diff options
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r-- | src/cleaners/skyblock/accessoryBagUpgrades.ts | 52 | ||||
-rw-r--r-- | src/cleaners/skyblock/inventory.ts | 2 | ||||
-rw-r--r-- | src/cleaners/skyblock/member.ts | 4 |
3 files changed, 57 insertions, 1 deletions
diff --git a/src/cleaners/skyblock/accessoryBagUpgrades.ts b/src/cleaners/skyblock/accessoryBagUpgrades.ts new file mode 100644 index 0000000..1fcc682 --- /dev/null +++ b/src/cleaners/skyblock/accessoryBagUpgrades.ts @@ -0,0 +1,52 @@ +import typedHypixelApi from 'typed-hypixel-api' + +export interface AccessoryBagUpgrades { + tuningTemplates: Record<string, number>[] + upgrades: { + purchased: number + coinsSpent: number + extraSlots: number + } + powers: { + selected: string | null + list: string[] + } +} + +export function cleanAccessoryBagUpgrades(data: typedHypixelApi.SkyBlockProfileMember): AccessoryBagUpgrades { + const tuningTemplates: Record<string, number>[] = [] + if (data.accessory_bag_storage) + for (const [key, template] of Object.entries(data.accessory_bag_storage?.tuning)) { + if (key.startsWith('slot_')) + tuningTemplates.push(template as Record<string, number>) + } + + let upgradesPurchased = data.accessory_bag_storage?.bag_upgrades_purchased ?? 0 + let upgradesCoinsSpent = 0 + let upgradesExtraSlots = upgradesPurchased * 2 + for (let i = 1; i <= upgradesPurchased; i++) { + if (i == 1) + upgradesCoinsSpent += 1_500_000 + else if (i <= 5) + upgradesCoinsSpent += 5_000_000 + else if (i <= 10) + upgradesCoinsSpent += 8_000_000 + else if (i <= 20) + upgradesCoinsSpent += 12_000_000 + else + upgradesCoinsSpent += 20_000_000 + } + + return { + tuningTemplates, + upgrades: { + purchased: upgradesPurchased, + coinsSpent: upgradesCoinsSpent, + extraSlots: upgradesExtraSlots + }, + powers: { + selected: data.accessory_bag_storage?.selected_power ?? null, + list: data.accessory_bag_storage?.unlocked_powers ?? [] + } + } +} diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts index 6be87c8..447ebdd 100644 --- a/src/cleaners/skyblock/inventory.ts +++ b/src/cleaners/skyblock/inventory.ts @@ -94,7 +94,7 @@ export const INVENTORIES = { armor: 'inv_armor', inventory: 'inv_contents', ender_chest: 'ender_chest_contents', - talisman_bag: 'talisman_bag', + talisman_bag: 'accessory_bag', potion_bag: 'potion_bag', fishing_bag: 'fishing_bag', quiver: 'quiver', diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts index 6b2f452..f2526d2 100644 --- a/src/cleaners/skyblock/member.ts +++ b/src/cleaners/skyblock/member.ts @@ -19,6 +19,7 @@ import * as constants from '../../constants.js' import { Included } from '../../hypixel.js' import { CleanPlayer } from '../player.js' import { CleanRank } from '../rank.js' +import { AccessoryBagUpgrades, cleanAccessoryBagUpgrades } from './accessoryBagUpgrades.js' export interface CleanBasicMember { uuid: string @@ -45,6 +46,7 @@ export interface CleanMember extends CleanBasicMember { harp: HarpData coopInvitation: CoopInvitation | null farmingContests: FarmingContests + accessoryBagUpgrades: AccessoryBagUpgrades /** Whether the user left the coop */ left: boolean } @@ -110,6 +112,7 @@ export async function cleanSkyBlockProfileMemberResponse(member: typedHypixelApi harp: await harpPromise, coopInvitation: await coopInvitationPromise, farmingContests: await farmingContestsPromise, + accessoryBagUpgrades: cleanAccessoryBagUpgrades(member), left: (player.profiles?.find(profile => profile.uuid === profileId) === undefined) ?? false } @@ -136,6 +139,7 @@ export interface CleanMemberProfilePlayer extends CleanPlayer { harp: HarpData coopInvitation: CoopInvitation | null farmingContests: FarmingContests + accessoryBagUpgrades: AccessoryBagUpgrades left: boolean } |