From db1dd6f3df6f842b1957af25b5a4feea00ee2440 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 18 Dec 2021 17:58:20 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20getRankVar=EC=97=90=20RankVar=EA=B0=80?= =?UTF-8?q?=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EA=B8=B0=EB=B3=B8?= =?UTF-8?q?=EA=B0=92=20=EC=A7=80=EC=A0=95=20=EA=B0=80=EB=8A=A5=20-=20?= =?UTF-8?q?=ED=86=A0=EB=84=88=EB=A8=BC=ED=8A=B8=20=EA=B0=92=20=ED=9A=8C?= =?UTF-8?q?=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_tournament.php | 2 +- hwe/sammo/General.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index 55111250..d8c9abd0 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -1155,7 +1155,7 @@ function setGift($tnmt_type, $tnmt, $phase) foreach (General::createGeneralObjListFromDB(Util::squeezeFromArray($gambleResult, 'general_id'), ['gold', 'npc'], 1) as $gambler) { $reward = Util::round($gambleResult[$gambler->getID()]['bet'] * $rewardRate); $gambler->increaseVar('gold', $reward); - if (($gambler->getNPCType() == 0) || ($gambler->getNPCType() == 1 && $gambler->getRankVar('betgold') > 0)) { + if (($gambler->getNPCType() == 0) || ($gambler->getNPCType() == 1 && $gambler->getRankVar('betgold', 0) > 0)) { $gambler->increaseRankVar('betwingold', $reward); $gambler->increaseRankVar('betwin', 1); } diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php index 966b7ce5..8b359ec4 100644 --- a/hwe/sammo/General.php +++ b/hwe/sammo/General.php @@ -781,7 +781,7 @@ class General implements iAction $this->rankVarSet[$key] = $value; } - function getRankVar(string $key): int + function getRankVar(string $key, $defaultValue = null): int { if (!key_exists($key, static::RANK_COLUMN)) { throw new \InvalidArgumentException('올바르지 않은 인자 :' . $key); @@ -792,7 +792,10 @@ class General implements iAction } if (!key_exists($key, $this->rankVarRead)) { - throw new \RuntimeException('인자가 없음 : ' . $key); + if($defaultValue === null){ + throw new \RuntimeException('인자가 없음 : ' . $key); + } + return $defaultValue; } return $this->rankVarRead[$key];