From 74390602d8d7295b1be2b572869e9beac881ca11 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 1 Apr 2018 05:18:17 +0900 Subject: [PATCH] =?UTF-8?q?pushHistory=EB=A5=BC=20DB=EA=B8=B0=EB=B0=98?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/d_ally.php | 2 +- hwe/d_cancel.php | 2 +- hwe/d_cease.php | 2 +- hwe/d_merge.php | 2 +- hwe/d_scout.php | 2 +- hwe/d_surrender.php | 2 +- hwe/func.php | 38 ++++++++++---------- hwe/func_auction.php | 4 +-- hwe/func_diplomacy.php | 2 +- hwe/func_gamerule.php | 12 +++---- hwe/func_history.php | 64 +++++++++++++++++++--------------- hwe/func_map.php | 8 ++--- hwe/func_process_chief.php | 30 ++++++++-------- hwe/func_process_personnel.php | 10 +++--- hwe/func_time_event.php | 8 ++--- hwe/func_tournament.php | 4 +-- hwe/j_install.php | 2 ++ hwe/join_post.php | 2 +- hwe/sammo/Scenario.php | 2 +- hwe/sammo/Scenario/NPC.php | 2 +- hwe/sql/reset.sql | 7 ++-- hwe/sql/schema.sql | 16 ++++++++- 22 files changed, 125 insertions(+), 98 deletions(-) diff --git a/hwe/d_ally.php b/hwe/d_ally.php index db7479f7..6dd6eaf8 100644 --- a/hwe/d_ally.php +++ b/hwe/d_ally.php @@ -114,7 +114,7 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); //pushAllLog($alllog); -//pushHistory($history); +//pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_cancel.php b/hwe/d_cancel.php index e2fb69b4..198be677 100644 --- a/hwe/d_cancel.php +++ b/hwe/d_cancel.php @@ -93,7 +93,7 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); -pushHistory($history); +pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_cease.php b/hwe/d_cease.php index 66e1cd60..b506e06f 100644 --- a/hwe/d_cease.php +++ b/hwe/d_cease.php @@ -98,7 +98,7 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); -pushHistory($history); +pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_merge.php b/hwe/d_merge.php index 4587b1f0..69826a49 100644 --- a/hwe/d_merge.php +++ b/hwe/d_merge.php @@ -132,7 +132,7 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); -pushHistory($history); +pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_scout.php b/hwe/d_scout.php index 4bb58633..687425ba 100644 --- a/hwe/d_scout.php +++ b/hwe/d_scout.php @@ -164,7 +164,7 @@ if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scou pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); -pushHistory($history); +pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/d_surrender.php b/hwe/d_surrender.php index fa9c80a7..5b8b62c2 100644 --- a/hwe/d_surrender.php +++ b/hwe/d_surrender.php @@ -122,7 +122,7 @@ if($ok == "수락") { pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); -pushHistory($history); +pushHistory($history, $admin['year'], $admin['month']); echo ""; diff --git a/hwe/func.php b/hwe/func.php index 0beae65a..cae04e2e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1243,9 +1243,17 @@ function pushAllLog($log) { file_put_contents(__dir__.'/logs/_alllog.txt', $text, FILE_APPEND); } -function pushHistory($history) { - $text = join("\n", $history)."\n"; - file_put_contents(__dir__.'/logs/_history.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){ @@ -1305,19 +1313,13 @@ function AuctionLog($count) { } function History($count) { - if(!file_exists("logs/_history.txt")){ - return ''; + $db = DB::db(); + + $texts = []; + foreach($db->queryFirstColumn('SELECT `text` from full_history order by id desc limit %i', $count) as $text){ + $texts[] = ConvertLog($text); } - $fp = @fopen("logs/_history.txt", "r"); - @fseek($fp, -300*$count, 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; + return join('
', $texts); } function MyLog($no, $count) { @@ -2536,7 +2538,7 @@ function uniqueItem($connect, $general, $log, $vote=0) { break; } pushAllLog($alllog); - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); } } return $log; @@ -2690,7 +2692,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); + pushHistory($history, $admin['year'], $admin['month']); refreshNationStaticInfo(); } @@ -2755,7 +2757,7 @@ function nextRuler($connect, $general) { $history[] = "●{$admin['year']}년 {$admin['month']}월:【유지】{$nextruler['name']}(이)가 {$nation['name']}의 유지를 이어 받았습니다"; - pushHistory($history); + pushHistory($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 09001588..e8d83bdb 100644 --- a/hwe/func_auction.php +++ b/hwe/func_auction.php @@ -83,7 +83,7 @@ function registerAuction($connect) { $alllog[0] = "●{$admin['month']}월:".GetStuffName($stuff)."(이)가 거래장에 등장했습니다!"; $history[0] = "●{$admin['year']}년 {$admin['month']}월:【암시장】ⓝ암시장상인(이)가 ".GetStuffName($stuff)."(을)를 판다는 소문이 돌고 있습니다!"; pushAllLog($alllog); - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); } } */ @@ -206,7 +206,7 @@ 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); + pushHistory($history, $admin['year'], $admin['month']); } pushGenLog($trader, $traderLog); pushGenLog($bidder, $bidderLog); diff --git a/hwe/func_diplomacy.php b/hwe/func_diplomacy.php index 6b05b6c3..7cb788d2 100644 --- a/hwe/func_diplomacy.php +++ b/hwe/func_diplomacy.php @@ -137,7 +137,7 @@ function acceptScout($messageInfo, $general, $msgResponse){ pushGenLog($me, $mylog); pushGenLog($you, $youlog); pushAllLog($alllog); - pushHistory($alllog); + pushHistory($alllog, $year, $month); return [true, 'success']; } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 800df374..32dfe085 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); + pushHistory($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); + pushHistory($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); + pushHistory($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); + pushHistory($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); + pushHistory($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); + pushHistory($history, $admin['year'], $admin['month']); //연감 월결산 LogHistory(); diff --git a/hwe/func_history.php b/hwe/func_history.php index 551789e2..5007e142 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -1,32 +1,25 @@ {$year}년 {$month}월:"; - for($i=0; $i < $count; $i++) { - $line = $log[count($log)-2-$i]; - if($line == "") { - continue; - } - - if(strpos($line, $prefix) || $isFirst == 1) { - $str = ConvertLog($line).'
'.$str; - } else { - break; - } + $texts = []; + foreach( + $db->queryFirstColumn( + 'SELECT `text` from full_history where year = %i and month = %i order by id desc', + $year, + $month + ) as $text + ){ + $texts[] = ConvertLog($text); } - if($str == "") { - $str = "●{$year}년 {$month}월: 기록 없음"; - $str = ConvertLog($str); + + if(!$texts){ + return ConvertLog("●{$year}년 {$month}월: 기록 없음"); } - return $str; + + return join('
', $texts); } function getGenHistory($count, $year, $month, $isFirst=0) { @@ -64,24 +57,37 @@ function getGenHistory($count, $year, $month, $isFirst=0) { function LogHistory($isFirst=0) { if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', LogHistory Start'); + $db = DB::db(); + $obj = $db->queryFirstRow('SELECT year, month, startyear FROM game limit 1'); + //TODO: 새롭게 추가할 지도 값 받아오는 함수를 이용하여 재구성 $map = getWorldMap([ + 'year'=>null, + 'month'=>null, 'neutralView'=>true, - 'showMe'=>false + 'showMe'=>false, + 'aux'=>[] ]); + + $map['month'] = $obj['month']; + $map['year'] = $obj['year']; + $map['startYear'] = $obj['startyear']; if($isFirst == 1){ - $map['year'] -= 1; - $map['month'] = 12; + $map['month'] -= 1; + if($map['month'] == 0){ + $map['month'] = 12; + $map['year'] -= 1; + } } - $startYear = $map['startYear']; + $startYear = $obj['startyear']; $year = $map['year']; $month = $map['month']; $map_json = json_encode($map, JSON_UNESCAPED_UNICODE); - $log = getHistory(20, $year, $month, $isFirst); + $log = getHistory($year, $month); $genlog = getGenHistory(50, $year, $month, $isFirst); $nationStr = ""; @@ -89,7 +95,7 @@ function LogHistory($isFirst=0) { $genStr = ""; $cityStr = ""; - $db = DB::db(); + foreach($db->query('select nation,color,name,power,gennum from nation where level>0 order by power desc') as $nation){ $cityCount = $db->queryFirstField('select count(*) from city where nation = %i',$nation['nation']); diff --git a/hwe/func_map.php b/hwe/func_map.php index 8cd83ec4..ff96dcee 100644 --- a/hwe/func_map.php +++ b/hwe/func_map.php @@ -7,10 +7,10 @@ class MapRequest{ public $neutralView; public $showMe; function __construct($obj){ - $this->year = $obj['year']; - $this->month = $obj['month']; - $this->aux = $obj['aux']; - $this->neutralView = $obj['neutralView']; + $this->year = Util::array_get($obj['year']); + $this->month = Util::array_get($obj['month']); + $this->aux = Util::array_get($obj['aux'],[]); + $this->neutralView = Util::array_get($obj['neutralView'], false); $this->showMe = $obj['showMe']; } } diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index fe6e91c4..a82ff8d6 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); + pushHistory($history, $admin['year'], $admin['month']); pushGenLog($general, $log); } @@ -681,7 +681,7 @@ 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); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -899,7 +899,7 @@ function process_65($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -985,7 +985,7 @@ function process_66($connect, &$general) { refreshNationStaticInfo(); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -1072,7 +1072,7 @@ function process_67($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -1171,7 +1171,7 @@ function process_68($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -1271,7 +1271,7 @@ function process_71($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -1381,7 +1381,7 @@ function process_72($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -1507,7 +1507,7 @@ function process_73($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -1645,7 +1645,7 @@ function process_74($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -1766,7 +1766,7 @@ function process_75($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -1980,7 +1980,7 @@ function process_76($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -2103,7 +2103,7 @@ function process_77($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -2223,7 +2223,7 @@ function process_78($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } -// pushHistory($history); +// pushHistory($history, $admin['year'], $admin['month']); // pushAllLog($alllog); pushTrickLog($tricklog); pushGenLog($general, $log); @@ -2292,7 +2292,7 @@ function process_81($connect, &$general) { refreshNationStaticInfo(); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index 2f3ef099..6c018958 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -618,7 +618,7 @@ function process_46($connect, &$general) { $log = uniqueItem($connect, $general, $log, 3); } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -676,7 +676,7 @@ 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); + pushHistory($history, $admin['year'], $admin['month']); refreshNationStaticInfo(); } @@ -742,7 +742,7 @@ function process_54($connect, &$general) { } pushGenLog($general, $log); pushGenLog($nextruler, $youlog); - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); } function process_55($connect, &$general) { @@ -826,7 +826,7 @@ function process_55($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } } - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAllLog($alllog); pushGenLog($general, $log); } @@ -942,5 +942,5 @@ function process_57($connect, &$general) { pushGenLog($general, $log); pushGenLog($ruler, $youlog); pushAllLog($alllog); - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); } diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index 2118ab16..36dfd3e3 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); + pushHistory($history, $admin['year'], $admin['month']); } function processGoldIncome($connect) { @@ -109,7 +109,7 @@ function processGoldIncome($connect) { } $history[0] = "●{$admin['year']}년 {$admin['month']}월:【지급】봄이 되어 봉록에 따라 자금이 지급됩니다."; - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAdminLog($adminLog); } @@ -401,7 +401,7 @@ function processRiceIncome($connect) { } $history[0] = "●{$admin['year']}년 {$admin['month']}월:【지급】가을이 되어 봉록에 따라 군량이 지급됩니다."; - pushHistory($history); + pushHistory($history, $admin['year'], $admin['month']); pushAdminLog($adminLog); } @@ -676,5 +676,5 @@ function disaster($connect) { } } - pushHistory($disaster); + pushHistory($disaster, $admin['year'], $admin['month']); } diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 7e34f612..67205e31 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); + pushHistory($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); + pushHistory($history, $admin['year'], $admin['month']); for($i=0; $i < count($genNo); $i++) { $general['no'] = $genNo[$i]; diff --git a/hwe/j_install.php b/hwe/j_install.php index fa1542e9..f976d656 100644 --- a/hwe/j_install.php +++ b/hwe/j_install.php @@ -207,6 +207,8 @@ $db->update('plock', [ 'plock'=>0 ], true); +LogHistory(1); + Json::die([ 'result'=>true ]); \ No newline at end of file diff --git a/hwe/join_post.php b/hwe/join_post.php index 6022d3a3..b47a495b 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); + pushHistory($history, $admin['year'], $admin['month']); } else { $log[0] = "●{$admin['month']}월:{$cityname['name']}에서 {$me['name']}(이)라는 호걸이 천하에 이름을 알립니다."; } diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index 1562a57b..a58771a7 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -339,7 +339,7 @@ class Scenario{ - pushHistory($this->history); + pushHistory($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 be694073..6a7734fb 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(이)가 성인이 되어 등장했습니다."]); + \sammo\pushHistory(["●1월:$name(이)가 성인이 되어 등장했습니다."], $year, $month); } if($this->ego == null){ diff --git a/hwe/sql/reset.sql b/hwe/sql/reset.sql index 2fe1499c..838b55ed 100644 --- a/hwe/sql/reset.sql +++ b/hwe/sql/reset.sql @@ -37,5 +37,8 @@ DROP TABLE IF EXISTS statistic; # 연감 테이블 삭제 DROP TABLE IF EXISTS history; -# 연감 테이블 삭제 -DROP TABLE IF EXISTS event; \ No newline at end of file +# 이벤트 테이블 삭제 +DROP TABLE IF EXISTS event; + +# 전체 이벤트 테이블 삭제(연감 대체?) +DROP TABLE IF EXISTS full_history; \ No newline at end of file diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 4220d291..c7bfdfad 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -605,4 +605,18 @@ CREATE TABLE `event` ( PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8mb4 -ENGINE=InnoDB; \ No newline at end of file +ENGINE=InnoDB; + + +##전체 이벤트 기록 테이블 +CREATE TABLE `full_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 +; \ No newline at end of file