feat,refac: increaseInheritancePointRaw 추가

- ownerID만으로 처리 가능
This commit is contained in:
2023-08-01 16:24:43 +00:00
parent 0e23677e1b
commit 41273f97db
+16 -10
View File
@@ -220,7 +220,7 @@ class InheritancePointManager
$inheritStor->setValue($key, [$value, $aux]);
}
public function increaseInheritancePoint(General $general, InheritanceKey $key, $value, $aux = null)
public function increaseInheritancePointRaw(int $ownerID, InheritanceKey $key, $value, $aux = null)
{
if (!is_int($value) && !is_float($value)) {
throw new \InvalidArgumentException("{$value}는 숫자가 아님");
@@ -234,15 +234,6 @@ class InheritancePointManager
throw new \InvalidArgumentException("{$key->value}는 직접 저장형 유산 포인트가 아님");
}
$ownerID = $general->getVar('owner');
if (!$ownerID) {
return;
}
if ($general->getVar('npc') >= 2) {
return;
}
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
if ($gameStor->isunited != 0) {
return;
@@ -259,6 +250,21 @@ class InheritancePointManager
$inheritStor->setValue($key->value, [$newValue, $aux]);
}
public function increaseInheritancePoint(General $general, InheritanceKey $key, $value, $aux = null)
{
$ownerID = $general->getVar('owner');
if (!$ownerID) {
return;
}
if ($general->getVar('npc') >= 2) {
return;
}
$this->increaseInheritancePointRaw($ownerID, $key, $value, $aux);
}
public function clearInheritancePoint(?int $ownerID)
{
if (!$ownerID) {