diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2024-06-07 13:06:59 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 13:06:59 +1000 |
commit | 239579b732e95562279af643527ee30b0858ee12 (patch) | |
tree | 81be1af1ebfd85685f51b5ce6f162d300ba8b2ab | |
parent | 999ff2256c1384a5ca4db2e7069207127404cfff (diff) | |
download | skyhanni-239579b732e95562279af643527ee30b0858ee12.tar.gz skyhanni-239579b732e95562279af643527ee30b0858ee12.tar.bz2 skyhanni-239579b732e95562279af643527ee30b0858ee12.zip |
Backend: Remove deprecated function: getMultiplier (#1956)
10 files changed, 21 insertions, 27 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index e179b682e..3e7e1f7bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -89,7 +89,7 @@ object CollectionAPI { @SubscribeEvent fun onItemAdd(event: ItemAddEvent) { val internalName = event.internalName - val (_, amount) = NEUItems.getMultiplier(internalName) + val amount = NEUItems.getPrimitiveMultiplier(internalName).amount if (amount > 1) return // TODO add support for replenish (higher collection than actual items in inv) 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 008a5263a..c12bafc39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -122,7 +122,7 @@ object MinionCraftHelper { if (!allIngredients.contains(rawId)) continue if (!isAllowed(allMinions, rawId)) continue - val (itemId, multiplier) = NEUItems.getMultiplier(rawId) + val (itemId, multiplier) = NEUItems.getPrimitiveMultiplier(rawId) val old = otherItems.getOrDefault(itemId, 0) otherItems[itemId] = old + item.stackSize * multiplier } @@ -133,7 +133,7 @@ object MinionCraftHelper { } private fun isAllowed(allMinions: List<NEUInternalName>, internalName: NEUInternalName): Boolean { - val a = NEUItems.getMultiplier(internalName) + val primitiveStack = NEUItems.getPrimitiveMultiplier(internalName) for (minion in allMinions) { val recipes = NEUItems.getRecipes(minion) @@ -142,8 +142,8 @@ object MinionCraftHelper { val ingredientInternalName = ingredient.internalItemId.asInternalName() if (ingredientInternalName == internalName) return true - val b = NEUItems.getMultiplier(ingredientInternalName) - if (a.first == b.first && a.second < b.second) return true + val ingredientPrimitive = NEUItems.getPrimitiveMultiplier(ingredientInternalName) + if (primitiveStack.internalName == ingredientPrimitive.internalName && primitiveStack.amount < ingredientPrimitive.amount) return true } } } @@ -209,7 +209,7 @@ object MinionCraftHelper { } var allDone = true for ((rawId, need) in map) { - val (itemId, multiplier) = NEUItems.getMultiplier(rawId) + val (itemId, multiplier) = NEUItems.getPrimitiveMultiplier(rawId) val needAmount = need * multiplier val have = otherItems.getOrDefault(itemId, 0) val percentage = have.toDouble() / needAmount diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index f2cc5d31e..b154a72e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -62,24 +62,24 @@ object GardenCropMilestoneFix { val amount = group("amount").toInt() val item = NEUInternalName.fromItemNameOrNull(group("item")) ?: return - val multiplier = NEUItems.getMultiplier(item) - val rawName = multiplier.first.itemNameWithoutColor + val primitiveStack = NEUItems.getPrimitiveMultiplier(item) + val rawName = primitiveStack.internalName.itemNameWithoutColor val cropType = CropType.getByNameOrNull(rawName) ?: return cropType.setCounter( - cropType.getCounter() + (amount * multiplier.second) + cropType.getCounter() + (amount * primitiveStack.amount) ) GardenCropMilestoneDisplay.update() } pestRareDropPattern.matchMatcher(event.message) { val item = NEUInternalName.fromItemNameOrNull(group("item")) ?: return - val multiplier = NEUItems.getMultiplier(item) - val rawName = multiplier.first.itemNameWithoutColor + val primitiveStack = NEUItems.getPrimitiveMultiplier(item) + val rawName = primitiveStack.internalName.itemNameWithoutColor val cropType = CropType.getByNameOrNull(rawName) ?: return cropType.setCounter( - cropType.getCounter() + multiplier.second + cropType.getCounter() + primitiveStack.amount ) GardenCropMilestoneDisplay.update() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt index 74269c52d..6423e00ae 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropTimeCommand.kt @@ -41,7 +41,7 @@ object GardenCropTimeCommand { val internalName = entry.key val itemName = internalName.itemName if (itemName.removeColor().lowercase().contains(searchName)) { - val (baseId, baseAmount) = NEUItems.getMultiplier(internalName) + val (baseId, baseAmount) = NEUItems.getPrimitiveMultiplier(internalName) val baseName = baseId.itemName val crop = CropType.getByName(baseName.removeColor()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt index 8523a7a58..11e307e88 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropsInCommand.kt @@ -46,7 +46,7 @@ object GardenCropsInCommand { val internalName = entry.key val itemName = internalName.itemName if (itemName.removeColor().lowercase().contains(searchName)) { - val (baseId, baseAmount) = NEUItems.getMultiplier(internalName) + val (baseId, baseAmount) = NEUItems.getPrimitiveMultiplier(internalName) val baseName = baseId.itemName val crop = CropType.getByName(baseName.removeColor()) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 9d0bc6952..701082d63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -579,7 +579,7 @@ object ComposterOverlay { || internalName == "SIMPLE_CARROT_CANDY" ) continue - var (newId, amount) = NEUItems.getMultiplier(internalName.asInternalName()) + var (newId, amount) = NEUItems.getPrimitiveMultiplier(internalName.asInternalName()) if (amount <= 9) continue if (internalName == "ENCHANTED_HUGE_MUSHROOM_1" || internalName == "ENCHANTED_HUGE_MUSHROOM_2") { // 160 * 8 * 4 is 5120 and not 5184, but hypixel made an error, so we have to copy the error diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 987ab0ed8..40509d97c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -361,7 +361,7 @@ object CropMoneyDisplay { if (debug) { debugList.addAsSingletonList(" added seedsPerHour: $seedsPerHour") } - val factor = NEUItems.getMultiplier(internalName).second + val factor = NEUItems.getPrimitiveMultiplier(internalName).amount npcPrice += "SEEDS".asInternalName().getNpcPrice() * seedsPerHour / factor sellOffer += it.buyPrice * seedsPerHour instantSell += it.sellPrice * seedsPerHour @@ -421,7 +421,7 @@ object CropMoneyDisplay { val internalName = rawInternalName.asInternalName() if (!internalName.isBazaarItem()) continue - val (newId, amount) = NEUItems.getMultiplier(internalName) + val (newId, amount) = NEUItems.getPrimitiveMultiplier(internalName) val itemName = newId.itemNameWithoutColor val crop = getByNameOrNull(itemName) crop?.let { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index 921583492..ccac68803 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -427,12 +427,12 @@ object GardenVisitorFeatures { finalList[index] = "$formattedLine §7(§6$format§7)" } if (!readingShoppingList) continue - val multiplier = NEUItems.getMultiplier(internalName) + val primitiveStack = NEUItems.getPrimitiveMultiplier(internalName) - val rawName = multiplier.first.itemNameWithoutColor + val rawName = primitiveStack.internalName.itemNameWithoutColor val cropType = getByNameOrNull(rawName) ?: continue - val cropAmount = multiplier.second.toLong() * amount + val cropAmount = primitiveStack.amount.toLong() * amount val formattedName = "§e${cropAmount.addSeparators()}§7x ${cropType.cropName} " val formattedSpeed = cropType.getSpeed()?.let { speed -> val duration = (cropAmount / speed).seconds diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt index cfb3e30c5..05eecd3b7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionCollectLogic.kt @@ -25,7 +25,7 @@ object MinionCollectLogic { val map = mutableMapOf<NEUInternalName, Int>() for (stack in InventoryUtils.getItemsInOwnInventory()) { val internalName = stack.getInternalName() - val (newId, amount) = NEUItems.getMultiplier(internalName) + val (newId, amount) = NEUItems.getPrimitiveMultiplier(internalName) val old = map[newId] ?: 0 map[newId] = old + amount * stack.stackSize } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 9c35ddcba..75b3e30c4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -279,12 +279,6 @@ object NEUItems { fun allNeuRepoItems(): Map<String, JsonObject> = NotEnoughUpdates.INSTANCE.manager.itemInformation - @Deprecated("outdated", ReplaceWith("NEUItems.getPrimitiveMultiplier(internalName, tryCount)")) - fun getMultiplier(internalName: NEUInternalName, tryCount: Int = 0): Pair<NEUInternalName, Int> { - val (name, amount) = getPrimitiveMultiplier(internalName, tryCount) - return Pair(name, amount) - } - fun getPrimitiveMultiplier(internalName: NEUInternalName, tryCount: Int = 0): PrimitiveItemStack { multiplierCache[internalName]?.let { return it } if (tryCount == 10) { |