aboutsummaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-09-07 19:49:54 +0800
committerGitHub <noreply@github.com>2022-09-07 19:49:54 +0800
commitf404f4f94a4394328b3d1f94b012e7d9cc0aa0d2 (patch)
treea327a09fae90b15652d849954074378ef5105756 /features
parent440138a8c05cb5cfbe28c5e77387e049b1db7108 (diff)
parentcd7b714f5e344359b7606c57282376f834084e99 (diff)
downloadSoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.tar.gz
SoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.tar.bz2
SoopyV2-f404f4f94a4394328b3d1f94b012e7d9cc0aa0d2.zip
Merge pull request #60 from Soopyboo32/terminal-solvers
Terminal solvers
Diffstat (limited to 'features')
-rw-r--r--features/dungeonSolvers/index.js71
-rw-r--r--features/globalSettings/index.js34
2 files changed, 97 insertions, 8 deletions
diff --git a/features/dungeonSolvers/index.js b/features/dungeonSolvers/index.js
index 83faf41..144951a 100644
--- a/features/dungeonSolvers/index.js
+++ b/features/dungeonSolvers/index.js
@@ -24,6 +24,13 @@ try {
} catch (e) {
//player doesent have translate (using english default)
}
+let wrongColorList = {
+ "light grey": "silver",
+ "wool": "white wool",
+ "ink": "black ink",
+ "lapis": "blue lapis",
+ "cocoa": "brown cocoa"
+}
class DungeonSolvers extends Feature {
constructor() {
@@ -168,17 +175,17 @@ class DungeonSolvers extends Feature {
let timerText = ""
if (this.spiritMaskOutsideDungeon.getValue() ? true : !this.eraseBonzoTimer) {
if (this.spiritMask.getValue()) {
- let timer1 = Math.round((this.spiritMaskTimer - Date.now())/100)/10
+ let timer1 = Math.round((this.spiritMaskTimer - Date.now()) / 100) / 10
timerText += "&5Spirit Mask: " + (timer1 > 0 ? "&c" + timer1 + "&6s" : "&6READY") + "\n"
}
}
if (!this.eraseBonzoTimer) {
if (this.normalBonzoMask.getValue()) {
- let timer2 = Math.round((this.bonzoMaskTimer - Date.now())/100)/10
+ let timer2 = Math.round((this.bonzoMaskTimer - Date.now()) / 100) / 10
timerText += "&9Bonzo's Mask: " + (timer2 > 0 ? "&c" + timer2 + "&6s" : "&6READY") + "\n"
}
if (this.fraggedBonzoMask.getValue()) {
- let timer3 = Math.round((this.fraggedBonzoMaskTimer - Date.now())/100)/10
+ let timer3 = Math.round((this.fraggedBonzoMaskTimer - Date.now()) / 100) / 10
timerText += "&9⚚ Bonzo's Mask: " + (timer3 > 0 ? "&c" + timer3 + "&6s" : "&6READY")
}
}
@@ -815,6 +822,64 @@ class DungeonSolvers extends Feature {
}
}
+ /**
+ * TODO: This is code from old soopyaddons, needs almost complete recode.
+ * TODO: Also needs support for the new terminals, namely click at time
+ * TODO: Make click on time scan even when terminal is throttled (update on chat msg)
+ * TODO: Make all terminal solvers track when the server will accept the click and update on that
+ */
+ findNeededClicks() {
+ let itemsHighlight = []
+ if (ChatLib.removeFormatting(Player.getContainer().getName()).startsWith("What starts with: '") && ChatLib.removeFormatting(Player.getContainer().getName()).endsWith("'?")) {
+ let letter = ChatLib.removeFormatting(Player.getContainer().getName()).substr(19, 1).toLowerCase()
+ let i = 0;
+ Player.getContainer().getItems().forEach((item) => {
+ if (ChatLib.removeFormatting(item.getName()).toLowerCase().startsWith(letter) && !item.isEnchanted()) {
+ itemsHighlight.push(i)
+ }
+ i++
+ })
+ }
+ if (ChatLib.removeFormatting(Player.getContainer().getName()).startsWith("Select all the ") && ChatLib.removeFormatting(Player.getContainer().getName()).endsWith(" items!")) {
+ let color = ChatLib.removeFormatting(Player.getContainer().getName()).substr(15).replace(" items!", "").toLowerCase()
+ let i = 0;//silver -> light grey die, white -> wool--
+ Player.getContainer().getItems().forEach((item) => {
+ let name = ChatLib.removeFormatting(item.getName()).toLowerCase()
+ Object.entries(wrongColorList).forEach(([from, to]) => {
+ name.replace(from, to)
+ })
+ if (name.replace("wool", "white wool").includes(color) && !item.isEnchanted()) {
+ itemsHighlight.push(i)
+ }
+ i++
+ })
+ }
+ if (ChatLib.removeFormatting(Player.getContainer().getName()) === "Click in order!") {
+ let i = 0;//silver -> light grey die, white -> wool--
+ let number = 100;
+ Player.getContainer().getItems().forEach((item, i) => {
+ if (parseInt(ChatLib.removeFormatting(item.getName())) < number && item.getMetadata() === 14) {
+ number = parseInt(ChatLib.removeFormatting(item.getName()))
+ }
+ i++
+ })
+ i = 0
+ Player.getContainer().getItems().forEach((item) => {
+ if (parseInt(ChatLib.removeFormatting(item.getName())) === number) {
+ itemsHighlight.push(i)
+ }
+ i++
+ })
+ i = 0
+ Player.getContainer().getItems().forEach((item) => {
+ if (parseInt(ChatLib.removeFormatting(item.getName())) === number + 1) {
+ itemsHighlight2.push(i)
+ }
+ i++
+ })
+ }
+ }
+
onWorldLoad() {
this.lastWorldload = Date.now()
this.goneInBonus = false;
diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js
index 0fd74e9..e8b86ab 100644
--- a/features/globalSettings/index.js
+++ b/features/globalSettings/index.js
@@ -370,19 +370,43 @@ class GlobalSettings extends Feature {
item: Player.getHeldItem().getNBT().toObject()
}
}).json(json => {
- ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALASIS:")
- json.details.sort((a, b) => {
+ ChatLib.chat(this.FeatureManager.messagePrefix + "PRICE ANALYSIS (Total: $" + numberWithCommas(Math.round(json.price)) + ")")
+ // json.details.sort((a, b) => {
+ // if (typeof (a) === "string") return 1
+ // if (typeof (b) === "string") return -1
+ // return a[1] - b[1]
+ // }).forEach(d => {
+ // if (typeof (d) === "string") {
+ // ChatLib.chat(d)
+ // } else {
+ // ChatLib.chat("&f" + d[0] + "&7: &6" + numberWithCommas(Math.round(d[1])))
+ // }
+ // })
+ // ChatLib.chat(this.FeatureManager.messagePrefix + "Final price: " + numberWithCommas(Math.round(json.price)))
+ json.details.sort((b, a) => {
if (typeof (a) === "string") return 1
if (typeof (b) === "string") return -1
- return a[1] - b[1]
+ return a.price - b.price
}).forEach(d => {
if (typeof (d) === "string") {
ChatLib.chat(d)
} else {
- ChatLib.chat("&f" + d[0] + "&7: &6" + numberWithCommas(Math.round(d[1])))
+ if (!d.price) return
+ let lore = []
+ d.items.sort((b, a) => {
+ if (typeof (a) === "string") return 1
+ if (typeof (b) === "string") return -1
+ return a[1] - b[1]
+ }).forEach(d2 => {
+ if (typeof (d2) === "string") {
+ lore.push(d2)
+ } else {
+ lore.push("&f" + d2[0] + "&7: $&6" + numberWithCommas(Math.round(d2[1])))
+ }
+ })
+ new TextComponent("&d" + d.name + "&7: $&6" + numberWithCommas(Math.round(d.price))).setHover("show_text", lore.join("\n")).chat()
}
})
- ChatLib.chat(this.FeatureManager.messagePrefix + "Final price: " + numberWithCommas(Math.round(json.price)))
})
})