From 477b77b59fe0dc38e941b6b33afdddb9399de138 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 18 Sep 2024 14:54:11 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20StaticEventHandler=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=EA=B8=B0=20=EC=B6=94=EA=B0=80=20-=20=EC=BB=A4=EB=A7=A8?= =?UTF-8?q?=EB=93=9C=20=EC=A2=85=EB=A3=8C=20=EC=8B=9C=EC=A0=90=EC=97=90=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=20=20-=20pre,=20post=20=EA=B0=81=EA=B0=81?= =?UTF-8?q?=EC=9D=B4=20=ED=95=84=EC=9A=94=ED=95=9C=EC=A7=80=EB=8A=94=20?= =?UTF-8?q?=EB=85=BC=EC=9D=98=20=ED=95=84=EC=9A=94=20=20=20-=20=EC=9D=BC?= =?UTF-8?q?=EB=8B=A8=20=EC=9A=A9=EB=8F=84=EC=97=90=20=EB=94=B0=EB=9D=BC=20?= =?UTF-8?q?pre,=20post=20=EB=91=98=EC=A4=91=EC=97=90=20=ED=95=98=EB=82=98?= =?UTF-8?q?=EB=A7=8C=20=EC=B2=98=EB=A6=AC=20-=20eventType=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=EB=8A=94=20full=20qualified=20class=20name=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=20=20=20-=20=EA=BC=AD=20=EA=B7=B8=EB=9F=B4?= =?UTF-8?q?=ED=95=84=EC=9A=94=EB=8A=94=20=EC=97=86=EC=A7=80=EB=A7=8C,=20?= =?UTF-8?q?=EC=BB=A4=EB=A7=A8=EB=93=9C=EC=97=90=20=ED=95=9C=ED=95=B4?= =?UTF-8?q?=EC=84=9C=EB=8A=94=20=EC=9D=B4=EB=A0=87=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_converter.php | 23 +++++++++++++++ hwe/sammo/BaseStaticEvent.php | 2 +- hwe/sammo/Command/General/che_NPC능동.php | 4 ++- hwe/sammo/Command/General/che_강행.php | 5 ++-- hwe/sammo/Command/General/che_거병.php | 4 ++- hwe/sammo/Command/General/che_건국.php | 2 ++ hwe/sammo/Command/General/che_견문.php | 4 ++- hwe/sammo/Command/General/che_군량매매.php | 4 ++- hwe/sammo/Command/General/che_귀환.php | 4 ++- hwe/sammo/Command/General/che_기술연구.php | 4 ++- hwe/sammo/Command/General/che_단련.php | 4 ++- hwe/sammo/Command/General/che_등용.php | 4 ++- hwe/sammo/Command/General/che_등용수락.php | 2 ++ hwe/sammo/Command/General/che_랜덤임관.php | 4 +-- hwe/sammo/Command/General/che_모반시도.php | 4 ++- hwe/sammo/Command/General/che_무작위건국.php | 2 ++ hwe/sammo/Command/General/che_물자조달.php | 4 ++- hwe/sammo/Command/General/che_방랑.php | 4 ++- hwe/sammo/Command/General/che_사기진작.php | 4 ++- hwe/sammo/Command/General/che_상업투자.php | 4 ++- hwe/sammo/Command/General/che_선양.php | 2 ++ hwe/sammo/Command/General/che_소집해제.php | 4 ++- hwe/sammo/Command/General/che_숙련전환.php | 4 +-- hwe/sammo/Command/General/che_요양.php | 4 ++- hwe/sammo/Command/General/che_은퇴.php | 4 ++- hwe/sammo/Command/General/che_이동.php | 4 +-- hwe/sammo/Command/General/che_인재탐색.php | 2 ++ hwe/sammo/Command/General/che_임관.php | 4 ++- hwe/sammo/Command/General/che_장비매매.php | 4 ++- .../Command/General/che_장수대상임관.php | 4 ++- hwe/sammo/Command/General/che_전투태세.php | 4 ++- .../Command/General/che_전투특기초기화.php | 4 ++- hwe/sammo/Command/General/che_접경귀환.php | 4 ++- hwe/sammo/Command/General/che_정착장려.php | 4 ++- hwe/sammo/Command/General/che_주민선정.php | 4 ++- hwe/sammo/Command/General/che_증여.php | 2 ++ hwe/sammo/Command/General/che_집합.php | 4 ++- hwe/sammo/Command/General/che_징병.php | 2 ++ hwe/sammo/Command/General/che_첩보.php | 2 ++ hwe/sammo/Command/General/che_출병.php | 2 ++ hwe/sammo/Command/General/che_하야.php | 4 ++- hwe/sammo/Command/General/che_해산.php | 2 ++ hwe/sammo/Command/General/che_헌납.php | 2 ++ hwe/sammo/Command/General/che_화계.php | 2 ++ hwe/sammo/Command/General/che_훈련.php | 4 ++- hwe/sammo/Command/General/cr_건국.php | 2 ++ hwe/sammo/Command/General/cr_맹훈련.php | 4 ++- hwe/sammo/Command/General/휴식.php | 2 ++ hwe/sammo/Command/Nation/che_감축.php | 4 ++- hwe/sammo/Command/Nation/che_국기변경.php | 2 ++ hwe/sammo/Command/Nation/che_국호변경.php | 2 ++ hwe/sammo/Command/Nation/che_급습.php | 2 ++ hwe/sammo/Command/Nation/che_몰수.php | 2 ++ .../Command/Nation/che_무작위수도이전.php | 2 ++ hwe/sammo/Command/Nation/che_물자원조.php | 2 ++ hwe/sammo/Command/Nation/che_발령.php | 2 ++ hwe/sammo/Command/Nation/che_백성동원.php | 4 ++- hwe/sammo/Command/Nation/che_불가침수락.php | 2 ++ hwe/sammo/Command/Nation/che_불가침제의.php | 2 ++ .../Command/Nation/che_불가침파기수락.php | 2 ++ .../Command/Nation/che_불가침파기제의.php | 2 ++ hwe/sammo/Command/Nation/che_선전포고.php | 2 ++ hwe/sammo/Command/Nation/che_수몰.php | 4 ++- hwe/sammo/Command/Nation/che_의병모집.php | 3 +- hwe/sammo/Command/Nation/che_이호경식.php | 2 ++ hwe/sammo/Command/Nation/che_종전수락.php | 2 ++ hwe/sammo/Command/Nation/che_종전제의.php | 2 ++ hwe/sammo/Command/Nation/che_증축.php | 4 ++- hwe/sammo/Command/Nation/che_천도.php | 2 ++ hwe/sammo/Command/Nation/che_초토화.php | 4 ++- hwe/sammo/Command/Nation/che_포상.php | 2 ++ hwe/sammo/Command/Nation/che_피장파장.php | 4 ++- hwe/sammo/Command/Nation/che_필사즉생.php | 4 ++- hwe/sammo/Command/Nation/che_허보.php | 2 ++ hwe/sammo/Command/Nation/cr_인구이동.php | 2 ++ hwe/sammo/Command/Nation/휴식.php | 2 ++ .../StaticEvent/event_부대발령즉시집합.php | 28 ++++--------------- .../StaticEvent/event_부대탑승즉시이동.php | 2 +- hwe/sammo/StaticEventHandler.php | 21 +++++++++----- 79 files changed, 227 insertions(+), 77 deletions(-) diff --git a/hwe/func_converter.php b/hwe/func_converter.php index 23f74823..774b9047 100644 --- a/hwe/func_converter.php +++ b/hwe/func_converter.php @@ -457,6 +457,29 @@ function buildWarUnitTriggerClass(?string $type, WarUnit $unit, ?array $args = n return $class->newInstanceArgs(array_merge([$unit], $args)); } +function getStaticEventClass(string $type){ + static $basePath = __NAMESPACE__.'\\StaticEvent\\'; + $classPath = ($basePath.$type); + + if(class_exists($classPath)){ + return $classPath; + } + + throw new \InvalidArgumentException("{$type}은 StaticEvent가 아님"); +} + +function buildStaticEventClass(?string $type):BaseStaticEvent{ + static $cache = []; + if(key_exists($type, $cache)){ + return $cache[$type]; + } + + $class = getStaticEventClass($type); + $obj = new $class(); + $cache[$type] = $obj; + return $obj; +} + function getGeneralPoolClass(string $type){ static $basePath = __NAMESPACE__.'\\GeneralPool\\'; $classPath = ($basePath.$type); diff --git a/hwe/sammo/BaseStaticEvent.php b/hwe/sammo/BaseStaticEvent.php index 92f7887e..e4652873 100644 --- a/hwe/sammo/BaseStaticEvent.php +++ b/hwe/sammo/BaseStaticEvent.php @@ -7,5 +7,5 @@ abstract class BaseStaticEvent { } - abstract function run(General $general, array $env, array $params): bool | string; + abstract function run(GeneralLite|General $general, null|GeneralLite|General $destGeneral, array $env, array $params): bool | string; } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_NPC능동.php b/hwe/sammo/Command/General/che_NPC능동.php index 7ee07fc3..1af189c2 100644 --- a/hwe/sammo/Command/General/che_NPC능동.php +++ b/hwe/sammo/Command/General/che_NPC능동.php @@ -7,7 +7,8 @@ use \sammo\{ CityConst, ActionLogger, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -96,6 +97,7 @@ class che_NPC능동 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); } + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 4ae55969..e2d92cc9 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -12,8 +12,7 @@ use function sammo\tryUniqueItemLottery; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; - - +use sammo\StaticEventHandler; class che_강행 extends Command\GeneralCommand { @@ -158,8 +157,8 @@ class che_강행 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); - $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_거병.php b/hwe/sammo/Command/General/che_거병.php index 74ad94a0..3a1dd535 100644 --- a/hwe/sammo/Command/General/che_거병.php +++ b/hwe/sammo/Command/General/che_거병.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; @@ -174,6 +175,7 @@ class che_거병 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_건국.php b/hwe/sammo/Command/General/che_건국.php index 7082d940..443dd453 100644 --- a/hwe/sammo/Command/General/che_건국.php +++ b/hwe/sammo/Command/General/che_건국.php @@ -19,6 +19,7 @@ use function \sammo\getAllNationStaticInfo; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; use sammo\Enums\PenaltyKey; +use sammo\StaticEventHandler; use function sammo\buildNationTypeClass; use function sammo\genGenericUniqueRNGFromGeneral; @@ -205,6 +206,7 @@ class che_건국 extends Command\GeneralCommand $general->increaseInheritancePoint(InheritanceKey::unifier, 250); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국'); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_견문.php b/hwe/sammo/Command/General/che_견문.php index 3f5871d3..b0a0dc9b 100644 --- a/hwe/sammo/Command/General/che_견문.php +++ b/hwe/sammo/Command/General/che_견문.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -112,6 +113,7 @@ class che_견문 extends Command\GeneralCommand{ $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_군량매매.php b/hwe/sammo/Command/General/che_군량매매.php index ee49479e..7fccca7d 100644 --- a/hwe/sammo/Command/General/che_군량매매.php +++ b/hwe/sammo/Command/General/che_군량매매.php @@ -9,7 +9,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -178,6 +179,7 @@ class che_군량매매 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_귀환.php b/hwe/sammo/Command/General/che_귀환.php index bef962c4..718798ca 100644 --- a/hwe/sammo/Command/General/che_귀환.php +++ b/hwe/sammo/Command/General/che_귀환.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -95,6 +96,7 @@ class che_귀환 extends Command\GeneralCommand{ $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_기술연구.php b/hwe/sammo/Command/General/che_기술연구.php index 7e416f39..cdc98679 100644 --- a/hwe/sammo/Command/General/che_기술연구.php +++ b/hwe/sammo/Command/General/che_기술연구.php @@ -6,7 +6,8 @@ use \sammo\{ General, ActionLogger, LastTurn, - Command, GameConst + Command, GameConst, + StaticEventHandler }; use function sammo\{ @@ -134,6 +135,7 @@ class che_기술연구 extends che_상업투자{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_단련.php b/hwe/sammo/Command/General/che_단련.php index af20f289..6af1c2ca 100644 --- a/hwe/sammo/Command/General/che_단련.php +++ b/hwe/sammo/Command/General/che_단련.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; @@ -126,6 +127,7 @@ class che_단련 extends Command\GeneralCommand{ $general->increaseVar($incStat, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index 58db248c..dc83f784 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -9,7 +9,8 @@ use \sammo\{ General, LastTurn, Command, - ScoutMessage + ScoutMessage, + StaticEventHandler }; use function \sammo\getAllNationStaticInfo; @@ -169,6 +170,7 @@ class che_등용 extends Command\GeneralCommand $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_등용수락.php b/hwe/sammo/Command/General/che_등용수락.php index 61c3fa8c..b9261aef 100644 --- a/hwe/sammo/Command/General/che_등용수락.php +++ b/hwe/sammo/Command/General/che_등용수락.php @@ -6,6 +6,7 @@ use \sammo\{ General, GameConst, Command, + StaticEventHandler, }; use \sammo\Constraint\ConstraintHelper; @@ -207,6 +208,7 @@ class che_등용수락 extends Command\GeneralCommand{ } + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destGeneral->applyDB($db); diff --git a/hwe/sammo/Command/General/che_랜덤임관.php b/hwe/sammo/Command/General/che_랜덤임관.php index 15243598..0fb89ae6 100644 --- a/hwe/sammo/Command/General/che_랜덤임관.php +++ b/hwe/sammo/Command/General/che_랜덤임관.php @@ -22,8 +22,7 @@ use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; use sammo\Enums\InheritanceKey; use sammo\MustNotBeReachedException; - - +use sammo\StaticEventHandler; class che_랜덤임관 extends Command\GeneralCommand { @@ -281,6 +280,7 @@ class che_랜덤임관 extends Command\GeneralCommand $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '랜덤 임관'); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_모반시도.php b/hwe/sammo/Command/General/che_모반시도.php index 8e533cc7..f5416e59 100644 --- a/hwe/sammo/Command/General/che_모반시도.php +++ b/hwe/sammo/Command/General/che_모반시도.php @@ -8,7 +8,8 @@ use \sammo\{ GameConst, LastTurn, GameUnitConst, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -97,6 +98,7 @@ class che_모반시도 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->increaseInheritancePoint(InheritanceKey::active_action, 1); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $lordGeneral->applyDB($db); diff --git a/hwe/sammo/Command/General/che_무작위건국.php b/hwe/sammo/Command/General/che_무작위건국.php index 1406ec41..2526595e 100644 --- a/hwe/sammo/Command/General/che_무작위건국.php +++ b/hwe/sammo/Command/General/che_무작위건국.php @@ -18,6 +18,7 @@ use function \sammo\getAllNationStaticInfo; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; use function sammo\buildNationTypeClass; use function sammo\genGenericUniqueRNGFromGeneral; @@ -216,6 +217,7 @@ class che_무작위건국 extends Command\GeneralCommand $general->increaseInheritancePoint(InheritanceKey::active_action, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국'); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_물자조달.php b/hwe/sammo/Command/General/che_물자조달.php index 4f2e994c..02d57dc3 100644 --- a/hwe/sammo/Command/General/che_물자조달.php +++ b/hwe/sammo/Command/General/che_물자조달.php @@ -8,7 +8,8 @@ use \sammo\{ GameConst, LastTurn, GameUnitConst, - Command + Command, + StaticEventHandler }; use function \sammo\getDomesticExpLevelBonus; @@ -148,6 +149,7 @@ class che_물자조달 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_방랑.php b/hwe/sammo/Command/General/che_방랑.php index 786f7464..4818c509 100644 --- a/hwe/sammo/Command/General/che_방랑.php +++ b/hwe/sammo/Command/General/che_방랑.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -124,6 +125,7 @@ class che_방랑 extends Command\GeneralCommand{ refreshNationStaticInfo(); $general->increaseInheritancePoint(InheritanceKey::active_action, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_사기진작.php b/hwe/sammo/Command/General/che_사기진작.php index cd14ea2e..71ad5371 100644 --- a/hwe/sammo/Command/General/che_사기진작.php +++ b/hwe/sammo/Command/General/che_사기진작.php @@ -11,7 +11,8 @@ use \sammo\{ GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -121,6 +122,7 @@ class che_사기진작 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php index 090945cc..5dd40e70 100644 --- a/hwe/sammo/Command/General/che_상업투자.php +++ b/hwe/sammo/Command/General/che_상업투자.php @@ -9,7 +9,8 @@ use \sammo\{ LastTurn, GameUnitConst, Command, - RandUtil + RandUtil, + StaticEventHandler }; use function \sammo\getDomesticExpLevelBonus; @@ -218,6 +219,7 @@ class che_상업투자 extends Command\GeneralCommand{ $general->increaseVar(static::$statKey.'_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_선양.php b/hwe/sammo/Command/General/che_선양.php index 9c2ec45e..633d415a 100644 --- a/hwe/sammo/Command/General/che_선양.php +++ b/hwe/sammo/Command/General/che_선양.php @@ -21,6 +21,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; class che_선양 extends Command\GeneralCommand { @@ -138,6 +139,7 @@ class che_선양 extends Command\GeneralCommand $general->increaseInheritancePoint(InheritanceKey::active_action, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destGeneral->applyDB($db); diff --git a/hwe/sammo/Command/General/che_소집해제.php b/hwe/sammo/Command/General/che_소집해제.php index 3826d005..dda6a29a 100644 --- a/hwe/sammo/Command/General/che_소집해제.php +++ b/hwe/sammo/Command/General/che_소집해제.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -80,6 +81,7 @@ class che_소집해제 extends Command\GeneralCommand{ $general->addDedication($ded); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_숙련전환.php b/hwe/sammo/Command/General/che_숙련전환.php index e775f932..8d73778d 100644 --- a/hwe/sammo/Command/General/che_숙련전환.php +++ b/hwe/sammo/Command/General/che_숙련전환.php @@ -13,8 +13,7 @@ use function sammo\getDexLevelList; use function \sammo\tryUniqueItemLottery; use \sammo\Constraint\ConstraintHelper; - - +use sammo\StaticEventHandler; class che_숙련전환 extends Command\GeneralCommand { @@ -179,6 +178,7 @@ class che_숙련전환 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 2); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_요양.php b/hwe/sammo/Command/General/che_요양.php index 8b06217f..b5cc421a 100644 --- a/hwe/sammo/Command/General/che_요양.php +++ b/hwe/sammo/Command/General/che_요양.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -69,6 +70,7 @@ class che_요양 extends Command\GeneralCommand{ $general->addDedication($ded); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_은퇴.php b/hwe/sammo/Command/General/che_은퇴.php index f134e5b8..5661510e 100644 --- a/hwe/sammo/Command/General/che_은퇴.php +++ b/hwe/sammo/Command/General/che_은퇴.php @@ -4,7 +4,8 @@ namespace sammo\Command\General; use \sammo\{ DB, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\ConstraintHelper; @@ -75,6 +76,7 @@ class che_은퇴 extends Command\GeneralCommand{ $logger->pushGeneralActionLog("은퇴하였습니다. <1>$date"); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php index 8301f313..63911edf 100644 --- a/hwe/sammo/Command/General/che_이동.php +++ b/hwe/sammo/Command/General/che_이동.php @@ -12,8 +12,7 @@ use function sammo\tryUniqueItemLottery; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; - - +use sammo\StaticEventHandler; class che_이동 extends Command\GeneralCommand { @@ -164,6 +163,7 @@ class che_이동 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_인재탐색.php b/hwe/sammo/Command/General/che_인재탐색.php index 9daf78cc..104838a0 100644 --- a/hwe/sammo/Command/General/che_인재탐색.php +++ b/hwe/sammo/Command/General/che_인재탐색.php @@ -18,6 +18,7 @@ use function \sammo\pickGeneralFromPool; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; class che_인재탐색 extends Command\GeneralCommand { @@ -218,6 +219,7 @@ class che_인재탐색 extends Command\GeneralCommand $general->increaseVar($incStat, 3); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index a9476d4f..f2980c55 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -9,7 +9,8 @@ use \sammo\{ GameConst, LastTurn, Command, - KVStorage + KVStorage, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -175,6 +176,7 @@ class che_임관 extends Command\GeneralCommand $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_장비매매.php b/hwe/sammo/Command/General/che_장비매매.php index 6bf64fc2..fd23cc55 100644 --- a/hwe/sammo/Command/General/che_장비매매.php +++ b/hwe/sammo/Command/General/che_장비매매.php @@ -14,7 +14,8 @@ use \sammo\{ GameUnitConst, LastTurn, Command, - KVStorage + KVStorage, + StaticEventHandler }; use function \sammo\buildItemClass; @@ -196,6 +197,7 @@ class che_장비매매 extends Command\GeneralCommand $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_장수대상임관.php b/hwe/sammo/Command/General/che_장수대상임관.php index 0f766b91..869a08d2 100644 --- a/hwe/sammo/Command/General/che_장수대상임관.php +++ b/hwe/sammo/Command/General/che_장수대상임관.php @@ -9,7 +9,8 @@ use \sammo\{ LastTurn, Command, Json, - KVStorage + KVStorage, + StaticEventHandler }; use function sammo\getAllNationStaticInfo; @@ -170,6 +171,7 @@ class che_장수대상임관 extends Command\GeneralCommand{ $general->addExperience($exp); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_전투태세.php b/hwe/sammo/Command/General/che_전투태세.php index fcd97842..0592a166 100644 --- a/hwe/sammo/Command/General/che_전투태세.php +++ b/hwe/sammo/Command/General/che_전투태세.php @@ -8,7 +8,8 @@ use \sammo\{ GameConst, GameUnitConst, LastTurn, Command, - MustNotBeReachedException + MustNotBeReachedException, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -121,6 +122,7 @@ class che_전투태세 extends Command\GeneralCommand{ $general->increaseVar('leadership_exp', 3); $this->setResultTurn($turnResult); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_전투특기초기화.php b/hwe/sammo/Command/General/che_전투특기초기화.php index 00f692d9..062ff3bc 100644 --- a/hwe/sammo/Command/General/che_전투특기초기화.php +++ b/hwe/sammo/Command/General/che_전투특기초기화.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -103,6 +104,7 @@ class che_전투특기초기화 extends Command\GeneralCommand{ $logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date"); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_접경귀환.php b/hwe/sammo/Command/General/che_접경귀환.php index 6c1df6b4..59c4feb9 100644 --- a/hwe/sammo/Command/General/che_접경귀환.php +++ b/hwe/sammo/Command/General/che_접경귀환.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\ConstraintHelper; @@ -98,6 +99,7 @@ class che_접경귀환 extends Command\GeneralCommand{ //TODO: InstantAction일때에만 설정하지 않는게 나은데.. //$this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_정착장려.php b/hwe/sammo/Command/General/che_정착장려.php index c5fafc12..e4a00276 100644 --- a/hwe/sammo/Command/General/che_정착장려.php +++ b/hwe/sammo/Command/General/che_정착장려.php @@ -9,7 +9,8 @@ use \sammo\{ LastTurn, GameUnitConst, Command, - RandUtil + RandUtil, + StaticEventHandler }; use function \sammo\getDomesticExpLevelBonus; @@ -188,6 +189,7 @@ class che_정착장려 extends Command\GeneralCommand{ $general->increaseVar(static::$statKey.'_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_주민선정.php b/hwe/sammo/Command/General/che_주민선정.php index 4d68704d..7bf0adc6 100644 --- a/hwe/sammo/Command/General/che_주민선정.php +++ b/hwe/sammo/Command/General/che_주민선정.php @@ -9,7 +9,8 @@ use \sammo\{ LastTurn, GameUnitConst, Command, - RandUtil + RandUtil, + StaticEventHandler }; use function \sammo\getDomesticExpLevelBonus; @@ -188,6 +189,7 @@ class che_주민선정 extends Command\GeneralCommand{ $general->increaseVar(static::$statKey.'_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index 5e788e01..1bf2f809 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -16,6 +16,7 @@ use \sammo\Command; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; +use sammo\StaticEventHandler; use function sammo\tryUniqueItemLottery; @@ -170,6 +171,7 @@ class che_증여 extends Command\GeneralCommand $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_집합.php b/hwe/sammo/Command/General/che_집합.php index 5ab7cb9b..80f2abd7 100644 --- a/hwe/sammo/Command/General/che_집합.php +++ b/hwe/sammo/Command/General/che_집합.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -103,6 +104,7 @@ class che_집합 extends Command\GeneralCommand{ $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index d7c50b3f..f17fcb84 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -16,6 +16,7 @@ use function sammo\getTechLevel; use \sammo\Constraint\ConstraintHelper; use sammo\MustNotBeReachedException; +use sammo\StaticEventHandler; class che_징병 extends Command\GeneralCommand { @@ -226,6 +227,7 @@ class che_징병 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->setAuxVar('armType', $reqCrewType->armType); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index 1f3c72c2..0d0e6356 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -16,6 +16,7 @@ use function \sammo\searchDistance; use \sammo\Constraint\ConstraintHelper; use sammo\CityConst; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; class che_첩보 extends Command\GeneralCommand { @@ -212,6 +213,7 @@ class che_첩보 extends Command\GeneralCommand $general->addDedication($ded); $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->checkStatChange(); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index afcd262b..1d2da1f4 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -22,6 +22,7 @@ use sammo\CityConst; use sammo\Enums\InheritanceKey; use sammo\LiteHashDRBG; use sammo\RandUtil; +use sammo\StaticEventHandler; use sammo\UniqueConst; class che_출병 extends Command\GeneralCommand @@ -253,6 +254,7 @@ class che_출병 extends Command\GeneralCommand processWar($warRngSeed, $general, $this->nation, $this->destCity); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_하야.php b/hwe/sammo/Command/General/che_하야.php index 36b01e0d..84d5f610 100644 --- a/hwe/sammo/Command/General/che_하야.php +++ b/hwe/sammo/Command/General/che_하야.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -122,6 +123,7 @@ class che_하야 extends Command\GeneralCommand{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/General/che_해산.php b/hwe/sammo/Command/General/che_해산.php index e8eb24a0..e536564e 100644 --- a/hwe/sammo/Command/General/che_해산.php +++ b/hwe/sammo/Command/General/che_해산.php @@ -10,6 +10,7 @@ use \sammo\{ Command, Json, KVStorage, + StaticEventHandler, TurnExecutionHelper }; @@ -109,6 +110,7 @@ class che_해산 extends Command\GeneralCommand{ foreach($nationGenerals as $oldGeneral){ $oldGeneral->applyDB($db); } + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); // 이벤트 핸들러 동작 diff --git a/hwe/sammo/Command/General/che_헌납.php b/hwe/sammo/Command/General/che_헌납.php index 7bf0581c..1afdc4a3 100644 --- a/hwe/sammo/Command/General/che_헌납.php +++ b/hwe/sammo/Command/General/che_헌납.php @@ -14,6 +14,7 @@ use \sammo\Command; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; +use sammo\StaticEventHandler; use function sammo\tryUniqueItemLottery; @@ -146,6 +147,7 @@ class che_헌납 extends Command\GeneralCommand $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php index 45f13c95..eb7823f1 100644 --- a/hwe/sammo/Command/General/che_화계.php +++ b/hwe/sammo/Command/General/che_화계.php @@ -18,6 +18,7 @@ use sammo\CityConst; use sammo\Enums\GeneralQueryMode; use sammo\Enums\RankColumn; use sammo\RandUtil; +use sammo\StaticEventHandler; class che_화계 extends Command\GeneralCommand { @@ -332,6 +333,7 @@ class che_화계 extends Command\GeneralCommand $general->increaseVar($statType . '_exp', 1); $general->increaseRankVar(RankColumn::firenum, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->checkStatChange(); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/che_훈련.php b/hwe/sammo/Command/General/che_훈련.php index b26efb1a..55ca4a81 100644 --- a/hwe/sammo/Command/General/che_훈련.php +++ b/hwe/sammo/Command/General/che_훈련.php @@ -11,7 +11,8 @@ use \sammo\{ GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -122,6 +123,7 @@ class che_훈련 extends Command\GeneralCommand $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/cr_건국.php b/hwe/sammo/Command/General/cr_건국.php index 17293789..5187ac19 100644 --- a/hwe/sammo/Command/General/cr_건국.php +++ b/hwe/sammo/Command/General/cr_건국.php @@ -18,6 +18,7 @@ use function \sammo\getAllNationStaticInfo; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; use function sammo\buildNationTypeClass; use function sammo\genGenericUniqueRNGFromGeneral; @@ -201,6 +202,7 @@ class cr_건국 extends Command\GeneralCommand $general->increaseInheritancePoint(InheritanceKey::active_action, 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국'); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/cr_맹훈련.php b/hwe/sammo/Command/General/cr_맹훈련.php index d44ff127..3b333128 100644 --- a/hwe/sammo/Command/General/cr_맹훈련.php +++ b/hwe/sammo/Command/General/cr_맹훈련.php @@ -7,7 +7,8 @@ use \sammo\{ ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + StaticEventHandler }; use function \sammo\tryUniqueItemLottery; @@ -105,6 +106,7 @@ class cr_맹훈련 extends Command\GeneralCommand{ $general->increaseVar('leadership_exp', 1); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->checkStatChange(); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general); $general->applyDB($db); diff --git a/hwe/sammo/Command/General/휴식.php b/hwe/sammo/Command/General/휴식.php index 8dcba62c..d077cfc7 100644 --- a/hwe/sammo/Command/General/휴식.php +++ b/hwe/sammo/Command/General/휴식.php @@ -6,6 +6,7 @@ use \sammo\Util; use \sammo\JosaUtil; use \sammo\LastTurn; use \sammo\DB; +use sammo\StaticEventHandler; class 휴식 extends Command\GeneralCommand{ static protected $actionName = '휴식'; @@ -39,6 +40,7 @@ class 휴식 extends Command\GeneralCommand{ $logger->pushGeneralActionLog("아무것도 실행하지 않았습니다. <1>$date"); $this->setResultTurn(new LastTurn()); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB(DB::db()); return true; } diff --git a/hwe/sammo/Command/Nation/che_감축.php b/hwe/sammo/Command/Nation/che_감축.php index a54af37b..b01f39c3 100644 --- a/hwe/sammo/Command/Nation/che_감축.php +++ b/hwe/sammo/Command/Nation/che_감축.php @@ -12,7 +12,8 @@ use \sammo\{ MessageTarget, Message, CityConst, - CityHelper + CityHelper, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -201,6 +202,7 @@ class che_감축 extends Command\NationCommand{ $logger->pushGlobalHistoryLog("【감축】{$nationName}{$josaYiNation} {$destCityName}{$josaUl} 감축하였습니다."); $general->increaseInheritancePoint(InheritanceKey::active_action, 1); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); $general->applyDB($db); diff --git a/hwe/sammo/Command/Nation/che_국기변경.php b/hwe/sammo/Command/Nation/che_국기변경.php index 5bea215e..528d8d18 100644 --- a/hwe/sammo/Command/Nation/che_국기변경.php +++ b/hwe/sammo/Command/Nation/che_국기변경.php @@ -12,6 +12,7 @@ use function \sammo\GetNationColors; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; +use sammo\StaticEventHandler; class che_국기변경 extends Command\NationCommand { @@ -136,6 +137,7 @@ class che_국기변경 extends Command\NationCommand $logger->pushGlobalHistoryLog("【국기변경】{$nationName}{$josaYiNation} 국기를 변경하였습니다."); $general->increaseInheritancePoint(InheritanceKey::active_action, 1); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_국호변경.php b/hwe/sammo/Command/Nation/che_국호변경.php index 10bd40fa..1fe67cd1 100644 --- a/hwe/sammo/Command/Nation/che_국호변경.php +++ b/hwe/sammo/Command/Nation/che_국호변경.php @@ -21,6 +21,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; use sammo\Event\Action; +use sammo\StaticEventHandler; class che_국호변경 extends Command\NationCommand { @@ -154,6 +155,7 @@ class che_국호변경 extends Command\NationCommand $logger->pushGlobalHistoryLog("【국호변경】{$nationName}{$josaYiNation} 국호를 {$newNationName}{$josaRo} 변경합니다."); $general->increaseInheritancePoint(InheritanceKey::active_action, 1); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_급습.php b/hwe/sammo/Command/Nation/che_급습.php index 1f88f386..6b234560 100644 --- a/hwe/sammo/Command/Nation/che_급습.php +++ b/hwe/sammo/Command/Nation/che_급습.php @@ -20,6 +20,7 @@ use function \sammo\getNationStaticInfo; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; +use sammo\StaticEventHandler; class che_급습 extends Command\NationCommand { @@ -191,6 +192,7 @@ class che_급습 extends Command\NationCommand $db->update('diplomacy', [ 'term' => $db->sqleval('`term` - %i', 3), ], '(me = %i AND you = %i) OR (you = %i AND me = %i)', $nationID, $destNationID, $nationID, $destNationID); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->applyDB($db); diff --git a/hwe/sammo/Command/Nation/che_몰수.php b/hwe/sammo/Command/Nation/che_몰수.php index 9658a6ff..6d5fe172 100644 --- a/hwe/sammo/Command/Nation/che_몰수.php +++ b/hwe/sammo/Command/Nation/che_몰수.php @@ -21,6 +21,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; use sammo\Enums\MessageType; +use sammo\StaticEventHandler; class che_몰수 extends Command\NationCommand { @@ -212,6 +213,7 @@ class che_몰수 extends Command\NationCommand $logger->pushGeneralActionLog("{$destGeneral->getName()}에게서 {$resName} $amountText{$josaUl} 몰수했습니다. <1>$date"); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destGeneral->applyDB($db); diff --git a/hwe/sammo/Command/Nation/che_무작위수도이전.php b/hwe/sammo/Command/Nation/che_무작위수도이전.php index 42f6f324..286280c7 100644 --- a/hwe/sammo/Command/Nation/che_무작위수도이전.php +++ b/hwe/sammo/Command/Nation/che_무작위수도이전.php @@ -20,6 +20,7 @@ use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; use sammo\Event\Action; use sammo\Json; +use sammo\StaticEventHandler; class che_무작위수도이전 extends Command\NationCommand { @@ -159,6 +160,7 @@ class che_무작위수도이전 extends Command\NationCommand $logger->pushGlobalHistoryLog("【무작위 수도 이전】{$nationName}{$josaYiNation} {$destCityName}{$josaRo} 수도 이전하였습니다."); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; } diff --git a/hwe/sammo/Command/Nation/che_물자원조.php b/hwe/sammo/Command/Nation/che_물자원조.php index 8f9ba797..434585f5 100644 --- a/hwe/sammo/Command/Nation/che_물자원조.php +++ b/hwe/sammo/Command/Nation/che_물자원조.php @@ -15,6 +15,7 @@ use \sammo\{ Command, Json, KVStorage, + StaticEventHandler, StringUtil }; @@ -255,6 +256,7 @@ class che_물자원조 extends Command\NationCommand $general->addExperience(5); $general->addDedication(5); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->applyDB($db); diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index 7917f796..40671ce4 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -14,6 +14,7 @@ use \sammo\{ GameUnitConst, CityConst, Command, + StaticEventHandler, TimeUtil }; @@ -167,6 +168,7 @@ class che_발령 extends Command\NationCommand $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->applyDB($db); $destGeneral->applyDB($db); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); return true; } diff --git a/hwe/sammo/Command/Nation/che_백성동원.php b/hwe/sammo/Command/Nation/che_백성동원.php index 581f08b4..1c82afa2 100644 --- a/hwe/sammo/Command/Nation/che_백성동원.php +++ b/hwe/sammo/Command/Nation/che_백성동원.php @@ -15,7 +15,8 @@ use \sammo\{ Command, MessageTarget, Message, - CityConst + CityConst, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -164,6 +165,7 @@ class che_백성동원 extends Command\NationCommand ], 'nation=%i', $nationID); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_불가침수락.php b/hwe/sammo/Command/Nation/che_불가침수락.php index 2056900d..73353202 100644 --- a/hwe/sammo/Command/Nation/che_불가침수락.php +++ b/hwe/sammo/Command/Nation/che_불가침수락.php @@ -24,6 +24,7 @@ use sammo\Enums\GeneralQueryMode; use sammo\Json; use sammo\KVStorage; use sammo\RandUtil; +use sammo\StaticEventHandler; class che_불가침수락 extends Command\NationCommand { @@ -224,6 +225,7 @@ class che_불가침수락 extends Command\NationCommand $destLogger->pushGeneralActionLog("{$nationName}{$josaWa} $year년 {$month}월까지 불가침에 성공했습니다.", ActionLogger::PLAIN); $destLogger->pushGeneralHistoryLog("{$nationName}{$josaWa} {$year}년 {$month}월까지 불가침 성공"); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_불가침제의.php b/hwe/sammo/Command/Nation/che_불가침제의.php index f01583fd..47f2b960 100644 --- a/hwe/sammo/Command/Nation/che_불가침제의.php +++ b/hwe/sammo/Command/Nation/che_불가침제의.php @@ -23,6 +23,7 @@ use function \sammo\getNationStaticInfo; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\MessageType; +use sammo\StaticEventHandler; class che_불가침제의 extends Command\NationCommand { @@ -220,6 +221,7 @@ class che_불가침제의 extends Command\NationCommand $msg->send(); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_불가침파기수락.php b/hwe/sammo/Command/Nation/che_불가침파기수락.php index 4b5efebe..782f3678 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기수락.php +++ b/hwe/sammo/Command/Nation/che_불가침파기수락.php @@ -22,6 +22,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; use sammo\RandUtil; +use sammo\StaticEventHandler; class che_불가침파기수락 extends Command\NationCommand { @@ -173,6 +174,7 @@ class che_불가침파기수락 extends Command\NationCommand $destLogger->pushGeneralActionLog("{$nationName}{$josaWa}의 불가침 파기에 성공했습니다.", ActionLogger::PLAIN); $destLogger->pushGeneralHistoryLog("{$nationName}{$josaWa}의 불가침 파기 성공"); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_불가침파기제의.php b/hwe/sammo/Command/Nation/che_불가침파기제의.php index a1749775..20b55fe1 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기제의.php +++ b/hwe/sammo/Command/Nation/che_불가침파기제의.php @@ -12,6 +12,7 @@ use \sammo\{ MessageTarget, DiplomaticMessage, Message, + StaticEventHandler, }; use function \sammo\getAllNationStaticInfo; @@ -166,6 +167,7 @@ class che_불가침파기제의 extends Command\NationCommand{ $msg->send(); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_선전포고.php b/hwe/sammo/Command/Nation/che_선전포고.php index 3609fbfc..53a396a7 100644 --- a/hwe/sammo/Command/Nation/che_선전포고.php +++ b/hwe/sammo/Command/Nation/che_선전포고.php @@ -22,6 +22,7 @@ use function \sammo\GetImageURL; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\MessageType; +use sammo\StaticEventHandler; class che_선전포고 extends Command\NationCommand { @@ -188,6 +189,7 @@ class che_선전포고 extends Command\NationCommand $msg->send(); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_수몰.php b/hwe/sammo/Command/Nation/che_수몰.php index 62ca5cbd..065b0c7c 100644 --- a/hwe/sammo/Command/Nation/che_수몰.php +++ b/hwe/sammo/Command/Nation/che_수몰.php @@ -15,7 +15,8 @@ use \sammo\{ Command, MessageTarget, Message, - CityConst + CityConst, + StaticEventHandler }; use function \sammo\getNationStaticInfo; @@ -191,6 +192,7 @@ class che_수몰 extends Command\NationCommand ], 'nation=%i', $nationID); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_의병모집.php b/hwe/sammo/Command/Nation/che_의병모집.php index 94f0e2f9..1ff99924 100644 --- a/hwe/sammo/Command/Nation/che_의병모집.php +++ b/hwe/sammo/Command/Nation/che_의병모집.php @@ -15,7 +15,7 @@ use \sammo\KVStorage; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; - +use sammo\StaticEventHandler; class che_의병모집 extends Command\NationCommand { @@ -170,6 +170,7 @@ class che_의병모집 extends Command\NationCommand ], 'nation=%i', $nationID); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_이호경식.php b/hwe/sammo/Command/Nation/che_이호경식.php index ff6772d6..d0174426 100644 --- a/hwe/sammo/Command/Nation/che_이호경식.php +++ b/hwe/sammo/Command/Nation/che_이호경식.php @@ -20,6 +20,7 @@ use function \sammo\getNationStaticInfo; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; +use sammo\StaticEventHandler; class che_이호경식 extends Command\NationCommand { @@ -193,6 +194,7 @@ class che_이호경식 extends Command\NationCommand $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_종전수락.php b/hwe/sammo/Command/Nation/che_종전수락.php index c2b6c933..71b82133 100644 --- a/hwe/sammo/Command/Nation/che_종전수락.php +++ b/hwe/sammo/Command/Nation/che_종전수락.php @@ -16,6 +16,7 @@ use \sammo\{ MessageTarget, DiplomaticMessage, Message, + StaticEventHandler, }; use function \sammo\getNationStaticInfo; @@ -188,6 +189,7 @@ class che_종전수락 extends Command\NationCommand $destLogger->pushNationalHistoryLog("{$nationName}{$josaWa} 종전"); $general->applyDB($db); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $destLogger->flush(); return true; diff --git a/hwe/sammo/Command/Nation/che_종전제의.php b/hwe/sammo/Command/Nation/che_종전제의.php index dc33f544..88ffc4b5 100644 --- a/hwe/sammo/Command/Nation/che_종전제의.php +++ b/hwe/sammo/Command/Nation/che_종전제의.php @@ -12,6 +12,7 @@ use \sammo\{ MessageTarget, DiplomaticMessage, Message, + StaticEventHandler, }; use function \sammo\getAllNationStaticInfo; @@ -164,6 +165,7 @@ class che_종전제의 extends Command\NationCommand{ $msg->send(); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destLogger->flush(); diff --git a/hwe/sammo/Command/Nation/che_증축.php b/hwe/sammo/Command/Nation/che_증축.php index 84cfbee5..535869c9 100644 --- a/hwe/sammo/Command/Nation/che_증축.php +++ b/hwe/sammo/Command/Nation/che_증축.php @@ -11,7 +11,8 @@ use \sammo\{ Command, MessageTarget, Message, - CityConst + CityConst, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -193,6 +194,7 @@ class che_증축 extends Command\NationCommand{ $logger->pushGlobalHistoryLog("【증축】{$nationName}{$josaYiNation} {$destCityName}{$josaUl} 증축하였습니다."); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_천도.php b/hwe/sammo/Command/Nation/che_천도.php index f9a85165..fa59868c 100644 --- a/hwe/sammo/Command/Nation/che_천도.php +++ b/hwe/sammo/Command/Nation/che_천도.php @@ -19,6 +19,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; use sammo\Event\Action; +use sammo\StaticEventHandler; class che_천도 extends Command\NationCommand { @@ -228,6 +229,7 @@ class che_천도 extends Command\NationCommand $logger->pushGlobalHistoryLog("【천도】{$nationName}{$josaYiNation} {$destCityName}{$josaRo} 천도하였습니다."); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; } diff --git a/hwe/sammo/Command/Nation/che_초토화.php b/hwe/sammo/Command/Nation/che_초토화.php index 8c8d39cb..7b7f5175 100644 --- a/hwe/sammo/Command/Nation/che_초토화.php +++ b/hwe/sammo/Command/Nation/che_초토화.php @@ -12,7 +12,8 @@ use \sammo\{ MessageTarget, Message, CityConst, - CityInitialDetail + CityInitialDetail, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -196,6 +197,7 @@ class che_초토화 extends Command\NationCommand{ $logger->pushGlobalHistoryLog("【초토화】{$nationName}{$josaYiNation} {$destCityName}{$josaUl} 초토화하였습니다."); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; } diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index 73791692..15aa8a57 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -16,6 +16,7 @@ use \sammo\Command; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\GeneralQueryMode; +use sammo\StaticEventHandler; class che_포상 extends Command\NationCommand { @@ -174,6 +175,7 @@ class che_포상 extends Command\NationCommand $logger->pushGeneralActionLog("{$destGeneral->getName()}에게 {$resName} $amountText{$josaUl} 수여했습니다. <1>$date"); $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); $destGeneral->applyDB($db); diff --git a/hwe/sammo/Command/Nation/che_피장파장.php b/hwe/sammo/Command/Nation/che_피장파장.php index 8400ff41..810c499a 100644 --- a/hwe/sammo/Command/Nation/che_피장파장.php +++ b/hwe/sammo/Command/Nation/che_피장파장.php @@ -15,7 +15,8 @@ use \sammo\{ Command, KVStorage, Message, - MessageTarget + MessageTarget, + StaticEventHandler }; use function \sammo\buildNationCommandClass; @@ -240,6 +241,7 @@ class che_피장파장 extends Command\NationCommand $destDelay = max($destNationStor->getValue($cmd->getNextExecuteKey()) ?? 0, $yearMonth); $destNationStor->setValue($cmd->getNextExecuteKey(), $destDelay + static::$delayCnt); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_필사즉생.php b/hwe/sammo/Command/Nation/che_필사즉생.php index ed7662f1..869815e9 100644 --- a/hwe/sammo/Command/Nation/che_필사즉생.php +++ b/hwe/sammo/Command/Nation/che_필사즉생.php @@ -10,7 +10,8 @@ use \sammo\{ GameUnitConst, Command, MessageTarget, - Message + Message, + StaticEventHandler }; use \sammo\Constraint\Constraint; @@ -121,6 +122,7 @@ class che_필사즉생 extends Command\NationCommand{ ], 'nation=%i', $nationID); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/che_허보.php b/hwe/sammo/Command/Nation/che_허보.php index c0b1ff38..98ec152f 100644 --- a/hwe/sammo/Command/Nation/che_허보.php +++ b/hwe/sammo/Command/Nation/che_허보.php @@ -21,6 +21,7 @@ use function \sammo\getNationStaticInfo; use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Event\Action; +use sammo\StaticEventHandler; class che_허보 extends Command\NationCommand { @@ -194,6 +195,7 @@ class che_허보 extends Command\NationCommand ], 'nation=%i', $nationID); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; diff --git a/hwe/sammo/Command/Nation/cr_인구이동.php b/hwe/sammo/Command/Nation/cr_인구이동.php index 52be4a72..02f6df40 100644 --- a/hwe/sammo/Command/Nation/cr_인구이동.php +++ b/hwe/sammo/Command/Nation/cr_인구이동.php @@ -19,6 +19,7 @@ use \sammo\Constraint\Constraint; use \sammo\Constraint\ConstraintHelper; use sammo\Enums\InheritanceKey; use sammo\Event\Action; +use sammo\StaticEventHandler; class cr_인구이동 extends Command\NationCommand { @@ -179,6 +180,7 @@ class cr_인구이동 extends Command\NationCommand $logger->pushGeneralActionLog("{$destCityName}{$josaRo} 인구 {$amount}명을 옮겼습니다. <1>$date"); $this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); $general->applyDB($db); return true; } diff --git a/hwe/sammo/Command/Nation/휴식.php b/hwe/sammo/Command/Nation/휴식.php index 4f5af13c..4ffaba79 100644 --- a/hwe/sammo/Command/Nation/휴식.php +++ b/hwe/sammo/Command/Nation/휴식.php @@ -5,6 +5,7 @@ use \sammo\Command; use \sammo\Util; use \sammo\JosaUtil; use sammo\LastTurn; +use sammo\StaticEventHandler; class 휴식 extends Command\NationCommand{ static protected $actionName = '휴식'; @@ -33,6 +34,7 @@ class 휴식 extends Command\NationCommand{ public function run(\Sammo\RandUtil $rng):bool{ $this->setResultTurn(new LastTurn(static::getName(), $this->arg)); + StaticEventHandler::handleEvent($this->generalObj, $this->destGeneralObj, $this::class, $this->env, $this->arg); return true; } } \ No newline at end of file diff --git a/hwe/sammo/StaticEvent/event_부대발령즉시집합.php b/hwe/sammo/StaticEvent/event_부대발령즉시집합.php index f144fa49..488a6dff 100644 --- a/hwe/sammo/StaticEvent/event_부대발령즉시집합.php +++ b/hwe/sammo/StaticEvent/event_부대발령즉시집합.php @@ -12,17 +12,13 @@ use sammo\JosaUtil; class event_부대발령즉시집합 extends \sammo\BaseStaticEvent { - function run(General $general, array $env, array $params): bool | string + function run(GeneralLite|General $general, null|GeneralLite|General $destGeneral, array $env, array $params): bool | string { - $destGeneralID = $params['destGeneralID'] ?? null; - if ($destGeneralID === null) { - return "destGeneralID is null"; - } - if (!is_int($destGeneralID)) { - return "destGeneralID is not int"; + if($destGeneral === null){ + return "destGeneral is null"; } - $destCityID = $params['city'] ?? null; + $destCityID = $params['destCityID'] ?? null; if ($destCityID === null) { return "destCityID is null"; } @@ -30,21 +26,11 @@ class event_부대발령즉시집합 extends \sammo\BaseStaticEvent return "destCityID is not int"; } - $destGeneral = GeneralLite::createObjFromDB($destGeneralID, ['nation', 'city', 'troop'], GeneralLiteQueryMode::Core); - if ($destGeneral === null) { - return "destGeneral is null"; - } - if($destGeneral->getID() !== $destGeneral->getVar('troop')){ //부대장 발령이 아니므로 무시 return true; } - if($destGeneral->getCityID() === $destCityID){ - //이미 제자리이므로 무시 - return true; - } - if($destGeneral->getNationID() !== $general->getNationID()){ return "destGeneral is not same nation"; } @@ -56,8 +42,7 @@ class event_부대발령즉시집합 extends \sammo\BaseStaticEvent $troopID = $destGeneral->getID(); $troopName = $db->queryFirstField('SELECT name FROM troop WHERE troop_leader = %i', $troopID); - - $generalList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city!=%i AND troop=%i AND no!=%i', $general->getNationID(), $destCityID, $troopID, $general->getID()); + $generalList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city!=%i AND troop=%i AND no!=%i', $destGeneral->getNationID(), $destCityID, $troopID, $destGeneral->getID()); if($generalList){ $db->update('general', [ 'city'=>$destCityID @@ -69,9 +54,6 @@ class event_부대발령즉시집합 extends \sammo\BaseStaticEvent $targetLogger->flush(); } - $general->setVar('city', $destGeneral->getCityID()); - $general->applyDB(DB::db()); - return true; } } diff --git a/hwe/sammo/StaticEvent/event_부대탑승즉시이동.php b/hwe/sammo/StaticEvent/event_부대탑승즉시이동.php index 34472362..6a8523cc 100644 --- a/hwe/sammo/StaticEvent/event_부대탑승즉시이동.php +++ b/hwe/sammo/StaticEvent/event_부대탑승즉시이동.php @@ -9,7 +9,7 @@ use sammo\GeneralLite; class event_부대탑승즉시이동 extends \sammo\BaseStaticEvent { - function run(General $general, array $env, array $params): bool | string + function run(GeneralLite|General $general, null|GeneralLite|General $destGeneral, array $env, array $params): bool | string { $troopID = $params['troopID'] ?? null; diff --git a/hwe/sammo/StaticEventHandler.php b/hwe/sammo/StaticEventHandler.php index d0db0970..b6cf904a 100644 --- a/hwe/sammo/StaticEventHandler.php +++ b/hwe/sammo/StaticEventHandler.php @@ -1,18 +1,25 @@ run($general, $destGeneral, $env, ...$params); + } } -} \ No newline at end of file +}