aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiningConfig.java82
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt55
2 files changed, 56 insertions, 81 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiningConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiningConfig.java
index 198f8d1d0..840096cac 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiningConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiningConfig.java
@@ -40,49 +40,49 @@ public class MiningConfig {
@Expose
@ConfigOption(
- name = "Text Format",
- desc = "Drag text to change the appearance of the overlay."
+ name = "Text Format",
+ desc = "Drag text to change the appearance of the overlay."
)
@ConfigEditorDraggableList(
- exampleText = {
- "§b§lPowder Tracker",
- "§7Display Mode: §a[Total] §e[This Session]",
- "§d852 Total chests Picked §7(950/h)",
- "§bx2 Powder: §aActive!",
- "§b250,420 §aMithril Powder §7(350,000/h)",
- "§b250,420 §dGemstone Powder §7(350,000/h)",
- "",
- "§b129 §bDiamond Essence §7(600/h)",
- "§b234 §6Gold Essence §7(700/h)",
- "",
- "§50§7-§90§7-§a0§f-0 §cRuby Gemstone",
- "§50§7-§90§7-§a0§f-0 §bSapphire Gemstone",
- "§50§7-§90§7-§a0§f-0 §6Amber Gemstone",
- "§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone",
- "§50§7-§90§7-§a0§f-0 §aJade Gemstone",
- "§50§7-§90§7-§a0§f-0 §eTopaz Gemstone",
-
- "§b14 §9FTX 3070",
- "§b14 §9Electron Transmitter",
- "§b14 §9Robotron Reflector",
- "§b14 §9Superlite Motor",
- "§b14 §9Control Switch",
- "§b14 §9Synthetic Heart",
- "§b14 §9Total Robot Parts",
-
- "§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg",
-
- "§b12 §aWishing Compass",
-
- "§b320 §aSludge Juice",
- "§b2 §9Ascension Rope",
- "§b6 §5Treasurite",
- "§b4 §6Jungle Heart",
- "§b1 §5Pickonimbus 2000",
- "§b14 §aYoggie",
- "§b9 §fPrehistoric Egg",
- "§b25 §aOil Barrel"
- }
+ exampleText = {
+ "§b§lPowder Tracker",
+ "§7Display Mode: §a[Total] §e[This Session]",
+ "§d852 Total chests Picked §7(950/h)",
+ "§bx2 Powder: §aActive!",
+ "§b250,420 §aMithril Powder §7(350,000/h)",
+ "§b250,420 §dGemstone Powder §7(350,000/h)",
+ "",
+ "§b129 §bDiamond Essence §7(600/h)",
+ "§b234 §6Gold Essence §7(700/h)",
+ "",
+ "§50§7-§90§7-§a0§f-0 §cRuby Gemstone",
+ "§50§7-§90§7-§a0§f-0 §bSapphire Gemstone",
+ "§50§7-§90§7-§a0§f-0 §6Amber Gemstone",
+ "§50§7-§90§7-§a0§f-0 §5Amethyst Gemstone",
+ "§50§7-§90§7-§a0§f-0 §aJade Gemstone",
+ "§50§7-§90§7-§a0§f-0 §eTopaz Gemstone",
+
+ "§b14 §9FTX 3070",
+ "§b14 §9Electron Transmitter",
+ "§b14 §9Robotron Reflector",
+ "§b14 §9Superlite Motor",
+ "§b14 §9Control Switch",
+ "§b14 §9Synthetic Heart",
+ "§b14 §9Total Robot Parts",
+
+ "§90§7-§a0§7-§c0§f-§e0§f-§30 §fGoblin Egg",
+
+ "§b12 §aWishing Compass",
+
+ "§b320 §aSludge Juice",
+ "§b2 §9Ascension Rope",
+ "§b6 §5Treasurite",
+ "§b4 §6Jungle Heart",
+ "§b1 §5Pickonimbus 2000",
+ "§b14 §aYoggie",
+ "§b9 §fPrehistoric Egg",
+ "§b25 §aOil Barrel"
+ }
)
public Property<List<Integer>> textFormat = Property.of(new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)));
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
index 6bace1ced..72949f93b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
@@ -174,10 +174,10 @@ class PowderTracker {
}
private fun saveAndUpdate() {
- calculateGemstone()
- calculateMithril()
- calculateDiamondEssence()
- calculateGoldEssence()
+ calculate(gemstoneInfo, PowderChestReward.GEMSTONE_POWDER)
+ calculate(mithrilInfo, PowderChestReward.MITHRIL_POWDER)
+ calculate(diamondEssenceInfo, PowderChestReward.DIAMOND_ESSENCE)
+ calculate(goldEssenceInfo, PowderChestReward.GOLD_ESSENCE)
calculateChest()
display = formatDisplay(drawDisplay())
}
@@ -191,7 +191,7 @@ class PowderTracker {
private fun drawDisplay() = buildList<List<Any>> {
addAsSingletonList("§b§lPowder Tracker")
- if (inventoryOpen){
+ if (inventoryOpen) {
addSelector<DisplayMode>(
"§7Display Mode: ",
getName = { type -> type.displayName },
@@ -201,7 +201,7 @@ class PowderTracker {
saveAndUpdate()
}
)
- }else{
+ } else {
addAsSingletonList("")
}
@@ -209,30 +209,31 @@ class PowderTracker {
val display = both.get(currentDisplayMode)
val rewards = display.rewards
- val chestPerHour = if (chestInfo.perHour < 0) 0 else chestInfo.perHour.toInt().addSeparators()
+ val chestPerHour = if (chestInfo.perHour < 0) "0" else chestInfo.perHour.toInt().addSeparators()
addAsSingletonList("§d${display.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)")
addAsSingletonList("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}")
val mithril = PowderChestReward.entries[0]
val mithrilCount = rewards.getOrDefault(mithril, 0).addSeparators()
- val mithrilPerHour = if (mithrilInfo.perHour < 0) 0 else mithrilInfo.perHour.toInt().addSeparators()
+ val mithrilPerHour = if (mithrilInfo.perHour < 0) "0" else mithrilInfo.perHour.toInt().addSeparators()
addAsSingletonList("§b$mithrilCount ${mithril.displayName} §7($mithrilPerHour/h)")
val gemstone = PowderChestReward.entries[1]
val gemstoneCount = rewards.getOrDefault(gemstone, 0).addSeparators()
- val gemstonePerHour = if (gemstoneInfo.perHour < 0) 0 else gemstoneInfo.perHour.toInt().addSeparators()
+ val gemstonePerHour = if (gemstoneInfo.perHour < 0) "0" else gemstoneInfo.perHour.toInt().addSeparators()
addAsSingletonList("§b$gemstoneCount ${gemstone.displayName} §7($gemstonePerHour/h)")
addAsSingletonList("")
val diamondEssence = PowderChestReward.entries[46]
val diamondEssenceCount = rewards.getOrDefault(diamondEssence, 0).addSeparators()
- val diamondEssencePerHour = if (diamondEssenceInfo.perHour < 0) 0 else diamondEssenceInfo.perHour.toInt().addSeparators()
+ val diamondEssencePerHour =
+ if (diamondEssenceInfo.perHour < 0) "0" else diamondEssenceInfo.perHour.toInt().addSeparators()
addAsSingletonList("§b$diamondEssenceCount ${diamondEssence.displayName} §7($diamondEssencePerHour/h)")
val goldEssence = PowderChestReward.entries[47]
val goldEssenceCount = rewards.getOrDefault(goldEssence, 0).addSeparators()
- val goldEssencePerHour = if (goldEssenceInfo.perHour < 0) 0 else goldEssenceInfo.perHour.toInt().addSeparators()
+ val goldEssencePerHour = if (goldEssenceInfo.perHour < 0) "0" else goldEssenceInfo.perHour.toInt().addSeparators()
addAsSingletonList("§b$goldEssenceCount ${goldEssence.displayName} §7($goldEssencePerHour/h)")
@@ -278,7 +279,6 @@ class PowderTracker {
addAsSingletonList("§b$count ${reward.displayName}")
}
-
}
private fun calculateResourceHour(resourceInfo: ResourceInfo) {
@@ -305,36 +305,12 @@ class PowderTracker {
resourceInfo.stoppedChecks = 0
}
- private fun calculateGemstone() {
+ private fun calculate(info: ResourceInfo, reward: PowderChestReward) {
val both = currentLog() ?: return
val display = both.get(currentDisplayMode)
val rewards = display.rewards
- gemstoneInfo.estimated = 0
- gemstoneInfo.estimated += rewards.getOrDefault(PowderChestReward.GEMSTONE_POWDER, 0)
- }
-
- private fun calculateMithril() {
- val both = currentLog() ?: return
- val display = both.get(currentDisplayMode)
- val rewards = display.rewards
- mithrilInfo.estimated = 0
- mithrilInfo.estimated += rewards.getOrDefault(PowderChestReward.MITHRIL_POWDER, 0)
- }
-
- private fun calculateDiamondEssence(){
- val both = currentLog() ?: return
- val display = both.get(currentDisplayMode)
- val rewards = display.rewards
- diamondEssenceInfo.estimated = 0
- diamondEssenceInfo.estimated += rewards.getOrDefault(PowderChestReward.DIAMOND_ESSENCE, 0)
- }
-
- private fun calculateGoldEssence(){
- val both = currentLog() ?: return
- val display = both.get(currentDisplayMode)
- val rewards = display.rewards
- goldEssenceInfo.estimated = 0
- goldEssenceInfo.estimated += rewards.getOrDefault(PowderChestReward.GOLD_ESSENCE, 0)
+ info.estimated = 0
+ info.estimated += rewards.getOrDefault(reward, 0)
}
private fun calculateChest() {
@@ -377,7 +353,6 @@ class PowderTracker {
;
}
-
private fun currentLog(): AbstractPowderTracker? {
val profileSpecific = ProfileStorageData.profileSpecific ?: return null