From ad233985920e6d420f9f75119e9f20b8f6daa85c Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sun, 30 Jul 2023 13:39:32 +0000 Subject: [PATCH] =?UTF-8?q?refac:=20General=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=20=EB=B3=80=EA=B2=BD=20-=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=ED=95=9C=20GeneralQueryMode=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20Lite=EA=B0=80=20=EB=B6=88=EA=B0=80=EB=8A=A5=20-=20L?= =?UTF-8?q?ite=EC=97=AC=EB=8F=84=20=EB=90=9C=EB=8B=A4=EB=A9=B4=20GeneralLi?= =?UTF-8?q?te=20=ED=81=B4=EB=9E=98=EC=8A=A4=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20-=20=EA=B7=B8=EB=A0=87=EC=A7=80=20=EC=95=8A=EB=8B=A4?= =?UTF-8?q?=EB=A9=B4=20General=20=ED=81=B4=EB=9E=98=EC=8A=A4=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20-=20=EB=82=B4=EB=B6=80=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EC=96=B4=EB=96=A0=ED=95=9C=20=EC=97=B0=EC=82=B0=EC=9D=84=20?= =?UTF-8?q?=ED=95=A0=20=EC=A7=80=20=EC=95=8C=20=EC=88=98=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=EB=8D=B0,=20=20=20=EA=B5=AC=ED=98=84=20=EC=8B=9C?= =?UTF-8?q?=EC=A0=90=EC=97=90=EC=84=9C=20=ED=8E=B8=EC=9D=98=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=9D=BC=20column=20=EC=97=AC=EB=B6=80=EA=B0=80=20?= =?UTF-8?q?=EC=B0=A8=EC=9D=B4=EB=82=98=EB=A9=B4=20=20=20=EC=9D=B4=ED=9B=84?= =?UTF-8?q?=EC=97=90=20=EB=AC=B8=EC=A0=9C=EA=B0=80=20=EB=90=A0=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EC=9D=8C=20-=20=EC=97=94=EC=A7=84=EC=9D=B4=20?= =?UTF-8?q?=EC=82=B4=EC=A7=9D=20=EB=AC=B4=EA=B1=B0=EC=9B=8C=20=EC=A7=88=20?= =?UTF-8?q?=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EB=B3=B4=EC=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/process_war.php | 2 +- hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php | 2 +- hwe/sammo/API/Nation/GeneralList.php | 4 +++- hwe/sammo/API/Nation/GetNationInfo.php | 2 +- hwe/sammo/API/NationCommand/GetReservedCommand.php | 2 +- hwe/sammo/API/Vote/AddComment.php | 4 +++- hwe/sammo/Betting.php | 2 +- hwe/sammo/Command/General/che_선양.php | 2 +- hwe/sammo/Command/General/che_장수대상임관.php | 2 +- hwe/sammo/Command/General/che_증여.php | 2 +- hwe/sammo/Command/Nation/che_몰수.php | 2 +- hwe/sammo/Command/Nation/che_발령.php | 2 +- hwe/sammo/Command/Nation/che_불가침수락.php | 2 +- hwe/sammo/Command/Nation/che_불가침파기수락.php | 2 +- hwe/sammo/Command/Nation/che_종전수락.php | 2 +- hwe/sammo/Command/Nation/che_포상.php | 2 +- hwe/sammo/Command/Nation/che_필사즉생.php | 2 +- hwe/sammo/DiplomaticMessage.php | 6 +++--- hwe/sammo/Event/Action/UpdateNationLevel.php | 2 +- 19 files changed, 25 insertions(+), 21 deletions(-) diff --git a/hwe/process_war.php b/hwe/process_war.php index 83a17c7c..444e1370 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -596,7 +596,7 @@ function ConquerCity(array $admin, General $general, array $city) $lord = new General($db->queryFirstRow( 'SELECT %l FROM general WHERE nation = %i AND officer_level = %i LIMIT 1', - Util::formatListOfBackticks(General::mergeQueryColumn(['npc', 'gold', 'rice', 'experience', 'explevel', 'belong', 'dedication', 'dedlevel', 'aux'], GeneralQueryMode::Lite)[0]), + Util::formatListOfBackticks(General::mergeQueryColumn()[0]), $defenderNationID, 12 ), null, null, $city, $loseNation, $year, $month); diff --git a/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php b/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php index 16222fb9..782995f3 100644 --- a/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php +++ b/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php @@ -77,7 +77,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI $inheritMgr = InheritancePointManager::getInstance(); //preveious라서 column을 최대한 비울 수 있다. $remainPoint = $inheritMgr->getInheritancePoint( - General::createObjFromDB($generalID, ['owner'], GeneralQueryMode::Core), + General::createObjFromDB($generalID), InheritanceKey::previous ); diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index 4a740589..dcf25d37 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -5,8 +5,10 @@ namespace sammo\API\Nation; use ArrayObject; use sammo\DB; use sammo\Enums\APIRecoveryType; +use sammo\Enums\GeneralLiteQueryMode; use sammo\Enums\GeneralQueryMode; use sammo\General; +use sammo\GeneralLite; use sammo\Session; use sammo\Util; @@ -165,7 +167,7 @@ class GeneralList extends \sammo\BaseAPI - [$queryColumns, $rankColumns, $accessLogColumns] = General::mergeQueryColumn(array_keys(static::$viewColumns), GeneralQueryMode::Lite); + [$queryColumns, $rankColumns, $accessLogColumns] = GeneralLite::mergeQueryColumn(array_keys(static::$viewColumns), GeneralLiteQueryMode::Lite); $rawGeneralList = Util::convertArrayToDict( $db->query( diff --git a/hwe/sammo/API/Nation/GetNationInfo.php b/hwe/sammo/API/Nation/GetNationInfo.php index be4a3d86..5133bfd0 100644 --- a/hwe/sammo/API/Nation/GetNationInfo.php +++ b/hwe/sammo/API/Nation/GetNationInfo.php @@ -58,7 +58,7 @@ class GetNationInfo extends \sammo\BaseAPI ]; } - $generalObj = General::createObjFromDB($session->generalID, null, GeneralQueryMode::FullWithoutIAction); + $generalObj = General::createObjFromDB($session->generalID); $gameStor = KVStorage::getStorage($db, 'game_env'); $gameEnv = $gameStor->getValues(['year', 'month', 'startyear']); diff --git a/hwe/sammo/API/NationCommand/GetReservedCommand.php b/hwe/sammo/API/NationCommand/GetReservedCommand.php index 2523a05c..660bb252 100644 --- a/hwe/sammo/API/NationCommand/GetReservedCommand.php +++ b/hwe/sammo/API/NationCommand/GetReservedCommand.php @@ -113,7 +113,7 @@ class GetReservedCommand extends \sammo\BaseAPI ]; } - $generalObj = General::createObjFromDB($session->generalID, null, GeneralQueryMode::FullWithoutIAction); + $generalObj = General::createObjFromDB($session->generalID); return [ diff --git a/hwe/sammo/API/Vote/AddComment.php b/hwe/sammo/API/Vote/AddComment.php index 5c386579..40b1899f 100644 --- a/hwe/sammo/API/Vote/AddComment.php +++ b/hwe/sammo/API/Vote/AddComment.php @@ -6,8 +6,10 @@ use DateTimeInterface; use sammo\DB; use sammo\DTO\VoteComment; use sammo\Enums\APIRecoveryType; +use sammo\Enums\GeneralLiteQueryMode; use sammo\Enums\GeneralQueryMode; use sammo\General; +use sammo\GeneralLite; use sammo\Session; use sammo\TimeUtil; use sammo\Validator; @@ -41,7 +43,7 @@ class AddComment extends \sammo\BaseAPI $text = mb_substr($this->args['text'], 0, 200); $generalID = $session->generalID; - $general = General::createObjFromDB($generalID, null, GeneralQueryMode::Core); + $general = GeneralLite::createObjFromDB($generalID, null, GeneralLiteQueryMode::Core); $generalName = $general->getName(); $nationID = $general->getNationID(); $nationName = $general->getStaticNation()['name']; diff --git a/hwe/sammo/Betting.php b/hwe/sammo/Betting.php index 2fab052a..15619fc1 100644 --- a/hwe/sammo/Betting.php +++ b/hwe/sammo/Betting.php @@ -402,7 +402,7 @@ class Betting $userLogger->flush(); } } else { - $generalList = General::createObjListFromDB(array_unique(Util::squeezeFromArray($rewardList, 'generalID')), ['gold', 'npc', 'betgold'], GeneralQueryMode::Lite); + $generalList = General::createObjListFromDB(array_unique(Util::squeezeFromArray($rewardList, 'generalID'))); foreach ($rewardList as $rewardItem) { $gambler = $generalList[$rewardItem['generalID']]; $reward = Util::round($rewardItem['amount']); diff --git a/hwe/sammo/Command/General/che_선양.php b/hwe/sammo/Command/General/che_선양.php index 2c4d4ecf..9c2ec45e 100644 --- a/hwe/sammo/Command/General/che_선양.php +++ b/hwe/sammo/Command/General/che_선양.php @@ -66,7 +66,7 @@ class che_선양 extends Command\GeneralCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], ['gold', 'nation'], GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $this->fullConditionConstraints = [ diff --git a/hwe/sammo/Command/General/che_장수대상임관.php b/hwe/sammo/Command/General/che_장수대상임관.php index f33b8850..5f97b9c9 100644 --- a/hwe/sammo/Command/General/che_장수대상임관.php +++ b/hwe/sammo/Command/General/che_장수대상임관.php @@ -84,7 +84,7 @@ class che_장수대상임관 extends Command\GeneralCommand{ protected function initWithArg() { $destGeneralID = $this->arg['destGeneralID']; - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], ['nation'], GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($destGeneralID); $this->setDestGeneral($destGeneral); $this->setDestNation($this->destGeneralObj->getVar('nation'), ['gennum', 'scout']); diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index 97365920..e6e2e6f9 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -87,7 +87,7 @@ class che_증여 extends Command\GeneralCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $this->fullConditionConstraints = [ diff --git a/hwe/sammo/Command/Nation/che_몰수.php b/hwe/sammo/Command/Nation/che_몰수.php index df4ab98c..9658a6ff 100644 --- a/hwe/sammo/Command/Nation/che_몰수.php +++ b/hwe/sammo/Command/Nation/che_몰수.php @@ -92,7 +92,7 @@ class che_몰수 extends Command\NationCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'npc', 'nation', 'imgsvr', 'picture'], GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $env = $this->env; diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index f7e6439a..7917f796 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -72,7 +72,7 @@ class che_발령 extends Command\NationCommand { $this->setDestCity($this->arg['destCityID']); - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], null, GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); if ($this->arg['destGeneralID'] == $this->getGeneral()->getID()) { diff --git a/hwe/sammo/Command/Nation/che_불가침수락.php b/hwe/sammo/Command/Nation/che_불가침수락.php index 75b1edc4..2056900d 100644 --- a/hwe/sammo/Command/Nation/che_불가침수락.php +++ b/hwe/sammo/Command/Nation/che_불가침수락.php @@ -104,7 +104,7 @@ class che_불가침수락 extends Command\NationCommand $env = $this->env; $relYear = $env['year'] - $env['startyear']; - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], null, GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $this->setDestNation($this->arg['destNationID']); diff --git a/hwe/sammo/Command/Nation/che_불가침파기수락.php b/hwe/sammo/Command/Nation/che_불가침파기수락.php index 6f397ca6..4b5efebe 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기수락.php +++ b/hwe/sammo/Command/Nation/che_불가침파기수락.php @@ -78,7 +78,7 @@ class che_불가침파기수락 extends Command\NationCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], null, GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $this->setDestNation($this->arg['destNationID']); diff --git a/hwe/sammo/Command/Nation/che_종전수락.php b/hwe/sammo/Command/Nation/che_종전수락.php index a5a4ae43..2441ee5a 100644 --- a/hwe/sammo/Command/Nation/che_종전수락.php +++ b/hwe/sammo/Command/Nation/che_종전수락.php @@ -87,7 +87,7 @@ class che_종전수락 extends Command\NationCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], null, GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); $this->setDestNation($this->arg['destNationID']); diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index bded0d39..73791692 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -82,7 +82,7 @@ class che_포상 extends Command\NationCommand protected function initWithArg() { - $destGeneral = General::createObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], GeneralQueryMode::Lite); + $destGeneral = General::createObjFromDB($this->arg['destGeneralID']); $this->setDestGeneral($destGeneral); if($this->arg['destGeneralID'] == $this->getGeneral()->getID()){ diff --git a/hwe/sammo/Command/Nation/che_필사즉생.php b/hwe/sammo/Command/Nation/che_필사즉생.php index 4383eab4..ed7662f1 100644 --- a/hwe/sammo/Command/Nation/che_필사즉생.php +++ b/hwe/sammo/Command/Nation/che_필사즉생.php @@ -95,7 +95,7 @@ class che_필사즉생 extends Command\NationCommand{ $broadcastMessage = "{$generalName}{$josaYi} 필사즉생을 발동하였습니다."; $targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID); - foreach(General::createObjListFromDB($targetGeneralList, ['train', 'atmos'], GeneralQueryMode::Lite) as $targetGeneral){ + foreach(General::createObjListFromDB($targetGeneralList) as $targetGeneral){ $targetGeneral->getLogger()->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); if($targetGeneral->getVar('train') < 100){ $targetGeneral->setVar('train', 100); diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index dc08c81f..7d9a2596 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -76,7 +76,7 @@ class DiplomaticMessage extends Message{ $gameStor = KVStorage::getStorage(DB::db(), 'game_env'); - $destGeneralObj = General::createObjFromDB($this->dest->generalID, ['picture', 'imgsvr', 'aux'], GeneralQueryMode::Lite); + $destGeneralObj = General::createObjFromDB($this->dest->generalID); $commandObj = buildNationCommandClass('che_불가침수락', $destGeneralObj, $gameStor->getAll(true), new LastTurn(), [ 'destNationID'=>$this->src->nationID, @@ -100,7 +100,7 @@ class DiplomaticMessage extends Message{ protected function cancelNA(){ $gameStor = KVStorage::getStorage(DB::db(), 'game_env'); - $destGeneralObj = General::createObjFromDB($this->dest->generalID, ['picture', 'imgsvr', 'aux'], GeneralQueryMode::Lite); + $destGeneralObj = General::createObjFromDB($this->dest->generalID); $commandObj = buildNationCommandClass('che_불가침파기수락', $destGeneralObj, $gameStor->getAll(true), new LastTurn(), [ 'destNationID'=>$this->src->nationID, @@ -122,7 +122,7 @@ class DiplomaticMessage extends Message{ protected function stopWar(){ $gameStor = KVStorage::getStorage(DB::db(), 'game_env'); - $destGeneralObj = General::createObjFromDB($this->dest->generalID, ['picture', 'imgsvr', 'aux'], GeneralQueryMode::Lite); + $destGeneralObj = General::createObjFromDB($this->dest->generalID); $commandObj = buildNationCommandClass('che_종전수락', $destGeneralObj, $gameStor->getAll(true), new LastTurn(), [ 'destNationID'=>$this->src->nationID, diff --git a/hwe/sammo/Event/Action/UpdateNationLevel.php b/hwe/sammo/Event/Action/UpdateNationLevel.php index d92de942..88751956 100644 --- a/hwe/sammo/Event/Action/UpdateNationLevel.php +++ b/hwe/sammo/Event/Action/UpdateNationLevel.php @@ -215,7 +215,7 @@ class UpdateNationLevel extends \sammo\Event\Action } if ($chiefID) { - $chiefObj = General::createObjFromDB($chiefID, ['belong', 'npc', 'aux'], GeneralQueryMode::Lite); + $chiefObj = General::createObjFromDB($chiefID); $chiefObj->increaseInheritancePoint(InheritanceKey::unifier, 250 * $levelDiff); $chiefObj->applyDB($db); }