fix: RegNPC 버그 수정, event handler 규격 버그 수정
This commit is contained in:
+1
-1
@@ -117,7 +117,7 @@ function logError(string $err, string $errstr, string $errpath, array $trace)
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext)
|
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext=null)
|
||||||
{
|
{
|
||||||
if (!(error_reporting() & $errno)) {
|
if (!(error_reporting() & $errno)) {
|
||||||
// This error code is not included in error_reporting, so let it fall
|
// This error code is not included in error_reporting, so let it fall
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ namespace sammo\Event;
|
|||||||
|
|
||||||
abstract class Action{
|
abstract class Action{
|
||||||
//public abstract function __construct(...$args);
|
//public abstract function __construct(...$args);
|
||||||
public abstract function run($env=null);
|
public abstract function run($env);
|
||||||
|
|
||||||
public static function build($actionArgs):Action{
|
public static function build($actionArgs):Action{
|
||||||
if(!is_array($actionArgs)){
|
if(!is_array($actionArgs)){
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ namespace sammo\Event\Action;
|
|||||||
|
|
||||||
//이전 RegNPC 함수를 EventAction으로 재구성
|
//이전 RegNPC 함수를 EventAction으로 재구성
|
||||||
class RegNPC extends \sammo\Event\Action{
|
class RegNPC extends \sammo\Event\Action{
|
||||||
|
/** @var \sammo\Scenario\GeneralBuilder */
|
||||||
private $npc;
|
private $npc;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -22,7 +23,7 @@ class RegNPC extends \sammo\Event\Action{
|
|||||||
$text = ''
|
$text = ''
|
||||||
){
|
){
|
||||||
|
|
||||||
return (new \sammo\Scenario\GeneralBuilder(
|
$this->npc=(new \sammo\Scenario\GeneralBuilder(
|
||||||
$name,
|
$name,
|
||||||
0,
|
0,
|
||||||
$picturePath,
|
$picturePath,
|
||||||
@@ -38,7 +39,7 @@ class RegNPC extends \sammo\Event\Action{
|
|||||||
->setLifeSpan($birth, $death);
|
->setLifeSpan($birth, $death);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run($env=null){
|
public function run($env){
|
||||||
$result = $this->npc->fillRemainSpecAsZero($env)->build($env);
|
$result = $this->npc->fillRemainSpecAsZero($env)->build($env);
|
||||||
return [__CLASS__, $result];
|
return [__CLASS__, $result];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class RegNeutralNPC extends \sammo\Event\Action{
|
|||||||
$char = '',
|
$char = '',
|
||||||
$text = ''
|
$text = ''
|
||||||
){
|
){
|
||||||
return (new \sammo\Scenario\GeneralBuilder(
|
$this->npc=(new \sammo\Scenario\GeneralBuilder(
|
||||||
$name,
|
$name,
|
||||||
0,
|
0,
|
||||||
$picturePath,
|
$picturePath,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class EventHandler{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function tryRunEvent(array $env=null){
|
public function tryRunEvent(array $env){
|
||||||
$result = $this->condition->eval($env);
|
$result = $this->condition->eval($env);
|
||||||
|
|
||||||
if(!$result['value']){
|
if(!$result['value']){
|
||||||
|
|||||||
@@ -407,13 +407,22 @@ class TurnExecutionHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 이벤트 핸들러 동작
|
// 이벤트 핸들러 동작
|
||||||
|
$e_env = null;
|
||||||
foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
|
foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
|
||||||
|
if($e_env === null){
|
||||||
|
$e_env = $gameStor->getAll(false);
|
||||||
|
}
|
||||||
$eventID = $rawEvent['id'];
|
$eventID = $rawEvent['id'];
|
||||||
$cond = Json::decode($rawEvent['condition']);
|
$cond = Json::decode($rawEvent['condition']);
|
||||||
$action = Json::decode($rawEvent['action']);
|
$action = Json::decode($rawEvent['action']);
|
||||||
$event = new Event\EventHandler($cond, $action);
|
$event = new Event\EventHandler($cond, $action);
|
||||||
|
$e_env['currentEventID'] = $eventID;
|
||||||
|
|
||||||
$event->tryRunEvent(['currentEventID'=>$eventID] + $gameStor->getAll(true));
|
$event->tryRunEvent($e_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($e_env !== null){
|
||||||
|
$gameStor->resetCache(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
postUpdateMonthly();
|
postUpdateMonthly();
|
||||||
|
|||||||
Reference in New Issue
Block a user