merge: 최신 main을 턴 입력기 연월 경계 수정에 통합한다
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { TRPCError } from '@trpc/server';
|
import { TRPCError } from '@trpc/server';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { LogCategory, LogScope } from '@sammo-ts/logic';
|
import { getBillByLevel, LogCategory, LogScope } from '@sammo-ts/logic';
|
||||||
import { asRecord, type RankDataType } from '@sammo-ts/common';
|
import { asRecord, type RankDataType } from '@sammo-ts/common';
|
||||||
|
|
||||||
import type { GameApiContext } from '../../context.js';
|
import type { GameApiContext } from '../../context.js';
|
||||||
@@ -526,6 +526,7 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
|
|||||||
injury: general.injury,
|
injury: general.injury,
|
||||||
experience: general.experience,
|
experience: general.experience,
|
||||||
dedication: general.dedication,
|
dedication: general.dedication,
|
||||||
|
bill: getBillByLevel(dedicationLevel),
|
||||||
age: general.age,
|
age: general.age,
|
||||||
retirementYear,
|
retirementYear,
|
||||||
turnTime: general.turnTime.toISOString(),
|
turnTime: general.turnTime.toISOString(),
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ export const lobbyRouter = router({
|
|||||||
preopenAt: worldState.meta.preopenAt ?? '',
|
preopenAt: worldState.meta.preopenAt ?? '',
|
||||||
turntime: worldState.meta.turntime ?? '',
|
turntime: worldState.meta.turntime ?? '',
|
||||||
serverTime: gameTime.now.toISOString(),
|
serverTime: gameTime.now.toISOString(),
|
||||||
|
serverWallTime: gameTime.wallNow.toISOString(),
|
||||||
clockMode: gameTime.mode ?? 'realtime',
|
clockMode: gameTime.mode ?? 'realtime',
|
||||||
|
clockRunning: gameTime.running,
|
||||||
|
clockStartsAt: gameTime.startsAt?.toISOString() ?? null,
|
||||||
otherTextInfo: worldState.meta.otherTextInfo ?? '',
|
otherTextInfo: worldState.meta.otherTextInfo ?? '',
|
||||||
npcMode: worldState.config.npcMode ?? 0,
|
npcMode: worldState.config.npcMode ?? 0,
|
||||||
defaultStatTotal: asNumber(asRecord(rawConfig.stat).total, 165),
|
defaultStatTotal: asNumber(asRecord(rawConfig.stat).total, 165),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { TRPCError } from '@trpc/server';
|
import { TRPCError } from '@trpc/server';
|
||||||
|
|
||||||
import { asRecord, type RankDataType } from '@sammo-ts/common';
|
import { asRecord, type RankDataType } from '@sammo-ts/common';
|
||||||
import { LogCategory } from '@sammo-ts/logic';
|
import { getBillByLevel, LogCategory } from '@sammo-ts/logic';
|
||||||
|
|
||||||
import { accessAuthedProcedure } from '../../../trpc.js';
|
import { accessAuthedProcedure } from '../../../trpc.js';
|
||||||
import {
|
import {
|
||||||
@@ -201,6 +201,7 @@ export const getBattleCenter = accessAuthedProcedure.query(async ({ ctx }) => {
|
|||||||
},
|
},
|
||||||
experience: general.experience,
|
experience: general.experience,
|
||||||
dedication: general.dedication,
|
dedication: general.dedication,
|
||||||
|
bill: getBillByLevel(dedicationLevel),
|
||||||
injury: general.injury,
|
injury: general.injury,
|
||||||
gold: general.gold,
|
gold: general.gold,
|
||||||
rice: general.rice,
|
rice: general.rice,
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export const troopRouter = router({
|
|||||||
troopLeaderIds.length === 0
|
troopLeaderIds.length === 0
|
||||||
? []
|
? []
|
||||||
: await ctx.db.generalTurn.findMany({
|
: await ctx.db.generalTurn.findMany({
|
||||||
where: { generalId: { in: troopLeaderIds } },
|
where: { generalId: { in: troopLeaderIds }, turnIdx: { lt: 5 } },
|
||||||
select: { generalId: true, turnIdx: true, actionCode: true },
|
select: { generalId: true, turnIdx: true, actionCode: true },
|
||||||
orderBy: [{ generalId: 'asc' }, { turnIdx: 'asc' }],
|
orderBy: [{ generalId: 'asc' }, { turnIdx: 'asc' }],
|
||||||
});
|
});
|
||||||
@@ -94,7 +94,8 @@ export const troopRouter = router({
|
|||||||
: 30;
|
: 30;
|
||||||
for (const turn of turns) {
|
for (const turn of turns) {
|
||||||
const list = reservedByLeader.get(turn.generalId) ?? [];
|
const list = reservedByLeader.get(turn.generalId) ?? [];
|
||||||
list.push(turn.actionCode);
|
// Ref 부대 편성은 앞쪽 슬롯이 집합인지 여부만 공개하고 다른 명령은 가립니다.
|
||||||
|
list.push(turn.actionCode === 'che_집합' ? '집합' : '-');
|
||||||
reservedByLeader.set(turn.generalId, list);
|
reservedByLeader.set(turn.generalId, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,25 @@ import type { DatabaseClient } from '../context.js';
|
|||||||
|
|
||||||
export interface CurrentGameTime {
|
export interface CurrentGameTime {
|
||||||
now: Date;
|
now: Date;
|
||||||
|
wallNow: Date;
|
||||||
tick: number | null;
|
tick: number | null;
|
||||||
mode: GameClockMode | null;
|
mode: GameClockMode | null;
|
||||||
|
running: boolean;
|
||||||
|
startsAt: Date | null;
|
||||||
dateToTick(date: Date): number | null;
|
dateToTick(date: Date): number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const loadCurrentGameTime = async (db: DatabaseClient, wallNow = new Date()): Promise<CurrentGameTime> => {
|
export const loadCurrentGameTime = async (db: DatabaseClient, wallNow = new Date()): Promise<CurrentGameTime> => {
|
||||||
if (!db.worldState) {
|
if (!db.worldState) {
|
||||||
return { now: wallNow, tick: null, mode: null, dateToTick: () => null };
|
return {
|
||||||
|
now: wallNow,
|
||||||
|
wallNow,
|
||||||
|
tick: null,
|
||||||
|
mode: null,
|
||||||
|
running: true,
|
||||||
|
startsAt: null,
|
||||||
|
dateToTick: () => null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const state = await db.worldState.findFirst({
|
const state = await db.worldState.findFirst({
|
||||||
orderBy: { id: 'asc' },
|
orderBy: { id: 'asc' },
|
||||||
@@ -24,7 +35,15 @@ export const loadCurrentGameTime = async (db: DatabaseClient, wallNow = new Date
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!state?.clockBaseTime || state.clockTick === null || !state.clockWallAnchor) {
|
if (!state?.clockBaseTime || state.clockTick === null || !state.clockWallAnchor) {
|
||||||
return { now: wallNow, tick: null, mode: null, dateToTick: () => null };
|
return {
|
||||||
|
now: wallNow,
|
||||||
|
wallNow,
|
||||||
|
tick: null,
|
||||||
|
mode: null,
|
||||||
|
running: true,
|
||||||
|
startsAt: null,
|
||||||
|
dateToTick: () => null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
const mode: GameClockMode = state.clockMode === 'manual' ? 'manual' : 'realtime';
|
const mode: GameClockMode = state.clockMode === 'manual' ? 'manual' : 'realtime';
|
||||||
const storedTick = Number(state.clockTick);
|
const storedTick = Number(state.clockTick);
|
||||||
@@ -39,10 +58,14 @@ export const loadCurrentGameTime = async (db: DatabaseClient, wallNow = new Date
|
|||||||
turnSeconds: state.tickSeconds,
|
turnSeconds: state.tickSeconds,
|
||||||
});
|
});
|
||||||
const tick = clock.nowTick(wallNow);
|
const tick = clock.nowTick(wallNow);
|
||||||
|
const running = mode === 'realtime' && wallNow.getTime() >= state.clockWallAnchor.getTime();
|
||||||
return {
|
return {
|
||||||
now: clock.tickToDate(tick),
|
now: clock.tickToDate(tick),
|
||||||
|
wallNow,
|
||||||
tick,
|
tick,
|
||||||
mode,
|
mode,
|
||||||
|
running,
|
||||||
|
startsAt: mode === 'realtime' && !running ? state.clockWallAnchor : null,
|
||||||
dateToTick: (date) => clock.dateToTick(date),
|
dateToTick: (date) => clock.dateToTick(date),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -57,8 +57,11 @@ describe('auction worker clock-shift race', () => {
|
|||||||
const now = new Date('2026-07-30T12:00:00.000Z');
|
const now = new Date('2026-07-30T12:00:00.000Z');
|
||||||
const time = {
|
const time = {
|
||||||
now,
|
now,
|
||||||
|
wallNow: now,
|
||||||
tick: 36_000_000,
|
tick: 36_000_000,
|
||||||
mode: 'manual' as const,
|
mode: 'manual' as const,
|
||||||
|
running: false,
|
||||||
|
startsAt: null,
|
||||||
dateToTick: () => 72_000_000,
|
dateToTick: () => 72_000_000,
|
||||||
};
|
};
|
||||||
const closeAt = new Date('2099-01-01T00:00:00.000Z');
|
const closeAt = new Date('2099-01-01T00:00:00.000Z');
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
|
|
||||||
|
import type { DatabaseClient } from '../src/context.js';
|
||||||
|
import { loadCurrentGameTime } from '../src/services/gameClock.js';
|
||||||
|
|
||||||
|
const buildDatabase = (mode: 'realtime' | 'manual' = 'realtime'): DatabaseClient =>
|
||||||
|
({
|
||||||
|
worldState: {
|
||||||
|
findFirst: vi.fn(async () => ({
|
||||||
|
clockBaseTime: new Date('2026-08-21T09:50:00.000Z'),
|
||||||
|
clockTick: 36_000_000n,
|
||||||
|
clockMode: mode,
|
||||||
|
clockWallAnchor: new Date('2026-08-21T11:00:00.000Z'),
|
||||||
|
tickSeconds: 600,
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
}) as unknown as DatabaseClient;
|
||||||
|
|
||||||
|
describe('current game time projection', () => {
|
||||||
|
it('holds a realtime clock at its persisted tick until the future wall anchor', async () => {
|
||||||
|
const db = buildDatabase();
|
||||||
|
|
||||||
|
const preopen = await loadCurrentGameTime(db, new Date('2026-08-21T10:30:00.000Z'));
|
||||||
|
expect(preopen).toMatchObject({
|
||||||
|
now: new Date('2026-08-21T10:00:00.000Z'),
|
||||||
|
wallNow: new Date('2026-08-21T10:30:00.000Z'),
|
||||||
|
tick: 36_000_000,
|
||||||
|
mode: 'realtime',
|
||||||
|
running: false,
|
||||||
|
startsAt: new Date('2026-08-21T11:00:00.000Z'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const opened = await loadCurrentGameTime(db, new Date('2026-08-21T11:00:05.000Z'));
|
||||||
|
expect(opened).toMatchObject({
|
||||||
|
now: new Date('2026-08-21T10:00:05.000Z'),
|
||||||
|
tick: 36_300_000,
|
||||||
|
running: true,
|
||||||
|
startsAt: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps a manual clock stopped without scheduling an automatic start', async () => {
|
||||||
|
const result = await loadCurrentGameTime(buildDatabase('manual'), new Date('2026-08-21T12:00:00.000Z'));
|
||||||
|
|
||||||
|
expect(result).toMatchObject({
|
||||||
|
now: new Date('2026-08-21T10:00:00.000Z'),
|
||||||
|
tick: 36_000_000,
|
||||||
|
running: false,
|
||||||
|
startsAt: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -297,6 +297,7 @@ describe('in-game my information ownership', () => {
|
|||||||
statUpgradeLimit: 20,
|
statUpgradeLimit: 20,
|
||||||
dex: [350, 1_375, 3_500, 7_125, 12_650],
|
dex: [350, 1_375, 3_500, 7_125, 12_650],
|
||||||
},
|
},
|
||||||
|
bill: 1_000,
|
||||||
},
|
},
|
||||||
city: {
|
city: {
|
||||||
population: 322_886,
|
population: 322_886,
|
||||||
@@ -433,6 +434,7 @@ describe('in-game my information ownership', () => {
|
|||||||
stats: { attack: 100, defence: 150, speed: 7, avoid: 10, magicCoef: 0, cost: 9, rice: 9 },
|
stats: { attack: 100, defence: 150, speed: 7, avoid: 10, magicCoef: 0, cost: 9, rice: 9 },
|
||||||
},
|
},
|
||||||
progression: { experienceLevel: 4, dedicationLevel: 2, dedicationText: '29품관' },
|
progression: { experienceLevel: 4, dedicationLevel: 2, dedicationText: '29품관' },
|
||||||
|
bill: 800,
|
||||||
itemNames: { horse: '노새(+3)' },
|
itemNames: { horse: '노새(+3)' },
|
||||||
itemInfo: { horse: '통솔 +3' },
|
itemInfo: { horse: '통솔 +3' },
|
||||||
},
|
},
|
||||||
@@ -855,6 +857,7 @@ describe('battle-center general and user permissions', () => {
|
|||||||
statUpgradeLimit: 20,
|
statUpgradeLimit: 20,
|
||||||
dex: [0, 0, 0, 0, 0],
|
dex: [0, 0, 0, 0, 0],
|
||||||
},
|
},
|
||||||
|
bill: 600,
|
||||||
serviceYears: 3,
|
serviceYears: 3,
|
||||||
battleStats: {
|
battleStats: {
|
||||||
kills: 5,
|
kills: 5,
|
||||||
|
|||||||
@@ -68,6 +68,32 @@ describe('lobby season state', () => {
|
|||||||
|
|
||||||
expect(result.serverTime).toBe('2026-08-15T02:00:00.000Z');
|
expect(result.serverTime).toBe('2026-08-15T02:00:00.000Z');
|
||||||
expect(result.clockMode).toBe('manual');
|
expect(result.clockMode).toBe('manual');
|
||||||
|
expect(result.clockRunning).toBe(false);
|
||||||
|
expect(result.clockStartsAt).toBeNull();
|
||||||
|
expect(new Date(result.serverWallTime).getTime()).not.toBeNaN();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('exposes the future realtime wall anchor without advancing the preopen clock', async () => {
|
||||||
|
const wallAnchor = new Date('2099-08-21T11:00:00.000Z');
|
||||||
|
const result = await appRouter
|
||||||
|
.createCaller(
|
||||||
|
buildContext(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
baseTime: new Date('2026-08-21T09:00:00.000Z'),
|
||||||
|
tick: 36_000_000n,
|
||||||
|
mode: 'realtime',
|
||||||
|
wallAnchor,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.lobby.info();
|
||||||
|
|
||||||
|
expect(result.serverTime).toBe('2026-08-21T10:00:00.000Z');
|
||||||
|
expect(result.clockMode).toBe('realtime');
|
||||||
|
expect(result.clockRunning).toBe(false);
|
||||||
|
expect(result.clockStartsAt).toBe(wallAnchor.toISOString());
|
||||||
|
expect(new Date(result.serverWallTime).getTime()).toBeLessThan(wallAnchor.getTime());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('preserves zero as the first official game index', async () => {
|
it('preserves zero as the first official game index', async () => {
|
||||||
|
|||||||
@@ -77,10 +77,12 @@ const buildContext = (options: {
|
|||||||
auth?: GameSessionTokenPayload | null;
|
auth?: GameSessionTokenPayload | null;
|
||||||
requestId?: string;
|
requestId?: string;
|
||||||
transaction?: ReturnType<typeof vi.fn>;
|
transaction?: ReturnType<typeof vi.fn>;
|
||||||
|
turns?: Array<{ generalId: number; turnIdx: number; actionCode: string }>;
|
||||||
result: Awaited<ReturnType<TurnDaemonTransport['requestCommand']>>;
|
result: Awaited<ReturnType<TurnDaemonTransport['requestCommand']>>;
|
||||||
}) => {
|
}) => {
|
||||||
const me = options.me ?? buildGeneral();
|
const me = options.me ?? buildGeneral();
|
||||||
const requestCommand = vi.fn(async () => options.result);
|
const requestCommand = vi.fn(async () => options.result);
|
||||||
|
const generalTurnFindMany = vi.fn(async () => options.turns ?? []);
|
||||||
const db = {
|
const db = {
|
||||||
...(options.transaction ? { $transaction: options.transaction } : {}),
|
...(options.transaction ? { $transaction: options.transaction } : {}),
|
||||||
general: {
|
general: {
|
||||||
@@ -110,7 +112,7 @@ const buildContext = (options: {
|
|||||||
},
|
},
|
||||||
city: { findMany: vi.fn(async () => [{ id: 1, name: '북평' }]) },
|
city: { findMany: vi.fn(async () => [{ id: 1, name: '북평' }]) },
|
||||||
worldState: { findFirst: vi.fn(async () => ({ config: { const: { upgradeLimit: 20 } } })) },
|
worldState: { findFirst: vi.fn(async () => ({ config: { const: { upgradeLimit: 20 } } })) },
|
||||||
generalTurn: { findMany: vi.fn(async () => []) },
|
generalTurn: { findMany: generalTurnFindMany },
|
||||||
};
|
};
|
||||||
const accessTokenStore = new RedisAccessTokenStore(
|
const accessTokenStore = new RedisAccessTokenStore(
|
||||||
{
|
{
|
||||||
@@ -134,7 +136,7 @@ const buildContext = (options: {
|
|||||||
flushStore: new InMemoryFlushStore(),
|
flushStore: new InMemoryFlushStore(),
|
||||||
gameTokenSecret: 'test-secret',
|
gameTokenSecret: 'test-secret',
|
||||||
};
|
};
|
||||||
return { context, requestCommand };
|
return { context, requestCommand, generalTurnFindMany };
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('troop router permissions and mutations', () => {
|
describe('troop router permissions and mutations', () => {
|
||||||
@@ -175,6 +177,30 @@ describe('troop router permissions and mutations', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns only the first five Ref-redacted troop command labels without exposing action codes', async () => {
|
||||||
|
const fixture = buildContext({
|
||||||
|
me: buildGeneral({ troopId: 1 }),
|
||||||
|
turns: [
|
||||||
|
{ generalId: 1, turnIdx: 0, actionCode: 'che_집합' },
|
||||||
|
{ generalId: 1, turnIdx: 1, actionCode: 'che_이동' },
|
||||||
|
{ generalId: 1, turnIdx: 2, actionCode: 'che_징병' },
|
||||||
|
{ generalId: 1, turnIdx: 3, actionCode: '휴식' },
|
||||||
|
{ generalId: 1, turnIdx: 4, actionCode: 'che_화계' },
|
||||||
|
],
|
||||||
|
result: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await appRouter.createCaller(fixture.context).troop.getList();
|
||||||
|
|
||||||
|
expect(result.troops[0]?.reservedCommands).toEqual(['집합', '-', '-', '-', '-']);
|
||||||
|
expect(JSON.stringify(result.troops)).not.toContain('che_');
|
||||||
|
expect(fixture.generalTurnFindMany).toHaveBeenCalledWith({
|
||||||
|
where: { generalId: { in: [1] }, turnIdx: { lt: 5 } },
|
||||||
|
select: { generalId: true, turnIdx: true, actionCode: true },
|
||||||
|
orderBy: [{ generalId: 'asc' }, { turnIdx: 'asc' }],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('creates a troop only for the general owned by the authenticated user', async () => {
|
it('creates a troop only for the general owned by the authenticated user', async () => {
|
||||||
const { context, requestCommand } = buildContext({
|
const { context, requestCommand } = buildContext({
|
||||||
result: { type: 'troopCreate', ok: true, generalId: 1, troopId: 1, troopName: '백마대' },
|
result: { type: 'troopCreate', ok: true, generalId: 1, troopId: 1, troopName: '백마대' },
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export interface ScenarioInstallOptions {
|
|||||||
joinMode?: 'full' | 'onlyRandom';
|
joinMode?: 'full' | 'onlyRandom';
|
||||||
autorunUser?: ScenarioAutorunOptions | null;
|
autorunUser?: ScenarioAutorunOptions | null;
|
||||||
preopenAt?: Date | null;
|
preopenAt?: Date | null;
|
||||||
|
openAt?: Date | null;
|
||||||
season?: number;
|
season?: number;
|
||||||
firstGameIdx?: number;
|
firstGameIdx?: number;
|
||||||
serverId?: string;
|
serverId?: string;
|
||||||
@@ -229,11 +230,14 @@ export const seedScenarioToDatabase = async (options: ScenarioSeedOptions): Prom
|
|||||||
const sync = install?.sync ?? false;
|
const sync = install?.sync ?? false;
|
||||||
const startState = resolveStartState(scenario.startYear ?? null, now, turnTermMinutes, sync);
|
const startState = resolveStartState(scenario.startYear ?? null, now, turnTermMinutes, sync);
|
||||||
const gameClockMode = options.gameClockMode ?? 'realtime';
|
const gameClockMode = options.gameClockMode ?? 'realtime';
|
||||||
|
// A realtime season prepared before its formal opening must not consume
|
||||||
|
// wall time while users are only allowed to edit reserved commands.
|
||||||
|
const initialClockWallAnchor = install?.openAt && install.openAt.getTime() > now.getTime() ? install.openAt : now;
|
||||||
const initialClock = new GameClock({
|
const initialClock = new GameClock({
|
||||||
baseTime: startState.startTime,
|
baseTime: startState.startTime,
|
||||||
tick: 0,
|
tick: 0,
|
||||||
mode: gameClockMode,
|
mode: gameClockMode,
|
||||||
wallAnchor: now,
|
wallAnchor: initialClockWallAnchor,
|
||||||
turnSeconds: tickSeconds,
|
turnSeconds: tickSeconds,
|
||||||
});
|
});
|
||||||
const initialClockTick = initialClock.dateToTick(now);
|
const initialClockTick = initialClock.dateToTick(now);
|
||||||
@@ -410,7 +414,7 @@ export const seedScenarioToDatabase = async (options: ScenarioSeedOptions): Prom
|
|||||||
clockBaseTime: initialClock.baseTime,
|
clockBaseTime: initialClock.baseTime,
|
||||||
clockTick: BigInt(initialClockTick),
|
clockTick: BigInt(initialClockTick),
|
||||||
clockMode: gameClockMode,
|
clockMode: gameClockMode,
|
||||||
clockWallAnchor: now,
|
clockWallAnchor: initialClock.wallAnchor,
|
||||||
lastTurnTick: BigInt(initialClockTick),
|
lastTurnTick: BigInt(initialClockTick),
|
||||||
config: asJson({ ...scenarioConfig, ...worldConfig }),
|
config: asJson({ ...scenarioConfig, ...worldConfig }),
|
||||||
meta: asJson(worldMeta),
|
meta: asJson(worldMeta),
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ type ScenarioSeederPrismaClient = {
|
|||||||
tickSeconds: number;
|
tickSeconds: number;
|
||||||
currentYear: number;
|
currentYear: number;
|
||||||
currentMonth: number;
|
currentMonth: number;
|
||||||
|
clockWallAnchor: Date | null;
|
||||||
} | null>;
|
} | null>;
|
||||||
};
|
};
|
||||||
gameHistory: {
|
gameHistory: {
|
||||||
@@ -364,6 +365,8 @@ describeDb('scenario database seed', () => {
|
|||||||
develop: true,
|
develop: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
preopenAt: new Date('2030-01-01T01:00:00Z'),
|
||||||
|
openAt: new Date('2030-01-01T02:00:00Z'),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -385,6 +388,7 @@ describeDb('scenario database seed', () => {
|
|||||||
}
|
}
|
||||||
expect(worldState.tickSeconds).toBe(180);
|
expect(worldState.tickSeconds).toBe(180);
|
||||||
expect(worldState.currentMonth).toBe(1);
|
expect(worldState.currentMonth).toBe(1);
|
||||||
|
expect(worldState.clockWallAnchor).toEqual(new Date('2030-01-01T02:00:00.000Z'));
|
||||||
|
|
||||||
const config = (worldState.config ?? {}) as Record<string, unknown>;
|
const config = (worldState.config ?? {}) as Record<string, unknown>;
|
||||||
expect(config.extendedGeneral).toBe(false);
|
expect(config.extendedGeneral).toBe(false);
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ const myGeneral = (state: FixtureState) => ({
|
|||||||
injury: 0,
|
injury: 0,
|
||||||
experience: 100,
|
experience: 100,
|
||||||
dedication: 200,
|
dedication: 200,
|
||||||
|
bill: 800,
|
||||||
age: 30,
|
age: 30,
|
||||||
turnTime: '2026-01-01 00:10:00',
|
turnTime: '2026-01-01 00:10:00',
|
||||||
recentWar: '2026-01-01 00:00:00',
|
recentWar: '2026-01-01 00:00:00',
|
||||||
@@ -296,6 +297,7 @@ const battleCenter = (state: FixtureState) => ({
|
|||||||
stats: { leadership: 70, strength: 60, intelligence: 50 },
|
stats: { leadership: 70, strength: 60, intelligence: 50 },
|
||||||
experience: 100,
|
experience: 100,
|
||||||
dedication: 200,
|
dedication: 200,
|
||||||
|
bill: 800,
|
||||||
injury: 0,
|
injury: 0,
|
||||||
gold: 1_000,
|
gold: 1_000,
|
||||||
rice: 2_000,
|
rice: 2_000,
|
||||||
@@ -334,6 +336,7 @@ const battleCenter = (state: FixtureState) => ({
|
|||||||
stats: { leadership: 50, strength: 50, intelligence: 50 },
|
stats: { leadership: 50, strength: 50, intelligence: 50 },
|
||||||
experience: 0,
|
experience: 0,
|
||||||
dedication: 0,
|
dedication: 0,
|
||||||
|
bill: 400,
|
||||||
injury: 0,
|
injury: 0,
|
||||||
gold: 500,
|
gold: 500,
|
||||||
rice: 500,
|
rice: 500,
|
||||||
@@ -1245,6 +1248,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
|
|||||||
await expect(page.locator('.general-table')).toContainText('병종보병');
|
await expect(page.locator('.general-table')).toContainText('병종보병');
|
||||||
await expect(page.locator('.general-table')).toContainText('삭턴6 턴');
|
await expect(page.locator('.general-table')).toContainText('삭턴6 턴');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
||||||
|
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('전투8회');
|
await expect(page.locator('.battle-general-extra')).toContainText('전투8회');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('계략12');
|
await expect(page.locator('.battle-general-extra')).toContainText('계략12');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('사관4년');
|
await expect(page.locator('.battle-general-extra')).toContainText('사관4년');
|
||||||
@@ -1255,7 +1259,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
|
|||||||
await expect(page.locator('.battle-general-extra__recent-value')).toHaveText('01-01 00:00');
|
await expect(page.locator('.battle-general-extra__recent-value')).toHaveText('01-01 00:00');
|
||||||
await expect(page.locator('.legacy-general-details')).toHaveCount(0);
|
await expect(page.locator('.legacy-general-details')).toHaveCount(0);
|
||||||
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
||||||
['명성', '계급', ''],
|
['명성', '계급', '봉급'],
|
||||||
['전투', '계략', '사관'],
|
['전투', '계략', '사관'],
|
||||||
['승률', '승리', '패배'],
|
['승률', '승리', '패배'],
|
||||||
['살상률', '사살', '피살'],
|
['살상률', '사살', '피살'],
|
||||||
@@ -2039,6 +2043,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
|
|||||||
await expect(page.locator('.battle-general-name')).toContainText('간의대부');
|
await expect(page.locator('.battle-general-name')).toContainText('간의대부');
|
||||||
await expect(page.locator('.battle-general-name')).toContainText('건강');
|
await expect(page.locator('.battle-general-name')).toContainText('건강');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
||||||
|
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
|
||||||
await expect(page.locator('.battle-general-card')).toContainText('병종보병');
|
await expect(page.locator('.battle-general-card')).toContainText('병종보병');
|
||||||
await expect(page.locator('.battle-general-card')).not.toContainText('che_');
|
await expect(page.locator('.battle-general-card')).not.toContainText('che_');
|
||||||
await expect(page.locator('.battle-general-card')).toHaveAttribute('data-general-basic-card', '');
|
await expect(page.locator('.battle-general-card')).toHaveAttribute('data-general-basic-card', '');
|
||||||
@@ -2049,7 +2054,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
|
|||||||
await expect(page.locator('.battle-general-extra')).toContainText('승률62.50%');
|
await expect(page.locator('.battle-general-extra')).toContainText('승률62.50%');
|
||||||
await expect(page.locator('.battle-general-extra')).toContainText('살상률181.84%');
|
await expect(page.locator('.battle-general-extra')).toContainText('살상률181.84%');
|
||||||
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
||||||
['명성', '계급', ''],
|
['명성', '계급', '봉급'],
|
||||||
['전투', '계략', '사관'],
|
['전투', '계략', '사관'],
|
||||||
['승률', '승리', '패배'],
|
['승률', '승리', '패배'],
|
||||||
['살상률', '사살', '피살'],
|
['살상률', '사살', '피살'],
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ type NavigationFixture = {
|
|||||||
generalTurnTime?: string;
|
generalTurnTime?: string;
|
||||||
nextTurnMonthOffset?: 0 | 1;
|
nextTurnMonthOffset?: 0 | 1;
|
||||||
serverTime?: string;
|
serverTime?: string;
|
||||||
|
serverWallTime?: string;
|
||||||
clockMode?: 'realtime' | 'manual';
|
clockMode?: 'realtime' | 'manual';
|
||||||
|
clockRunning?: boolean;
|
||||||
|
clockStartsAt?: string | null;
|
||||||
cityDefence?: number;
|
cityDefence?: number;
|
||||||
cityState?: number;
|
cityState?: number;
|
||||||
nationRate?: number;
|
nationRate?: number;
|
||||||
@@ -589,7 +592,10 @@ const installFixture = async (page: Page, state: NavigationFixture) => {
|
|||||||
month: state.currentMonth ?? 1,
|
month: state.currentMonth ?? 1,
|
||||||
turnTerm: 10,
|
turnTerm: 10,
|
||||||
serverTime: state.serverTime ?? '2026-08-13T00:00:00.000Z',
|
serverTime: state.serverTime ?? '2026-08-13T00:00:00.000Z',
|
||||||
|
serverWallTime: state.serverWallTime ?? '2026-08-13T00:00:00.000Z',
|
||||||
clockMode: state.clockMode ?? 'realtime',
|
clockMode: state.clockMode ?? 'realtime',
|
||||||
|
clockRunning: state.clockRunning ?? true,
|
||||||
|
clockStartsAt: state.clockStartsAt ?? null,
|
||||||
scenarioTitle: state.scenarioTitle ?? '',
|
scenarioTitle: state.scenarioTitle ?? '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1844,12 +1850,48 @@ test('main general card uses local turn time and command clock tracks corrected
|
|||||||
}
|
}
|
||||||
|
|
||||||
state.clockMode = 'manual';
|
state.clockMode = 'manual';
|
||||||
|
state.clockRunning = false;
|
||||||
state.serverTime = '2026-08-13T00:08:30.000Z';
|
state.serverTime = '2026-08-13T00:08:30.000Z';
|
||||||
await page.reload();
|
await page.reload();
|
||||||
const frozenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
|
const frozenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
|
||||||
await expect(frozenClock).toHaveText('09:08:30');
|
await expect(frozenClock).toHaveText('09:08:30');
|
||||||
await page.clock.runFor(2_000);
|
await page.clock.runFor(2_000);
|
||||||
await expect(frozenClock).toHaveText('09:08:30');
|
await expect(frozenClock).toHaveText('09:08:30');
|
||||||
|
|
||||||
|
state.clockMode = 'realtime';
|
||||||
|
state.clockRunning = false;
|
||||||
|
state.serverTime = '2026-08-13T00:10:00.000Z';
|
||||||
|
state.serverWallTime = '2026-08-21T10:00:00.000Z';
|
||||||
|
state.clockStartsAt = '2026-08-21T10:00:02.000Z';
|
||||||
|
await page.reload();
|
||||||
|
const preopenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
|
||||||
|
await expect(preopenClock).toHaveText('09:10:00');
|
||||||
|
const operationsBeforePreopenBoundary = state.operations.length;
|
||||||
|
await page.clock.runFor(1_500);
|
||||||
|
await expect(preopenClock).toHaveText('09:10:00');
|
||||||
|
if (artifactRoot) {
|
||||||
|
const preopenGeometry = await preopenClock.evaluate((element) => ({
|
||||||
|
rect: element.getBoundingClientRect().toJSON(),
|
||||||
|
overflow: element.scrollWidth - element.clientWidth,
|
||||||
|
fontSize: getComputedStyle(element).fontSize,
|
||||||
|
lineHeight: getComputedStyle(element).lineHeight,
|
||||||
|
value: element.textContent,
|
||||||
|
}));
|
||||||
|
expect(preopenGeometry.overflow).toBeLessThanOrEqual(0);
|
||||||
|
await Promise.all([
|
||||||
|
page.screenshot({
|
||||||
|
path: resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.png'),
|
||||||
|
fullPage: true,
|
||||||
|
}),
|
||||||
|
writeFile(
|
||||||
|
resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.json'),
|
||||||
|
`${JSON.stringify(preopenGeometry, null, 2)}\n`
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
await page.clock.runFor(1_500);
|
||||||
|
await expect(preopenClock).toHaveText('09:10:01');
|
||||||
|
expect(state.operations).toHaveLength(operationsBeforePreopenBoundary);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('message targets keep reply behavior and use nation-color contrast in labels and select options', async ({
|
test('message targets keep reply behavior and use nation-color contrast in labels and select options', async ({
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const baseTroops = (): TroopFixture[] => [
|
|||||||
name: '백마대',
|
name: '백마대',
|
||||||
nationId: 1,
|
nationId: 1,
|
||||||
turnTime: '2026-07-25T08:20:30.000Z',
|
turnTime: '2026-07-25T08:20:30.000Z',
|
||||||
reservedCommands: ['che_집합', 'che_이동'],
|
reservedCommands: ['집합', '-'],
|
||||||
leader: {
|
leader: {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '공손찬',
|
name: '공손찬',
|
||||||
@@ -96,7 +96,7 @@ const baseTroops = (): TroopFixture[] => [
|
|||||||
name: '청룡대',
|
name: '청룡대',
|
||||||
nationId: 1,
|
nationId: 1,
|
||||||
turnTime: '2026-07-25T08:30:30.000Z',
|
turnTime: '2026-07-25T08:30:30.000Z',
|
||||||
reservedCommands: ['che_징병'],
|
reservedCommands: ['-'],
|
||||||
leader: {
|
leader: {
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '관우',
|
name: '관우',
|
||||||
@@ -224,6 +224,27 @@ const installApiFixture = async (page: Page, state: FixtureState) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
test('shows only the Ref-safe first-five troop command labels on desktop and mobile', async ({ page }) => {
|
||||||
|
await installApiFixture(page, {
|
||||||
|
me: { id: 1, troopId: 1 },
|
||||||
|
permission: 4,
|
||||||
|
troops: baseTroops(),
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const viewport of [
|
||||||
|
{ width: 1000, height: 800 },
|
||||||
|
{ width: 500, height: 800 },
|
||||||
|
]) {
|
||||||
|
await page.setViewportSize(viewport);
|
||||||
|
await gotoTroop(page);
|
||||||
|
|
||||||
|
const firstTroopCommands = page.locator('.troopReservedCommand').first();
|
||||||
|
await expect(firstTroopCommands).toContainText('1: 집합');
|
||||||
|
await expect(firstTroopCommands).toContainText('2: -');
|
||||||
|
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('renders the legacy desktop grid with matching computed geometry and states', async ({ page }) => {
|
test('renders the legacy desktop grid with matching computed geometry and states', async ({ page }) => {
|
||||||
await installApiFixture(page, {
|
await installApiFixture(page, {
|
||||||
me: { id: 1, troopId: 1 },
|
me: { id: 1, troopId: 1 },
|
||||||
@@ -233,6 +254,9 @@ test('renders the legacy desktop grid with matching computed geometry and states
|
|||||||
await page.setViewportSize({ width: 1000, height: 800 });
|
await page.setViewportSize({ width: 1000, height: 800 });
|
||||||
await gotoTroop(page);
|
await gotoTroop(page);
|
||||||
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
||||||
|
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
|
||||||
|
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
|
||||||
|
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||||
|
|
||||||
const geometry = await page
|
const geometry = await page
|
||||||
.locator('.troopItem')
|
.locator('.troopItem')
|
||||||
@@ -319,6 +343,9 @@ test('matches the legacy 500px responsive placement', async ({ page }) => {
|
|||||||
await page.setViewportSize({ width: 500, height: 800 });
|
await page.setViewportSize({ width: 500, height: 800 });
|
||||||
await gotoTroop(page);
|
await gotoTroop(page);
|
||||||
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
||||||
|
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
|
||||||
|
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
|
||||||
|
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||||
|
|
||||||
const geometry = await page
|
const geometry = await page
|
||||||
.locator('.troopItem')
|
.locator('.troopItem')
|
||||||
|
|||||||
@@ -20,7 +20,10 @@ const props = defineProps<{
|
|||||||
currentMonth?: number;
|
currentMonth?: number;
|
||||||
turnTermMinutes?: number;
|
turnTermMinutes?: number;
|
||||||
serverTime?: string;
|
serverTime?: string;
|
||||||
|
serverWallTime?: string;
|
||||||
clockMode?: 'realtime' | 'manual';
|
clockMode?: 'realtime' | 'manual';
|
||||||
|
clockRunning?: boolean;
|
||||||
|
clockStartsAt?: string | null;
|
||||||
autorunLimit?: number | null;
|
autorunLimit?: number | null;
|
||||||
storageKey?: string;
|
storageKey?: string;
|
||||||
mapData?: CommandMapData | null;
|
mapData?: CommandMapData | null;
|
||||||
@@ -90,8 +93,10 @@ const autonomousUntil = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const currentServerTime = ref('--:--:--');
|
const currentServerTime = ref('--:--:--');
|
||||||
|
const MAX_SERVER_CLOCK_TIMER_DELAY_MS = 60_000;
|
||||||
let sampledServerTimeMs: number | null = null;
|
let sampledServerTimeMs: number | null = null;
|
||||||
let sampledClientTimeMs = 0;
|
let sampledClientTimeMs = 0;
|
||||||
|
let sampledStartDelayMs: number | null = 0;
|
||||||
let serverClockTimer: ReturnType<typeof setTimeout> | undefined;
|
let serverClockTimer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
|
||||||
const updateServerClock = () => {
|
const updateServerClock = () => {
|
||||||
@@ -101,21 +106,42 @@ const updateServerClock = () => {
|
|||||||
currentServerTime.value = '--:--:--';
|
currentServerTime.value = '--:--:--';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const projectedTime = new Date(
|
const clientElapsedMs = Math.max(0, Date.now() - sampledClientTimeMs);
|
||||||
props.clockMode === 'manual' ? sampledServerTimeMs : sampledServerTimeMs + Date.now() - sampledClientTimeMs
|
const elapsedGameMs =
|
||||||
);
|
props.clockMode === 'manual' || sampledStartDelayMs === null
|
||||||
|
? 0
|
||||||
|
: Math.max(0, clientElapsedMs - sampledStartDelayMs);
|
||||||
|
const projectedTime = new Date(sampledServerTimeMs + elapsedGameMs);
|
||||||
currentServerTime.value = formatLocalTimeSeconds(projectedTime);
|
currentServerTime.value = formatLocalTimeSeconds(projectedTime);
|
||||||
if (props.clockMode !== 'manual') {
|
if (props.clockMode !== 'manual' && sampledStartDelayMs !== null) {
|
||||||
serverClockTimer = setTimeout(updateServerClock, 1_000 - projectedTime.getMilliseconds());
|
const untilStartMs = sampledStartDelayMs - clientElapsedMs;
|
||||||
|
serverClockTimer = setTimeout(
|
||||||
|
updateServerClock,
|
||||||
|
untilStartMs > 0
|
||||||
|
? Math.min(untilStartMs, MAX_SERVER_CLOCK_TIMER_DELAY_MS)
|
||||||
|
: 1_000 - projectedTime.getMilliseconds()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => [props.serverTime, props.clockMode] as const,
|
() => [props.serverTime, props.serverWallTime, props.clockMode, props.clockRunning, props.clockStartsAt] as const,
|
||||||
([serverTime]) => {
|
([serverTime, serverWallTime, clockMode, clockRunning, clockStartsAt]) => {
|
||||||
const parsed = serverTime ? new Date(serverTime).getTime() : Number.NaN;
|
const parsed = serverTime ? new Date(serverTime).getTime() : Number.NaN;
|
||||||
sampledServerTimeMs = Number.isFinite(parsed) ? parsed : null;
|
sampledServerTimeMs = Number.isFinite(parsed) ? parsed : null;
|
||||||
sampledClientTimeMs = Date.now();
|
sampledClientTimeMs = Date.now();
|
||||||
|
if (clockMode === 'manual') {
|
||||||
|
sampledStartDelayMs = null;
|
||||||
|
} else if (clockRunning !== false) {
|
||||||
|
sampledStartDelayMs = 0;
|
||||||
|
} else {
|
||||||
|
const wallTimeMs = serverWallTime ? new Date(serverWallTime).getTime() : Number.NaN;
|
||||||
|
const startsAtMs = clockStartsAt ? new Date(clockStartsAt).getTime() : Number.NaN;
|
||||||
|
sampledStartDelayMs =
|
||||||
|
Number.isFinite(wallTimeMs) && Number.isFinite(startsAtMs)
|
||||||
|
? Math.max(0, startsAtMs - wallTimeMs)
|
||||||
|
: null;
|
||||||
|
}
|
||||||
updateServerClock();
|
updateServerClock();
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export type GeneralBattleSummaryData = {
|
|||||||
available?: boolean;
|
available?: boolean;
|
||||||
experience?: number | null;
|
experience?: number | null;
|
||||||
dedicationText?: string | null;
|
dedicationText?: string | null;
|
||||||
|
bill?: number | null;
|
||||||
warnum?: number | null;
|
warnum?: number | null;
|
||||||
wins?: number | null;
|
wins?: number | null;
|
||||||
losses?: number | null;
|
losses?: number | null;
|
||||||
@@ -62,8 +63,13 @@ const killRate = computed(() => {
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<span>명성</span><strong>{{ numberText(summary.experience) }}</strong> <span>계급</span
|
<span>명성</span><strong>{{ numberText(summary.experience) }}</strong> <span>계급</span
|
||||||
><strong>{{ summary.dedicationText || '-' }}</strong>
|
><strong>{{ summary.dedicationText || '-' }}</strong>
|
||||||
|
<template v-if="summary.bill !== undefined">
|
||||||
|
<span>봉급</span><strong>{{ numberText(summary.bill) }}</strong>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
<span class="battle-general-extra__empty" aria-hidden="true"></span>
|
<span class="battle-general-extra__empty" aria-hidden="true"></span>
|
||||||
<strong class="battle-general-extra__empty" aria-hidden="true"></strong>
|
<strong class="battle-general-extra__empty" aria-hidden="true"></strong>
|
||||||
|
</template>
|
||||||
<span>전투</span
|
<span>전투</span
|
||||||
><strong>{{ numberText(summary.warnum) }}<template v-if="summary.warnum != null">회</template></strong>
|
><strong>{{ numberText(summary.warnum) }}<template v-if="summary.warnum != null">회</template></strong>
|
||||||
<span>계략</span><strong>{{ numberText(summary.strategies) }}</strong>
|
<span>계략</span><strong>{{ numberText(summary.strategies) }}</strong>
|
||||||
|
|||||||
@@ -291,6 +291,7 @@ onMounted(() => {
|
|||||||
available: true,
|
available: true,
|
||||||
experience: selectedGeneral.experience,
|
experience: selectedGeneral.experience,
|
||||||
dedicationText: selectedGeneral.progression.dedicationText,
|
dedicationText: selectedGeneral.progression.dedicationText,
|
||||||
|
bill: selectedGeneral.bill,
|
||||||
warnum: selectedGeneral.warnum,
|
warnum: selectedGeneral.warnum,
|
||||||
wins: selectedGeneral.battleStats.kills,
|
wins: selectedGeneral.battleStats.kills,
|
||||||
losses: selectedGeneral.battleStats.deaths,
|
losses: selectedGeneral.battleStats.deaths,
|
||||||
|
|||||||
@@ -267,7 +267,10 @@ watch(
|
|||||||
:current-month="lobbyInfo?.month"
|
:current-month="lobbyInfo?.month"
|
||||||
:turn-term-minutes="lobbyInfo?.turnTerm"
|
:turn-term-minutes="lobbyInfo?.turnTerm"
|
||||||
:server-time="lobbyInfo?.serverTime"
|
:server-time="lobbyInfo?.serverTime"
|
||||||
|
:server-wall-time="lobbyInfo?.serverWallTime"
|
||||||
:clock-mode="lobbyInfo?.clockMode"
|
:clock-mode="lobbyInfo?.clockMode"
|
||||||
|
:clock-running="lobbyInfo?.clockRunning"
|
||||||
|
:clock-starts-at="lobbyInfo?.clockStartsAt"
|
||||||
:autorun-limit="reservedGeneralAutorunLimit"
|
:autorun-limit="reservedGeneralAutorunLimit"
|
||||||
:map-data="worldMap"
|
:map-data="worldMap"
|
||||||
:map-layout="mapLayout"
|
:map-layout="mapLayout"
|
||||||
@@ -437,7 +440,10 @@ watch(
|
|||||||
:current-month="lobbyInfo?.month"
|
:current-month="lobbyInfo?.month"
|
||||||
:turn-term-minutes="lobbyInfo?.turnTerm"
|
:turn-term-minutes="lobbyInfo?.turnTerm"
|
||||||
:server-time="lobbyInfo?.serverTime"
|
:server-time="lobbyInfo?.serverTime"
|
||||||
|
:server-wall-time="lobbyInfo?.serverWallTime"
|
||||||
:clock-mode="lobbyInfo?.clockMode"
|
:clock-mode="lobbyInfo?.clockMode"
|
||||||
|
:clock-running="lobbyInfo?.clockRunning"
|
||||||
|
:clock-starts-at="lobbyInfo?.clockStartsAt"
|
||||||
:autorun-limit="reservedGeneralAutorunLimit"
|
:autorun-limit="reservedGeneralAutorunLimit"
|
||||||
:map-data="worldMap"
|
:map-data="worldMap"
|
||||||
:map-layout="mapLayout"
|
:map-layout="mapLayout"
|
||||||
|
|||||||
@@ -421,6 +421,7 @@ onMounted(() => {
|
|||||||
available: true,
|
available: true,
|
||||||
experience: data.general.experience,
|
experience: data.general.experience,
|
||||||
dedicationText: data.general.progression?.dedicationText,
|
dedicationText: data.general.progression?.dedicationText,
|
||||||
|
bill: data.general.bill,
|
||||||
warnum: data.general.records.battles,
|
warnum: data.general.records.battles,
|
||||||
wins: data.general.records.wins,
|
wins: data.general.records.wins,
|
||||||
losses: data.general.records.losses,
|
losses: data.general.records.losses,
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ const parseInstallOptions = (
|
|||||||
joinMode: joinMode === 'full' || joinMode === 'onlyRandom' ? joinMode : undefined,
|
joinMode: joinMode === 'full' || joinMode === 'onlyRandom' ? joinMode : undefined,
|
||||||
autorunUser: autorunUser ?? null,
|
autorunUser: autorunUser ?? null,
|
||||||
preopenAt: preopenAt ?? null,
|
preopenAt: preopenAt ?? null,
|
||||||
|
openAt: openAt ?? null,
|
||||||
installOperationId: action.installOperationId,
|
installOperationId: action.installOperationId,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2173,6 +2174,7 @@ export class GatewayOrchestrator implements GatewayOrchestratorHandle {
|
|||||||
? {
|
? {
|
||||||
...options.installOptions,
|
...options.installOptions,
|
||||||
preopenAt: options.installOptions.preopenAt?.toISOString() ?? null,
|
preopenAt: options.installOptions.preopenAt?.toISOString() ?? null,
|
||||||
|
openAt: options.installOptions.openAt?.toISOString() ?? null,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
adminUser: options.adminUser,
|
adminUser: options.adminUser,
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ interface ProfileSeedRequest {
|
|||||||
scenarioId: number;
|
scenarioId: number;
|
||||||
tickSeconds?: number;
|
tickSeconds?: number;
|
||||||
now: string;
|
now: string;
|
||||||
installOptions?: Omit<ScenarioInstallOptions, 'preopenAt'> & { preopenAt?: string | null };
|
installOptions?: Omit<ScenarioInstallOptions, 'preopenAt' | 'openAt'> & {
|
||||||
|
preopenAt?: string | null;
|
||||||
|
openAt?: string | null;
|
||||||
|
};
|
||||||
adminUser?: AdminSeedUser | null;
|
adminUser?: AdminSeedUser | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +52,11 @@ export const runProfileSeedCli = async (env: NodeJS.ProcessEnv = process.env): P
|
|||||||
if (preopenAt && Number.isNaN(preopenAt.getTime())) {
|
if (preopenAt && Number.isNaN(preopenAt.getTime())) {
|
||||||
throw new Error('Profile seed preopenAt must be an ISO date-time.');
|
throw new Error('Profile seed preopenAt must be an ISO date-time.');
|
||||||
}
|
}
|
||||||
|
const rawOpenAt = request.installOptions?.openAt;
|
||||||
|
const openAt = typeof rawOpenAt === 'string' ? new Date(rawOpenAt) : null;
|
||||||
|
if (openAt && Number.isNaN(openAt.getTime())) {
|
||||||
|
throw new Error('Profile seed openAt must be an ISO date-time.');
|
||||||
|
}
|
||||||
const resourceRoot = path.join(process.cwd(), 'resources');
|
const resourceRoot = path.join(process.cwd(), 'resources');
|
||||||
|
|
||||||
await seedProfileDatabase({
|
await seedProfileDatabase({
|
||||||
@@ -61,6 +69,7 @@ export const runProfileSeedCli = async (env: NodeJS.ProcessEnv = process.env): P
|
|||||||
? {
|
? {
|
||||||
...request.installOptions,
|
...request.installOptions,
|
||||||
preopenAt,
|
preopenAt,
|
||||||
|
openAt,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
scenarioOptions: { scenarioRoot: path.join(resourceRoot, 'scenario') },
|
scenarioOptions: { scenarioRoot: path.join(resourceRoot, 'scenario') },
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ describeDatabase('selected workspace profile seed CLI', () => {
|
|||||||
firstGameIdx: 0,
|
firstGameIdx: 0,
|
||||||
installOperationId: 'selected-cli-operation',
|
installOperationId: 'selected-cli-operation',
|
||||||
installCommitSha: 'selected-cli-commit',
|
installCommitSha: 'selected-cli-commit',
|
||||||
|
preopenAt: '2036-03-03T01:00:00.000Z',
|
||||||
|
openAt: '2036-03-03T02:00:00.000Z',
|
||||||
},
|
},
|
||||||
adminUser: {
|
adminUser: {
|
||||||
id: 'selected-cli-admin',
|
id: 'selected-cli-admin',
|
||||||
@@ -69,6 +71,7 @@ describeDatabase('selected workspace profile seed CLI', () => {
|
|||||||
const world = await connector.prisma.worldState.findFirstOrThrow();
|
const world = await connector.prisma.worldState.findFirstOrThrow();
|
||||||
expect(world).toMatchObject({
|
expect(world).toMatchObject({
|
||||||
scenarioCode: '1010',
|
scenarioCode: '1010',
|
||||||
|
clockWallAnchor: new Date('2036-03-03T02:00:00.000Z'),
|
||||||
meta: {
|
meta: {
|
||||||
firstGameIdx: 0,
|
firstGameIdx: 0,
|
||||||
gameIdx: completedGameCount,
|
gameIdx: completedGameCount,
|
||||||
|
|||||||
@@ -13,13 +13,18 @@ describe('parseProfileSeedRequest', () => {
|
|||||||
installOperationId: 'operation-id',
|
installOperationId: 'operation-id',
|
||||||
installCommitSha: 'abcdef',
|
installCommitSha: 'abcdef',
|
||||||
preopenAt: null,
|
preopenAt: null,
|
||||||
|
openAt: '2030-01-01T02:00:00.000Z',
|
||||||
},
|
},
|
||||||
adminUser: { id: 'admin', username: 'admin' },
|
adminUser: { id: 'admin', username: 'admin' },
|
||||||
})
|
})
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
scenarioId: 1010,
|
scenarioId: 1010,
|
||||||
tickSeconds: 60,
|
tickSeconds: 60,
|
||||||
installOptions: { installOperationId: 'operation-id', installCommitSha: 'abcdef' },
|
installOptions: {
|
||||||
|
installOperationId: 'operation-id',
|
||||||
|
installCommitSha: 'abcdef',
|
||||||
|
openAt: '2030-01-01T02:00:00.000Z',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user