feat: 최근 전투, 전투(전/승/살상률) 추가
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
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 `<span style="color:cyan;">${data.officerLevelText}</span>`;
|
||||
}
|
||||
if (data.st2 && 2 <= data.officerLevel && data.officerLevel <= 4) {
|
||||
@@ -1010,6 +1011,21 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
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<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
||||
},
|
||||
],
|
||||
},
|
||||
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()}승<br>살상: ${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) => {
|
||||
|
||||
@@ -57,6 +57,7 @@ export type GeneralListItemP2 = GeneralListItemP1 & {
|
||||
train: number,
|
||||
atmos: number,
|
||||
turntime: string,
|
||||
recent_war: string,
|
||||
horse: GameObjClassKey,
|
||||
weapon: GameObjClassKey,
|
||||
book: GameObjClassKey,
|
||||
|
||||
+69
-1
@@ -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
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user