fix: 본인이 아닌 수뇌자리에도 부대장 발령 표기
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-for="(officer, _idx) in [chiefList[chiefLevel]]"
|
|
||||||
:key="_idx"
|
|
||||||
:class="[`chiefBox${chiefLevel}`, 'subRows']"
|
:class="[`chiefBox${chiefLevel}`, 'subRows']"
|
||||||
:style="style"
|
:style="style"
|
||||||
@click="$emit('click', this)"
|
@click="$emit('click', this)"
|
||||||
@@ -37,15 +35,19 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getNpcColor } from "@/common_legacy";
|
import { getNpcColor } from "@/common_legacy";
|
||||||
|
import type { ChiefResponse } from "@/defs/API/NationCommand";
|
||||||
import { mb_strwidth } from "@/util/mb_strwidth";
|
import { mb_strwidth } from "@/util/mb_strwidth";
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import VueTypes from "vue-types";
|
import VueTypes from "vue-types";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
chiefLevel: VueTypes.integer.isRequired,
|
chiefLevel: VueTypes.integer.isRequired,
|
||||||
style: VueTypes.object.isRequired,
|
style: VueTypes.object.isRequired,
|
||||||
chiefList: VueTypes.object.isRequired,
|
officer: {
|
||||||
|
type: Object as PropType<ChiefResponse['chiefList'][0]>,
|
||||||
|
default: undefined,
|
||||||
|
},
|
||||||
isMe: VueTypes.bool.isRequired,
|
isMe: VueTypes.bool.isRequired,
|
||||||
},
|
},
|
||||||
emits: ["click"],
|
emits: ["click"],
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
<div id="container" class="pageChiefCenter">
|
<div id="container" class="pageChiefCenter">
|
||||||
<TopBackBar title="사령부" reloadable @reload="reloadTable" />
|
<TopBackBar title="사령부" reloadable @reload="reloadTable" />
|
||||||
|
|
||||||
<div v-if="asyncReady && chiefList !== undefined" id="mainTable" :class="`${targetIsMe ? 'targetIsMe' : 'targetIsNotMe'}`">
|
<div
|
||||||
|
v-if="asyncReady && chiefList !== undefined"
|
||||||
|
id="mainTable"
|
||||||
|
:class="`${targetIsMe ? 'targetIsMe' : 'targetIsNotMe'}`"
|
||||||
|
>
|
||||||
<template v-for="(chiefLevel, vidx) in [12, 10, 8, 6, 11, 9, 7, 5]" :key="chiefLevel">
|
<template v-for="(chiefLevel, vidx) in [12, 10, 8, 6, 11, 9, 7, 5]" :key="chiefLevel">
|
||||||
<div v-if="vidx % 4 == 0" :class="['turnIdx', vidx == 0 && !targetIsMe ? undefined : 'only1000px']">
|
<div v-if="vidx % 4 == 0" :class="['turnIdx', vidx == 0 && !targetIsMe ? undefined : 'only1000px']">
|
||||||
<div :class="['subRows', 'bg0']" :style="mainTableGridRows">
|
<div :class="['subRows', 'bg0']" :style="mainTableGridRows">
|
||||||
@@ -20,7 +24,7 @@
|
|||||||
<TopItem
|
<TopItem
|
||||||
v-if="officerLevel != chiefLevel"
|
v-if="officerLevel != chiefLevel"
|
||||||
:style="mainTableGridRows"
|
:style="mainTableGridRows"
|
||||||
:officer="officer"
|
:officer="postFilterOfficer(chiefList[chiefLevel])"
|
||||||
:maxTurn="maxChiefTurn"
|
:maxTurn="maxChiefTurn"
|
||||||
:turnTerm="turnTerm"
|
:turnTerm="turnTerm"
|
||||||
/>
|
/>
|
||||||
@@ -64,7 +68,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<BottomItem
|
<BottomItem
|
||||||
:chiefLevel="chiefLevel"
|
:chiefLevel="chiefLevel"
|
||||||
:chiefList="chiefList"
|
:officer="postFilterOfficer(chiefList[chiefLevel])"
|
||||||
:style="subTableGridRows"
|
:style="subTableGridRows"
|
||||||
:isMe="chiefLevel == officerLevel"
|
:isMe="chiefLevel == officerLevel"
|
||||||
@click="viewTarget = chiefLevel"
|
@click="viewTarget = chiefLevel"
|
||||||
@@ -103,12 +107,13 @@ import { isString } from "lodash";
|
|||||||
import { entriesWithType } from "./util/entriesWithType";
|
import { entriesWithType } from "./util/entriesWithType";
|
||||||
import TopItem from "@/ChiefCenter/TopItem.vue";
|
import TopItem from "@/ChiefCenter/TopItem.vue";
|
||||||
import BottomItem from "@/ChiefCenter/BottomItem.vue";
|
import BottomItem from "@/ChiefCenter/BottomItem.vue";
|
||||||
import type { OptionalFull } from "./defs";
|
import type { OptionalFull, TurnObj } from "./defs";
|
||||||
import { SammoAPI } from "./SammoAPI";
|
import { SammoAPI } from "./SammoAPI";
|
||||||
import { unwrap } from "@/util/unwrap";
|
import { unwrap } from "@/util/unwrap";
|
||||||
import { StoredActionsHelper } from "./util/StoredActionsHelper";
|
import { StoredActionsHelper } from "./util/StoredActionsHelper";
|
||||||
import type { ChiefResponse } from "./defs/API/NationCommand";
|
import type { ChiefResponse } from "./defs/API/NationCommand";
|
||||||
import { getGameConstStore, type GameConstStore } from "./GameConstStore";
|
import { getGameConstStore, type GameConstStore } from "./GameConstStore";
|
||||||
|
import { postFilterNationCommandGen } from "./utilGame/postFilterNationCommandGen";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
maxChiefTurn: VueTypes.number.isRequired,
|
maxChiefTurn: VueTypes.number.isRequired,
|
||||||
@@ -143,6 +148,32 @@ const tableObj = reactive<Omit<OptionalFull<ChiefResponse>, "result">>({
|
|||||||
|
|
||||||
const { year, month, turnTerm, date, chiefList, troopList, officerLevel, commandList } = toRefs(tableObj);
|
const { year, month, turnTerm, date, chiefList, troopList, officerLevel, commandList } = toRefs(tableObj);
|
||||||
|
|
||||||
|
let postFilterNationCommand = function (turnObj: TurnObj): TurnObj {
|
||||||
|
return turnObj;
|
||||||
|
};
|
||||||
|
|
||||||
|
watch([tableObj, gameConstStore], ([tableObj, gameConstStore]) => {
|
||||||
|
if (tableObj.troopList === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gameConstStore === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
postFilterNationCommand = postFilterNationCommandGen(tableObj.troopList, gameConstStore);
|
||||||
|
});
|
||||||
|
|
||||||
|
type OfficerObj = ChiefResponse["chiefList"][0];
|
||||||
|
function postFilterOfficer(officer: OfficerObj|undefined): OfficerObj|undefined {
|
||||||
|
if(officer === undefined) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...officer,
|
||||||
|
turn: officer.turn.map(postFilterNationCommand),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const viewTarget = ref<number | undefined>();
|
const viewTarget = ref<number | undefined>();
|
||||||
|
|
||||||
const targetIsMe = ref<boolean>(false);
|
const targetIsMe = ref<boolean>(false);
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ import DragSelect from "@/components/DragSelect.vue";
|
|||||||
import { isString, range, trim } from "lodash";
|
import { isString, range, trim } from "lodash";
|
||||||
import { SammoAPI } from "@/SammoAPI";
|
import { SammoAPI } from "@/SammoAPI";
|
||||||
import type { CommandItem, TurnObj } from "@/defs";
|
import type { CommandItem, TurnObj } from "@/defs";
|
||||||
import { QueryActionHelper } from "@/util/QueryActionHelper";
|
import { QueryActionHelper, type TurnObjWithTime } from "@/util/QueryActionHelper";
|
||||||
import type { Args } from "@/processing/args";
|
import type { Args } from "@/processing/args";
|
||||||
import type { StoredActionsHelper } from "@/util/StoredActionsHelper";
|
import type { StoredActionsHelper } from "@/util/StoredActionsHelper";
|
||||||
import { getNpcColor } from "@/common_legacy";
|
import { getNpcColor } from "@/common_legacy";
|
||||||
@@ -276,18 +276,9 @@ import { BButton, BDropdownItem, BDropdownText, BButtonGroup, BDropdownDivider,
|
|||||||
import CommandSelectForm from "@/components/CommandSelectForm.vue";
|
import CommandSelectForm from "@/components/CommandSelectForm.vue";
|
||||||
import SimpleClock from "@/components/SimpleClock.vue";
|
import SimpleClock from "@/components/SimpleClock.vue";
|
||||||
import type { ChiefResponse } from "@/defs/API/NationCommand";
|
import type { ChiefResponse } from "@/defs/API/NationCommand";
|
||||||
import { unwrap } from "@/util/unwrap";
|
|
||||||
import { unwrap_err } from "@/util/unwrap_err";
|
import { unwrap_err } from "@/util/unwrap_err";
|
||||||
import type { GameConstStore } from "@/GameConstStore";
|
import type { GameConstStore } from "@/GameConstStore";
|
||||||
import { pick as josaPick } from "@/util/JosaUtil";
|
import { postFilterNationCommandGen } from "@/utilGame/postFilterNationCommandGen";
|
||||||
|
|
||||||
type TurnObjWithTime = TurnObj & {
|
|
||||||
time: string;
|
|
||||||
year?: number;
|
|
||||||
month?: number;
|
|
||||||
tooltip?: string;
|
|
||||||
style?: Record<string, unknown>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
maxTurn: VueTypes.integer.isRequired,
|
maxTurn: VueTypes.integer.isRequired,
|
||||||
@@ -451,28 +442,7 @@ const gameConstStore = unwrap_err(
|
|||||||
"gameConstStore가 주입되지 않았습니다."
|
"gameConstStore가 주입되지 않았습니다."
|
||||||
);
|
);
|
||||||
|
|
||||||
function postFilterTurnBrief(turnObj: TurnObjWithTime): TurnObjWithTime{
|
const postFilterTurnBrief = postFilterNationCommandGen<TurnObjWithTime>(props.troopList, gameConstStore.value);
|
||||||
if(turnObj.action != 'che_발령'){
|
|
||||||
return turnObj;
|
|
||||||
}
|
|
||||||
const destGeneralID = unwrap(turnObj.arg.destGeneralID);
|
|
||||||
if(!(destGeneralID in props.troopList)){
|
|
||||||
return turnObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
const troopName = props.troopList[destGeneralID];
|
|
||||||
const destCityID = unwrap(turnObj.arg.destCityID);
|
|
||||||
const destCityName = gameConstStore.value.cityConst[destCityID].name;
|
|
||||||
const josaRo = josaPick(destCityName, "로");
|
|
||||||
const brief = `《${troopName}》【${destCityName}】${josaRo} 발령`;
|
|
||||||
const tooltip = `《${troopName}》${turnObj.brief}`;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...turnObj,
|
|
||||||
brief,
|
|
||||||
tooltip,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const queryActionHelper = new QueryActionHelper(props.maxTurn);
|
const queryActionHelper = new QueryActionHelper(props.maxTurn);
|
||||||
const reservedCommandList = queryActionHelper.reservedCommandList;
|
const reservedCommandList = queryActionHelper.reservedCommandList;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { clone, isString, range } from "lodash";
|
|||||||
import { ref, type Ref } from "vue";
|
import { ref, type Ref } from "vue";
|
||||||
import { unwrap } from "./unwrap";
|
import { unwrap } from "./unwrap";
|
||||||
|
|
||||||
type TurnObjWithTime = TurnObj & {
|
export type TurnObjWithTime = TurnObj & {
|
||||||
time: string;
|
time: string;
|
||||||
year?: number;
|
year?: number;
|
||||||
month?: number;
|
month?: number;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import type { GameConstStore } from "@/GameConstStore";
|
||||||
|
import { unwrap } from "@/util/unwrap";
|
||||||
|
import { pick as josaPick } from "@/util/JosaUtil";
|
||||||
|
import type { TurnObj } from "@/defs";
|
||||||
|
|
||||||
|
export function postFilterNationCommandGen<T extends TurnObj>(troopList: Record<number, string>, gameConst: GameConstStore){
|
||||||
|
return function(turnObj: T): T{
|
||||||
|
if(turnObj.action != 'che_발령'){
|
||||||
|
return turnObj;
|
||||||
|
}
|
||||||
|
const destGeneralID = unwrap(turnObj.arg.destGeneralID);
|
||||||
|
if(!(destGeneralID in troopList)){
|
||||||
|
return turnObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
const troopName = troopList[destGeneralID];
|
||||||
|
const destCityID = unwrap(turnObj.arg.destCityID);
|
||||||
|
const destCityName = gameConst.cityConst[destCityID].name;
|
||||||
|
const josaRo = josaPick(destCityName, "로");
|
||||||
|
const brief = `《${troopName}》【${destCityName}】${josaRo} 발령`;
|
||||||
|
const tooltip = `《${troopName}》${turnObj.brief}`;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...turnObj,
|
||||||
|
brief,
|
||||||
|
tooltip,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user