Scenario 초기화 버그 수정

리셋 시 로그 초기화
This commit is contained in:
2018-03-31 19:42:16 +09:00
parent 8713bac296
commit 87c6130d17
4 changed files with 28 additions and 11 deletions
+3
View File
@@ -9,6 +9,9 @@ class FileUtil{
if ($FolderOrFile == "." || $FolderOrFile == "..") {
continue;
}
if($FolderOrFile[0] == '.'){
continue;
}
$filepath = sprintf('%s/%s', $dir, $FolderOrFile);
if (is_dir($filepath)) {
+4
View File
@@ -40,6 +40,10 @@ if($fullReset && class_exists('\\sammo\\DB')){
}
}
}
if($fullReset){
FileUtil::delInDir(__dir__."/logs");
FileUtil::delInDir(__dir__."/data");
}
function dbConnFail($params){
Json::die([
+8 -5
View File
@@ -31,6 +31,8 @@ class Scenario{
if($this->initOK){
return;
}
$this->initOK = true;
$data = $this->data;
$this->nations = [];
$this->nations[0] = new Scenario\Nation(0, '재야', '#ffffff', 0, 0);
@@ -96,7 +98,7 @@ class Scenario{
list(
$affinity, $name, $pictureID, $nationID, $locatedCity,
$leadership, $power, $intel, $birth, $death, $ego,
$leadership, $power, $intel, $level, $birth, $death, $ego,
$char, $text
) = $rawGeneral;
@@ -115,6 +117,7 @@ class Scenario{
$leadership,
$power,
$intel,
$level,
$birth,
$death,
$ego,
@@ -242,7 +245,7 @@ class Scenario{
continue;
}
$rawGeneral = $this->tmpGeneralQueue[$general->$name];
$rawGeneral = $this->tmpGeneralQueue[$general->name];
$birth = $general->birth;
if(!key_exists($birth, $remainGenerals)){
$remainGenerals[$birth] = [];
@@ -256,7 +259,7 @@ class Scenario{
continue;
}
$rawGeneral = $this->tmpGeneralQueue[$general->$name];
$rawGeneral = $this->tmpGeneralQueue[$general->name];
$birth = $general->birth;
if(!key_exists($birth, $remainGenerals)){
$remainGenerals[$birth] = [];
@@ -282,7 +285,7 @@ class Scenario{
public function build($env=[]){
$this->initFull();
//NOTE: 초기화가 되어있다고 가정함.
/*
@@ -325,7 +328,7 @@ class Scenario{
$events = array_map(function($rawEvent){
return [
'cond'=>Json::encode($rawEvent['cond']),
'condition'=>Json::encode($rawEvent['cond']),
'action'=>Json::encode($rawEvent['action'])
];
}, $this->events);
+13 -6
View File
@@ -14,6 +14,7 @@ class NPC{
public $leadership;
public $power;
public $intel;
public $level;
public $birth;
public $death;
public $ego;
@@ -21,6 +22,7 @@ class NPC{
public $charWar = 0;
public $text;
//[ 1, "헌제",1002, 1, null, 17, 13, 61, 0, 170, 250, "안전", null, "산 넘어 산이로구나..."],
public function __construct(
int $affinity,
string $name,
@@ -30,11 +32,12 @@ class NPC{
int $leadership,
int $power,
int $intel,
int $level = 0,
int $birth = 160,
int $death = 300,
string $ego = null,
string $char = null,
string $text = null
$ego = null,
$char = null,
$text = null
){
$this->affinity = $affinity;
$this->name = $name;
@@ -44,6 +47,7 @@ class NPC{
$this->leadership = $leadership;
$this->power = $power;
$this->intel = $intel;
$this->level = $level;
$this->birth = $birth;
$this->death = $death;
$this->ego = $ego;
@@ -84,7 +88,10 @@ class NPC{
}
if($this->ego == null){
$this->ego = mt_rand(0, 9);//TODO: 나중에 성격을 따로 분리할 경우 클래스를 참조.
$ego = mt_rand(0, 9);//TODO: 나중에 성격을 따로 분리할 경우 클래스를 참조.
}
else{
$ego = \sammo\CharCall($this->ego);
}
$name = 'ⓝ'.$this->name;
@@ -108,7 +115,7 @@ class NPC{
$experience = $age * 100;
$dedication = $age * 100;
$level = $nationID?1:0;
$level = $nationID?1:$this->level;
$turntime = \sammo\getRandTurn($env['turnterm']);
@@ -147,7 +154,7 @@ class NPC{
'killturn'=>$killturn,
'age'=>$age,
'belong'=>1,
'personal'=>$this->ego,
'personal'=>$ego,
'special'=>$this->charDomestic,
'specage'=>$specage,
'special2'=>$this->charWar,