diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index 4b28dc45..6c9f4f37 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -66,6 +66,7 @@ class GeneralList extends \sammo\BaseAPI 'weapon' => 2, 'book' => 2, 'item' => 2, + 'recent_war' => 2, 'aux' => 2, @@ -209,6 +210,7 @@ class GeneralList extends \sammo\BaseAPI 'dedLevelText' => fn ($rawGeneral) => getDedLevelText($rawGeneral['dedlevel']), //'0000-00-00 11:23'; 'turntime' => fn ($rawGeneral) => substr($rawGeneral['turntime'], 0, 19), + 'recent_war' => fn ($rawGeneral) => substr($rawGeneral['recent_war'], 0, 19), 'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']), 'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null, 'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0, diff --git a/hwe/ts/components/GeneralList.vue b/hwe/ts/components/GeneralList.vue index 1c0902fb..a4235b5b 100644 --- a/hwe/ts/components/GeneralList.vue +++ b/hwe/ts/components/GeneralList.vue @@ -347,7 +347,8 @@ type headerType = | "specials" | "reservedCommandShort" | "killturnAndConnect" - | "years"; + | "years" + | "warResults"; interface GenValueParams extends BaseWithValueColDefParams { data: GeneralListItem; } @@ -578,7 +579,7 @@ const columnRawDefs = ref sortable: true, comparator: (a, b, c, d) => c.data.officerLevel - d.data.officerLevel, cellRenderer: ({ data }: GenValueParams) => { - if(data.officerLevel >= 5){ + if (data.officerLevel >= 5) { return `${data.officerLevelText}`; } if (data.st2 && 2 <= data.officerLevel && data.officerLevel <= 4) { @@ -1010,6 +1011,21 @@ const columnRawDefs = ref sortable: true, cellClass: centerCellClass, }, + recent_war: { + colId: "recent_war", + headerName: "최근전투", + field: "recent_war", + width: 60, + valueFormatter: ({ value, data }) => { + if (!data.st2) { + return "?"; + } + const turntime = value as string; + return turntime.substring(14, 19); + }, + sortable: true, + cellClass: centerCellClass, + }, years: { groupId: "years", headerName: "연도", @@ -1084,6 +1100,60 @@ const columnRawDefs = ref }, ], }, + warResults: { + groupId: "warResults", + headerName: "전과", + children: [ + { + colId: "warResults", + headerName: "요약", + cellRenderer: ({ data }: GenValueParams) => { + if (!data.st2) { + return "?"; + } + const killRatePercent = Math.round((data.killcrew / Math.max(1, data.deathcrew)) * 100); + return `${data.warnum.toLocaleString()}전 ${data.killnum.toLocaleString()}승
살상: ${killRatePercent}%`; + }, + cellClass: centerCellClass, + columnGroupShow: "closed", + width: 90, + }, + { + colId: "warnum", + headerName: "전투", + field: "warnum", + ...sortableNumber, + valueFormatter: numberFormatter("전"), + columnGroupShow: "open", + width: 60, + }, + { + colId: "killnum", + headerName: "승리", + field: "killnum", + ...sortableNumber, + valueFormatter: numberFormatter("승"), + columnGroupShow: "open", + width: 60, + }, + { + colId: "killcrew", + headerName: "살상률", + field: "killcrew", + ...sortableNumber, + valueGetter: ({ data }) => { + if (!data.st2) { + return "?"; + } + const killRatePercent = Math.round((data.killcrew / Math.max(1, data.deathcrew)) * 100); + return killRatePercent + }, + valueFormatter: numberFormatter("%"), + columnGroupShow: "open", + width: 60, + }, + ], + }, }); const columnDefs = ref([...Object.values(columnRawDefs.value)]); watch(columnRawDefs, (val) => { diff --git a/hwe/ts/defs/API/Nation.ts b/hwe/ts/defs/API/Nation.ts index 9248d0d0..6675055f 100644 --- a/hwe/ts/defs/API/Nation.ts +++ b/hwe/ts/defs/API/Nation.ts @@ -57,6 +57,7 @@ export type GeneralListItemP2 = GeneralListItemP1 & { train: number, atmos: number, turntime: string, + recent_war: string, horse: GameObjClassKey, weapon: GameObjClassKey, book: GameObjClassKey, diff --git a/hwe/ts/defs/gridDefs.ts b/hwe/ts/defs/gridDefs.ts index b54ac4cc..1eca66a7 100644 --- a/hwe/ts/defs/gridDefs.ts +++ b/hwe/ts/defs/gridDefs.ts @@ -185,6 +185,12 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> sort: "asc", sortIndex: 0, }, + { + colId: "recent_war", + width: 60, + hide: true, + sort: null, + }, { colId: "years_1", width: 60, @@ -221,6 +227,26 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> hide: true, sort: null, }, + { + colId: "warResults_1", + hide: true, + sort: null, + }, + { + colId: "warnum", + hide: true, + sort: null, + }, + { + colId: "killnum", + hide: true, + sort: null, + }, + { + colId: "killcrew", + hide: true, + sort: null, + }, ], columnGroup: [ { @@ -275,6 +301,10 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> groupId: "5", open: false, }, + { + groupId: "6", + open: false, + }, { groupId: "years", open: false, @@ -283,6 +313,10 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> groupId: "killturnAndConnect", open: true, }, + { + groupId: "warResults", + open: false + }, ], }, normal: { @@ -463,6 +497,12 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> hide: true, sort: null, }, + { + colId: "recent_war", + width: 60, + hide: true, + sort: null, + }, { colId: "years_1", width: 60, @@ -499,6 +539,26 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> hide: false, sort: "desc", sortIndex: 0, + }, + { + colId: "warResults_1", + hide: true, + sort: null, + }, + { + colId: "warnum", + hide: true, + sort: null, + }, + { + colId: "killnum", + hide: true, + sort: null, + }, + { + colId: "killcrew", + hide: true, + sort: null, } ], columnGroup: [ @@ -554,6 +614,10 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> groupId: "5", open: false }, + { + groupId: "6", + open: false, + }, { groupId: "years", open: false @@ -561,7 +625,11 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting> { groupId: "killturnAndConnect", open: true - } + }, + { + groupId: "warResults", + open: false + }, ], }, }; \ No newline at end of file