원조 받으면 불가침 제의
This commit is contained in:
@@ -10,6 +10,7 @@ use \sammo\{
|
||||
GameUnitConst,
|
||||
Command,
|
||||
Json,
|
||||
KVStorage,
|
||||
StringUtil
|
||||
};
|
||||
|
||||
@@ -91,7 +92,7 @@ class che_물자원조 extends Command\NationCommand{
|
||||
protected function initWithArg()
|
||||
{
|
||||
$destNationID = $this->arg['destNationID'];
|
||||
$this->setDestNation($destNationID, ['gold', 'rice', 'surlimit', 'aux']);
|
||||
$this->setDestNation($destNationID, ['gold', 'rice', 'surlimit']);
|
||||
|
||||
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||
$limit = $this->nation['level'] * GameConst::$coefAidAmount;
|
||||
@@ -223,12 +224,10 @@ class che_물자원조 extends Command\NationCommand{
|
||||
$destNationLogger = new ActionLogger(0, $destChiefID, $year, $month);
|
||||
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaRoSrc}부터 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원 받음");
|
||||
|
||||
|
||||
$destAux = Json::decode($this->destNation['aux']);
|
||||
if(!key_exists('recv_assist', $destAux)){
|
||||
$destAux['recv_assist'] = [];
|
||||
}
|
||||
$destAux['recv_assist'][$nationID] = $destAux['recv_assist'][$nationID]??0 + $goldAmount + $riceAmount;
|
||||
$destNationStor = KVStorage::getStorage(DB::db(), $destNationID, 'nation_env');
|
||||
$destRecvAssist = $destNationStor->getValue('recv_assist')??[];
|
||||
$destRecvAssist["n{$nationID}"] = [$nationID, ($destRecvAssist["n{$nationID}"][1]??0) + $goldAmount + $riceAmount];
|
||||
$destNationStor->setValue('recv_assist', $destRecvAssist);
|
||||
|
||||
$db->update('nation', [
|
||||
'gold'=>$db->sqleval('gold - %i', $goldAmount),
|
||||
@@ -239,7 +238,6 @@ class che_물자원조 extends Command\NationCommand{
|
||||
$db->update('nation', [
|
||||
'gold'=>$db->sqleval('gold + %i', $goldAmount),
|
||||
'rice'=>$db->sqleval('rice + %i', $riceAmount),
|
||||
'aux'=>Json::encode($destAux)
|
||||
], 'nation = %i', $destNationID);
|
||||
|
||||
$general->addExperience(5);
|
||||
|
||||
@@ -26,6 +26,7 @@ use function \sammo\GetImageUR;
|
||||
use \sammo\Constraint\Constraint;
|
||||
use \sammo\Constraint\ConstraintHelper;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
|
||||
class che_불가침수락 extends Command\NationCommand
|
||||
{
|
||||
@@ -188,11 +189,12 @@ class che_불가침수락 extends Command\NationCommand
|
||||
$destNationID = $destNation['nation'];
|
||||
$destNationName = $destNation['name'];
|
||||
|
||||
$destNationAux = Json::decode($db->queryFirstField('SELECT aux FROM nation WHERE nation = %i', $destNationID));
|
||||
if(!key_exists('resp_assist', $destNationAux)){
|
||||
$destNationAux['resp_assist'] = [];
|
||||
}
|
||||
$destNationAux['resp_assist'][$nationID] = $destNationAux['recv_assist'][$nationID]??0;
|
||||
$destNationStor = KVStorage::getStorage(DB::db(), $destNationID, 'nation_env');
|
||||
$destRecvAssist = $destNationStor->getValue('recv_assist')??[];
|
||||
$destRespAssist = $destNationStor->getValue('resp_assist')??[];
|
||||
|
||||
$destRespAssist["n{$nationID}"] = [$nationID, $destRecvAssist["n{$nationID}"][1]??0];
|
||||
$destNationStor->setValue('resp_assist', $destRespAssist);
|
||||
|
||||
$year = $this->arg['year'];
|
||||
$month = $this->arg['month'];
|
||||
@@ -203,10 +205,6 @@ class che_불가침수락 extends Command\NationCommand
|
||||
$currentMonth = $env['year'] * 12 + $env['month'] - 1;
|
||||
$reqMonth = $year * 12 + $month - 1;
|
||||
|
||||
$db->update('nation', [
|
||||
'aux'=>Json::encode($destNationAux)
|
||||
], 'nation=%i', $destNationID);
|
||||
|
||||
$db->update(
|
||||
'diplomacy',
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user