wip: 출력 시작
This commit is contained in:
@@ -26,7 +26,13 @@ class GetNationInfo extends \sammo\BaseAPI
|
||||
{
|
||||
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
|
||||
@@ -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);
|
||||
|
||||
$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_globalDiplomacy.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='b_myPage.php' class='commandButton <?=$btnClass??""?>'>내 정보&설정</a><?=$btnEnd??''?>
|
||||
<?=$splitBtnBegin??''?>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</BFormSelectOption>
|
||||
</BFormSelect>
|
||||
</div>
|
||||
<!--<GeneralBasicCard v-if="targetGeneral" :general="targetGeneral" :nation="" />-->
|
||||
<GeneralBasicCard v-if="targetGeneral && nationInfo" :general="targetGeneral" :nation="nationInfo" />
|
||||
<BottomBar></BottomBar>
|
||||
</BContainer>
|
||||
</template>
|
||||
@@ -41,6 +41,7 @@ import { unwrap } from "@/util/unwrap";
|
||||
import { merge2DArrToObjectArr } from "@/util/merge2DArrToObjectArr";
|
||||
import { getNpcColor } from "@/common_legacy";
|
||||
import GeneralBasicCard from "./components/GeneralBasicCard.vue";
|
||||
import type { NationStaticItem } from "./defs";
|
||||
|
||||
const toasts = unwrap(useToast());
|
||||
|
||||
@@ -57,12 +58,15 @@ const orderBy = ref<keyof typeof textMap>("turntime");
|
||||
const targetGeneral = ref<GeneralListItemP1>();
|
||||
const targetGeneralID = ref(queryValues.generalID ?? undefined);
|
||||
|
||||
const nationInfo = ref<NationStaticItem>();
|
||||
|
||||
watch([generalList, targetGeneralID], ([generalList, targetGeneralID]) => {
|
||||
if (targetGeneralID === undefined) return;
|
||||
targetGeneral.value = generalList.get(targetGeneralID);
|
||||
});
|
||||
|
||||
watch([generalList, orderBy], ([generalList, orderBy]) => {
|
||||
console.log(generalList);
|
||||
const list = Array.from(generalList.values());
|
||||
list.sort((a, b) => {
|
||||
const [, getter, isAsc] = textMap[orderBy];
|
||||
@@ -90,16 +94,24 @@ async function reload(): Promise<void> {
|
||||
console.log("갱신 시도");
|
||||
|
||||
try {
|
||||
const nationP = SammoAPI.Nation.GetNationInfo({});
|
||||
const { column, list, permission, troops, env } = await SammoAPI.Nation.GeneralList();
|
||||
|
||||
if (permission === 0) {
|
||||
throw "권한이 부족합니다.";
|
||||
}
|
||||
|
||||
console.log(list);
|
||||
const rawGeneralList = merge2DArrToObjectArr(column, list);
|
||||
|
||||
const newList = new Map<number, GeneralListItemP1>();
|
||||
for (const general of rawGeneralList) {
|
||||
newList.set(general.no, general);
|
||||
}
|
||||
generalList.value = newList;
|
||||
|
||||
const { nation } = await nationP;
|
||||
nationInfo.value = nation;
|
||||
} catch (e) {
|
||||
toasts.danger({
|
||||
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 { ChiefResponse } from "./defs/API/NationCommand";
|
||||
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 { GeneralLogType, GetGeneralLogResponse, JoinArgs } from "./defs/API/General";
|
||||
import type {
|
||||
@@ -231,6 +231,7 @@ const apiRealPath = {
|
||||
troopID: number;
|
||||
troopName: string;
|
||||
}>,
|
||||
GetNationInfo: GET as APICallT<{full?: boolean}, NationInfoResponse>,
|
||||
},
|
||||
Vote: {
|
||||
AddComment: POST as APICallT<{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
},
|
||||
"ingame_vue": {
|
||||
"v_auction": "v_auction.ts",
|
||||
"v_battleCenter": "v_battleCenter.ts",
|
||||
"v_inheritPoint": "v_inheritPoint.ts",
|
||||
"v_board": "v_board.ts",
|
||||
"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 { ValidResponse } from "@/SammoAPI";
|
||||
|
||||
@@ -127,3 +127,29 @@ export type RawGeneralListP2 = ValidResponse & {
|
||||
}
|
||||
|
||||
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