CheckHintsTrue() optimize algorithm, add favicon
This commit is contained in:
parent
acc95a9877
commit
f2fb1f9e1d
5 changed files with 58 additions and 76 deletions
|
|
@ -209,13 +209,13 @@ const HK_DREAMNAIL = {
|
|||
};
|
||||
|
||||
const HK_EQUIPMENT = {
|
||||
hasDash: ["Mothwing Cloak", "Greenpath; Dash ability"],
|
||||
hasWalljump: ["Mantis Claw", "Mantis Village; Wall Jump ability"],
|
||||
hasSuperDash: ["Crystal Heart", "Crystal Peak; Super Dash ability"],
|
||||
hasAcidArmour: ["Isma's Tear", "Royal Waterways; Acid Armour ability"],
|
||||
hasDoubleJump: ["Monarch Wings", "Ancient Basin; Double Jump ability"],
|
||||
hasDash: ["Mothwing Cloak", "Greenpath: Dash ability"],
|
||||
hasWalljump: ["Mantis Claw", "Mantis Village: Wall Jump ability"],
|
||||
hasSuperDash: ["Crystal Heart", "Crystal Peak: Super Dash ability"],
|
||||
hasDoubleJump: ["Monarch Wings", "Ancient Basin: Double Jump ability"],
|
||||
hasAcidArmour: ["Isma's Tear", "Royal Waterways: Acid Armour ability"],
|
||||
hasKingsBrand: ["King's Brand", "Kingdom's Edge"],
|
||||
hasShadowDash: ["Shade Cloak", "The Abyss; Shadow Dash ability"]
|
||||
hasShadowDash: ["Shade Cloak", "The Abyss: Shadow Dash ability"]
|
||||
};
|
||||
|
||||
const HK_MASKSHARDS = {
|
||||
|
|
@ -321,7 +321,7 @@ const HK_GODMASTER_DOORS = [
|
|||
|
||||
/**
|
||||
* Checks Hollow Knight game completion by analyzing the save file
|
||||
* @param {object} jsonObject Save data in JavaScript Object form
|
||||
* @param {object} jsonObject Decoded save data in JavaScript Object Notation form (JSON)
|
||||
*/
|
||||
function HKCheckCompletion(jsonObject) {
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ function HKCheckCompletion(jsonObject) {
|
|||
CheckboxHintsToggle("hide");
|
||||
CheckboxLocationsToggle("hide");
|
||||
|
||||
// Pre-Cleaning and filling initial data
|
||||
// Pre-Cleaning and filling initial data (h2, id) needed for FillHTML()
|
||||
PrefillHTML(DIV_ID);
|
||||
|
||||
// Shallow Clone const objects (used for destructive functions)
|
||||
|
|
@ -558,14 +558,14 @@ function CheckPlayTime(divId, playTime) {
|
|||
* @param {object} playerData Reference/pointer to specific data where to search
|
||||
*/
|
||||
function CheckCompletionPercent(divId, playerData) {
|
||||
|
||||
|
||||
let textFill = "";
|
||||
CurrentDataFalse();
|
||||
|
||||
for (let i in playerData) {
|
||||
if (i === "completionPercentage") {
|
||||
if (playerData[i] >= 112) CurrentDataTrue();
|
||||
|
||||
|
||||
textFill = "Game Completion: <b>" + playerData[i] + " %</b> (out of " + divId.maxPercent + " %)";
|
||||
document.getElementById(divId.id).innerHTML += divStart + completionSymbol + textFill + divEnd;
|
||||
}
|
||||
|
|
@ -656,92 +656,66 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
|
|||
* @param {object} worldData object containing HK World Data to look in
|
||||
*/
|
||||
function CheckHintsTrue(divId, dataObject, playerData, worldData) {
|
||||
let hollowKnightDefeated = false;
|
||||
|
||||
for (let i in dataObject) {
|
||||
CurrentDataFalse();
|
||||
|
||||
if (playerData[i] === true) {
|
||||
if (i === "killedHollowKnight") {
|
||||
hollowKnightDefeated = true;
|
||||
// a text to show when player already finished their first playthrough (killed Hollow Knight first time)
|
||||
FillHTML(divId, "", "...a successful Knight who doesn't need hints anymore");
|
||||
break;
|
||||
}
|
||||
CurrentDataTrue();
|
||||
continue;
|
||||
} else if (i === "fireballLevel") {
|
||||
if (playerData[i] >= 1) {
|
||||
CurrentDataTrue();
|
||||
continue;
|
||||
} else {
|
||||
CurrentDataFalse();
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} else if (i === "Crossroads_04") {
|
||||
let GruzMotherDefeated = false;
|
||||
|
||||
for (let k = 0, length = worldData.length; k < length; k++) {
|
||||
if (worldData[k].id === "Battle Scene" && worldData[k].sceneName === "Crossroads_04" && worldData[k].activated === true) {
|
||||
CurrentDataTrue();
|
||||
GruzMotherDefeated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (completionSymbol === SYMBOL_FALSE) {
|
||||
if (GruzMotherDefeated) {
|
||||
continue; // next dataObject (i)
|
||||
} else {
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} else if (i === "dungDefenderOrHornet2") {
|
||||
for (let k in playerData) {
|
||||
if (k === "defeatedDungDefender" && playerData[k] === true) {
|
||||
CurrentDataTrue();
|
||||
break;
|
||||
} else if (k === "hornetOutskirtsDefeated" && playerData[k] === true) {
|
||||
CurrentDataTrue();
|
||||
break;
|
||||
} else if ((k === "defeatedDungDefender" && playerData[k] === false) &&
|
||||
(k === "hornetOutskirtsDefeated" && playerData[k] === false)) {
|
||||
CurrentDataFalse();
|
||||
if (playerData.defeatedDungDefender === true) {
|
||||
continue;
|
||||
} else if (playerData.hornetOutskirtsDefeated === true) {
|
||||
continue;
|
||||
} else { // if no Dung Defender or Hornet 2
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} else if (i === "ismaTearOrShadeCloak") {
|
||||
if (playerData.hasAcidArmour === true) {
|
||||
continue;
|
||||
} else if (playerData.hasKingsBrand === true) {
|
||||
if (playerData.hasShadowDash === true) {
|
||||
continue;
|
||||
} else { // if Kings Brand but no Shade Cloak
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} else { // if no Isma's Tear or Kings Brand
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} else if (i === "ismaTearOrShadeCloak") {
|
||||
for (let k in playerData) {
|
||||
if (k === "hasAcidArmour") {
|
||||
if (playerData[k] === true) {
|
||||
CurrentDataTrue();
|
||||
break;
|
||||
}
|
||||
} else if (k === "hasKingsBrand") {
|
||||
if (playerData[k] === true) {
|
||||
for (let l in playerData) {
|
||||
if (l === "hasShadowDash") {
|
||||
if (playerData[l] === true) {
|
||||
CurrentDataTrue();
|
||||
break;
|
||||
} else {
|
||||
CurrentDataFalse();
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CurrentDataFalse();
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CurrentDataFalse();
|
||||
} else { // if anything from the hints list is not done
|
||||
FillHTML(divId, dataObject[i][0], dataObject[i][1]);
|
||||
break;
|
||||
}
|
||||
} // end: for (let i in dataObject)
|
||||
|
||||
// prevents showing hints when player already has seen the credits
|
||||
if (hollowKnightDefeated) {
|
||||
FillHTML(divId, "", "...a successful Knight who doesn't need hints anymore");
|
||||
}
|
||||
}
|
||||
} // function CheckHintsTrue()
|
||||
|
||||
/**
|
||||
* Pre-Cleans HTML. Reads contents inside text area and parses it to a JavaScript object. If not empty, runs HKCheckCompletion() to check data.
|
||||
|
|
|
|||
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
11
index.html
11
index.html
|
|
@ -4,21 +4,21 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<link href="../favicon.png" rel="icon">
|
||||
<link href="favicon.png" rel="icon">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<link href="css/fontello.css" rel="stylesheet">
|
||||
<link href="style.css" rel="stylesheet">
|
||||
<title>Hollow Knight Completion Check Tool</title>
|
||||
<title>Hollow Knight: Analyze Save Completion</title>
|
||||
<meta name="description" content="A simple open source tool for checking what you missed for your Game Completion Percentage.">
|
||||
<meta name="keywords" content="hollow knight, tool, online, save, game, completion, check, checker, percentage, percent, left">
|
||||
|
||||
<meta property="og:title" content="Hollow Knight Completion Check Tool">
|
||||
<meta property="og:title" content="Hollow Knight: Analyze Save Completion">
|
||||
<meta property="og:description" content="A simple open source tool for checking what you missed for your Game Completion Percentage.">
|
||||
<meta property="og:image" content="http://reznortech.rf.gd/favicon.png">
|
||||
<meta property="og:url" content="http://reznortech.rf.gd/hollow-knight-completion">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta property="og:site_name" content="rezno[R].tech">
|
||||
<meta name="twitter:image:alt" content="Hollow Knight Completion Check Tool">
|
||||
<meta name="twitter:image:alt" content="Hollow Knight: Analyze Save Completion">
|
||||
<meta name="author" content="ReznoR Michael">
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -28,12 +28,11 @@
|
|||
- Calculate all % in all categories from save data
|
||||
- Single Pale Ore locations? (required for completion)
|
||||
- Single Keys/Pass locations? (required for completion)
|
||||
- CheckHintsTrue optimize algorithm
|
||||
-->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1 id="h1-title">Hollow Knight Completion % Check</h1>
|
||||
<h1 id="h1-title">Hollow Knight Analyze Save Completion</h1>
|
||||
|
||||
<p class="smalltext">Check what you have left for completion. Hints for first playthrough.<br>
|
||||
Use bloodorca's amazing <a href="https://bloodorca.github.io/hollow/" target="_blank">[ Online Hollow Knight Save Editor ]</a> to decode your save file.<br>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ function loadJSON(filename, callback) {
|
|||
xobj.send(null);
|
||||
}
|
||||
|
||||
loadJSON("save/" + fileName[5],
|
||||
loadJSON("save/" + fileName[9],
|
||||
function JSONparse(response) {
|
||||
// Parse JSON string into object
|
||||
jsonObj = JSON.parse(response);
|
||||
|
|
|
|||
17
style.css
17
style.css
|
|
@ -31,6 +31,7 @@ body {
|
|||
}
|
||||
b {
|
||||
font-weight: 500;
|
||||
color: #1e406c;
|
||||
}
|
||||
strong {
|
||||
font-weight: 700;
|
||||
|
|
@ -40,7 +41,8 @@ strong {
|
|||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.9rem;
|
||||
font-size: 1.7rem;
|
||||
color: #1e406c;
|
||||
margin: 0.6rem 0;
|
||||
}
|
||||
#h1-title {
|
||||
|
|
@ -82,7 +84,7 @@ h1 {
|
|||
}
|
||||
h2 {
|
||||
margin: 0.6rem 0;
|
||||
color: #737373;
|
||||
color: #6f7583;
|
||||
}
|
||||
p {
|
||||
margin-top: 0.6rem;
|
||||
|
|
@ -110,12 +112,13 @@ p {
|
|||
a,
|
||||
a:active,
|
||||
a:visited {
|
||||
color: black;
|
||||
color: #1e406c;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
color: #529dff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.icon-cancel {
|
||||
color: #f03a17;
|
||||
|
|
@ -194,6 +197,12 @@ input[type="radio"]
|
|||
background-color: #1e406c;
|
||||
background-color: var(--rt-main);
|
||||
}
|
||||
/* When the checkbox is checked change background color on hover */
|
||||
.radio-label:hover input:checked ~ .radiomark,
|
||||
.checkbox-label:hover input:checked ~ .checkmark
|
||||
{
|
||||
background-color: #285188;
|
||||
}
|
||||
/* Create the checkmark/indicator (hidden when not checked) */
|
||||
.radiomark:after,
|
||||
.checkmark:after
|
||||
|
|
|
|||
Loading…
Reference in a new issue