From b2b2934ce95a5bc2f2b46848744dbcb314bde89b Mon Sep 17 00:00:00 2001 From: hided62 Date: Thu, 29 Feb 2024 10:27:04 +0900 Subject: [PATCH] =?UTF-8?q?refac:=20=EC=A0=84=EC=B2=B4=20penalty=EB=8A=94?= =?UTF-8?q?=20expire=EC=99=80=20value=20-=20=EA=B2=8C=EC=9E=84=20=EA=B0=9C?= =?UTF-8?q?=EC=8B=9C=EC=8B=9C=20expire=EA=B0=80=20=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EC=9D=80=20=EA=B2=83=EC=9D=84=20=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?value=EB=A7=8C=20=EC=A0=84=EB=8B=AC=20-=20=EC=A6=89,=20?= =?UTF-8?q?=ED=8E=98=EB=84=90=ED=8B=B0=EB=8A=94=20=EA=B9=83=EC=88=98=20?= =?UTF-8?q?=EB=8B=A8=EC=9C=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/j_select_npc.php | 9 ++++++++- hwe/sammo/API/General/Join.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hwe/j_select_npc.php b/hwe/j_select_npc.php index 13005ce4..84fdb15e 100644 --- a/hwe/j_select_npc.php +++ b/hwe/j_select_npc.php @@ -37,7 +37,14 @@ if(!$member){ $userNick = $member['name']; $memberPenalty = Json::decode($member['penalty'] ?? '{}'); -$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); +$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); + +$penalty = []; +foreach($penaltyInfo as $penaltyKey => $penaltyValue){ + if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){ + $penalty[$penaltyKey] = $penaltyValue['value']; + } +} $pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now); if(!$pickResult){ diff --git a/hwe/sammo/API/General/Join.php b/hwe/sammo/API/General/Join.php index 26571cff..82714f46 100644 --- a/hwe/sammo/API/General/Join.php +++ b/hwe/sammo/API/General/Join.php @@ -153,7 +153,14 @@ class Join extends \sammo\BaseAPI } $memberPenalty = Json::decode($member['penalty'] ?? "{}"); - $penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); + $penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []); + + $penalty = []; + foreach($penaltyInfo as $penaltyKey => $penaltyValue){ + if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){ + $penalty[$penaltyKey] = $penaltyValue['value']; + } + } $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env');