Grimmchild/Carefree Melody detection
This commit is contained in:
parent
30e48c4ee8
commit
3d556c1bc8
4 changed files with 192 additions and 26 deletions
|
|
@ -62,8 +62,35 @@ let pSpan = "<span class='p-left-small'></span>";
|
|||
|
||||
let benchHKCCBegin, benchHKCCEnd;
|
||||
|
||||
let benchmark = {
|
||||
loadSaveFile: {
|
||||
name: "LoadSaveFile()",
|
||||
timeStart: 0,
|
||||
timeEnd: 0
|
||||
},
|
||||
checkCompletion: {
|
||||
name: "HKCheckCompletion()",
|
||||
timeStart: 0,
|
||||
timeEnd: 0
|
||||
},
|
||||
total: {
|
||||
name: "Total",
|
||||
timeStart: 0,
|
||||
timeEnd: 0
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------- Functions ----------------------------- */
|
||||
|
||||
function Benchmark(bench) {
|
||||
|
||||
for (let time in bench) {
|
||||
console.info(`${bench[time].name} time (ms) =`, bench[time].timeEnd - bench[time].timeStart);
|
||||
bench[time].timeStart = 0;
|
||||
bench[time].timeEnd = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main Function. Checks Hollow Knight game completion by analyzing the save file
|
||||
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
||||
|
|
@ -72,6 +99,7 @@ function HKCheckCompletion(jsonObject) {
|
|||
|
||||
// start benchmark
|
||||
benchHKCCBegin = new Date();
|
||||
benchmark.checkCompletion.timeStart = new Date();
|
||||
|
||||
let HKPlayerData;
|
||||
let HKWorldItems;
|
||||
|
|
@ -250,8 +278,11 @@ function HKCheckCompletion(jsonObject) {
|
|||
|
||||
// finish and show benchmark
|
||||
benchHKCCEnd = new Date();
|
||||
benchmark.checkCompletion.timeEnd = new Date();
|
||||
console.info("HKCheckCompletion() time (ms) =", benchHKCCEnd - benchHKCCBegin);
|
||||
|
||||
Benchmark(benchmark);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -529,19 +560,19 @@ function CheckNotches(section, notchesTotal = 3, notchesFilled = 0) {
|
|||
*/
|
||||
function CheckIfDataTrue(section, dataObject, playerData, worldData = []) {
|
||||
|
||||
let {
|
||||
/* let {
|
||||
textPrefix,
|
||||
textSuffix,
|
||||
} = "";
|
||||
let sFillText = "";
|
||||
let wiki = "";
|
||||
let wiki = ""; */
|
||||
let checkText = "";
|
||||
|
||||
for (let i in dataObject) {
|
||||
|
||||
textPrefix = dataObject[i].name;
|
||||
/* textPrefix = dataObject[i].name;
|
||||
textSuffix = dataObject[i].spoiler;
|
||||
(dataObject[i].hasOwnProperty("wiki")) ? wiki = dataObject[i].wiki: wiki = "";
|
||||
(dataObject[i].hasOwnProperty("wiki")) ? wiki = dataObject[i].wiki: wiki = ""; */
|
||||
|
||||
switch (i) {
|
||||
case "gotCharm_36":
|
||||
|
|
@ -557,18 +588,65 @@ function CheckIfDataTrue(section, dataObject, playerData, worldData = []) {
|
|||
case "grimmChildLevel":
|
||||
case "killedHiveKnight":
|
||||
case "hasGodfinder":
|
||||
|
||||
// fades out the entries if save file is from older game versions
|
||||
if (playerData.hasOwnProperty(i) === false) {
|
||||
CurrentDataBlank(section, i);
|
||||
dataObject[i].disabled = true;
|
||||
textPrefix = `<del>${textPrefix}</del>`;
|
||||
/* textPrefix = `<del>${textPrefix}</del>`; */
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Checks for Nightmare King (4) or Banishment (5)
|
||||
if (i === "grimmChildLevel") {
|
||||
(playerData.grimmChildLevel >= 4) ? CurrentDataTrue(section, i): CurrentDataFalse(section, i);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (i === "gotCharm_40") {
|
||||
CurrentDataFalse(section, i);
|
||||
dataObject[i].name = dataObject[i].nameDefault;
|
||||
|
||||
switch (playerData.grimmChildLevel) {
|
||||
|
||||
case 1:
|
||||
if (playerData[i] === true) {
|
||||
dataObject[i].name = dataObject[i].nameGrimmchildP1;
|
||||
CurrentDataTrue(section, i);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
dataObject[i].name = dataObject[i].nameGrimmchildP2;
|
||||
CurrentDataTrue(section, i);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
dataObject[i].name = dataObject[i].nameGrimmchildP3;
|
||||
CurrentDataTrue(section, i);
|
||||
|
||||
break;
|
||||
case 4:
|
||||
dataObject[i].name = dataObject[i].nameGrimmchildP4;
|
||||
CurrentDataTrue(section, i);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
dataObject[i].name = dataObject[i].nameCarefreeMelody;
|
||||
CurrentDataTrue(section, i);
|
||||
|
||||
break;
|
||||
default:
|
||||
dataObject[i].name = dataObject[i].nameDefault;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse(section, i);
|
||||
|
||||
break;
|
||||
|
||||
case "bossGruzMother":
|
||||
|
|
@ -600,7 +678,7 @@ function CheckIfDataTrue(section, dataObject, playerData, worldData = []) {
|
|||
if (checkText === "PropertyNotFound") {
|
||||
CurrentDataBlank(section, i);
|
||||
dataObject[i].disabled = true;
|
||||
textPrefix = `<del>${textPrefix}</del>`;
|
||||
/* textPrefix = `<del>${textPrefix}</del>`; */
|
||||
break;
|
||||
} else if (checkText === "PantheonCompleted") {
|
||||
CurrentDataTrue(section, i);
|
||||
|
|
@ -614,7 +692,7 @@ function CheckIfDataTrue(section, dataObject, playerData, worldData = []) {
|
|||
(playerData[i] === true) ? CurrentDataTrue(section, i): CurrentDataFalse(section, i);
|
||||
}
|
||||
|
||||
sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki);
|
||||
/* sFillText += PrepareHTMLString(section, textPrefix, textSuffix, wiki); */
|
||||
}
|
||||
|
||||
// AppendHTML(section, sFillText);
|
||||
|
|
|
|||
|
|
@ -925,8 +925,16 @@ const HK = {
|
|||
},
|
||||
gotCharm_40: {
|
||||
name: "Charm #40 Grimmchild or Carefree Melody",
|
||||
nameDefault: "Charm #40 Grimmchild or Carefree Melody",
|
||||
nameGrimmchildP1: "Charm #40: Grimmchild (Phase 1)",
|
||||
nameGrimmchildP2: "Charm #40: Grimmchild (Phase 2)",
|
||||
nameGrimmchildP3: "Charm #40: Grimmchild (Phase 3)",
|
||||
nameGrimmchildP4: "Charm #40: Grimmchild (Phase 4)",
|
||||
nameCarefreeMelody: "Charm #40: Carefree Melody",
|
||||
spoiler: "Dirtmouth",
|
||||
wiki: "Grimmchild"
|
||||
wiki: "Grimmchild",
|
||||
wikiGrimmchild: "Grimmchild",
|
||||
wikiCarefreeMelody: "Carefree_Melody"
|
||||
},
|
||||
killedGrimm: {
|
||||
name: "P3 Troupe Master Grimm",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue