From 907ba0b26e9cd3f44fe1b98b20c9c7c2dee85328 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 28 Mar 2018 19:14:11 +0900 Subject: [PATCH] =?UTF-8?q?CityHelper=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/func_converter.php | 1 + twe/sammo/CityHelper.php | 74 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 twe/sammo/CityHelper.php diff --git a/twe/func_converter.php b/twe/func_converter.php index 2bc83dbe..102e36a6 100644 --- a/twe/func_converter.php +++ b/twe/func_converter.php @@ -240,6 +240,7 @@ function SpecCall($call) { case '의술': $type = 73; break; case '격노': $type = 74; break; case '척사': $type = 75; break; + default: $type = 0; break; } return $type; } diff --git a/twe/sammo/CityHelper.php b/twe/sammo/CityHelper.php new file mode 100644 index 00000000..7f8d44a8 --- /dev/null +++ b/twe/sammo/CityHelper.php @@ -0,0 +1,74 @@ +query('SELECT `city` as `id`, `name`, `level`, `nation` from city') as $city) { + $list[$city['id']] = $city; + $listInv[$city['name']] = $city; + + if(!key_exists($id, $listByNation)){ + $listByNation[$id] = []; + } + $listByNation[$id][] = $city; + } + + self::$list = $list; + self::$listInv = $listInv; + self::$listByNation = $listByNation; + } + + public static function getAllCities(){ + if(self::$list === null){ + self::generateCache(); + } + + return self::$list; + } + + public static function getAllNationCities(int $nationID){ + if(self::$listByNation === null){ + self::generateCache(); + } + + return self::$listByNation[$nationID]; + } + + public static function getCity(int $cityID){ + if(self::$list === null){ + self::generateCache(); + } + + return self::$list[$cityID]; + } + + public static function getCityByName(string $cityName){ + if(self::$listInv === null){ + self::generateCache(); + } + + return self::$listInv[$cityName]; + } + + +} \ No newline at end of file