aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-08-19 13:34:07 +0200
committerGitHub <noreply@github.com>2023-08-19 13:34:07 +0200
commitcf6e1e9094b55c27c488d095ead23aa678e2e9b9 (patch)
tree9acd7a13accd3f7cd6991484a089d935a5b4bd1e /src/main/java/at/hannibal2
parentd001f0bbda3a16c765ac877db19ff1cf9398dc3d (diff)
downloadskyhanni-cf6e1e9094b55c27c488d095ead23aa678e2e9b9.tar.gz
skyhanni-cf6e1e9094b55c27c488d095ead23aa678e2e9b9.tar.bz2
skyhanni-cf6e1e9094b55c27c488d095ead23aa678e2e9b9.zip
Merge pull request #392
* update to use same method as in Chest Value
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
index 9e06b5015..5ef9abe44 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt
@@ -3,14 +3,11 @@ package at.hannibal2.skyhanni.features.rift.everywhere.motes
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.rift.RiftAPI
import at.hannibal2.skyhanni.features.rift.RiftAPI.motesNpcPrice
-import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old
-import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector
import at.hannibal2.skyhanni.utils.LorenzUtils.chat
-import at.hannibal2.skyhanni.utils.NEUItems
-import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.highlight
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
@@ -19,6 +16,7 @@ import at.hannibal2.skyhanni.utils.renderables.Renderable
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
class ShowMotesNpcSellPrice {
private val config get() = RiftAPI.config.motes
@@ -52,9 +50,12 @@ class ShowMotesNpcSellPrice {
if (!isInventoryValueEnabled()) return
val name = InventoryUtils.openInventoryName()
if (!name.contains("Rift Storage")) return
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- if (slotList.contains(slot.slotIndex))
- slot highlight LorenzColor.GREEN
+ for ((_, indexes) in Renderable.list) {
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ if (indexes.contains(slot.slotIndex)) {
+ slot highlight LorenzColor.GREEN
+ }
+ }
}
}
@@ -90,6 +91,7 @@ class ShowMotesNpcSellPrice {
itemMap.clear()
slotList.clear()
inInventory = false
+ Renderable.list.clear()
}
private fun processItems() {
@@ -132,28 +134,19 @@ class ShowMotesNpcSellPrice {
for ((internalName, pair) in sorted) {
newDisplay.add(buildList {
val (index, value) = pair
- val dashColor = if (slotList.containsAll(index)) "§a" else "§7"
- add(" $dashColor- ")
+ add(" §7- ")
val stack = NEUItems.getItemStack(internalName)
add(stack)
val price = value.formatPrice()
val valuePer = stack.motesNpcPrice() ?: continue
val tips = buildList {
- add("§eClick to highlight in the chest !")
+ add("§6Item: ${stack.displayName}")
add("§6Value per: §d$valuePer Motes")
add("§6Total in chest: §d${(value / valuePer).toInt()}")
+ add("")
+ add("§6Total value: §d$price")
}
- add(Renderable.clickAndHover("§6${stack.displayName}: §b$price", tips) {
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- if (index.contains(slot.slotIndex)) {
- if (slotList.contains(slot.slotIndex)) {
- slotList.remove(slot.slotIndex)
- } else {
- slotList.add(slot.slotIndex)
- }
- }
- }
- })
+ add(Renderable.hoverTips("§6${stack.displayName}: §b$price", tips, indexes = index, stack = stack))
})
}
val total = itemMap.values.fold(0.0) { acc, pair -> acc + pair.second }.formatPrice()