유산 포인트 초기화/저장 구조 추가
This commit is contained in:
+73
-10
@@ -553,6 +553,8 @@ class General implements iAction{
|
||||
|
||||
$generalName = $this->getName();
|
||||
|
||||
$this->mergeTotalInheritancePoint();
|
||||
|
||||
// 군주였으면 유지 이음
|
||||
$officerLevel = $this->getVar('officer_level');
|
||||
if($officerLevel == 12) {
|
||||
@@ -606,6 +608,12 @@ class General implements iAction{
|
||||
|
||||
$generalName = $this->getName();
|
||||
|
||||
$ownerID = $this->getVar('owner');
|
||||
if($ownerID){
|
||||
$this->mergeTotalInheritancePoint();
|
||||
resetInheritanceUser($ownerID);
|
||||
}
|
||||
|
||||
$this->multiplyVarWithLimit('leadership', 0.85, 10);
|
||||
$this->multiplyVarWithLimit('strength', 0.85, 10);
|
||||
$this->multiplyVarWithLimit('intel', 0.85, 10);
|
||||
@@ -1165,10 +1173,19 @@ class General implements iAction{
|
||||
throw new \OutOfRangeException("{$key}는 유산 타입이 아님");
|
||||
}
|
||||
|
||||
$ownerID = $this->getVar('owner');
|
||||
if(!$ownerID){
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($this->getVar('npc') != 0){
|
||||
return 0;
|
||||
}
|
||||
|
||||
[$storeType, $multiplier, ] = $inheritType;
|
||||
|
||||
if($storeType === true){
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$this->getID()}");
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
||||
[$value, $aux] = $inheritStor->getValue($key);
|
||||
return $value;
|
||||
}
|
||||
@@ -1235,7 +1252,21 @@ class General implements iAction{
|
||||
throw new \InvalidArgumentException("{$key}는 1:1 유산 포인트가 아님");
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$this->getID()}");
|
||||
$ownerID = $this->getVar('owner');
|
||||
if(!$ownerID){
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->getVar('npc') != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
if($gameStor->isunited != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
||||
$inheritStor->setValue($key, [$value, $aux]);
|
||||
}
|
||||
|
||||
@@ -1254,7 +1285,21 @@ class General implements iAction{
|
||||
throw new \InvalidArgumentException("{$key}는 직접 저장형 유산 포인트가 아님");
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$this->getID()}");
|
||||
$ownerID = $this->getVar('owner');
|
||||
if(!$ownerID){
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->getVar('npc') != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
if($gameStor->isunited != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
||||
[$oldValue, $oldAux] = $inheritStor->getValue($key)??[0, null];
|
||||
|
||||
if($oldAux !== $aux){
|
||||
@@ -1265,13 +1310,31 @@ class General implements iAction{
|
||||
$inheritStor->setValue($key, [$newValue, $aux]);
|
||||
}
|
||||
|
||||
public function calcTotalInheritancePoint(): int{
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$this->getID()}");
|
||||
$inheritStor->cacheAll();
|
||||
$total = 0;
|
||||
foreach(array_keys(static::INHERITANCE_KEY) as $key){
|
||||
$total += $this->getInheritancePoint($key);
|
||||
public function mergeTotalInheritancePoint(){
|
||||
$ownerID = $this->getVar('owner');
|
||||
if(!$ownerID){
|
||||
return;
|
||||
}
|
||||
return Util::toInt($total);
|
||||
|
||||
if($this->getVar('npc') != 0){
|
||||
return;
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
||||
$inheritStor->cacheAll();
|
||||
foreach(static::INHERITANCE_KEY as $key=>[$storType, ,]){
|
||||
$point = $this->getInheritancePoint($key);
|
||||
if($storType === true){
|
||||
continue;
|
||||
}
|
||||
$inheritStor->setValue($key, $point);
|
||||
}
|
||||
|
||||
$oldInheritStor = KVStorage::getStorage(DB::db(), "inheritance_result");
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
$serverID = UniqueConst::$serverID;
|
||||
$year = $gameStor->year;
|
||||
$month = $gameStor->month;
|
||||
$oldInheritStor->setValue("{$serverID}_{$ownerID}_{$this->getID()}_{$year}_{$month}", $inheritStor->getAll(true));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user