From 7b1eedb574d3d1e6000bc7f33e2ab795710f3cb5 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 25 Jun 2025 12:31:29 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20ChangeCity=EC=97=90=20=EC=B5=9C?= =?UTF-8?q?=EB=8C=80=20=EB=82=B4=EC=A0=95=20=EC=88=98=EC=B9=98=EB=8F=84=20?= =?UTF-8?q?=EC=97=B0=EC=82=B0=EC=9E=90=EB=A1=9C=20=EB=B0=94=EA=BF=80=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Event/Action/ChangeCity.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hwe/sammo/Event/Action/ChangeCity.php b/hwe/sammo/Event/Action/ChangeCity.php index 029503e0..e75e979b 100644 --- a/hwe/sammo/Event/Action/ChangeCity.php +++ b/hwe/sammo/Event/Action/ChangeCity.php @@ -120,6 +120,16 @@ class ChangeCity extends \sammo\Event\Action{ return DB::db()->sqleval('ROUND(%b * %d, 0)', $keyMax, $value/100); } + if(Util::ends_with($key, '_max') && preg_match(self::REGEXP_MATH, $value, $matches)){ + //key가 아예 최대치에 대한 값이면 연산은 결과값이 0보다만 높게. + $op = $matches[1]; + $value = $matches[2]; + if($op == '/' && $value == 0){ + throw new \InvalidArgumentException('0으로 나눌 수 없습니다.'); + } + return DB::db()->sqleval('greatest(0, ROUND(%b '.$op.' %i, 0))', $key, $value); + } + if(preg_match(self::REGEXP_MATH, $value, $matches)){ $op = $matches[1]; $value = $matches[2];