// 시연·통합 테스트용 경기 데이터 생성기 (실제 API 응답 구조: 발로란트 match-details, 롤 LCU match-history + timeline) // 결정적(seed 고정)이라 매번 같은 경기가 나온다. let seed = 7; const rnd = () => ((seed = (seed * 16807) % 2147483647) - 1) / 2147483646; const pick = (a: T[]): T => a[Math.floor(rnd() * a.length)]; const range = (a: number, b: number) => a + Math.floor(rnd() * (b - a + 1)); export const AGENT = { jett: 'add6443a-41bd-e414-f6ad-e58d267f4e95', sova: '320b2a48-4d9b-a075-30f1-1f93a9b638fa', sage: '569fdd95-4d10-43ab-ca70-79becc718b46', omen: '8e253930-4c05-31dd-1b6c-968525494517', killjoy: '1e58de9c-4950-5125-93e9-a0aee9f98746', raze: 'f94c3b30-42be-e959-889c-5aa313dba261', reyna: 'a3bfb853-43b2-7238-a4f1-ad90e9e46bcc', }; const WEAPON = { vandal: '9C82E19D-4575-0200-1A81-3EACF00CF872', phantom: 'EE8E8D15-496B-07AC-E5F6-8FAE5D4C7B1A', operator: 'A03B24D3-4319-996D-0F8C-94BBFBA1DFC7', sheriff: 'E336C6B8-418D-9340-D77F-7A9E4CFE0702', classic: '29A0CFAB-485B-F5D5-779A-B59F85E204A8', spectre: '462080D1-4035-2937-7C09-27AA2A5C27A7', }; // 어센트 미니맵 위 플레이 가능한 지점 (1024px 기준 u,v) → 게임 좌표 const ASCENT = { xMultiplier: 7e-5, yMultiplier: -7e-5, xScalarToAdd: 0.813895, yScalarToAdd: 0.573242 }; const SPOTS = [ [320, 150], [300, 190], [400, 140], [410, 300], [480, 130], [500, 250], [330, 290], [200, 350], [500, 500], [540, 520], [420, 500], [300, 480], [310, 570], [180, 640], [160, 450], [100, 450], [280, 800], [240, 770], [300, 700], [420, 750], [560, 740], [800, 580], [900, 580], [790, 420], [600, 270], [690, 400], [560, 450], ]; function loc() { const s = pick(SPOTS); const u = (s[0] + range(-12, 12)) / 1024; const v = (s[1] + range(-12, 12)) / 1024; return { x: Math.round((v - ASCENT.yScalarToAdd) / ASCENT.yMultiplier), y: Math.round((u - ASCENT.xScalarToAdd) / ASCENT.xMultiplier) }; } export const VAL_PLAYERS = [ { subject: 'p-sh', gameName: '승한', tagLine: 'KR1', teamId: 'Blue', characterId: AGENT.jett }, { subject: 'p-ms', gameName: '민수', tagLine: '0707', teamId: 'Blue', characterId: AGENT.sova }, { subject: 'p-jw', gameName: '지우', tagLine: 'KR2', teamId: 'Blue', characterId: AGENT.sage }, { subject: 'p-hw', gameName: '현우', tagLine: 'HW1', teamId: 'Blue', characterId: AGENT.omen }, { subject: 'p-dk', gameName: 'Duck', tagLine: 'KR3', teamId: 'Blue', characterId: AGENT.killjoy }, { subject: 'e-lm', gameName: 'Lumi', tagLine: 'KR1', teamId: 'Red', characterId: AGENT.raze }, { subject: 'e-hr', gameName: 'Haru', tagLine: 'KR2', teamId: 'Red', characterId: AGENT.reyna }, { subject: 'e-kw', gameName: 'Kiwi', tagLine: 'KR9', teamId: 'Red', characterId: AGENT.sova }, { subject: 'e-nx', gameName: 'Nox', tagLine: '0420', teamId: 'Red', characterId: AGENT.killjoy }, { subject: 'e-mt', gameName: 'Mint', tagLine: '7777', teamId: 'Red', characterId: AGENT.omen }, ]; /** 22라운드 13:9 어센트 경쟁전 */ export function makeDemoValorant(gameStart: number) { seed = 11; const W = 'WWLWLWWLLWWLWWLWLLWLWW'; // 우리 팀 기준 const blue = VAL_PLAYERS.filter((p) => p.teamId === 'Blue').map((p) => p.subject); const red = VAL_PLAYERS.filter((p) => p.teamId === 'Red').map((p) => p.subject); const stats: Record = {}; for (const p of VAL_PLAYERS) stats[p.subject] = { kills: 0, deaths: 0, assists: 0, score: 0 }; let t = 0; const roundResults: any[] = []; for (let i = 0; i < W.length; i++) { const win = W[i] === 'W'; const roundStart = t; const combat = roundStart + (i === 0 || i === 12 ? 45000 : 30000); const aliveB = new Set(blue); const aliveR = new Set(red); const kills: any[] = []; let rt = range(8000, 20000); const pistol = i === 0 || i === 12; while (aliveB.size && aliveR.size) { const blueKills = win ? rnd() < 0.62 : rnd() < 0.38; const killer = pick([...(blueKills ? aliveB : aliveR)]); const victim = pick([...(blueKills ? aliveR : aliveB)]); (blueKills ? aliveR : aliveB).delete(victim); const assistants = rnd() < 0.5 ? [pick([...(blueKills ? aliveB : aliveR)].filter((x) => x !== killer) || [])].filter(Boolean) : []; kills.push({ gameTime: combat + rt, roundTime: rt, killer, victim, victimLocation: loc(), assistants, playerLocations: [], finishingDamage: { damageType: 'Weapon', damageItem: pistol ? pick([WEAPON.classic, WEAPON.sheriff]) : pick([WEAPON.vandal, WEAPON.vandal, WEAPON.phantom, WEAPON.operator, WEAPON.spectre]), isSecondaryFireMode: false }, }); stats[killer].kills++; stats[victim].deaths++; for (const a of assistants) stats[a].assists++; rt += range(3000, 16000); if ((win && !aliveR.size) || (!win && !aliveB.size)) break; if (kills.length >= 8 && rnd() < 0.5) break; } const planted = rnd() < 0.55; const result = !aliveB.size || !aliveR.size ? 'Eliminated' : planted ? (win ? 'Bomb defused' : 'Bomb detonated') : 'Round timer expired'; const end = combat + Math.max(rt + 4000, planted ? 80000 : 60000); const playerStats = VAL_PLAYERS.map((p) => ({ subject: p.subject, kills: kills.filter((k) => k.killer === p.subject), score: kills.filter((k) => k.killer === p.subject).length * 200 + range(0, 150), economy: { spent: pistol ? 800 : range(1500, 4700), remaining: range(0, 3000), loadoutValue: 0, weapon: pistol ? WEAPON.classic : pick([WEAPON.vandal, WEAPON.phantom]), armor: '' }, })); // 피해량 · 장비 값 (난수를 더 쓰지 않는다: 다른 시연 데이터가 바뀌지 않게) for (const ps of playerStats as any[]) { ps.damage = ps.kills.map((k: any) => ({ receiver: k.victim, damage: 140 + (k.gameTime % 61), headshots: k.gameTime % 3 === 0 ? 1 : 0, bodyshots: 2, legshots: k.gameTime % 5 === 0 ? 1 : 0 })); ps.economy.loadoutValue = pistol ? 800 : ps.economy.spent + 900; } for (const ps of playerStats) stats[ps.subject].score += ps.score; roundResults.push({ roundNum: i, roundResult: result, winningTeam: win ? 'Blue' : 'Red', plantRoundTime: planted ? range(35000, 60000) : undefined, plantSite: planted ? pick(['A', 'B']) : undefined, bombPlanter: planted ? pick(win ? red : red) : undefined, defuseRoundTime: planted && win ? range(70000, 85000) : undefined, bombDefuser: planted && win ? pick(blue) : undefined, playerStats, }); t = end + 8000; } return { matchInfo: { matchId: 'demo-ascent-01', mapId: '/Game/Maps/Ascent/Ascent', gameStartMillis: gameStart, gameLengthMillis: t, queueID: 'competitive', gameMode: '/Game/GameModes/Bomb/BombGameMode.BombGameMode_C', isCompleted: true }, players: VAL_PLAYERS.map((p) => ({ ...p, competitiveTier: range(12, 18), stats: { ...stats[p.subject], roundsPlayed: W.length } })), teams: [ { teamId: 'Blue', won: true, roundsWon: [...W].filter((c) => c === 'W').length }, { teamId: 'Red', won: false, roundsWon: [...W].filter((c) => c === 'L').length }, ], roundResults, }; } // ------------------------------------------------------------------ 롤 const LOL = [ { pid: 1, champ: 103, team: 100, puuid: 'l-sh', name: '승한', tag: 'KR1' }, // 아리 미드 { pid: 2, champ: 64, team: 100, puuid: 'l-ms', name: '민수', tag: '0707' }, // 리 신 { pid: 3, champ: 86, team: 100, puuid: 'l-hw', name: '현우', tag: 'HW1' }, // 가렌 { pid: 4, champ: 81, team: 100, puuid: 'l-jw', name: '지우', tag: 'KR2' }, // 이즈리얼 { pid: 5, champ: 412, team: 100, puuid: 'l-dk', name: 'Duck', tag: 'KR3' }, // 쓰레쉬 { pid: 6, champ: 7, team: 200, puuid: 'r-1', name: 'Lumi', tag: 'KR1' }, // 르블랑 { pid: 7, champ: 113, team: 200, puuid: 'r-2', name: 'Haru', tag: 'KR2' }, // 세주아니 { pid: 8, champ: 122, team: 200, puuid: 'r-3', name: 'Kiwi', tag: 'KR9' }, // 다리우스 { pid: 9, champ: 222, team: 200, puuid: 'r-4', name: 'Nox', tag: '0420' }, // 징크스 { pid: 10, champ: 89, team: 200, puuid: 'r-5', name: 'Mint', tag: '7777' }, // 레오나 ]; const LANE = [ { lane: 'MIDDLE', role: 'SOLO' }, { lane: 'JUNGLE', role: 'NONE' }, { lane: 'TOP', role: 'SOLO' }, { lane: 'BOTTOM', role: 'DUO_CARRY' }, { lane: 'BOTTOM', role: 'DUO_SUPPORT' }, ]; export function makeDemoLol() { seed = 23; const dur = 28 * 60; const st: Record = {}; for (const p of LOL) st[p.pid] = { kills: 0, deaths: 0, assists: 0 }; const frames: any[] = []; let ga = 0; let gr = 0; const dragons = ['FIRE_DRAGON', 'WATER_DRAGON', 'EARTH_DRAGON', 'FIRE_DRAGON']; let di = 0; for (let m = 0; m <= 28; m++) { const events: any[] = []; const inc = (team: number) => 300 + range(150, 420) + (team === 100 ? m * 12 : 0); ga += m ? inc(100) * 5 : 2500; gr += m ? inc(200) * 5 : 2500; if (m >= 3) for (let k = 0; k < range(0, 2); k++) { const blueKill = rnd() < 0.58; const killer = pick(LOL.filter((p) => (p.team === 100) === blueKill)); const victim = pick(LOL.filter((p) => (p.team === 100) !== blueKill)); const assists = rnd() < 0.6 ? [pick(LOL.filter((p) => p.team === killer.team && p !== killer)).pid] : []; st[killer.pid].kills++; st[victim.pid].deaths++; for (const a of assists) st[a].assists++; events.push({ type: 'CHAMPION_KILL', timestamp: m * 60000 + range(1000, 58000), killerId: killer.pid, victimId: victim.pid, assistingParticipantIds: assists, position: { x: range(1500, 13500), y: range(1500, 13500) } }); if (blueKill) ga += 300; else gr += 300; } if ([6, 12, 18, 24].includes(m)) events.push({ type: 'ELITE_MONSTER_KILL', timestamp: m * 60000 + 20000, killerId: m === 18 ? 7 : 2, monsterType: 'DRAGON', monsterSubType: dragons[di++], position: { x: 9866, y: 4414 } }); if (m === 8) events.push({ type: 'ELITE_MONSTER_KILL', timestamp: m * 60000 + 30000, killerId: 2, monsterType: 'HORDE', position: { x: 5007, y: 10471 } }); if (m === 21) events.push({ type: 'ELITE_MONSTER_KILL', timestamp: m * 60000 + 40000, killerId: 2, monsterType: 'BARON_NASHOR', position: { x: 5007, y: 10471 } }); if ([10, 14, 16, 22, 25, 26].includes(m)) events.push({ type: 'BUILDING_KILL', timestamp: m * 60000 + 45000, killerId: 1, teamId: 200, buildingType: m === 26 ? 'INHIBITOR_BUILDING' : 'TOWER_BUILDING', position: { x: 8955 + m * 100, y: 8510 + m * 80 } }); if ([13, 19].includes(m)) events.push({ type: 'BUILDING_KILL', timestamp: m * 60000 + 15000, killerId: 8, teamId: 100, buildingType: 'TOWER_BUILDING', position: { x: 5846, y: 6396 } }); events.sort((a, b) => a.timestamp - b.timestamp); const pf: Record = {}; for (const p of LOL) pf[String(p.pid)] = { totalGold: Math.round((p.team === 100 ? ga : gr) / 5), minionsKilled: (p.pid - 1) % 5 === 4 || (p.pid - 1) % 5 === 1 ? m : m * (6 + (p.pid % 3)), jungleMinionsKilled: (p.pid - 1) % 5 === 1 ? m * 5 : 0, xp: m * 420 + p.pid * 10, }; frames.push({ timestamp: m * 60000, participantFrames: pf, events }); } const items = [3031, 3089, 3157, 3020, 6655, 3135]; return { game: { gameId: 7700123, gameDuration: dur, queueId: 420, participants: LOL.map((p) => ({ participantId: p.pid, championId: p.champ, teamId: p.team, spell1Id: p.pid === 2 || p.pid === 7 ? 11 : 4, spell2Id: 14, // 라인 · 역할 (LCU 경기 기록 형식) timeline: LANE[(p.pid - 1) % 5], stats: { ...st[p.pid], totalMinionsKilled: range(30, 230), neutralMinionsKilled: p.pid === 2 || p.pid === 7 ? range(120, 180) : range(0, 15), goldEarned: Math.round((p.team === 100 ? ga : gr) / 5) + range(-800, 800), item0: pick(items), item1: pick(items), item2: pick(items), champLevel: range(13, 18), win: p.team === 100, // 범인찾기용 추가 지표 (난수를 더 쓰지 않는다: 다른 시연 데이터가 바뀌지 않게) totalDamageDealtToChampions: 9000 + p.pid * 1700, totalDamageTaken: 15000 + ((p.pid * 3700) % 11000), visionScore: (p.pid - 1) % 5 === 4 ? 62 : 14 + p.pid * 2, wardsPlaced: (p.pid - 1) % 5 === 4 ? 48 : 9 + p.pid, wardsKilled: 3 + (p.pid % 4), visionWardsBoughtInGame: (p.pid - 1) % 5 === 4 ? 9 : 2, damageDealtToObjectives: 4000 + p.pid * 900, damageDealtToTurrets: 1200 + p.pid * 400, timeCCingOthers: 10 + p.pid * 3, }, })), participantIdentities: LOL.map((p) => ({ participantId: p.pid, player: { puuid: p.puuid, gameName: p.name, tagLine: p.tag } })), teams: [ { teamId: 100, win: 'Win' }, { teamId: 200, win: 'Fail' }, ], }, timeline: { frames }, durationMs: dur * 1000, }; }