aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coleweight.csv28
-rw-r--r--config.toml4
-rw-r--r--index.js153
-rw-r--r--metadata.json2
4 files changed, 86 insertions, 101 deletions
diff --git a/coleweight.csv b/coleweight.csv
deleted file mode 100644
index c8b2be9..0000000
--- a/coleweight.csv
+++ /dev/null
@@ -1,28 +0,0 @@
-experience_skill_mining,800000
-powder_mithril_total,55000,mining_core
-powder_gemstone_total,40000,mining_core
-MITHRIL_ORE,500000,collection
-GEMSTONE_COLLECTION,1400000,collection
-GOLD_INGOT,500000,collection
-NETHERRACK,45000,collection
-DIAMOND,1000000,collection
-ICE,1000000,collection
-REDSTONE,2000000,collection
-INK_SACK:4,4000000,collection
-SULPHUR,9999999999,collection
-COAL,500000,collection
-EMERALD,400000,collection
-ENDER_STONE,400000,collection
-GLOWSTONE_DUST,1000000,collection
-GRAVEL,333333,collection
-IRON_INGOT,1000000,collection
-MYCEL,50000,collection
-QUARTZ,400000,collection
-OBSIDIAN,200000,collection
-SAND:1,50000,collection
-SAND,500000,collection
-COBBLESTONE,1000000,collection
-HARD_STONE,200000,collection
-kills_scatha_10,2.5,bestiary
-kills_worm_5,10,bestiary
-total_placed,4,mining_core,crystals,jade_crystal \ No newline at end of file
diff --git a/config.toml b/config.toml
new file mode 100644
index 0000000..7b57afa
--- /dev/null
+++ b/config.toml
@@ -0,0 +1,4 @@
+
+[general]
+ tba = ""
+
diff --git a/index.js b/index.js
index 2414c4f..7fe755a 100644
--- a/index.js
+++ b/index.js
@@ -52,8 +52,7 @@ register("step", () => {
try
{
let tempUuid = Player.getUUID(),
- cwRows = (FileLib.read("Coleweight", "coleweight.csv")).split("\r\n"),
- cwData = "",
+ profileData = "",
coleweight = 0,
uuid = ""
@@ -64,92 +63,102 @@ register("step", () => {
uuid = uuid + tempUuid[i]
}
}
-
- 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(profileToSearch = 'none' && res.data.profiles[i].selected == true)
- cwData = res.data.profiles[i]
- else if(res.data.profiles[i].cute_name == profileToSearch)
- cwData = res.data.profiles[i]
- }
- for(let i = 0; i < cwRows.length; i++)
- {
- let row = cwRows[i].split(","),
- sourceToSearch = row[0];
-
- if(row[2] == undefined)
+ 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)
{
- let source = cwData.members[uuid][sourceToSearch],
- eq = Math.ceil(source/row[1]*100) / 100
- if(eq != undefined)
- coleweight += eq
+ if(res.data.profiles[i].selected == true)
+ profileData = res.data.profiles[i]
}
- else if(row[3] == undefined)
+
+ coleweight += Math.ceil((profileData.members[uuid][cwInfo.experience.name]/cwInfo.experience.req)*100) / 100
+
+ for(let i = 0; i < cwInfo.powder.length; i++)
{
- let source = cwData.members[uuid][row[2]][sourceToSearch]
- if (sourceToSearch == "powder_mithril_total")
+ let sourceToSearch = cwInfo.powder[i].name,
+ source = profileData.members[uuid].mining_core[sourceToSearch]
+
+ if(source != undefined)
{
- var eq = Math.ceil(source/row[1]*100) / 100
- let powder2 = cwData.members[uuid]['mining_core']['powder_spent_mithril']
+ eq = Math.ceil(source/cwInfo.powder[i].req*100) / 100
- if(powder2 != undefined)
+ if(i == 0)
{
- eq = Math.ceil((source+powder2)/row[1]*100) / 100
- }
- }
- else if (sourceToSearch == "powder_gemstone_total")
- {
- var eq = Math.ceil(source/row[1]*100) / 100
- let powder2 = cwData.members[uuid]['mining_core']['powder_spent_gemstone']
+ let powder2 = profileData.members[uuid].mining_core['powder_spent_mithril']
- if(powder2 != undefined)
+ if(powder2 != undefined)
+ eq = Math.ceil((source+powder2)/cwInfo.powder[i].req*100) / 100
+ }
+ else
{
- eq = Math.ceil((source+powder2)/row[1]*100) / 100
+ 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
}
- else
- var eq = Math.ceil(source/row[1]*100) / 100
+ }
+
+ for(let i = 0; i < cwInfo.collection.length; i++)
+ {
+ let sourceToSearch = cwInfo.collection[i].name,
+ source = profileData.members[uuid].collection[sourceToSearch]
- if(eq != undefined)
+ if(source != undefined)
+ {
+ eq = Math.ceil(source/cwInfo.collection[i].req*100) / 100
coleweight += eq
+ }
}
- else if(row[5] == undefined)
+
+ for(let i = 0; i < cwInfo.miscellaneous.length; i++)
{
- let source = cwData.members[uuid][row[2]][row[3]][row[4]][sourceToSearch]
- eq = Math.ceil(source/row[1]*100) / 100
- if(source != undefined)
+ 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 => {})
+
+ 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)
{
diff --git a/metadata.json b/metadata.json
index f5969bc..0de54c1 100644
--- a/metadata.json
+++ b/metadata.json
@@ -3,6 +3,6 @@
"creator": "Ninjune",
"entry": "index.js",
"description": "Simple Coleweight module to measure mining progression.",
- "version": "1.5.1",
+ "version": "1.5.2",
"requires": ["axios", "PogData", "Vigilance"]
} \ No newline at end of file