From aba9ee7b33df708f56a4cd341c6a9da458352861 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 18 Apr 2020 14:07:07 +0900 Subject: [PATCH] =?UTF-8?q?history=20column=EC=9D=84=20=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EB=B8=94=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/_admin2_submit.php | 4 +- hwe/func.php | 30 ++-- hwe/func_auction.php | 10 +- hwe/func_gamerule.php | 40 +++--- hwe/func_history.php | 235 ++++++++++++++++++++++++-------- hwe/func_process_chief.php | 8 +- hwe/j_select_npc.php | 8 +- hwe/join_post.php | 43 +++--- hwe/process_war.php | 22 +-- hwe/sammo/ActionLogger.php | 38 +++--- hwe/sammo/DiplomaticMessage.php | 50 +++---- hwe/sammo/ScoutMessage.php | 6 +- hwe/sql/reset.sql | 2 +- hwe/sql/schema.sql | 11 +- 14 files changed, 323 insertions(+), 184 deletions(-) diff --git a/hwe/_admin2_submit.php b/hwe/_admin2_submit.php index eb1faacb..f9e9fdad 100644 --- a/hwe/_admin2_submit.php +++ b/hwe/_admin2_submit.php @@ -122,8 +122,8 @@ switch($btn) { ], 'no=%i', $general['no']); $specialWarName = SpecialityConst::WAR[$specialWar][0]; $josaUl = JosaUtil::pick($specialWarName, '을'); - pushGeneralHistory($general, "●{$year}년 {$month}월:특기 【{$specialWarName}】{$josaUl} 습득"); - pushGenLog($general, ["●특기 【{$specialWarName}】{$josaUl} 익혔습니다!"]); + pushGeneralHistory($general['no'], ["●{$year}년 {$month}월:특기 【{$specialWarName}】{$josaUl} 습득"]); + pushGenLog($general['no'], ["●특기 【{$specialWarName}】{$josaUl} 익혔습니다!"]); } break; diff --git a/hwe/func.php b/hwe/func.php index e06311d7..669dc1fd 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1,6 +1,8 @@ get(); + //나이와 호봉 증가 - $query = "update general set age=age+1,belong=belong+1"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('general', [ + 'age'=>$db->sqleval('age+1'), + 'belong'=>$db->sqleval('belong+1') + ], true); - $admin = $gameStor->getValues(['startyear', 'year', 'month']); + [$startYear, $year, $month] = $gameStor->getValuesAsArray(['startyear', 'year', 'month']); - if($admin['year'] >= $admin['startyear']+3) { + if($year >= $startYear+3) { foreach($db->query('SELECT no,name,nation,leadership,strength,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){ + $generalID = $general['no']; $special = SpecialityConst::pickSpecialDomestic($general); $specialClass = buildGeneralSpecialDomesticClass($special); $specialText = $specialClass->getName(); $db->update('general', [ 'special'=>$special - ], 'no=%i',$general['no']); + ], 'no=%i',$generalID); + + $logger = new ActionLogger($generalID, $general['nation'], $year, $month); $josaUl = JosaUtil::pick($specialText, '을'); - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【{$specialText}】{$josaUl} 습득"); - pushGenLog($general, "●특기 【{$specialText}】{$josaUl} 익혔습니다!"); + $logger->pushGeneralActionLog("특기 【{$specialText}】{$josaUl} 익혔습니다!", ActionLogger::PLAIN); + $logger->pushGeneralHistoryLog("특기 【{$specialText}】{$josaUl} 습득"); } foreach($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5 from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){ + $generalID = $general['no']; $special2 = SpecialityConst::pickSpecialWar($general); $specialClass = buildGeneralSpecialWarClass($special2); $specialText = $specialClass->getName(); @@ -1219,9 +1227,11 @@ function addAge() { 'special2'=>$special2 ], 'no=%i',$general['no']); + $logger = new ActionLogger($generalID, $general['nation'], $year, $month); + $josaUl = JosaUtil::pick($specialText, '을'); - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【{$specialText}】{$josaUl} 습득"); - pushGenLog($general, "●특기 【{$specialText}】{$josaUl} 익혔습니다!"); + $logger->pushGeneralActionLog("특기 【{$specialText}】{$josaUl} 익혔습니다!", ActionLogger::PLAIN); + $logger->pushGeneralHistoryLog("특기 【{$specialText}】{$josaUl} 습득"); } } } diff --git a/hwe/func_auction.php b/hwe/func_auction.php index 59b636a2..25149d80 100644 --- a/hwe/func_auction.php +++ b/hwe/func_auction.php @@ -107,7 +107,7 @@ function processAuction() { $josaUlRice = JosaUtil::pick($auction['amount'], '을'); $auctionLog[0] = "◆{$admin['year']}년 {$admin['month']}월, {$auction['no']}번 구매 유찰 : {$auction['name1']}{$josaYi1} 쌀 {$auction['amount']}{$josaUlRice} 구매, 그러나 입찰자 부재"; } - pushGenLog($trader, $traderLog); + pushGenLog($trader['no'], $traderLog); pushAuctionLog($auctionLog); } } else { @@ -170,8 +170,8 @@ function processAuction() { $query = "update general set gold=gold-'{$auction['value']}',rice=rice+'{$auction['amount']}' where no='{$auction['no2']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushGenLog($trader, $traderLog); - pushGenLog($bidder, $bidderLog); + pushGenLog($trader['no'], $traderLog); + pushGenLog($bidder['no'], $bidderLog); pushAuctionLog($auctionLog); //구매거래 } else { @@ -219,8 +219,8 @@ function processAuction() { $query = "update general set gold=gold+'{$auction['value']}',rice=rice-'{$auction['amount']}' where no='{$auction['no2']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushGenLog($trader, $traderLog); - pushGenLog($bidder, $bidderLog); + pushGenLog($trader['no'], $traderLog); + pushGenLog($bidder['no'], $bidderLog); pushAuctionLog($auctionLog); } } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index ad0d498e..af9e0f44 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -621,8 +621,8 @@ function checkMerge() { $genlog = ["{$mynation['name']}{$josaWa} 통합에 성공했습니다."]; for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); - pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$josaWa} {$you['makenation']}로 통합에 성공"); + pushGenLog($gen['no'], $genlog); + pushGeneralHistory($gen['no'], ["●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$josaWa} {$you['makenation']}로 통합에 성공"]); } //항복국 장수들 역사 기록 및 로그 전달 $query = "select no,name,nation from general where nation='{$me['nation']}'"; @@ -632,8 +632,8 @@ function checkMerge() { $genlog[0] = "{$younation['name']}{$josaWa} 통합에 성공했습니다."; for($i=0; $i < $gencount2; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); - pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$josaWa} {$you['makenation']}로 통합에 성공"); + pushGenLog($gen['no'], $genlog); + pushGeneralHistory($gen['no'], ["●{$admin['year']}년 {$admin['month']}월:{$younation['name']}{$josaWa} {$you['makenation']}로 통합에 성공"]); } $josaRo = JosaUtil::pick($you['makenation'], '로'); @@ -641,7 +641,7 @@ function checkMerge() { $josaWa = JosaUtil::pick($mynation['name'], '와'); $history[] = "●{$admin['year']}년 {$admin['month']}월:【통합】{$mynation['name']}{$josaWa} {$younation['name']}{$josaYi} {$you['makenation']}{$josaRo} 통합하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【혼란】통합에 반대하는 세력들로 인해 {$you['makenation']}에 혼란이 일고 있습니다."; - pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합"); + pushNationHistory($younation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$you['makenation']}로 통합"]); $newGenCount = $gencount + $gencount2; $newTech = ($younation['tech']*$gencount + $mynation['tech']*$gencount2)/$newGenCount; @@ -713,8 +713,8 @@ function checkMerge() { ], 'general_id IN %li AND turn_idx = 0'); } - pushGenLog($me, $mylog); - pushGenLog($you, $youlog); + pushGenLog($me['no'], $mylog); + pushGenLog($you['no'], $youlog); pushWorldHistory($history, $admin['year'], $admin['month']); $mylog = []; @@ -775,8 +775,8 @@ function checkSurrender() { $genlog = ["{$mynation['name']} 합병에 성공했습니다."]; for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); - pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']} 합병에 성공"); + pushGenLog($gen['no'], $genlog); + pushGeneralHistory($gen['no'], ["●{$admin['year']}년 {$admin['month']}월:{$mynation['name']} 합병에 성공"]); } $josaRo = JosaUtil::pick($younation['name'], '로'); //항복국 장수들 역사 기록 및 로그 전달 @@ -786,15 +786,15 @@ function checkSurrender() { $genlog[0] = "{$younation['name']}{$josaRo} 항복하여 수도로 이동합니다."; for($i=0; $i < $gencount2; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); - pushGeneralHistory($gen, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$younation['name']}{$josaRo} 항복"); + pushGenLog($gen['no'], $genlog); + pushGeneralHistory($gen['no'], ["●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$younation['name']}{$josaRo} 항복"]); } $josaYi = JosaUtil::pick($mynation['name'], '이'); $josaWa = JosaUtil::pick($mynation['name'], '와'); $history[] = "●{$admin['year']}년 {$admin['month']}월:【투항】{$mynation['name']}{$josaYi} {$younation['name']}{$josaRo} 항복하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【혼란】통합에 반대하는 세력들로 인해 {$younation['name']}에 혼란이 일고 있습니다."; - pushNationHistory($younation, "●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$josaWa} 합병"); + pushNationHistory($younation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$mynation['name']}{$josaWa} 합병"]); // 국가 백업 $oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $me['nation']); @@ -872,8 +872,8 @@ function checkSurrender() { ], 'general_id IN %li AND turn_idx = 0'); } - pushGenLog($me, $mylog); - pushGenLog($you, $youlog); + pushGenLog($me['no'], $mylog); + pushGenLog($you['no'], $youlog); pushWorldHistory($history, $admin['year'], $admin['month']); refreshNationStaticInfo(); @@ -922,21 +922,21 @@ function updateNationState() { case 7: $josaUl = JosaUtil::pick(getNationLevel($nationlevel), '을'); $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."{$josaUl} 자칭하였습니다."; - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."{$josaUl} 자칭"); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."{$josaUl} 자칭"]); break; case 6: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극하였습니다."; - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극"); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 등극"]); break; case 5: case 4: case 3: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명되었습니다."; - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명됨"); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."에 임명됨"]); break; case 2: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 독립하여 ".getNationLevel($nationlevel)."로 나섰습니다."; - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."로 나서다"); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 ".getNationLevel($nationlevel)."로 나서다"]); break; } @@ -1254,7 +1254,7 @@ function checkEmperior() { $josaYi = JosaUtil::pick($nation['name'], '이'); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$josaYi} 전토를 통일"); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$josaYi} 전토를 통일"]); $gameStor->isunited = 2; $gameStor->conlimit = $gameStor->conlimit*100; @@ -1318,7 +1318,7 @@ function checkEmperior() { $general = MYDB_fetch_array($result); $gen .= "{$general['name']}, "; - pushGenLog($general, $log); + pushGenLog($general['no'], $log); } $nation['type'] = getNationType($nation['type']); diff --git a/hwe/func_history.php b/hwe/func_history.php index 05777b5b..6b2e94b8 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -100,33 +100,6 @@ function getAuctionLogRecent(int $count) { return join('
', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $count, 300))); } -function pushGenLog($general, $log) { - $no = Util::toInt($general['no']); - pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $log); -} - -function getGenLogRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $count, 300))); -} - -function pushBatRes($general, $log) { - $no = Util::toInt($general['no']); - pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $log); -} - -function getBatResRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $count, 300))); -} - -function pushBatLog($general, $log) { - $no = Util::toInt($general['no']); - pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $log); -} - -function getBatLogRecent(int $no, int $count) { - return join('
', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300))); -} - function pushOldNationStop(int $no, int $nationNo){ $logPrefixList = ['batres', 'gen', 'batlog']; @@ -156,45 +129,188 @@ function pushOldNationStop(int $no, int $nationNo){ } //DB-based -function pushNationHistory($nation, ?string $history) { - if(!$history){ - return; - } - if(!$nation || !$nation['nation']){ - return; - } - $db = DB::db(); - $db->update('nation', [ - 'history'=>$db->sqleval('concat(%s, history)', $history.'
') - ], 'nation=%i', $nation['nation']); -} -function pushGeneralHistory($me, ?string $history) { + +function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } $db = DB::db(); - $db->update('general', [ - 'history'=>$db->sqleval('concat(%s, history)', $history.'
') - ], 'nation=%i', $me['no']); + + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); + } + $request = array_map(function($text) use ($year, $month, $generalID) { + return [ + 'general_id'=>$generalID, + 'log_type'=>'action', + 'year'=>$year, + 'month'=>$month, + 'text'=>$text + ]; + }, array_values($history)); + $db->insert('general_record', $request); } -function getGeneralHistoryAll(int $no) { - $history = DB::db()->queryFirstField('SELECT history FROM general WHERE `no`=%i',$no); - return ConvertLog($history); +function getGenLogRecent(int $generalID, int $count) { + $db = DB::db(); + + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_record WHERE general_id = %i AND log_type = "action" order by id desc LIMIT %i', + $generalID, $count + ) as $text + ){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); } +function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month=null) { + if(!$history){ + return; + } + $db = DB::db(); + + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); + } + $request = array_map(function($text) use ($year, $month, $generalID) { + return [ + 'general_id'=>$generalID, + 'log_type'=>'battle_brief', + 'year'=>$year, + 'month'=>$month, + 'text'=>$text + ]; + }, array_values($history)); + $db->insert('general_record', $request); +} + +function getBatResRecent(int $generalID, int $count) { + $db = DB::db(); + + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle_brief" order by id desc LIMIT %i', + $generalID, $count + ) as $text + ){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); +} + +function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month=null) { + if(!$history){ + return; + } + $db = DB::db(); + + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); + } + $request = array_map(function($text) use ($year, $month, $generalID) { + return [ + 'general_id'=>$generalID, + 'log_type'=>'battle', + 'year'=>$year, + 'month'=>$month, + 'text'=>$text + ]; + }, array_values($history)); + $db->insert('general_record', $request); +} + +function getBatLogRecent(int $generalID, int $count) { + $db = DB::db(); + + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle" order by id desc LIMIT %i', + $generalID, $count + ) as $text + ){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); +} + + +function pushGeneralHistory(int $generalID, ?array $history, $year=null, $month=null) { + if(!$history){ + return; + } + $db = DB::db(); + + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); + } + $request = array_map(function($text) use ($year, $month, $generalID) { + return [ + 'general_id'=>$generalID, + 'log_type'=>'history', + 'year'=>$year, + 'month'=>$month, + 'text'=>$text + ]; + }, array_values($history)); + $db->insert('general_record', $request); + +} + +function getGeneralHistoryAll(int $generalID) { + $db = DB::db(); + + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_record WHERE general_id = %i AND log_type = "history" order by id desc', + $generalID + ) as $text + ){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); +} + + +function pushNationHistory(int $nationID, ?array $history, ?int $year=null, ?int $month=null) { + if(!$history){ + return; + } + $db = DB::db(); + + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); + } + $request = array_map(function($text) use ($year, $month, $nationID) { + return ['nation_id'=>$nationID, 'year'=>$year, 'month'=>$month, 'text'=>$text]; + }, array_values($history)); + $db->insert('world_history', $request); +} + + function pushWorldHistory(?array $history, $year=null, $month=null) { if(!$history){ return; } $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); } $request = array_map(function($text) use ($year, $month) { - return ['year'=>$year, 'month'=>$month, 'text'=>$text]; + return ['nation_id'=>0, 'year'=>$year, 'month'=>$month, 'text'=>$text]; }, array_values($history)); $db->insert('world_history', $request); } @@ -203,19 +319,19 @@ function getWorldHistoryRecent(int $count) { $db = DB::db(); $texts = []; - foreach($db->queryFirstColumn('SELECT `text` from world_history order by id desc limit %i', $count) as $text){ + foreach($db->queryFirstColumn('SELECT `text` from world_history WHERE nation_id = 0 order by id desc limit %i', $count) as $text){ $texts[] = ConvertLog($text); } return join('
', $texts); } -function getWorldHistoryWithDate($year, $month) { +function getWorldHistoryWithDate(int $year, int $month) { $db = DB::db(); $texts = []; foreach( $db->queryFirstColumn( - 'SELECT `text` from world_history where year = %i and month = %i order by id desc', + 'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc', $year, $month ) as $text @@ -231,28 +347,29 @@ function getWorldHistoryWithDate($year, $month) { } -function pushGeneralPublicRecord(?array $history, $year=null, $month=null) { +function pushGeneralPublicRecord(?array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); + if($year === null || $month === null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']); } $request = array_map(function($text) use ($year, $month) { - return ['year'=>$year, 'month'=>$month, 'text'=>$text]; + return ['general_id'=>0, 'log_type'=>'history', 'year'=>$year, 'month'=>$month, 'text'=>$text]; }, array_values($history)); - $db->insert('general_public_record', $request); + $db->insert('general_record', $request); } -function getGeneralPublicRecordRecent($count) { +function getGeneralPublicRecordRecent(int $count) { $db = DB::db(); $texts = []; foreach( $db->queryFirstColumn( - 'SELECT `text` from general_public_record order by id desc limit %i', + 'SELECT `text` from general_record WHERE general_id = 0 AND log_type = "history" order by id desc limit %i', $count ) as $text ){ @@ -261,13 +378,13 @@ function getGeneralPublicRecordRecent($count) { return join('
', $texts); } -function getGeneralPublicRecordWithDate($year, $month) { +function getGeneralPublicRecordWithDate(int $year, int $month) { $db = DB::db(); $texts = []; foreach( $db->queryFirstColumn( - 'SELECT `text` from general_public_record where year = %i and month = %i order by id desc', + 'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc', $year, $month ) as $text diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index b90bbc97..d364af7b 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -353,8 +353,8 @@ function process_65(&$general) { $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}초토화를 명령하였습니다."; $history[] = "●{$admin['year']}년 {$admin['month']}월:【초토화】{$nation['name']}{$josaYiNation} {$destcity['name']}{$josaUl} 초토화하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}초토화를 명령"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}초토화를 명령"); + pushGeneralHistory($general['no'], ["●{$admin['year']}년 {$admin['month']}월:{$destcity['name']}초토화를 명령"]); + pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destcity['name']}초토화를 명령"]); //외교제한 24 $amount = Util::round($destcity['pop'] * 0.1); @@ -475,8 +475,8 @@ function process_77(&$general) { // $alllog[] = "●{$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}이호경식을 발동하였습니다."; // $history[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destnation['name']}이호경식을 발동하였습니다."; $sabotagelog[] = "●{$admin['year']}년 {$admin['month']}월:【전략】{$nation['name']}{$josaYiNation} {$destnation['name']}이호경식을 발동하였습니다."; - pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}이호경식을 발동"); - pushNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}이호경식을 발동"); + pushGeneralHistory($general['no'], ["●{$admin['year']}년 {$admin['month']}월:{$destnation['name']}이호경식을 발동"]); + pushNationHistory($nation['nation'], "●{$admin['year']}년 {$admin['month']}월:{$general['name']}{$josaYi} {$destnation['name']}이호경식을 발동"); pushNationHistory($destnation, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}{$general['name']}{$josaYi} 아국에 이호경식을 발동"); //선포+3개월 diff --git a/hwe/j_select_npc.php b/hwe/j_select_npc.php index 8777dfce..5996991f 100644 --- a/hwe/j_select_npc.php +++ b/hwe/j_select_npc.php @@ -91,9 +91,11 @@ if(!$db->affectedRows()){ $db->delete('select_npc_token', 'owner=%i or valid_until < %s', $userID, $now); $josaYi = JosaUtil::pick($userNick, '이'); -pushGeneralHistory($pickedNPC, "●{$year}년 {$month}월:{$pickedNPC['name']}의 육체에 {$userNick}{$josaYi} 빙의되다."); -//pushGenLog($me, $mylog); -pushGeneralPublicRecord(["●{$month}월:{$pickedNPC['name']}의 육체에 {$userNick}{$josaYi} 빙의됩니다!"], $year, $month); + +$logger = new ActionLogger($pickedNPC['no'], $pickedNPC['nation'], $year, $month); +$logger->pushGeneralHistoryLog("{$pickedNPC['name']}의 육체에 {$userNick}{$josaYi} 빙의되다."); +$logger->pushGlobalActionLog("{$pickedNPC['name']}의 육체에 {$userNick}{$josaYi} 빙의됩니다!"); +$logger->flush(); pushAdminLog(["가입 : {$userID} // {$session->userName} // {$pick} // ".getenv("REMOTE_ADDR")]); diff --git a/hwe/join_post.php b/hwe/join_post.php index 3cbf4d98..7061fa6e 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -282,28 +282,33 @@ $me = [ $log = []; $mylog = []; -$josaRa = JosaUtil::pick($name, '라'); -if ($genius) { - $log[0] = "●{$gameStor->month}월:{$cityname}에서 {$name}{$josaRa}는 기재가 천하에 이름을 알립니다."; - $log[1] = "●{$gameStor->month}월:".getGeneralSpecialWarName($special2)." 특기를 가진 천재의 등장으로 온 천하가 떠들썩합니다."; +$logger = new ActionLogger($generalID, 0, $gameStor->year, $gameStor->month); - pushWorldHistory(["●{$gameStor->year}년 {$gameStor->month}월:【천재】{$cityname}에 천재가 등장했습니다."], $gameStor->year, $gameStor->month); -} else { - $log[0] = "●{$gameStor->month}월:{$cityname}에서 {$name}{$josaRa}는 호걸이 천하에 이름을 알립니다."; -} -pushGeneralHistory($me, "●{$gameStor->year}년 {$gameStor->month}월:{$name}, {$cityname}에서 큰 뜻을 품다."); -$mylog[] = "●삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^"; -$mylog[] = "●처음 하시는 경우에는 도움말을 참고하시고,"; -$mylog[] = "●문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~"; -$mylog[] = "●부디 즐거운 삼모전 되시길 바랍니다 ^^"; -$mylog[] = "●통솔 $pleadership 무력 $pstrength 지력 $pintel 의 보너스를 받으셨습니다."; -$mylog[] = "●연령은 $age세로 시작합니다."; +$josaRa = JosaUtil::pick($name, '라'); +$speicalText = getGeneralSpecialWarName($special2); if ($genius) { - $mylog[] = "●축하합니다! 천재로 태어나 처음부터 ".getGeneralSpecialWarName($special2)." 특기를 가지게 됩니다!"; - pushGeneralHistory($me, "●{$gameStor->year}년 {$gameStor->month}월:".getGeneralSpecialWarName($special2)." 특기를 가진 천재로 탄생."); + + $logger->pushGlobalActionLog("{$cityname}에서 {$name}{$josaRa}는 기재가 천하에 이름을 알립니다."); + $logger->pushGlobalActionLog("{$speicalText} 특기를 가진 천재의 등장으로 온 천하가 떠들썩합니다."); + $logger->pushGlobalHistoryLog("【천재】{$cityname}에 천재가 등장했습니다."); +} else { + $logger->pushGlobalActionLog("{$cityname}에서 {$name}{$josaRa}는 호걸이 천하에 이름을 알립니다."); } -pushGenLog($me, $mylog); -pushGeneralPublicRecord($log, $gameStor->year, $gameStor->month); + +$logger->pushGeneralHistoryLog("{$name}, {$cityname}에서 큰 뜻을 품다."); +$logger->pushGeneralActionLog("삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^", ActionLogger::PLAIN); +$logger->pushGeneralActionLog("처음 하시는 경우에는 도움말을 참고하시고,", ActionLogger::PLAIN); +$logger->pushGeneralActionLog("문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~", ActionLogger::PLAIN); +$logger->pushGeneralActionLog("부디 즐거운 삼모전 되시길 바랍니다 ^^", ActionLogger::PLAIN); +$logger->pushGeneralActionLog("통솔 $pleadership 무력 $pstrength 지력 $pintel 의 보너스를 받으셨습니다.", ActionLogger::PLAIN); +$logger->pushGeneralActionLog("연령은 $age세로 시작합니다.", ActionLogger::PLAIN); + +if ($genius) { + $logger->pushGeneralActionLog("축하합니다! 천재로 태어나 처음부터 {$speicalText} 특기를 가지게 됩니다!", ActionLogger::PLAIN); + $logger->pushGeneralHistoryLog("{$speicalText} 특기를 가진 천재로 탄생."); +} + +$logger->flush(); pushAdminLog(["가입 : {$userID} // {$name} // {$generalID}".getenv("REMOTE_ADDR")]); diff --git a/hwe/process_war.php b/hwe/process_war.php index 442387be..6c15a9b7 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -501,9 +501,9 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $alllog[] = "●{$month}월:{$general['name']}{$josaYiGen} {$city['name']} 공략에 성공했습니다."; $log[] = "{$city['name']} 공략에 성공했습니다."; $history[] = "●{$year}년 {$month}월:【지배】{$nation['name']}{$josaYiNation} {$city['name']}{$josaUl} 지배했습니다."; - pushGeneralHistory($general, "●{$year}년 {$month}월:{$city['name']}{$josaUl} 함락시킴"); - pushNationHistory($nation, "●{$year}년 {$month}월:{$general['name']}{$josaYiGen} {$destnationName} {$city['name']}{$josaUl} 점령"); - pushNationHistory($destnation, "●{$year}년 {$month}월:{$nation['name']}{$general['name']}에 의해 {$city['name']}{$josaYiCity} 함락"); + pushGeneralHistory($general['no'], ["●{$year}년 {$month}월:{$city['name']}{$josaUl} 함락시킴"]); + pushNationHistory($nation['nation'], ["●{$year}년 {$month}월:{$general['name']}{$josaYiGen} {$destnationName} {$city['name']}{$josaUl} 점령"]); + pushNationHistory($destnation['nation'], ["●{$year}년 {$month}월:{$nation['name']}{$general['name']}에 의해 {$city['name']}{$josaYiCity} 함락"]); $citycount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation = %i', $city['nation']); $renewFront = false; @@ -516,7 +516,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $josaYi = JosaUtil::pick($losenation['name'], '이'); $josaUl = JosaUtil::pick($losenation['name'], '을'); $history[] = "●{$year}년 {$month}월:【멸망】{$losenation['name']}{$josaYi} 멸망하였습니다."; - pushNationHistory($nation, "●{$year}년 {$month}월:{$losenation['name']}{$josaUl} 정복"); + pushNationHistory($nation['nation'], ["●{$year}년 {$month}월:{$losenation['name']}{$josaUl} 정복"]); $loseGeneralGold = 0; $loseGeneralRice = 0; @@ -543,9 +543,9 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $query = "update general set gold=gold-{$loseGold},rice=rice-{$loseRice} where no={$gen['no']}"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - pushGenLog($gen, $genlog); + pushGenLog($gen['no'], $genlog); - pushGeneralHistory($gen, "●{$year}년 {$month}월:{$losenation['name']}{$josaYi} 멸망"); + pushGeneralHistory($gen['no'], ["●{$year}년 {$month}월:{$losenation['name']}{$josaYi} 멸망"]); pushOldNationStop($gen['no'], $city['nation']); $loseGeneralGold += $loseGold; @@ -589,7 +589,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $genlog[0] = "{$losenation['name']} 정복으로 금{$losenation['gold']} 쌀{$losenation['rice']}을 획득했습니다."; for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); + pushGenLog($gen['no'], $genlog); } @@ -646,7 +646,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $genlog = ["●수도가 함락되어 $minCityName으로 긴급천도합니다."]; for($i=0; $i < $gencount; $i++) { $gen = MYDB_fetch_array($result); - pushGenLog($gen, $genlog); + pushGenLog($gen['no'], $genlog); } //천도 $query = "update nation set capital='$minCity',gold=gold*0.5,rice=rice*0.5 where nation='{$destnation['nation']}'"; @@ -679,8 +679,8 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $josaUl = JosaUtil::pick($city['name'], '을'); $josaYi = JosaUtil::pick($conquerNationName, '이'); $history[] = "●{$year}년 {$month}월:【분쟁협상】{$conquerNationName}{$josaYi} 영토분쟁에서 우위를 점하여 {$city['name']}{$josaUl} 양도받았습니다."; - pushNationHistory($nation, "●{$year}년 {$month}월:{$city['name']}{$josaUl} {$conquerNationName}양도"); - pushNationHistory(['nation'=>$conquerNation], "●{$year}년 {$month}월:{$nation['name']}에서 {$city['name']}{$josaUl} 양도 받음"); + pushNationHistory($nation['nation'], ["●{$year}년 {$month}월:{$city['name']}{$josaUl} {$conquerNationName}양도"]); + pushNationHistory($conquerNation, ["●{$year}년 {$month}월:{$nation['name']}에서 {$city['name']}{$josaUl} 양도 받음"]); } $query = [ @@ -714,7 +714,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { SetNationFront($nationNationID); } - pushGenLog($general, $log); + pushGenLog($general['no'], $log); pushGeneralPublicRecord($alllog, $year, $month); pushWorldHistory($history); } diff --git a/hwe/sammo/ActionLogger.php b/hwe/sammo/ActionLogger.php index 419b930c..b0a21649 100644 --- a/hwe/sammo/ActionLogger.php +++ b/hwe/sammo/ActionLogger.php @@ -4,8 +4,8 @@ namespace sammo; class ActionLogger{ //TODO: global을 따로 뗴어내고, 장수 Logger를 상속해서 받는 형식으로. - protected $generalId; - protected $nationId; + protected $generalID; + protected $nationID; protected $autoFlush; protected $year = null; @@ -20,18 +20,26 @@ class ActionLogger{ protected $globalActionLog = []; const RAWTEXT = 0; + /** ● */ const PLAIN = 1; + /** ●{$year}년 {$month}월: */ const YEAR_MONTH = 2; + /** ●{$year}년: */ const YEAR = 3; + /** ●{$month}월: */ const MONTH = 4; + /** ◆ */ const EVENT_PLAIN = 5; + /** ◆{$year}년 {$month}월: */ const EVENT_YEAR_MONTH = 6; + /** ★ */ const NOTICE = 7; + /** ★{$year}년 {$month}월: */ const NOTICE_YEAR_MONTH = 8; - public function __construct(int $generalId, int $nationId, int $year, int $month, bool $autoFlush = true){ - $this->generalId = $generalId; - $this->nationId = $nationId; + public function __construct(int $generalID, int $nationID, int $year, int $month, bool $autoFlush = true){ + $this->generalID = $generalID; + $this->nationID = $nationID; $this->year = $year; $this->month = $month; $this->autoFlush = $autoFlush; @@ -66,36 +74,28 @@ class ActionLogger{ } public function flush(){ - $db = DB::db(); - if($this->generalHistoryLog){ - $rawText = join('
', $this->generalHistoryLog).'
'; - $db->update('general', [ - 'history'=>$db->sqleval('concat(%s, history)', $rawText) - ], 'no=%i', $this->generalId); + pushGeneralHistory($this->generalID, $this->generalHistoryLog, $this->year, $this->month); $this->generalHistoryLog = []; } if($this->generalActionLog){ - pushGenLog(['no'=>$this->generalId], $this->generalActionLog); + pushGenLog($this->generalID, $this->generalActionLog, $this->year, $this->month); $this->generalActionLog = []; } if($this->generalBattleResultLog){ - pushBatRes(['no'=>$this->generalId], $this->generalBattleResultLog); + pushBatRes($this->generalID, $this->generalBattleResultLog, $this->year, $this->month); $this->generalBattleResultLog = []; } if($this->generalBattleDetailLog){ - pushBatLog(['no'=>$this->generalId], $this->generalBattleDetailLog); + pushBatLog($this->generalID, $this->generalBattleDetailLog, $this->year, $this->month); $this->generalBattleDetailLog = []; } - if($this->nationId && $this->nationalHistoryLog){ - $rawText = join('
', $this->nationalHistoryLog).'
'; - $db->update('nation', [ - 'history'=>$db->sqleval('concat(%s, history)', $rawText) - ], 'nation=%i', $this->nationId); + if($this->nationID && $this->nationalHistoryLog){ + pushNationHistory($this->nationID, $this->nationalHistoryLog, $this->year, $this->month); $this->nationalHistoryLog = []; } diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index f5d928a8..dbaf7bca 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -119,13 +119,13 @@ class DiplomaticMessage extends Message{ $mylog[] = "{$this->src->nationName}{$josaWa} 파기에 합의했습니다."; $josaWa = JosaUtil::pick($this->dest->nationName, '와'); - pushGeneralHistory(['no'=>$this->src->generalID], "●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 파기 성공"); + pushGeneralHistory($this->src->generalID, ["●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 파기 성공"]); $josaWa = JosaUtil::pick($this->src->nationName, '와'); - pushGeneralHistory(['no'=>$this->dest->generalID], "●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 파기 수락"); + pushGeneralHistory($this->dest->generalID, ["●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 파기 수락"]); - pushGenLog(['no'=>$this->dest->generalID], $mylog); - pushGenLog(['no'=>$this->src->generalID], $youlog); + pushGenLog($this->dest->generalID, $mylog); + pushGenLog($this->src->generalID, $youlog); pushGeneralPublicRecord($alllog, $helper->year, $helper->month); pushWorldHistory($history, $helper->year, $helper->month); @@ -154,13 +154,13 @@ class DiplomaticMessage extends Message{ $mylog[] = "{$this->src->nationName}{$josaWa} 종전에 합의했습니다."; $josaWa = JosaUtil::pick($this->dest->nationName, '와'); - pushGeneralHistory(['no'=>$this->src->generalID], "●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 종전 성공"); + pushGeneralHistory($this->src->generalID, ["●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 종전 성공"]); $josaWa = JosaUtil::pick($this->src->nationName, '와'); - pushGeneralHistory(['no'=>$this->dest->generalID], "●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 종전 수락"); + pushGeneralHistory($this->dest->generalID, ["●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 종전 수락"]); - pushGenLog(['no'=>$this->dest->generalID], $mylog); - pushGenLog(['no'=>$this->src->generalID], $youlog); + pushGenLog($this->dest->generalID, $mylog); + pushGenLog($this->src->generalID, $youlog); pushGeneralPublicRecord($alllog, $helper->year, $helper->month); pushWorldHistory($history, $helper->year, $helper->month); @@ -176,11 +176,11 @@ class DiplomaticMessage extends Message{ $josaWa = JosaUtil::pick($this->src->nationName, '와'); pushGeneralHistory( - ['no'=>$this->dest->generalID], - "●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 통합 시도" + $this->dest->generalID, + ["●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaWa} 통합 시도"] ); pushGenLog( - ['no'=>$this->dest->generalID], + $this->dest->generalID, ["{$this->src->nationName}{$josaWa} 통합에 동의했습니다."] ); @@ -195,12 +195,12 @@ class DiplomaticMessage extends Message{ $josaWa = JosaUtil::pick($this->dest->nationName, '와'); pushGeneralHistory( - ['no'=>$this->src->generalID], - "●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 통합 시도" + $this->src->generalID, + ["●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}{$josaWa} 통합 시도"] ); $josaYi = JosaUtil::pick($this->dest->nationName, '이'); pushGenLog( - ['no'=>$this->src->generalID], + $this->src->generalID, ["{$this->dest->nationName}{$josaYi} 통합에 동의했습니다."] ); pushWorldHistory( @@ -221,20 +221,20 @@ class DiplomaticMessage extends Message{ $josaRo = JosaUtil::pick($this->src->nationName, '로'); pushGeneralHistory( - ['no'=>$this->src->generalID], - "●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}에게 투항 제의" + $this->src->generalID, + ["●{$helper->year}년 {$helper->month}월:{$this->dest->nationName}에게 투항 제의"] ); pushGeneralHistory( - ['no'=>$this->dest->generalID], - "●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaRo} 투항 동의" + $this->dest->generalID, + ["●{$helper->year}년 {$helper->month}월:{$this->src->nationName}{$josaRo} 투항 동의"] ); pushGenLog( - ['no'=>$this->dest->generalID], + $this->dest->generalID, ["{$this->src->nationName}{$josaRo} 투항에 동의했습니다."] ); $josaYi = JosaUtil::pick($this->dest->nationName, '이'); pushGenLog( - ['no'=>$this->src->generalID], + $this->src->generalID, ["{$this->dest->nationName}{$josaYi} 투항에 동의했습니다."] ); $josaYi = JosaUtil::pick($this->dest->generalName, '이'); @@ -281,7 +281,7 @@ class DiplomaticMessage extends Message{ list($result, $reason) = $this->checkDiplomaticMessageValidation($general); if($result !== self::ACCEPTED){ - pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 실패."]); + pushGenLog($receiverID, ["●{$reason} {$this->diplomacyName} 실패."]); if($result === self::DECLINED){ $this->_declineMessage(); } @@ -309,7 +309,7 @@ class DiplomaticMessage extends Message{ } if($result !== self::ACCEPTED){ - pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 실패."]); + pushGenLog($receiverID, ["●{$reason} {$this->diplomacyName} 실패."]); if($result === self::DECLINED){ $this->_declineMessage(); } @@ -380,13 +380,13 @@ class DiplomaticMessage extends Message{ list($result, $reason) = $this->checkDiplomaticMessageValidation($general); if($result === self::INVALID){ - pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 거절 불가."]); + pushGenLog($receiverID, ["●{$reason} {$this->diplomacyName} 거절 불가."]); return $result; } $josaYi = JosaUtil::pick($this->dest->nationName, '이'); - pushGenLog(['no'=>$receiverID], "{$this->src->nationName}의 {$this->diplomacyName} 제안을 거절했습니다."); - pushGenLog(['no'=>$this->src->generalID], "{$this->dest->nationName}{$josaYi} {$this->diplomacyName} 제안을 거절했습니다."); + pushGenLog($receiverID, ["{$this->src->nationName}의 {$this->diplomacyName} 제안을 거절했습니다."]); + pushGenLog($this->src->generalID, ["{$this->dest->nationName}{$josaYi} {$this->diplomacyName} 제안을 거절했습니다."]); $this->_declineMessage(); return self::DECLINED; } diff --git a/hwe/sammo/ScoutMessage.php b/hwe/sammo/ScoutMessage.php index 17a9feb1..ba59c767 100644 --- a/hwe/sammo/ScoutMessage.php +++ b/hwe/sammo/ScoutMessage.php @@ -143,14 +143,14 @@ class ScoutMessage extends Message{ list($result, $reason) = $this->checkScoutMessageValidation($receiverID); if($result === self::INVALID){ - pushGenLog(['no'=>$receiverID], ["●{$reason} 등용 취소 불가."]); + pushGenLog($receiverID, ["●{$reason} 등용 취소 불가."]); return $result; } $josaRo = JosaUtil::pick($this->src->nationName, '로'); $josaYi = JosaUtil::pick($this->dest->generalName, '이'); - pushGenLog(['no'=>$receiverID], "{$this->src->nationName}{$josaRo} 망명을 거부했습니다."); - pushGenLog(['no'=>$this->src->generalID], "{$this->dest->generalName}{$josaYi} 등용을 거부했습니다."); + pushGenLog($receiverID, ["{$this->src->nationName}{$josaRo} 망명을 거부했습니다."]); + pushGenLog($this->src->generalID, ["{$this->dest->generalName}{$josaYi} 등용을 거부했습니다."]); $this->_declineMessage(); return self::DECLINED; diff --git a/hwe/sql/reset.sql b/hwe/sql/reset.sql index 0cfcc6b5..5746657e 100644 --- a/hwe/sql/reset.sql +++ b/hwe/sql/reset.sql @@ -44,7 +44,7 @@ DROP TABLE IF EXISTS event; DROP TABLE IF EXISTS world_history; # 전체 이벤트 테이블 삭제(연감 대체?) -DROP TABLE IF EXISTS general_public_record; +DROP TABLE IF EXISTS general_record; DROP TABLE IF EXISTS select_npc_token; diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 27a2b5c9..33f186eb 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -531,24 +531,29 @@ ENGINE=Aria; ##전체 이벤트 기록 테이블 CREATE TABLE `world_history` ( `id` INT(11) NOT NULL AUTO_INCREMENT, + `nation_id` INT(11) NOT NULL, `year` INT(4) NOT NULL, `month` INT(2) NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (`id`), - INDEX `date` (`year`, `month`, `id`) + INDEX `date` (`nation_id`, `year`, `month`, `id`), + INDEX `plain` (`nation_id`, `id`) ) DEFAULT CHARSET=utf8mb4 ENGINE=Aria ; ##장수 동향 테이블 -CREATE TABLE `general_public_record` ( +CREATE TABLE `general_record` ( `id` INT(11) NOT NULL AUTO_INCREMENT, + `general_id` INT(11) NOT NULL, + `log_type` ENUM('action','battle_brief','battle', 'history') NOT NULL, `year` INT(4) NOT NULL, `month` INT(2) NOT NULL, `text` TEXT NOT NULL, PRIMARY KEY (`id`), - INDEX `date` (`year`, `month`, `id`) + INDEX `date` (`general_id`, `log_type`, `year`, `month`, `id`), + INDEX `plain` (`general_id`, `log_type`, `id`) ) DEFAULT CHARSET=utf8mb4 ENGINE=Aria