diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d9a3a165..c55f72e7 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -11,13 +11,15 @@ module.exports = { files: ['*.ts', '*.tsx', "*.vue"], }], plugins: [ - "@typescript-eslint" + "@typescript-eslint", + "prettier" ], extends: [ "eslint:recommended", - "plugin:vue/vue3-essential", - "plugin:@typescript-eslint/recommended" + "plugin:vue/vue3-recommended", + "plugin:@typescript-eslint/recommended", + "prettier", ], parserOptions: { "sourceType": "module", @@ -29,6 +31,14 @@ module.exports = { rules: { '@typescript-eslint/no-floating-promises': 'error', 'vue/script-setup-uses-vars': 'error', + 'vue/max-attributes-per-line': [ + 'warn', + { + singleline: 4, //prettier와 싸우지 말자 + }, + ], + 'vue/v-on-event-hyphenation': 'off', //vue3에선 필요없다고 생각 + 'vue/attribute-hyphenation': 'off', //vue3에선 필요없다고 생각 }, settings: { 'import/resolver': { diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..054d599c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "tabWidth": 2, + "useTabs": false, + "printWidth": 120 +} diff --git a/hwe/a_history.php b/hwe/a_history.php index d20c8cf8..450f7cac 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -23,7 +23,7 @@ if ($serverID === UniqueConst::$serverID) { increaseRefresh("연감", 1); } -$admin = $gameStor->getValues(['startyear', 'year', 'month', 'map_theme']); +$admin = $gameStor->getValues(['startyear', 'year', 'month']); $me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID); @@ -47,9 +47,9 @@ if ($s_year === null) { $e = Util::joinYearMonth($e_year, $e_month); if ($serverID !== UniqueConst::$serverID) { - $mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che'; + $mapName = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che'; } else { - $mapTheme = $admin['map_theme'] ?? 'che'; + $mapName = GameConst::$mapName; } //FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요. @@ -104,7 +104,7 @@ $nations = $history['nations']; <?= UniqueConst::$serverName ?>: 연감 - + @@ -155,7 +155,7 @@ $nations = $history['nations']; - + diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index da47e4e1..e3b15e70 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -13,8 +13,6 @@ $gameStor = KVStorage::getStorage($db, 'game_env'); increaseRefresh("중원정보", 1); -$mapTheme = $gameStor->map_theme ?? 'che'; - $me = $db->queryFirstRow('SELECT no,nation FROM general WHERE owner=%i', $userID); $myNationID = $me['nation']; @@ -100,7 +98,9 @@ $neutralStateCharMap = [ [ 'serverNick' => DB::prefix(), - 'serverID' => UniqueConst::$serverID + 'serverID' => UniqueConst::$serverID, + 'unitSet' => GameConst::$unitSet, + 'mapName' => GameConst::$mapName, ], ]) ?> @@ -187,7 +187,7 @@ $neutralStateCharMap = [
- + diff --git a/hwe/func_template.php b/hwe/func_template.php index 1b89a90b..8407257e 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -235,24 +235,19 @@ function formatLeadershipBonus(int $value): string function getMapTheme(): string { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $mapTheme = $gameStor->map_theme ?? 'che'; - return $mapTheme; + return GameConst::$mapName; } -function getMapHtml(?string $mapTheme = null) +function getMapHtml(?string $mapName = null) { $templates = new \League\Plates\Engine(__DIR__ . '/templates'); - if ($mapTheme === null) { - $db = DB::db(); - $gameStor = KVStorage::getStorage($db, 'game_env'); - $mapTheme = $gameStor->map_theme ?? 'che'; + if($mapName === null){ + $mapName = GameConst::$mapName; } return $templates->render('map', [ - 'mapTheme' => $mapTheme + 'mapName' => $mapName ]); } diff --git a/hwe/index.php b/hwe/index.php index f3eb5ab1..cd3ae7a6 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -83,7 +83,6 @@ if ($gameStor->npcmode == 0) { $npcmode = "선택 생성"; } $color = "cyan"; -$mapTheme = $gameStor->map_theme; $serverName = UniqueConst::$serverName; $serverCnt = $gameStor->server_cnt; @@ -257,7 +256,7 @@ if (!$otherTextInfo) {
-
+
diff --git a/hwe/j_map_recent.php b/hwe/j_map_recent.php index f557f856..f5cd93c2 100644 --- a/hwe/j_map_recent.php +++ b/hwe/j_map_recent.php @@ -31,15 +31,15 @@ $now = time(); if($mapInfo && ($now - $mapInfo['timestamp'] < 600)){ $mapEtag = $mapInfo['etag']; $mapModified = $mapInfo['timestamp']; - - header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mapModified)." GMT"); - header("Etag: $mapEtag"); + + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mapModified)." GMT"); + header("Etag: $mapEtag"); if ( - strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']??'2000-01-01') === $mapModified || + strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']??'2000-01-01') === $mapModified || trim($_SERVER['HTTP_IF_NONE_MATCH']??'') === $mapEtag - ) { - header("HTTP/1.1 304 Not Modified"); + ) { + header("HTTP/1.1 304 Not Modified"); die(); } @@ -65,10 +65,9 @@ $rawMap = getWorldMap([ $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); -$mapTheme = $gameStor->map_theme ?? 'che'; $rawMap['history'] = $history; -$rawMap['theme'] = $mapTheme; +$rawMap['theme'] = GameConst::$mapName; $etag = hash('sha256', $serverID.$now); $map = [ @@ -77,7 +76,7 @@ $map = [ 'data'=>$rawMap, ]; $cache->save("recent_map", $map); -header("Last-Modified: ".gmdate("D, d M Y H:i:s", $now)." GMT"); -header("Etag: $etag"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s", $now)." GMT"); +header("Etag: $etag"); Json::die($map['data'], 0); \ No newline at end of file diff --git a/hwe/sammo/Command/General/che_강행.php b/hwe/sammo/Command/General/che_강행.php index 32bf0339..88d011c7 100644 --- a/hwe/sammo/Command/General/che_강행.php +++ b/hwe/sammo/Command/General/che_강행.php @@ -173,7 +173,6 @@ class che_강행 extends Command\GeneralCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3), diff --git a/hwe/sammo/Command/General/che_이동.php b/hwe/sammo/Command/General/che_이동.php index 75cebd46..1ad87f32 100644 --- a/hwe/sammo/Command/General/che_이동.php +++ b/hwe/sammo/Command/General/che_이동.php @@ -181,7 +181,6 @@ class che_이동 extends Command\GeneralCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1), diff --git a/hwe/sammo/Command/General/che_임관.php b/hwe/sammo/Command/General/che_임관.php index 5f5aae2a..b07c5398 100644 --- a/hwe/sammo/Command/General/che_임관.php +++ b/hwe/sammo/Command/General/che_임관.php @@ -225,7 +225,6 @@ class che_임관 extends Command\GeneralCommand $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/General/che_첩보.php b/hwe/sammo/Command/General/che_첩보.php index 5a5f73f3..4f00f04c 100644 --- a/hwe/sammo/Command/General/che_첩보.php +++ b/hwe/sammo/Command/General/che_첩보.php @@ -228,7 +228,6 @@ class che_첩보 extends Command\GeneralCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3), diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index eef6119d..75709497 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -244,7 +244,6 @@ class che_출병 extends Command\GeneralCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1), diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php index 7bb0e1f2..cfc66c7a 100644 --- a/hwe/sammo/Command/General/che_화계.php +++ b/hwe/sammo/Command/General/che_화계.php @@ -342,7 +342,6 @@ class che_화계 extends Command\GeneralCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3), diff --git a/hwe/sammo/Command/Nation/che_급습.php b/hwe/sammo/Command/Nation/che_급습.php index afa008a9..8ef601f3 100644 --- a/hwe/sammo/Command/Nation/che_급습.php +++ b/hwe/sammo/Command/Nation/che_급습.php @@ -221,7 +221,6 @@ class che_급습 extends Command\NationCommand $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_물자원조.php b/hwe/sammo/Command/Nation/che_물자원조.php index 85a91e85..2dcdba61 100644 --- a/hwe/sammo/Command/Nation/che_물자원조.php +++ b/hwe/sammo/Command/Nation/che_물자원조.php @@ -291,7 +291,6 @@ class che_물자원조 extends Command\NationCommand } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'currentNationLevel' => $currentNationLevel, diff --git a/hwe/sammo/Command/Nation/che_발령.php b/hwe/sammo/Command/Nation/che_발령.php index 536276df..26ad01a3 100644 --- a/hwe/sammo/Command/Nation/che_발령.php +++ b/hwe/sammo/Command/Nation/che_발령.php @@ -177,7 +177,6 @@ class che_발령 extends Command\NationCommand $troops = Util::convertArrayToDict($db->query('SELECT * FROM troop WHERE nation=%i', $nationID), 'troop_leader'); $destRawGenerals = $db->queryAllLists('SELECT no,name,officer_level,npc,gold,rice,leadership,strength,intel,city,crew,train,atmos,troop FROM general WHERE nation = %i ORDER BY npc,binary(name)', $nationID); return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1), 'cities' => \sammo\JSOptionsForCities(), diff --git a/hwe/sammo/Command/Nation/che_백성동원.php b/hwe/sammo/Command/Nation/che_백성동원.php index f0285ecd..de54dc2f 100644 --- a/hwe/sammo/Command/Nation/che_백성동원.php +++ b/hwe/sammo/Command/Nation/che_백성동원.php @@ -172,7 +172,6 @@ class che_백성동원 extends Command\NationCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => new \stdClass(), diff --git a/hwe/sammo/Command/Nation/che_불가침제의.php b/hwe/sammo/Command/Nation/che_불가침제의.php index c2468f4b..e8ea5359 100644 --- a/hwe/sammo/Command/Nation/che_불가침제의.php +++ b/hwe/sammo/Command/Nation/che_불가침제의.php @@ -255,7 +255,6 @@ class che_불가침제의 extends Command\NationCommand $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_불가침파기제의.php b/hwe/sammo/Command/Nation/che_불가침파기제의.php index d388935e..4d500534 100644 --- a/hwe/sammo/Command/Nation/che_불가침파기제의.php +++ b/hwe/sammo/Command/Nation/che_불가침파기제의.php @@ -200,7 +200,6 @@ class che_불가침파기제의 extends Command\NationCommand{ $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_선전포고.php b/hwe/sammo/Command/Nation/che_선전포고.php index bd976864..6df46ec8 100644 --- a/hwe/sammo/Command/Nation/che_선전포고.php +++ b/hwe/sammo/Command/Nation/che_선전포고.php @@ -219,7 +219,6 @@ class che_선전포고 extends Command\NationCommand $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_수몰.php b/hwe/sammo/Command/Nation/che_수몰.php index 5ce4479c..6305d33e 100644 --- a/hwe/sammo/Command/Nation/che_수몰.php +++ b/hwe/sammo/Command/Nation/che_수몰.php @@ -199,7 +199,6 @@ class che_수몰 extends Command\NationCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => new \stdClass(), diff --git a/hwe/sammo/Command/Nation/che_이호경식.php b/hwe/sammo/Command/Nation/che_이호경식.php index 2773e7df..5ffc6094 100644 --- a/hwe/sammo/Command/Nation/che_이호경식.php +++ b/hwe/sammo/Command/Nation/che_이호경식.php @@ -224,7 +224,6 @@ class che_이호경식 extends Command\NationCommand $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_종전제의.php b/hwe/sammo/Command/Nation/che_종전제의.php index 382e397c..a738957a 100644 --- a/hwe/sammo/Command/Nation/che_종전제의.php +++ b/hwe/sammo/Command/Nation/che_종전제의.php @@ -193,7 +193,6 @@ class che_종전제의 extends Command\NationCommand{ $nationList[] = $nationTarget; } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_천도.php b/hwe/sammo/Command/Nation/che_천도.php index 1bdc795d..087f20da 100644 --- a/hwe/sammo/Command/Nation/che_천도.php +++ b/hwe/sammo/Command/Nation/che_천도.php @@ -233,7 +233,6 @@ class che_천도 extends Command\NationCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => new \stdClass(), diff --git a/hwe/sammo/Command/Nation/che_초토화.php b/hwe/sammo/Command/Nation/che_초토화.php index 3749c14a..91d5b61c 100644 --- a/hwe/sammo/Command/Nation/che_초토화.php +++ b/hwe/sammo/Command/Nation/che_초토화.php @@ -199,7 +199,6 @@ class che_초토화 extends Command\NationCommand{ public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => new \stdClass(), diff --git a/hwe/sammo/Command/Nation/che_피장파장.php b/hwe/sammo/Command/Nation/che_피장파장.php index 06095d0b..c2a3421e 100644 --- a/hwe/sammo/Command/Nation/che_피장파장.php +++ b/hwe/sammo/Command/Nation/che_피장파장.php @@ -280,7 +280,6 @@ class che_피장파장 extends Command\NationCommand } return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'nationList' => $nationList, 'startYear' => $this->env['startyear'], diff --git a/hwe/sammo/Command/Nation/che_허보.php b/hwe/sammo/Command/Nation/che_허보.php index 3fe6897f..5cfbf580 100644 --- a/hwe/sammo/Command/Nation/che_허보.php +++ b/hwe/sammo/Command/Nation/che_허보.php @@ -202,7 +202,6 @@ class che_허보 extends Command\NationCommand public function exportJSVars(): array { return [ - 'mapTheme' => \sammo\getMapTheme(), 'procRes' => [ 'cities' => \sammo\JSOptionsForCities(), 'distanceList' => new \stdClass(), diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index d2638a54..5a518c37 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -250,7 +250,7 @@ class ResetHelper{ 'month'=> $month, 'init_year'=> $year, 'init_month'=>$month, - 'map_theme' => $scenarioObj->getMapTheme(), + 'map_theme' => $scenarioObj->getMapTheme(), //@deprecated 'season'=>$seasonIdx, 'msg'=>'공지사항',//TODO:공지사항 'maxgeneral'=>GameConst::$defaultMaxGeneral, diff --git a/hwe/templates/map.php b/hwe/templates/map.php index 5c87c14c..28f2d343 100644 --- a/hwe/templates/map.php +++ b/hwe/templates/map.php @@ -1,4 +1,4 @@ -
+
diff --git a/hwe/ts/ChiefCenter/BottomItem.vue b/hwe/ts/ChiefCenter/BottomItem.vue index d6afcc10..b1cb7ea5 100644 --- a/hwe/ts/ChiefCenter/BottomItem.vue +++ b/hwe/ts/ChiefCenter/BottomItem.vue @@ -1,8 +1,8 @@ \ No newline at end of file + diff --git a/hwe/ts/PageInheritPoint.vue b/hwe/ts/PageInheritPoint.vue index 7e5d5369..d96947e0 100644 --- a/hwe/ts/PageInheritPoint.vue +++ b/hwe/ts/PageInheritPoint.vue @@ -1,40 +1,31 @@