diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index c89fdb39..81521971 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -177,40 +177,22 @@ class che_증여 extends Command\GeneralCommand return true; } - public function getForm(): string + public function exportJSVars(): array { - //TODO: 암행부처럼 보여야... $db = DB::db(); - - $destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)', $this->generalObj->getNationID(), $this->generalObj->getID()); - ob_start(); -?> - 자신의 자금이나 군량을 다른 장수에게 증여합니다.
- 장수를 선택하세요.
- - -
-getNationID(); + $troops = Util::convertArrayToDict($db->query('SELECT * FROM troop WHERE nation=%i', $nationID), 'troop_leader'); + $destRawGenerals = $db->queryAllLists('SELECT no,name,officer_level,npc,gold,rice,leadership,strength,intel,city,crew,train,atmos,troop FROM general WHERE nation = %i ORDER BY npc,binary(name)', $nationID); + return [ + 'procRes' => [ + 'troops' => $troops, + 'generals' => $destRawGenerals, + 'generalsKey' => ['no', 'name', 'officerLevel', 'npc', 'gold', 'rice', 'leadership', 'strength', 'intel', 'cityID', 'crew', 'train', 'atmos', 'troopID'], + 'cities' => \sammo\JSOptionsForCities(), + 'minAmount' => 100, + 'maxAmount' => GameConst::$maxResourceActionAmount, + 'amountGuide' => GameConst::$resourceActionAmountGuide, + ] + ]; } } diff --git a/hwe/sammo/Command/General/che_헌납.php b/hwe/sammo/Command/General/che_헌납.php index c05fd72f..cd8eebe6 100644 --- a/hwe/sammo/Command/General/che_헌납.php +++ b/hwe/sammo/Command/General/che_헌납.php @@ -152,6 +152,17 @@ class che_헌납 extends Command\GeneralCommand return true; } + public function exportJSVars(): array + { + return [ + 'procRes' => [ + 'minAmount' => 100, + 'maxAmount' => GameConst::$maxResourceActionAmount, + 'amountGuide' => GameConst::$resourceActionAmountGuide, + ] + ]; + } + public function getForm(): string { ob_start(); diff --git a/hwe/sammo/Command/Nation/che_백성동원.php b/hwe/sammo/Command/Nation/che_백성동원.php index 92607988..09033e6c 100644 --- a/hwe/sammo/Command/Nation/che_백성동원.php +++ b/hwe/sammo/Command/Nation/che_백성동원.php @@ -1,9 +1,13 @@ arg === null){ + protected function argTest(): bool + { + if ($this->arg === null) { return false; } - if(!key_exists('destCityID', $this->arg)){ + if (!key_exists('destCityID', $this->arg)) { return false; } - if(CityConst::byID($this->arg['destCityID']) === null){ + if (CityConst::byID($this->arg['destCityID']) === null) { return false; } $destCityID = $this->arg['destCityID']; $this->arg = [ - 'destCityID'=>$destCityID, + 'destCityID' => $destCityID, ]; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; $env = $this->env; @@ -49,7 +56,7 @@ class che_백성동원 extends Command\NationCommand{ $this->setCity(); $this->setNation(['strategic_cmd_limit']); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ConstraintHelper::AvailableStrategicCommand() @@ -61,7 +68,7 @@ class che_백성동원 extends Command\NationCommand{ $this->setDestCity($this->arg['destCityID']); $this->setDestNation($this->destCity['nation']); - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ConstraintHelper::OccupiedDestCity(), @@ -69,38 +76,44 @@ class che_백성동원 extends Command\NationCommand{ ]; } - public function getCommandDetailTitle():string{ + public function getCommandDetailTitle(): string + { $name = $this->getName(); - $reqTurn = $this->getPreReqTurn()+1; + $reqTurn = $this->getPreReqTurn() + 1; $postReqTurn = $this->getPostReqTurn(); return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)"; } - public function getCost():array{ + public function getCost(): array + { return [0, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 0; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { $genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit); - $nextTerm = Util::round(sqrt($genCount*4)*10); + $nextTerm = Util::round(sqrt($genCount * 4) * 10); $nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm); return $nextTerm; } - public function getBrief():string{ + public function getBrief(): string + { $commandName = $this->getName(); $destCityName = CityConst::byID($this->arg['destCityID'])->name; return "【{$destCityName}】에 {$commandName}"; } - public function run():bool{ - if(!$this->hasFullConditionMet()){ + public function run(): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -132,7 +145,7 @@ class che_백성동원 extends Command\NationCommand{ $broadcastMessage = "{$generalName}{$josaYi} {$destCityName}백성동원을 하였습니다."; $targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID); - foreach($targetGeneralList as $targetGeneralID){ + foreach ($targetGeneralList as $targetGeneralID) { $targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month); $targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); $targetLogger->flush(); @@ -159,27 +172,14 @@ class che_백성동원 extends Command\NationCommand{ return true; } - public function getJSPlugins(): array + public function exportJSVars(): array { return [ - 'defaultSelectCityByMap' + 'mapTheme' => \sammo\getMapTheme(), + 'procRes' => [ + 'cities' => \sammo\JSOptionsForCities(), + 'distanceList' => new \stdClass(), + ], ]; } - - - public function getForm(): string - { - ob_start(); -?> -
-선택된 도시에 백성을 동원해 성벽을 쌓습니다.
-아국 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-
-arg === null){ + protected function argTest(): bool + { + if ($this->arg === null) { return false; } - if(!key_exists('destCityID', $this->arg)){ + if (!key_exists('destCityID', $this->arg)) { return false; } - if(CityConst::byID($this->arg['destCityID']) === null){ + if (CityConst::byID($this->arg['destCityID']) === null) { return false; } $destCityID = $this->arg['destCityID']; $this->arg = [ - 'destCityID'=>$destCityID, + 'destCityID' => $destCityID, ]; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; $env = $this->env; @@ -51,7 +58,7 @@ class che_수몰 extends Command\NationCommand{ $this->setCity(); $this->setNation(['strategic_cmd_limit']); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ConstraintHelper::AvailableStrategicCommand(), @@ -63,7 +70,7 @@ class che_수몰 extends Command\NationCommand{ $this->setDestCity($this->arg['destCityID']); $this->setDestNation($this->destCity['nation']); - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ConstraintHelper::NotNeutralDestCity(), @@ -73,39 +80,45 @@ class che_수몰 extends Command\NationCommand{ ]; } - public function getCommandDetailTitle():string{ + public function getCommandDetailTitle(): string + { $name = $this->getName(); - $reqTurn = $this->getPreReqTurn()+1; + $reqTurn = $this->getPreReqTurn() + 1; $postReqTurn = $this->getPostReqTurn(); return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)"; } - public function getCost():array{ + public function getCost(): array + { return [0, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 2; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { $genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit); - $nextTerm = Util::round(sqrt($genCount*4)*10); + $nextTerm = Util::round(sqrt($genCount * 4) * 10); $nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm); return $nextTerm; } - public function getBrief():string{ + public function getBrief(): string + { $commandName = $this->getName(); $destCityName = CityConst::byID($this->arg['destCityID'])->name; $josaUl = JosaUtil::pick($destCityName, '을'); return "【{$destCityName}】{$josaUl} {$commandName}"; } - public function run():bool{ - if(!$this->hasFullConditionMet()){ + public function run(): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -140,7 +153,7 @@ class che_수몰 extends Command\NationCommand{ $broadcastMessage = "{$generalName}{$josaYi} {$destCityName}수몰을 발동하였습니다."; $targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID); - foreach($targetGeneralList as $targetGeneralID){ + foreach ($targetGeneralList as $targetGeneralID) { $targetLogger = new ActionLogger($targetGeneralID, $nationID, $year, $month); $targetLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); $targetLogger->flush(); @@ -150,12 +163,13 @@ class che_수몰 extends Command\NationCommand{ $targetGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i', $destNationID); $destNationLogged = false; - foreach($targetGeneralList as $targetGeneralID){ + foreach ($targetGeneralList as $targetGeneralID) { $targetLogger = new ActionLogger($targetGeneralID, $destNationID, $year, $month); $targetLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN); - if(!$destNationLogged){ + if (!$destNationLogged) { $targetLogger->pushNationalHistoryLog( - "{$nationName}{$generalName}{$josaYi} 아국의 {$destCityName}수몰을 발동", ActionLogger::PLAIN + "{$nationName}{$generalName}{$josaYi} 아국의 {$destCityName}수몰을 발동", + ActionLogger::PLAIN ); $destNationLogged = true; } @@ -182,27 +196,14 @@ class che_수몰 extends Command\NationCommand{ return true; } - public function getJSPlugins(): array + public function exportJSVars(): array { return [ - 'defaultSelectCityByMap' + 'mapTheme' => \sammo\getMapTheme(), + 'procRes' => [ + 'cities' => \sammo\JSOptionsForCities(), + 'distanceList' => new \stdClass(), + ], ]; } - - - public function getForm(): string - { - ob_start(); -?> -
-선택된 도시에 수몰을 발동합니다.
-전쟁중인 상대국 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-
- \sammo\getMapTheme(), + 'procRes' => [ + 'cities' => \sammo\JSOptionsForCities(), + 'distanceList' => new \stdClass(), + ], ]; } - - - public function getForm(): string - { - ob_start(); -?> -
- 선택된 도시로 천도합니다.
- 현재 수도에서 연결된 도시만 가능하며, 1+2×거리만큼의 턴이 필요합니다.
- 목록을 선택하거나 도시를 클릭하세요.
-
-
- \sammo\getMapTheme(), + 'procRes' => [ + 'cities' => \sammo\JSOptionsForCities(), + 'distanceList' => new \stdClass(), + ], ]; } - - - public function getForm(): string - { - - $cities = Util::convertArrayToDict(DB::db()->query('SELECT * FROM city WHERE nation =%i', $this->generalObj->getNationID()), 'city'); - $calc = function(CityInitialDetail $constCity)use($cities){ - if(!key_exists($constCity->id, $cities)){ - return null; - } - $amount = $this->calcReturnAmount($cities[$constCity->id]); - $amountText = number_format($amount); - return "금쌀 각 {$amountText} 회수"; - }; - ob_start(); -?> -
-선택된 도시를 초토화 시킵니다.
-도시가 공백지가 되며, 도시의 인구, 내정 상태에 따라 상당량의 국고가 확보됩니다.
-국가의 수뇌들은 명성을 잃고, 모든 장수들은 배신 수치가 1 증가합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-
- \sammo\getMapTheme(), + 'procRes' => [ + 'cities' => \sammo\JSOptionsForCities(), + 'distanceList' => new \stdClass(), + ], ]; } - - - public function getForm(): string - { - ob_start(); -?> -
- 선택된 도시에 허보를 발동합니다.
- 전쟁중인 상대국 도시만 가능합니다.
- 목록을 선택하거나 도시를 클릭하세요.
-
-
- + +
+
+ 자신의 자금이나 군량을 국가 재산으로 헌납합니다. +
+
+
+ 자원 : + + + + +
+
+ 금액 : + +
+
+ {{ commandName }} +
+
+
+ + + + diff --git a/hwe/ts/processing/General/index.ts b/hwe/ts/processing/General/index.ts index 04828e57..d8f92378 100644 --- a/hwe/ts/processing/General/index.ts +++ b/hwe/ts/processing/General/index.ts @@ -2,12 +2,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 che_선양 } from "./che_선양.vue"; - import { default as che_임관 } from "./che_임관.vue"; import { default as che_장수대상임관 } from "./che_장수대상임관.vue"; import { default as che_징병 } from "./che_징병.vue"; +import { default as che_헌납 } from "./che_헌납.vue"; import { default as ProcessCity } from "../ProcessCity.vue"; +import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue"; //TODO: 자주 쓰는 녀석들은 Slot으로 변경 @@ -24,20 +25,16 @@ export const commandMap: Record = { che_임관, che_장수대상임관, che_징병, + che_증여: ProcessGeneralAmount, che_첩보: ProcessCity, che_출병: ProcessCity, che_탈취: ProcessCity, che_파괴: ProcessCity, che_화계: ProcessCity, + che_헌납, } /* - 항목들 -장수/금쌀/분량 - 증여(포상 이식) -금쌀/분량 - 헌납(군량매매 또는 포상 수정) - 고유 양식 - 숙련전환, 장비매매 - - - */ \ No newline at end of file diff --git a/hwe/ts/processing/Nation/index.ts b/hwe/ts/processing/Nation/index.ts index 56107060..d550775e 100644 --- a/hwe/ts/processing/Nation/index.ts +++ b/hwe/ts/processing/Nation/index.ts @@ -4,8 +4,9 @@ import { default as che_물자원조 } from "./che_물자원조.vue"; import { default as che_피장파장 } from "./che_피장파장.vue"; import { default as ProcessNation } from "../ProcessNation.vue"; -import { default as ProcessGeneralAmount } from "./che_몰수.vue"; +import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue"; import { default as ProcessGeneralCity } from "./che_발령.vue"; +import { default as ProcessCity } from "../ProcessCity.vue"; export const commandMap: Record = { che_국기변경, @@ -14,17 +15,20 @@ export const commandMap: Record = { che_몰수: ProcessGeneralAmount, che_물자원조, che_발령: ProcessGeneralCity, + che_백성동원: ProcessCity, che_불가침파기제의: ProcessNation, che_선전포고: ProcessNation, + che_수몰: ProcessCity, che_이호경식: ProcessNation, che_종전제의: ProcessNation, + che_천도: ProcessCity, + che_초토화: ProcessCity, che_포상: ProcessGeneralAmount, che_피장파장, + che_허보: ProcessCity, } /* - 항목들 -도시 - 백성동원, 수몰, 천도, 초토화, 허보 고유 양식 - 불가침제의 - */ \ No newline at end of file diff --git a/hwe/ts/processing/ProcessCity.vue b/hwe/ts/processing/ProcessCity.vue index a22d5f02..55813b71 100644 --- a/hwe/ts/processing/ProcessCity.vue +++ b/hwe/ts/processing/ProcessCity.vue @@ -31,8 +31,35 @@ 목록을 선택하거나 도시를 클릭하세요.
- 선택된 도시에 {{ commandName }}{{JosaPick(commandName, '을')}} - 실행합니다.
+ 선택된 도시에 {{ commandName + }}{{ JosaPick(commandName, "을") }} 실행합니다.
+ 목록을 선택하거나 도시를 클릭하세요.
+
+
+ 선택된 도시에 수몰을 발동합니다.
+ 전쟁중인 상대국 도시만 가능합니다.
+ 목록을 선택하거나 도시를 클릭하세요.
+
+
+ 선택된 도시에 백성을 동원해 성벽을 쌓습니다.
+ 아국 도시만 가능합니다.
+ 목록을 선택하거나 도시를 클릭하세요.
+
+
+ 선택된 도시로 천도합니다.
+ 현재 수도에서 연결된 도시만 가능하며, 1+2×거리만큼의 턴이 필요합니다.
+ 목록을 선택하거나 도시를 클릭하세요.
+
+
+ 선택된 도시에 허보를 발동합니다.
+ 전쟁중인 상대국 도시만 가능합니다.
+ 목록을 선택하거나 도시를 클릭하세요.
+
+
+ 선택된 도시를 초토화 시킵니다.
+ 도시가 공백지가 되며, 도시의 인구, 내정 상태에 따라 상당량의 국고가 + 확보됩니다.
+ 국가의 수뇌들은 명성을 잃고, 모든 장수들은 배신 수치가 1 증가합니다.
목록을 선택하거나 도시를 클릭하세요.
diff --git a/hwe/ts/processing/Nation/che_몰수.vue b/hwe/ts/processing/ProcessGeneralAmount.vue similarity index 95% rename from hwe/ts/processing/Nation/che_몰수.vue rename to hwe/ts/processing/ProcessGeneralAmount.vue index 34877a2c..000e9c16 100644 --- a/hwe/ts/processing/Nation/che_몰수.vue +++ b/hwe/ts/processing/ProcessGeneralAmount.vue @@ -8,13 +8,15 @@
국고로 장수에게 자금이나 군량을 지급합니다.
+
+ 자신의 자금이나 군량을 다른 장수에게 증여합니다.
+
장수 : @@ -56,7 +58,7 @@ import { procGeneralItem, procGeneralKey, procGeneralRawItemList, -} from "../processingRes"; +} from "./processingRes"; import { getNpcColor } from "@/common_legacy"; declare const commandName: string; diff --git a/hwe/ts/processing/SelectGeneral.vue b/hwe/ts/processing/SelectGeneral.vue index a1d6e756..3a7b6734 100644 --- a/hwe/ts/processing/SelectGeneral.vue +++ b/hwe/ts/processing/SelectGeneral.vue @@ -147,7 +147,6 @@ export default defineComponent({ groupArray.push(obj); targets.set(gen.no, obj); } - console.log(forFind); return { selectedGeneral, searchMode: true,