diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php index 00de2256..74d86344 100644 --- a/hwe/_admin1_submit.php +++ b/hwe/_admin1_submit.php @@ -28,7 +28,7 @@ switch($btn) { $lognum = $admin['historyindex'] + 1; if($lognum >= 29) { $lognum = 0; } $history[0] = "{$log}"; - pushHistory($history); + pushWorldHistory($history); break; case "변경1": $query = "update game set starttime='$starttime'"; @@ -101,7 +101,7 @@ switch($btn) { } } $history[] = "★턴시간이 $btn으로 변경됩니다."; - pushHistory($history); + pushWorldHistory($history); break; } diff --git a/hwe/a_status.php b/hwe/a_status.php index 2b76275c..1a2f642e 100644 --- a/hwe/a_status.php +++ b/hwe/a_status.php @@ -53,7 +53,7 @@ $(function(){
- + @@ -61,7 +61,7 @@ $(function(){
- +
diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index a7158e76..a3c7cfcb 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -162,7 +162,7 @@ if($btn == "추방") { addHistory($general, "●{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 추방됨"); pushGenLog($general, $log); - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); } } elseif($btn == "임명" && $level >= 5 && $level <= 11) { $query = "select l{$level}set,level,chemi from nation where nation='{$me['nation']}'"; diff --git a/hwe/d_ally.php b/hwe/d_ally.php index 6dd6eaf8..2b443b73 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -113,8 +113,8 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); -//pushAllLog($alllog); -//pushHistory($history, $admin['year'], $admin['month']); +//pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +//pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_cancel.php b/hwe/d_cancel.php index 198be677..896dc110 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -92,8 +92,8 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); -pushAllLog($alllog); -pushHistory($history, $admin['year'], $admin['month']); +pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_cease.php b/hwe/d_cease.php index b506e06f..57dcb97e 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -97,8 +97,8 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); -pushAllLog($alllog); -pushHistory($history, $admin['year'], $admin['month']); +pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_merge.php b/hwe/d_merge.php index 69826a49..48819595 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -131,8 +131,8 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); -pushAllLog($alllog); -pushHistory($history, $admin['year'], $admin['month']); +pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_scout.php b/hwe/d_scout.php index 687425ba..c5bf898f 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -163,8 +163,8 @@ if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scou pushGenLog($me, $mylog); pushGenLog($you, $youlog); -pushAllLog($alllog); -pushHistory($history, $admin['year'], $admin['month']); +pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_surrender.php b/hwe/d_surrender.php index 5b8b62c2..af3c8c86 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -121,8 +121,8 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); -pushAllLog($alllog); -pushHistory($history, $admin['year'], $admin['month']); +pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); +pushWorldHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/func.php b/hwe/func.php index cae04e2e..b655c496 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1136,126 +1136,6 @@ function generalInfo2($connect, $no) { "; } -function pushTrickLog($log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/_tricklog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushProcessLog($log) { - $size = count($log); - if($size > 0) { - $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_processlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function delStepLog() { - $date = date('Y_m_d'); - @unlink("logs/_{$date}_steplog.txt"); -} - -function pushStepLog($log) { - $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_steplog.txt", "a"); - fwrite($fp, $log."\n"); - fclose($fp); -} - -function pushLockLog($log) { - $size = count($log); - if($size > 0) { - $date = date('Y_m_d'); - $fp = fopen("logs/_{$date}_locklog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushAdminLog($log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/_adminlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushAuctionLog($log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/_auctionlog.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushGenLog($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/gen{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushBatRes($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/batres{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushBatLog($general, $log) { - $size = count($log); - if($size > 0) { - $fp = fopen("logs/batlog{$general['no']}.txt", "a"); - for($i=0; $i < $size; $i++) { - fwrite($fp, $log[$i]."\n"); - } - fclose($fp); - } -} - -function pushAllLog($log) { - $text = join("\n", $log)."\n"; - file_put_contents(__dir__.'/logs/_alllog.txt', $text, FILE_APPEND); -} - -function pushHistory($history, $year=null, $month=null) { - $db = DB::db(); - if($year === null || $month === null){ - $game = $db->queryFirstRow('SELECT year, month FROM game LIMIT 1'); - $year = $game['year']; - $month = $game['month']; - } - $request = array_map(function($text) use ($year, $month) { - return ['year'=>$year, 'month'=>$month, 'text'=>$text]; - }, $history); - $db->insert('full_history', $history); -} - function getRawLog($path, $count, $line_length){ //TODO: tail과 유사한 형태로 처리할 수 있는게 나을 듯. 그 이전에 파일 로그는 좀... ㅜㅜ if(!file_exists($path)){ @@ -1282,22 +1162,6 @@ function TrickLog($count) { echo $str; } -function AllLog($count) { - if(!file_exists("logs/_alllog.txt")){ - return ''; - } - $fp = @fopen("logs/_alllog.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - for($i=0; $i < $count; $i++) { - $str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."
" : "
"; - } - echo $str; -} - function AuctionLog($count) { if(!file_exists("logs/_auctionlog.txt")){ return ''; @@ -1312,16 +1176,6 @@ function AuctionLog($count) { echo $str; } -function History($count) { - $db = DB::db(); - - $texts = []; - foreach($db->queryFirstColumn('SELECT `text` from full_history order by id desc limit %i', $count) as $text){ - $texts[] = ConvertLog($text); - } - return join('
', $texts); -} - function MyLog($no, $count) { if(!file_exists("logs/gen{$no}.txt")){ return ''; @@ -1923,7 +1777,7 @@ function checkTurn($connect) { addAge($connect); // 새해 알림 $alllog[] = "◆{$admin['month']}월:{$admin['year']}년이 되었습니다."; - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); } elseif($admin['month'] == 4) { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly'); updateQuaterly($connect); @@ -2202,7 +2056,7 @@ function updateTurntime($connect, $no) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $alllog[0] = "●{$admin['month']}월:{$general['name2']}(이)가 {$general['name']}의 육체에서 유체이탈합니다!"; - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); if($admin['isUnited'] == 0) { CheckHall($connect, $no); @@ -2315,7 +2169,7 @@ function updateTurntime($connect, $no) { } } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); return; } @@ -2330,7 +2184,7 @@ function updateTurntime($connect, $no) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $alllog[0] = "●{$admin['month']}월:{$general['name']}(이)가 은퇴하고 그 자손이 유지를 이어받았습니다."; - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); $log[0] = "●나이가 들어 은퇴하고 자손에게 자리를 물려줍니다."; pushGenLog($general, $log); @@ -2537,8 +2391,8 @@ function uniqueItem($connect, $general, $log, $vote=0) { } break; } - pushAllLog($alllog); - pushHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } } return $log; @@ -2692,7 +2546,7 @@ function deleteNation($connect, $general) { $query = "delete from diplomacy where me='{$general['nation']}' or you='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); refreshNationStaticInfo(); } @@ -2757,7 +2611,7 @@ function nextRuler($connect, $general) { $history[] = "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받았습니다"; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); addNationHistory($nation, "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받음."); // 장수 삭제 및 부대처리는 checkTurn에서 } diff --git a/hwe/func_auction.php b/hwe/func_auction.php index e8d83bdb..04a07da1 100644 --- a/hwe/func_auction.php +++ b/hwe/func_auction.php @@ -82,8 +82,8 @@ function registerAuction($connect) { $alllog[0] = "●{$admin['month']}월:".GetStuffName($stuff)."(이)가 거래장에 등장했습니다!"; $history[0] = "●{$admin['year']}년 {$admin['month']}월:【암시장】ⓝ암시장상인(이)가 ".GetStuffName($stuff)."(을)를 판다는 소문이 돌고 있습니다!"; - pushAllLog($alllog); - pushHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } } */ @@ -205,8 +205,8 @@ function processAuction($connect) { $alllog[0] = "●{$admin['month']}월:{$auction['name2']}(이)가 ".GetStuffName($auction['stuff'])."(을)를 구매했습니다!"; $history[0] = "●{$admin['year']}년 {$admin['month']}월:【암시장】{$auction['name2']}(이)가 ".GetStuffName($auction['stuff'])."(을)를 구매했습니다!"; - pushAllLog($alllog); - pushHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } pushGenLog($trader, $traderLog); pushGenLog($bidder, $bidderLog); diff --git a/hwe/func_diplomacy.php b/hwe/func_diplomacy.php index 7cb788d2..c0021ac4 100644 --- a/hwe/func_diplomacy.php +++ b/hwe/func_diplomacy.php @@ -136,8 +136,8 @@ function acceptScout($messageInfo, $general, $msgResponse){ pushGenLog($me, $mylog); pushGenLog($you, $youlog); - pushAllLog($alllog); - pushHistory($alllog, $year, $month); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($alllog, $year, $month); return [true, 'success']; } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 32dfe085..e0e03476 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -386,7 +386,7 @@ function preUpdateMonthly($connect) { $history[] = "●{$admin['year']}년 {$admin['month']}월:【고립】{$city['name']}(이)가 보급이 끊겨 미지배 도시가 되었습니다."; } - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); //민심30이하 공백지 처리 $query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='',conflict2='',term=0,front=0 where rate<='30' and supply='0'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -608,7 +608,7 @@ group by A.nation MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); //사상자 초기화 $query = "update diplomacy set dead=0"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -781,7 +781,7 @@ function checkMerge($connect) { pushGenLog($me, $mylog); pushGenLog($you, $youlog); - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); unset($mylog); unset($youlog); unset($history); @@ -901,7 +901,7 @@ function checkSurrender($connect) { pushGenLog($me, $mylog); pushGenLog($you, $youlog); - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); unset($mylog); unset($youlog); unset($history); @@ -985,7 +985,7 @@ function updateNationState($connect) { $query = "update nation set tech=totaltech/'$gencount',gennum='$gennum' where nation='{$nation['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } function checkStatistic($connect) { @@ -1279,7 +1279,7 @@ function checkEmperior($connect) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $history[] = "●{$admin['year']}년 {$admin['month']}월:【통일】{$nation['name']}(이)가 전토를 통일하였습니다."; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); //연감 월결산 LogHistory(); diff --git a/hwe/func_history.php b/hwe/func_history.php index 5007e142..19443710 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -1,13 +1,142 @@ 0) { + $fp = fopen("logs/_tricklog.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushProcessLog($log) { + $size = count($log); + if($size > 0) { + $date = date('Y_m_d'); + $fp = fopen("logs/_{$date}_processlog.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function delStepLog() { + $date = date('Y_m_d'); + @unlink("logs/_{$date}_steplog.txt"); +} + +function pushStepLog($log) { + $date = date('Y_m_d'); + $fp = fopen("logs/_{$date}_steplog.txt", "a"); + fwrite($fp, $log."\n"); + fclose($fp); +} + +function pushLockLog($log) { + $size = count($log); + if($size > 0) { + $date = date('Y_m_d'); + $fp = fopen("logs/_{$date}_locklog.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushAdminLog($log) { + $size = count($log); + if($size > 0) { + $fp = fopen("logs/_adminlog.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushAuctionLog($log) { + $size = count($log); + if($size > 0) { + $fp = fopen("logs/_auctionlog.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushGenLog($general, $log) { + $size = count($log); + if($size > 0) { + $fp = fopen("logs/gen{$general['no']}.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushBatRes($general, $log) { + $size = count($log); + if($size > 0) { + $fp = fopen("logs/batres{$general['no']}.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + +function pushBatLog($general, $log) { + $size = count($log); + if($size > 0) { + $fp = fopen("logs/batlog{$general['no']}.txt", "a"); + for($i=0; $i < $size; $i++) { + fwrite($fp, $log[$i]."\n"); + } + fclose($fp); + } +} + + + +function pushWorldHistory(array $history, $year=null, $month=null) { + $db = DB::db(); + if($year === null || $month === null){ + $game = $db->queryFirstRow('SELECT year, month FROM game LIMIT 1'); + $year = $game['year']; + $month = $game['month']; + } + $request = array_map(function($text) use ($year, $month) { + return ['year'=>$year, 'month'=>$month, 'text'=>$text]; + }, array_values($history)); + $db->insert('world_history', $request); +} + +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){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); +} + +function getWorldHistoryWithDate($year, $month) { $db = DB::db(); $texts = []; foreach( $db->queryFirstColumn( - 'SELECT `text` from full_history where year = %i and month = %i order by id desc', + 'SELECT `text` from world_history where year = %i and month = %i order by id desc', $year, $month ) as $text @@ -22,36 +151,47 @@ function getHistory($year, $month) { return join('
', $texts); } -function getGenHistory($count, $year, $month, $isFirst=0) { - $fp = @fopen("logs/_alllog.txt", "r"); - @fseek($fp, -$count*300, SEEK_END); - $file = @fread($fp, $count*300); - @fclose($fp); - $log = explode("\n",$file); - $str = ""; - $prefix = "{$month}월:"; - $year -= 1; - $prefixYear = "{$month}월:{$year}"; - for($i=0; $i < $count; $i++) { - $line = $log[count($log)-2-$i]; - if($line == "") { - continue; - } - - if(strpos($line, $prefixYear)) { - break; - } elseif(strpos($line, $prefix) || $isFirst == 1) { - $str = ConvertLog($line).'
'.$str; - } else { - break; - } +function pushGeneralPublicRecord(array $history, $year=null, $month=null) { + $db = DB::db(); + if($year === null || $month === null){ + $game = $db->queryFirstRow('SELECT year, month FROM game LIMIT 1'); + $year = $game['year']; + $month = $game['month']; } - if($str == "") { - $str = "●{$month}월: 기록 없음"; - $str = ConvertLog($str); + $request = array_map(function($text) use ($year, $month) { + return ['year'=>$year, 'month'=>$month, 'text'=>$text]; + }, array_values($history)); + $db->insert('general_public_record', $request); +} + +function getGeneralPublicRecordRecent($count) { + $db = DB::db(); + + $texts = []; + foreach($db->queryFirstColumn('SELECT `text` from general_public_record order by id desc limit %i', $count) as $text){ + $texts[] = ConvertLog($text); + } + return join('
', $texts); +} + +function getGeneralPublicRecordWithDate($count, $year, $month, $isFirst=0) { + $db = DB::db(); + + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from general_public_record where year = %i and month = %i order by id desc', + $year, + $month + ) as $text + ){ + $texts[] = ConvertLog($text); + } + + if(!$texts){ + return ConvertLog("●{$month}월: 기록 없음"); } - return $str; } function LogHistory($isFirst=0) { @@ -87,8 +227,8 @@ function LogHistory($isFirst=0) { $map_json = json_encode($map, JSON_UNESCAPED_UNICODE); - $log = getHistory($year, $month); - $genlog = getGenHistory(50, $year, $month, $isFirst); + $log = getWorldHistoryWithDate($year, $month); + $genlog = getGeneralPublicRecordWithDate(50, $year, $month, $isFirst); $nationStr = ""; $powerStr = ""; diff --git a/hwe/func_npc.php b/hwe/func_npc.php index 720e6e25..7ab54fba 100644 --- a/hwe/func_npc.php +++ b/hwe/func_npc.php @@ -148,7 +148,7 @@ function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$a 'bornyear'=>$bornyear, 'deadyear'=>$deadyear ]); - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); } function SetDevelop($connect, $genType, $no, $city, $tech) { diff --git a/hwe/func_process.php b/hwe/func_process.php index 1f29cf4f..606ef241 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -1426,7 +1426,7 @@ function process_26($connect, &$general) { $log = uniqueItem($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -1674,7 +1674,7 @@ function process_31($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -2128,7 +2128,7 @@ function process_44($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index a82ff8d6..a671bdd2 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -443,7 +443,7 @@ function process_52($connect, &$general) { // $log = checkAbility($connect, $general, $log); } - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -681,8 +681,8 @@ function process_62($connect, &$general) { PushMsg(3, $younation['nation'], $general['picture'], $general['imgsvr'], "{$general['name']}:{$nation['name']}▶", $nation['color'], $younation['name'], $younation['color'], $youmsg); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -899,8 +899,8 @@ function process_65($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -985,8 +985,8 @@ function process_66($connect, &$general) { refreshNationStaticInfo(); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -1072,8 +1072,8 @@ function process_67($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -1171,8 +1171,8 @@ function process_68($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -1271,8 +1271,8 @@ function process_71($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -1381,8 +1381,8 @@ function process_72($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -1507,8 +1507,8 @@ function process_73($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -1645,8 +1645,8 @@ function process_74($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -1766,8 +1766,8 @@ function process_75($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -1980,8 +1980,8 @@ function process_76($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -2103,8 +2103,8 @@ function process_77($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -2223,8 +2223,8 @@ function process_78($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history, $admin['year'], $admin['month']); -// pushAllLog($alllog); +// pushWorldHistory($history, $admin['year'], $admin['month']); +// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushTrickLog($tricklog); pushGenLog($general, $log); } @@ -2292,7 +2292,7 @@ function process_81($connect, &$general) { refreshNationStaticInfo(); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 6c018958..3a134c5c 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -168,7 +168,7 @@ function process_25($connect, &$general) { } } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -422,7 +422,7 @@ function process_29($connect, &$general) { $log = uniqueItem($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -535,7 +535,7 @@ function process_45($connect, &$general) { $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -618,8 +618,8 @@ function process_46($connect, &$general) { $log = uniqueItem($connect, $general, $log, 3); } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -676,11 +676,11 @@ function process_47($connect, &$general) { $query = "update diplomacy set state='2',term='0' where me='{$general['nation']}' or you='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); refreshNationStaticInfo(); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -742,7 +742,7 @@ function process_54($connect, &$general) { } pushGenLog($general, $log); pushGenLog($nextruler, $youlog); - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } function process_55($connect, &$general) { @@ -826,8 +826,8 @@ function process_55($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } - pushHistory($history, $admin['year'], $admin['month']); - pushAllLog($alllog); + pushWorldHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -875,7 +875,7 @@ function process_56($connect, &$general) { refreshNationStaticInfo(); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -941,6 +941,6 @@ function process_57($connect, &$general) { } pushGenLog($general, $log); pushGenLog($ruler, $youlog); - pushAllLog($alllog); - pushHistory($history, $admin['year'], $admin['month']); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } diff --git a/hwe/func_process_trick.php b/hwe/func_process_trick.php index 578254a4..48ad9a39 100644 --- a/hwe/func_process_trick.php +++ b/hwe/func_process_trick.php @@ -118,7 +118,7 @@ function process_32($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -266,7 +266,7 @@ function process_33($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -388,7 +388,7 @@ function process_34($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -512,7 +512,7 @@ function process_35($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -650,6 +650,6 @@ function process_36($connect, &$general) { $log = checkAbility($connect, $general, $log); } - pushAllLog($alllog); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); } diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index 36dfd3e3..b76ba9ed 100644 --- a/hwe/func_time_event.php +++ b/hwe/func_time_event.php @@ -37,7 +37,7 @@ function processSpring($connect) { $admin = MYDB_fetch_array($result); $history[0] = "★{$admin['year']}년 {$admin['month']}월: 모두들 즐거운 게임 하고 계신가요? ^^ 삼국일보 애독해 주시고, 훼접은 삼가주세요~"; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } function processGoldIncome($connect) { @@ -109,7 +109,7 @@ function processGoldIncome($connect) { } $history[0] = "●{$admin['year']}년 {$admin['month']}월:【지급】봄이 되어 봉록에 따라 자금이 지급됩니다."; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); pushAdminLog($adminLog); } @@ -401,7 +401,7 @@ function processRiceIncome($connect) { } $history[0] = "●{$admin['year']}년 {$admin['month']}월:【지급】가을이 되어 봉록에 따라 군량이 지급됩니다."; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); pushAdminLog($adminLog); } @@ -676,5 +676,5 @@ function disaster($connect) { } } - pushHistory($disaster, $admin['year'], $admin['month']); + pushWorldHistory($disaster, $admin['year'], $admin['month']); } diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 67205e31..3ba52ae9 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -276,7 +276,7 @@ function startTournament($connect, $auto, $type) { case 2: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 일기토 대회가 개최됩니다! 천하의 용사들을 모집하고 있습니다!"; break; case 3: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 설전 대회가 개최됩니다! 천하의 책사들을 모집하고 있습니다!"; break; } - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } function fillLowGenAll($connect) { @@ -646,7 +646,7 @@ function setGift($connect, $tnmt_type, $tnmt, $phase) { $cost2 = $admin['develcost'] * 12; $history[0] = "◆{$admin['year']}년 {$admin['month']}월: {$tp} 대회에서 {$general['name']}(이)가 우승, {$general2['name']}(이)가 준우승을 차지하여 천하에 이름을 떨칩니다!"; $history[1] = "◆{$admin['year']}년 {$admin['month']}월: {$tp} 대회의 우승자에게는 {$cost}, 준우승자에겐 {$cost2}의 상금과 약간의 명성이 주어집니다!"; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); for($i=0; $i < count($genNo); $i++) { $general['no'] = $genNo[$i]; diff --git a/hwe/index.php b/hwe/index.php index f68010fa..ee325bb2 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -237,11 +237,11 @@ if(Session::getUserGrade() >= 5) { 개인 기록 - + 중원 정세 - + diff --git a/hwe/join_post.php b/hwe/join_post.php index b47a495b..0f23e62d 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -235,7 +235,7 @@ if($id_num) { $log[1] = "●{$admin['month']}월:".getGenSpecial($special2)." 특기를 가진 천재의 등장으로 온 천하가 떠들썩합니다."; $history[0] = "●{$admin['year']}년 {$admin['month']}월:【천재】{$cityname['name']}에 천재가 등장했습니다."; - pushHistory($history, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); } else { $log[0] = "●{$admin['month']}월:{$cityname['name']}에서 {$me['name']}(이)라는 호걸이 천하에 이름을 알립니다."; } @@ -251,7 +251,7 @@ if($id_num) { addHistory($me, "●{$admin['year']}년 {$admin['month']}월:".getGenSpecial($special2)." 특기를 가진 천재로 탄생."); } pushGenLog($me, $mylog); - pushAllLog($log); + pushGeneralPublicRecord($log, $admin['year'], $admin['month']); $adminLog[0] = "가입 : {$name} // {$me['name']} // {$id} // ".getenv("REMOTE_ADDR"); pushAdminLog($adminLog); diff --git a/hwe/process_war.php b/hwe/process_war.php index 6702fbd2..44504748 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -113,8 +113,8 @@ function processWar($connect, $general, $city) { $alllog[] = "●{$game['month']}월:병량 부족으로 {$city['name']}의 수비병들이 패퇴합니다."; $history[] = "●{$game['year']}년 {$game['month']}월:【패퇴】{$destnation['name']}(이)가 병량 부족으로 {$city['name']}(을)를 뺏기고 말았습니다."; pushGenLog($general, $log); - pushAllLog($alllog); - pushHistory($history); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history); unset($log); unset($alllog); unset($history); @@ -482,8 +482,8 @@ function processWar($connect, $general, $city) { pushGenLog($general, $log); pushBatLog($general, $batlog); pushBatRes($general, $batres); - pushAllLog($alllog); - pushHistory($history); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history, $admin['year'], $admin['month']); unset($log); unset($batlog); unset($batres); @@ -1495,8 +1495,8 @@ function processWar($connect, $general, $city) { pushGenLog($general, $log); pushBatLog($general, $batlog); pushBatRes($general, $batres); - pushAllLog($alllog); - pushHistory($history); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history); return $deadAmount; } @@ -1607,7 +1607,7 @@ function addConflict($connect, $city, $nationnum, $mykillnum) { $nation = getNationStaticInfo($nationnum); $history[] = "●{$game['year']}년 {$game['month']}월:【분쟁】{$nation['name']}(이)가 {$city['name']} 공략에 가담하여 분쟁이 발생하고 있습니다."; - pushHistory($history); + pushWorldHistory($history); } $nationlist[$i] = $nationnum; @@ -1915,7 +1915,7 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { } pushGenLog($general, $log); - pushAllLog($alllog); - pushHistory($history); + pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); + pushWorldHistory($history); } diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index a58771a7..db31517f 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -339,7 +339,7 @@ class Scenario{ - pushHistory($this->history, $env['year'], $env['month']); + pushWorldHistory($this->history, $env['year'], $env['month']); refreshNationStaticInfo(); foreach(getAllNationStaticInfo() as $nation){ diff --git a/hwe/sammo/Scenario/NPC.php b/hwe/sammo/Scenario/NPC.php index 6a7734fb..bbb42c29 100644 --- a/hwe/sammo/Scenario/NPC.php +++ b/hwe/sammo/Scenario/NPC.php @@ -85,7 +85,7 @@ class NPC{ $db = DB::db(); if($age == \sammo\GameConst::$adultAge && $month == 1){//FIXME: 14가 어디서 튀어나왔나? - \sammo\pushHistory(["●1월:$name(이)가 성인이 되어 등장했습니다."], $year, $month); + \sammo\pushWorldHistory(["●1월:$name(이)가 성인이 되어 등장했습니다."], $year, $month); } if($this->ego == null){ diff --git a/hwe/select_npc_post.php b/hwe/select_npc_post.php index 742833bd..272e4c75 100644 --- a/hwe/select_npc_post.php +++ b/hwe/select_npc_post.php @@ -103,7 +103,7 @@ if($admin['npcmode'] != 1) { $log[0] = "●{$admin['month']}월:{$me['name']}의 육체에 {$member['name']}(이)가 빙의됩니다!"; addHistory($me, "●{$admin['year']}년 {$admin['month']}월:{$me['name']}의 육체에 {$member['name']}(이)가 빙의되다."); pushGenLog($me, $mylog); - pushAllLog($log); + pushGeneralPublicRecord($log, $admin['year'], $admin['month']); $adminLog[0] = "가입 : {$me['name']} // {$id} // ".getenv("REMOTE_ADDR"); pushAdminLog($adminLog); diff --git a/hwe/sql/reset.sql b/hwe/sql/reset.sql index 838b55ed..07162e82 100644 --- a/hwe/sql/reset.sql +++ b/hwe/sql/reset.sql @@ -41,4 +41,7 @@ DROP TABLE IF EXISTS history; DROP TABLE IF EXISTS event; # 전체 이벤트 테이블 삭제(연감 대체?) -DROP TABLE IF EXISTS full_history; \ No newline at end of file +DROP TABLE IF EXISTS world_history; + +# 전체 이벤트 테이블 삭제(연감 대체?) +DROP TABLE IF EXISTS general_public_record; \ No newline at end of file diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index c7bfdfad..ab4ea277 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -609,7 +609,20 @@ ENGINE=InnoDB; ##전체 이벤트 기록 테이블 -CREATE TABLE `full_history` ( +CREATE TABLE `world_history` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `year` INT(4) NOT NULL, + `month` INT(2) NOT NULL, + `text` TEXT NOT NULL, + PRIMARY KEY (`id`), + INDEX `date` (`year`, `month`, `id`) +) +DEFAULT CHARSET=utf8mb4 +ENGINE=InnoDB +; + +##장수 동향 테이블 +CREATE TABLE `general_public_record` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `year` INT(4) NOT NULL, `month` INT(2) NOT NULL,