버그 수정

This commit is contained in:
2019-04-21 15:41:02 +09:00
parent 2765e1c923
commit 9ad8d70cf7
9 changed files with 32 additions and 14 deletions
+4 -7
View File
@@ -65,10 +65,7 @@ class TurnExecutionHelper
return true;
}
public function processNationCommand(string $commandClassName, array $commandArg, LastTurn $commandLast):LastTurn{
if(!$this->nationTurn){
throw new \InvalidArgumentException('nationTurn이 없음');
}
public function processNationCommand(string $commandClassName, ?array $commandArg, LastTurn $commandLast):LastTurn{
$general = $this->getGeneral();
$db = DB::db();
@@ -233,7 +230,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
if($general->getVar('nation') != 0 && $general->getVar('level') >= 5){
$nationStor = KVStorage::getStorage($db, 'nation_env');
$lastNationTurnKey = "turn_last_{$general->getVar('nation')}_{$general->getVar('level')}";
$lastNationTurn = $nationStor->getValue($lastNationTurnKey)??[];
$lastNationTurn = $nationStor->getValue($lastNationTurnKey);
//수뇌 몇 없는데 매번 left join 하는건 낭비인것 같다.
$rawNationTurn = Json::decode($db->queryFirstRow(
'SELECT action, arg FROM nation_turn WHERE nation_id = %i AND level = %i AND turn_idx =0',
@@ -242,7 +239,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
))??[];
$hasNationTurn = true;
$nationCommand = $rawNationTurn['action'];
$nationArg = Json::decode($rawNationTurn['arg']);
$nationArg = Json::decode($rawNationTurn['arg']??null);
}
if($general->getVar('npc') >= 2){
@@ -261,7 +258,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
$resultNationTurn = $turnObj->processNationCommand(
$nationCommand,
$nationArg,
$lastNationTurn
LastTurn::fromJson($lastNationTurn)
);
$nationStor->setValue($lastNationTurnKey, $resultNationTurn->toJson());
}