feat(WIP): OpenNationBetting에 보너스 상금 추가

This commit is contained in:
2022-01-26 03:05:33 +09:00
parent 466faf8179
commit 3a2fdce3d9
2 changed files with 20 additions and 9 deletions
+14 -3
View File
@@ -11,11 +11,14 @@ use sammo\KVStorage;
class OpenNationBetting extends \sammo\Event\Action 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) { if ($nationCnt < 1) {
throw new \RuntimeException("1 미만의 숫자"); throw new \RuntimeException("1 미만의 숫자");
} }
if ($bonusPoint < 0){
throw new \RuntimeException("0 미만의 보너스 포인트");
}
} }
public function run(array $env) public function run(array $env)
@@ -51,8 +54,6 @@ class OpenNationBetting extends \sammo\Event\Action
); );
$nationBettingStor->setValue("id_{$bettingID}", $bettingInfo->toArray()); $nationBettingStor->setValue("id_{$bettingID}", $bettingInfo->toArray());
//TODO: 초기에 부여할 포인트는 어디서 나는가?
$db->insert('event', [ $db->insert('event', [
'target' => 'DESTROY_NATION', 'target' => 'DESTROY_NATION',
'priority' => 1000, 'priority' => 1000,
@@ -64,6 +65,16 @@ class OpenNationBetting extends \sammo\Event\Action
["DeleteEvent"], ["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 = new \sammo\ActionLogger(0, 0, $year, $month);
$logger->pushGlobalHistoryLog("<B><b>【내기】</b></>천하통일을 염원하는 <C>내기</>가 진행중입니다! 호사가의 참여를 기다립니다!"); $logger->pushGlobalHistoryLog("<B><b>【내기】</b></>천하통일을 염원하는 <C>내기</>가 진행중입니다! 호사가의 참여를 기다립니다!");
$logger->flush(); $logger->flush();
+6 -6
View File
@@ -148,8 +148,8 @@
[ [
"month", 1000, "month", 1000,
["Date", "==", 181, 1], ["Date", "==", 181, 1],
["OpenNationBetting", 4], ["OpenNationBetting", 4, 1000],
["OpenNationBetting", 1], ["OpenNationBetting", 1, 1000],
["DeleteEvent"] ["DeleteEvent"]
], ],
[ [
@@ -158,8 +158,8 @@
["Date", ">=", 183, 1], ["Date", ">=", 183, 1],
["RemainNation", "<=", 16] ["RemainNation", "<=", 16]
], ],
["OpenNationBetting", 4], ["OpenNationBetting", 4, 1000],
["OpenNationBetting", 1], ["OpenNationBetting", 1, 1000],
["DeleteEvent"] ["DeleteEvent"]
], ],
[ [
@@ -168,7 +168,7 @@
["Date", ">=", 183, 1], ["Date", ">=", 183, 1],
["RemainNation", "<=", 8] ["RemainNation", "<=", 8]
], ],
["OpenNationBetting", 1], ["OpenNationBetting", 1, 1000],
["DeleteEvent"] ["DeleteEvent"]
], ],
[ [
@@ -177,7 +177,7 @@
["Date", ">=", 183, 1], ["Date", ">=", 183, 1],
["RemainNation", "<=", 4] ["RemainNation", "<=", 4]
], ],
["OpenNationBetting", 1], ["OpenNationBetting", 1, 1000],
["DeleteEvent"] ["DeleteEvent"]
] ]
] ]