aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-08 14:25:32 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-08 14:25:32 +0100
commit6a52e0a5c9d168ad0e3ef549f6a77e140f92b174 (patch)
tree9697c8d785bbef34fd744c5fbaadd71e05166b6e /src/main/java
parentb62cdfa295248ec3a9a236db0e2bea6441208f21 (diff)
downloadskyhanni-6a52e0a5c9d168ad0e3ef549f6a77e140f92b174.tar.gz
skyhanni-6a52e0a5c9d168ad0e3ef549f6a77e140f92b174.tar.bz2
skyhanni-6a52e0a5c9d168ad0e3ef549f6a77e140f92b174.zip
Add rancher boots speed display.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt81
2 files changed, 47 insertions, 39 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
index a86e8a5a2..3575e2379 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
@@ -105,10 +105,11 @@ public class Inventory {
"§bWishing Compass",
"§bKuudra Key",
"§bSkill Level",
- "§bCollection Level"
+ "§bCollection Level",
+ "§bRancher Boot's speed"
}
)
- public List<Integer> itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 9));
+ public List<Integer> itemNumberAsStackSize = new ArrayList<>(Arrays.asList(3, 9, 11));
@Expose
@ConfigOption(name = "Sack Name", desc = "Show an abbreviation of the Sack name.")
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 e77865a35..2a0cfc20c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.api.CollectionAPI
import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils
-import at.hannibal2.skyhanni.utils.ItemUtils.cleanName
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils.between
@@ -19,6 +18,7 @@ import java.util.regex.Pattern
class ItemDisplayOverlayFeatures {
private val wishingCompassPattern = Pattern.compile("§7Remaining Uses: §e(.*)§8/§e3")
+ private val rangerBootsSpeedCapPattern = Pattern.compile("§7Current Speed Cap: §a(.*)")
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
@@ -26,10 +26,10 @@ class ItemDisplayOverlayFeatures {
}
private fun getStackTip(item: ItemStack): String {
- val name = item.cleanName()
+ val itemName = item.name ?: return ""
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(0)) {
- when (name) {
+ when (itemName) {
"First Master Star" -> return "1"
"Second Master Star" -> return "2"
"Third Master Star" -> return "3"
@@ -39,37 +39,37 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1)) {
- if (name.matchRegex("(.*)Master Skull - Tier .")) {
- return name.substring(name.length - 1)
+ if (itemName.matchRegex("(.*)Master Skull - Tier .")) {
+ return itemName.substring(itemName.length - 1)
}
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2)) {
- if (name.contains("Golden ") || name.contains("Diamond ")) {
+ if (itemName.contains("Golden ") || itemName.contains("Diamond ")) {
when {
- name.contains("Bonzo") -> return "1"
- name.contains("Scarf") -> return "2"
- name.contains("Professor") -> return "3"
- name.contains("Thorn") -> return "4"
- name.contains("Livid") -> return "5"
- name.contains("Sadan") -> return "6"
- name.contains("Necron") -> return "7"
+ itemName.contains("Bonzo") -> return "1"
+ itemName.contains("Scarf") -> return "2"
+ itemName.contains("Professor") -> return "3"
+ itemName.contains("Thorn") -> return "4"
+ itemName.contains("Livid") -> return "5"
+ itemName.contains("Sadan") -> return "6"
+ itemName.contains("Necron") -> return "7"
}
}
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3)) {
- if (name.startsWith("New Year Cake (")) {
- return "§b" + name.between("(Year ", ")")
+ if (itemName.startsWith("New Year Cake (")) {
+ return "§b" + itemName.between("(Year ", ")")
}
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) {
val chestName = InventoryUtils.openInventoryName()
if (!chestName.endsWith("Sea Creature Guide")) {
- if (ItemUtils.isPet(name)) {
- val level = name.between("Lvl ", "] ").toInt()
- if (level != ItemUtils.maxPetLevel(name)) {
+ if (ItemUtils.isPet(itemName)) {
+ val level = itemName.between("Lvl ", "] ").toInt()
+ if (level != ItemUtils.maxPetLevel(itemName)) {
return "$level"
}
}
@@ -77,9 +77,9 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5)) {
- if (name.contains(" Minion ")) {
+ if (itemName.contains(" Minion ")) {
if (item.getLore().any { it.contains("Place this minion") }) {
- val array = name.split(" ")
+ val array = itemName.split(" ")
val last = array[array.size - 1]
return last.romanToDecimal().toString()
}
@@ -87,14 +87,14 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.displaySackName) {
- if (ItemUtils.isSack(name)) {
- val sackName = grabSackName(name)
- return (if (name.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2)
+ if (ItemUtils.isSack(itemName)) {
+ val sackName = grabSackName(itemName)
+ return (if (itemName.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2)
}
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(7)) {
- if (name.contains("Wishing Compass")) {
+ if (itemName.contains("Wishing Compass")) {
for (line in item.getLore()) {
val matcher = wishingCompassPattern.matcher(line)
if (matcher.matches()) {
@@ -108,8 +108,8 @@ class ItemDisplayOverlayFeatures {
}
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(8)) {
- if (name.contains("Kuudra Key")) {
- return when (name) {
+ if (itemName.contains("Kuudra Key")) {
+ return when (itemName) {
"Kuudra Key" -> "§a1"
"Hot Kuudra Key" -> "§22"
"Burning Kuudra Key" -> "§e3"
@@ -123,11 +123,9 @@ class ItemDisplayOverlayFeatures {
if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(9)) {
if (InventoryUtils.openInventoryName() == "Your Skills") {
if (item.getLore().any { it.contains("Click to view!") }) {
- item.name?.let {
- if (!it.contains("Dungeon")) {
- val text = it.split(" ").last()
- return "" + text.romanToDecimalIfNeeded()
- }
+ if (!itemName.contains("Dungeon")) {
+ val text = itemName.split(" ").last()
+ return "" + text.romanToDecimalIfNeeded()
}
}
}
@@ -137,12 +135,21 @@ class ItemDisplayOverlayFeatures {
if (InventoryUtils.openInventoryName().endsWith(" Collections")) {
val lore = item.getLore()
if (lore.any { it.contains("Click to view!") }) {
- item.name?.let {
- if (CollectionAPI.isCollectionTier0(lore)) return "0"
- if (it.startsWith("§e")) {
- val text = it.split(" ").last()
- return "" + text.romanToDecimalIfNeeded()
- }
+ if (CollectionAPI.isCollectionTier0(lore)) return "0"
+ if (itemName.startsWith("§e")) {
+ val text = itemName.split(" ").last()
+ return "" + text.romanToDecimalIfNeeded()
+ }
+ }
+ }
+ }
+
+ if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(11)) {
+ if (itemName.contains("Rancher's Boots")) {
+ for (line in item.getLore()) {
+ val matcher = rangerBootsSpeedCapPattern.matcher(line)
+ if (matcher.matches()) {
+ return matcher.group(1)
}
}
}