Move Salmon Run mystery weapon detection to the data store

This commit is contained in:
Matt Isenhower 2023-02-20 21:07:17 -08:00
parent a2ea3e8811
commit 260f70fa37
2 changed files with 8 additions and 11 deletions

View File

@ -19,14 +19,6 @@ export default class SalmonRunStatus extends StatusGenerator
return Date.parse(schedule.startTime);
}
_isGrizzcoMystery(schedule) {
return schedule.settings.weapons.some(w => w.__splatoon3ink_id === 'edcfecb7e8acd1a7')
}
_isMystery(schedule) {
return schedule.settings.weapons.some(w => w.name === 'Random');
}
async _getStatus() {
let schedule = await this.getActiveSchedule();
@ -34,9 +26,9 @@ export default class SalmonRunStatus extends StatusGenerator
let mode = schedule.isBigRun ? 'BIG RUN' : 'Salmon Run';
if (this._isGrizzcoMystery(schedule)) {
if (schedule.isGrizzcoMystery) {
lines.push(`${mode} is now open on ${schedule.settings.coopStage.name} with GRIZZCO MYSTERY WEAPONS! #salmonrun #splatoon3`);
} else if (this._isMystery(schedule)) {
} else if (schedule.isMystery) {
lines.push(`${mode} is now open on ${schedule.settings.coopStage.name} with MYSTERY WEAPONS! #salmonrun #splatoon3`);
} else {
lines.push(`${mode} is now open on ${schedule.settings.coopStage.name}! #salmonrun #splatoon3`);

View File

@ -84,7 +84,12 @@ export const useSalmonRunSchedulesStore = defineScheduleStore('salmonRun', {
let nodes = []
.concat(data?.coopGroupingSchedule.regularSchedules.nodes.map(n => ({ ...n, isBigRun: false })))
.concat(data?.coopGroupingSchedule.bigRunSchedules.nodes.map(n => ({ ...n, isBigRun: true })))
.filter(n => n);
.filter(n => n)
.map(n => ({
...n,
isMystery: n.setting.weapons.some(w => w.name === 'Random'),
isGrizzcoMystery: n.setting.weapons.some(w => w.__splatoon3ink_id === 'edcfecb7e8acd1a7'),
}));
return sortBy(nodes, 'startTime');
},