loginGame()->setReadOnly(); $userID = Session::getUserID(); increaseRefresh("메인", 1); $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); if (!$userID) { header('Location:..'); die(); } //턴 실행. TurnExecutionHelper::executeAllCommand(); if (!$session->isGameLoggedIn()) { header('Location:..'); die(); } $me = $db->queryFirstRow( 'SELECT no,refresh_score,turntime,newmsg,newvote,`officer_level` FROM `general` LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner = %i', $userID ); //그새 사망이면 if ($me === null) { $session->logoutGame(); header('Location: ../'); die(); } $gameStor->cacheAll(true); if ($me['newmsg'] == 1 || $me['newvote'] == 1) { $db->update('general', [ 'newmsg' => 0, 'newvote' => 0 ], 'owner=%i', $userID); } $plock = boolval($db->queryFirstField('SELECT plock FROM plock WHERE `type`="GAME" LIMIT 1')); $limitState = checkLimit($me['refresh_score']); if ($limitState >= 2) { printLimitMsg($me['turntime']); exit(); } $generalObj = General::createObjFromDB($me['no'], null, GeneralQueryMode::FullWithAccessLog); $generalObj->setRawCity($db->queryFirstRow('SELECT * FROM city WHERE city = %i', $generalObj->getCityID())); $scenario = $gameStor->scenario_text; $nationID = $generalObj->getNationID(); if ($nationID) { $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $nationStor->cacheAll(); } if ($gameStor->extended_general == 0) { $extend = "표준"; } else { $extend = "확장"; } if ($gameStor->fiction == 0) { $fiction = "사실"; } else { $fiction = "가상"; } if ($gameStor->npcmode == 0) { $npcmode = "불가능"; } else if ($gameStor->npcmode == 1) { $npcmode = "가능"; } else { $npcmode = "선택 생성"; } $color = "cyan"; $serverName = UniqueConst::$serverName; $serverCnt = $gameStor->server_cnt; $auctionCount = $db->queryFirstField('SELECT count(*) FROM ng_auction WHERE finished = 0'); $isTournamentActive = $gameStor->tournament > 0; $isTournamentApplicationOpen = $gameStor->tournament == 1; $isBettingActive = $gameStor->tournament == 6; $myNationStatic = getNationStaticInfo($generalObj->getNationID()); $nationColorType = substr($myNationStatic['color'] ?? '#000000', 1); $autorunUser = ($gameStor->autorun_user) ?? []; $otherTextInfo = []; if ($gameStor->join_mode == 'onlyRandom') { $otherTextInfo[] = '랜덤 임관 전용'; } if ($autorunUser['limit_minutes'] ?? false) { $otherTextInfo[] = getAutorunInfo($autorunUser); } if (!$otherTextInfo) { $otherTextInfo = '표준'; } else { $otherTextInfo = join(', ', $otherTextInfo); } $lastVoteID = $gameStor->lastVote; $lastVote = null; if ($lastVoteID) { $voteStor = KVStorage::getStorage($db, 'vote'); $lastVote = VoteInfo::fromArray($voteStor->getValue("vote_{$lastVoteID}")); if ($lastVote->endDate && $lastVote->endDate < TimeUtil::now()) { $lastVote = null; } } ?>