Skip to content

The Pit

The Pit module exposes a single parser, parsePit, which mirrors the raw stats.Pit block of the Hypixel player API field-for-field into readonly, fully-typed objects. Every value below is read straight from the raw JSON with no computation, no ratios, and no derived totals.

parsePit

Parses a player's Pit stats (stats.Pit) into a typed object.

ts
function parsePit(stats: Record<string, unknown>): PitStats | null;

Null / empty behavior

parsePit returns null when stats.Pit is absent, is not an object, or is an array. Otherwise it returns a fully-populated PitStats object. The top-level combat block is read from the raw pit_stats_ptl key and profile from the raw profile key. Missing fields are filled in by the safe readers used throughout the module:

  • Missing or non-number values become 0.
  • Missing or non-string values become "".
  • Boolean fields are true only when the raw value is exactly true, otherwise false.
  • Missing nested objects are treated as empty objects, so every nested block is still present and populated with the defaults above.
  • Array fields become empty arrays ([]) when absent; typed arrays are filtered to the matching primitive type, and object arrays keep only object entries.
  • contract is null when the raw contract is absent or not an object; issuer on a bounty is null when not a string.

The dynamic maps (leaderboardStats, itemsLastBuy, goldStackStreaks, xpStackStreaks, shopsThrottle, and each contract's requirements / progress) contain only the keys present in the raw data, so they may be empty objects when no data exists. Indexed array-style keys (for example selected_perk_0, selected_perk_1) are collected in numeric order.


Returned type tree

PitStats

The root object returned by parsePit.

ts
interface PitStats {
  readonly profile: PitProfile;
  readonly combat: PitCombatStats;
  readonly statsMove1: number;
  readonly packages: readonly string[];
}
FieldRaw sourceNotes
profilePit.profileParsed PitProfile block.
combatPit.pit_stats_ptlParsed PitCombatStats block.
statsMove1Pit.stats_move_1Raw numeric value.
packagesPit.packagesFiltered to string entries only; empty array when absent.

PitProfile

The main profile block, read from Pit.profile. Array-style indexed keys (for example selected_perk_0, selected_perk_1) are collected in numeric order into the corresponding arrays.

ts
interface PitProfile {
  readonly xp: number;
  readonly lastPassiveXp: number;
  readonly zeroPointTwoXp: number;
  readonly cash: number;
  readonly renown: number;
  readonly hatColor: number;
  readonly hatEnabled: boolean;
  readonly impatientEnabled: boolean;
  readonly nightQuestsEnabled: boolean;
  readonly supporterStarEnabled: boolean;
  readonly cheapMilk: boolean;
  readonly disableSpawnItems: boolean;
  readonly refundedGoldenPickaxe: boolean;
  readonly apolloEnabled: boolean;
  readonly dropConfirmDisabled: boolean;
  readonly hatGlintEnabled: boolean;
  readonly fishFishedToday: number;
  readonly lastFishFished: number;
  readonly lastLycanthropy: number;
  readonly reconessenceDay: number;
  readonly lastSave: number;
  readonly lastContract: number;
  readonly lastMidfightDisconnect: number;
  readonly zeroPointThreeGoldTransfer: boolean;
  readonly selectedLaunchTrail: string;
  readonly selectedLeaderboard: string;
  readonly selectedMegastreakExceptUber: string;
  readonly movedAchievements: readonly boolean[];
  readonly selectedPerks: readonly string[];
  readonly selectedKillstreaks: readonly string[];
  readonly cashDuringPrestige: readonly number[];
  readonly hotbarFavorites: readonly number[];
  readonly recentUberstreaks: readonly number[];
  readonly goldStackStreaks: Readonly<Record<string, number>>;
  readonly xpStackStreaks: Readonly<Record<string, number>>;
  readonly shopsThrottle: Readonly<Record<string, PitShopThrottle>>;
  readonly chatOptions: PitChatOptions;
  readonly genesis: PitGenesis;
  readonly kingQuest: PitKingQuest;
  readonly leaderboardStats: Readonly<Record<string, number>>;
  readonly itemsLastBuy: Readonly<Record<string, number>>;
  readonly prestiges: readonly PitPrestige[];
  readonly bounties: readonly PitBounty[];
  readonly goldTransactions: readonly PitGoldTransaction[];
  readonly contract: PitEndedContract | null;
  readonly endedContracts: readonly PitEndedContract[];
  readonly contractChoices: readonly unknown[];
  readonly outgoingOffers: readonly unknown[];
  readonly autobuyItems: readonly unknown[];
  readonly tradeTimestamps: readonly number[];
  readonly loginMessages: readonly string[];
  readonly unlocks: readonly PitUnlock[];
  readonly prestigeUnlocks: readonly (readonly PitUnlock[])[];
  readonly renownUnlocks: readonly PitUnlock[];
  readonly inventory: PitInventory;
  readonly armor: PitInventory;
  readonly enderChest: PitInventory;
  readonly itemStash: PitInventory;
  readonly mysticWellItem: PitInventory;
  readonly spireStash: PitInventory;
  readonly spireStashArmor: PitInventory;
  readonly deathRecaps: PitInventory;
}
FieldRaw sourceNotes
xpxpProfile XP.
lastPassiveXplast_passive_xp
zeroPointTwoXpzero_point_two_xp
cashcash
renownrenown
hatColorhat_color
hatEnabledhat_enabled
impatientEnabledimpatient_enabled
nightQuestsEnablednight_quests_enabled
supporterStarEnabledsupporter_star_enabled
cheapMilkcheap_milk
disableSpawnItemsdisable_spawn_items
refundedGoldenPickaxerefunded_golden_pickaxe
apolloEnabledapollo_enabled
dropConfirmDisableddrop_confirm_disabled
hatGlintEnabledhat_glint_enabled
fishFishedTodayfish_fished_today
lastFishFishedlast_fish_fished
lastLycanthropylast_lycanthropy
reconessenceDayreconessence_day
lastSavelast_save
lastContractlast_contract
lastMidfightDisconnectlast_midfight_disconnect
zeroPointThreeGoldTransferzero_point_three_gold_transfer
selectedLaunchTrailselected_launch_trail
selectedLeaderboardselected_leaderboard
selectedMegastreakExceptUberselected_megastreak_except_uber
movedAchievementsmoved_achievements_<n>Indexed boolean keys collected in numeric order.
selectedPerksselected_perk_<n>Indexed string keys collected in numeric order.
selectedKillstreaksselected_killstreak_<n>Indexed string keys collected in numeric order.
cashDuringPrestigecash_during_prestige_<n>Indexed number keys collected in numeric order.
hotbarFavoriteshotbar_favoritesFiltered to number entries.
recentUberstreaksrecent_uberstreaksFiltered to number entries.
goldStackStreaksgold_stack_streak_<n>Indexed numeric keys; <n> suffix → value map.
xpStackStreaksxp_stack_streak_<n>Indexed numeric keys; <n> suffix → value map.
shopsThrottleshops_throttlePitShopThrottle map; non-object entries dropped.
chatOptionschat_option_*Parsed PitChatOptions block.
genesisgenesis_*Parsed PitGenesis block.
kingQuestking_questParsed PitKingQuest block.
leaderboardStatsleaderboard_statsNumber-valued map; non-number values dropped.
itemsLastBuyitems_last_buyNumber-valued map; non-number values dropped.
prestigesprestigesArray of PitPrestige.
bountiesbountiesArray of PitBounty.
goldTransactionsgold_transactionsArray of PitGoldTransaction.
contractcontractActive contract as PitEndedContract, or null when absent / not an object.
endedContractsended_contractsArray of PitEndedContract.
contractChoicescontract_choicesPassed through unparsed; empty array when not an array.
outgoingOffersoutgoing_offersPassed through unparsed; empty array when not an array.
autobuyItemsautobuy_itemsPassed through unparsed; empty array when not an array.
tradeTimestampstrade_timestampsFiltered to number entries.
loginMessageslogin_messagesFiltered to string entries.
unlocksunlocksArray of PitUnlock.
prestigeUnlocksunlocks_<n>Each indexed key parsed into its own PitUnlock array, collected in numeric order.
renownUnlocksrenown_unlocksArray of PitUnlock.
inventoryinv_contentsParsed PitInventory.
armorinv_armorParsed PitInventory.
enderChestinv_enderchestParsed PitInventory.
itemStashitem_stashParsed PitInventory.
mysticWellItemmystic_well_itemParsed PitInventory.
spireStashspire_stash_invParsed PitInventory.
spireStashArmorspire_stash_armorParsed PitInventory.
deathRecapsdeath_recapsParsed PitInventory.

PitChatOptions

Booleans read from the chat_option_* keys of the profile.

ts
interface PitChatOptions {
  readonly bounties: boolean;
  readonly killFeed: boolean;
  readonly minorEvents: boolean;
  readonly misc: boolean;
  readonly playerChat: boolean;
  readonly prestigeAnnouncements: boolean;
  readonly streaks: boolean;
}
FieldRaw source
bountieschat_option_bounties
killFeedchat_option_kill_feed
minorEventschat_option_minor_events
miscchat_option_misc
playerChatchat_option_player_chat
prestigeAnnouncementschat_option_prestige_announcements
streakschat_option_streaks

PitGenesis

Values read from the genesis_* keys of the profile.

ts
interface PitGenesis {
  readonly allegiance: string;
  readonly allegianceTime: number;
  readonly permaAngel: number;
  readonly permaDemon: number;
  readonly points: number;
  readonly spawnInBase: boolean;
  readonly weeklyPerksClaimItemAngel: number;
  readonly weeklyPerksClaimItemDemon: number;
  readonly weeklyPerksPermaGold: number;
  readonly weeklyPerksPermaXp: number;
}
FieldRaw source
allegiancegenesis_allegiance
allegianceTimegenesis_allegiance_time
permaAngelgenesis_perma_angel
permaDemongenesis_perma_demon
pointsgenesis_points
spawnInBasegenesis_spawn_in_base
weeklyPerksClaimItemAngelgenesis_weekly_perks_claim_item_angel
weeklyPerksClaimItemDemongenesis_weekly_perks_claim_item_demon
weeklyPerksPermaGoldgenesis_weekly_perks_perma_gold
weeklyPerksPermaXpgenesis_weekly_perks_perma_xp

PitKingQuest

Read from the king_quest object of the profile.

ts
interface PitKingQuest {
  readonly kills: number;
  readonly renown: number;
  readonly lastCompleted: number;
  readonly lastAccepted: number;
}
FieldRaw source
killsking_quest.kills
renownking_quest.renown
lastCompletedking_quest.last_completed
lastAcceptedking_quest.last_accepted

PitShopThrottle

One entry per key in the profile's shops_throttle object.

ts
interface PitShopThrottle {
  readonly count: number;
  readonly lastEpochDay: number;
}
FieldRaw source
countcount
lastEpochDaylastEpochDay

PitPrestige

One entry per object in the prestiges array.

ts
interface PitPrestige {
  readonly index: number;
  readonly xpOnPrestige: number;
  readonly timestamp: number;
}
FieldRaw source
indexindex
xpOnPrestigexp_on_prestige
timestamptimestamp

PitBounty

One entry per object in the bounties array.

ts
interface PitBounty {
  readonly amount: number;
  readonly remainingTicks: number;
  readonly timestamp: number;
  readonly issuer: string | null;
}
FieldRaw sourceNotes
amountamount
remainingTicksremainingTicks
timestamptimestamp
issuerissuernull when the raw value is not a string.

PitGoldTransaction

One entry per object in the gold_transactions array.

ts
interface PitGoldTransaction {
  readonly amount: number;
  readonly timestamp: number;
}
FieldRaw source
amountamount
timestamptimestamp

PitEndedContract

Used both for each object in the ended_contracts array and for the active contract field.

ts
interface PitEndedContract {
  readonly difficulty: string;
  readonly goldReward: number;
  readonly chunkOfVilesReward: number;
  readonly requirements: Readonly<Record<string, number>>;
  readonly progress: Readonly<Record<string, number>>;
  readonly completionDate: number;
  readonly remainingTicks: number;
  readonly key: string;
}
FieldRaw sourceNotes
difficultydifficulty
goldRewardgold_reward
chunkOfVilesRewardchunk_of_viles_reward
requirementsrequirementsNumber-valued map; non-number values dropped.
progressprogressNumber-valued map; non-number values dropped.
completionDatecompletion_date
remainingTicksremaining_ticks
keykey

PitUnlock

One entry per object in an unlocks array (unlocks, renown_unlocks, and each indexed unlocks_<n>).

ts
interface PitUnlock {
  readonly tier: number;
  readonly acquireDate: number;
  readonly key: string;
}
FieldRaw source
tiertier
acquireDateacquireDate
keykey

PitInventory

A container with a numeric type and decoded NBT items. The raw data (a base64 string or a byte array) is decoded into NbtItem entries; a byte array is first converted to base64 before decoding.

ts
interface PitInventory {
  readonly type: number;
  readonly items: readonly NbtItem[];
}
FieldRaw sourceNotes
type<container>.type
items<container>.dataDecoded NBT items. NbtItem is defined in the NBT module.

PitCombatStats

Combat counters read from Pit.pit_stats_ptl. Every field is a raw numeric value defaulting to 0 when absent.

ts
interface PitCombatStats {
  readonly kills: number;
  readonly deaths: number;
  readonly assists: number;
  readonly maxStreak: number;
  readonly joins: number;
  readonly playtimeMinutes: number;
  readonly damageDealt: number;
  readonly damageReceived: number;
  readonly meleeDamageDealt: number;
  readonly meleeDamageReceived: number;
  readonly bowDamageDealt: number;
  readonly bowDamageReceived: number;
  readonly swordHits: number;
  readonly arrowHits: number;
  readonly arrowsFired: number;
  readonly leftClicks: number;
  readonly blocksPlaced: number;
  readonly blocksBroken: number;
  readonly obsidianBroken: number;
  readonly cashEarned: number;
  readonly goldFromFarming: number;
  readonly goldFromSellingFish: number;
  readonly chatMessages: number;
  readonly contractsStarted: number;
  readonly contractsCompleted: number;
  readonly diamondItemsPurchased: number;
  readonly enderchestOpened: number;
  readonly ingotsCash: number;
  readonly ingotsPickedUp: number;
  readonly jumpedIntoPit: number;
  readonly launchedByLaunchers: number;
  readonly launchedByAngelSpawn: number;
  readonly launchedByDemonSpawn: number;
  readonly nightQuestsCompleted: number;
  readonly kingQuestCompletion: number;
  readonly vampireHealedHp: number;
  readonly bountiesOf500gWithBh: number;
  readonly ramboKills: number;
  readonly darkPantsCrated: number;
  readonly darkPantsT2: number;
  readonly ragePantsCrafted: number;
  readonly ragePotatoesEaten: number;
  readonly enchantedTier1: number;
  readonly enchantedTier2: number;
  readonly enchantedTier3: number;
  readonly endlessQuiverArrows: number;
  readonly extraFromTrickleDown: number;
  readonly fishedAnything: number;
  readonly fishesFished: number;
  readonly fishingRodLaunched: number;
  readonly gappleEaten: number;
  readonly gheadEaten: number;
  readonly soupsDrank: number;
  readonly lavaBucketEmptied: number;
  readonly luckyDiamondPieces: number;
  readonly sewerTreasuresFound: number;
  readonly wheatFarmed: number;
  readonly hiddenJewelTriggers: number;
}
FieldRaw source
killskills
deathsdeaths
assistsassists
maxStreakmax_streak
joinsjoins
playtimeMinutesplaytime_minutes
damageDealtdamage_dealt
damageReceiveddamage_received
meleeDamageDealtmelee_damage_dealt
meleeDamageReceivedmelee_damage_received
bowDamageDealtbow_damage_dealt
bowDamageReceivedbow_damage_received
swordHitssword_hits
arrowHitsarrow_hits
arrowsFiredarrows_fired
leftClicksleft_clicks
blocksPlacedblocks_placed
blocksBrokenblocks_broken
obsidianBrokenobsidian_broken
cashEarnedcash_earned
goldFromFarminggold_from_farming
goldFromSellingFishgold_from_selling_fish
chatMessageschat_messages
contractsStartedcontracts_started
contractsCompletedcontracts_completed
diamondItemsPurchaseddiamond_items_purchased
enderchestOpenedenderchest_opened
ingotsCashingots_cash
ingotsPickedUpingots_picked_up
jumpedIntoPitjumped_into_pit
launchedByLauncherslaunched_by_launchers
launchedByAngelSpawnlaunched_by_angel_spawn
launchedByDemonSpawnlaunched_by_demon_spawn
nightQuestsCompletednight_quests_completed
kingQuestCompletionking_quest_completion
vampireHealedHpvampire_healed_hp
bountiesOf500gWithBhbounties_of_500g_with_bh
ramboKillsrambo_kills
darkPantsCrateddark_pants_crated
darkPantsT2dark_pants_t2
ragePantsCraftedrage_pants_crafted
ragePotatoesEatenrage_potatoes_eaten
enchantedTier1enchanted_tier1
enchantedTier2enchanted_tier2
enchantedTier3enchanted_tier3
endlessQuiverArrowsendless_quiver_arrows
extraFromTrickleDownextra_from_trickle_down
fishedAnythingfished_anything
fishesFishedfishes_fished
fishingRodLaunchedfishing_rod_launched
gappleEatengapple_eaten
gheadEatenghead_eaten
soupsDranksoups_drank
lavaBucketEmptiedlava_bucket_emptied
luckyDiamondPieceslucky_diamond_pieces
sewerTreasuresFoundsewer_treasures_found
wheatFarmedwheat_farmed
hiddenJewelTriggershidden_jewel_triggers

Released under the MIT License.