inheritAction: 특정 전특 획득

This commit is contained in:
2021-09-15 19:06:15 +00:00
committed by Gitea
parent f54bdfcea0
commit 97a28f716c
2 changed files with 23 additions and 8 deletions
+14 -4
View File
@@ -1283,16 +1283,26 @@ function addAge()
foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5,aux from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general) { foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5,aux from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general) {
$generalID = $general['no']; $generalID = $general['no'];
$generalAux = Json::decode($general['aux']);
$updateVars = [];
if(key_exists('inheritSpecificSpecialWar', $generalAux)){
$special2 = $generalAux['inheritSpecificSpecialWar'];
unset($generalAux['inheritSpecificSpecialWar']);
$updateVars['aux'] = Json::encode($generalAux);
}
else{
$special2 = SpecialityHelper::pickSpecialWar( $special2 = SpecialityHelper::pickSpecialWar(
$general, $general,
(Json::decode($general['aux'])['prev_types_special2']) ?? [] ($generalAux['prev_types_special2']) ?? []
); );
}
$specialClass = buildGeneralSpecialWarClass($special2); $specialClass = buildGeneralSpecialWarClass($special2);
$specialText = $specialClass->getName(); $specialText = $specialClass->getName();
$db->update('general', [ $updateVars['special2'] = $special2;
'special2' => $special2 $db->update('general', $updateVars, 'no=%i', $general['no']);
], 'no=%i', $general['no']);
$logger = new ActionLogger($generalID, $general['nation'], $year, $month); $logger = new ActionLogger($generalID, $general['nation'], $year, $month);
@@ -55,6 +55,11 @@ class ResetSpecialWar extends \sammo\BaseAPI
return '충분한 유산 포인트를 가지고 있지 않습니다.'; return '충분한 유산 포인트를 가지고 있지 않습니다.';
} }
$oldTypeKey = 'prev_types_special2';
$oldSpecialList = $general->getAuxVar($oldTypeKey) ?? [];
$oldSpecialList[] = $currentSpecialWar;
$general->setAuxVar($oldTypeKey, $oldSpecialList);
$general->setAuxVar('inheritResetSpecialWar', $nextLevel); $general->setAuxVar('inheritResetSpecialWar', $nextLevel);
$general->setVar('special2', 'None'); $general->setVar('special2', 'None');
$inheritStor->setValue('previous', $previousPoint - $reqPoint); $inheritStor->setValue('previous', $previousPoint - $reqPoint);