code format

This commit is contained in:
ReznoRMichael 2020-08-25 04:09:20 +02:00
parent 30897e6d21
commit 22a6aa3691
2 changed files with 14 additions and 14 deletions

View file

@ -199,7 +199,8 @@ function HKCheckCompletion(jsonObject) {
let HK_GODMASTER_temp = Object.assign({}, HK_GODMASTER);
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) {
completionSymbol = SYMBOL_FALSE;
@ -248,9 +249,6 @@ function HKCheckCompletion(jsonObject) {
// ---------------- Nail Upgrades --------------------- //
if (i === "nailSmithUpgrades") {
let nailName = ["Old Nail", "Sharpened Nail", "Channeled Nail", "Coiled Nail", "Pure Nail"];
for (let j = 0; j < nailName.length; j++) {
currentDataFalse();
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 (bossDoor.length) {
for (let j=1; j<=4; j++) {
for (let j = 1; j <= 4; j++) {
currentDataFalse();
if (i === ("bossDoorStateTier" + j)) {
if (HKPlayerData["bossDoorStateTier" + j].completed === true) currentDataTrue();

View file

@ -4,11 +4,13 @@ var jsonObj;
* Reads the .json file and parses it to a JS object (jsonObj).
* @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.
var xobj = new XMLHttpRequest();
xobj.overrideMimeType( "application/json" );
xobj.overrideMimeType("application/json");
let fileName = ["reznor88banish.json", "reznor112grimm.json"];
// Specifies the request
/* method: the request type GET or POST
@ -16,24 +18,24 @@ function loadJSON( callback ) {
async: true (asynchronous) or false (synchronous)
user: optional user name
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
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
// Returns the response data as a string
callback( xobj.responseText );
callback(xobj.responseText);
}
};
// Sends the request to the server - Used for GET requests
xobj.send( null );
xobj.send(null);
}
loadJSON(
function JSONparse( response ) {
function JSONparse(response) {
// Parse JSON string into object
jsonObj = JSON.parse( response );
console.log( jsonObj );
jsonObj = JSON.parse(response);
console.log(jsonObj);
}
);