연감 저장방식 수정
This commit is contained in:
@@ -40,7 +40,7 @@ switch ($btn) {
|
||||
$gameStor->msg = $msg;
|
||||
break;
|
||||
case "로그쓰기":
|
||||
pushWorldHistory(["<R>★</><S>{$log}</>"]);
|
||||
pushGlobalHistoryLog(["<R>★</><S>{$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(["<R>★</>턴시간이 <C>$btn</>으로 변경됩니다."]);
|
||||
pushGlobalHistoryLog(["<R>★</>턴시간이 <C>$btn</>으로 변경됩니다."]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ switch ($btn) {
|
||||
], 'no=%i', $general['no']);
|
||||
$specialWarName = buildGeneralSpecialWarClass($specialWar)->getName();
|
||||
$josaUl = JosaUtil::pick($specialWarName, '을');
|
||||
pushGeneralHistory($general['no'], ["<C>●</>{$year}년 {$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득"]);
|
||||
pushGenLog($general['no'], ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]);
|
||||
pushGeneralHistoryLog($general['no'], ["<C>●</>{$year}년 {$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득"]);
|
||||
pushGeneralActionLog($general['no'], ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
+4
-4
@@ -142,10 +142,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?= formatHistoryToHTML(getGenLogRecent($gen, 24)) ?>
|
||||
<?= formatHistoryToHTML(getGeneralActionLogRecent($gen, 24)) ?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?= formatHistoryToHTML(getBatLogRecent($gen, 24)) ?>
|
||||
<?= formatHistoryToHTML(getBattleDetailLogRecent($gen, 24)) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -158,10 +158,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?= formatHistoryToHTML(getGeneralHistoryAll($gen)) ?>
|
||||
<?= formatHistoryToHTML(getGeneralHistoryLogAll($gen)) ?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?= formatHistoryToHTML(getBatResRecent($gen, 24)) ?>
|
||||
<?= formatHistoryToHTML(getBattleResultRecent($gen, 24)) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
+42
-17
@@ -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']);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -108,6 +110,7 @@ $history = $db->queryFirstRow('SELECT log,genlog,nation,power,gen,city FROM hist
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/map.css')?>
|
||||
<?=WebUtil::printCSS('css/history.css')?>
|
||||
<script>
|
||||
var startYear = <?=$s_year?>;
|
||||
var startMonth = <?=$s_month?>;
|
||||
@@ -115,6 +118,7 @@ var lastYear = <?=$e_year?>;
|
||||
var lastMonth = <?=$e_month?>;
|
||||
var selectYear = <?=$year?>;
|
||||
var selectMonth = <?=$month?>;
|
||||
var nations = <?=$nations?$history['nations']:'{}'?>;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -135,28 +139,49 @@ var selectMonth = <?=$month?>;
|
||||
</td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 height=520 class='tb_layout bg0'>
|
||||
<tr><td colspan=5 align=center id=bg1>중 원 지 도</td></tr>
|
||||
<thead><tr><th colspan=5 align=center id=bg1>중 원 지 도</th></tr></thead>
|
||||
<tbody>
|
||||
<tr height=520>
|
||||
<td width=698>
|
||||
<?=getMapHtml($mapTheme);?>
|
||||
|
||||
<td width=139 valign=top><div style='background-color:#cccccc;color:black;text-align:center'>국명</div><?=$history['nation']?></td>
|
||||
<td width=70 valign=top style='text-align:center'><div style='background-color:#cccccc;color:black;'>국력</div><?=$history['power']?></td>
|
||||
<td width=43 valign=top style='text-align:center'><div style='background-color:#cccccc;color:black;'>장수</div><?=$history['gen']?></td>
|
||||
<td width=40 valign=top style='text-align:center'><div style='background-color:#cccccc;color:black;'>속령</div><?=$history['city']?></td>
|
||||
</tr>
|
||||
<tr><td colspan=5 align=center id=bg1>중 원 정 세</td></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=formatHistoryToHTML(Json::decode($history['log']))?>
|
||||
<?=getMapHtml($mapTheme)?>
|
||||
</td>
|
||||
<td id='nation_list_frame'>
|
||||
<table id='nation_list'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width=130>국명</th>
|
||||
<th width=70>국력</th>
|
||||
<th width=45>장수</th>
|
||||
<th width=45>속령</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($nations as $nation): ?>
|
||||
<tr>
|
||||
<td><span style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'><?=$nation['name']?></td>
|
||||
<td style='text-align:right'><?=number_format($nation['power'])?></td>
|
||||
<td style='text-align:right'><?=number_format($nation['gennum'])?></td>
|
||||
<td style='text-align:right'><?=number_format(count($nation['cities']))?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot></tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=5 align=center id=bg1>장 수 동 향</td></tr>
|
||||
<tr><th colspan=5 align=center id=bg1>중 원 정 세</th></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=formatHistoryToHTML(Json::decode($history['genlog']))?>
|
||||
<?=formatHistoryToHTML(Json::decode($history['global_history']))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th colspan=5 align=center id=bg1>장 수 동 향</th></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=formatHistoryToHTML(Json::decode($history['global_action']))?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=closeButton()?></td></tr>
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ $(function(){
|
||||
<table align=center width=1200 height=520 class='tb_layout bg0'>
|
||||
<tr height=520>
|
||||
<td width=498 valign=top>
|
||||
<?=formatHistoryToHTML(getGeneralPublicRecordRecent(34))?>
|
||||
<?=formatHistoryToHTML(getGlobalActionLogRecent(34))?>
|
||||
</td>
|
||||
<td width=698>
|
||||
<?=getMapHtml($mapTheme)?>
|
||||
@@ -69,7 +69,7 @@ $(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 valign=top>
|
||||
<?=formatHistoryToHTML(getWorldHistoryRecent(34))?>
|
||||
<?=formatHistoryToHTML(getGlobalHistoryLogRecent(34))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -161,7 +161,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
<?php generalInfo($showGeneral); generalInfo2($showGeneral); ?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryAll($gen))?>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryLogAll($gen))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -170,10 +170,10 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getBatLogRecent($gen, 24))?>
|
||||
<?=formatHistoryToHTML(getBattleDetailLogRecent($gen, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getBatResRecent($gen, 24))?>
|
||||
<?=formatHistoryToHTML(getBattleResultRecent($gen, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($showGeneral->getVar('npc') > 1 || $permission >= 2): ?>
|
||||
@@ -183,7 +183,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getGenLogRecent($gen, 24))?>
|
||||
<?=formatHistoryToHTML(getGeneralActionLogRecent($gen, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
</td>
|
||||
|
||||
@@ -146,7 +146,7 @@ if ($budgetricediff > 0) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center valign=top id=bg1>국가열전</td>
|
||||
<td colspan=7 id=bg0><?=formatHistoryToHTML(getNationHistoryAll($nation['nation']))?></td>
|
||||
<td colspan=7 id=bg0><?=formatHistoryToHTML(getNationHistoryLogAll($nation['nation']))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
+4
-4
@@ -175,10 +175,10 @@ $('#die_immediately').click(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getGenLogRecent($generalID, 24))?>
|
||||
<?=formatHistoryToHTML(getGeneralActionLogRecent($generalID, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getBatLogRecent($generalID, 24))?>
|
||||
<?=formatHistoryToHTML(getBattleDetailLogRecent($generalID, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -187,10 +187,10 @@ $('#die_immediately').click(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryAll($generalID))?>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryLogAll($generalID))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=formatHistoryToHTML(getBatResRecent($generalID, 24))?>
|
||||
<?=formatHistoryToHTML(getBattleResultRecent($generalID, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
+1
-1
@@ -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 = "<D><b>{$nationName}</b></>{$josaYi} <R>멸망</>했습니다.";
|
||||
|
||||
@@ -107,7 +107,7 @@ function processAuction() {
|
||||
$josaUlRice = JosaUtil::pick($auction['amount'], '을');
|
||||
$auctionLog[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월, {$auction['no']}번 <S>구매</> <M>유찰</> : <Y>{$auction['name1']}</>{$josaYi1} 쌀 <C>{$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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ function updateNationState()
|
||||
case 7:
|
||||
$josaUl = JosaUtil::pick(getNationLevel($nationlevel), '을');
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭하였습니다.";
|
||||
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭"]);
|
||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭"]);
|
||||
$auxVal = Json::decode($nation['aux']);
|
||||
$auxVal['can_국기변경'] = 1;
|
||||
$auxVal['can_국호변경'] = 1;
|
||||
@@ -567,17 +567,17 @@ function updateNationState()
|
||||
break;
|
||||
case 6:
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극하였습니다.";
|
||||
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극"]);
|
||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극"]);
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명되었습니다.";
|
||||
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명됨"]);
|
||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명됨"]);
|
||||
break;
|
||||
case 2:
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 독립하여 <Y>" . getNationLevel($nationlevel) . "</>로 나섰습니다.";
|
||||
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>로 나서다"]);
|
||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . 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 = ["<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다."];
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
pushGlobalHistoryLog($history, $admin['year'], $admin['month']);
|
||||
|
||||
//연감 월결산
|
||||
LogHistory();
|
||||
|
||||
+43
-41
@@ -109,7 +109,7 @@ function formatHistoryToHTML(array $history):string{
|
||||
return join('<br>', $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 .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>";
|
||||
$powerStr .= "{$nation['power']}<br>";
|
||||
$genStr .= "{$nation['gennum']}<br>";
|
||||
$cityStr .= "$cityCount<br>";
|
||||
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');
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -35,7 +35,7 @@ function processSpring() {
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
pushWorldHistory(["<R>★</>{$admin['year']}년 {$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>매너 있는 플레이</> 부탁드리고, <M>지나친 훼접</>은 삼가주세요~</>"], $admin['year'], $admin['month']);
|
||||
pushGlobalHistoryLog(["<R>★</>{$admin['year']}년 {$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>매너 있는 플레이</> 부탁드리고, <M>지나친 훼접</>은 삼가주세요~</>"], $admin['year'], $admin['month']);
|
||||
}
|
||||
|
||||
function processGoldIncome() {
|
||||
|
||||
@@ -297,7 +297,7 @@ function startTournament($auto, $type) {
|
||||
|
||||
$history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월:{$openerText}<C>{$typeText}</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>{$genTypeText}</span>들을 모집하고 있습니다!";
|
||||
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
pushGlobalHistoryLog($history, $admin['year'], $admin['month']);
|
||||
}
|
||||
|
||||
function fillLowGenAll() {
|
||||
|
||||
+3
-3
@@ -324,11 +324,11 @@ else if($session->userGrade == 4){
|
||||
<td width=498 class='bg1 center'><b>개인 기록</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 id="general_public_record" style="text-align:left;"><?=formatHistoryToHTML(getGeneralPublicRecordRecent(15))?></td>
|
||||
<td width=498 id="general_log" style="text-align:left;"><?=formatHistoryToHTML(getGenLogRecent($me['no'], 15))?></td>
|
||||
<td width=498 id="general_public_record" style="text-align:left;"><?=formatHistoryToHTML(getGlobalActionLogRecent(15))?></td>
|
||||
<td width=498 id="general_log" style="text-align:left;"><?=formatHistoryToHTML(getGeneralActionLogRecent($me['no'], 15))?></td>
|
||||
</tr>
|
||||
<tr><td width=998 colspan=2 class='bg1 center'><b>중원 정세</b></td></tr>
|
||||
<tr><td width=998 id="world_history" colspan=2 style="text-align:left;"><?=formatHistoryToHTML(getWorldHistoryRecent(15))?></td></tr>
|
||||
<tr><td width=998 id="world_history" colspan=2 style="text-align:left;"><?=formatHistoryToHTML(getGlobalHistoryLogRecent(15))?></td></tr>
|
||||
</table>
|
||||
<div class="message_input_form bg0">
|
||||
<select id="mailbox_list" size="1">
|
||||
|
||||
@@ -34,7 +34,7 @@ $session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$map = $db->queryFirstField('SELECT map FROM history WHERE server_id=%s AND year=%i AND month=%i', $serverID, $year, $month);
|
||||
$map = $db->queryFirstField('SELECT map FROM ng_history WHERE server_id=%s AND year=%i AND month=%i', $serverID, $year, $month);
|
||||
|
||||
if(!$map){
|
||||
Json::die([
|
||||
|
||||
@@ -80,37 +80,37 @@ class ActionLogger
|
||||
public function flush()
|
||||
{
|
||||
if ($this->generalHistoryLog && $this->generalID) {
|
||||
pushGeneralHistory($this->generalID, $this->generalHistoryLog, $this->year, $this->month);
|
||||
pushGeneralHistoryLog($this->generalID, $this->generalHistoryLog, $this->year, $this->month);
|
||||
$this->generalHistoryLog = [];
|
||||
}
|
||||
|
||||
if ($this->generalActionLog && $this->generalID) {
|
||||
pushGenLog($this->generalID, $this->generalActionLog, $this->year, $this->month);
|
||||
pushGeneralActionLog($this->generalID, $this->generalActionLog, $this->year, $this->month);
|
||||
$this->generalActionLog = [];
|
||||
}
|
||||
|
||||
if ($this->generalBattleResultLog && $this->generalID) {
|
||||
pushBatRes($this->generalID, $this->generalBattleResultLog, $this->year, $this->month);
|
||||
pushBattleResultLog($this->generalID, $this->generalBattleResultLog, $this->year, $this->month);
|
||||
$this->generalBattleResultLog = [];
|
||||
}
|
||||
|
||||
if ($this->generalBattleDetailLog && $this->generalID) {
|
||||
pushBatLog($this->generalID, $this->generalBattleDetailLog, $this->year, $this->month);
|
||||
pushBattleDetailLog($this->generalID, $this->generalBattleDetailLog, $this->year, $this->month);
|
||||
$this->generalBattleDetailLog = [];
|
||||
}
|
||||
|
||||
if ($this->nationID && $this->nationalHistoryLog) {
|
||||
pushNationHistory($this->nationID, $this->nationalHistoryLog, $this->year, $this->month);
|
||||
pushNationHistoryLog($this->nationID, $this->nationalHistoryLog, $this->year, $this->month);
|
||||
$this->nationalHistoryLog = [];
|
||||
}
|
||||
|
||||
if ($this->globalHistoryLog) {
|
||||
pushWorldHistory($this->globalHistoryLog, $this->year, $this->month);
|
||||
pushGlobalHistoryLog($this->globalHistoryLog, $this->year, $this->month);
|
||||
$this->globalHistoryLog = [];
|
||||
}
|
||||
|
||||
if ($this->globalActionLog) {
|
||||
pushGeneralPublicRecord($this->globalActionLog, $this->year, $this->month);
|
||||
pushGlobalActionLog($this->globalActionLog, $this->year, $this->month);
|
||||
$this->globalActionLog = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ class DiplomaticMessage extends Message{
|
||||
|
||||
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
|
||||
if($result !== self::ACCEPTED){
|
||||
pushGenLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||
if($result === self::DECLINED){
|
||||
$this->_declineMessage();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ class DiplomaticMessage extends Message{
|
||||
}
|
||||
|
||||
if($result !== self::ACCEPTED){
|
||||
pushGenLog($receiverID, ["<C>●</>{$reason}"]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</>{$reason}"]);
|
||||
if($result === self::DECLINED){
|
||||
$this->_declineMessage();
|
||||
}
|
||||
@@ -259,13 +259,13 @@ class DiplomaticMessage extends Message{
|
||||
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
|
||||
|
||||
if($result === self::INVALID){
|
||||
pushGenLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
||||
return $result;
|
||||
}
|
||||
|
||||
$josaYi = JosaUtil::pick($this->dest->nationName, '이');
|
||||
pushGenLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>의 {$this->diplomacyName} 제안을 거절했습니다."]);
|
||||
pushGenLog($this->src->generalID, ["<C>●</><Y>{$this->dest->nationName}</>{$josaYi} {$this->diplomacyName} 제안을 거절했습니다."]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>의 {$this->diplomacyName} 제안을 거절했습니다."]);
|
||||
pushGeneralActionLog($this->src->generalID, ["<C>●</><Y>{$this->dest->nationName}</>{$josaYi} {$this->diplomacyName} 제안을 거절했습니다."]);
|
||||
$this->_declineMessage();
|
||||
return self::DECLINED;
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ class Scenario{
|
||||
|
||||
|
||||
|
||||
pushWorldHistory($this->history, $env['year'], $env['month']);
|
||||
pushGlobalHistoryLog($this->history, $env['year'], $env['month']);
|
||||
|
||||
refreshNationStaticInfo();
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
|
||||
@@ -143,14 +143,14 @@ class ScoutMessage extends Message{
|
||||
list($result, $reason) = $this->checkScoutMessageValidation($receiverID);
|
||||
|
||||
if($result === self::INVALID){
|
||||
pushGenLog($receiverID, ["<C>●</>{$reason} 등용 취소 불가."]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</>{$reason} 등용 취소 불가."]);
|
||||
return $result;
|
||||
}
|
||||
|
||||
$josaRo = JosaUtil::pick($this->src->nationName, '로');
|
||||
$josaYi = JosaUtil::pick($this->dest->generalName, '이');
|
||||
pushGenLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>{$josaRo} 망명을 거부했습니다."]);
|
||||
pushGenLog($this->src->generalID, ["<C>●</><Y>{$this->dest->generalName}</>{$josaYi} 등용을 거부했습니다."]);
|
||||
pushGeneralActionLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>{$josaRo} 망명을 거부했습니다."]);
|
||||
pushGeneralActionLog($this->src->generalID, ["<C>●</><Y>{$this->dest->generalName}</>{$josaYi} 등용을 거부했습니다."]);
|
||||
$this->_declineMessage();
|
||||
|
||||
return self::DECLINED;
|
||||
|
||||
+8
-11
@@ -481,22 +481,19 @@ ENGINE=Aria ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
###########################################################################
|
||||
## 연감 테이블
|
||||
###########################################################################
|
||||
CREATE TABLE IF NOT EXISTS `history` (
|
||||
CREATE TABLE IF NOT EXISTS `ng_history` (
|
||||
`no` INT(6) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL DEFAULT '',
|
||||
`year` INT(4) NULL DEFAULT '0',
|
||||
`month` INT(2) NULL DEFAULT '0',
|
||||
`server_id` CHAR(20) NOT NULL,
|
||||
`year` INT(4) NULL,
|
||||
`month` INT(2) NULL,
|
||||
`map` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`map`)),
|
||||
`log` TEXT NULL DEFAULT NULL CHECK (json_valid(`log`)),
|
||||
`genlog` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`genlog`)),
|
||||
`nation` TEXT NULL DEFAULT '',
|
||||
`power` TEXT NULL DEFAULT '',
|
||||
`gen` TEXT NULL DEFAULT '',
|
||||
`city` TEXT NULL DEFAULT '',
|
||||
`global_history` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`global_history`)),
|
||||
`global_action` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`global_action`)),
|
||||
`nations` MEDIUMTEXT NULL DEFAULT NULL CHECK (json_valid(`nations`)),
|
||||
PRIMARY KEY (`no`),
|
||||
INDEX `server_id` (`server_id`, `year`, `month`)
|
||||
)
|
||||
ENGINE=Aria DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED;
|
||||
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
###########################################################################
|
||||
## 이벤트 핸들러 테이블
|
||||
|
||||
Reference in New Issue
Block a user