fixed checking pantheon data

This commit is contained in:
ReznoRMichael 2021-07-02 16:45:50 +02:00
parent a07f20c1ee
commit 75edc85435
4 changed files with 77 additions and 62 deletions

View file

@ -143,7 +143,8 @@ function HKCheckCompletion(jsonObject) {
CheckIfDataTrue(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.lifeblood, _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.lifeblood.entries, HKPlayerData); // ---------------- Godmaster Content Pack --------------------- // CheckIfDataTrue(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.lifeblood, _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.lifeblood.entries, HKPlayerData); // ---------------- Godmaster Content Pack --------------------- //
CheckIfDataTrue(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster, _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster.entries, HKPlayerData); CheckIfDataTrue(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster, _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster.entries, HKPlayerData);
CheckGodmasterDoors(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster, _hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster.entries, HKPlayerData); // ---------------- Fleur Divide ----------------- // /* CheckGodmasterDoors(HK.SECTION.godmaster, HK.SECTION.godmaster.entries, HKPlayerData); */
// ---------------- Fleur Divide ----------------- //
(0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.AppendHTML)(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster, FLEUR_DIVIDE); // ------------------------- Essential Things ----------------------------- // (0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.AppendHTML)(_hk_database_js__WEBPACK_IMPORTED_MODULE_0__.default.SECTION.godmaster, FLEUR_DIVIDE); // ------------------------- Essential Things ----------------------------- //
@ -416,6 +417,7 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
textSuffix = _ref.textSuffix; textSuffix = _ref.textSuffix;
var sFillText = ""; var sFillText = "";
var wiki = ""; var wiki = "";
var checkText = "";
for (var i in dataObject) { for (var i in dataObject) {
textPrefix = dataObject[i].name; textPrefix = dataObject[i].name;
@ -472,6 +474,25 @@ function CheckIfDataTrue(divId, dataObject, playerData) {
WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData) ? CurrentDataTrue(divId) : CurrentDataFalse(); WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData) ? CurrentDataTrue(divId) : CurrentDataFalse();
break; break;
case "pantheonMaster":
case "pantheonArtist":
case "pantheonSage":
case "pantheonKnight":
checkText = CheckGodmasterDoors(dataObject[i], playerData);
if (checkText === "PropertyNotFound") {
CurrentDataBlank();
textPrefix = "<del>".concat(textPrefix, "</del>");
break;
} else if (checkText === "PantheonCompleted") {
CurrentDataTrue(divId);
break;
} else {
CurrentDataFalse();
}
break;
default: default:
playerData[i] === true ? CurrentDataTrue(divId) : CurrentDataFalse(); playerData[i] === true ? CurrentDataTrue(divId) : CurrentDataFalse();
} }
@ -539,33 +560,20 @@ function CheckWarriorDreams(divId, dataObject, playerData) {
} }
/** /**
* Verifies if the Godmaster Pantheons 1-4 are completed by the player, and appends HTML accordingly. * Verifies if the Godmaster Pantheons 1-4 are completed by the player, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} dataObject Object containing pantheon data to be verified (with property)
* @param {object} dataObject Object containing pantheon data to be verified
* @param {object} playerData Reference/pointer to specific data where to search in the save file * @param {object} playerData Reference/pointer to specific data where to search in the save file
*/ */
function CheckGodmasterDoors(divId, dataObject, playerData) { function CheckGodmasterDoors(dataObject, playerData) {
// appends "pantheon" to every array element if (playerData.hasOwnProperty(dataObject.property) === false) {
// same as names in the database object return "PropertyNotFound";
var pantheon = ["Master", "Artist", "Sage", "Knight"].map(function (element) { } else if (playerData[dataObject.property].completed === true) {
return "pantheon" + element; return "PantheonCompleted";
});
var sFillText = "";
for (var i = 0; i < 4; i++) {
// compatibility with earlier game versions
if (playerData.hasOwnProperty("bossDoorStateTier" + (i + 1)) === false) {
CurrentDataBlank();
sFillText += PrepareHTMLString(divId, "<del>".concat(dataObject[pantheon[i]].name, "</del>"), dataObject[pantheon[i]].spoiler, dataObject[pantheon[i]].wiki);
} else { } else {
playerData["bossDoorStateTier" + (i + 1)].completed === true ? CurrentDataTrue(divId) : CurrentDataFalse(); return "PantheonNotCompleted";
sFillText += PrepareHTMLString(divId, dataObject[pantheon[i]].name, dataObject[pantheon[i]].spoiler, dataObject[pantheon[i]].wiki);
} }
} }
(0,_page_functions_js__WEBPACK_IMPORTED_MODULE_1__.AppendHTML)(divId, sFillText);
}
/** /**
* Verifies the level of player's nail upgrades, and appends HTML accordingly. * Verifies the level of player's nail upgrades, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} divId ID of the HTML element for data appending
@ -3435,22 +3443,26 @@ var HK = {
pantheonMaster: { pantheonMaster: {
name: "P1 Pantheon of the Master", name: "P1 Pantheon of the Master",
spoiler: "Godhome, defeat P1 bosses", spoiler: "Godhome, defeat P1 bosses",
wiki: "Pantheon_of_the_Master" wiki: "Pantheon_of_the_Master",
property: "bossDoorStateTier1"
}, },
pantheonArtist: { pantheonArtist: {
name: "P2 Pantheon of the Artist", name: "P2 Pantheon of the Artist",
spoiler: "Godhome, defeat P2 bosses", spoiler: "Godhome, defeat P2 bosses",
wiki: "Pantheon_of_the_Artist" wiki: "Pantheon_of_the_Artist",
property: "bossDoorStateTier2"
}, },
pantheonSage: { pantheonSage: {
name: "P3 Pantheon of the Sage", name: "P3 Pantheon of the Sage",
spoiler: "Godhome, defeat P3 bosses", spoiler: "Godhome, defeat P3 bosses",
wiki: "Pantheon_of_the_Sage" wiki: "Pantheon_of_the_Sage",
property: "bossDoorStateTier3"
}, },
pantheonKnight: { pantheonKnight: {
name: "P4 Pantheon of the Knight", name: "P4 Pantheon of the Knight",
spoiler: "Godhome: complete P1, P2 and P3", spoiler: "Godhome: complete P1, P2 and P3",
wiki: "Pantheon_of_the_Knight" wiki: "Pantheon_of_the_Knight",
property: "bossDoorStateTier4"
} }
} }
}, },

File diff suppressed because one or more lines are too long

View file

@ -198,7 +198,7 @@ function HKCheckCompletion(jsonObject) {
CheckIfDataTrue(HK.SECTION.godmaster, HK.SECTION.godmaster.entries, HKPlayerData); CheckIfDataTrue(HK.SECTION.godmaster, HK.SECTION.godmaster.entries, HKPlayerData);
CheckGodmasterDoors(HK.SECTION.godmaster, HK.SECTION.godmaster.entries, HKPlayerData); /* CheckGodmasterDoors(HK.SECTION.godmaster, HK.SECTION.godmaster.entries, HKPlayerData); */
// ---------------- Fleur Divide ----------------- // // ---------------- Fleur Divide ----------------- //
@ -501,6 +501,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
} = ""; } = "";
let sFillText = ""; let sFillText = "";
let wiki = ""; let wiki = "";
let checkText = "";
for (let i in dataObject) { for (let i in dataObject) {
@ -513,6 +514,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
// prevents green checkbox and adding 1% when only got one white fragment // prevents green checkbox and adding 1% when only got one white fragment
(playerData.gotQueenFragment === true && playerData.gotKingFragment === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData.gotQueenFragment === true && playerData.gotKingFragment === true) ? CurrentDataTrue(divId): CurrentDataFalse();
break; break;
case "gotCharm_37": case "gotCharm_37":
case "gotCharm_38": case "gotCharm_38":
case "gotCharm_39": case "gotCharm_39":
@ -533,6 +535,7 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
} }
(playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse();
break; break;
case "bossGruzMother": case "bossGruzMother":
case "bossBroodingMawlek": case "bossBroodingMawlek":
case "maskShardCrossroadsSprings": case "maskShardCrossroadsSprings":
@ -553,6 +556,24 @@ function CheckIfDataTrue(divId, dataObject, playerData, worldData = []) {
case "vesselFragmentFountain": case "vesselFragmentFountain":
(WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData)) ? CurrentDataTrue(divId): CurrentDataFalse(); (WorldDataActivated(dataObject[i].id, dataObject[i].sceneName, worldData)) ? CurrentDataTrue(divId): CurrentDataFalse();
break; break;
case "pantheonMaster":
case "pantheonArtist":
case "pantheonSage":
case "pantheonKnight":
checkText = CheckGodmasterDoors(dataObject[i], playerData);
if (checkText === "PropertyNotFound") {
CurrentDataBlank();
textPrefix = `<del>${textPrefix}</del>`;
break;
} else if (checkText === "PantheonCompleted") {
CurrentDataTrue(divId);
break;
} else {
CurrentDataFalse();
}
break;
default: default:
(playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse(); (playerData[i] === true) ? CurrentDataTrue(divId): CurrentDataFalse();
} }
@ -618,42 +639,20 @@ function CheckWarriorDreams(divId, dataObject, playerData) {
/** /**
* Verifies if the Godmaster Pantheons 1-4 are completed by the player, and appends HTML accordingly. * Verifies if the Godmaster Pantheons 1-4 are completed by the player, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} dataObject Object containing pantheon data to be verified (with property)
* @param {object} dataObject Object containing pantheon data to be verified
* @param {object} playerData Reference/pointer to specific data where to search in the save file * @param {object} playerData Reference/pointer to specific data where to search in the save file
*/ */
function CheckGodmasterDoors(divId, dataObject, playerData) { function CheckGodmasterDoors(dataObject, playerData) {
// appends "pantheon" to every array element if (playerData.hasOwnProperty(dataObject.property) === false) {
// same as names in the database object return "PropertyNotFound";
let pantheon = ["Master", "Artist", "Sage", "Knight"].map((element) => "pantheon" + element); } else if (playerData[dataObject.property].completed === true) {
return "PantheonCompleted";
let sFillText = "";
for (let i = 0; i < 4; i++) {
// compatibility with earlier game versions
if (playerData.hasOwnProperty("bossDoorStateTier" + (i + 1)) === false) {
CurrentDataBlank();
sFillText += PrepareHTMLString(
divId,
`<del>${dataObject[pantheon[i]].name}</del>`,
dataObject[pantheon[i]].spoiler,
dataObject[pantheon[i]].wiki
);
} else { } else {
(playerData["bossDoorStateTier" + (i + 1)].completed === true) ? CurrentDataTrue(divId): CurrentDataFalse(); return "PantheonNotCompleted";
sFillText += PrepareHTMLString(
divId,
dataObject[pantheon[i]].name,
dataObject[pantheon[i]].spoiler,
dataObject[pantheon[i]].wiki
);
} }
} }
AppendHTML(divId, sFillText);
}
/** /**
* Verifies the level of player's nail upgrades, and appends HTML accordingly. * Verifies the level of player's nail upgrades, and appends HTML accordingly.
* @param {object} divId ID of the HTML element for data appending * @param {object} divId ID of the HTML element for data appending

View file

@ -948,22 +948,26 @@ const HK = {
pantheonMaster: { pantheonMaster: {
name: "P1 Pantheon of the Master", name: "P1 Pantheon of the Master",
spoiler: "Godhome, defeat P1 bosses", spoiler: "Godhome, defeat P1 bosses",
wiki: "Pantheon_of_the_Master" wiki: "Pantheon_of_the_Master",
property: "bossDoorStateTier1"
}, },
pantheonArtist: { pantheonArtist: {
name: "P2 Pantheon of the Artist", name: "P2 Pantheon of the Artist",
spoiler: "Godhome, defeat P2 bosses", spoiler: "Godhome, defeat P2 bosses",
wiki: "Pantheon_of_the_Artist" wiki: "Pantheon_of_the_Artist",
property: "bossDoorStateTier2"
}, },
pantheonSage: { pantheonSage: {
name: "P3 Pantheon of the Sage", name: "P3 Pantheon of the Sage",
spoiler: "Godhome, defeat P3 bosses", spoiler: "Godhome, defeat P3 bosses",
wiki: "Pantheon_of_the_Sage" wiki: "Pantheon_of_the_Sage",
property: "bossDoorStateTier3"
}, },
pantheonKnight: { pantheonKnight: {
name: "P4 Pantheon of the Knight", name: "P4 Pantheon of the Knight",
spoiler: "Godhome: complete P1, P2 and P3", spoiler: "Godhome: complete P1, P2 and P3",
wiki: "Pantheon_of_the_Knight" wiki: "Pantheon_of_the_Knight",
property: "bossDoorStateTier4"
} }
}, },
}, },