diff --git a/src/api/reputations.js b/src/api/reputations.js index 2738becd..d937cbb7 100644 --- a/src/api/reputations.js +++ b/src/api/reputations.js @@ -44,7 +44,8 @@ function parseFactions(all_factions, my_reputations) { var calculatedPerc = (rep.standing.value / rep.standing.max) * 100; standing[rep.faction.id] = { - level: rep.standing.tier, + // tier is called renown_level for renown factions such as those in dragonflight + level: rep.standing.tier != undefined ? rep.standing.tier : rep.standing.renown_level, perc: (isNaN(calculatedPerc) ? 100 : calculatedPerc), value: rep.standing.value, max: rep.standing.max @@ -70,6 +71,11 @@ function parseFactions(all_factions, my_reputations) { levels: levelsAsList(faction.levels ? faction.levels : defaultLevels), }; + // If it's a faction with renown such as Dragonflight factions + if (faction.maxRenown) { + f.levels = maxRenownToLevels(faction.maxRenown); + } + var stand = standing[faction.id]; if (stand) { @@ -102,3 +108,11 @@ function levelsAsList(levelsDict) { } return items; } + +function maxRenownToLevels(maxRenown, step = 2500) { + var items = []; + for (i = 0; i <= maxRenown; i++) { + items.push([i * step, "Renown 0" + i]) + } + return items; +} diff --git a/static/data/factions.json b/static/data/factions.json index 21f073e1..1613c551 100644 --- a/static/data/factions.json +++ b/static/data/factions.json @@ -12,11 +12,13 @@ "factions": [ { "id": 2507, - "name": "Dragonscale Expedition" + "name": "Dragonscale Expedition", + "maxRenown": 25 }, { "id": 2511, - "name": "Iskaara Tuskarr" + "name": "Iskaara Tuskarr", + "maxRenown": 30 }, { "id": 2523,