diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index 76c4b99a..65813261 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -26,7 +26,7 @@ increaseRefresh("명장일람", 1); <?=UniqueConst::$serverName?>: 명장일람 - + @@ -160,7 +160,7 @@ foreach($generals as $general){ $general['rankName'] = $itemName; $general['value'] = $itemCode; $itemTypes[$itemIdx][5][$itemCode] = $general; - } + } } foreach($itemTypes as [$itemNameType, $itemType, $itemFunc, $itemMinCode, $itemMaxCode, $itemOwners]){ diff --git a/hwe/a_hallOfFame.php b/hwe/a_hallOfFame.php index 1ef2d2c2..d5b0bf8d 100644 --- a/hwe/a_hallOfFame.php +++ b/hwe/a_hallOfFame.php @@ -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); +} + ?> @@ -19,51 +36,70 @@ increaseRefresh("명예의전당", 1); <?=UniqueConst::$serverName?>: 명예의 전당 - + + + + +
명 예 의 전 당
+시나리오 검색 : +
$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); diff --git a/hwe/css/common.css b/hwe/css/common.css index 81edf37e..f49e8ec8 100644 --- a/hwe/css/common.css +++ b/hwe/css/common.css @@ -181,3 +181,39 @@ div.bar_out div.bar_in{ float:left; } +.tooltip{ + position: relative; +} + +.tooltip .tooltiptext { + visibility: hidden; + width: 120px; + background-color: #555; + color: #fff; + text-align: center; + border-radius: 6px; + padding: 5px 0; + position: absolute; + z-index: 1; + bottom: 125%; + left: 50%; + margin-left: -60px; + opacity: 0; + transition: opacity 0.3s; +} + +.tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; +} + +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; +} \ No newline at end of file diff --git a/hwe/css/hallOfFrame.css b/hwe/css/hallOfFame.css similarity index 83% rename from hwe/css/hallOfFrame.css rename to hwe/css/hallOfFame.css index 3df9e35c..dc3caffa 100644 --- a/hwe/css/hallOfFrame.css +++ b/hwe/css/hallOfFame.css @@ -17,7 +17,6 @@ list-style:none; margin:0; padding:0; - overflow:hidden; box-sizing: border-box; margin-top:-1px; margin-bottom:-1px; @@ -39,6 +38,25 @@ height:128px; } +.rankView li.has_server { + height:168px; +} + +.rankView li.no_value.has_server { + height:146px; +} + +.rankView .hall_server{ + border-top:1px solid gray; +} + +.rankView .tooltip .tooltiptext{ + width:220px; + margin-left: -110px; +} + + + .rankView .no_value .hall_value{ display:none; } diff --git a/hwe/func.php b/hwe/func.php index 54539d0b..42d4738a 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -2056,8 +2056,7 @@ function updateTurntime($no) { function CheckHall($no) { $db = DB::db(); - - + $gameStor = KVStorage::getStorage($db, 'game_env'); $types = array( "experience", @@ -2085,63 +2084,69 @@ function CheckHall($no) { $general = $db->queryFirstRow('SELECT name,name2,owner,nation,picture,imgsvr, experience,dedication,warnum,firenum,killnum, - killnum/warnum*10000 as winrate,killcrew,killcrew/deathcrew*10000 as killrate, + killnum/warnum as winrate,killcrew,killcrew/deathcrew as killrate, dex0,dex10,dex20,dex30,dex40, - ttw/(ttw+ttd+ttl)*10000 as ttrate, ttw+ttd+ttl as tt, - tlw/(tlw+tld+tll)*10000 as tlrate, tlw+tld+tll as tl, - tpw/(tpw+tpd+tpl)*10000 as tprate, tpw+tpd+tpl as tp, - tiw/(tiw+tid+til)*10000 as tirate, tiw+tid+til as ti, - betgold, betwin, betwingold, betwingold/betgold*10000 as betrate + ttw/(ttw+ttd+ttl) as ttrate, ttw+ttd+ttl as tt, + tlw/(tlw+tld+tll) as tlrate, tlw+tld+tll as tl, + tpw/(tpw+tpd+tpl) as tprate, tpw+tpd+tpl as tp, + tiw/(tiw+tid+til) as tirate, tiw+tid+til as ti, + betgold, betwin, betwingold, betwingold/betgold as betrate from general where no=%i', $no); if(!$general){ return; } + $unitedDate = date('Y-m-d H:i:s'); $nation = getNationStaticInfo($general['nation']); $serverCnt = $db->queryFirstField('SELECT count(*) FROM ng_games'); + [$scenarioIdx, $scenarioName, $startTime] = $gameStor->getValuesAsArray(['scenario', 'scenario_text', 'starttime']); + foreach($types as $idx=>$typeName) { //승률,살상률인데 10회 미만 전투시 스킵 - if(($k == 5 || $k == 7) && $general['warnum']<10) { continue; } + if(($typeName === 'winrate' || $typeName === 'killrate') && $general['warnum']<10) { continue; } //토너승률인데 50회 미만시 스킵 - if($k == 13 && $general['tt'] < 50) { continue; } + if($typeName === 'ttrate' && $general['tt'] < 50) { continue; } //토너승률인데 50회 미만시 스킵 - if($k == 14 && $general['tl'] < 50) { continue; } + if($typeName === 'tlrate' && $general['tl'] < 50) { continue; } //토너승률인데 50회 미만시 스킵 - if($k == 15 && $general['tp'] < 50) { continue; } + if($typeName === 'tprate' && $general['tp'] < 50) { continue; } //토너승률인데 50회 미만시 스킵 - if($k == 16 && $general['ti'] < 50) { continue; } + if($typeName === 'tirate' && $general['ti'] < 50) { continue; } //수익률인데 1000미만시 스킵 - if($k == 20 && $general['betgold'] < 1000) { continue; } + if($typeName === 'betrate' && $general['betgold'] < 1000) { continue; } $aux = [ + 'name'=>$general['name'], 'nationName'=>$nation['name'], 'bgColor'=>$nation['color'], 'fgColor'=>newColor($nation['color']), 'picture'=>$general['picture'], 'imgsvr'=>$general['imgsvr'], - 'date'=>date('Y-m-d H:i:s'), + 'startTime'=>$startTime, + 'unitedTime'=>$unitedDate, 'owner_name'=>$general['name2'], - 'server_id'=>UniqueConst::$serverID, - 'printValue'=>$general['value'] + 'serverID'=>UniqueConst::$serverID, + 'serverIdx'=>$serverCnt, + 'serverName'=>UniqueConst::$serverName, + 'scenarioName'=>$scenarioName, ]; $jsonAux = Json::encode($aux); $db->insertUpdate('ng_hall', [ 'server_id'=>UniqueConst::$serverID, - 'type'=>$idx, + 'scenario'=>$scenarioIdx, 'general_no'=>$no, - 'value'=>$general[$typeName], + 'type'=>$idx, + 'value'=>$general[$typeName]??0, 'owner'=>$general['owner']??null, - 'serverIdx'=>$serverCnt, - 'serverName'=>UniqueConst::$serverName, 'aux'=>$jsonAux ],[ - 'value'=>$general[$typeName], + 'value'=>$general[$typeName]??0, 'aux'=>$jsonAux ]); } diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 39fad85f..0023c8e7 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -1126,7 +1126,7 @@ function checkEmperior() { $gameStor->isunited = 2; $gameStor->conlimit = $gameStor->conlimit*100; - $query = "select no from general where npc<2 and age>=45"; + $query = "select no from general where npc<2 and age>=40"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $count = MYDB_num_rows($result); diff --git a/hwe/func_history.php b/hwe/func_history.php index 0f6952bf..9be0b23e 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -127,6 +127,34 @@ function getBatLogRecent(int $no, int $count) { return join('
', array_reverse(getFormattedFileLogRecent(__dir__."/logs/".UniqueConst::$serverID."/batlog{$no}.txt", $count, 300))); } +function pushOldNationStop(int $no, int $nationNo){ + $logPrefixList = ['batres', 'gen', 'batlog']; + + $result = []; + foreach($logPrefixList as $logPrefix){ + $path = __dir__."/logs/".UniqueConst::$serverID."/{$logPrefix}{$no}.txt"; + if(file_exists($path)){ + $fileLen = @filesize($path); + } + else{ + $fileLen = 0; + } + $result[$logPrefix] = $fileLen; + } + + $baseStopPath = __dir__."/logs/".UniqueConst::$serverID."/stop{$no}.txt"; + if(file_exists($baseStopPath)){ + $oldValues = Json::decode(file_get_contents($baseStopPath)); + } + else{ + $oldValues = []; + } + + $oldValues[$nationNo] = $result; + + file_put_contents($baseStopPath, Json::encode($oldValues, Json::PRETTY)); +} + //DB-based function pushNationHistory($nation, $history) { if(!$nation || !$nation['nation']){ diff --git a/hwe/js/hallOfFame.js b/hwe/js/hallOfFame.js new file mode 100644 index 00000000..ad475cfd --- /dev/null +++ b/hwe/js/hallOfFame.js @@ -0,0 +1,7 @@ +jQuery(function($){ + $('#by_scenario').change(function(){ + var scenarioIdx = $(this).val(); + $.redirect('a_hallOfFame.php', {scenarioIdx:scenarioIdx}, 'get'); + }) + //$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post'); +}); \ No newline at end of file diff --git a/hwe/process_war.php b/hwe/process_war.php index 01bb6b1e..798c6198 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -1805,13 +1805,16 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $loseGeneralGold = 0; $loseGeneralRice = 0; //멸망국 장수들 역사 기록 및 로그 전달 - $query = "select no,name,nation,npc,gold,rice from general where nation='{$city['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); $josaYi = JosaUtil::pick($losenation['name'], '이'); $genlog = ["{$losenation['name']}{$josaYi} 멸망했습니다."]; - for($i=0; $i < $gencount; $i++) { - $gen = MYDB_fetch_array($result); + + + // 국가 백업 + $oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $city['nation']); + $oldNationGenerals = $db->query('SELECT * FROM general WHERE nation=%i', $city['nation']); + $oldNation['generals'] = $oldNationGenerals; + + foreach($oldNationGenerals as $gen){ $loseGold = intdiv($gen['gold'] * (rand()%30+20), 100); $loseRice = intdiv($gen['rice'] * (rand()%30+20), 100); @@ -1823,6 +1826,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { pushGenLog($gen, $genlog); pushGeneralHistory($gen, "●{$year}년 {$month}월:{$losenation['name']}{$josaYi} 멸망"); + pushOldNationStop($gen['no'], $city['nation']); $loseGeneralGold += $loseGold; $loseGeneralRice += $loseRice; @@ -1833,7 +1837,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { || $nation['name'] == "왜족") { //등용장 미발부 } elseif(Util::randBool(0.5)) { - $msg = ScoutMessage::buildScoutMessage($general['no'], $gen['no'], $reason); + $msg = ScoutMessage::buildScoutMessage($general['no'], $gen['no']); if($msg){ $msg->send(true); } @@ -1874,6 +1878,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { pushGenLog($gen, $genlog); } + //분쟁기록 모두 지움 DeleteConflict($city['nation']); // 전 장수 공헌 명성치 깎음 @@ -1892,8 +1897,6 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { $query = "delete from diplomacy where me='{$city['nation']}' or you='{$city['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - // 국가 백업 - $oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $city['nation']); $db->insert('ng_old_nations', [ 'server_id'=>UniqueConst::$serverID, 'nation'=>$city['nation'], diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index c7739da7..05be10c4 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -363,7 +363,7 @@ ENGINE=InnoDB; ## 명전 테이블 ########################################################################### -CREATE TABLE if not exists `ng_hall` ( +CREATE TABLE `ng_hall` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `server_id` CHAR(20) NOT NULL, `scenario` INT(11) NOT NULL, @@ -378,7 +378,7 @@ CREATE TABLE if not exists `ng_hall` ( INDEX `server_show` (`server_id`, `type`, `value`), INDEX `scenario` (`scenario`, `type`, `value`) ) -ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED; ########################################################################### @@ -398,15 +398,16 @@ CREATE TABLE if not exists `ng_games` ( ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -CREATE TABLE if not exists `ng_old_nations` ( +CREATE TABLE `ng_old_nations` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `server_id` CHAR(20) NOT NULL DEFAULT '0', `nation` INT(11) NOT NULL DEFAULT '0', `data` LONGTEXT NOT NULL DEFAULT '0' COMMENT 'json', + `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), INDEX `server_id` (`server_id`, `nation`) ) -ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED; create table if not exists emperior ( no int(6) not null auto_increment, @@ -546,7 +547,7 @@ CREATE TABLE if not exists `history` ( PRIMARY KEY (`no`), INDEX `server_id` (`server_id`, `year`, `month`) ) -ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED; ########################################################################### ## 이벤트 핸들러 테이블 diff --git a/hwe/templates/hallOfFrame.php b/hwe/templates/hallOfFrame.php index bde96ea1..c41182d4 100644 --- a/hwe/templates/hallOfFrame.php +++ b/hwe/templates/hallOfFrame.php @@ -1,13 +1,18 @@

    -$general): ?>
  • > +$general): ?>
  • '>
    - -
    + +
    기 + +
    + ~ +
    +