feat(WIP): processing 물자원조
- nations, nationList를 nationList로 통합
This commit is contained in:
@@ -223,7 +223,7 @@ class che_급습 extends Command\NationCommand
|
|||||||
return [
|
return [
|
||||||
'mapTheme' => \sammo\getMapTheme(),
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
'procRes' => [
|
'procRes' => [
|
||||||
'nations' => $nationList,
|
'nationList' => $nationList,
|
||||||
'startYear' => $this->env['startyear'],
|
'startYear' => $this->env['startyear'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\Nation;
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
use \sammo\{
|
use \sammo\{
|
||||||
DB, Util, JosaUtil,
|
DB,
|
||||||
General, DummyGeneral,
|
Util,
|
||||||
|
JosaUtil,
|
||||||
|
General,
|
||||||
|
DummyGeneral,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
@@ -21,64 +25,67 @@ use function \sammo\getNationStaticInfo;
|
|||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
|
|
||||||
class che_물자원조 extends Command\NationCommand{
|
class che_물자원조 extends Command\NationCommand
|
||||||
|
{
|
||||||
static protected $actionName = '원조';
|
static protected $actionName = '원조';
|
||||||
static public $reqArg = true;
|
static public $reqArg = true;
|
||||||
|
|
||||||
protected function argTest():bool{
|
protected function argTest(): bool
|
||||||
if($this->arg === null){
|
{
|
||||||
|
if ($this->arg === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('destNationID', $this->arg)){
|
if (!key_exists('destNationID', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$destNationID = $this->arg['destNationID'];
|
$destNationID = $this->arg['destNationID'];
|
||||||
if(!is_int($destNationID)){
|
if (!is_int($destNationID)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($destNationID < 1){
|
if ($destNationID < 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('amountList', $this->arg)){
|
if (!key_exists('amountList', $this->arg)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amountList = $this->arg['amountList'];
|
$amountList = $this->arg['amountList'];
|
||||||
if(!is_array($amountList)){
|
if (!is_array($amountList)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($amountList) != 2){
|
if (count($amountList) != 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[$goldAmount, $riceAmount] = $amountList;
|
[$goldAmount, $riceAmount] = $amountList;
|
||||||
|
|
||||||
if(!is_int($goldAmount) || !is_int($riceAmount)){
|
if (!is_int($goldAmount) || !is_int($riceAmount)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($goldAmount < 0 || $riceAmount < 0){
|
if ($goldAmount < 0 || $riceAmount < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if($goldAmount == 0 && $riceAmount == 0){
|
if ($goldAmount == 0 && $riceAmount == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'destNationID'=>$destNationID,
|
'destNationID' => $destNationID,
|
||||||
'amountList'=>[$goldAmount, $riceAmount]
|
'amountList' => [$goldAmount, $riceAmount]
|
||||||
];
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init()
|
||||||
|
{
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['gold', 'rice', 'surlimit']);
|
$this->setNation(['gold', 'rice', 'surlimit']);
|
||||||
|
|
||||||
$this->minConditionConstraints=[
|
$this->minConditionConstraints = [
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
@@ -94,47 +101,51 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
$limit = $this->nation['level'] * GameConst::$coefAidAmount;
|
$limit = $this->nation['level'] * GameConst::$coefAidAmount;
|
||||||
|
|
||||||
if($goldAmount > $limit || $riceAmount > $limit){
|
if ($goldAmount > $limit || $riceAmount > $limit) {
|
||||||
$this->fullConditionConstraints[
|
$this->fullConditionConstraints[ConstraintHelper::AlwaysFail('작위 제한량 이상은 보낼 수 없습니다.')];
|
||||||
ConstraintHelper::AlwaysFail('작위 제한량 이상은 보낼 수 없습니다.')
|
|
||||||
];
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::ExistsDestNation(),
|
ConstraintHelper::ExistsDestNation(),
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
ConstraintHelper::ReqNationGold(GameConst::$basegold+(($goldAmount>0)?1:0)),
|
ConstraintHelper::ReqNationGold(GameConst::$basegold + (($goldAmount > 0) ? 1 : 0)),
|
||||||
ConstraintHelper::ReqNationRice(GameConst::$baserice+(($riceAmount>0)?1:0)),
|
ConstraintHelper::ReqNationRice(GameConst::$baserice + (($riceAmount > 0) ? 1 : 0)),
|
||||||
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
||||||
ConstraintHelper::ReqDestNationValue('surlimit', '외교제한', '==', 0, '상대국이 외교제한중입니다.'),
|
ConstraintHelper::ReqDestNationValue('surlimit', '외교제한', '==', 0, '상대국이 외교제한중입니다.'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost(): array
|
||||||
|
{
|
||||||
return [0, 0];
|
return [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn(): int
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn(): int
|
||||||
|
{
|
||||||
//NOTE: 자체 postReqTurn 사용
|
//NOTE: 자체 postReqTurn 사용
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextAvailableTurn():?int{
|
public function getNextAvailableTurn(): ?int
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNextAvailable(?int $yearMonth=null){
|
public function setNextAvailable(?int $yearMonth = null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrief():string{
|
public function getBrief(): string
|
||||||
|
{
|
||||||
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
$goldAmountText = number_format($goldAmount);
|
$goldAmountText = number_format($goldAmount);
|
||||||
$riceAmountText = number_format($riceAmount);
|
$riceAmountText = number_format($riceAmount);
|
||||||
@@ -144,8 +155,9 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function run():bool{
|
public function run(): bool
|
||||||
if(!$this->hasFullConditionMet()){
|
{
|
||||||
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +208,7 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
$broadcastMessage = "<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원했습니다.";
|
$broadcastMessage = "<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원했습니다.";
|
||||||
|
|
||||||
$chiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND no != %i AND nation = %i', $generalID, $nationID);
|
$chiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND no != %i AND nation = %i', $generalID, $nationID);
|
||||||
foreach($chiefList as $chiefID){
|
foreach ($chiefList as $chiefID) {
|
||||||
$chiefLogger = new ActionLogger($chiefID, $nationID, $year, $month);
|
$chiefLogger = new ActionLogger($chiefID, $nationID, $year, $month);
|
||||||
$chiefLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
$chiefLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||||
$chiefLogger->flush();
|
$chiefLogger->flush();
|
||||||
@@ -211,7 +223,7 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
|
|
||||||
$destBroadcastMessage = $broadcastMessage = "<D><b>{$nationName}</b></>에서 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 원조했습니다.";
|
$destBroadcastMessage = $broadcastMessage = "<D><b>{$nationName}</b></>에서 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 원조했습니다.";
|
||||||
$destChiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND nation = %i', $destNationID);
|
$destChiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND nation = %i', $destNationID);
|
||||||
foreach($destChiefList as $destChiefID){
|
foreach ($destChiefList as $destChiefID) {
|
||||||
$destChiefLogger = new ActionLogger($destChiefID, $nationID, $year, $month);
|
$destChiefLogger = new ActionLogger($destChiefID, $nationID, $year, $month);
|
||||||
$destChiefLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
$destChiefLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
||||||
$destChiefLogger->flush();
|
$destChiefLogger->flush();
|
||||||
@@ -222,19 +234,19 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaRoSrc}부터 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원 받음");
|
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaRoSrc}부터 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원 받음");
|
||||||
|
|
||||||
$destNationStor = KVStorage::getStorage(DB::db(), $destNationID, 'nation_env');
|
$destNationStor = KVStorage::getStorage(DB::db(), $destNationID, 'nation_env');
|
||||||
$destRecvAssist = $destNationStor->getValue('recv_assist')??[];
|
$destRecvAssist = $destNationStor->getValue('recv_assist') ?? [];
|
||||||
$destRecvAssist["n{$nationID}"] = [$nationID, ($destRecvAssist["n{$nationID}"][1]??0) + $goldAmount + $riceAmount];
|
$destRecvAssist["n{$nationID}"] = [$nationID, ($destRecvAssist["n{$nationID}"][1] ?? 0) + $goldAmount + $riceAmount];
|
||||||
$destNationStor->setValue('recv_assist', $destRecvAssist);
|
$destNationStor->setValue('recv_assist', $destRecvAssist);
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gold'=>$db->sqleval('gold - %i', $goldAmount),
|
'gold' => $db->sqleval('gold - %i', $goldAmount),
|
||||||
'rice'=>$db->sqleval('rice - %i', $riceAmount),
|
'rice' => $db->sqleval('rice - %i', $riceAmount),
|
||||||
'surlimit'=>$db->sqleval('surlimit + %i', $this->getPostReqTurn())
|
'surlimit' => $db->sqleval('surlimit + %i', $this->getPostReqTurn())
|
||||||
], 'nation = %i', $nationID);
|
], 'nation = %i', $nationID);
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gold'=>$db->sqleval('gold + %i', $goldAmount),
|
'gold' => $db->sqleval('gold + %i', $goldAmount),
|
||||||
'rice'=>$db->sqleval('rice + %i', $riceAmount),
|
'rice' => $db->sqleval('rice + %i', $riceAmount),
|
||||||
], 'nation = %i', $destNationID);
|
], 'nation = %i', $destNationID);
|
||||||
|
|
||||||
$general->addExperience(5);
|
$general->addExperience(5);
|
||||||
@@ -246,6 +258,51 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function exportJSVars(): array
|
||||||
|
{
|
||||||
|
$generalObj = $this->generalObj;
|
||||||
|
$nationList = [];
|
||||||
|
foreach (getAllNationStaticInfo() as $destNation) {
|
||||||
|
$nationTarget = [
|
||||||
|
'id' => $destNation['nation'],
|
||||||
|
'name' => $destNation['name'],
|
||||||
|
'color' => $destNation['color'],
|
||||||
|
'power' => $destNation['power'],
|
||||||
|
];
|
||||||
|
|
||||||
|
//TODO: 물자원조 자체가 가능한지도 검사?
|
||||||
|
|
||||||
|
if($nationTarget['id'] == $generalObj->getNationID()){
|
||||||
|
$nationTarget['notAvailable'] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nationList[] = $nationTarget;
|
||||||
|
}
|
||||||
|
$currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level'];
|
||||||
|
|
||||||
|
$nationLevelText = [];
|
||||||
|
foreach (\sammo\getNationLevelList() as $level => [$levelText,,]) {
|
||||||
|
$nationLevelText[$level] = $levelText;
|
||||||
|
}
|
||||||
|
|
||||||
|
$amountGuide = [];
|
||||||
|
foreach (Util::range(1, $currentNationLevel + 1) as $nationLevel) {
|
||||||
|
$amountGuide[] = $nationLevel * GameConst::$coefAidAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
|
'procRes' => [
|
||||||
|
'nationList' => $nationList,
|
||||||
|
'currentNationLevel' => $currentNationLevel,
|
||||||
|
'nationLevelText' => $nationLevelText,
|
||||||
|
'minAmount' => 1000,
|
||||||
|
'maxAmount' => Util::array_last($amountGuide),
|
||||||
|
'amountGuide' => $amountGuide,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function getJSPlugins(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -259,34 +316,31 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
$currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level'];
|
$currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level'];
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<?=\sammo\getMapHtml()?><br>
|
<?= \sammo\getMapHtml() ?><br>
|
||||||
타국에게 원조합니다.<br>
|
타국에게 원조합니다.<br>
|
||||||
작위별로 금액 제한이 있습니다.<br>
|
작위별로 금액 제한이 있습니다.<br>
|
||||||
<?php foreach(\sammo\getNationLevelList() as $level => [$levelText,,]): ?>
|
<?php foreach (\sammo\getNationLevelList() as $level => [$levelText,,]) : ?>
|
||||||
<?=StringUtil::padStringAlignRight($levelText, 10)?>: <?=number_format($level*GameConst::$coefAidAmount)?><br>
|
<?= StringUtil::padStringAlignRight($levelText, 10) ?>: <?= number_format($level * GameConst::$coefAidAmount) ?><br>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
원조할 국가를 목록에서 선택하세요.<br>
|
원조할 국가를 목록에서 선택하세요.<br>
|
||||||
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach(getAllNationStaticInfo() as $nation): ?>
|
<?php foreach (getAllNationStaticInfo() as $nation) : ?>
|
||||||
<option
|
<option value='<?= $nation['nation'] ?>' style='color:<?= $nation['color'] ?>;'>【<?= $nation['name'] ?> 】</option>
|
||||||
value='<?=$nation['nation']?>'
|
<?php endforeach; ?>
|
||||||
style='color:<?=$nation['color']?>;'
|
</select>
|
||||||
>【<?=$nation['name']?> 】</option>
|
국고 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
||||||
<?php endforeach; ?>
|
<?php foreach (Util::range($currentNationLevel + 1) as $nationLevel) : ?>
|
||||||
</select>
|
<option value='<?= $nationLevel * GameConst::$coefAidAmount ?>'><?= $nationLevel * GameConst::$coefAidAmount ?></option>
|
||||||
국고 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
<?php endforeach; ?>
|
||||||
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
</select>
|
||||||
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
병량 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
||||||
<?php endforeach; ?>
|
<?php foreach (Util::range($currentNationLevel + 1) as $nationLevel) : ?>
|
||||||
</select>
|
<option value='<?= $nationLevel * GameConst::$coefAidAmount ?>'><?= $nationLevel * GameConst::$coefAidAmount ?></option>
|
||||||
병량 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
<?php endforeach; ?>
|
||||||
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
</select>
|
||||||
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
<input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
||||||
<?php endforeach; ?>
|
<br>
|
||||||
</select>
|
|
||||||
<input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ class che_선전포고 extends Command\NationCommand
|
|||||||
return [
|
return [
|
||||||
'mapTheme' => \sammo\getMapTheme(),
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
'procRes' => [
|
'procRes' => [
|
||||||
'nations' => $nationList,
|
'nationList' => $nationList,
|
||||||
'startYear' => $this->env['startyear'],
|
'startYear' => $this->env['startyear'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
:max="maxAmount"
|
:max="maxAmount"
|
||||||
:min="minAmount"
|
:min="minAmount"
|
||||||
|
:step="step"
|
||||||
v-model="amount"
|
v-model="amount"
|
||||||
placeholder="금액"
|
placeholder="금액"
|
||||||
/>
|
/>
|
||||||
@@ -69,8 +70,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
amountGuide: {
|
amountGuide: {
|
||||||
type: Array as PropType<number[]>,
|
type: Array as PropType<number[]>,
|
||||||
reqquired: false,
|
required: false,
|
||||||
},
|
},
|
||||||
|
step: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
default: 1,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
emits: ["update:modelValue"],
|
emits: ["update:modelValue"],
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 col-md-3">
|
<div class="col-6 col-md-3">
|
||||||
국가 :
|
국가 :
|
||||||
<NationSelect :nations="nations" v-model="selectedNationID" />
|
<NationSelect :nations="nationList" v-model="selectedNationID" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 col-md-2 d-grid">
|
<div class="col-4 col-md-2 d-grid">
|
||||||
<b-button @click="submit">{{ commandName }}</b-button>
|
<b-button @click="submit">{{ commandName }}</b-button>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<div>임관권유문</div>
|
<div>임관권유문</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="[, nation] in nations"
|
v-for="[, nation] in nationList"
|
||||||
:key="nation.id"
|
:key="nation.id"
|
||||||
class="nation-row s-border-b"
|
class="nation-row s-border-b"
|
||||||
@click="selectedNationID = nation.id"
|
@click="selectedNationID = nation.id"
|
||||||
@@ -68,9 +68,9 @@ export default defineComponent({
|
|||||||
BottomBar,
|
BottomBar,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const nations = new Map<number, procNationItem>();
|
const nationList = new Map<number, procNationItem>();
|
||||||
for (const nationItem of procRes.nationList) {
|
for (const nationItem of procRes.nationList) {
|
||||||
nations.set(nationItem.id, nationItem);
|
nationList.set(nationItem.id, nationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedNationID = ref(procRes.nationList[0].id);
|
const selectedNationID = ref(procRes.nationList[0].id);
|
||||||
@@ -89,7 +89,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nations: ref(nations),
|
nationList: ref(nationList),
|
||||||
selectedNationID,
|
selectedNationID,
|
||||||
commandName,
|
commandName,
|
||||||
isBrightColor,
|
isBrightColor,
|
||||||
|
|||||||
@@ -97,9 +97,9 @@ export default defineComponent({
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nations = new Map<number, procNationItem>();
|
const nationList = new Map<number, procNationItem>();
|
||||||
for (const nationItem of procRes.nationList) {
|
for (const nationItem of procRes.nationList) {
|
||||||
nations.set(nationItem.id, nationItem);
|
nationList.set(nationItem.id, nationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submit(e: Event) {
|
async function submit(e: Event) {
|
||||||
@@ -111,16 +111,10 @@ export default defineComponent({
|
|||||||
unwrap(e.target).dispatchEvent(event);
|
unwrap(e.target).dispatchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
const nationList = new Map<number, procNationItem>();
|
|
||||||
for (const nationItem of procRes.nationList) {
|
|
||||||
nationList.set(nationItem.id, nationItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nations: ref(nations),
|
nationList: ref(nationList),
|
||||||
selectedGeneralID,
|
selectedGeneralID,
|
||||||
generalList,
|
generalList,
|
||||||
nationList,
|
|
||||||
commandName,
|
commandName,
|
||||||
isBrightColor,
|
isBrightColor,
|
||||||
textHelpGeneral,
|
textHelpGeneral,
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
<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 />
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6 col-md-3">
|
||||||
|
국가 :
|
||||||
|
<NationSelect :nations="nationList" v-model="selectedNationID" />
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-md-0"></div>
|
||||||
|
<div class="col-10 col-md-5">
|
||||||
|
금 :
|
||||||
|
<AmountSelect
|
||||||
|
:amountGuide="amountGuide"
|
||||||
|
v-model="goldAmount"
|
||||||
|
:step="10"
|
||||||
|
:maxAmount="maxAmount"
|
||||||
|
:minAmount="minAmount"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-10 col-md-5">
|
||||||
|
쌀 :
|
||||||
|
<AmountSelect
|
||||||
|
:amountGuide="amountGuide"
|
||||||
|
v-model="riceAmount"
|
||||||
|
:step="10"
|
||||||
|
:maxAmount="maxAmount"
|
||||||
|
:minAmount="minAmount"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 col-md-2 d-grid">
|
||||||
|
<b-button variant="primary" @click="submit">{{ commandName }}</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<BottomBar :title="commandName" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import MapLegacyTemplate, {
|
||||||
|
MapCityParsed,
|
||||||
|
} from "@/components/MapLegacyTemplate.vue";
|
||||||
|
import NationSelect from "@/processing/NationSelect.vue";
|
||||||
|
import AmountSelect from "@/processing/AmountSelect.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;
|
||||||
|
currentNationLevel: number;
|
||||||
|
nationLevelText: Record<number, string>;
|
||||||
|
minAmount: number;
|
||||||
|
maxAmount: number;
|
||||||
|
amountGuide: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
MapLegacyTemplate,
|
||||||
|
NationSelect,
|
||||||
|
AmountSelect,
|
||||||
|
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 goldAmount = ref(procRes.minAmount);
|
||||||
|
const riceAmount = ref(procRes.minAmount);
|
||||||
|
|
||||||
|
const selectedNationID = ref(procRes.nationList[0]?.id);
|
||||||
|
const selectedCityObj = ref(); //mapping용
|
||||||
|
|
||||||
|
async function submit(e: Event) {
|
||||||
|
const event = new CustomEvent<Args>("customSubmit", {
|
||||||
|
detail: {
|
||||||
|
amountList: [goldAmount.value, riceAmount.value],
|
||||||
|
destNationID: selectedNationID.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
unwrap(e.target).dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
mapTheme,
|
||||||
|
goldAmount,
|
||||||
|
riceAmount,
|
||||||
|
nationList,
|
||||||
|
selectedNationID,
|
||||||
|
selectedCityObj,
|
||||||
|
currentNationLevel: procRes.currentNationLevel,
|
||||||
|
nationLevelText: procRes.nationLevelText,
|
||||||
|
minAmount: ref(procRes.minAmount),
|
||||||
|
maxAmount: ref(procRes.maxAmount),
|
||||||
|
amountGuide: procRes.amountGuide,
|
||||||
|
commandName,
|
||||||
|
submit,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 col-md-3">
|
<div class="col-6 col-md-3">
|
||||||
국가 :
|
국가 :
|
||||||
<NationSelect :nations="nations" v-model="selectedNationID" />
|
<NationSelect :nations="nationList" v-model="selectedNationID" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 col-md-2 d-grid">
|
<div class="col-4 col-md-2 d-grid">
|
||||||
<b-button @click="submit">{{ commandName }}</b-button>
|
<b-button @click="submit">{{ commandName }}</b-button>
|
||||||
@@ -54,7 +54,7 @@ declare const mapTheme: string;
|
|||||||
declare const commandName: string;
|
declare const commandName: string;
|
||||||
|
|
||||||
declare const procRes: {
|
declare const procRes: {
|
||||||
nations: procNationList;
|
nationList: procNationList;
|
||||||
startYear: number,
|
startYear: number,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,12 +74,12 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const nations = new Map<number, procNationItem>();
|
const nationList = new Map<number, procNationItem>();
|
||||||
for (const nationItem of procRes.nations) {
|
for (const nationItem of procRes.nationList) {
|
||||||
nations.set(nationItem.id, nationItem);
|
nationList.set(nationItem.id, nationItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedNationID = ref(procRes.nations[0].id);
|
const selectedNationID = ref(procRes.nationList[0].id);
|
||||||
const selectedCityObj = ref();//mapping용
|
const selectedCityObj = ref();//mapping용
|
||||||
|
|
||||||
function selectedNation(nationID: number) {
|
function selectedNation(nationID: number) {
|
||||||
@@ -98,7 +98,7 @@ export default defineComponent({
|
|||||||
return {
|
return {
|
||||||
startYear: procRes.startYear,
|
startYear: procRes.startYear,
|
||||||
mapTheme: ref(mapTheme),
|
mapTheme: ref(mapTheme),
|
||||||
nations: ref(nations),
|
nationList: ref(nationList),
|
||||||
selectedCityObj,
|
selectedCityObj,
|
||||||
selectedNationID,
|
selectedNationID,
|
||||||
commandName,
|
commandName,
|
||||||
|
|||||||
@@ -1,5 +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 NationProcess } from "./che_선전포고.vue";
|
import { default as NationProcess } from "./che_선전포고.vue";
|
||||||
import { default as GeneralAmountProcess } from "./che_몰수.vue";
|
import { default as GeneralAmountProcess } from "./che_몰수.vue";
|
||||||
import { default as GeneralCityProcess } from "./che_발령.vue";
|
import { default as GeneralCityProcess } from "./che_발령.vue";
|
||||||
@@ -9,6 +11,7 @@ export const commandMap: Record<string, typeof NationProcess> = {
|
|||||||
che_국호변경,
|
che_국호변경,
|
||||||
che_급습: NationProcess,
|
che_급습: NationProcess,
|
||||||
che_몰수: GeneralAmountProcess,
|
che_몰수: GeneralAmountProcess,
|
||||||
|
che_물자원조,
|
||||||
che_선전포고: NationProcess,
|
che_선전포고: NationProcess,
|
||||||
che_포상: GeneralAmountProcess,
|
che_포상: GeneralAmountProcess,
|
||||||
che_발령: GeneralCityProcess,
|
che_발령: GeneralCityProcess,
|
||||||
|
|||||||
Reference in New Issue
Block a user