From 86dd573e2f89f12eb24fe3def74a1f5d0e35cccd Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 22 Dec 2021 21:15:26 +0900 Subject: [PATCH] =?UTF-8?q?feat(WIP):=20processing=20=EC=88=99=EB=A0=A8?= =?UTF-8?q?=EC=A0=84=ED=99=98,=20=EB=B6=88=EA=B0=80=EC=B9=A8=EC=A0=9C?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Command/General/che_숙련전환.php | 68 +++--- hwe/sammo/Command/General/che_징병.php | 172 -------------- hwe/sammo/Command/General/che_헌납.php | 18 -- hwe/sammo/Command/Nation/che_불가침제의.php | 84 +++---- .../Command/Nation/che_불가침파기제의.php | 54 ----- hwe/ts/processing/General/che_숙련전환.vue | 220 ++++++++++++++++++ hwe/ts/processing/General/index.ts | 4 +- hwe/ts/processing/Nation/che_불가침제의.vue | 132 +++++++++++ hwe/ts/processing/Nation/index.ts | 2 + 9 files changed, 414 insertions(+), 340 deletions(-) create mode 100644 hwe/ts/processing/General/che_숙련전환.vue create mode 100644 hwe/ts/processing/Nation/che_불가침제의.vue diff --git a/hwe/sammo/Command/General/che_숙련전환.php b/hwe/sammo/Command/General/che_숙련전환.php index 84e6bc46..a8664be5 100644 --- a/hwe/sammo/Command/General/che_숙련전환.php +++ b/hwe/sammo/Command/General/che_숙련전환.php @@ -16,6 +16,7 @@ use \sammo\Command; use \sammo\ServConfig; use function \sammo\getDexCall; +use function sammo\getDexLevelList; use function \sammo\tryUniqueItemLottery; use \sammo\Constraint\Constraint; @@ -37,6 +38,9 @@ class che_숙련전환 extends Command\GeneralCommand /** @var string */ protected $destArmTypeName; + static $decreaseCoeff = 0.4; + static $convertCoeff = 0.9; + protected function argTest(): bool { if ($this->arg === null) { @@ -162,9 +166,9 @@ class che_숙련전환 extends Command\GeneralCommand $logger = $general->getLogger(); $srcDex = $general->getVar('dex' . $this->srcArmType); - $cutDex = Util::toInt($srcDex * 0.4); + $cutDex = Util::toInt($srcDex * static::$decreaseCoeff); $cutDexText = number_format($cutDex); - $addDex = Util::toInt($cutDex * 9 / 10); + $addDex = Util::toInt($cutDex * static::$convertCoeff); $addDexText = number_format($addDex); $general->increaseVar('dex' . $this->srcArmType, -$cutDex); @@ -189,47 +193,33 @@ class che_숙련전환 extends Command\GeneralCommand return true; } - public function getForm(): string + public function exportJSVars(): array { - $db = DB::db(); - $general = $this->generalObj; - - $dexSrcTexts = []; - $dexDestTexts = []; + $ownDexList = []; foreach (GameUnitConst::allType() as $armType => $armName) { - $dexVal = $general->getVar('dex' . $armType); - $dexValText = number_format($dexVal); - $cutDex = Util::toInt($dexVal * 0.4); - $addDex = Util::toInt($cutDex * 9 / 10); - $addDexText = number_format($addDex); - $newDex = $dexVal - $cutDex; - $beforeDexLevel = getDexCall($dexVal); - $afterDexLevel = getDexCall($newDex); - - $dexSrcTexts[$armType] = "{$armName} ({$beforeDexLevel} ⇒ {$afterDexLevel}, {$addDexText} 전환)"; - $dexDestTexts[$armType] = "{$armName} ({$dexValText})"; + $ownDexList[] = [ + 'armType' => $armType, + 'name' => $armName, + 'amount' => $general->getVar('dex' . $armType), + ]; } - ob_start(); -?> - 본인의 특정 병종 숙련을 40% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종 숙련으로 전환합니다.
- - - 숙련을 - - - 숙련으로
- -$dexKey, + 'color'=>$color, + 'name'=>$name + ]; + } + return [ + 'procRes' => [ + 'ownDexList' => $ownDexList, + 'dexLevelList' => $dexLevelList, + 'decreaseCoeff' => static::$decreaseCoeff, + 'convertCoeff' => static::$convertCoeff, + ] + ]; } } diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index 5fc86816..e166d78a 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -332,176 +332,4 @@ class che_징병 extends Command\GeneralCommand ] ]; } - - public function getForm(): string - { - $db = DB::db(); - - $general = $this->generalObj; - - [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $general->getNationID()); - if (!$nationLevel) { - $nationLevel = 0; - } - - if (!$tech) { - $tech = 0; - } - - $ownCities = []; - $ownRegions = []; - $year = $this->env['year']; - $startyear = $this->env['startyear']; - - $relativeYear = $year - $startyear; - - foreach (DB::db()->query('SELECT city, region from city where nation = %i', $general->getNationID()) as $city) { - $ownCities[$city['city']] = 1; - $ownRegions[$city['region']] = 1; - } - - $leadership = $general->getLeadership(); - $fullLeadership = $general->getLeadership(false); - $abil = getTechAbil($tech); - - $armTypes = []; - - foreach (GameUnitConst::allType() as $armType => $armName) { - $armTypeCrews = []; - - foreach (GameUnitConst::byType($armType) as $unit) { - $crewObj = new \stdClass; - $crewObj->showDefault = 'true'; - - $crewObj->id = $unit->id; - - if ($unit->reqTech == 0) { - $crewObj->bgcolor = 'green'; - } else { - $crewObj->bgcolor = 'limegreen'; - } - - if (!$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech)) { - $crewObj->showDefault = 'false'; - $crewObj->bgcolor = 'red'; - } - - $crewObj->baseRice = $general->onCalcDomestic($this->getName(), 'rice', $unit->riceWithTech($tech), ['armType' => $unit->armType]); - $crewObj->baseCost = $general->onCalcDomestic($this->getName(), 'cost', $unit->costWithTech($tech), ['armType' => $unit->armType]); - - $crewObj->name = $unit->name; - $crewObj->attack = $unit->attack + $abil; - $crewObj->defence = $unit->defence + $abil; - $crewObj->speed = $unit->speed; - $crewObj->avoid = $unit->avoid; - if ($this->env['show_img_level'] < 2) { - $crewObj->img = ServConfig::$sharedIconPath . "/default.jpg"; - } else { - $crewObj->img = ServConfig::$gameImagePath . "/crewtype" . $unit->id . ".png"; - } - - $crewObj->info = join('
', $unit->info); - - - $armTypeCrews[] = $crewObj; - } - $armTypes[] = [$armName, $armTypeCrews]; - } - $commandName = $this->getName(); - - $techLevelText = getTechCall($tech); - - $crew = $general->getVar('crew'); - $gold = $general->getVar('gold'); - $crewTypeObj = $general->getCrewTypeObj(); - - ob_start(); -?> - - 병사를 모집합니다. - - 훈련과 사기치는 낮지만 가격이 저렴합니다.
- - 훈련과 사기치는 높지만 자금이 많이 듭니다. - - 가능한 수보다 많게 입력하면 가능한 최대 병사를 모집합니다.
- 이미 병사가 있는 경우 추가되며, 병종이 다를경우는 기존의 병사는 소집해제됩니다.
- 현재 가능한 병종은 녹색으로 표시되며,
- 현재 가능한 특수병종은 초록색으로 표시됩니다.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
불가능한 병종 표시
- -
모병은 가격 2배의 자금이 소요됩니다.
- -
- 현재 기술력 : - 현재 통솔 : - 현재 병종 : name ?> - 현재 병사 : - 현재 자금 : -
사진병종공격방어기동회피가격군량병사수행동특징
계열
name ?>attack ?>defence ?>speed ?>avoid ?>baseCostShort ?>baseRiceShort ?> -
- 00명 - 원 - -
info ?>
- - - - - 자신의 자금이나 군량을 국가 재산으로 헌납합니다.
- -
-generalObj; $nationID = $generalObj->getNationID(); - - $db = DB::db(); - + $nationList = []; + $testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn()); $currYear = $this->env['year']; - $diplomacyStatus = Util::convertArrayToDict( - $db->query('SELECT * FROM diplomacy WHERE me = %i', $nationID), - 'you' - ); - - $nationList = []; foreach (getAllNationStaticInfo() as $destNation) { - if ($destNation['nation'] == $nationID) { - continue; - } - - $testCommand = new static($generalObj, $this->env, $this->getLastTurn(), [ + $testCommand = new static($generalObj, $this->env, $testTurn, [ 'destNationID' => $destNation['nation'], - 'year' => $currYear + 1, - 'month' => 12 + 'year' => $currYear + 2, + 'month' => 1 ]); + + $nationTarget = [ + 'id' => $destNation['nation'], + 'name' => $destNation['name'], + 'color' => $destNation['color'], + 'power' => $destNation['power'], + ]; if (!$testCommand->hasFullConditionMet()) { - $destNation['cssBgColor'] = 'background-color:red;'; - } else if ($diplomacyStatus[$destNation['nation']]['state'] == 7) { - $destNation['cssBgColor'] = 'background-color:blue;'; - } else { - $destNation['cssBgColor'] = ''; + $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'], + 'minYear' => $this->env['year'] + 1, + 'maxYear' => $this->env['year'] + 20, + 'month' => $this->env['month'], + ], + ]; } } diff --git a/hwe/sammo/Command/Nation/che_불가침파기제의.php b/hwe/sammo/Command/Nation/che_불가침파기제의.php index 2848ea24..74e1245b 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기제의.php +++ b/hwe/sammo/Command/Nation/che_불가침파기제의.php @@ -207,58 +207,4 @@ class che_불가침파기제의 extends Command\NationCommand{ ], ]; } - - public function getJSPlugins(): array - { - return [ - 'defaultSelectNationByMap' - ]; - } - - public function getForm(): string - { - $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; - } - - if($diplomacyStatus[$destNation['nation']]['state'] != 7){ - $destNation['cssBgColor'] = 'background-color:red;'; - } - else{ - $destNation['cssBgColor'] = ''; - } - - $nationList[] = $destNation; - } - - ob_start(); -?> -
-불가침중인 국가에 조약 파기를 제의합니다.
-제의할 국가를 목록에서 선택하세요.
-배경색은 현재 제의가 불가능한 국가는 붉은색으로 표시됩니다.
-
-에게 - - + +
+
+ 본인의 특정 병종 숙련을 40% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종 + 숙련으로 전환합니다. +
+
+
+ 감소 대상 숙련 : + + {{ dexInfo.name }} ({{ dexInfo.currentInfo.name }}) + +
+
+ 전환 대상 숙련 : + + {{ dexInfo.name }} ({{ dexInfo.currentInfo.name }}) + +
+
+ {{ commandName }} +
+
+
{{dexFullInfo.get(srcArmTypeID).name}}
+
[
+
{{dexFullInfo.get(srcArmTypeID).currentInfo.name}}
+
{{convNumberFormat(dexFullInfo.get(srcArmTypeID).currentInfo.amount)}}
+
]
+
+
[
+
{{dexFullInfo.get(srcArmTypeID).decreasedInfo.name}}
+
{{convNumberFormat(dexFullInfo.get(srcArmTypeID).decreasedInfo.amount)}}
+
]
+
+
+
{{dexFullInfo.get(destArmTypeID).name}}
+
[
+ + +
]
+
+
[
+
{{dexFullInfo.get(destArmTypeID).afterInfo.get(srcArmTypeID).name}}
+
{{convNumberFormat(dexFullInfo.get(destArmTypeID).afterInfo.get(srcArmTypeID).amount)}}
+
]
+
+ + +
+
+ + + + diff --git a/hwe/ts/processing/General/index.ts b/hwe/ts/processing/General/index.ts index d8f92378..fd27236a 100644 --- a/hwe/ts/processing/General/index.ts +++ b/hwe/ts/processing/General/index.ts @@ -2,6 +2,7 @@ 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"; @@ -21,6 +22,7 @@ export const commandMap: Record = { che_모병: che_징병, che_선동: ProcessCity, che_선양, + che_숙련전환, che_이동: ProcessCity, che_임관, che_장수대상임관, @@ -36,5 +38,5 @@ export const commandMap: Record = { /* - 항목들 -고유 양식 - 숙련전환, 장비매매 +고유 양식 - 장비매매 */ \ No newline at end of file diff --git a/hwe/ts/processing/Nation/che_불가침제의.vue b/hwe/ts/processing/Nation/che_불가침제의.vue new file mode 100644 index 00000000..065f5343 --- /dev/null +++ b/hwe/ts/processing/Nation/che_불가침제의.vue @@ -0,0 +1,132 @@ + + + diff --git a/hwe/ts/processing/Nation/index.ts b/hwe/ts/processing/Nation/index.ts index d550775e..267c943a 100644 --- a/hwe/ts/processing/Nation/index.ts +++ b/hwe/ts/processing/Nation/index.ts @@ -1,6 +1,7 @@ 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 ProcessNation } from "../ProcessNation.vue"; @@ -16,6 +17,7 @@ export const commandMap: Record = { che_물자원조, che_발령: ProcessGeneralCity, che_백성동원: ProcessCity, + che_불가침제의, che_불가침파기제의: ProcessNation, che_선전포고: ProcessNation, che_수몰: ProcessCity,