aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/NeedsConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/SackDataUpdateEvent.kt3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt20
4 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/NeedsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/NeedsConfig.java
index b60b6207f..002b44a16 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/NeedsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/visitor/NeedsConfig.java
@@ -33,6 +33,12 @@ public class NeedsConfig {
public boolean showPrice = true;
@Expose
+ @ConfigOption(name = "Show Sack Count", desc = "Show the amount of this item that you already have in your sacks. " +
+ "§eOnly updates on sack change messages.")
+ @ConfigEditorBoolean
+ public boolean showSackCount = true;
+
+ @Expose
@ConfigOption(name = "Item Preview", desc = "Show the base type for the required items next to new visitors. §cNote that some visitors may require any crop.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
index 8a2c511b3..e2ce24672 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.SackChangeEvent
+import at.hannibal2.skyhanni.events.SackDataUpdateEvent
import at.hannibal2.skyhanni.features.fishing.FishingAPI
import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
import at.hannibal2.skyhanni.features.inventory.SackDisplay
@@ -300,6 +301,8 @@ object SackAPI {
private fun saveSackData() {
ProfileStorageData.sackProfiles?.sackContents = sackData
SkyHanniMod.configManager.saveConfig(ConfigFileType.SACKS, "saving-data")
+
+ SackDataUpdateEvent().postAndCatch()
}
data class SackGemstone(
diff --git a/src/main/java/at/hannibal2/skyhanni/events/SackDataUpdateEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/SackDataUpdateEvent.kt
new file mode 100644
index 000000000..f9e3831d1
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/SackDataUpdateEvent.kt
@@ -0,0 +1,3 @@
+package at.hannibal2.skyhanni.events
+
+class SackDataUpdateEvent : LorenzEvent()
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 8607a12af..4bcd4a079 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
@@ -3,11 +3,14 @@ package at.hannibal2.skyhanni.features.garden.visitor
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.garden.visitor.VisitorConfig.HighlightMode
import at.hannibal2.skyhanni.data.IslandType
+import at.hannibal2.skyhanni.data.SackAPI
+import at.hannibal2.skyhanni.data.SackStatus
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent
import at.hannibal2.skyhanni.events.PreProfileSwitchEvent
+import at.hannibal2.skyhanni.events.SackDataUpdateEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorAcceptedEvent
import at.hannibal2.skyhanni.events.garden.visitor.VisitorArrivalEvent
@@ -177,6 +180,18 @@ class GardenVisitorFeatures {
list.add(" §7(§6$format§7)")
}
+ if (config.needs.showSackCount) {
+ val sackItemData = SackAPI.fetchSackItem(internalName)
+ val itemStatus = sackItemData.getStatus()
+ val itemAmount = sackItemData.amount
+ if (itemStatus == SackStatus.OUTDATED) {
+ list.add(" §cdata outdated, open sacks")
+ } else {
+ val textColour = if (itemAmount > amount) "a" else "e"
+ list.add(" §${textColour}x${sackItemData.amount.addSeparators()} §7in your sack")
+ }
+ }
+
add(list)
}
if (totalPrice > 0) {
@@ -240,6 +255,11 @@ class GardenVisitorFeatures {
}
@SubscribeEvent
+ fun onSackUpdate(event: SackDataUpdateEvent) {
+ update()
+ }
+
+ @SubscribeEvent
fun onVisitorRefused(event: VisitorRefusedEvent) {
update()
GardenVisitorDropStatistics.deniedVisitors += 1