Skip to content

Smash Heroes

The Smash Heroes module exposes a single parser, parseSmashHeroes, which mirrors the raw stats.SuperSmash 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.

parseSmashHeroes

Parses a player's Smash Heroes stats (stats.SuperSmash) into a typed object.

ts
function parseSmashHeroes(
  stats: Record<string, unknown>,
): SmashHeroesStats | null;

Null / empty behavior

parseSmashHeroes returns null when stats is not an object, is null, or is an empty object. Otherwise it returns a fully-populated SmashHeroesStats object built with 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.
  • Date | null fields are null when the raw value is absent or not a positive epoch-ms number.
  • Missing nested objects are treated as empty objects, so every nested block is still present and populated with the defaults above.
  • packages becomes an empty array ([]) when the raw value is missing or not an array (only string entries are kept).

The dynamic maps (votes, classes, heroes, and each hero's abilities) contain only the keys present in the raw data, so they may be empty objects when no data exists.


Returned type tree

SmashHeroesStats

The root object returned by parseSmashHeroes.

ts
interface SmashHeroesStats {
  readonly coins: number;
  readonly smashLevel: number;
  readonly smashLevelTotal: number;
  readonly winStreak: number;
  readonly activeClass: string;
  readonly quits: number;
  readonly smashPlayStreak: number;
  readonly expiredBooster: boolean;
  readonly expBoosterPurchases10Plays: number;
  readonly expBoosterPurchases30Plays: number;
  readonly expBoosterPurchases50Plays: number;
  readonly expBoosterPurchases100Plays: number;
  readonly friendsFirstGame: Date | null;
  readonly friendsGamesDay: number;
  readonly oneVJuanFirstGame: Date | null;
  readonly oneVJuanGamesDay: number;
  readonly games: number;
  readonly wins: number;
  readonly losses: number;
  readonly kills: number;
  readonly deaths: number;
  readonly assists: number;
  readonly assistsNormal: number;
  readonly smashed: number;
  readonly smasher: number;
  readonly damageDealt: number;
  readonly friendWins: number;
  readonly friendWinsNormal: number;
  readonly friendLosses: number;
  readonly friendLossesNormal: number;
  readonly oneVOneWins: number;
  readonly oneVOneWinsNormal: number;
  readonly oneVOneLosses: number;
  readonly oneVOneLossesNormal: number;
  readonly packages: readonly string[];
  readonly classes: Readonly<Record<string, boolean>>;
  readonly leaderboardSettings: SmashHeroesLeaderboardSettings;
  readonly heroLevelBoosterActive: SmashHeroesHeroLevelBooster;
  readonly votes: Readonly<Record<string, number>>;
  readonly combatTracker: boolean;
  readonly ignoreSmashLevel: boolean;
  readonly normal: SmashHeroesModeStats;
  readonly twoVsTwo: SmashHeroesModeStats;
  readonly threeVsThree: SmashHeroesModeStats;
  readonly teams: SmashHeroesModeStats;
  readonly threeVsThreeLegacy: SmashHeroesModeStats;
  readonly teamsLegacy: SmashHeroesModeStats;
  readonly monthly: SmashHeroesPeriodPair;
  readonly weekly: SmashHeroesPeriodPair;
  readonly heroes: Readonly<Record<string, SmashHeroesHeroStats>>;
}
FieldNotes
coinsRaw coins.
smashLevelRaw smashLevel.
smashLevelTotalRaw smash_level_total.
winStreakRaw win_streak.
activeClassRaw active_class.
quitsRaw quits.
smashPlayStreakRaw smash_play_streak.
expiredBoosterRaw expired_booster (true only when exactly true).
expBoosterPurchases10PlaysRaw expBooster_purchases_10_plays.
expBoosterPurchases30PlaysRaw expBooster_purchases_30_plays.
expBoosterPurchases50PlaysRaw expBooster_purchases_50_plays.
expBoosterPurchases100PlaysRaw expBooster_purchases_100_plays.
friendsFirstGameRaw FRIENDS_firstGame as Date, or null.
friendsGamesDayRaw FRIENDS_gamesDay.
oneVJuanFirstGameRaw ONE_V_JUAN_firstGame as Date, or null.
oneVJuanGamesDayRaw ONE_V_JUAN_gamesDay.
assists / assistsNormalRaw assists / assists_normal.
smashed / smasherRaw smashed / smasher.
damageDealtRaw damage_dealt.
friendWins / friendWinsNormalRaw friend_wins / friend_wins_normal.
friendLosses / friendLossesNormalRaw friend_losses / friend_losses_normal.
oneVOneWins / oneVOneWinsNormalRaw one_v_one_wins / one_v_one_wins_normal.
oneVOneLosses / oneVOneLossesNormalRaw one_v_one_losses / one_v_one_losses_normal.
packagesRaw packages; string entries only.
classesMap of class name to ownership boolean, from the raw classes object.
votesCollected from keys matching votes_<name>; keyed by <name>.
combatTrackerRaw combatTracker.
ignoreSmashLevelRaw ignoreSmashLevel.
normalMode with suffix normal (e.g. games_normal).
twoVsTwoMode with suffix 2v2 (e.g. games_2v2).
threeVsThreeMode with suffix 3v3 (e.g. games_3v3).
teamsMode with suffix teams (e.g. games_teams).
threeVsThreeLegacyLegacy 3v3 mode with no separator (e.g. games3v3).
teamsLegacyLegacy teams mode with no separator (e.g. gamesteams).
monthlyPeriod pair from monthly_a / monthly_b.
weeklyPeriod pair from weekly_a / weekly_b.
heroesMap of hero name to SmashHeroesHeroStats.

Hero names in heroes are collected from the keys of class_stats plus any top-level key matching ^(?:lastLevel|xp|pg|masterArmor)_(.+)$, deduplicated and sorted by localeCompare.


Per-mode stat types

SmashHeroesModeStats

Per-mode statistics for the overall game. Used by normal, twoVsTwo, threeVsThree, teams, threeVsThreeLegacy, and teamsLegacy. Each field reads its base key with a mode-specific suffix; legacy modes use no separator between base and suffix.

ts
interface SmashHeroesModeStats {
  readonly games: number;
  readonly wins: number;
  readonly losses: number;
  readonly kills: number;
  readonly deaths: number;
  readonly smashed: number;
  readonly smasher: number;
  readonly damageDealt: number;
}

Base keys: games, wins, losses, kills, deaths, smashed, smasher, damage_dealt.

SmashHeroesPeriodPair

A pair of period buckets (a and b) used by monthly and weekly.

ts
interface SmashHeroesPeriodPair {
  readonly a: SmashHeroesPeriodStats;
  readonly b: SmashHeroesPeriodStats;
}

SmashHeroesPeriodStats

Reduced statistics for a monthly/weekly bucket. Each field reads <base>_<period> (for example games_monthly_a).

ts
interface SmashHeroesPeriodStats {
  readonly games: number;
  readonly wins: number;
  readonly losses: number;
  readonly kills: number;
}

Heroes

SmashHeroesHeroStats

Per-hero statistics. Keyed by hero name in SmashHeroesStats.heroes.

ts
interface SmashHeroesHeroStats {
  readonly hero: string;
  readonly lastLevel: number;
  readonly experience: number;
  readonly prestige: number;
  readonly overall: SmashHeroesHeroModeStats;
  readonly normal: SmashHeroesHeroModeStats;
  readonly twoVsTwo: SmashHeroesHeroModeStats;
  readonly threeVsThree: SmashHeroesHeroModeStats;
  readonly teams: SmashHeroesHeroModeStats;
  readonly threeVsThreeLegacy: SmashHeroesHeroModeStats;
  readonly teamsLegacy: SmashHeroesHeroModeStats;
  readonly friendWins: number;
  readonly friendWinsNormal: number;
  readonly friendLosses: number;
  readonly friendLossesNormal: number;
  readonly oneVOneWins: number;
  readonly oneVOneWinsNormal: number;
  readonly oneVOneLosses: number;
  readonly oneVOneLossesNormal: number;
  readonly masterArmor: boolean;
  readonly abilities: Readonly<Record<string, SmashHeroesAbilityStats>>;
}
FieldNotes
heroThe hero's identifier (the map key).
lastLevelRaw lastLevel_<hero>.
experienceRaw xp_<hero>.
prestigeRaw pg_<hero>.
overallPer-mode hero stats from class_stats.<hero> with no suffix.
normalPer-mode hero stats with suffix normal.
twoVsTwoPer-mode hero stats with suffix 2v2.
threeVsThreePer-mode hero stats with suffix 3v3.
teamsPer-mode hero stats with suffix teams.
threeVsThreeLegacyLegacy 3v3 per-mode hero stats with no separator.
teamsLegacyLegacy teams per-mode hero stats with no separator.
friendWins / friendWinsNormalFrom class_stats.<hero>: friend_wins / friend_wins_normal.
friendLosses / friendLossesNormalFrom class_stats.<hero>: friend_losses / friend_losses_normal.
oneVOneWins / oneVOneWinsNormalFrom class_stats.<hero>: one_v_one_wins / one_v_one_wins_normal.
oneVOneLosses / oneVOneLossesNormalFrom class_stats.<hero>: one_v_one_losses / one_v_one_losses_normal.
masterArmorRaw masterArmor_<hero>.
abilitiesEach nested non-array object under class_stats.<hero> becomes a SmashHeroesAbilityStats keyed by its name.

SmashHeroesHeroModeStats

Per-mode statistics within a single hero. Used by the hero's overall, normal, twoVsTwo, threeVsThree, teams, threeVsThreeLegacy, and teamsLegacy.

ts
interface SmashHeroesHeroModeStats {
  readonly games: number;
  readonly wins: number;
  readonly losses: number;
  readonly kills: number;
  readonly deaths: number;
  readonly smashed: number;
  readonly smasher: number;
  readonly damageDealt: number;
  readonly winStreak: number;
}

Base keys: games, wins, losses, kills, deaths, smashed, smasher, damage_dealt, win_streak.

SmashHeroesAbilityStats

Per-ability statistics broken down by mode. Keyed by ability name in SmashHeroesHeroStats.abilities.

ts
interface SmashHeroesAbilityStats {
  readonly overall: SmashHeroesAbilityModeStats;
  readonly normal: SmashHeroesAbilityModeStats;
  readonly twoVsTwo: SmashHeroesAbilityModeStats;
  readonly threeVsThree: SmashHeroesAbilityModeStats;
  readonly teams: SmashHeroesAbilityModeStats;
  readonly threeVsThreeLegacy: SmashHeroesAbilityModeStats;
  readonly teamsLegacy: SmashHeroesAbilityModeStats;
}

overall reads with no suffix; normal/twoVsTwo/threeVsThree/teams use suffixes normal/2v2/3v3/teams; threeVsThreeLegacy and teamsLegacy use the 3v3/teams suffixes with no separator.

SmashHeroesAbilityModeStats

Per-mode statistics for a single ability.

ts
interface SmashHeroesAbilityModeStats {
  readonly kills: number;
  readonly smashed: number;
  readonly smasher: number;
  readonly damageDealt: number;
}

Base keys: kills, smashed, smasher, damage_dealt.


Settings and boosters

SmashHeroesLeaderboardSettings

Read from the raw leaderboardSettings object.

ts
interface SmashHeroesLeaderboardSettings {
  readonly resetType: string;
  readonly mode: string;
}
FieldRaw key
resetTyperesetType
modemode

SmashHeroesHeroLevelBooster

The active hero-level booster, read from the raw hero_level_booster_active object.

ts
interface SmashHeroesHeroLevelBooster {
  readonly key: string;
  readonly multiplier: number;
  readonly value: number;
  readonly plays: number;
}
FieldRaw key
keykey
multipliermultiplier
valuevalue
playsplays

Released under the MIT License.