aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt27
1 files changed, 22 insertions, 5 deletions
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
}