diff --git a/src/sammo/FileUtil.php b/src/sammo/FileUtil.php index 44cb3424..c07a4837 100644 --- a/src/sammo/FileUtil.php +++ b/src/sammo/FileUtil.php @@ -9,6 +9,9 @@ class FileUtil{ if ($FolderOrFile == "." || $FolderOrFile == "..") { continue; } + if($FolderOrFile[0] == '.'){ + continue; + } $filepath = sprintf('%s/%s', $dir, $FolderOrFile); if (is_dir($filepath)) { diff --git a/twe/j_install_db.php b/twe/j_install_db.php index bfeda051..f4a8b058 100644 --- a/twe/j_install_db.php +++ b/twe/j_install_db.php @@ -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([ diff --git a/twe/sammo/Scenario.php b/twe/sammo/Scenario.php index eed9e569..41c2c339 100644 --- a/twe/sammo/Scenario.php +++ b/twe/sammo/Scenario.php @@ -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); diff --git a/twe/sammo/Scenario/NPC.php b/twe/sammo/Scenario/NPC.php index 1b8f3b8f..12836837 100644 --- a/twe/sammo/Scenario/NPC.php +++ b/twe/sammo/Scenario/NPC.php @@ -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,