From 9600e18c92a0b8dceda387a9195e50ea8b46e85d Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 27 Nov 2019 13:54:19 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=95=EB=B3=91=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/js/recruitCrewForm.js | 86 ++++++++ hwe/sammo/Command/General/che_선양.php | 28 ++- hwe/sammo/Command/General/che_장비매매.php | 64 +++--- hwe/sammo/Command/General/che_징병.php | 225 +++++++++++++++++++++ 4 files changed, 369 insertions(+), 34 deletions(-) create mode 100644 hwe/js/recruitCrewForm.js diff --git a/hwe/js/recruitCrewForm.js b/hwe/js/recruitCrewForm.js new file mode 100644 index 00000000..9570f352 --- /dev/null +++ b/hwe/js/recruitCrewForm.js @@ -0,0 +1,86 @@ +window.calc = function(id) { + var $obj = $('#crewType{0}'.format(id)); + var crew = $obj.find('.form_double').val(); + var baseCost = $obj.data('cost'); + var $cost = $obj.find('.form_cost'); + + var cost = crew * baseCost; + if(window.is모병){ + cost *= 2; + } + $cost.val(Math.round(cost)); +} + +$(function(){ + + + var $postForm = $('#post_form'); + var $formAmount = $postForm.find('.form_amount'); + var $formCrewtype = $postForm.find('.form_crewtype'); + $('.form_double').on('keyup change',function(e){ + var $this = $(this); + var $parent = $this.parents('.input_form'); + var crewtype = parseInt($parent.data('crewtype')); + calc(crewtype); + $formCrewtype.val(crewtype); + $formAmount.val($this.val()); + + if(e.which === 13){ + $postForm.submit(); + } + return false; + }); + + $('.btn_half').click(function(){ + var $this = $(this); + var $parent = $this.closest('.input_form'); + var crewtype = parseInt($parent.data('crewtype')); + var $input = $parent.find('.form_double:eq(0)'); + + var fillValue = Math.round(leadership / 2); + $formCrewtype.val(crewtype); + $input.val(fillValue).change(); + return false; + }); + + $('.btn_fill').click(function(){ + var $this = $(this); + var $parent = $this.closest('.input_form'); + var crewtype = parseInt($parent.data('crewtype')); + var $input = $parent.find('.form_double:eq(0)'); + + var fillValue = Math.ceil((leadership*100 - currentCrew)/100); + if(crewtype != currentCrewType){ + fillValue = leadership; + } + $formCrewtype.val(crewtype); + $input.val(fillValue).change(); + return false; + }); + + $('.btn_full').click(function(){ + var $this = $(this); + var $parent = $this.closest('.input_form'); + var crewtype = parseInt($parent.data('crewtype')); + var $input = $parent.find('.form_double:eq(0)'); + + var fillValue = fullLeadership + 15; + $formCrewtype.val(crewtype); + $input.val(fillValue).change(); + return false; + }); + + $('.submit_btn').click(function(){ + var $this = $(this); + var $parent = $this.closest('tr').find('.input_form'); + var crewtype = parseInt($parent.data('crewtype')); + var $input = $parent.find('.form_double'); + + $formCrewtype.val(crewtype); + $formAmount.val($input.val()); + + $postForm.submit(); + }); + + $('.btn_fill').click(); +}); \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_선양.php b/hwe/sammo/Command/General/che_선양.php index b1b1dae9..fe423b71 100644 --- a/hwe/sammo/Command/General/che_선양.php +++ b/hwe/sammo/Command/General/che_선양.php @@ -131,5 +131,31 @@ class che_선양 extends Command\GeneralCommand{ return true; } - + public function getForm(): string + { + //TODO: 암행부처럼 보여야... + $db = DB::db(); + + $destRawGenerals = $db->query('SELECT no,name,level,npc FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID()); + ob_start(); +?> +군주의 자리를 다른 장수에게 물려줍니다.
+장수를 선택하세요.
+
+queryFirstField('SELECT secu FROM city WHERE city = %i', $this->generalObj->getCityID()); $gold = $this->generalObj->getVar('gold'); - $form[] = << -EOT; - $form[] = ''; - $form[] = << 장비를 구입하거나 매각합니다.
현재 구입 불가능한 것은 붉은색으로 표시됩니다.
-현재 도시 치안 : {$citySecu}    현재 자금 : {$gold}
+현재 도시 치안 :    현재 자금 :
장비 : -EOT; - - return join("\n",$form); +generalObj; + + + + [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $me['nation']); + if(!$nationLevel){ + $nationLevel = 0; + } + + if(!$tech){ + $tech = 0; + } + + $lbonus = setLeadershipBonus($me, $nationLevel); + + $ownCities = []; + $ownRegions = []; + [$year, $startyear] = $gameStor->getValuesAsArray(['year','startyear']); + + $relativeYear = $year - $startyear; + + foreach(DB::db()->query('SELECT city, region from city where nation = %i', $me['nation']) 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; + if(!$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech)){ + continue; //TODO: 불가능한 병종도 보여줄 필요가 있음. + } + + $crewObj->id = $unit->id; + + if($unit->reqTech == 0){ + $crewObj->bgcolor = 'green'; + } + else{ + $crewObj->bgcolor = 'limegreen'; + } + + $crewObj->baseRice = $unit->rice * getTechCost($tech); + $crewObj->baseCost = CharCost($unit->costWithTech($tech), $me['personal']); + + $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) { + $crewObj->img = ServConfig::$sharedIconPath."/default.jpg"; + } + else{ + $crewObj->img = ServConfig::$gameImagePath."/weap".$unit->id.".png"; + } + + $crewObj->baseRiceShort = round($crewObj->baseRice, 1); + $crewObj->baseCostShort = round($crewObj->baseCost, 1); + + $crewObj->info = join('
', $unit->info); + + + $armTypeCrews[] = $crewObj; + } + $armTypes[] = [$armName, $armTypeCrews]; + } + $commandName = $this->getName(); + + $techLevelText = getTechCall($tech); + + $crew = $general->getRaw('crew'); + $gold = $general->getRaw('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(); +?> + +병사를 모집합니다. + +훈련과 사기치는 낮지만 가격이 저렴합니다.
+ +훈련과 사기치는 높지만 자금이 많이 듭니다. + +가능한 수보다 많게 입력하면 가능한 최대 병사를 모집합니다.
+이미 병사가 있는 경우 추가되며, 병종이 다를경우는 기존의 병사는 소집해제됩니다.
+현재 가능한 병종은 녹색으로 표시되며,
+현재 가능한 특수병종은 초록색으로 표시됩니다.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
모병은 가격 2배의 자금이 소요됩니다.
+ 현재 기술력 : + 현재 통솔 : + 현재 병종 : name?> + 현재 병사 : + 현재 자금 : +
사진병종공격방어기동회피가격군량병사수행동특징
계열
name?>attack?>defence?>speed?>avoid?>baseCostShort?>baseRiceShort?> +
+ 00명 + 원 + +
info?>
+ + + +