aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-25 04:15:16 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-25 04:15:16 +0100
commit7f86047e7f5565deab278ad2866a6d753c1816a0 (patch)
tree688854a3a7b69cd419bee689146daf9a6117d7ff /src/main
parent0ee3f2095cabddbf85016e3a5eee9cee4435d16b (diff)
downloadskyhanni-7f86047e7f5565deab278ad2866a6d753c1816a0.tar.gz
skyhanni-7f86047e7f5565deab278ad2866a6d753c1816a0.tar.bz2
skyhanni-7f86047e7f5565deab278ad2866a6d753c1816a0.zip
made coin name and coin description independent functions
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt20
4 files changed, 22 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
index d5433c9bf..e6f2a9a92 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt
@@ -52,15 +52,13 @@ object FishingProfitTracker {
)
}
- override fun getCoinFormat(item: TrackedItem, numberColor: String): Pair<String, List<String>> {
+ override fun getCoinName(item: TrackedItem) = "§6Fished Coins"
+
+ override fun getCoinDescription(item: TrackedItem): List<String> {
val mobKillCoinsFormat = NumberUtil.format(item.totalAmount)
- val gained = item.timesGained
- val text = " $numberColor${gained}x §6Fished Coins§7: §6$mobKillCoinsFormat"
- val lore = listOf(
- "§7Killing mobs gives you coins (more with scavenger)",
- "§7You got §e$mobKillCoinsFormat §7coins in total this way"
+ return listOf(
+ "§7You fished up §6$mobKillCoinsFormat coins §7already."
)
- return text to lore
}
override fun getCustomPricePer(internalName: NEUInternalName): Double {
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 3e69cfcca..7a49e4ddd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
@@ -58,15 +58,14 @@ object SlayerProfitTracker {
)
}
- override fun getCoinFormat(item: TrackedItem, numberColor: String): Pair<String, List<String>> {
+ override fun getCoinName(item: TrackedItem) = "§6Mob Kill Coins"
+
+ override fun getCoinDescription(item: TrackedItem): List<String> {
val mobKillCoinsFormat = NumberUtil.format(item.totalAmount)
- val gained = item.timesGained
- val text = " $numberColor${gained}x §6Mob Kill Coins§7: §6$mobKillCoinsFormat"
- val lore = listOf(
- "§7Killing mobs gives you coins (more with scavenger)",
- "§7You got §6$mobKillCoinsFormat coins §7in total this way"
+ return listOf(
+ "§7Killing mobs gives you coins (more with scavenger).",
+ "§7You got §6$mobKillCoinsFormat coins §7way."
)
- return text to lore
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt
index d515dd401..7aa2cf4f9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/ItemTrackerData.kt
@@ -13,7 +13,9 @@ abstract class ItemTrackerData : TrackerData() {
abstract fun getDescription(timesGained: Long): List<String>
- abstract fun getCoinFormat(item: TrackedItem, numberColor: String): Pair<String, List<String>>
+ abstract fun getCoinName(item: TrackedItem): String
+
+ abstract fun getCoinDescription(item: TrackedItem): List<String>
open fun getCustomPricePer(internalName: NEUInternalName) = SkyHanniTracker.getPricePer(internalName)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
index c84ab239a..dc3398620 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt
@@ -70,8 +70,8 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
val price = (pricePer * amount).toLong()
val displayAmount = if (internalName == SKYBLOCK_COIN) itemProfit.timesGained else amount
- var name = if (internalName == SKYBLOCK_COIN) {
- "§6Coins"
+ val cleanName = if (internalName == SKYBLOCK_COIN) {
+ data.getCoinName(itemProfit)
} else {
internalName.getItemStack().nameWithEnchantment ?: error("no name for $internalName")
}
@@ -80,9 +80,6 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
val hidden = itemProfit.hidden
val newDrop = itemProfit.lastTimeUpdated.passedSince() < 10.seconds && config.showRecentDrops
val numberColor = if (newDrop) "§a§l" else "§7"
- if (hidden) {
- name = "§8§m" + name.removeColor(keepFormatting = true).replace("§r", "")
- }
val text = " $numberColor${displayAmount.addSeparators()}x $name§7: §6$priceFormat"
val (displayName, lore) = if (internalName == SKYBLOCK_COIN) {
@@ -93,12 +90,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
if (System.currentTimeMillis() > lastClickDelay + 150) {
if (KeyboardManager.isControlKeyDown()) {
data.items.remove(internalName)
- val abc = if (internalName == SKYBLOCK_COIN) {
- "§6Coins"
- } else {
- internalName.getItemStack().nameWithEnchantment
- }
- LorenzUtils.chat("§e[SkyHanni] Removed $abc §efrom Fishing Frofit Tracker.")
+ LorenzUtils.chat("§e[SkyHanni] Removed $cleanName §efrom Fishing Frofit Tracker.")
lastClickDelay = System.currentTimeMillis() + 500
} else {
itemProfit.hidden = !hidden
@@ -126,7 +118,11 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
hidden: Boolean,
newDrop: Boolean
) = buildList {
- addAll(data.getDescription(item.timesGained))
+ if (internalName == SKYBLOCK_COIN) {
+ addAll(data.getCoinDescription(item))
+ } else {
+ addAll(data.getDescription(item.timesGained))
+ }
add("")
if (newDrop) {
add("§aYou caught this item recently.")