예약턴 바로 받아오도록 수정

This commit is contained in:
2020-05-08 20:14:20 +09:00
parent c46d9fd04a
commit 541de612b2
3 changed files with 7 additions and 14 deletions
+1
View File
@@ -62,6 +62,7 @@ class che_첩보 extends Command\GeneralCommand
$this->minConditionConstraints = [
ConstraintHelper::ReqGeneralGold($reqGold),
ConstraintHelper::ReqGeneralRice($reqRice),
ConstraintHelper::NotBeNeutral(),
];
}
+4 -4
View File
@@ -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;
+2 -10
View File
@@ -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){