diff --git a/src/logger.ts b/src/logger.ts index 6a9ab231abf..8d780b72d2d 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -413,6 +413,11 @@ export function generateEditOption(scene: BattleScene, i: integer, saves: any, p downloadLogByID(i) phase.callEnd() }, + () => { + scene.ui.playSelect(); + downloadLogByIDToSheet(i) + phase.callEnd() + },, () => { scene.ui.playSelect(); localStorage.removeItem(logs[i][1]) @@ -535,6 +540,18 @@ export function downloadLogByID(i: integer) { link.click(); link.remove(); } +export function downloadLogByIDToSheet(i: integer) { + console.log(i) + var d = JSON.parse(localStorage.getItem(logs[i][1])) + const blob = new Blob([ printDRPD("", "", d as DRPD).split("\n").join("CHAR(10)") ], {type: "text/json"}); + const link = document.createElement("a"); + link.href = window.URL.createObjectURL(blob); + var date: string = (d as DRPD).date + var filename: string = date[0] + date[1] + "_" + date[3] + date[4] + "_" + date[6] + date[7] + date[8] + date[9] + "_route.json" + link.download = `${filename}`; + link.click(); + link.remove(); +} /** * Calls `logPokemon` once for each opponent or, if it's a trainer battle, logs the trainer's data. * @param scene The BattleScene. Used to get the enemy team and whether it's a trainer battle or not. diff --git a/src/ui/log-name-form-ui-handler.ts b/src/ui/log-name-form-ui-handler.ts index d51adee3796..1b285f0cb40 100644 --- a/src/ui/log-name-form-ui-handler.ts +++ b/src/ui/log-name-form-ui-handler.ts @@ -24,7 +24,7 @@ export default class LogNameFormUiHandler extends FormModalUiHandler { } getButtonLabels(config?: ModalConfig): string[] { - return [ "Rename", "Export" ]; + return [ "Rename", "Export", "ExSheet", "Delete" ]; } getReadableErrorMessage(error: string): string {