2020-10-08 21:09:05 +00:00
|
|
|
"use strict";
|
2020-10-02 12:01:51 +00:00
|
|
|
|
2020-10-08 21:09:05 +00:00
|
|
|
const UNKNOWN = "Unknown";
|
2020-09-29 21:38:08 +00:00
|
|
|
|
2020-09-29 15:11:43 +00:00
|
|
|
class GameInfo {
|
|
|
|
constructor() {
|
2020-10-02 12:01:51 +00:00
|
|
|
//#region Properties
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Game name
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.name = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Game author
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.author = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* URL to the game's official conversation on the F95Zone portal
|
2020-10-08 21:08:20 +00:00
|
|
|
* @type String
|
2020-09-29 15:11:43 +00:00
|
|
|
*/
|
|
|
|
this.f95url = null;
|
|
|
|
/**
|
|
|
|
* Game description
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.overview = UNKNOWN;
|
|
|
|
/**
|
|
|
|
* List of tags associated with the game
|
|
|
|
* @type String[]
|
|
|
|
*/
|
|
|
|
this.tags = [];
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Graphics engine used for game development
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.engine = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Progress of the game
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.status = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Game description image URL
|
2020-10-08 21:08:20 +00:00
|
|
|
* @type String
|
2020-09-29 15:11:43 +00:00
|
|
|
*/
|
|
|
|
this.previewSource = null;
|
|
|
|
/**
|
|
|
|
* Game version
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.version = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Last time the game underwent updates
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.lastUpdate = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Last time the local copy of the game was run
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.lastPlayed = UNKNOWN;
|
2020-09-29 15:11:43 +00:00
|
|
|
/**
|
|
|
|
* Specifies if the game is original or a mod
|
|
|
|
* @type Boolean
|
|
|
|
*/
|
|
|
|
this.isMod = false;
|
|
|
|
/**
|
|
|
|
* Directory containing the local copy of the game
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-09-29 21:38:08 +00:00
|
|
|
this.gameDir = UNKNOWN;
|
2020-10-01 19:13:23 +00:00
|
|
|
/**
|
2020-10-08 21:09:05 +00:00
|
|
|
* Information on game file download links,
|
|
|
|
* including information on hosting platforms
|
2020-10-02 12:01:51 +00:00
|
|
|
* and operating system supported by the specific link
|
|
|
|
* @type GameDownload[]
|
2020-10-01 19:13:23 +00:00
|
|
|
*/
|
|
|
|
this.downloadInfo = [];
|
2020-10-02 12:01:51 +00:00
|
|
|
//#endregion Properties
|
2020-09-29 15:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts the object to a dictionary used for JSON serialization
|
|
|
|
*/
|
|
|
|
toJSON() {
|
|
|
|
return {
|
|
|
|
name: this.name,
|
|
|
|
author: this.author,
|
|
|
|
f95url: this.f95url,
|
|
|
|
overview: this.overview,
|
|
|
|
engine: this.engine,
|
|
|
|
status: this.status,
|
|
|
|
previewSource: this.previewSource,
|
|
|
|
version: this.version,
|
|
|
|
lastUpdate: this.lastUpdate,
|
|
|
|
lastPlayed: this.lastPlayed,
|
|
|
|
isMod: this.isMod,
|
2020-10-02 12:01:51 +00:00
|
|
|
gameDir: this.gameDir,
|
2020-10-08 21:09:05 +00:00
|
|
|
downloadInfo: this.downloadInfo,
|
|
|
|
};
|
2020-09-29 15:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a new GameInfo from a JSON string
|
|
|
|
* @param {String} json JSON string used to create the new object
|
|
|
|
* @returns {GameInfo}
|
|
|
|
*/
|
|
|
|
static fromJSON(json) {
|
|
|
|
return Object.assign(new GameInfo(), json);
|
|
|
|
}
|
|
|
|
}
|
2020-10-08 21:09:05 +00:00
|
|
|
module.exports = GameInfo;
|