feat: process 징병 페이지
This commit is contained in:
@@ -218,44 +218,4 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$destGenerals = [];
|
||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND officer_level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$destNationID = $destGeneral['nation'];
|
||||
if(!key_exists($destNationID, $destGenerals)){
|
||||
$destGenerals[$destNationID] = [];
|
||||
}
|
||||
$destGenerals[$destNationID] = [$destGeneral];
|
||||
}
|
||||
|
||||
$nationList = array_merge([0=>getNationStaticInfo(0)], getAllNationStaticInfo());
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
재야나 타국의 장수를 등용합니다.<br>
|
||||
서신은 개인 메세지로 전달됩니다.<br>
|
||||
등용할 장수를 목록에서 선택하세요.<br>
|
||||
<select class='formInput' name="destGeneralID" id="destGeneralID" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach($nationList as $destNation): ?>
|
||||
<optgroup style='color:<?=$destNation['color']?>'>【<?=$destNation['name']?>】
|
||||
<?php foreach($destGenerals[$destNation['nation']]??[] as $destGeneral):
|
||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
||||
if($nameColor){
|
||||
$nameColor = " style='color:{$nameColor}'";
|
||||
}
|
||||
?>
|
||||
<option value='<?=$destGeneral['no']?>' <?=$nameColor?>><?=$destGeneral['name']?></option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ use \sammo\ServConfig;
|
||||
use function \sammo\getTechCall;
|
||||
use function \sammo\tryUniqueItemLottery;
|
||||
use function \sammo\getTechAbil;
|
||||
use function sammo\getTechLevel;
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
@@ -231,6 +232,107 @@ class che_징병 extends Command\GeneralCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function exportJSVars(): array
|
||||
{
|
||||
$general = $this->generalObj;
|
||||
$db = DB::db();
|
||||
|
||||
[$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $general->getNationID());
|
||||
if (!$nationLevel) {
|
||||
$nationLevel = 0;
|
||||
}
|
||||
|
||||
if (!$tech) {
|
||||
$tech = 0;
|
||||
}
|
||||
|
||||
$year = $this->env['year'];
|
||||
$startyear = $this->env['startyear'];
|
||||
$relativeYear = $year - $startyear;
|
||||
|
||||
$ownCities = [];
|
||||
$ownRegions = [];
|
||||
|
||||
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);
|
||||
|
||||
$armCrewTypes = [];
|
||||
foreach (GameUnitConst::allType() as $armType => $armName) {
|
||||
$armCrewType = [
|
||||
'armType' => $armType,
|
||||
'armName' => $armName,
|
||||
'values' => [],
|
||||
];
|
||||
|
||||
$crewTypes = [];
|
||||
foreach (GameUnitConst::byType($armType) as $unit) {
|
||||
$crewObj = new \stdClass;
|
||||
|
||||
$crewObj->id = $unit->id;
|
||||
$crewObj->reqTech = $unit->reqTech;
|
||||
$crewObj->reqYear = $unit->reqYear;
|
||||
|
||||
/*
|
||||
if ($unit->reqTech == 0) {
|
||||
$crewObj->bgcolor = 'green';
|
||||
} else {
|
||||
$crewObj->bgcolor = 'limegreen';
|
||||
}
|
||||
*/
|
||||
|
||||
$crewObj->notAvailable = !$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech);
|
||||
|
||||
$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 = $unit->info;
|
||||
|
||||
$armCrewType['values'][] = $crewObj;
|
||||
}
|
||||
|
||||
|
||||
$armCrewTypes[] = $armCrewType;
|
||||
}
|
||||
|
||||
$crew = $general->getVar('crew');
|
||||
$gold = $general->getVar('gold');
|
||||
$crewTypeObj = $general->getCrewTypeObj();
|
||||
|
||||
return [
|
||||
'procRes' => [
|
||||
'relYear' => $relativeYear,
|
||||
'year' => $year,
|
||||
'tech' => $tech,
|
||||
'techLevel' => getTechLevel($tech),
|
||||
'startYear' => $startyear,
|
||||
'goldCoeff' => static::$costOffset,
|
||||
'leadership' => $leadership,
|
||||
'fullLeadership' => $fullLeadership,
|
||||
'armCrewTypes' => $armCrewTypes,
|
||||
'currentCrewType' => $crewTypeObj->id,
|
||||
'crew' => $crew,
|
||||
'gold' => $gold,
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
@@ -305,9 +407,6 @@ class che_징병 extends Command\GeneralCommand
|
||||
$crewObj->img = ServConfig::$gameImagePath . "/crewtype" . $unit->id . ".png";
|
||||
}
|
||||
|
||||
$crewObj->baseRiceShort = round($crewObj->baseRice, 1);
|
||||
$crewObj->baseCostShort = round($crewObj->baseCost, 1);
|
||||
|
||||
$crewObj->info = join('<br>', $unit->info);
|
||||
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class GameUnitConstBase{
|
||||
0, null, null, 0,
|
||||
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8, self::T_SIEGE=>1.2],
|
||||
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2, self::T_SIEGE=>0.8],
|
||||
['표준적인 보병입니다.','보병은 방어특화이며, 상대가 회피하기 어렵습니다.'],
|
||||
['표준적인 보병입니다.','보병은 방어특화이며,','상대가 회피하기 어렵습니다.'],
|
||||
null, ['che_방어력증가5p']
|
||||
],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user