diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 2b66fc45..1147fb2f 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -12,7 +12,8 @@ use \sammo\{ use function \sammo\{ - tryUniqueItemLottery + tryUniqueItemLottery, + printCitiesBasedOnDistance }; use \sammo\Constraint\Constraint; @@ -135,5 +136,31 @@ class che_강행 extends Command\GeneralCommand{ } + public function getJSFiles(): array + { + return [ + 'js/defaultSelectCityByMap.js' + ]; + } + + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + $form[] = << +최대 3칸내 도시로만 강행이 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+'; + $form[] = ''; + $form[] = printCitiesBasedOnDistance($this->generalObj->getCityID(), 3); + + return join("\n",$form); + } + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_건국.php b/hwe/sammo/Command/General/che_건국.php index 1d5ada68..581d8e76 100644 --- a/hwe/sammo/Command/General/che_건국.php +++ b/hwe/sammo/Command/General/che_건국.php @@ -12,7 +12,8 @@ use \sammo\{ use function \sammo\{ - tryUniqueItemLottery + tryUniqueItemLottery, + getAllNationStaticInfo }; use \sammo\Constraint\Constraint; @@ -21,7 +22,7 @@ use sammo\CityConst; use function sammo\getNationTypeClass; use function sammo\refreshNationStaticInfo; use function sammo\GetNationColors; - +use function sammo\newColor; class che_건국 extends Command\GeneralCommand{ @@ -172,5 +173,82 @@ class che_건국 extends Command\GeneralCommand{ return true; } + public function getForm(): string + { + + if(count(getAllNationStaticInfo()) >= $this->env['maxnation']){ + return '더 이상 건국은 불가능합니다.'; + } + + + //NOTE: 새로운 방법이 생기기 전까진 아무색이나 선택 가능하도록 하자. + /* + foreach(GetNationColors() as $color){ + $colorUsed[$color] = 0; + } + foreach(getAllNationStaticInfo() as $nation){ + if($nation['level'] <= 0){ + continue; + } + $colorUsed[$nation['color']]++; + } + + $colorUsedCnt = 0; + foreach($colorUsed as $color=>$used){ + if($used){ + continue; + } + $colorUsedCnt += 1; + } + + //색깔이 다 쓰였으면 그냥 모두 허용 + if($colorUsedCnt === count($colorUsed)){ + foreach(array_keys($colorUsed) as $color){ + $colorUsed[$color] = 0; + } + } + */ + + + $form = []; + + $form[] = '현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.

'; + + foreach(GameConst::$availableNationType as $nationType){ + $nationClass = getNationTypeClass($nationType); + + [$name, $pros, $cons] = [$nationClass::$name, $nationClass::$pros, $nationClass::$cons]; + $form[] = "- $name : {$pros} {$cons}
"; + + } + $form[] = << +국명 : +색깔 : +EOT; + foreach(GameConst::$availableNationType as $nationType){ + $nationClass = getNationTypeClass($nationType); + + $name = $nationClass::$name; + $form[] = ""; + + } + $form[] = ''; + $form[] = ''; + + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php index 3729ca7b..6b501ce9 100644 --- a/hwe/sammo/Command/General/che_등용.php +++ b/hwe/sammo/Command/General/che_등용.php @@ -16,7 +16,9 @@ use function \sammo\{ getDomesticExpLevelBonus, CriticalRatioDomestic, CriticalScoreEx, - tryUniqueItemLottery + tryUniqueItemLottery, + getAllNationStaticInfo, + getNationStaticInfo }; use \sammo\Constraint\Constraint; @@ -148,5 +150,47 @@ class che_등용 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + $db = DB::db(); + $form = []; + + $form[] = << +서신은 개인 메세지로 전달됩니다.
+등용할 장수를 목록에서 선택하세요.
+'; + $form[] = ''; + + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index 4ce9884b..1c69da87 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -12,7 +12,8 @@ use \sammo\{ use function \sammo\{ - tryUniqueItemLottery + tryUniqueItemLottery, + getInvitationList }; use \sammo\Constraint\Constraint; @@ -176,5 +177,61 @@ class che_임관 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + $db = DB::db(); + $form = []; + + $generalObj = $this->generalObj; + + $env = $this->env; + + $joinedNations = Json::decode($db->queryFirstField('SELECT nations FROM general WHERE no = %i', $generalObj->getID())); + + $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation'); + shuffle($nationList); + + $onlyRandom = $env['join_mode'] == 'onlyRandom'; + + foreach($nationList as &$nation){ + if ($onlyRandom && TimeUtil::IsRangeMonth($env['init_year'], $env['init_month'], 1, $env['year'], $env['month']) && $nation['gennum'] >= GameConst::$initialNationGenLimitForRandInit) { + $nation['availableJoin'] = false; + } + else if($env['year'] < $env['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){ + $nation['availableJoin'] = false; + } + else if($nation['scout'] == 1) { + $nation['availableJoin'] = false; + } + else{ + $nation['availableJoin'] = true; + } + + if(in_array($nation['nation'], $joinedNations)){ + $nation['availableJoin'] = false; + } + } + unset($nation); + + $form[] = << +이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.
+바로 군주의 위치로 이동합니다.
+임관할 국가를 목록에서 선택하세요.
+ +EOT; + $form[] = getInvitationList($nationList); + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_장비매매.php b/hwe/sammo/Command/General/che_장비매매.php index 741d31cb..ea227dc8 100644 --- a/hwe/sammo/Command/General/che_장비매매.php +++ b/hwe/sammo/Command/General/che_장비매매.php @@ -17,7 +17,8 @@ use function \sammo\{ tryUniqueItemLottery, getItemCost, getItemInfo, - getItemName + getItemName, + buildItemClass }; use \sammo\Constraint\Constraint; @@ -43,12 +44,14 @@ class che_장비매매 extends Command\GeneralCommand{ return false; } $itemCode = $this->arg['itemCode']??null; - if(!is_int($itemCode)){ + if(!key_exists($itemCode, GameConst::$allItems[$itemType])){ return false; } - if($itemCode < 0 || 6 < $itemCode){ + $itemClass = buildItemClass($itemCode); + if(!$itemClass->isBuyable()){ return false; } + $this->arg = [ 'itemType'=>$itemType, 'itemCode'=>$itemCode @@ -66,12 +69,13 @@ class che_장비매매 extends Command\GeneralCommand{ $itemType = $this->arg['itemType']; $itemTypeName = static::$itemMap[$itemType]; $itemCode = $this->arg['itemCode']; + $itemClass = buildItemClass($itemCode); [$reqGold, $reqRice] = $this->getCost(); $this->runnableConstraints=[ ConstraintHelper::ReqCityTrader($general->getVar('npc')), - ConstraintHelper::ReqCityCapacity('secu', '치안 수치', $itemCode * 1000), + ConstraintHelper::ReqCityCapacity('secu', '치안 수치', $itemClass->getReqSecu()), ConstraintHelper::ReqGeneralGold($reqGold), ConstraintHelper::ReqGeneralRice($reqRice), ]; @@ -82,7 +86,7 @@ class che_장비매매 extends Command\GeneralCommand{ else if($itemCode == $general->getVar($itemType)){ $this->runnableConstraints[] = ConstraintHelper::AlwaysFail('이미 가지고 있습니다.'); } - else if($itemType != 'item' && $general->getVar($itemType) > 6){ + else if($itemType != 'item' && !buildItemClass($general->getVar($itemType))->isBuyable()){ $this->runnableConstraints[] = ConstraintHelper::AlwaysFail('이미 진귀한 것을 가지고 있습니다.'); } @@ -93,7 +97,6 @@ class che_장비매매 extends Command\GeneralCommand{ return [0, 0]; } - $itemType = $this->arg['itemType']; $itemCode = $this->arg['itemCode']; $reqGold = getItemCost($itemCode); @@ -121,7 +124,7 @@ class che_장비매매 extends Command\GeneralCommand{ $itemType = $this->arg['itemType']; $itemCode = $this->arg['itemCode']; - if($itemCode == 0){ + if($itemCode == 'None'){ $buying = false; $itemCode = $general->getVar($itemType); $cost = getItemCost($itemCode); @@ -159,5 +162,58 @@ class che_장비매매 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + $db = DB::db(); + + $citySecu = $db->queryFirstField('SELECT secu FROM city WHERE city = %i', $this->generalObj->getCityID()); + $gold = $this->generalObj->getVar('gold'); + $form[] = << +function updateItemType(elem){ + $('#itemType').val($(elem).data('itemType')); +} + +EOT; + $form[] = ''; + $form[] = << +현재 구입 불가능한 것은 붉은색으로 표시됩니다.
+현재 도시 치안 : {$citySecu}    현재 자금 : {$gold}
+장비 : +EOT; + + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_증여.php b/hwe/sammo/Command/General/che_증여.php index eb41d72e..50029a4c 100644 --- a/hwe/sammo/Command/General/che_증여.php +++ b/hwe/sammo/Command/General/che_증여.php @@ -150,5 +150,64 @@ class che_증여 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + //TODO: 암행부처럼 보여야... + $db = DB::db(); + $form = []; + + $form[] = << +장수를 선택하세요.
+ + + + + + + +EOT; + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index e5658d5a..811fbb42 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -13,7 +13,8 @@ use \sammo\{ use function \sammo\{ tryUniqueItemLottery, - searchDistance + searchDistance, + printCitiesBasedOnDistance }; use \sammo\Constraint\Constraint; @@ -182,5 +183,31 @@ class che_첩보 extends Command\GeneralCommand{ return true; } + public function getJSFiles(): array + { + return [ + 'js/defaultSelectCityByMap.js' + ]; + } + + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + $form[] = << +인접도시일 경우 많은 정보를 얻을 수 있습니다.
+목록을 선택하거나 도시를 클릭하세요.
+'; + $form[] = ''; + $form[] = printCitiesBasedOnDistance($this->generalObj->getCityID(), 3); + + return join("\n",$form); + } + } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_헌납.php b/hwe/sammo/Command/General/che_헌납.php index 0d4802e6..11e2aad7 100644 --- a/hwe/sammo/Command/General/che_헌납.php +++ b/hwe/sammo/Command/General/che_헌납.php @@ -130,5 +130,44 @@ class che_헌납 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + //TODO: 암행부처럼 보여야... + $form = []; + + $form[] = << + + + + +EOT; + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php index 602a0445..f61d3ec9 100644 --- a/hwe/sammo/Command/General/che_화계.php +++ b/hwe/sammo/Command/General/che_화계.php @@ -290,5 +290,32 @@ class che_화계 extends Command\GeneralCommand{ return true; } + public function getJSFiles(): array + { + return [ + 'js/defaultSelectCityByMap.js' + ]; + } + + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + $josaUl = JosaUtil::pick($this->getName(), '을'); + + $form[] = <<getName()}{$josaUl} 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+'; + $form[] = " +EOT; + $destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID()); + foreach($destRawGenerals as $destGeneral){ + $nameColor = \sammo\getNameColor($destGeneral['npc']); + if($nameColor){ + $nameColor = " style='color:{$nameColor}'"; + } + + $name = $destGeneral['name']; + if($destGeneral['level'] >= 5){ + $name = "*{$name}*"; + } + + $form[] = ""; + } + $form[] = << + + + + +EOT; + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index d2c8e599..279ce518 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -128,4 +128,49 @@ class che_발령 extends Command\NationCommand{ return true; } + + public function getJSFiles(): array + { + return [ + 'js/defaultSelectCityByMap.js' + ]; + } + + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + $db = DB::db(); + + $form[] = << +아국 도시로만 발령이 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+ +EOT; + $form[] = \sammo\optionsForCities(); + $form[] = ''; + $form[] = ''; + + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/Nation/che_선전포고.php b/hwe/sammo/Command/Nation/che_선전포고.php index 6c490d7a..dbbceabf 100644 --- a/hwe/sammo/Command/Nation/che_선전포고.php +++ b/hwe/sammo/Command/Nation/che_선전포고.php @@ -170,4 +170,20 @@ class che_선전포고 extends Command\NationCommand{ return true; } + + public function getJSFiles(): array + { + return [ + 'js/defaultSelectNationByMap.js' + ]; + } + + public function getForm(): string + { + $form = []; + $form[] = \sammo\getMapHtml(); + + + return join("\n",$form); + } } \ No newline at end of file diff --git a/hwe/sammo/Command/Nation/che_포상.php b/hwe/sammo/Command/Nation/che_포상.php index 39c9675f..04e51aa0 100644 --- a/hwe/sammo/Command/Nation/che_포상.php +++ b/hwe/sammo/Command/Nation/che_포상.php @@ -138,4 +138,65 @@ class che_포상 extends Command\NationCommand{ return true; } + + + public function getForm(): string + { + //TODO: 암행부처럼 보여야... + $db = DB::db(); + $form = []; + + $form[] = << +EOT; + $destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID()); + foreach($destRawGenerals as $destGeneral){ + $nameColor = \sammo\getNameColor($destGeneral['npc']); + if($nameColor){ + $nameColor = " style='color:{$nameColor}'"; + } + + $name = $destGeneral['name']; + if($destGeneral['level'] >= 5){ + $name = "*{$name}*"; + } + + $form[] = ""; + } + $form[] = << + + + + +EOT; + return join("\n",$form); + } } \ No newline at end of file