diff --git a/api/analyze.js b/api/analyze.js index a51d009..7521792 100644 --- a/api/analyze.js +++ b/api/analyze.js @@ -78,6 +78,7 @@ function analyze_level(level, rawData) { const header = data.shift(); let level_portals = []; + let level_coins = []; let level_text = []; let orb_array = {}; @@ -94,6 +95,9 @@ function analyze_level(level, rawData) { if (id in ids.portals) { obj.portal = ids.portals[id]; level_portals.push(obj); + } else if (id in ids.coins) { + obj.coin = ids.coins[id]; + level_coins.push(obj); } else if (id in ids.orbs) { obj.orb = ids.orbs[id]; @@ -153,6 +157,8 @@ function analyze_level(level, rawData) { response.settings = {} response.portals = level_portals.sort(function (a, b) {return parseInt(a.x) - parseInt(b.x)}).map(x => x.portal + " " + Math.floor(x.x / (Math.max(last, 529.0) + 340.0) * 100) + "%").join(", ") + response.coins = level_coins.sort(function (a, b) {return parseInt(a.x) - parseInt(b.x)}).map(x => x.coin + " " + Math.floor(x.x / (Math.max(last, 529.0) + 340.0) * 100) + "%").join(", ") + response.coinsVerified = level.verifiedCoins response.orbs = orb_array response.orbs.total = Object.values(orb_array).reduce((a, x) => a + x, 0); // we already have an array of objects, use it diff --git a/html/analyze.html b/html/analyze.html index 20457ef..435adb0 100644 --- a/html/analyze.html +++ b/html/analyze.html @@ -6,7 +6,7 @@ - + @@ -44,6 +44,9 @@

+

Coin order

+
+

Portal order

@@ -144,6 +147,7 @@ let blockList = Object.keys(res.blocks) let colorList = Object.keys(res.colors) let portals = res.portals.split(", ").map(x => x.split(" ")) +let coins = res.coins.split(", ").map(x => x.split(" ")) function commafy(num) { return (+num || 0).toString().replace(/(\d)(?=(\d\d\d)+$)/g, "$1,") } @@ -169,6 +173,14 @@ function appendPortals() { appendPortals() + coins.forEach(x => { + if (!x || x[0] == "") { + $('#coinText').remove() + $('#coins').remove() + } + else $('#coins').append(`

${x[1]}

`) + }) + triggerList.forEach(x => { if (x == "total") $('#triggerText').text(`Triggers (${commafy(res.triggers[x])})`) else $('#triggers').append(`

x${commafy(res.triggers[x])}

`) @@ -311,4 +323,4 @@ appendPortals() }); - \ No newline at end of file + diff --git a/misc/analysis/objects.json b/misc/analysis/objects.json index 5f8f8b7..72a4742 100644 --- a/misc/analysis/objects.json +++ b/misc/analysis/objects.json @@ -20,6 +20,10 @@ "1334": "4x" }, + "coins": { + "1329": "coin" + }, + "orbs": { "36": "yellow", "84": "blue", @@ -109,4 +113,4 @@ "monsters": ["Monsters", 918, 1327, 1328, 1584], "fires": ["Fire", 920, 923, 924, 921] } -} \ No newline at end of file +}