wip: 출력 시작
This commit is contained in:
@@ -26,7 +26,13 @@ class GetNationInfo extends \sammo\BaseAPI
|
|||||||
{
|
{
|
||||||
public function validateArgs(): ?string
|
public function validateArgs(): ?string
|
||||||
{
|
{
|
||||||
return null;
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('boolean', 'full');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredSessionMode(): int
|
public function getRequiredSessionMode(): int
|
||||||
@@ -48,6 +54,16 @@ class GetNationInfo extends \sammo\BaseAPI
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$isFull = $this->args['full'] ?? false;
|
||||||
|
|
||||||
|
if(!$isFull){
|
||||||
|
$nation = getNationStaticInfo($nationID);
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'nation' => $nation,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
$generalObj = General::createGeneralObjFromDB($session->generalID, null, 1);
|
$generalObj = General::createGeneralObjFromDB($session->generalID, null, 1);
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<?=$btnBegin??''?><a href='v_nationGeneral.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 장수</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='v_nationGeneral.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 장수</a><?=$btnEnd??''?>
|
||||||
<?=$btnBegin??''?><a href='v_globalDiplomacy.php' class='commandButton <?=$btnClass??""?>'>중원 정보</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='v_globalDiplomacy.php' class='commandButton <?=$btnClass??""?>'>중원 정보</a><?=$btnEnd??''?>
|
||||||
<?=$btnBegin??''?><a href='b_currentCity.php' class='commandButton <?=$btnClass??""?>'>현재 도시</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='b_currentCity.php' class='commandButton <?=$btnClass??""?>'>현재 도시</a><?=$btnEnd??''?>
|
||||||
<?=$btnBegin??''?><a href='b_battleCenter.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>감 찰 부</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='v_battleCenter.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>감 찰 부</a><?=$btnEnd??''?>
|
||||||
<?=$btnBegin??''?><a href='v_inheritPoint.php' class='commandButton <?=$btnClass??""?>'>유산 관리</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='v_inheritPoint.php' class='commandButton <?=$btnClass??""?>'>유산 관리</a><?=$btnEnd??''?>
|
||||||
<?=$btnBegin??''?><a href='b_myPage.php' class='commandButton <?=$btnClass??""?>'>내 정보&설정</a><?=$btnEnd??''?>
|
<?=$btnBegin??''?><a href='b_myPage.php' class='commandButton <?=$btnClass??""?>'>내 정보&설정</a><?=$btnEnd??''?>
|
||||||
<?=$splitBtnBegin??''?>
|
<?=$splitBtnBegin??''?>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</BFormSelectOption>
|
</BFormSelectOption>
|
||||||
</BFormSelect>
|
</BFormSelect>
|
||||||
</div>
|
</div>
|
||||||
<!--<GeneralBasicCard v-if="targetGeneral" :general="targetGeneral" :nation="" />-->
|
<GeneralBasicCard v-if="targetGeneral && nationInfo" :general="targetGeneral" :nation="nationInfo" />
|
||||||
<BottomBar></BottomBar>
|
<BottomBar></BottomBar>
|
||||||
</BContainer>
|
</BContainer>
|
||||||
</template>
|
</template>
|
||||||
@@ -41,6 +41,7 @@ import { unwrap } from "@/util/unwrap";
|
|||||||
import { merge2DArrToObjectArr } from "@/util/merge2DArrToObjectArr";
|
import { merge2DArrToObjectArr } from "@/util/merge2DArrToObjectArr";
|
||||||
import { getNpcColor } from "@/common_legacy";
|
import { getNpcColor } from "@/common_legacy";
|
||||||
import GeneralBasicCard from "./components/GeneralBasicCard.vue";
|
import GeneralBasicCard from "./components/GeneralBasicCard.vue";
|
||||||
|
import type { NationStaticItem } from "./defs";
|
||||||
|
|
||||||
const toasts = unwrap(useToast());
|
const toasts = unwrap(useToast());
|
||||||
|
|
||||||
@@ -57,12 +58,15 @@ const orderBy = ref<keyof typeof textMap>("turntime");
|
|||||||
const targetGeneral = ref<GeneralListItemP1>();
|
const targetGeneral = ref<GeneralListItemP1>();
|
||||||
const targetGeneralID = ref(queryValues.generalID ?? undefined);
|
const targetGeneralID = ref(queryValues.generalID ?? undefined);
|
||||||
|
|
||||||
|
const nationInfo = ref<NationStaticItem>();
|
||||||
|
|
||||||
watch([generalList, targetGeneralID], ([generalList, targetGeneralID]) => {
|
watch([generalList, targetGeneralID], ([generalList, targetGeneralID]) => {
|
||||||
if (targetGeneralID === undefined) return;
|
if (targetGeneralID === undefined) return;
|
||||||
targetGeneral.value = generalList.get(targetGeneralID);
|
targetGeneral.value = generalList.get(targetGeneralID);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch([generalList, orderBy], ([generalList, orderBy]) => {
|
watch([generalList, orderBy], ([generalList, orderBy]) => {
|
||||||
|
console.log(generalList);
|
||||||
const list = Array.from(generalList.values());
|
const list = Array.from(generalList.values());
|
||||||
list.sort((a, b) => {
|
list.sort((a, b) => {
|
||||||
const [, getter, isAsc] = textMap[orderBy];
|
const [, getter, isAsc] = textMap[orderBy];
|
||||||
@@ -90,16 +94,24 @@ async function reload(): Promise<void> {
|
|||||||
console.log("갱신 시도");
|
console.log("갱신 시도");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const nationP = SammoAPI.Nation.GetNationInfo({});
|
||||||
const { column, list, permission, troops, env } = await SammoAPI.Nation.GeneralList();
|
const { column, list, permission, troops, env } = await SammoAPI.Nation.GeneralList();
|
||||||
|
|
||||||
if (permission === 0) {
|
if (permission === 0) {
|
||||||
throw "권한이 부족합니다.";
|
throw "권한이 부족합니다.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(list);
|
||||||
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
||||||
|
|
||||||
const newList = new Map<number, GeneralListItemP1>();
|
const newList = new Map<number, GeneralListItemP1>();
|
||||||
for (const general of rawGeneralList) {
|
for (const general of rawGeneralList) {
|
||||||
newList.set(general.no, general);
|
newList.set(general.no, general);
|
||||||
}
|
}
|
||||||
|
generalList.value = newList;
|
||||||
|
|
||||||
|
const { nation } = await nationP;
|
||||||
|
nationInfo.value = nation;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toasts.danger({
|
toasts.danger({
|
||||||
title: "오류",
|
title: "오류",
|
||||||
|
|||||||
+2
-1
@@ -18,7 +18,7 @@ import type { BettingDetailResponse, BettingListResponse } from "./defs/API/Bett
|
|||||||
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse } from "./defs/API/Command";
|
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse } from "./defs/API/Command";
|
||||||
import type { ChiefResponse } from "./defs/API/NationCommand";
|
import type { ChiefResponse } from "./defs/API/NationCommand";
|
||||||
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
||||||
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse } from "./defs/API/Nation";
|
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse, LiteNationInfoResponse, NationInfoResponse } from "./defs/API/Nation";
|
||||||
import type { UploadImageResponse } from "./defs/API/Misc";
|
import type { UploadImageResponse } from "./defs/API/Misc";
|
||||||
import type { GeneralLogType, GetGeneralLogResponse, JoinArgs } from "./defs/API/General";
|
import type { GeneralLogType, GetGeneralLogResponse, JoinArgs } from "./defs/API/General";
|
||||||
import type {
|
import type {
|
||||||
@@ -231,6 +231,7 @@ const apiRealPath = {
|
|||||||
troopID: number;
|
troopID: number;
|
||||||
troopName: string;
|
troopName: string;
|
||||||
}>,
|
}>,
|
||||||
|
GetNationInfo: GET as APICallT<{full?: boolean}, NationInfoResponse>,
|
||||||
},
|
},
|
||||||
Vote: {
|
Vote: {
|
||||||
AddComment: POST as APICallT<{
|
AddComment: POST as APICallT<{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
},
|
},
|
||||||
"ingame_vue": {
|
"ingame_vue": {
|
||||||
"v_auction": "v_auction.ts",
|
"v_auction": "v_auction.ts",
|
||||||
|
"v_battleCenter": "v_battleCenter.ts",
|
||||||
"v_inheritPoint": "v_inheritPoint.ts",
|
"v_inheritPoint": "v_inheritPoint.ts",
|
||||||
"v_board": "v_board.ts",
|
"v_board": "v_board.ts",
|
||||||
"v_cachedMap": "v_cachedMap",
|
"v_cachedMap": "v_cachedMap",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { ValuesOf, TurnObj } from "@/defs";
|
import type { ValuesOf, TurnObj, NationStaticItem } from "@/defs";
|
||||||
import type { GameObjClassKey } from "@/defs/GameObj";
|
import type { GameObjClassKey } from "@/defs/GameObj";
|
||||||
import type { ValidResponse } from "@/SammoAPI";
|
import type { ValidResponse } from "@/SammoAPI";
|
||||||
|
|
||||||
@@ -127,3 +127,29 @@ export type RawGeneralListP2 = ValidResponse & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type GeneralListResponse = RawGeneralListP0 | RawGeneralListP1 | RawGeneralListP2;
|
export type GeneralListResponse = RawGeneralListP0 | RawGeneralListP1 | RawGeneralListP2;
|
||||||
|
|
||||||
|
export type NationItem = NationStaticItem & {
|
||||||
|
gold: number;
|
||||||
|
rice: number;
|
||||||
|
bill: number;
|
||||||
|
rate: number;
|
||||||
|
secretlimit: number;
|
||||||
|
chief_set: number;
|
||||||
|
scout: number;
|
||||||
|
war: number;
|
||||||
|
strategic_cmd_limit: number;
|
||||||
|
surlimit: number;
|
||||||
|
tech: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type LiteNationInfoResponse = ValidResponse & {
|
||||||
|
nation: NationStaticItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type NationInfoResponse = (ValidResponse & {
|
||||||
|
nation: NationStaticItem;
|
||||||
|
}) | (ValidResponse &{
|
||||||
|
nation: NationItem;
|
||||||
|
impossibleStrategicCommandLists: [string, number][];
|
||||||
|
troops: Record<number, string>;
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user