UNPKG

bad-stats-common

Version:

Common constants and types for bad-stats client and server

86 lines (79 loc) 2.38 kB
declare const PLAYER_RANKS: readonly ["R5", "R4", "R3", "R2", "R1", "R0"]; declare const PLAYER_ROLES: readonly ["owner", "administrator", "moderator", "user", "quest"]; declare const EVENT_STATUSES: readonly ["active", "finished", "planned"]; type FilterType<T> = T | null; type SortKey<T> = keyof T; type PlayerRank = (typeof PLAYER_RANKS)[number]; type PlayerRoles = (typeof PLAYER_ROLES)[number]; type EventStatus = (typeof EVENT_STATUSES)[number]; type FilterRank = FilterType<PlayerRank>; type FilterStatus = FilterType<EventStatus>; interface IStagePlayerStats { playerId: string; pvpKillsStart: number; pvpKillsEnd?: number; pvpKills: number; healedStart: number; healedEnd?: number; healed: number; aiKills: number; honorPoints?: number; kpi?: number; activity?: number; } interface IStage { id: string; eventId: string; description?: string; startDate: Date; endDate: Date; stats?: IStagePlayerStats[]; avgPvpKills?: number; avgHealed?: number; avgActivity?: number; createdAt?: Date; updatedAt?: Date; } interface IEvent { id: string; name: string; startDate: Date; endDate: Date; status: EventStatus; allianceId: string; stages?: IStage[]; avgActivity?: number; createdAt?: Date; updatedAt?: Date; } interface IPlayerProfileStats { rank?: PlayerRank; totalKills: number; totalHealed: number; power?: number; cavePoints?: number; } interface IPlayer { id: string; gameId?: number; name: string; role: PlayerRoles; alliance: IAlliance[]; profileStats: IPlayerProfileStats[]; events: IEvent[]; createdAt?: Date; updatedAt?: Date; } interface IAlliance { id: string; name: string; slogan: string; server: number; players: IPlayer[]; events?: IEvent[]; createdAt?: Date; updatedAt?: Date; } declare const calculateDifference: (startValue: number, endValue: number) => number | null; declare const calculateAverage: (values: number[], round?: boolean) => number | null; export { EVENT_STATUSES, type EventStatus, type FilterRank, type FilterStatus, type FilterType, type IAlliance, type IEvent, type IPlayer, type IPlayerProfileStats, PLAYER_RANKS, PLAYER_ROLES, type PlayerRank, type PlayerRoles, type SortKey, calculateAverage, calculateDifference };