forked from devsam/core
feat(WIP): processing 숙련전환, 불가침제의
This commit is contained in:
@@ -16,6 +16,7 @@ use \sammo\Command;
|
||||
use \sammo\ServConfig;
|
||||
|
||||
use function \sammo\getDexCall;
|
||||
use function sammo\getDexLevelList;
|
||||
use function \sammo\tryUniqueItemLottery;
|
||||
|
||||
use \sammo\Constraint\Constraint;
|
||||
@@ -37,6 +38,9 @@ class che_숙련전환 extends Command\GeneralCommand
|
||||
/** @var string */
|
||||
protected $destArmTypeName;
|
||||
|
||||
static $decreaseCoeff = 0.4;
|
||||
static $convertCoeff = 0.9;
|
||||
|
||||
protected function argTest(): bool
|
||||
{
|
||||
if ($this->arg === null) {
|
||||
@@ -162,9 +166,9 @@ class che_숙련전환 extends Command\GeneralCommand
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$srcDex = $general->getVar('dex' . $this->srcArmType);
|
||||
$cutDex = Util::toInt($srcDex * 0.4);
|
||||
$cutDex = Util::toInt($srcDex * static::$decreaseCoeff);
|
||||
$cutDexText = number_format($cutDex);
|
||||
$addDex = Util::toInt($cutDex * 9 / 10);
|
||||
$addDex = Util::toInt($cutDex * static::$convertCoeff);
|
||||
$addDexText = number_format($addDex);
|
||||
|
||||
$general->increaseVar('dex' . $this->srcArmType, -$cutDex);
|
||||
@@ -189,47 +193,33 @@ class che_숙련전환 extends Command\GeneralCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
public function exportJSVars(): array
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
$dexSrcTexts = [];
|
||||
$dexDestTexts = [];
|
||||
$ownDexList = [];
|
||||
foreach (GameUnitConst::allType() as $armType => $armName) {
|
||||
$dexVal = $general->getVar('dex' . $armType);
|
||||
$dexValText = number_format($dexVal);
|
||||
$cutDex = Util::toInt($dexVal * 0.4);
|
||||
$addDex = Util::toInt($cutDex * 9 / 10);
|
||||
$addDexText = number_format($addDex);
|
||||
$newDex = $dexVal - $cutDex;
|
||||
$beforeDexLevel = getDexCall($dexVal);
|
||||
$afterDexLevel = getDexCall($newDex);
|
||||
|
||||
$dexSrcTexts[$armType] = "{$armName} ({$beforeDexLevel} ⇒ {$afterDexLevel}, {$addDexText} 전환)";
|
||||
$dexDestTexts[$armType] = "{$armName} ({$dexValText})";
|
||||
$ownDexList[] = [
|
||||
'armType' => $armType,
|
||||
'name' => $armName,
|
||||
'amount' => $general->getVar('dex' . $armType),
|
||||
];
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
본인의 특정 병종 숙련을 40% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종 숙련으로 전환합니다.<br>
|
||||
|
||||
<select class='formInput' name="srcArmType" id="srcArmType" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach ($dexSrcTexts as $armType => $infoText) : ?>
|
||||
<option value="<?= $armType ?>"><?= $infoText ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
숙련을
|
||||
|
||||
<select class='formInput' name="destArmType" id="destArmType" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach ($dexDestTexts as $armType => $infoText) : ?>
|
||||
<option value="<?= $armType ?>"><?= $infoText ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
숙련으로 <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
||||
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
$dexLevelList = [];
|
||||
foreach(getDexLevelList() as [$dexKey, $color, $name]){
|
||||
$dexLevelList[] = [
|
||||
'amount'=>$dexKey,
|
||||
'color'=>$color,
|
||||
'name'=>$name
|
||||
];
|
||||
}
|
||||
return [
|
||||
'procRes' => [
|
||||
'ownDexList' => $ownDexList,
|
||||
'dexLevelList' => $dexLevelList,
|
||||
'decreaseCoeff' => static::$decreaseCoeff,
|
||||
'convertCoeff' => static::$convertCoeff,
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,176 +332,4 @@ class che_징병 extends Command\GeneralCommand
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$general = $this->generalObj;
|
||||
|
||||
[$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $general->getNationID());
|
||||
if (!$nationLevel) {
|
||||
$nationLevel = 0;
|
||||
}
|
||||
|
||||
if (!$tech) {
|
||||
$tech = 0;
|
||||
}
|
||||
|
||||
$ownCities = [];
|
||||
$ownRegions = [];
|
||||
$year = $this->env['year'];
|
||||
$startyear = $this->env['startyear'];
|
||||
|
||||
$relativeYear = $year - $startyear;
|
||||
|
||||
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);
|
||||
|
||||
$armTypes = [];
|
||||
|
||||
foreach (GameUnitConst::allType() as $armType => $armName) {
|
||||
$armTypeCrews = [];
|
||||
|
||||
foreach (GameUnitConst::byType($armType) as $unit) {
|
||||
$crewObj = new \stdClass;
|
||||
$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 = $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 = join('<br>', $unit->info);
|
||||
|
||||
|
||||
$armTypeCrews[] = $crewObj;
|
||||
}
|
||||
$armTypes[] = [$armName, $armTypeCrews];
|
||||
}
|
||||
$commandName = $this->getName();
|
||||
|
||||
$techLevelText = getTechCall($tech);
|
||||
|
||||
$crew = $general->getVar('crew');
|
||||
$gold = $general->getVar('gold');
|
||||
$crewTypeObj = $general->getCrewTypeObj();
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
|
||||
<font size=2>병사를 모집합니다.
|
||||
<?php if ($commandName == '징병') : ?>
|
||||
훈련과 사기치는 낮지만 가격이 저렴합니다.<br>
|
||||
<?php else : ?>
|
||||
훈련과 사기치는 높지만 자금이 많이 듭니다.
|
||||
<?php endif; ?>
|
||||
가능한 수보다 많게 입력하면 가능한 최대 병사를 모집합니다.<br>
|
||||
이미 병사가 있는 경우 추가<?= $commandName ?>되며, 병종이 다를경우는 기존의 병사는 소집해제됩니다.<br>
|
||||
현재 <?= $commandName ?> 가능한 병종은 <font color=green>녹색</font>으로 표시되며,<br>
|
||||
현재 <?= $commandName ?> 가능한 특수병종은 <font color=limegreen>초록색</font>으로 표시됩니다.<br>
|
||||
|
||||
<table class='tb_layout' style='margin:auto;'>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan=11>
|
||||
<div style='float:right'><input type='checkbox' id="show_unavailable_troops">불가능한 병종 표시</input></div>
|
||||
<?php if ($commandName == '모병') : ?>
|
||||
<div style='text-align:center;'>모병은 가격 2배의 자금이 소요됩니다.</div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=11 align=center class='bg2'>
|
||||
현재 기술력 : <?= $techLevelText ?>
|
||||
현재 통솔 : <?= $leadership ?><?= ($leadership != $fullLeadership) ? "({$fullLeadership})" : '' ?>
|
||||
현재 병종 : <?= $crewTypeObj->name ?>
|
||||
현재 병사 : <?= $crew ?>
|
||||
현재 자금 : <?= $gold ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=64 align=center class='bg1'>사진</td>
|
||||
<td width=64 align=center class='bg1'>병종</td>
|
||||
<td width=40 align=center class='bg1'>공격</td>
|
||||
<td width=40 align=center class='bg1'>방어</td>
|
||||
<td width=40 align=center class='bg1'>기동</td>
|
||||
<td width=40 align=center class='bg1'>회피</td>
|
||||
<td width=40 align=center class='bg1'>가격</td>
|
||||
<td width=40 align=center class='bg1'>군량</td>
|
||||
<td width=180 align=center class='bg1'>병사수</td>
|
||||
<td width=50 align=center class='bg1'>행동</td>
|
||||
<td width=300 align=center class='bg1'>특징</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($armTypes as [$armName, $armTypeCrews]) : ?>
|
||||
<tr>
|
||||
<td colspan=11><?= $armName ?> 계열</td>
|
||||
</tr>
|
||||
<?php foreach ($armTypeCrews as $crewObj) : ?>
|
||||
<tr id="crewType<?= $crewObj->id ?>" class="show_default_<?= $crewObj->showDefault ?>" style='height:64px;background-color:<?= $crewObj->bgcolor ?>' data-rice="<?= $crewObj->baseRice ?>" data-cost="<?= $crewObj->baseCost ?>">
|
||||
<td style='background:#222222 no-repeat center url("<?= $crewObj->img ?>");background-size:64px'></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->name ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->attack ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->defence ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->speed ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->avoid ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->baseCostShort ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;'><?= $crewObj->baseRiceShort ?></td>
|
||||
<td style='text-align:center;vertical-align:middle;' class='input_form' data-crewtype='<?= $crewObj->id ?>'>
|
||||
<input type=button value='절반' class='btn_half'><input type=button value='채우기' class='btn_fill'><input type=button value='가득' class='btn_full'><br>
|
||||
<input type=text data-crewtype='<?= $crewObj->id ?>' class=form_double name=double maxlength=3 size=3 style=text-align:right;color:white;background-color:black>00명
|
||||
<input type=text class=form_cost name=cost maxlength=5 size=5 readonly style=text-align:right;color:white;background-color:black>원
|
||||
|
||||
</td>
|
||||
<td style='position:relative;height:64px;'><input type=submit value='<?= $commandName ?>' class='submit_btn' style='width:100%;height:44px;margin:10px 0;display:block;position: absolute;left:0;top:0;'></td>
|
||||
<td><?= $crewObj->info ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type='hidden' id='amount' value='1'>
|
||||
<input type='hidden' id='crewType' value='<?= $crewTypeObj->id ?>'>
|
||||
<script>
|
||||
window.currentTech = <?= $tech ?>;
|
||||
window.leadership = <?= $leadership ?>;
|
||||
window.fullLeadership = <?= $fullLeadership ?>;
|
||||
window.currentCrewType = <?= $crewTypeObj->id ?>;
|
||||
window.currentCrew = <?= $crew ?>;
|
||||
window.currentGold = <?= $gold ?>;
|
||||
window.is모병 = <?= ($this->getName() == '모병') ? 'true' : 'false' ?>;
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,22 +162,4 @@ class che_헌납 extends Command\GeneralCommand
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
ob_start();
|
||||
?>
|
||||
자신의 자금이나 군량을 국가 재산으로 헌납합니다.<br>
|
||||
<select id='isGold' name="isGold" size=1 style=color:white;background-color:black>
|
||||
<option value='true'>금</option>
|
||||
<option value='false'>쌀</option>
|
||||
</select>
|
||||
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
||||
<?php foreach (GameConst::$resourceActionAmountGuide as $amount) : ?>
|
||||
<option value='<?= $amount ?>'><?= $amount ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,74 +223,46 @@ class che_불가침제의 extends Command\NationCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'defaultSelectNationByMap'
|
||||
];
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
public function exportJSVars(): array
|
||||
{
|
||||
$generalObj = $this->generalObj;
|
||||
$nationID = $generalObj->getNationID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$nationList = [];
|
||||
$testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn());
|
||||
$currYear = $this->env['year'];
|
||||
|
||||
$diplomacyStatus = Util::convertArrayToDict(
|
||||
$db->query('SELECT * FROM diplomacy WHERE me = %i', $nationID),
|
||||
'you'
|
||||
);
|
||||
|
||||
$nationList = [];
|
||||
foreach (getAllNationStaticInfo() as $destNation) {
|
||||
if ($destNation['nation'] == $nationID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$testCommand = new static($generalObj, $this->env, $this->getLastTurn(), [
|
||||
$testCommand = new static($generalObj, $this->env, $testTurn, [
|
||||
'destNationID' => $destNation['nation'],
|
||||
'year' => $currYear + 1,
|
||||
'month' => 12
|
||||
'year' => $currYear + 2,
|
||||
'month' => 1
|
||||
]);
|
||||
|
||||
$nationTarget = [
|
||||
'id' => $destNation['nation'],
|
||||
'name' => $destNation['name'],
|
||||
'color' => $destNation['color'],
|
||||
'power' => $destNation['power'],
|
||||
];
|
||||
if (!$testCommand->hasFullConditionMet()) {
|
||||
$destNation['cssBgColor'] = 'background-color:red;';
|
||||
} else if ($diplomacyStatus[$destNation['nation']]['state'] == 7) {
|
||||
$destNation['cssBgColor'] = 'background-color:blue;';
|
||||
} else {
|
||||
$destNation['cssBgColor'] = '';
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
if ($destNation['id'] == $nationID) {
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
|
||||
$nationList[] = $destNation;
|
||||
$nationList[] = $nationTarget;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<?= \sammo\getMapHtml() ?><br>
|
||||
타국에게 불가침을 제의합니다.<br>
|
||||
제의할 국가를 목록에서 선택하세요.<br>
|
||||
불가침 기한 다음 달부터 선포 가능합니다.<br>
|
||||
배경색은 현재 제의가 불가능한 국가는 <font color=red>붉은색</font>, 현재 불가침중인 국가는 <font color=blue>푸른색</font>으로 표시됩니다.<br>
|
||||
<br>
|
||||
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach ($nationList as $nation) : ?>
|
||||
<option value='<?= $nation['nation'] ?>' style='color:<?= $nation['color'] ?>;<?= $nation['cssBgColor'] ?>'>【<?= $nation['name'] ?> 】</option>
|
||||
<?php endforeach; ?>
|
||||
</select>에게
|
||||
<select class='formInput' name="year" id="year" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach (Util::range($currYear + 1, $currYear + 20 + 1) as $formYear) : ?>
|
||||
<option value='<?= $formYear ?>'><?= $formYear ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>년
|
||||
<select class='formInput' name="month" id="month" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach (Util::range(1, 12 + 1) as $formMonth) : ?>
|
||||
<option value='<?= $formMonth ?>'><?= $formMonth ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>월까지
|
||||
<input type=button id="commonSubmit" value="<?= $this->getName() ?>">
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
return [
|
||||
'mapTheme' => \sammo\getMapTheme(),
|
||||
'procRes' => [
|
||||
'nationList' => $nationList,
|
||||
'startYear' => $this->env['startyear'],
|
||||
'minYear' => $this->env['year'] + 1,
|
||||
'maxYear' => $this->env['year'] + 20,
|
||||
'month' => $this->env['month'],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,58 +207,4 @@ class che_불가침파기제의 extends Command\NationCommand{
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function getJSPlugins(): array
|
||||
{
|
||||
return [
|
||||
'defaultSelectNationByMap'
|
||||
];
|
||||
}
|
||||
|
||||
public function getForm(): string
|
||||
{
|
||||
$generalObj = $this->generalObj;
|
||||
$nationID = $generalObj->getNationID();
|
||||
|
||||
$db = DB::db();
|
||||
$diplomacyStatus = Util::convertArrayToDict(
|
||||
$db->query('SELECT * FROM diplomacy WHERE me = %i', $nationID),
|
||||
'you'
|
||||
);
|
||||
|
||||
$nationList = [];
|
||||
foreach(getAllNationStaticInfo() as $destNation){
|
||||
if($destNation['nation'] == $nationID){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($diplomacyStatus[$destNation['nation']]['state'] != 7){
|
||||
$destNation['cssBgColor'] = 'background-color:red;';
|
||||
}
|
||||
else{
|
||||
$destNation['cssBgColor'] = '';
|
||||
}
|
||||
|
||||
$nationList[] = $destNation;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<?=\sammo\getMapHtml()?><br>
|
||||
불가침중인 국가에 조약 파기를 제의합니다.<br>
|
||||
제의할 국가를 목록에서 선택하세요.<br>
|
||||
배경색은 현재 제의가 불가능한 국가는 <font color=red>붉은색</font>으로 표시됩니다.<br>
|
||||
<br>
|
||||
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
||||
<?php foreach($nationList as $nation): ?>
|
||||
<option
|
||||
value='<?=$nation['nation']?>'
|
||||
style='color:<?=$nation['color']?>;<?=$nation['cssBgColor']?>'
|
||||
>【<?=$nation['name']?> 】</option>
|
||||
<?php endforeach; ?>
|
||||
</select>에게
|
||||
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<TopBackBar :title="commandName" type="chief" />
|
||||
<div class="bg0">
|
||||
<div>
|
||||
본인의 특정 병종 숙련을 40% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종
|
||||
숙련으로 전환합니다.
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4 col-md-2">
|
||||
감소 대상 숙련 :
|
||||
<b-form-select v-model="srcArmTypeID">
|
||||
<b-form-select-option
|
||||
v-for="[armType, dexInfo] in dexFullInfo"
|
||||
:key="armType"
|
||||
:value="armType"
|
||||
>{{ dexInfo.name }} (<span
|
||||
:style="{ color: dexInfo.currentInfo.color }"
|
||||
>{{ dexInfo.currentInfo.name }}</span>)</b-form-select-option
|
||||
>
|
||||
</b-form-select>
|
||||
</div>
|
||||
<div class="col-4 col-md-2">
|
||||
전환 대상 숙련 :
|
||||
<b-form-select v-model="destArmTypeID">
|
||||
<b-form-select-option
|
||||
v-for="[armType, dexInfo] in dexFullInfo"
|
||||
:key="armType"
|
||||
:value="armType"
|
||||
>{{ dexInfo.name }} (<span
|
||||
:style="{ color: dexInfo.currentInfo.color }"
|
||||
>{{ dexInfo.currentInfo.name }}</span>)</b-form-select-option
|
||||
>
|
||||
</b-form-select>
|
||||
</div>
|
||||
<div class="col-4 col-md-2 d-grid">
|
||||
<b-button @click="submit">{{ commandName }}</b-button>
|
||||
</div>
|
||||
<div :style="{
|
||||
display:'grid',
|
||||
gridTemplateColumns: '3ch 1ch 2ch 10ch 1ch 3ch 1ch 2ch 10ch 1ch'
|
||||
}">
|
||||
<div>{{dexFullInfo.get(srcArmTypeID).name}}</div>
|
||||
<div class="text-end">[</div>
|
||||
<div :style="`color:${dexFullInfo.get(srcArmTypeID).currentInfo.color}`">{{dexFullInfo.get(srcArmTypeID).currentInfo.name}}</div>
|
||||
<div class="f_tnum text-end">{{convNumberFormat(dexFullInfo.get(srcArmTypeID).currentInfo.amount)}}</div>
|
||||
<div>]</div>
|
||||
<div class="text-center">→</div>
|
||||
<div class="text-end">[</div>
|
||||
<div :style="`color:${dexFullInfo.get(srcArmTypeID).decreasedInfo.color}`">{{dexFullInfo.get(srcArmTypeID).decreasedInfo.name}}</div>
|
||||
<div class="f_tnum text-end">{{convNumberFormat(dexFullInfo.get(srcArmTypeID).decreasedInfo.amount)}}</div>
|
||||
<div>]</div>
|
||||
</div>
|
||||
<div :style="{
|
||||
display:'grid',
|
||||
gridTemplateColumns: '3ch 1ch 2ch 10ch 1ch 3ch 1ch 2ch 10ch 1ch'
|
||||
}">
|
||||
<div>{{dexFullInfo.get(destArmTypeID).name}}</div>
|
||||
<div class="text-end">[</div>
|
||||
<template v-if="srcArmTypeID == destArmTypeID">
|
||||
<div :style="`color:${dexFullInfo.get(destArmTypeID).decreasedInfo.color}`">{{dexFullInfo.get(destArmTypeID).decreasedInfo.name}}</div>
|
||||
<div class="f_tnum text-end">{{convNumberFormat(dexFullInfo.get(destArmTypeID).decreasedInfo.amount)}}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div :style="`color:${dexFullInfo.get(destArmTypeID).currentInfo.color}`">{{dexFullInfo.get(destArmTypeID).currentInfo.name}}</div>
|
||||
<div class="f_tnum text-end">{{convNumberFormat(dexFullInfo.get(destArmTypeID).currentInfo.amount)}}</div>
|
||||
</template>
|
||||
<div>]</div>
|
||||
<div class="text-center">→</div>
|
||||
<div class="text-end">[</div>
|
||||
<div :style="`color:${dexFullInfo.get(destArmTypeID).afterInfo.get(srcArmTypeID).color}`">{{dexFullInfo.get(destArmTypeID).afterInfo.get(srcArmTypeID).name}}</div>
|
||||
<div class="f_tnum text-end">{{convNumberFormat(dexFullInfo.get(destArmTypeID).afterInfo.get(srcArmTypeID).amount)}}</div>
|
||||
<div>]</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<BottomBar :title="commandName" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from "vue";
|
||||
import { unwrap } from "@/util/unwrap";
|
||||
import { Args } from "@/processing/args";
|
||||
import TopBackBar from "@/components/TopBackBar.vue";
|
||||
import BottomBar from "@/components/BottomBar.vue";
|
||||
|
||||
declare const commandName: string;
|
||||
|
||||
type dexInfo = {
|
||||
amount: number;
|
||||
color: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
declare const procRes: {
|
||||
ownDexList: {
|
||||
armType: number;
|
||||
name: string;
|
||||
amount: number;
|
||||
}[];
|
||||
dexLevelList: dexInfo[];
|
||||
decreaseCoeff: number;
|
||||
convertCoeff: number;
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
TopBackBar,
|
||||
BottomBar,
|
||||
},
|
||||
setup() {
|
||||
const srcArmTypeID = ref(procRes.ownDexList[0].armType);
|
||||
const destArmTypeID = ref(procRes.ownDexList[0].armType);
|
||||
|
||||
async function submit(e: Event) {
|
||||
const event = new CustomEvent<Args>("customSubmit", {
|
||||
detail: {
|
||||
srcArmType: srcArmTypeID.value,
|
||||
destArmType: destArmTypeID.value,
|
||||
},
|
||||
});
|
||||
unwrap(e.target).dispatchEvent(event);
|
||||
}
|
||||
|
||||
function getDexCall(dex: number): { color: string; name: string } {
|
||||
if (dex < 0) {
|
||||
throw `올바르지 않은 수치: ${dex}`;
|
||||
}
|
||||
|
||||
let color = "";
|
||||
let name = "";
|
||||
for (const nextDexLevel of procRes.dexLevelList) {
|
||||
if (dex < nextDexLevel.amount) {
|
||||
break;
|
||||
}
|
||||
color = nextDexLevel.color;
|
||||
name = nextDexLevel.name;
|
||||
}
|
||||
|
||||
return {
|
||||
color,
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
const dexFullInfo = new Map<
|
||||
number,
|
||||
{
|
||||
armType: number;
|
||||
name: string;
|
||||
amount: number;
|
||||
decresedAmount: number;
|
||||
currentInfo: dexInfo;
|
||||
decreasedInfo: dexInfo;
|
||||
afterInfo: Map<number, dexInfo>;
|
||||
}
|
||||
>();
|
||||
|
||||
for (const dexItem of procRes.ownDexList) {
|
||||
const amount = dexItem.amount;
|
||||
const currentInfo = { ...getDexCall(amount), amount };
|
||||
|
||||
const decresedAmount = amount * procRes.decreaseCoeff;
|
||||
const decresedAfterAmount = amount - decresedAmount;
|
||||
const decreasedInfo = {
|
||||
...getDexCall(decresedAfterAmount),
|
||||
amount: decresedAfterAmount,
|
||||
};
|
||||
|
||||
dexFullInfo.set(dexItem.armType, {
|
||||
...dexItem,
|
||||
decresedAmount,
|
||||
currentInfo,
|
||||
decreasedInfo,
|
||||
afterInfo: new Map(),
|
||||
});
|
||||
}
|
||||
|
||||
for (const [armType, dexItem] of dexFullInfo.entries()) {
|
||||
for (const [fromArmType, fromDexItem] of dexFullInfo.entries()) {
|
||||
let afterAmount = fromDexItem.decresedAmount * procRes.convertCoeff;
|
||||
if (armType != fromArmType) {
|
||||
afterAmount += dexItem.amount;
|
||||
} else {
|
||||
afterAmount += dexItem.decresedAmount;
|
||||
}
|
||||
|
||||
dexItem.afterInfo.set(fromArmType, {
|
||||
amount: afterAmount,
|
||||
...getDexCall(afterAmount),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function convDexFormat(value: dexInfo): string {
|
||||
const amount = convNumberFormat(value.amount);
|
||||
return `<span class="f_tnum" style="color:${value.color}">${value.name}</span>,${"\xa0".repeat(Math.max(0, 3 - value.name.length))} ${amount}`;
|
||||
}
|
||||
|
||||
function convNumberFormat(value: number): string {
|
||||
return Math.floor(value).toLocaleString();
|
||||
}
|
||||
|
||||
console.log(dexFullInfo);
|
||||
|
||||
return {
|
||||
...procRes,
|
||||
srcArmTypeID,
|
||||
destArmTypeID,
|
||||
dexFullInfo,
|
||||
getDexCall,
|
||||
commandName,
|
||||
submit,
|
||||
convDexFormat,
|
||||
convNumberFormat,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -2,6 +2,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";
|
||||
@@ -21,6 +22,7 @@ export const commandMap: Record<string, typeof ProcessCity> = {
|
||||
che_모병: che_징병,
|
||||
che_선동: ProcessCity,
|
||||
che_선양,
|
||||
che_숙련전환,
|
||||
che_이동: ProcessCity,
|
||||
che_임관,
|
||||
che_장수대상임관,
|
||||
@@ -36,5 +38,5 @@ export const commandMap: Record<string, typeof ProcessCity> = {
|
||||
|
||||
/*
|
||||
- 항목들
|
||||
고유 양식 - 숙련전환, 장비매매
|
||||
고유 양식 - 장비매매
|
||||
*/
|
||||
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<TopBackBar :title="commandName" type="chief" />
|
||||
<div class="bg0">
|
||||
<MapLegacyTemplate
|
||||
:isDetailMap="false"
|
||||
:clickableAll="true"
|
||||
:neutralView="true"
|
||||
:useCachedMap="true"
|
||||
:mapTheme="mapTheme"
|
||||
v-model="selectedCityObj"
|
||||
/>
|
||||
|
||||
<div>
|
||||
타국에게 불가침을 제의합니다.<br />
|
||||
제의할 국가를 목록에서 선택하세요.<br />
|
||||
불가침 기한 다음 달부터 선포 가능합니다.<br />
|
||||
현재 제의가 불가능한 국가는
|
||||
<span style="color: red">붉은색</span>으로 표시됩니다.<br />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6 col-md-3">
|
||||
국가 :
|
||||
<SelectNation :nations="nationList" v-model="selectedNationID" />
|
||||
</div>
|
||||
<div class="col-6 col-md-3">
|
||||
기간 :
|
||||
<div class="input-group"></div>
|
||||
<div class="input-group">
|
||||
<b-form-select v-model="selectedYear"
|
||||
><b-form-select-option
|
||||
v-for="yearP in maxYear - minYear + 1"
|
||||
:key="yearP"
|
||||
:value="yearP + minYear - 1"
|
||||
>{{ yearP + minYear - 1 }}</b-form-select-option
|
||||
>
|
||||
</b-form-select>
|
||||
<span class="input-group-text">년</span>
|
||||
<b-form-select v-model="selectedMonth"
|
||||
><b-form-select-option v-for="month in 12" :key="month" :value="month">{{
|
||||
month
|
||||
}}</b-form-select-option>
|
||||
</b-form-select>
|
||||
<span class="input-group-text">월</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 col-md-2 d-grid">
|
||||
<b-button @click="submit">{{ commandName }}</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BottomBar :title="commandName" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import MapLegacyTemplate, {
|
||||
MapCityParsed,
|
||||
} from "@/components/MapLegacyTemplate.vue";
|
||||
import SelectNation from "@/processing/SelectNation.vue";
|
||||
import { defineComponent, ref } from "vue";
|
||||
import { unwrap } from "@/util/unwrap";
|
||||
import { Args } from "@/processing/args";
|
||||
import TopBackBar from "@/components/TopBackBar.vue";
|
||||
import BottomBar from "@/components/BottomBar.vue";
|
||||
import { procNationItem, procNationList } from "../processingRes";
|
||||
declare const mapTheme: string;
|
||||
declare const commandName: string;
|
||||
|
||||
declare const procRes: {
|
||||
nationList: procNationList;
|
||||
startYear: number;
|
||||
minYear: number;
|
||||
maxYear: number;
|
||||
month: number;
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MapLegacyTemplate,
|
||||
SelectNation,
|
||||
TopBackBar,
|
||||
BottomBar,
|
||||
},
|
||||
watch: {
|
||||
selectedCityObj(city: MapCityParsed) {
|
||||
if (!city.nationID) {
|
||||
return;
|
||||
}
|
||||
this.selectedNationID = city.nationID;
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const nationList = new Map<number, procNationItem>();
|
||||
for (const nationItem of procRes.nationList) {
|
||||
nationList.set(nationItem.id, nationItem);
|
||||
}
|
||||
|
||||
const selectedNationID = ref(procRes.nationList[0].id);
|
||||
const selectedCityObj = ref(); //mapping용
|
||||
|
||||
const selectedYear = ref(procRes.minYear);
|
||||
const selectedMonth = ref(procRes.month);
|
||||
|
||||
function selectedNation(nationID: number) {
|
||||
selectedNationID.value = nationID;
|
||||
}
|
||||
|
||||
async function submit(e: Event) {
|
||||
const event = new CustomEvent<Args>("customSubmit", {
|
||||
detail: {
|
||||
destNationID: selectedNationID.value,
|
||||
year: selectedYear.value,
|
||||
month: selectedMonth.value,
|
||||
},
|
||||
});
|
||||
unwrap(e.target).dispatchEvent(event);
|
||||
}
|
||||
|
||||
return {
|
||||
...procRes,
|
||||
selectedYear,
|
||||
selectedMonth,
|
||||
mapTheme: ref(mapTheme),
|
||||
nationList: ref(nationList),
|
||||
selectedCityObj,
|
||||
selectedNationID,
|
||||
commandName,
|
||||
selectedNation,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -1,6 +1,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 ProcessNation } from "../ProcessNation.vue";
|
||||
@@ -16,6 +17,7 @@ export const commandMap: Record<string, typeof ProcessNation> = {
|
||||
che_물자원조,
|
||||
che_발령: ProcessGeneralCity,
|
||||
che_백성동원: ProcessCity,
|
||||
che_불가침제의,
|
||||
che_불가침파기제의: ProcessNation,
|
||||
che_선전포고: ProcessNation,
|
||||
che_수몰: ProcessCity,
|
||||
|
||||
Reference in New Issue
Block a user