From 8f0057ff5134793e7ce6dcb53057926fdb85b55d Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sat, 4 Mar 2023 23:45:23 +0900 Subject: [PATCH] fix: GetNationInfo Full mode --- hwe/sammo/API/Nation/GetNationInfo.php | 4 ++-- hwe/ts/defs/API/Nation.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hwe/sammo/API/Nation/GetNationInfo.php b/hwe/sammo/API/Nation/GetNationInfo.php index 8f836f05..63d73bd4 100644 --- a/hwe/sammo/API/Nation/GetNationInfo.php +++ b/hwe/sammo/API/Nation/GetNationInfo.php @@ -27,7 +27,7 @@ class GetNationInfo extends \sammo\BaseAPI public function validateArgs(): ?string { $v = new Validator($this->args); - $v->rule('boolean', 'full'); + $v->rule('in', 'full', ['true', 'false']); if (!$v->validate()) { return $v->errorStr(); @@ -70,7 +70,7 @@ class GetNationInfo extends \sammo\BaseAPI $gameEnv = $gameStor->getValues(['year', 'month', 'startyear']); $nation = $db->queryFirstRow( - 'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE id = %i', + 'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE nation = %i', $nationID ); $nationStor = \sammo\KVStorage::getStorage($db, $nationID, 'nation_env'); diff --git a/hwe/ts/defs/API/Nation.ts b/hwe/ts/defs/API/Nation.ts index e77dc5a8..34f2f340 100644 --- a/hwe/ts/defs/API/Nation.ts +++ b/hwe/ts/defs/API/Nation.ts @@ -154,10 +154,17 @@ export type NationInfoFull = ValidResponse & { nation: NationItem; isFull: true, impossibleStrategicCommandLists: [string, number][]; - nationNotice: string, + nationNotice: NationNotice, troops: Record; } +export type NationNotice = { + date: string, + msg: string, + author: string, + authorID: number, +} + export type NationInfoResponse = | (ValidResponse & { nation: NationStaticItem;