fix,refac: Nation/GetGeneralList에서 부대정보는 공개되어야 함
This commit is contained in:
@@ -44,6 +44,8 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'belong' => 0,
|
'belong' => 0,
|
||||||
'connect' => 0,
|
'connect' => 0,
|
||||||
|
|
||||||
|
'troop' => 0,
|
||||||
|
|
||||||
'con' => 1,
|
'con' => 1,
|
||||||
'specage' => 1,
|
'specage' => 1,
|
||||||
'specage2' => 1,
|
'specage2' => 1,
|
||||||
@@ -63,7 +65,6 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'officer_level' => 1,
|
'officer_level' => 1,
|
||||||
'officer_city' => 1,
|
'officer_city' => 1,
|
||||||
'defence_train' => 1,
|
'defence_train' => 1,
|
||||||
'troop' => 1,
|
|
||||||
'crewtype' => 1,
|
'crewtype' => 1,
|
||||||
'crew' => 1,
|
'crew' => 1,
|
||||||
'train' => 1,
|
'train' => 1,
|
||||||
@@ -271,13 +272,18 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
$generalList[] = $item;
|
$generalList[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->permission >= 1) {
|
$troops = [];
|
||||||
$troops = $db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID);
|
foreach ($db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID) as [$troopLeaderID, $troopName]) {
|
||||||
} else {
|
if (!key_exists($troopLeaderID, $rawGeneralList)) {
|
||||||
$troops = null;
|
continue;
|
||||||
|
}
|
||||||
|
$troopTurnTime = $rawGeneralList[$troopLeaderID]['turntime'];
|
||||||
|
$troops[] = [
|
||||||
|
'id' => $troopLeaderID,
|
||||||
|
'name' => $troopName,
|
||||||
|
'turntime' => $troopTurnTime
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'permission' => $this->permission,
|
'permission' => $this->permission,
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ async function reload() {
|
|||||||
return { permission, st0: true, st1: true, st2: true, ...v };
|
return { permission, st0: true, st1: true, st2: true, ...v };
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const [troopLeader, troopName] of troops) {
|
for (const {id: troopID, name:troopName} of troops) {
|
||||||
troopList.value[troopLeader] = troopName;
|
troopList.value[troopID] = troopName;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw `?? ${permission}`;
|
throw `?? ${permission}`;
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ export type GeneralListItemP0 = {
|
|||||||
reservedCommand: TurnObj[] | null,
|
reservedCommand: TurnObj[] | null,
|
||||||
|
|
||||||
autorun_limit: number,
|
autorun_limit: number,
|
||||||
|
|
||||||
|
troop: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GeneralListItemP1 = {
|
export type GeneralListItemP1 = {
|
||||||
@@ -61,7 +63,6 @@ export type GeneralListItemP1 = {
|
|||||||
officer_level: number,
|
officer_level: number,
|
||||||
officer_city: number,
|
officer_city: number,
|
||||||
defence_train: number,
|
defence_train: number,
|
||||||
troop: number,
|
|
||||||
crewtype: GameObjClassKey,
|
crewtype: GameObjClassKey,
|
||||||
crew: number,
|
crew: number,
|
||||||
train: number,
|
train: number,
|
||||||
@@ -106,7 +107,7 @@ export type RawGeneralListP0 = ValidResponse & {
|
|||||||
permission: 0,
|
permission: 0,
|
||||||
column: (keyof GeneralListItemP0)[],
|
column: (keyof GeneralListItemP0)[],
|
||||||
list: ValuesOf<GeneralListItemP0>[][],
|
list: ValuesOf<GeneralListItemP0>[][],
|
||||||
troops?: null,
|
troops: {id: number, name: string, turntime: string}[],
|
||||||
env: ResponseEnv,
|
env: ResponseEnv,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +115,7 @@ export type RawGeneralListP1 = ValidResponse & {
|
|||||||
permission: 1,
|
permission: 1,
|
||||||
column: (keyof GeneralListItemP1)[],
|
column: (keyof GeneralListItemP1)[],
|
||||||
list: ValuesOf<GeneralListItemP1>[][],
|
list: ValuesOf<GeneralListItemP1>[][],
|
||||||
troops?: null,
|
troops: {id: number, name: string, turntime: string}[],
|
||||||
env: ResponseEnv,
|
env: ResponseEnv,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ export type RawGeneralListP2 = ValidResponse & {
|
|||||||
permission: 2 | 3 | 4,
|
permission: 2 | 3 | 4,
|
||||||
column: (keyof GeneralListItemP2)[],
|
column: (keyof GeneralListItemP2)[],
|
||||||
list: ValuesOf<GeneralListItemP2>[][],
|
list: ValuesOf<GeneralListItemP2>[][],
|
||||||
troops: [number, string][],
|
troops: {id: number, name: string, turntime: string}[],
|
||||||
env: ResponseEnv,
|
env: ResponseEnv,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user