forked from devsam/core
inheritAction: 특정 전특 획득
This commit is contained in:
+17
-7
@@ -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) {
|
||||
$generalID = $general['no'];
|
||||
$special2 = SpecialityHelper::pickSpecialWar(
|
||||
$general,
|
||||
(Json::decode($general['aux'])['prev_types_special2']) ?? []
|
||||
);
|
||||
$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(
|
||||
$general,
|
||||
($generalAux['prev_types_special2']) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
$specialClass = buildGeneralSpecialWarClass($special2);
|
||||
$specialText = $specialClass->getName();
|
||||
|
||||
$db->update('general', [
|
||||
'special2' => $special2
|
||||
], 'no=%i', $general['no']);
|
||||
$updateVars['special2'] = $special2;
|
||||
$db->update('general', $updateVars, 'no=%i', $general['no']);
|
||||
|
||||
$logger = new ActionLogger($generalID, $general['nation'], $year, $month);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class ResetSpecialWar extends \sammo\BaseAPI
|
||||
|
||||
|
||||
$currentSpecialWar = $general->getVar('special2');
|
||||
if($currentSpecialWar === null || $currentSpecialWar == 'None'){
|
||||
if ($currentSpecialWar === null || $currentSpecialWar == 'None') {
|
||||
return '이미 전투 특기가 공란입니다.';
|
||||
}
|
||||
|
||||
@@ -55,6 +55,11 @@ class ResetSpecialWar extends \sammo\BaseAPI
|
||||
return '충분한 유산 포인트를 가지고 있지 않습니다.';
|
||||
}
|
||||
|
||||
$oldTypeKey = 'prev_types_special2';
|
||||
$oldSpecialList = $general->getAuxVar($oldTypeKey) ?? [];
|
||||
$oldSpecialList[] = $currentSpecialWar;
|
||||
$general->setAuxVar($oldTypeKey, $oldSpecialList);
|
||||
|
||||
$general->setAuxVar('inheritResetSpecialWar', $nextLevel);
|
||||
$general->setVar('special2', 'None');
|
||||
$inheritStor->setValue('previous', $previousPoint - $reqPoint);
|
||||
|
||||
Reference in New Issue
Block a user