From 6bdcc845e8397041c44b5271af245597caf26353 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:04:07 +0100 Subject: Replaced all logErrorState to logErrorStateWithData --- .../skyhanni/features/garden/visitor/VisitorAPI.kt | 8 +++--- .../misc/items/EstimatedItemValueCalculator.kt | 29 ++++++++++++++++------ .../at/hannibal2/skyhanni/utils/LorenzRarity.kt | 12 +++++---- .../java/at/hannibal2/skyhanni/utils/NEUItems.kt | 7 +++--- 4 files changed, 36 insertions(+), 20 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt index 1c51e00a9..1ad82a241 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorAPI.kt @@ -60,11 +60,11 @@ object VisitorAPI { if (visitor != null) return visitor - println("visitors: $visitors") - println("name: $name") - ErrorManager.logErrorState( + ErrorManager.logErrorStateWithData( "Error finding the visitor `$nameĀ§c`. Try to reopen the inventory", - "visitor is null! name='$name', visitors=`$visitors`" + "Visitor is null while opening visitor inventory", + "name" to name, + "visitors" to visitors, ) return null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index 7d8f3c010..93edf2416 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -198,11 +198,14 @@ object EstimatedItemValueCalculator { itemRarity = LorenzRarity.LEGENDARY } else { if (stack.isRecombobulated()) { - val oneBelow = itemRarity.oneBelow() + val oneBelow = itemRarity.oneBelow(logError = false) if (oneBelow == null) { - ErrorManager.logErrorState( + ErrorManager.logErrorStateWithData( "Wrong item rarity detected in estimated item value for item ${stack.name}", - "Recombobulated item is common: ${stack.getInternalName()}, name:${stack.name}" + "Recombobulated item is common", + "internal name" to stack.getInternalName(), + "itemRarity" to itemRarity, + "item name" to stack.name, ) return null } @@ -212,9 +215,16 @@ object EstimatedItemValueCalculator { val rarityName = itemRarity.name if (!reforgeCosts.has(rarityName)) { val reforgesFound = reforgeCosts.entrySet().map { it.key } - ErrorManager.logErrorState( - "Can not calculate reforge cost for item ${stack.name}", - "item rarity '$itemRarity' is not in NEU repo reforge cost for reforge stone$reforgeStone ($reforgesFound)" + ErrorManager.logErrorStateWithData( + "Could not calculate reforge cost for item ${stack.name}", + "Item not in NEU repo reforge cost", + "rarityName" to rarityName, + "reforgeCosts" to reforgeCosts, + "itemRarity" to itemRarity, + "reforgesFound" to reforgesFound, + "internal name" to stack.getInternalName(), + "item name" to stack.name, + "reforgeStone" to reforgeStone, ) return null } @@ -633,9 +643,12 @@ object EstimatedItemValueCalculator { if (EstimatedItemValue.gemstoneUnlockCosts.isEmpty()) return 0.0 if (internalName !in EstimatedItemValue.gemstoneUnlockCosts) { - ErrorManager.logErrorState( + ErrorManager.logErrorStateWithData( "Could not find gemstone slot price for ${stack.name}", - "EstimatedItemValue has no gemstoneUnlockCosts for $internalName" + "EstimatedItemValue has no gemstoneUnlockCosts for $internalName", + "internal name" to internalName, + "gemstoneUnlockCosts" to EstimatedItemValue.gemstoneUnlockCosts, + "item name" to stack.name, ) return 0.0 } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt index d589df3ac..35868027f 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzRarity.kt @@ -29,9 +29,10 @@ enum class LorenzRarity(val color: LorenzColor, val id: Int) { fun oneBelow(logError: Boolean = true): LorenzRarity? { val rarityBelow = getById(ordinal - 1) if (rarityBelow == null && logError) { - ErrorManager.logErrorState( + ErrorManager.logErrorStateWithData( "Problem with item rarity detected.", - "Trying to get an item rarity below common" + "Trying to get an item rarity below common", + "ordinal" to ordinal ) } return rarityBelow @@ -40,9 +41,10 @@ enum class LorenzRarity(val color: LorenzColor, val id: Int) { fun oneAbove(logError: Boolean = true): LorenzRarity? { val rarityBelow = getById(ordinal + 1) if (rarityBelow == null && logError) { - ErrorManager.logErrorState( + ErrorManager.logErrorStateWithData( "Problem with item rarity detected.", - "Trying to get an item rarity above special" + "Trying to get an item rarity above special", + "ordinal" to ordinal ) } return rarityBelow @@ -65,4 +67,4 @@ enum class LorenzRarity(val color: LorenzColor, val id: Int) { } } -} \ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 7a3ddbf14..e5c45bab1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -233,9 +233,10 @@ object NEUItems { return multiplierCache[internalName]!! } if (tryCount == 10) { - ErrorManager.logErrorState( - "Error grabbing recipe data", - "Error reading getMultiplier for item '$internalName'" + ErrorManager.logErrorStateWithData( + "Cound not load recipe data.", + "Failed to find item multiplier", + "internalName" to internalName ) return Pair(internalName, 1) } -- cgit