From 279127f1e23d66ed7e9b2bf63c81b1100f09c0ff Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 28 Aug 2023 20:12:44 +0200 Subject: added npc price display as debug option --- .../skyhanni/config/features/DevConfig.java | 6 ++++++ .../hannibal2/skyhanni/test/SkyHanniTestCommand.kt | 25 ++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index f7ee9f765..751e48a1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -46,6 +46,12 @@ public class DevConfig { @ConfigAccordionId(id = 0) public boolean showInternalName = false; + @Expose + @ConfigOption(name = "Show NPC Price", desc = "Show NPC price in item lore.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean showNpcPrice = false; + @Expose @ConfigOption(name = "Show empty internal names", desc = "Shows internal name even for items with none.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt index 684a1a97d..8cbc28855 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniTestCommand.kt @@ -10,6 +10,9 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonData import at.hannibal2.skyhanni.features.garden.visitor.GardenVisitorColorNames import at.hannibal2.skyhanni.utils.* import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull +import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import net.minecraft.nbt.NBTTagCompound @@ -224,14 +227,22 @@ class SkyHanniTestCommand { } @SubscribeEvent - fun onItemTooltipLow(event: ItemTooltipEvent) { + fun onShowInternalName(event: ItemTooltipEvent) { if (!SkyHanniMod.feature.dev.showInternalName) return - val itemStack = event.itemStack - if (itemStack != null) { - val internalName = itemStack.getInternalName() - if ((internalName == NEUInternalName.NONE) && !SkyHanniMod.feature.dev.showEmptyNames) return - event.toolTip.add("Internal Name: '${internalName.asString()}'") - } + val itemStack = event.itemStack ?: return + val internalName = itemStack.getInternalName() + if ((internalName == NEUInternalName.NONE) && !SkyHanniMod.feature.dev.showEmptyNames) return + event.toolTip.add("Internal Name: '${internalName.asString()}'") + } + + @SubscribeEvent + fun onSHowNpcPrice(event: ItemTooltipEvent) { + if (!SkyHanniMod.feature.dev.showNpcPrice) return + val itemStack = event.itemStack ?: return + val internalName = itemStack.getInternalNameOrNull() ?: return + + val npcPrice = internalName.getNpcPriceOrNull() ?: return + event.toolTip.add("§7Npc price: §6${npcPrice.addSeparators()}") } @SubscribeEvent -- cgit