aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/dictionaries/default_user.xml1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/combat/end/EndIslandConfig.java14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/DraconicSacrificeTrackerConfig.java27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/DraconicSacrificeTracker.kt151
7 files changed, 207 insertions, 4 deletions
diff --git a/.idea/dictionaries/default_user.xml b/.idea/dictionaries/default_user.xml
index 32875a5fb..fc3066750 100644
--- a/.idea/dictionaries/default_user.xml
+++ b/.idea/dictionaries/default_user.xml
@@ -63,6 +63,7 @@
<w>dicer</w>
<w>disintegrator</w>
<w>disintegrators</w>
+ <w>draconic</w>
<w>dragontail</w>
<w>dreadfarm</w>
<w>dreadlord</w>
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index fe245eca7..d701e745b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -208,7 +208,7 @@ object Commands {
event.register("shcopytranslation") {
description =
"Copy the translation of a message in another language to your clipboard.\n" +
- "Uses a 2 letter language code that can be found at the end of a translation message."
+ "Uses a 2 letter language code that can be found at the end of a translation message."
category = CommandCategory.USERS_ACTIVE
callback { Translator.fromNativeLanguage(it) }
}
@@ -590,7 +590,7 @@ object Commands {
event.register("shdebugscoreboard") {
description =
"Monitors the scoreboard changes: " +
- "Prints the raw scoreboard lines in the console after each update, with time since last update."
+ "Prints the raw scoreboard lines in the console after each update, with time since last update."
category = CommandCategory.DEVELOPER_DEBUG
callback { ScoreboardData.toggleMonitor() }
}
@@ -746,8 +746,8 @@ object Commands {
event.register("shresetconfig") {
description =
"Reloads the config manager and rendering processors of MoulConfig. " +
- "This §cWILL RESET §7your config, but also updating the java config files " +
- "(names, description, orderings and stuff)."
+ "This §cWILL RESET §7your config, but also updating the java config files " +
+ "(names, description, orderings and stuff)."
category = CommandCategory.DEVELOPER_TEST
callback { SkyHanniDebugsAndTests.resetConfigCommand() }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
index 7042b2fdb..b951a4175 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
@@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.config.features.combat;
import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.features.combat.broodmother.BroodmotherConfig;
import at.hannibal2.skyhanni.config.features.combat.damageindicator.DamageIndicatorConfig;
+import at.hannibal2.skyhanni.config.features.combat.end.EndIslandConfig;
import at.hannibal2.skyhanni.config.features.combat.ghostcounter.GhostCounterConfig;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
@@ -21,6 +22,10 @@ public class CombatConfig {
public GhostCounterConfig ghostCounter = new GhostCounterConfig();
@Expose
+ @Category(name = "End Island", desc = "Features for the End Island")
+ public EndIslandConfig endIsland = new EndIslandConfig();
+
+ @Expose
@ConfigOption(name = "Quiver", desc = "")
@Accordion
public QuiverConfig quiverConfig = new QuiverConfig();
@@ -49,6 +54,7 @@ public class CombatConfig {
@Expose
@ConfigOption(name = "Ender Node Tracker", desc = "")
@Accordion
+ // TODO move into end island config
public EnderNodeConfig enderNodeTracker = new EnderNodeConfig();
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/end/EndIslandConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/end/EndIslandConfig.java
new file mode 100644
index 000000000..693a38be8
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/end/EndIslandConfig.java
@@ -0,0 +1,14 @@
+package at.hannibal2.skyhanni.config.features.combat.end;
+
+import at.hannibal2.skyhanni.config.features.misc.DraconicSacrificeTrackerConfig;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.Accordion;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class EndIslandConfig {
+
+ @Expose
+ @ConfigOption(name = "Draconic Sacrifice Tracker", desc = "")
+ @Accordion
+ public DraconicSacrificeTrackerConfig draconicSacrificeTracker = new DraconicSacrificeTrackerConfig();
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/DraconicSacrificeTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DraconicSacrificeTrackerConfig.java
new file mode 100644
index 000000000..54d70fb5b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/DraconicSacrificeTrackerConfig.java
@@ -0,0 +1,27 @@
+package at.hannibal2.skyhanni.config.features.misc;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import at.hannibal2.skyhanni.config.core.config.Position;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class DraconicSacrificeTrackerConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Track items/profit while using the Draconic Altar in the End.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = true;
+
+ @Expose
+ @ConfigOption(name = "Only In Void Slate", desc = "Show the tracker only when inside the Void Slate area.")
+ @ConfigEditorBoolean
+ public boolean onlyInVoidSlate = true;
+
+ @Expose
+ @ConfigLink(owner = DraconicSacrificeTrackerConfig.class, field = "enabled")
+ public Position position = new Position(201, 199, false, true);
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
index 4ad2c8eb3..5a5e884e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/storage/ProfileSpecificStorage.java
@@ -38,6 +38,7 @@ import at.hannibal2.skyhanni.features.mining.MineshaftPityDisplay;
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker;
import at.hannibal2.skyhanni.features.mining.glacitemineshaft.CorpseTracker;
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker;
+import at.hannibal2.skyhanni.features.misc.DraconicSacrificeTracker;
import at.hannibal2.skyhanni.features.misc.trevor.TrevorTracker;
import at.hannibal2.skyhanni.features.rift.area.westvillage.VerminTracker;
import at.hannibal2.skyhanni.features.rift.area.westvillage.kloon.KloonTerminal;
@@ -725,6 +726,9 @@ public class ProfileSpecificStorage {
}
@Expose
+ public DraconicSacrificeTracker.Data draconicSacrificeTracker = new DraconicSacrificeTracker.Data();
+
+ @Expose
public UpgradeReminder.CommunityShopUpgrade communityShopProfileUpgrade = null;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/DraconicSacrificeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/DraconicSacrificeTracker.kt
new file mode 100644
index 000000000..61fff44ff
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/DraconicSacrificeTracker.kt
@@ -0,0 +1,151 @@
+package at.hannibal2.skyhanni.features.misc
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.api.event.HandleEvent
+import at.hannibal2.skyhanni.config.commands.CommandCategory
+import at.hannibal2.skyhanni.config.commands.CommandRegistrationEvent
+import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzChatEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
+import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut
+import at.hannibal2.skyhanni.utils.CollectionUtils.addSearchString
+import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
+import at.hannibal2.skyhanni.utils.NEUInternalName
+import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
+import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
+import at.hannibal2.skyhanni.utils.renderables.Renderable
+import at.hannibal2.skyhanni.utils.renderables.Searchable
+import at.hannibal2.skyhanni.utils.renderables.toSearchable
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData
+import at.hannibal2.skyhanni.utils.tracker.SkyHanniItemTracker
+import com.google.gson.annotations.Expose
+import net.minecraft.util.AxisAlignedBB
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+@SkyHanniModule
+object DraconicSacrificeTracker {
+
+ private val config get() = SkyHanniMod.feature.combat.endIsland.draconicSacrificeTracker
+ private val patternGroup = RepoPattern.group("misc.draconicsacrifice")
+
+ /**
+ * REGEX-TEST: §c§lSACRIFICE! §r§eYou turned §r§5Ender Boots §r§einto §r§d3 Dragon Essence§r§e!
+ * REGEX-TEST: §c§lSACRIFICE! §r§eYou turned §r§5Ender Helmet §r§einto §r§d3 Dragon Essence§r§e!
+ * REGEX-TEST: §c§lSACRIFICE! §r§eYou turned §r§6Old Dragon Helmet §r§einto §r§d25 Dragon Essence§r§e!
+ * REGEX-TEST: §c§lSACRIFICE! §r§eYou turned §r§6Wise Dragon Helmet §r§einto §r§d25 Dragon Essence§r§e!
+ */
+ private val sacrificeLoot by patternGroup.pattern(
+ "sacrifice",
+ "§c§lSACRIFICE! §r§eYou turned §r(?<item>.*) §r§einto §r§d(?<amount>\\d+) Dragon Essence§r§e!",
+ )
+
+ /**
+ * REGEX-TEST: §c§lBONUS LOOT! §r§eYou also received §r§817x §r§5Wise Dragon Fragment §r§efrom your sacrifice!
+ */
+ private val bonusLoot by patternGroup.pattern(
+ "bonus",
+ "§c§lBONUS LOOT! §r§eYou also received §r(?:§\\w(?<amount>\\d+)?x)?(?: §r)?(?<item>.*) §r§efrom your sacrifice!",
+ )
+
+ private val tracker =
+ SkyHanniItemTracker("Draconic Sacrifice Profit Tracker", { Data() }, { it.draconicSacrificeTracker }) {
+ drawDisplay(it)
+ }
+
+ private val altarArea = AxisAlignedBB(-601.0, 4.0, -282.0, -586.0, 15.0, -269.0)
+ private val ESSENCE_DRAGON = "ESSENCE_DRAGON".asInternalName()
+
+ class Data : ItemTrackerData() {
+ override fun resetItems() {
+ sacrificedItemsMap.clear()
+ itemsSacrificed = 0
+ }
+
+ override fun getDescription(timesGained: Long): List<String> {
+ val percentage = timesGained.toDouble() / itemsSacrificed
+ val dropRate = LorenzUtils.formatPercentage(percentage.coerceAtMost(1.0))
+ return listOf(
+ "§7Dropped §e${timesGained.addSeparators()} §7times.",
+ "§7Your drop rate: §c$dropRate.",
+ )
+ }
+
+ override fun getCoinName(item: TrackedItem) = "§dDragon Essence"
+
+ override fun getCoinDescription(item: TrackedItem): List<String> {
+ val essences = item.totalAmount.addSeparators()
+ return listOf(
+ "§7Sacrificed items give you dragon essence.",
+ "§7You got §6$essences essence §7that way.",
+ )
+ }
+
+ @Expose
+ var itemsSacrificed = 0L
+
+ @Expose
+ var sacrificedItemsMap: MutableMap<String, Long> = mutableMapOf()
+ }
+
+ private fun drawDisplay(data: Data): List<Searchable> = buildList {
+ addSearchString("§5§lDraconic Sacrifice Profit Tracker")
+ val profit = tracker.drawItems(data, { true }, this)
+
+ add(
+ Renderable.hoverTips(
+ "§b${data.itemsSacrificed.addSeparators()} §6Items Sacrificed",
+ data.sacrificedItemsMap.map { (item, amount) -> "$item: §b$amount" },
+ ).toSearchable()
+ )
+
+ add(tracker.addTotalProfit(profit, data.itemsSacrificed, "sacrifice"))
+
+ tracker.addPriceFromButton(this)
+ }
+
+ @SubscribeEvent
+ fun onChat(event: LorenzChatEvent) {
+ sacrificeLoot.matchMatcher(event.message) {
+ val amount = group("amount").toInt()
+ val item = group("item")
+ tracker.addItem(ESSENCE_DRAGON, amount, command = false)
+ tracker.modify {
+ it.itemsSacrificed += 1
+ it.sacrificedItemsMap.addOrPut(item, 1)
+ }
+ }
+
+ bonusLoot.matchMatcher(event.message) {
+ val item = group("item")
+ val amount = groupOrNull("amount")?.toInt() ?: 1
+ val internalName = NEUInternalName.fromItemNameOrNull(item) ?: return
+ tracker.addItem(internalName, amount, command = false)
+ }
+ tracker.update()
+ }
+
+ @SubscribeEvent
+ fun onRender(event: GuiRenderEvent) {
+ if (!isEnabled()) return
+ if (config.onlyInVoidSlate && !altarArea.isPlayerInside()) return
+
+ tracker.renderDisplay(config.position)
+ }
+
+ @HandleEvent
+ fun onCommandRegistration(event: CommandRegistrationEvent) {
+ event.register("shresetdraconicsacrificetracker") {
+ description = "Resets the Draconic Sacrifice Tracker."
+ category = CommandCategory.USERS_RESET
+ callback { tracker.resetCommand() }
+ }
+ }
+
+ private fun isEnabled() = IslandType.THE_END.isInIsland() && config.enabled
+}