Skip to content

Arena Brawl

The Arena Brawl module exposes a single parser, parseArenaBrawl, which mirrors the raw stats.Arena 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.

parseArenaBrawl

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

ts
function parseArenaBrawl(
  stats: Record<string, unknown>,
): ArenaBrawlStats | null;

Null / empty behavior

parseArenaBrawl returns null when stats.Arena is missing or is not a plain object (i.e. it is absent, null, or an array). Otherwise it always returns a fully-populated ArenaBrawlStats object 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.
  • coins reads coins, falling back to tokens when coins is 0/absent.
  • packages becomes an empty array ([]) when absent or not an array, keeping only string entries.
  • The dynamic maps (runes, datedRatings) contain only the keys discovered in the raw data, so they may be empty objects when no matching keys exist.

Returned type tree

ArenaBrawlStats

The root object returned by parseArenaBrawl.

ts
interface ArenaBrawlStats {
  readonly coins: number;
  readonly coinsSpent: number;
  readonly wins: number;
  readonly keys: number;
  readonly chests: number;
  readonly rating: number;
  readonly penalty: number;
  readonly chestOpens: number;
  readonly damageError: number;
  readonly damageTakenError: number;
  readonly healError: number;
  readonly combatTracker: boolean;
  readonly hat: string;
  readonly selectedSword: string;
  readonly activeRune: string;
  readonly activeKillEffect: string;
  readonly activeMeleeTrail: string;
  readonly prefixColor: string;
  readonly shortenedPrefix: boolean;
  readonly showWinPrefix: boolean;
  readonly pregameArmor: boolean;
  readonly packages: readonly string[];
  readonly runes: Readonly<Record<string, number>>;
  readonly datedRatings: Readonly<Record<string, ArenaBrawlDatedRating>>;
  readonly upgrades: ArenaBrawlUpgradeLevels;
  readonly abilities: ArenaBrawlAbilities;
  readonly classes: ArenaBrawlClasses;
  readonly modes: Readonly<Record<ArenaBrawlModeId, ArenaBrawlModeStats>>;
}
FieldTypeRaw source / notes
coinsnumberReads coins, falling back to tokens when coins is 0/absent.
coinsSpentnumbercoins_spent
winsnumberwins
keysnumberkeys
chestsnumbermagical_chest
ratingnumberrating
penaltynumberpenalty
chestOpensnumberchest_opens
damageErrornumberdamage_error
damageTakenErrornumberdamage_taken_error
healErrornumberheal_error
combatTrackerbooleancombatTracker
hatstringhat
selectedSwordstringselected_sword
activeRunestringactive_rune
activeKillEffectstringactive_kill_effect
activeMeleeTrailstringactive_melee_trail
prefixColorstringprefix_color
shortenedPrefixbooleanshortened_prefix
showWinPrefixbooleanshow_win_prefix
pregameArmorbooleanpregame_armor
packagesreadonly string[]packages array, filtered to string entries; empty array when absent or not an array.
runesReadonly<Record<string, number>>All numeric keys prefixed with rune_, with the prefix stripped from the key.
datedRatingsReadonly<Record<string, ArenaBrawlDatedRating>>Keyed by date string, built from Arena_arena_rating_<date>_rating and _position keys.
upgradesArenaBrawlUpgradeLevelsSee below.
abilitiesArenaBrawlAbilitiesSee below.
classesArenaBrawlClassesSee below.
modesReadonly<Record<ArenaBrawlModeId, ArenaBrawlModeStats>>Per-mode stats keyed by mode id.

ArenaBrawlModeId

The mode keys present in modes are a fixed set. This type is internal (not exported); modes always contains an entry for each of the four ids.

ts
type ArenaBrawlModeId = "ffa" | "1v1" | "2v2" | "4v4";

ArenaBrawlModeStats

Per-mode stats, where each field reads the raw key suffixed with the mode id (for example damage_1v1, win_streaks_2v2).

ts
interface ArenaBrawlModeStats {
  readonly damage: number;
  readonly kills: number;
  readonly deaths: number;
  readonly healed: number;
  readonly wins: number;
  readonly losses: number;
  readonly games: number;
  readonly winStreak: number;
}
FieldRaw source
damagedamage_<mode>
killskills_<mode>
deathsdeaths_<mode>
healedhealed_<mode>
winswins_<mode>
losseslosses_<mode>
gamesgames_<mode>
winStreakwin_streaks_<mode>

ArenaBrawlUpgradeLevels

Upgrade levels, read from lvl_* keys.

ts
interface ArenaBrawlUpgradeLevels {
  readonly cooldown: number;
  readonly damage: number;
  readonly energy: number;
  readonly health: number;
}
FieldRaw source
cooldownlvl_cooldown
damagelvl_damage
energylvl_energy
healthlvl_health

ArenaBrawlAbilities

Selected ability slots, read directly from their named keys.

ts
interface ArenaBrawlAbilities {
  readonly offensive: string;
  readonly support: string;
  readonly utility: string;
  readonly ultimate: string;
}
FieldRaw source
offensiveoffensive
supportsupport
utilityutility
ultimateultimate

ArenaBrawlClasses

Per-class loadout configuration.

ts
interface ArenaBrawlClasses {
  readonly mage: ArenaBrawlMageClass;
  readonly paladin: ArenaBrawlPaladinClass;
  readonly warrior: ArenaBrawlWarriorClass;
}

ArenaBrawlMageClass

ts
interface ArenaBrawlMageClass {
  readonly spec: string;
  readonly skill1: string;
  readonly skill2: string;
  readonly skill3: string;
  readonly skill4: string;
}
FieldRaw source
specmage_spec
skill1mage_skill1
skill2mage_skill2
skill3mage_skill3
skill4mage_skill4

ArenaBrawlPaladinClass

ts
interface ArenaBrawlPaladinClass {
  readonly spec: string;
  readonly cooldown: string;
  readonly critChance: string;
  readonly critMultiplier: string;
  readonly energy: string;
  readonly health: string;
}
FieldRaw source
specpaladin_spec
cooldownpaladin_cooldown
critChancepaladin_critchance
critMultiplierpaladin_critmultiplier
energypaladin_energy
healthpaladin_health

ArenaBrawlWarriorClass

ts
interface ArenaBrawlWarriorClass {
  readonly spec: string;
}
FieldRaw source
specwarrior_spec

ArenaBrawlDatedRating

A single dated rating snapshot, keyed by date within datedRatings.

ts
interface ArenaBrawlDatedRating {
  readonly rating: number;
  readonly position: number;
}
FieldRaw source
ratingArena_arena_rating_<date>_rating
positionArena_arena_rating_<date>_position

Each entry defaults missing rating or position to 0. The datedRatings map is empty when no matching keys are present.

Released under the MIT License.