diff options
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java | 19 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt | 27 |
2 files changed, 38 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 62f551490..0ab3b06f2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -509,7 +509,20 @@ public class RiftConfig { public boolean highlightGuide = true; @Expose - @ConfigOption(name = "Show Motes Price", desc = "Show the Motes NPC price in the item lore.") - @ConfigEditorBoolean - public boolean showMotesPrice = true; + @ConfigOption(name = "Motes Sell Price", desc = "") + @Accordion + public Motes motes = new Motes(); + + public static class Motes { + + @Expose + @ConfigOption(name = "Show Motes Price", desc = "Show the Motes NPC price in the item lore.") + @ConfigEditorBoolean + public boolean showPrice = true; + + @Expose + @ConfigOption(name = "Burger Stacks", desc = "Set your McGrubber's burger stacks.") + @ConfigEditorSlider(minStep = 1, minValue = 0, maxValue = 5) + public int burgerStacks = 0; + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt index 2de528b7f..c4c7b2786 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt @@ -1,12 +1,17 @@ package at.hannibal2.skyhanni.features.rift +import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI.motesNpcPrice +import at.hannibal2.skyhanni.utils.LorenzUtils.chat import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ShowMotesNpcSellPrice { + private val config get() = RiftAPI.config.motes + private val pattern = ".*(?:§\\w)+You have (?:§\\w)+(?<amount>\\d) Grubber Stacks.*".toPattern() @SubscribeEvent fun onItemTooltipLow(event: ItemTooltipEvent) { @@ -14,15 +19,27 @@ class ShowMotesNpcSellPrice { val itemStack = event.itemStack ?: return - val motesPerItem = itemStack.motesNpcPrice() ?: return + val baseMotes = itemStack.motesNpcPrice() ?: return + val burgerStacks = config.burgerStacks + val motesPerItem = baseMotes + (burgerStacks * 5) * baseMotes / 100 + val burgerText = if (burgerStacks > 0) "(${burgerStacks}x≡) " else "" val size = itemStack.stackSize if (size > 1) { - val motes = motesPerItem * size - event.toolTip.add("§6NPC price: §d${motes.addSeparators()} Motes §7($size x §d${motesPerItem.addSeparators()} Motes§7)") + val motes = motesPerItem * size + event.toolTip.add("§6NPC price: $burgerText§d${motes.addSeparators()} Motes §7($size x §d${motesPerItem.addSeparators()} Motes§7)") } else { - event.toolTip.add("§6NPC price: §d${motesPerItem.addSeparators()} Motes") + event.toolTip.add("§6NPC price: $burgerText§d${motesPerItem.addSeparators()} Motes") } } - fun isEnabled() = RiftAPI.inRift() && RiftAPI.config.showMotesPrice + @SubscribeEvent + fun onChat(event: LorenzChatEvent) { + if (!RiftAPI.inRift()) return + pattern.matchMatcher(event.message) { + config.burgerStacks = group("amount").toInt() + chat("§6[SkyHanni] Set your McGrubber's burger stacks to ${group("amount")}.") + } + } + + fun isEnabled() = RiftAPI.inRift() && config.showPrice } |