Anonymous

Module:GameData/doc: Difference between revisions

From Melvor Idle
Update JS
(Update JS - Avoid modified descriptions for shop purchases)
(Update JS)
Line 17: Line 17:
this.baseDir = '/assets/data/';
this.baseDir = '/assets/data/';
this.namespaces = {
this.namespaces = {
melvorD: { displayName: 'Demo', url: 'https://' + location.hostname + this.baseDir + 'melvorDemo.json' },
melvorD: {
melvorF: { displayName: 'Full Version', url: 'https://' + location.hostname + this.baseDir + 'melvorFull.json' },
displayName: 'Demo',
packFile: 'melvorDemo.json',
},
melvorF: {
displayName: 'Full Version',
packFile: 'melvorFull.json',
},
melvorTotH: {
melvorTotH: {
displayName: 'Throne of the Herald',
displayName: 'Throne of the Herald',
url: 'https://' + location.hostname + this.baseDir + 'melvorTotH.json',
packFile: 'melvorTotH.json',
},
},
melvorAoD: {
melvorAoD: {
displayName: 'Atlas of Discovery',
displayName: 'Atlas of Discovery',
url: 'https://' + location.hostname + this.baseDir + 'melvorExpansion2.json',
packFile: 'melvorExpansion2.json',
},
},
melvorBirthday2023: {
melvorBirthday2023: {
displayName: 'Melvor Birthday 2023',
displayName: 'Melvor Birthday 2023',
url: 'https://' + location.hostname + this.baseDir + 'melvorBirthday2023.json',
packFile: 'melvorBirthday2023.json',
},
},
melvorItA: {
melvorItA: {
displayName: 'Into the Abyss',
displayName: 'Into the Abyss',
url: 'https://' + location.hostname + this.baseDir + 'melvorItA.json',
packFile: 'melvorItA.json',
},
},
};
};
Line 85: Line 91:
this.gameData = {};
this.gameData = {};
this.skillDataInit = {};
this.skillDataInit = {};
}
getDataPackURL(nsID) {
return 'https://' + location.hostname + this.baseDir + this.namespaces[nsID].packFile + '?' + DATA_VERSION.toString();
}
}
async getWikiData() {
async getWikiData() {
Line 92: Line 101:
for (const nsIdx in Object.keys(this.namespaces)) {
for (const nsIdx in Object.keys(this.namespaces)) {
const ns = Object.keys(this.namespaces)[nsIdx];
const ns = Object.keys(this.namespaces)[nsIdx];
const dataURL = this.namespaces[ns].url;
const dataURL = this.getDataPackURL(ns);
console.log(`URL: ${dataURL}`);
console.log(`URL: ${dataURL}`);
const dataPackage = await this.getDataPackage(dataURL);
const dataPackage = await this.getDataPackage(dataURL);
Line 344: Line 353:
case 'melvorD:Summoning':
case 'melvorD:Summoning':
importKeys = ['baseInterval'];
importKeys = ['baseInterval'];
const sumKeys = ['recipeGPCost', 'markLevels'];
const sumKeys = ['recipeAPCost', 'recipeGPCost', 'markLevels'];
sumKeys.forEach((k) => (dataNode.data[k] = Summoning[k]));
sumKeys.forEach((k) => (dataNode.data[k] = Summoning[k]));
break;
break;
Line 592: Line 601:
const dependentData = this.packData[namespace].dependentData;
const dependentData = this.packData[namespace].dependentData;
if (dependentData !== undefined) {
if (dependentData !== undefined) {
console.warn(
`Data package for ${namespace} has dependent data, which is currently unsupported`
);
// TODO Handle dependentData
// TODO Handle dependentData
}
}
Line 1,271: Line 1,283:
strongholds: {
strongholds: {
name: { key: 'STRONGHOLD_NAME', idFormat: 'NAME_{ID}' },
name: { key: 'STRONGHOLD_NAME', idFormat: 'NAME_{ID}' },
},
equipmentSlots: {
emptyName: { idFormat: 'EQUIP_SLOT_{ID}' }
},
},
gamemodes: {
gamemodes: {