Skip to content

Commit 8a21438

Browse files
committed
change: stop always redownloading quest phases, add new flag to force doing so
1 parent 73537d2 commit 8a21438

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ Data should always be retrieved with the provided utilities in [`./src/cache`](.
8080
- `--verbose`, `-v`: Show debug output
8181
- `--force-check`, `-f`: Force checking API for updated exports
8282
- `--reprocess`, `-r`: Don't check API and reprocess cached exports (disables `-f`!)
83+
- `--update-quests`,`-q`: Redownload all Quest Phases, even if cached files exist

src/cache/prepare-cache/processNiceWar.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { log } from "~/utils/logger";
44
import { freeQuestsCache, warsCache } from "..";
55
import { getBasicQuestPhase } from "./getBasicQuestPhase";
66

7-
// WIP
87
export async function processNiceWar(
98
niceWarJP: NiceWar[],
109
niceWarEN: NiceWar[],
1110
updateJP = false,
12-
updateEN = false
11+
updateEN = false,
12+
updateQuest = false
1313
) {
1414
const freeQuestList = new Array<FreeQuest>();
1515
const warsList = new Array<War>();
@@ -41,7 +41,7 @@ export async function processNiceWar(
4141
region,
4242
questJP.id,
4343
questJP.phases.length,
44-
region == "JP" ? updateJP : updateEN
44+
(region == "JP" ? updateJP : updateEN) && updateQuest
4545
);
4646

4747
const freeQuest: FreeQuest = {

src/cache/prepare-cache/script.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const { values: args } = parseArgs({
2020
/**
2121
* Reprocess data without checking for updates
2222
*/
23-
reprocess: { type: "boolean", short: "r", default: false }
23+
reprocess: { type: "boolean", short: "r", default: false },
24+
/**
25+
* Redownload all Quest Phases, even if cached files exist
26+
*/
27+
"update-quests": { type: "boolean", short: "q", default: false }
2428
}
2529
});
2630

@@ -99,7 +103,13 @@ async function main() {
99103
// perform data update
100104
await Promise.all([
101105
processNiceServant(niceServantJP, niceServantEN),
102-
processNiceWar(niceWarJP, niceWarEN, updateJP, updateEN)
106+
processNiceWar(
107+
niceWarJP,
108+
niceWarEN,
109+
updateJP,
110+
updateEN,
111+
args["update-quests"]
112+
)
103113
]);
104114
log.success("Wrote new data cache");
105115
}

0 commit comments

Comments
 (0)