diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php index a7a2177e..a8cde9fc 100644 --- a/hwe/_admin1_submit.php +++ b/hwe/_admin1_submit.php @@ -40,7 +40,7 @@ switch ($btn) { $gameStor->msg = $msg; break; case "로그쓰기": - pushWorldHistory(["{$log}"]); + pushGlobalHistoryLog(["{$log}"]); break; case "변경1": $gameStor->starttime = (new \DateTime($starttime))->format('Y-m-d H:i:s'); @@ -94,7 +94,7 @@ switch ($btn) { $starttime = cutTurn($starttime, $turnterm, false); $gameStor->turnterm = $turnterm; $gameStor->starttime = $starttime; - pushWorldHistory(["★턴시간이 $btn으로 변경됩니다."]); + pushGlobalHistoryLog(["★턴시간이 $btn으로 변경됩니다."]); break; } diff --git a/hwe/_admin2_submit.php b/hwe/_admin2_submit.php index f6542850..d47dbe18 100644 --- a/hwe/_admin2_submit.php +++ b/hwe/_admin2_submit.php @@ -123,8 +123,8 @@ switch ($btn) { ], 'no=%i', $general['no']); $specialWarName = buildGeneralSpecialWarClass($specialWar)->getName(); $josaUl = JosaUtil::pick($specialWarName, '을'); - pushGeneralHistory($general['no'], ["●{$year}년 {$month}월:특기 【{$specialWarName}】{$josaUl} 습득"]); - pushGenLog($general['no'], ["●특기 【{$specialWarName}】{$josaUl} 익혔습니다!"]); + pushGeneralHistoryLog($general['no'], ["●{$year}년 {$month}월:특기 【{$specialWarName}】{$josaUl} 습득"]); + pushGeneralActionLog($general['no'], ["●특기 【{$specialWarName}】{$josaUl} 익혔습니다!"]); } break; diff --git a/hwe/_admin7.php b/hwe/_admin7.php index df7b6deb..c4bdb0e9 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -142,10 +142,10 @@ $generalObj = General::createGeneralObjFromDB($gen); - + - + @@ -158,10 +158,10 @@ $generalObj = General::createGeneralObjFromDB($gen); - + - + diff --git a/hwe/a_history.php b/hwe/a_history.php index 2625fc82..c60e665d 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -34,7 +34,7 @@ if ($con >= 2) { -[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID); +[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID); $s = $s_year * 12 + $s_month; if($s_year === null){ @@ -42,7 +42,7 @@ if($s_year === null){ exit(); } -[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID); +[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID); $e = $e_year * 12 + $e_month; if($serverID !== UniqueConst::$serverID){ @@ -86,8 +86,10 @@ if ($month <= 0) { $month += 12; } -$history = $db->queryFirstRow('SELECT log,genlog,nation,power,gen,city FROM history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month); +$history = $db->queryFirstRow('SELECT * FROM ng_history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month); + +$nations = Json::decode($history['nations']); ?> @@ -108,6 +110,7 @@ $history = $db->queryFirstRow('SELECT log,genlog,nation,power,gen,city FROM hist + @@ -135,28 +139,49 @@ var selectMonth = ; - + + - - - - - - - + - + + + + + +
중 원 지 도
중 원 지 도
- - -
국명
국력
장수
속령
중 원 정 세
- + + + + + + + + + + + + + + + + + + + + + + +
국명국력장수속령
;background-color:'>
장 수 동 향
중 원 정 세
- +
장 수 동 향
+ +
diff --git a/hwe/a_status.php b/hwe/a_status.php index 2998bae6..409be4d9 100644 --- a/hwe/a_status.php +++ b/hwe/a_status.php @@ -61,7 +61,7 @@ $(function(){
- + @@ -69,7 +69,7 @@ $(function(){
- +
diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index 430b41f4..9727a448 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -161,7 +161,7 @@ $showGeneral = General::createGeneralObjFromDB($gen); - + @@ -170,10 +170,10 @@ $showGeneral = General::createGeneralObjFromDB($gen); - + - + getVar('npc') > 1 || $permission >= 2): ?> @@ -183,7 +183,7 @@ $showGeneral = General::createGeneralObjFromDB($gen); - + diff --git a/hwe/b_myKingdomInfo.php b/hwe/b_myKingdomInfo.php index 1e87b8d2..f1bef3ea 100644 --- a/hwe/b_myKingdomInfo.php +++ b/hwe/b_myKingdomInfo.php @@ -146,7 +146,7 @@ if ($budgetricediff > 0) { 국가열전 - +
diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index e351d782..b6e38b0f 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -175,10 +175,10 @@ $('#die_immediately').click(function(){ - + - + @@ -187,10 +187,10 @@ $('#die_immediately').click(function(){ - + - + diff --git a/hwe/css/history.css b/hwe/css/history.css new file mode 100644 index 00000000..ed4c8edb --- /dev/null +++ b/hwe/css/history.css @@ -0,0 +1,30 @@ +#nation_list_frame{ + vertical-align: top; +} + +#nation_list{ + width:100%; +} + +#nation_list thead{ + background-color:#cccccc; + color:black; + text-align:center +} + +#nation_list th{ + border:0; + border-left:1px solid gray; + padding:2px 6px; +} + +#nation_list td{ + border:0; + border-left:1px solid gray; + padding:1px 6px; + text-align:right; +} + +#nation_list td:first-child{ + text-align:left; +} \ No newline at end of file diff --git a/hwe/func.php b/hwe/func.php index d8149441..f4bc2637 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1659,7 +1659,7 @@ function deleteNation(General $lord, bool $applyDB):array $nation['msg'] = $nationStor->notice; $nation['scout_msg'] = $nationStor->scout_msg; $nation['aux'] += $nationStor->max_power; - $nation['history'] = getNationHistoryAll($nationID); + $nation['history'] = getNationHistoryLogAll($nationID); $josaYi = JosaUtil::pick($nationName, '이'); $destroyLog = "{$nationName}{$josaYi} 멸망했습니다."; diff --git a/hwe/func_auction.php b/hwe/func_auction.php index 25149d80..83a2ae1a 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['no'], $traderLog); + pushGeneralActionLog($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['no'], $traderLog); - pushGenLog($bidder['no'], $bidderLog); + pushGeneralActionLog($trader['no'], $traderLog); + pushGeneralActionLog($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['no'], $traderLog); - pushGenLog($bidder['no'], $bidderLog); + pushGeneralActionLog($trader['no'], $traderLog); + pushGeneralActionLog($bidder['no'], $bidderLog); pushAuctionLog($auctionLog); } } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 6ba7551e..d9bd1116 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -559,7 +559,7 @@ function updateNationState() case 7: $josaUl = JosaUtil::pick(getNationLevel($nationlevel), '을'); $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "{$josaUl} 자칭하였습니다."; - pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "{$josaUl} 자칭"]); + pushNationHistoryLog($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "{$josaUl} 자칭"]); $auxVal = Json::decode($nation['aux']); $auxVal['can_국기변경'] = 1; $auxVal['can_국호변경'] = 1; @@ -567,17 +567,17 @@ function updateNationState() break; case 6: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "에 등극하였습니다."; - pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "에 등극"]); + pushNationHistoryLog($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['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "에 임명됨"]); + pushNationHistoryLog($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "에 임명됨"]); break; case 2: $history[] = "●{$admin['year']}년 {$admin['month']}월:【작위】{$nation['name']}의 군주가 독립하여 " . getNationLevel($nationlevel) . "로 나섰습니다."; - pushNationHistory($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "로 나서다"]); + pushNationHistoryLog($nation['nation'], ["●{$admin['year']}년 {$admin['month']}월:{$nation['name']}의 군주가 " . getNationLevel($nationlevel) . "로 나서다"]); break; } @@ -701,7 +701,7 @@ function updateNationState() } } } - pushWorldHistory($history, $admin['year'], $admin['month']); + pushGlobalHistoryLog($history, $admin['year'], $admin['month']); } function checkStatistic() @@ -891,7 +891,7 @@ function checkStatistic() function convForOldGeneral(array $general, int $year, int $month) { - $general['history'] = getGeneralHistoryAll($general['no']); + $general['history'] = getGeneralHistoryLogAll($general['no']); return [ 'server_id' => UniqueConst::$serverID, 'general_no' => $general['no'], @@ -1040,7 +1040,7 @@ function checkEmperior() $nation['msg'] = $nationStor->notice; $nation['scout_msg'] = $nationStor->scout_msg; $nation['aux'] += $nationStor->max_power; - $nation['history'] = getNationHistoryAll($nation['nation']); + $nation['history'] = getNationHistoryLogAll($nation['nation']); storeOldGenerals(0, $admin['year'], $admin['month']); storeOldGenerals($nation['nation'], $admin['year'], $admin['month']); @@ -1062,7 +1062,7 @@ function checkEmperior() ]) ]); - $nationHistory = getNationHistoryAll($nation['nation']); + $nationHistory = getNationHistoryLogAll($nation['nation']); $serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games'); $serverName = UniqueConst::$serverName; @@ -1116,7 +1116,7 @@ function checkEmperior() ]); $history = ["●{$admin['year']}년 {$admin['month']}월:【통일】{$nation['name']}{$josaYi} 전토를 통일하였습니다."]; - pushWorldHistory($history, $admin['year'], $admin['month']); + pushGlobalHistoryLog($history, $admin['year'], $admin['month']); //연감 월결산 LogHistory(); diff --git a/hwe/func_history.php b/hwe/func_history.php index 5299c2b4..ccc034ed 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -109,7 +109,7 @@ function formatHistoryToHTML(array $history):string{ return join('
', $result); } -function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $month=null) { +function pushGeneralActionLog(int $generalID, ?array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } @@ -131,7 +131,7 @@ function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $mont $db->insert('general_record', $request); } -function getGenLogRecent(int $generalID, int $count):array{ +function getGeneralActionLogRecent(int $generalID, int $count):array{ $db = DB::db(); return $db->queryFirstColumn( @@ -140,7 +140,7 @@ function getGenLogRecent(int $generalID, int $count):array{ ); } -function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month=null) { +function pushBattleResultLog(int $generalID, array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } @@ -162,7 +162,7 @@ function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month $db->insert('general_record', $request); } -function getBatResRecent(int $generalID, int $count):array { +function getBattleResultRecent(int $generalID, int $count):array { $db = DB::db(); return $db->queryFirstColumn( @@ -171,7 +171,7 @@ function getBatResRecent(int $generalID, int $count):array { ); } -function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month=null) { +function pushBattleDetailLog(int $generalID, array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } @@ -193,7 +193,7 @@ function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month $db->insert('general_record', $request); } -function getBatLogRecent(int $generalID, int $count):array { +function getBattleDetailLogRecent(int $generalID, int $count):array { $db = DB::db(); return $db->queryFirstColumn( @@ -203,7 +203,7 @@ function getBatLogRecent(int $generalID, int $count):array { } -function pushGeneralHistory(int $generalID, ?array $history, $year=null, $month=null) { +function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $month=null) { if(!$history){ return; } @@ -226,7 +226,7 @@ function pushGeneralHistory(int $generalID, ?array $history, $year=null, $month= } -function getGeneralHistoryAll(int $generalID):array { +function getGeneralHistoryLogAll(int $generalID):array { $db = DB::db(); return $db->queryFirstColumn( @@ -236,7 +236,7 @@ function getGeneralHistoryAll(int $generalID):array { } -function pushNationHistory(int $nationID, ?array $history, ?int $year=null, ?int $month=null) { +function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } @@ -255,7 +255,7 @@ function pushNationHistory(int $nationID, ?array $history, ?int $year=null, ?int $db->insert('world_history', $request); } -function getNationHistoryAll(int $nationID):array { +function getNationHistoryLogAll(int $nationID):array { $db = DB::db(); return $db->queryFirstColumn( @@ -265,7 +265,7 @@ function getNationHistoryAll(int $nationID):array { } -function pushWorldHistory(?array $history, $year=null, $month=null) { +function pushGlobalHistoryLog(?array $history, $year=null, $month=null) { if(!$history){ return; } @@ -281,13 +281,13 @@ function pushWorldHistory(?array $history, $year=null, $month=null) { $db->insert('world_history', $request); } -function getWorldHistoryRecent(int $count):array { +function getGlobalHistoryLogRecent(int $count):array { $db = DB::db(); return $db->queryFirstColumn('SELECT `text` from world_history WHERE nation_id = 0 order by id desc limit %i', $count); } -function getWorldHistoryWithDate(int $year, int $month):array { +function getGlobalHistoryLogWithDate(int $year, int $month):array { $db = DB::db(); $texts = $db->queryFirstColumn( @@ -303,7 +303,7 @@ function getWorldHistoryWithDate(int $year, int $month):array { } -function pushGeneralPublicRecord(?array $history, ?int $year=null, ?int $month=null) { +function pushGlobalActionLog(?array $history, ?int $year=null, ?int $month=null) { if(!$history){ return; } @@ -319,7 +319,7 @@ function pushGeneralPublicRecord(?array $history, ?int $year=null, ?int $month=n $db->insert('general_record', $request); } -function getGeneralPublicRecordRecent(int $count):array { +function getGlobalActionLogRecent(int $count):array { $db = DB::db(); return $db->queryFirstColumn( @@ -328,7 +328,7 @@ function getGeneralPublicRecordRecent(int $count):array { ); } -function getGeneralPublicRecordWithDate(int $year, int $month):array { +function getGlobalActionLogWithDate(int $year, int $month):array { $db = DB::db(); $texts = $db->queryFirstColumn( @@ -350,7 +350,6 @@ function LogHistory($isFirst=0) { $gameStor = KVStorage::getStorage($db, 'game_env'); $obj = $gameStor->getValues(['startyear', 'year', 'month']); - //TODO: 새롭게 추가할 지도 값 받아오는 함수를 이용하여 재구성 $map = getWorldMap([ 'year'=>null, 'month'=>null, @@ -371,43 +370,46 @@ function LogHistory($isFirst=0) { } } - $startYear = $obj['startyear']; $year = $map['year']; $month = $map['month']; - $map_json = Json::encode($map); - $log = Json::encode(getWorldHistoryWithDate($year, $month)); - $genlog = Json::encode(getGeneralPublicRecordWithDate($year, $month)); - - $nationStr = ""; - $powerStr = ""; - $genStr = ""; - $cityStr = ""; - + $globalHistory = getGlobalHistoryLogWithDate($year, $month); + $globalAction = getGlobalActionLogWithDate($year, $month); - 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']); + $nations = getAllNationStaticInfo(); + $nations[0] = getNationStaticInfo(0); - $nationStr .= " {$nation['name']}
"; - $powerStr .= "{$nation['power']}
"; - $genStr .= "{$nation['gennum']}
"; - $cityStr .= "$cityCount
"; + foreach($db->query('SELECT name, nation FROM city') as $city){ + $cityNationID = $city['nation']; + if(!key_exists('cities', $nations[$cityNationID])){ + $nations[$cityNationID]['cities'] = []; + } + $nations[$cityNationID]['cities'][] = $city['name']; } + foreach($db->queryAllLists('SELECT name, npc, nation FROM general WHERE 1 ORDER BY dedication DESC') as $general){ + $generalNationID = array_pop($general); + if(!key_exists('generals', $nations[$generalNationID])){ + $nations[$generalNationID]['generals'] = []; + } + $nations[$generalNationID]['generals'][] = $general; + } + + usort($nations, function(array $lhs, array $rhs){ + return -($lhs['power']<=>$rhs['power']); + }); + if(STEP_LOG) pushStepLog(TimeUtil::now().', contents collected'); - $db->insert('history', [ + $db->insert('ng_history', [ 'server_id' => UniqueConst::$serverID, 'year' => $year, 'month' => $month, - 'map' => $map_json, - 'log' => $log, - 'genlog' => $genlog, - 'nation' => $nationStr, - 'power' => $powerStr, - 'gen' => $genStr, - 'city' => $cityStr + 'map' => Json::encode($map), + 'global_history' => Json::encode($globalHistory), + 'global_action' => Json::encode($globalAction), + 'nations' => Json::encode($nations), ]); if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Finish'); diff --git a/hwe/func_map.php b/hwe/func_map.php index 861afad0..ea96ae56 100644 --- a/hwe/func_map.php +++ b/hwe/func_map.php @@ -33,7 +33,7 @@ function getHistoryMap($year, $month, ?string $serverID=null){ $serverID = UniqueConst::$serverID; } - $map = DB::db()->queryFirstField('SELECT map FROM history WHERE server_id = %s AND year=%i and month=%i', + $map = DB::db()->queryFirstField('SELECT map FROM ng_history WHERE server_id = %s AND year=%i and month=%i', $serverID, $year, $month); diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index adfdbac0..c5275904 100644 --- a/hwe/func_time_event.php +++ b/hwe/func_time_event.php @@ -35,7 +35,7 @@ function processSpring() { $admin = $gameStor->getValues(['year', 'month']); - pushWorldHistory(["★{$admin['year']}년 {$admin['month']}월: 모두들 즐거운 게임 하고 계신가요? ^^ 매너 있는 플레이 부탁드리고, 지나친 훼접은 삼가주세요~"], $admin['year'], $admin['month']); + pushGlobalHistoryLog(["★{$admin['year']}년 {$admin['month']}월: 모두들 즐거운 게임 하고 계신가요? ^^ 매너 있는 플레이 부탁드리고, 지나친 훼접은 삼가주세요~"], $admin['year'], $admin['month']); } function processGoldIncome() { diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 5cf382da..6bf425bb 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -297,7 +297,7 @@ function startTournament($auto, $type) { $history[] = "◆{$admin['year']}년 {$admin['month']}월:{$openerText}{$typeText} 대회가 개최됩니다! 천하의 {$genTypeText}들을 모집하고 있습니다!"; - pushWorldHistory($history, $admin['year'], $admin['month']); + pushGlobalHistoryLog($history, $admin['year'], $admin['month']); } function fillLowGenAll() { diff --git a/hwe/index.php b/hwe/index.php index 16152488..ff72fe9c 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -324,11 +324,11 @@ else if($session->userGrade == 4){ 개인 기록 - - + + 중원 정세 - +