From f7d02cac3d28a3f84bb8c8416f44b5250aae52ea Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 01:07:01 +0800 Subject: fixes & update + fixes using old master stars itemName making sba go brrr (requires new feature below) + added SBA's item pick up log (exactly same with sba, but fixes ^) (please use these 2 features together, either use both of them or don't, also please turn "Item Pickup Log" in SBA off) --- features/globalSettings/index.js | 145 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 140 insertions(+), 5 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index f5913ff..20a47c2 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -4,6 +4,8 @@ import Feature from "../../featureClass/class"; import ButtonSetting from "../settings/settingThings/button"; import TextSetting from "../settings/settingThings/textSetting"; import ToggleSetting from "../settings/settingThings/toggle"; +import HudTextElement from "../hud/HudTextElement"; +import LocationSetting from "../settings/settingThings/location"; import firstLoadPages from "./firstLoadPages"; import GuiPage from "../soopyGui/GuiPage" import Notification from "../../../guimanager/Notification"; @@ -54,7 +56,14 @@ class GlobalSettings extends Feature { 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.oldMasterStars = new ToggleSetting("Use Old Master Stars", "replaces the ugly new master star on item name with the old fashion one", false, "old_master_star", this) + this.sbaItemPickUpLog = new ToggleSetting("Sba Item Pick Up Log", "Same as sba item pick up log, but fixes old master stars making it go brrr", true, "sba_item_log", this); + this.sbaItemPickUpLogElement = new HudTextElement() + .setText("") + .setToggleSetting(this.sbaItemPickUpLog) + .setLocationSetting(new LocationSetting("Sba Item Pick Up Log location", "Allows you to change location of this display", "sba_item_log_location", this, [10, 100, 1, 1]).requires(this.sbaItemPickUpLog).editTempText(`&a+ 1x &dHeroic Hyperion &c✪✪✪✪✪\n&c- 1x &dHeroic Hyperion &6✪✪✪✪✪`)); + this.hudElements.push(this.sbaItemPickUpLogElement); this.registerEvent('itemTooltip', (lore, i, e) => { if (!this.oldMasterStars.getValue()) return @@ -62,27 +71,98 @@ class GlobalSettings extends Feature { let itemName = i.getName() let itemNameReformat = itemName.removeFormatting() if (itemNameReformat.endsWith("➊")) { - i.setName(itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➊", "&c✪&6✪✪✪✪")) + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➊", "§c✪§6✪✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) return } if (itemNameReformat.endsWith("➋")) { - i.setName(itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➋", "&c✪✪&6✪✪✪")) + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➋", "§c✪✪§6✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) return } if (itemNameReformat.endsWith("➌")) { - i.setName(itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➌", "&c✪✪✪&6✪✪")) + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➌", "§c✪✪✪§6✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) return } if (itemNameReformat.endsWith("➍")) { - i.setName(itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➍", "&c✪✪✪✪&6✪")) + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➍", "§c✪✪✪✪§6✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) return } if (itemNameReformat.endsWith("➎")) { - i.setName(itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➎", "&c✪✪✪✪✪")) + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➎", "§c✪✪✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) return } }) + this.itemData = {}; + this.oldItemData = {}; + this.initOldItemData(); + this.todoPickUpLog = []; + + this.registerStep(true, 5, () => { + let old = this.oldMasterStars.getValue(); + let pick = this.sbaItemPickUpLog.getValue(); + if (!old && !pick) return + let j = 0; + let now = Date.now(); + [...Player.getInventory().getItems()].forEach(i => { + j++; + if (i) { + let uuid = getSBUUID(i) + if (old) { + if (uuid && this.itemData.hasOwnProperty(uuid)) { + let newName = this.itemData[uuid] + if (i.getName() != newName) { + i.setName(newName) + } + } + } + } + if (pick) { + let oldItem = this.oldItemData[j] + let newItem = i + if (!oldItem && !newItem) return //they both are air + let oldItemAmount = oldItem ? oldItem.getNBT().toObject()?.Count : 0 + let oldItemName = oldItem ? oldItem.getName() : "" + let newItemAmount = newItem ? newItem.getNBT().toObject()?.Count : 0 + let newItemName = newItem ? newItem.getName() : "" + this.oldItemData[j] = newItem + if (oldItemName === newItemName) { //only amount is changed + if (oldItemAmount === newItemAmount) return + this.addToTodoPickUpLog(now, oldItemName, newItemAmount - oldItemAmount) + return //so it doesn't provide duplicate message + } + if (getSBUUID(oldItem) === getSBUUID(newItem) && oldItem) return // fixes using old master star making sba go brrr + if (oldItem) { //thing removed from that inventory slot + this.addToTodoPickUpLog(now, oldItemName, (-1) * oldItemAmount) + } + if (newItem) { //thing being placed into that inventory slot + this.addToTodoPickUpLog(now, newItemName, newItemAmount) + } + } + }) + let todoText = []; + if (pick) { + this.todoPickUpLog.forEach((i, index, array) => { //positive and negative prefix colors + if (Math.abs(i.timeStamp - now) > 5000) { + array.splice(index, 1) + } + todoText.push((i.Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount) + "x &r" + i.itemName) + }); + } else { + this.todoPickUpLog = []; + } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list + this.sbaItemPickUpLogElement.setText(todoText.join("\n")) + }) + this.firstPageSettings = [this.darkTheme] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} @@ -255,6 +335,56 @@ class GlobalSettings extends Feature { }) } + addToTodoPickUpLog(timestamp, itemname, amount) { + this.todoPickUpLog.push({ + timeStamp: timestamp, + itemName: itemname, + Amount: amount + }) + } + + initOldItemData() { + let j = 0; + [...Player.getInventory().getItems()].forEach(i => { + j++; + this.oldItemData[j] = i + }) + } + + saveItemData(uuid, newName) { + if (!this.itemData[uuid]) { + this.itemData[uuid] = newName + } + } + + updateItemPrices() { + 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 (!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 (this.requestingPrices.has(uuid)) return + + this.requestingPrices.add(uuid) + + let json = i.getNBT().toObject() + socketConnection.requestItemPrice(json, uuid) + }) + } + // renderWebpage() { // let url = this.getField(Client.currentGui.get(), f.linkText) @@ -606,7 +736,12 @@ class GlobalSettings extends Feature { this.apiKeySetting.setValue(key) } + initVariables() { + this.hudElements = []; + } + onDisable() { + this.hudElements.forEach(h => h.delete()) this.initVariables() } } -- cgit From 3dff26823ee3e3cf07d85889105279c85a0bfad8 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:01:18 +0800 Subject: small salvaging fix + fixed salvaging something making the pickup log saying -0x Epic Dreadlord Sword (don't need to put this in changelog) --- features/globalSettings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 20a47c2..ca1519b 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -155,7 +155,7 @@ class GlobalSettings extends Feature { if (Math.abs(i.timeStamp - now) > 5000) { array.splice(index, 1) } - todoText.push((i.Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount) + "x &r" + i.itemName) + todoText.push((i.Amount > -1 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) }); } else { this.todoPickUpLog = []; -- cgit From a34391dd76097c51e9ad8847779db2b88b31d42e Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:13:15 +0800 Subject: added check + added a check for pickup log to exclude sbmenu and armor pieces so it doesnt go brrr when u open menu/ switch armor with wardrobe --- features/globalSettings/index.js | 1 + 1 file changed, 1 insertion(+) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index ca1519b..ffa7b9f 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -130,6 +130,7 @@ class GlobalSettings extends Feature { let oldItem = this.oldItemData[j] let newItem = i if (!oldItem && !newItem) return //they both are air + if (j > 36 || j == 9) return //sbmenu and armors (when switching wardrobe it goes brrr w/o this) let oldItemAmount = oldItem ? oldItem.getNBT().toObject()?.Count : 0 let oldItemName = oldItem ? oldItem.getName() : "" let newItemAmount = newItem ? newItem.getNBT().toObject()?.Count : 0 -- cgit From 3142f3c939b7cae12928b401efbcec193b1ba3c1 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:40:02 +0800 Subject: small fix + 2 registerChats to prevent pickup log going brrr after warping into a different lobby (yes its 10s ish after i tested) --- features/globalSettings/index.js | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index ffa7b9f..274457f 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -17,6 +17,7 @@ import socketConnection from "../../socketConnection"; import renderLibs from "../../../guimanager/renderLibs"; import { f } from "../../../mappings/mappings"; import { addLore, getSBUUID } from "../../utils/utils"; +import { delay } from "../../utils/delayUtils"; const Files = Java.type("java.nio.file.Files") const Paths = Java.type("java.nio.file.Paths") const JavaString = Java.type("java.lang.String") @@ -106,6 +107,7 @@ class GlobalSettings extends Feature { this.oldItemData = {}; this.initOldItemData(); this.todoPickUpLog = []; + this.clearLog = false; this.registerStep(true, 5, () => { let old = this.oldMasterStars.getValue(); @@ -151,18 +153,31 @@ class GlobalSettings extends Feature { } }) let todoText = []; - if (pick) { - this.todoPickUpLog.forEach((i, index, array) => { //positive and negative prefix colors - if (Math.abs(i.timeStamp - now) > 5000) { - array.splice(index, 1) - } - todoText.push((i.Amount > -1 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) - }); - } else { - this.todoPickUpLog = []; - } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list + if (!this.clearLog) { + if (pick) { + this.todoPickUpLog.forEach((i, index, array) => { //positive and negative prefix colors + if (Math.abs(i.timeStamp - now) > 5000) { + array.splice(index, 1) + } + todoText.push((i.Amount > -1 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) + }); + } else { + this.todoPickUpLog = []; + } + } + // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list this.sbaItemPickUpLogElement.setText(todoText.join("\n")) }) + //2 chat registeries below prevents pickup log to go brrr when warping + this.registerChat("&eSkyBlock Dungeon Warp${p}", () => { + this.clearLog = true + delay(10000, () => { this.clearLog = false }) + }) + + this.registerChat("&r&7Warping...${island}", () => { + this.clearLog = true + delay(10000, () => { this.clearLog = false }) + }) this.firstPageSettings = [this.darkTheme] -- cgit From bb19b9667e23ae8f408b3edcc204ef85a2b2aa05 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:48:08 +0800 Subject: Update index.js 10s -> 12.5s nvmm i think it needs longer --- features/globalSettings/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 274457f..cb12c4c 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -171,12 +171,12 @@ class GlobalSettings extends Feature { //2 chat registeries below prevents pickup log to go brrr when warping this.registerChat("&eSkyBlock Dungeon Warp${p}", () => { this.clearLog = true - delay(10000, () => { this.clearLog = false }) + delay(12500, () => { this.clearLog = false }) }) this.registerChat("&r&7Warping...${island}", () => { this.clearLog = true - delay(10000, () => { this.clearLog = false }) + delay(12500, () => { this.clearLog = false }) }) this.firstPageSettings = [this.darkTheme] -- cgit From 29bc7f9f65f196b4e1703d86692d0debc0791fc7 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 02:57:05 +0800 Subject: wrong thing math is fun! --- features/globalSettings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index cb12c4c..185c5c1 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -159,7 +159,7 @@ class GlobalSettings extends Feature { if (Math.abs(i.timeStamp - now) > 5000) { array.splice(index, 1) } - todoText.push((i.Amount > -1 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) + todoText.push((i.Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) }); } else { this.todoPickUpLog = []; -- cgit From f7185ba108df10f3d102a5be1294649daeaff6c6 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 03:08:41 +0800 Subject: +worldLoad for pickup log only doing 1-8 hot bar slots --- features/globalSettings/index.js | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 185c5c1..eaa296d 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -103,6 +103,48 @@ class GlobalSettings extends Feature { } }) + this.registerEvent('worldLoad', () => { + if (!this.oldMasterStars.getValue()) return + let j = 0; + [...Player.getInventory().getItems()].forEach(i => { + j++; + if (j > 8) return //only do the 1-8 hot bar slots + if (!i) return + let itemName = i.getName() + let itemNameReformat = itemName.removeFormatting() + if (itemNameReformat.endsWith("➊")) { + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➊", "§c✪§6✪✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) + return + } + if (itemNameReformat.endsWith("➋")) { + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➋", "§c✪✪§6✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) + return + } + if (itemNameReformat.endsWith("➌")) { + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➌", "§c✪✪✪§6✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) + return + } + if (itemNameReformat.endsWith("➍")) { + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➍", "§c✪✪✪✪§6✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) + return + } + if (itemNameReformat.endsWith("➎")) { + let newItemName = itemName.replace("§6✪§6✪§6✪§6✪§6✪§c➎", "§c✪✪✪✪✪") + i.setName(newItemName) + this.saveItemData(getSBUUID(i), newItemName) + return + } + }) + }) + this.itemData = {}; this.oldItemData = {}; this.initOldItemData(); -- cgit From 98e6000939b1fdded936f46969bcea04c975c993 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 04:21:38 +0800 Subject: this.todoPickUpLog array -> object so i can merge the same items into the same line --- features/globalSettings/index.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index eaa296d..1430824 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -148,7 +148,7 @@ class GlobalSettings extends Feature { this.itemData = {}; this.oldItemData = {}; this.initOldItemData(); - this.todoPickUpLog = []; + this.todoPickUpLog = {}; this.clearLog = false; this.registerStep(true, 5, () => { @@ -197,14 +197,16 @@ class GlobalSettings extends Feature { let todoText = []; if (!this.clearLog) { if (pick) { - this.todoPickUpLog.forEach((i, index, array) => { //positive and negative prefix colors - if (Math.abs(i.timeStamp - now) > 5000) { - array.splice(index, 1) + Object.keys(this.todoPickUpLog).forEach((i) => { + if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount) { + delete this.todoPickUpLog[i] + return } - todoText.push((i.Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(i.Amount == 0 ? 1 : i.Amount) + "x &r" + i.itemName) - }); + //positive and negative prefix colors + todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount == 0 ? 1 : this.todoPickUpLog[i].Amount) + "x &r" + i) + }) } else { - this.todoPickUpLog = []; + this.todoPickUpLog = {}; } } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list @@ -394,11 +396,16 @@ class GlobalSettings extends Feature { } addToTodoPickUpLog(timestamp, itemname, amount) { - this.todoPickUpLog.push({ + let basicValue = 0 + if (this.todoPickUpLog[itemname]) { + if (this.todoPickUpLog[itemname].Amount > 0) { + basicValue = this.todoPickUpLog[itemname].Amount + } + } + this.todoPickUpLog[itemname] = { timeStamp: timestamp, - itemName: itemname, - Amount: amount - }) + Amount: basicValue + amount + } } initOldItemData() { -- cgit From 59914a8efc0e5001a8397322622d564b9cfbcdac Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 04:23:23 +0800 Subject: remove unused function --- features/globalSettings/index.js | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 1430824..30ba992 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -422,34 +422,6 @@ class GlobalSettings extends Feature { } } - updateItemPrices() { - 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 (!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 (this.requestingPrices.has(uuid)) return - - this.requestingPrices.add(uuid) - - let json = i.getNBT().toObject() - socketConnection.requestItemPrice(json, uuid) - }) - } - // renderWebpage() { // let url = this.getField(Client.currentGui.get(), f.linkText) -- cgit From 0bd5136dc20141235dbb2e20f35bd5d71bb2fb2a Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 04:55:17 +0800 Subject: fix fix not being able to record negative amount cuz it got returned --- features/globalSettings/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 30ba992..689df07 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -185,11 +185,13 @@ class GlobalSettings extends Feature { this.addToTodoPickUpLog(now, oldItemName, newItemAmount - oldItemAmount) return //so it doesn't provide duplicate message } - if (getSBUUID(oldItem) === getSBUUID(newItem) && oldItem) return // fixes using old master star making sba go brrr - if (oldItem) { //thing removed from that inventory slot + let olduuid = getSBUUID(oldItem) + let newuuid = getSBUUID(newItem) + if (oldItemAmount == 1 && olduuid == newuuid) return // fixes using old master star making sba go brrr + if (oldItemName) { //thing removed from that inventory slot this.addToTodoPickUpLog(now, oldItemName, (-1) * oldItemAmount) } - if (newItem) { //thing being placed into that inventory slot + if (newItemName) { //thing being placed into that inventory slot this.addToTodoPickUpLog(now, newItemName, newItemAmount) } } -- cgit From 7940ae49e4327f77345821764c8346cb44657848 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 05:00:58 +0800 Subject: actually fixing a bug actually fix it saying 0 items gained --- features/globalSettings/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 689df07..767f2ee 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -175,13 +175,13 @@ class GlobalSettings extends Feature { let newItem = i if (!oldItem && !newItem) return //they both are air if (j > 36 || j == 9) return //sbmenu and armors (when switching wardrobe it goes brrr w/o this) - let oldItemAmount = oldItem ? oldItem.getNBT().toObject()?.Count : 0 + let oldItemAmount = oldItem ? oldItem.getNBT().toObject()?.Count : undefined let oldItemName = oldItem ? oldItem.getName() : "" - let newItemAmount = newItem ? newItem.getNBT().toObject()?.Count : 0 + let newItemAmount = newItem ? newItem.getNBT().toObject()?.Count : undefined let newItemName = newItem ? newItem.getName() : "" this.oldItemData[j] = newItem if (oldItemName === newItemName) { //only amount is changed - if (oldItemAmount === newItemAmount) return + if (oldItemAmount === newItemAmount || !newItemAmount || !oldItemAmount) return this.addToTodoPickUpLog(now, oldItemName, newItemAmount - oldItemAmount) return //so it doesn't provide duplicate message } @@ -189,9 +189,11 @@ class GlobalSettings extends Feature { let newuuid = getSBUUID(newItem) if (oldItemAmount == 1 && olduuid == newuuid) return // fixes using old master star making sba go brrr if (oldItemName) { //thing removed from that inventory slot + if (!oldItemAmount) return this.addToTodoPickUpLog(now, oldItemName, (-1) * oldItemAmount) } if (newItemName) { //thing being placed into that inventory slot + if (!newItemAmount) return this.addToTodoPickUpLog(now, newItemName, newItemAmount) } } @@ -200,12 +202,12 @@ class GlobalSettings extends Feature { if (!this.clearLog) { if (pick) { Object.keys(this.todoPickUpLog).forEach((i) => { - if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount) { + if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount || this.todoPickUpLog[i].Amount == 0) { delete this.todoPickUpLog[i] return } //positive and negative prefix colors - todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount == 0 ? 1 : this.todoPickUpLog[i].Amount) + "x &r" + i) + todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &r" + i) }) } else { this.todoPickUpLog = {}; -- cgit From fe6878c328dca8b78a5e4eeb7af7c85e0649b659 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 07:01:26 +0800 Subject: Update index.js --- features/globalSettings/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 767f2ee..a17cf50 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -59,7 +59,7 @@ class GlobalSettings extends Feature { this.showChampion = new ToggleSetting("Show champion enchant info in lore", "", true, "show_champion", this) this.oldMasterStars = new ToggleSetting("Use Old Master Stars", "replaces the ugly new master star on item name with the old fashion one", false, "old_master_star", this) - this.sbaItemPickUpLog = new ToggleSetting("Sba Item Pick Up Log", "Same as sba item pick up log, but fixes old master stars making it go brrr", true, "sba_item_log", this); + this.sbaItemPickUpLog = new ToggleSetting("Sba Item Pick Up Log", "Same as sba item pick up log, but fixes old master stars making it go brrr", false, "sba_item_log", this); this.sbaItemPickUpLogElement = new HudTextElement() .setText("") .setToggleSetting(this.sbaItemPickUpLog) @@ -207,7 +207,7 @@ class GlobalSettings extends Feature { return } //positive and negative prefix colors - todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &r" + i) + if (todoText.length < 12) todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &r" + i) }) } else { this.todoPickUpLog = {}; @@ -227,6 +227,13 @@ class GlobalSettings extends Feature { delay(12500, () => { this.clearLog = false }) }) + this.registerChat("&r&c ☠ ${info} and became a ghost&r&7.&r", (info, e) => { + if (info.includes("You")) { + this.clearLog = true + delay(12500, () => { this.clearLog = false }) + } + }); + this.firstPageSettings = [this.darkTheme] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} -- cgit From fd9a1fe37623833e5c90642503ea96e220a14d7f Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 20:36:05 +0800 Subject: bug fixes + fixed it sometimes bypasses clearLog when warping frequently + prevent dying/revived in dungeons making it go brrr --- features/globalSettings/index.js | 77 ++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 19 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index a17cf50..61d2173 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -150,6 +150,7 @@ class GlobalSettings extends Feature { this.initOldItemData(); this.todoPickUpLog = {}; this.clearLog = false; + this.maxAmount = 12; this.registerStep(true, 5, () => { let old = this.oldMasterStars.getValue(); @@ -199,41 +200,79 @@ class GlobalSettings extends Feature { } }) let todoText = []; - if (!this.clearLog) { - if (pick) { - Object.keys(this.todoPickUpLog).forEach((i) => { - if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount || this.todoPickUpLog[i].Amount == 0) { - delete this.todoPickUpLog[i] - return - } - //positive and negative prefix colors - if (todoText.length < 12) todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &r" + i) - }) - } else { - this.todoPickUpLog = {}; - } + if (pick) { + Object.keys(this.todoPickUpLog).forEach((i) => { + if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount || this.todoPickUpLog[i].Amount == 0) { + delete this.todoPickUpLog[i] + return + } + //positive and negative prefix colors + if (todoText.length < this.maxAmount) todoText.push((this.todoPickUpLog[i].Amount > 0 ? "&r&a+ " : "&r&c- ") + Math.abs(this.todoPickUpLog[i].Amount) + "x &r" + i) + }) + } else { + this.todoPickUpLog = {}; + } + if (this.guiOpened) { + this.todoPickUpLog = {}; } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list this.sbaItemPickUpLogElement.setText(todoText.join("\n")) }) //2 chat registeries below prevents pickup log to go brrr when warping + this.warpedAgain = false this.registerChat("&eSkyBlock Dungeon Warp${p}", () => { - this.clearLog = true - delay(12500, () => { this.clearLog = false }) + this.maxAmount = 0 + this.warpedAgain = true + delay(8000, () => { + if (this.warpedAgain) { + this.warpedAgain = false + this.maxAmount = 12 + } + }) }) this.registerChat("&r&7Warping...${island}", () => { - this.clearLog = true - delay(12500, () => { this.clearLog = false }) + this.maxAmount = 0 + this.warpedAgain = true + delay(8000, () => { + if (this.warpedAgain) { + this.warpedAgain = false + this.maxAmount = 12 + } + }) }) this.registerChat("&r&c ☠ ${info} and became a ghost&r&7.&r", (info, e) => { if (info.includes("You")) { - this.clearLog = true - delay(12500, () => { this.clearLog = false }) + this.maxAmount = 0 + this.warpedAgain = true + delay(5000, () => { + if (this.warpedAgain) { + this.warpedAgain = false + this.maxAmount = 12 + } + }) } }); + this.registerChat("${info}You were revived by ${info2}", () => { + this.maxAmount = 0 + this.warpedAgain = true + delay(5000, () => { + if (this.warpedAgain) { + this.warpedAgain = false + this.maxAmount = 12 + } + }) + }); + this.guiOpened = false; + this.registerEvent('guiOpened', () => { + this.guiOpened = true + }) + this.registerEvent('guiClosed', () => { + this.guiOpened = false + }) + this.firstPageSettings = [this.darkTheme] this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} -- cgit From cc714e8ae5397e6b451e9b50e36bfbead3d6ac41 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 22:21:39 +0800 Subject: changed how inGui thing works --- features/globalSettings/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 61d2173..12d5a26 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -200,6 +200,12 @@ class GlobalSettings extends Feature { } }) let todoText = []; + if (this.guiOpened) { + this.maxAmount = 0 + this.todoPickUpLog = {}; + } else if (!this.warpedAgain) { + this.maxAmount = 12 + } if (pick) { Object.keys(this.todoPickUpLog).forEach((i) => { if (Math.abs(this.todoPickUpLog[i].timeStamp - now) > 5000 || !this.todoPickUpLog[i].Amount || this.todoPickUpLog[i].Amount == 0) { @@ -212,9 +218,6 @@ class GlobalSettings extends Feature { } else { this.todoPickUpLog = {}; } - if (this.guiOpened) { - this.todoPickUpLog = {}; - } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list this.sbaItemPickUpLogElement.setText(todoText.join("\n")) }) -- cgit From 4089a5d2b0fe6f459de09d5d509fd4506741b5e8 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 22:48:35 +0800 Subject: fixing + fixed opening gui twice sets the variable to false --- features/globalSettings/index.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 12d5a26..9f6e657 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -200,11 +200,9 @@ class GlobalSettings extends Feature { } }) let todoText = []; - if (this.guiOpened) { - this.maxAmount = 0 + let inGui = Client.isInGui(); + if (inGui) { this.todoPickUpLog = {}; - } else if (!this.warpedAgain) { - this.maxAmount = 12 } if (pick) { Object.keys(this.todoPickUpLog).forEach((i) => { @@ -219,7 +217,7 @@ class GlobalSettings extends Feature { this.todoPickUpLog = {}; } // doesn't need to put setText() in if (pick) cuz if (!pick) it clears the todo log list - this.sbaItemPickUpLogElement.setText(todoText.join("\n")) + this.sbaItemPickUpLogElement.setText(inGui ? "" : (todoText.join("\n"))) }) //2 chat registeries below prevents pickup log to go brrr when warping this.warpedAgain = false @@ -268,13 +266,6 @@ class GlobalSettings extends Feature { } }) }); - this.guiOpened = false; - this.registerEvent('guiOpened', () => { - this.guiOpened = true - }) - this.registerEvent('guiClosed', () => { - this.guiOpened = false - }) this.firstPageSettings = [this.darkTheme] -- cgit From 73c4500e118dcbbbdd752081dffe40161dfa6d44 Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Thu, 11 Aug 2022 22:54:31 +0800 Subject: forgot something --- features/globalSettings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 9f6e657..5429401 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -201,7 +201,7 @@ class GlobalSettings extends Feature { }) let todoText = []; let inGui = Client.isInGui(); - if (inGui) { + if (inGui || this.warpedAgain) { this.todoPickUpLog = {}; } if (pick) { -- cgit