aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-02-19 23:46:19 +0100
committerLinnea Gräf <nea@nea.moe>2024-02-19 23:46:19 +0100
commit5db2ea9e6c19c7c5054499ee7ca020546949df3d (patch)
tree44e6df4b1650b312911c577bc430fa44d104ad6e /src/main/java/at/hannibal2/skyhanni/data
parent128b8db7ad7e8633af231d6f547aca1eed3c1e95 (diff)
downloadSkyHanni-feat/sackmonitor.tar.gz
SkyHanni-feat/sackmonitor.tar.bz2
SkyHanni-feat/sackmonitor.zip
Add sack HUDfeat/sackmonitor
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
index ee9ea621c..bbb8c26aa 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SackAPI.kt
@@ -288,6 +288,16 @@ object SackAPI {
sackData = sackData.editCopy { this[item] = SackItem(amount, 0, SackStatus.CORRECT) }
}
+ /**
+ * Get a list of all known items the sacks.
+ */
+ fun getAllKnownSackItems(): Set<NEUInternalName> {
+ return ProfileStorageData.sackProfiles?.sackContents?.keys ?: emptySet()
+ }
+
+ /**
+ * Get information about how many items are contained within the sacks for the given item type.
+ */
fun fetchSackItem(item: NEUInternalName): SackItem {
sackData = ProfileStorageData.sackProfiles?.sackContents ?: return SackItem(0, 0, SackStatus.MISSING)
@@ -299,7 +309,21 @@ object SackAPI {
return sackData[item] ?: return SackItem(0, 0, SackStatus.MISSING)
}
- fun commandGetFromSacks(item: String, amount: Int) = LorenzUtils.sendCommandToServer("gfs $item $amount")
+ /**
+ * Send a request to hypixel to receive items from the sacks. Has a roughly 2 second cooldown.
+ * Note that our own internal command queueing sends faster than that cooldown, so additional measures need to be
+ * taken to slow down those requests.
+ */
+ fun commandGetFromSacks(
+ /**
+ * The [item id](NEUInternalName) or the name of the item you want to get.
+ */
+ item: String,
+ /**
+ * The amount of items you want to request
+ */
+ amount: Int
+ ) = LorenzUtils.sendCommandToServer("gfs $item $amount")
private fun saveSackData() {
ProfileStorageData.sackProfiles?.sackContents = sackData