aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 19:14:58 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-04-15 19:14:58 +0200
commitec08babcd63289587a269dd45f5ba8488d2921e7 (patch)
tree3a44b9ab030554ecff37e05d6c64b81326bc5a7d /src/main/java/at/hannibal2/skyhanni
parentd9b4dbfb8a3cdc6f869d740af9b0e38b44ecea2d (diff)
downloadskyhanni-ec08babcd63289587a269dd45f5ba8488d2921e7.tar.gz
skyhanni-ec08babcd63289587a269dd45f5ba8488d2921e7.tar.bz2
skyhanni-ec08babcd63289587a269dd45f5ba8488d2921e7.zip
code cleanup
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt4
4 files changed, 21 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
index 3c6caf271..ea4584119 100644
--- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt
@@ -30,27 +30,18 @@ class CollectionAPI {
val profileData = event.profileData
val jsonElement = profileData["collection"] ?: return
val asJsonObject = jsonElement.asJsonObject ?: return
- for ((rawName, rawCounter) in asJsonObject.entrySet()) {
+ for ((hypixelId, rawCounter) in asJsonObject.entrySet()) {
val counter = rawCounter.asLong
- var itemName = BazaarApi.getBazaarDataByInternalName(rawName)?.displayName
- if (rawName == "MUSHROOM_COLLECTION") {
- itemName = "Mushroom"
- }
- if (rawName == "MELON") {
- itemName = "Melon"
- }
- if (rawName == "GEMSTONE_COLLECTION") {
- itemName = "Gemstone"
- }
-
+ val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId)
+ val itemName = BazaarApi.getBazaarDataByInternalName(neuItemId)?.displayName
// Hypixel moment
- if (hypixelApiHasWrongItems.contains(rawName)) continue
+ if (hypixelApiHasWrongItems.contains(neuItemId)) continue
if (itemName == null) {
- LorenzUtils.debug("collection name is null for '$rawName'")
+ LorenzUtils.debug("collection name is null for '$neuItemId'")
continue
}
- collectionValue[itemName] = counter
+ collectionValue[neuItemId] = counter
}
CollectionUpdateEvent().postAndCatch()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt
index 121aa7dfb..226e368a7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt
@@ -6,7 +6,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates
import kotlinx.coroutines.launch
import kotlin.concurrent.fixedRateTimer
@@ -27,8 +26,7 @@ class BazaarDataHolder {
if (jsonObject.has("npc_sell_price")) {
val hypixelId = jsonObject["id"].asString
val npcPrice = jsonObject["npc_sell_price"].asDouble
- val auctionManager = NotEnoughUpdates.INSTANCE.manager.auctionManager
- val neuItemId = auctionManager.transformHypixelBazaarToNEUItemId(hypixelId)
+ val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId)
list[neuItemId] = npcPrice
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
index 55b01dd9f..b6d3873f7 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt
@@ -40,6 +40,7 @@ class LorenzTest {
}
fun testCommand(args: Array<String>) {
+ SoundUtils.playBeepSound()
// for ((i, s) in ScoreboardData.sidebarLinesFormatted().withIndex()) {
// println("$i: '$s'")
@@ -52,8 +53,8 @@ class LorenzTest {
// SoundUtils.createSound(name, pitch).playSound()
- a = args[0].toDouble()
- b = args[1].toDouble()
+// a = args[0].toDouble()
+// b = args[1].toDouble()
// c = args[2].toDouble()
// for (line in (Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay).footer.unformattedText
@@ -165,6 +166,14 @@ class LorenzTest {
// if (itemStack != null) {
// val internalName = itemStack.getInternalName()
// event.toolTip.add("internal name: $internalName")
+// val data = BazaarApi.getBazaarDataByInternalName(internalName)
+// if (data == null) {
+// event.toolTip.add("SkyHanni Price: null")
+// } else {
+// val buyPrice = data.buyPrice
+// val sellPrice = data.sellPrice
+// event.toolTip.add("SkyHanni Price: $buyPrice / $sellPrice")
+// }
// }
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 76a2f7d2a..5a2f1dc3a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -63,6 +63,9 @@ object NEUItems {
return getPrice(internalName, false)
}
+ fun transHypixelNameToInternalName(hypixelId: String): String =
+ manager.auctionManager.transformHypixelBazaarToNEUItemId(hypixelId)
+
fun getPrice(internalName: String, useSellingPrice: Boolean): Double {
val result = manager.auctionManager.getBazaarOrBin(internalName, useSellingPrice)
if (result == -1.0) {
@@ -73,7 +76,6 @@ object NEUItems {
// 6.8 for some players
return 7.0 // NPC price
}
- LorenzUtils.debug("Item price is null for '$internalName'")
}
return result
}