diff --git a/hwe/func.php b/hwe/func.php index d9dfe137..013657c9 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -48,8 +48,10 @@ function getNationStaticInfo($nationID, $forceRefresh=false) 'type'=>GameConst::$neutralNationType, 'level'=>0, 'capital'=>0, - 'gennum'=>1, - 'power'=>1 + 'gold'=>0, + 'rice'=>2000, + 'tech'=>0, + 'gennum'=>1 ]; } diff --git a/hwe/js/processing.js b/hwe/js/processing.js index 258bd4e6..76bbbb9a 100644 --- a/hwe/js/processing.js +++ b/hwe/js/processing.js @@ -25,7 +25,7 @@ function reserveTurn(turnList, command, arg){ jQuery(function($){ -$('#commonSubmit').click(function(){ +window.submitAction = function(){ //checkCommandArg 참고 var availableArgumentList = { @@ -84,7 +84,9 @@ $('#commonSubmit').click(function(){ console.log(argument); reserveTurn(turnList, command, argument); -}); +}; + +$('#commonSubmit').click(submitAction); }); \ No newline at end of file diff --git a/hwe/js/recruitCrewForm.js b/hwe/js/recruitCrewForm.js index 9570f352..742cb3a7 100644 --- a/hwe/js/recruitCrewForm.js +++ b/hwe/js/recruitCrewForm.js @@ -15,8 +15,8 @@ $(function(){ var $postForm = $('#post_form'); - var $formAmount = $postForm.find('.form_amount'); - var $formCrewtype = $postForm.find('.form_crewtype'); + var $formAmount = $('#amount'); + var $formCrewtype = $('#crewType'); $('.form_double').on('keyup change',function(e){ var $this = $(this); var $parent = $this.parents('.input_form'); @@ -26,7 +26,7 @@ $(function(){ $formAmount.val($this.val()); if(e.which === 13){ - $postForm.submit(); + submitAction(); } return false; }); @@ -77,10 +77,21 @@ $(function(){ var $input = $parent.find('.form_double'); $formCrewtype.val(crewtype); - $formAmount.val($input.val()); + $formAmount.val($input.val()*100); - $postForm.submit(); + submitAction(); }); $('.btn_fill').click(); + + $('#show_unavailable_troops').change(function(){ + var show = $('#show_unavailable_troops').is(":checked"); + if(show){ + $('.show_default_false').show(); + } + else{ + $('.show_default_false').hide(); + } + }); + $('.show_default_false').hide(); }); \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_징병.php b/hwe/sammo/Command/General/che_징병.php index 4ec18750..9d50d924 100644 --- a/hwe/sammo/Command/General/che_징병.php +++ b/hwe/sammo/Command/General/che_징병.php @@ -2,18 +2,20 @@ namespace sammo\Command\General; use \sammo\{ - DB, Util, JosaUtil, + DB, Util, JosaUtil, Session, KVStorage, General, ActionLogger, GameConst, GameUnitConst, LastTurn, - Command + Command, + ServConfig }; use function \sammo\{ - function getTechCall, - tryUniqueItemLottery + getTechCall, + tryUniqueItemLottery, + getTechAbil }; use \sammo\Constraint\Constraint; @@ -112,6 +114,13 @@ class che_징병 extends Command\GeneralCommand{ } + public function getBrief():string{ + $crewTypeName = $this->reqCrewType->name; + $amount = $this->reqCrew; + $commandName = static::getName(); + return "【{$crewTypeName}】 {$amount}명 {$commandName}"; + } + public function getCommandDetailTitle():string{ return "{$this->getName()}(통솔경험)"; } @@ -217,14 +226,10 @@ class che_징병 extends Command\GeneralCommand{ public function getForm(): string { $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $userID = Session::getUserID(); $general = $this->generalObj; - - - [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $me['nation']); + [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $general->getNationID()); if(!$nationLevel){ $nationLevel = 0; } @@ -233,20 +238,20 @@ class che_징병 extends Command\GeneralCommand{ $tech = 0; } - $lbonus = setLeadershipBonus($me, $nationLevel); - $ownCities = []; $ownRegions = []; - [$year, $startyear] = $gameStor->getValuesAsArray(['year','startyear']); + $year = $this->env['year']; + $startyear = $this->env['startyear']; $relativeYear = $year - $startyear; - foreach(DB::db()->query('SELECT city, region from city where nation = %i', $me['nation']) as $city){ + 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); + $leadership = $general->getLeadership(); + $fullLeadership = $general->getLeadership(false); $abil = getTechAbil($tech); $armTypes = []; @@ -256,48 +261,31 @@ class che_징병 extends Command\GeneralCommand{ foreach(GameUnitConst::byType($armType) as $unit){ $crewObj = new \stdClass; - if(!$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech)){ - continue; //TODO: 불가능한 병종도 보여줄 필요가 있음. - } - + $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 = $unit->rice * getTechCost($tech); - $crewObj->baseCost = CharCost($unit->costWithTech($tech), $me['personal']); + $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]); - $armType = $unit->armType; - if($me['special2'] == 50 && $armType == GameUnitConst::T_FOOTMAN){ - $crewObj->baseCost *= 0.9; - } - else if($me['special2'] == 51 && $armType == GameUnitConst::T_ARCHER){ - $crewObj->baseCost *= 0.9; - } - else if($me['special2'] == 52 && $armType == GameUnitConst::T_CAVALRY){ - $crewObj->baseCost *= 0.9; - } - else if($me['special2'] == 53 && $armType == GameUnitConst::T_WIZARD){ - $crewObj->baseCost *= 0.9; - } - else if($me['special2'] == 54 && $armType == GameUnitConst::T_SIEGE){ - $crewObj->baseCost *= 0.9; - } - else if($me['special2'] == 72) { - $crewObj->baseCost *= 0.5; - } - $crewObj->name = $unit->name; $crewObj->attack = $unit->attack + $abil; $crewObj->defence = $unit->defence + $abil; $crewObj->speed = $unit->speed; $crewObj->avoid = $unit->avoid; - if($gameStor->show_img_level < 2) { + if($this->env['show_img_level'] < 2) { $crewObj->img = ServConfig::$sharedIconPath."/default.jpg"; } else{ @@ -318,24 +306,10 @@ class che_징병 extends Command\GeneralCommand{ $techLevelText = getTechCall($tech); - $crew = $general->getRaw('crew'); - $gold = $general->getRaw('gold'); + $crew = $general->getVar('crew'); + $gold = $general->getVar('gold'); $crewTypeObj = $general->getCrewTypeObj(); - - - $templates = new \League\Plates\Engine('templates'); - return $templates->render('recruitCrewForm', [ - 'crewType'=>GameUnitConst::byId($me['crewtype'])->id, - 'crewTypeName'=>GameUnitConst::byId($me['crewtype'])->name, - 'crew'=>$me['crew'], - 'gold'=>$me['gold'], - 'turn'=>$turn, - 'armTypes'=>$armTypes, - ]); - - - $destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID()); ob_start(); ?> @@ -352,9 +326,11 @@ class che_징병 extends Command\GeneralCommand{ + +
모병은 가격 2배의 자금이 소요됩니다.
+
불가능한 병종 표시
-
모병은 가격 2배의 자금이 소요됩니다.
현재 기술력 : @@ -384,6 +360,7 @@ class che_징병 extends Command\GeneralCommand{
- - + +