Module:GameData/doc: Difference between revisions

Update script
(Update for v1.3)
(Update script)
Line 108: Line 108:
// All data packages should now be within this.gameData
// All data packages should now be within this.gameData
}
}
getGameVersion() {
getGameFileVersion() {
const fileDOM = document.querySelector('#sidebar ul.nav-main');
const fileDOM = document.querySelector('#sidebar ul.nav-main');
let fileVer = 'Unknown';
let fileVer = 'Unknown';
if (fileDOM !== null && fileDOM.dataset !== undefined) {
if (fileDOM !== null && fileDOM.dataset !== undefined) {
fileVer = fileDOM.dataset.fileVersion;
return fileDOM.dataset.fileVersion;
}
}
return gameVersion + ' (' + fileVer + ')';
}
getGameVersion() {
return gameVersion;
}
getGameVersionText() {
return this.getGameVersion() + ' (' + this.getGameFileVersion() + ')';
}
}
getObjectByID(data, objectID, idKey = 'id') {
getObjectByID(data, objectID, idKey = 'id') {
Line 180: Line 185:
const result = await this.getWikiData();
const result = await this.getWikiData();
}
}
console.log('Printing data for game version ' + this.getGameVersion());
console.log('Printing data for game version ' + this.getGameVersionText());
this.printPages.forEach((page) => {
this.printPages.forEach((page) => {
const inclCat = this.getCategoriesForPage(page);
const inclCat = this.getCategoriesForPage(page);
Line 842: Line 847:
registerNonPackData() {
registerNonPackData() {
// Some data resides outside of packages. Add any such data to this.gameData within this function
// Some data resides outside of packages. Add any such data to this.gameData within this function
// Metadata for data/file version
if (this.gameData._dataVersion === undefined) {
this.gameData._dataVersion = ({
gameVersion: this.getGameVersion().substring(1),
fileVersion: this.getGameFileVersion().substring(1)
});
}
// Namespaces
if (this.gameData.namespaces === undefined) {
if (this.gameData.namespaces === undefined) {
const nsData = [];
const nsData = [];