diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-12 04:21:20 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-12-12 04:21:20 +0100 |
commit | 35e13552257e07ef13ef0aaf059156a175f55340 (patch) | |
tree | 9bd56c938d7a22d63be7524eac3f200d80c9fd57 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 232c3cfc2074480976d39ca9d1f33cf7c7225a93 (diff) | |
download | skyhanni-35e13552257e07ef13ef0aaf059156a175f55340.tar.gz skyhanni-35e13552257e07ef13ef0aaf059156a175f55340.tar.bz2 skyhanni-35e13552257e07ef13ef0aaf059156a175f55340.zip |
Not only Slayer, also Fishing and Diana items will now show in chat & title when over a custom defined price.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index 1f6631a3a..78391a069 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -12,7 +12,6 @@ import at.hannibal2.skyhanni.events.PurseChangeEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent -import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.NEUInternalName @@ -26,14 +25,12 @@ import com.google.gson.JsonObject import com.google.gson.JsonPrimitive import com.google.gson.annotations.Expose import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import kotlin.time.Duration.Companion.seconds object SlayerProfitTracker { private val config get() = SkyHanniMod.feature.slayer.itemProfitTracker private var itemLogCategory = "" private var baseSlayerType = "" - private val logger = LorenzLogger("slayer/profit_tracker") private val trackers = mutableMapOf<String, SkyHanniItemTracker<Data>>() class Data : ItemTrackerData() { @@ -89,11 +86,9 @@ object SlayerProfitTracker { if (!isEnabled()) return val coins = event.coins if (event.reason == PurseChangeCause.GAIN_MOB_KILL && SlayerAPI.isInCorrectArea) { - logger.log("Coins gained for killing mobs: ${coins.addSeparators()}") - addMobKillCoins(coins.toInt()) + getTracker()?.addCoins(coins.toInt()) } if (event.reason == PurseChangeCause.LOSE_SLAYER_QUEST_STARTED) { - logger.log("Coins paid for starting slayer quest: ${coins.addSeparators()}") addSlayerCosts(coins.toInt()) } } @@ -106,14 +101,6 @@ object SlayerProfitTracker { getTracker()?.update() } - private fun addMobKillCoins(coins: Int) { - getTracker()?.addCoins(coins) - } - - private fun addItemPickup(internalName: NEUInternalName, stackSize: Int) { - getTracker()?.addItem(internalName, stackSize) - } - private fun getTracker(): SkyHanniItemTracker<Data>? { if (itemLogCategory == "") return null @@ -148,15 +135,7 @@ object SlayerProfitTracker { return } - val (itemName, price) = SlayerAPI.getItemNameAndPrice(internalName, amount) - addItemPickup(internalName, amount) - logger.log("Coins gained for picking up an item ($itemName) ${price.addSeparators()}") - if (config.priceInChat && price > config.minimumPrice) { - LorenzUtils.chat("§a+Slayer Drop§7: §r$itemName") - } - if (config.titleWarning && price > config.minimumPriceWarning) { - LorenzUtils.sendTitle("§a+ $itemName", 5.seconds) - } + getTracker()?.addItem(internalName, amount) } private fun isAllowedItem(internalName: NEUInternalName): Boolean { |