Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: J10a1n15 <[email protected]>
  • Loading branch information
j10a1n15 committed Oct 3, 2024
1 parent ab7b326 commit 5d08243
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {

val logger = LorenzLogger("ConfigMigration")
const val CONFIG_VERSION = 60
const val CONFIG_VERSION = 61
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.GOLD_ESSENCE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.HARD_STONE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.JADE;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.MITHRIL_POWDER;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.ROBOTRON;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.RUBY;
import static at.hannibal2.skyhanni.config.features.mining.PowderTrackerConfig.PowderDisplayEntry.SAPPHIRE;
Expand Down Expand Up @@ -56,7 +55,6 @@ public class PowderTrackerConfig {
public Property<List<PowderDisplayEntry>> textFormat = Property.of(new ArrayList<>(Arrays.asList(
TOTAL_CHESTS,
DOUBLE_POWDER,
MITHRIL_POWDER,
GEMSTONE_POWDER,
SPACER_1,
DIAMOND_ESSENCE,
Expand All @@ -78,7 +76,6 @@ public class PowderTrackerConfig {
public enum PowderDisplayEntry implements HasLegacyId {
TOTAL_CHESTS("§d852 Total chests Picked §7(950/h)", 2),
DOUBLE_POWDER("§bx2 Powder: §aActive!", 3),
MITHRIL_POWDER("§b250,420 §aMithril Powder §7(350,000/h)", 4),
GEMSTONE_POWDER("§b250,420 §dGemstone Powder §7(350,000/h)", 5),
SPACER_1("", 6),
DIAMOND_ESSENCE("§b129 §bDiamond Essence §7(600/h)", 7),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern

enum class PowderChestReward(val displayName: String, pattern: String) {

MITHRIL_POWDER(
"§aMithril Powder",
" {4}§r§2Mithril Powder(?: §r§8x(?<amount>.*))?",
),
GEMSTONE_POWDER(
"§dGemstone Powder",
" {4}§r§dGemstone Powder(?: §r§8x(?<amount>.*))?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ object PowderTracker {
}

for (reward in PowderChestReward.entries) {
if (reward == PowderChestReward.MITHRIL_POWDER || reward == PowderChestReward.GEMSTONE_POWDER) return
if (reward == PowderChestReward.GEMSTONE_POWDER) continue
reward.chatPattern.matchMatcher(msg) {
tracker.modify {
val count = it.rewards[reward] ?: 0
Expand All @@ -216,7 +216,6 @@ object PowderTracker {
tracker.modify {
val reward = when (event.powder) {
HotmAPI.PowderType.GEMSTONE -> PowderChestReward.GEMSTONE_POWDER
HotmAPI.PowderType.MITHRIL -> PowderChestReward.MITHRIL_POWDER
else -> return@modify
}
it.rewards.addOrPut(reward, event.amount)
Expand Down Expand Up @@ -274,6 +273,17 @@ object PowderTracker {
}
newList
}

event.transform(61, "mining.powderTracker.textFormat") { element ->
val newList = JsonArray()
for (entry in element.asJsonArray) {
if (entry is JsonNull) continue
if (entry.asString.let { it != "MITHRIL_POWDER" }) {
newList.add(entry)
}
}
newList
}
}

@SubscribeEvent
Expand All @@ -296,7 +306,6 @@ object PowderTracker {

private fun drawDisplay(data: Data): List<Searchable> = buildList {
calculate(data, gemstoneInfo, PowderChestReward.GEMSTONE_POWDER)
calculate(data, mithrilInfo, PowderChestReward.MITHRIL_POWDER)
calculate(data, diamondEssenceInfo, PowderChestReward.DIAMOND_ESSENCE)
calculate(data, goldEssenceInfo, PowderChestReward.GOLD_ESSENCE)
calculateChest(data)
Expand Down

0 comments on commit 5d08243

Please sign in to comment.