Merge branch 'beta' into boss-shield-fix
Before Width: | Height: | Size: 848 B After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 864 B After Width: | Height: | Size: 1.1 KiB |
@ -4,8 +4,8 @@
|
|||||||
"image": "skull_grunt_f.png",
|
"image": "skull_grunt_f.png",
|
||||||
"format": "RGBA8888",
|
"format": "RGBA8888",
|
||||||
"size": {
|
"size": {
|
||||||
"w": 69,
|
"w": 74,
|
||||||
"h": 69
|
"h": 74
|
||||||
},
|
},
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"frames": [
|
"frames": [
|
||||||
@ -14,20 +14,20 @@
|
|||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
"w": 80,
|
"w": 31,
|
||||||
"h": 80
|
"h": 74
|
||||||
},
|
},
|
||||||
"spriteSourceSize": {
|
"spriteSourceSize": {
|
||||||
"x": 27,
|
"x": 0,
|
||||||
"y": 9,
|
"y": 0,
|
||||||
"w": 29,
|
"w": 31,
|
||||||
"h": 69
|
"h": 74
|
||||||
},
|
},
|
||||||
"frame": {
|
"frame": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"w": 29,
|
"w": 31,
|
||||||
"h": 69
|
"h": 74
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -36,6 +36,6 @@
|
|||||||
"meta": {
|
"meta": {
|
||||||
"app": "https://www.codeandweb.com/texturepacker",
|
"app": "https://www.codeandweb.com/texturepacker",
|
||||||
"version": "3.0",
|
"version": "3.0",
|
||||||
"smartupdate": "$TexturePacker:SmartUpdate:2e44c39efe8e78ec75d9119731b9b1cb:4923b5197ea74a9ed0b861e2408f595b:9035f560a0ab0d45bcc084aba7172990$"
|
"smartupdate": "$TexturePacker:SmartUpdate:71a1f5b1981674c6e81163ac8ea576c3:a5e612d58e5f0a1489e111212baea09d:dd369353af16e4c5eb6547e129dfac18$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 905 B |
@ -4,8 +4,8 @@
|
|||||||
"image": "skull_grunt_m.png",
|
"image": "skull_grunt_m.png",
|
||||||
"format": "RGBA8888",
|
"format": "RGBA8888",
|
||||||
"size": {
|
"size": {
|
||||||
"w": 67,
|
"w": 72,
|
||||||
"h": 67
|
"h": 72
|
||||||
},
|
},
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"frames": [
|
"frames": [
|
||||||
@ -14,20 +14,20 @@
|
|||||||
"rotated": false,
|
"rotated": false,
|
||||||
"trimmed": false,
|
"trimmed": false,
|
||||||
"sourceSize": {
|
"sourceSize": {
|
||||||
"w": 80,
|
"w": 51,
|
||||||
"h": 80
|
"h": 72
|
||||||
},
|
},
|
||||||
"spriteSourceSize": {
|
"spriteSourceSize": {
|
||||||
"x": 28,
|
"x": 0,
|
||||||
"y": 11,
|
"y": 0,
|
||||||
"w": 26,
|
"w": 51,
|
||||||
"h": 67
|
"h": 72
|
||||||
},
|
},
|
||||||
"frame": {
|
"frame": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"w": 26,
|
"w": 51,
|
||||||
"h": 67
|
"h": 72
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -36,6 +36,6 @@
|
|||||||
"meta": {
|
"meta": {
|
||||||
"app": "https://www.codeandweb.com/texturepacker",
|
"app": "https://www.codeandweb.com/texturepacker",
|
||||||
"version": "3.0",
|
"version": "3.0",
|
||||||
"smartupdate": "$TexturePacker:SmartUpdate:688a83ff13a77c6923f038db8c7e5e84:d0ece3ab82602eb0c5003bacc26dbd9f:1ff10b395daf6ebfa377680a6404f816$"
|
"smartupdate": "$TexturePacker:SmartUpdate:4deb2a68e4d168bb1a40cb5d190a7d1f:be3d7b29f4b544ba51cf907691fef51d:df57ca2c9bf5f80d930306e15a851d4d$"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 723 B After Width: | Height: | Size: 966 B |
@ -6,6 +6,7 @@ export interface UserInfo {
|
|||||||
lastSessionSlot: integer;
|
lastSessionSlot: integer;
|
||||||
discordId: string;
|
discordId: string;
|
||||||
googleId: string;
|
googleId: string;
|
||||||
|
hasAdminRole: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let loggedInUser: UserInfo | null = null;
|
export let loggedInUser: UserInfo | null = null;
|
||||||
@ -13,13 +14,13 @@ export let loggedInUser: UserInfo | null = null;
|
|||||||
export const clientSessionId = Utils.randomString(32);
|
export const clientSessionId = Utils.randomString(32);
|
||||||
|
|
||||||
export function initLoggedInUser(): void {
|
export function initLoggedInUser(): void {
|
||||||
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: ""};
|
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateUserInfo(): Promise<[boolean, integer]> {
|
export function updateUserInfo(): Promise<[boolean, integer]> {
|
||||||
return new Promise<[boolean, integer]>(resolve => {
|
return new Promise<[boolean, integer]>(resolve => {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "" };
|
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false};
|
||||||
let lastSessionSlot = -1;
|
let lastSessionSlot = -1;
|
||||||
for (let s = 0; s < 5; s++) {
|
for (let s = 0; s < 5; s++) {
|
||||||
if (localStorage.getItem(`sessionData${s ? s : ""}_${loggedInUser.username}`)) {
|
if (localStorage.getItem(`sessionData${s ? s : ""}_${loggedInUser.username}`)) {
|
||||||
|
@ -2,6 +2,106 @@
|
|||||||
"boy": "Chico",
|
"boy": "Chico",
|
||||||
"girl": "Chica",
|
"girl": "Chica",
|
||||||
"general": "General",
|
"general": "General",
|
||||||
|
"display": "Pantalla",
|
||||||
"audio": "Audio",
|
"audio": "Audio",
|
||||||
"shopOverlayOpacity": "Opacidad de la fase de compra"
|
"gamepad": "Mando",
|
||||||
|
"keyboard": "Teclado",
|
||||||
|
"gameSpeed": "Veloc. del juego",
|
||||||
|
"hpBarSpeed": "Veloc. barra PS",
|
||||||
|
"expGainsSpeed": "Veloc. de EXP",
|
||||||
|
"expPartyDisplay": "Mostrar EXP del Equipo",
|
||||||
|
"skipSeenDialogues": "Saltar diálogos leídos",
|
||||||
|
"battleStyle": "Estilo de lucha",
|
||||||
|
"enableRetries": "Activar reintento",
|
||||||
|
"hideIvs": "Ocultar escáner de IVs",
|
||||||
|
"tutorials": "Tutoriales",
|
||||||
|
"touchControls": "Control táctil",
|
||||||
|
"vibrations": "Vibración",
|
||||||
|
"normal": "Normal",
|
||||||
|
"fast": "+1",
|
||||||
|
"faster": "+2",
|
||||||
|
"skip": "Saltar",
|
||||||
|
"levelUpNotifications": "Aumentos de nivel",
|
||||||
|
"on": "Sí",
|
||||||
|
"off": "No",
|
||||||
|
"switch": "Cambiar",
|
||||||
|
"set": "Mantener",
|
||||||
|
"auto": "Auto.",
|
||||||
|
"disabled": "Desact.",
|
||||||
|
"language": "Idioma",
|
||||||
|
"change": "Cambiar",
|
||||||
|
"uiTheme": "Color UI",
|
||||||
|
"default": "Predet.",
|
||||||
|
"legacy": "Clásico",
|
||||||
|
"windowType": "Ventana",
|
||||||
|
"moneyFormat": "Formato dinero",
|
||||||
|
"damageNumbers": "Cifras de daño",
|
||||||
|
"simple": "Simple",
|
||||||
|
"fancy": "Elegante",
|
||||||
|
"abbreviated": "Abreviado",
|
||||||
|
"moveAnimations": "Animación de movs.",
|
||||||
|
"showStatsOnLevelUp": "Estadísticas al aum. nivel",
|
||||||
|
"candyUpgradeNotification": "Aviso de caramelos",
|
||||||
|
"passivesOnly": "Solo pasivas",
|
||||||
|
"candyUpgradeDisplay": "Muestra de caramelos",
|
||||||
|
"icon": "Icono",
|
||||||
|
"animation": "Animación",
|
||||||
|
"moveInfo": "Info. de movimientos",
|
||||||
|
"showMovesetFlyout": "Descripción de movimientos",
|
||||||
|
"showArenaFlyout": "Descripción de escenarios",
|
||||||
|
"showTimeOfDayWidget": "Mostrar hora del día",
|
||||||
|
"timeOfDayAnimation": "Animación hora del día",
|
||||||
|
"bounce": "Rebote",
|
||||||
|
"timeOfDay_back": "Vuelta",
|
||||||
|
"spriteSet": "Set de sprites",
|
||||||
|
"consistent": "Consistente",
|
||||||
|
"mixedAnimated": "Mixto",
|
||||||
|
"fusionPaletteSwaps": "Colores de fusión",
|
||||||
|
"playerGender": "Género del jugador",
|
||||||
|
"typeHints": "Pistas de tipos",
|
||||||
|
"masterVolume": "Volumen total",
|
||||||
|
"bgmVolume": "Volumen música",
|
||||||
|
"fieldVolume": "Volumen escenario",
|
||||||
|
"seVolume": "Volumen efectos",
|
||||||
|
"uiVolume": "Volumen sistema",
|
||||||
|
"musicPreference": "Preferencia musical",
|
||||||
|
"mixed": "Mixta",
|
||||||
|
"gamepadPleasePlug": "Conecta un mando o pulsa un botón",
|
||||||
|
"delete": "Eliminar",
|
||||||
|
"keyboardPleasePress": "Pulsa una tecla de tu teclado",
|
||||||
|
"reset": "Restablecer",
|
||||||
|
"requireReload": "Requiere reinicio",
|
||||||
|
"action": "Acción",
|
||||||
|
"back": "Atrás",
|
||||||
|
"pressToBind": "Pulsa para vincular",
|
||||||
|
"pressButton": "Pulsa un botón...",
|
||||||
|
"buttonUp": "Arriba",
|
||||||
|
"buttonDown": "Abajo",
|
||||||
|
"buttonLeft": "Izquierda",
|
||||||
|
"buttonRight": "Derecha",
|
||||||
|
"buttonAction": "Acción",
|
||||||
|
"buttonMenu": "Menú",
|
||||||
|
"buttonSubmit": "Confirmar",
|
||||||
|
"buttonCancel": "Cancelar",
|
||||||
|
"buttonStats": "Estadísticas",
|
||||||
|
"buttonCycleForm": "Cambiar forma",
|
||||||
|
"buttonCycleShiny": "Cambiar shiny",
|
||||||
|
"buttonCycleGender": "Cambiar género",
|
||||||
|
"buttonCycleAbility": "Cambiar habilidad",
|
||||||
|
"buttonCycleNature": "Cambiar naturaleza",
|
||||||
|
"buttonCycleVariant": "Cambiar variante",
|
||||||
|
"buttonSpeedUp": "Acelerar",
|
||||||
|
"buttonSlowDown": "Ralentizar",
|
||||||
|
"alt": " (Alt.)",
|
||||||
|
"mute": "Silenciar",
|
||||||
|
"controller": "Mando",
|
||||||
|
"gamepadSupport": "Soporte de mando",
|
||||||
|
"showBgmBar": "Mostrar título de canción",
|
||||||
|
"moveTouchControls": "Controles táctiles",
|
||||||
|
"shopOverlayOpacity": "Opacidad de la fase de compra",
|
||||||
|
"shopCursorTarget": "Cursor de la tienda",
|
||||||
|
"items": "Objetos",
|
||||||
|
"reroll": "Actualizar",
|
||||||
|
"shop": "Tienda",
|
||||||
|
"checkTeam": "Ver equipo"
|
||||||
}
|
}
|
||||||
|
@ -138,11 +138,17 @@
|
|||||||
"rood": "Rood",
|
"rood": "Rood",
|
||||||
"xerosic": "Xerosic",
|
"xerosic": "Xerosic",
|
||||||
"bryony": "Bryony",
|
"bryony": "Bryony",
|
||||||
|
"faba": "Faba",
|
||||||
|
"plumeria": "Plumeria",
|
||||||
|
"oleana": "Oleana",
|
||||||
"maxie": "Maxie",
|
"maxie": "Maxie",
|
||||||
"archie": "Archie",
|
"archie": "Archie",
|
||||||
"cyrus": "Cyrus",
|
"cyrus": "Cyrus",
|
||||||
"ghetsis": "Ghetsis",
|
"ghetsis": "Ghetsis",
|
||||||
"lysandre": "Lysandre",
|
"lysandre": "Lysandre",
|
||||||
|
"lusamine": "Lusamine",
|
||||||
|
"guzma": "Guzma",
|
||||||
|
"rose": "Rose",
|
||||||
"blue_red_double": "Blue & Red",
|
"blue_red_double": "Blue & Red",
|
||||||
"red_blue_double": "Red & Blue",
|
"red_blue_double": "Red & Blue",
|
||||||
"tate_liza_double": "Tate & Liza",
|
"tate_liza_double": "Tate & Liza",
|
||||||
|
@ -57,7 +57,7 @@ export class ModifierType {
|
|||||||
this.localeKey = localeKey!; // TODO: is this bang correct?
|
this.localeKey = localeKey!; // TODO: is this bang correct?
|
||||||
this.iconImage = iconImage!; // TODO: is this bang correct?
|
this.iconImage = iconImage!; // TODO: is this bang correct?
|
||||||
this.group = group!; // TODO: is this bang correct?
|
this.group = group!; // TODO: is this bang correct?
|
||||||
this.soundName = soundName ?? "restore";
|
this.soundName = soundName ?? "se/restore";
|
||||||
this.newModifierFunc = newModifierFunc;
|
this.newModifierFunc = newModifierFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ class AddPokeballModifierType extends ModifierType {
|
|||||||
private count: integer;
|
private count: integer;
|
||||||
|
|
||||||
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
||||||
super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "pb_bounce_1");
|
super("", iconImage, (_type, _args) => new Modifiers.AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
||||||
this.pokeballType = pokeballType;
|
this.pokeballType = pokeballType;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
}
|
}
|
||||||
@ -677,7 +677,7 @@ export class MoneyRewardModifierType extends ModifierType {
|
|||||||
private moneyMultiplierDescriptorKey: string;
|
private moneyMultiplierDescriptorKey: string;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, moneyMultiplier: number, moneyMultiplierDescriptorKey: string) {
|
constructor(localeKey: string, iconImage: string, moneyMultiplier: number, moneyMultiplierDescriptorKey: string) {
|
||||||
super(localeKey, iconImage, (_type, _args) => new Modifiers.MoneyRewardModifier(this, moneyMultiplier), "money", "buy");
|
super(localeKey, iconImage, (_type, _args) => new Modifiers.MoneyRewardModifier(this, moneyMultiplier), "money", "se/buy");
|
||||||
|
|
||||||
this.moneyMultiplier = moneyMultiplier;
|
this.moneyMultiplier = moneyMultiplier;
|
||||||
this.moneyMultiplierDescriptorKey = moneyMultiplierDescriptorKey;
|
this.moneyMultiplierDescriptorKey = moneyMultiplierDescriptorKey;
|
||||||
@ -1462,7 +1462,7 @@ export const modifierTypes = {
|
|||||||
VOUCHER_PLUS: () => new AddVoucherModifierType(VoucherType.PLUS, 1),
|
VOUCHER_PLUS: () => new AddVoucherModifierType(VoucherType.PLUS, 1),
|
||||||
VOUCHER_PREMIUM: () => new AddVoucherModifierType(VoucherType.PREMIUM, 1),
|
VOUCHER_PREMIUM: () => new AddVoucherModifierType(VoucherType.PREMIUM, 1),
|
||||||
|
|
||||||
GOLDEN_POKEBALL: () => new ModifierType("modifierType:ModifierType.GOLDEN_POKEBALL", "pb_gold", (type, _args) => new Modifiers.ExtraModifierModifier(type), undefined, "pb_bounce_1"),
|
GOLDEN_POKEBALL: () => new ModifierType("modifierType:ModifierType.GOLDEN_POKEBALL", "pb_gold", (type, _args) => new Modifiers.ExtraModifierModifier(type), undefined, "se/pb_bounce_1"),
|
||||||
|
|
||||||
ENEMY_DAMAGE_BOOSTER: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_BOOSTER", "wl_item_drop", (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 5)),
|
ENEMY_DAMAGE_BOOSTER: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_BOOSTER", "wl_item_drop", (type, _args) => new Modifiers.EnemyDamageBoosterModifier(type, 5)),
|
||||||
ENEMY_DAMAGE_REDUCTION: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_REDUCTION", "wl_guard_spec", (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 2.5)),
|
ENEMY_DAMAGE_REDUCTION: () => new ModifierType("modifierType:ModifierType.ENEMY_DAMAGE_REDUCTION", "wl_guard_spec", (type, _args) => new Modifiers.EnemyDamageReducerModifier(type, 2.5)),
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
import { clientSessionId } from "#app/account.js";
|
import { clientSessionId } from "#app/account";
|
||||||
import BattleScene from "#app/battle-scene.js";
|
import BattleScene from "#app/battle-scene";
|
||||||
import { BattleType } from "#app/battle.js";
|
import { BattleType } from "#app/battle";
|
||||||
import { miscDialogue, getCharVariantFromDialogue } from "#app/data/dialogue.js";
|
import { miscDialogue, getCharVariantFromDialogue } from "#app/data/dialogue";
|
||||||
import { pokemonEvolutions } from "#app/data/pokemon-evolutions.js";
|
import { pokemonEvolutions } from "#app/data/pokemon-evolutions";
|
||||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species.js";
|
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||||
import { trainerConfigs } from "#app/data/trainer-config.js";
|
import { trainerConfigs } from "#app/data/trainer-config";
|
||||||
import { PlayerGender } from "#app/enums/player-gender.js";
|
import { PlayerGender } from "#app/enums/player-gender";
|
||||||
import { TrainerType } from "#app/enums/trainer-type.js";
|
import { TrainerType } from "#app/enums/trainer-type";
|
||||||
import Pokemon from "#app/field/pokemon.js";
|
import Pokemon from "#app/field/pokemon";
|
||||||
import { modifierTypes } from "#app/modifier/modifier-type.js";
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
import { achvs, ChallengeAchv } from "#app/system/achv.js";
|
import { achvs, ChallengeAchv } from "#app/system/achv";
|
||||||
import { Unlockables } from "#app/system/unlockables.js";
|
import { Unlockables } from "#app/system/unlockables";
|
||||||
import { Mode } from "#app/ui/ui.js";
|
import { Mode } from "#app/ui/ui";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import * as Utils from "#app/utils.js";
|
import * as Utils from "#app/utils";
|
||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import { CheckSwitchPhase } from "./check-switch-phase";
|
import { CheckSwitchPhase } from "./check-switch-phase";
|
||||||
import { EncounterPhase } from "./encounter-phase";
|
import { EncounterPhase } from "./encounter-phase";
|
||||||
@ -23,6 +23,12 @@ import { SummonPhase } from "./summon-phase";
|
|||||||
import { EndCardPhase } from "./end-card-phase";
|
import { EndCardPhase } from "./end-card-phase";
|
||||||
import { PostGameOverPhase } from "./post-game-over-phase";
|
import { PostGameOverPhase } from "./post-game-over-phase";
|
||||||
import { UnlockPhase } from "./unlock-phase";
|
import { UnlockPhase } from "./unlock-phase";
|
||||||
|
import { SessionSaveData } from "../system/game-data";
|
||||||
|
import TrainerData from "../system/trainer-data";
|
||||||
|
import PokemonData from "../system/pokemon-data";
|
||||||
|
import PersistentModifierData from "../system/modifier-data";
|
||||||
|
import ChallengeData from "../system/challenge-data";
|
||||||
|
import ArenaData from "../system/arena-data";
|
||||||
|
|
||||||
export class GameOverPhase extends BattlePhase {
|
export class GameOverPhase extends BattlePhase {
|
||||||
private victory: boolean;
|
private victory: boolean;
|
||||||
@ -98,13 +104,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.scene.gameData.gameStats.dailyRunSessionsWon++;
|
this.scene.gameData.gameStats.dailyRunSessionsWon++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.scene.gameData.getSession(this.scene.sessionSlotId).then(sessionData => {
|
this.scene.gameData.saveRunHistory(this.scene, this.getFinalSessionData(), this.victory);
|
||||||
if (sessionData) {
|
|
||||||
this.scene.gameData.saveRunHistory(this.scene, sessionData, this.victory);
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.error("Failed to save run to history.", err);
|
|
||||||
});
|
|
||||||
const fadeDuration = this.victory ? 10000 : 5000;
|
const fadeDuration = this.victory ? 10000 : 5000;
|
||||||
this.scene.fadeOutBgm(fadeDuration, true);
|
this.scene.fadeOutBgm(fadeDuration, true);
|
||||||
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
const activeBattlers = this.scene.getField().filter(p => p?.isActive(true));
|
||||||
@ -207,4 +207,32 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.firstRibbons.push(getPokemonSpecies(pokemon.species.getRootSpeciesId(forStarter)));
|
this.firstRibbons.push(getPokemonSpecies(pokemon.species.getRootSpeciesId(forStarter)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function mirrors game-data.ts' getSessionSaveData() to update the session data to reflect any changes that occurred within the last wave
|
||||||
|
* This means that level ups, item usage, evolutions, etc. will all be accurately reflected.
|
||||||
|
* @returns {@linkCode SessionSaveData} an updated version of the wave's SessionSaveData that accurately reflects the events of the wave
|
||||||
|
*/
|
||||||
|
private getFinalSessionData(): SessionSaveData {
|
||||||
|
return {
|
||||||
|
seed: this.scene.seed,
|
||||||
|
playTime: this.scene.sessionPlayTime,
|
||||||
|
gameMode: this.scene.gameMode.modeId,
|
||||||
|
party: this.scene.getParty().map(p => new PokemonData(p)),
|
||||||
|
enemyParty: this.scene.getEnemyParty().map(p => new PokemonData(p)),
|
||||||
|
modifiers: this.scene.findModifiers(() => true).map(m => new PersistentModifierData(m, true)),
|
||||||
|
enemyModifiers: this.scene.findModifiers(() => true, false).map(m => new PersistentModifierData(m, false)),
|
||||||
|
arena: new ArenaData(this.scene.arena),
|
||||||
|
pokeballCounts: this.scene.pokeballCounts,
|
||||||
|
money: this.scene.money,
|
||||||
|
score: this.scene.score,
|
||||||
|
waveIndex: this.scene.currentBattle.waveIndex,
|
||||||
|
battleType: this.scene.currentBattle.battleType,
|
||||||
|
trainer: this.scene.currentBattle.battleType === BattleType.TRAINER ? new TrainerData(this.scene.currentBattle.trainer) : null,
|
||||||
|
gameVersion: this.scene.game.config.gameVersion,
|
||||||
|
timestamp: new Date().getTime(),
|
||||||
|
challenges: this.scene.gameMode.challenges.map(c => new ChallengeData(c))
|
||||||
|
} as SessionSaveData;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -635,13 +635,13 @@ export class GameData {
|
|||||||
async saveRunHistory(scene: BattleScene, runEntry : SessionSaveData, isVictory: boolean): Promise<boolean> {
|
async saveRunHistory(scene: BattleScene, runEntry : SessionSaveData, isVictory: boolean): Promise<boolean> {
|
||||||
const runHistoryData = await this.getRunHistoryData(scene);
|
const runHistoryData = await this.getRunHistoryData(scene);
|
||||||
// runHistoryData should always return run history or {} empty object
|
// runHistoryData should always return run history or {} empty object
|
||||||
const timestamps = Object.keys(runHistoryData);
|
let timestamps = Object.keys(runHistoryData).map(Number);
|
||||||
const timestampsNo = timestamps.map(Number);
|
|
||||||
|
|
||||||
// Arbitrary limit of 25 entries per user --> Can increase or decrease
|
// Arbitrary limit of 25 entries per user --> Can increase or decrease
|
||||||
while (timestamps.length >= RUN_HISTORY_LIMIT ) {
|
while (timestamps.length >= RUN_HISTORY_LIMIT ) {
|
||||||
const oldestTimestamp = Math.min.apply(Math, timestampsNo);
|
const oldestTimestamp = (Math.min.apply(Math, timestamps)).toString();
|
||||||
delete runHistoryData[oldestTimestamp];
|
delete runHistoryData[oldestTimestamp];
|
||||||
|
timestamps = Object.keys(runHistoryData).map(Number);
|
||||||
}
|
}
|
||||||
|
|
||||||
const timestamp = (runEntry.timestamp).toString();
|
const timestamp = (runEntry.timestamp).toString();
|
||||||
|
85
src/ui/admin-ui-handler.ts
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import BattleScene from "#app/battle-scene.js";
|
||||||
|
import { ModalConfig } from "./modal-ui-handler";
|
||||||
|
import { Mode } from "./ui";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||||
|
import { Button } from "#app/enums/buttons.js";
|
||||||
|
|
||||||
|
export default class AdminUiHandler extends FormModalUiHandler {
|
||||||
|
|
||||||
|
constructor(scene: BattleScene, mode: Mode | null = null) {
|
||||||
|
super(scene, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
setup(): void {
|
||||||
|
super.setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
getModalTitle(config?: ModalConfig): string {
|
||||||
|
return "Admin panel";
|
||||||
|
}
|
||||||
|
|
||||||
|
getFields(config?: ModalConfig): string[] {
|
||||||
|
return ["Username", "Discord ID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
getWidth(config?: ModalConfig): number {
|
||||||
|
return 160;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMargin(config?: ModalConfig): [number, number, number, number] {
|
||||||
|
return [0, 0, 48, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
getButtonLabels(config?: ModalConfig): string[] {
|
||||||
|
return ["Link account", "Cancel"];
|
||||||
|
}
|
||||||
|
|
||||||
|
processInput(button: Button): boolean {
|
||||||
|
if (button === Button.SUBMIT && this.submitAction) {
|
||||||
|
this.submitAction();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
show(args: any[]): boolean {
|
||||||
|
if (super.show(args)) {
|
||||||
|
const config = args[0] as ModalConfig;
|
||||||
|
const originalSubmitAction = this.submitAction;
|
||||||
|
this.submitAction = (_) => {
|
||||||
|
this.submitAction = originalSubmitAction;
|
||||||
|
this.scene.ui.setMode(Mode.LOADING, { buttonActions: [] });
|
||||||
|
const onFail = error => {
|
||||||
|
this.scene.ui.setMode(Mode.ADMIN, Object.assign(config, { errorMessage: error?.trim() }));
|
||||||
|
this.scene.ui.playError();
|
||||||
|
};
|
||||||
|
if (!this.inputs[0].text) {
|
||||||
|
return onFail("Username is required");
|
||||||
|
}
|
||||||
|
if (!this.inputs[1].text) {
|
||||||
|
return onFail("Discord Id is required");
|
||||||
|
}
|
||||||
|
Utils.apiPost("admin/account/discord-link", `username=${encodeURIComponent(this.inputs[0].text)}&discordId=${encodeURIComponent(this.inputs[1].text)}`, "application/x-www-form-urlencoded", true)
|
||||||
|
.then(response => {
|
||||||
|
if (!response.ok) {
|
||||||
|
return response.text();
|
||||||
|
}
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
this.scene.ui.setMode(Mode.ADMIN, config);
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
clear(): void {
|
||||||
|
super.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -60,7 +60,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
|
|||||||
const inputBg = addWindow(this.scene, 0, 0, 80, 16, false, false, 0, 0, WindowVariant.XTHIN);
|
const inputBg = addWindow(this.scene, 0, 0, 80, 16, false, false, 0, 0, WindowVariant.XTHIN);
|
||||||
|
|
||||||
const isPassword = field.includes(i18next.t("menu:password")) || field.includes(i18next.t("menu:confirmPassword"));
|
const isPassword = field.includes(i18next.t("menu:password")) || field.includes(i18next.t("menu:confirmPassword"));
|
||||||
const input = addTextInputObject(this.scene, 4, -2, 440, 116, TextStyle.TOOLTIP_CONTENT, { type: isPassword ? "password" : "text", maxLength: isPassword ? 64 : 16 });
|
const input = addTextInputObject(this.scene, 4, -2, 440, 116, TextStyle.TOOLTIP_CONTENT, { type: isPassword ? "password" : "text", maxLength: isPassword ? 64 : 18 });
|
||||||
input.setOrigin(0, 0);
|
input.setOrigin(0, 0);
|
||||||
|
|
||||||
inputContainer.add(inputBg);
|
inputContainer.add(inputBg);
|
||||||
|
@ -306,16 +306,34 @@ export default class MenuUiHandler extends MessageUiHandler {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
keepOpen: true
|
keepOpen: true
|
||||||
|
}];
|
||||||
|
if (!bypassLogin && loggedInUser?.hasAdminRole) {
|
||||||
|
communityOptions.push({
|
||||||
|
label: "Admin",
|
||||||
|
handler: () => {
|
||||||
|
ui.playSelect();
|
||||||
|
ui.setOverlayMode(Mode.ADMIN, {
|
||||||
|
buttonActions: [
|
||||||
|
() => {
|
||||||
|
ui.revertMode();
|
||||||
},
|
},
|
||||||
{
|
() => {
|
||||||
|
ui.revertMode();
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
keepOpen: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
communityOptions.push({
|
||||||
label: i18next.t("menuUiHandler:cancel"),
|
label: i18next.t("menuUiHandler:cancel"),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
this.scene.ui.revertMode();
|
this.scene.ui.revertMode();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
];
|
|
||||||
|
|
||||||
this.communityConfig = {
|
this.communityConfig = {
|
||||||
xOffset: 98,
|
xOffset: 98,
|
||||||
options: communityOptions
|
options: communityOptions
|
||||||
|
@ -5,7 +5,7 @@ import { Command } from "./command-ui-handler";
|
|||||||
import MessageUiHandler from "./message-ui-handler";
|
import MessageUiHandler from "./message-ui-handler";
|
||||||
import { Mode } from "./ui";
|
import { Mode } from "./ui";
|
||||||
import * as Utils from "../utils";
|
import * as Utils from "../utils";
|
||||||
import { PokemonBaseStatModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
import { PokemonFormChangeItemModifier, PokemonHeldItemModifier, SwitchEffectTransferModifier } from "../modifier/modifier";
|
||||||
import { allMoves, ForceSwitchOutAttr } from "../data/move";
|
import { allMoves, ForceSwitchOutAttr } from "../data/move";
|
||||||
import { getGenderColor, getGenderSymbol } from "../data/gender";
|
import { getGenderColor, getGenderSymbol } from "../data/gender";
|
||||||
import { StatusEffect } from "../data/status-effect";
|
import { StatusEffect } from "../data/status-effect";
|
||||||
@ -989,14 +989,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
optionText.setOrigin(0, 0);
|
optionText.setOrigin(0, 0);
|
||||||
|
|
||||||
/** For every item that has stack bigger than 1, display the current quantity selection */
|
/** For every item that has stack bigger than 1, display the current quantity selection */
|
||||||
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferQuantitiesMax[option] > 1) {
|
|
||||||
const itemModifier = itemModifiers[option];
|
const itemModifier = itemModifiers[option];
|
||||||
|
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferQuantitiesMax[option] > 1 && !this.transferMode && itemModifier !== undefined && itemModifier.type.name === optionName) {
|
||||||
/** Not sure why getMaxHeldItemCount had an error, but it only checks the Pokemon parameter if the modifier is PokemonBaseStatModifier */
|
|
||||||
if (itemModifier === undefined || itemModifier instanceof PokemonBaseStatModifier) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let amountText = ` (${this.transferQuantities[option]})`;
|
let amountText = ` (${this.transferQuantities[option]})`;
|
||||||
|
|
||||||
/** If the amount held is the maximum, display the count in red */
|
/** If the amount held is the maximum, display the count in red */
|
||||||
|
@ -46,6 +46,7 @@ import SettingsAudioUiHandler from "./settings/settings-audio-ui-handler";
|
|||||||
import { PlayerGender } from "#enums/player-gender";
|
import { PlayerGender } from "#enums/player-gender";
|
||||||
import BgmBar from "#app/ui/bgm-bar";
|
import BgmBar from "#app/ui/bgm-bar";
|
||||||
import RenameFormUiHandler from "./rename-form-ui-handler";
|
import RenameFormUiHandler from "./rename-form-ui-handler";
|
||||||
|
import AdminUiHandler from "./admin-ui-handler";
|
||||||
import RunHistoryUiHandler from "./run-history-ui-handler";
|
import RunHistoryUiHandler from "./run-history-ui-handler";
|
||||||
import RunInfoUiHandler from "./run-info-ui-handler";
|
import RunInfoUiHandler from "./run-info-ui-handler";
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ export enum Mode {
|
|||||||
OUTDATED,
|
OUTDATED,
|
||||||
CHALLENGE_SELECT,
|
CHALLENGE_SELECT,
|
||||||
RENAME_POKEMON,
|
RENAME_POKEMON,
|
||||||
|
ADMIN,
|
||||||
RUN_HISTORY,
|
RUN_HISTORY,
|
||||||
RUN_INFO,
|
RUN_INFO,
|
||||||
}
|
}
|
||||||
@ -124,7 +126,8 @@ const noTransitionModes = [
|
|||||||
Mode.SESSION_RELOAD,
|
Mode.SESSION_RELOAD,
|
||||||
Mode.UNAVAILABLE,
|
Mode.UNAVAILABLE,
|
||||||
Mode.OUTDATED,
|
Mode.OUTDATED,
|
||||||
Mode.RENAME_POKEMON
|
Mode.RENAME_POKEMON,
|
||||||
|
Mode.ADMIN,
|
||||||
];
|
];
|
||||||
|
|
||||||
export default class UI extends Phaser.GameObjects.Container {
|
export default class UI extends Phaser.GameObjects.Container {
|
||||||
@ -188,6 +191,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
|||||||
new RenameFormUiHandler(scene),
|
new RenameFormUiHandler(scene),
|
||||||
new RunHistoryUiHandler(scene),
|
new RunHistoryUiHandler(scene),
|
||||||
new RunInfoUiHandler(scene),
|
new RunInfoUiHandler(scene),
|
||||||
|
new AdminUiHandler(scene),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|