124 lines
8.6 KiB
TypeScript
124 lines
8.6 KiB
TypeScript
// Deterministic, preview-only fixtures. Every displayed aggregate is calculated
|
|
// from these games. These are illustrative records, not imported live results.
|
|
export const PREVIEW_PATH = '/design-previews/internal-stats.html';
|
|
export const ORIGINAL_PATH = '/communities/69ebe0adf627c11be2f020a1/internal-stats';
|
|
export const lanes = ['TOP', 'JUNGLE', 'MIDDLE', 'BOTTOM', 'UTILITY'] as const;
|
|
export type Lane = typeof lanes[number];
|
|
export const laneNames: Record<Lane, string> = { TOP: '탑', JUNGLE: '정글', MIDDLE: '미드', BOTTOM: '원딜', UTILITY: '서포터' };
|
|
export const seasons = [
|
|
{ id: '2026-2', name: '2026 시즌 2', from: '2026-06-01', to: '2026-06-30' },
|
|
{ id: '2026-1', name: '2026 시즌 1', from: '2026-05-01', to: '2026-05-31' },
|
|
];
|
|
export const champions = [
|
|
{ key: 'Ornn', name: '오른' }, { key: 'LeeSin', name: '리 신' },
|
|
{ key: 'Ahri', name: '아리' }, { key: 'Ezreal', name: '이즈리얼' }, { key: 'Thresh', name: '쓰레쉬' },
|
|
{ key: 'Gnar', name: '나르' }, { key: 'Viego', name: '비에고' },
|
|
{ key: 'Orianna', name: '오리아나' }, { key: 'Jinx', name: '징크스' }, { key: 'Leona', name: '레오나' },
|
|
{ key: 'Renekton', name: '레넥톤' }, { key: 'Sejuani', name: '세주아니' },
|
|
{ key: 'Syndra', name: '신드라' }, { key: 'Kaisa', name: '카이사' }, { key: 'Nautilus', name: '노틸러스' },
|
|
];
|
|
export function championImage(key: string) {
|
|
return `https://ddragon.leagueoflegends.com/cdn/15.24.1/img/champion/${key}.png`;
|
|
}
|
|
export type Player = { id: string; name: string; lane: Lane; teamId: string; champion: number };
|
|
export type Team = { id: string; name: string; players: Player[] };
|
|
const names = [
|
|
'덕 덕', '정 웅', '장금순', '귤팽이', 'Choco Queen',
|
|
'으악도망처', '정공글주', '프리리', '멘헤라 원딜', '달래줘',
|
|
'그 냥', '하냥이', '귤딱콩', '김꾸루꾸루', '서폿의 품격',
|
|
'캐리요정', 'Horra', '던 던', '포악한 너구리', '여름밤',
|
|
'오른손', '달빛정글', '민트초코', '봄날의 원딜', '구름산책',
|
|
'단단한 바위', '바람길', '새벽별', '라임소다', '느린우체통',
|
|
'탑의기억', '초록숲', '고양이발', '은빛화살', '작은파도',
|
|
'도토리', '숲속여우', '별사탕', '노을빛', '밤하늘',
|
|
];
|
|
export const teams: Team[] = ['포구리야~', '나물장수', '해온해줘', '똥칼라파워', '참봉발사', '월요일의 기적', '바텀 듀오', '다섯 번째 계절'].map((name, t) => ({
|
|
id: `t${t}`, name,
|
|
players: lanes.map((lane, i) => ({ id: `p${t * 5 + i}`, name: names[t * 5 + i], lane, teamId: `t${t}`, champion: (t % 3) * 5 + i })),
|
|
}));
|
|
export const players = teams.flatMap(t => t.players);
|
|
export const teamById = new Map(teams.map(t => [t.id, t]));
|
|
export const playerById = new Map(players.map(p => [p.id, p]));
|
|
export type Participant = {
|
|
playerId: string; teamId: string; lane: Lane; champion: number;
|
|
kills: number; deaths: number; assists: number; cs: number; gold: number;
|
|
damage: number; vision: number; kp: number; won: boolean;
|
|
};
|
|
export type Game = {
|
|
id: string; eventId: string; seriesId: string; number: number; ordinal: number;
|
|
blue: string; red: string; winner: string; duration: number;
|
|
evidence: 'ready' | 'missing' | 'pending'; participants: Participant[];
|
|
};
|
|
export type Series = { id: string; label: string; a: string; b: string; games: Game[]; winner: string; scoreA: number; scoreB: number };
|
|
export type Event = {
|
|
id: string; name: string; date: string; time: string; season: string;
|
|
format: 'pair' | 'tournament'; formatLabel: string; teamIds: string[];
|
|
champion: string | null; series: Series[];
|
|
};
|
|
function makeEvent(id: string, name: string, date: string, kind: 'double' | 'league' | 'pair', seed: number): Event {
|
|
const event: Event = { id, name, date, time: '21:00', season: date.startsWith('2026-06') ? '2026-2' : '2026-1', format: kind === 'pair' ? 'pair' : 'tournament', formatLabel: kind === 'double' ? '더블 엘리미네이션' : kind === 'league' ? '리그전' : '두 팀 내전', teamIds: [], champion: null, series: [] };
|
|
let serial = 0;
|
|
const series = (label: string, a: string, b: string, winner: string, count = 3) => {
|
|
const sid = `${id}-s${event.series.length + 1}`;
|
|
const games: Game[] = Array.from({ length: count }, (_, i) => {
|
|
serial += 1;
|
|
const n = serial;
|
|
const losingTeam = winner === a ? b : a;
|
|
const won = count === 3 && i === 1 ? losingTeam : winner;
|
|
const blue = i % 2 ? b : a;
|
|
const red = blue === a ? b : a;
|
|
const duration = 1560 + ((n * 127 + seed * 79) % 900);
|
|
const kills = [0, 1].map(side => lanes.map((_, slot) => 2 + (n * 7 + seed * 3 + side * 5 + slot * 3) % 10));
|
|
const participants = [blue, red].flatMap((tid, side) => teamById.get(tid)!.players.map((player, slot): Participant => {
|
|
const lane = lanes[(slot + (n % 7 === 0 ? 1 : 0)) % 5];
|
|
const teamKills = kills[side].reduce((sum, k) => sum + k, 0);
|
|
const assists = Math.min(teamKills - kills[side][slot], 5 + (n + slot * 4 + seed) % 17);
|
|
const gpm = (lane === 'UTILITY' ? 260 : lane === 'BOTTOM' ? 460 : 370) + (n * 13 + slot * 21 + seed * 7 + side * 37) % 100 + (won === tid ? 28 : 0);
|
|
return { playerId: player.id, teamId: tid, lane, champion: (player.champion + (n % 3) * 5) % champions.length, kills: kills[side][slot], deaths: kills[1 - side][slot], assists, cs: Math.round((lane === 'UTILITY' ? 1.2 : 5.5 + (n + slot) % 4) * duration / 60), gold: Math.round(gpm * duration / 60), damage: 8000 + ((n * 1331 + slot * 3443 + seed * 701 + side * 3911) % 24000), vision: lane === 'UTILITY' ? 45 + n % 42 : 12 + n % 30, kp: (kills[side][slot] + assists) / teamKills * 100, won: won === tid };
|
|
}));
|
|
const evidence = id === 'summer-finals' && [3, 6, 9, 12, 15, 18, 21].includes(n) ? 'missing' : id === 'friday-league' && n === 12 ? 'pending' : 'ready';
|
|
return { id: `${id}-g${n}`, eventId: id, seriesId: sid, number: n, ordinal: i + 1, blue, red, winner: won, duration, evidence, participants };
|
|
});
|
|
const result = { id: sid, label, a, b, games, winner, scoreA: games.filter(g => g.winner === a).length, scoreB: games.filter(g => g.winner === b).length };
|
|
event.series.push(result);
|
|
return { win: winner, loss: winner === a ? b : a };
|
|
};
|
|
if (kind === 'double') {
|
|
const q1 = series('승자조 1라운드 · 1경기', 't0', 't7', 't0', 2);
|
|
const q2 = series('승자조 1라운드 · 2경기', 't1', 't6', 't1', 2);
|
|
const q3 = series('승자조 1라운드 · 3경기', 't2', 't5', 't2', 2);
|
|
const q4 = series('승자조 1라운드 · 4경기', 't3', 't4', 't3', 2);
|
|
const s1 = series('승자조 준결승 · 1경기', q1.win, q2.win, q1.win, 2);
|
|
const s2 = series('승자조 준결승 · 2경기', q3.win, q4.win, q3.win, 2);
|
|
const l1 = series('패자조 1라운드 · 1경기', q1.loss, q2.loss, q2.loss, 2);
|
|
const l2 = series('패자조 1라운드 · 2경기', q3.loss, q4.loss, q4.loss, 2);
|
|
const l3 = series('패자조 2라운드 · 1경기', l1.win, s2.loss, s2.loss, 2);
|
|
const l4 = series('패자조 2라운드 · 2경기', l2.win, s1.loss, s1.loss, 2);
|
|
const wf = series('승자조 결승', s1.win, s2.win, s1.win, 2);
|
|
const ls = series('패자조 준결승', l3.win, l4.win, l4.win, 2);
|
|
const lf = series('패자조 결승', ls.win, wf.loss, ls.win, 2);
|
|
const final = series('최종 결승', wf.win, lf.win, wf.win, 3);
|
|
event.champion = final.win;
|
|
} else if (kind === 'league') {
|
|
const ids = seed % 2 ? ['t0', 't1', 't2', 't3'] : ['t4', 't5', 't6', 't7'];
|
|
for (let i = 0; i < 4; i++) for (let j = i + 1; j < 4; j++) series(`리그 ${event.series.length + 1}경기`, ids[i], ids[j], ids[i], 2);
|
|
event.champion = ids[0];
|
|
} else {
|
|
const a = `t${seed % 8}`, b = `t${(seed + 3) % 8}`;
|
|
series('3판 2선승', a, b, seed % 2 ? a : b);
|
|
}
|
|
event.teamIds = [...new Set(event.series.flatMap(s => [s.a, s.b]))];
|
|
return event;
|
|
}
|
|
export const events: Event[] = [
|
|
makeEvent('summer-finals', '6월 정기 멸망전', '2026-06-27', 'double', 1),
|
|
makeEvent('friday-league', '목요일, 한 판 더', '2026-06-25', 'league', 3),
|
|
makeEvent('tuesday-pair', '화요일 저녁 내전', '2026-06-23', 'pair', 2),
|
|
makeEvent('monday-league', '월요 내전 리그', '2026-06-22', 'league', 4),
|
|
makeEvent('weekend-pair', '주말 자유 내전', '2026-06-21', 'pair', 5),
|
|
makeEvent('saturday-pair', '토요일 리매치', '2026-06-20', 'pair', 6),
|
|
makeEvent('may-finals', '5월 마무리 리그', '2026-05-30', 'league', 7),
|
|
makeEvent('may-pair', '수요일 저녁 내전', '2026-05-27', 'pair', 0),
|
|
];
|
|
export const games = events.flatMap(e => e.series.flatMap(s => s.games));
|