aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chat/grieferTrack.js62
-rw-r--r--chat/message.js36
-rw-r--r--commandManager.js110
-rw-r--r--commands/calculate/calcSpeed.js47
-rw-r--r--commands/calculate/calculate.js36
-rw-r--r--commands/calculate/hotmCalc.js66
-rw-r--r--commands/calculate/tick.js93
-rw-r--r--commands/claim.js103
-rw-r--r--commands/credits.js7
-rw-r--r--commands/fetchDiscord.js12
-rw-r--r--commands/help.js10
-rw-r--r--commands/reload.js11
-rw-r--r--commands/spiral.js2
-rw-r--r--commands/throne.js2
-rw-r--r--commands/tick.js64
-rw-r--r--data/collections.json87
-rw-r--r--data/hotm.json151
-rw-r--r--index.js149
-rw-r--r--metadata.json2
-rw-r--r--render/collectionGui.js64
-rw-r--r--render/cwGui.js178
-rw-r--r--render/dwarvenNotifier.js36
-rw-r--r--render/gemstoneMiningStats.js99
-rw-r--r--render/miningAbilities.js95
-rw-r--r--render/naturals.js37
-rw-r--r--render/tabList.js39
-rw-r--r--render/textGuiCreator.js20
-rw-r--r--settings.js156
-rw-r--r--util/constants.js28
-rw-r--r--util/grieferTrack.js47
-rw-r--r--util/helperFunctions.js352
-rw-r--r--util/updater.js35
32 files changed, 1720 insertions, 516 deletions
diff --git a/chat/grieferTrack.js b/chat/grieferTrack.js
new file mode 100644
index 0000000..2b745c3
--- /dev/null
+++ b/chat/grieferTrack.js
@@ -0,0 +1,62 @@
+import axios from "../../axios"
+import settings from "../settings"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+let checkedPlayers = [],
+ griefers = []
+
+
+register("step", () => {
+ let date_ob = new Date(),
+ seconds = date_ob.getSeconds()
+
+ if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
+ checkMMiners()
+}).setFps(1)
+
+
+register("worldLoad", () => {
+ checkedPlayers = []
+ setTimeout(() => {
+ checkMMiners()
+ }, 1500)
+})
+
+
+function checkMMiners()
+{
+ if (!settings.trackGriefers) return
+ try
+ {
+ const NetHandlerPlayClient = Client.getConnection(),
+ PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
+
+ PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => {
+ let player = PlayerMP.func_178845_a().name
+
+ if(!checkedPlayers.includes(player))
+ {
+ if(griefers.includes(player))
+ ChatLib.chat(`${PREFIX}&e'${player}' is a griefer!`)
+ checkedPlayers.push(player)
+ }
+ })
+ } catch(err) { if(settings.debug) console.log("grieferTrack trycatch: " + err) }
+
+ return checkedPlayers
+}
+
+
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/mminers`)
+ .then(res => {
+ griefers = res.data.griefers
+ })
+ .catch(err => {
+ if(!settings.debug) return
+ ChatLib.chat(err)
+ })
+})
+
+
+export default "" \ No newline at end of file
diff --git a/chat/message.js b/chat/message.js
index 79b6be1..27cf78f 100644
--- a/chat/message.js
+++ b/chat/message.js
@@ -40,6 +40,17 @@ register("chat", (level, typeOfChat, hypixelRank, username, playerMessage, event
ChatLib.chat(newMessage)
}).setCriteria(/^(\[\d+\] )?((?:(?:Guild|Party|Co-op) > )|(?:\[:v:\] ))?(\[\w+\+{0,2}\] )?(\w{1,16})(?: \[\w{1,6}\])?: (.*)$/g)
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/coleweight-leaderboard?length=500`)
+ .then(res => {
+ cwlbData = res.data
+ })
+ .catch(err => {
+ ChatLib.chat(err)
+ })
+})
+
+
register("messageSent", (origMessage, event) => { // emotes! this was fun to make :)
let commandState = 0,
command = "",
@@ -75,14 +86,21 @@ register("messageSent", (origMessage, event) => { // emotes! this was fun to mak
ChatLib.say(`${message}`)
})
-register("worldLoad", () => {
- axios.get(`https://ninjune.dev/api/coleweight-leaderboard?length=500`)
- .then(res => {
- cwlbData = res.data
- })
- .catch(err => {
- ChatLib.chat(err)
- })
-})
+
+// first time check
+register("step", () => {
+ if (constants.data.first_time)
+ {
+ constants.data.first_time = false
+ constants.data.save()
+ ChatLib.chat("")
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bPlease Set Your Api Key By Doing /api new`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bOr By Doing /cw setkey (key)`)).chat()
+ new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat()
+ ChatLib.chat("")
+ }
+ if (constants.data.api_key == undefined || constants.data.api_key == "") return
+}).setFps(1);
+
export default "" \ No newline at end of file
diff --git a/commandManager.js b/commandManager.js
index cf28a8c..591676c 100644
--- a/commandManager.js
+++ b/commandManager.js
@@ -2,9 +2,9 @@ import { openTimerGui } from "./render/timerGui.js"
import { openPowderGui } from "./render/powertrackerGui"
import { openCoordsGui } from "./render/coordsGui.js"
import { openDowntimeGui } from "./render/downtimeGui.js"
-import { openCwGui } from "./render/cwGui"
+import { openCwGui, reloadColeweight } from "./render/cwGui"
+import { openCollectionGui, reloadCollection, trackCollection } from "./render/collectionGui"
import { help } from "./commands/help"
-import { reload } from "./commands/reload"
import { setkey } from "./commands/setkey"
import { spiral } from "./commands/spiral"
import { throne } from "./commands/throne"
@@ -14,27 +14,30 @@ import { update } from "./commands/update"
import { fetchDiscord } from "./commands/fetchDiscord"
import { findColeweight } from "./commands/findColeweight"
import { claim } from "./commands/claim"
-import { tick } from "./commands/tick"
import { time } from "./commands/time"
import { info } from "./commands/info"
+import { credits } from "./commands/credits"
import Settings from "./settings"
import constants from "./util/constants"
import { clearLobbies } from "./commands/markingLobbies"
import { divans } from "./commands/divans.js"
+import { calculate } from "./commands/calculate/calculate.js"
+import { openMiningAbilitiesGui } from "./render/miningAbilities.js"
-register("command", (arg, arg2, arg3) => {
- if (arg == undefined) {findColeweight(arg); return}
- switch(arg.toLowerCase())
+register("command", (...args) => {
+ console.log(args[0])
+ if (args[0] == undefined) {findColeweight(args[0]); return}
+ switch(args[0].toString().toLowerCase())
{
case "setkey":
- setkey(arg2)
+ setkey(args[1])
break
case "help":
help()
break
case "move":
- if (arg2 == undefined) {ChatLib.chat(`${constants.PREFIX}&cNot enough arguments.`); return}
- switch(arg2.toLowerCase())
+ if (args[1] == undefined) {ChatLib.chat(`${constants.PREFIX}&cNot enough arguments.`); return}
+ switch(args[1].toLowerCase())
{
case "coleweight":
openCwGui()
@@ -49,21 +52,37 @@ register("command", (arg, arg2, arg3) => {
case "downtime":
openDowntimeGui()
break
+ case "collection":
+ openCollectionGui()
+ break
+ case "miningabilities":
+ openMiningAbilitiesGui()
+ break
default:
ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${arg2}'.`)
}
break
case "throne":
- throne(arg2)
+ throne(args[1])
break
case "spiral":
- spiral(arg2)
+ spiral(args[1])
break
case "reload":
- reload()
+ switch(args[1].toLowerCase())
+ {
+ case "coleweight":
+ reloadColeweight()
+ break
+ case "collection":
+ reloadCollection()
+ break
+ default:
+ ChatLib.chat(`${constants.PREFIX}&cNo such gui as '${args[1]}'.`)
+ }
break
case "leaderboard":
- leaderboard(arg2, arg3)
+ leaderboard(args[1], args[2])
break
case "update":
update()
@@ -73,14 +92,11 @@ register("command", (arg, arg2, arg3) => {
Settings.openGUI()
break
case "claim":
- claim(arg2)
+ claim(args[1])
break
case "powdertrackersync":
updateDisplay()
break
- case "tick":
- tick(arg2, arg3)
- break
case "time":
time()
break
@@ -91,37 +107,71 @@ register("command", (arg, arg2, arg3) => {
clearLobbies()
break
case "yog":
- yog(arg2)
+ yog(args[1])
break
case "divans":
case "divan":
- divans(arg2)
+ divans(args[1])
break
case "coord":
case "coords":
openCoordsGui()
break
+ case "credits":
+ credits()
+ break
+ case "track":
+ trackCollection(args[1])
+ break
+ case "calc":
+ case "calculate":
+ calculate(args.slice(1))
+ break
default:
- findColeweight(arg)
+ findColeweight(args[0])
}
}).setTabCompletions((args) => {
let output = [],
+ calculateOptions = ["tick", "ms2toprofessional", "hotmcalc", "calchotm"],
commands = ["setkey", "help", "move", "toggle", "throne", "spiral", "reload", "leaderboard",
- "settings", "claim", "tick", "time", "info", "clearlobbies", "yog", "divan", "coords"]
+ "settings", "claim", "time", "info", "clearlobbies", "yog", "divan", "coords", "credits", "track", "calculate"]
if(args[0].length == 0 || args[0] == undefined)
- output = commands
+ return output = commands
+
+ if(args[0] == "calc" || args[0] == "calculate")
+ {
+ if(args[1] == undefined) output = calculateOptions
+
+ else
+ {
+ calculateOptions.forEach(calculateOption => {
+ for(let char = 0; char < args[1].length; char++)
+ {
+ if(calculateOption[char] != args[1][char])
+ break
+ else if(char == args[1].length - 1)
+ output.push(calculateOption)
+ }
+ })
+ }
+ }
else
{
- for(let i = 0; i < commands.length; i++)
+
+ if(args[0] == undefined) output = commands
+
+ else
{
- for(let j = 0; j < args[0].length; j++)
- {
- if(commands[i][j] != args[0][j])
- break
- else if(j == args[0].length - 1)
- output.push(commands[i])
- }
+ commands.forEach(command => {
+ for(let char = 0; char < args[0].length; char++)
+ {
+ if(command[char] != args[0][char])
+ break
+ else if(char == args[0].length - 1)
+ output.push(command)
+ }
+ })
}
}
return output
diff --git a/commands/calculate/calcSpeed.js b/commands/calculate/calcSpeed.js
new file mode 100644
index 0000000..1b2eae6
--- /dev/null
+++ b/commands/calculate/calcSpeed.js
@@ -0,0 +1,47 @@
+import constants from "../../util/constants"
+import { parseNotatedInput } from "../../util/helperFunctions"
+const PREFIX = constants.PREFIX
+
+
+export function calcSpeed(powder)
+{
+ let speedLevels = 1,
+ professionalLevels = 1
+
+ if(powder == undefined || parseNotatedInput(powder) == "NI") return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ powder = parseNotatedInput(powder)
+
+ while(powder > msPowder(speedLevels) + profPowder(professionalLevels))
+ {
+ if(ms2SpeedPerPowder(speedLevels + 1) > professionalSpeedPerPowder(professionalLevels + 1) && speedLevels < 50)
+ {
+ powder -= msPowder(speedLevels++)
+ }
+ else if (professionalLevels < 140)
+ {
+ powder -= profPowder(professionalLevels++)
+ }
+ else break
+ }
+ return ChatLib.chat(`&bGet &6&l${speedLevels} &bmining speed levels and &6&l${professionalLevels} &bprofessional levels.`)
+}
+
+function ms2SpeedPerPowder(miningSpeedLevel) // 40 speed per level
+{
+ return 40/msPowder(miningSpeedLevel)
+}
+
+function professionalSpeedPerPowder(professionalLevel) // 5 speed per level
+{
+ return 5/profPowder(professionalLevel)
+}
+
+function msPowder(miningSpeedLevel)
+{
+ return Math.floor(Math.pow(miningSpeedLevel+1, 3.2))
+}
+
+function profPowder(professionalLevel)
+{
+ return Math.floor(Math.pow(professionalLevel+1, 2.3))
+} \ No newline at end of file
diff --git a/commands/calculate/calculate.js b/commands/calculate/calculate.js
new file mode 100644
index 0000000..3d9d750
--- /dev/null
+++ b/commands/calculate/calculate.js
@@ -0,0 +1,36 @@
+import constants from "../../util/constants"
+import { hotmCalc } from "./hotmCalc"
+import { calcSpeed } from "./calcSpeed"
+import { tickCommand } from "./tick"
+import { helpCommand } from "../help"
+const PREFIX = constants.PREFIX
+
+
+export function calculate(args)
+{
+ switch(args[0].toLowerCase())
+ {
+ case "hotm":
+ case "hotmcalc":
+ case "calchotm":
+ hotmCalc(args[1], args[2], args[3])
+ break
+ case "tick":
+ tickCommand(args[1], args[2])
+ break
+ case "calcspeed":
+ case "speed":
+ calcSpeed(args[1])
+ break
+ case "help":
+ ChatLib.chat("&b--------------[ &a&l/cw calculate &b]--------------")
+ helpCommand("calculate tick", "Calculates tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))")
+ helpCommand("calculate speed", "Calculates the ratio of mining speed 2 to professional with a certain amount of powder.", "(powder)")
+ helpCommand("calculate hotm", "Calculates powder between two levels of a certain perk.", "(perk) (minlevel) [maxlevel]")
+ ChatLib.chat("&b------------------------------------------")
+ return
+ default:
+ return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ }
+}
+
diff --git a/commands/calculate/hotmCalc.js b/commands/calculate/hotmCalc.js
new file mode 100644
index 0000000..583b2b8
--- /dev/null
+++ b/commands/calculate/hotmCalc.js
@@ -0,0 +1,66 @@
+import constants from "../../util/constants"
+import { addCommas } from "../../util/helperFunctions"
+const PREFIX = constants.PREFIX
+
+
+export function hotmCalc(hotmName, minLevel, maxLevel)
+{
+ if(hotmName == undefined)
+ {
+ let hotmData = JSON.parse(FileLib.read("Coleweight", "data/hotm.json")).data
+
+ ChatLib.chat(`/cw calc hotm (hotmName listed below) (minLevel) [maxLevel]`)
+ for(let i = 0; i < hotmData.length; i++)
+ {
+ ChatLib.chat(hotmData[i].names[0])
+ }
+ return
+ }
+ if(maxLevel == undefined)
+ {
+ maxLevel = minLevel
+ minLevel = 1
+ }
+
+ if(minLevel != parseInt(minLevel) || maxLevel != parseInt(maxLevel)) return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+
+ minLevel = parseInt(minLevel)
+ maxLevel = parseInt(maxLevel)
+ let hotmObjectToFind = findHotmObject(hotmName)
+ if(hotmObjectToFind == undefined) return ChatLib.chat(`${PREFIX}&cDid not find HOTM perk with name '${hotmName}'!`)
+
+ maxLevel = (maxLevel < hotmObjectToFind.maxLevel ? maxLevel : hotmObjectToFind.maxLevel)
+
+ let powderSum = findCost(hotmObjectToFind.costFormula, minLevel, maxLevel),
+ reward = findReward(hotmObjectToFind.rewardFormula, minLevel, maxLevel)
+
+ ChatLib.chat("")
+ ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill cost &6&l${addCommas(Math.round(powderSum))} &6${hotmObjectToFind.powderType[0].toUpperCase() + hotmObjectToFind.powderType.slice(1)} &bpowder.`)
+ ChatLib.chat(`&6${hotmObjectToFind.nameStringed} ${minLevel} - ${maxLevel} &bwill give &6&l${addCommas(Math.round(reward * 100) / 100)} &bof whatever reward is listed.`)
+ ChatLib.chat("")
+}
+
+export function findHotmObject(hotmName)
+{
+ let hotmData = JSON.parse(FileLib.read("Coleweight", "data/hotm.json")).data
+
+ for(let i = 0; i < hotmData.length; i++)
+ {
+ if(hotmData[i].names.includes(hotmName))
+ return hotmData[i]
+ }
+}
+
+export function findCost(costFormula, minLevel, maxLevel)
+{
+ let powderSum = 0
+
+ for(let currentLevel = minLevel; currentLevel < maxLevel; currentLevel++) // finds cost
+ powderSum += eval(costFormula.replace("currentLevel", currentLevel))
+ return powderSum
+}
+
+export function findReward(rewardFormula, minLevel, maxLevel)
+{
+ return eval(rewardFormula.replace("Level", 1+maxLevel-minLevel))
+} \ No newline at end of file
diff --git a/commands/calculate/tick.js b/commands/calculate/tick.js
new file mode 100644
index 0000000..f8b2433
--- /dev/null
+++ b/commands/calculate/tick.js
@@ -0,0 +1,93 @@
+import constants from "../../util/constants"
+const PREFIX = constants.PREFIX
+
+export function tickCommand(speed, block)
+{
+ if(speed == undefined || parseInt(speed) != speed)
+ return ChatLib.chat(`${PREFIX}&cMining speed must be an integer!`)
+ if(block == undefined)
+ return ChatLib.chat(constants.CALCULATEERRORMESSAGE)
+ const ticks = findTick(speed, block)
+ if(ticks.err) return ChatLib.chat(`${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`)
+
+
+ ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(ticks.currentBlockTick)} ticks` +
+ `\n&bCurrently mining shards in &6&l${Math.round(ticks.currentShardTick)} ticks` +
+ `\n&bNext block tick will be at: &6&l${Math.round(ticks.nextBlockSpeed)} mining speed` +
+ `\n&bNext shard tick will be at: &6&l${Math.round(ticks.nextShardSpeed)} mining speed` +
+ `\n&bYou need &6&l${Math.round(ticks.nextBlockSpeed - speed)} mining speed&b to get the next block tick.` +
+ `\n&bYou need &6&l${Math.round(ticks.nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`)
+}
+
+
+export function findTick(speed, block)
+{
+ let ticks = {err: false},
+ strength = findStrength(block)
+
+ ticks.currentBlockTick = strength*30/speed
+ ticks.currentShardTick = (strength-200)*30/speed
+
+ if(strength < 1) return ticks.err = true
+
+
+ if(ticks.currentBlockTick < Math.floor(ticks.currentBlockTick) + 0.5)
+ ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)-0.5)
+ else
+ ticks.nextBlockSpeed = strength*30/(Math.floor(ticks.currentBlockTick)+0.5)
+
+ if(ticks.currentShardTick < Math.floor(ticks.currentShardTick) + 0.5)
+ ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)-0.5)
+ else
+ ticks.nextShardSpeed = strength*30/(Math.floor(ticks.currentShardTick)+0.5)
+
+ return ticks
+}
+
+function findStrength(block)
+{
+ let strength = -1
+
+ if(block == parseInt(block) && block > 5) // change if add block to tick speed blocks in settings
+ strength = block
+ else
+ {
+ switch(block.toString().toLowerCase())
+ {
+ case "0":
+ case "green_mithril":
+ strength = 800
+ break
+ case "1":
+ case "blue_mithril":
+ strength = 1500
+ break
+ case "2":
+ case "ruby":
+ case "r":
+ strength = 2500
+ break
+ case "3":
+ case "j":
+ case "jade":
+ case "a":
+ case "amber":
+ case "amethyst":
+ case "s":
+ case "sapphire":
+ strength = 3200
+ break
+ case "4":
+ case "t":
+ case "topaz":
+ case "o":
+ case "opal":
+ strength = 4000
+ case "5":
+ case "jasper":
+ strength = 5000
+ }
+ }
+
+ return strength
+}
diff --git a/commands/claim.js b/commands/claim.js
index ae20924..ef40b99 100644
--- a/commands/claim.js
+++ b/commands/claim.js
@@ -2,7 +2,10 @@ import axios from "../../axios"
import settings from "../settings"
import constants from "../util/constants"
const PREFIX = constants.PREFIX
+const path = `https://ninjune.dev`
const serverId = java.util.UUID.randomUUID().toString().replace("-", "")
+let claimedServers = []
+
export function claim(structure)
{
@@ -24,71 +27,91 @@ export function claim(structure)
return
}
- axios.get(`https://ninjune.dev/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`)
+ axios.get(`${path}/api/claim?type=${structure}&lobby=${constants.serverData.server}&username=${Player.getName()}&serverID=${serverId}`)
.then(res => {
if(res.data.success)
+ {
ChatLib.chat(`${PREFIX}&aSuccessfully claimed ${constants.serverData.server} as your server!`)
+ claimedServers.push({player: Player.getName(), server: constants.serverData.server, structure: structure})
+ return
+ }
else
{
- ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`)
+
if(res.data.code == 501)
{
ChatLib.chat(`${PREFIX}&cError: Not logged into the auth server. Try running the command again.`)
- Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ return Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
}
+ else
+ return ChatLib.chat(`${PREFIX}&cError: ${res.data.reason}.`)
}
})
.catch(err => {
- ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ return ChatLib.chat(`${PREFIX}&cError: ${err}`)
})
-
}
+
register('gameLoad', (event) => {
- Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ try
+ {
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ }
+ catch(e) {}
+ getClaimed()
})
+
register('worldLoad', () => {
if(!settings.claiming) return
- axios.get(`https://ninjune.dev/api/unclaim?username=${Player.getName()}&serverID=${serverId}`)
- .then(res => {
- if(settings.debug && !res.data.success)
- ChatLib.chat("Unclaim: " + res.data.reason)
- if(res.data.code == 501)
- Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
- })
- .catch(err => {
- if(settings.debug)
- ChatLib.chat(`${PREFIX}&cError: ${err}`)
- })
- // unclaims the lobby, isn't needed but will allow another player to claim lobby after claimer leaves.
+ getClaimed()
setTimeout(() => {
const NetHandlerPlayClient = Client.getConnection(),
PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
-
+ let player
+
if(settings.debug) console.log(constants.serverData.server)
- axios.get(`https://ninjune.dev/api/claimed?serverID=${constants.serverData.server}&authServer=${serverId}&passedName=${Player.getName()}`)
- .then(res => {
- if(res.data.claimed)
- {
- PlayerMap.filter(player => player.func_178853_c() /* getResponseTime */ > 0 && !player.func_178845_a()/* getGameProfile */.name.startsWith("!")).forEach((PlayerMP) => {
- let player = PlayerMP.func_178845_a()/* getGameProfile */.name
+
+ claimedServers.forEach((claimedServer) => {
+ PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => {
+ player = PlayerMP.func_178845_a().name
- res.data.structures.forEach((structure) => {
- if (player == structure.player)
- ChatLib.chat(`${PREFIX}&cThe ${structure.structure} in ${structure.server} is claimed by ${structure.player}.`)
- //holy im so good at naming things, structure.structure I must be a genius.
+ if (player == claimedServer.player && claimedServer.server == constants.serverData.server)
+ ChatLib.chat(`${PREFIX}&cThe ${claimedServer.structure} in ${claimedServer.server} is claimed by ${claimedServer.player}.`)
+ })
+
+ if (Player.getName() == claimedServer.player)
+ {
+ axios.get(`${path}/api/unclaim?username=${Player.getName()}&serverID=${serverId}`)
+ .then(res => {
+ if(settings.debug && !res.data.success)
+ ChatLib.chat("Unclaim: " + res.data.reason)
+ if(res.data.code == 501)
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
})
- })
- }
- else if (res.data.err && settings.debug)
- {
- ChatLib.chat("Check claim: " + res.data.reason)
- }
- })
- .catch(err => {
- if(!settings.debug) return
- ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ .catch(err => {
+ if(settings.debug)
+ ChatLib.chat(`${PREFIX}&cError: ${err}`)
+ })
+ }
})
}, 2000)
-}) \ No newline at end of file
+})
+
+
+function getClaimed()
+{
+ axios.get(`${path}/api/claimed?authServer=${serverId}&passedName=${Player.getName()}`)
+ .then(res => {
+ if(res.data.code == 501)
+ {
+ Client.getMinecraft().func_152347_ac().joinServer(Client.getMinecraft().func_110432_I().func_148256_e(), Client.getMinecraft().func_110432_I().func_148254_d(), serverId)
+ return
+ }
+ claimedServers = []
+ res.data.forEach(server => {
+ claimedServers.push(server)
+ })
+ })
+}
diff --git a/commands/credits.js b/commands/credits.js
new file mode 100644
index 0000000..af4aa28
--- /dev/null
+++ b/commands/credits.js
@@ -0,0 +1,7 @@
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+export function credits()
+{
+ ChatLib.chat(`${PREFIX}&bCW was made by Ninjune#0670 (NinOnCubed).`)
+} \ No newline at end of file
diff --git a/commands/fetchDiscord.js b/commands/fetchDiscord.js
index f44c385..f254edb 100644
--- a/commands/fetchDiscord.js
+++ b/commands/fetchDiscord.js
@@ -6,14 +6,14 @@ export function fetchDiscord(arg)
{
if(arg == undefined) { ChatLib.chat(`${PREFIX}&eRequires a username!`); return }
- axios.get(`https://api.ashcon.app/mojang/v2/user/${arg}`)
- .then(res => {
- let uuid = res.data.uuid
+ axios.get(`https://api.mojang.com/users/profiles/minecraft/${arg}`)
+ .then(mojangRes => {
+ let uuid = mojangRes.data.id
axios.get(`https://api.hypixel.net/player?key=${constants.data.api_key}&uuid=${uuid}`)
- .then(res2 => {
- let discordMessage = new TextComponent(`${PREFIX}&a${res.data.username}'s Discord: `)
+ .then(hypixelRes => {
+ let discordMessage = new TextComponent(`${PREFIX}&a${mojangRes.data.name}'s Discord: `)
ChatLib.chat(discordMessage);
- ChatLib.chat(`&b${res2.data.player.socialMedia.links.DISCORD}`)
+ ChatLib.chat(`&b${hypixelRes.data.player.socialMedia.links.DISCORD}`)
})
.catch(err => {
ChatLib.chat(`${PREFIX}&eNo discord linked :( (or no key linked)`)
diff --git a/commands/help.js b/commands/help.js
index 05c5a04..8e06b51 100644
--- a/commands/help.js
+++ b/commands/help.js
@@ -7,14 +7,15 @@ export function help()
helpCommand("", "Gets Coleweight of specified user", "(username)")
helpCommand("help", "This menu.", "")
helpCommand("time", "Prints time on timer (timer gui doesn't have to be visible).", "")
- helpCommand("tick", "Shows tick data.", "(mining speed) (('r','jade', etc) || breaking power of block))")
+ helpCommand("calculate", "Calculates things. '/cw calculate help' for more info.", "")
helpCommand("leaderboard", "Shows leaderboard.", "(min) [max]")
helpCommand("info", "Prints coleweight info.", "")
ChatLib.chat(ChatLib.getCenteredText("&a&lSettings"))
helpCommand("settings", "Opens settings.", "")
helpCommand("claim", "Claims a chollows sapphire structure in a lobby.", "(throne || spiral)")
- helpCommand("setkey", "Sets API key (can also use /api new)-", "(key)")
+ helpCommand("setkey", "Sets API key (can also use /api new)", "(key)")
helpCommand("reload", "Reloads the gui.", "")
+ helpCommand("track", "Sets tracked collection for collection tracker.", "(collection)")
ChatLib.chat(ChatLib.getCenteredText("&a&lWaypoints"))
helpCommand("coords", "Opens coords gui.", "")
helpCommand("throne", "Guide for setting up waypoints for throne.", "[toggle]")
@@ -27,8 +28,7 @@ export function help()
}
// Made by Almighty Stylla <3
-function helpCommand(command, desc, usage)
+export function helpCommand(command, desc, usage)
{
ChatLib.chat(new TextComponent(`&a${PREFIX} /cw ${command} => &b${desc}`).setHoverValue(`${"/cw " + command + " " + usage}`))
-}
-
+} \ No newline at end of file
diff --git a/commands/reload.js b/commands/reload.js
deleted file mode 100644
index 1c5fcc0..0000000
--- a/commands/reload.js
+++ /dev/null
@@ -1,11 +0,0 @@
-import constants from "../util/constants"
-const PREFIX = constants.PREFIX
-
-export function reload()
-{
- constants.upTimeTrack = false
- constants.stepsSinceLast = 0
- constants.cwValues = []
- constants.uptime = 0
- ChatLib.chat(`${PREFIX}Reloaded!`)
-} \ No newline at end of file
diff --git a/commands/spiral.js b/commands/spiral.js
index 6574f18..f9f00aa 100644
--- a/commands/spiral.js
+++ b/commands/spiral.js
@@ -45,7 +45,7 @@ export function spiral(arg2)
}
register("renderWorld", () => {
- waypointRender(spiralWaypoints, true)
+ waypointRender(spiralWaypoints, true, true)
})
register("worldLoad", () => {
diff --git a/commands/throne.js b/commands/throne.js
index 517c93d..c3a2e1c 100644
--- a/commands/throne.js
+++ b/commands/throne.js
@@ -41,7 +41,7 @@ export function throne(arg2)
register("renderWorld", () => {
- waypointRender(throneWaypoints, true)
+ waypointRender(throneWaypoints, true, true)
})
diff --git a/commands/tick.js b/commands/tick.js
deleted file mode 100644
index 7af81e2..0000000
--- a/commands/tick.js
+++ /dev/null
@@ -1,64 +0,0 @@
-import constants from "../util/constants"
-const PREFIX = constants.PREFIX
-
-export function tick(speed, block)
-{
- if(speed == undefined || parseInt(speed) != speed)
- return `${PREFIX}&cMining speed must be an integer!`
- let strength = findStrength(block)
- if(strength < 1) return `${PREFIX}&cBlock must be a gemstone or positive breaking power! (or starting letter of gemstone)`
- let currentBlockTick = strength*30/speed,
- currentShardTick = (strength-200)*30/speed,
- nextBlockSpeed, nextShardSpeed
-
- if(currentBlockTick < Math.floor(currentBlockTick) + 0.5)
- nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)-0.5)
- else
- nextBlockSpeed = strength*30/(Math.floor(currentBlockTick)+0.5)
-
- if(currentShardTick < Math.floor(currentShardTick) + 0.5)
- nextShardSpeed = strength*30/(Math.floor(currentShardTick)-0.5)
- else
- nextShardSpeed = strength*30/(Math.floor(currentShardTick)+0.5)
-
- ChatLib.chat(`\n&bCurrently mining blocks in &6&l${Math.round(currentBlockTick)} ticks` +
- `\n&bCurrently mining shards in &6&l${Math.round(currentShardTick)} ticks` +
- `\n&bNext block tick will be at: &6&l${Math.round(nextBlockSpeed)} mining speed` +
- `\n&bNext shard tick will be at: &6&l${Math.round(nextShardSpeed)} mining speed` +
- `\n&bYou need &6&l${Math.round(nextBlockSpeed - speed)} mining speed&b to get the next block tick.` +
- `\n&bYou need &6&l${Math.round(nextShardSpeed - speed)} mining speed&b to get the next shard tick.\n`)
-}
-
-function findStrength(block)
-{
- let strength = -1
-
- if(block == parseInt(block))
- strength = block
- else
- {
- switch(block.toLowerCase())
- {
- case "ruby":
- case "r":
- strength = 2500
- break
- case "j":
- case "jade":
- case "a":
- case "amber":
- case "amethyst":
- case "s":
- case "sapphire":
- strength = 3200
- break
- case "t":
- case "topaz":
- case "o":
- case "opal":
- strength = 4000
- }
- }
-
- return strength
-}
diff --git a/data/collections.json b/data/collections.json
new file mode 100644
index 0000000..e61a942
--- /dev/null
+++ b/data/collections.json
@@ -0,0 +1,87 @@
+{
+ "gemstone":
+ {
+ "collectionToTrack": "GEMSTONE_COLLECTION",
+ "collectionStringed": "Gemstone"
+ },
+ "mithril":
+ {
+ "collectionToTrack": "MITHRIL_ORE",
+ "collectionStringed": "Mithril"
+ },
+ "gold":
+ {
+ "collectionToTrack": "GOLD_INGOT",
+ "collectionStringed": "Gold"
+ },
+ "obsidian":
+ {
+ "collectionToTrack": "OBSIDIAN",
+ "collectionStringed": "Obsidian"
+ },
+ "netherrack":
+ {
+ "collectionToTrack": "NETHERRACK",
+ "collectionStringed": "Netherrack"
+ },
+ "diamond":
+ {
+ "collectionToTrack": "DIAMOND",
+ "collectionStringed": "Diamond"
+ },
+ "ice":
+ {
+ "collectionToTrack": "ICE",
+ "collectionStringed": "Ice"
+ },
+ "redstone":
+ {
+ "collectionToTrack": "REDSTONE",
+ "collectionStringed": "Redstone"
+ },
+ "lapis":
+ {
+ "collectionToTrack": "INK_SACK:4",
+ "collectionStringed": "Lapis"
+ },
+ "coal":
+ {
+ "collectionToTrack": "COAL",
+ "collectionStringed": "Coal"
+ },
+ "emerald":
+ {
+ "collectionToTrack": "EMERALD",
+ "collectionStringed": "Emerald"
+ },
+ "endstone":
+ {
+ "collectionToTrack": "ENDER_STONE",
+ "collectionStringed": "Endstone"
+ },
+ "glowstone":
+ {
+ "collectionToTrack": "GLOWSTONE_DUST",
+ "collectionStringed": "Glowstone"
+ },
+ "iron":
+ {
+ "collectionToTrack": "IRON_INGOT",
+ "collectionStringed": "Iron"
+ },
+ "mycelium":
+ {
+ "collectionToTrack": "MYCEL",
+ "collectionStringed": "Mycelium"
+ },
+ "quartz":
+ {
+ "collectionToTrack": "QUARTZ",
+ "collectionStringed": "Endstone"
+ },
+ "cobblestone":
+ {
+ "collectionToTrack": "COBBLESTONE",
+ "collectionStringed": "Cobblestone"
+ }
+} \ No newline at end of file
diff --git a/data/hotm.json b/data/hotm.json
new file mode 100644
index 0000000..1904b57
--- /dev/null
+++ b/data/hotm.json
@@ -0,0 +1,151 @@
+{"data": [
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3)",
+ "rewardFormula": "Level*20",
+ "nameStringed": "Mining Speed",
+ "names": ["miningspeed", "speed", "ms"],
+ "maxLevel": 50,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.05)",
+ "rewardFormula": "Level*5",
+ "nameStringed": "Mining Fortune",
+ "names": ["miningfortune", "fortune", "mf"],
+ "maxLevel": 50,
+ "powderType": "mithril"
+
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 4)",
+ "rewardFormula": "10+(Level*0.5)",
+ "nameStringed": "Quick Forge",
+ "names": ["quickforge", "forge"],
+ "maxLevel": 20,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "200+((currentLevel-1)*18)",
+ "rewardFormula": "(200+((Level-1)*18))*2",
+ "nameStringed": "Titanium Insanium",
+ "names": ["titaniuminsanium", "titanium", "tita"],
+ "maxLevel": 50,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "200+((currentLevel-1)*18)",
+ "rewardFormula": "(200+((Level-1)*18))*2",
+ "nameStringed": "Titanium Insanium",
+ "names": ["dailypowder"],
+ "maxLevel": 100,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.07)",
+ "rewardFormula": "5+Level",
+ "nameStringed": "Luck Of The Cave",
+ "names": ["luckofthecave", "caveluck", "luck"],
+ "maxLevel": 45,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.4)",
+ "rewardFormula": "20+((Level-1)*6)",
+ "nameStringed": "Crystallized",
+ "names": ["crystallized"],
+ "maxLevel": 30,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 2.6)",
+ "rewardFormula": "10+(Level*0.4)",
+ "nameStringed": "Efficient Miner",
+ "names": ["efficientminer", "efficient"],
+ "maxLevel": 100,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "currentLevel*70",
+ "rewardFormula": "0.2+(Level*0.01)",
+ "nameStringed": "Orbiter",
+ "names": ["orbiter", "orbit"],
+ "maxLevel": 80,
+ "powderType": "mithril"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 2.3)",
+ "rewardFormula": "5+(Level*0.1)",
+ "nameStringed": "Seasoned Mineman",
+ "names": ["seasonedmineman", "mineman"],
+ "maxLevel": 100,
+ "powderType": "mithril"
+ },
+ {
+ "1": { "cost": "0", "reward": "+1 Pickaxe Ability Level;+1 Token of the Mountain", "powderType": "mithril"},
+ "2": { "cost": "50000", "reward": "+1 Forge Slot", "powderType": "mithril" },
+ "3": { "cost": "75000", "reward": "+1 Commission Slot" },
+ "4": { "cost": "100000", "reward": "+1 base ᠅ Mithril Powder when mining Mithril", "powderType": "mithril" },
+ "5": { "cost": "125000", "reward": "+1 Token of the Mountain", "powderType": "mithril" },
+ "6": { "cost": "500000", "reward": "+1 base ᠅ Gemstone Powder when mining Gemstones", "powderType": "gemstone" },
+ "7": { "cost": "750000", "reward": "+1 Token of the Mountain", "powderType": "gemstone"},
+ "nameStringed": "Peak of the Mountain",
+ "names": ["peakofthemountain", "peak", "potm"],
+ "maxLevel": 7
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 2.2)",
+ "rewardFormula": "50+((Level-1)*5)",
+ "nameStringed": "Mole",
+ "names": ["mole"],
+ "maxLevel": 190,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 2.3)",
+ "rewardFormula": "50+(Level*5)",
+ "nameStringed": "Professional",
+ "names": ["professional", "prof"],
+ "maxLevel": 140,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.07)",
+ "rewardFormula": "5+((Level-1)*0.5)",
+ "nameStringed": "Lonesome Miner",
+ "names": ["lonesomeminer", "lonesome"],
+ "maxLevel": 45,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 4)",
+ "rewardFormula": "20+(4*(Level-1))",
+ "nameStringed": "Great Explorer",
+ "names": ["greatexplorer", "explorer"],
+ "maxLevel": 20,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.2)",
+ "rewardFormula": "Level*0.01",
+ "nameStringed": "Powder Buff",
+ "names": ["powderbuff", "powder"],
+ "maxLevel": 50,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.2)",
+ "rewardFormula": "Level*40",
+ "nameStringed": "Mining Speed II",
+ "names": ["miningspeedii", "miningspeed2", "speed2", "ms2"],
+ "maxLevel": 50,
+ "powderType": "gemstone"
+ },
+ {
+ "costFormula": "Math.pow((currentLevel+1), 3.2)",
+ "rewardFormula": "Level*5",
+ "nameStringed": "Mining Fortune II",
+ "names": ["miningfortuneii", "miningfortune2", "fortune2", "mf2"],
+ "maxLevel": 50,
+ "powderType": "gemstone"
+ }
+]} \ No newline at end of file
diff --git a/index.js b/index.js
index bb38e78..4961946 100644
--- a/index.js
+++ b/index.js
@@ -1,153 +1,10 @@
import './render/naturals'
import './render/tabList'
+import './render/gemstoneMiningStats'
+import './render/dwarvenNotifier'
import './commands/yog'
import './chat/apiNew'
import './chat/message'
import './chat/serverdata'
import './commandManager'
-import './util/updater'
-import './util/grieferTrack'
-import axios from '../axios'
-import constants from './util/constants';
-const PREFIX = constants.PREFIX
-
-//update every second (dogshit code)
-register("step", () => {
- // first time check
- if (constants.data.first_time)
- {
- constants.data.first_time = false
- constants.data.save()
- ChatLib.chat("")
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bPlease Set Your Api Key By Doing /api new`)).chat()
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bOr By Doing /cw setkey (key)`)).chat()
- new TextComponent(ChatLib.getCenteredText(`${PREFIX}&bView commands: /cw help`)).chat()
- ChatLib.chat("")
- }
- if (constants.data.api_key == undefined || constants.data.api_key == "") return
-
- // updates coleweight for gui
- let date_ob = new Date(),
- seconds = date_ob.getSeconds()
-
- if(constants.upTimeTrack == true)
- constants.uptime += 1
- if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
- {
- try
- {
- let tempUuid = Player.getUUID(),
- profileData = "",
- coleweight = 0,
- uuid = ""
-
- for(let i = 0; i < tempUuid.length; i++)
- {
- if(tempUuid[i] != "-")
- {
- uuid = uuid + tempUuid[i]
- }
- }
- axios.get(`https://ninjune.dev/api/cwinfo`)
- .then(cwInfoRes => {
- axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${uuid}`)
- .then(res => {
- let eq = 0,
- cwInfo = cwInfoRes.data
-
- for(let i=0; i < res.data.profiles.length; i+=1)
- {
- if(res.data.profiles[i].selected == true)
- profileData = res.data.profiles[i]
- }
-
- coleweight += Math.ceil((profileData.members[uuid][cwInfo.experience.name]/cwInfo.experience.req)*100) / 100
-
- for(let i = 0; i < cwInfo.powder.length; i++)
- {
- let sourceToSearch = cwInfo.powder[i].name,
- source = profileData.members[uuid].mining_core[sourceToSearch]
-
- if(source != undefined)
- {
- eq = Math.ceil(source/cwInfo.powder[i].req*100) / 100
-
- if(i == 0)
- {
- let powder2 = profileData.members[uuid].mining_core['powder_spent_mithril']
-
- if(powder2 != undefined)
- eq = Math.ceil((source+powder2)/cwInfo.powder[i].req*100) / 100
- }
- else
- {
- let powder2 = profileData.members[uuid].mining_core['powder_spent_gemstone']
-
- if(powder2 != undefined)
- eq = Math.ceil((source+powder2)/cwInfo.powder[i].req*100) / 100
- }
- coleweight += eq
- }
- }
-
- for(let i = 0; i < cwInfo.collection.length; i++)
- {
- let sourceToSearch = cwInfo.collection[i].name,
- source = profileData.members[uuid].collection[sourceToSearch]
-
- if(source != undefined)
- {
- eq = Math.ceil(source/cwInfo.collection[i].req*100) / 100
- coleweight += eq
- }
- }
-
- for(let i = 0; i < cwInfo.miscellaneous.length; i++)
- {
- let sourceToSearch = cwInfo.miscellaneous[i].name
- if(i == 0 || i == 1)
- source = profileData.members[uuid].bestiary[sourceToSearch]
- else
- source = profileData.members[uuid].mining_core.crystals.jade_crystal[sourceToSearch]
- if (source != undefined)
- {
- eq = Math.ceil(source/cwInfo.miscellaneous[i].req*100) / 100
- coleweight += eq
- }
- }
-
- if(constants.baseColeweight == 0)
- {
- constants.baseColeweight = coleweight
- }
- else if((coleweight - constants.baseColeweight) > 0)
- {
- constants.cwValues.push(coleweight - constants.baseColeweight)
- constants.calcCwPerHr = true
- constants.upTimeTrack = true
- constants.stepsSinceLast = 0
- constants.baseColeweight = coleweight
- }
- else if(constants.stepsSinceLast > 20)
- {
- constants.upTimeTrack = false
- constants.stepsSinceLast = 0
- constants.cwValues = []
- }
- else
- {
- constants.stepsSinceLast += 1
- }
-
- constants.data.coleweight = Math.ceil(coleweight*100)/100
- constants.data.save()
- })
- .catch(err => {ChatLib.chat(e)})
- })
- }
- catch(e)
- {
- ChatLib.chat(e)
- }
- }
-}).setFps(1); \ No newline at end of file
+import './chat/grieferTrack' \ No newline at end of file
diff --git a/metadata.json b/metadata.json
index e177ffb..6f3dfd2 100644
--- a/metadata.json
+++ b/metadata.json
@@ -3,6 +3,6 @@
"creator": "Ninjune",
"entry": "index.js",
"description": "Mining utilities.",
- "version": "1.6.9",
+ "version": "1.8.0",
"requires": ["axios", "PogData", "Vigilance", "Elementa"]
} \ No newline at end of file
diff --git a/render/collectionGui.js b/render/collectionGui.js
index 8197b11..4e6deee 100644
--- a/render/collectionGui.js
+++ b/render/collectionGui.js
@@ -1,43 +1,53 @@
-/*import constants from "../util/constants"
+import constants from "../util/constants"
+import settings from "../settings"
+import { trackerGui } from "../util/helperFunctions"
const PREFIX = constants.PREFIX
+const collectionMoveGui = new Gui()
+const collectionGui = new trackerGui("", "Collection Not set! /cw track", settings.collectionNotation)
-let collectionGui = new Gui(),
- collection = ""
export function trackCollection(arg)
{
- switch(arg)
- {
- case "obby":
- case "obsidian":
- collection = "OBSIDIAN"
- break
- default:
- ChatLib.chat(`${PREFIX}&eThat is not a valid collection! (or is not supported)`)
- }
+ collectionGui.resetVars()
+ let collections = JSON.parse(FileLib.read("Coleweight", "data/collections.json"))
+ if(arg == "obby") arg = "obsidian"
+ if(arg == "cobble") arg = "cobblestone"
+ if(collections[arg.toLowerCase()] == undefined) return ChatLib.chat(`${PREFIX}&eThat is not a valid collection! (or is not supported)`)
+ collectionGui.trackedItem = collections[arg].collectionToTrack
+ collectionGui.itemStringed = collections[arg].collectionStringed
+
+ ChatLib.chat(`${PREFIX}&bSet collection to ${collectionGui.itemStringed}!`)
+}
+
+export function openCollectionGui()
+{
+ collectionGui.moveGui()
}
-export function moveCollection()
+export function reloadCollection()
{
- collectionGui.open()
+ collectionGui.resetVars()
}
register("dragged", (dx, dy, x, y) => {
- if (!collectionGui.isOpen()) return
- constants.data.collectionX = x
- constants.data.collectionY = y
- constants.data.save()
+ if (!collectionGui.collectionMoveGui.isOpen()) return
+ constants.collectiondata.x = x
+ constants.collectiondata.y = y
+ constants.collectiondata.save()
})
register("renderOverlay", () => {
- if (cwGui.isOpen())
+ collectionGui.renderGui(constants.collectiondata.x, constants.collectiondata.y, settings.collectionNotation, settings.collectionTracker)
+})
+
+register("step", () => {
+ let date_ob = new Date(),
+ seconds = date_ob.getSeconds()
+
+ if(collectionGui.trackingItem == true)
+ collectionGui.uptimeSeconds += 1
+ if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
{
- let txt = "Please set your api key with /cw setkey (key)!"
- if (constants.data.api_key != undefined)
- txt = "Click anywhere to move!"
- Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- Renderer.drawStringWithShadow(`&aCollection: &b0\n&aCW/hr: &b0\n&aUptime: &b0m\n&aColeweight Gained: &b0`, constants.data.collectionX, constants.data.collectionY)
+ collectionGui.calcApi(["members", Player.getUUID().replace(/-/g, ""), "collection"], Player.getUUID())
}
- if(collection == "") return
- coleweight > 1000 ?collectionMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`: coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
-})*/ \ No newline at end of file
+}).setFps(1) \ No newline at end of file
diff --git a/render/cwGui.js b/render/cwGui.js
index 96c0bf6..0d734cd 100644
--- a/render/cwGui.js
+++ b/render/cwGui.js
@@ -1,15 +1,37 @@
import settings from "../settings";
import constants from "../util/constants";
-
+import axios from "../../axios"
const cwGui = new Gui()
let txt = "Please set your api key with /cw setkey (key)!"
+let cwValues = [],
+ calcCwPerHr = false,
+ upTimeTrack = false,
+ uptime = 0,
+ coleweight = 0,
+ baseColeweight = 0,
+ stepsSinceLast = 0,
+ coleweightHr = 0,
+ cwValuesSum = 0,
+ cwInfo
+
+
export function openCwGui()
{
cwGui.open()
}
+export function reloadColeweight()
+{
+ upTimeTrack = false
+ stepsSinceLast = 0
+ cwValues = []
+ uptime = 0
+ ChatLib.chat(`${PREFIX}Reloaded!`)
+}
+
+
register("dragged", (dx, dy, x, y) => {
if (!cwGui.isOpen()) return
constants.data.x = x
@@ -28,27 +50,149 @@ register("renderOverlay", () => {
}
if(!settings.cwToggle || constants.data.api_key == undefined) return
- let coleweight = constants.data.coleweight || 0,
- coleweightMessage = "",
- uptimeHr = Math.floor(constants.uptime/60/60)
+ let coleweightMessage = "",
+ uptimeHr = Math.floor(uptime/60/60)
coleweight > 1000 ?coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`: coleweightMessage = `&b${coleweight.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`
- if(constants.cwValues[0] != undefined && constants.upTimeTrack && constants.calcCwPerHr)
+ if(cwValues[0] != undefined && upTimeTrack && calcCwPerHr)
{
- constants.cwValuesSum = 0
- for(let i = 0; i < constants.cwValues.length; i++)
- {
- constants.cwValuesSum += constants.cwValues[i]
- }
- let eq = Math.ceil((constants.cwValuesSum*(3600/constants.uptime)) * 100) / 100
- eq != Infinity ? constants.coleweightHr = eq : constants.coleweightHr = "Calculating..."
- constants.calcCwPerHr = false
+ cwValuesSum = 0
+ for(let i = 0; i < cwValues.length; i++)
+ cwValuesSum += cwValues[i]
+ let eq = Math.ceil((cwValuesSum*(3600/uptime)) * 100) / 100
+ eq != Infinity ? coleweightHr = eq : coleweightHr = "Calculating..."
+ calcCwPerHr = false
}
- if (cwGui.isOpen() || !constants.upTimeTrack) return
+ if (cwGui.isOpen() || !upTimeTrack) return
if(uptimeHr >= 1)
- Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${constants.coleweightHr}\n&aUptime: &b${uptimeHr}h ${Math.floor(constants.uptime/60) - uptimeHr*60}m\n&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
+ Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${coleweightHr}\n&aUptime: &b${uptimeHr}h ${Math.floor(uptime/60) - uptimeHr*60}m\n&aColeweight Gained: &b${Math.ceil(cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
else
- Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${constants.coleweightHr}\n&aUptime: &b${Math.floor(constants.uptime/60)}m ${Math.floor(constants.uptime%60)}s\n&aColeweight Gained: &b${Math.ceil(constants.cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
-}) \ No newline at end of file
+ Renderer.drawStringWithShadow(`&aCW: &b${coleweightMessage}\n&aCW/hr: &b${coleweightHr}\n&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n&aColeweight Gained: &b${Math.ceil(cwValuesSum*100) / 100}`, constants.data.x, constants.data.y)
+})
+
+register("gameLoad", () => {
+ axios.get(`https://ninjune.dev/api/cwinfo`)
+ .then(cwInfoRes => {
+ cwInfo = cwInfoRes.data
+ })
+})
+
+
+register("step", () => {
+ // updates coleweight for gui
+ let date_ob = new Date(),
+ seconds = date_ob.getSeconds()
+
+ if(upTimeTrack == true)
+ uptime += 1
+ if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
+ {
+ try
+ {
+ let tempUuid = Player.getUUID(),
+ profileData = "",
+ tempColeweight = 0,
+ uuid = ""
+
+ for(let i = 0; i < tempUuid.length; i++)
+ {
+ if(tempUuid[i] != "-")
+ {
+ uuid = uuid + tempUuid[i]
+ }
+ }
+ axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${uuid}`)
+ .then(res => {
+ let eq = 0
+
+ for(let i=0; i < res.data.profiles.length; i+=1)
+ {
+ if(res.data.profiles[i].selected == true)
+ profileData = res.data.profiles[i]
+ }
+
+ tempColeweight += Math.ceil((profileData.members[uuid][cwInfo.experience.name]/cwInfo.experience.req)*100) / 100
+
+ for(let i = 0; i < cwInfo.powder.length; i++)
+ {
+ let sourceToSearch = cwInfo.powder[i].name,
+ source = profileData.members[uuid].mining_core[sourceToSearch]
+
+ if(source != undefined)
+ {
+ eq = Math.ceil(source/cwInfo.powder[i].req*100) / 100
+
+ if(i == 0)
+ {
+ let powder2 = profileData.members[uuid].mining_core['powder_spent_mithril']
+
+ if(powder2 != undefined)
+ eq = Math.ceil((source+powder2)/cwInfo.powder[i].req*100) / 100
+ }
+ else
+ {
+ let powder2 = profileData.members[uuid].mining_core['powder_spent_gemstone']
+
+ if(powder2 != undefined)
+ eq = Math.ceil((source+powder2)/cwInfo.powder[i].req*100) / 100
+ }
+ tempColeweight += eq
+ }
+ }
+
+ for(let i = 0; i < cwInfo.collection.length; i++)
+ {
+ let sourceToSearch = cwInfo.collection[i].name,
+ source = profileData.members[uuid].collection[sourceToSearch]
+
+ if(source != undefined)
+ {
+ eq = Math.ceil(source/cwInfo.collection[i].req*100) / 100
+ tempColeweight += eq
+ }
+ }
+ for(let i = 0; i < cwInfo.miscellaneous.length; i++)
+ {
+ let sourceToSearch = cwInfo.miscellaneous[i].name
+ if(i == 0 || i == 1)
+ source = profileData.members[uuid].bestiary[sourceToSearch]
+ else
+ source = profileData.members[uuid].mining_core.crystals.jade_crystal[sourceToSearch]
+ if (source != undefined)
+ {
+ eq = Math.ceil(source/cwInfo.miscellaneous[i].req*100) / 100
+ tempColeweight += eq
+ }
+ }
+ if(baseColeweight == 0)
+ {
+ baseColeweight = tempColeweight
+ }
+ else if((tempColeweight - baseColeweight) > 0)
+ {
+ cwValues.push(tempColeweight - baseColeweight)
+ calcCwPerHr = true
+ upTimeTrack = true
+ stepsSinceLast = 0
+ baseColeweight = tempColeweight
+ }
+ else if(stepsSinceLast > 20)
+ {
+ uptime = 0
+ upTimeTrack = false
+ stepsSinceLast = 0
+ cwValues = []
+ }
+ else
+ {
+ stepsSinceLast += 1
+ }
+
+ coleweight = Math.ceil(tempColeweight*100)/100
+ })
+ }
+ catch(e) { if (settings.debug) console.log(e)}
+ }
+}).setFps(1) \ No newline at end of file
diff --git a/render/dwarvenNotifier.js b/render/dwarvenNotifier.js
new file mode 100644
index 0000000..33739b0
--- /dev/null
+++ b/render/dwarvenNotifier.js
@@ -0,0 +1,36 @@
+import settings from "../settings"
+import { checkInDwarven, drawTitle } from "../util/helperFunctions"
+import constants from "../util/constants"
+const PREFIX = constants.PREFIX
+
+let drawTitleState = 0,
+ drawTimestamp = undefined
+
+register("step", () => {
+ if(checkInDwarven() || !settings.dwarvenNotifier) return
+ const scoreboard = Scoreboard.getLines()
+
+ for(let lineIndex = 0; lineIndex < scoreboard.length; lineIndex++)
+ {
+ let line = scoreboard[lineIndex].toString()
+ if (line.includes("☽") || line.includes("☀"))
+ {
+ let matches = /§7(\d\d?:\d\d)(am|pm)/g.exec(line)
+ if(matches == undefined) return ChatLib.chat("No matches.")
+ if(matches[1] == "12:00" && matches[2] == "am")
+ {
+ ChatLib.chat(`${PREFIX}&aA day has passed and your Skymall perk has changed!`)
+ drawTitleState = 1
+ }
+ }
+ }
+}).setDelay(10)
+
+register("renderOverlay", () => {
+ if(drawTitleState == 1)
+ {
+ titleResults = drawTitle(`&2A day has passed and your &bSkymall &2perk has changed!`, drawTimestamp, 3)
+ drawTitleState = titleResults.drawTitle
+ drawTimestamp = titleResults.drawTimestamp
+ }
+}) \ No newline at end of file
diff --git a/render/gemstoneMiningStats.js b/render/gemstoneMiningStats.js
new file mode 100644
index 0000000..e86911d
--- /dev/null
+++ b/render/gemstoneMiningStats.js
@@ -0,0 +1,99 @@
+import settings from "../settings"
+import constants from "../util/constants"
+import { findTick } from "../commands/calculate/tick"
+import { addCommas, getSelectedProfile } from "../util/helperFunctions"
+import axios from "../../axios"
+const NBTTagString = Java.type("net.minecraft.nbt.NBTTagString")
+
+
+register("itemTooltip", (lore, item) => { // this is so bad 💀
+ if(!item.getLore()[0].startsWith("§o§aYour SkyBlock Profile") || !settings.gemstoneMiningStats) return
+ const list = new NBTTagList(item.getNBT().getCompoundTag("tag").getCompoundTag("display").getTagMap().get("Lore")),
+ tempList = []
+
+ for(let elementIndex = 0; elementIndex < list.getTagCount(); elementIndex++)
+ {
+ tempList.push(list.getStringTagAt(elementIndex))
+ }
+
+ for(let elementIndex = 0; elementIndex < list.getTagCount(); elementIndex++)
+ {
+ let element = list.getStringTagAt(elementIndex)
+ if(element !== ` §6⸕ Mining Speed §f${element.replace(" §6⸕ Mining Speed §f", "").replace("§", "")}` || constants.data.professional == 0)
+ {
+ if(element !== ` §6☘ Mining Fortune §f${element.replace(" §6☘ Mining Fortune §f", "").replace("§", "")}` || (constants.data.jungle_amulet == false && constants.data.fortunate == 0))
+ continue
+ let miningFortune = element.replace(" §6☘ Mining Fortune §f", "").replace("§", ""),
+ replacedFortune
+
+ if(constants.data.jungle_amulet && constants.data.fortunate > 0)
+ replacedFortune = parseInt(miningFortune.toString().replace(",", "")) + 10 + 5*constants.data.fortunate
+ else if(constants.data.jungle_amulet)
+ replacedFortune = parseInt(miningFortune.toString().replace(",", "")) + 10
+ else
+ replacedFortune = parseInt(miningFortune.toString().replace(",", "")) + 5*constants.data.fortunate
+
+ let miningFortuneText = `${element} §6(§b${addCommas(replacedFortune)}§6)`
+
+ list.set(elementIndex, new NBTTagString(miningFortuneText))
+ continue
+ }
+ let miningSpeed = parseInt(element.replace(" §6⸕ Mining Speed §f", "").replace("§", "").replace(",", "")),
+ professionalSpeed = miningSpeed + Math.floor(50+(constants.data.professional*5)),
+ miningSpeedText = `${element} §6(§b${addCommas(professionalSpeed)}§6)`,
+ tick
+ if(settings.tickSpeedBlock > 1) // may need to change if add tick blocks (good programming real)
+ tick = findTick(professionalSpeed, settings.tickSpeedBlock).currentBlockTick
+ else
+ tick = findTick(miningSpeed, settings.tickSpeedBlock).currentBlockTick
+
+ list.set(elementIndex, new NBTTagString(miningSpeedText))
+ list.set(elementIndex + 1, new NBTTagString(` §6⸕ Block Tick §f${Math.round(tick)}`)) // 1 new added
+ for(let i = elementIndex + 2; i < list.getTagCount() + 1; i++)
+ {
+ list.set(i, new NBTTagString(tempList[i - 1]))
+ }
+ }
+})
+
+
+
+
+register("worldLoad", () => {
+ axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${Player.getUUID()}`)
+ .then(res => {
+ let professional = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.professional,
+ fortunate = getSelectedProfile(res)?.members[Player.getUUID().replace(/-/g, "")]?.mining_core?.nodes?.fortunate
+
+ if(professional != undefined)
+ constants.data.professional = professional
+ if(fortunate != undefined)
+ constants.data.fortunate = fortunate
+ constants.data.save()
+ })
+})
+
+register('step', () => { // idk how to get items so...
+ let inventoryName = Player?.getOpenedInventory()?.getName()?.toString()
+ if(inventoryName == undefined) return
+ if(inventoryName.includes("Accessory Bag ")) {
+ for (i = 0; i < Player.getOpenedInventory().getSize(); i++) {
+ let extraAttributes = Player.getOpenedInventory().getStackInSlot(i)?.getNBT()?.getCompoundTag("tag")?.getCompoundTag("ExtraAttributes")
+ if (extraAttributes?.getString('id') === "JUNGLE_AMULET")
+ {
+ constants.data.jungle_amulet = true
+ constants.data.save()
+ }
+ }
+ }
+}).setFps(2)
+
+
+register("itemTooltip", (lore, item) => { // keeping for if api key isn't set
+ if(item.getLore()[0].startsWith("§o§aFortunate§r"))
+ constants.data.fortunate = parseInt(item.getLore()[1].replace("§5§o§7Level ", ""))
+ else if (item.getLore()[0].startsWith("§o§aProfessional§r"))
+ constants.data.professional = parseInt(item.getLore()[1].replace("§5§o§7Level ", ""))
+ else return
+ constants.data.save()
+})
diff --git a/render/miningAbilities.js b/render/miningAbilities.js
new file mode 100644
index 0000000..d920e50
--- /dev/null
+++ b/render/miningAbilities.js
@@ -0,0 +1,95 @@
+import settings from "../settings"
+import constants from "../util/constants"
+import { capitalizeFirst, checkInDwarven, checkInHollows, drawTitle, textGui } from "../util/helperFunctions"
+
+const miningAbilitiesGui = new textGui()
+let activeAbilities = []
+
+
+export function openMiningAbilitiesGui()
+{
+ miningAbilitiesGui.moveGui()
+}
+
+
+register("dragged", (dx, dy, x, y) => {
+ if (!miningAbilitiesGui.moveGuiObject.isOpen()) return
+ constants.abilitydata.x = x
+ constants.abilitydata.y = y
+ constants.abilitydata.save()
+})
+
+
+register("renderOverlay", () => {
+ if(!(checkInDwarven() || checkInHollows()) || !settings.miningAbilities) return
+ activeAbilities.forEach(ability => {
+ if(ability.drawTitle == 1)
+ {
+ let titleResults = drawTitle(`&6[&3&kd&6] &b&l${ability.name}&6 [&3&kd&6]`, ability.drawTimestamp)
+ ability.drawTitle = titleResults.drawTitle
+ ability.drawTimestamp = titleResults.drawTimestamp
+ }
+ })
+})
+
+register("renderOverlay", () => {
+ if(!(checkInDwarven() || checkInHollows()) || !settings.miningAbilitiesGui) return
+ let leftValues = [],
+ rightValues = []
+
+ activeAbilities.forEach(ability => {
+ leftValues.push(`${ability.name} CD`)
+ rightValues.push(ability.timer + "s")
+ })
+
+ if(miningAbilitiesGui.moveGuiObject.isOpen() && leftValues.length < 1)
+ {
+ leftValues.push("Mining Speed Boost")
+ rightValues.push("0")
+ }
+
+ miningAbilitiesGui.guiObject = {leftValues: leftValues, rightValues: rightValues}
+ miningAbilitiesGui.x = constants.abilitydata.x
+ miningAbilitiesGui.y = constants.abilitydata.y
+ miningAbilitiesGui.alignment = settings.miningAbilitiesAlignment
+ miningAbilitiesGui.renderGui()
+})
+
+
+register("step", () => {
+ activeAbilities.forEach(ability => {
+ if(ability.timer > 0)
+ ability.timer -= 1
+ else if (ability.drawTitle == 0)
+ ability.drawTitle = 1
+ })
+}).setDelay(1) // delay instead of fps for accuracy ?
+
+
+register("chat", (abilityName, event) => {
+ let found = false
+
+ activeAbilities.forEach(ability => {
+ if(ability.name == capitalizeFirst(abilityName))
+ {
+ found = true
+ drawTimestamp = undefined
+ ability.drawTitle = 0
+ if (capitalizeFirst(abilityName) === "Pickobulus")
+ ability.timer = 110
+ else
+ ability.timer = 120
+ }
+ })
+
+ if (!found)
+ {
+ let object = {timer: capitalizeFirst(abilityName) === "Pickobulus" ? 110 : 120, name: capitalizeFirst(abilityName), drawTitle: 0, drawTimestamp: undefined}
+
+ activeAbilities.push(object)
+ }
+}).setCriteria(/&r&aYou used your &r&6(.+) &r&aPickaxe Ability!&r/g)
+
+register("worldLoad", () => {
+ activeAbilities = []
+}) \ No newline at end of file
diff --git a/render/naturals.js b/render/naturals.js
index 595c32d..a4d4393 100644
--- a/render/naturals.js
+++ b/render/naturals.js
@@ -2,37 +2,40 @@ import axios from "../../axios"
import settings from "../settings"
import constants from "../util/constants"
import { waypointRender } from "../util/helperFunctions"
-const PREFIX = constants.PREFIX
-let coords = []
+let coords = [],
+ visibleCoords = []
-
-register("step", () => {
- if(constants.serverData.map != "Crystal Hollows") return
+register("gameLoad", res => {
axios.get(`https://ninjune.dev/api/coords`)
.then((res) => {
- coords = []
- res.data.filter(coord =>
- (((-1 * settings.naturalRange)/2 < (parseInt(Player.getX()) - coord.x)) && ((parseInt(Player.getX()) - coord.x) < settings.naturalRange/2)
- && ((-1 * settings.naturalRange)/2 < (parseInt(Player.getY()) - coord.y)) && ((parseInt(Player.getY()) - coord.y) < settings.naturalRange/2)
- && ((-1 * settings.naturalRange)/2 < (parseInt(Player.getZ()) - coord.z)) && ((parseInt(Player.getZ()) - coord.z) < settings.naturalRange/2))
- ).forEach(coord => {
- coords.push([coord.x, coord.y, coord.z])
- })
+ coords = res.data
})
.catch((err) => {
- console.log(err)
+ if(settings.debug) return console.log(err)
+ })
+})
+
+register("step", () => {
+ if(constants.serverData.map != "Crystal Hollows" || !settings.showNaturals || coords.length < 1) return
+ visibleCoords = []
+ coords.filter(coord =>
+ (((-1 * settings.naturalRange)/2 < (parseInt(Player.getX()) - coord.x)) && ((parseInt(Player.getX()) - coord.x) < settings.naturalRange/2)
+ && ((-1 * settings.naturalRange)/2 < (parseInt(Player.getY()) - coord.y)) && ((parseInt(Player.getY()) - coord.y) < settings.naturalRange/2)
+ && ((-1 * settings.naturalRange)/2 < (parseInt(Player.getZ()) - coord.z)) && ((parseInt(Player.getZ()) - coord.z) < settings.naturalRange/2))
+ ).forEach(coord => {
+ visibleCoords.push([coord.x, coord.y, coord.z])
})
}).setFps(1)
register("renderWorld", () => {
if(!settings.showNaturals) return
- if(coords.length < 1) return
- waypointRender(coords)
+ if(visibleCoords.length < 1) return
+ waypointRender(visibleCoords)
})
register("worldUnload", () => {
- coords = []
+ visibleCoords = []
})
diff --git a/render/tabList.js b/render/tabList.js
index fcf971e..aa16445 100644
--- a/render/tabList.js
+++ b/render/tabList.js
@@ -1,26 +1,29 @@
-/*import axios from "../../axios" // implement when im not an idiot
+/*import axios from "../../axios" // ♒
import settings from "../settings"
import constants from "../util/constants"
const PREFIX = constants.PREFIX
-
+const ChatComponentText = Java.type("net.minecraft.util.ChatComponentText")
register("worldLoad", () => {
- const NetHandlerPlayClient = Client.getConnection(),
- PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
+ const NetHandlerPlayClient = Client.getMinecraft().func_147114_u(),
+ PlayerMap = NetHandlerPlayClient.func_175106_d()
let tag = ""
- axios.get(`https://ninjune.dev/api/mminers`)
- .then((res) => {
- PlayerMap.filter(player => !player.func_178845_a().name.startsWith("!")).forEach((player) => {
- res.data.macroers.forEach((macroer) => {
- if(player == macroer) tag ="[M] "
- })
- res.data.griefers.forEach((griefer) => {
- if(player == griefer) tag ="[G] "
- })
-
- player.func_178859_a(new net.minecraft.util.IChatComponentText("Player"))
- })
+ //axios.get(`https://ninjune.dev/api/mminers`)
+ //.then((res) => {
+ PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP, index) => {
+ let player = PlayerMP.func_178845_a().name // getGameProfile
+ console.dir(PlayerMP)
+ PlayerMP.func_178859_a(new ChatComponentText("Hello World")) // setDisplayName; takes an IChatComponent; doesn't do anything.
+ PlayerMP.func_178850_i().func_96662_c("Hello World") // getPlayerTeam; setNameSuffix; doesn't do anything
})
- .catch((e) => {console.log(e)})
-})*/ \ No newline at end of file
+ //.catch((e) => {console.log(e)})
+ //})
+})
+/*res.data.macroers.forEach((macroer) => {
+ if(player == macroer) tag ="[M] "
+})
+res.data.griefers.forEach((griefer) => {
+ if(player == griefer) tag ="[G] "
+})
+*/ \ No newline at end of file
diff --git a/render/textGuiCreator.js b/render/textGuiCreator.js
new file mode 100644
index 0000000..e85b7e4
--- /dev/null
+++ b/render/textGuiCreator.js
@@ -0,0 +1,20 @@
+export function createGui(guiObject, x, y)
+// format: { leftValues: [], rightValues: [] } (must have same amount of each or error).
+{
+ let string = ""
+ guiObject.leftValues.forEach((leftValue, index) => {
+ if(leftValue == "Uptime")
+ {
+ let uptime = guiObject.rightValues[index],
+ uptimeHr = Math.floor(uptime/60/60)
+
+ if(uptimeHr >= 1)
+ string += `&aUptime: &b${uptimeHr}h ${Math.floor(uptime/60) - uptimeHr*60}m\n`
+ else
+ string += `&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n`
+ }
+ else
+ string += `&a${leftValue}: &b${guiObject.rightValues[index]}\n`
+ })
+ Renderer.drawStringWithShadow(string, x, y)
+} \ No newline at end of file
diff --git a/settings.js b/settings.js
index 92c13d2..ac18d02 100644
--- a/settings.js
+++ b/settings.js
@@ -1,20 +1,20 @@
import { @Vigilant, @ButtonProperty, @SwitchProperty, @SelectorProperty, @SliderProperty } from 'Vigilance'
-@Vigilant("Coleweight")
+@Vigilant("Coleweight/config")
class Settings {
@SwitchProperty({
name: "Coleweight tracker",
description: "Enables the Coleweight tracker.",
subcategory: "Coleweight Tracker",
- category: "General"
+ category: "Gui"
})
- cwToggle = true;
+ cwToggle = false;
@ButtonProperty({
name: "Change Coleweight tracker position",
description: "Move the location of the coleweight tracker.",
subcategory: "Coleweight Tracker",
- category: "General",
+ category: "Gui",
placeholder: "Open"
})
moveCwLocation() {
@@ -31,7 +31,7 @@ class Settings {
@SwitchProperty({
name: "Rank everywhere",
- description: "Enables showing Coleweight rank everywhere. (instead of just in crystal hollows)",
+ description: "Enables showing Coleweight rank everywhere. (instead of just in Crystal Hollows/Dwarven Mines)",
subcategory: "Ranked Chat",
category: "General"
})
@@ -54,10 +54,26 @@ class Settings {
claiming = true;
@SwitchProperty({
+ name: "Dwarven notifier",
+ description: "Notifies you every day when not in Dwarven Mines.",
+ subcategory: "Random Features",
+ category: "General"
+ })
+ dwarvenNotifier = false;
+
+ @SwitchProperty({
+ name: "Debug",
+ description: "Toggles debug mode.",
+ subcategory: "Random Features",
+ category: "General"
+ })
+ debug = false;
+
+ @SwitchProperty({
name: "Downtime tracker",
description: "Tracks downtime.",
subcategory: "Downtime",
- category: "General"
+ category: "Gui"
})
downtimeTracker = false;
@@ -65,7 +81,7 @@ class Settings {
name: "Change downtime tracker position",
description: "Move the location of the downtime tracker.",
subcategory: "Downtime",
- category: "General",
+ category: "Gui",
placeholder: "Open"
})
moveDowntimeLocation() {
@@ -73,12 +89,31 @@ class Settings {
}
@SwitchProperty({
- name: "Debug",
- description: "Toggles debug mode.",
- subcategory: "Random Features",
- category: "General"
+ name: "Collection tracker",
+ description: "Tracks collections ('/cw track (collection)' to set).",
+ subcategory: "Collection",
+ category: "Gui"
})
- debug = false;
+ collectionTracker = false;
+
+ @SwitchProperty({
+ name: "Collection notation",
+ description: "Changes collection to be abbrivated like '45K' or '2M'.",
+ subcategory: "Collection",
+ category: "Gui"
+ })
+ collectionNotation = true;
+
+ @ButtonProperty({
+ name: "Change collection tracker position",
+ description: "Move the location of the collection tracker.",
+ subcategory: "Collection",
+ category: "Gui",
+ placeholder: "Open"
+ })
+ moveCollectionLocation() {
+ ChatLib.command("cw move collection", true);
+ }
@SwitchProperty({
name: "Marked lobbies",
@@ -99,11 +134,11 @@ class Settings {
ChatLib.command("cw clearlobbies", true);
}
- @SwitchProperty({
+ @SwitchProperty({ // Gui
name: "Timer",
description: "Toggles visibility of CHollows timer",
subcategory: "Timer",
- category: "General"
+ category: "Gui"
})
timerVisible = false;
@@ -111,33 +146,69 @@ class Settings {
name: "Change timer position",
description: "Move the location of the timer.",
subcategory: "Timer",
- category: "General",
+ category: "Gui",
placeholder: "Open"
})
moveTimerLocation() {
ChatLib.command("cw move timer", true);
}
+ @SwitchProperty({ // Mining abilities
+ name: "Mining abilities",
+ description: "Toggles title notification of mining abilities.",
+ subcategory: "Mining Abilities",
+ category: "Gui"
+ })
+ miningAbilities = false;
+
@SwitchProperty({
+ name: "Mining abilities gui",
+ description: "Toggles mining abilities gui.",
+ subcategory: "Mining Abilities",
+ category: "Gui"
+ })
+ miningAbilitiesGui = false;
+
+ @SelectorProperty({
+ name: "Mining abilities alignment",
+ description: "Sets the alignment of the tracker.",
+ subcategory: "Mining Abilities",
+ category: "Gui",
+ options: ["Left", "Center", "Right"]
+ })
+ miningAbilitiesAlignment = 0;
+
+ @ButtonProperty({
+ name: "Change mining abilities position",
+ description: "Move the location of the mining abilities gui.",
+ subcategory: "Mining Abilities",
+ category: "Gui",
+ placeholder: "Open"
+ })
+ moveAbilitiesLocation() {
+ ChatLib.command("cw move miningabilities", true);
+ }
+
+ @SwitchProperty({ // Powdertracker
name: "Show powdertracker",
description: "If the tracker overlay should be visible.",
category: "Powdertracker"
})
- trackerVisible = false;
+ trackerVisible = false;
@SwitchProperty({
name: "Show totals",
description: "If the tracker should show the total amount.",
category: "Powdertracker"
})
- showTotals = true;
+ showTotals = true;
@SwitchProperty({
name: "Show rates",
description: "If the tracker should show the estimated rates per hour.",
category: "Powdertracker"
})
- showRates = true;
+ showRates = true;
@SelectorProperty({
name: "Alignment",
@@ -145,7 +216,7 @@ class Settings {
category: "Powdertracker",
options: ["Left", "Right", "Center"]
})
- trackerAlignment = 0;
+ trackerAlignment = 0;
@ButtonProperty({
name: "Change Powdertracker position",
@@ -162,7 +233,7 @@ class Settings {
description: "If natural veins should show.",
category: "Naturals"
})
- showNaturals = false
+ showNaturals = false;
@SliderProperty({
name: "Natural range",
@@ -171,7 +242,22 @@ class Settings {
min: 16,
max: 64
})
- naturalRange = 32
+ naturalRange = 32;
+
+ @SwitchProperty({ // Stats
+ name: "Gemstone mining stats",
+ description: "Shows gemstone mining speed/fortune on player profile. Also shows tick that you're mining at. (set block below)",
+ category: "Stats"
+ })
+ gemstoneMiningStats = true;
+
+ @SelectorProperty({
+ name: "Tick speed block",
+ description: "Sets the tick speed block on player profile.",
+ category: "Stats",
+ options: ["Green Mithril", "Blue Mithril", "Ruby", "Normal gemstone (jade, amethyst, etc)", "Topaz/Opal", "Jasper"]
+ })
+ tickSpeedBlock = 3;
constructor() {
this.initialize(this);
@@ -187,17 +273,35 @@ class Settings {
this.registerListener("Claiming", value => {
this.claiming = value;
})
+ this.registerListener("Dwarven notifier", value => {
+ this.dwarvenNotifier = value;
+ })
+ this.registerListener("Debug", value => {
+ this.debug = value;
+ })
this.registerListener("Marked lobbies", value => {
this.lobbyMarking = value;
})
this.registerListener("Timer", value => {
this.timerVisible = value;
})
+ this.registerListener("Mining abilities", value => {
+ this.miningAbilities = value;
+ })
+ this.registerListener("Mining abilities gui", value => {
+ this.miningAbilitiesGui = value;
+ })
+ this.registerListener("Mining abilities alignment", value => {
+ this.miningAbilitiesAlignment = value;
+ })
this.registerListener("Downtime tracker", value => {
this.downtimeTracker = value;
})
- this.registerListener("Debug", value => {
- this.debug = value;
+ this.registerListener("Collection tracker", value => {
+ this.collectionTracker = value;
+ })
+ this.registerListener("Collection notation", value => {
+ this.collectionNotation = value;
})
this.registerListener("Show powdertracker", value => {
this.trackerVisible = value;
@@ -217,6 +321,12 @@ class Settings {
this.registerListener("Natural range", value => {
this.naturalRange = value;
})
+ this.registerListener("Gemstone mining stats", value => {
+ this.gemstoneMiningStats = value;
+ })
+ this.registerListener("Tick speed block", value => {
+ this.tickSpeedBlock = value;
+ })
}
}
diff --git a/util/constants.js b/util/constants.js
index 51345fe..776f3f7 100644
--- a/util/constants.js
+++ b/util/constants.js
@@ -2,9 +2,10 @@ import PogObject from "PogData"
let PogData = new PogObject("Coleweight", {
"api_key": "",
+ "professional": 0,
+ "jungle_amulet": true,
"x": 0.5,
"y": 141,
- "coleweight": 0,
"first_time": true
}, "config/.cw_data.json")
@@ -27,24 +28,31 @@ let DowntimeData = new PogObject("Coleweight", {
"y": 0
}, "config/.downtime_data.json")
+let CollectionData = new PogObject("Coleweight", {
+ "x": 0,
+ "y": 0
+}, "config/.collection_data.json")
+
+let AbilityData = new PogObject("Coleweight", {
+ "x": 0,
+ "y": 0
+}, "config/.ability_data.json")
+
+const PREFIX = "&2[CW] "
export default
{
- PREFIX: "&2[CW] ",
+ PREFIX: PREFIX,
+ CALCULATEERRORMESSAGE: `${PREFIX}&cInvalid arguments. '/cw calculate help' for more information.`,
+ INVALIDARGS: `${PREFIX}&cInvalid arguments. '/cw help' for more information.`,
VERSION: (JSON.parse(FileLib.read("Coleweight", "metadata.json"))).version,
data: PogData,
powderdata: PowderData,
timerdata: TimerData,
downtimedata: DowntimeData,
- cwValues: [],
- calcCwPerHr: false,
- upTimeTrack: false,
- uptime: 0,
- baseColeweight: 0,
- stepsSinceLast: 0,
+ collectiondata: CollectionData,
+ abilitydata: AbilityData,
throneValues: [],
spiralValues: [],
- coleweightHr: 0,
- cwValuesSum: 0,
beta: false,
serverData: {}
} \ No newline at end of file
diff --git a/util/grieferTrack.js b/util/grieferTrack.js
deleted file mode 100644
index a21653b..0000000
--- a/util/grieferTrack.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import axios from "../../axios"
-import Settings from "../settings"
-import constants from "./constants"
-const PREFIX = constants.PREFIX
-let players = [] // global variable moment
-
-
-function checkMMiners()
-{
- if (!Settings.trackGriefers) return
- const NetHandlerPlayClient = Client.getConnection(),
- PlayerMap = NetHandlerPlayClient.func_175106_d() // getPlayerInfoMap
-
- PlayerMap.filter(player => player.func_178853_c() > 0 && !player.func_178845_a().name.startsWith("!")).forEach((PlayerMP) => {
- let player = PlayerMP.func_178845_a().name
-
- if(players.indexOf(player) == -1)
- {
- axios.get(`https://ninjune.dev/api/mminers?username=${player}`)
- .then(res => {
- if(res.data.found == true && res.data.type == "griefer")
- ChatLib.chat(`${PREFIX}&e'${res.data.name}' is a griefer!`)
- })
- players.push(player)
- }
- })
-
- return players
-}
-
-
-register("step", () => {
- let date_ob = new Date(),
- seconds = date_ob.getSeconds()
-
- if(seconds == 0 || seconds == 15 || seconds == 30 || seconds == 45)
- checkMMiners()
-}).setFps(1)
-
-
-register("worldLoad", () => {
- players = []
- checkMMiners()
-})
-
-
-export default "" \ No newline at end of file
diff --git a/util/helperFunctions.js b/util/helperFunctions.js
index 7a3927d..d2f07d4 100644
--- a/util/helperFunctions.js
+++ b/util/helperFunctions.js
@@ -1,3 +1,7 @@
+import axios from "../../axios";
+import settings from "../settings";
+import constants from "./constants";
+
export function addCommas(num) {
try {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
@@ -7,19 +11,65 @@ export function addCommas(num) {
}// credit to senither for the regex, just don't care to make my own lol
-export function waypointRender(waypoints, yellow=false)
+export function addNotation(type, value) {
+ let returnVal = value;
+ let notList = [];
+ if (type === "shortScale") {
+ notList = [
+ " Thousand",
+ " Million",
+ " Billion",
+ " Trillion",
+ " Quadrillion",
+ " Quintillion"
+ ];
+ }
+
+ if (type === "oneLetters") {
+ notList = [" K", " M", " B", " T"];
+ }
+
+ let checkNum = 1000;
+ if (type !== "none" && type !== "commas") {
+ let notValue = notList[notList.length - 1];
+ for (let u = notList.length; u >= 1; u--) {
+ notValue = notList.shift()
+ for (let o = 3; o >= 1; o--) {
+ if (value >= checkNum) {
+ returnVal = value / (checkNum / 100)
+ returnVal = Math.floor(returnVal)
+ returnVal = (returnVal / Math.pow(10, o)) * 10
+ returnVal = +returnVal.toFixed(o - 1) + notValue
+ }
+ checkNum *= 10;
+ }
+ }
+ } else {
+ returnVal = numberWithCommas(value.toFixed(0))
+ }
+
+ return returnVal
+}
+
+
+export function waypointRender(waypoints, yellow=false, numbered=false)
{
+ let string = ""
if(waypoints.length < 1) return
- waypoints.forEach((waypoint) => {
- if(yellow)
- Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2], 0xFAFD01)
+ waypoints.forEach((waypoint, index) => {
+ string = Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m"
+ if (numbered)
+ string = index + 1
+
+ if (yellow)
+ Tessellator.drawString(string, waypoint[0], waypoint[1], waypoint[2], 0xFAFD01)
else
- Tessellator.drawString(Math.floor((Math.abs(parseInt(Player.getX()) - waypoint[0]) + Math.abs(parseInt(Player.getY()) - waypoint[1]) + Math.abs(parseInt(Player.getZ()) - waypoint[2]))/3) + "m", waypoint[0], waypoint[1], waypoint[2])
+ Tessellator.drawString(string, waypoint[0], waypoint[1], waypoint[2])
})
}
-export class textGui // first class I've made, gonna be dog
+export class textGui
// guiObject format: { leftValues: [], rightValues: [] } (must have same amount of each or error).
{
constructor(guiObject, x, y)
@@ -27,16 +77,19 @@ export class textGui // first class I've made, gonna be dog
this.guiObject = guiObject
this.x = x
this.y = y
+ this.alignment = 0
+ this.moveGuiObject = new Gui()
}
renderGui()
{
let string = ""
+
this.guiObject.leftValues.forEach((leftValue, index) => {
if(leftValue == "Uptime")
{
- let uptime = this.guiObject.rightValues[index],
+ let uptime = this.guiObject.rightValues[index] ?? 0,
uptimeHr = Math.floor(uptime/60/60)
if(uptimeHr >= 1)
@@ -45,7 +98,290 @@ export class textGui // first class I've made, gonna be dog
string += `&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n`
}
else
+ {
string += `&a${leftValue}: &b${this.guiObject.rightValues[index]}\n`
+ }
})
- Renderer.drawStringWithShadow(string, this.x, this.y) }
+
+ let text = new Text(string)
+ if (this.alignment == 1)
+ text.setAlign("CENTER")
+ else if (this.alignment == 2)
+ text.setAlign("RIGHT")
+ text.setShadow(true)
+ .setX(this.x)
+ .setY(this.y)
+
+ if (this.moveGuiObject.isOpen())
+ {
+ let txt = "Drag to move."
+
+ Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
+ }
+
+ text.draw()
+ }
+
+
+ moveGui()
+ {
+ this.moveGuiObject.open()
+ }
+
+
+ findDrawValues()
+ {
+ let string = ""
+
+ this.guiObject.leftValues.forEach((leftValue, index) => {
+ if(leftValue == "Uptime")
+ {
+ let uptime = this.guiObject.rightValues[index] ?? 0,
+ uptimeHr = Math.floor(uptime/60/60)
+
+ if(uptimeHr >= 1)
+ string += `&aUptime: &b${uptimeHr}h ${Math.floor(uptime/60) - uptimeHr*60}m\n`
+ else
+ string += `&aUptime: &b${Math.floor(uptime/60)}m ${Math.floor(uptime%60)}s\n`
+ }
+ else
+ {
+ string += `&a${leftValue}: &b${this.guiObject.rightValues[index]}\n`
+ }
+ })
+
+ return string
+ }
+}
+
+export class trackerGui
+{
+ constructor(trackedItem = "", itemStringed = "")
+ {
+ this.itemStringed = itemStringed
+ this.trackedItem = trackedItem
+ this.itemValues = []
+ this.uptimeSeconds = 0
+ this.trackingItem = false
+ this.apiCallsSinceLastChange = 0
+ this.calcItemPerHour = false
+ this.itemValuesSum = 0
+ this.itemPerHour = 0
+ this.itemGui = new textGui()
+ this.currentItem = 0
+ this.collectionMoveGui = new Gui()
+ }
+
+ renderGui(x, y, notation = false, renderGui = true) // can only be called in renderOverlay
+ {
+ let leftValues = [`${this.itemStringed}`, `${this.itemStringed}/hr`, `${this.itemStringed} gained`, "Uptime"]
+ this.itemGui.x = x
+ this.itemGui.y = y
+ if (this.collectionMoveGui.isOpen())
+ {
+ let txt = "Drag to move."
+
+ Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
+ if(notation)
+ this.itemGui.guiObject = {leftValues: leftValues, rightValues: [addNotation("oneLetters", this.currentItem) ?? 0, addNotation("oneLetters", this.itemPerHour) ?? 0, addNotation("oneLetters", this.itemValuesSum) ?? 0, this.uptimeSeconds]}
+ else
+ this.itemGui.guiObject = {leftValues: leftValues, rightValues: [addCommas(this.currentItem) ?? 0, addCommas(this.itemPerHour) ?? 0, addCommas(this.itemValuesSum) ?? 0, this.uptimeSeconds]}
+
+ return this.itemGui.renderGui()
+ }
+ if(!renderGui) return
+ if(this.itemValues[0] != undefined && /*this.trackingItem && */this.calcItemPerHour)
+ {
+ this.itemValuesSum = 0
+ for(let i = 0; i < this.itemValues.length; i++)
+ this.itemValuesSum += this.itemValues[i]
+ let eq = Math.ceil((this.itemValuesSum*(3600/this.uptimeSeconds)) * 100) / 100
+ eq != Infinity ? this.itemPerHour = eq : this.itemPerHour = "Calculating..."
+ this.calcItemPerHour = false
+ }
+
+ if(notation)
+ this.itemGui.guiObject = {leftValues: leftValues, rightValues: [addNotation("oneLetters", this.currentItem) ?? 0, addNotation("oneLetters", this.itemPerHour) ?? 0, addNotation("oneLetters", this.itemValuesSum) ?? 0, this.uptimeSeconds]}
+ else
+ this.itemGui.guiObject = {leftValues: leftValues, rightValues: [addCommas(this.currentItem) ?? 0, addCommas(this.itemPerHour) ?? 0, addCommas(this.itemValuesSum) ?? 0, this.uptimeSeconds]}
+
+ this.itemGui.renderGui()
+ }
+
+ calcApi(apiPath, tempUuid)
+ {
+ if(this.trackedItem == "" || constants.data.api_key == "") return
+ let profileData = "",
+ uuid = ""
+
+ for(let i = 0; i < tempUuid.length; i++)
+ {
+ if(tempUuid[i] != "-")
+ {
+ uuid += tempUuid[i]
+ }
+ }
+
+ try
+ {
+ axios.get(`https://api.hypixel.net/skyblock/profiles?key=${constants.data.api_key}&uuid=${uuid}`)
+ .then(res => {
+ for(let i=0; i < res.data.profiles.length; i+=1)
+ {
+ if(res.data.profiles[i].selected == true)
+ profileData = res.data.profiles[i]
+ }
+ let source = getObjectValue(profileData, apiPath)[this.trackedItem]
+
+ if(this.currentItem == 0 || this.currentItem == undefined)
+ {
+ this.currentItem = source
+ }
+ else if ((source - this.currentItem) > 0)
+ {
+ this.itemValues.push(source - this.currentItem)
+ this.calcItemPerHour = true
+ this.trackingItem = true
+ this.apiCallsSinceLastChange = 0
+ this.currentItem = source
+ }
+ else if (this.apiCallsSinceLastChange > 20)
+ {
+ this.uptimeSeconds = 0
+ this.trackingItem = false
+ this.apiCallsSinceLastChange = 0
+ this.itemValues = []
+ }
+ else
+ {
+ this.apiCallsSinceLastChange += 1
+ }
+ })
+ }
+ catch(e) { if(settings.debug) console.log(e)}
+ }
+ resetVars()
+ {
+ this.currentItem = 0
+ this.itemValues = []
+ this.uptimeSeconds = 0
+ this.trackingItem = false
+ this.apiCallsSinceLastChange = 0
+ this.itemPerHour = "Calculating..."
+ this.itemValuesSum = 0
+ }
+ moveGui()
+ {
+ this.collectionMoveGui.open()
+ }
+}
+
+
+function getObjectValue(obj, path, def)
+{
+ let current = obj
+
+ for (let i = 0; i < path.length; i++)
+ current = current[path[i]] // could be source of issues
+
+ return current
+
+}
+
+
+export function parseNotatedInput(input)
+{
+ for(let index = 0; index < input.length; index++)
+ {
+
+ switch(input[index])
+ {
+ case 'k':
+ return 1000 * parseFloat(input.slice(0, index))
+ case 'm':
+ return 1000000 * parseFloat(input.slice(0, index))
+ }
+ }
+ if(parseFloat(input) == input)
+ return parseFloat(input)
+ else
+ return "NI" // not integer
+}
+
+export function getSelectedProfile(res)
+{
+ for(let i=0; i < res.data.profiles.length; i+=1)
+ {
+ if(res.data.profiles[i].selected == true)
+ return res.data.profiles[i]
+ }
+}
+
+export function capitalizeFirst(sentence)
+{
+ let words = sentence.split(" "),
+ capitalized = words.map(word => {
+ return word[0].toUpperCase() + word.slice(1);
+ })
+
+ return capitalized.join(" ")
+}
+
+export function drawTitle(text, drawTimestamp, scale = 5, time = 3000, sound = "random.orb",)
+{
+ let object = {}
+ if(drawTimestamp == undefined)
+ {
+ World.playSound(sound, 1, 1)
+ object.drawTimestamp = Date.now()
+ object.drawTitle = 1
+ }
+ else if (Date.now() - drawTimestamp > time)
+ {
+ object.drawTimestamp = undefined
+ object.drawTitle = 2
+ }
+ else
+ {
+ let title = new Text(text, Renderer.screen.getWidth()/2, Renderer.screen.getHeight()/2)
+ title.setAlign("CENTER")
+ .setShadow(true)
+ .setScale(scale)
+ .draw()
+ object.drawTimestamp = drawTimestamp
+ object.drawTitle = 1
+ }
+ return object
+}
+
+const hollowsLocations = ["Goblin", "Jungle", "Mithril", "Precursor", "Magma", "Crystal", "Khazad", "Divan", "City"]
+export function checkInHollows()
+{
+ const scoreboard = Scoreboard.getLines()
+
+ for(let lineIndex = 0; lineIndex < scoreboard.length; lineIndex++)
+ {
+ for(let locationsIndex = 0; locationsIndex < hollowsLocations.length; locationsIndex++)
+ {
+ if(scoreboard[lineIndex].toString().includes(hollowsLocations[locationsIndex]))
+ return true
+ }
+ }
+ return false
+}
+
+const dwarvenLocations = ["Dwarven", "Royal", "Palace", "Library", "Mist", "Cliffside", "Quarry", "Gateway", "Wall", "Forge", "Far", "Burrows", "Springs", "Upper"]
+export function checkInDwarven()
+{
+ const scoreboard = Scoreboard.getLines()
+
+ for(let lineIndex = 0; lineIndex < scoreboard.length; lineIndex++)
+ {
+ for(let locationsIndex = 0; locationsIndex < dwarvenLocations.length; locationsIndex++)
+ {
+ if(scoreboard[lineIndex].toString().includes(dwarvenLocations[locationsIndex]))
+ return true
+ }
+ }
+ return false
} \ No newline at end of file
diff --git a/util/updater.js b/util/updater.js
deleted file mode 100644
index ea8fa2c..0000000
--- a/util/updater.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import axios from "../../axios"
-import constants from "./constants"
-
-const PREFIX = constants.PREFIX,
- VERSION = constants.VERSION
-
-register("worldLoad", () => {
- axios.get(`https://chattriggers.com/api/modules/1367`)
- .then(res => {
- let ctVersionArray = (res.data.releases[0].releaseVersion).split('.'),
- currentVersionArray = VERSION.split('.'),
- newVersion = false
-
- for(let i = ctVersionArray.length; i >= 0; i--)
- {
- if (ctVersionArray[i] > currentVersionArray[i])
- newVersion = true
- else if (currentVersionArray[i] > ctVersionArray[i])
- newVersion = false
- }
-
- if(newVersion)
- {
- ChatLib.chat(`${PREFIX}&eYou are using an unsupported version of Coleweight!`)
- new TextComponent(`${PREFIX}&eClick &3here&e to update!`)
- .setClickAction("run_command")
- .setClickValue(`/ct load`)
- .chat()
- ChatLib.chat("")
- }
- })
-
-})
-
-export default "" \ No newline at end of file