setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if(!$serverID){
$serverID = UniqueConst::$serverID;
}
if($serverID === UniqueConst::$serverID){
increaseRefresh("연감", 1);
}
$admin = $gameStor->getValues(['startyear','year','month','map_theme']);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
$con = checkLimit($me['con']);
if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
$s = $s_year * 12 + $s_month;
if($s_year === null){
echo '인자 에러';
exit();
}
[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
$e = $e_year * 12 + $e_month;
if($serverID !== UniqueConst::$serverID){
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID)?:'che';
}
else{
$mapTheme = $admin['map_theme']??'che';
}
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
if($serverID !== UniqueConst::$serverID && !$yearmonth){
$year = $s_year;
$month = $s_month;
}
else if (!$yearmonth) {
$year = $admin['year'];
$month = $admin['month'] - 1;
} else {
$year = intdiv($yearmonth, 100);
$month = $yearmonth % 100;
if ($btn == "◀◀ 이전달") {
$month -= 1;
} elseif ($btn == "다음달 ▶▶") {
$month += 1;
}
}
$now = ($year*12) + $month;
if ($now < $s) {
$now = $s;
}
if ($now > $e) {
$now = $e;
}
$year = intdiv($now, 12);
$month = $now % 12;
if ($month <= 0) {
$year -= 1;
$month += 12;
}
$history = $db->queryFirstRow('SELECT * FROM ng_history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month);
$nations = Json::decode($history['nations']);
?>
=UniqueConst::$serverName?>: 연감
=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
=WebUtil::printJS('../d_shared/common_path.js')?>
=WebUtil::printJS('js/common.js')?>
=WebUtil::printJS("js/map/theme_{$mapTheme}.js")?>
=WebUtil::printJS('js/map.js')?>
=WebUtil::printJS('js/history.js')?>
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../d_shared/common.css')?>
=WebUtil::printCSS('css/common.css')?>
=WebUtil::printCSS('css/map.css')?>
=WebUtil::printCSS('css/history.css')?>
| 중 원 지 도 |
|
=getMapHtml($mapTheme)?>
|
| 국명 |
국력 |
장수 |
속령 |
| ;background-color:=$nation['color']?>'>=$nation['name']?> |
=number_format($nation['power'])?> |
=number_format(count($nation['generals']??[]))?> |
=number_format(count($nation['cities']??[]))?> |
|
| 중 원 정 세 |
|
=formatHistoryToHTML(Json::decode($history['global_history']))?>
|
| 장 수 동 향 |
|
=formatHistoryToHTML(Json::decode($history['global_action']))?>
|
| =closeButton()?> |
| =banner()?> |