diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-29 10:57:57 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-29 10:57:57 +0800 |
commit | 996d99f533e8dcc8aa4a471097f5d6a93de894f4 (patch) | |
tree | 4a965697b77983f07457c2498c08738d0d2624c9 /src | |
parent | 62b3e2b485fc576b5c3ca90035e44b29fdf48ae3 (diff) | |
download | SoopyV2-996d99f533e8dcc8aa4a471097f5d6a93de894f4.tar.gz SoopyV2-996d99f533e8dcc8aa4a471097f5d6a93de894f4.tar.bz2 SoopyV2-996d99f533e8dcc8aa4a471097f5d6a93de894f4.zip |
fix api cant find current profile
Diffstat (limited to 'src')
-rw-r--r-- | src/features/bestiary/index.js | 4 | ||||
-rw-r--r-- | src/features/dungeonSolvers/index.js | 8 | ||||
-rw-r--r-- | src/features/hud/index.js | 10 | ||||
-rw-r--r-- | src/metadata.json | 4 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/features/bestiary/index.js b/src/features/bestiary/index.js index e9106c5..ead03ef 100644 --- a/src/features/bestiary/index.js +++ b/src/features/bestiary/index.js @@ -144,11 +144,9 @@ class Bestiary extends Feature { if (dataType !== "skyblock") return; let currentProfile = {} - let currentProfileTime = 0 data.profiles.forEach(p => { - if (p.members[Player.getUUID().toString().replace(/-/g, "")].last_save > currentProfileTime) { - currentProfileTime = p.members[Player.getUUID().toString().replace(/-/g, "")].last_save + if (p.selected) { currentProfile = p.members[Player.getUUID().toString().replace(/-/g, "")] } }) diff --git a/src/features/dungeonSolvers/index.js b/src/features/dungeonSolvers/index.js index 4d4fb81..787879a 100644 --- a/src/features/dungeonSolvers/index.js +++ b/src/features/dungeonSolvers/index.js @@ -671,15 +671,15 @@ class DungeonSolvers extends Feature { let data = await fetch(`https://api.hypixel.net/skyblock/profiles?key=${this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue()}&uuid=${uuid}`).json() if (!data.success) return - let latestProfile = [0, undefined] + let latestProfile = undefined data.profiles.forEach(p => { - if (p.members[uuid].last_save > latestProfile[0]) { - latestProfile = [p.members[uuid].last_save, p.members[uuid].pets.some(pet => pet.type === "SPIRIT" && pet.tier === "LEGENDARY")] + if (p.selected) { + latestProfile = p.members[uuid].pets.some(pet => pet.type === "SPIRIT" && pet.tier === "LEGENDARY") } }) - if (latestProfile[1]) { + if (latestProfile) { this.firstDeathHadSpirit = true if (this.scoreCalculation.getValue()) ChatLib.chat(this.FeatureManager.messagePrefix + username + " has spirit pet!") } else { diff --git a/src/features/hud/index.js b/src/features/hud/index.js index fad13c5..bd211e6 100644 --- a/src/features/hud/index.js +++ b/src/features/hud/index.js @@ -676,10 +676,10 @@ class Hud extends Feature { this.potsHudElement.setText(text) } - updatePotsData(data) { + updatePotsData(data, lastSave) { this.potsExpireAt = {} let now = Date.now() - if (Date.now() - data.last_save < 5 * 60000) now = data.last_save + if (Date.now() - lastSave < 5 * 60000) now = lastSave data.active_effects.forEach(e => { this.potsExpireAt[e.effect] = { level: e.level, @@ -690,14 +690,16 @@ class Hud extends Feature { } statApiLoadThingo(data) { + let lastSave = 0 data.profiles.forEach(p => { - if (!this.lastStatData || (p.members[Player.getUUID().toString().replace(/-/g, "")] && p.members[Player.getUUID().toString().replace(/-/g, "")].last_save > this.lastStatData.last_save)) { + if (!this.lastStatData || p.selected) { this.lastStatData = p.members[Player.getUUID().toString().replace(/-/g, "")] + lastSave = p.last_save } }) if (this.lastStatData) { - this.updatePotsData(this.lastStatData) + this.updatePotsData(this.lastStatData, lastSave) if (this.lastStatData.soulflow) this.apiSoulflow = true if (this.apiSoulflow) this.soulflowElement.setText("&6Soulflow&7> &f" + this.numberUtils.numberWithCommas(this.lastStatData.soulflow)) diff --git a/src/metadata.json b/src/metadata.json index 12517b6..e85d39a 100644 --- a/src/metadata.json +++ b/src/metadata.json @@ -5,8 +5,8 @@ "entry": "index.js", "description": "SoopyV2", "name": "SoopyV2", - "version": "2.1.171", - "versionId": 298, + "version": "2.1.172", + "versionId": 299, "requires": [ "soopyApis", "soopyAddonsData", |