장수 생성 시 본닉 항상 추가. 사망시 본닉 출력
This commit is contained in:
@@ -73,7 +73,7 @@ foreach($rawGeneralList as $rawGeneral){
|
||||
getGeneralSpecialWarName($special2),
|
||||
getGenChar($personal),
|
||||
$name,
|
||||
$name2,
|
||||
$npc==1?$name2:null,
|
||||
$injury,
|
||||
$leader,
|
||||
$lbonus,
|
||||
|
||||
@@ -223,6 +223,7 @@ $affinity = rand()%150 + 1;
|
||||
$db->insert('general', [
|
||||
'owner' => $userID,
|
||||
'name' => $name,
|
||||
'name2' => $member['name'],
|
||||
'picture' => $face,
|
||||
'imgsvr' => $imgsvr,
|
||||
'nation' => 0,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -7,6 +7,7 @@ use \sammo\JosaUtil;
|
||||
|
||||
class DyingMessage{
|
||||
private $name;
|
||||
private $realName;
|
||||
private $npc;
|
||||
|
||||
static protected $defaultMessage = '<Y>:name:</>:이: <R>사망</>했습니다.';
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user