add maps counting

This commit is contained in:
ReznoRMichael 2021-08-03 11:35:57 +02:00
parent a3185d5b24
commit 5e57c0eaef
3 changed files with 146 additions and 98 deletions

View file

@ -439,6 +439,7 @@ function CheckExtendedCompletion(db) {
case "xunFlowerBrokeTimes": case "xunFlowerBrokeTimes":
case "itemsDiscovered": case "itemsDiscovered":
case "stagStationsOpened": case "stagStationsOpened":
case "areaMaps":
case "killedMegaMossCharger": case "killedMegaMossCharger":
case "killedBigBuzzer": case "killedBigBuzzer":
case "killedOblobble": case "killedOblobble":
@ -453,7 +454,7 @@ function CheckExtendedCompletion(db) {
case "greyPrinceDefeated": case "greyPrinceDefeated":
case "killedHollowKnight": case "killedHollowKnight":
case "killedFinalBoss": case "killedFinalBoss":
// console.info("Ignored:", entry); console.info("Ignored:", entry);
continue; continue;
} }
@ -1067,7 +1068,6 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
discoveredTotal = _2.discoveredTotal; discoveredTotal = _2.discoveredTotal;
switch (i) { switch (i) {
case "areaMaps":
case "grubsCollected": case "grubsCollected":
case "grubRewards": case "grubRewards":
case "charmsOwned": case "charmsOwned":
@ -1080,9 +1080,7 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
case "journalNotesCompleted": case "journalNotesCompleted":
case "whiteDefenderDefeats": case "whiteDefenderDefeats":
case "greyPrinceDefeats": case "greyPrinceDefeats":
if (i === "areaMaps") { if (i === "whisperingRoots") {
amount = CountMaps(dataObject[i].list);
} else if (i === "whisperingRoots") {
amount = CountWorldItem("Dream Plant"); amount = CountWorldItem("Dream Plant");
} else { } else {
amount = playerData[i]; amount = playerData[i];
@ -1530,6 +1528,45 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
break; break;
case "mapCrossroads":
case "mapGreenpath":
case "mapFungalWastes":
case "mapCliffs":
case "mapCity":
case "mapMines":
case "mapWaterways":
case "mapRestingGrounds":
case "mapAbyss":
case "mapOutskirts":
case "mapFogCanyon":
case "mapRoyalGardens":
case "mapDeepnest":
if (playerData[i] === true) {
SetIconGreen(section, i);
/* Create amount property before incrementing (avoids NaN) */
if (!dataObject.areaMaps.hasOwnProperty("amount")) {
dataObject.areaMaps.amount = 0;
}
/* increment the area maps amount by one */
dataObject.areaMaps.amount++;
} else {
SetIconRed(section, i);
}
break;
case "areaMaps":
if (dataObject[i].amount >= dataObject[i].max) {
SetIconGreen(section, i);
} else {
SetIconRed(section, i);
}
break;
default: default:
// backwards compatibility with earlier game versions // backwards compatibility with earlier game versions
if (playerData.hasOwnProperty(i) === false) { if (playerData.hasOwnProperty(i) === false) {
@ -1591,22 +1628,6 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
return total; return total;
} }
/**
* Counts the number of maps the player has acquired (from the list in an array)
* @param {array} mapArray Array of strings with area map names
* @returns {number}
*/
function CountMaps(mapArray) {
var totalMaps = 0;
for (var _i3 = 0, len = mapArray.length; _i3 < len; _i3++) {
if (playerData[mapArray[_i3]] === true) totalMaps++;
}
return totalMaps;
}
/** /**
* Counts the total amount of Geo Rocks Unbroken or Broken. Logs to console all the Unbroken IDs and Map locations. * Counts the total amount of Geo Rocks Unbroken or Broken. Logs to console all the Unbroken IDs and Map locations.
* @param {number} arrayLength How many items the Geo Rocks array is currently storing (for iteration) * @param {number} arrayLength How many items the Geo Rocks array is currently storing (for iteration)
@ -1620,10 +1641,10 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
var geoRocksLog = []; var geoRocksLog = [];
if (mode === "unbroken") { if (mode === "unbroken") {
for (var _i4 = 0; _i4 < arrayLength; _i4++) { for (var _i3 = 0; _i3 < arrayLength; _i3++) {
if (sceneData.geoRocks[_i4].hitsLeft > 0) { if (sceneData.geoRocks[_i3].hitsLeft > 0) {
countTotal++; countTotal++;
geoRocksLog.push("#".concat(countTotal, " \uD83C\uDFD4\uFE0F ").concat(sceneData.geoRocks[_i4].id, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(sceneData.geoRocks[_i4].sceneName), " \u2328\uFE0F ").concat(sceneData.geoRocks[_i4].sceneName)); geoRocksLog.push("#".concat(countTotal, " \uD83C\uDFD4\uFE0F ").concat(sceneData.geoRocks[_i3].id, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(sceneData.geoRocks[_i3].sceneName), " \u2328\uFE0F ").concat(sceneData.geoRocks[_i3].sceneName));
} }
} }
@ -1632,15 +1653,15 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
} else { } else {
console.groupCollapsed("%cUnbroken Geo Rocks (".concat(countTotal, "):"), "color: #16c60c; font-weight: 700;"); console.groupCollapsed("%cUnbroken Geo Rocks (".concat(countTotal, "):"), "color: #16c60c; font-weight: 700;");
for (var _i5 = 0, length = geoRocksLog.length; _i5 < length; _i5++) { for (var _i4 = 0, length = geoRocksLog.length; _i4 < length; _i4++) {
console.log(geoRocksLog[_i5]); console.log(geoRocksLog[_i4]);
} }
console.groupEnd(); console.groupEnd();
} }
} else { } else {
for (var _i6 = 0; _i6 < arrayLength; _i6++) { for (var _i5 = 0; _i5 < arrayLength; _i5++) {
if (sceneData.geoRocks[_i6].hitsLeft === 0) countTotal++; if (sceneData.geoRocks[_i5].hitsLeft === 0) countTotal++;
} }
} }
@ -1659,10 +1680,10 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
var itemsLog = []; var itemsLog = [];
if (mode === "notActivated") { if (mode === "notActivated") {
for (var _i7 = 0; _i7 < arrayLength; _i7++) { for (var _i6 = 0; _i6 < arrayLength; _i6++) {
if (worldData[_i7].activated === false && worldData[_i7].semiPersistent === false) { if (worldData[_i6].activated === false && worldData[_i6].semiPersistent === false) {
countTotal++; countTotal++;
itemsLog.push("#".concat(countTotal, " ").concat(worldData[_i7].id, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(worldData[_i7].sceneName), " \u2328\uFE0F ").concat(worldData[_i7].sceneName)); itemsLog.push("#".concat(countTotal, " ").concat(worldData[_i6].id, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(worldData[_i6].sceneName), " \u2328\uFE0F ").concat(worldData[_i6].sceneName));
} }
} }
@ -1671,15 +1692,15 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
} else { } else {
console.groupCollapsed("%cNot Activated Interactables (".concat(countTotal, "):"), "color: #16c60c; font-weight: 700;"); console.groupCollapsed("%cNot Activated Interactables (".concat(countTotal, "):"), "color: #16c60c; font-weight: 700;");
for (var _i8 = 0, length = itemsLog.length; _i8 < length; _i8++) { for (var _i7 = 0, length = itemsLog.length; _i7 < length; _i7++) {
console.log(itemsLog[_i8]); console.log(itemsLog[_i7]);
} }
console.groupEnd(); console.groupEnd();
} }
} else { } else {
for (var _i9 = 0; _i9 < arrayLength; _i9++) { for (var _i8 = 0; _i8 < arrayLength; _i8++) {
if (worldData[_i9].activated === true) countTotal++; if (worldData[_i8].activated === true) countTotal++;
} }
} }
@ -1693,9 +1714,9 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
function LogMissingGrubs() { function LogMissingGrubs() {
var rescuedGrubsSceneList = []; var rescuedGrubsSceneList = [];
for (var _i10 = 0, _length = worldData.length; _i10 < _length; _i10++) { for (var _i9 = 0, _length = worldData.length; _i9 < _length; _i9++) {
if (worldData[_i10].id.includes("Grub Bottle")) { if (worldData[_i9].id.includes("Grub Bottle")) {
if (worldData[_i10].activated === true) { if (worldData[_i9].activated === true) {
// There are 3 duplicates of the same map scene name from older game save files. Prevents adding duplicates // There are 3 duplicates of the same map scene name from older game save files. Prevents adding duplicates
/* if (worldData[i].sceneName === "Ruins2_11" && worldData[i].id === "Grub Bottle (1)") { /* if (worldData[i].sceneName === "Ruins2_11" && worldData[i].id === "Grub Bottle (1)") {
@ -1703,7 +1724,7 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
} else if (worldData[i].sceneName === "Ruins2_11" && worldData[i].id === "Grub Bottle (2)") { } else if (worldData[i].sceneName === "Ruins2_11" && worldData[i].id === "Grub Bottle (2)") {
continue; continue;
} else { */ } else { */
rescuedGrubsSceneList.push(worldData[_i10].sceneName); // } rescuedGrubsSceneList.push(worldData[_i9].sceneName); // }
} }
} }
} // Filtering the reference database Grub list to include only the missing values } // Filtering the reference database Grub list to include only the missing values
@ -1719,8 +1740,8 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
} else { } else {
console.groupCollapsed("%cUnrescued Grubs (".concat(length, "):"), "color: #16c60c; font-weight: 700;"); console.groupCollapsed("%cUnrescued Grubs (".concat(length, "):"), "color: #16c60c; font-weight: 700;");
for (var _i11 = 0; _i11 < length; _i11++) { for (var _i10 = 0; _i10 < length; _i10++) {
console.log("#".concat(section.grubsList.indexOf(missingGrubsList[_i11]) + 1, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(missingGrubsList[_i11]), " \u2328\uFE0F ").concat(missingGrubsList[_i11])); console.log("#".concat(section.grubsList.indexOf(missingGrubsList[_i10]) + 1, " \uD83D\uDDFA\uFE0F ").concat((0,_hk_functions_js__WEBPACK_IMPORTED_MODULE_2__.TranslateMapName)(missingGrubsList[_i10]), " \u2328\uFE0F ").concat(missingGrubsList[_i10]));
} }
console.groupEnd(); console.groupEnd();
@ -4513,50 +4534,30 @@ var HK = {
spoiler: "60/80 Geo: just below Greenpath entrance", spoiler: "60/80 Geo: just below Greenpath entrance",
wiki: "Greenpath" wiki: "Greenpath"
}, },
mapFogCanyon: {
name: "Map: Fog Canyon",
spoiler: "150/200 Geo: above Teacher's Archives",
wiki: "Fog_Canyon"
},
mapRoyalGardens: {
name: "Map: Queen's Gardens",
spoiler: "150/200 Geo: below Fog Canyon entrance",
wiki: "Queen's_Gardens"
},
mapFungalWastes: { mapFungalWastes: {
name: "Map: Fungal Wastes", name: "Map: Fungal Wastes",
spoiler: "75/100 Geo: right of Queen's Station", spoiler: "75/100 Geo: right of Queen's Station",
wiki: "Fungal_Wastes" wiki: "Fungal_Wastes"
}, },
mapCity: {
name: "Map: City of Tears",
spoiler: "90/120 Geo: left of Soul Sanctum",
wiki: "City_of_Tears"
},
mapWaterways: {
name: "Map: Royal Waterways",
spoiler: "75/100 Geo: far left area, near Fungal",
wiki: "Royal_Waterways"
},
mapMines: {
name: "Map: Crystal Peak",
spoiler: "120/150 Geo: top left area",
wiki: "Crystal_Peak"
},
mapDeepnest: {
name: "Map: Deepnest",
spoiler: "38/50 Geo: near both Fungal Wastes entrances",
wiki: "Deepnest"
},
mapCliffs: { mapCliffs: {
name: "Map: Howling Cliffs", name: "Map: Howling Cliffs",
spoiler: "75/100 Geo: left middle area, near Journal", spoiler: "75/100 Geo: left middle area, near Journal",
wiki: "Howling_Cliffs" wiki: "Howling_Cliffs"
}, },
mapOutskirts: { mapCity: {
name: "Map: Kingdom's Edge + Hive", name: "Map: City of Tears",
spoiler: "112/150 Geo: left bottom area, inside pipe", spoiler: "90/120 Geo: left of Soul Sanctum",
wiki: "Kingdom's_Edge" wiki: "City_of_Tears"
},
mapMines: {
name: "Map: Crystal Peak",
spoiler: "120/150 Geo: top left area",
wiki: "Crystal_Peak"
},
mapWaterways: {
name: "Map: Royal Waterways",
spoiler: "75/100 Geo: far left area, near Fungal",
wiki: "Royal_Waterways"
}, },
mapRestingGrounds: { mapRestingGrounds: {
name: "Map: Resting Grounds", name: "Map: Resting Grounds",
@ -4568,6 +4569,26 @@ var HK = {
spoiler: "112/150 Geo: center area, near fountain", spoiler: "112/150 Geo: center area, near fountain",
wiki: "Ancient_Basin" wiki: "Ancient_Basin"
}, },
mapOutskirts: {
name: "Map: Kingdom's Edge + Hive",
spoiler: "112/150 Geo: left bottom area, inside pipe",
wiki: "Kingdom's_Edge"
},
mapFogCanyon: {
name: "Map: Fog Canyon",
spoiler: "150/200 Geo: above Teacher's Archives",
wiki: "Fog_Canyon"
},
mapRoyalGardens: {
name: "Map: Queen's Gardens",
spoiler: "150/200 Geo: below Fog Canyon entrance",
wiki: "Queen's_Gardens"
},
mapDeepnest: {
name: "Map: Deepnest",
spoiler: "38/50 Geo: near both Fungal Wastes entrances",
wiki: "Deepnest"
},
areaMaps: { areaMaps: {
name: "Area Maps", name: "Area Maps",
spoiler: "Cornifer and Iselda, 13 Area Maps total", spoiler: "Cornifer and Iselda, 13 Area Maps total",
@ -4576,11 +4597,6 @@ var HK = {
list: ["mapCrossroads", "mapGreenpath", "mapFogCanyon", "mapRoyalGardens", "mapFungalWastes", "mapCity", "mapWaterways", "mapMines", "mapDeepnest", "mapCliffs", "mapOutskirts", "mapRestingGrounds", "mapAbyss"], list: ["mapCrossroads", "mapGreenpath", "mapFogCanyon", "mapRoyalGardens", "mapFungalWastes", "mapCity", "mapWaterways", "mapMines", "mapDeepnest", "mapCliffs", "mapOutskirts", "mapRestingGrounds", "mapAbyss"],
wiki: "Map_and_Quill#Maps" wiki: "Map_and_Quill#Maps"
}, },
hasPinGrub: {
name: "Collector's Map",
spoiler: "Kingdom's Edge: Tower of Love, Love Key",
wiki: "Map_and_Quill#The_Collector's_Map"
},
hasJournal: { hasJournal: {
name: "Hunter's Journal", name: "Hunter's Journal",
spoiler: "Greenpath: Hunter, above Stone Sanctuary", spoiler: "Greenpath: Hunter, above Stone Sanctuary",
@ -5977,6 +5993,11 @@ var HK = {
spoiler: "Dirtmouth: Troupe Leader Grimm", spoiler: "Dirtmouth: Troupe Leader Grimm",
wiki: "Category:Charms#Notches" wiki: "Category:Charms#Notches"
}, },
hasPinGrub: {
name: "Collector's Map",
spoiler: "Kingdom's Edge: Tower of Love, Love Key",
wiki: "Map_and_Quill#The_Collector's_Map"
},
hasDreamGate: { hasDreamGate: {
name: "Dreamgate", name: "Dreamgate",
spoiler: "Seer: 900 Essence", spoiler: "Seer: 900 Essence",

File diff suppressed because one or more lines are too long

View file

@ -514,6 +514,7 @@ function CheckExtendedCompletion(db) {
case "xunFlowerBrokeTimes": case "xunFlowerBrokeTimes":
case "itemsDiscovered": case "itemsDiscovered":
case "stagStationsOpened": case "stagStationsOpened":
case "areaMaps":
case "killedMegaMossCharger": case "killedMegaMossCharger":
case "killedBigBuzzer": case "killedBigBuzzer":
case "killedOblobble": case "killedOblobble":
@ -1188,7 +1189,6 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
} = 0; } = 0;
switch (i) { switch (i) {
case "areaMaps":
case "grubsCollected": case "grubsCollected":
case "grubRewards": case "grubRewards":
case "charmsOwned": case "charmsOwned":
@ -1201,9 +1201,7 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
case "journalNotesCompleted": case "journalNotesCompleted":
case "whiteDefenderDefeats": case "whiteDefenderDefeats":
case "greyPrinceDefeats": case "greyPrinceDefeats":
if (i === "areaMaps") { if (i === "whisperingRoots") {
amount = CountMaps(dataObject[i].list);
} else if (i === "whisperingRoots") {
amount = CountWorldItem("Dream Plant"); amount = CountWorldItem("Dream Plant");
} else { } else {
amount = playerData[i]; amount = playerData[i];
@ -1663,6 +1661,48 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
break; break;
case "mapCrossroads":
case "mapGreenpath":
case "mapFungalWastes":
case "mapCliffs":
case "mapCity":
case "mapMines":
case "mapWaterways":
case "mapRestingGrounds":
case "mapAbyss":
case "mapOutskirts":
case "mapFogCanyon":
case "mapRoyalGardens":
case "mapDeepnest":
if (playerData[i] === true) {
SetIconGreen(section, i);
/* Create amount property before incrementing (avoids NaN) */
if (!dataObject.areaMaps.hasOwnProperty("amount")) {
dataObject.areaMaps.amount = 0;
}
/* increment the area maps amount by one */
dataObject.areaMaps.amount++;
} else {
SetIconRed(section, i);
}
break;
case "areaMaps":
if (dataObject[i].amount >= dataObject[i].max) {
SetIconGreen(section, i);
} else {
SetIconRed(section, i);
}
break;
default: default:
// backwards compatibility with earlier game versions // backwards compatibility with earlier game versions
@ -1720,19 +1760,6 @@ function CheckAdditionalThings(section, dataObject, playerData, worldData, scene
return total; return total;
} }
/**
* Counts the number of maps the player has acquired (from the list in an array)
* @param {array} mapArray Array of strings with area map names
* @returns {number}
*/
function CountMaps(mapArray) {
let totalMaps = 0;
for (let i = 0, len = mapArray.length; i < len; i++) {
if (playerData[mapArray[i]] === true) totalMaps++;
}
return totalMaps;
}
/** /**
* Counts the total amount of Geo Rocks Unbroken or Broken. Logs to console all the Unbroken IDs and Map locations. * Counts the total amount of Geo Rocks Unbroken or Broken. Logs to console all the Unbroken IDs and Map locations.
* @param {number} arrayLength How many items the Geo Rocks array is currently storing (for iteration) * @param {number} arrayLength How many items the Geo Rocks array is currently storing (for iteration)