장수 생성 시 본닉 항상 추가. 사망시 본닉 출력
This commit is contained in:
@@ -73,7 +73,7 @@ foreach($rawGeneralList as $rawGeneral){
|
|||||||
getGeneralSpecialWarName($special2),
|
getGeneralSpecialWarName($special2),
|
||||||
getGenChar($personal),
|
getGenChar($personal),
|
||||||
$name,
|
$name,
|
||||||
$name2,
|
$npc==1?$name2:null,
|
||||||
$injury,
|
$injury,
|
||||||
$leader,
|
$leader,
|
||||||
$lbonus,
|
$lbonus,
|
||||||
|
|||||||
@@ -223,6 +223,7 @@ $affinity = rand()%150 + 1;
|
|||||||
$db->insert('general', [
|
$db->insert('general', [
|
||||||
'owner' => $userID,
|
'owner' => $userID,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
|
'name2' => $member['name'],
|
||||||
'picture' => $face,
|
'picture' => $face,
|
||||||
'imgsvr' => $imgsvr,
|
'imgsvr' => $imgsvr,
|
||||||
'nation' => 0,
|
'nation' => 0,
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class General implements iAction{
|
|||||||
$db->delete('troop', 'troop_leader=%i', $troopLeaderID);
|
$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());
|
$logger->pushGlobalActionLog($dyingMessage->getText());
|
||||||
|
|
||||||
$db->delete('general', 'no=%i', $generalID);
|
$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',
|
'no', 'name', 'name2', 'picture', 'imgsvr', 'nation', 'nations', 'city', 'troop', 'injury', 'affinity',
|
||||||
'leader', 'leader2', 'power', 'power2', 'intel', 'intel2', 'weap', 'book', 'horse', 'item',
|
'leader', 'leader2', 'power', 'power2', 'intel', 'intel2', 'weap', 'book', 'horse', 'item',
|
||||||
'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
'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',
|
'personal', 'special', 'special2', 'mode', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
||||||
'dex0', 'dex10', 'dex20', 'dex30', 'dex40',
|
'dex0', 'dex10', 'dex20', 'dex30', 'dex40',
|
||||||
'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew', 'recwar', 'last_turn', 'myset'
|
'warnum', 'killnum', 'deathnum', 'killcrew', 'deathcrew', 'recwar', 'last_turn', 'myset'
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use \sammo\JosaUtil;
|
|||||||
|
|
||||||
class DyingMessage{
|
class DyingMessage{
|
||||||
private $name;
|
private $name;
|
||||||
|
private $realName;
|
||||||
private $npc;
|
private $npc;
|
||||||
|
|
||||||
static protected $defaultMessage = '<Y>:name:</>:이: <R>사망</>했습니다.';
|
static protected $defaultMessage = '<Y>:name:</>:이: <R>사망</>했습니다.';
|
||||||
@@ -88,31 +89,21 @@ class DyingMessage{
|
|||||||
static::$utilNPCMessages = static::getUtilNPCMessageList();
|
static::$utilNPCMessages = static::getUtilNPCMessageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _constructWithObj(General $general){
|
function __construct(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)
|
|
||||||
{
|
{
|
||||||
if(static::$messages === null){
|
if(static::$messages === null){
|
||||||
static::initMessageList();
|
static::initMessageList();
|
||||||
}
|
}
|
||||||
if($name instanceof General){
|
$this->general = $general;
|
||||||
$this->_constructWithObj($name);
|
$this->name = $general->getName();
|
||||||
}
|
$this->npc = $general->getVar('npc');
|
||||||
else{
|
if($general['owner'] > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
||||||
$this->_constructWithRawValue($name, $npc);
|
$this->realName = $general->getVar('name2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getText():string{
|
public function getText():string{
|
||||||
$name = $this->name ;
|
$name = $this->name;
|
||||||
$npc = $this->npc;
|
$npc = $this->npc;
|
||||||
|
|
||||||
if($npc == 0){
|
if($npc == 0){
|
||||||
@@ -128,7 +119,12 @@ class DyingMessage{
|
|||||||
$text = static::$defaultMessage;
|
$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);
|
JosaUtil::batch($text, $name);
|
||||||
return $text;
|
return $text;
|
||||||
|
|||||||
Reference in New Issue
Block a user