diff --git a/hwe/sammo/Command/Nation/che_물자원조.php b/hwe/sammo/Command/Nation/che_물자원조.php index e77cc6e1..7687d68c 100644 --- a/hwe/sammo/Command/Nation/che_물자원조.php +++ b/hwe/sammo/Command/Nation/che_물자원조.php @@ -272,7 +272,7 @@ class che_물자원조 extends Command\NationCommand //TODO: 물자원조 자체가 가능한지도 검사? - if($nationTarget['id'] == $generalObj->getNationID()){ + if ($nationTarget['id'] == $generalObj->getNationID()) { $nationTarget['notAvailable'] = true; } @@ -280,9 +280,9 @@ class che_물자원조 extends Command\NationCommand } $currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level']; - $nationLevelText = []; + $levelInfo = []; foreach (\sammo\getNationLevelList() as $level => [$levelText,,]) { - $nationLevelText[$level] = $levelText; + $levelInfo[$level] = ['text' => $levelText, 'amount' => $level * GameConst::$coefAidAmount]; } $amountGuide = []; @@ -295,52 +295,11 @@ class che_물자원조 extends Command\NationCommand 'procRes' => [ 'nationList' => $nationList, 'currentNationLevel' => $currentNationLevel, - 'nationLevelText' => $nationLevelText, + 'levelInfo' => $levelInfo, 'minAmount' => 1000, 'maxAmount' => Util::array_last($amountGuide), 'amountGuide' => $amountGuide, ], ]; } - - public function getJSPlugins(): array - { - return [ - 'defaultSelectNationByMap' - ]; - } - - - public function getForm(): string - { - $currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level']; - ob_start(); -?> -
- 타국에게 원조합니다.
- 작위별로 금액 제한이 있습니다.
- [$levelText,,]) : ?> - :
- - 원조할 국가를 목록에서 선택하세요.
- - 국고 - 병량 -
-
-generalObj; + $nationID = $generalObj->getNationID(); + $nationList = []; + + $db = DB::db(); + $diplomacyStatus = Util::convertArrayToDict( + $db->query('SELECT * FROM diplomacy WHERE me = %i', $nationID), + 'you' + ); + + foreach (getAllNationStaticInfo() as $destNation) { + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; + + if($diplomacyStatus[$destNation['nation']]['state'] != 7){ + $nationTarget['notAvailable'] = true; + } + if ($destNation['id'] == $nationID) { + $nationTarget['notAvailable'] = true; + } + + $nationList[] = $nationTarget; + } + return [ + 'mapTheme' => \sammo\getMapTheme(), + 'procRes' => [ + 'nationList' => $nationList, + 'startYear' => $this->env['startyear'], + ], + ]; + } + public function getJSPlugins(): array { return [ diff --git a/hwe/sammo/Command/Nation/che_이호경식.php b/hwe/sammo/Command/Nation/che_이호경식.php index 563e6fad..5d8cc06f 100644 --- a/hwe/sammo/Command/Nation/che_이호경식.php +++ b/hwe/sammo/Command/Nation/che_이호경식.php @@ -199,48 +199,36 @@ class che_이호경식 extends Command\NationCommand return true; } - public function getJSPlugins(): array - { - return [ - 'defaultSelectNationByMap' - ]; - } - - public function getForm(): string + public function exportJSVars(): array { $generalObj = $this->generalObj; $nationID = $generalObj->getNationID(); $nationList = []; $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); foreach (getAllNationStaticInfo() as $destNation) { - if ($destNation['nation'] == $nationID) { - continue; - } - - $testTurn->setArg(['destNationID' => $destNation['nation']]); $testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID' => $destNation['nation']]); - if ($testCommand->hasFullConditionMet()) { - $destNation['availableCommand'] = true; - } else { - $destNation['availableCommand'] = false; + + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; + if (!$testCommand->hasFullConditionMet()) { + $nationTarget['notAvailable'] = true; + } + if ($destNation['id'] == $nationID) { + $nationTarget['notAvailable'] = true; } - $nationList[] = $destNation; + $nationList[] = $nationTarget; } - - ob_start(); -?> -
- 선택된 국가에 이호경식을 발동합니다.
- 선포, 전쟁중인 상대국에만 가능합니다.
- 상대 국가를 목록에서 선택하세요.
- 배경색은 현재 이호경식 불가능 국가는 붉은색으로 표시됩니다.
- - \sammo\getMapTheme(), + 'procRes' => [ + 'nationList' => $nationList, + 'startYear' => $this->env['startyear'], + ], + ]; } } diff --git a/hwe/sammo/Command/Nation/che_종전제의.php b/hwe/sammo/Command/Nation/che_종전제의.php index 6e26fc6a..7c6d8ea2 100644 --- a/hwe/sammo/Command/Nation/che_종전제의.php +++ b/hwe/sammo/Command/Nation/che_종전제의.php @@ -168,57 +168,36 @@ class che_종전제의 extends Command\NationCommand{ return true; } - public function getJSPlugins(): array - { - return [ - 'defaultSelectNationByMap' - ]; - } - - public function getForm(): string + public function exportJSVars(): array { $generalObj = $this->generalObj; $nationID = $generalObj->getNationID(); - - $db = DB::db(); - $diplomacyStatus = Util::convertArrayToDict( - $db->query('SELECT * FROM diplomacy WHERE me = %i', $nationID), - 'you' - ); - $nationList = []; - foreach(getAllNationStaticInfo() as $destNation){ - if($destNation['nation'] == $nationID){ - continue; + $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); + foreach (getAllNationStaticInfo() as $destNation) { + $testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID' => $destNation['nation']]); + + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; + if (!$testCommand->hasFullConditionMet()) { + $nationTarget['notAvailable'] = true; + } + if ($destNation['id'] == $nationID) { + $nationTarget['notAvailable'] = true; } - if(!in_array($diplomacyStatus[$destNation['nation']]['state'], [0, 1])){ - $destNation['cssBgColor'] = 'background-color:red;'; - } - else{ - $destNation['cssBgColor'] = ''; - } - - $nationList[] = $destNation; + $nationList[] = $nationTarget; } - - ob_start(); -?> -
-전쟁중인 국가에 종전을 제의합니다.
-제의할 국가를 목록에서 선택하세요.
-배경색은 현재 제의가 불가능한 국가는 붉은색으로 표시됩니다.
-
-에게 - - \sammo\getMapTheme(), + 'procRes' => [ + 'nationList' => $nationList, + 'startYear' => $this->env['startyear'], + ], + ]; } } \ No newline at end of file diff --git a/hwe/sammo/Command/Nation/che_피장파장.php b/hwe/sammo/Command/Nation/che_피장파장.php index 20fabea0..0d45620d 100644 --- a/hwe/sammo/Command/Nation/che_피장파장.php +++ b/hwe/sammo/Command/Nation/che_피장파장.php @@ -1,16 +1,21 @@ arg === null){ + protected function argTest(): bool + { + if ($this->arg === null) { return false; } //NOTE: 멸망 직전에 턴을 넣을 수 있으므로, 존재하지 않는 국가여도 argTest에서 바로 탈락시키지 않음 - if(!key_exists('destNationID', $this->arg)){ + if (!key_exists('destNationID', $this->arg)) { return false; } - if(!key_exists('commandType', $this->arg)){ + if (!key_exists('commandType', $this->arg)) { return false; } $destNationID = $this->arg['destNationID']; $commandType = $this->arg['commandType']; - if(!is_int($destNationID)){ + if (!is_int($destNationID)) { return false; } - if($destNationID < 1){ + if ($destNationID < 1) { return false; } - if(!is_string($commandType)){ + if (!is_string($commandType)) { return false; } - if(!in_array($commandType, GameConst::$availableChiefCommand['전략'])){ + if (!in_array($commandType, GameConst::$availableChiefCommand['전략'])) { return false; } $this->arg = [ - 'destNationID'=>$destNationID, - 'commandType'=>$commandType + 'destNationID' => $destNationID, + 'commandType' => $commandType ]; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; $env = $this->env; @@ -69,7 +77,7 @@ class che_피장파장 extends Command\NationCommand{ $this->setCity(); $this->setNation(); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ]; @@ -79,8 +87,8 @@ class che_피장파장 extends Command\NationCommand{ { $this->setDestNation($this->arg['destNationID'], null); - if($this->getNationID() == 0){ - $this->fullConditionConstraints=[ + if ($this->getNationID() == 0) { + $this->fullConditionConstraints = [ ConstraintHelper::OccupiedCity() ]; return; @@ -90,14 +98,14 @@ class che_피장파장 extends Command\NationCommand{ $currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']); $nextAvailableTurn = $cmd->getNextAvailableTurn(); - if($currYearMonth < $nextAvailableTurn){ - $this->fullConditionConstraints=[ + if ($currYearMonth < $nextAvailableTurn) { + $this->fullConditionConstraints = [ ConstraintHelper::AlwaysFail('해당 전략을 아직 사용할 수 없습니다') ]; return; } - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::OccupiedCity(), ConstraintHelper::BeChief(), ConstraintHelper::ExistsDestNation(), @@ -108,35 +116,41 @@ class che_피장파장 extends Command\NationCommand{ ]; } - public function getCommandDetailTitle():string{ + public function getCommandDetailTitle(): string + { $name = $this->getName(); - $reqTurn = $this->getPreReqTurn()+1; + $reqTurn = $this->getPreReqTurn() + 1; return "{$name}/{$reqTurn}턴(대상 재사용 대기 {$this->getTargetPostReqTurn()})"; } - public function getCost():array{ + public function getCost(): array + { return [0, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 1; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { return 0; } - public function getTargetPostReqTurn():int{ + public function getTargetPostReqTurn(): int + { $genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit); - $nextTerm = Util::round(sqrt($genCount*2)*10); + $nextTerm = Util::round(sqrt($genCount * 2) * 10); $nextTerm = $this->generalObj->onCalcStrategic($this->getName(), 'delay', $nextTerm); $nextTerm = Util::valueFit($nextTerm, Util::round(static::$delayCnt * 1.2)); return $nextTerm; } - public function getBrief():string{ + public function getBrief(): string + { $commandName = $this->getName(); $cmd = buildNationCommandClass($this->arg['commandType'], $this->generalObj, $this->env, new LastTurn()); $targetCommandName = $cmd->getName(); @@ -145,8 +159,9 @@ class che_피장파장 extends Command\NationCommand{ } - public function run():bool{ - if(!$this->hasFullConditionMet()){ + public function run(): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -187,7 +202,7 @@ class che_피장파장 extends Command\NationCommand{ $broadcastMessage = "{$generalName}{$josaYi} {$destNationName}{$cmd->getName()} 전략의 {$commandName}{$josaUl} 발동하였습니다."; $nationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID); - foreach($nationGeneralList as $nationGeneralID){ + foreach ($nationGeneralList as $nationGeneralID) { $nationGeneralLogger = new ActionLogger($nationGeneralID, $nationID, $year, $month); $nationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); $nationGeneralLogger->flush(); @@ -198,7 +213,7 @@ class che_피장파장 extends Command\NationCommand{ $broadcastMessage = "아국에 {$cmd->getName()} 전략의 {$commandName}{$josaYiCommand} 발동되었습니다."; $destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $destNationID, $generalID); - foreach($destNationGeneralList as $destNationGeneralID){ + foreach ($destNationGeneralList as $destNationGeneralID) { $destNationGeneralLogger = new ActionLogger($destNationGeneralID, $destNationID, $year, $month); $destNationGeneralLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN); $destNationGeneralLogger->flush(); @@ -222,79 +237,55 @@ class che_피장파장 extends Command\NationCommand{ return true; } - public function getJSPlugins(): array - { - return [ - 'defaultSelectNationByMap' - ]; - } - - public function getForm(): string + public function exportJSVars(): array { $generalObj = $this->generalObj; $nationID = $generalObj->getNationID(); $nationList = []; $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); - foreach(getAllNationStaticInfo() as $destNation){ - if($destNation['nation'] == $nationID){ - continue; + foreach (getAllNationStaticInfo() as $destNation) { + $testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID' => $destNation['nation']]); + + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; + if (!$testCommand->hasFullConditionMet()) { + $nationTarget['notAvailable'] = true; + } + if ($destNation['id'] == $nationID) { + $nationTarget['notAvailable'] = true; } - $testTurn->setArg(['destNationID'=>$destNation['nation']]); - $testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID'=>$destNation['nation']]); - if($testCommand->hasFullConditionMet()){ - $destNation['availableCommand'] = true; - } - else{ - $destNation['availableCommand'] = false; - } - - $nationList[] = $destNation; + $nationList[] = $nationTarget; } + $availableCommandTypeList = []; $currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']); - foreach(GameConst::$availableChiefCommand['전략'] as $commandType){ + foreach (GameConst::$availableChiefCommand['전략'] as $commandType) { $cmd = buildNationCommandClass($commandType, $generalObj, $this->env, new LastTurn()); $cmdName = $cmd->getName(); $remainTurn = 0; $nextAvailableTurn = $cmd->getNextAvailableTurn(); - if($nextAvailableTurn !== null && $currYearMonth < $nextAvailableTurn){ + if ($nextAvailableTurn !== null && $currYearMonth < $nextAvailableTurn) { $remainTurn = $nextAvailableTurn - $currYearMonth; } - $availableCommandTypeList[$commandType] = [$cmdName, $remainTurn]; + $availableCommandTypeList[$commandType] = ['name' => $cmdName, 'remainTurn' => $remainTurn]; } - ob_start(); -?> -
-선택된 국가에 피장파장을 발동합니다.
-지정한 전략을 상대국이 턴 동안 사용할 수 없게됩니다.
-대신 아국은 지정한 전략을getTargetPostReqTurn()?>턴 동안 사용할 수 없습니다.
-선포, 전쟁중인 상대국에만 가능합니다.
-상대 국가를 목록에서 선택하세요.
-배경색은 현재 피장파장 불가능 국가는 붉은색으로 표시됩니다.
-에 - 전략을 - - \sammo\getMapTheme(), + 'procRes' => [ + 'nationList' => $nationList, + 'startYear' => $this->env['startyear'], + 'delayCnt' => static::$delayCnt, + 'postReqTurn' => $this->getTargetPostReqTurn(), + 'availableCommandTypeList' => $availableCommandTypeList + ], + ]; } -} \ No newline at end of file +} diff --git a/hwe/ts/processing/General/che_건국.vue b/hwe/ts/processing/General/che_건국.vue index f5f49147..970b2fc7 100644 --- a/hwe/ts/processing/General/che_건국.vue +++ b/hwe/ts/processing/General/che_건국.vue @@ -38,7 +38,7 @@ diff --git a/hwe/ts/processing/AmountSelect.vue b/hwe/ts/processing/SelectAmount.vue similarity index 80% rename from hwe/ts/processing/AmountSelect.vue rename to hwe/ts/processing/SelectAmount.vue index 2f50b9b1..c16a474c 100644 --- a/hwe/ts/processing/AmountSelect.vue +++ b/hwe/ts/processing/SelectAmount.vue @@ -1,19 +1,22 @@ @@ -76,7 +82,7 @@ export default defineComponent({ type: Number, required: false, default: 1, - } + }, }, emits: ["update:modelValue"], watch: { diff --git a/hwe/ts/processing/CitySelect.vue b/hwe/ts/processing/SelectCity.vue similarity index 100% rename from hwe/ts/processing/CitySelect.vue rename to hwe/ts/processing/SelectCity.vue diff --git a/hwe/ts/processing/ColorSelect.vue b/hwe/ts/processing/SelectColor.vue similarity index 100% rename from hwe/ts/processing/ColorSelect.vue rename to hwe/ts/processing/SelectColor.vue diff --git a/hwe/ts/processing/GeneralSelect.vue b/hwe/ts/processing/SelectGeneral.vue similarity index 100% rename from hwe/ts/processing/GeneralSelect.vue rename to hwe/ts/processing/SelectGeneral.vue diff --git a/hwe/ts/processing/NationSelect.vue b/hwe/ts/processing/SelectNation.vue similarity index 100% rename from hwe/ts/processing/NationSelect.vue rename to hwe/ts/processing/SelectNation.vue