From 047cd9598a9241b94e17b36e00f02689a60c3d17 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 25 Nov 2023 18:35:52 +0100 Subject: code cleanup --- .../inventory/ItemDisplayOverlayFeatures.kt | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 8b7b6cb7d..61a18a317 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -40,7 +40,8 @@ class ItemDisplayOverlayFeatures { private fun getStackTip(item: ItemStack): String { val itemName = item.cleanName() - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(0)) { + val itemNumberAsStackSize = SkyHanniMod.feature.inventory.itemNumberAsStackSize + if (itemNumberAsStackSize.contains(0)) { when (itemName) { "First Master Star" -> return "1" "Second Master Star" -> return "2" @@ -50,11 +51,11 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1) && itemName.matchRegex("(.*)Master Skull - Tier .")) { + if (itemNumberAsStackSize.contains(1) && itemName.matchRegex("(.*)Master Skull - Tier .")) { return itemName.substring(itemName.length - 1) } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2) && (itemName.contains("Golden ") || itemName.contains( + if (itemNumberAsStackSize.contains(2) && (itemName.contains("Golden ") || itemName.contains( "Diamond " )) ) { @@ -69,11 +70,11 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3) && itemName.startsWith("New Year Cake (")) { + if (itemNumberAsStackSize.contains(3) && itemName.startsWith("New Year Cake (")) { return "§b" + itemName.between("(Year ", ")") } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) { + if (itemNumberAsStackSize.contains(4)) { val chestName = InventoryUtils.openInventoryName() if (!chestName.endsWith("Sea Creature Guide") && ItemUtils.isPet(itemName)) { petLevelPattern.matchMatcher(itemName) { @@ -87,7 +88,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5) && itemName.contains(" Minion ") && + if (itemNumberAsStackSize.contains(5) && itemName.contains(" Minion ") && !itemName.contains("Recipe") && item.getLore().any { it.contains("Place this minion") } ) { val array = itemName.split(" ") @@ -100,7 +101,7 @@ class ItemDisplayOverlayFeatures { return (if (itemName.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2) } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(8) && itemName.contains("Kuudra Key")) { + if (itemNumberAsStackSize.contains(8) && itemName.contains("Kuudra Key")) { return when (itemName) { "Kuudra Key" -> "§a1" "Hot Kuudra Key" -> "§22" @@ -111,7 +112,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(9) && + if (itemNumberAsStackSize.contains(9) && InventoryUtils.openInventoryName() == "Your Skills" && item.getLore().any { it.contains("Click to view!") } ) { @@ -124,7 +125,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(10) && InventoryUtils.openInventoryName() + if (itemNumberAsStackSize.contains(10) && InventoryUtils.openInventoryName() .endsWith(" Collections") ) { val lore = item.getLore() @@ -139,7 +140,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(11) && itemName.contains("Rancher's Boots")) { + if (itemNumberAsStackSize.contains(11) && itemName.contains("Rancher's Boots")) { for (line in item.getLore()) { rancherBootsSpeedCapPattern.matchMatcher(line) { return group("cap") @@ -147,7 +148,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(12) && itemName.contains("Larva Hook")) { + if (itemNumberAsStackSize.contains(12) && itemName.contains("Larva Hook")) { for (line in item.getLore()) { "§7§7You may harvest §6(?.).*".toPattern().matchMatcher(line) { val amount = group("amount").toInt() @@ -160,7 +161,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(13) && itemName.startsWith("Dungeon ") && itemName.contains( + if (itemNumberAsStackSize.contains(13) && itemName.startsWith("Dungeon ") && itemName.contains( " Potion" ) ) { @@ -176,7 +177,7 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(14)) { + if (itemNumberAsStackSize.contains(14)) { if (item.getInternalNameOrNull() in garenVacuumVariants) { for (line in item.getLore()) { gardenVacuumPatterm.matchMatcher(line) { -- cgit