From 0904d17a5fed88441deb3b044da5c0f6842dd306 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 18 Sep 2018 00:36:05 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=91=ED=95=A9=EC=9E=A5=20=EB=93=B1?= =?UTF-8?q?=EC=9E=A5=20=EC=88=98=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_gamerule.php | 62 +++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 435361ed..5757b00e 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -1020,37 +1020,41 @@ function updateNationState() { break; } + $lastAssemblerID = $gameStor->assemblerID??0; - foreach(range($nation['level'] + 1, $nationLevel) as $levelGen){ - $lastAssemblerID += 1; - - $npcObj = new Scenario\NPC( - 999, '집합장'.$lastAssemblerID, null, $nation['nation'], $nation['capital'], - 10, 10, 10, 1, $admin['year'] - 15, $admin['year'] + 15, 10, 75 - ); - $npcObj->npc = 5; - $npcObj->build(); - $npcID = $npcObj->generalID; + $jumpStep = $nationLevel - max(1, $nation['level']); + if($jumpStep > 0){ + foreach(range(1, $jumpStep) as $levelGen){ + $lastAssemblerID += 1; + + $npcObj = new Scenario\NPC( + 999, '집합장'.$lastAssemblerID, null, $nation['nation'], $nation['capital'], + 10, 10, 10, 1, $admin['year'] - 15, $admin['year'] + 15, 10, 75 + ); + $npcObj->npc = 5; + $npcObj->build(); + $npcID = $npcObj->generalID; - $db->insert('troop', [ - 'name'=>$npcObj->realName, - 'nation'=>$nation['nation'], - 'no'=>$npcID - ]); - $troopID = $db->insertId(); - - $command = EncodeCommand(0, 0, 0, 26); //집합 - $db->update('general', [ - 'troop'=>$troopID, - 'turn0'=>$command, - 'turn1'=>$command, - 'turn2'=>$command, - 'turn3'=>$command, - 'turn4'=>$command, - 'turn5'=>$command, - 'killturn'=>80 - ], 'no=%i', $npcID); - + $db->insert('troop', [ + 'name'=>$npcObj->realName, + 'nation'=>$nation['nation'], + 'no'=>$npcID + ]); + $troopID = $db->insertId(); + + $command = EncodeCommand(0, 0, 0, 26); //집합 + $db->update('general', [ + 'troop'=>$troopID, + 'turn0'=>$command, + 'turn1'=>$command, + 'turn2'=>$command, + 'turn3'=>$command, + 'turn4'=>$command, + 'turn5'=>$command, + 'killturn'=>80 + ], 'no=%i', $npcID); + + } } $gameStor->assemberlID = $lastAssemblerID;