fix: 세력일람에 군주 현재 위치를 복원
영토가 없는 세력도 전체 도시 사전에서 군주의 위치를 찾아 Ref와 같은 현재 위치를 표시한다. API와 Chromium 회귀 테스트를 추가한다.
This commit is contained in:
@@ -134,6 +134,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
|
||||
generalsByNation.set(general.nationId, list);
|
||||
}
|
||||
const citiesByNation = new Map<number, typeof cities>();
|
||||
const cityNameById = new Map(cities.map((city) => [city.id, city.name] as const));
|
||||
for (const city of cities) {
|
||||
const list = citiesByNation.get(city.nationId) ?? [];
|
||||
list.push(city);
|
||||
@@ -153,6 +154,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
|
||||
: null,
|
||||
};
|
||||
});
|
||||
const ruler = officers.find((officer) => officer.officerLevel === 12)?.general;
|
||||
const secretPermissions = nationGenerals.map((general) => ({
|
||||
general,
|
||||
permission: resolveSecretPermission(
|
||||
@@ -178,6 +180,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
|
||||
},
|
||||
power: readMetaNumber(nation.meta, 'power'),
|
||||
capitalCityId: nation.capitalCityId ?? 0,
|
||||
rulerCityName: ruler ? (cityNameById.get(ruler.cityId) ?? null) : null,
|
||||
generalCount: readMetaNumber(nation.meta, 'gennum', nationGenerals.length),
|
||||
cityCount: nationCities.length,
|
||||
officers,
|
||||
|
||||
Reference in New Issue
Block a user