aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-14 12:03:01 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-14 12:03:01 -0600
commita12f0eaf3349160282bdc9f48cf9f253a154e500 (patch)
tree4d4ca3578c99ae802df0821bf8c0903799b59a9e
parentd3c4b954545eae9869f6347e1b6edc580210bfcd (diff)
downloadskyblock-api-a12f0eaf3349160282bdc9f48cf9f253a154e500.tar.gz
skyblock-api-a12f0eaf3349160282bdc9f48cf9f253a154e500.tar.bz2
skyblock-api-a12f0eaf3349160282bdc9f48cf9f253a154e500.zip
add visited zones
-rw-r--r--build/cleaners/skyblock/inventory.js5
-rw-r--r--build/cleaners/skyblock/member.js4
-rw-r--r--build/cleaners/skyblock/zones.js16
-rw-r--r--src/cleaners/skyblock/inventory.ts4
-rw-r--r--src/cleaners/skyblock/member.ts5
-rw-r--r--src/cleaners/skyblock/zones.ts18
6 files changed, 48 insertions, 4 deletions
diff --git a/build/cleaners/skyblock/inventory.js b/build/cleaners/skyblock/inventory.js
index 9daa717..c0c54ba 100644
--- a/build/cleaners/skyblock/inventory.js
+++ b/build/cleaners/skyblock/inventory.js
@@ -26,7 +26,10 @@ function base64decode(base64) {
}
function cleanItem(rawItem) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
- const vanillaId = rawItem.id;
+ // if the item doesn't have an id, it isn't an item
+ if (rawItem.id === undefined)
+ return null;
+ const vanillaId = rawItem.id && -1;
const itemCount = rawItem.Count;
const damageValue = rawItem.Damage;
const itemTag = rawItem.tag;
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js
index 39324de..bf1f908 100644
--- a/build/cleaners/skyblock/member.js
+++ b/build/cleaners/skyblock/member.js
@@ -27,6 +27,7 @@ const objectives_1 = require("./objectives");
const minions_1 = require("./minions");
const skills_1 = require("./skills");
const cached = __importStar(require("../../hypixelCached"));
+const zones_1 = require("./zones");
async function cleanSkyBlockProfileMemberResponseBasic(member, included = null) {
return {
uuid: member.uuid,
@@ -51,7 +52,8 @@ async function cleanSkyBlockProfileMemberResponse(member, included = null) {
fairy_souls: fairysouls_1.cleanFairySouls(member),
inventories: inventoriesIncluded ? await inventory_1.cleanInventories(member) : undefined,
objectives: objectives_1.cleanObjectives(member),
- skills: skills_1.cleanSkills(member)
+ skills: skills_1.cleanSkills(member),
+ visited_zones: zones_1.cleanVisitedZones(member)
};
}
exports.cleanSkyBlockProfileMemberResponse = cleanSkyBlockProfileMemberResponse;
diff --git a/build/cleaners/skyblock/zones.js b/build/cleaners/skyblock/zones.js
new file mode 100644
index 0000000..fb79441
--- /dev/null
+++ b/build/cleaners/skyblock/zones.js
@@ -0,0 +1,16 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cleanVisitedZones = void 0;
+function cleanVisitedZones(data) {
+ const rawZones = (data === null || data === void 0 ? void 0 : 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) {
+ zones.push({
+ name: rawZoneName,
+ visited: true
+ });
+ }
+ return zones;
+}
+exports.cleanVisitedZones = cleanVisitedZones;
diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts
index 1b49e95..96cd629 100644
--- a/src/cleaners/skyblock/inventory.ts
+++ b/src/cleaners/skyblock/inventory.ts
@@ -27,7 +27,9 @@ interface Item {
export type Inventory = Item[]
function cleanItem(rawItem): Item {
- const vanillaId: number = rawItem.id
+ // if the item doesn't have an id, it isn't an item
+ if (rawItem.id === undefined) return null
+ const vanillaId: number = rawItem.id && -1
const itemCount = rawItem.Count
const damageValue = rawItem.Damage
const itemTag = rawItem.tag
diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts
index 6796f7d..e7e6250 100644
--- a/src/cleaners/skyblock/member.ts
+++ b/src/cleaners/skyblock/member.ts
@@ -9,6 +9,7 @@ import { CleanFullProfile } from './profile'
import { Included } from '../../hypixel'
import { CleanPlayer } from '../player'
import { Bank } from './bank'
+import { cleanVisitedZones, Zone } from './zones'
export interface CleanBasicMember {
uuid: string
@@ -25,6 +26,7 @@ export interface CleanMember extends CleanBasicMember {
inventories: Inventories
objectives: Objective[]
skills: Skill[]
+ visited_zones: Zone[]
}
export async function cleanSkyBlockProfileMemberResponseBasic(member, included: Included[] = null): Promise<CleanBasicMember> {
@@ -53,7 +55,8 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu
fairy_souls: cleanFairySouls(member),
inventories: inventoriesIncluded ? await cleanInventories(member) : undefined,
objectives: cleanObjectives(member),
- skills: cleanSkills(member)
+ skills: cleanSkills(member),
+ visited_zones: cleanVisitedZones(member)
}
}
diff --git a/src/cleaners/skyblock/zones.ts b/src/cleaners/skyblock/zones.ts
new file mode 100644
index 0000000..87d008d
--- /dev/null
+++ b/src/cleaners/skyblock/zones.ts
@@ -0,0 +1,18 @@
+export interface Zone {
+ name: string
+ visited: boolean
+}
+
+
+export function cleanVisitedZones(data: any): Zone[] {
+ 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: Zone[] = []
+ for (const rawZoneName of rawZones) {
+ zones.push({
+ name: rawZoneName,
+ visited: true
+ })
+ }
+ return zones
+}