ActionLogger 보강
This commit is contained in:
+77
-10
@@ -6,6 +6,9 @@ class ActionLogger{
|
||||
protected $generalId;
|
||||
protected $nationId;
|
||||
protected $autoFlush;
|
||||
|
||||
protected $year = null;
|
||||
protected $month = null;
|
||||
|
||||
protected $generalHistoryLog = [];
|
||||
protected $generalActionLog = [];
|
||||
@@ -15,9 +18,21 @@ class ActionLogger{
|
||||
protected $globalHistoryLog = [];
|
||||
protected $globalActionLog = [];
|
||||
|
||||
public function __construct(int $generalId, int $nationId, bool $autoFlush = true){
|
||||
const RAWTEXT = 0;
|
||||
const PLAIN = 1;
|
||||
const YEAR_MONTH = 2;
|
||||
const YEAR = 3;
|
||||
const MONTH = 4;
|
||||
const EVENT_PLAIN = 5;
|
||||
const EVENT_YEAR_MONTH = 6;
|
||||
const NOTICE = 7;
|
||||
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;
|
||||
$this->year = $year;
|
||||
$this->month = $month;
|
||||
$this->autoFlush = $autoFlush;
|
||||
}
|
||||
|
||||
@@ -62,18 +77,18 @@ class ActionLogger{
|
||||
}
|
||||
|
||||
if($this->globalHistoryLog){
|
||||
pushWorldHistory($this->globalHistoryLog);
|
||||
pushWorldHistory($this->globalHistoryLog, $this->year, $this->month);
|
||||
$this->globalHistoryLog = [];
|
||||
}
|
||||
|
||||
if($this->globalActionLog){
|
||||
pushGeneralPublicRecord($this->globalActionLog);
|
||||
pushGeneralPublicRecord($this->globalActionLog, $this->year, $this->month);
|
||||
$this->globalActionLog = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function pushGeneralHistoryLog($text){
|
||||
public function pushGeneralHistoryLog($text, int $formatType = self::YEAR_MONTH){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -83,10 +98,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->generalHistoryLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushGeneralActionLog($text){
|
||||
public function pushGeneralActionLog($text, int $formatType = self::MONTH){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -96,10 +113,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->generalActionLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushGeneralBattleResultLog($text){
|
||||
public function pushGeneralBattleResultLog($text, int $formatType = self::RAWTEXT){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -109,10 +128,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->generalBattleResultLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushGeneralBattleDetailLog($text){
|
||||
public function pushGeneralBattleDetailLog($text, int $formatType = self::RAWTEXT){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -122,10 +143,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->generalBattleDetailLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushNationalHistoryLog($text){
|
||||
public function pushNationalHistoryLog($text, int $formatType = self::RAWTEXT){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -135,10 +158,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->nationalHistoryLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushGlobalActionLog($text){
|
||||
public function pushGlobalActionLog($text, int $formatType = self::MONTH){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -148,10 +173,12 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->globalActionLog[] = $text;
|
||||
}
|
||||
|
||||
public function pushGlobalHistoryLog($text){
|
||||
public function pushGlobalHistoryLog($text, int $formatType = self::YEAR_MONTH){
|
||||
if(!$text){
|
||||
return;
|
||||
}
|
||||
@@ -161,9 +188,49 @@ class ActionLogger{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$text = $this->formatText($formatType);
|
||||
$this->globalHistoryLog[] = $text;
|
||||
}
|
||||
|
||||
public function formatText(string $text, int $formatType):string{
|
||||
if($formatType === self::RAWTEXT){
|
||||
return $text;
|
||||
}
|
||||
|
||||
if($formatType === self::PLAIN){
|
||||
return "<C>●</>{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::YEAR_MONTH){
|
||||
return "<C>●</>{$this->year}년 {$this->month}월:{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::YEAR){
|
||||
return "<C>●</>{$this->year}년:{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::MONTH){
|
||||
return "<C>●</>{$this->month}월:{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::EVENT_PLAIN){
|
||||
return "<S>◆</>{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::EVENT_YEAR_MONTH){
|
||||
return "<S>◆</>{$this->year}년 {$this->month}월:{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::NOTICE){
|
||||
return "<R>★</>{$text}";
|
||||
}
|
||||
|
||||
if($formatType === self::NOTICE_YEAR_MONTH){
|
||||
return "<R>★</>{$this->year}년 {$this->month}월:{$text}";
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user