Merge pull request #2429 from MartinFournier/fix/export-bonus

Fix export bonus not being applied when using options menu
This commit is contained in:
hydroflame
2022-01-08 12:43:28 -05:00
committed by GitHub
4 changed files with 14 additions and 7 deletions
+7 -2
View File
@@ -389,7 +389,11 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
<GameOptionsRoot
player={player}
save={() => saveObject.saveGame()}
export={() => saveObject.exportGame()}
export={() => {
// Apply the export bonus before saving the game
onExport(player);
saveObject.exportGame()
}}
forceKill={killAllScripts}
softReset={() => {
dialogBoxCreate("Soft Reset!");
@@ -400,8 +404,9 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
) : page === Page.Augmentations ? (
<AugmentationsRoot
exportGameFn={() => {
saveObject.exportGame();
// Apply the export bonus before saving the game
onExport(player);
saveObject.exportGame();
}}
installAugmentationsFn={() => {
installAugmentations();
+3 -5
View File
@@ -246,16 +246,14 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
return;
}
const data: ImportData = {
base64: contents,
parsed: parsedSave,
}
// We don't always seem to have this value in the save file. Exporting from the option menu does not set the bonus I think.
const exportTimestamp = parsedSave.data.LastExportBonus;
if (exportTimestamp && exportTimestamp !== '0') {
data.exportDate = new Date(parseInt(exportTimestamp, 10))
const timestamp = parsedSave.data.SaveTimestamp;
if (timestamp && timestamp !== '0') {
data.exportDate = new Date(parseInt(timestamp, 10))
}
setImportData(data)