diff options
author | mat <github@matdoes.dev> | 2022-03-19 19:56:16 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-03-19 19:56:16 -0500 |
commit | 4fd4e4fdbd444466fd22827327eb36da1219eb9f (patch) | |
tree | 6cbdb9d729037c35180ee614fbcb88755be853e4 /src/cleaners/skyblock | |
parent | 53ebb73fa06f6b41793757375dea40bff75bef7e (diff) | |
download | skyblock-api-4fd4e4fdbd444466fd22827327eb36da1219eb9f.tar.gz skyblock-api-4fd4e4fdbd444466fd22827327eb36da1219eb9f.tar.bz2 skyblock-api-4fd4e4fdbd444466fd22827327eb36da1219eb9f.zip |
Squashed commit of the following:
commit 8de482698ce3b144a5208084299733a3951d691a
Author: mat <github@matdoes.dev>
Date: Sat Mar 19 19:39:21 2022 -0500
fix some issues with the typings
commit e4d72e4b66c1f013dab495786041e7ce0316b0af
Author: mat <github@matdoes.dev>
Date: Sat Mar 19 18:04:10 2022 -0500
Fix error when there is no slayer data
commit 706d044f6791272f3f4488d03884c33fc545a806
Author: mat <github@matdoes.dev>
Date: Sat Mar 19 18:02:04 2022 -0500
Fix wrong interface
commit d1cc698f4add94171004ca7039a452d38fa063b8
Merge: b490254 8843ccf
Author: mat <github@matdoes.dev>
Date: Sat Mar 19 17:54:00 2022 -0500
Merge branch 'main' into breaking
commit b490254510b43ca9ef9822c661f3bfeb2e9ec7ef
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 13:09:26 2022 -0600
change some seconds to milliseconds
commit 09fc38f77faa88f7234f2496c7fd797b884cbf24
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 13:04:46 2022 -0600
Update README.md
commit a470363ea7e7885c5c946aca9b40f73426a0e94c
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 13:01:42 2022 -0600
Move `/leaderboard/` to `/leaderboards/`
commit 012525036db62fbb97a56576f80c231b4127736d
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 13:00:06 2022 -0600
Rename collection `xp` to `amount`
commit dc8ea0588ad5357257767b37737da185e4dbffd0
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 12:59:20 2022 -0600
Rename visited_zones to just zones
commit 6008feb15d36afd914efe98e90409327d3fc1322
Author: mat <github@matdoes.dev>
Date: Sat Mar 5 12:54:15 2022 -0600
Replace all snake_case keys with camelCase
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r-- | src/cleaners/skyblock/collections.ts | 4 | ||||
-rw-r--r-- | src/cleaners/skyblock/election.ts | 4 | ||||
-rw-r--r-- | src/cleaners/skyblock/inventory.ts | 8 | ||||
-rw-r--r-- | src/cleaners/skyblock/member.ts | 47 | ||||
-rw-r--r-- | src/cleaners/skyblock/profile.ts | 6 | ||||
-rw-r--r-- | src/cleaners/skyblock/slayers.ts | 4 |
6 files changed, 36 insertions, 37 deletions
diff --git a/src/cleaners/skyblock/collections.ts b/src/cleaners/skyblock/collections.ts index 363a6e0..7be5a9d 100644 --- a/src/cleaners/skyblock/collections.ts +++ b/src/cleaners/skyblock/collections.ts @@ -81,7 +81,7 @@ type CollectionCategory = keyof typeof COLLECTIONS export interface Collection { name: string - xp: number + amount: number level: number category: CollectionCategory } @@ -127,7 +127,7 @@ export function cleanCollections(data: any): Collection[] { if (collectionLevel !== undefined) playerCollections.push({ name: collectionName, - xp: collectionXp, + amount: collectionXp, level: collectionLevel, category: collectionCategory }) diff --git a/src/cleaners/skyblock/election.ts b/src/cleaners/skyblock/election.ts index 127fe96..a773f4a 100644 --- a/src/cleaners/skyblock/election.ts +++ b/src/cleaners/skyblock/election.ts @@ -15,7 +15,7 @@ export interface Candidate { } export interface ElectionData { - last_updated: number + lastUpdated: number previous: { year: number winner: string @@ -42,7 +42,7 @@ function cleanCandidate(data: any, index: number): Candidate { export function cleanElectionResponse(data: any): ElectionData { const previousCandidates = data.mayor.election.candidates.map(cleanCandidate) return { - last_updated: data.lastUpdated / 1000, + lastUpdated: data.lastUpdated, previous: { year: data.mayor.election.year, winner: data.mayor.name, diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts index 5ad6617..16c74fa 100644 --- a/src/cleaners/skyblock/inventory.ts +++ b/src/cleaners/skyblock/inventory.ts @@ -17,11 +17,11 @@ interface Item { } reforge?: string - anvil_uses?: number + anvilUses?: number timestamp?: string enchantments?: { [ name: string ]: number } - head_texture?: string + headTexture?: string } export type Inventory = Item[] @@ -63,10 +63,10 @@ function cleanItem(rawItem): Item | null { reforge: extraAttributes?.modifier, enchantments: extraAttributes?.enchantments, - anvil_uses: extraAttributes?.anvil_uses, + anvilUses: extraAttributes?.anvil_uses, timestamp: extraAttributes?.timestamp, - head_texture: headId, + headTexture: headId, } } diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts index 8d1fdf1..b90d0c4 100644 --- a/src/cleaners/skyblock/member.ts +++ b/src/cleaners/skyblock/member.ts @@ -19,21 +19,21 @@ import { Bank } from './bank.js' export interface CleanBasicMember { uuid: string username: string - last_save: number - first_join: number + lastSave: number + firstJoin: number rank: CleanRank } export interface CleanMember extends CleanBasicMember { purse: number stats: StatItem[] - rawHypixelStats?: { [key: string]: number } + rawHypixelStats: { [key: string]: number } minions: CleanMinion[] - fairy_souls: FairySouls + fairySouls: FairySouls inventories?: Inventories objectives: Objective[] skills: Skill[] - visited_zones: Zone[] + zones: Zone[] collections: Collection[] slayers: SlayerData } @@ -44,8 +44,8 @@ export async function cleanSkyBlockProfileMemberResponseBasic(member: any): Prom return { uuid: member.uuid, username: player.username, - last_save: member.last_save / 1000, - first_join: member.first_join / 1000, + lastSave: member.last_save, + firstJoin: member.first_join, rank: player.rank } } @@ -65,8 +65,8 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu return { uuid: member.uuid, username: player.username, - last_save: member.last_save / 1000, - first_join: member.first_join / 1000, + lastSave: member.last_save, + firstJoin: member.first_join, rank: player.rank, purse: member.coin_purse, @@ -77,11 +77,11 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu rawHypixelStats: member.stats ?? {}, minions: await cleanMinions(member), - fairy_souls: fairySouls, + fairySouls: fairySouls, inventories: inventoriesIncluded ? await cleanInventories(member) : undefined, objectives: cleanObjectives(member), skills: await cleanSkills(member), - visited_zones: await cleanVisitedZones(member), + zones: await cleanVisitedZones(member), collections: cleanCollections(member), slayers: cleanSlayers(member) } @@ -91,20 +91,19 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu export interface CleanMemberProfilePlayer extends CleanPlayer { // The profile name may be different for each player, so we put it here profileName: string - first_join: number - last_save: number - bank?: Bank - purse?: number - stats?: StatItem[] - rawHypixelStats?: { [key: string]: number } - minions?: CleanMinion[] - fairy_souls?: FairySouls + firstJoin: number + lastSave: number + purse: number + stats: StatItem[] + rawHypixelStats: { [key: string]: number } + minions: CleanMinion[] + fairySouls: FairySouls inventories?: Inventories - objectives?: Objective[] - skills?: Skill[] - visited_zones?: Zone[] - collections?: Collection[] - slayers?: SlayerData + objectives: Objective[] + skills: Skill[] + zones: Zone[] + collections: Collection[] + slayers: SlayerData } export interface CleanMemberProfile { diff --git a/src/cleaners/skyblock/profile.ts b/src/cleaners/skyblock/profile.ts index d5ddc61..a510563 100644 --- a/src/cleaners/skyblock/profile.ts +++ b/src/cleaners/skyblock/profile.ts @@ -12,7 +12,7 @@ export interface CleanFullProfile extends CleanProfile { members: CleanMember[] bank: Bank minions: CleanMinion[] - minion_count: number + minionCount: number maxUniqueMinions: number } @@ -20,7 +20,7 @@ export interface CleanFullProfileBasicMembers extends CleanProfile { members: CleanBasicMember[] bank: Bank minions: CleanMinion[] - minion_count: number + minionCount: number maxUniqueMinions: number } @@ -94,7 +94,7 @@ export async function cleanSkyblockProfileResponse(data: any, options?: ApiOptio members: cleanedMembers, bank: cleanBank(data), minions: minions, - minion_count: uniqueMinions, + minionCount: uniqueMinions, maxUniqueMinions: maxUniqueMinions ?? 0, } } diff --git a/src/cleaners/skyblock/slayers.ts b/src/cleaners/skyblock/slayers.ts index 4852160..f4d203e 100644 --- a/src/cleaners/skyblock/slayers.ts +++ b/src/cleaners/skyblock/slayers.ts @@ -16,7 +16,7 @@ interface SlayerTier { export interface Slayer { name?: SlayerName - raw_name: string + rawName: string xp: number level: number kills: number @@ -81,7 +81,7 @@ export function cleanSlayers(data: any): SlayerData { const slayer: Slayer = { name: slayerName, - raw_name: slayerNameRaw, + rawName: slayerNameRaw, tiers: slayerTiers, xp: slayerXp ?? 0, level: slayerLevel, |