summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-06 23:51:02 +0100
committerGitHub <noreply@github.com>2024-03-06 23:51:02 +0100
commit0a95a791eb57a546fb5421594abae740faf1dfdb (patch)
tree82bfc13c544a60d496bab081b66ddd73e07d62a3 /src/main/java/at/hannibal2/skyhanni/features
parent28430fe85115334fb06fb7e3cc36da819f08dace (diff)
downloadskyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.tar.gz
skyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.tar.bz2
skyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.zip
Internal Changes: Many small code cleanups (#1101)
Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt36
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/FishingBaitWarnings.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/ShowFishingItemName.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/OdgerWaypoint.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt34
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropTracker.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenInventoryNumbers.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenNextPlotPrice.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorListener.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/AuctionsHighlighter.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemStars.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/QuickCraftFeatures.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SkyblockGuideHighlightFeature.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarApi.kt17
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarCancelledBuyOrderClipboard.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarDataHolder.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOpenPriceWebsite.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/itemabilities/ChickenHeadTimer.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/BrewingStandOverlay.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/NonGodPotEffectDisplay.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/AuctionHouseCopyUnderbidPrice.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedWardrobePrice.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/GlowingDroppedItems.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/teleportpad/TeleportPadInventoryNumber.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/PabloHelper.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt5
62 files changed, 261 insertions, 246 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
index e6d339979..e4bae4f05 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt
@@ -43,7 +43,7 @@ object FirstMinionTier {
minionId: NEUInternalName,
) {
if (recipe.getCachedIngredients().any { help.contains(it.internalItemId.asInternalName()) }) {
- val name = recipe.output.itemStack.name!!.removeColor()
+ val name = recipe.output.itemStack.name.removeColor()
val abc = name.replace(" I", " 0")
minions[abc] = minionId.replace("_1", "_0")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
index a6f81c588..35741622a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
@@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.NEUItems.getCachedIngredients
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -222,8 +223,8 @@ class MinionCraftHelper {
return
}
val format = LorenzUtils.formatPercentage(percentage)
- val haveFormat = LorenzUtils.formatInteger(have)
- val needFormat = LorenzUtils.formatInteger(needAmount)
+ val haveFormat = have.addSeparators()
+ val needFormat = needAmount.addSeparators()
newDisplay.add("$itemName§8: §e$format §8(§7$haveFormat§8/§7$needFormat§8)")
allDone = false
}
@@ -265,7 +266,7 @@ class MinionCraftHelper {
if (event.inventoryName != "Crafted Minions") return
for ((_, b) in event.inventoryItems) {
- val name = b.name ?: continue
+ val name = b.name
if (!name.startsWith("§e")) continue
val internalName = NEUInternalName.fromItemName("$name I")
.replace("MINION", "GENERATOR").replace(";", "_").replace("CAVE_SPIDER", "CAVESPIDER")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
index c0606ad54..91759f003 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
@@ -51,7 +51,7 @@ class BingoCardReader {
lore.any { it.endsWith("Community Goal") } -> GoalType.COMMUNITY
else -> continue
}
- val name = stack.name?.removeColor() ?: continue
+ val name = stack.name.removeColor()
var index = 0
val builder = StringBuilder()
for (s in lore) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
index be4a8c7a4..30dd81bd7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
@@ -22,6 +22,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.NumberUtil.formatInt
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
@@ -122,9 +124,7 @@ class BingoNextStepHelper {
return if (having > 0) {
val needed = step.amountNeeded
val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed)
- val havingFormat = LorenzUtils.formatInteger(having)
- val neededFormat = LorenzUtils.formatInteger(needed)
- " $percentage ($havingFormat/$neededFormat)"
+ " $percentage (${having.addSeparators()}/${needed.addSeparators()})"
} else ""
}
}
@@ -183,7 +183,7 @@ class BingoNextStepHelper {
if (step is ItemsStep) {
var totalCount = 0L
for ((itemName, multiplier) in step.variants) {
- val count = InventoryUtils.countItemsInLowerInventory { it.name?.removeColor() == itemName }
+ val count = InventoryUtils.countItemsInLowerInventory { it.name.removeColor() == itemName }
totalCount += count * multiplier
}
if (step.amountHaving != totalCount) {
@@ -263,7 +263,7 @@ class BingoNextStepHelper {
private fun readDescription(description: String): NextStep? {
collectionPattern.matchMatcher(description) {
- val amount = group("amount").replace(",", "").toInt()
+ val amount = group("amount").formatInt()
val name = group("name")
return CollectionStep(name, amount) withItemIslandRequirement name
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
index bd1d58894..2e9259f0a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
@@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addButton
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
-import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
+import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision
import at.hannibal2.skyhanni.utils.NumberUtil.toRoman
@@ -150,12 +150,12 @@ object BestiaryData {
val progress = line.substring(line.lastIndexOf(' ') + 1)
if (previousLine.contains("Families Found")) {
progressPattern.matchMatcher(progress) {
- familiesFound = group("current").formatNumber()
- totalFamilies = group("needed").formatNumber()
+ familiesFound = group("current").formatLong()
+ totalFamilies = group("needed").formatLong()
}
} else if (previousLine.contains("Families Completed")) {
progressPattern.matchMatcher(progress) {
- familiesCompleted = group("current").formatNumber()
+ familiesCompleted = group("current").formatLong()
}
}
}
@@ -178,7 +178,7 @@ object BestiaryData {
for ((lineIndex, line) in stack.getLore().withIndex()) {
val loreLine = line.removeColor()
if (loreLine.startsWith("Kills: ")) {
- actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber()
+ actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatLong()
?: 0
}
if (!loreLine.startsWith(" ")) continue
@@ -186,13 +186,13 @@ object BestiaryData {
val progress = loreLine.substring(loreLine.lastIndexOf(' ') + 1)
if (previousLine.contains("Progress to Tier")) {
progressPattern.matchMatcher(progress) {
- totalKillToTier = group("needed").formatNumber()
- currentKillToTier = group("current").formatNumber()
+ totalKillToTier = group("needed").formatLong()
+ currentKillToTier = group("current").formatLong()
}
} else if (previousLine.contains("Overall Progress")) {
progressPattern.matchMatcher(progress) {
- totalKillToMax = group("needed").formatNumber()
- currentTotalKill = group("current").formatNumber()
+ totalKillToMax = group("needed").formatLong()
+ currentTotalKill = group("current").formatLong()
}
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
index b87002c0e..274e64f9d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
@@ -18,7 +18,6 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield
import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield
import at.hannibal2.skyhanni.test.command.ErrorManager
-import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.CollectionUtils.put
import at.hannibal2.skyhanni.utils.ConfigUtils
@@ -400,7 +399,13 @@ class DamageIndicatorManager {
val thorn = checkThorn(health, maxHealth)
if (thorn == null) {
val floor = DungeonAPI.dungeonFloor
- ChatUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)")
+ ErrorManager.logErrorStateWithData(
+ "Could not detect thorn",
+ "checkThorn returns null",
+ "health" to health,
+ "maxHealth" to maxHealth,
+ "floor" to floor,
+ )
}
return thorn
}
@@ -563,7 +568,16 @@ class DamageIndicatorManager {
calcHealth = 0
break
} else {
- ChatUtils.error("unknown magma boss health sidebar format!")
+ ErrorManager.logErrorStateWithData(
+ "Unknown magma boss health sidebar format",
+ "Damage Indicator could not find magma boss bar data",
+ "line" to line,
+ "ScoreboardData.sidebarLinesRaw" to ScoreboardData.sidebarLinesRaw,
+ "calcHealth" to calcHealth,
+ "slimeSize" to slimeSize,
+ "entity" to entity,
+ "entityData" to entityData,
+ )
break
}
@@ -777,7 +791,11 @@ class DamageIndicatorManager {
}
}
} else {
- ChatUtils.error("Invalid/impossible thorn floor!")
+ ErrorManager.logErrorStateWithData(
+ "Thorn in wrong floor detected",
+ "Invalid floor for thorn",
+ "dungeonFloor" to DungeonAPI.dungeonFloor,
+ )
return null
}
val color = NumberUtil.percentageColor(health.toLong(), maxHealth.toLong())
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
index d636f24e3..9c352a459 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
@@ -40,7 +40,7 @@ class DungeonFinderFeatures {
if (!LorenzUtils.inSkyBlock || LorenzUtils.skyBlockArea != "Dungeon Hub") return
if (!config.floorAsStackSize) return
- val itemName = event.stack.name?.removeColor() ?: ""
+ val itemName = event.stack.name.removeColor()
val invName = InventoryUtils.openInventoryName()
if (invName == "Select Floor") {
@@ -105,8 +105,7 @@ class DungeonFinderFeatures {
if (slot.slotNumber != slot.slotIndex) continue
if (slot.stack == null) continue
- val itemName = slot.stack.name ?: continue
- if (!itemName.endsWith(" Party")) continue
+ if (!slot.stack.name.endsWith(" Party")) continue
if (config.markIneligibleGroups && slot.stack.getLore().any { ineligiblePattern.matches(it) }) {
slot highlight LorenzColor.DARK_RED
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt
index f28c4966f..3ff3fa59f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/AllBurrowsList.kt
@@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.RenderUtils.drawColor
@@ -43,7 +42,7 @@ object AllBurrowsList {
val burrowLocations = burrowLocations ?: return
val list = burrowLocations.map { it.printWithAccuracy(0, ":") }
OSUtils.copyToClipboard(list.joinToString(";"))
- LorenzUtils.chat("Saved all ${list.size} burrow locations to clipboard.")
+ ChatUtils.chat("Saved all ${list.size} burrow locations to clipboard.")
}
fun addFromClipboard() {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt
index 2d96a88b9..1eae1e8a6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/lobby/waypoints/halloween/BasketWaypoints.kt
@@ -11,7 +11,6 @@ import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
import at.hannibal2.skyhanni.utils.LocationUtils.distanceSqToPlayer
import at.ha