From 541de612b2a165f55f73c30d499b60bec49cd512 Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 8 May 2020 20:14:20 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=88=EC=95=BD=ED=84=B4=20=EB=B0=94?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=9B=EC=95=84=EC=98=A4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_첩보.php | 1 + hwe/sammo/General.php | 8 ++++---- hwe/sammo/TurnExecutionHelper.php | 12 ++---------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index 17d94273..53fc3bef 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -62,6 +62,7 @@ class che_첩보 extends Command\GeneralCommand $this->minConditionConstraints = [ ConstraintHelper::ReqGeneralGold($reqGold), ConstraintHelper::ReqGeneralRice($reqRice), + ConstraintHelper::NotBeNeutral(), ]; } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 87de075c..3514c503 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -305,7 +305,7 @@ class General implements iAction{ if(!$rawCmd){ return buildGeneralCommandClass(null, $this, $env); } - return buildGeneralCommandClass($rawCmd['action'], $this, $env, $rawCmd['arg']); + return buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null)); } /** @@ -340,7 +340,7 @@ class General implements iAction{ } foreach($rawCmds as $turnIdx=>$rawCmd){ - $result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, $rawCmd['arg']); + $result[$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $this, $env, Json::decode($rawCmd['arg']??null)); } return $result; @@ -1073,7 +1073,7 @@ class General implements iAction{ continue; } $rawCmd = $rawCmds[$generalID]; - $result[$generalID] = buildGeneralCommandClass($rawCmd['action'], $general, $env, $rawCmd['arg']); + $result[$generalID] = buildGeneralCommandClass($rawCmd['action'], $general, $env, Json::decode($rawCmd['arg'])); } return $result; } @@ -1127,7 +1127,7 @@ class General implements iAction{ continue; } foreach($orderedRawCmds[$generalID] as $turnIdx=>$rawCmd){ - $result[$generalID][$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $general, $env, $rawCmd['arg']); + $result[$generalID][$turnIdx] = buildGeneralCommandClass($rawCmd['action'], $general, $env, Json::decode($rawCmd['arg'])); } } return $result; diff --git a/hwe/sammo/TurnExecutionHelper.php b/hwe/sammo/TurnExecutionHelper.php index b17baf82..2c33ec10 100644 --- a/hwe/sammo/TurnExecutionHelper.php +++ b/hwe/sammo/TurnExecutionHelper.php @@ -215,10 +215,7 @@ class TurnExecutionHelper static public function executeGeneralCommandUntil(string $date, \DateTimeInterface $limitActionTime, int $year, int $month){ $db = DB::db(); $generalsTodo = $db->query( - 'SELECT no,name,turntime,killturn,block,npc,deadyear, -general_turn.`action` AS `action`, general_turn.arg AS arg -FROM general LEFT JOIN general_turn ON general.`no` = general_turn.general_id AND turn_idx = 0 -WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', + 'SELECT no,name,turntime,killturn,block,npc,deadyear FROM general WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', $date ); @@ -228,11 +225,6 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', $autorun_user = $gameStor->autorun_user; foreach($generalsTodo as $rawGeneral){ - $generalCommand = $rawGeneral['action']; - $generalArg = Json::decode($rawGeneral['arg'])??[]; - unset($rawGeneral['action']); - unset($rawGeneral['arg']); - $currActionTime = new \DateTimeImmutable(); if($currActionTime > $limitActionTime){ return [true, $currentTurn]; @@ -242,7 +234,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC', $turnObj = new static($general); $env = $gameStor->getAll(true); - $generalCommandObj = buildGeneralCommandClass($generalCommand, $general, $env, $generalArg); + $generalCommandObj = $general->getReservedTurn(0, $env); $hasNationTurn = false; if($general->getVar('nation') != 0 && $general->getVar('officer_level') >= 5){