forked from devsam/core
history 관련 처리 변경
This commit is contained in:
+4
-4
@@ -146,10 +146,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getGenLogRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getGenLogRecent($gen, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getBatLogRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getBatLogRecent($gen, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -158,10 +158,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getGeneralHistoryAll($gen)?>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryAll($gen))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getBatResRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getBatResRecent($gen, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ if ($select == 0) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>역 사 기 록</td>
|
||||
<td colspan=5>".ConvertLog($emperior['history'], 1)."</td>
|
||||
<td colspan=5>".formatHistoryToHTML(Json::decode($emperior['history']))."</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>";
|
||||
|
||||
@@ -153,7 +153,7 @@ if($emperior):
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>역 사 기 록</td>
|
||||
<td colspan=5><?=ConvertLog($emperior['history'], 1)?></td>
|
||||
<td colspan=5><?=formatHistoryToHTML(Json::decode($emperior['history']))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
+2
-2
@@ -148,13 +148,13 @@ var selectMonth = <?=$month?>;
|
||||
<tr><td colspan=5 align=center id=bg1>중 원 정 세</td></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=$history['log']?>
|
||||
<?=formatHistoryToHTML(Json::decode($history['log']))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=5 align=center id=bg1>장 수 동 향</td></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=$history['genlog']?>
|
||||
<?=formatHistoryToHTML(Json::decode($history['genlog']))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ $(function(){
|
||||
<table align=center width=1200 height=520 class='tb_layout bg0'>
|
||||
<tr height=520>
|
||||
<td width=498 valign=top>
|
||||
<?=getGeneralPublicRecordRecent(34)?>
|
||||
<?=formatHistoryToHTML(getGeneralPublicRecordRecent(34))?>
|
||||
</td>
|
||||
<td width=698>
|
||||
<?=getMapHtml($mapTheme)?>
|
||||
@@ -72,7 +72,7 @@ $(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 valign=top>
|
||||
<?=getWorldHistoryRecent(34)?>
|
||||
<?=formatHistoryToHTML(getWorldHistoryRecent(34))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -174,7 +174,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
<?php generalInfo($showGeneral); generalInfo2($showGeneral); ?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getGeneralHistoryAll($gen)?>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryAll($gen))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -183,10 +183,10 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getBatLogRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getBatLogRecent($gen, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getBatResRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getBatResRecent($gen, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($npc > 1 || $permission >= 2): ?>
|
||||
@@ -196,7 +196,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getGenLogRecent($gen, 24)?>
|
||||
<?=formatHistoryToHTML(getGenLogRecent($gen, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
</td>
|
||||
|
||||
@@ -43,7 +43,7 @@ if($nationID == 0) {
|
||||
<br>
|
||||
<?php
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT nation,gennum,power,rate,bill,type,gold,rice,color,name,level,tech,history,capital FROM nation WHERE nation=%i', $nationID); //국가정보
|
||||
$nation = $db->queryFirstRow('SELECT nation,gennum,power,rate,bill,type,gold,rice,color,name,level,tech,capital FROM nation WHERE nation=%i', $nationID); //국가정보
|
||||
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
|
||||
|
||||
$currPop = 0;
|
||||
@@ -146,7 +146,7 @@ if ($budgetricediff > 0) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center valign=top id=bg1>국가열전</td>
|
||||
<td colspan=7 id=bg0><?=ConvertLog($nation['history'])?></td>
|
||||
<td colspan=7 id=bg0><?=formatHistoryToHTML(getNationHistoryAll($nation['nation']))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
+4
-4
@@ -161,10 +161,10 @@ $('#die_immediately').click(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getGenLogRecent($generalID, 24)?>
|
||||
<?=formatHistoryToHTML(getGenLogRecent($generalID, 24))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getBatLogRecent($generalID, 24)?>
|
||||
<?=formatHistoryToHTML(getBatLogRecent($generalID, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -173,10 +173,10 @@ $('#die_immediately').click(function(){
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
<?=getGeneralHistoryAll($generalID)?>
|
||||
<?=formatHistoryToHTML(getGeneralHistoryAll($generalID))?>
|
||||
</td>
|
||||
<td valign=top>
|
||||
<?=getBatResRecent($generalID, 24)?>
|
||||
<?=formatHistoryToHTML(getBatResRecent($generalID, 24))?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1566,6 +1566,7 @@ function deleteNation(General $general) {
|
||||
$oldNationGenerals = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nationID);
|
||||
$oldNation['generals'] = $oldNationGenerals;
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
$oldNation['history'] = getNationHistoryAll($nationID);
|
||||
|
||||
$general->setVar('belong', 0);
|
||||
$general->setVar('troop', 0);
|
||||
|
||||
@@ -651,6 +651,7 @@ function checkMerge() {
|
||||
$oldNationGenerals = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $me['nation']);
|
||||
$oldNation['generals'] = $oldNationGenerals;
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
$oldNation['history'] = getNationHistoryAll($me['nation']);
|
||||
|
||||
// 자금 통합, 외교제한 5년, 기술유지
|
||||
$db->update('nation', [
|
||||
@@ -801,6 +802,7 @@ function checkSurrender() {
|
||||
$oldNationGenerals = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $me['nation']);
|
||||
$oldNation['generals'] = $oldNationGenerals;
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
$oldNation['history'] = getNationHistoryAll($me['nation']);
|
||||
|
||||
$newGenCount = $gencount + $gencount2;
|
||||
$newTech = ($younation['tech'] * $gencount + $mynation['tech'] * $gencount2) / $newGenCount;
|
||||
@@ -1186,6 +1188,7 @@ function checkStatistic() {
|
||||
|
||||
|
||||
function convForOldGeneral(array $general, int $year, int $month){
|
||||
$general['history'] = getGeneralHistoryAll($general['no']);
|
||||
return [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'general_no'=>$general['no'],
|
||||
@@ -1345,6 +1348,7 @@ function checkEmperior() {
|
||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['generals'] = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
$oldNation['history'] = getNationHistoryAll($nation['nation']);
|
||||
|
||||
storeOldGenerals(0, $admin['year'], $admin['month']);
|
||||
storeOldGenerals($nation['nation'], $admin['year'], $admin['month']);
|
||||
@@ -1366,7 +1370,7 @@ function checkEmperior() {
|
||||
])
|
||||
]);
|
||||
|
||||
$nationHistory = DB::db()->queryFirstField('SELECT `history` FROM `nation` WHERE `nation` = %i', $nation['nation']);
|
||||
$nationHistory = JSON::encode(getNationHistoryAll($nation['nation']));
|
||||
|
||||
$serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games');
|
||||
$serverName = UniqueConst::$serverName;
|
||||
|
||||
+61
-91
@@ -129,7 +129,13 @@ function pushOldNationStop(int $no, int $nationNo){
|
||||
}
|
||||
|
||||
//DB-based
|
||||
|
||||
function formatHistoryToHTML(array $history):string{
|
||||
$result = [];
|
||||
foreach($history as $item){
|
||||
$result[] = ConvertLog($item);
|
||||
}
|
||||
return join('<br>', $result);
|
||||
}
|
||||
|
||||
function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $month=null) {
|
||||
if(!$history){
|
||||
@@ -153,19 +159,13 @@ function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $mont
|
||||
$db->insert('general_record', $request);
|
||||
}
|
||||
|
||||
function getGenLogRecent(int $generalID, int $count) {
|
||||
function getGenLogRecent(int $generalID, int $count):array{
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "action" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "action" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
);
|
||||
}
|
||||
|
||||
function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month=null) {
|
||||
@@ -190,19 +190,13 @@ function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month
|
||||
$db->insert('general_record', $request);
|
||||
}
|
||||
|
||||
function getBatResRecent(int $generalID, int $count) {
|
||||
function getBatResRecent(int $generalID, int $count):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle_brief" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle_brief" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
);
|
||||
}
|
||||
|
||||
function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month=null) {
|
||||
@@ -227,19 +221,13 @@ function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month
|
||||
$db->insert('general_record', $request);
|
||||
}
|
||||
|
||||
function getBatLogRecent(int $generalID, int $count) {
|
||||
function getBatLogRecent(int $generalID, int $count):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "battle" order by id desc LIMIT %i',
|
||||
$generalID, $count
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -266,19 +254,13 @@ function pushGeneralHistory(int $generalID, ?array $history, $year=null, $month=
|
||||
|
||||
}
|
||||
|
||||
function getGeneralHistoryAll(int $generalID) {
|
||||
function getGeneralHistoryAll(int $generalID):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "history" order by id desc',
|
||||
$generalID
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = %i AND log_type = "history" order by id desc',
|
||||
$generalID
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +280,15 @@ function pushNationHistory(int $nationID, ?array $history, ?int $year=null, ?int
|
||||
$db->insert('world_history', $request);
|
||||
}
|
||||
|
||||
function getNationHistoryAll(int $nationID):array {
|
||||
$db = DB::db();
|
||||
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from world_history WHERE nation_id = %i order by id desc',
|
||||
$nationID
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function pushWorldHistory(?array $history, $year=null, $month=null) {
|
||||
if(!$history){
|
||||
@@ -315,35 +306,25 @@ function pushWorldHistory(?array $history, $year=null, $month=null) {
|
||||
$db->insert('world_history', $request);
|
||||
}
|
||||
|
||||
function getWorldHistoryRecent(int $count) {
|
||||
function getWorldHistoryRecent(int $count):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach($db->queryFirstColumn('SELECT `text` from world_history WHERE nation_id = 0 order by id desc limit %i', $count) as $text){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
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) {
|
||||
function getWorldHistoryWithDate(int $year, int $month):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc',
|
||||
$year,
|
||||
$month
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
$texts = $db->queryFirstColumn(
|
||||
'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc',
|
||||
$year,
|
||||
$month
|
||||
);
|
||||
|
||||
if(!$texts){
|
||||
return ConvertLog("<C>●</>{$year}년 {$month}월: 기록 없음");
|
||||
return ["<C>●</>{$year}년 {$month}월: 기록 없음"];
|
||||
}
|
||||
|
||||
return join('<br>', $texts);
|
||||
return $texts;
|
||||
}
|
||||
|
||||
|
||||
@@ -363,39 +344,28 @@ function pushGeneralPublicRecord(?array $history, ?int $year=null, ?int $month=n
|
||||
$db->insert('general_record', $request);
|
||||
}
|
||||
|
||||
function getGeneralPublicRecordRecent(int $count) {
|
||||
function getGeneralPublicRecordRecent(int $count):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = 0 AND log_type = "history" order by id desc limit %i',
|
||||
$count
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record WHERE general_id = 0 AND log_type = "history" order by id desc limit %i',
|
||||
$count
|
||||
);
|
||||
}
|
||||
|
||||
function getGeneralPublicRecordWithDate(int $year, int $month) {
|
||||
function getGeneralPublicRecordWithDate(int $year, int $month):array {
|
||||
$db = DB::db();
|
||||
|
||||
$texts = [];
|
||||
foreach(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc',
|
||||
$year,
|
||||
$month
|
||||
) as $text
|
||||
){
|
||||
$texts[] = ConvertLog($text);
|
||||
}
|
||||
$texts = $db->queryFirstColumn(
|
||||
'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc',
|
||||
$year,
|
||||
$month
|
||||
);
|
||||
|
||||
if(!$texts){
|
||||
return ConvertLog("<C>●</>{$month}월: 기록 없음");
|
||||
return "<C>●</>{$month}월: 기록 없음";
|
||||
}
|
||||
return join('<br>', $texts);
|
||||
return $texts;
|
||||
}
|
||||
|
||||
function LogHistory($isFirst=0) {
|
||||
@@ -432,8 +402,8 @@ function LogHistory($isFirst=0) {
|
||||
|
||||
$map_json = Json::encode($map);
|
||||
|
||||
$log = getWorldHistoryWithDate($year, $month);
|
||||
$genlog = getGeneralPublicRecordWithDate($year, $month);
|
||||
$log = Json::encode(getWorldHistoryWithDate($year, $month));
|
||||
$genlog = Json::encode(getGeneralPublicRecordWithDate($year, $month));
|
||||
|
||||
$nationStr = "";
|
||||
$powerStr = "";
|
||||
|
||||
+3
-3
@@ -318,11 +318,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;"><?=getGeneralPublicRecordRecent(15)?></td>
|
||||
<td width=498 id="general_log" style="text-align:left;"><?=getGenLogRecent($me['no'], 15)?></td>
|
||||
<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>
|
||||
</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;"><?=getWorldHistoryRecent(15)?></td></tr>
|
||||
<tr><td width=998 id="world_history" colspan=2 style="text-align:left;"><?=formatHistoryToHTML(getWorldHistoryRecent(15))?></td></tr>
|
||||
</table>
|
||||
<div class="message_input_form bg0">
|
||||
<select id="mailbox_list" size="1">
|
||||
|
||||
@@ -533,6 +533,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
return $gen['no'];
|
||||
}, $oldNationGenerals);
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
$oldNation['history'] = getNationHistoryAll($city['nation']);
|
||||
|
||||
foreach($oldNationGenerals as $gen){
|
||||
|
||||
|
||||
@@ -63,7 +63,6 @@ CREATE TABLE `general` (
|
||||
`explevel` INT(2) NULL DEFAULT '0',
|
||||
`age` INT(3) NULL DEFAULT '20',
|
||||
`startage` INT(3) NULL DEFAULT '20',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`belong` INT(2) NULL DEFAULT '1',
|
||||
`betray` INT(2) NULL DEFAULT '0',
|
||||
`personal` VARCHAR(20) NOT NULL DEFAULT 'None',
|
||||
@@ -148,7 +147,6 @@ CREATE TABLE `nation` (
|
||||
`level` INT(1) NULL DEFAULT '0',
|
||||
`type` VARCHAR(20) NOT NULL DEFAULT 'che_중립',
|
||||
`rule` TEXT NULL DEFAULT '',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`aux` TEXT NOT NULL DEFAULT '{}',
|
||||
PRIMARY KEY (`nation`)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user