FindWorldItem() correction
This commit is contained in:
parent
291b0950a4
commit
71ba27184b
1 changed files with 29 additions and 27 deletions
|
|
@ -647,23 +647,23 @@ function CheckNailUpgrades(divId, dataObject, playerData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies if the specific Interactable is activated. Returns true or false.
|
* Verifies if the specific Interactable (Item, Boss, Chest etc.) is activated. Returns true or false.
|
||||||
* @param {string} idText Text string inside save data to search for
|
* @param {string} idText ID text of the Interactable (id in sceneData)
|
||||||
* @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
|
* @param {string} sceneNameText Map codename of the Interactable (sceneName in sceneData)
|
||||||
|
* @param {Array} worldData Array of Interactable data to search in (sceneData.persistentBoolItems)
|
||||||
*/
|
*/
|
||||||
function WorldDataActivated(idText, sceneNameText, worldData) {
|
/* function WorldDataActivated(idText, sceneNameText, worldData) {
|
||||||
|
|
||||||
// Search for the Interactable
|
// Search for the Interactable
|
||||||
for (let i = 0, length = worldData.length; i < length; i++) {
|
for (let i = 0, length = worldData.length; i < length; i++) {
|
||||||
// Verify if the Interactable is activated and return the result
|
// Verify if the Interactable is activated and return the result
|
||||||
if (worldData[i].id === idText && worldData[i].sceneName === sceneNameText && worldData[i].activated === true) {
|
if (worldData[i].id === idText && worldData[i].sceneName === sceneNameText && worldData[i].activated === true) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject.
|
* Verifies if the data in a specific object are true or false, and appends HTML accordingly. Creates a copy of dataObject.
|
||||||
|
|
@ -706,8 +706,8 @@ function CheckWorldDataTrue(divId, idText, dataObject, worldData) {
|
||||||
* @param {object} divId ID of the HTML element for data appending
|
* @param {object} divId ID of the HTML element for data appending
|
||||||
* @param {object} dataObject Object containing data to be verified
|
* @param {object} dataObject Object containing data to be verified
|
||||||
* @param {object} playerData Reference/pointer to specific data where to search (playerData)
|
* @param {object} playerData Reference/pointer to specific data where to search (playerData)
|
||||||
* @param {object} worldData Reference/pointer to specific data where to search (sceneData)
|
* @param {object} worldData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
|
||||||
* @param {object} sceneData Reference/pointer to specific data where to search (sceneData.persistentBoolItems)
|
* @param {object} sceneData Reference/pointer to specific data where to search (sceneData)
|
||||||
*/
|
*/
|
||||||
function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneData) {
|
function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneData) {
|
||||||
|
|
||||||
|
|
@ -834,10 +834,10 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
|
||||||
(playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(): CurrentDataFalse();
|
(playerData.hasLoveKey === true || playerData.openedLoveDoor === true) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "simpleKeyCityOfTears": // #2
|
case "simpleKeyCityOfTears": // #2
|
||||||
(FindWorldItem("Ruins1_17", "Shiny Item")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item", "Ruins1_17")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "simpleKeyAncientBasin": // #3
|
case "simpleKeyAncientBasin": // #3
|
||||||
(FindWorldItem("Abyss_20", "Shiny Item Stand")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item Stand", "Abyss_20")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "gotLurkerKey":
|
case "gotLurkerKey":
|
||||||
case "nightmareLanternLit":
|
case "nightmareLanternLit":
|
||||||
|
|
@ -862,22 +862,22 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
|
||||||
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
|
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreAncientBasin": // #1
|
case "paleOreAncientBasin": // #1
|
||||||
(FindWorldItem("Abyss_17", "Battle Scene Ore")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Battle Scene Ore", "Abyss_17")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreSeer": // #2
|
case "paleOreSeer": // #2
|
||||||
(playerData.dreamReward2 === true) ? CurrentDataTrue(): CurrentDataFalse();
|
(playerData.dreamReward2 === true) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreCrystalPeak": // #3
|
case "paleOreCrystalPeak": // #3
|
||||||
(FindWorldItem("Mines_34", "Shiny Item Stand")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item Stand", "Mines_34")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreDeepnest": // #4
|
case "paleOreDeepnest": // #4
|
||||||
(FindWorldItem("Deepnest_32", "Shiny Item Stand")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item Stand", "Deepnest_32")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreGrubfather": // #5
|
case "paleOreGrubfather": // #5
|
||||||
(FindWorldItem("Crossroads_38", "Shiny Item Ore")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item Ore", "Crossroads_38")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "paleOreColosseum": // #6
|
case "paleOreColosseum": // #6
|
||||||
(FindWorldItem("Room_Colosseum_Silver", "Shiny Item")) ? CurrentDataTrue(): CurrentDataFalse();
|
(FindWorldItem("Shiny Item", "Room_Colosseum_Silver")) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
break;
|
break;
|
||||||
case "relicsWandererJournal":
|
case "relicsWandererJournal":
|
||||||
case "relicsHallownestSeal":
|
case "relicsHallownestSeal":
|
||||||
|
|
@ -999,6 +999,9 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
|
||||||
case "mrMushroomState":
|
case "mrMushroomState":
|
||||||
sFillText += CheckMrMushroomState(divId, dataObject[i], playerData[i]);
|
sFillText += CheckMrMushroomState(divId, dataObject[i], playerData[i]);
|
||||||
break;
|
break;
|
||||||
|
case "pantheonSoulWarrior":
|
||||||
|
(FindWorldItem(dataObject[i].id, dataObject[i].sceneName)) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
|
(playerData[i] === true) ? CurrentDataTrue(): CurrentDataFalse();
|
||||||
} // end switch (i)
|
} // end switch (i)
|
||||||
|
|
@ -1013,21 +1016,20 @@ function CheckAdditionalThings(divId, dataObject, playerData, worldData, sceneDa
|
||||||
// -------------- Methods ---------------- //
|
// -------------- Methods ---------------- //
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for a given item in the in-game area and returns true when found and collected.
|
* Verifies if the specific Interactable (Item, Boss, Chest etc.) is activated (completed). Returns true or false.
|
||||||
* @param {string} itemArea Code of the in-game area on the map
|
* @param {string} idText ID text of the Interactable (id in sceneData)
|
||||||
* @param {string} itemId Name of the item
|
* @param {string} sceneNameText Map codename of the Interactable (sceneName in sceneData)
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function FindWorldItem(itemArea = "", itemId = "Shiny Item") {
|
function FindWorldItem(idText = "", sceneNameText = "") {
|
||||||
for (let i = 0, length = worldData.length; i < length; i++) {
|
for (let i = 0, length = worldData.length; i < length; i++) {
|
||||||
if (worldData[i].id === itemId) {
|
if (worldData[i].id === idText && worldData[i].sceneName === sceneNameText && worldData[i].activated === true) {
|
||||||
if (worldData[i].sceneName === itemArea) {
|
return true;
|
||||||
if (worldData[i].activated === true) return true;
|
} else {
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for a given item that the player has found and returns the amount of them that the player completed.
|
* Searches for a given item that the player has found and returns the amount of them that the player completed.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue