Overview
The Player class represents a single player in a match, tracking their identity, agent selection, in-game stats, equipment, and state across rounds.
Player Class
export class Player {
// Identity
private name: string;
private tagline: string;
private riotId: string;
private searchName: string; // "Name #TAG"
private fullName: string; // "Name#TAG"
private position: number;
// Agent
private agentInternal: string = "";
private agentProper: string = "";
private locked: boolean = false;
// State
private isAlive: boolean = true;
private hasSpike: boolean = false;
private isObserved: boolean = false;
private health: number = 100;
// Stats
private kills: number = 0;
private deaths: number = 0;
private assists: number = 0;
private kdRatio: number = 0;
private killsThisRound: number = 0;
private deathsThisRound: number = 0;
// Ultimate
private currUltPoints: number = 0;
private maxUltPoints: number = 0;
private ultReady: boolean = false;
// Economy
private money: number = 0;
private moneySpent: number = 0;
private spentMoneyThisRound: boolean = false;
// Equipment
private armorName: string;
private highestWeapon: string;
// Abilities (from auxiliary data)
private abilities: AvailableAbilities;
// Advanced Stats
private teamKills: number = 0;
private headshotKills: number = 0;
private headshotRatio: number = 0;
private killedPlayerNames: string[] = [];
private killsByWeaponsAndAbilities: Record<string, number> = {};
private killsOnEnemyPlayer: Record<string, number> = {};
private killsOnTeammatePlayer: Record<string, number> = {};
// Data Availability
private scoreboardAvailable: boolean = false;
private auxiliaryAvailable: AvailableAuxiliary;
private iconNameSuffix: string = "";
}
Properties
Identity
Player’s in-game display name (without tagline).
Riot ID tagline (the part after #).
Unique player identifier (PUUID).
Player’s position in the team roster (0-4).
Agent
Internal agent identifier from game data (e.g., “Clay_PC_C”).
Human-readable agent name (e.g., “Raze”).
Whether the agent selection is locked.
Combat Stats
Total kills in the match.
Total deaths in the match.
Total assists in the match.
Calculated kill/death ratio (kills ÷ deaths).
Kills in the current round (resets each round).
Deaths in the current round (resets each round).
State
Whether the player is currently alive.
Whether the player is carrying the spike.
Whether the observer camera is currently viewing this player.
Current health points (0-100). Only available with auxiliary client.
Ultimate
Maximum ultimate points required for this agent.
Whether ultimate ability is ready to use (currUltPoints >= maxUltPoints).
Economy
Credits spent in the current round.
Equipment
Current armor type.
- Index 0: No armor
- Index 1: Light armor (25 HP)
- Index 2: Heavy armor (50 HP)
Best weapon the player is currently holding (translated name).
Advanced Stats
Number of kills that were headshots.
Percentage of kills that were headshots (headshotKills ÷ kills).
Number of friendly fire kills.
List of player names killed this round.
killsByWeaponsAndAbilities
Map of weapon/ability internal names to kill counts.
Constructor
constructor(data: IFormattedRoster)
Creates a new player from roster data.
Initial roster information containing:
name: Player name
tagline: Riot ID tag
playerId: PUUID
agentInternal: Selected agent
position: Roster position
locked: Lock state
Core Methods
updateFromScoreboard
public updateFromScoreboard(data: IFormattedScoreboard): void
Updates player state from observer scoreboard data. This is the primary data source.
data
IFormattedScoreboard
required
agentInternal: Current agent
kills, deaths, assists: Stats
currUltPoints, maxUltPoints: Ultimate state
money: Current credits
isAlive: Alive state
hasSpike: Spike carrier status
initialArmor: Armor type index
scoreboardWeaponInternal: Best weapon
updateFromAuxiliaryScoreboard
public updateFromAuxiliaryScoreboard(data: IFormattedScoreboard | IFormattedAuxScoreboardTeam): void
Fallback scoreboard update from auxiliary client. Only used if observer scoreboard is unavailable.
public extractKillfeedInfo(data: IFormattedKillfeed): void
Processes killfeed events to extract detailed stats:
- Weapon/ability kill tracking
- Headshot detection
- Teamkill recording
- Victim tracking
updateAbilities
public updateAbilities(data: AvailableAbilities): void
Updates ability charges from auxiliary client.
data
AvailableAbilities
required
{
grenade: number; // Q ability charges
ability1: number; // E ability charges
ability2: number; // C ability charges
}
setHealth
public setHealth(health: number): void
Updates health from auxiliary client (0-100).
resetRoundSpecificValues
public resetRoundSpecificValues(isSideSwitch: boolean): void
Resets per-round stats at the start of each round:
- Clears
killsThisRound and deathsThisRound
- Resets money spent tracking
- Clears killed player names
- Resets state flags
- Sets money to 800 on side switches
Getters
public getName(): string
public getSearchName(): string // "Name #TAG"
public getPlayerId(): string
public getAgentInternal(): string
public checkIsAlive(): boolean
public getMoney(): number
public getMoneySpent(): number
public getKillsThisRound(): number
public getDeathsThisRound(): number
Helper Classes
AvailableAbilities
export class AvailableAbilities {
grenade: number = 0; // Q ability
ability1: number = 0; // E ability
ability2: number = 0; // C ability
}
AvailableAuxiliary
export class AvailableAuxiliary {
health: boolean = false;
abilities: boolean = false;
scoreboard: boolean = false;
}
Tracks which auxiliary data sources are connected for this player.
Agent-Specific Behavior
When Clove uses ultimate:
- Detects when ult points drop to 0 while ultimate was ready
- Sets special icon suffix for “in-ultimate” state
- Resets icon on kill or damaging assist
When Veto transforms:
- Detects when ult points drop to 0 while ultimate was ready
- Sets special icon suffix for transformed state
Cosmic form tracking:
- Sets icon suffix when entering astral form
- Resets when exiting
- Requires auxiliary data feed
Camera usage tracking:
- Sets icon suffix when viewing camera
- Resets when exiting camera view
- Requires auxiliary data feed
Example Usage
// Player is created from roster data
const rosterData: IFormattedRoster = {
name: "PlayerOne",
tagline: "NA1",
playerId: "player-uuid-123",
startTeam: 0,
agentInternal: "Clay_PC_C",
position: 0,
locked: true,
rank: 24
};
const player = new Player(rosterData);
// Update from scoreboard
player.updateFromScoreboard({
name: "PlayerOne",
tagline: "NA1",
playerId: "player-uuid-123",
startTeam: 0,
agentInternal: "Clay_PC_C",
isAlive: true,
initialArmor: 2,
scoreboardWeaponInternal: "vandal",
currUltPoints: 6,
maxUltPoints: 7,
hasSpike: false,
money: 3400,
kills: 12,
deaths: 8,
assists: 5
});
// Process kill
player.extractKillfeedInfo({
attacker: "PlayerOne",
victim: "Enemy1",
weaponKillfeedInternal: "vandal",
headshotKill: true,
assists: ["Teammate1"],
isTeamkill: false
});
// Update abilities from aux client
player.updateAbilities({
grenade: 1,
ability1: 2,
ability2: 1
});
console.log(player.getName()); // "PlayerOne"
console.log(player.getKillsThisRound()); // 1