12) { $type = 10; } //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); $db = DB::db(); increaseRefresh("세력도시", 1); $me = $db->queryFirstRow('SELECT no,nation,officer_level FROM general WHERE owner=%i', $userID); $nationID = $me['nation']; if ($me['officer_level'] == 0) { echo "재야입니다."; exit(); } $sel = [$type => "selected"]; ?> <?= UniqueConst::$serverName ?>: 세력도시
세 력 도 시
정렬순서 :
query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer) { $officerCityID = $officer['officer_city']; if (!key_exists($officerCityID, $officerList)) { $officerList[$officerCityID] = []; } $officerList[$officerCityID][$officer['officer_level']] = $officer; } $cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID); switch ($type) { case 1: break; case 2: usort($cityList, function ($lhs, $rhs) { return $rhs['pop'] <=> $lhs['pop']; }); break; case 3: usort($cityList, function ($lhs, $rhs) { return $rhs['poprate'] <=> $lhs['poprate']; }); break; case 4: usort($cityList, function ($lhs, $rhs) { return $rhs['trust'] <=> $lhs['trust']; }); break; case 5: usort($cityList, function ($lhs, $rhs) { return $rhs['agri'] <=> $lhs['agri']; }); break; case 6: usort($cityList, function ($lhs, $rhs) { return $rhs['comm'] <=> $lhs['comm']; }); break; case 7: usort($cityList, function ($lhs, $rhs) { return $rhs['secu'] <=> $lhs['secu']; }); break; case 8: usort($cityList, function ($lhs, $rhs) { return $rhs['def'] <=> $lhs['def']; }); break; case 9: usort($cityList, function ($lhs, $rhs) { return $rhs['wall'] <=> $lhs['wall']; }); break; case 10: usort($cityList, function ($lhs, $rhs) { return $rhs['trade'] <=> $lhs['trade']; }); break; case 11: usort($cityList, function ($lhs, $rhs) { $cmpTrust = $lhs['region'] <=> $rhs['region']; if ($cmpTrust != 0) { return $cmpTrust; } return $rhs['level'] <=> $lhs['level']; }); break; case 12: usort($cityList, function ($lhs, $rhs) { $cmpTrust = $rhs['level'] <=> $lhs['level']; if ($cmpTrust != 0) { return $cmpTrust; } return $lhs['region'] <=> $rhs['region']; }); break; } $region = 0; $level = 0; foreach ($cityList as $city) { $cityID = $city['city']; if ($city['city'] == $nation['capital']) { $city['name'] = "[{$city['name']}]"; } $officerQuery = []; $officerName = [ 2 => '-', 3 => '-', 4 => '-' ]; $cityOfficerList = $officerList[$cityID] ?? []; foreach ($cityOfficerList as $cityOfficer) { $officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']); } if ($type == 10 && $city['region'] != $region) { echo "
"; $region = $city['region']; } elseif ($type == 11 && $city['level'] != $level) { echo "
"; $level = $city['level']; } if ($city['trade'] === null) { $city['trade'] = "- "; } echo "
【 " . CityConst::$regionMap[$city['region']] . " | " . CityConst::$levelMap[$city['level']] . " 】 {$city['name']}
주민 {$city['pop']}/{$city['pop_max']} 농업 {$city['agri']}/{$city['agri_max']} 상업 {$city['comm']}/{$city['comm_max']} 치안 {$city['secu']}/{$city['secu_max']} 수비 {$city['def']}/{$city['def_max']} 성벽 {$city['wall']}/{$city['wall_max']}
민심 " . round($city['trust'], 1) . " 시세 {$city['trade']}% 인구 " . round($city['pop'] / $city['pop_max'] * 100, 2) . " % 태수 "; echo $officerName[4]; echo " 군사 "; echo $officerName[3]; echo " 종사 "; echo $officerName[2]; echo "
장수 "; $generalList = $db->query('SELECT npc, name FROM general WHERE city = %i AND nation = %i', $city['city'], $me['nation']); if (!$generalList) { echo "-"; } foreach ($generalList as $general) { echo getColoredName($general['name'], $general['npc']) . ', '; } echo "
"; } ?>