From c1719fdc1b7464dc913a2a63fb3e30b6d9bbfd67 Mon Sep 17 00:00:00 2001 From: Manuel Bojato <30560560+KingDarBoja@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:48:12 -0500 Subject: [PATCH] Add onyx shark 1.7.0 update (#513) * Add onyx shark 1.7.0 update * fix: mapping challenges will check if array is passed. The 1.7.0 update introduced few challenge changes which affected how the schema is read. --- config.ts | 17 ++++++++++++++--- src/unitStats/mappingChallenges.ts | 14 ++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/config.ts b/config.ts index 9eb6918a..b1e5f4d7 100644 --- a/config.ts +++ b/config.ts @@ -42,7 +42,7 @@ const getEdgioEnvName = (): string | null => { }; // This controls the default patch selector in the stats page // this needs to be key statsPatchSelector object -const defaultStatsPatchSelector = "1.6.10"; +const defaultStatsPatchSelector = "1.7.0"; // This controls the patch selector in the stats page const statsPatchSelector: Record< @@ -55,9 +55,16 @@ const statsPatchSelector: Record< group: string; } > = { + "1.7.0": { + from: "2024-07-16", + to: "now", + value: "1.7.0", + label: "1.7.0", + group: "Onyx Shark", + }, "1.6.10": { from: "2024-05-02", - to: "now", + to: "2024-07-15", value: "1.6.10", label: "1.6.5 - 1.6.10", group: "Coral Viper", @@ -159,11 +166,15 @@ const statsPatchSelector: Record< }; // Latest patch needs to be a key to patches object -const latestPatch = "1.6.10"; +const latestPatch = "1.7.0"; // Get patchTimeSeconds here https://www.unixtimestamp.com/ const patches: Record = { + "1.7.0": { + dataTag: "v1.7.0-1", + dataTime: "16/July/2024", + }, "1.6.10": { dataTag: "v1.6.6-1", // This is the tag of the data repo dataTime: "03/May/2024", // The date when was the data tag created (the data extracted from game) diff --git a/src/unitStats/mappingChallenges.ts b/src/unitStats/mappingChallenges.ts index f297e8a3..90123c12 100644 --- a/src/unitStats/mappingChallenges.ts +++ b/src/unitStats/mappingChallenges.ts @@ -72,10 +72,16 @@ const mapChallengeBag = (root: any, challenge: ChallengesType) => { /* --------- COUNTERS SECTION --------- */ for (const cItem of challengeBag.counters) { - const triggerRules = cItem.counter.trigger_rules; + const triggerRules = Array.isArray(cItem?.counter?.trigger_rules) + ? cItem.counter.trigger_rules + : []; for (const trRule of triggerRules) { - const ruleReqValues = trRule.rule.requirement.values; - const ruleReqReq = trRule.rule.requirement.requirements; + const ruleReqValues = Array.isArray(trRule.rule.requirement.values) + ? trRule.rule.requirement.values + : []; + const ruleReqReq = Array.isArray(trRule.rule.requirement.requirements) + ? trRule.rule.requirement.requirements + : []; for (const rrVal of ruleReqValues) { // Check the template reference value. @@ -155,7 +161,7 @@ const mapChallengeBag = (root: any, challenge: ChallengesType) => { const reqTempRef = rrReq.requirement.template_reference.value; switch (reqTempRef) { - case "challenges\\requirement": + case "challenges\\values_requirement": if (!rrReq.requirement.values.length) { continue; }