merge: 최신 main을 메인 갱신 제어 작업에 통합

This commit is contained in:
2026-08-21 04:51:55 +00:00
22 changed files with 575 additions and 59 deletions
+25 -2
View File
@@ -2,7 +2,7 @@ import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { LogCategory, LogScope } from '@sammo-ts/logic';
import { asRecord } from '@sammo-ts/common';
import { asRecord, type RankDataType } from '@sammo-ts/common';
import type { GameApiContext } from '../../context.js';
import {
@@ -63,6 +63,14 @@ const zImmediateActionInput = z
})
.optional();
const MAIN_RECORD_LIMIT = 15;
const PERSONAL_RECORD_TYPES = [
'firenum',
'warnum',
'killnum',
'deathnum',
'killcrew',
'deathcrew',
] as const satisfies readonly RankDataType[];
const NEUTRAL_NATION_CONTEXT = {
id: 0,
name: '재야',
@@ -276,7 +284,7 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
const metaRecord = asRecord(general.meta);
const officerCityId = readNumber(metaRecord.officerCity ?? metaRecord.officer_city ?? metaRecord.officerCityId, 0);
const [city, queriedNation, worldState, officerCity, troop, troopLeader, troopLeaderFirstTurn, accessLog] =
const [city, queriedNation, worldState, officerCity, troop, troopLeader, troopLeaderFirstTurn, accessLog, rankRows] =
await Promise.all([
general.cityId > 0
? ctx.db.city.findUnique({
@@ -346,6 +354,10 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
where: { generalId: general.id },
select: { refreshScore: true, refreshScoreTotal: true },
}),
ctx.db.rankData.findMany({
where: { generalId: general.id, type: { in: [...PERSONAL_RECORD_TYPES] } },
select: { type: true, value: true },
}),
]);
const nation = queriedNation ?? NEUTRAL_NATION_CONTEXT;
@@ -466,6 +478,8 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
};
const refreshScore = accessLog?.refreshScore ?? 0;
const refreshScoreTotal = accessLog?.refreshScoreTotal ?? 0;
const rankValues = new Map(rankRows.map((row) => [row.type, row.value]));
const rankValue = (type: (typeof PERSONAL_RECORD_TYPES)[number]): number => rankValues.get(type) ?? 0;
const troopStatus: 'inactive' | 'present' | 'away' =
troopLeaderFirstTurn?.actionCode !== undefined && troopLeaderFirstTurn.actionCode !== 'che_집합'
? 'inactive'
@@ -527,6 +541,15 @@ export const getGeneralContext = async (ctx: GameApiContext) => {
statUpgradeLimit: readNumber(constValues.upgradeLimit, 30),
dex: [1, 2, 3, 4, 5].map((index) => readNumber(metaRecord[`dex${index}`], 0)),
},
records: {
battles: rankValue('warnum'),
strategies: rankValue('firenum'),
serviceYears: readNumber(metaRecord.belong, 0),
wins: rankValue('killnum'),
losses: rankValue('deathnum'),
killedCrew: rankValue('killcrew'),
lostCrew: rankValue('deathcrew'),
},
items: {
horse: normalizeItemCode(general.horseCode),
weapon: normalizeItemCode(general.weaponCode),
+9 -5
View File
@@ -72,6 +72,11 @@ const parseBuffRecord = (raw: unknown): Record<string, number> => {
const serializeBuffRecord = (buff: Record<string, number>): string => JSON.stringify(buff);
const readStringList = (raw: unknown): string[] => {
const parsed = typeof raw === 'string' ? parseJson<unknown>(raw) : raw;
return Array.isArray(parsed) ? parsed.filter((entry): entry is string => typeof entry === 'string') : [];
};
const readBuffLevel = (buff: Record<string, number>, key: InheritBuffType): number => {
const compatibilityKey = key === 'domesticSuccessProb' ? 'success' : key === 'domesticFailProb' ? 'fail' : null;
return Math.max(0, Math.min(5, Math.floor(buff[key] ?? (compatibilityKey ? buff[compatibilityKey] : 0) ?? 0)));
@@ -133,7 +138,7 @@ const patchGeneral = async (
strength?: number;
intelligence?: number;
};
specialWar?: string;
specialWar?: string | null;
}
): Promise<void> => {
const result = await ctx.turnDaemon.requestCommand({
@@ -530,16 +535,15 @@ export const inheritRouter = router({
}
const meta = asRecord(general.meta);
const prevList =
parseJson<string[]>(typeof meta.prev_types_special2 === 'string' ? meta.prev_types_special2 : null) ?? [];
const prevList = readStringList(meta.prev_types_special2);
prevList.push(general.special2Code);
await patchGeneral(ctx, general.id, {
specialWar: 'None',
specialWar: null,
meta: {
...meta,
inheritResetSpecialWar: nextLevel,
prev_types_special2: JSON.stringify(prevList),
prev_types_special2: prevList,
},
});
@@ -83,6 +83,7 @@ const buildContext = (authenticated: boolean, generalAccessTracking = false) =>
general: {
findFirst: findGeneral,
},
rankData: { findMany: async () => [] },
city: { findUnique: findCity },
nation: { findUnique: findNation },
generalAccessLog: { findUnique: async () => null },
@@ -85,6 +85,7 @@ const createContext = (options: {
troopLeaderAction?: string | null;
refreshScore?: number;
refreshScoreTotal?: number;
rankRows?: Array<{ type: string; value: number }>;
requestId?: string;
transaction?: ReturnType<typeof vi.fn>;
}) => {
@@ -128,6 +129,9 @@ const createContext = (options: {
refreshScoreTotal: options.refreshScoreTotal ?? 0,
})),
},
rankData: {
findMany: vi.fn(async () => options.rankRows ?? []),
},
city: {
findUnique: vi.fn(async () => options.city ?? null),
aggregate: vi.fn(async () => ({
@@ -206,6 +210,41 @@ const createContext = (options: {
};
describe('in-game my information ownership', () => {
it('returns the owned general battle records from the same rank_data source used by rankings', async () => {
const fixture = createContext({
me: buildGeneral({ meta: { belong: 4, rank_killnum: 999 } }),
rankRows: [
{ type: 'firenum', value: 12 },
{ type: 'warnum', value: 8 },
{ type: 'killnum', value: 5 },
{ type: 'deathnum', value: 3 },
{ type: 'killcrew', value: 12_345 },
{ type: 'deathcrew', value: 6_789 },
],
});
await expect(appRouter.createCaller(fixture.context).general.me()).resolves.toMatchObject({
general: {
records: {
battles: 8,
strategies: 12,
serviceYears: 4,
wins: 5,
losses: 3,
killedCrew: 12_345,
lostCrew: 6_789,
},
},
});
expect(fixture.db.rankData.findMany).toHaveBeenCalledWith({
where: {
generalId: 7,
type: { in: ['firenum', 'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew'] },
},
select: { type: true, value: true },
});
});
it('returns every ref progress-bar input from the owned general and current city read model', async () => {
const fixture = createContext({
me: buildGeneral({
+84
View File
@@ -331,6 +331,90 @@ describe('inherit router actor and permission boundaries', () => {
);
});
it('reserves the selected Ref war trait and charges the authenticated owner once', async () => {
const fixture = buildContext({
inheritancePoint: 5_000,
configConst: { availableSpecialWar: ['che_의술'] },
});
await expect(
appRouter.createCaller(fixture.context).inherit.setNextSpecialWar({ specialKey: 'che_의술' })
).resolves.toEqual({ ok: true });
expect(fixture.requestCommand).toHaveBeenCalledWith({
type: 'patchGeneral',
generalId: 7,
patch: { meta: { inheritSpecificSpecialWar: 'che_의술' } },
});
expect(fixture.pointUpsert).toHaveBeenCalledWith(expect.objectContaining({ update: { value: 1_000 } }));
expect(fixture.logCreate).toHaveBeenCalledWith({
data: {
userId: 'user-1',
year: 200,
month: 4,
text: '4000 포인트로 다음 전투 특기로 의술 지정',
},
});
});
it('does not dispatch or charge when a different war trait is already reserved', async () => {
const fixture = buildContext({
inheritancePoint: 5_000,
general: buildGeneral({ meta: { inheritSpecificSpecialWar: 'che_신산' } }),
configConst: { availableSpecialWar: ['che_의술'] },
});
await expect(
appRouter.createCaller(fixture.context).inherit.setNextSpecialWar({ specialKey: 'che_의술' })
).rejects.toMatchObject({ code: 'BAD_REQUEST', message: '이미 예약한 특기가 있습니다.' });
expect(fixture.requestCommand).not.toHaveBeenCalled();
expect(fixture.pointUpsert).not.toHaveBeenCalled();
expect(fixture.logCreate).not.toHaveBeenCalled();
});
it('resets the current war trait to the in-memory null sentinel and preserves Ref history as an array', async () => {
const fixture = buildContext({
inheritancePoint: 2_000,
general: buildGeneral({ meta: { prev_types_special2: ['che_돌격'], marker: 3 } }),
});
await expect(appRouter.createCaller(fixture.context).inherit.resetSpecialWar()).resolves.toEqual({ ok: true });
expect(fixture.requestCommand).toHaveBeenCalledWith({
type: 'patchGeneral',
generalId: 7,
patch: {
specialWar: null,
meta: {
prev_types_special2: ['che_돌격', 'che_선봉'],
marker: 3,
inheritResetSpecialWar: 0,
},
},
});
expect(fixture.pointUpsert).toHaveBeenCalledWith(expect.objectContaining({ update: { value: 1_000 } }));
expect(fixture.logCreate).toHaveBeenCalledWith({
data: {
userId: 'user-1',
year: 200,
month: 4,
text: '1000 포인트로 전투 특기 초기화',
},
});
});
it('does not dispatch or charge when the current war trait is already blank', async () => {
const fixture = buildContext({ inheritancePoint: 2_000, general: buildGeneral({ special2Code: 'None' }) });
await expect(appRouter.createCaller(fixture.context).inherit.resetSpecialWar()).rejects.toMatchObject({
code: 'BAD_REQUEST',
message: '이미 전투 특기가 공란입니다.',
});
expect(fixture.requestCommand).not.toHaveBeenCalled();
expect(fixture.pointUpsert).not.toHaveBeenCalled();
expect(fixture.logCreate).not.toHaveBeenCalled();
});
it('queues Ref-compatible nextTurnTimeBase without moving the current scheduled turn', async () => {
const fixture = buildContext({
inheritancePoint: 2_000,
@@ -69,7 +69,31 @@ export const do징병 = (ai: GeneralAI) => {
}
const generalMeta = asRecord(ai.general.meta);
const fullLeadership = readMetaNumber(generalMeta, 'fullLeadership', ai.general.stats.leadership);
const recruitContext = {
general: ai.general,
nation,
...(ai.worldRef
? {
worldView: {
listGenerals: () => ai.worldRef!.listGenerals(),
listGeneralsByCity: (cityId: number) =>
ai.worldRef!.listGenerals().filter((candidate) => candidate.cityId === cityId),
listNations: () => ai.worldRef!.listNations(),
},
}
: {}),
time: {
year: ai.world.currentYear,
month: ai.world.currentMonth,
startYear: ai.startYear,
},
};
const recruitment = new RecruitmentCommandResolver(ai.commandEnv.generalActionModules ?? [], ai.commandEnv);
// The cached AI stat follows the scenario/global classification cap, while
// che_징병 resolves the actual command capacity from the general's current
// stat and modules. NPC recruitment must request that same uncapped amount;
// otherwise a 300-leadership general can be stuck at a 100/140/255 cap.
const fullLeadership = recruitment.resolveFullLeadership(recruitContext);
trace('population-policy', {
population: city.population,
populationMax: city.populationMax,
@@ -175,26 +199,6 @@ export const do징병 = (ai: GeneralAI) => {
// whether to halve the requested crew. In particular, that command caps
// the charge at the actually refillable amount when the selected type is
// already equipped, then applies traits/items and legacy rounding.
const recruitContext = {
general: ai.general,
nation,
...(ai.worldRef
? {
worldView: {
listGenerals: () => ai.worldRef!.listGenerals(),
listGeneralsByCity: (cityId: number) =>
ai.worldRef!.listGenerals().filter((candidate) => candidate.cityId === cityId),
listNations: () => ai.worldRef!.listNations(),
},
}
: {}),
time: {
year: ai.world.currentYear,
month: ai.world.currentMonth,
startYear: ai.startYear,
},
};
const recruitment = new RecruitmentCommandResolver(ai.commandEnv.generalActionModules ?? [], ai.commandEnv);
const goldCost = recruitment.getCost(recruitContext, crewTypeId, crewAmount, picked).gold;
const killCrew = readMetaNumber(generalMeta, 'rank_killcrew', readMetaNumber(generalMeta, 'killcrew', 0));
const deathCrew = readMetaNumber(generalMeta, 'rank_deathcrew', readMetaNumber(generalMeta, 'deathcrew', 0));
+1 -1
View File
@@ -257,7 +257,7 @@ const zPatchGeneral = z.object({
intelligence: zFiniteNumber.optional(),
})
.optional(),
specialWar: z.string().optional(),
specialWar: z.string().nullable().optional(),
}),
});
@@ -734,10 +734,10 @@ async function handlePatchGeneral(
...command.patch.stats,
};
}
if (typeof command.patch.specialWar === 'string') {
if (command.patch.specialWar !== undefined) {
patch.role = {
...general.role,
specialWar: command.patch.specialWar,
specialWar: command.patch.specialWar === 'None' ? null : command.patch.specialWar,
};
}
@@ -955,6 +955,57 @@ describe('legacy NPC AI final-decision parity', () => {
});
});
it.each([
[101, 100, 10_100],
[140, 100, 14_000],
[256, 255, 25_600],
[300, 140, 30_000],
[300, 255, 30_000],
])(
'requests the command-resolved full crew above the cached AI cap (leadership=%i, cached=%i)',
(leadership, cachedLeadership, amount) => {
const ai = makeAi({
dipState: 2,
city: { population: 100_000, populationMax: 100_000 },
general: {
stats: { leadership, strength: 70, intelligence: 70 },
gold: 100_000,
rice: 100_000,
meta: { killturn: 100, fullLeadership: cachedLeadership, rank_killcrew: 0, rank_deathcrew: 1 },
},
rng: makeRng([], [0, 0]),
});
expect(do징병(ai)).toMatchObject({
action: 'che_징병',
args: { crewType: 1, amount },
});
}
);
it('uses recruitment stat modules when resolving uncapped NPC crew capacity', () => {
const ai = makeAi({
dipState: 2,
city: { population: 100_000, populationMax: 100_000 },
general: {
stats: { leadership: 240, strength: 70, intelligence: 70 },
gold: 100_000,
rice: 100_000,
meta: { killturn: 100, fullLeadership: 100, rank_killcrew: 0, rank_deathcrew: 1 },
},
generalActionModules: singleActionModuleStack({
eventHandlers: {},
onCalcStat: (_context, statName, value) => (statName === 'leadership' ? value * 1.25 : value),
}),
rng: makeRng([], [0, 0]),
});
expect(do징병(ai)).toMatchObject({
action: 'che_징병',
args: { crewType: 1, amount: 30_000 },
});
});
it('uses the refillable same-type crew amount for the legacy gold-cost halving threshold', () => {
const ai = makeAi({
dipState: 2,
@@ -1,11 +1,14 @@
import { describe, expect, it } from 'vitest';
import { LogCategory, LogFormat } from '@sammo-ts/logic';
import type { TurnDaemonCommand } from '@sammo-ts/common';
import { InMemoryTurnWorld } from '../src/turn/inMemoryWorld.js';
import { normalizeTurnDaemonCommand } from '../src/turn/commandRegistry.js';
import {
createAddGlobalBetrayHandler,
createAssignGeneralSpecialityHandler,
} from '../src/turn/monthlySpecialityBetrayAction.js';
import { createTurnDaemonCommandHandler } from '../src/turn/worldCommandHandler.js';
import type { TurnEvent, TurnGeneral, TurnWorldSnapshot, TurnWorldState } from '../src/turn/types.js';
const event: TurnEvent = {
@@ -177,6 +180,84 @@ describe('monthly speciality and betrayal actions', () => {
]);
});
it.each([
['고정 후 초기화', ['reserve', 'reset']],
['초기화 후 고정', ['reset', 'reserve']],
] as const)('%s 순서에서도 다음 월에 지정한 전투 특기를 지급한다', async (_label, steps) => {
const world = buildWorld();
const initial = world.getGeneralById(3)!;
const initialMeta = { ...initial.meta };
delete initialMeta.inheritSpecificSpecialWar;
world.updateGeneral(3, {
role: { ...initial.role, specialWar: 'che_신산' },
meta: initialMeta,
});
world.acknowledgeDirtyState(world.peekDirtyState());
const commandHandler = createTurnDaemonCommandHandler({ world });
let requestIndex = 0;
const dispatchPatch = async (patch: Extract<TurnDaemonCommand, { type: 'patchGeneral' }>['patch']) => {
requestIndex += 1;
const command = normalizeTurnDaemonCommand({
requestId: `inherit-war-trait-${requestIndex}`,
sentAt: '2026-08-21T00:00:00.000Z',
command: { type: 'patchGeneral', generalId: 3, patch },
});
expect(command).not.toBeNull();
await expect(commandHandler.handle(command!)).resolves.toMatchObject({ type: 'patchGeneral', ok: true });
};
for (const step of steps) {
const current = world.getGeneralById(3)!;
if (step === 'reserve') {
await dispatchPatch({
meta: { ...current.meta, inheritSpecificSpecialWar: 'che_의술' },
});
} else {
await dispatchPatch({
specialWar: null,
meta: {
...current.meta,
inheritResetSpecialWar: 0,
prev_types_special2: ['che_신산'],
},
});
}
}
expect(world.getGeneralById(3)?.role.specialWar).toBeNull();
expect(world.getGeneralById(3)?.meta).toMatchObject({
inheritSpecificSpecialWar: 'che_의술',
prev_types_special2: ['che_신산'],
});
await createAssignGeneralSpecialityHandler({ getWorld: () => world })([], environment, event);
expect(world.getGeneralById(3)?.role.specialWar).toBe('che_의술');
expect(world.getGeneralById(3)?.meta).not.toHaveProperty('inheritSpecificSpecialWar');
expect(world.getGeneralById(3)?.meta.prev_types_special2).toEqual(['che_신산']);
expect(
world
.peekDirtyState()
.logs.filter((log) => log.generalId === 3)
.map((log) => log.text)
).toEqual(['특기 【<b><C>의술</></b>】을 습득', '특기 【<b><L>의술</></b>】을 익혔습니다!']);
});
it('normalizes the legacy None sentinel before monthly eligibility checks', async () => {
const world = buildWorld();
const target = world.getGeneralById(3)!;
world.updateGeneral(3, { role: { ...target.role, specialWar: 'che_신산' } });
world.acknowledgeDirtyState(world.peekDirtyState());
const commandHandler = createTurnDaemonCommandHandler({ world });
await expect(
commandHandler.handle({ type: 'patchGeneral', generalId: 3, patch: { specialWar: 'None' } })
).resolves.toMatchObject({ type: 'patchGeneral', ok: true });
expect(world.getGeneralById(3)?.role.specialWar).toBeNull();
});
it('does nothing before the three-year opening period ends', async () => {
const world = buildWorld();
await createAssignGeneralSpecialityHandler({ getWorld: () => world })([], { ...environment, year: 192 }, event);
@@ -9,6 +9,7 @@ import {
createAddGlobalBetrayHandler,
createAssignGeneralSpecialityHandler,
} from '../src/turn/monthlySpecialityBetrayAction.js';
import { createTurnDaemonCommandHandler } from '../src/turn/worldCommandHandler.js';
import type { TurnEvent, TurnGeneral, TurnWorldSnapshot, TurnWorldState } from '../src/turn/types.js';
const databaseUrl = process.env.INPUT_EVENT_DATABASE_URL;
@@ -105,7 +106,7 @@ integration('monthly speciality and betrayal persistence', () => {
}),
buildGeneral(generalIds[1], {
domestic: 'che_경작',
war: null,
war: 'che_신산',
meta: {
specage: 99,
specage2: 30,
@@ -198,6 +199,22 @@ integration('monthly speciality and betrayal persistence', () => {
const hooks = await createDatabaseTurnHooks(databaseUrl!, world);
try {
const reservedGeneral = world.getGeneralById(generalIds[1])!;
const commandHandler = createTurnDaemonCommandHandler({ world });
await expect(
commandHandler.handle({
type: 'patchGeneral',
generalId: reservedGeneral.id,
patch: {
specialWar: null,
meta: {
...reservedGeneral.meta,
inheritResetSpecialWar: 0,
prev_types_special2: ['che_신산'],
},
},
})
).resolves.toMatchObject({ type: 'patchGeneral', ok: true });
await world.advanceMonth(new Date('0200-01-01T00:00:00.000Z'));
await hooks.hooks.flushChanges?.({
lastTurnTime: state.lastTurnTime.toISOString(),
@@ -214,7 +231,12 @@ integration('monthly speciality and betrayal persistence', () => {
expect(rows[0]?.specialCode).not.toBe('None');
expect(rows[0]?.meta).toMatchObject({ betray: 2 });
expect(rows[1]).toMatchObject({ special2Code: 'che_의술' });
expect(rows[1]?.meta).toMatchObject({ betray: 3, marker: 2 });
expect(rows[1]?.meta).toMatchObject({
betray: 3,
marker: 2,
inheritResetSpecialWar: 0,
prev_types_special2: ['che_신산'],
});
expect(rows[1]?.meta).not.toHaveProperty('inheritSpecificSpecialWar');
expect(await db.logEntry.count({ where: { generalId: { in: [...generalIds] } } })).toBe(4);
} finally {
@@ -2291,6 +2291,7 @@ test('keeps Ref command briefs and autonomous-action state after a turn mutation
test('uses drag selection, clipboard paste, and a stored template in advanced mode', async ({ page }) => {
const requests = await install(page);
await page.setViewportSize({ width: 1200, height: 900 });
await page.goto('/');
const editor = page.locator('[data-command-scope="general"]');
@@ -2318,6 +2319,41 @@ test('uses drag selection, clipboard paste, and a stored template in advanced mo
await picker.getByRole('button', { name: '입력', exact: true }).click();
await expect(editor.locator('.action-column > div').nth(2)).toHaveText('【허창】에 화계실행');
const recentMenu = editor.locator('details').filter({ has: page.getByText('최근 실행', { exact: true }) });
await recentMenu.locator('summary').click();
const recentBriefButton = recentMenu.getByRole('button', { name: '【허창】에 화계실행', exact: true });
await expect(recentBriefButton).toBeVisible();
await recentBriefButton.hover();
await page.screenshot({
path: test.info().outputPath('advanced-recent-command-brief-desktop-1200.png'),
fullPage: true,
});
await recentMenu.locator('summary').click();
await page.setViewportSize({ width: 500, height: 900 });
await recentMenu.locator('summary').click();
await expect(recentBriefButton).toBeVisible();
await recentBriefButton.focus();
await expect(recentBriefButton).toBeFocused();
const mobileRecentGeometry = await editor.evaluate((element) => {
const menu = element.querySelector<HTMLElement>('details[open] .menu-items');
const recentButton = menu?.querySelector<HTMLElement>('button');
if (!menu || !recentButton) throw new Error('advanced recent command menu is missing');
return {
horizontalOverflow: element.scrollWidth - element.clientWidth,
menuRight: menu.getBoundingClientRect().right,
buttonRight: recentButton.getBoundingClientRect().right,
};
});
expect(mobileRecentGeometry.horizontalOverflow).toBeLessThanOrEqual(0);
expect(mobileRecentGeometry.menuRight).toBeLessThanOrEqual(500);
expect(mobileRecentGeometry.buttonRight).toBeLessThanOrEqual(500);
await page.screenshot({
path: test.info().outputPath('advanced-recent-command-brief-mobile-500.png'),
fullPage: true,
});
await recentMenu.locator('summary').click();
await page.setViewportSize({ width: 1200, height: 900 });
await drag(0, 2);
await editor.locator('details.selected-menu > summary').click();
await editor.getByRole('button', { name: '복사하기', exact: true }).click();
+12
View File
@@ -112,6 +112,15 @@ const myGeneral = (state: FixtureState) => ({
statUpgradeLimit: 20,
dex: [350, 1_375, 3_500, 7_125, 1_275_975],
},
records: {
battles: 8,
strategies: 12,
serviceYears: 4,
wins: 5,
losses: 3,
killedCrew: 12_345,
lostCrew: 6_789,
},
items: { horse: 'che_명마', weapon: null, book: null, item: null },
itemNames: { horse: '명마', weapon: null, book: null, item: null },
},
@@ -1184,6 +1193,9 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
expect(myPageImages[1]?.backgroundImage).toContain('/game/crewtype1.png');
await expect(page.locator('.legacy-general-details')).toContainText('계급 29품관');
await expect(page.locator('.legacy-general-details')).toContainText('병종 보병');
await expect(page.locator('.legacy-general-details')).toContainText('전투 8 · 계략 12 · 사관 4년');
await expect(page.locator('.legacy-general-details')).toContainText('승률 62.50% · 승리 5 · 패배 3');
await expect(page.locator('.legacy-general-details')).toContainText('살상률 181.84% · 사살 12,345 · 피살 6,789');
await expect(page.locator('.item-group')).toContainText('명마');
await expect(page.locator('#container')).not.toContainText('che_');
await expect(page.locator('.title-row')).toContainText('내 정 보');
@@ -142,11 +142,12 @@ const isRecruitmentCommand = computed(
() => selectedCommand.value?.key === 'che_징병' || selectedCommand.value?.key === 'che_모병'
);
const isRecruitmentOverlayOpen = computed(() => pickerOpen.value && isRecruitmentCommand.value);
const rowLabel = (row: ReservedCommandRow): string =>
formatReservedCommandBrief(props.scope, row.action, row.args, props.commandTable) ||
row.label ||
labelMap.value.get(row.action) ||
row.action;
const commandBrief = (entry: { action: string; args: unknown; label?: string }): string =>
formatReservedCommandBrief(props.scope, entry.action, entry.args, props.commandTable) ||
entry.label ||
labelMap.value.get(entry.action) ||
entry.action;
const rowLabel = (row: ReservedCommandRow): string => commandBrief(row);
const selectedIndices = () => normalizedSelection(selected.value, previousSelected.value, props.rows.length);
const pattern = () => extractPattern(props.rows, selectedIndices());
const touchMenus = () => (menuRevision.value += 1);
@@ -467,7 +468,7 @@ const clickOutsideMenu = (event: Event) => {
clickOutsideMenu($event);
"
>
{{ entry.label ?? labelMap.get(entry.action) ?? entry.action }}
{{ commandBrief(entry) }}
</button>
<span v-if="!storage?.recent.size" class="empty-menu">비어 있음</span>
</div>
+3 -3
View File
@@ -796,12 +796,12 @@ onMounted(() => {
width: min(100%, 1000px);
margin: 0 auto;
border: 1px solid #888;
overflow: hidden;
overflow-x: hidden;
box-sizing: border-box;
position: relative;
padding: 0 7px;
color: #fff;
height: 1597px;
min-height: 1597px;
font: 14px/21px var(--sammo-font-sans);
}
@@ -1017,7 +1017,7 @@ a:not(.legacy-button):focus-visible {
}
.inherit-page {
height: 3047.5px;
min-height: 3047.5px;
}
.shop-item .buy-button {
+19 -3
View File
@@ -136,6 +136,9 @@ const statusLine = computed(() =>
const canSave = computed(() => (data.value?.settings.myset ?? 1) > 0);
const penalties = computed(() => Object.entries(data.value?.penalties ?? {}));
const numberText = (value: number): string => value.toLocaleString('ko-KR');
const percentText = (numerator: number, denominator: number): string =>
`${((numerator / Math.max(denominator, 1)) * 100).toFixed(2)}%`;
const noDefencePenaltyWaived = computed(() => {
const environment = asRecord(world.value?.config.environment);
return isDefenceTrainPenaltyWaivedByScenarioEffect(
@@ -437,9 +440,22 @@ onMounted(() => {
}})</strong
>
</div>
<div>전투 0 · 계략 0 · 사관 7</div>
<div>승률 0% · 승리 0 · 패배 0</div>
<div>살상률 0% · 사살 0 · 피살 0</div>
<div>
전투 {{ numberText(data.general.records.battles) }} · 계략
{{ numberText(data.general.records.strategies) }} · 사관
{{ numberText(data.general.records.serviceYears) }}
</div>
<div>
승률 {{ percentText(data.general.records.wins, data.general.records.battles) }} · 승리
{{ numberText(data.general.records.wins) }} · 패배
{{ numberText(data.general.records.losses) }}
</div>
<div>
살상률
{{ percentText(data.general.records.killedCrew, data.general.records.lostCrew) }} · 사살
{{ numberText(data.general.records.killedCrew) }} · 피살
{{ numberText(data.general.records.lostCrew) }}
</div>
<div>
소속 {{ data.nation?.name ?? '재야' }} · 도시 {{ data.city?.name ?? '-' }} · 병종
{{ data.general.crewTypeName ?? '-' }} · 내정특기