diff --git a/hwe/sammo/Command/General/che_장비매매.php b/hwe/sammo/Command/General/che_장비매매.php index a14f46e3..ea8f4954 100644 --- a/hwe/sammo/Command/General/che_장비매매.php +++ b/hwe/sammo/Command/General/che_장비매매.php @@ -1,13 +1,17 @@ '명마', - 'weapon'=>'무기', - 'book'=>'서적', - 'item'=>'도구', + 'horse' => '명마', + 'weapon' => '무기', + 'book' => '서적', + 'item' => '도구', ]; - protected function argTest():bool{ - if($this->arg === null){ + protected function argTest(): bool + { + if ($this->arg === null) { return false; } - $itemType = $this->arg['itemType']??null; - if(!in_array($itemType, array_keys(static::$itemMap))){ + $itemType = $this->arg['itemType'] ?? null; + if (!in_array($itemType, array_keys(static::$itemMap))) { return false; } - $itemCode = $this->arg['itemCode']??null; - if(!key_exists($itemCode, GameConst::$allItems[$itemType]) && $itemCode !== 'None'){ + $itemCode = $this->arg['itemCode'] ?? null; + if (!key_exists($itemCode, GameConst::$allItems[$itemType]) && $itemCode !== 'None') { return false; } $itemClass = buildItemClass($itemCode); - if(!$itemClass->isBuyable()){ + if (!$itemClass->isBuyable()) { return false; } $this->arg = [ - 'itemType'=>$itemType, - 'itemCode'=>$itemCode + 'itemType' => $itemType, + 'itemCode' => $itemCode ]; return true; } - protected function init(){ + protected function init() + { $general = $this->generalObj; $this->setCity(); $this->setNation(); - $this->minConditionConstraints=[ + $this->minConditionConstraints = [ ConstraintHelper::ReqCityTrader($general->getNPCType()), ]; } @@ -76,26 +83,25 @@ class che_장비매매 extends Command\GeneralCommand{ [$reqGold, $reqRice] = $this->getCost(); - $this->fullConditionConstraints=[ + $this->fullConditionConstraints = [ ConstraintHelper::ReqCityTrader($general->getNPCType()), ConstraintHelper::ReqCityCapacity('secu', '치안 수치', $itemClass->getReqSecu()), ConstraintHelper::ReqGeneralGold($reqGold), ConstraintHelper::ReqGeneralRice($reqRice), ]; - if($itemCode === 'None'){ + if ($itemCode === 'None') { $this->fullConditionConstraints[] = ConstraintHelper::ReqGeneralValue($itemType, $itemTypeName, '!=', 'None'); - } - else if($itemCode == $general->getVar($itemType)){ + } else if ($itemCode == $general->getVar($itemType)) { $this->fullConditionConstraints[] = ConstraintHelper::AlwaysFail('이미 가지고 있습니다.'); - } - else if(!buildItemClass($general->getVar($itemType))->isBuyable()){ + } else if (!buildItemClass($general->getVar($itemType))->isBuyable()) { $this->fullConditionConstraints[] = ConstraintHelper::AlwaysFail('이미 진귀한 것을 가지고 있습니다.'); } } - public function getCost():array{ - if(!$this->isArgValid){ + public function getCost(): array + { + if (!$this->isArgValid) { return [0, 0]; } @@ -106,19 +112,22 @@ class che_장비매매 extends Command\GeneralCommand{ return [$reqGold, 0]; } - public function getPreReqTurn():int{ + public function getPreReqTurn(): int + { return 0; } - public function getPostReqTurn():int{ + public function getPostReqTurn(): int + { return 0; } - public function getBrief():string{ + public function getBrief(): string + { $itemType = $this->arg['itemType']; $itemCode = $this->arg['itemCode']; - if($itemCode === 'None'){ + if ($itemCode === 'None') { $itemTypeName = static::$itemMap[$itemType]; $josaUl = JosaUtil::pick($itemTypeName, '을'); return "{$itemTypeName}{$josaUl} 판매"; @@ -132,8 +141,9 @@ class che_장비매매 extends Command\GeneralCommand{ return "【{$itemName}】{$josaUl} 구입"; } - public function run():bool{ - if(!$this->hasFullConditionMet()){ + public function run(): bool + { + if (!$this->hasFullConditionMet()) { throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도'); } @@ -145,11 +155,10 @@ class che_장비매매 extends Command\GeneralCommand{ $itemType = $this->arg['itemType']; $itemCode = $this->arg['itemCode']; - if($itemCode === 'None'){ + if ($itemCode === 'None') { $buying = false; $itemCode = $general->getVar($itemType); - } - else{ + } else { $buying = true; } $itemObj = buildItemClass($itemCode); @@ -161,12 +170,11 @@ class che_장비매매 extends Command\GeneralCommand{ $logger = $general->getLogger(); - if($buying){ + if ($buying) { $logger->pushGeneralActionLog("{$itemName}{$josaUl} 구입했습니다. <1>$date"); $general->increaseVarWithLimit('gold', -$cost, 0); $general->setVar($itemType, $itemCode); - } - else{ + } else { $logger->pushGeneralActionLog("{$itemName}{$josaUl} 판매했습니다. <1>$date"); $general->increaseVarWithLimit('gold', $cost / 2); $general->deleteItem($itemType); @@ -183,6 +191,60 @@ class che_장비매매 extends Command\GeneralCommand{ return true; } + public function exportJSVars(): array + { + $general = $this->generalObj; + $db = DB::db(); + $citySecu = $db->queryFirstField('SELECT secu FROM city WHERE city = %i', $this->generalObj->getCityID()); + $itemList = []; + foreach (GameConst::$allItems as $itemType => $itemCategories) { + $typeName = static::$itemMap[$itemType]; + $values = []; + foreach ($itemCategories as $itemCode => $cnt) { + if ($cnt > 0) { + continue; + } + $item = buildItemClass($itemCode); + if (!$item->isBuyable()) { + continue; + } + $values[] = [ + 'id'=>$itemCode, + 'name'=>$item->getName(), + 'reqSecu'=>$item->getReqSecu(), + 'cost'=>$item->getCost(), + 'info'=>$item->getInfo(), + 'isBuyable'=>$item->isBuyable(),//항상 true지만, 일관성을 위해 + ]; + } + $itemList[$itemType] = [ + 'typeName'=>$typeName, + 'values'=>$values + ]; + } + + $ownItem = []; + foreach($general->getItems() as $itemType => $item){ + $ownItem[$itemType] = [ + 'id'=>$item->getRawClassName(), + 'name'=>$item->getName(), + 'reqSecu'=>$item->getReqSecu(), + 'cost'=>$item->getCost(), + 'info'=>$item->getInfo(), + 'isBuyable'=>$item->isBuyable(), + ]; + } + + return [ + 'procRes' => [ + 'citySecu'=>$citySecu, + 'gold'=>$general->getVar('gold'), + 'itemList'=>$itemList, + 'ownItem'=>$ownItem, + ] + ]; + } + public function getForm(): string { $form = []; @@ -194,49 +256,49 @@ class che_장비매매 extends Command\GeneralCommand{ ob_start(); ?> - - -장비를 구입하거나 매각합니다.
-현재 구입 불가능한 것은 붉은색으로 표시됩니다.
-현재 도시 치안 :    현재 자금 :
-장비 : + 장비를 구입하거나 매각합니다.
+ 현재 구입 불가능한 것은 붉은색으로 표시됩니다.
+ 현재 도시 치안 :    현재 자금 :
+ 장비 : +
= { + horse: '명마', + weapon: '무기', + book: '서적', + item: '도구', +} + export declare type Colors = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light'; export type IDItem = { @@ -147,4 +155,8 @@ export type ToastType = { } export const keyScreenMode = 'sam.screenMode'; -export type ScreenModeType = 'auto'|'500px'|'1000px'; \ No newline at end of file +export type ScreenModeType = 'auto'|'500px'|'1000px'; + +export declare type ValuesOf = T[keyof T]; + +export const NoneValue = 'None' as const; \ No newline at end of file diff --git a/hwe/ts/processing/General/che_임관.vue b/hwe/ts/processing/General/che_임관.vue index d207f60b..08d33911 100644 --- a/hwe/ts/processing/General/che_임관.vue +++ b/hwe/ts/processing/General/che_임관.vue @@ -20,11 +20,20 @@
국가명
임관권유문
+
+ {{ toggleZoom ? "작게 보기" : "크게 보기" }} +
* { + display: none; + } } @include media-500px { + .nation-list .nation-row.nation-header { + display: grid; + grid-template-columns: 3fr 1fr; + grid-template-rows: 1fr 1fr; + + .zoom-toggle { + grid-column: 2/3; + grid-row: 1/3; + } + } + .nation-list .nation-row { display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr minmax(1fr, calc(200px * 500 / 870)); } - .nation-scout-plate { - max-height: calc(200px * 500 / 870); - overflow: hidden; + .on-fit { + .nation-scout-plate { + max-height: calc(200px * 500 / 870); + overflow: hidden; + } + + .nation-scout-msg { + width: 870px; + transform-origin: 0px 0px; + transform: scale(calc(500 / 870)); + } } - .nation-scout-msg { - width: 870px; - transform-origin: 0px 0px; - transform: scale(calc(500 / 870)); + .on-zoom { + .nation-scout-plate { + max-height: 200px; + overflow-y: hidden; + overflow-x: auto; + } + + .nation-scout-msg { + max-width: 870px; + } } } \ 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..0a374d15 --- /dev/null +++ b/hwe/ts/processing/General/che_장비매매.vue @@ -0,0 +1,191 @@ + + + \ No newline at end of file diff --git a/hwe/ts/processing/General/index.ts b/hwe/ts/processing/General/index.ts index fd27236a..da45cace 100644 --- a/hwe/ts/processing/General/index.ts +++ b/hwe/ts/processing/General/index.ts @@ -4,6 +4,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"; @@ -25,6 +26,7 @@ export const commandMap: Record = { che_숙련전환, che_이동: ProcessCity, che_임관, + che_장비매매, che_장수대상임관, che_징병, che_증여: ProcessGeneralAmount, diff --git a/hwe/ts/processing/SelectCity.vue b/hwe/ts/processing/SelectCity.vue index 40d47078..707c4bcf 100644 --- a/hwe/ts/processing/SelectCity.vue +++ b/hwe/ts/processing/SelectCity.vue @@ -36,8 +36,7 @@ -