aboutsummaryrefslogtreecommitdiff
path: root/src/lib/APITypes.d.ts
blob: 64027212014b4eec25caac6a17142c2008545c67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
import type typedHypixelApi from 'typed-hypixel-api'


export interface CleanMemberProfile {
	member: CleanMemberProfilePlayer
	profile: CleanFullProfileBasicMembers
	customization?: AccountCustomization
}

export interface CleanMemberProfilePlayer extends CleanPlayer {
	profileName: string
	firstJoin: number | null
	lastSave: number | null
	purse: number
	stats: StatItem[]
	rawHypixelStats: { [key: string]: number }
	minions: CleanMinion[]
	fairySouls: FairySouls
	inventories?: Inventories
	objectives: Objective[]
	skills: Skills
	zones: Zone[]
	collections: Collection[]
	slayers: SlayerData
	pets: PetsData
	harp: HarpData
	coopInvitation: CoopInvitation | null
	farmingContests: FarmingContests
	accessoryBagUpgrades: AccessoryBagUpgrades
	left: boolean
}

export interface CleanMember extends CleanBasicMember {
	purse: number
	stats: StatItem[]
	rawHypixelStats: {
		[key: string]: number
	}
	minions: CleanMinion[]
	fairySouls: FairySouls
	inventories?: Inventories
	objectives: Objective[]
	skills: Skills
	zones: Zone[]
	collections: Collection[]
	slayers: SlayerData
	/** Whether the user left the coop */
	left: boolean
}


export interface CleanBasicPlayer {
	uuid: string
	username: string
}

export interface CleanPlayer extends CleanBasicPlayer {
	rank: CleanRank
	socials: CleanSocialMedia
	profiles?: CleanBasicProfile[]
	claimed?: ClaimedSkyBlockItem[]
}

export interface StatItem {
	rawName: string
	value: number
	categorizedName: string
	category: string | null
	unit: string | null
}

interface Item {
	id: string
	count: number
	vanillaId: string
	display: {
		name: string
		lore: string[]
		glint: boolean
	}
	reforge?: string
	anvilUses?: number
	timestamp?: string
	enchantments?: {
		[name: string]: number
	}
	headTexture?: string
}
export declare type Inventory = Item[]
export declare const INVENTORIES: {
	armor: string
	inventory: string
	ender_chest: string
	accessory_bag: string
	potion_bag: string
	fishing_bag: string
	quiver: string
	trick_or_treat_bag: string
	wardrobe: string,
	personal_vault: string
}
export declare type Inventories = {
	[name in keyof typeof INVENTORIES]: Item[]
}

export interface CleanUser {
	player: CleanPlayer | null
	profiles?: CleanProfile[]
	activeProfile?: string
	online?: boolean
	customization?: AccountCustomization
}

export interface CleanProfile extends CleanBasicProfile {
	members: CleanBasicMember[]
	mode: GameMode
}

/** A basic profile that only includes the profile uuid and name */
export interface CleanBasicProfile {
	uuid: string
	name?: string
}

export interface AccountCustomization {
	backgroundUrl?: string
	pack?: string
	blurBackground?: boolean
	emoji?: string
}

export interface CleanMinion {
	name: string
	levels: boolean[]
}

export interface CleanProfile extends CleanBasicProfile {
	members?: CleanBasicMember[]
}
export interface CleanFullProfile extends CleanProfile {
	members: CleanMember[]
	bank: Bank
	minions: CleanMinion[]
	minionCount: number
	maxUniqueMinions: number
}
export interface CleanFullProfileBasicMembers extends CleanProfile {
	members: CleanBasicMember[]
	bank: Bank
	minions: CleanMinion[]
	minionCount: number
	maxUniqueMinions: number
}

declare const COLLECTIONS: {
	readonly farming: readonly ["wheat", "carrot", "potato", "pumpkin", "melon_slice", "wheat_seeds", "red_mushroom", "cocoa_beans", "cactus", "sugar_cane", "feather", "leather", "porkchop", "chicken", "mutton", "rabbit", "nether_wart"]
	readonly mining: readonly ["cobblestone", "coal", "iron_ingot", "gold_ingot", "diamond", "lapis_lazuli", "emerald", "redstone", "quartz", "obsidian", "glowstone_dust", "gravel", "ice", "netherrack", "sand", "end_stone", "mithril_ore", "gemstone", "hard_stone"]
	readonly combat: readonly ["rotten_flesh", "bone", "string", "spider_eye", "gunpowder", "ender_pearl", "ghast_tear", "slime_ball", "blaze_rod", "magma_cream"]
	readonly foraging: readonly ["oak_log", "spruce_log", "birch_log", "jungle_log", "acacia_log", "dark_oak_log"]
	readonly fishing: readonly ["cod", "salmon", "tropical_fish", "pufferfish", "prismarine_shard", "prismarine_crystals", "clay_ball", "lily_pad", "ink_sac", "sponge"]
	readonly unknown: readonly []
}
declare type CollectionCategory = keyof typeof COLLECTIONS
export interface Collection {
	name: string
	amount: number
	level: number
	category: CollectionCategory
}

