From 270f236f95efbbc6fc8d0d7e0afc50ac6a30e71f Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 26 Jan 2022 03:05:33 +0900 Subject: [PATCH] =?UTF-8?q?feat(WIP):=20OpenNationBetting=EC=97=90=20?= =?UTF-8?q?=EB=B3=B4=EB=84=88=EC=8A=A4=20=EC=83=81=EA=B8=88=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/Event/Action/OpenNationBetting.php | 17 ++++++++++++++--- hwe/scenario/scenario_904.json | 12 ++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/hwe/sammo/Event/Action/OpenNationBetting.php b/hwe/sammo/Event/Action/OpenNationBetting.php index d551c41d..feea37d2 100644 --- a/hwe/sammo/Event/Action/OpenNationBetting.php +++ b/hwe/sammo/Event/Action/OpenNationBetting.php @@ -11,11 +11,14 @@ use sammo\KVStorage; class OpenNationBetting extends \sammo\Event\Action { - public function __construct(private int $nationCnt = 1) + public function __construct(private int $nationCnt = 1, private int $bonusPoint = 0) { if ($nationCnt < 1) { throw new \RuntimeException("1 미만의 숫자"); } + if ($bonusPoint < 0){ + throw new \RuntimeException("0 미만의 보너스 포인트"); + } } public function run(array $env) @@ -51,8 +54,6 @@ class OpenNationBetting extends \sammo\Event\Action ); $nationBettingStor->setValue("id_{$bettingID}", $bettingInfo->toArray()); - //TODO: 초기에 부여할 포인트는 어디서 나는가? - $db->insert('event', [ 'target' => 'DESTROY_NATION', 'priority' => 1000, @@ -64,6 +65,16 @@ class OpenNationBetting extends \sammo\Event\Action ["DeleteEvent"], ]), ]); + + if($this->bonusPoint > 0){ + $db->insert('ng_betting', [ + 'betting_id' => $bettingID, + 'general_id' => 0, + 'betting_type' => '0', + 'amount' => $this->bonusPoint + ]); + } + $logger = new \sammo\ActionLogger(0, 0, $year, $month); $logger->pushGlobalHistoryLog("【내기】천하통일을 염원하는 내기가 진행중입니다! 호사가의 참여를 기다립니다!"); $logger->flush(); diff --git a/hwe/scenario/scenario_904.json b/hwe/scenario/scenario_904.json index c6ad8f3e..05452c20 100644 --- a/hwe/scenario/scenario_904.json +++ b/hwe/scenario/scenario_904.json @@ -148,8 +148,8 @@ [ "month", 1000, ["Date", "==", 181, 1], - ["OpenNationBetting", 4], - ["OpenNationBetting", 1], + ["OpenNationBetting", 4, 1000], + ["OpenNationBetting", 1, 1000], ["DeleteEvent"] ], [ @@ -158,8 +158,8 @@ ["Date", ">=", 183, 1], ["RemainNation", "<=", 16] ], - ["OpenNationBetting", 4], - ["OpenNationBetting", 1], + ["OpenNationBetting", 4, 1000], + ["OpenNationBetting", 1, 1000], ["DeleteEvent"] ], [ @@ -168,7 +168,7 @@ ["Date", ">=", 183, 1], ["RemainNation", "<=", 8] ], - ["OpenNationBetting", 1], + ["OpenNationBetting", 1, 1000], ["DeleteEvent"] ], [ @@ -177,7 +177,7 @@ ["Date", ">=", 183, 1], ["RemainNation", "<=", 4] ], - ["OpenNationBetting", 1], + ["OpenNationBetting", 1, 1000], ["DeleteEvent"] ] ]