From 9e45800367e67ca19ae506d46a984fdfa6353c1a Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 20 Jul 2019 15:48:30 +0900 Subject: [PATCH] =?UTF-8?q?94f3906949...06f86c6c27=20=EB=B0=98=EC=98=81,?= =?UTF-8?q?=20=EC=8B=9C=EC=A6=8C=20=EA=B0=92,=20=EB=B6=80=EB=8C=80?= =?UTF-8?q?=EC=A0=95=EB=B3=B4,=20=EC=99=95=EC=A1=B0=EC=9D=BC=EB=9E=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/a_emperior.php | 12 ++++++++- hwe/a_hallOfFame.php | 43 +++++++++++++++++++++--------- hwe/d_setting/UniqueConst.orig.php | 1 + hwe/func.php | 22 +++++++++++++-- hwe/func_template.php | 2 +- hwe/js/hallOfFame.js | 9 ++++--- hwe/sammo/ResetHelper.php | 21 +++++++++++++-- hwe/sql/schema.sql | 4 ++- 8 files changed, 91 insertions(+), 23 deletions(-) diff --git a/hwe/a_emperior.php b/hwe/a_emperior.php index 2d7ea874..7d5ec491 100644 --- a/hwe/a_emperior.php +++ b/hwe/a_emperior.php @@ -98,11 +98,21 @@ foreach($emperiors as $emperior){ 승 상 - 위 장 군 + 표 기 장 군 사 공 + + 거 기 장 군 + + 태 위 + + 위 장 군 + + 사 도 + + diff --git a/hwe/a_hallOfFame.php b/hwe/a_hallOfFame.php index b0f8cb23..633f7632 100644 --- a/hwe/a_hallOfFame.php +++ b/hwe/a_hallOfFame.php @@ -5,26 +5,36 @@ include "lib.php"; include "func.php"; $session = Session::getInstance()->setReadOnly(); +$seasonIdx = Util::getReq('seasonIdx', 'int', UniqueConst::$seasonIdx); $scenarioIdx = Util::getReq('scenarioIdx', 'int', null); $db = DB::db(); increaseRefresh("명예의전당", 1); -$scenarioList= []; -foreach($db->query('SELECT scenario_name as name, count(scenario) as cnt, scenario from ng_games group by scenario order by scenario asc') as $scenarioInfo){ - $scenarioList[$scenarioInfo['scenario']] = $scenarioInfo; -} +$scenarioList = (function(){ + $db = DB::db(); + $scenarioList= []; + foreach($db->query('SELECT season, scenario_name as name, count(scenario) as cnt, scenario from ng_games group by season, scenario order by season desc, scenario asc') as $scenarioInfo){ + $seasonIdx = $scenarioInfo['season']; + $scenarioIdx = $scenarioInfo['scenario']; + if(!key_exists($seasonIdx, $scenarioList)){ + $scenarioList[$seasonIdx] = []; + } + $scenarioList[$seasonIdx][$scenarioIdx] = $scenarioInfo; + } + return $scenarioList; +})(); if($scenarioIdx !== null || key_exists($scenarioIdx, $scenarioList)){ - $searchScenarioName = $scenarioList[$scenarioIdx]['name']; - $searchFilter = $db->sqleval('scenario = %i', $scenarioIdx); + $searchScenarioName = $scenarioList[$seasonIdx][$scenarioIdx]['name']; + $searchFilter = $db->sqleval('season = %i AND scenario = %i', $seasonIdx, $scenarioIdx); } else{ $searchScenarioName = '* 모두 *'; - $searchFilter = $db->sqleval(true); + $searchFilter = $db->sqleval('season = %i', $seasonIdx); } ?> @@ -53,12 +63,19 @@ else{ 명 예 의 전 당
시나리오 검색 : diff --git a/hwe/d_setting/UniqueConst.orig.php b/hwe/d_setting/UniqueConst.orig.php index 29dd6dbe..6627a649 100644 --- a/hwe/d_setting/UniqueConst.orig.php +++ b/hwe/d_setting/UniqueConst.orig.php @@ -4,6 +4,7 @@ namespace sammo; class UniqueConst{ public static $serverID = '_tK_serverID_'; public static $serverName = '_tK_serverName_'; + public static $seasonIdx = '_tK_seasonIdx_'; private function __construct(){} diff --git a/hwe/func.php b/hwe/func.php index 440a7a10..fc8ec6d2 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -654,7 +654,24 @@ function generalInfo($no) { $lbonus = ""; } - $troopName = getTroopName($general['troop'])??'-'; + if($general['troop'] == 0){ + $troopInfo = '-'; + } + else{ + $troopCity = $db->queryFirstField('SELECT city FROM general WHERE no=%i', $general['troop']); + $troopTurn = $db->queryFirstField('SELECT `action` FROM general_turn WHERE general_id = %i AND turn_idx = 0', $general['troop']); + $troopInfo = $db->queryFirstField('SELECT name FROM troop WHERE troop_leader = %i', $general['troop']); + + $troopInfo = $troop['name']; + + if($troopTurn == 'che_집합'){ + $troopInfo = "{$troopInfo}"; + } + else if($troopCity != $general['city']){ + $troopCityName = CityConst::byID($troopCity)->name; + $troopInfo = "{$troopInfo}({$troopCityName})"; + } + } $level = getLevel($general['level'], $nation['level']); if($general['level'] == 2) { @@ -796,7 +813,7 @@ function generalInfo($no) { 부대 - {$troopName} + {$troopInfo} 벌점 ".getConnect($general['connect'])." {$general['connect']}({$general['con']}) @@ -1473,6 +1490,7 @@ function CheckHall($no) { $db->insertIgnore('ng_hall', [ 'server_id'=>UniqueConst::$serverID, + 'season'=>UniqueConst::$seasonIdx, 'scenario'=>$scenarioIdx, 'general_no'=>$no, 'type'=>$idx, diff --git a/hwe/func_template.php b/hwe/func_template.php index 3306dfaf..a31de307 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -43,7 +43,7 @@ foreach(range(1, GameConst::$maxChiefTurn - 1) as $turnIdx){ $turnText = join("\n", $turnList); return " - {$turnText} "; diff --git a/hwe/js/hallOfFame.js b/hwe/js/hallOfFame.js index ad475cfd..9a2c165e 100644 --- a/hwe/js/hallOfFame.js +++ b/hwe/js/hallOfFame.js @@ -1,7 +1,10 @@ jQuery(function($){ $('#by_scenario').change(function(){ - var scenarioIdx = $(this).val(); - $.redirect('a_hallOfFame.php', {scenarioIdx:scenarioIdx}, 'get'); + var $this = $(this); + var scenarioIdx = $this.val(); + var seasonIdx = $(this).find('option:selected').data('season'); + + + $.redirect('a_hallOfFame.php', {scenarioIdx:scenarioIdx, seasonIdx:seasonIdx}, 'get'); }) - //$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post'); }); \ No newline at end of file diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index 07073686..ca939722 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -81,11 +81,23 @@ class ResetHelper{ mkdir($servRoot.'/logs/'.$serverID, 0755); mkdir($servRoot.'/data/'.$serverID, 0755); + $seasonIdx = 1; + if($db->queryFirstField('SHOW TABLES LIKE %s', 'storage') !== null){ + $gameStor = KVStorage::getStorage($db, 'game_env'); + $nextSeasonIdx = $gameStor->next_season_idx; + if($nextSeasonIdx !== null){ + $seasonIdx = $nextSeasonIdx; + } + $gameStor->resetCache(); + } + + $result = Util::generateFileUsingSimpleTemplate( $servRoot.'/d_setting/UniqueConst.orig.php', $servRoot.'/d_setting/UniqueConst.php',[ 'serverID'=>$serverID, 'serverName'=>AppConf::getList()[$prefix]->getKorName(), + 'seasonIdx'=>$seasonIdx, ], true ); @@ -112,12 +124,15 @@ class ResetHelper{ } } - (KVStorage::getStorage($db, 'game_env'))->resetValues(); + $gameStor = KVStorage::getStorage($db, 'game_env'); + $gameStor->resetValues(); + $gameStor->next_season_idx = $seasonIdx; (KVStorage::getStorage($db, 'nation_env'))->resetValues(); return [ 'result'=>true, - 'serverID'=>$serverID + 'serverID'=>$serverID, + 'seasonIdx'=>$seasonIdx ]; } @@ -154,6 +169,7 @@ class ResetHelper{ } $serverID = $clearResult['serverID']; + $seasonIdx = $clearResult['seasonIdx']; $scenarioObj = new Scenario($scenario, false); $scenarioObj->buildConf(); @@ -220,6 +236,7 @@ class ResetHelper{ 'init_year'=> $year, 'init_month'=>$month, 'map_theme' => $scenarioObj->getMapTheme(), + 'season'=>$seasonIdx, 'msg'=>'공지사항',//TODO:공지사항 'maxgeneral'=>GameConst::$defaultMaxGeneral, 'maxnation'=>GameConst::$defaultMaxNation, diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 0fd91ccb..dd6dcd0a 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -332,6 +332,7 @@ ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS `ng_hall` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `server_id` CHAR(20) NOT NULL, + `season` INT(11) NOT NULL, `scenario` INT(11) NOT NULL, `general_no` INT(11) NOT NULL, `type` INT(11) NOT NULL, @@ -342,7 +343,7 @@ CREATE TABLE IF NOT EXISTS `ng_hall` ( UNIQUE INDEX `server_general` (`server_id`, `type`, `general_no`), UNIQUE INDEX `owner` (`owner`, `server_id`, `type`), INDEX `server_show` (`server_id`, `type`, `value`), - INDEX `scenario` (`scenario`, `type`, `value`) + INDEX `scenario` (`season`, `scenario`, `type`, `value`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED; @@ -357,6 +358,7 @@ CREATE TABLE IF NOT EXISTS `ng_games` ( `date` DATETIME NOT NULL, `winner_nation` INT(11) NULL DEFAULT NULL, `map` VARCHAR(50) NULL DEFAULT NULL, + `season` INT(11) NOT NULL, `scenario` INT(11) NOT NULL, `scenario_name` TEXT NOT NULL, `env` TEXT NOT NULL COMMENT 'json',