From 12f7f03344decf77d96997bf2d4898c6b978bb3c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Thu, 18 Apr 2024 13:32:40 +0200 Subject: Add kistmet reroll tracker --- .../java/moe/nea/ledger/DungeonChestDetection.kt | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/moe/nea/ledger/DungeonChestDetection.kt b/src/main/java/moe/nea/ledger/DungeonChestDetection.kt index 1cdc2d9..2418354 100644 --- a/src/main/java/moe/nea/ledger/DungeonChestDetection.kt +++ b/src/main/java/moe/nea/ledger/DungeonChestDetection.kt @@ -17,7 +17,24 @@ class DungeonChestDetection(val logger: LedgerLogger) { } }, Damage: 0s - }*/ + } + + { + id: "minecraft:feather", + Count: 1b, + tag: { + overrideMeta: 1b, + ench: [], + HideFlags: 254, + display: { + Lore: ["§7Consume a §9Kismet Feather §7to reroll", "§7the loot within this chest.", "", "§7You may only use a feather once", "§7per dungeon run.", "", "§eClick to reroll this chest!"], + Name: "§aReroll Chest" + }, + AttributeModifiers: [] + }, + Damage: 0s +} + */ val costPattern = Pattern.compile("(?$SHORT_NUMBER_PATTERN) Coins") @@ -30,7 +47,25 @@ class DungeonChestDetection(val logger: LedgerLogger) { var lastOpenedChest: ChestCost? = null @SubscribeEvent - fun onSlotClick(event: GuiClickEvent) { + fun onKismetClick(event: GuiClickEvent) { + val slot = event.slotIn ?: return + if (!slot.inventory.displayName.unformattedText.unformattedString().endsWith(" Chest")) return + val stack = slot.stack ?: return + if (stack.getDisplayNameU() == "§aReroll Chest") { + logger.logEntry( + LedgerEntry( + "KISMET_REROLL", + Instant.now(), + 0.0, + itemId = "KISMET_FEATHER", + itemAmount = 1 + ) + ) + } + } + + @SubscribeEvent + fun onRewardChestClick(event: GuiClickEvent) { val slot = event.slotIn ?: return if (!slot.inventory.displayName.unformattedText.unformattedString().endsWith(" Chest")) return val stack = slot.stack ?: return -- cgit