diff --git a/hwe/func.php b/hwe/func.php index adae4f2f..0dbc7e78 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -149,7 +149,7 @@ function getRandGenName(RandUtil $rng) -function cityInfo(General $generalObj) +function cityInfo(GeneralLite $generalObj) { $db = DB::db(); @@ -1721,7 +1721,6 @@ function deleteNation(General $lord, bool $applyDB): array $lordID ), ['npc', 'owner', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'belong', 'aux'], - GeneralQueryMode::Lite, ); $nationGeneralList[$lordID] = $lord; diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php index 22086dd8..bd1086b4 100644 --- a/hwe/func_time_event.php +++ b/hwe/func_time_event.php @@ -364,7 +364,14 @@ function disaster(RandUtil $rng) { $logger->flush(); if (!$isGood) { - $generalListByCity = Util::arrayGroupBy($db->query('SELECT no, name, nation, city, officer_level, injury, leadership, strength, intel, horse, weapon, book, item, crew, crewtype, atmos, train, special, special2 FROM general WHERE city IN %li', Util::squeezeFromArray($targetCityList, 'city')), 'city'); + [$queryColumns,,] = General::mergeQueryColumn(); + $generalListByCity = Util::arrayGroupBy( + $db->query( + 'SELECT %l FROM general WHERE city IN %li', + Util::formatListOfBackticks($queryColumns), + Util::squeezeFromArray($targetCityList, 'city') + ), + 'city'); //NOTE: 쿼리 1번이지만 복잡하기 vs 쿼리 여러번이지만 조금 더 깔끔하기 foreach ($targetCityList as $city) { $affectRatio = Util::valueFit($city['secu'] / $city['secu_max'] / 0.8, 0, 1); diff --git a/hwe/process_war.php b/hwe/process_war.php index c7789a69..1d65d37c 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -599,7 +599,7 @@ function ConquerCity(array $admin, General $general, array $city) Util::formatListOfBackticks(General::mergeQueryColumn(['npc', 'gold', 'rice', 'experience', 'explevel', 'belong', 'dedication', 'dedlevel', 'aux'], GeneralQueryMode::Lite)[0]), $defenderNationID, 12 - ), null, null, $city, $loseNation, $year, $month, false); + ), null, null, $city, $loseNation, $year, $month); $josaUl = JosaUtil::pick($defenderNationName, '을'); $attackerLogger->pushNationalHistoryLog("{$defenderNationName}{$josaUl} 정복"); diff --git a/hwe/sammo/AutorunNationPolicy.php b/hwe/sammo/AutorunNationPolicy.php index 86748efa..3323041d 100644 --- a/hwe/sammo/AutorunNationPolicy.php +++ b/hwe/sammo/AutorunNationPolicy.php @@ -179,7 +179,7 @@ class AutorunNationPolicy { 'cureThreshold'=>10, ]; - function __construct(General $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env) + function __construct(GeneralLite $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env) { foreach(static::$defaultPolicy as $policy=>$value){ $this->{$policy} = $value; diff --git a/hwe/v_NPCControl.php b/hwe/v_NPCControl.php index c9307359..59946efd 100644 --- a/hwe/v_NPCControl.php +++ b/hwe/v_NPCControl.php @@ -43,7 +43,7 @@ $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']); $gameStor->cacheAll(); -$general = new General($me, null, null, null, $nation, $gameStor->year, $gameStor->month, false); +$general = General::createGeneralObjFromDB($me['no']); $rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? []; $rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? [];