aboutsummaryrefslogtreecommitdiff
path: root/build/cleaners/skyblock/zones.js
diff options
context:
space:
mode:
Diffstat (limited to 'build/cleaners/skyblock/zones.js')
-rw-r--r--build/cleaners/skyblock/zones.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/build/cleaners/skyblock/zones.js b/build/cleaners/skyblock/zones.js
index ef7015e..90c689b 100644
--- a/build/cleaners/skyblock/zones.js
+++ b/build/cleaners/skyblock/zones.js
@@ -1,12 +1,23 @@
-export function cleanVisitedZones(data) {
+import * as constants from '../../constants.js';
+export async function cleanVisitedZones(data) {
const rawZones = data?.visited_zones || [];
// TODO: store all the zones that exist in SkyBlock, add add those to the array with visited being false
const zones = [];
- for (const rawZoneName of rawZones) {
+ const knownZones = await constants.fetchZones();
+ for (const rawZoneName of knownZones) {
zones.push({
name: rawZoneName,
- visited: true
+ visited: rawZones.includes(rawZoneName)
});
}
+ // if this user somehow has a zone that we don't know about, just add it to zones
+ for (const rawZoneName of rawZones) {
+ if (!knownZones.includes(rawZoneName)) {
+ zones.push({
+ name: rawZoneName,
+ visited: true
+ });
+ }
+ }
return zones;
}