From fd057ebb0585f3ed7528e856e4f83854135f6554 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 12 Dec 2021 13:52:55 +0900 Subject: [PATCH 01/11] =?UTF-8?q?build(WIP):=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=EB=AC=BC=EC=9D=84=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=EC=97=90=20=EA=B4=80=EA=B3=84=EC=97=86?= =?UTF-8?q?=EC=9D=B4=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- j_updateServer.php | 26 ++++++++--- webpack.config.cjs | 110 ++++++++++++++++++++++++--------------------- 2 files changed, 79 insertions(+), 57 deletions(-) diff --git a/j_updateServer.php b/j_updateServer.php index 50ed0f47..8542a83e 100644 --- a/j_updateServer.php +++ b/j_updateServer.php @@ -140,7 +140,7 @@ if (!$v->validate()) { $target = Util::getPost('target'); $server = basename($request['server']); - +$settingBasePath = __DIR__ . "/{$server}/d_setting/"; $allowFullUpdate = in_array('fullUpdate', $session->acl[$server] ?? []); $allowFullUpdate |= $session->userGrade >= 6; @@ -244,20 +244,28 @@ if ($server == $baseServerName) { $version = getVersion(); $gitHash = getHash(); if ( - hash_file("sha256", __DIR__ . '/' . $server . '/d_setting/VersionGit.dynamic.orig.php') == - hash_file("sha256", __DIR__ . '/' . $server . '/d_setting/VersionGit.php') + hash_file("sha256", $settingBasePath . 'VersionGit.dynamic.orig.php') == + hash_file("sha256", $settingBasePath . 'VersionGit.php') ) { + + if (file_exists($settingBasePath . 'VersionGit.json')) { + unlink($settingBasePath . 'VersionGit.json'); + } $result = true; } else { $result = Util::generateFileUsingSimpleTemplate( - __DIR__ . '/' . $server . '/d_setting/VersionGit.orig.php', - __DIR__ . '/' . $server . '/d_setting/VersionGit.php', + $settingBasePath . 'VersionGit.orig.php', + $settingBasePath . 'VersionGit.php', [ 'verionGit' => $version, 'hash' => $gitHash ], true ); + file_put_contents($settingBasePath . 'VersionGit.json', Json::encode([ + 'versionGit' => $version, + 'hash' => $gitHash, + ])); } //git 업데이트했는데, package.json이 바뀌면 곤란하니까 @@ -333,14 +341,18 @@ $zip->close(); $version = getVersion($target); $gitHash = getHash($target); $result = Util::generateFileUsingSimpleTemplate( - __DIR__ . '/' . $server . '/d_setting/VersionGit.orig.php', - __DIR__ . '/' . $server . '/d_setting/VersionGit.php', + $settingBasePath . 'VersionGit.orig.php', + $settingBasePath . 'VersionGit.php', [ 'verionGit' => $version, 'hash' => $gitHash ], true ); +file_put_contents($settingBasePath . 'VersionGit.json', Json::encode([ + 'versionGit' => $version, + 'hash' => $gitHash, +])); genJS($server); $storage->$server = [$target, $version]; diff --git a/webpack.config.cjs b/webpack.config.cjs index f887875a..a7c6900e 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -6,12 +6,41 @@ const { resolve } = require('path'); const CleanTerminalPlugin = require('clean-terminal-webpack-plugin'); const { ESBuildMinifyPlugin } = require('esbuild-loader') const webpack = require('webpack'); +const fs = require('fs'); module.exports = (env, argv) => { const target = env.target ?? 'hwe'; const mode = argv.mode ?? 'production'; const tsDir = resolve(__dirname, `${target}/ts/`); const build_exports = require(`${tsDir}/build_exports.json`); + const versionGitPath = resolve(__dirname, target, 'd_setting', 'VersionGit.json'); + + const versionValue = (() => { + if (!fs.existsSync(versionGitPath)) { + return undefined; + } + const versionInfo = JSON.parse(fs.readFileSync(versionGitPath, 'utf-8')); + return versionInfo.versionGit; + })() + const versionTarget = versionValue ?? `${target}_dynamic`; + const outputPath = resolve(__dirname, 'dist_js', versionTarget); + fs.mkdirSync(outputPath, { + recursive: true + }); + + const genBuildHook = function (oTarget) { + const checkFilePath = resolve(outputPath, `build_${oTarget}.txt`); + return function (percentage, msg) { + if (percentage == 0) { + if (fs.existsSync(checkFilePath)) { + fs.unlinkSync(checkFilePath); + } + } else if (percentage == 1) { + fs.writeFileSync(checkFilePath, new Date().toISOString(), 'utf-8'); + } + }; + }; + //TODO: esbuild에 browserslist 사용 가능하면 적용 //서버마다 ts 파일 구성이 다를 가능성이 높기 때문에 어떤 파일이 필요한지는 ts/build_exports.json을 확인한다. @@ -25,7 +54,7 @@ module.exports = (env, argv) => { } const ingame_vue = { - name: `ingame_${target}_vue`, + name: `ingame_${versionTarget}_vue`, resolve: { extensions: [".ts", ".tsx", ".vue", ".js"], alias: { @@ -39,7 +68,7 @@ module.exports = (env, argv) => { entry: entryIngameVue, output: { filename: '[name].js', - path: resolve(__dirname, `${target}/dist_js`) + path: resolve(outputPath, 'vue') }, devtool: 'source-map', optimization: { @@ -128,56 +157,27 @@ module.exports = (env, argv) => { }, { test: /\.(png|jpe?g|gif|webp)$/, - use: [ - { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } - ] + use: ['file-loader'] }, { test: /\.(svg)$/, - use: [ - { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } - ] + use: ['file-loader'] }, { test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)$/, - use: [ - { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } - ] + use: ['file-loader'] }, { test: /\.(woff2?|eot|ttf|otf)$/i, - use: [ - { - loader: 'file-loader', - options: { - name: '../dist_misc/[name].[contenthash:8].[ext]' - } - } - ] + use: ['file-loader'] }, ] }, plugins: [ new CleanTerminalPlugin(), new VueLoaderPlugin(), - new MiniCssExtractPlugin({ - filename: '../dist_css/[name].css' - }), + new MiniCssExtractPlugin(), + new webpack.ProgressPlugin(genBuildHook('vue')), //new BundleAnalyzerPlugin() ], cache: { @@ -185,7 +185,7 @@ module.exports = (env, argv) => { }, }; const ingame = { - name: `ingame_${target}`, + name: `ingame_${versionTarget}`, resolve: { extensions: [".js", ".ts", ".tsx"], alias: { @@ -198,7 +198,7 @@ module.exports = (env, argv) => { entry: entryIngame, output: { filename: '[name].js', - path: resolve(__dirname, `${target}/dist_js`) + path: resolve(outputPath, 'ts') }, devtool: 'source-map', optimization: { @@ -272,9 +272,8 @@ module.exports = (env, argv) => { }, plugins: [ new CleanTerminalPlugin(), - new MiniCssExtractPlugin({ - filename: '../dist_css/[name].css' - }), + new MiniCssExtractPlugin(), + new webpack.ProgressPlugin(genBuildHook('ts')), //new BundleAnalyzerPlugin() ], cache: { @@ -287,7 +286,7 @@ module.exports = (env, argv) => { } }; const gateway = { - name: 'gateway', + name: `gateway_${versionTarget}`, resolve: { extensions: [".js", ".ts", ".tsx"], alias: { @@ -307,7 +306,7 @@ module.exports = (env, argv) => { }, output: { filename: '[name].js', - path: path.resolve(__dirname, 'dist_js'), + path: resolve(outputPath, 'gateway') }, devtool: 'source-map', optimization: { @@ -379,9 +378,8 @@ module.exports = (env, argv) => { }] }, plugins: [ - new MiniCssExtractPlugin({ - filename: '../dist_css/[name].css' - }), + new MiniCssExtractPlugin(), + new webpack.ProgressPlugin(genBuildHook('gateway')), //new BundleAnalyzerPlugin() ], cache: { @@ -389,10 +387,22 @@ module.exports = (env, argv) => { }, }; - if (target == 'hwe') { + if(env.WEBPACK_WATCH || !versionValue){ return [gateway, ingame_vue, ingame]; } - else { - return [ingame_vue, ingame]; + + const buildConfList = []; + if (target == 'hwe' && !fs.existsSync(resolve(outputPath, `build_gateway.txt`))) { + buildConfList.push(gateway); } + + if (!fs.existsSync(resolve(outputPath, `build_vue.txt`))) { + buildConfList.push(ingame_vue); + } + + if (!fs.existsSync(resolve(outputPath, `build_ts.txt`))) { + buildConfList.push(ingame); + } + + return buildConfList; } From 0b82024caa4b40f4ab27eeeb5ef68a7ea61a7462 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 12 Dec 2021 15:28:52 +0900 Subject: [PATCH 02/11] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=20=EC=97=86?= =?UTF-8?q?=EC=9D=B4=20emit=20=EB=90=9C=20=EA=B2=BD=EC=9A=B0=EC=97=90?= =?UTF-8?q?=EB=A7=8C=20=EB=B9=8C=EB=93=9C=20=EC=99=84=EB=A3=8C=20=ED=91=9C?= =?UTF-8?q?=EC=A7=80=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webpack.config.cjs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/webpack.config.cjs b/webpack.config.cjs index a7c6900e..5942ae29 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -30,13 +30,19 @@ module.exports = (env, argv) => { const genBuildHook = function (oTarget) { const checkFilePath = resolve(outputPath, `build_${oTarget}.txt`); - return function (percentage, msg) { + let emitDone = false; + let writeDone = false; + return function (percentage, msg, ...args) { + if(msg == 'emitting'){ + emitDone = true; + } if (percentage == 0) { if (fs.existsSync(checkFilePath)) { fs.unlinkSync(checkFilePath); } - } else if (percentage == 1) { + } else if (percentage == 1 && emitDone && !writeDone) { fs.writeFileSync(checkFilePath, new Date().toISOString(), 'utf-8'); + writeDone = true; } }; }; @@ -177,7 +183,11 @@ module.exports = (env, argv) => { new CleanTerminalPlugin(), new VueLoaderPlugin(), new MiniCssExtractPlugin(), - new webpack.ProgressPlugin(genBuildHook('vue')), + new webpack.ProgressPlugin({ + percentBy: 'modules', + dependencies: false, + handler: genBuildHook('vue') + }), //new BundleAnalyzerPlugin() ], cache: { @@ -388,7 +398,8 @@ module.exports = (env, argv) => { }; if(env.WEBPACK_WATCH || !versionValue){ - return [gateway, ingame_vue, ingame]; + return [ingame_vue]; + //return [gateway, ingame_vue, ingame]; } const buildConfList = []; From 6a7f62f2c2c36bed871e36d401a19894b6eb6761 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 12 Dec 2021 16:33:20 +0900 Subject: [PATCH 03/11] =?UTF-8?q?build(WIP):=20php=EB=8B=A8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B3=80=EA=B2=BD=EB=90=9C=20dist=5Fjs=EC=97=90=20?= =?UTF-8?q?=EB=A7=9E=EA=B2=8C=20js,css=20=EB=A1=9C=EB=93=9C=20-=20fix:=20w?= =?UTF-8?q?ebpack=20=EC=B6=9C=EB=A0=A5=EB=AC=BC=20=EB=AC=B8=EC=A0=9C=20-?= =?UTF-8?q?=20webpack=20splitChunks=20=ED=8C=8C=EC=9D=BC=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/index.php | 8 +-- hwe/ts/v_main.ts | 1 + src/sammo/WebUtil.php | 37 ++++++++++++++ webpack.config.cjs | 111 +++++++++++++----------------------------- 4 files changed, 72 insertions(+), 85 deletions(-) diff --git a/hwe/index.php b/hwe/index.php index 512b5c6c..b2c0b649 100644 --- a/hwe/index.php +++ b/hwe/index.php @@ -118,15 +118,9 @@ if (!$otherTextInfo) { - - - - - + - - DB::prefix(), diff --git a/hwe/ts/v_main.ts b/hwe/ts/v_main.ts index d20f92e7..a2a1b1fb 100644 --- a/hwe/ts/v_main.ts +++ b/hwe/ts/v_main.ts @@ -1,4 +1,5 @@ import '@scss/main.scss'; +import "@scss/common_legacy.scss"; exportWindow(scrollHardTo, 'scrollHardTo'); diff --git a/src/sammo/WebUtil.php b/src/sammo/WebUtil.php index cc93c471..e61d3457 100644 --- a/src/sammo/WebUtil.php +++ b/src/sammo/WebUtil.php @@ -139,6 +139,43 @@ class WebUtil return static::preloadAsset($path, 'script'); } + public static function printDist(string $type, string|array $entryName, bool $isDefer = false){ + if(is_string($entryName)){ + $entryName = [$entryName]; + } + if(is_subclass_of('\\sammo\\VersionGit', '\\sammo\\VersionGitDynamic')){ + $version = DB::prefix().'_dynamic'; + } + else{ + $version = VersionGit::getVersion(); + } + + $basePath = dirname(__DIR__, 2)."/dist_js/{$version}/{$type}"; + $serverBasePath = \phpUri::parse(ServConfig::$serverWebPath)->path; + $serverBasePath .= "/dist_js/{$version}/{$type}"; + + $outputs = ["\n"]; + + foreach(["vendors", "common_ts", ...$entryName] as $moduleName){ + foreach(['js', 'css'] as $ext){ + $checkPath = $basePath."/{$moduleName}.{$ext}"; + if (!file_exists($checkPath)) { + $outputs[] = "\n"; + continue; + } + $mtime = filemtime($checkPath); + if($ext == 'css'){ + $outputs[] = "\n"; + } + else if($ext == 'js'){ + $typeText = $isDefer ? 'defer' : ''; + $outputs[] = "\n"; + } + } + } + return join("", $outputs); + } + public static function printJS(string $path, bool $isDefer = false) { //async 옵션 고려? diff --git a/webpack.config.cjs b/webpack.config.cjs index 5942ae29..c1639052 100644 --- a/webpack.config.cjs +++ b/webpack.config.cjs @@ -33,7 +33,7 @@ module.exports = (env, argv) => { let emitDone = false; let writeDone = false; return function (percentage, msg, ...args) { - if(msg == 'emitting'){ + if (msg == 'emitting') { emitDone = true; } if (percentage == 0) { @@ -59,6 +59,33 @@ module.exports = (env, argv) => { entryIngame[entry] = `${tsDir}/${filePath}`; } + const optimization = { + splitChunks: { + cacheGroups: { + commons: { + test: /[\\/]node_modules[\\/]/, + name: 'vendors', + priority: -10, + chunks: 'all', + reuseExistingChunk: true, + }, + default: { + name: 'common_ts', + minChunks: 2, + priority: -20, + chunks: 'all', + reuseExistingChunk: true, + }, + }, + }, + minimizer: [ + new ESBuildMinifyPlugin({ + css: true + }), + ], + moduleIds: 'deterministic', + }; + const ingame_vue = { name: `ingame_${versionTarget}_vue`, resolve: { @@ -77,32 +104,7 @@ module.exports = (env, argv) => { path: resolve(outputPath, 'vue') }, devtool: 'source-map', - optimization: { - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors_vue', - priority: -10, - chunks: 'all', - reuseExistingChunk: true, - }, - default: { - name: 'common_vue', - minChunks: 2, - priority: -20, - chunks: 'all', - reuseExistingChunk: true, - }, - }, - }, - minimizer: [ - new ESBuildMinifyPlugin({ - css: true - }), - ], - moduleIds: 'deterministic', - }, + optimization, module: { rules: [ //FROM `vue inspect` and some tweaks @@ -211,30 +213,7 @@ module.exports = (env, argv) => { path: resolve(outputPath, 'ts') }, devtool: 'source-map', - optimization: { - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors', - chunks: 'all', - }, - default: { - name: 'common_ts', - minChunks: 2, - priority: -20, - chunks: 'all', - reuseExistingChunk: true, - }, - }, - }, - minimizer: [ - new ESBuildMinifyPlugin({ - css: true - }), - ], - moduleIds: 'deterministic', - }, + optimization, module: { rules: [{ test: /\.ts$/, @@ -319,30 +298,7 @@ module.exports = (env, argv) => { path: resolve(outputPath, 'gateway') }, devtool: 'source-map', - optimization: { - splitChunks: { - cacheGroups: { - commons: { - test: /[\\/]node_modules[\\/]/, - name: 'vendors', - chunks: 'all', - }, - default: { - name: 'common_ts', - minChunks: 2, - priority: -20, - chunks: 'all', - reuseExistingChunk: true, - }, - }, - }, - minimizer: [ - new ESBuildMinifyPlugin({ - css: true - }), - ], - moduleIds: 'deterministic', - }, + optimization, module: { rules: [{ test: /\.ts$/, @@ -397,9 +353,8 @@ module.exports = (env, argv) => { }, }; - if(env.WEBPACK_WATCH || !versionValue){ - return [ingame_vue]; - //return [gateway, ingame_vue, ingame]; + if (env.WEBPACK_WATCH || !versionValue) { + return [gateway, ingame_vue, ingame]; } const buildConfList = []; From 8ede84c17696e924b01a29354a5d314ecc64a688 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 12 Dec 2021 19:26:27 +0900 Subject: [PATCH 04/11] =?UTF-8?q?build(WIP):=20printDist=EB=A5=BC=20?= =?UTF-8?q?=EB=AA=A8=EB=93=A0=20=EC=BD=94=EB=93=9C=EC=97=90=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=20-=20=ED=98=84=EC=9E=AC=20summernote=20=EB=AF=B8?= =?UTF-8?q?=EC=9E=91=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f_install/install.php | 14 +- hwe/_119.php | 2 +- hwe/_admin1.php | 2 +- hwe/_admin2.php | 2 +- hwe/_admin4.php | 23 +- hwe/_admin5.php | 8 +- hwe/_admin7.php | 2 +- hwe/_admin8.php | 152 ++-- hwe/a_bestGeneral.php | 5 +- hwe/a_emperior.php | 5 +- hwe/a_emperior_detail.php | 359 ++++---- hwe/a_genList.php | 5 +- hwe/a_hallOfFame.php | 5 +- hwe/a_history.php | 6 +- hwe/a_kingdomList.php | 6 +- hwe/a_npcList.php | 6 +- hwe/a_status.php | 15 +- hwe/a_traffic.php | 7 +- hwe/a_vote.php | 7 +- hwe/b_auction.php | 5 +- hwe/b_battleCenter.php | 5 +- hwe/b_betting.php | 5 +- hwe/b_chiefcenter.php | 5 +- hwe/b_currentCity.php | 5 +- hwe/b_dipcenter.php | 8 +- hwe/b_diplomacy.php | 15 +- hwe/b_genList.php | 5 +- hwe/b_myBossInfo.php | 6 +- hwe/b_myCityInfo.php | 6 +- hwe/b_myGenInfo.php | 6 +- hwe/b_myKingdomInfo.php | 6 +- hwe/b_myPage.php | 8 +- hwe/b_processing.php | 7 +- hwe/b_tournament.php | 793 ++++++++++-------- hwe/b_troop.php | 11 +- hwe/battle_simulator.php | 5 +- hwe/func_legacy.php | 135 +-- hwe/func_template.php | 79 +- hwe/install.php | 5 +- hwe/install_db.php | 5 +- hwe/recent_map.php | 5 +- .../dipcenter.css => scss/dipcenter.scss} | 4 +- hwe/select_general_from_pool.php | 8 +- hwe/select_npc.php | 6 +- hwe/t_diplomacy.php | 5 +- hwe/ts/dipcenter.ts | 7 +- hwe/ts/summernote-image-flip.ts | 2 +- hwe/v_NPCControl.php | 7 +- hwe/v_board.php | 6 +- hwe/v_inheritPoint.php | 6 +- hwe/v_join.php | 7 +- i_entrance/admin_userlist.php | 7 +- i_entrance/entrance.php | 13 +- i_entrance/user_info.php | 7 +- index.php | 8 +- oauth_kakao/join.php | 6 +- showErrorLog.php | 5 +- src/sammo/WebUtil.php | 46 +- webpack.config.cjs | 4 +- 59 files changed, 961 insertions(+), 954 deletions(-) rename hwe/{css/dipcenter.css => scss/dipcenter.scss} (81%) diff --git a/f_install/install.php b/f_install/install.php index 27c46db6..e1c1b265 100644 --- a/f_install/install.php +++ b/f_install/install.php @@ -13,13 +13,17 @@ require(__DIR__ . '/../vendor/autoload.php'); 설치 + - - - - - + + + + + + + + diff --git a/hwe/_119.php b/hwe/_119.php index 1017a904..513301d1 100644 --- a/hwe/_119.php +++ b/hwe/_119.php @@ -24,7 +24,7 @@ $plock = $db->queryFirstField('SELECT plock FROM plock'); - + diff --git a/hwe/_admin1.php b/hwe/_admin1.php index a622e36e..8e9fd584 100644 --- a/hwe/_admin1.php +++ b/hwe/_admin1.php @@ -22,7 +22,7 @@ $admin = getAdmin(); - + diff --git a/hwe/_admin2.php b/hwe/_admin2.php index 5721e97c..87b2bb2b 100644 --- a/hwe/_admin2.php +++ b/hwe/_admin2.php @@ -23,7 +23,7 @@ $db = DB::db(); - + diff --git a/hwe/_admin4.php b/hwe/_admin4.php index 0f05ba32..2ef4c18f 100644 --- a/hwe/_admin4.php +++ b/hwe/_admin4.php @@ -23,8 +23,9 @@ $ipGroupList = Util::arrayGroupBy( 'ip_c' ); -function colorBlockedName($general){ - if(!$general['blocked']){ +function colorBlockedName($general) +{ + if (!$general['blocked']) { return $general['name']; } return "{$general['name']}"; @@ -40,7 +41,7 @@ function colorBlockedName($general){ - + @@ -108,14 +109,14 @@ function colorBlockedName($general){ IP ID -$users): ?> - - ',array_map('\sammo\colorBlockedName', $users))?> - ',array_column($users, 'lastconnect'))?> - ',array_column($users, 'ip'))?> - ',array_column($users, 'owner'))?> - - + $users) : ?> + + ', array_map('\sammo\colorBlockedName', $users)) ?> + ', array_column($users, 'lastconnect')) ?> + ', array_column($users, 'ip')) ?> + ', array_column($users, 'owner')) ?> + + - + @@ -212,7 +212,7 @@ GROUP BY B.nation $query .= " order by avg(B.dex5) desc"; break; } - foreach($db->query($query) as $nation){ + foreach ($db->query($query) as $nation) { $gen = $db->queryFirstRow('SELECT COUNT(*) as cnt, ROUND(AVG(gold)) as avgg, ROUND(AVG(rice)) as avgr, @@ -221,7 +221,7 @@ GROUP BY B.nation ROUND(AVG(intel), 1) as avgi, ROUND(AVG(explevel), 1) as avge, SUM(crew) as crew -from general where nation=%i',$nation['nation']); +from general where nation=%i', $nation['nation']); $city = $db->queryFirstRow('SELECT COUNT(*) as cnt, SUM(pop) as pop, SUM(pop_max) as pop_max, @@ -312,7 +312,7 @@ from city where nation=%i', $nation['nation']); ?> query('SELECT * from statistic where month=1 or no=1') as $stat){ + foreach ($db->query('SELECT * from statistic where month=1 or no=1') as $stat) { echo " {$stat['year']} diff --git a/hwe/_admin7.php b/hwe/_admin7.php index 1a3ecfd1..25078733 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -86,7 +86,7 @@ $generalObj = General::createGeneralObjFromDB($gen); - + diff --git a/hwe/_admin8.php b/hwe/_admin8.php index 9fd01fba..b9fb03c0 100644 --- a/hwe/_admin8.php +++ b/hwe/_admin8.php @@ -1,4 +1,5 @@ + -외교정보 - - - - - - + 외교정보 + + + + + + + - - - -
외 교 정 보
-
- 정렬순서 : - - -
-
- - +
외 교 관 계
+ + + + + + +
외 교 정 보
+
+ 정렬순서 : + + +
+
+ + + + + + + + + + + query('SELECT * from diplomacy where me < you order by state desc') as $dip) { + $me = $dip['me']; + $you = $dip['you']; + + if ($dip['state'] == 2) { + continue; + } + + switch ($dip['state']) { + case 0: + $state = "교 전"; + break; + case 1: + $state = "선포중"; + break; + case 2: + $state = "통 상"; + break; + case 7: + $state = "불가침"; + break; + } + + $date = TimeUtil::now(); + + echo " - - - - - -query('SELECT * from diplomacy where me < you order by state desc') as $dip){ - $me = $dip['me']; - $you = $dip['you']; - - if ($dip['state'] == 2) { - continue; - } - - switch ($dip['state']) { - case 0: $state = "교 전"; break; - case 1: $state = "선포중"; break; - case 2: $state = "통 상"; break; - case 7: $state = "불가침"; break; - } - - $date = TimeUtil::now(); - - echo " - - - + + "; -} -?> -
외 교 관 계
국 가 명국 가 명상 태기 간
국 가 명국 가 명상 태기 간
$nationName[$me]$nationName[$you]$nationName[$me]$nationName[$you] $state {$dip['term']} 개월
- - - -
+ } + ?> + + + + + + + + +
- + + \ No newline at end of file diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php index 7efac72a..37967b4d 100644 --- a/hwe/a_bestGeneral.php +++ b/hwe/a_bestGeneral.php @@ -27,13 +27,10 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates'); <?= UniqueConst::$serverName ?>: 명장일람 - - - - + diff --git a/hwe/a_emperior.php b/hwe/a_emperior.php index 6294f2d3..8444f331 100644 --- a/hwe/a_emperior.php +++ b/hwe/a_emperior.php @@ -18,12 +18,9 @@ increaseRefresh("왕조일람", 1); <?= UniqueConst::$serverName ?>: 왕조일람 - - - - + diff --git a/hwe/a_emperior_detail.php b/hwe/a_emperior_detail.php index 1a3ea255..a852745c 100644 --- a/hwe/a_emperior_detail.php +++ b/hwe/a_emperior_detail.php @@ -1,4 +1,5 @@ registerFunction('ConvertLog', '\sammo\ConvertLog'); $templates->registerFunction('newColor', '\sammo\newColor'); increaseRefresh("왕조일람", 1); -$emperior = $db->queryFirstRow('SELECT * FROM emperior WHERE `no`=%i',$select); -$serverID = $emperior['server_id']??($emperior['serverID']??null); +$emperior = $db->queryFirstRow('SELECT * FROM emperior WHERE `no`=%i', $select); +$serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null); ?> @@ -22,193 +23,199 @@ $serverID = $emperior['server_id']??($emperior['serverID']??null); - - - -<?=UniqueConst::$serverName?>: 왕조일람 - - - + + + + <?= UniqueConst::$serverName ?>: 왕조일람 + + + - - +
역 대 왕 조
- -
+ + + -
역 대 왕 조
+ +
+ - + if ($emperior) : + ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
국 가 수
(최종 / 최대)
장 수 수
(최종 / 최대)
등 장 국 가
국가별 성향
장 수 성 격
장 수 특 기
; bgcolor= colspan=6> - (月) -
국 력성 향
장 수속 령
총 인 구인 구 율
국 고병 량
황 제 승 상 
위 장 군 사 공 
표 기 장 군 태 위 
거 기 장 군 사 도 
오 호 장 군
건 안 칠 자
장 수 들
(공헌도 순서)
역 사 기 록
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
국 가 수
(최종 / 최대)
장 수 수
(최종 / 최대)
등 장 국 가
국가별 성향
장 수 성 격
장 수 특 기
; bgcolor= colspan=6> + (月) +
국 력성 향
장 수속 령
총 인 구인 구 율
국 고병 량
황 제 승 상 
위 장 군 사 공 
표 기 장 군 태 위 
거 기 장 군 사 도 
오 호 장 군
건 안 칠 자
장 수 들
(공헌도 순서)
역 사 기 록
-query('SELECT * FROM ng_old_nations WHERE server_id=%s ORDER BY date DESC', $serverID); - foreach($nations as $nation){ - if(!$nation['nation']??null){ - continue; - } - $nation += Json::decode($nation['data']); - - $nation['typeName'] = getNationType($nation['type']); - $nation['levelName'] = getNationLevel($nation['level']); - /** @var int[]|null $nationGenerals */ - $nationGenerals = $nation['generals']; - - if($nationGenerals){ - $generals = $db->query('SELECT `general_no`, `name`, `last_yearmonth` FROM ng_old_generals WHERE server_id=%s AND general_no IN %li', $serverID, $nationGenerals); - - if(count($generals) != count($nationGenerals) && $serverID == UniqueConst::$serverID){ - $liveGenerals = $nationGenerals; - foreach($generals as $general){ - if(in_array($general['general_no'], $nationGenerals)){ - unset($nationGenerals[$general['general_no']]); - } - } - $liveGenerals = $db->query('SELECT `no`as`general_no`, `name` FROM general WHERE no IN %li', $liveGenerals); - $nation['generalsFull'] = array_merge($liveGenerals, $generals); - } - else{ - $nation['generalsFull'] = $generals; - } - } - else{ - $nation['generalsFull'] = []; - } - - if(key_exists('aux', $nation) && !is_array($nation['aux'])){ - $nation += Json::decode($nation['aux']); - } - - echo $templates->render('oldNation', $nation); + if (!$serverID) { + $serverID = UniqueConst::$serverID; } -} -?> - - - -
+ if ($showServers) { + $nations = $db->query('SELECT * FROM ng_old_nations WHERE server_id=%s ORDER BY date DESC', $serverID); + foreach ($nations as $nation) { + if (!$nation['nation'] ?? null) { + continue; + } + $nation += Json::decode($nation['data']); + + $nation['typeName'] = getNationType($nation['type']); + $nation['levelName'] = getNationLevel($nation['level']); + /** @var int[]|null $nationGenerals */ + $nationGenerals = $nation['generals']; + + if ($nationGenerals) { + $generals = $db->query('SELECT `general_no`, `name`, `last_yearmonth` FROM ng_old_generals WHERE server_id=%s AND general_no IN %li', $serverID, $nationGenerals); + + if (count($generals) != count($nationGenerals) && $serverID == UniqueConst::$serverID) { + $liveGenerals = $nationGenerals; + foreach ($generals as $general) { + if (in_array($general['general_no'], $nationGenerals)) { + unset($nationGenerals[$general['general_no']]); + } + } + $liveGenerals = $db->query('SELECT `no`as`general_no`, `name` FROM general WHERE no IN %li', $liveGenerals); + $nation['generalsFull'] = array_merge($liveGenerals, $generals); + } else { + $nation['generalsFull'] = $generals; + } + } else { + $nation['generalsFull'] = []; + } + + if (key_exists('aux', $nation) && !is_array($nation['aux'])) { + $nation += Json::decode($nation['aux']); + } + + echo $templates->render('oldNation', $nation); + } + } + ?> + + + + + + + + +
+ \ No newline at end of file diff --git a/hwe/a_genList.php b/hwe/a_genList.php index c8f62b0b..b83e4e3b 100644 --- a/hwe/a_genList.php +++ b/hwe/a_genList.php @@ -45,12 +45,9 @@ if ($gameStor->isunited) { <?= UniqueConst::$serverName ?>: 장수일람 - - - - + diff --git a/hwe/a_hallOfFame.php b/hwe/a_hallOfFame.php index b4b89813..68c573c4 100644 --- a/hwe/a_hallOfFame.php +++ b/hwe/a_hallOfFame.php @@ -47,13 +47,10 @@ if ($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx] ?? [])) { <?= UniqueConst::$serverName ?>: 명예의 전당 - - - - + diff --git a/hwe/a_history.php b/hwe/a_history.php index cb4c9618..cffb467f 100644 --- a/hwe/a_history.php +++ b/hwe/a_history.php @@ -99,15 +99,13 @@ $nations = Json::decode($history['nations']); <?= UniqueConst::$serverName ?>: 연감 - - - - + + - - - - - - diff --git a/hwe/a_traffic.php b/hwe/a_traffic.php index 615e76df..106e9397 100644 --- a/hwe/a_traffic.php +++ b/hwe/a_traffic.php @@ -54,12 +54,7 @@ if ($admin['maxonline'] < $curonline) { - - - - - + + diff --git a/hwe/a_vote.php b/hwe/a_vote.php index 92fed25d..e526689f 100644 --- a/hwe/a_vote.php +++ b/hwe/a_vote.php @@ -30,12 +30,7 @@ $vote = $admin['vote'] ?: ['-']; - - - - - + + + diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index 2e1813e4..38d63e50 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -35,13 +35,9 @@ $templates = new \League\Plates\Engine('templates'); - - - - + diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php index 452d774d..03df6d72 100644 --- a/hwe/b_dipcenter.php +++ b/hwe/b_dipcenter.php @@ -62,15 +62,9 @@ $nationStor->cacheValues(['notice', 'scout_msg', 'available_war_setting_cnt']); ]) ?>; - - - - - - - + diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php index 236977cd..7b54f766 100644 --- a/hwe/b_diplomacy.php +++ b/hwe/b_diplomacy.php @@ -92,11 +92,12 @@ $neutralStateCharMap = [ <?= UniqueConst::$serverName ?>: 중원 정보 - - - - + + + + + - - - - - - diff --git a/hwe/b_genList.php b/hwe/b_genList.php index 9295bde6..5d8dd06f 100644 --- a/hwe/b_genList.php +++ b/hwe/b_genList.php @@ -55,12 +55,9 @@ $templates = new \League\Plates\Engine('templates'); <?= UniqueConst::$serverName ?>: 암행부 - - - - + diff --git a/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php index 54d0c97c..3336c9da 100644 --- a/hwe/b_myBossInfo.php +++ b/hwe/b_myBossInfo.php @@ -35,19 +35,15 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati <?= UniqueConst::$serverName ?>: 인사부 - - - - - + "selected"]; <?= UniqueConst::$serverName ?>: 세력도시 - - - - - + diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php index 8dec4b95..015559e7 100644 --- a/hwe/b_myGenInfo.php +++ b/hwe/b_myGenInfo.php @@ -46,13 +46,9 @@ if ($gameStor->isunited) { <?= UniqueConst::$serverName ?>: 세력장수 - - - - - + diff --git a/hwe/b_myKingdomInfo.php b/hwe/b_myKingdomInfo.php index 05d9c4c2..39c7ccc0 100644 --- a/hwe/b_myKingdomInfo.php +++ b/hwe/b_myKingdomInfo.php @@ -29,13 +29,9 @@ if ($nationID == 0) { <?= UniqueConst::$serverName ?>: 세력정보 - - - - - + diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index bc6b26e8..270e945a 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -53,14 +53,10 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1; - - - - - - + + diff --git a/hwe/b_processing.php b/hwe/b_processing.php index dc3b1a60..5a398fab 100644 --- a/hwe/b_processing.php +++ b/hwe/b_processing.php @@ -76,11 +76,7 @@ $cssList = $commandObj->getCSSFiles(); - - - - + @@ -233,7 +225,6 @@ uasort($troops, function ($lhs, $rhs) { - \ No newline at end of file diff --git a/hwe/battle_simulator.php b/hwe/battle_simulator.php index 7277f3a7..7e7f6cb7 100644 --- a/hwe/battle_simulator.php +++ b/hwe/battle_simulator.php @@ -46,18 +46,15 @@ if ($nationID) { - - - - + diff --git a/hwe/func_legacy.php b/hwe/func_legacy.php index a2e4d070..bfc56589 100644 --- a/hwe/func_legacy.php +++ b/hwe/func_legacy.php @@ -1,58 +1,72 @@ - - - -접속제한 - - - - - - - - - -접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다. (다음 접속 가능 시각 : )
-(자신의 턴이 되면 다시 접속 가능합니다. 당신의 건강을 위해 잠시 쉬어보시는 것은 어떨까요? ^^)
-
- - + + + + + 접속제한 + + + + + + + + + + + 접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다. (다음 접속 가능 시각 : )
+ (자신의 턴이 되면 다시 접속 가능합니다. 당신의 건강을 위해 잠시 쉬어보시는 것은 어떨까요? ^^)
+
+ + + -
-
+
+
"; return $str; } -function optionsForCities(callable $infoCall=null) { +function optionsForCities(callable $infoCall = null) +{ - if(!$infoCall){ - return join('', array_map(function($city){ + if (!$infoCall) { + return join('', array_map(function ($city) { return ""; }, CityConst::all())); } $infoList = []; $noInfoList = []; - foreach(CityConst::all() as $city){ + foreach (CityConst::all() as $city) { $info = $infoCall($city); - if(!$info){ + if (!$info) { $noInfoList[] = ""; continue; } @@ -62,7 +76,8 @@ function optionsForCities(callable $infoCall=null) { return join('', array_merge($infoList, $noInfoList)); } -function Submit($url, $msg="", $msg2="") { +function Submit($url, $msg = "", $msg2 = "") +{ echo "a"; // 파폭 버그 때문 echo "
@@ -74,49 +89,62 @@ function Submit($url, $msg="", $msg2="") { } -function GetNationColors() { - $colors = array("#FF0000", "#800000", "#A0522D", "#FF6347", "#FFA500", "#FFDAB9", "#FFD700", "#FFFF00", +function GetNationColors() +{ + $colors = array( + "#FF0000", "#800000", "#A0522D", "#FF6347", "#FFA500", "#FFDAB9", "#FFD700", "#FFFF00", "#7CFC00", "#00FF00", "#808000", "#008000", "#2E8B57", "#008080", "#20B2AA", "#6495ED", "#7FFFD4", "#AFEEEE", "#87CEEB", "#00FFFF", "#00BFFF", "#0000FF", "#000080", "#483D8B", "#7B68EE", "#BA55D3", - "#800080", "#FF00FF", "#FFC0CB", "#F5F5DC", "#E0FFFF", "#FFFFFF", "#A9A9A9"); + "#800080", "#FF00FF", "#FFC0CB", "#F5F5DC", "#E0FFFF", "#FFFFFF", "#A9A9A9" + ); return $colors; } -function backButton() { +function backButton() +{ return "
"; } -function CoreBackButton() { +function CoreBackButton() +{ return "
"; } -function closeButton() { +function closeButton() +{ return "
"; } -function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1):string { +function printCitiesBasedOnDistance(int $cityNo, int $maxDistance = 1): string +{ $distanceList = searchDistance($cityNo, $maxDistance, true); $result = []; - for($dist = 1; $dist <= $maxDistance; $dist++){ - $cityList = array_map(function($cityID){ + for ($dist = 1; $dist <= $maxDistance; $dist++) { + $cityList = array_map(function ($cityID) { return CityConst::byID($cityID)->name; }, Util::array_get($distanceList[$dist], [])); $cityStr = join(', ', $cityList); - switch($dist) { - case 1: $color = "magenta"; break; - case 2: $color = "orange"; break; - default: $color = "yellow"; break; + switch ($dist) { + case 1: + $color = "magenta"; + break; + case 2: + $color = "orange"; + break; + default: + $color = "yellow"; + break; } $result[] = "{$dist}칸 떨어진 도시 : {$cityStr}"; @@ -125,7 +153,8 @@ function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1):string { } -function info($type=0) { +function info($type = 0) +{ $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -136,14 +165,14 @@ function info($type=0) { $gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc < 2'); $npccount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc >= 2'); - switch($type) { - case 0: - return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)
등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; - case 1: - return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)          등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; - case 2: - return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)"; - case 3: - return "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; + switch ($type) { + case 0: + return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)
등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; + case 1: + return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)          등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; + case 2: + return "현재 : {$admin['year']}年 {$admin['month']}月 ($termtype 서버)"; + case 3: + return "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + NPC {$npccount} 명"; } } diff --git a/hwe/func_template.php b/hwe/func_template.php index 17287026..8b029dba 100644 --- a/hwe/func_template.php +++ b/hwe/func_template.php @@ -11,10 +11,10 @@ namespace sammo; * TODO: side effect를 제거 */ - /** - * 관리자 권한이 필요함을 출력. - * @return void - */ +/** + * 관리자 권한이 필요함을 출력. + * @return void + */ function requireAdminPermissionHTML() { ob_start(); @@ -28,8 +28,8 @@ function requireAdminPermissionHTML() - - + + @@ -119,7 +119,7 @@ function displaySpecialDomesticInfo(?string $type): string ]); } -function allButton(bool $seizeNPCMode, array $opts=[]) +function allButton(bool $seizeNPCMode, array $opts = []) { if ($seizeNPCMode) { $site = "a_npcList.php"; @@ -143,7 +143,7 @@ function allButton(bool $seizeNPCMode, array $opts=[]) } -function commandButton(array $opts=[]) +function commandButton(array $opts = []) { $session = Session::getInstance(); $userID = Session::getUserID(); @@ -196,13 +196,13 @@ function formatDefenceTrain(int $value): string { if ($value === 999) { return "×"; - } else if ($value >= 90){ + } else if ($value >= 90) { return "☆"; } else if ($value >= 80) { return "◎"; } else if ($value >= 60) { return "○"; - } else{ + } else { return "△"; } } @@ -253,36 +253,49 @@ function getInvitationList(array $nationList) } -function getAutorunInfo($autorunOption){ - $templates = new \League\Plates\Engine(__DIR__.'/templates'); +function getAutorunInfo($autorunOption) +{ + $templates = new \League\Plates\Engine(__DIR__ . '/templates'); $auto_info = []; - foreach($autorunOption['options'] as $auto_option => $value){ + foreach ($autorunOption['options'] as $auto_option => $value) { assert($value); - switch($auto_option){ - case 'develop': $auto_info['내정'] = '내정'; break; - case 'warp': $auto_info['순간이동'] = '순간이동'; break; - case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break; - case 'recruit_high': $auto_info['징병'] = '모병'; break; - case 'train': $auto_info['훈사'] = '훈련/사기진작'; break; - case 'battle': $auto_info['출병'] = '출병'; break; - case 'chief': $auto_info['사령턴'] = '사령턴'; break; + switch ($auto_option) { + case 'develop': + $auto_info['내정'] = '내정'; + break; + case 'warp': + $auto_info['순간이동'] = '순간이동'; + break; + case 'recruit': + $auto_info['징병'] = $auto_info['징병'] ?? '징병'; + break; + case 'recruit_high': + $auto_info['징병'] = '모병'; + break; + case 'train': + $auto_info['훈사'] = '훈련/사기진작'; + break; + case 'battle': + $auto_info['출병'] = '출병'; + break; + case 'chief': + $auto_info['사령턴'] = '사령턴'; + break; } } $limit = Util::toInt($autorunOption['limit_minutes']); - if($limit >= 43200){ + if ($limit >= 43200) { $auto_info['제한'] = '항상 유효'; - } - else if($limit % 60 == 0){ - $auto_info['제한'] = ($limit/60).'시간 유효'; - } - else{ - $auto_info['제한'] = ($limit).'분 유효'; + } else if ($limit % 60 == 0) { + $auto_info['제한'] = ($limit / 60) . '시간 유효'; + } else { + $auto_info['제한'] = ($limit) . '분 유효'; } $auto_info = join(', ', array_values($auto_info)); return $templates->render('tooltip', [ - 'text'=>'자율행동', - 'info'=>$auto_info, - 'style'=>'text-decoration:underline', - 'copyable_info'=>true + 'text' => '자율행동', + 'info' => $auto_info, + 'style' => 'text-decoration:underline', + 'copyable_info' => true ]); -} \ No newline at end of file +} diff --git a/hwe/install.php b/hwe/install.php index 3a624bc9..25969c90 100644 --- a/hwe/install.php +++ b/hwe/install.php @@ -31,11 +31,8 @@ if ($session->userGrade < 5 && !$allowReset) { - - - - + diff --git a/hwe/install_db.php b/hwe/install_db.php index b815cde4..b2779906 100644 --- a/hwe/install_db.php +++ b/hwe/install_db.php @@ -24,12 +24,9 @@ if ($session->userGrade == 5) { - - - - + diff --git a/hwe/recent_map.php b/hwe/recent_map.php index 8583b35b..c09f537c 100644 --- a/hwe/recent_map.php +++ b/hwe/recent_map.php @@ -19,14 +19,12 @@ include "func.php"; 'serverNick' => DB::prefix(), 'serverID' => UniqueConst::$serverID ]) ?> - - - + \ No newline at end of file diff --git a/hwe/ts/Join.vue b/hwe/ts/PageJoin.vue similarity index 99% rename from hwe/ts/Join.vue rename to hwe/ts/PageJoin.vue index 85c39fa5..f8f351e5 100644 --- a/hwe/ts/Join.vue +++ b/hwe/ts/PageJoin.vue @@ -389,7 +389,7 @@ type APIArgs = { }; export default defineComponent({ - name: "Join", + name: "PageJoin", components: { TopBackBar, CTable, diff --git a/hwe/ts/NPCControl.vue b/hwe/ts/PageNPCControl.vue similarity index 99% rename from hwe/ts/NPCControl.vue rename to hwe/ts/PageNPCControl.vue index 1cedfde6..345cbc10 100644 --- a/hwe/ts/NPCControl.vue +++ b/hwe/ts/PageNPCControl.vue @@ -511,7 +511,7 @@ declare const lastSetters: { }; export default defineComponent({ - name: "NPCControl", + name: "PageNPCControl", components: { TopBackBar, NumberInputWithInfo, diff --git a/hwe/ts/PartialDipcenter.vue b/hwe/ts/PartialDipcenter.vue new file mode 100644 index 00000000..7982792d --- /dev/null +++ b/hwe/ts/PartialDipcenter.vue @@ -0,0 +1,53 @@ + + \ No newline at end of file diff --git a/hwe/ts/ReservedCommand.vue b/hwe/ts/PartialReservedCommand.vue similarity index 99% rename from hwe/ts/ReservedCommand.vue rename to hwe/ts/PartialReservedCommand.vue index 32da8014..35dab1eb 100644 --- a/hwe/ts/ReservedCommand.vue +++ b/hwe/ts/PartialReservedCommand.vue @@ -287,7 +287,7 @@ function isDropdownChildren(e?: Event): boolean { const searchModeKey = `sammo_${serverID}_searchMode`; export default defineComponent({ - name: "ReservedCommand", + name: "PartialReservedCommand", methods: { updateNow() { diff --git a/hwe/ts/build_exports.json b/hwe/ts/build_exports.json index ead7fb94..d681655e 100644 --- a/hwe/ts/build_exports.json +++ b/hwe/ts/build_exports.json @@ -13,7 +13,6 @@ "bossInfo": "bossInfo.ts", "myPage": "myPage.ts", "extExpandCity": "extExpandCity.ts", - "dipcenter": "dipcenter.ts", "diplomacy": "diplomacy.ts", "currentCity": "currentCity.ts", "hallOfFame": "hallOfFame.ts", @@ -27,6 +26,8 @@ "v_board": "v_board.ts", "v_NPCControl": "v_NPCControl.ts", "v_join": "v_join.ts", - "v_main": "v_main.ts" + "v_main": "v_main.ts", + "v_dipcenter": "v_dipcenter.ts" + } } \ No newline at end of file diff --git a/hwe/ts/components/BoardArticle.vue b/hwe/ts/components/BoardArticle.vue index 56b6bb14..1ce03eb8 100644 --- a/hwe/ts/components/BoardArticle.vue +++ b/hwe/ts/components/BoardArticle.vue @@ -50,7 +50,7 @@ \ No newline at end of file diff --git a/hwe/ts/components/TipTap.vue b/hwe/ts/components/TipTap.vue new file mode 100644 index 00000000..7042cb50 --- /dev/null +++ b/hwe/ts/components/TipTap.vue @@ -0,0 +1,133 @@ + + + \ No newline at end of file diff --git a/package.json b/package.json index 2d370889..0ace3edf 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,14 @@ "license": "MIT", "type": "module", "dependencies": { + "@tiptap/extension-image": "^2.0.0-beta.24", + "@tiptap/extension-link": "^2.0.0-beta.33", + "@tiptap/starter-kit": "^2.0.0-beta.156", + "@tiptap/vue-3": "^2.0.0-beta.83", "@types/bootstrap": "^5.1.6", "@types/downloadjs": "^1.4.2", "@types/linkifyjs": "^2.1.4", + "@types/quill": "^2.0.9", "@types/select2": "^4.0.54", "@vueup/vue-quill": "^1.0.0-beta.7", "async-validator": "^4.0.7", From 2c3a9b93c738c75776a6a498814d9289c4c36f7f Mon Sep 17 00:00:00 2001 From: hide_d Date: Mon, 13 Dec 2021 03:24:14 +0900 Subject: [PATCH 08/11] =?UTF-8?q?feat(WIP):=20=EC=83=88=20=EC=97=90?= =?UTF-8?q?=EB=94=94=ED=84=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/PartialDipcenter.vue | 2 +- hwe/ts/components/TipTap.vue | 130 +++++++++++++++++++++++++++++----- hwe/ts/tiptap-ext/FontSize.ts | 70 ++++++++++++++++++ hwe/ts/v_dipcenter.ts | 1 - package.json | 3 + 5 files changed, 187 insertions(+), 19 deletions(-) create mode 100644 hwe/ts/tiptap-ext/FontSize.ts diff --git a/hwe/ts/PartialDipcenter.vue b/hwe/ts/PartialDipcenter.vue index ae94abdd..3bfbf963 100644 --- a/hwe/ts/PartialDipcenter.vue +++ b/hwe/ts/PartialDipcenter.vue @@ -49,7 +49,7 @@ import "@scss/dipcenter.scss"; import "@scss/common_legacy.scss"; import TipTap from "./components/TipTap.vue"; -import { defineComponent, reactive, ref } from "vue"; +import { defineComponent } from "vue"; import { sammoAPI } from "./util/sammoAPI"; import { isString } from "lodash"; declare const editable: boolean; diff --git a/hwe/ts/components/TipTap.vue b/hwe/ts/components/TipTap.vue index 7042cb50..c02fbb17 100644 --- a/hwe/ts/components/TipTap.vue +++ b/hwe/ts/components/TipTap.vue @@ -1,33 +1,75 @@