aboutsummaryrefslogtreecommitdiff
path: root/features/globalSettings
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-08-10 17:30:48 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-08-10 17:30:48 +0800
commit533756ee56072894f59d45f7bffd433830426cfd (patch)
treebb4409ce84f025f7c174bf6d85f02bf0a7f93139 /features/globalSettings
parentf15b6b06d27525e80be44512cc8554fb12b33c9d (diff)
downloadSoopyV2-533756ee56072894f59d45f7bffd433830426cfd.tar.gz
SoopyV2-533756ee56072894f59d45f7bffd433830426cfd.tar.bz2
SoopyV2-533756ee56072894f59d45f7bffd433830426cfd.zip
+ hecatomb and champion info in lore
Diffstat (limited to 'features/globalSettings')
-rw-r--r--features/globalSettings/index.js58
1 files changed, 44 insertions, 14 deletions
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 1c1381a..115b790 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -20,6 +20,9 @@ const Paths = Java.type("java.nio.file.Paths")
const JavaString = Java.type("java.lang.String")
const JavaLong = Java.type("java.lang.Long")
+let hecatombLevels = [2, 5, 10, 20, 30, 40, 60, 80, 100]
+let championLevels = [50000, 100000, 250000, 500000, 1000000, 1500000, 2000000, 2500000, 3000000]
+
class GlobalSettings extends Feature {
constructor() {
super()
@@ -49,6 +52,8 @@ class GlobalSettings extends Feature {
this.hideFallingBlocks = new ToggleSetting("Hide falling blocks", "NOTE: This setting is a bit laggy", false, "hide_falling_sand", this)
this.twitchCommands = new ToggleSetting("Ingame twitch bot commands", "Allows u to use twitch bot commands ingame (eg -sa)", true, "twitch_commands_ingame", this)
this.itemWorth = new ToggleSetting("(Approximate) Item worth in lore", "Accounts for stuff like enchants/recombs ect", false, "item_worth", this)
+ this.showHecatomb = new ToggleSetting("Show hecatomb enchant info in lore", "", true, "show_hecatomb", this)
+ this.showChampion = new ToggleSetting("Show champion enchant info in lore", "", true, "show_champion", this)
this.firstPageSettings = [this.darkTheme]
@@ -87,7 +92,7 @@ class GlobalSettings extends Feature {
}
this.requestingPrices = new Set()
- this.registerStep(false, 1, this.updateItemPrices)
+ this.registerStep(false, 1, this.updateItemLores)
this.registerEvent("worldLoad", () => {
this.requestingPrices.clear()
})
@@ -167,31 +172,56 @@ class GlobalSettings extends Feature {
})
}
- updateItemPrices() {
+ updateItemLores() {
if (!this.itemWorth.getValue()) return;
[...Player.getInventory().getItems(), ...Player.getContainer().getItems()].forEach(i => {
let uuid = getSBUUID(i)
if (!uuid) return
- let a = socketConnection.itemPricesCache.get(uuid)
+ if (this.itemWorth.getValue()) {
+ let a = socketConnection.itemPricesCache.get(uuid)
- if (!a && socketConnection.itemPricesCache2.get(uuid)) {
- a = socketConnection.itemPricesCache2.get(uuid)
- socketConnection.itemPricesCache.set(uuid, a)
- }
+ if (!a && socketConnection.itemPricesCache2.get(uuid)) {
+ a = socketConnection.itemPricesCache2.get(uuid)
+ socketConnection.itemPricesCache.set(uuid, a)
+ }
- if (a) {
- addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a)))
- return
+ if (a) {
+ addLore(i, "§eWorth: ", "§6$" + numberWithCommas(Math.round(a)))
+ return
+ }
+
+ if (this.requestingPrices.has(uuid)) return
+
+ this.requestingPrices.add(uuid)
+
+ let json = i.getNBT().toObject()
+ socketConnection.requestItemPrice(json, uuid)
}
- if (this.requestingPrices.has(uuid)) return
+ if (this.showChampion.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")) {
+ let xp = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getDouble("champion_combat_xp")
+
+ let level = 1
+ championLevels.forEach(l => {
+ if (xp >= l) level++
+ })
+ let xpNext = championLevels[level - 1]
- this.requestingPrices.add(uuid)
+ addLore(i, "§eChampion: ", "§d" + level + " §6" + numberWithCommas(Math.round(xp)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : ""))
+ }
+ if (this.showHecatomb.getValue() && i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")) {
+ let runs = i?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")?.getInteger("hecatomb_s_runs")
- let json = i.getNBT().toObject()
- socketConnection.requestItemPrice(json, uuid)
+ let level = 1
+ hecatombLevels.forEach(l => {
+ if (runs >= l) level++
+ })
+ let xpNext = hecatombLevels[level - 1]
+
+ addLore(i, "§eHecatomb: ", "§d" + level + " §6" + numberWithCommas(Math.round(runs)) + (xpNext ? " §7/ §6" + numberWithCommas(Math.round(xpNext)) : ""))
+ }
})
}