diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-09 21:47:06 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-09 21:47:06 +0100 |
| commit | c98bbe34efab04cf46dde6a573b57275a69c5722 (patch) | |
| tree | 998cb4d4a8c04b82b06d00edae197ea4fcc9ad35 /src/main/java/at/hannibal2/skyhanni/api | |
| parent | 6157bc46e3355cf353767572c46bba3fb6f8d02f (diff) | |
| download | skyhanni-c98bbe34efab04cf46dde6a573b57275a69c5722.tar.gz skyhanni-c98bbe34efab04cf46dde6a573b57275a69c5722.tar.bz2 skyhanni-c98bbe34efab04cf46dde6a573b57275a69c5722.zip | |
Added support for slayer tracker items for loot from area mini-bosses. Fixed a bug where some items were counted twice.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/api')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt index 2476cbe73..29ce97471 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/CollectionAPI.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.api import at.hannibal2.skyhanni.events.CollectionUpdateEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent +import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -66,6 +67,17 @@ class CollectionAPI { } } + @SubscribeEvent + fun onItemAdd(event: ItemAddInInventoryEvent) { + // TODO add support for replenish (higher collection than actual items in inv) + val internalName = event.internalName + if (internalName.getItemStackOrNull() == null) { + LorenzUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") + return + } + collectionValue.addOrPut(internalName, event.amount.toLong()) + } + companion object { // TODO USE SH-REPO val collectionValue = mutableMapOf<NEUInternalName, Long>() @@ -74,14 +86,5 @@ class CollectionAPI { fun isCollectionTier0(lore: List<String>) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() } fun getCollectionCounter(internalName: NEUInternalName): Long? = collectionValue[internalName] - - // TODO add support for replenish (higher collection than actual items in inv) - fun addFromInventory(internalName: NEUInternalName, amount: Int) { - if (internalName.getItemStackOrNull() == null) { - LorenzUtils.debug("CollectionAPI.addFromInventory: item is null for '$internalName'") - return - } - collectionValue.addOrPut(internalName, amount.toLong()) - } } -}
\ No newline at end of file +} |
