diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index e2345d21..292a41ab 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -44,6 +44,8 @@ class GeneralList extends \sammo\BaseAPI 'belong' => 0, 'connect' => 0, + 'troop' => 0, + 'con' => 1, 'specage' => 1, 'specage2' => 1, @@ -63,7 +65,6 @@ class GeneralList extends \sammo\BaseAPI 'officer_level' => 1, 'officer_city' => 1, 'defence_train' => 1, - 'troop' => 1, 'crewtype' => 1, 'crew' => 1, 'train' => 1, @@ -271,13 +272,18 @@ class GeneralList extends \sammo\BaseAPI $generalList[] = $item; } - if ($this->permission >= 1) { - $troops = $db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID); - } else { - $troops = null; + $troops = []; + foreach ($db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID) as [$troopLeaderID, $troopName]) { + if (!key_exists($troopLeaderID, $rawGeneralList)) { + continue; + } + $troopTurnTime = $rawGeneralList[$troopLeaderID]['turntime']; + $troops[] = [ + 'id' => $troopLeaderID, + 'name' => $troopName, + 'turntime' => $troopTurnTime + ]; } - - $result = [ 'result' => true, 'permission' => $this->permission, diff --git a/hwe/ts/PageNationGeneral.vue b/hwe/ts/PageNationGeneral.vue index 4b528870..fbb65c1b 100644 --- a/hwe/ts/PageNationGeneral.vue +++ b/hwe/ts/PageNationGeneral.vue @@ -83,8 +83,8 @@ async function reload() { return { permission, st0: true, st1: true, st2: true, ...v }; }); - for (const [troopLeader, troopName] of troops) { - troopList.value[troopLeader] = troopName; + for (const {id: troopID, name:troopName} of troops) { + troopList.value[troopID] = troopName; } } else { throw `?? ${permission}`; diff --git a/hwe/ts/defs/API/Nation.ts b/hwe/ts/defs/API/Nation.ts index b51d68cc..126f2278 100644 --- a/hwe/ts/defs/API/Nation.ts +++ b/hwe/ts/defs/API/Nation.ts @@ -39,6 +39,8 @@ export type GeneralListItemP0 = { reservedCommand: TurnObj[] | null, autorun_limit: number, + + troop: number, } export type GeneralListItemP1 = { @@ -61,7 +63,6 @@ export type GeneralListItemP1 = { officer_level: number, officer_city: number, defence_train: number, - troop: number, crewtype: GameObjClassKey, crew: number, train: number, @@ -106,7 +107,7 @@ export type RawGeneralListP0 = ValidResponse & { permission: 0, column: (keyof GeneralListItemP0)[], list: ValuesOf[][], - troops?: null, + troops: {id: number, name: string, turntime: string}[], env: ResponseEnv, } @@ -114,7 +115,7 @@ export type RawGeneralListP1 = ValidResponse & { permission: 1, column: (keyof GeneralListItemP1)[], list: ValuesOf[][], - troops?: null, + troops: {id: number, name: string, turntime: string}[], env: ResponseEnv, } @@ -122,7 +123,7 @@ export type RawGeneralListP2 = ValidResponse & { permission: 2 | 3 | 4, column: (keyof GeneralListItemP2)[], list: ValuesOf[][], - troops: [number, string][], + troops: {id: number, name: string, turntime: string}[], env: ResponseEnv, }