merge: refresh ng_compare for logical game clock

This commit is contained in:
2026-08-04 12:09:58 +00:00
124 changed files with 2713 additions and 807 deletions
+10 -5
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
use sammo\DB;
use sammo\Event\Action\OpenNationBetting;
use sammo\GameClock;
use sammo\Json;
use sammo\KVStorage;
@@ -46,8 +47,12 @@ if ($uniqueCount === 0) {
if ($generalID <= 0) {
throw new RuntimeException('Ref GUI parity fixture requires at least one general.');
}
$openDate = new DateTimeImmutable('now');
$closeDate = $openDate->modify('+1 day');
$gameStorage = KVStorage::getStorage($db, 'game_env');
$clock = GameClock::fromStorage($gameStorage);
$openTick = $clock->nowTick();
$closeTick = GameClock::addTicks($openTick, $clock->ticksFromMinutes(24 * 60));
$latestBidCloseTick = GameClock::addTicks($openTick, $clock->ticksFromMinutes(2 * 24 * 60));
$openDate = $clock->tickToDateTime($openTick);
$detail = [
'title' => '손자병법 경매',
'hostName' => '청룡',
@@ -56,7 +61,7 @@ if ($uniqueCount === 0) {
'startBidAmount' => 1000,
'finishBidAmount' => null,
'remainCloseDateExtensionCnt' => 1,
'availableLatestBidCloseDate' => $openDate->modify('+2 days')->format('Y-m-d H:i:s'),
'availableLatestBidCloseTick' => $latestBidCloseTick,
];
$db->insert('ng_auction', [
'type' => 'uniqueItem',
@@ -64,8 +69,8 @@ if ($uniqueCount === 0) {
'target' => 'che_서적_15_손자병법',
'host_general_id' => $generalID,
'req_resource' => 'inheritPoint',
'open_date' => $openDate->format('Y-m-d H:i:s'),
'close_date' => $closeDate->format('Y-m-d H:i:s'),
'open_tick' => $openTick,
'close_tick' => $closeTick,
'detail' => Json::encode($detail),
]);
$auctionID = (int)$db->insertId();