forked from devsam/core
fix: 대규모 이민족 소환 중단을 방지한다
This commit is contained in:
@@ -100,6 +100,17 @@ class RaiseInvader extends \sammo\Event\Action
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function run(array $env)
|
public function run(array $env)
|
||||||
|
{
|
||||||
|
$previousIgnoreUserAbort = ignore_user_abort(true);
|
||||||
|
try {
|
||||||
|
return $this->runToCompletion($env);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
ignore_user_abort($previousIgnoreUserAbort !== 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function runToCompletion(array $env)
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
@@ -196,6 +207,7 @@ class RaiseInvader extends \sammo\Event\Action
|
|||||||
], true);
|
], true);
|
||||||
|
|
||||||
$invaderNationIDList = [];
|
$invaderNationIDList = [];
|
||||||
|
$env = GeneralBuilder::prepareEnvironment($env);
|
||||||
refreshNationStaticInfo();
|
refreshNationStaticInfo();
|
||||||
foreach ($cities as $cityObj) {
|
foreach ($cities as $cityObj) {
|
||||||
if ($cityObj->level != 4) {
|
if ($cityObj->level != 4) {
|
||||||
|
|||||||
@@ -539,11 +539,8 @@ class GeneralBuilder{
|
|||||||
return $this->death;
|
return $this->death;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function build($env){
|
public static function prepareEnvironment(array $env): array
|
||||||
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(!key_exists('stored_icons', $env)){
|
if(!key_exists('stored_icons', $env)){
|
||||||
try{
|
try{
|
||||||
$text = \file_get_contents(\sammo\ServConfig::getSharedIconPath('../hook/list.json?1'));
|
$text = \file_get_contents(\sammo\ServConfig::getSharedIconPath('../hook/list.json?1'));
|
||||||
@@ -556,6 +553,16 @@ class GeneralBuilder{
|
|||||||
$env['stored_icons'] = $storedIcons;
|
$env['stored_icons'] = $storedIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $env;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build($env){
|
||||||
|
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$env = static::prepareEnvironment($env);
|
||||||
|
|
||||||
$isFictionMode = (Util::array_get($env['fiction'], 0)!=0);
|
$isFictionMode = (Util::array_get($env['fiction'], 0)!=0);
|
||||||
|
|
||||||
$year = $env['year'];
|
$year = $env['year'];
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ require_once __DIR__ . '/../hwe/sammo/Scenario/GeneralBuilder.php';
|
|||||||
|
|
||||||
final class ScenarioGeneralBuilderSpecialTest extends TestCase
|
final class ScenarioGeneralBuilderSpecialTest extends TestCase
|
||||||
{
|
{
|
||||||
|
public function testPreparedStoredIconsAreReusedWithoutChangingTheEnvironment(): void
|
||||||
|
{
|
||||||
|
$environment = [
|
||||||
|
'stored_icons' => ['.' => ['default.jpg']],
|
||||||
|
'icon_path' => '.',
|
||||||
|
];
|
||||||
|
|
||||||
|
self::assertSame($environment, GeneralBuilder::prepareEnvironment($environment));
|
||||||
|
}
|
||||||
|
|
||||||
public function testAsiaPossessionScenarioWarSpecialsUseWarSlot(): void
|
public function testAsiaPossessionScenarioWarSpecialsUseWarSlot(): void
|
||||||
{
|
{
|
||||||
$scenario = json_decode(
|
$scenario = json_decode(
|
||||||
|
|||||||
Reference in New Issue
Block a user