Update DRPD

Change DRPD some more & start replacing daily run button
This commit is contained in:
RedstonewolfX 2024-07-09 16:12:32 -04:00
parent 2a7b787fd0
commit b0912a278c
2 changed files with 51 additions and 5 deletions

View File

@ -29,11 +29,12 @@ export var logKeys: string[] = [
export const DRPD_Version = "0.1.3" export const DRPD_Version = "0.1.3"
export interface DRPD { export interface DRPD {
version: string, version: string,
title: string, title?: string,
authors: string[], authors: string[],
date: string, date: string,
waves: Wave[], waves: Wave[],
starters: PokeData[] starters?: PokeData[],
filename: string
} }
export interface Wave { export interface Wave {
id: integer, id: integer,
@ -87,7 +88,8 @@ export function newDocument(name: string = "Untitled Run " + (new Date().getUTCM
authors: (Array.isArray(authorName) ? authorName : [authorName]), authors: (Array.isArray(authorName) ? authorName : [authorName]),
date: (new Date().getUTCMonth() + 1 < 10 ? "0" : "") + (new Date().getUTCMonth() + 1) + "-" + (new Date().getUTCDate() < 10 ? "0" : "") + new Date().getUTCDate() + "-" + new Date().getUTCFullYear(), date: (new Date().getUTCMonth() + 1 < 10 ? "0" : "") + (new Date().getUTCMonth() + 1) + "-" + (new Date().getUTCDate() < 10 ? "0" : "") + new Date().getUTCDate() + "-" + new Date().getUTCFullYear(),
waves: new Array(50), waves: new Array(50),
starters: new Array(3) starters: new Array(3),
filename: (new Date().getUTCMonth() + 1 < 10 ? "0" : "") + (new Date().getUTCMonth() + 1) + "-" + (new Date().getUTCDate() < 10 ? "0" : "") + new Date().getUTCDate() + "-" + new Date().getUTCFullYear() + "_untitled"
} }
} }
export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeData { export function exportPokemon(pokemon: Pokemon, encounterRarity?: string): PokeData {

View File

@ -73,6 +73,7 @@ import { Challenges } from "./enums/challenges"
import PokemonData from "./system/pokemon-data" import PokemonData from "./system/pokemon-data"
import * as LoggerTools from "./logger" import * as LoggerTools from "./logger"
import { getNatureName } from "./data/nature"; import { getNatureName } from "./data/nature";
import { GameDataType } from "./enums/game-data-type";
const { t } = i18next; const { t } = i18next;
@ -554,7 +555,7 @@ export class TitlePhase extends Phase {
options.push({ options.push({
label: i18next.t("menu:dailyRun"), label: i18next.t("menu:dailyRun"),
handler: () => { handler: () => {
this.initDailyRun(); this.setupDaily();
return true; return true;
}, },
keepOpen: true keepOpen: true
@ -659,7 +660,50 @@ export class TitlePhase extends Phase {
} }
}); });
} }
setupDaily(): void {
// TODO
var saves = this.getSaves()
var saveNames = new Array(5).fill("")
for (var i = 0; i < saves.length; i++) {
saveNames[saves[i][0]] = saves[i][1].description
}
const ui = this.scene.ui
const confirmSlot = (message: string, slotFilter: (i: integer) => boolean, callback: (i: integer) => void) => {
ui.revertMode();
ui.showText(message, null, () => {
const config: OptionSelectConfig = {
options: new Array(5).fill(null).map((_, i) => i).filter(slotFilter).map(i => {
return {
label: (i+1) + " " + saveNames[i],
handler: () => {
callback(i);
ui.revertMode();
ui.showText(null, 0);
return true;
}
};
}).concat([{
label: i18next.t("menuUiHandler:cancel"),
handler: () => {
ui.revertMode();
ui.showText(null, 0);
return true;
}
}]),
xOffset: 98
};
ui.setOverlayMode(Mode.MENU_OPTION_SELECT, config);
});
};
ui.showText("This feature is incomplete.", null, () => {
this.scene.clearPhaseQueue();
this.scene.pushPhase(new TitlePhase(this.scene));
super.end();
return true;
})
return;
confirmSlot("Select a slot to replace.", () => true, slotId => this.scene.gameData.importData(GameDataType.SESSION, slotId));
}
end(): void { end(): void {
if (!this.loaded && !this.scene.gameMode.isDaily) { if (!this.loaded && !this.scene.gameMode.isDaily) {
this.scene.arena.preloadBgm(); this.scene.arena.preloadBgm();