refac: 토너먼트 베팅 세부 로직을 ng_betting으로 이동 (#218)

- 토너먼트 베팅을 betting 테이블 대신 Betting 모듈을 이용하는 형태로 변경
  - 이전 토너먼트 베팅 기록이 남음
  - 현재 이전 토너먼트 기록을 볼 수는 없음
- 베팅에 API/Betting/Bet 을 이용
- 토너먼트, 베팅 페이지를 Betting 모듈에 맞게 임시 조정
- 이전 버전과의 호환성을 위해 betting table과 betting 테이블에 초기값을 추가하는 로직은 남김
  - 이후 0.30이 되었을 때 제거

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/218
This commit was merged in pull request #218.
This commit is contained in:
2022-04-25 01:06:32 +09:00
parent db749ae75a
commit 9b8ad5384e
13 changed files with 355 additions and 293 deletions
+8 -7
View File
@@ -472,7 +472,8 @@ function getCommandTable(General $general)
return $result;
}
function getChiefCommandTable(General $general){
function getChiefCommandTable(General $general)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->turnOnCache();
@@ -1121,7 +1122,7 @@ function CheckOverhead()
function isLock()
{
return DB::db()->queryFirstField("SELECT plock from plock limit 1") != 0;
return DB::db()->queryFirstField("SELECT plock from plock WHERE `type`='GAME'") != 0;
}
function tryLock(): bool
@@ -1133,7 +1134,7 @@ function tryLock(): bool
$db->update('plock', [
'plock' => 1,
'locktime' => TimeUtil::now(true)
], 'plock=0');
], 'plock=0 AND type="GAME"');
return $db->affectedRows() > 0;
}
@@ -1144,7 +1145,7 @@ function unlock(): bool
$db = DB::db();
$db->update('plock', [
'plock' => 0
], true);
], 'type="GAME"');
return $db->affectedRows() > 0;
}
@@ -1581,7 +1582,7 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
}
}
foreach($db->queryAllLists('SELECT namespace, count(*) as cnt FROM `storage` WHERE namespace LIKE "ut_%" GROUP BY namespace') as [$uniqueNS, $cnt]){
foreach ($db->queryAllLists('SELECT namespace, count(*) as cnt FROM `storage` WHERE namespace LIKE "ut_%" GROUP BY namespace') as [$uniqueNS, $cnt]) {
$itemCode = substr($uniqueNS, 3);
$itemClass = buildItemClass($itemCode);
if (!$itemClass) {
@@ -1590,7 +1591,7 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
if ($itemClass->isBuyable()) {
continue;
}
$occupiedUnique[$itemCode] = ($occupiedUnique[$itemCode]??0) + $cnt;
$occupiedUnique[$itemCode] = ($occupiedUnique[$itemCode] ?? 0) + $cnt;
}
foreach (GameConst::$allItems as $itemType => $itemCategories) {
@@ -1632,7 +1633,7 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
$relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth);
$availableBuyUnique = $relMonthByInit >= GameConst::$minMonthToAllowInheritItem;
if($availableBuyUnique){
if ($availableBuyUnique) {
$general->setAuxVar('inheritRandomUnique', null);
}
}