From aec4d7a3f39b393b525cf3c594d66a041a63c719 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Fri, 8 Apr 2022 01:48:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=84=B8=EB=A0=A5=EC=9E=A5=EC=88=98?= =?UTF-8?q?=EC=97=90=EC=84=9C=20'=ED=9C=B4=EC=8B=9D'=EC=9D=98=20'=EC=9E=90?= =?UTF-8?q?=EC=9C=A8=ED=96=89=EB=8F=99'=20=EC=97=AC=EB=B6=80=20=ED=8C=90?= =?UTF-8?q?=EB=B3=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/API/Nation/GeneralList.php | 2 +- hwe/ts/PageNationGeneral.vue | 1 + hwe/ts/components/GeneralList.vue | 56 +++++++++++++++++++++------- hwe/ts/defs/API/Nation.ts | 5 +++ 4 files changed, 49 insertions(+), 15 deletions(-) diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index 9dea5450..4b28dc45 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -130,7 +130,7 @@ class GeneralList extends \sammo\BaseAPI $db = DB::db(); $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()); $con = checkLimit($me['con']); diff --git a/hwe/ts/PageNationGeneral.vue b/hwe/ts/PageNationGeneral.vue index cd2b6042..5ca50076 100644 --- a/hwe/ts/PageNationGeneral.vue +++ b/hwe/ts/PageNationGeneral.vue @@ -42,6 +42,7 @@ const envVal = ref({ month: 1, turnterm: 1, turntime: "2022-02-22 22:22:22.22222", + killturn: 80, }); const toolbarID = "toolbar-id"; diff --git a/hwe/ts/components/GeneralList.vue b/hwe/ts/components/GeneralList.vue index 7a04e1a8..36fa65f2 100644 --- a/hwe/ts/components/GeneralList.vue +++ b/hwe/ts/components/GeneralList.vue @@ -90,7 +90,7 @@ import type { GridApi, GridReadyEvent, RowNode, -CellClickedEvent, + CellClickedEvent, } from "ag-grid-community"; import { ProvidedColumnGroup } from "ag-grid-community"; import { getNpcColor } from "@/common_legacy"; @@ -139,11 +139,11 @@ const props = defineProps({ type: Boolean, required: false, default: true, - } + }, }); const emit = defineEmits<{ - (e: 'generalClick', generalID: number): void + (e: "generalClick", generalID: number): void; }>(); const suppressColumnMoveAnimation = ref(true); @@ -154,7 +154,7 @@ const validColumns = ref(new Set()); watch( () => props.list, (newValue) => { - const newValidColumns = new Set(['icon']); + const newValidColumns = new Set(["icon"]); if (newValue.length > 0) { for (const key of Object.keys(newValue[0])) { newValidColumns.add(key); @@ -325,11 +325,11 @@ function onGridReady(params: GridReadyEvent) { }, 1); } -function onCellClicked(event: CellClickedEvent){ +function onCellClicked(event: CellClickedEvent) { const colID = event.column.getColId(); - if(colID === 'icon' || colID === 'name'){ + if (colID === "icon" || colID === "name") { const generalItem = event.data as GeneralListItem; - emit('generalClick', generalItem.no); + emit("generalClick", generalItem.no); } } @@ -503,7 +503,7 @@ const columnRawDefs = ref return ``; }, pinned: "left", - cellClass: [props.availableGeneralClick?'clickable-cell':'', ...defaultCellClass], + cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass], lockPosition: true, }, name: { @@ -523,7 +523,7 @@ const columnRawDefs = ref return style as CellStyle; }, filterValueGetter: ({ data }) => convertSearch초성(data.name), - cellClass: [props.availableGeneralClick?'clickable-cell':'', ...defaultCellClass], + cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass], filter: true, hide: false, lockVisible: true, @@ -701,8 +701,8 @@ const columnRawDefs = ref headerName: "부대", field: "troop", valueGetter: ({ data }: GenValueGetterParams) => { - if(!data.st2){ - return '?'; + if (!data.st2) { + return "?"; } const troopInfo = extractTroopInfo(data); if (troopInfo === undefined) { @@ -934,7 +934,21 @@ const columnRawDefs = ref if (!commandList) { return "???"; } - return commandList.map(({ action }) => naiveCheClassNameFilter(action)).join("
"); + 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("
"); }, cellStyle: { lineHeight: "1em", @@ -954,7 +968,21 @@ const columnRawDefs = ref if (!commandList) { return "???"; } - return commandList.map(({ brief }) => brief).join("
"); + 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("
"); }, cellStyle: { lineHeight: "1em", @@ -1076,7 +1104,7 @@ watch(columnRawDefs, (val) => {