From 2f94dfe23e1f86de93dfa5bb3b52a0be123a8fb2 Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Sat, 16 Jun 2018 11:40:03 -0700 Subject: [PATCH] Add support for potential new Salmon Run special weapons Nintendo changed the way "random" weapons appear for Salmon Run. Previously, these were just listed as "null" values, but now they have a new "coop_special_weapon" key with an image and name. This change adds support for downloading images and localized names for these weapons just in case any special weapons appear here in the future. --- .../splatoon/SalmonRunDetailsBar.vue | 27 +++++++++++++------ src/updater/updaters/CoopSchedulesUpdater.js | 7 +++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/js/components/splatoon/SalmonRunDetailsBar.vue b/src/js/components/splatoon/SalmonRunDetailsBar.vue index 90308b0..6c2731f 100644 --- a/src/js/components/splatoon/SalmonRunDetailsBar.vue +++ b/src/js/components/splatoon/SalmonRunDetailsBar.vue @@ -8,15 +8,30 @@ {{ stageName }} -
+
{{ $t('coop.supplied_weapons') }}
-
+
- - + + + + +
@@ -36,10 +51,6 @@ export default { let stage = this.schedule.stage; return this.$t(`splatnet.coop_stages.${stage.image}.name`, stage.name); }, - weapons() { - if (this.schedule.weapons) - return this.schedule.weapons.map(w => w ? w.weapon : null); - }, }, } diff --git a/src/updater/updaters/CoopSchedulesUpdater.js b/src/updater/updaters/CoopSchedulesUpdater.js index ac1b1c8..3b34869 100644 --- a/src/updater/updaters/CoopSchedulesUpdater.js +++ b/src/updater/updaters/CoopSchedulesUpdater.js @@ -10,6 +10,7 @@ class CoopSchedulesUpdater extends Updater { imagePaths: [ '$..stage.image', '$..weapons[*].weapon.image', + '$..coop_special_weapon.image' ], localization: [ { @@ -18,6 +19,12 @@ class CoopSchedulesUpdater extends Updater { id: 'image', // Unfortunately these don't have an ID, so we'll just match them by image URL values: 'name', }, + { + name: 'coop_special_weapons', + entities: '$..coop_special_weapon', + id: 'image', // These don't have a name either + values: 'name', + }, { name: 'weapons', entities: '$..weapons[?(@.id)].weapon',