TranslateMapName()

This commit is contained in:
ReznoRMichael 2021-02-10 19:37:39 +01:00
parent 2f33bc91b0
commit cde6cd9dbc
3 changed files with 25 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,7 @@
// ---------------- Load main Hollow Knight database file ----------------- //
import HK from "./hk-database.js";
import MAP from "./hk-dictionary.js";
// ---------------- Load image files (necessary for Webpack) ----------------- //
@ -741,7 +742,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
for (let i = 0; i < arrayLength; i++) {
if (sceneData.geoRocks[i].hitsLeft > 0) {
countTotal++;
console.log(`#${countTotal} | ${sceneData.geoRocks[i].id} | ${sceneData.geoRocks[i].sceneName}`);
console.log(`#${countTotal} | ${sceneData.geoRocks[i].id} | ${TranslateMapName(sceneData.geoRocks[i].sceneName)}`);
}
}
console.groupEnd();
@ -782,7 +783,7 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
if (length) {
console.groupCollapsed("%cUnrescued Grubs List:", "color: #16c60c;");
for (let i = 0; i < length; i++) {
console.log(`#${HK.GRUBS_LIST.indexOf(missingGrubsList[i]) + 1} | ${missingGrubsList[i]}`);
console.log(`#${HK.GRUBS_LIST.indexOf(missingGrubsList[i]) + 1} | ${TranslateMapName(missingGrubsList[i])}`);
}
console.groupEnd();
}
@ -1253,6 +1254,14 @@ function FillInnerHTML(elementId, textFill) {
element.innerHTML = textFill;
}
function TranslateMapName(mapCode, dictionary = MAP) {
let translation = mapCode;
if (dictionary.hasOwnProperty(mapCode)) translation = dictionary[mapCode];
return translation;
}
// Populate HTML at load (before img and css)
document.addEventListener("DOMContentLoaded", InitialHTMLPopulate(HK.DIV_ID));

View file

@ -394,6 +394,4 @@ const MAP = {
"GG_Workshop": "Godhome_Hall_Of_Gods"
};
export {
MAP
};
export default MAP;