mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 01:09:29 +02:00
Logs show Pokemon data
If a log doesn't contain starter data, but matches a save file, it shows your current party in that save instead.
This commit is contained in:
parent
dee46e090f
commit
ecb86753bd
@ -977,15 +977,15 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
addPkIcon(pokemon: PokemonSpecies, form: integer = 0, x: number, y: number, originX: number = 0.5, originY: number = 0.5, ignoreOverride: boolean = false): Phaser.GameObjects.Container {
|
addPkIcon(pokemon: PokemonSpecies, form: integer = 0, x: number, y: number, originX: number = 0.5, originY: number = 0.5, ignoreOverride: boolean = false, shiny?: boolean, variant?: integer): Phaser.GameObjects.Container {
|
||||||
const container = this.add.container(x, y);
|
const container = this.add.container(x, y);
|
||||||
container.setName(`${pokemon.name}-icon`);
|
container.setName(`${pokemon.name}-icon`);
|
||||||
|
|
||||||
const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(form));
|
const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(form, shiny, variant));
|
||||||
icon.setName(`sprite-${pokemon.name}-icon`);
|
icon.setName(`sprite-${pokemon.name}-icon`);
|
||||||
icon.setFrame(pokemon.getIconId(true));
|
icon.setFrame(pokemon.getIconId(true, form, shiny, variant));
|
||||||
// Temporary fix to show pokemon's default icon if variant icon doesn't exist
|
// Temporary fix to show pokemon's default icon if variant icon doesn't exist
|
||||||
if (icon.frame.name !== pokemon.getIconId(true)) {
|
if (icon.frame.name !== pokemon.getIconId(true, form, shiny, variant)) {
|
||||||
console.log(`${pokemon.name}'s variant icon does not exist. Replacing with default.`);
|
console.log(`${pokemon.name}'s variant icon does not exist. Replacing with default.`);
|
||||||
icon.setTexture(pokemon.getIconAtlasKey(0));
|
icon.setTexture(pokemon.getIconAtlasKey(0));
|
||||||
icon.setFrame(pokemon.getIconId(true));
|
icon.setFrame(pokemon.getIconId(true));
|
||||||
|
@ -14,7 +14,7 @@ import Trainer from "./field/trainer";
|
|||||||
import { Species } from "./enums/species";
|
import { Species } from "./enums/species";
|
||||||
import { GameMode, GameModes } from "./game-mode";
|
import { GameMode, GameModes } from "./game-mode";
|
||||||
import PersistentModifierData from "./system/modifier-data";
|
import PersistentModifierData from "./system/modifier-data";
|
||||||
import PokemonSpecies from "./data/pokemon-species";
|
import PokemonSpecies, { getPokemonSpecies, starterPassiveAbilities } from "./data/pokemon-species";
|
||||||
import { getStatusEffectCatchRateMultiplier, StatusEffect } from "./data/status-effect";
|
import { getStatusEffectCatchRateMultiplier, StatusEffect } from "./data/status-effect";
|
||||||
import { decrypt, SessionSaveData } from "./system/game-data";
|
import { decrypt, SessionSaveData } from "./system/game-data";
|
||||||
import { loggedInUser } from "./account";
|
import { loggedInUser } from "./account";
|
||||||
@ -24,6 +24,9 @@ import ArenaData from "./system/arena-data";
|
|||||||
import ChallengeData from "./system/challenge-data";
|
import ChallengeData from "./system/challenge-data";
|
||||||
import { Challenges } from "./enums/challenges";
|
import { Challenges } from "./enums/challenges";
|
||||||
import { getPlayerModifierTypeOptions, ModifierPoolType, ModifierTypeOption, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
import { getPlayerModifierTypeOptions, ModifierPoolType, ModifierTypeOption, regenerateModifierPoolThresholds } from "./modifier/modifier-type";
|
||||||
|
import { Ability, allAbilities } from "./data/ability";
|
||||||
|
import { pokemonPrevolutions } from "./data/pokemon-evolutions";
|
||||||
|
import { Abilities } from "./enums/abilities";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SECTIONS
|
SECTIONS
|
||||||
@ -528,7 +531,7 @@ export function printDRPD(inData: string, indent: string, drpd: DRPD): string {
|
|||||||
inData += ",\n" + indent + " \"waves\": [\n"
|
inData += ",\n" + indent + " \"waves\": [\n"
|
||||||
var isFirst = true
|
var isFirst = true
|
||||||
for (var i = 0; i < drpd.waves.length; i++) {
|
for (var i = 0; i < drpd.waves.length; i++) {
|
||||||
if (drpd.waves[i] != undefined && drpd.waves[i] != null && drpd.waves[i].id > 0) {
|
if (drpd.waves[i] != undefined && drpd.waves[i] != null) {
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
} else {
|
} else {
|
||||||
@ -1074,6 +1077,30 @@ export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeD
|
|||||||
iv: formatIVs(pokemon.ivs)
|
iv: formatIVs(pokemon.ivs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Exports a Pokemon's data as `PokeData`, using `PokemonData` rather than the Pokemon object.
|
||||||
|
* @param pokemon The Pokemon to store.
|
||||||
|
* @param encounterRarity The rarity tier of the Pokemon for this biome.
|
||||||
|
* @returns The Pokemon data.
|
||||||
|
*/
|
||||||
|
export function exportPokemonFromData(pokemon: PokemonData, encounterRarity?: string): PokeData {
|
||||||
|
var P = getPokemonSpecies(pokemon.species)
|
||||||
|
return {
|
||||||
|
id: pokemon.species,
|
||||||
|
name: P.species,
|
||||||
|
ability: Utils.getEnumKeys(Abilities)[P.getAbility(pokemon.abilityIndex)],
|
||||||
|
isHiddenAbility: P.getAbility(pokemon.abilityIndex) === P.abilityHidden,
|
||||||
|
passiveAbility: "Cannot pull Passive or Held Items from raw file data",
|
||||||
|
nature: exportNature(pokemon.nature),
|
||||||
|
gender: pokemon.gender == 0 ? "Male" : (pokemon.gender == 1 ? "Female" : "Genderless"),
|
||||||
|
rarity: encounterRarity!,
|
||||||
|
captured: false,
|
||||||
|
level: pokemon.level,
|
||||||
|
items: [],
|
||||||
|
iv_raw: exportIVs(pokemon.ivs),
|
||||||
|
iv: formatIVs(pokemon.ivs)
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Prints a Pokemon as a string, for saving a DRPD to your device.
|
* Prints a Pokemon as a string, for saving a DRPD to your device.
|
||||||
* @param inData The data to add on to.
|
* @param inData The data to add on to.
|
||||||
|
@ -255,7 +255,7 @@ export default class LogSelectUiHandler extends MessageUiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SessionSlot extends Phaser.GameObjects.Container {
|
class SessionSlot extends Phaser.GameObjects.Container {
|
||||||
public slotId: integer;
|
public slotId?: integer;
|
||||||
public autoSlot: integer;
|
public autoSlot: integer;
|
||||||
public hasData: boolean;
|
public hasData: boolean;
|
||||||
public wv: integer;
|
public wv: integer;
|
||||||
@ -285,10 +285,12 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
this.remove(this.loadingLabel, true);
|
this.remove(this.loadingLabel, true);
|
||||||
var lbl = `???`
|
var lbl = `???`
|
||||||
lbl = data.title!
|
lbl = data.title!
|
||||||
|
var matchesFile = 0
|
||||||
if (this.slotId != undefined) {
|
if (this.slotId != undefined) {
|
||||||
lbl = `[${this.slotId + 1}] ${lbl}`
|
lbl = `[${this.slotId + 1}] ${lbl}`
|
||||||
|
matchesFile = this.slotId + 1
|
||||||
}
|
}
|
||||||
console.log(data, this.slotId, this.autoSlot, lbl)
|
//console.log(data, this.slotId, this.autoSlot, lbl)
|
||||||
const gameModeLabel = addTextObject(this.scene, 8, 5, lbl, TextStyle.WINDOW);
|
const gameModeLabel = addTextObject(this.scene, 8, 5, lbl, TextStyle.WINDOW);
|
||||||
this.add(gameModeLabel);
|
this.add(gameModeLabel);
|
||||||
|
|
||||||
@ -297,49 +299,96 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
const playTimeLabel = addTextObject(this.scene, 8, 33, data.version + " / Path: " + (data.label || ""), TextStyle.WINDOW);
|
const playTimeLabel = addTextObject(this.scene, 8, 33, data.version + " / Path: " + (data.label || ""), TextStyle.WINDOW);
|
||||||
this.add(playTimeLabel);
|
this.add(playTimeLabel);
|
||||||
|
|
||||||
if (data.starters && data.starters![0] == null) {
|
var wavecount = 0
|
||||||
const timestampLabel = addTextObject(this.scene, 144, 10, "No Starter data", TextStyle.WINDOW);
|
data.waves.forEach((wv, idx) => {
|
||||||
this.add(timestampLabel);
|
if (wv) {
|
||||||
}
|
if (wv.id != 0) {
|
||||||
|
wavecount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const waveLabel = addTextObject(this.scene, 185, 33, wavecount + " wv" + (wavecount == 1 ? "" : "s"), TextStyle.WINDOW);
|
||||||
|
this.add(waveLabel);
|
||||||
const fileSizeLabel = addTextObject(this.scene, 255, 33, LoggerTools.getSize(JSON.stringify(data)), TextStyle.WINDOW);
|
const fileSizeLabel = addTextObject(this.scene, 255, 33, LoggerTools.getSize(JSON.stringify(data)), TextStyle.WINDOW);
|
||||||
fileSizeLabel.setAlign("right")
|
//fileSizeLabel.setAlign("right")
|
||||||
this.add(fileSizeLabel);
|
this.add(fileSizeLabel);
|
||||||
|
|
||||||
const pokemonIconsContainer = this.scene.add.container(144, 4);
|
const pokemonIconsContainer = this.scene.add.container(144, 4);
|
||||||
if (false || data.starters)
|
if (data.starters && data.starters![0] != null) {
|
||||||
data.starters.forEach((p: LoggerTools.PokeData, i: integer) => {
|
data.starters.forEach((p: LoggerTools.PokeData, i: integer) => {
|
||||||
if (p == undefined)
|
if (p == undefined)
|
||||||
return;
|
return;
|
||||||
const iconContainer = this.scene.add.container(26 * i, 0);
|
const iconContainer = this.scene.add.container(26 * i, 0);
|
||||||
iconContainer.setScale(0.75);
|
iconContainer.setScale(0.75);
|
||||||
|
|
||||||
//if (Utils.getEnumValues(Species)[p.id] == undefined)
|
//if (Utils.getEnumValues(Species)[p.id] == undefined)
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
//if (getPokemonSpecies(Utils.getEnumValues(Species)[p.id]) == undefined)
|
//if (getPokemonSpecies(Utils.getEnumValues(Species)[p.id]) == undefined)
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
if (allSpecies[Utils.getEnumValues(Species).indexOf(p.id)] == undefined) {
|
if (allSpecies[Utils.getEnumValues(Species).indexOf(p.id)] == undefined) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
console.log(p.id)
|
//console.log(p.id)
|
||||||
const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[p.id]), 0, 0, 0, 0, 0);
|
const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[p.id]), 0, 0, 0, 0, 0);
|
||||||
iconContainer.add(icon);
|
iconContainer.add(icon);
|
||||||
} else {
|
} else {
|
||||||
const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[p.id]), 0, 0, 0, 0, 0);
|
const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[p.id]), 0, 0, 0, 0, 0);
|
||||||
//const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[allSpecies[Utils.getEnumValues(Species).indexOf(p.id)].speciesId]), 0, 0, 0, 0, 0);
|
//const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[allSpecies[Utils.getEnumValues(Species).indexOf(p.id)].speciesId]), 0, 0, 0, 0, 0);
|
||||||
iconContainer.add(icon);
|
iconContainer.add(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
const text = addTextObject(this.scene, 32, 20, ``, TextStyle.PARTY, { fontSize: "54px", color: "#f8f8f8" });
|
const text = addTextObject(this.scene, 32, 20, ``, TextStyle.PARTY, { fontSize: "54px", color: "#f8f8f8" });
|
||||||
text.setShadow(0, 0, undefined);
|
text.setShadow(0, 0, undefined);
|
||||||
text.setStroke("#424242", 14);
|
text.setStroke("#424242", 14);
|
||||||
text.setOrigin(1, 0);
|
text.setOrigin(1, 0);
|
||||||
|
|
||||||
iconContainer.add(text);
|
iconContainer.add(text);
|
||||||
|
|
||||||
pokemonIconsContainer.add(iconContainer);
|
pokemonIconsContainer.add(iconContainer);
|
||||||
});
|
});
|
||||||
|
} else if (this.slotId != undefined) {
|
||||||
|
var gamedata = LoggerTools.parseSlotData(this.slotId)!
|
||||||
|
//console.log(gamedata)
|
||||||
|
gamedata.party.forEach((pk: PokemonData, i: integer) => {
|
||||||
|
if (pk == undefined)
|
||||||
|
return;
|
||||||
|
var p = LoggerTools.exportPokemonFromData(pk)
|
||||||
|
const iconContainer = this.scene.add.container(26 * i, 0);
|
||||||
|
iconContainer.setScale(0.75);
|
||||||
|
|
||||||
|
//if (Utils.getEnumValues(Species)[p.id] == undefined)
|
||||||
|
//return;
|
||||||
|
|
||||||
|
//if (getPokemonSpecies(Utils.getEnumValues(Species)[p.id]) == undefined)
|
||||||
|
//return;
|
||||||
|
|
||||||
|
var sp = getPokemonSpecies(pk.species);
|
||||||
|
if (allSpecies[Utils.getEnumValues(Species).indexOf(p.id)] == undefined) {
|
||||||
|
// Do nothing
|
||||||
|
const icon = this.scene.addPkIcon(sp, pk.formIndex, 0, 0, 0, 0, undefined, pk.shiny, pk.variant);
|
||||||
|
iconContainer.add(icon);
|
||||||
|
} else {
|
||||||
|
//console.log(p.id, Utils.getEnumValues(Species)[p.id])
|
||||||
|
const icon = this.scene.addPkIcon(sp, pk.formIndex, 0, 0, 0, 0, undefined, pk.shiny, pk.variant);
|
||||||
|
//const icon = this.scene.addPkIcon(getPokemonSpecies(Utils.getEnumValues(Species)[allSpecies[Utils.getEnumValues(Species).indexOf(p.id)].speciesId]), 0, 0, 0, 0, 0);
|
||||||
|
iconContainer.add(icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = addTextObject(this.scene, 32, 20, ``, TextStyle.PARTY, { fontSize: "54px", color: "#f8f8f8" });
|
||||||
|
text.setShadow(0, 0, undefined);
|
||||||
|
text.setStroke("#424242", 14);
|
||||||
|
text.setOrigin(1, 0);
|
||||||
|
|
||||||
|
iconContainer.add(text);
|
||||||
|
|
||||||
|
pokemonIconsContainer.add(iconContainer);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const timestampLabel = addTextObject(this.scene, 144, 10, "No Starter data", TextStyle.WINDOW);
|
||||||
|
this.add(timestampLabel);
|
||||||
|
}
|
||||||
|
|
||||||
this.add(pokemonIconsContainer);
|
this.add(pokemonIconsContainer);
|
||||||
|
|
||||||
@ -367,6 +416,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
this.setupWithData(JSON.parse(localStorage.getItem(l)!))
|
this.setupWithData(JSON.parse(localStorage.getItem(l)!))
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
this.scene.gameData.getSession(this.slotId, this.autoSlot).then(async sessionData => {
|
this.scene.gameData.getSession(this.slotId, this.autoSlot).then(async sessionData => {
|
||||||
if (!sessionData) {
|
if (!sessionData) {
|
||||||
@ -376,10 +426,11 @@ class SessionSlot extends Phaser.GameObjects.Container {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.hasData = true;
|
this.hasData = true;
|
||||||
//await this.setupWithData(undefined);
|
await this.setupWithData(undefined);
|
||||||
resolve(true);
|
resolve(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user