diff --git a/hwe/sammo/Command/General/che_군량매매.php b/hwe/sammo/Command/General/che_군량매매.php index 052d5b17..f0af7ca8 100644 --- a/hwe/sammo/Command/General/che_군량매매.php +++ b/hwe/sammo/Command/General/che_군량매매.php @@ -185,23 +185,14 @@ class che_군량매매 extends Command\GeneralCommand{ return true; } - public function getForm(): string + public function exportJSVars(): array { - ob_start(); -?> -자신의 군량을 사거나 팝니다.
- -
- [ + 'minAmount' => 100, + 'maxAmount' => GameConst::$maxResourceActionAmount, + 'amountGuide' => GameConst::$resourceActionAmountGuide, + ] + ]; } - - } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index 72a4cc77..13f7f327 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -1,9 +1,13 @@ arg === null){ + protected function argTest(): bool + { + if ($this->arg === null) { return false; } //NOTE: 사망 직전에 '등용' 턴을 넣을 수 있으므로, 존재하지 않는 장수여도 argTest에서 바로 탈락시키지 않음 - if(!key_exists('destGeneralID', $this->arg)){ + if (!key_exists('destGeneralID', $this->arg)) { return false; } $destGeneralID = $this->arg['destGeneralID']; - if(!is_int($destGeneralID)){ + if (!is_int($destGeneralID)) { return false; } - if($destGeneralID <= 0){ + if ($destGeneralID <= 0) { return false; } - if($destGeneralID == $this->generalObj->getID()){ + if ($destGeneralID == $this->generalObj->getID()) { return false; } $this->arg = [ - 'destGeneralID'=>$destGeneralID + 'destGeneralID' => $destGeneralID ]; return true; } @@ -59,11 +65,11 @@ class che_등용 extends Command\GeneralCommand{ $relYear = $this->env['year'] - $this->env['startyear']; - $this->permissionConstraints=[ + $this->permissionConstraints = [ ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'), ]; - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'), ConstraintHelper::NotBeNeutral(), ConstraintHelper::OccupiedCity(), @@ -79,7 +85,7 @@ class che_등용 extends Command\GeneralCommand{ [$reqGold, $reqRice] = $this->getCost(); $relYear = $this->env['year'] - $this->env['startyear']; - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::ReqEnvValue('join_mode', '!=', 'onlyRandom', '랜덤 임관만 가능합니다'), ConstraintHelper::NotBeNeutral(), ConstraintHelper::OccupiedCity(), @@ -90,33 +96,37 @@ class che_등용 extends Command\GeneralCommand{ ConstraintHelper::ReqGeneralRice($reqRice), ]; - if($this->destGeneralObj->getVar('officer_level') == 12){ + if ($this->destGeneralObj->getVar('officer_level') == 12) { $this->fullConditionConstraints[] = ConstraintHelper::AlwaysFail('군주에게는 등용장을 보낼 수 없습니다.'); } } - public function canDisplay():bool{ + public function canDisplay(): bool + { return $this->env['join_mode'] !== 'onlyRandom'; } - public function getCost():array{ + public function getCost(): array + { $env = $this->env; - if(!$this->isArgValid){ + if (!$this->isArgValid) { return [$env['develcost'], 0]; } $destGeneral = $this->destGeneralObj; $reqGold = Util::round( $env['develcost'] + - ($destGeneral->getVar('experience') + $destGeneral->getVar('dedication')) / 1000 + ($destGeneral->getVar('experience') + $destGeneral->getVar('dedication')) / 1000 ) * 10; return [$reqGold, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 0; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { return 0; } @@ -124,12 +134,13 @@ class che_등용 extends Command\GeneralCommand{ { $destGeneralName = $this->destGeneralObj->getName(); $name = $this->getName(); - $josaUl = JosaUtil::pick($name, '을'); + $josaUl = JosaUtil::pick($destGeneralName, '을'); return "【{$destGeneralName}】{$josaUl} {$name}"; } - public function run():bool{ - if(!$this->hasFullConditionMet()){ + public function run(): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -145,11 +156,10 @@ class che_등용 extends Command\GeneralCommand{ $msg = ScoutMessage::buildScoutMessage($general->getID(), $destGeneralID, $reason, new \DateTime($general->getTurnTime())); - if($msg){ + if ($msg) { $logger->pushGeneralActionLog("{$destGeneralName}에게 등용 권유 서신을 보냈습니다. <1>$date"); $msg->send(true); - } - else{ + } else { $logger->pushGeneralActionLog("{$destGeneralName}에게 등용 권유 서신을 보내지 못했습니다. {$reason} <1>$date"); } @@ -172,43 +182,27 @@ class che_등용 extends Command\GeneralCommand{ return true; } - public function getForm(): string + public function exportJSVars(): array { $db = DB::db(); + $destRawGenerals = $db->queryAllLists('SELECT no,name,nation,officer_level,npc,leadership,strength,intel FROM general WHERE npc < 2 AND officer_level != 12 AND no != %i ORDER BY npc,binary(name)', $this->generalObj->getID()); + $nationList = []; - $destGenerals = []; - $destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND officer_level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID()); - foreach($destRawGenerals as $destGeneral){ - $destNationID = $destGeneral['nation']; - if(!key_exists($destNationID, $destGenerals)){ - $destGenerals[$destNationID] = []; - } - $destGenerals[$destNationID][] = $destGeneral; + foreach ([getNationStaticInfo(0), ...getAllNationStaticInfo()] as $destNation) { + $nationList[] = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; } - $nationList = array_merge([0=>getNationStaticInfo(0)], getAllNationStaticInfo()); - - ob_start(); -?> -재야나 타국의 장수를 등용합니다.
-서신은 개인 메세지로 전달됩니다.
-등용할 장수를 목록에서 선택하세요.
-
- [ + 'nationList' => $nationList, + 'generals' => $destRawGenerals, + 'generalsKey' => ['no', 'name', 'nationID', 'officerLevel', 'npc', 'leadership', 'strength', 'intel'] + ] + ]; } -} \ No newline at end of file +} diff --git a/hwe/ts/processing/ColorSelect.vue b/hwe/ts/processing/ColorSelect.vue index b1294c05..3af708a3 100644 --- a/hwe/ts/processing/ColorSelect.vue +++ b/hwe/ts/processing/ColorSelect.vue @@ -26,7 +26,7 @@
{{ props.option.title }} @@ -37,12 +37,13 @@
{{ props.option.title }}
- - \ No newline at end of file diff --git a/hwe/ts/processing/General/che_군량매매.vue b/hwe/ts/processing/General/che_군량매매.vue new file mode 100644 index 00000000..b6384f6c --- /dev/null +++ b/hwe/ts/processing/General/che_군량매매.vue @@ -0,0 +1,78 @@ + + + diff --git a/hwe/ts/processing/General/che_등용.vue b/hwe/ts/processing/General/che_등용.vue new file mode 100644 index 00000000..f16c9407 --- /dev/null +++ b/hwe/ts/processing/General/che_등용.vue @@ -0,0 +1,99 @@ + + + diff --git a/hwe/ts/processing/General/index.ts b/hwe/ts/processing/General/index.ts index a7c5e41d..d4f4a1f8 100644 --- a/hwe/ts/processing/General/index.ts +++ b/hwe/ts/processing/General/index.ts @@ -1,9 +1,13 @@ import { default as che_건국} from "./che_건국.vue"; +import { default as che_군량매매} from "./che_군량매매.vue"; +import { default as che_등용} from "./che_등용.vue"; import { default as CityProcess} from "./che_이동.vue"; export const commandMap: Record = { che_강행: CityProcess, + che_군량매매, che_건국, + che_등용, che_이동: CityProcess, che_출병: CityProcess, } \ No newline at end of file diff --git a/hwe/ts/processing/GeneralSelect.vue b/hwe/ts/processing/GeneralSelect.vue index 48f2de9e..200475e9 100644 --- a/hwe/ts/processing/GeneralSelect.vue +++ b/hwe/ts/processing/GeneralSelect.vue @@ -5,6 +5,8 @@ :allow-empty="false" :options="forFind" :group-select="false" + :group-values="groupByNation ? 'values' : undefined" + group-label="nationID" label="searchText" track-by="value" :show-labels="false" @@ -18,7 +20,21 @@ :searchable="searchMode" >