export interface MayorPerk {
	name: string
	description: string
}

export interface Candidate {
	name: string
	perks: MayorPerk[]
	votes: number
	color: string | null
}

export interface ElectionData {
	lastUpdated: number
	previous: {
		year: number
		winner: string
		candidates: Candidate[]
	}
	current: {
		year: number
		candidates: Candidate[]
	} | null
}

interface SessionSchema {
	_id?: string
	refresh_token: string
	discord_user: {
		id: string
		name: string
	}
	lastUpdated: Date
}

export interface AccountCustomization {
	backgroundUrl?: string
	pack?: string
	emoji?: string
}

export interface AccountSchema {
	_id?: string
	discordId: string
	minecraftUuid?: string
	customization?: AccountCustomization
}

export interface CleanSocialMedia {
	discord: string | null
	forums: string | null
}

export interface SlayerData {
	xp: number
	kills: number
	bosses: Slayer[]
}

interface SlayerTier {
	tier: number
	kills: number
}

export interface Slayer {
	name?: SlayerName
	rawName: string
	xp: number
	level: number
	kills: number
	tiers: SlayerTier[]
}

export interface CleanBasicMember {
	uuid: string
	username: string
	lastSave: number
	firstJoin: number
	rank: CleanRank
	left?: boolean
}

export interface Bank {
	balance?: number
	history: BankHistoryItem[]
}
export interface BankHistoryItem {
	change: number
	total: number
	timestamp: number
	name: string
}


export interface HarpSong {
	id: string
	/** A number between 0 and 1 representing the user's best completion */
	progress: number
	completions: number
	perfectCompletions: number
}

export interface HarpData {
	selected: {
		id: string
		timestamp: number
	} | null
	claimedMelodysHair: boolean
	songs: HarpSong[]
}

export interface ClaimedSkyBlockItem {
	name: string
	id: string
	timestamp: number
}

export interface Pet {
	id: string
	xp: number
	level: number
	tier: typedHypixelApi.Pet['tier']
	skin: string | null
	item: ItemListItem | null
}
export interface PetsData {
	active: Pet | null
	list: Pet[]
	missingIds: string[]
}

export interface ItemRequirement {
	dungeon?: {
		type: string
		level: number
	}
	skill?: {
		type: string
		level: number
	}
	slayer?: {
		boss: string
		level: number
	}
}

export interface ItemListItem {
	id: string
	headTexture?: string
	vanillaId: string
	tier: string | null
	display: {
		name: string
		glint: boolean
	}
	npcSellPrice: number | null
	requirements: ItemRequirement
	category: string | null
	soulbound: boolean
	museum: boolean
}

export interface ItemListData {
	lastUpdated: number
	list: ItemListItem[]
}

export interface PlayerFarmingContestStats {
	year: number
	month: number
	day: number
	crops: {
		item: string
		amount: number
		/** The position (1-indexed) that the user got on the contest. */
		position: number | null
		/** Whether the player has claimed their rewards. */
		claimed: boolean | null
		/**
		 * The number of people who participated in this contest.
		 */
		participants: number | null
	}[]
}
export interface FarmingContests {
	talkedToJacob: boolean
	list: PlayerFarmingContestStats[]
}

export interface CoopInvitation {
	invitedTimestamp: number
	invitedBy: CleanPlayer | null
	accepted: boolean
	acceptedTimestamp: number | null
}

export type GameMode = 'normal' | 'stranded' | 'bingo' | 'ironman'

export interface MemberLeaderboard {
	name: string
	unit: string | null
	list: MemberLeaderboardItem[]
	info?: string
}

export interface ProfileLeaderboard {
	name: string
	unit: string | null
	list: ProfileLeaderboardItem[]
	info?: string
}

export interface MemberLeaderboardItem {
	player: LeaderboardBasicPlayer
	profileUuid: string
	value: number
}
export interface ProfileLeaderboardItem {
	players: LeaderboardBasicPlayer[]
	profileUuid: string
	value: number
}

export interface LeaderboardBasicPlayer {
	uuid: string
	username: string
	rank: {
		color: string
	}
}


export interface Skill {
	id: string
	xp: number
	level: number

	maxLevel: number

	levelXp: number
	levelXpRequired: number
}

export interface Skills {
	list: Skill[]
	/**
	 * Whether the player has their skills API enabled. If this is off, that
	 * means the data doesn't include xp and is per-player. You should show a
	 * warning to the user.
	 */
	apiEnabled: boolean
}


export interface AccessoryBagUpgrades {
	tuningTemplates: Record<string, number>[]
	upgrades: {
		purchased: number
		coinsSpent: number
		extraSlots: number
	}
	powers: {
		selected: string | null
		list: string[]
	}
}