feat(game-ui): 세력일람에 총 병사를 표시
This commit is contained in:
@@ -96,6 +96,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
|
||||
npcState: true,
|
||||
nationId: true,
|
||||
cityId: true,
|
||||
crew: true,
|
||||
dedication: true,
|
||||
officerLevel: true,
|
||||
meta: true,
|
||||
@@ -182,6 +183,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
|
||||
capitalCityId: nation.capitalCityId ?? 0,
|
||||
rulerCityName: ruler ? (cityNameById.get(ruler.cityId) ?? null) : null,
|
||||
generalCount: readMetaNumber(nation.meta, 'gennum', nationGenerals.length),
|
||||
totalCrew: nationGenerals.reduce((sum, general) => sum + general.crew, 0),
|
||||
cityCount: nationCities.length,
|
||||
officers,
|
||||
ambassadorNames: secretPermissions
|
||||
|
||||
@@ -112,6 +112,7 @@ const directoryGeneral = (overrides: Record<string, unknown> = {}) => ({
|
||||
leadership: 70,
|
||||
strength: 60,
|
||||
intel: 50,
|
||||
crew: 100,
|
||||
experience: 1_000,
|
||||
meta: { killturn: 3 },
|
||||
penalty: {},
|
||||
@@ -303,6 +304,7 @@ describe('legacy global nation/general directories', () => {
|
||||
expect(result[1]).toMatchObject({
|
||||
id: 1,
|
||||
generalCount: 4,
|
||||
totalCrew: 400,
|
||||
cityCount: 1,
|
||||
ambassadorNames: ['군주', '외교관'],
|
||||
auditorCount: 1,
|
||||
@@ -312,7 +314,7 @@ describe('legacy global nation/general directories', () => {
|
||||
officerLevel: 12,
|
||||
general: { id: 10, name: '군주' },
|
||||
});
|
||||
expect(result[2]).toMatchObject({ name: '재 야', generalCount: 1, cityCount: 1 });
|
||||
expect(result[2]).toMatchObject({ name: '재 야', generalCount: 1, totalCrew: 100, cityCount: 1 });
|
||||
});
|
||||
|
||||
it('projects a level-zero nation location from its ruler city even when that city belongs to another nation', async () => {
|
||||
|
||||
@@ -19,6 +19,7 @@ const nationDirectory = [
|
||||
power: 2000,
|
||||
capitalCityId: 2,
|
||||
generalCount: 1,
|
||||
totalCrew: 1_200,
|
||||
cityCount: 1,
|
||||
officers: Array.from({ length: 8 }, (_, index) => ({
|
||||
officerLevel: 12 - index,
|
||||
@@ -38,6 +39,7 @@ const nationDirectory = [
|
||||
power: 1000,
|
||||
capitalCityId: 1,
|
||||
generalCount: 2,
|
||||
totalCrew: 2_500,
|
||||
cityCount: 1,
|
||||
officers: Array.from({ length: 8 }, (_, index) => ({
|
||||
officerLevel: 12 - index,
|
||||
@@ -60,6 +62,7 @@ const nationDirectory = [
|
||||
power: 0,
|
||||
capitalCityId: 0,
|
||||
generalCount: 1,
|
||||
totalCrew: 0,
|
||||
cityCount: 1,
|
||||
officers: Array.from({ length: 8 }, (_, index) => ({ officerLevel: 12 - index, general: null })),
|
||||
ambassadorNames: [],
|
||||
@@ -697,6 +700,8 @@ test('nation directory reuses only the public general-directory row on hover and
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.getByRole('button', { name: '장수 일람 연동' })).toHaveCount(0);
|
||||
await expect(page.locator('[data-general-preview-trigger]')).toHaveCount(4);
|
||||
await expect(page.locator('[data-nation-id="1"]')).toContainText('총 병사');
|
||||
await expect(page.locator('[data-nation-id="1"]')).toContainText('2,500');
|
||||
expect(requestedOperations.filter((operation) => operation === 'world.getGeneralDirectory')).toHaveLength(
|
||||
viewport.name === 'desktop' ? 0 : 1
|
||||
);
|
||||
|
||||
@@ -203,6 +203,16 @@ onBeforeUnmount(() => {
|
||||
<td class="label-cell">장수 / 속령</td>
|
||||
<td class="value-wide">{{ nation.generalCount }} / {{ nation.cityCount }}</td>
|
||||
</tr>
|
||||
<tr class="desktop-only">
|
||||
<td class="label-cell">총 병사</td>
|
||||
<td class="value-wide">{{ nation.totalCrew.toLocaleString('ko-KR') }}</td>
|
||||
<td colspan="6"></td>
|
||||
</tr>
|
||||
<tr class="mobile-only">
|
||||
<td class="label-cell">총 병사</td>
|
||||
<td class="value-wide">{{ nation.totalCrew.toLocaleString('ko-KR') }}</td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr v-for="row in 2" :key="`desktop-officers-${row}`" class="desktop-only">
|
||||
<template v-for="column in 4" :key="column">
|
||||
<td class="label-cell">
|
||||
@@ -316,6 +326,12 @@ onBeforeUnmount(() => {
|
||||
<td class="neutral-label">속 령</td>
|
||||
<td class="neutral-value">{{ nation.cityCount }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="neutral-spacer"> </td>
|
||||
<td class="neutral-label">총 병사</td>
|
||||
<td class="neutral-value">{{ nation.totalCrew.toLocaleString('ko-KR') }}</td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
속령 일람 :
|
||||
|
||||
Reference in New Issue
Block a user