From ec49cdb6adbbfb23402ea2edc268b097a046a368 Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 24 Jan 2022 05:40:38 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Global/GetNationList=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20-=20=EC=84=B8=EB=A0=A5=EC=9D=BC=EB=9E=8C=EC=9D=98?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EC=99=80=20=EC=9B=90=EC=B9=99?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=8F=99=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/API/Global/GetNationList.php | 65 ++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 hwe/sammo/API/Global/GetNationList.php diff --git a/hwe/sammo/API/Global/GetNationList.php b/hwe/sammo/API/Global/GetNationList.php new file mode 100644 index 00000000..f3bd80aa --- /dev/null +++ b/hwe/sammo/API/Global/GetNationList.php @@ -0,0 +1,65 @@ + $lhs['power']; + }); + + $nations[0] = getNationStaticInfo(0); + + foreach ($db->query('SELECT npc,name,nation,officer_level,permission FROM `general` ORDER BY dedication DESC') as $general) { + $nationID = $general['nation']; + + $permission = $general['permission']; + if($permission != 'auditor' && $permission != 'ambassador'){ + unset($general['permission']); + } + + if($general['officer_level'] < 5){ + $general['officer_level'] = 1; + } + + if (!key_exists('generals', $nations[$nationID])) { + $nations[$nationID]['generals'] = []; + } + $nations[$nationID]['generals'][] = $general; + } + + foreach ($db->queryAllLists('SELECT city, name, nation FROM city') as [$cityID, $cityName, $nationID]) { + if (!key_exists('cities', $nations[$nationID])) { + $nations[$nationID]['cities'] = []; + } + $nations[$nationID]['cities'][$cityID] = $cityName; + } + + return [ + 'result' => true, + 'nations' => $nations, + ]; + } +}