명장 일람, 명예의 전당 최종 개선

This commit is contained in:
2018-06-26 02:36:20 +09:00
parent 48f0c56a9e
commit 69b0a80684
11 changed files with 222 additions and 72 deletions
+77 -30
View File
@@ -5,11 +5,28 @@ include "lib.php";
include "func.php";
$session = Session::getInstance()->setReadOnly();
$scenarioIdx = Util::getReq('scenarioIdx', 'int', null);
$db = DB::db();
$connect=$db->get();
increaseRefresh("명예의전당", 1);
$scenarioList= [];
foreach($db->query('SELECT distinct(scenario_name) as name, count(scenario) as cnt, scenario from ng_games order by scenario asc') as $scenarioInfo){
$scenarioList[$scenarioInfo['scenario']] = $scenarioInfo;
}
if($scenarioIdx !== null || key_exists($scenarioIdx, $scenarioList)){
$searchScenarioName = $scenarioList[$scenarioIdx]['name'];
$searchFilter = $db->sqleval('scenario = %i', $scenarioIdx);
}
else{
$searchScenarioName = '* 모두 *';
$searchFilter = $db->sqleval(true);
}
?>
<!DOCTYPE html>
<html>
@@ -19,51 +36,70 @@ increaseRefresh("명예의전당", 1);
<title><?=UniqueConst::$serverName?>: 명예의 전당</title>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/hallOfFrame.css')?>
<?=WebUtil::printCSS('css/hallOfFame.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.2.1.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
<?=WebUtil::printJs('js/hallOfFame.js')?>
</head>
<body>
<table align=center width=1100 class='tb_layout bg0'>
<tr><td>명 예 의 전 당<br><?=closeButton()?></td></tr>
<tr><td>
시나리오 검색 : <select id="by_scenario" name="by_scenario">
<option value="" <?=$scenarioIdx?"selected='selected'":''?>>* 종합 *</option>
<?php foreach($scenarioList as $info): ?>
<option
value="<?=$info['scenario']?>"
<?=($info['scenario']===$scenarioIdx)?"selected='selected'":''?>
><?=$info['name']?>(<?=$info['cnt']?>회)</option>
<?php endforeach; ?>
?>
</select>
</td></tr>
</table>
<div style="margin:auto;width=1100px;">
<?php
$types = array(
"명 성",
"계 급",
"계 략 성 공",
"전 투 횟 수",
"승 리",
"승 률",
"사 살",
"살 상 률",
"보 병 숙 련 도",
"궁 병 숙 련 도",
"기 병 숙 련 도",
"귀 병 숙 련 도",
"차 병 숙 련 도",
"전 력 전 승 률",
"통 솔 전 승 률",
"일 기 토 승 률",
"설 전 승 률",
"베 팅 투 자 액",
"베 팅 당 첨",
"베 팅 수 익 금",
"베 팅 수 익 률"
);
$types = [
["명 성", 'int'],
["계 급", 'int'],
["계 략 성 공", 'int'],
["전 투 횟 수", 'int'],
["승 리", 'int'],
["승 률", 'percent'],
["사 살", 'int'],
["살 상 률", 'percent'],
["보 병 숙 련 도", 'int'],
["궁 병 숙 련 도", 'int'],
["기 병 숙 련 도", 'int'],
["귀 병 숙 련 도", 'int'],
["차 병 숙 련 도", 'int'],
["전 력 전 승 률", 'percent'],
["통 솔 전 승 률", 'percent'],
["일 기 토 승 률", 'percent'],
["설 전 승 률", 'percent'],
["베 팅 투 자 액", 'int'],
["베 팅 당 첨", 'int'],
["베 팅 수 익 금", 'int'],
["베 팅 수 익 률", 'percent'],
];
$templates = new \League\Plates\Engine('templates');
foreach($types as $idx=>$typeName) {
$hallResult = $db->query('SELECT * FROM ng_hall WHERE server_id = %s AND `type`=%i ORDER BY `value` DESC LIMIT 10', UniqueConst::$serverID, $idx);
foreach($types as $idx=>[$typeName, $typeValue]) {
$hallResult = $db->query('SELECT * FROM ng_hall WHERE `type`=%i AND %? ORDER BY `value` DESC LIMIT 10', $idx, $searchFilter);
$hallResult = array_map(function($general){
$hallResult = array_map(function($general)use($typeValue){
$aux = Json::decode($general['aux']);
$general += $aux;
if(!key_exists('color', $general)){
$general['color'] = GameConst::$basecolor4;
$general['fgColor'] = newColor($general['color']);
$general['bgColor'] = GameConst::$basecolor4;
}
if(!key_exists('fgColor', $general)){
$general['fgColor'] = newColor($general['bgColor']);
}
if(key_exists('picture', $general)){
$imageTemp = GetImageURL($general['imgsvr']);
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
@@ -71,6 +107,17 @@ foreach($types as $idx=>$typeName) {
else{
$general['pictureFullPath'] = GetImageURL(0)."/default.jpg";
}
if(!key_exists('printValue', $general)){
$value = $general['value'];
if($typeValue == 'percent'){
$general['printValue'] = number_format($value*100, 2).'%';
}
else {
$general['printValue'] = number_format($value);
}
}
return $general;
}, $hallResult);