code format
This commit is contained in:
parent
30897e6d21
commit
22a6aa3691
2 changed files with 14 additions and 14 deletions
|
|
@ -199,7 +199,8 @@ function HKCheckCompletion(jsonObject) {
|
||||||
let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER);
|
let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER);
|
||||||
|
|
||||||
let HKPlayerData = jsonObject.playerData;
|
let HKPlayerData = jsonObject.playerData;
|
||||||
let bossDoor = ["Pantheon of the Master", "Pantheon of the Artist", "Pantheon of the Sage", "Pantheon of the Knight"]
|
let bossDoor = ["Pantheon of the Master", "Pantheon of the Artist", "Pantheon of the Sage", "Pantheon of the Knight"];
|
||||||
|
let nailName = ["Old Nail", "Sharpened Nail", "Channeled Nail", "Coiled Nail", "Pure Nail"];
|
||||||
|
|
||||||
for (i in HKPlayerData) {
|
for (i in HKPlayerData) {
|
||||||
completionSymbol = SYMBOL_FALSE;
|
completionSymbol = SYMBOL_FALSE;
|
||||||
|
|
@ -248,9 +249,6 @@ function HKCheckCompletion(jsonObject) {
|
||||||
// ---------------- Nail Upgrades --------------------- //
|
// ---------------- Nail Upgrades --------------------- //
|
||||||
|
|
||||||
if (i === "nailSmithUpgrades") {
|
if (i === "nailSmithUpgrades") {
|
||||||
|
|
||||||
let nailName = ["Old Nail", "Sharpened Nail", "Channeled Nail", "Coiled Nail", "Pure Nail"];
|
|
||||||
|
|
||||||
for (let j = 0; j < nailName.length; j++) {
|
for (let j = 0; j < nailName.length; j++) {
|
||||||
currentDataFalse();
|
currentDataFalse();
|
||||||
if (HKPlayerData.nailSmithUpgrades >= j) currentDataTrue();
|
if (HKPlayerData.nailSmithUpgrades >= j) currentDataTrue();
|
||||||
|
|
@ -289,7 +287,7 @@ function HKCheckCompletion(jsonObject) {
|
||||||
if (HK_GODMASTER_temp) checkIfDataTrue(DIV_ID.godmaster, HK_GODMASTER_temp, HKPlayerData);
|
if (HK_GODMASTER_temp) checkIfDataTrue(DIV_ID.godmaster, HK_GODMASTER_temp, HKPlayerData);
|
||||||
|
|
||||||
if (bossDoor.length) {
|
if (bossDoor.length) {
|
||||||
for (let j=1; j<=4; j++) {
|
for (let j = 1; j <= 4; j++) {
|
||||||
currentDataFalse();
|
currentDataFalse();
|
||||||
if (i === ("bossDoorStateTier" + j)) {
|
if (i === ("bossDoorStateTier" + j)) {
|
||||||
if (HKPlayerData["bossDoorStateTier" + j].completed === true) currentDataTrue();
|
if (HKPlayerData["bossDoorStateTier" + j].completed === true) currentDataTrue();
|
||||||
|
|
|
||||||
20
loadJson.js
20
loadJson.js
|
|
@ -4,11 +4,13 @@ var jsonObj;
|
||||||
* Reads the .json file and parses it to a JS object (jsonObj).
|
* Reads the .json file and parses it to a JS object (jsonObj).
|
||||||
* @param callback Asynchronous function.
|
* @param callback Asynchronous function.
|
||||||
*/
|
*/
|
||||||
function loadJSON( callback ) {
|
function loadJSON(callback) {
|
||||||
// new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server.
|
// new Http request object (asynchronous), both the web page and the XML file it tries to load, must be located on the same server.
|
||||||
var xobj = new XMLHttpRequest();
|
var xobj = new XMLHttpRequest();
|
||||||
|
|
||||||
xobj.overrideMimeType( "application/json" );
|
xobj.overrideMimeType("application/json");
|
||||||
|
|
||||||
|
let fileName = ["reznor88banish.json", "reznor112grimm.json"];
|
||||||
|
|
||||||
// Specifies the request
|
// Specifies the request
|
||||||
/* method: the request type GET or POST
|
/* method: the request type GET or POST
|
||||||
|
|
@ -16,24 +18,24 @@ function loadJSON( callback ) {
|
||||||
async: true (asynchronous) or false (synchronous)
|
async: true (asynchronous) or false (synchronous)
|
||||||
user: optional user name
|
user: optional user name
|
||||||
psw: optional password */
|
psw: optional password */
|
||||||
xobj.open( 'GET', 'reznor88banish.json', true ); // Path to the file
|
xobj.open('GET', fileName[0], true); // Path to the file
|
||||||
|
|
||||||
// Defines a function to be called when the readyState property changes
|
// Defines a function to be called when the readyState property changes
|
||||||
xobj.onreadystatechange = function GetResponseText() {
|
xobj.onreadystatechange = function GetResponseText() {
|
||||||
if( xobj.readyState == 4 && xobj.status == "200" ) {
|
if (xobj.readyState == 4 && xobj.status == "200") {
|
||||||
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
|
// Required use of an anonymous callback as .open will NOT return a value but simply returns undefined in asynchronous mode
|
||||||
// Returns the response data as a string
|
// Returns the response data as a string
|
||||||
callback( xobj.responseText );
|
callback(xobj.responseText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Sends the request to the server - Used for GET requests
|
// Sends the request to the server - Used for GET requests
|
||||||
xobj.send( null );
|
xobj.send(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadJSON(
|
loadJSON(
|
||||||
function JSONparse( response ) {
|
function JSONparse(response) {
|
||||||
// Parse JSON string into object
|
// Parse JSON string into object
|
||||||
jsonObj = JSON.parse( response );
|
jsonObj = JSON.parse(response);
|
||||||
console.log( jsonObj );
|
console.log(jsonObj);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
Loading…
Reference in a new issue