diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index e0242264..8959e79b 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -1294,31 +1294,47 @@ function checkEmperior() { $nationHistory = DB::db()->queryFirstField('SELECT `history` FROM `nation` WHERE `nation` = %i', $nation['nation']); - $query = " - insert into emperior ( - phase, - nation_count, nation_name, nation_hist, - gen_count, personal_hist, special_hist, - name, type, color, year, month, power, gennum, citynum, - pop, poprate, gold, rice, - l12name, l12pic, l11name, l11pic, - l10name, l10pic, l9name, l9pic, - l8name, l8pic, l7name, l7pic, - l6name, l6pic, l5name, l5pic, - tiger, eagle, gen, history - ) values ( - '-', - '$statNC', '{$statNation['nation_name']}', '{$statNation['nation_hist']}', - '$statGC', '{$statGeneral['personal_hist']}', '{$statGeneral['special_hist']}', - '{$nation['name']}', '{$nation['type']}', '{$nation['color']}', '{$admin['year']}', '{$admin['month']}', '{$nation['power']}', '{$nation['gennum']}', '$allcount', - '$pop', '$poprate', '{$nation['gold']}', '{$nation['rice']}', - '{$level12['name']}', '{$level12['picture']}', '{$level11['name']}', '{$level11['picture']}', - '{$level10['name']}', '{$level10['picture']}', '{$level9['name']}', '{$level9['picture']}', - '{$level8['name']}', '{$level8['picture']}', '{$level7['name']}', '{$level7['picture']}', - '{$level6['name']}', '{$level6['picture']}', '{$level5['name']}', '{$level5['picture']}', - '$tigerstr', '$eaglestr', '$gen', '{$nationHistory}' - )"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->insert('emperior', [ + 'phase'=>'-', + 'nation_count'=>$statNC, + 'nation_name'=>$statNation['nation_name'], + 'nation_hist'=>$statNation['nation_hist'], + 'gen_count'=>$statGC, + 'personal_hist'=>$statGeneral['personal_hist'], + 'special_hist'=>$statGeneral['special_hist'], + 'name'=>$nation['name'], + 'type'=>$nation['type'], + 'color'=>$nation['color'], + 'year'=>$admin['year'], + 'month'=>$admin['month'], + 'power'=>$nation['power'], + 'gennum'=>$nation['gennum'], + 'citynum'=>$allcount, + 'pop'=>$pop, + 'poprate'=>$poprate, + 'gold'=>$nation['gold'], + 'rice'=>$nation['rice'], + 'l12name'=>$level12['name'], + 'l12pic'=>$level12['picture'], + 'l11name'=>$level11['name'], + 'l11pic'=>$level11['picture'], + 'l10name'=>$level10['name'], + 'l10pic'=>$level10['picture'], + 'l9name'=>$level9['name'], + 'l9pic'=>$level9['picture'], + 'l8name'=>$level8['name'], + 'l8pic'=>$level8['picture'], + 'l7name'=>$level7['name'], + 'l7pic'=>$level7['picture'], + 'l6name'=>$level6['name'], + 'l6pic'=>$level6['picture'], + 'l5name'=>$level5['name'], + 'l5pic'=>$level5['picture'], + 'tiger'=>$tigerstr, + 'eagle'=>$eaglestr, + 'gen'=>$gen, + 'history'=>$nationHistory + ]); $history = ["●{$admin['year']}년 {$admin['month']}월:【통일】{$nation['name']}(이)가 전토를 통일하였습니다."]; pushWorldHistory($history, $admin['year'], $admin['month']); diff --git a/hwe/lib.php b/hwe/lib.php index 929b2cde..be4ac818 100644 --- a/hwe/lib.php +++ b/hwe/lib.php @@ -55,7 +55,7 @@ session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야 //FIXME: 이곳에서 설정하면 안될 듯 하다. 옮기자. // 에러 메세지 출력 -function Error($message, $url="") +function Error($message='', $url="") { if (!$url) { $url = $_SERVER['REQUEST_URI']; diff --git a/hwe/process_war.php b/hwe/process_war.php index cad21178..0d9e91a1 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -88,6 +88,7 @@ function processWar($general, $city) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $destnation = MYDB_fetch_array($result) ?: [ 'nation'=>0, + 'capital'=>0, 'level'=>0, 'rice'=>2000, 'type'=>0, @@ -1866,7 +1867,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) { ], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]); //수도였으면 긴급 천도 - if($destnation['capital'] == $city['city']) { + if(!isset($destnation['capital']) && $destnation['capital'] == $city['city']) { $minCity = findNextCapital($city['city'], $destnation['nation']); $minCityName = CityConst::byID($minCity)->name; diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index d4430282..bb181b98 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -462,7 +462,7 @@ create table if not exists emperior ( special_hist text default '', name char(64) default '', type char(64) default '', - color char(6) default '', + color char(7) default '', year int(4) default 0, month int(2) default 0, power int(8) default 0, diff --git a/hwe/templates/error.php b/hwe/templates/error.php index 74a76ed1..b36fb030 100644 --- a/hwe/templates/error.php +++ b/hwe/templates/error.php @@ -22,7 +22,7 @@
- message?> +