feat: 세력장수에서 '휴식'의 '자율행동' 여부 판별

This commit is contained in:
2022-04-08 01:48:23 +09:00
parent f04845f7dd
commit aec4d7a3f3
4 changed files with 49 additions and 15 deletions
+1 -1
View File
@@ -130,7 +130,7 @@ class GeneralList extends \sammo\BaseAPI
$db = DB::db(); $db = DB::db();
$gameStor = \sammo\KVStorage::getStorage($db, 'game_env'); $gameStor = \sammo\KVStorage::getStorage($db, 'game_env');
$env = $gameStor->getValues(['year', 'month', 'turntime', 'turnterm']); $env = $gameStor->getValues(['year', 'month', 'turntime', 'turnterm', 'autorun_user', 'killturn']);
$me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $session->getUserID()); $me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $session->getUserID());
$con = checkLimit($me['con']); $con = checkLimit($me['con']);
+1
View File
@@ -42,6 +42,7 @@ const envVal = ref<GeneralListResponse["env"]>({
month: 1, month: 1,
turnterm: 1, turnterm: 1,
turntime: "2022-02-22 22:22:22.22222", turntime: "2022-02-22 22:22:22.22222",
killturn: 80,
}); });
const toolbarID = "toolbar-id"; const toolbarID = "toolbar-id";
+42 -14
View File
@@ -90,7 +90,7 @@ import type {
GridApi, GridApi,
GridReadyEvent, GridReadyEvent,
RowNode, RowNode,
CellClickedEvent, CellClickedEvent,
} from "ag-grid-community"; } from "ag-grid-community";
import { ProvidedColumnGroup } from "ag-grid-community"; import { ProvidedColumnGroup } from "ag-grid-community";
import { getNpcColor } from "@/common_legacy"; import { getNpcColor } from "@/common_legacy";
@@ -139,11 +139,11 @@ const props = defineProps({
type: Boolean, type: Boolean,
required: false, required: false,
default: true, default: true,
} },
}); });
const emit = defineEmits<{ const emit = defineEmits<{
(e: 'generalClick', generalID: number): void (e: "generalClick", generalID: number): void;
}>(); }>();
const suppressColumnMoveAnimation = ref(true); const suppressColumnMoveAnimation = ref(true);
@@ -154,7 +154,7 @@ const validColumns = ref(new Set<string>());
watch( watch(
() => props.list, () => props.list,
(newValue) => { (newValue) => {
const newValidColumns = new Set<string>(['icon']); const newValidColumns = new Set<string>(["icon"]);
if (newValue.length > 0) { if (newValue.length > 0) {
for (const key of Object.keys(newValue[0])) { for (const key of Object.keys(newValue[0])) {
newValidColumns.add(key); newValidColumns.add(key);
@@ -325,11 +325,11 @@ function onGridReady(params: GridReadyEvent) {
}, 1); }, 1);
} }
function onCellClicked(event: CellClickedEvent){ function onCellClicked(event: CellClickedEvent) {
const colID = event.column.getColId(); const colID = event.column.getColId();
if(colID === 'icon' || colID === 'name'){ if (colID === "icon" || colID === "name") {
const generalItem = event.data as GeneralListItem; const generalItem = event.data as GeneralListItem;
emit('generalClick', generalItem.no); emit("generalClick", generalItem.no);
} }
} }
@@ -503,7 +503,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
return `<img src="${getIconPath(gen.imgsvr, gen.picture)}" width="64">`; return `<img src="${getIconPath(gen.imgsvr, gen.picture)}" width="64">`;
}, },
pinned: "left", pinned: "left",
cellClass: [props.availableGeneralClick?'clickable-cell':'', ...defaultCellClass], cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
lockPosition: true, lockPosition: true,
}, },
name: { name: {
@@ -523,7 +523,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
return style as CellStyle; return style as CellStyle;
}, },
filterValueGetter: ({ data }) => convertSearch초성(data.name), filterValueGetter: ({ data }) => convertSearch초성(data.name),
cellClass: [props.availableGeneralClick?'clickable-cell':'', ...defaultCellClass], cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
filter: true, filter: true,
hide: false, hide: false,
lockVisible: true, lockVisible: true,
@@ -701,8 +701,8 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
headerName: "부대", headerName: "부대",
field: "troop", field: "troop",
valueGetter: ({ data }: GenValueGetterParams) => { valueGetter: ({ data }: GenValueGetterParams) => {
if(!data.st2){ if (!data.st2) {
return '?'; return "?";
} }
const troopInfo = extractTroopInfo(data); const troopInfo = extractTroopInfo(data);
if (troopInfo === undefined) { if (troopInfo === undefined) {
@@ -934,7 +934,21 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
if (!commandList) { if (!commandList) {
return "???"; return "???";
} }
return commandList.map(({ action }) => naiveCheClassNameFilter(action)).join("<br>"); return commandList
.map(({ action }) => {
if (action !== "휴식" || data.npc >= 2) {
return naiveCheClassNameFilter(action);
}
const limitMinutes = props.env.autorun_user?.limit_minutes ?? 0;
if (!limitMinutes) {
return naiveCheClassNameFilter(action);
}
if (data.killturn + limitMinutes > props.env.killturn) {
return "자율행동";
}
return naiveCheClassNameFilter(action);
})
.join("<br>");
}, },
cellStyle: { cellStyle: {
lineHeight: "1em", lineHeight: "1em",
@@ -954,7 +968,21 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
if (!commandList) { if (!commandList) {
return "???"; return "???";
} }
return commandList.map(({ brief }) => brief).join("<br>"); return commandList
.map(({ action, brief }) => {
if (action !== "휴식" || data.npc >= 2) {
return brief;
}
const limitMinutes = props.env.autorun_user?.limit_minutes ?? 0;
if (!limitMinutes) {
return brief;
}
if (data.killturn + limitMinutes > props.env.killturn) {
return "자율 행동";
}
return brief;
})
.join("<br>");
}, },
cellStyle: { cellStyle: {
lineHeight: "1em", lineHeight: "1em",
@@ -1076,7 +1104,7 @@ watch(columnRawDefs, (val) => {
</style> </style>
<style lang="scss"> <style lang="scss">
.component-general-list { .component-general-list {
.clickable-cell:hover{ .clickable-cell:hover {
text-decoration: underline; text-decoration: underline;
cursor: pointer; cursor: pointer;
} }
+5
View File
@@ -82,6 +82,11 @@ type ResponseEnv = {
month: number, month: number,
turntime: string, turntime: string,
turnterm: number, turnterm: number,
killturn: number,
autorun_user?: {
limit_minutes: number,
options: Record<string, number>,
}
} }
export type RawGeneralListP0 = ValidResponse & { export type RawGeneralListP0 = ValidResponse & {