From fd21e3c6f7c40f92972f594b2724950e036986a9 Mon Sep 17 00:00:00 2001 From: HiZe_ Date: Fri, 9 Jun 2023 23:22:16 +0200 Subject: Restore Bought Piece Of Wizard Portal Lore (#225) --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 1 + .../hannibal2/skyhanni/config/features/Misc.java | 5 +++++ .../misc/RestorePieceOfWizardPortalLore.kt | 24 ++++++++++++++++++++++ .../skyhanni/utils/SkyBlockItemModifierUtils.kt | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index b4a9ebe75..9cdb71fa5 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -295,6 +295,7 @@ class SkyHanniMod { loadModule(SlayerItemProfitTracker()) loadModule(SlayerItemsOnGround()) loadModule(DetectBrokenHyperion()) + loadModule(RestorePieceOfWizardPortalLore()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 73ef39593..fbb623f44 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -507,6 +507,11 @@ public class Misc { @ConfigEditorBoolean public boolean configButtonOnPause = true; + @Expose + @ConfigOption(name = "Piece Of Wizard Portal", desc = "Restore the Earned By lore line on bought Piece Of Wizard Portal.") + @ConfigEditorBoolean + public boolean restorePieceOfWizardPortalLore = true; + @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt new file mode 100644 index 000000000..01810d729 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/RestorePieceOfWizardPortalLore.kt @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRecipientName +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RestorePieceOfWizardPortalLore { + + private val config get() = SkyHanniMod.feature.misc + + @SubscribeEvent + fun onTooltip(event: LorenzToolTipEvent) { + if (!config.restorePieceOfWizardPortalLore) return + val stack = event.itemStack + if (stack.getInternalName() != "WIZARD_PORTAL_MEMENTO") return + val recipient = stack.getRecipientName() + if (!event.toolTip[5].contains(recipient!!)) { + event.toolTip.add(5, "ยง7Earned by: $recipient") + } + } + +} \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt index 19177aaa5..cd0d33f96 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt @@ -153,6 +153,8 @@ object SkyBlockItemModifierUtils { return data.sackInASack } + fun ItemStack.getRecipientName() = getAttributeString("recipient_name") + fun ItemStack.getGemstones() = getExtraAttributes()?.let { val list = mutableListOf() for (attributes in it.keySet) { -- cgit