getAll(); $contract = [ 'scenario' => (int)($game['scenario'] ?? 0), 'year' => (int)($game['year'] ?? 0), 'month' => (int)($game['month'] ?? 0), 'turnterm' => (int)($game['turnterm'] ?? 0), 'npcmode' => (int)($game['npcmode'] ?? 0), ]; if ($contract !== ['scenario' => 2601, 'year' => 186, 'month' => 1, 'turnterm' => 10, 'npcmode' => 2]) { throw new RuntimeException('Ref GUI parity conditional fixture requires scenario2601 at 186-01.'); } $nationBettingCount = (int)$db->queryFirstField( "SELECT COUNT(*) FROM storage WHERE namespace = 'betting' AND JSON_UNQUOTE(JSON_EXTRACT(value, '$.type')) = 'bettingNation'" ); if ($nationBettingCount === 0) { (new OpenNationBetting(4, 5000))->run($game); } $uniqueCount = (int)$db->queryFirstField( "SELECT COUNT(*) FROM ng_auction WHERE type = 'uniqueItem' AND finished = 0" ); if ($uniqueCount === 0) { $generalID = (int)$db->queryFirstField('SELECT no FROM general WHERE npc <= 2 ORDER BY no LIMIT 1'); if ($generalID <= 0) { throw new RuntimeException('Ref GUI parity fixture requires at least one general.'); } $openDate = new DateTimeImmutable('now'); $closeDate = $openDate->modify('+1 day'); $detail = [ 'title' => '손자병법 경매', 'hostName' => '청룡', 'amount' => 1, 'isReverse' => false, 'startBidAmount' => 1000, 'finishBidAmount' => null, 'remainCloseDateExtensionCnt' => 1, 'availableLatestBidCloseDate' => $openDate->modify('+2 days')->format('Y-m-d H:i:s'), ]; $db->insert('ng_auction', [ 'type' => 'uniqueItem', 'finished' => 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'), 'detail' => Json::encode($detail), ]); $auctionID = (int)$db->insertId(); $db->insert('ng_auction_bid', [ 'auction_id' => $auctionID, 'owner' => null, 'general_id' => $generalID, 'amount' => 1000, 'date' => $openDate->format('Y-m-d H:i:s'), 'aux' => Json::encode(['generalName' => '청룡']), ]); } printf( "Ref conditional capture fixtures: nation_betting=%d unique_auction=%d\n", (int)$db->queryFirstField( "SELECT COUNT(*) FROM storage WHERE namespace = 'betting' AND JSON_UNQUOTE(JSON_EXTRACT(value, '$.type')) = 'bettingNation'" ), (int)$db->queryFirstField("SELECT COUNT(*) FROM ng_auction WHERE type = 'uniqueItem'") );