diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-18 14:44:06 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-18 14:44:06 +0100 |
commit | f4831bff1bf50570898b0d07524d6d605d958283 (patch) | |
tree | 48d089f52377f2561b3e6c134d82d36419ce094f | |
parent | c7a7f70a22f22b80fa9c12619891592e5a83e7dc (diff) | |
download | skyhanni-f4831bff1bf50570898b0d07524d6d605d958283.tar.gz skyhanni-f4831bff1bf50570898b0d07524d6d605d958283.tar.bz2 skyhanni-f4831bff1bf50570898b0d07524d6d605d958283.zip |
Fixed dice roll profit counting as Mob Kill Coins in Slayer Tracker.
3 files changed, 18 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index cb3b21031..0deb53164 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PurseChangeCause import at.hannibal2.skyhanni.events.PurseChangeEvent import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.NumberUtil.milion import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -41,12 +42,16 @@ class PurseAPI { if (diff == 1.0) { return PurseChangeCause.GAIN_TALISMAN_OF_COINS } + + if (diff == 15.milion || diff == 100.milion) { + return PurseChangeCause.GAIN_DICE_ROLL + } + if (Minecraft.getMinecraft().currentScreen == null) { val timeDiff = System.currentTimeMillis() - inventoryCloseTime if (timeDiff > 2_000) { return PurseChangeCause.GAIN_MOB_KILL } - } return PurseChangeCause.GAIN_UNKNOWN } else { @@ -55,7 +60,11 @@ class PurseAPI { return PurseChangeCause.LOSE_SLAYER_QUEST_STARTED } + if (diff == -6_666_666.0 || diff == -666_666.0) { + return PurseChangeCause.LOSE_DICE_ROLL_COST + } + return PurseChangeCause.LOSE_UNKNOWN } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt index 50343a7d9..d776fe32b 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/PurseChangeEvent.kt @@ -5,8 +5,10 @@ class PurseChangeEvent(val coins: Double, val reason: PurseChangeCause) : Lorenz enum class PurseChangeCause { GAIN_MOB_KILL, GAIN_TALISMAN_OF_COINS, + GAIN_DICE_ROLL, GAIN_UNKNOWN, LOSE_SLAYER_QUEST_STARTED, + LOSE_DICE_ROLL_COST, LOSE_UNKNOWN, -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index 3ad9e2da7..707bb5b4d 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -201,4 +201,7 @@ object NumberUtil { val d = text.toDouble() return (d * multiplier).toLong() } -}
\ No newline at end of file + + val Int.milion get() = this * 1_000_000.0 + val Double.milion get() = (this * 1_000_000.0).toLong() +} |