.
This commit is contained in:
1 parent
6d62de4ec4
commit
285f72b3ee
16 files changed
+2095
-136
No files matched your search
+60
-4
@@ -12,6 +12,7 @@ import type {
|
||||
MatchTeam,
|
||||
Position,
|
||||
PositionPreference,
|
||||
RiotLane,
|
||||
RiotRecentStatsSummary,
|
||||
TierInfo,
|
||||
} from './modules/global/database/schema';
|
||||
@@ -82,7 +83,7 @@ type SeedPlayer = {
|
||||
losses: number;
|
||||
};
|
||||
masteries: SeedChampionMastery[];
|
||||
recentStatsSummary: RiotRecentStatsSummary;
|
||||
recentStatsSummary: SeedRecentStatsSummary;
|
||||
};
|
||||
|
||||
type SeedChampionMastery = {
|
||||
@@ -92,6 +93,18 @@ type SeedChampionMastery = {
|
||||
points: number;
|
||||
};
|
||||
|
||||
type SeedRecentStatsSummary = {
|
||||
games: number;
|
||||
wins: number;
|
||||
losses: number;
|
||||
avgKills: number;
|
||||
avgDeaths: number;
|
||||
avgAssists: number;
|
||||
avgCs: number;
|
||||
avgCsPerMin?: number;
|
||||
mostPlayedChampionIds: string[];
|
||||
};
|
||||
|
||||
const DEV_COMMUNITY_NAME = '[DEV] Lolympus Test Community';
|
||||
const DEV_COMMUNITY_DESCRIPTION =
|
||||
'Frontend/Backend 통합 검증용으로 생성된 개발 커뮤니티입니다.';
|
||||
@@ -129,6 +142,14 @@ const CHAMPION_IDS: Record<string, number> = {
|
||||
Zeri: 221,
|
||||
};
|
||||
|
||||
const POSITION_TO_RIOT_LANE: Record<Position, RiotLane> = {
|
||||
TOP: 'TOP',
|
||||
JGL: 'JUNGLE',
|
||||
MID: 'MIDDLE',
|
||||
ADC: 'BOTTOM',
|
||||
SUP: 'UTILITY',
|
||||
};
|
||||
|
||||
const PLAYER_SEEDS: SeedPlayer[] = [
|
||||
{
|
||||
key: 'priri',
|
||||
@@ -635,7 +656,10 @@ function createRiotAccount(player: SeedPlayer) {
|
||||
tiers,
|
||||
tierHistory: [],
|
||||
matchIds: [],
|
||||
recentStatsSummary: player.recentStatsSummary,
|
||||
recentStatsSummary: createRecentStatsSummary(
|
||||
player.recentStatsSummary,
|
||||
player.main,
|
||||
),
|
||||
recentStatsFetchedAt: NOW,
|
||||
championMasteries: createChampionMasteries(puuid, player.masteries),
|
||||
championMasteriesFetchedAt: NOW,
|
||||
@@ -663,7 +687,8 @@ function createStaffRiotAccount(
|
||||
tiers: [createTier(puuid, 'RANKED_SOLO_5x5', 'GOLD', 'I', 75, 24, 19)],
|
||||
tierHistory: [],
|
||||
matchIds: [],
|
||||
recentStatsSummary: {
|
||||
recentStatsSummary: createRecentStatsSummary(
|
||||
{
|
||||
games: 12,
|
||||
wins: 7,
|
||||
losses: 5,
|
||||
@@ -672,7 +697,9 @@ function createStaffRiotAccount(
|
||||
avgAssists: 7.4,
|
||||
avgCs: 167,
|
||||
mostPlayedChampionIds: ['Orianna', 'JarvanIV'],
|
||||
},
|
||||
},
|
||||
'MID',
|
||||
),
|
||||
recentStatsFetchedAt: NOW,
|
||||
championMasteries: createChampionMasteries(puuid, [
|
||||
{
|
||||
@@ -708,6 +735,35 @@ function createChampionMasteries(
|
||||
}));
|
||||
}
|
||||
|
||||
function createRecentStatsSummary(
|
||||
input: SeedRecentStatsSummary,
|
||||
mainPosition: Position,
|
||||
): RiotRecentStatsSummary {
|
||||
const lane = POSITION_TO_RIOT_LANE[mainPosition];
|
||||
const championIds = input.mostPlayedChampionIds.map(
|
||||
(championId) => CHAMPION_IDS[championId] ?? 0,
|
||||
);
|
||||
const laneStats = {
|
||||
games: input.games,
|
||||
wins: input.wins,
|
||||
losses: input.losses,
|
||||
avgKills: input.avgKills,
|
||||
avgDeaths: input.avgDeaths,
|
||||
avgAssists: input.avgAssists,
|
||||
avgCs: input.avgCs,
|
||||
avgCsPerMin:
|
||||
input.avgCsPerMin ?? Math.round((input.avgCs / 28) * 10) / 10,
|
||||
mostPlayedChampionIds: championIds,
|
||||
};
|
||||
|
||||
return {
|
||||
overall: laneStats,
|
||||
byLane: {
|
||||
[lane]: laneStats,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function toMatchParticipant(user: {
|
||||
_id: mongoose.Types.ObjectId;
|
||||
riotAccounts: Array<{
|
||||
|
||||
Reference in new issue
Block a user