diff --git a/hwe/j_get_general_list.php b/hwe/j_get_general_list.php index aba61d2e..898035ff 100644 --- a/hwe/j_get_general_list.php +++ b/hwe/j_get_general_list.php @@ -73,7 +73,7 @@ foreach($rawGeneralList as $rawGeneral){ getGeneralSpecialWarName($special2), getGenChar($personal), $name, - $name2, + $npc==1?$name2:null, $injury, $leader, $lbonus, diff --git a/hwe/join_post.php b/hwe/join_post.php index 344ddac6..10698ab8 100644 --- a/hwe/join_post.php +++ b/hwe/join_post.php @@ -223,6 +223,7 @@ $affinity = rand()%150 + 1; $db->insert('general', [ 'owner' => $userID, 'name' => $name, + 'name2' => $member['name'], 'picture' => $face, 'imgsvr' => $imgsvr, 'nation' => 0, diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index e306d0ac..970dff9f 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -277,7 +277,7 @@ class General implements iAction{ $db->delete('troop', 'troop_leader=%i', $troopLeaderID); } - $dyingMessage = new TextDecoration\DyingMessage($this->getName(), $this->getVar('npc')); + $dyingMessage = new TextDecoration\DyingMessage($this); $logger->pushGlobalActionLog($dyingMessage->getText()); $db->delete('general', 'no=%i', $generalID); @@ -563,7 +563,7 @@ class General implements iAction{ 'no', 'name', 'name2', 'picture', 'imgsvr', 'nation', 'nations', 'city', 'troop', 'injury', 'affinity', 'leader', 'leader2', 'power', 'power2', 'intel', 'intel2', 'weap', 'book', 'horse', 'item', 'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime', - 'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'belong', + 'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong', 'personal', 'special', 'special2', 'mode', 'npc', 'npc_org', 'deadyear', 'npcmsg', 'dex0', 'dex10', 'dex20', 'dex30', 'dex40', 'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew', 'recwar', 'last_turn', 'myset' diff --git a/hwe/sammo/TextDecoration/DyingMessage.php b/hwe/sammo/TextDecoration/DyingMessage.php index 0163ac69..84f778bc 100644 --- a/hwe/sammo/TextDecoration/DyingMessage.php +++ b/hwe/sammo/TextDecoration/DyingMessage.php @@ -7,6 +7,7 @@ use \sammo\JosaUtil; class DyingMessage{ private $name; + private $realName; private $npc; static protected $defaultMessage = ':name::이: 사망했습니다.'; @@ -88,31 +89,21 @@ class DyingMessage{ static::$utilNPCMessages = static::getUtilNPCMessageList(); } - protected function _constructWithObj(General $general){ - $this->name = $general->getName(); - $this->npc = $general->getVar('npc'); - } - - protected function _constructWithRawValue(string $name, int $npc){ - $this->name = $name; - $this->npc = $npc; - } - - function __construct($name, ?int $npc = null) + function __construct(General $general) { if(static::$messages === null){ static::initMessageList(); } - if($name instanceof General){ - $this->_constructWithObj($name); - } - else{ - $this->_constructWithRawValue($name, $npc); + $this->general = $general; + $this->name = $general->getName(); + $this->npc = $general->getVar('npc'); + if($general['owner'] > 0 && $general->getVar('startage') - $general->getVar('age') > 1){ + $this->realName = $general->getVar('name2'); } } public function getText():string{ - $name = $this->name ; + $name = $this->name; $npc = $this->npc; if($npc == 0){ @@ -128,7 +119,12 @@ class DyingMessage{ $text = static::$defaultMessage; } - $text = str_replace(':name:', $name, $text); + if($this->realName){ + $text = str_replace(':name:', $name."({$this->realName})", $text); + } + else{ + $text = str_replace(':name:', $name, $text); + } JosaUtil::batch($text, $name); return $text;