feat: 장수 패널에 개인 전략 표기
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
namespace sammo\API\Nation;
|
namespace sammo\API\Nation;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
|
use sammo\Command\UserActionCommand;
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
|
use sammo\DTO\UserAction;
|
||||||
use sammo\Enums\APIRecoveryType;
|
use sammo\Enums\APIRecoveryType;
|
||||||
use sammo\Enums\GeneralLiteQueryMode;
|
use sammo\Enums\GeneralLiteQueryMode;
|
||||||
use sammo\Enums\GeneralQueryMode;
|
use sammo\Enums\GeneralQueryMode;
|
||||||
@@ -117,6 +119,8 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'reservedCommand' => 1,
|
'reservedCommand' => 1,
|
||||||
|
|
||||||
'autorun_limit' => 1,
|
'autorun_limit' => 1,
|
||||||
|
|
||||||
|
'impossibleUserAction' => 1,
|
||||||
];
|
];
|
||||||
|
|
||||||
public function validateArgs(): ?string
|
public function validateArgs(): ?string
|
||||||
@@ -153,7 +157,8 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
|
|
||||||
$me = $db->queryFirstRow(
|
$me = $db->queryFirstRow(
|
||||||
'SELECT refresh_score, turntime, belong, nation, officer_level, permission, penalty FROM `general`
|
'SELECT refresh_score, turntime, belong, nation, officer_level, permission, penalty FROM `general`
|
||||||
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i', $session->getUserID()
|
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i',
|
||||||
|
$session->getUserID()
|
||||||
);
|
);
|
||||||
$limitState = checkLimit($me['refresh_score']);
|
$limitState = checkLimit($me['refresh_score']);
|
||||||
if ($limitState >= 2) {
|
if ($limitState >= 2) {
|
||||||
@@ -269,6 +274,21 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
|
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
|
||||||
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
|
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
|
||||||
'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0,
|
'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0,
|
||||||
|
'impossibleUserAction' => function ($rawGeneral) use ($env) {
|
||||||
|
$rawUserAction = ($rawGeneral['aux'] ?? [])[UserActionCommand::USER_ACTION_KEY] ?? [];
|
||||||
|
$userAction = UserAction::fromArray($rawUserAction);
|
||||||
|
$impossibleUserAction = [];
|
||||||
|
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
||||||
|
|
||||||
|
if ($userAction->nextAvailableTurn) {
|
||||||
|
foreach ($userAction->nextAvailableTurn as $command => $nextAvailableTurn) {
|
||||||
|
if ($nextAvailableTurn > $yearMonth) {
|
||||||
|
$impossibleUserAction[] = [$command, $nextAvailableTurn - $yearMonth];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $impossibleUserAction;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($rankColumns as $rankKey) {
|
foreach ($rankColumns as $rankKey) {
|
||||||
|
|||||||
+16
-11
@@ -1,17 +1,22 @@
|
|||||||
<template>
|
<template>
|
||||||
<BContainer id="container" ref="container" :toast="{ root: true }">
|
<BContainer id="container" ref="container" :toast="{ root: true }">
|
||||||
<TopBackBar :reloadable="true" title="개인 전략" @reload="refresh" />
|
<TopBackBar :reloadable="true" title="개인 전략" @reload="refresh" />
|
||||||
<div v-if="asyncReady && gameConstStore && generalInfo && frontInfo && globalInfo && nationStaticInfo" id="pages" class="bg0">
|
<div v-if="asyncReady && gameConstStore && generalInfo && frontInfo && globalInfo && nationStaticInfo" id="pages"
|
||||||
|
class="bg0">
|
||||||
<div id="leftPanel">
|
<div id="leftPanel">
|
||||||
<GeneralBasicCard :general="generalInfo" :nation="nationStaticInfo" :troopInfo="frontInfo.general.troopInfo"
|
<GeneralBasicCard :general="generalInfo" :nation="nationStaticInfo" :troopInfo="frontInfo.general.troopInfo"
|
||||||
:turnTerm="globalInfo.turnterm" :lastExecuted="lastExecuted" />
|
:turnTerm="globalInfo.turnterm" :lastExecuted="lastExecuted" />
|
||||||
|
<div class="bg1" style="margin-top: 10px;">
|
||||||
|
대기 중인 전략
|
||||||
|
</div>
|
||||||
|
<div v-for="[command, turn] of frontInfo.general.impossibleUserAction" :key="command">
|
||||||
|
<span>{{ command }}</span>: {{ turn.toLocaleString() }}턴 뒤
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="actionForm">
|
<div id="actionForm">
|
||||||
<ReservedCommandForUserAction ref="reservedCommandPanel" />
|
<ReservedCommandForUserAction ref="reservedCommandPanel" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</BContainer>
|
</BContainer>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -91,14 +96,14 @@ async function refresh() {
|
|||||||
|
|
||||||
const rawNation = frontResponse.nation;
|
const rawNation = frontResponse.nation;
|
||||||
nationStaticInfo.value = {
|
nationStaticInfo.value = {
|
||||||
nation: rawNation.id,
|
nation: rawNation.id,
|
||||||
name: rawNation.name,
|
name: rawNation.name,
|
||||||
color: rawNation.color,
|
color: rawNation.color,
|
||||||
type: rawNation.type.raw,
|
type: rawNation.type.raw,
|
||||||
level: rawNation.level,
|
level: rawNation.level,
|
||||||
capital: rawNation.capital,
|
capital: rawNation.capital,
|
||||||
gennum: rawNation.gennum,
|
gennum: rawNation.gennum,
|
||||||
power: rawNation.power
|
power: rawNation.power
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,17 @@
|
|||||||
{{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
|
{{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="bg1">전략</div>
|
||||||
|
<div
|
||||||
|
v-if="impossibleUserActionText"
|
||||||
|
v-b-tooltip.hover="impossibleUserActionText"
|
||||||
|
style="text-decoration: underline dashed red"
|
||||||
|
>
|
||||||
|
<span style="color: yellow">가능</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="strategicClg-body tb-body">
|
||||||
|
<span style="color: limegreen">가능</span>
|
||||||
|
</div>
|
||||||
<div class="bg1">벌점</div>
|
<div class="bg1">벌점</div>
|
||||||
<div class="general-refresh-score-total">
|
<div class="general-refresh-score-total">
|
||||||
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
||||||
@@ -272,6 +283,25 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const impossibleUserActionText = ref<string>("");
|
||||||
|
watch(
|
||||||
|
general,
|
||||||
|
(general) => {
|
||||||
|
const impossibleUserAction = general.impossibleUserAction;
|
||||||
|
if (impossibleUserAction.length == 0) {
|
||||||
|
impossibleUserActionText.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const texts = [];
|
||||||
|
for (const [cmdName, turnCnt] of impossibleUserAction) {
|
||||||
|
texts.push(`${cmdName}: ${turnCnt.toLocaleString()}턴 뒤`);
|
||||||
|
}
|
||||||
|
impossibleUserActionText.value = texts.join("<br>\n");
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
const nextExecuteMinute = ref(999);
|
const nextExecuteMinute = ref(999);
|
||||||
watch(
|
watch(
|
||||||
general,
|
general,
|
||||||
@@ -341,7 +371,4 @@ watch(
|
|||||||
grid-column: 2 / 4;
|
grid-column: 2 / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.general-refresh-score-total {
|
|
||||||
grid-column: 5 / 8;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ export type GetFrontInfoResponse = {
|
|||||||
};
|
};
|
||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
impossibleUserAction: [string, number][];
|
|
||||||
};
|
};
|
||||||
nation: {
|
nation: {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ export type GeneralListItemP1 = {
|
|||||||
killcrew: number;
|
killcrew: number;
|
||||||
deathcrew: number;
|
deathcrew: number;
|
||||||
firenum: number;
|
firenum: number;
|
||||||
|
|
||||||
|
impossibleUserAction: [string, number][];
|
||||||
} & GeneralListItemP0;
|
} & GeneralListItemP0;
|
||||||
|
|
||||||
export type GeneralListItemP2 = GeneralListItemP1;
|
export type GeneralListItemP2 = GeneralListItemP1;
|
||||||
|
|||||||
Reference in New Issue
Block a user