원조 받으면 불가침 제의

This commit is contained in:
2021-08-11 21:44:50 +09:00
parent a5145636ad
commit f06a8225d0
6 changed files with 100 additions and 18 deletions
@@ -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);