history column을 테이블로 분리

This commit is contained in:
2020-04-18 14:07:07 +09:00
parent ad2baeda2f
commit aba9ee7b33
14 changed files with 323 additions and 184 deletions
+2 -2
View File
@@ -122,8 +122,8 @@ switch($btn) {
], 'no=%i', $general['no']);
$specialWarName = SpecialityConst::WAR[$specialWar][0];
$josaUl = JosaUtil::pick($specialWarName, '을');
pushGeneralHistory($general, "<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득");
pushGenLog($general, ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]);
pushGeneralHistory($general['no'], ["<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】{$josaUl} 습득"]);
pushGenLog($general['no'], ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】{$josaUl} 익혔습니다!"]);
}
break;
+20 -10
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Event\Action;
require_once 'process_war.php';
require_once 'func_gamerule.php';
require_once 'func_process.php';
@@ -1188,29 +1190,35 @@ function updateOnline() {
function addAge() {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$connect=$db->get();
//나이와 호봉 증가
$query = "update general set age=age+1,belong=belong+1";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$db->update('general', [
'age'=>$db->sqleval('age+1'),
'belong'=>$db->sqleval('belong+1')
], true);
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
[$startYear, $year, $month] = $gameStor->getValuesAsArray(['startyear', 'year', 'month']);
if($admin['year'] >= $admin['startyear']+3) {
if($year >= $startYear+3) {
foreach($db->query('SELECT no,name,nation,leadership,strength,intel from general where specage<=age and special=%s', GameConst::$defaultSpecialDomestic) as $general){
$generalID = $general['no'];
$special = SpecialityConst::pickSpecialDomestic($general);
$specialClass = buildGeneralSpecialDomesticClass($special);
$specialText = $specialClass->getName();
$db->update('general', [
'special'=>$special
], 'no=%i',$general['no']);
], 'no=%i',$generalID);
$logger = new ActionLogger($generalID, $general['nation'], $year, $month);
$josaUl = JosaUtil::pick($specialText, '을');
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>{$specialText}</></b>】{$josaUl} 습득");
pushGenLog($general, "<C>●</>특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!");
$logger->pushGeneralActionLog("특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!", ActionLogger::PLAIN);
$logger->pushGeneralHistoryLog("특기 【<b><C>{$specialText}</></b>】{$josaUl} 습득");
}
foreach($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5 from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general){
$generalID = $general['no'];
$special2 = SpecialityConst::pickSpecialWar($general);
$specialClass = buildGeneralSpecialWarClass($special2);
$specialText = $specialClass->getName();
@@ -1219,9 +1227,11 @@ function addAge() {
'special2'=>$special2
], 'no=%i',$general['no']);
$logger = new ActionLogger($generalID, $general['nation'], $year, $month);
$josaUl = JosaUtil::pick($specialText, '을');
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>{$specialText}</></b>】{$josaUl} 습득");
pushGenLog($general, "<C>●</>특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!");
$logger->pushGeneralActionLog("특기 【<b><L>{$specialText}</></b>】{$josaUl} 익혔습니다!", ActionLogger::PLAIN);
$logger->pushGeneralHistoryLog("특기 【<b><C>{$specialText}</></b>】{$josaUl} 습득");
}
}
}
+5 -5
View File
@@ -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, $traderLog);
pushGenLog($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, $traderLog);
pushGenLog($bidder, $bidderLog);
pushGenLog($trader['no'], $traderLog);
pushGenLog($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, $traderLog);
pushGenLog($bidder, $bidderLog);
pushGenLog($trader['no'], $traderLog);
pushGenLog($bidder['no'], $bidderLog);
pushAuctionLog($auctionLog);
}
}
+20 -20
View File
@@ -621,8 +621,8 @@ function checkMerge() {
$genlog = ["<C>●</><D><b>{$mynation['name']}</b></>{$josaWa} 통합에 성공했습니다."];
for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGeneralHistory($gen, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaWa} <D><b>{$you['makenation']}</b></>로 통합에 성공");
pushGenLog($gen['no'], $genlog);
pushGeneralHistory($gen['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaWa} <D><b>{$you['makenation']}</b></>로 통합에 성공"]);
}
//항복국 장수들 역사 기록 및 로그 전달
$query = "select no,name,nation from general where nation='{$me['nation']}'";
@@ -632,8 +632,8 @@ function checkMerge() {
$genlog[0] = "<C>●</><D><b>{$younation['name']}</b></>{$josaWa} 통합에 성공했습니다.";
for($i=0; $i < $gencount2; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGeneralHistory($gen, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>{$josaWa} <D><b>{$you['makenation']}</b></>로 통합에 성공");
pushGenLog($gen['no'], $genlog);
pushGeneralHistory($gen['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>{$josaWa} <D><b>{$you['makenation']}</b></>로 통합에 성공"]);
}
$josaRo = JosaUtil::pick($you['makenation'], '로');
@@ -641,7 +641,7 @@ function checkMerge() {
$josaWa = JosaUtil::pick($mynation['name'], '와');
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통합】</b></><D><b>{$mynation['name']}</b></>{$josaWa} <D><b>{$younation['name']}</b></>{$josaYi} <D><b>{$you['makenation']}</b></>{$josaRo} 통합하였습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>【혼란】</b></>통합에 반대하는 세력들로 인해 <D><b>{$you['makenation']}</b></>에 혼란이 일고 있습니다.";
pushNationHistory($younation, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>과 <D><b>{$you['makenation']}</b></>로 통합");
pushNationHistory($younation['nation'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>과 <D><b>{$you['makenation']}</b></>로 통합"]);
$newGenCount = $gencount + $gencount2;
$newTech = ($younation['tech']*$gencount + $mynation['tech']*$gencount2)/$newGenCount;
@@ -713,8 +713,8 @@ function checkMerge() {
], 'general_id IN %li AND turn_idx = 0');
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushGenLog($me['no'], $mylog);
pushGenLog($you['no'], $youlog);
pushWorldHistory($history, $admin['year'], $admin['month']);
$mylog = [];
@@ -775,8 +775,8 @@ function checkSurrender() {
$genlog = ["<C>●</><D><b>{$mynation['name']}</b></> 합병에 성공했습니다."];
for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGeneralHistory($gen, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></> 합병에 성공");
pushGenLog($gen['no'], $genlog);
pushGeneralHistory($gen['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></> 합병에 성공"]);
}
$josaRo = JosaUtil::pick($younation['name'], '로');
//항복국 장수들 역사 기록 및 로그 전달
@@ -786,15 +786,15 @@ function checkSurrender() {
$genlog[0] = "<C>●</><D><b>{$younation['name']}</b></>{$josaRo} 항복하여 수도로 이동합니다.";
for($i=0; $i < $gencount2; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGeneralHistory($gen, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>가 <D><b>{$younation['name']}</b></>{$josaRo} 항복");
pushGenLog($gen['no'], $genlog);
pushGeneralHistory($gen['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>가 <D><b>{$younation['name']}</b></>{$josaRo} 항복"]);
}
$josaYi = JosaUtil::pick($mynation['name'], '이');
$josaWa = JosaUtil::pick($mynation['name'], '와');
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【투항】</b></><D><b>{$mynation['name']}</b></>{$josaYi} <D><b>{$younation['name']}</b></>{$josaRo} 항복하였습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>【혼란】</b></>통합에 반대하는 세력들로 인해 <D><b>{$younation['name']}</b></>에 혼란이 일고 있습니다.";
pushNationHistory($younation, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaWa} 합병");
pushNationHistory($younation['nation'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaWa} 합병"]);
// 국가 백업
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $me['nation']);
@@ -872,8 +872,8 @@ function checkSurrender() {
], 'general_id IN %li AND turn_idx = 0');
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushGenLog($me['no'], $mylog);
pushGenLog($you['no'], $youlog);
pushWorldHistory($history, $admin['year'], $admin['month']);
refreshNationStaticInfo();
@@ -922,21 +922,21 @@ 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, "<C>●</>{$admin['year']}{$admin['month']}월:<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} 자칭"]);
break;
case 6:
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>".getNationLevel($nationlevel)."</>에 등극하였습니다.";
pushNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>".getNationLevel($nationlevel)."</>에 등극");
pushNationHistory($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, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>".getNationLevel($nationlevel)."</>에 임명됨");
pushNationHistory($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, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>".getNationLevel($nationlevel)."</>로 나서다");
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>".getNationLevel($nationlevel)."</>로 나서다"]);
break;
}
@@ -1254,7 +1254,7 @@ function checkEmperior() {
$josaYi = JosaUtil::pick($nation['name'], '이');
pushNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일");
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일"]);
$gameStor->isunited = 2;
$gameStor->conlimit = $gameStor->conlimit*100;
@@ -1318,7 +1318,7 @@ function checkEmperior() {
$general = MYDB_fetch_array($result);
$gen .= "{$general['name']}, ";
pushGenLog($general, $log);
pushGenLog($general['no'], $log);
}
$nation['type'] = getNationType($nation['type']);
+176 -59
View File
@@ -100,33 +100,6 @@ function getAuctionLogRecent(int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/_auctionlog.txt", $count, 300)));
}
function pushGenLog($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $log);
}
function getGenLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/gen{$no}.txt", $count, 300)));
}
function pushBatRes($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $log);
}
function getBatResRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batres{$no}.txt", $count, 300)));
}
function pushBatLog($general, $log) {
$no = Util::toInt($general['no']);
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $log);
}
function getBatLogRecent(int $no, int $count) {
return join('<br>', array_reverse(getFormattedFileLogRecent(__DIR__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300)));
}
function pushOldNationStop(int $no, int $nationNo){
$logPrefixList = ['batres', 'gen', 'batlog'];
@@ -156,45 +129,188 @@ function pushOldNationStop(int $no, int $nationNo){
}
//DB-based
function pushNationHistory($nation, ?string $history) {
if(!$history){
return;
}
if(!$nation || !$nation['nation']){
return;
}
$db = DB::db();
$db->update('nation', [
'history'=>$db->sqleval('concat(%s, history)', $history.'<br>')
], 'nation=%i', $nation['nation']);
}
function pushGeneralHistory($me, ?string $history) {
function pushGenLog(int $generalID, ?array $history, ?int $year=null, ?int $month=null) {
if(!$history){
return;
}
$db = DB::db();
$db->update('general', [
'history'=>$db->sqleval('concat(%s, history)', $history.'<br>')
], 'nation=%i', $me['no']);
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month, $generalID) {
return [
'general_id'=>$generalID,
'log_type'=>'action',
'year'=>$year,
'month'=>$month,
'text'=>$text
];
}, array_values($history));
$db->insert('general_record', $request);
}
function getGeneralHistoryAll(int $no) {
$history = DB::db()->queryFirstField('SELECT history FROM general WHERE `no`=%i',$no);
return ConvertLog($history);
function getGenLogRecent(int $generalID, int $count) {
$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);
}
function pushBatRes(int $generalID, array $history, ?int $year=null, ?int $month=null) {
if(!$history){
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month, $generalID) {
return [
'general_id'=>$generalID,
'log_type'=>'battle_brief',
'year'=>$year,
'month'=>$month,
'text'=>$text
];
}, array_values($history));
$db->insert('general_record', $request);
}
function getBatResRecent(int $generalID, int $count) {
$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);
}
function pushBatLog(int $generalID, array $history, ?int $year=null, ?int $month=null) {
if(!$history){
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month, $generalID) {
return [
'general_id'=>$generalID,
'log_type'=>'battle',
'year'=>$year,
'month'=>$month,
'text'=>$text
];
}, array_values($history));
$db->insert('general_record', $request);
}
function getBatLogRecent(int $generalID, int $count) {
$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);
}
function pushGeneralHistory(int $generalID, ?array $history, $year=null, $month=null) {
if(!$history){
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month, $generalID) {
return [
'general_id'=>$generalID,
'log_type'=>'history',
'year'=>$year,
'month'=>$month,
'text'=>$text
];
}, array_values($history));
$db->insert('general_record', $request);
}
function getGeneralHistoryAll(int $generalID) {
$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);
}
function pushNationHistory(int $nationID, ?array $history, ?int $year=null, ?int $month=null) {
if(!$history){
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month, $nationID) {
return ['nation_id'=>$nationID, 'year'=>$year, 'month'=>$month, 'text'=>$text];
}, array_values($history));
$db->insert('world_history', $request);
}
function pushWorldHistory(?array $history, $year=null, $month=null) {
if(!$history){
return;
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month) {
return ['year'=>$year, 'month'=>$month, 'text'=>$text];
return ['nation_id'=>0, 'year'=>$year, 'month'=>$month, 'text'=>$text];
}, array_values($history));
$db->insert('world_history', $request);
}
@@ -203,19 +319,19 @@ function getWorldHistoryRecent(int $count) {
$db = DB::db();
$texts = [];
foreach($db->queryFirstColumn('SELECT `text` from world_history order by id desc limit %i', $count) as $text){
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);
}
function getWorldHistoryWithDate($year, $month) {
function getWorldHistoryWithDate(int $year, int $month) {
$db = DB::db();
$texts = [];
foreach(
$db->queryFirstColumn(
'SELECT `text` from world_history where year = %i and month = %i order by id desc',
'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc',
$year,
$month
) as $text
@@ -231,28 +347,29 @@ function getWorldHistoryWithDate($year, $month) {
}
function pushGeneralPublicRecord(?array $history, $year=null, $month=null) {
function pushGeneralPublicRecord(?array $history, ?int $year=null, ?int $month=null) {
if(!$history){
return;
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
}
$request = array_map(function($text) use ($year, $month) {
return ['year'=>$year, 'month'=>$month, 'text'=>$text];
return ['general_id'=>0, 'log_type'=>'history', 'year'=>$year, 'month'=>$month, 'text'=>$text];
}, array_values($history));
$db->insert('general_public_record', $request);
$db->insert('general_record', $request);
}
function getGeneralPublicRecordRecent($count) {
function getGeneralPublicRecordRecent(int $count) {
$db = DB::db();
$texts = [];
foreach(
$db->queryFirstColumn(
'SELECT `text` from general_public_record order by id desc limit %i',
'SELECT `text` from general_record WHERE general_id = 0 AND log_type = "history" order by id desc limit %i',
$count
) as $text
){
@@ -261,13 +378,13 @@ function getGeneralPublicRecordRecent($count) {
return join('<br>', $texts);
}
function getGeneralPublicRecordWithDate($year, $month) {
function getGeneralPublicRecordWithDate(int $year, int $month) {
$db = DB::db();
$texts = [];
foreach(
$db->queryFirstColumn(
'SELECT `text` from general_public_record where year = %i and month = %i order by id desc',
'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
+4 -4
View File
@@ -353,8 +353,8 @@ function process_65(&$general) {
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령하였습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<R><b>【초토화】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>{$josaUl} <R>초토화</>하였습니다.";
pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령");
pushNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령");
pushGeneralHistory($general['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령"]);
pushNationHistory($nation['nation'], ["<C>●</>{$admin['year']}{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>의 <R>초토화</>를 명령"]);
//외교제한 24
$amount = Util::round($destcity['pop'] * 0.1);
@@ -475,8 +475,8 @@ function process_77(&$general) {
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동하였습니다.";
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동하였습니다.";
$sabotagelog[] = "<C>●</>{$admin['year']}{$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동하였습니다.";
pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동");
pushNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동");
pushGeneralHistory($general['no'], ["<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동"]);
pushNationHistory($nation['nation'], "<C>●</>{$admin['year']}{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>이호경식</>을 발동");
pushNationHistory($destnation, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>{$josaYi} 아국에 <M>이호경식</>을 발동");
//선포+3개월
+5 -3
View File
@@ -91,9 +91,11 @@ if(!$db->affectedRows()){
$db->delete('select_npc_token', 'owner=%i or valid_until < %s', $userID, $now);
$josaYi = JosaUtil::pick($userNick, '이');
pushGeneralHistory($pickedNPC, "<C>●</>{$year}{$month}월:<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>{$josaYi} 빙의되다.");
//pushGenLog($me, $mylog);
pushGeneralPublicRecord(["<C>●</>{$month}월:<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>{$josaYi} <S>빙의</>됩니다!"], $year, $month);
$logger = new ActionLogger($pickedNPC['no'], $pickedNPC['nation'], $year, $month);
$logger->pushGeneralHistoryLog("<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>{$josaYi} 빙의되다.");
$logger->pushGlobalActionLog("<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>{$josaYi} <S>빙의</>됩니다!");
$logger->flush();
pushAdminLog(["가입 : {$userID} // {$session->userName} // {$pick} // ".getenv("REMOTE_ADDR")]);
+24 -19
View File
@@ -282,28 +282,33 @@ $me = [
$log = [];
$mylog = [];
$josaRa = JosaUtil::pick($name, '라');
if ($genius) {
$log[0] = "<C>●</>{$gameStor->month}월:<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 기재가 천하에 이름을 알립니다.";
$log[1] = "<C>●</>{$gameStor->month}월:<C>".getGeneralSpecialWarName($special2)."</> 특기를 가진 <C>천재</>의 등장으로 온 천하가 떠들썩합니다.";
$logger = new ActionLogger($generalID, 0, $gameStor->year, $gameStor->month);
pushWorldHistory(["<C>●</>{$gameStor->year}{$gameStor->month}월:<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다."], $gameStor->year, $gameStor->month);
} else {
$log[0] = "<C>●</>{$gameStor->month}월:<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 호걸이 천하에 이름을 알립니다.";
}
pushGeneralHistory($me, "<C>●</>{$gameStor->year}{$gameStor->month}월:<Y>{$name}</>, <G>{$cityname}</>에서 큰 뜻을 품다.");
$mylog[] = "<C>●</>삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^";
$mylog[] = "<C>●</>처음 하시는 경우에는 <D>도움말</>을 참고하시고,";
$mylog[] = "<C>●</>문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~";
$mylog[] = "<C>●</>부디 즐거운 삼모전 되시길 바랍니다 ^^";
$mylog[] = "<C>●</>통솔 <C>$pleadership</> 무력 <C>$pstrength</> 지력 <C>$pintel</> 의 보너스를 받으셨습니다.";
$mylog[] = "<C>●</>연령은 <C>$age</>세로 시작합니다.";
$josaRa = JosaUtil::pick($name, '라');
$speicalText = getGeneralSpecialWarName($special2);
if ($genius) {
$mylog[] = "<C>●</>축하합니다! 천재로 태어나 처음부터 <C>".getGeneralSpecialWarName($special2)."</> 특기를 가지게 됩니다!";
pushGeneralHistory($me, "<C>●</>{$gameStor->year}{$gameStor->month}월:<C>".getGeneralSpecialWarName($special2)."</> 특기를 가진 천재로 탄생.");
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 기재가 천하에 이름을 알립니다.");
$logger->pushGlobalActionLog("<C>{$speicalText}</> 특기를 가진 <C>천재</>의 등장으로 온 천하가 떠들썩합니다.");
$logger->pushGlobalHistoryLog("<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다.");
} else {
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 호걸이 천하에 이름을 알립니다.");
}
pushGenLog($me, $mylog);
pushGeneralPublicRecord($log, $gameStor->year, $gameStor->month);
$logger->pushGeneralHistoryLog("<Y>{$name}</>, <G>{$cityname}</>에서 큰 뜻을 품다.");
$logger->pushGeneralActionLog("삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("처음 하시는 경우에는 <D>도움말</>을 참고하시고,", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("부디 즐거운 삼모전 되시길 바랍니다 ^^", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("통솔 <C>$pleadership</> 무력 <C>$pstrength</> 지력 <C>$pintel</> 의 보너스를 받으셨습니다.", ActionLogger::PLAIN);
$logger->pushGeneralActionLog("연령은 <C>$age</>세로 시작합니다.", ActionLogger::PLAIN);
if ($genius) {
$logger->pushGeneralActionLog("축하합니다! 천재로 태어나 처음부터 <C>{$speicalText}</> 특기를 가지게 됩니다!", ActionLogger::PLAIN);
$logger->pushGeneralHistoryLog("<C>{$speicalText}</> 특기를 가진 천재로 탄생.");
}
$logger->flush();
pushAdminLog(["가입 : {$userID} // {$name} // {$generalID}".getenv("REMOTE_ADDR")]);
+11 -11
View File
@@ -501,9 +501,9 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>{$josaYiGen} <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
$log[] = "<C>●</><G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
$history[] = "<C>●</>{$year}{$month}월:<S><b>【지배】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$city['name']}</b></>{$josaUl} 지배했습니다.";
pushGeneralHistory($general, "<C>●</>{$year}{$month}월:<G><b>{$city['name']}</b></>{$josaUl} <S>함락</>시킴");
pushNationHistory($nation, "<C>●</>{$year}{$month}월:<Y>{$general['name']}</>{$josaYiGen} {$destnationName} <G><b>{$city['name']}</b></>{$josaUl} <S>점령</>");
pushNationHistory($destnation, "<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>{$josaYiCity} <span class='ev_highlight'>함락</span>");
pushGeneralHistory($general['no'], ["<C>●</>{$year}{$month}월:<G><b>{$city['name']}</b></>{$josaUl} <S>함락</>시킴"]);
pushNationHistory($nation['nation'], ["<C>●</>{$year}{$month}월:<Y>{$general['name']}</>{$josaYiGen} {$destnationName} <G><b>{$city['name']}</b></>{$josaUl} <S>점령</>"]);
pushNationHistory($destnation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>{$josaYiCity} <span class='ev_highlight'>함락</span>"]);
$citycount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation = %i', $city['nation']);
$renewFront = false;
@@ -516,7 +516,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$josaYi = JosaUtil::pick($losenation['name'], '이');
$josaUl = JosaUtil::pick($losenation['name'], '을');
$history[] = "<C>●</>{$year}{$month}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>{$josaYi} 멸망하였습니다.";
pushNationHistory($nation, "<C>●</>{$year}{$month}월:<D><b>{$losenation['name']}</b></>{$josaUl} 정복");
pushNationHistory($nation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$losenation['name']}</b></>{$josaUl} 정복"]);
$loseGeneralGold = 0;
$loseGeneralRice = 0;
@@ -543,9 +543,9 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$query = "update general set gold=gold-{$loseGold},rice=rice-{$loseRice} where no={$gen['no']}";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
pushGenLog($gen, $genlog);
pushGenLog($gen['no'], $genlog);
pushGeneralHistory($gen, "<C>●</>{$year}{$month}월:<D><b>{$losenation['name']}</b></>{$josaYi} <R>멸망</>");
pushGeneralHistory($gen['no'], ["<C>●</>{$year}{$month}월:<D><b>{$losenation['name']}</b></>{$josaYi} <R>멸망</>"]);
pushOldNationStop($gen['no'], $city['nation']);
$loseGeneralGold += $loseGold;
@@ -589,7 +589,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$genlog[0] = "<C>●</><D><b>{$losenation['name']}</b></> 정복으로 금<C>{$losenation['gold']}</> 쌀<C>{$losenation['rice']}</>을 획득했습니다.";
for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGenLog($gen['no'], $genlog);
}
@@ -646,7 +646,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$genlog = ["<C>●</>수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다."];
for($i=0; $i < $gencount; $i++) {
$gen = MYDB_fetch_array($result);
pushGenLog($gen, $genlog);
pushGenLog($gen['no'], $genlog);
}
//천도
$query = "update nation set capital='$minCity',gold=gold*0.5,rice=rice*0.5 where nation='{$destnation['nation']}'";
@@ -679,8 +679,8 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
$josaUl = JosaUtil::pick($city['name'], '을');
$josaYi = JosaUtil::pick($conquerNationName, '이');
$history[] = "<C>●</>{$year}{$month}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationName}</b></>{$josaYi} 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>{$josaUl} 양도받았습니다.";
pushNationHistory($nation, "<C>●</>{$year}{$month}월:<G><b>{$city['name']}</b></>{$josaUl} <D><b>{$conquerNationName}</b></>에 <Y>양도</>");
pushNationHistory(['nation'=>$conquerNation], "<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>{$josaUl} <S>양도</> 받음");
pushNationHistory($nation['nation'], ["<C>●</>{$year}{$month}월:<G><b>{$city['name']}</b></>{$josaUl} <D><b>{$conquerNationName}</b></>에 <Y>양도</>"]);
pushNationHistory($conquerNation, ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>{$josaUl} <S>양도</> 받음"]);
}
$query = [
@@ -714,7 +714,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
SetNationFront($nationNationID);
}
pushGenLog($general, $log);
pushGenLog($general['no'], $log);
pushGeneralPublicRecord($alllog, $year, $month);
pushWorldHistory($history);
}
+19 -19
View File
@@ -4,8 +4,8 @@ namespace sammo;
class ActionLogger{
//TODO: global을 따로 뗴어내고, 장수 Logger를 상속해서 받는 형식으로.
protected $generalId;
protected $nationId;
protected $generalID;
protected $nationID;
protected $autoFlush;
protected $year = null;
@@ -20,18 +20,26 @@ class ActionLogger{
protected $globalActionLog = [];
const RAWTEXT = 0;
/** <C>●</> */
const PLAIN = 1;
/** <C>●</>{$year}년 {$month}월: */
const YEAR_MONTH = 2;
/** <C>●</>{$year}년: */
const YEAR = 3;
/** <C>●</>{$month}월: */
const MONTH = 4;
/** <S>◆</> */
const EVENT_PLAIN = 5;
/** <S>◆</>{$year}년 {$month}월: */
const EVENT_YEAR_MONTH = 6;
/** <R>★</> */
const NOTICE = 7;
/** <R>★</>{$year}년 {$month}월: */
const NOTICE_YEAR_MONTH = 8;
public function __construct(int $generalId, int $nationId, int $year, int $month, bool $autoFlush = true){
$this->generalId = $generalId;
$this->nationId = $nationId;
public function __construct(int $generalID, int $nationID, int $year, int $month, bool $autoFlush = true){
$this->generalID = $generalID;
$this->nationID = $nationID;
$this->year = $year;
$this->month = $month;
$this->autoFlush = $autoFlush;
@@ -66,36 +74,28 @@ class ActionLogger{
}
public function flush(){
$db = DB::db();
if($this->generalHistoryLog){
$rawText = join('<br>', $this->generalHistoryLog).'<br>';
$db->update('general', [
'history'=>$db->sqleval('concat(%s, history)', $rawText)
], 'no=%i', $this->generalId);
pushGeneralHistory($this->generalID, $this->generalHistoryLog, $this->year, $this->month);
$this->generalHistoryLog = [];
}
if($this->generalActionLog){
pushGenLog(['no'=>$this->generalId], $this->generalActionLog);
pushGenLog($this->generalID, $this->generalActionLog, $this->year, $this->month);
$this->generalActionLog = [];
}
if($this->generalBattleResultLog){
pushBatRes(['no'=>$this->generalId], $this->generalBattleResultLog);
pushBatRes($this->generalID, $this->generalBattleResultLog, $this->year, $this->month);
$this->generalBattleResultLog = [];
}
if($this->generalBattleDetailLog){
pushBatLog(['no'=>$this->generalId], $this->generalBattleDetailLog);
pushBatLog($this->generalID, $this->generalBattleDetailLog, $this->year, $this->month);
$this->generalBattleDetailLog = [];
}
if($this->nationId && $this->nationalHistoryLog){
$rawText = join('<br>', $this->nationalHistoryLog).'<br>';
$db->update('nation', [
'history'=>$db->sqleval('concat(%s, history)', $rawText)
], 'nation=%i', $this->nationId);
if($this->nationID && $this->nationalHistoryLog){
pushNationHistory($this->nationID, $this->nationalHistoryLog, $this->year, $this->month);
$this->nationalHistoryLog = [];
}
+25 -25
View File
@@ -119,13 +119,13 @@ class DiplomaticMessage extends Message{
$mylog[] = "<C>●</><D><b>{$this->src->nationName}</b></>{$josaWa} 파기에 합의했습니다.";
$josaWa = JosaUtil::pick($this->dest->nationName, '와');
pushGeneralHistory(['no'=>$this->src->generalID], "<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 파기 성공");
pushGeneralHistory($this->src->generalID, ["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 파기 성공"]);
$josaWa = JosaUtil::pick($this->src->nationName, '와');
pushGeneralHistory(['no'=>$this->dest->generalID], "<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 파기 수락");
pushGeneralHistory($this->dest->generalID, ["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 파기 수락"]);
pushGenLog(['no'=>$this->dest->generalID], $mylog);
pushGenLog(['no'=>$this->src->generalID], $youlog);
pushGenLog($this->dest->generalID, $mylog);
pushGenLog($this->src->generalID, $youlog);
pushGeneralPublicRecord($alllog, $helper->year, $helper->month);
pushWorldHistory($history, $helper->year, $helper->month);
@@ -154,13 +154,13 @@ class DiplomaticMessage extends Message{
$mylog[] = "<C>●</><D><b>{$this->src->nationName}</b></>{$josaWa} 종전에 합의했습니다.";
$josaWa = JosaUtil::pick($this->dest->nationName, '와');
pushGeneralHistory(['no'=>$this->src->generalID], "<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 종전 성공");
pushGeneralHistory($this->src->generalID, ["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 종전 성공"]);
$josaWa = JosaUtil::pick($this->src->nationName, '와');
pushGeneralHistory(['no'=>$this->dest->generalID], "<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 종전 수락");
pushGeneralHistory($this->dest->generalID, ["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 종전 수락"]);
pushGenLog(['no'=>$this->dest->generalID], $mylog);
pushGenLog(['no'=>$this->src->generalID], $youlog);
pushGenLog($this->dest->generalID, $mylog);
pushGenLog($this->src->generalID, $youlog);
pushGeneralPublicRecord($alllog, $helper->year, $helper->month);
pushWorldHistory($history, $helper->year, $helper->month);
@@ -176,11 +176,11 @@ class DiplomaticMessage extends Message{
$josaWa = JosaUtil::pick($this->src->nationName, '와');
pushGeneralHistory(
['no'=>$this->dest->generalID],
"<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 통합 시도"
$this->dest->generalID,
["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaWa} 통합 시도"]
);
pushGenLog(
['no'=>$this->dest->generalID],
$this->dest->generalID,
["<C>●</><D><b>{$this->src->nationName}</b></>{$josaWa} 통합에 동의했습니다."]
);
@@ -195,12 +195,12 @@ class DiplomaticMessage extends Message{
$josaWa = JosaUtil::pick($this->dest->nationName, '와');
pushGeneralHistory(
['no'=>$this->src->generalID],
"<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 통합 시도"
$this->src->generalID,
["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>{$josaWa} 통합 시도"]
);
$josaYi = JosaUtil::pick($this->dest->nationName, '이');
pushGenLog(
['no'=>$this->src->generalID],
$this->src->generalID,
["<C>●</><D><b>{$this->dest->nationName}</b></>{$josaYi} 통합에 동의했습니다."]
);
pushWorldHistory(
@@ -221,20 +221,20 @@ class DiplomaticMessage extends Message{
$josaRo = JosaUtil::pick($this->src->nationName, '로');
pushGeneralHistory(
['no'=>$this->src->generalID],
"<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>에게 투항 제의"
$this->src->generalID,
["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->dest->nationName}</b></>에게 투항 제의"]
);
pushGeneralHistory(
['no'=>$this->dest->generalID],
"<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaRo} 투항 동의"
$this->dest->generalID,
["<C>●</>{$helper->year}{$helper->month}월:<D><b>{$this->src->nationName}</b></>{$josaRo} 투항 동의"]
);
pushGenLog(
['no'=>$this->dest->generalID],
$this->dest->generalID,
["<C>●</><D><b>{$this->src->nationName}</b></>{$josaRo} 투항에 동의했습니다."]
);
$josaYi = JosaUtil::pick($this->dest->nationName, '이');
pushGenLog(
['no'=>$this->src->generalID],
$this->src->generalID,
["<C>●</><D><b>{$this->dest->nationName}</b></>{$josaYi} 투항에 동의했습니다."]
);
$josaYi = JosaUtil::pick($this->dest->generalName, '이');
@@ -281,7 +281,7 @@ class DiplomaticMessage extends Message{
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
if($result !== self::ACCEPTED){
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
pushGenLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
if($result === self::DECLINED){
$this->_declineMessage();
}
@@ -309,7 +309,7 @@ class DiplomaticMessage extends Message{
}
if($result !== self::ACCEPTED){
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
pushGenLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
if($result === self::DECLINED){
$this->_declineMessage();
}
@@ -380,13 +380,13 @@ class DiplomaticMessage extends Message{
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
if($result === self::INVALID){
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
pushGenLog($receiverID, ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
return $result;
}
$josaYi = JosaUtil::pick($this->dest->nationName, '이');
pushGenLog(['no'=>$receiverID], "<C>●</><D>{$this->src->nationName}</>의 {$this->diplomacyName} 제안을 거절했습니다.");
pushGenLog(['no'=>$this->src->generalID], "<C>●</><Y>{$this->dest->nationName}</>{$josaYi} {$this->diplomacyName} 제안을 거절했습니다.");
pushGenLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>의 {$this->diplomacyName} 제안을 거절했습니다."]);
pushGenLog($this->src->generalID, ["<C>●</><Y>{$this->dest->nationName}</>{$josaYi} {$this->diplomacyName} 제안을 거절했습니다."]);
$this->_declineMessage();
return self::DECLINED;
}
+3 -3
View File
@@ -143,14 +143,14 @@ class ScoutMessage extends Message{
list($result, $reason) = $this->checkScoutMessageValidation($receiverID);
if($result === self::INVALID){
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} 등용 취소 불가."]);
pushGenLog($receiverID, ["<C>●</>{$reason} 등용 취소 불가."]);
return $result;
}
$josaRo = JosaUtil::pick($this->src->nationName, '로');
$josaYi = JosaUtil::pick($this->dest->generalName, '이');
pushGenLog(['no'=>$receiverID], "<C>●</><D>{$this->src->nationName}</>{$josaRo} 망명을 거부했습니다.");
pushGenLog(['no'=>$this->src->generalID], "<C>●</><Y>{$this->dest->generalName}</>{$josaYi} 등용을 거부했습니다.");
pushGenLog($receiverID, ["<C>●</><D>{$this->src->nationName}</>{$josaRo} 망명을 거부했습니다."]);
pushGenLog($this->src->generalID, ["<C>●</><Y>{$this->dest->generalName}</>{$josaYi} 등용을 거부했습니다."]);
$this->_declineMessage();
return self::DECLINED;
+1 -1
View File
@@ -44,7 +44,7 @@ DROP TABLE IF EXISTS event;
DROP TABLE IF EXISTS world_history;
# ( ?)
DROP TABLE IF EXISTS general_public_record;
DROP TABLE IF EXISTS general_record;
DROP TABLE IF EXISTS select_npc_token;
+8 -3
View File
@@ -531,24 +531,29 @@ ENGINE=Aria;
##
CREATE TABLE `world_history` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`nation_id` INT(11) NOT NULL,
`year` INT(4) NOT NULL,
`month` INT(2) NOT NULL,
`text` TEXT NOT NULL,
PRIMARY KEY (`id`),
INDEX `date` (`year`, `month`, `id`)
INDEX `date` (`nation_id`, `year`, `month`, `id`),
INDEX `plain` (`nation_id`, `id`)
)
DEFAULT CHARSET=utf8mb4
ENGINE=Aria
;
##
CREATE TABLE `general_public_record` (
CREATE TABLE `general_record` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`general_id` INT(11) NOT NULL,
`log_type` ENUM('action','battle_brief','battle', 'history') NOT NULL,
`year` INT(4) NOT NULL,
`month` INT(2) NOT NULL,
`text` TEXT NOT NULL,
PRIMARY KEY (`id`),
INDEX `date` (`year`, `month`, `id`)
INDEX `date` (`general_id`, `log_type`, `year`, `month`, `id`),
INDEX `plain` (`general_id`, `log_type`, `id`)
)
DEFAULT CHARSET=utf8mb4
ENGINE=Aria