merge: refresh ng_compare for logical game clock
This commit is contained in:
+13
-16
@@ -19,21 +19,17 @@ function processTournament()
|
||||
getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
|
||||
&& getenv('REF_DETERMINISTIC_TOURNAMENT_MODE') === 'hold'
|
||||
) {
|
||||
// Legacy tournament matches mix PHP rand(), shuffle(), and MariaDB
|
||||
// ORDER BY RAND(), so they are outside the hidden/monthly seed stream.
|
||||
// Hold the real-time subsystem during monthly world-state comparison.
|
||||
// Tournament randomness is independent from the monthly hidden-seed
|
||||
// stream. Keep it out of deterministic monthly comparisons.
|
||||
return;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$clock = GameClock::fromStorage($gameStor);
|
||||
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'turnterm', 'last_tournament_betting_id']);
|
||||
// The comparison harness supplies a fixed clock through TimeUtil. Keep the
|
||||
// production clock unchanged while preventing tournament catch-up from
|
||||
// escaping that deterministic month boundary.
|
||||
$now = TimeUtil::nowDateTime();
|
||||
$offset = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
|
||||
$offset = intdiv($clock->nowTick() - Util::toInt($admin['tnmt_time']), $clock->ticksPerSecond());
|
||||
|
||||
//수동일땐 무시
|
||||
if (!$admin['tnmt_auto']) {
|
||||
@@ -135,10 +131,10 @@ function processTournament()
|
||||
if ($tnmt == 6) {
|
||||
$betTerm = Util::valueFit($unit * 60, null, 3600);
|
||||
//처리 초 더한 날짜
|
||||
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm);
|
||||
$gameStor->tournament = $tnmt;
|
||||
$gameStor->phase = $phase;
|
||||
$gameStor->tnmt_time = $dt;
|
||||
$gameStor->tnmt_time = Util::toInt($admin['tnmt_time'])
|
||||
+ $clock->ticksFromSeconds($unit * $i + $betTerm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -146,7 +142,7 @@ function processTournament()
|
||||
$second = $unit * $iter;
|
||||
$gameStor->tournament = $tnmt;
|
||||
$gameStor->phase = $phase;
|
||||
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
|
||||
$gameStor->tnmt_time = Util::toInt($admin['tnmt_time']) + $clock->ticksFromSeconds($second);
|
||||
}
|
||||
|
||||
function getTournamentTermText(int $turnTerm)
|
||||
@@ -173,7 +169,8 @@ function getTournamentTime()
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
list($tnmt, $tnmt_time) = $gameStor->getValuesAsArray(['tournament', 'tnmt_time']);
|
||||
$dt = substr($tnmt_time, 11, 5);
|
||||
$clock = GameClock::fromStorage($gameStor);
|
||||
$dt = substr($clock->formatTick(Util::toInt($tnmt_time)), 11, 5);
|
||||
switch ($tnmt) {
|
||||
case 1:
|
||||
$tnmt = "개막시간 {$dt}";
|
||||
@@ -297,11 +294,11 @@ function startTournament($type)
|
||||
$admin = $gameStor->getValues(['year', 'month', 'turnterm']);
|
||||
$turnTerm = $admin['turnterm'];
|
||||
$unit = calcTournamentTerm($turnTerm);
|
||||
$clock = GameClock::fromStorage($gameStor);
|
||||
|
||||
$gameStor->tnmt_auto = true;
|
||||
$gameStor->tnmt_time = TimeUtil::nowDateTimeImmutable()
|
||||
->add(new \DateInterval("PT{$unit}M"))
|
||||
->format('Y-m-d H:i:s');
|
||||
// 기존 startTournament은 unit을 분으로 더하므로 그 계약을 유지합니다.
|
||||
$gameStor->tnmt_time = $clock->nowTick() + $clock->ticksFromMinutes($unit);
|
||||
$gameStor->tournament = 1;
|
||||
$gameStor->tnmt_type = $type;
|
||||
$gameStor->last_tournament_betting_id = 0;
|
||||
@@ -1186,7 +1183,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type)
|
||||
}
|
||||
$damage1 *= $factor1;
|
||||
$damage2 *= $factor2;
|
||||
|
||||
|
||||
//1합 승부
|
||||
if ($phase == 1) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user