2020-10-16 08:06:03 +00:00
|
|
|
"use strict";
|
2020-10-02 12:01:51 +00:00
|
|
|
|
2020-09-29 15:11:43 +00:00
|
|
|
class GameInfo {
|
2020-10-29 21:14:40 +00:00
|
|
|
constructor() {
|
2020-10-31 15:00:26 +00:00
|
|
|
//#region Properties
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Game name
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.name = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Game author
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.author = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* URL to the game's official conversation on the F95Zone portal
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-31 15:00:26 +00:00
|
|
|
this.url = null;
|
2020-10-29 21:14:40 +00:00
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Game description
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.overview = null;
|
|
|
|
/**
|
2020-11-01 20:56:12 +00:00
|
|
|
* Game language.
|
|
|
|
* @type String
|
|
|
|
*/
|
|
|
|
this.language = null;
|
|
|
|
/**
|
|
|
|
* List of supported OS.
|
|
|
|
* @type
|
|
|
|
*/
|
|
|
|
this.supportedOS = [];
|
|
|
|
/**
|
|
|
|
* Specify whether the game has censorship
|
|
|
|
* measures regarding NSFW scenes.
|
|
|
|
* @type Boolean
|
|
|
|
*/
|
|
|
|
this.censored = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* List of tags associated with the game
|
|
|
|
* @type String[]
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.tags = [];
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Graphics engine used for game development
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.engine = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Development of the game
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.status = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Game description image URL
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-31 15:00:26 +00:00
|
|
|
this.previewSrc = null;
|
2020-10-29 21:14:40 +00:00
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Game version
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.version = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Last time the game underwent updates
|
|
|
|
* @type Date
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.lastUpdate = null;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Specifies if the game is original or a mod
|
|
|
|
* @type Boolean
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.isMod = false;
|
|
|
|
/**
|
2020-11-07 17:01:48 +00:00
|
|
|
* Changelog for the last version.
|
|
|
|
* @type String
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
this.changelog = null;
|
2020-10-31 15:00:26 +00:00
|
|
|
//#endregion Properties
|
2020-10-29 21:14:40 +00:00
|
|
|
}
|
2020-09-29 15:11:43 +00:00
|
|
|
|
2020-10-29 21:14:40 +00:00
|
|
|
/**
|
2020-10-31 15:00:26 +00:00
|
|
|
* Converts the object to a dictionary used for JSON serialization.
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
/* istanbul ignore next */
|
|
|
|
toJSON() {
|
|
|
|
return {
|
|
|
|
name: this.name,
|
|
|
|
author: this.author,
|
2020-10-31 15:00:26 +00:00
|
|
|
url: this.url,
|
2020-10-29 21:14:40 +00:00
|
|
|
overview: this.overview,
|
2020-11-01 20:56:12 +00:00
|
|
|
language: this.language,
|
|
|
|
supportedOS: this.supportedOS,
|
|
|
|
censored: this.censored,
|
2020-10-29 21:14:40 +00:00
|
|
|
engine: this.engine,
|
|
|
|
status: this.status,
|
2020-11-02 14:06:09 +00:00
|
|
|
tags: this.tags,
|
2020-10-31 15:00:26 +00:00
|
|
|
previewSrc: this.previewSrc,
|
2020-10-29 21:14:40 +00:00
|
|
|
version: this.version,
|
|
|
|
lastUpdate: this.lastUpdate,
|
|
|
|
lastPlayed: this.lastPlayed,
|
|
|
|
isMod: this.isMod,
|
|
|
|
changelog: this.changelog,
|
|
|
|
gameDir: this.gameDir,
|
|
|
|
};
|
|
|
|
}
|
2020-09-29 15:11:43 +00:00
|
|
|
|
2020-10-29 21:14:40 +00:00
|
|
|
/**
|
2020-10-31 15:00:26 +00:00
|
|
|
* Return a new GameInfo from a JSON string.
|
|
|
|
* @param {String} json JSON string used to create the new object
|
|
|
|
* @returns {GameInfo}
|
|
|
|
*/
|
2020-10-29 21:14:40 +00:00
|
|
|
static fromJSON(json) {
|
2020-11-02 14:06:09 +00:00
|
|
|
// Convert string
|
|
|
|
const temp = Object.assign(new GameInfo(), JSON.parse(json));
|
|
|
|
|
|
|
|
// JSON cannot transform a string to a date implicitly
|
|
|
|
temp.lastUpdate = new Date(temp.lastUpdate);
|
|
|
|
return temp;
|
2020-10-29 21:14:40 +00:00
|
|
|
}
|
2020-09-29 15:11:43 +00:00
|
|
|
}
|
2020-10-08 21:09:05 +00:00
|
|
|
module.exports = GameInfo;
|