diff --git a/hwe/func.php b/hwe/func.php index e82cef61..459b4ebf 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1983,6 +1983,7 @@ function deleteNation(General $general) { 'data'=>Json::encode($oldNation) ]); $db->delete('nation', 'nation=%i', $nationID); + $db->delete('nation_turn', 'nation_id=%i', $nationID); // 외교 삭제 $db->delete('diplomacy', 'me = %i OR you = %i', $nationID, $nationID); diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 056bd3e7..6c6a37dd 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -789,6 +789,7 @@ function checkMerge() { $query = "delete from nation where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->delete('nation_turn', 'nation_id=%i', $me['nation']); // 아국 모든 도시들 상대국 소속으로 $query = "update city set nation='{$you['nation']}',gen1='0',gen2='0',gen3='0',conflict='{}' where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -941,6 +942,7 @@ function checkSurrender() { $query = "delete from nation where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->delete('nation_turn', 'nation_id=%i', $me['nation']); // 군주가 있는 위치 구함 $query = "select city from general where nation='{$you['nation']}' and level='12'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1073,6 +1075,20 @@ function updateNationState() { } $gameStor->assembler_id = $lastAssemblerID; + $turnRows = []; + foreach(range(getNationChiefLevel($oldLevel) - 1, getNationChiefLevel($nation['level']), -1) as $chiefLevel){ + foreach(range(0, GameConst::$maxChiefTurn - 1) as $turnIdx){ + $turnRows[] = [ + 'nation_id'=>$nation['nation'], + 'level'=>$chiefLevel, + 'turn_idx'=>$turnIdx, + 'action'=>'휴식', + 'arg'=>null, + ]; + } + } + $db->insertIgnore('nation_turn', $turnRows); + $db->update('nation', [ 'level'=>$nation['level'] ], 'nation=%i', $nation['nation']); diff --git a/hwe/join_post.php b/hwe/join_post.php index 5238d2f9..3ddb9464 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -245,7 +245,16 @@ $db->insert('general', [ 'special2' => $special2 ]); $generalID = $db->insertId(); - +$turnRows = []; +foreach(range(0, GameConst::$maxTurn - 1) as $turnIdx){ + $turnRows[] = [ + 'general_id'=>$generalID, + 'turn_idx'=>$turnIdx, + 'action'=>'휴식', + 'arg'=>null, + ]; +} +$db->insert('general_turn', $turnRows); $cityname = CityConst::byID($city)->name; $me = [ diff --git a/hwe/process_war.php b/hwe/process_war.php index 0196de92..509c46f0 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -621,6 +621,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { // 국가 삭제 $query = "delete from nation where nation='{$city['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->delete('nation_turn', 'nation_id=%i', $city['nation']); $renewFront = true; // 멸망이 아니면 } else { diff --git a/hwe/sammo/Command/General/che_거병.php b/hwe/sammo/Command/General/che_거병.php index 4e7662a2..c408415b 100644 --- a/hwe/sammo/Command/General/che_거병.php +++ b/hwe/sammo/Command/General/che_거병.php @@ -123,6 +123,20 @@ class che_거병 extends Command\GeneralCommand{ 'gennum'=>1 ]); $nationID = DB::db()->insertId(); + $turnRows = []; + foreach([12, 11] as $chiefLevel){ + foreach(range(0, GameConst::$maxChiefTurn - 1) as $turnIdx){ + $turnRows[] = [ + 'nation_id'=>$nationID, + 'level'=>$chiefLevel, + 'turn_idx'=>$turnIdx, + 'action'=>'휴식', + 'arg'=>null, + ]; + } + + } + $db->insert('nation_turn', $turnRows); refreshNationStaticInfo(); diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 069a9afd..e046c39b 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -278,6 +278,7 @@ class General implements iAction{ $logger->pushGlobalActionLog($dyingMessage->getText()); $db->delete('general', 'no=%i', $generalID); + $db->delete('general_turn', 'general_id=%i', $generalID); $this->updatedVar = []; $db->update('nation', [ diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index b246c1e5..9ee7beb4 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -186,8 +186,7 @@ class ResetHelper{ ); - $turntime = TimeUtil::now(); - $time = substr($turntime, 11, 2); + $turntime = TimeUtil::now(true); if($sync == 0) { // 현재 시간을 1월로 맞춤 $starttime = cutTurn($turntime, $turnterm); @@ -249,6 +248,17 @@ class ResetHelper{ 'killturn'=>9999, 'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE ]); + $generalID = $db->insertId(); + $turnRows = []; + foreach(range(0, GameConst::$maxTurn - 1) as $turnIdx){ + $turnRows[] = [ + 'general_id'=>$generalID, + 'turn_idx'=>$turnIdx, + 'action'=>'휴식', + 'arg'=>null, + ]; + } + $db->insert('general_turn', $turnRows); } foreach($env as $key=>$value){ diff --git a/hwe/sammo/Scenario/NPC.php b/hwe/sammo/Scenario/NPC.php index 34141dee..0fb9b75f 100644 --- a/hwe/sammo/Scenario/NPC.php +++ b/hwe/sammo/Scenario/NPC.php @@ -341,6 +341,16 @@ class NPC{ 'dex40'=>$this->dex40, ]); $this->generalID = $db->insertId(); + $turnRows = []; + foreach(range(0, GameConst::$maxTurn - 1) as $turnIdx){ + $turnRows[] = [ + 'general_id'=>$this->generalID, + 'turn_idx'=>$turnIdx, + 'action'=>'휴식', + 'arg'=>null, + ]; + } + $db->insert('general_turn', $turnRows); return true; //생성되었다. }