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/features/inventory/StatsTuning.kt111
1 files changed, 51 insertions, 60 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
index 270acbd6f..2c42e00d9 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt
@@ -26,73 +26,65 @@ class StatsTuning {
val stack = event.stack
if (config.templateStats && inventoryName == "Stats Tuning") if (templateStats(stack, event)) return
- if (config.selectedStats && inventoryName == "Accessory Bag Thaumaturgy") if (selectedStats(
- stack,
- event
- )
- ) return
+ if (config.selectedStats && inventoryName == "Accessory Bag Thaumaturgy" && selectedStats(stack, event)) return
if (config.points && inventoryName == "Stats Tuning") points(stack, event)
}
private fun templateStats(stack: ItemStack, event: RenderInventoryItemTipEvent): Boolean {
val name = stack.name ?: return true
- if (name == "§aLoad") {
- var grab = false
- val list = mutableListOf<String>()
- for (line in stack.getLore()) {
- if (line == "§7You are loading:") {
- grab = true
- continue
- }
- if (grab) {
- if (line == "") {
- grab = false
- continue
- }
- val text = line.split(":")[0]
- list.add(text)
- }
+ if (name != "§aLoad") return false
+
+ var grab = false
+ val list = mutableListOf<String>()
+ for (line in stack.getLore()) {
+ if (line == "§7You are loading:") {
+ grab = true
+ continue
}
- if (list.isNotEmpty()) {
- event.stackTip = list.joinToString(" + ")
- event.offsetX = 20
- event.offsetY = -5
- event.alignLeft = false
- return true
+ if (!grab) continue
+
+ if (line == "") {
+ grab = false
+ continue
}
+ val text = line.split(":")[0]
+ list.add(text)
}
- return false
+ if (list.isEmpty()) return false
+
+ event.stackTip = list.joinToString(" + ")
+ event.offsetX = 20
+ event.offsetY = -5
+ event.alignLeft = false
+ return true
}
private fun selectedStats(stack: ItemStack, event: RenderInventoryItemTipEvent): Boolean {
val name = stack.name ?: return true
- if (name == "§aStats Tuning") {
- var grab = false
- val list = mutableListOf<String>()
- for (line in stack.getLore()) {
- if (line == "§7Your tuning:") {
- grab = true
- continue
- }
- if (grab) {
- if (line == "") {
- grab = false
- continue
- }
- val text = line.split(":")[0].split(" ")[0] + "§7"
- list.add(text)
- }
+ if (name != "§aStats Tuning") return false
+
+ var grab = false
+ val list = mutableListOf<String>()
+ for (line in stack.getLore()) {
+ if (line == "§7Your tuning:") {
+ grab = true
+ continue
}
- if (list.isNotEmpty()) {
- event.stackTip = list.joinToString(" + ")
- event.offsetX = 3
- event.offsetY = -5
- event.alignLeft = false
- return true
+ if (!grab) continue
+ if (line == "") {
+ grab = false
+ continue
}
+ val text = line.split(":")[0].split(" ")[0] + "§7"
+ list.add(text)
}
- return false
+ if (list.isEmpty()) return false
+ event.stackTip = list.joinToString(" + ")
+ event.offsetX = 3
+ event.offsetY = -5
+ event.alignLeft = false
+ return true
}
private fun points(stack: ItemStack, event: RenderInventoryItemTipEvent) {
@@ -109,14 +101,13 @@ class StatsTuning {
if (!LorenzUtils.inSkyBlock) return
val chestName = InventoryUtils.openInventoryName()
- if (config.selectedTemplate && chestName == "Stats Tuning") {
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- val stack = slot.stack
- val lore = stack.getLore()
-
- if (lore.any { it == "§aCurrently selected!" }) {
- slot highlight LorenzColor.GREEN
- }
+ if (!config.selectedTemplate || chestName != "Stats Tuning") return
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ val stack = slot.stack
+ val lore = stack.getLore()
+
+ if (lore.any { it == "§aCurrently selected!" }) {
+ slot highlight LorenzColor.GREEN
}
}
}
@@ -128,4 +119,4 @@ class StatsTuning {
event.move(3, "inventory.statsTuningTemplateStats", "inventory.statsTuning.templateStats")
event.move(3, "inventory.statsTuningPoints", "inventory.statsTuning.points")
}
-} \ No newline at end of file
+}