diff --git a/data/schema.strict.yaml b/data/schema.strict.yaml index b2595909..22f3f852 100644 --- a/data/schema.strict.yaml +++ b/data/schema.strict.yaml @@ -100,3 +100,8 @@ additionalProperties: properties: id: type: integer + gog: + type: object + properties: + id: + type: integer diff --git a/data/schema.yaml b/data/schema.yaml index 30a6ef76..7eb9585b 100644 --- a/data/schema.yaml +++ b/data/schema.yaml @@ -81,3 +81,8 @@ additionalProperties: properties: id: type: integer + gog: + type: object + properties: + id: + type: integer diff --git a/src/manifest.ts b/src/manifest.ts index 87e78d9e..c08fa29b 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -40,6 +40,9 @@ export interface Game { steam?: { id?: number }; + gog?: { + id?: number, + }; } export interface Constraint { @@ -77,6 +80,9 @@ function integrateWikiData(game: Game, cache: WikiGameCache[""]): void { if (cache.steam !== undefined) { game.steam = { id: cache.steam }; } + if (cache.gog !== undefined) { + game.gog = { id: cache.gog }; + } const info = parseTemplates(cache.templates ?? []); game.files = info.files; game.registry = info.registry; diff --git a/src/wiki.ts b/src/wiki.ts index 5383b486..b1b647d1 100644 --- a/src/wiki.ts +++ b/src/wiki.ts @@ -37,6 +37,8 @@ export type WikiGameCache = { renamedFrom?: Array, templates?: Array, steam?: number, + gog?: number + }; }; @@ -587,6 +589,10 @@ export async function getGame(pageTitle: string, cache: WikiGameCache, client: W if (!isNaN(steamId) && steamId > 0) { cache[pageTitle].steam = steamId; } + const gogId = Number(template.parameters["gogcom id"]); + if (!isNaN(gogId) && gogId > 0) { + cache[pageTitle].gog = gogId + } } else if (templateName === "game data/saves" || templateName === "game data/config") { const reparsed = parseWiki(template.toString()); if (reparsed[0].positionalParameters[1]?.length > 0 ?? false) {