clone arrays godmaster doors, nail upgrades

This commit is contained in:
ReznoRMichael 2020-08-30 03:04:09 +02:00
parent 2227942fc6
commit 946edb0023
3 changed files with 28 additions and 12 deletions

View file

@ -57,7 +57,7 @@ const HK_BOSSES = {
hornetOutskirtsDefeated: "Hornet Sentinel (Kingdom's Edge)", hornetOutskirtsDefeated: "Hornet Sentinel (Kingdom's Edge)",
killedInfectedKnight: "Broken Vessel (Ancient Basin)", killedInfectedKnight: "Broken Vessel (Ancient Basin)",
killedMimicSpider: "Nosk (Deepnest)", killedMimicSpider: "Nosk (Deepnest)",
killedTraitorLord: "Traitor Lord (Queen's Gardens)", killedTraitorLord: "Traitor Lord (Queen's Gardens)"
}; };
// reference: https://radiance.host/apidocs/Charms.html // reference: https://radiance.host/apidocs/Charms.html
@ -158,6 +158,14 @@ const HK_NAILARTS = {
hasCyclone: "Cyclone Slash" hasCyclone: "Cyclone Slash"
}; };
const HK_NAILUPGRADES = [
"Old Nail",
"Sharpened Nail",
"Channeled Nail",
"Coiled Nail",
"Pure Nail"
];
const HK_SPELLS = { const HK_SPELLS = {
fireballLevel: { fireballLevel: {
1: "Vengeful Spirit", 1: "Vengeful Spirit",
@ -215,6 +223,13 @@ const HK_GODMASTER = {
hasGodfinder: "Godtuner" hasGodfinder: "Godtuner"
}; };
const HK_GODMASTER_DOORS = [
"Pantheon of the Master",
"Pantheon of the Artist",
"Pantheon of the Sage",
"Pantheon of the Knight"
];
function HKCheckCompletion(jsonObject) { function HKCheckCompletion(jsonObject) {
// start benchmark // start benchmark
@ -240,13 +255,15 @@ function HKCheckCompletion(jsonObject) {
let HK_LIFEBLOOD_temp = Object.assign({}, HK_LIFEBLOOD); let HK_LIFEBLOOD_temp = Object.assign({}, HK_LIFEBLOOD);
let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER); let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER);
// Shallow Clone const arrays (used for destructive functions)
let HK_GODMASTER_DOORS_temp = Array.from(HK_GODMASTER_DOORS);
let HK_NAILUPGRADES_temp = Array.from(HK_NAILUPGRADES);
// Deep Clone const spells multi-layer object (used for destructive functions) // Deep Clone const spells multi-layer object (used for destructive functions)
let HK_SPELLS_temp = JSON.parse(JSON.stringify(HK_SPELLS)); let HK_SPELLS_temp = JSON.parse(JSON.stringify(HK_SPELLS));
let HKPlayerData = jsonObject.playerData; let HKPlayerData = jsonObject.playerData;
let HKWorldItems = jsonObject.sceneData.persistentBoolItems; let HKWorldItems = jsonObject.sceneData.persistentBoolItems;
let bossDoor = ["Pantheon of the Master", "Pantheon of the Artist", "Pantheon of the Sage", "Pantheon of the Knight"];
let nailName = ["Old Nail", "Sharpened Nail", "Channeled Nail", "Coiled Nail", "Pure Nail"];
for (let i in HKPlayerData) { for (let i in HKPlayerData) {
completionSymbol = SYMBOL_FALSE; completionSymbol = SYMBOL_FALSE;
@ -308,10 +325,10 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Nail Upgrades --------------------- // // ---------------- Nail Upgrades --------------------- //
if (i === "nailSmithUpgrades") { if (i === "nailSmithUpgrades") {
for (let j = 0; j < nailName.length; j++) { for (let j = 0; j < HK_NAILUPGRADES_temp.length; j++) {
CurrentDataFalse(); CurrentDataFalse();
if (HKPlayerData.nailSmithUpgrades >= j) CurrentDataTrue(); if (HKPlayerData.nailSmithUpgrades >= j) CurrentDataTrue();
FillHTML(DIV_ID.nailUpgrades, nailName[j]); FillHTML(DIV_ID.nailUpgrades, HK_NAILUPGRADES_temp[j]);
} }
} }
@ -345,13 +362,12 @@ function HKCheckCompletion(jsonObject) {
if (HK_GODMASTER_temp) CheckIfDataTrue(DIV_ID.godmaster, HK_GODMASTER_temp, HKPlayerData); if (HK_GODMASTER_temp) CheckIfDataTrue(DIV_ID.godmaster, HK_GODMASTER_temp, HKPlayerData);
if (bossDoor.length) { if (HK_GODMASTER_DOORS_temp.length) {
for (let j = 1; j <= 4; j++) { for (let j = 1; j <= 4; j++) {
CurrentDataFalse(); CurrentDataFalse();
if (i === ("bossDoorStateTier" + j)) { if (i === ("bossDoorStateTier" + j)) {
if (HKPlayerData["bossDoorStateTier" + j].completed === true) CurrentDataTrue(); if (HKPlayerData["bossDoorStateTier" + j].completed === true) CurrentDataTrue();
FillHTML(DIV_ID.godmaster, bossDoor[0]); FillHTML(DIV_ID.godmaster, HK_GODMASTER_DOORS_temp.shift());
bossDoor.shift();
} }
} }
} }

View file

@ -82,9 +82,6 @@
<h2>Equipment</h2> <h2>Equipment</h2>
<div id="hk-equipment"></div> <div id="hk-equipment"></div>
<h2>Mask Shards</h2>
<div id="hk-maskshards"></div>
<h2>Nail Arts</h2> <h2>Nail Arts</h2>
<div id="hk-nailarts"></div> <div id="hk-nailarts"></div>
@ -94,6 +91,9 @@
<h2>Spells</h2> <h2>Spells</h2>
<div id="hk-spells"></div> <div id="hk-spells"></div>
<h2>Mask Shards</h2>
<div id="hk-maskshards"></div>
<h2>Vessel Fragments</h2> <h2>Vessel Fragments</h2>
<div id="hk-vesselfragments"></div> <div id="hk-vesselfragments"></div>

View file

@ -31,7 +31,7 @@ function loadJSON(filename, callback) {
xobj.send(null); xobj.send(null);
} }
loadJSON(fileName[2], loadJSON(fileName[1],
function JSONparse(response) { function JSONparse(response) {
// Parse JSON string into object // Parse JSON string into object
jsonObj = JSON.parse(response); jsonObj = JSON.parse(response);