From 7e435c9c0ff8424940cfa0df77ba4f4da7cf12b1 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 8 Nov 2024 15:46:05 -0800 Subject: [PATCH 1/3] Support parsing dmax and gmax moves --- src/classes/Move.ts | 12 +++++++----- src/index.ts | 2 +- src/typings/general.ts | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/classes/Move.ts b/src/classes/Move.ts index 7598c3a..0a9b223 100644 --- a/src/classes/Move.ts +++ b/src/classes/Move.ts @@ -33,22 +33,24 @@ export default class Moves extends Masterfile { data: { moveSettings }, } = object try { - const id: number = - Rpc.HoloPokemonMove[templateId.substring(11) as MoveProto] + const regular = templateId.startsWith('COMBAT_V') + const proto = regular ? templateId.substring(11) : templateId + const id = Rpc.HoloPokemonMove[proto as MoveProto] if (id || id === 0) { if (!this.parsedMoves[id]) { this.parsedMoves[id] = { moveId: id, moveName: this.capitalize( - templateId.substring(11).replace('_FAST', ''), + regular ? proto.replace('_FAST', '') : moveSettings.vfxName ), - proto: templateId.substring(11), + proto, fast: templateId.endsWith('_FAST'), } } this.parsedMoves[id].type = Rpc.HoloPokemonType[moveSettings.pokemonType as TypeProto] - this.parsedMoves[id].power = moveSettings.power + this.parsedMoves[id].power = regular + ? moveSettings.power : moveSettings.obMoveSettingsNumber18[2] this.parsedMoves[id].durationMs = moveSettings.durationMs this.parsedMoves[id].energyDelta = moveSettings.energyDelta } diff --git a/src/index.ts b/src/index.ts index 5b68565..ef3044d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,7 +35,7 @@ export async function generate({ const final: FinalResult = {} const urlToFetch = url || - 'https://raw.githubusercontent.com/PokeMiners/game_masters/master/latest/latest.json' + 'https://raw.githubusercontent.com/alexelgt/game_masters/refs/heads/master/GAME_MASTER.json' const { pokemon, types, diff --git a/src/typings/general.ts b/src/typings/general.ts index 08c801b..a659be8 100644 --- a/src/typings/general.ts +++ b/src/typings/general.ts @@ -84,9 +84,11 @@ export interface NiaMfObj { moveSettings?: { movementId: string pokemonType: string - power: number + power?: number durationMs: number - energyDelta: number + energyDelta?: number + vfxName: string + obMoveSettingsNumber18: number[] } combatMove?: { uniqueId: string | number From 3342b6f1d18f322b22ca126982b4bc47859fb6c8 Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 8 Nov 2024 16:10:37 -0800 Subject: [PATCH 2/3] Support parsing gmax move mappings --- src/classes/Pokemon.ts | 39 +++++++++++++++++++++++++++++++++++++++ src/index.ts | 3 +++ src/typings/dataTypes.ts | 1 + src/typings/general.ts | 7 +++++++ src/typings/inputs.ts | 1 + 5 files changed, 51 insertions(+) diff --git a/src/classes/Pokemon.ts b/src/classes/Pokemon.ts index 6c47dd3..236a9fd 100644 --- a/src/classes/Pokemon.ts +++ b/src/classes/Pokemon.ts @@ -978,6 +978,45 @@ export default class Pokemon extends Masterfile { } } + addSourdoughMoveMappings({ data: { + sourdoughMoveMappingSettings: { mappings } + } }: NiaMfObj) { + for (let i = 0; i < mappings.length; i += 1) try { + let id = Rpc.HoloPokemonId[ + mappings[i].pokemonId as PokemonIdProto + ] + if (!this.parsedPokemon[id]) { + this.parsedPokemon[id] = {} + } + let target = this.parsedPokemon[id] + if (mappings[i].form) { + let formId = Rpc.PokemonDisplayProto.Form[mappings[i].form as FormProto] + if (!this.parsedPokemon[id].forms) { + this.parsedPokemon[id].forms = [] + } + const formName = this.formName(id, mappings[i].form) + if (!this.skipForms(formName)) { + this.parsedForms[formId] = { + ...this.parsedForms[formId], + formName, + formId, + } + if (!this.parsedPokemon[id].forms.includes(formId)) { + this.parsedPokemon[id].forms.push(formId) + } + target = this.parsedForms[formId] + } + } + target.gmaxMove = Rpc.HoloPokemonMove[mappings[i].move as MoveProto] + } catch (e) { + console.warn( + e, + `Failed to parse gmax move mapping #${i}`, + JSON.stringify(mappings[i], null, 2), + ) + } + } + missingPokemon() { Object.values(Rpc.HoloPokemonId).forEach((id) => { try { diff --git a/src/index.ts b/src/index.ts index ef3044d..f6b3872 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,6 +91,8 @@ export async function generate({ AllPokemon.addForm(data[i]) } else if (data[i].data.pokemonSettings) { AllPokemon.addPokemon(data[i]) + } else if (data[i].data.sourdoughMoveMappingSettings) { + AllPokemon.addSourdoughMoveMappings(data[i]) } else if (data[i].data.itemSettings) { AllItems.addItem(data[i]) } else if (data[i].data.moveSettings) { @@ -305,6 +307,7 @@ export async function generate({ forms: localForms, itemRequirement: localItems, questRequirement: localEvolutionQuests, + // TODO gmaxMove }) if (pokemon.options.includeRawForms || raw) { final.forms = localForms diff --git a/src/typings/dataTypes.ts b/src/typings/dataTypes.ts index b5ea4c1..addaa99 100644 --- a/src/typings/dataTypes.ts +++ b/src/typings/dataTypes.ts @@ -152,6 +152,7 @@ interface SingleForm extends BaseStats { costumeName: string }[] sizeSettings?: { name: string; value: number }[] + gmaxMove?: number } export interface TempEvolutions extends BaseStats { diff --git a/src/typings/general.ts b/src/typings/general.ts index a659be8..4ef77db 100644 --- a/src/typings/general.ts +++ b/src/typings/general.ts @@ -104,6 +104,13 @@ export interface NiaMfObj { buffActivationChance: number }[] } + sourdoughMoveMappingSettings?: { + mappings: { + pokemonId: string + form?: string + move: string + }[] + } itemSettings?: { itemId: string | number itemType: string | number diff --git a/src/typings/inputs.ts b/src/typings/inputs.ts index aee828f..4518a81 100644 --- a/src/typings/inputs.ts +++ b/src/typings/inputs.ts @@ -127,6 +127,7 @@ interface Form extends BaseStats { transferable?: boolean costumeOverrideEvos?: CostumeOverrideEvo | StringBool sizeSettings?: { name: boolean; value: boolean } | string + gmaxMove?: Move | StringBool } type CostumeOverrideEvo = { From 6b95ecd4e31b58a9924a7b6003f8629bea233cf1 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 10 Nov 2024 11:35:37 -0800 Subject: [PATCH 3/3] Fix max move detection --- src/classes/Move.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/classes/Move.ts b/src/classes/Move.ts index 0a9b223..ba218bc 100644 --- a/src/classes/Move.ts +++ b/src/classes/Move.ts @@ -33,15 +33,15 @@ export default class Moves extends Masterfile { data: { moveSettings }, } = object try { - const regular = templateId.startsWith('COMBAT_V') - const proto = regular ? templateId.substring(11) : templateId + const isMax = templateId.startsWith('VN_BM_') + const proto = isMax ? templateId : templateId.substring(11) const id = Rpc.HoloPokemonMove[proto as MoveProto] if (id || id === 0) { if (!this.parsedMoves[id]) { this.parsedMoves[id] = { moveId: id, moveName: this.capitalize( - regular ? proto.replace('_FAST', '') : moveSettings.vfxName + isMax ? moveSettings.vfxName : proto.replace('_FAST', '') ), proto, fast: templateId.endsWith('_FAST'), @@ -49,8 +49,8 @@ export default class Moves extends Masterfile { } this.parsedMoves[id].type = Rpc.HoloPokemonType[moveSettings.pokemonType as TypeProto] - this.parsedMoves[id].power = regular - ? moveSettings.power : moveSettings.obMoveSettingsNumber18[2] + this.parsedMoves[id].power = isMax + ? moveSettings.obMoveSettingsNumber18[2] : moveSettings.power this.parsedMoves[id].durationMs = moveSettings.durationMs this.parsedMoves[id].energyDelta = moveSettings.energyDelta }