Skip to content

Commit

Permalink
Add onyx shark 1.7.0 update (#513)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
KingDarBoja authored Jul 17, 2024
1 parent 1efe167 commit c1719fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
17 changes: 14 additions & 3 deletions config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand All @@ -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",
Expand Down Expand Up @@ -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<string, { dataTag: string; dataTime: string; patchTimeSeconds?: number }> =
{
"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)
Expand Down
14 changes: 10 additions & 4 deletions src/unitStats/mappingChallenges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit c1719fd

Please sign in to comment.