diff --git a/hwe/sammo/Command/Nation/che_국호변경.php b/hwe/sammo/Command/Nation/che_국호변경.php index f0cfc747..fd7b36de 100644 --- a/hwe/sammo/Command/Nation/che_국호변경.php +++ b/hwe/sammo/Command/Nation/che_국호변경.php @@ -157,23 +157,4 @@ class che_국호변경 extends Command\NationCommand $general->applyDB($db); return true; } - - public function getJSPlugins(): array - { - return [ - 'colorSelect' - ]; - } - - - public function getForm(): string - { - ob_start(); -?> - 나라의 이름을 바꿉니다. 황제가 된 후 1회 가능합니다. - 국명 : - -generalObj; $nationID = $generalObj->getNationID(); $nationList = []; $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); foreach (getAllNationStaticInfo() as $destNation) { - if ($destNation['nation'] == $nationID) { + /*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['nation'] == $nationID) { + $nationTarget['notAvailable'] = true; } - $nationList[] = $destNation; + $nationList[] = $nationTarget; } - - ob_start(); -?> - = \sammo\getMapHtml() ?> - 선택된 국가에 급습을 발동합니다. - 선포, 전쟁중인 상대국에만 가능합니다. - 상대 국가를 목록에서 선택하세요. - 배경색은 현재 급습 불가능 국가는 붉은색으로 표시됩니다. - - - ' style='color:= $nation['color'] ?>;= $nation['availableCommand'] ? '' : 'background-color:red;' ?>'>【= $nation['name'] ?> 】 - - - \sammo\getMapTheme(), + 'procRes' => [ + 'nations' => $nationList + ], + ]; } + + + } diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index 6efd3be9..536276df 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -187,57 +187,4 @@ class che_발령 extends Command\NationCommand ] ]; } - - public function getJSPlugins(): array - { - return [ - 'defaultSelectCityByMap' - ]; - } - - public function getForm(): string - { - $db = DB::db(); - - $nationID = $this->generalObj->getNationID(); - - $troops = Util::convertArrayToDict($db->query('SELECT * FROM troop WHERE nation=%i', $nationID), 'troop_leader'); - $destRawGenerals = $db->query('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); - $destGeneralList = []; - foreach ($destRawGenerals as $destGeneral) { - $nameColor = \sammo\getNameColor($destGeneral['npc']); - if ($nameColor) { - $nameColor = " style='color:{$nameColor}'"; - } - - $name = $destGeneral['name']; - if ($destGeneral['officer_level'] >= 5) { - $name = "*{$name}*"; - } - - $destGeneral['name'] = $name; - $destGeneral['color'] = $nameColor; - $destGeneralList[] = $destGeneral; - } - ob_start(); -?> - = \sammo\getMapHtml() ?> - 선택된 도시로 아국 장수를 발령합니다. - 아국 도시로만 발령이 가능합니다. - 목록을 선택하거나 도시를 클릭하세요. - - - ' = $destGeneral['color'] ?>>= $destGeneral['name'] ?>[= CityConst::byID($destGeneral['city'])->name ?>] - (= $destGeneral['leadership'] ?>/= $destGeneral['strength'] ?>/= $destGeneral['intel'] ?>) - <병= number_format($destGeneral['crew']) ?>/훈= $destGeneral['train'] ?>/사= $destGeneral['atmos'] ?>/= $destGeneral['troop'] ? $troops[$destGeneral['troop']]['name'] : '-' ?>> - - - - - = \sammo\optionsForCities() ?> - - - - - {{ props.option.title }} - ({{ props.option.info }}) + + {{ props.option.title }} + ({{ props.option.info }}) {{ props.option.simpleName }} @@ -35,6 +41,7 @@ type SelectedCity = { title: string; simpleName: string; info?: string; + notAvailable?: boolean; }; export default defineComponent({ @@ -54,9 +61,9 @@ export default defineComponent({ const target = this.targets.get(val); this.selectedCity = target; }, - selectedCity(val: SelectedCity){ - this.$emit('update:modelValue', val.value); - } + selectedCity(val: SelectedCity) { + this.$emit("update:modelValue", val.value); + }, }, data() { const citiesForFind = []; @@ -69,7 +76,7 @@ export default defineComponent({ title: name, info: info, simpleName: name, - searchText: `${name} ${filteredTextH} ${filteredTextA}` + searchText: `${name} ${filteredTextH} ${filteredTextA}`, }; if (value == this.modelValue) { selectedCity = obj; diff --git a/hwe/ts/processing/Nation/che_국호변경.vue b/hwe/ts/processing/Nation/che_국호변경.vue new file mode 100644 index 00000000..b6f7ac48 --- /dev/null +++ b/hwe/ts/processing/Nation/che_국호변경.vue @@ -0,0 +1,53 @@ + + + + + 나라의 이름을 바꿉니다. 황제가 된 후 1회 가능합니다. + 국명 : + + + + + + + {{ commandName }} + + + + + + + diff --git a/hwe/ts/processing/Nation/che_급습.vue b/hwe/ts/processing/Nation/che_급습.vue new file mode 100644 index 00000000..7f8b7209 --- /dev/null +++ b/hwe/ts/processing/Nation/che_급습.vue @@ -0,0 +1,100 @@ + + + + + + + 선택된 국가에 급습을 발동합니다. + 선포, 전쟁중인 상대국에만 가능합니다. + 상대 국가를 목록에서 선택하세요. + 배경색은 현재 급습 불가능 국가는 붉은색으로 + 표시됩니다. + + + + + + + {{ commandName }} + + + + + + + diff --git a/hwe/ts/processing/Nation/index.ts b/hwe/ts/processing/Nation/index.ts index f192048a..38c83d85 100644 --- a/hwe/ts/processing/Nation/index.ts +++ b/hwe/ts/processing/Nation/index.ts @@ -1,3 +1,5 @@ export { default as che_국기변경 } from "./che_국기변경.vue"; +export { default as che_국호변경 } from "./che_국호변경.vue"; +export { default as che_급습 } from "./che_급습.vue"; export { default as che_발령 } from "./che_발령.vue"; export { default as che_포상 } from "./che_포상.vue"; \ No newline at end of file diff --git a/hwe/ts/processing/NationSelect.vue b/hwe/ts/processing/NationSelect.vue new file mode 100644 index 00000000..4bc6ba17 --- /dev/null +++ b/hwe/ts/processing/NationSelect.vue @@ -0,0 +1,100 @@ + + + + + {{ props.option.title }} + ({{ props.option.info }}) + {{ props.option.notAvailable ? "(불가)" : undefined }} + + + + {{ props.option.simpleName }} + + + + diff --git a/hwe/ts/processing/processingRes.ts b/hwe/ts/processing/processingRes.ts index ea380147..23e4980c 100644 --- a/hwe/ts/processing/processingRes.ts +++ b/hwe/ts/processing/processingRes.ts @@ -51,4 +51,16 @@ export type procGeneralRawItemList = procGeneralRawItem[]; export function convertGeneralList(keys: procGeneralKeyList, rawList: procGeneralRawItemList): procGeneralList{ return combineArray(rawList, keys) as procGeneralList; -} \ No newline at end of file +} + + +export type procNationItem = { + id: number, + name: string, + color: string, + power: number, + info?: string, + notAvailable?: boolean, +}; + +export type procNationList = procNationItem[]; \ No newline at end of file