금액 단위를 GameConst로 이동, 원조 추가
arg 목록으로 amountList 추가
This commit is contained in:
@@ -225,7 +225,7 @@ function checkCommandArg(?array $arg):?string{
|
|||||||
['crewType', 0]
|
['crewType', 0]
|
||||||
],
|
],
|
||||||
'integerArray'=>[
|
'integerArray'=>[
|
||||||
'destNationIDList', 'destGeneralIDList'
|
'destNationIDList', 'destGeneralIDList', 'amountList'
|
||||||
],
|
],
|
||||||
'stringWidthBetween'=>[
|
'stringWidthBetween'=>[
|
||||||
['nationName', 1, 18]
|
['nationName', 1, 18]
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ window.submitAction = function(){
|
|||||||
'isGold', 'buyRice',
|
'isGold', 'buyRice',
|
||||||
],
|
],
|
||||||
'integerArray':[
|
'integerArray':[
|
||||||
'destNationIDList', 'destGeneralIDList'
|
'destNationIDList', 'destGeneralIDList', 'amountList'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class ActionLogger{
|
|||||||
$this->generalBattleDetailLog[] = $text;
|
$this->generalBattleDetailLog[] = $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pushNationalHistoryLog($text, int $formatType = self::RAWTEXT){
|
public function pushNationalHistoryLog($text, int $formatType = self::YEAR_MONTH){
|
||||||
if(!$text){
|
if(!$text){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::valueFit($amount, 100, 10000);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxIncentiveAmount);
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'buyRice'=>$buyRice,
|
'buyRice'=>$buyRice,
|
||||||
@@ -184,28 +184,9 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
<option value='true'>삼</option>
|
<option value='true'>삼</option>
|
||||||
</select>
|
</select>
|
||||||
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
||||||
<option value=100>100</option>
|
<?php foreach(GameConst::$resourceActionAmountGuide as $amount): ?>
|
||||||
<option value=200>200</option>
|
<option value='<?=$amount?>'><?=$amount?></option>
|
||||||
<option value=300>300</option>
|
<?php endforeach; ?>
|
||||||
<option value=400>400</option>
|
|
||||||
<option value=500>500</option>
|
|
||||||
<option value=600>600</option>
|
|
||||||
<option value=700>700</option>
|
|
||||||
<option value=800>800</option>
|
|
||||||
<option value=900>900</option>
|
|
||||||
<option value=1000>1000</option>
|
|
||||||
<option value=1200>1200</option>
|
|
||||||
<option value=1500>1500</option>
|
|
||||||
<option value=2000>2000</option>
|
|
||||||
<option value=2500>2500</option>
|
|
||||||
<option value=3000>3000</option>
|
|
||||||
<option value=4000>4000</option>
|
|
||||||
<option value=5000>5000</option>
|
|
||||||
<option value=6000>6000</option>
|
|
||||||
<option value=7000>7000</option>
|
|
||||||
<option value=8000>8000</option>
|
|
||||||
<option value=9000>9000</option>
|
|
||||||
<option value=10000>10000</option>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class che_증여 extends Command\GeneralCommand{
|
|||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::valueFit($amount, 100, 10000);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
||||||
if(!is_bool($isGold)){
|
if(!is_bool($isGold)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -192,28 +192,9 @@ class che_증여 extends Command\GeneralCommand{
|
|||||||
<option value="false">쌀</option>
|
<option value="false">쌀</option>
|
||||||
</select>
|
</select>
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
||||||
<option value=100>100</option>
|
<?php foreach(GameConst::$resourceActionAmountGuide as $amount): ?>
|
||||||
<option value=200>200</option>
|
<option value='<?=$amount?>'><?=$amount?></option>
|
||||||
<option value=300>300</option>
|
<?php endforeach; ?>
|
||||||
<option value=400>400</option>
|
|
||||||
<option value=500>500</option>
|
|
||||||
<option value=600>600</option>
|
|
||||||
<option value=700>700</option>
|
|
||||||
<option value=800>800</option>
|
|
||||||
<option value=900>900</option>
|
|
||||||
<option value=1000>1000</option>
|
|
||||||
<option value=1200>1200</option>
|
|
||||||
<option value=1500>1500</option>
|
|
||||||
<option value=2000>2000</option>
|
|
||||||
<option value=2500>2500</option>
|
|
||||||
<option value=3000>3000</option>
|
|
||||||
<option value=4000>4000</option>
|
|
||||||
<option value=5000>5000</option>
|
|
||||||
<option value=6000>6000</option>
|
|
||||||
<option value=7000>7000</option>
|
|
||||||
<option value=8000>8000</option>
|
|
||||||
<option value=9000>9000</option>
|
|
||||||
<option value=10000>10000</option>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class che_헌납 extends Command\GeneralCommand{
|
|||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::valueFit($amount, 100, 10000);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
||||||
if(!is_bool($isGold)){
|
if(!is_bool($isGold)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -152,28 +152,9 @@ class che_헌납 extends Command\GeneralCommand{
|
|||||||
<option value='false'>쌀</option>
|
<option value='false'>쌀</option>
|
||||||
</select>
|
</select>
|
||||||
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
<select name=amount id='amount' size=1 style=text-align:right;color:white;background-color:black>
|
||||||
<option value=100>100</option>
|
<?php foreach(GameConst::$resourceActionAmountGuide as $amount): ?>
|
||||||
<option value=200>200</option>
|
<option value='<?=$amount?>'><?=$amount?></option>
|
||||||
<option value=300>300</option>
|
<?php endforeach; ?>
|
||||||
<option value=400>400</option>
|
|
||||||
<option value=500>500</option>
|
|
||||||
<option value=600>600</option>
|
|
||||||
<option value=700>700</option>
|
|
||||||
<option value=800>800</option>
|
|
||||||
<option value=900>900</option>
|
|
||||||
<option value=1000>1000</option>
|
|
||||||
<option value=1200>1200</option>
|
|
||||||
<option value=1500>1500</option>
|
|
||||||
<option value=2000>2000</option>
|
|
||||||
<option value=2500>2500</option>
|
|
||||||
<option value=3000>3000</option>
|
|
||||||
<option value=4000>4000</option>
|
|
||||||
<option value=5000>5000</option>
|
|
||||||
<option value=6000>6000</option>
|
|
||||||
<option value=7000>7000</option>
|
|
||||||
<option value=8000>8000</option>
|
|
||||||
<option value=9000>9000</option>
|
|
||||||
<option value=10000>10000</option>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class che_몰수 extends Command\NationCommand{
|
|||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::valueFit($amount, 100, 10000);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
||||||
if(!is_bool($isGold)){
|
if(!is_bool($isGold)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -214,12 +214,6 @@ class che_몰수 extends Command\NationCommand{
|
|||||||
'rice'=>$destGeneral['rice']
|
'rice'=>$destGeneral['rice']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$amountList = [
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
||||||
12, 15, 20, 25,
|
|
||||||
30, 40, 50, 60, 70, 80, 90, 100
|
|
||||||
];
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
장수의 자금이나 군량을 몰수합니다.<br>
|
장수의 자금이나 군량을 몰수합니다.<br>
|
||||||
@@ -235,8 +229,8 @@ class che_몰수 extends Command\NationCommand{
|
|||||||
</select>
|
</select>
|
||||||
</select>
|
</select>
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach($amountList as $amount): ?>
|
<?php foreach(GameConst::$resourceActionAmountGuide as $amount): ?>
|
||||||
<option value='<?=$amount?>00'><?=$amount?>00</option>
|
<option value='<?=$amount?>'><?=$amount?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -228,6 +228,7 @@ class che_선전포고 extends Command\NationCommand{
|
|||||||
style='color:<?=$nation['color']?>;<?=$nation['availableWar']?'':'background-color:red;'?>'
|
style='color:<?=$nation['color']?>;<?=$nation['availableWar']?'':'background-color:red;'?>'
|
||||||
>【<?=$nation['name']?> 】</option>
|
>【<?=$nation['name']?> 】</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|||||||
@@ -0,0 +1,272 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Command\Nation;
|
||||||
|
|
||||||
|
use \sammo\{
|
||||||
|
DB, Util, JosaUtil,
|
||||||
|
General, DummyGeneral,
|
||||||
|
ActionLogger,
|
||||||
|
GameConst,
|
||||||
|
LastTurn,
|
||||||
|
GameUnitConst,
|
||||||
|
Command,
|
||||||
|
StringUtil
|
||||||
|
};
|
||||||
|
|
||||||
|
use function \sammo\{
|
||||||
|
getDomesticExpLevelBonus,
|
||||||
|
CriticalRatioDomestic,
|
||||||
|
CriticalScoreEx,
|
||||||
|
getAllNationStaticInfo,
|
||||||
|
getNationStaticInfo
|
||||||
|
};
|
||||||
|
|
||||||
|
use \sammo\Constraint\Constraint;
|
||||||
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
|
|
||||||
|
class che_원조 extends Command\NationCommand{
|
||||||
|
static protected $actionName = '원조';
|
||||||
|
static public $reqArg = true;
|
||||||
|
|
||||||
|
protected function argTest():bool{
|
||||||
|
if($this->arg === null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!key_exists('destNationID', $this->arg)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$destNationID = $this->arg['destNationID'];
|
||||||
|
if(!is_int($destNationID)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($destNationID < 1){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!key_exists('amountList', $this->arg)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$amountList = $this->arg['amountList'];
|
||||||
|
if(!is_array($amountList)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($amountList) != 2){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[$goldAmount, $riceAmount] = $amountList;
|
||||||
|
|
||||||
|
if(!is_int($goldAmount) || !is_int($riceAmount)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($goldAmount < 0 || $riceAmount < 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if($goldAmount == 0 && $riceAmount == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->arg = [
|
||||||
|
'destNationID'=>$destNationID,
|
||||||
|
'amountList'=>[$goldAmount, $riceAmount]
|
||||||
|
];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function init(){
|
||||||
|
$general = $this->generalObj;
|
||||||
|
|
||||||
|
$this->setCity();
|
||||||
|
$this->setNation(['gold', 'rice', 'surlimit']);
|
||||||
|
|
||||||
|
$destNationID = $this->arg['destNationID'];
|
||||||
|
$this->setDestNation($destNationID, ['gold', 'rice', 'surlimit']);
|
||||||
|
|
||||||
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
|
$limit = $this->nation['level'] * GameConst::$coefAidAmount;
|
||||||
|
|
||||||
|
if($goldAmount > $limit || $riceAmount > $limit){
|
||||||
|
$this->runnableConstraints[
|
||||||
|
ConstraintHelper::AlwaysFail('작위 제한량 이상은 보낼 수 없습니다.')
|
||||||
|
];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->runnableConstraints=[
|
||||||
|
ConstraintHelper::ExistsDestNation(),
|
||||||
|
ConstraintHelper::OccupiedCity(),
|
||||||
|
ConstraintHelper::BeChief(),
|
||||||
|
ConstraintHelper::SuppliedCity(),
|
||||||
|
ConstraintHelper::ReqNationGold(GameConst::$basegold+($goldAmount>0)?1:0),
|
||||||
|
ConstraintHelper::ReqNationRice(GameConst::$baserice+($riceAmount>0)?1:0),
|
||||||
|
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
||||||
|
ConstraintHelper::ReqDestNationValue('surlimit', '외교제한', '==', 0, '상대국이 외교제한중입니다.'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCost():array{
|
||||||
|
return [0, 0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPreReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPostReqTurn():int{
|
||||||
|
return 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBrief():string{
|
||||||
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
|
$goldAmountText = number_format($goldAmount);
|
||||||
|
$riceAmountText = number_format($riceAmount);
|
||||||
|
$destNationName = $this->destNation['name'];
|
||||||
|
$commandName = $this->getName();
|
||||||
|
return "【{$destNationName}】에게 국고 {$goldAmountText} 병량 {$riceAmountText} {$commandName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function run():bool{
|
||||||
|
if(!$this->isRunnable()){
|
||||||
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$general = $this->generalObj;
|
||||||
|
$generalID = $general->getID();
|
||||||
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
|
$nation = $this->nation;
|
||||||
|
$nationID = $nation['nation'];
|
||||||
|
$nationName = $nation['name'];
|
||||||
|
|
||||||
|
$destNationID = $this->destNation['nation'];
|
||||||
|
$destNationName = $this->destNation['name'];
|
||||||
|
|
||||||
|
|
||||||
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
|
|
||||||
|
|
||||||
|
$goldAmount = Util::valueFit(
|
||||||
|
$goldAmount,
|
||||||
|
0,
|
||||||
|
$nation['gold'] - GameConst::$basegold
|
||||||
|
);
|
||||||
|
|
||||||
|
$riceAmount = Util::valueFit(
|
||||||
|
$riceAmount,
|
||||||
|
0,
|
||||||
|
$nation['rice'] - GameConst::$baserice
|
||||||
|
);
|
||||||
|
|
||||||
|
$goldAmountText = number_format($goldAmount);
|
||||||
|
$riceAmountText = number_format($riceAmount);
|
||||||
|
|
||||||
|
|
||||||
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
$year = $this->env['year'];
|
||||||
|
$month = $this->env['month'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$josaRo = JosaUtil::pick($destNationName, '로');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$broadcastMessage = "<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원했습니다.";
|
||||||
|
|
||||||
|
$chiefList = $db->queryFirstColumn('SELECT no FROM general WHERE level >= 5 AND no != %i AND nation = %i', $generalID, $nationID);
|
||||||
|
foreach($chiefList as $chiefID){
|
||||||
|
$chiefLogger = new ActionLogger($chiefID, $nationID, $year, $month);
|
||||||
|
$chiefLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||||
|
$chiefLogger->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
$logger->pushGeneralHistoryLog("<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원");
|
||||||
|
$logger->pushNationalHistoryLog("<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원");
|
||||||
|
$logger->pushGlobalHistoryLog("<Y><b>【원조】</b></><D><b>{$nationName}</b></>에서 <D><b>{$destNationName}</b></>{$josaRo} 물자를 지원합니다");
|
||||||
|
|
||||||
|
$logger->pushGeneralActionLog($broadcastMessage);
|
||||||
|
$logger->pushGeneralActionLog("<D><b>{$destNationName}</b></>{$josaRo} 물자를 지원합니다. <1>$date</>", ActionLogger::PLAIN);
|
||||||
|
|
||||||
|
$destBroadcastMessage = $broadcastMessage = "<D><b>{$nationName}</b></>에서 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 원조했습니다.";
|
||||||
|
$destChiefList = $db->queryFirstColumn('SELECT no FROM general WHERE level >= 5 AND nation = %i', $destNationID);
|
||||||
|
foreach($destChiefList as $destChiefID){
|
||||||
|
$destChiefLogger = new ActionLogger($destChiefID, $nationID, $year, $month);
|
||||||
|
$destChiefLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
||||||
|
$destChiefLogger->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
$josaRoSrc = JosaUtil::pick($nationName, '로');
|
||||||
|
$destNationLogger = new ActionLogger(0, $destChiefID, $year, $month);
|
||||||
|
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaRoSrc}부터 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원 받음");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold'=>$db->sqleval('gold - %i', $goldAmount),
|
||||||
|
'rice'=>$db->sqleval('rice - %i', $riceAmount),
|
||||||
|
'surlimit'=>$db->sqleval('surlimit + %i', 12)
|
||||||
|
], 'nation = %i', $nationID);
|
||||||
|
|
||||||
|
$db->update('nation', [
|
||||||
|
'gold'=>$db->sqleval('gold + %i', $goldAmount),
|
||||||
|
'rice'=>$db->sqleval('rice + %i', $riceAmount),
|
||||||
|
], 'nation = %i', $destNationID);
|
||||||
|
|
||||||
|
$general->increaseVar('experience', $general->onCalcStat($general, 'experience', 5));
|
||||||
|
$general->increaseVar('dedication', $general->onCalcStat($general, 'dedication', 5));
|
||||||
|
|
||||||
|
|
||||||
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getJSFiles(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'js/defaultSelectNationByMap.js'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getForm(): string
|
||||||
|
{
|
||||||
|
$currentNationLevel = getNationStaticInfo($this->generalObj->getNationID())['level'];
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<?=\sammo\getMapHtml()?><br>
|
||||||
|
타국에게 원조합니다.<br>
|
||||||
|
작위별로 금액 제한이 있습니다.<br>
|
||||||
|
<?php foreach(\sammo\getNationLevelList() as $level => [$levelText,,]): ?>
|
||||||
|
<?=StringUtil::padStringAlignRight($levelText, 10)?>: <?=number_format($level*GameConst::$coefAidAmount)?><br>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
원조할 국가를 목록에서 선택하세요.<br>
|
||||||
|
<select class='formInput' name="destNationID" id="destNationID" size='1' style='color:white;background-color:black;'>
|
||||||
|
<?php foreach(getAllNationStaticInfo() as $nation): ?>
|
||||||
|
<option
|
||||||
|
value='<?=$nation['nation']?>'
|
||||||
|
style='color:<?=$nation['color']?>;'
|
||||||
|
>【<?=$nation['name']?> 】</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
국고 <select class='formInput' name="goldAmount" id="goldAmount" size='1' style='color:white;background-color:black;'>
|
||||||
|
<?php foreach(range(0, $currentNationLevel) as $nationLevel): ?>
|
||||||
|
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
병량 <select class='formInput' name="riceAmount" id="riceAmount" size='1' style='color:white;background-color:black;'>
|
||||||
|
<?php foreach(range(0, $currentNationLevel) as $nationLevel): ?>
|
||||||
|
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
|
<br>
|
||||||
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,7 +44,7 @@ class che_포상 extends Command\NationCommand{
|
|||||||
if(!is_int($amount)){
|
if(!is_int($amount)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$amount = Util::valueFit($amount, 100, 10000);
|
$amount = Util::valueFit($amount, 100, GameConst::$maxResourceActionAmount);
|
||||||
if(!is_bool($isGold)){
|
if(!is_bool($isGold)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -183,12 +183,6 @@ class che_포상 extends Command\NationCommand{
|
|||||||
'rice'=>$destGeneral['rice']
|
'rice'=>$destGeneral['rice']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$amountList = [
|
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
|
|
||||||
12, 15, 20, 25,
|
|
||||||
30, 40, 50, 60, 70, 80, 90, 100
|
|
||||||
];
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
국고로 장수에게 자금이나 군량을 지급합니다.<br>
|
국고로 장수에게 자금이나 군량을 지급합니다.<br>
|
||||||
@@ -203,8 +197,8 @@ class che_포상 extends Command\NationCommand{
|
|||||||
</select>
|
</select>
|
||||||
</select>
|
</select>
|
||||||
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="amount" id="amount" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach($amountList as $amount): ?>
|
<?php foreach(GameConst::$resourceActionAmountGuide as $amount): ?>
|
||||||
<option value='<?=$amount?>00'><?=$amount?>00</option>
|
<option value='<?=$amount?>'><?=$amount?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
</select> <input type=button id="commonSubmit" value="<?=$this->getName()?>"><br>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
@@ -111,6 +111,17 @@ class GameConstBase
|
|||||||
/** @var int 시작시 쌀 */
|
/** @var int 시작시 쌀 */
|
||||||
public static $defaultRice = 1000;
|
public static $defaultRice = 1000;
|
||||||
|
|
||||||
|
/** @var int 원조 계수 */
|
||||||
|
public static $coefAidAmount = 10000;
|
||||||
|
|
||||||
|
/** @var int 최대 개별 자원 금액 */
|
||||||
|
public static $maxResourceActionAmount = 10000;
|
||||||
|
/** @var int[] 포상/몰수 가이드 금액 */
|
||||||
|
public static $resourceActionAmountGuide = [
|
||||||
|
100, 200, 300, 400, 500, 600, 700, 800, 900, 1000,
|
||||||
|
1200, 1500, 2000, 2500, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000
|
||||||
|
];
|
||||||
|
|
||||||
public static $generalMinimumGold = 0;
|
public static $generalMinimumGold = 0;
|
||||||
public static $generalMinimumRice = 500;
|
public static $generalMinimumRice = 500;
|
||||||
|
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ class GeneralAI{
|
|||||||
if((($isWarUser || $resName == 'gold') && $compUser->$resName < 21000) || ($compUser->$resName < 5000)){
|
if((($isWarUser || $resName == 'gold') && $compUser->$resName < 21000) || ($compUser->$resName < 5000)){
|
||||||
if($work){
|
if($work){
|
||||||
//TODO: 새로 구현한 코드로 이전
|
//TODO: 새로 구현한 코드로 이전
|
||||||
$amount = min(10000, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*1000 + 1000);
|
$amount = min(GameConst::$maxIncentiveAmount, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 3000)*1000 + 1000);
|
||||||
$commandList[] = [['che_포상', [
|
$commandList[] = [['che_포상', [
|
||||||
'destGeneralID'=>$userGenerals[0]->no,
|
'destGeneralID'=>$userGenerals[0]->no,
|
||||||
'isGold'=>$resName=='gold',
|
'isGold'=>$resName=='gold',
|
||||||
@@ -706,7 +706,7 @@ class GeneralAI{
|
|||||||
]], 10]; // 금,쌀 1000단위 포상
|
]], 10]; // 금,쌀 1000단위 포상
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$amount = min(10000, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 5000)*1000 + 1000);
|
$amount = min(GameConst::$maxIncentiveAmount, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 5000)*1000 + 1000);
|
||||||
$commandList[] = [['che_포상', [
|
$commandList[] = [['che_포상', [
|
||||||
'destGeneralID'=>$userGenerals[0]->no,
|
'destGeneralID'=>$userGenerals[0]->no,
|
||||||
'isGold'=>$resName=='gold',
|
'isGold'=>$resName=='gold',
|
||||||
@@ -1130,10 +1130,10 @@ class GeneralAI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($general->getVar('gold') >= $general->getVar('rice')){
|
if($general->getVar('gold') >= $general->getVar('rice')){
|
||||||
return ['che_헌납', ['isGold'=>true, 'amount'=>10000]];
|
return ['che_헌납', ['isGold'=>true, 'amount'=>GameConst::$maxResourceActionAmount]];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return ['che_헌납', ['isGold'=>false, 'amount'=>10000]];
|
return ['che_헌납', ['isGold'=>false, 'amount'=>GameConst::$maxResourceActionAmount]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user