aboutsummaryrefslogtreecommitdiff
path: root/build/cleaners/skyblock/zones.js
blob: 90c689bf290be0f8a6c8446fa366ccae911f6715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 = [];
    const knownZones = await constants.fetchZones();
    for (const rawZoneName of knownZones) {
        zones.push({
            name: rawZoneName,
            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;
}