aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-07-11 10:47:32 +0200
committerGitHub <noreply@github.com>2023-07-11 10:47:32 +0200
commit2e28181c5808edd76114ff035de99bd4b1ed0e40 (patch)
tree673aea28adf20fc6112b48d80d49a6a30979f969 /src/main
parent635d6cee39cf710286364c47d3419bd6e923a513 (diff)
downloadskyhanni-2e28181c5808edd76114ff035de99bd4b1ed0e40.tar.gz
skyhanni-2e28181c5808edd76114ff035de99bd4b1ed0e40.tar.bz2
skyhanni-2e28181c5808edd76114ff035de99bd4b1ed0e40.zip
Merge pull request #306
* added burger buff to price * removed burger buff line * added cute burger icon * forgot cute icon if size is 1 * config name * Code cleanup * Code cleanup * Code cleanup
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/ShowMotesNpcSellPrice.kt27
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
}