refac: General 객체 생성을 GeneralQueryMode를 활용

- 기존 $constructMode
- 버그 있음..?
This commit is contained in:
2023-07-07 18:39:23 +00:00
parent b4f197b7d8
commit ee3d84d7b0
36 changed files with 110 additions and 63 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ use function \sammo\getNationStaticInfo;
use function sammo\tryUniqueItemLottery;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\GeneralQueryMode;
class che_등용 extends Command\GeneralCommand
{
@@ -77,7 +77,7 @@ class che_등용 extends Command\GeneralCommand
protected function initWithArg()
{
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation', 'experience', 'dedication'], 0);
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation', 'experience', 'dedication'], GeneralQueryMode::Core);
$this->setDestGeneral($destGeneral);
[$reqGold, $reqRice] = $this->getCost();
@@ -68,7 +68,7 @@ class che_등용수락 extends Command\GeneralCommand{
protected function initWithArg()
{
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], null, 2);
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], null);
$this->setDestGeneral($destGeneral);
$this->setDestNation($this->arg['destNationID'], ['gennum', 'scout']);
+2 -1
View File
@@ -19,6 +19,7 @@ use function\sammo\tryUniqueItemLottery;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\GeneralQueryMode;
use sammo\Enums\InheritanceKey;
class che_선양 extends Command\GeneralCommand
@@ -65,7 +66,7 @@ class che_선양 extends Command\GeneralCommand
protected function initWithArg()
{
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'nation'], 1);
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'nation'], GeneralQueryMode::Core);
$this->setDestGeneral($destGeneral);
$this->fullConditionConstraints = [
@@ -17,6 +17,7 @@ use function \sammo\tryUniqueItemLottery;
use function \sammo\getNationStaticInfo;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\GeneralQueryMode;
use sammo\Enums\InheritanceKey;
class che_장수대상임관 extends Command\GeneralCommand{
@@ -83,7 +84,7 @@ class che_장수대상임관 extends Command\GeneralCommand{
protected function initWithArg()
{
$destGeneralID = $this->arg['destGeneralID'];
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation'], 0);
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['nation'], GeneralQueryMode::Core);
$this->setDestGeneral($destGeneral);
$this->setDestNation($this->destGeneralObj->getVar('nation'), ['gennum', 'scout']);
+2 -1
View File
@@ -15,6 +15,7 @@ use \sammo\Command;
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use sammo\Enums\GeneralQueryMode;
use function sammo\tryUniqueItemLottery;
@@ -86,7 +87,7 @@ class che_증여 extends Command\GeneralCommand
protected function initWithArg()
{
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], 1);
$destGeneral = General::createGeneralObjFromDB($this->arg['destGeneralID'], ['gold', 'rice', 'nation'], GeneralQueryMode::Lite);
$this->setDestGeneral($destGeneral);
$this->fullConditionConstraints = [
+2 -1
View File
@@ -15,6 +15,7 @@ use function \sammo\searchDistance;
use \sammo\Constraint\ConstraintHelper;
use sammo\CityConst;
use sammo\Enums\GeneralQueryMode;
use sammo\Enums\RankColumn;
use sammo\RandUtil;
@@ -268,7 +269,7 @@ class che_화계 extends Command\GeneralCommand
$destCityGeneralList = [];
$cityGeneralID = $db->queryFirstColumn('SELECT no FROM general WHERE city = %i AND nation = %i', $destCityID, $destNationID);
$destCityGeneralList = General::createGeneralObjListFromDB($cityGeneralID, ['name', 'city', 'nation', 'officer_level', 'leadership', 'horse', 'strength', 'weapon', 'intel', 'book', 'item', 'last_turn', 'injury', 'special', 'special2', 'injury', 'crewtype', 'crew', 'atmos', 'train'], 2);
$destCityGeneralList = General::createGeneralObjListFromDB($cityGeneralID, ['name', 'city', 'nation', 'officer_level', 'leadership', 'horse', 'strength', 'weapon', 'intel', 'book', 'item', 'last_turn', 'injury', 'special', 'special2', 'injury', 'crewtype', 'crew', 'atmos', 'train']);
foreach ($destCityGeneralList as &$destCityGeneral) {
$destCityGeneral->setRawCity($this->destCity);
unset($destCityGeneral);