Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
921ba6811d | ||
|
|
906dd241b4 | ||
|
|
3f0cd2ad64 | ||
|
|
41420d1954 | ||
|
|
6e5a72b170 | ||
|
|
4b19e6aec8 | ||
|
|
58572cbc36 | ||
|
|
096d5766bf | ||
|
|
f5c5b56492 | ||
|
|
69c69d63e6 | ||
|
|
3fd8b21867 | ||
|
|
8660e8cd85 | ||
|
|
8458f725f2 | ||
|
|
366678c965 | ||
|
|
336b5668db | ||
|
|
55886269ea | ||
|
|
0b3698595b | ||
|
|
05e43a39db | ||
|
|
5737ad3db2 | ||
|
|
4ac174eb9a | ||
|
|
895eec10b4 | ||
|
|
e0d891e89a | ||
|
|
adf7734b85 | ||
|
|
5362be9c21 | ||
|
|
847ece52f2 | ||
|
|
851c59d22c | ||
|
|
0669534bba | ||
|
|
05db47e62a | ||
|
|
4a0e608d1c | ||
|
|
45fe73af86 | ||
|
|
4d9fcd657f | ||
|
|
a057deb0fe | ||
|
|
4766210a7d | ||
|
|
fd26aae6d3 | ||
|
|
c5c092cc8e | ||
|
|
58c0a21d90 | ||
|
|
8dc567f966 | ||
|
|
942b2752f5 | ||
|
|
b9259353f4 | ||
|
|
86c614dd40 | ||
|
|
1a010a16a9 | ||
|
|
d5b5726b1e | ||
|
|
d06f3b6bdf | ||
|
|
97a28f716c | ||
|
|
f54bdfcea0 | ||
|
|
5958c4b0ba | ||
|
|
7c3db881c7 | ||
|
|
51ee2e1b2c | ||
|
|
baa813004b | ||
|
|
86b5269d3d | ||
|
|
860e6dacac | ||
|
|
22025bd89e | ||
|
|
ed9301455d | ||
|
|
35df84e059 | ||
|
|
62deebf310 | ||
|
|
7ed4bd5c01 | ||
|
|
c8eb9332b4 | ||
|
|
1df55f9168 | ||
|
|
b726c6aa96 | ||
|
|
0a71962652 | ||
|
|
160946ef74 | ||
|
|
1dc67317dc | ||
|
|
08f4a2e8bf | ||
|
|
11ffdaa8f7 | ||
|
|
0f853303a4 | ||
|
|
d225eb9b16 | ||
|
|
d926e4b8bc | ||
|
|
3e2df1d4d8 | ||
|
|
d670dbf081 | ||
|
|
f510a312e3 | ||
|
|
19c44e3d31 | ||
|
|
d0848aee67 | ||
|
|
f4b4b6811c | ||
|
|
fecb3f1f7b | ||
|
|
4c924c0763 | ||
|
|
f1e8d70554 | ||
|
|
7d11bc152e | ||
|
|
fdf0a3135a | ||
|
|
3a1a455c48 | ||
|
|
3a786e835b | ||
|
|
c70181132f | ||
|
|
538615a1f5 | ||
|
|
aa20a60a1c | ||
|
|
69fa1dac6c | ||
|
|
3ab349af6e | ||
|
|
97ac7deb2f | ||
|
|
3230cafb9f | ||
|
|
394284d8de | ||
|
|
6323b174c6 | ||
|
|
3d3e0e5139 | ||
|
|
ffc7d4bacc | ||
|
|
598236a1d2 | ||
|
|
69207519bd | ||
|
|
022eb1012f | ||
|
|
0a9c59f91e | ||
|
|
7ebb22b892 | ||
|
|
3dc7fc6f14 | ||
|
|
90dea7517b | ||
|
|
eae48f9564 | ||
|
|
dd7afba5f5 | ||
|
|
73357b6777 | ||
|
|
53df6bbcc6 | ||
|
|
9871559227 | ||
|
|
9cbead1ddc | ||
|
|
6402028c17 | ||
|
|
76bd65cf53 | ||
|
|
6e4113de11 | ||
|
|
12f37f76c7 | ||
|
|
acd77b2c0a | ||
|
|
f4fb4ec00d | ||
|
|
46ae4669ea | ||
|
|
67b2dbfe98 | ||
|
|
4f3b39fbfa | ||
|
|
a28fc52309 | ||
|
|
d5f0d60794 | ||
|
|
72e65587df | ||
|
|
b4d4d90784 | ||
|
|
3f81fb759d | ||
|
|
d995b39e02 | ||
|
|
3bd09a1aa4 | ||
|
|
a6ff951c98 | ||
|
|
604b1557e8 | ||
|
|
279bd5c71a | ||
|
|
97dfb02ab6 | ||
|
|
32c7b02303 | ||
|
|
e135835e61 | ||
|
|
7ed9a8075c | ||
|
|
ead8110fb4 | ||
|
|
586b1b6c15 | ||
|
|
e1727c8d80 | ||
|
|
7bd8a7ff35 | ||
|
|
de48651ae7 | ||
|
|
9902e07be0 | ||
|
|
5e4b38895e | ||
|
|
38bbbf261a | ||
|
|
def0a52578 | ||
|
|
4f1f87bda0 | ||
|
|
15f9faa2fa | ||
|
|
7257491d8b | ||
|
|
c19b2a9ebe | ||
|
|
54e7fd0293 | ||
|
|
21f3a2082b | ||
|
|
f647eb5a7b | ||
|
|
d7b1db0081 | ||
|
|
11511316d1 | ||
|
|
95a93c2c44 | ||
|
|
815ce10c25 | ||
|
|
5f13bfe8a1 | ||
|
|
5cd494c00a | ||
|
|
5a0a8bedc1 | ||
|
|
3b9884160b | ||
|
|
5b2b01328a | ||
|
|
e5b51dcd16 | ||
|
|
4d8b816acf | ||
|
|
fa109c1b0b | ||
|
|
b987fce627 | ||
|
|
b072cc3266 | ||
|
|
366b40ea90 | ||
|
|
3d3daa205d | ||
|
|
665ebbd11a | ||
|
|
52a5a7697d | ||
|
|
97a38d516a | ||
|
|
e89475bf52 | ||
|
|
90a78b05ce | ||
|
|
8c6eff15f0 | ||
|
|
824c58b391 | ||
|
|
b97500430c | ||
|
|
bacafc67c9 | ||
|
|
f23ebcdc2d | ||
|
|
edbe8e3561 | ||
|
|
05d1e33b30 | ||
|
|
96b60ce0f5 | ||
|
|
6174bc7ffd | ||
|
|
3bd022e03a | ||
|
|
b0cc5b0b60 | ||
|
|
5493f70458 | ||
|
|
323b3d9d16 | ||
|
|
1b0742ad2a | ||
|
|
2eb7217f49 | ||
|
|
b6f5a286b0 | ||
|
|
66c496fb10 | ||
|
|
56ca588c1e | ||
|
|
e2b09caff3 | ||
|
|
a5b4a4c59f | ||
|
|
a70312a90a | ||
|
|
6c6a3238cb | ||
|
|
9af10d4bcb | ||
|
|
f6e1b4611e | ||
|
|
7bc762d357 | ||
|
|
8edf1da92b | ||
|
|
a18baf2ffe | ||
|
|
2d41bf8f2f | ||
|
|
334778bdae | ||
|
|
1b46a06eee | ||
|
|
1e860e9443 | ||
|
|
0b973672d2 | ||
|
|
868ed85c7f | ||
|
|
6f2a24ec66 | ||
|
|
e5d5899a15 | ||
|
|
243473a97d | ||
|
|
28d71b8ce2 | ||
|
|
1acbf90261 | ||
|
|
94229f84a3 | ||
|
|
cead74238a | ||
|
|
73c60ea94c | ||
|
|
73638da4db | ||
|
|
bc218b73e1 | ||
|
|
aac6632f4b | ||
|
|
fdba3fdc74 | ||
|
|
21bb61ec82 | ||
|
|
ce1203d64d | ||
|
|
56daf15c8e | ||
|
|
96faa924d8 | ||
|
|
ee8854451c | ||
|
|
0975e925a9 | ||
|
|
83d6a2169b | ||
|
|
21e7a4d966 | ||
|
|
404cd24855 | ||
|
|
b4ad72ee67 | ||
|
|
bea628b619 | ||
|
|
3637e54982 | ||
|
|
e0d1a0a612 | ||
|
|
3040996671 | ||
|
|
dd830e7500 | ||
|
|
d2dfe2c418 | ||
|
|
139fb6b6e0 | ||
|
|
c4f6976c42 | ||
|
|
ab428fc104 | ||
|
|
aa97f78acd | ||
|
|
dbce900aeb | ||
|
|
30b382e2e7 | ||
|
|
433c4abb86 | ||
|
|
64404e4092 | ||
|
|
08d483af8a | ||
|
|
fa19c17941 | ||
|
|
c896a999ad | ||
|
|
f9bca935ac | ||
|
|
7abf274d89 | ||
|
|
e2ad417306 | ||
|
|
2ea9655f6b | ||
|
|
f450d5d9de | ||
|
|
f8f4b73a09 | ||
|
|
926d96732d | ||
|
|
167113d6a3 | ||
|
|
911cb614a5 | ||
|
|
7a939b7024 | ||
|
|
6e57a60997 | ||
|
|
9f1151e699 | ||
|
|
3fbe1fb63d | ||
|
|
d4906eec5a | ||
|
|
ebe0663e74 | ||
|
|
04c89b9711 | ||
|
|
4f2bc874e5 | ||
|
|
316ac5c3c8 | ||
|
|
7882aa667e | ||
|
|
8b8d5eecbf | ||
|
|
65b76643ee |
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"useBuiltIns": "usage",
|
||||
"corejs": 3,
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"lodash"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: "vue-eslint-parser",
|
||||
parserOptions: {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
ignorePatterns: ['*.test.ts', '.eslintrc.cjs', 'webpack.config.cjs', '*.js'],
|
||||
overrides: [{
|
||||
files: ['*.ts', '*.tsx', "*.vue"],
|
||||
}],
|
||||
plugins: [
|
||||
"@typescript-eslint",
|
||||
|
||||
],
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
'plugin:vue/essential',
|
||||
'@vue/typescript',
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
rules: {
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
"vue/no-multiple-template-root": "off",
|
||||
"vue/no-v-for-template-key": "off",
|
||||
}
|
||||
}
|
||||
+15
-1
@@ -4,7 +4,8 @@
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
|
||||
/node_modules
|
||||
package-lock.json
|
||||
|
||||
|
||||
# 체섭 ignore
|
||||
@@ -32,9 +33,17 @@ d_pic/*.png
|
||||
d_pic/*.webp
|
||||
d_pic/uploaded_image
|
||||
|
||||
*/dist_misc/*
|
||||
*/dist_js/*
|
||||
*/dist_css/*
|
||||
/dist_misc/*
|
||||
/dist_js/*
|
||||
/dist_css/*
|
||||
|
||||
d_setting/*.php
|
||||
*/d_setting/*.php
|
||||
*/d_setting/templates/*.php
|
||||
!*.orig.php
|
||||
|
||||
*/data/file_cache
|
||||
|
||||
@@ -51,3 +60,8 @@ test.php
|
||||
phpinfo.php
|
||||
vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/*
|
||||
*.sqlite3
|
||||
|
||||
ingame/js/*
|
||||
ingame/css/*
|
||||
gateway/js/*
|
||||
gateway/css/*
|
||||
|
||||
+15
-5
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
return [
|
||||
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`,
|
||||
// `'7.4'`, `null`.
|
||||
// `'7.4'`, `'8.0'`, `'8.1'`, `null`.
|
||||
// If this is set to `null`,
|
||||
// then Phan assumes the PHP version which is closest to the minor version
|
||||
// of the php executable used to execute Phan.
|
||||
@@ -15,15 +15,14 @@ return [
|
||||
// Note that the **only** effect of choosing `'5.6'` is to infer
|
||||
// that functions removed in php 7.0 exist.
|
||||
// (See `backward_compatibility_checks` for additional options)
|
||||
"target_php_version" => '7.3',
|
||||
'backward_compatibility_checks ' => false,
|
||||
'minimum_severity'=>\Phan\Issue::SEVERITY_NORMAL,
|
||||
"target_php_version" => '7.4',
|
||||
'backward_compatibility_checks ' => true,
|
||||
'minimum_severity'=>\Phan\Issue::SEVERITY_CRITICAL,
|
||||
|
||||
'file_list' => [
|
||||
'f_config/config.php',
|
||||
'hwe/a_bestGeneral.php',
|
||||
'hwe/a_emperior.php',
|
||||
'hwe/a_emperior2.php',
|
||||
'hwe/a_emperior_detail.php',
|
||||
'hwe/a_genList.php',
|
||||
'hwe/a_hallOfFame.php',
|
||||
@@ -42,11 +41,13 @@ return [
|
||||
'hwe/b_dipcenter.php',
|
||||
'hwe/b_diplomacy.php',
|
||||
'hwe/b_genList.php',
|
||||
'hwe/v_inheritPoint.php',
|
||||
'hwe/b_myBossInfo.php',
|
||||
'hwe/b_myCityInfo.php',
|
||||
'hwe/b_myGenInfo.php',
|
||||
'hwe/b_myKingdomInfo.php',
|
||||
'hwe/b_myPage.php',
|
||||
'hwe/b_npc_control.php',
|
||||
'hwe/b_processing.php',
|
||||
'hwe/b_tournament.php',
|
||||
'hwe/b_troop.php',
|
||||
@@ -87,14 +88,18 @@ return [
|
||||
'hwe/j_diplomacy_respond_letter.php',
|
||||
'hwe/j_diplomacy_rollback_letter.php',
|
||||
'hwe/j_diplomacy_send_letter.php',
|
||||
'hwe/j_export_simulator_object.php',
|
||||
'hwe/j_general_log_old.php',
|
||||
'hwe/j_general_set_permission.php',
|
||||
'hwe/j_general_turn.php',
|
||||
'hwe/j_getChiefTurn.php',
|
||||
'hwe/j_get_basic_general_list.php',
|
||||
'hwe/j_get_city_list.php',
|
||||
'hwe/j_get_general_list.php',
|
||||
'hwe/j_get_nation_general_list.php',
|
||||
'hwe/j_get_reserved_command.php',
|
||||
'hwe/j_get_select_npc_token.php',
|
||||
'hwe/j_get_select_pool.php',
|
||||
'hwe/j_image_upload.php',
|
||||
'hwe/j_install.php',
|
||||
'hwe/j_install_db.php',
|
||||
@@ -108,15 +113,20 @@ return [
|
||||
'hwe/j_msg_get_recent.php',
|
||||
'hwe/j_msg_submit.php',
|
||||
'hwe/j_myBossInfo.php',
|
||||
'hwe/j_raise_event.php',
|
||||
'hwe/j_select_npc.php',
|
||||
'hwe/j_select_picked_general.php',
|
||||
'hwe/j_server_basic_info.php',
|
||||
'hwe/j_set_chief_command.php',
|
||||
'hwe/j_set_general_command.php',
|
||||
'hwe/j_set_my_setting.php',
|
||||
'hwe/j_set_npc_control.php',
|
||||
'hwe/j_simulate_battle.php',
|
||||
'hwe/j_troop.php',
|
||||
'hwe/j_vacation.php',
|
||||
'hwe/lib.php',
|
||||
'hwe/process_war.php',
|
||||
'hwe/select_general_from_pool.php',
|
||||
'hwe/select_npc.php',
|
||||
'hwe/t_board.php',
|
||||
'hwe/t_diplomacy.php',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2020 Hide_D, 62che
|
||||
Copyright (c) 2021 Hide_D, 62che
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -5,22 +5,24 @@
|
||||
|
||||
## 요구사항
|
||||
|
||||
* Apache2
|
||||
* <code>mpm_event</code> 권장
|
||||
* PHP 7.3 이상
|
||||
* <code>php-fpm</code> 권장
|
||||
* Apache2 또는 nginx
|
||||
* Apache2인 경우 `mpm_event` 권장
|
||||
* PHP 8.0 이상
|
||||
* `php-fpm` 권장
|
||||
* php에서 curl, pdo-sqlite을 실행가능해야 합니다.
|
||||
* mysqli, mysqlnd
|
||||
* gd
|
||||
* mbstring
|
||||
* NodeJS 14 이상
|
||||
* 내부의 git을 통해 upgrade 때 `webpack build` 용도로 필요합니다.
|
||||
* MariaDB 10.2.1 이상
|
||||
* 현재 MySQL은 지원하지 않습니다.
|
||||
* <code>git</code>
|
||||
* <code>curl</code>
|
||||
* `git`
|
||||
* `curl`
|
||||
|
||||
Linux는 Ubuntu 18.04, 20.04, Windows는 Windows 10에서 XAMPP, WSL2를 사용한 환경에서 테스트되었습니다.
|
||||
Linux는 Ubuntu 18.04, 20.04, Windows는 WSL2를 사용한 환경에서 테스트되었습니다.
|
||||
|
||||
Docker를 이용한 설치는 테스트버전만 제공됩니다.
|
||||
Docker를 이용한 설치도 제공하고 있습니다.
|
||||
|
||||
## Docker를 이용한 설치
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
require(__DIR__ . '/vendor/autoload.php');
|
||||
|
||||
|
||||
if (!class_exists('\\sammo\\RootDB')) {
|
||||
Json::dieWithReason('No DB');
|
||||
}
|
||||
|
||||
APIHelper::launch(dirname(__FILE__));
|
||||
+5
-3
@@ -8,7 +8,7 @@
|
||||
],
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "7.3"
|
||||
"php": "7.4"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
@@ -26,9 +26,11 @@
|
||||
"ezyang/htmlpurifier": "^4.10",
|
||||
"xemlock/htmlpurifier-html5": "^0.1.7",
|
||||
"catfan/medoo": "^1.5",
|
||||
"phan/phan": "^2.7",
|
||||
"phan/phan": "*",
|
||||
"erusev/parsedown-extra": "^0.8.1",
|
||||
"nette/caching": "^3.0"
|
||||
"nette/caching": "^3.0",
|
||||
"illuminate/database": "^8.61",
|
||||
"illuminate/events": "^8.61"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Generated
+2159
-295
File diff suppressed because it is too large
Load Diff
+70
-1
@@ -128,5 +128,74 @@ input::-webkit-input-placeholder {
|
||||
}
|
||||
|
||||
#running_map {
|
||||
margin-top: 20px;
|
||||
border: none;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
|
||||
#map-subframe {
|
||||
display: none;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width : 360px) {
|
||||
#map-subframe {
|
||||
display: block;
|
||||
transform: scale(calc(330 / 700));
|
||||
transform-origin: 350px 0px;
|
||||
margin-bottom: -400px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (min-width : 440px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(410 / 700));
|
||||
margin-bottom: -300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width : 480px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(450 / 700));
|
||||
margin-bottom: -250px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (min-width : 520px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(490 / 700));
|
||||
margin-bottom: -200px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width : 576px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(546 / 700));
|
||||
margin-bottom: -150px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width : 640px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(600/700));
|
||||
margin-bottom: -100px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (min-width : 700px) {
|
||||
#map-subframe {
|
||||
transform: scale(calc(670 / 700));
|
||||
margin-bottom: -20px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (min-width : 730px) {
|
||||
#map-subframe {
|
||||
transform: none;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
+1
-1
@@ -117,7 +117,7 @@ function logError(string $err, string $errstr, string $errpath, array $trace)
|
||||
]);
|
||||
}
|
||||
|
||||
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext)
|
||||
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext=null)
|
||||
{
|
||||
if (!(error_reporting() & $errno)) {
|
||||
// This error code is not included in error_reporting, so let it fall
|
||||
|
||||
+22
-25
@@ -11,12 +11,9 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>설치</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/sha512.min.js')?>
|
||||
<?=WebUtil::printJS('../js/common.js')?>
|
||||
<?=WebUtil::printJS('../js/install.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?=WebUtil::printJS('../dist_js/vendors.js') ?>
|
||||
<?=WebUtil::printJS('../dist_js/install.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../css/install.css')?>
|
||||
</head>
|
||||
@@ -29,13 +26,13 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="card" id="db_form_card" style="display:none">
|
||||
<h3 class="card-header">
|
||||
설치(DB 설정)
|
||||
</h3>
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<form id="db_form" method="post" action="#">
|
||||
<div class="form-group row">
|
||||
<label for="db_host" class="col-sm-4 col-form-label">DB호스트</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_host" id="db_host"
|
||||
<input type="text" class="form-control" name="db_host" id="db_host"
|
||||
placeholder="호스트" value="localhost" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,11 +40,11 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="db_port" class="col-sm-4 col-form-label">DB포트</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_port" id="db_port"
|
||||
<input type="text" class="form-control" name="db_port" id="db_port"
|
||||
placeholder="접속 포트" value="3306" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_id" class="col-sm-4 col-form-label">DB계정명</label>
|
||||
<div class="col-sm-8">
|
||||
@@ -55,11 +52,11 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_pw" class="col-sm-4 col-form-label">DB비밀번호</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="password" class="form-control" name="db_pw" id="db_pw"
|
||||
<input type="password" class="form-control" name="db_pw" id="db_pw"
|
||||
placeholder="DB비밀번호"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,7 +64,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="db_name" class="col-sm-4 col-form-label">DB명</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="db_name" id="db_name"
|
||||
<input type="text" class="form-control" name="db_name" id="db_name"
|
||||
placeholder="DB명(예:sammo)"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,7 +72,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="serv_host" class="col-sm-4 col-form-label">접속 경로</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="serv_host" id="serv_host"
|
||||
<input type="text" class="form-control" name="serv_host" id="serv_host"
|
||||
placeholder="접속경로(예:http://www.example.com)"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -83,7 +80,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="shared_icon_path" class="col-sm-4 col-form-label">공용 아이콘 주소</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="shared_icon_path" id="shared_icon_path"
|
||||
<input type="text" class="form-control" name="shared_icon_path" id="shared_icon_path"
|
||||
placeholder="공용 아이콘 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
|
||||
value="../image/icons" />
|
||||
</div>
|
||||
@@ -92,7 +89,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="game_image_path" class="col-sm-4 col-form-label">게임 이미지 주소</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="game_image_path" id="game_image_path"
|
||||
<input type="text" class="form-control" name="game_image_path" id="game_image_path"
|
||||
placeholder="게임 이미지 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
|
||||
value="../image/game" />
|
||||
</div>
|
||||
@@ -101,7 +98,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="image_request_key" class="col-sm-4 col-form-label">이미지 갱신 키</label>
|
||||
<div class="input-group col-sm-8">
|
||||
<input type="text" class="form-control" name="image_request_key" id="image_request_key"
|
||||
<input type="text" class="form-control" name="image_request_key" id="image_request_key"
|
||||
placeholder="이미지 서버의 hook/HashKey.php의 값과 동일하게"
|
||||
value="" />
|
||||
<div class="input-group-append">
|
||||
@@ -115,7 +112,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="kakao_rest_key" class="col-sm-4 col-form-label">카카오 API Rest Key</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="kakao_rest_key" id="kakao_rest_key"
|
||||
<input type="text" class="form-control" name="kakao_rest_key" id="kakao_rest_key"
|
||||
placeholder="카카오톡 API의 Rest Key"
|
||||
value="" />
|
||||
</div>
|
||||
@@ -124,7 +121,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="kakao_admin_key" class="col-sm-4 col-form-label">카카오 API Admin Key</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" class="form-control" name="kakao_admin_key" id="kakao_admin_key"
|
||||
<input type="text" class="form-control" name="kakao_admin_key" id="kakao_admin_key"
|
||||
placeholder="카카오톡 API의 Admin Key"
|
||||
value="" />
|
||||
</div>
|
||||
@@ -133,7 +130,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-4"></div>
|
||||
<div class="col-sm-8">
|
||||
<button type="submit"
|
||||
<button type="submit"
|
||||
class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,7 +141,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="card" id="admin_form_card" style="display:none">
|
||||
<h3 class="card-header">
|
||||
설치(관리자 생성)
|
||||
</h3>
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<form id="admin_form" method="post" action="#">
|
||||
<div class="form-group row">
|
||||
@@ -155,11 +152,11 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="password" class="col-sm-3 col-form-label">비밀번호</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="password" class="form-control" name="password" id="password"
|
||||
<input type="password" class="form-control" name="password" id="password"
|
||||
placeholder="비밀번호"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -167,7 +164,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="password" class="form-control" name="confirm_password" id="confirm_password"
|
||||
<input type="password" class="form-control" name="confirm_password" id="confirm_password"
|
||||
placeholder="비밀번호 확인"/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -175,7 +172,7 @@ require(__DIR__.'/../vendor/autoload.php');
|
||||
<div class="form-group row">
|
||||
<label for="nickname" class="col-sm-3 col-form-label">닉네임</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control" name="nickname" id="nickname"
|
||||
<input type="text" class="form-control" name="nickname" id="nickname"
|
||||
placeholder="닉네임" value="운영자"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace kakao;
|
||||
|
||||
// @suppress PhanRedefineClass
|
||||
class KakaoKey{
|
||||
const REST_KEY = '_tK_REST_API_KEY_';
|
||||
const ADMIN_KEY = '_tK_ADMIN_KEY_';
|
||||
|
||||
@@ -2,9 +2,15 @@
|
||||
|
||||
namespace sammo;
|
||||
|
||||
//https://hub.packtpub.com/eloquent-without-laravel/
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
class RootDB
|
||||
{
|
||||
private static $uDB = null;
|
||||
private static ?Capsule $uIlluminate = null;
|
||||
|
||||
private static $host = '_tK_host_';
|
||||
private static $user = '_tK_user_';
|
||||
@@ -12,6 +18,8 @@ class RootDB
|
||||
private static $dbName = '_tK_dbName_';
|
||||
private static $port = _tK_port_;
|
||||
private static $encoding = 'utf8mb4';
|
||||
private static $collation = 'utf8mb4_general_ci';
|
||||
|
||||
|
||||
private static $globalSalt = '_tK_globalSalt_';
|
||||
|
||||
@@ -19,6 +27,29 @@ class RootDB
|
||||
{
|
||||
}
|
||||
|
||||
public static function illuminate(): Capsule
|
||||
{
|
||||
if(self::$uIlluminate !== null){
|
||||
return self::$uIlluminate;
|
||||
}
|
||||
$capsule = new Capsule;
|
||||
|
||||
$capsule->addConnection([
|
||||
'driver' => 'mysql',
|
||||
'host' => self::$host,
|
||||
'database' => self::$dbName,
|
||||
'username' => self::$user,
|
||||
'password' => self::$password,
|
||||
'charset' => self::$encoding,
|
||||
'collation' => self::$collation,
|
||||
], 'root');
|
||||
|
||||
$capsule->setEventDispatcher(new Dispatcher(new Container));
|
||||
$capsule->bootEloquent();
|
||||
self::$uIlluminate = $capsule;
|
||||
return $capsule;
|
||||
}
|
||||
|
||||
/**
|
||||
* DB 객체 생성
|
||||
*
|
||||
|
||||
@@ -6,38 +6,33 @@
|
||||
|
||||
.img_back {background-image:url('_tK_gameImagePath_/back.jpg'); }
|
||||
|
||||
/* 레거시. */
|
||||
#bg0 { background-image:url('_tK_gameImagePath_/back_walnut.jpg'); }
|
||||
#bg1 { background-image:url('_tK_gameImagePath_/back_green.jpg'); }
|
||||
#bg2 { background-image:url('_tK_gameImagePath_/back_blue.jpg'); }
|
||||
|
||||
.map_detail .map_title{
|
||||
background:
|
||||
url('_tK_gameImagePath_/ltitle.jpg') no-repeat left,
|
||||
url('_tK_gameImagePath_/ltitle.jpg') no-repeat left,
|
||||
url('_tK_gameImagePath_/rtitle.jpg') no-repeat right;
|
||||
}
|
||||
|
||||
.map_detail.map_spring .map_title_text{
|
||||
background:
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/spring.gif') no-repeat right;
|
||||
}
|
||||
|
||||
.map_detail.map_summer .map_title_text{
|
||||
background:
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/summer.gif') no-repeat right;
|
||||
}
|
||||
|
||||
.map_detail.map_fall .map_title_text{
|
||||
background:
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/fall.gif') no-repeat right;
|
||||
}
|
||||
|
||||
.map_detail.map_winter .map_title_text{
|
||||
background:
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/ad.gif') no-repeat left,
|
||||
url('_tK_gameImagePath_/winter.gif') no-repeat right;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -99,7 +99,7 @@ $sel2[$type2] = "selected";
|
||||
</table>
|
||||
|
||||
<table align=center width=1600 class="tb_layout bg0">
|
||||
<tr id=bg1>
|
||||
<tr class='bg1'>
|
||||
<td align=center>국명</td>
|
||||
<td align=center>접률</td>
|
||||
<td align=center>단접</td>
|
||||
@@ -278,7 +278,7 @@ from city where nation=%i', $nation['nation']);
|
||||
</table>
|
||||
|
||||
<table align=center width=1760 class="tb_layout bg0">
|
||||
<tr id=bg1>
|
||||
<tr class='bg1'>
|
||||
<td width=30 align=center>년</td>
|
||||
<td width=30 align=center>월</td>
|
||||
<td width=50 align=center>국가수</td>
|
||||
|
||||
+9
-9
@@ -52,9 +52,9 @@ if ($reqArgType === 0) {
|
||||
$generalBasicList = $db->query('SELECT no, name, nation, npc, turntime, %b FROM general', $reqQueryType);
|
||||
} else if ($reqArgType === 2) {
|
||||
$generalBasicList = $db->query(
|
||||
'SELECT no, name, nation, npc, turntime, value as %b
|
||||
FROM general LEFT JOIN rank_data
|
||||
ON general.no = rank_data.general_id
|
||||
'SELECT no, name, nation, npc, turntime, value as %b
|
||||
FROM general LEFT JOIN rank_data
|
||||
ON general.no = rank_data.general_id
|
||||
WHERE rank_data.type = %s',
|
||||
$reqQueryType,
|
||||
$reqQueryType
|
||||
@@ -117,10 +117,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</table>
|
||||
<table width=1000 align=center class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=50% align=center id=bg1>
|
||||
<td width=50% align=center class='bg1'>
|
||||
<font color=skyblue size=3>장 수 정 보</font>
|
||||
</td>
|
||||
<td width=50% align=center id=bg1>
|
||||
<td width=50% align=center class='bg1'>
|
||||
<font color=orange size=3>-</font>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -133,10 +133,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>
|
||||
<td align=center class='bg1'>
|
||||
<font color=skyblue size=3>개인 기록</font>
|
||||
</td>
|
||||
<td align=center id=bg1>
|
||||
<td align=center class='bg1'>
|
||||
<font color=orange size=3>전투 기록</font>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -149,10 +149,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>
|
||||
<td align=center class='bg1'>
|
||||
<font color=skyblue size=3>장수 열전</font>
|
||||
</td>
|
||||
<td align=center id=bg1>
|
||||
<td align=center class='bg1'>
|
||||
<font color=orange size=3>전투 결과</font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+4
-4
@@ -49,10 +49,10 @@ $sel[$type] = "selected";
|
||||
<table width=1000 align=center class='tb_layout bg0'>
|
||||
<tr><td colspan=9 align=center bgcolor=blue>외 교 관 계</td></tr>
|
||||
<tr>
|
||||
<td width=130 align=center id=bg1>국 가 명</td>
|
||||
<td width=130 align=center id=bg1>국 가 명</td>
|
||||
<td width=80 align=center id=bg1>상 태</td>
|
||||
<td width=60 align=center id=bg1>기 간</td>
|
||||
<td width=130 align=center class='bg1'>국 가 명</td>
|
||||
<td width=130 align=center class='bg1'>국 가 명</td>
|
||||
<td width=80 align=center class='bg1'>상 태</td>
|
||||
<td width=60 align=center class='bg1'>기 간</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
|
||||
@@ -24,3 +24,7 @@ foreach ($db->queryFirstColumn(
|
||||
) as $generalNo) {
|
||||
CheckHall($generalNo);
|
||||
}
|
||||
|
||||
foreach(General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc = 0')) as $genObj){
|
||||
$genObj->mergeTotalInheritancePoint();
|
||||
}
|
||||
+16
-18
@@ -29,10 +29,9 @@ $templates = new \League\Plates\Engine(__DIR__.'/templates');
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/hallOfFame.css')?>
|
||||
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -74,7 +73,7 @@ $types = [
|
||||
}
|
||||
$v['nationName'] = '???';
|
||||
$v['pictureFullPath'] = GetImageURL(0)."/default.jpg";
|
||||
$v['name'] = '???';
|
||||
$v['name'] = '???';
|
||||
$v['ownerName'] = null;
|
||||
$v['bgColor'] = GameConst::$basecolor4;
|
||||
$v['fgColor'] = newColor($v['bgColor']);
|
||||
@@ -123,9 +122,9 @@ $types = [
|
||||
$v['value'] = 0;
|
||||
}
|
||||
else{
|
||||
$v['value'] = $v['ttw']/max(1, $totalCnt);
|
||||
$v['value'] = $v['ttw']/max(1, $totalCnt);
|
||||
}
|
||||
return $v;
|
||||
return $v;
|
||||
}],
|
||||
["통 솔 전 승 률", "percent", function($v){
|
||||
$totalCnt = $v['tlw']+$v['tld']+$v['tll'];
|
||||
@@ -135,7 +134,7 @@ $types = [
|
||||
else{
|
||||
$v['value'] = $v['tlw']/max(1, $totalCnt);
|
||||
}
|
||||
return $v;
|
||||
return $v;
|
||||
}],
|
||||
["일 기 토 승 률", "percent", function($v){
|
||||
$totalCnt = $v['tsw']+$v['tsd']+$v['tsl'];
|
||||
@@ -155,7 +154,7 @@ $types = [
|
||||
else{
|
||||
$v['value'] = $v['tiw']/max(1, $totalCnt);
|
||||
}
|
||||
|
||||
|
||||
return $v;
|
||||
}],
|
||||
["베 팅 투 자 액", "int", function($v){$v['value'] = $v['betgold']; return $v; }],
|
||||
@@ -174,17 +173,17 @@ $types = [
|
||||
|
||||
$generals = [];
|
||||
foreach($db->query(
|
||||
"SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr,
|
||||
"SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr,
|
||||
experience, dedication,
|
||||
dex1, dex2, dex3, dex4, dex5,
|
||||
horse, weapon, book, item
|
||||
dex1, dex2, dex3, dex4, dex5,
|
||||
horse, weapon, book, item
|
||||
FROM general WHERE %l", $btn == "NPC 보기"?"npc>=2":"npc<2") as $general
|
||||
){
|
||||
$generalID = $general['no'];
|
||||
$general['bgColor'] = $nationColor[$general['nation']]??GameConst::$basecolor4;
|
||||
$general['fgColor'] = newColor($general['bgColor']);
|
||||
$general['nationName'] = $nationName[$general['nation']];
|
||||
|
||||
|
||||
if(key_exists('picture', $general)){
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
|
||||
@@ -265,7 +264,7 @@ foreach($generals as $general){
|
||||
else{
|
||||
$itemOwners[$itemClassName] = [$general];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +279,7 @@ foreach(GameConst::$allItems as $itemType=>$itemList){
|
||||
continue;
|
||||
}
|
||||
$itemClass = buildItemClass($itemClassName);
|
||||
|
||||
|
||||
if($itemClass->isBuyable()){
|
||||
continue;
|
||||
}
|
||||
@@ -288,7 +287,7 @@ foreach(GameConst::$allItems as $itemType=>$itemList){
|
||||
$info = $itemClass->getInfo();
|
||||
$name = $itemClass->getName();
|
||||
|
||||
|
||||
|
||||
if($info){
|
||||
$name = $templates->render('tooltip', [
|
||||
'text'=>$name,
|
||||
@@ -323,7 +322,7 @@ foreach(GameConst::$allItems as $itemType=>$itemList){
|
||||
$itemRanker[] = $card;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo $templates->render('hallOfFrame', [
|
||||
'typeName'=>$itemNameType,
|
||||
'generals'=>$itemRanker
|
||||
@@ -337,4 +336,3 @@ foreach(GameConst::$allItems as $itemType=>$itemList){
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
+17
-17
@@ -16,9 +16,9 @@ increaseRefresh("왕조일람", 1);
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 왕조일람</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -70,9 +70,9 @@ foreach($emperiors as $emperior){
|
||||
<tr>
|
||||
<td bgcolor=skyblue align=center colspan=8>
|
||||
<font size=5><?=$emperior['phase']?></font>
|
||||
|
||||
|
||||
<a href="a_emperior_detail.php?select=<?=$emperior['no']?>"><button type='button'>자세히</button></a>
|
||||
|
||||
|
||||
<?php if($emperior['server_id']): ?>
|
||||
<a href="a_history.php?serverID=<?=$emperior['server_id']?>"><button type='button'>역사 보기</button></a>
|
||||
<?php endif ?>
|
||||
@@ -84,33 +84,33 @@ foreach($emperiors as $emperior){
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center width=80>국 력</td>
|
||||
<td class='bg1' align=center width=80>국 력</td>
|
||||
<td align=center width=170><?=$emperior['power']?></td>
|
||||
<td id=bg1 align=center width=80>장 수</td>
|
||||
<td class='bg1' align=center width=80>장 수</td>
|
||||
<td align=center width=170><?=$emperior['gennum']?></td>
|
||||
<td id=bg1 align=center width=80>속 령</td>
|
||||
<td class='bg1' align=center width=80>속 령</td>
|
||||
<td align=center width=170><?=$emperior['citynum']?></td>
|
||||
<td id=bg1 align=center width=80>성 향</td>
|
||||
<td class='bg1' align=center width=80>성 향</td>
|
||||
<td align=center width=170><?=$emperior['type']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>황 제</td>
|
||||
<td class='bg1' align=center>황 제</td>
|
||||
<td align=center><?=$emperior['l12name']?></td>
|
||||
<td id=bg1 align=center>승 상</td>
|
||||
<td class='bg1' align=center>승 상</td>
|
||||
<td align=center><?=$emperior['l11name']?></td>
|
||||
<td id=bg1 align=center>표 기 장 군</td>
|
||||
<td class='bg1' align=center>표 기 장 군</td>
|
||||
<td align=center><?=$emperior['l10name']?></td>
|
||||
<td id=bg1 align=center>사 공</td>
|
||||
<td class='bg1' align=center>사 공</td>
|
||||
<td align=center><?=$emperior['l9name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>거 기 장 군</td>
|
||||
<td class='bg1' align=center>거 기 장 군</td>
|
||||
<td align=center><?=$emperior['l8name']?></td>
|
||||
<td id=bg1 align=center>태 위</td>
|
||||
<td class='bg1' align=center>태 위</td>
|
||||
<td align=center><?=$emperior['l7name']?></td>
|
||||
<td id=bg1 align=center>위 장 군</td>
|
||||
<td class='bg1' align=center>위 장 군</td>
|
||||
<td align=center><?=$emperior['l6name']?></td>
|
||||
<td id=bg1 align=center>사 도</td>
|
||||
<td class='bg1' align=center>사 도</td>
|
||||
<td align=center><?=$emperior['l5name']?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
+28
-31
@@ -26,9 +26,6 @@ $serverID = $emperior['server_id']??($emperior['serverID']??null);
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 왕조일람</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -57,25 +54,25 @@ if($emperior):
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>국 가 수<br>(최종 / 최대)</td>
|
||||
<td class='bg1' width=98 align=center>국 가 수<br>(최종 / 최대)</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['nation_count']?></td>
|
||||
<td id=bg1 width=98 align=center>장 수 수<br>(최종 / 최대)</td>
|
||||
<td class='bg1' width=98 align=center>장 수 수<br>(최종 / 최대)</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['gen_count']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>등 장 국 가</td>
|
||||
<td class='bg1' align=center>등 장 국 가</td>
|
||||
<td colspan=5><?=$emperior['nation_name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>국가별 성향</td>
|
||||
<td class='bg1' align=center>국가별 성향</td>
|
||||
<td colspan=5><?=$emperior['nation_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 성 격</td>
|
||||
<td class='bg1' align=center>장 수 성 격</td>
|
||||
<td colspan=5><?=$emperior['personal_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 특 기</td>
|
||||
<td class='bg1' align=center>장 수 특 기</td>
|
||||
<td colspan=5><?=$emperior['special_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -84,75 +81,75 @@ if($emperior):
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>국 력</td>
|
||||
<td class='bg1' width=98 align=center>국 력</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['power']?></td>
|
||||
<td id=bg1 width=98 align=center>성 향</td>
|
||||
<td class='bg1' width=98 align=center>성 향</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['type']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>장 수</td>
|
||||
<td class='bg1' width=98 align=center>장 수</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['gennum']?></td>
|
||||
<td id=bg1 width=98 align=center>속 령</td>
|
||||
<td class='bg1' width=98 align=center>속 령</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['citynum']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>총 인 구</td>
|
||||
<td class='bg1' align=center>총 인 구</td>
|
||||
<td align=center colspan=2><?=$emperior['pop']?></td>
|
||||
<td id=bg1 align=center>인 구 율</td>
|
||||
<td class='bg1' align=center>인 구 율</td>
|
||||
<td align=center colspan=2><?=$emperior['poprate']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>국 고</td>
|
||||
<td class='bg1' align=center>국 고</td>
|
||||
<td align=center colspan=2><?=$emperior['gold']?></td>
|
||||
<td id=bg1 align=center>병 량</td>
|
||||
<td class='bg1' align=center>병 량</td>
|
||||
<td align=center colspan=2><?=$emperior['rice']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>황 제</td>
|
||||
<td class='bg1' align=center>황 제</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l12name']?></td>
|
||||
<td id=bg1 align=center>승 상</td>
|
||||
<td class='bg1' align=center>승 상</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l11name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>위 장 군</td>
|
||||
<td class='bg1' align=center>위 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l10name']?></td>
|
||||
<td id=bg1 align=center>사 공</td>
|
||||
<td class='bg1' align=center>사 공</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l9name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>표 기 장 군</td>
|
||||
<td class='bg1' align=center>표 기 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l8name']?></td>
|
||||
<td id=bg1 align=center>태 위</td>
|
||||
<td class='bg1' align=center>태 위</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l7name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>거 기 장 군</td>
|
||||
<td class='bg1' align=center>거 기 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l6name']?></td>
|
||||
<td id=bg1 align=center>사 도</td>
|
||||
<td class='bg1' align=center>사 도</td>
|
||||
<td width=64> </td>
|
||||
<td width=332><?=$emperior['l5name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>오 호 장 군</td>
|
||||
<td class='bg1' align=center>오 호 장 군</td>
|
||||
<td colspan=5><?=$emperior['tiger']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>건 안 칠 자</td>
|
||||
<td class='bg1' align=center>건 안 칠 자</td>
|
||||
<td colspan=5><?=$emperior['eagle']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 들<br>(공헌도 순서)</td>
|
||||
<td class='bg1' align=center>장 수 들<br>(공헌도 순서)</td>
|
||||
<td colspan=5><?=$emperior['gen']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>역 사 기 록</td>
|
||||
<td class='bg1' align=center>역 사 기 록</td>
|
||||
<td colspan=5><?=formatHistoryToHTML(Json::decode($emperior['history']))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -178,7 +175,7 @@ if($showServers){
|
||||
$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);
|
||||
|
||||
@@ -203,7 +200,7 @@ if($showServers){
|
||||
if(key_exists('aux', $nation) && !is_array($nation['aux'])){
|
||||
$nation += Json::decode($nation['aux']);
|
||||
}
|
||||
|
||||
|
||||
echo $templates->render('oldNation', $nation);
|
||||
}
|
||||
}
|
||||
|
||||
+20
-21
@@ -46,10 +46,9 @@ if($gameStor->isunited){
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -110,21 +109,21 @@ $generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special
|
||||
echo"
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=64 align=center id=bg1>얼 굴</td>
|
||||
<td width=140 align=center id=bg1>이 름</td>
|
||||
<td width=45 align=center id=bg1>연령</td>
|
||||
<td width=45 align=center id=bg1>성격</td>
|
||||
<td width=80 align=center id=bg1>특기</td>
|
||||
<td width=45 align=center id=bg1>레 벨</td>
|
||||
<td width=140 align=center id=bg1>국 가</td>
|
||||
<td width=55 align=center id=bg1>명 성</td>
|
||||
<td width=55 align=center id=bg1>계 급</td>
|
||||
<td width=75 align=center id=bg1>관 직</td>
|
||||
<td width=45 align=center id=bg1>통솔</td>
|
||||
<td width=45 align=center id=bg1>무력</td>
|
||||
<td width=45 align=center id=bg1>지력</td>
|
||||
<td width=45 align=center id=bg1>삭턴</td>
|
||||
<td width=70 align=center id=bg1>벌점</td>
|
||||
<td width=64 align=center class='bg1'>얼 굴</td>
|
||||
<td width=140 align=center class='bg1'>이 름</td>
|
||||
<td width=45 align=center class='bg1'>연령</td>
|
||||
<td width=45 align=center class='bg1'>성격</td>
|
||||
<td width=80 align=center class='bg1'>특기</td>
|
||||
<td width=45 align=center class='bg1'>레 벨</td>
|
||||
<td width=140 align=center class='bg1'>국 가</td>
|
||||
<td width=55 align=center class='bg1'>명 성</td>
|
||||
<td width=55 align=center class='bg1'>계 급</td>
|
||||
<td width=75 align=center class='bg1'>관 직</td>
|
||||
<td width=45 align=center class='bg1'>통솔</td>
|
||||
<td width=45 align=center class='bg1'>무력</td>
|
||||
<td width=45 align=center class='bg1'>지력</td>
|
||||
<td width=45 align=center class='bg1'>삭턴</td>
|
||||
<td width=70 align=center class='bg1'>벌점</td>
|
||||
</tr>";
|
||||
foreach($generalList as $general){
|
||||
$nation = $nationname[$general['nation']];
|
||||
@@ -149,7 +148,7 @@ foreach($generalList as $general){
|
||||
$intel = "{$general['intel']}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($general['npc'] >= 2) {
|
||||
$name = "<font color=cyan>{$general['name']}</font>";
|
||||
@@ -167,8 +166,8 @@ foreach($generalList as $general){
|
||||
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
<tr data-general-id='{$general['no']}'
|
||||
data-general-wounded='{$general['injury']}'
|
||||
<tr data-general-id='{$general['no']}'
|
||||
data-general-wounded='{$general['injury']}'
|
||||
data-general-leadership='{$general['leadership']}'
|
||||
data-general-leadership-bonus='{$lbonus}'
|
||||
data-general-strength='{$general['strength']}'
|
||||
|
||||
+9
-13
@@ -28,7 +28,7 @@ $scenarioList = (function(){
|
||||
|
||||
|
||||
|
||||
if($scenarioIdx !== null || key_exists($scenarioIdx, $scenarioList)){
|
||||
if($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx]??[])){
|
||||
$searchScenarioName = $scenarioList[$seasonIdx][$scenarioIdx]['name'];
|
||||
$searchFilter = $db->sqleval('season = %i AND scenario = %i', $seasonIdx, $scenarioIdx);
|
||||
}
|
||||
@@ -50,12 +50,9 @@ else{
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/hallOfFame.css')?>
|
||||
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJs('js/hallOfFame.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJs('dist_js/hallOfFame.js')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -64,14 +61,14 @@ else{
|
||||
<tr><td>
|
||||
시나리오 검색 : <select id="by_scenario" name="by_scenario">
|
||||
<?php foreach($scenarioList as $iterSeasonIdx=>$subScenarioList): ?>
|
||||
<option
|
||||
data-season="<?=$iterSeasonIdx?>"
|
||||
value=""
|
||||
<option
|
||||
data-season="<?=$iterSeasonIdx?>"
|
||||
value=""
|
||||
<?=($iterSeasonIdx == $seasonIdx && $scenarioIdx === null)?"selected='selected'":''?>
|
||||
>* 시즌 : <?=$iterSeasonIdx?> 종합 *</option>
|
||||
<?php foreach($subScenarioList as $info): ?>
|
||||
<option
|
||||
data-season="<?=$iterSeasonIdx?>"
|
||||
data-season="<?=$iterSeasonIdx?>"
|
||||
value="<?=$info['scenario']?>"
|
||||
<?=($iterSeasonIdx == $seasonIdx && $info['scenario']===$scenarioIdx)?"selected='selected'":''?>
|
||||
><?=$info['name']?>(<?=$info['cnt']?>회)</option>
|
||||
@@ -136,7 +133,7 @@ foreach($types as $typeName=>[$typeDescribe, $typeValue]) {
|
||||
$general['bgColor'] = $general['color'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!key_exists('fgColor', $general)){
|
||||
$general['fgColor'] = newColor($general['bgColor']);
|
||||
}
|
||||
@@ -175,4 +172,3 @@ foreach($types as $typeName=>[$typeDescribe, $typeValue]) {
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
+5
-8
@@ -99,13 +99,10 @@ $nations = Json::decode($history['nations']);
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 연감</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS("js/map/theme_{$mapTheme}.js")?>
|
||||
<?=WebUtil::printJS('js/map.js')?>
|
||||
<?=WebUtil::printJS('js/history.js')?>
|
||||
<?=WebUtil::printJS('dist_js/history.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -139,7 +136,7 @@ var nations = <?=$nations?$history['nations']:'{}'?>;
|
||||
</td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 height=520 class='tb_layout bg0'>
|
||||
<thead><tr><th colspan=5 align=center id=bg1>중 원 지 도</th></tr></thead>
|
||||
<thead><tr><th colspan=5 align=center class='bg1'>중 원 지 도</th></tr></thead>
|
||||
<tbody>
|
||||
<tr height=520>
|
||||
<td width=698>
|
||||
@@ -169,13 +166,13 @@ var nations = <?=$nations?$history['nations']:'{}'?>;
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th colspan=5 align=center id=bg1>중 원 정 세</th></tr>
|
||||
<tr><th colspan=5 align=center class='bg1'>중 원 정 세</th></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=formatHistoryToHTML(Json::decode($history['global_history']))?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th colspan=5 align=center id=bg1>장 수 동 향</th></tr>
|
||||
<tr><th colspan=5 align=center class='bg1'>장 수 동 향</th></tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?=formatHistoryToHTML(Json::decode($history['global_action']))?>
|
||||
|
||||
+13
-14
@@ -25,10 +25,9 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 세력일람</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/ext.kingdoms.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/extKingdoms.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -48,7 +47,7 @@ $nations[0] = getNationStaticInfo(0);
|
||||
|
||||
foreach($db->query('SELECT npc,name,city,nation,officer_level,penalty,permission FROM general ORDER BY dedication DESC') as $general){
|
||||
$nationID = $general['nation'];
|
||||
|
||||
|
||||
if(!key_exists('generals', $nations[$nationID])){
|
||||
$nations[$nationID]['generals'] = [];
|
||||
}
|
||||
@@ -92,13 +91,13 @@ foreach ($nations as $nation) {
|
||||
<td colspan=8 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 {$nation['name']} 】</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=80 align=center id=bg1>성 향</td>
|
||||
<td width=80 align=center class='bg1'>성 향</td>
|
||||
<td width=170 align=center><font color=yellow>".getNationType($nation['type'])."</font></td>
|
||||
<td width=80 align=center id=bg1>작 위</td>
|
||||
<td width=80 align=center class='bg1'>작 위</td>
|
||||
<td width=170 align=center>".getNationLevel($nation['level'])."</td>
|
||||
<td width=80 align=center id=bg1>국 력</td>
|
||||
<td width=80 align=center class='bg1'>국 력</td>
|
||||
<td width=170 align=center>{$nation['power']}</td>
|
||||
<td width=80 align=center id=bg1>장수 / 속령</td>
|
||||
<td width=80 align=center class='bg1'>장수 / 속령</td>
|
||||
<td width=170 align=center>{$nation['gennum']} / ".count($nation['cities']??[])."</td>
|
||||
";
|
||||
for($chiefLevel = 12; $chiefLevel >= 5; $chiefLevel--){
|
||||
@@ -113,9 +112,9 @@ foreach ($nations as $nation) {
|
||||
}
|
||||
echo "</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>외교권자</td><td colspan=5>";
|
||||
<td align=center class='bg1'>외교권자</td><td colspan=5>";
|
||||
echo join(', ', $ambassadors);
|
||||
echo "</td><td align=center id=bg1>조언자</td><td align=center >";
|
||||
echo "</td><td align=center class='bg1'>조언자</td><td align=center >";
|
||||
echo count($auditors).'명';
|
||||
echo "</td></tr>
|
||||
<tr>
|
||||
@@ -160,9 +159,9 @@ echo "
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=center> </td>
|
||||
<td width=123 align=center id=bg1>장 수</td>
|
||||
<td width=123 align=center class='bg1'>장 수</td>
|
||||
<td width=123 align=center>{$nations[0]['gennum']}</td>
|
||||
<td width=123 align=center id=bg1>속 령</td>
|
||||
<td width=123 align=center class='bg1'>속 령</td>
|
||||
<td width=123 align=center>".count($nations[0]['cities']??[])."</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -177,7 +176,7 @@ echo"
|
||||
<td colspan=5> 장수 일람 : ";
|
||||
foreach($nations[0]['generals'] as $general) {
|
||||
$generalText = getColoredName($general['name'], $general['npc']);
|
||||
echo "{$generalText}, ";
|
||||
echo "{$generalText}, ";
|
||||
}
|
||||
echo"
|
||||
</td>
|
||||
|
||||
+21
-16
@@ -26,9 +26,9 @@ $sel[$type] = "selected";
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 빙의일람</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -59,8 +59,13 @@ foreach (getAllNationStaticInfo() as $nation) {
|
||||
$nationName[$nation['nation']] = $nation['name'];
|
||||
}
|
||||
|
||||
|
||||
$generalList = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1');
|
||||
$generalListFromPool = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general JOIN select_pool on general.no = select_pool.general_id where npc=0');
|
||||
|
||||
if($generalListFromPool){
|
||||
$generalList = array_merge($generalListFromPool, $generalList);
|
||||
}
|
||||
|
||||
$sortType = [
|
||||
1 => ['name', true],
|
||||
2 => ['nation', true],
|
||||
@@ -88,18 +93,18 @@ else{
|
||||
?>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=102 align=center id=bg1>희생된 장수</td>
|
||||
<td width=102 align=center id=bg1>악령 이름</td>
|
||||
<td width=68 align=center id=bg1>레벨</td>
|
||||
<td width=118 align=center id=bg1>국가</td>
|
||||
<td width=68 align=center id=bg1>성격</td>
|
||||
<td width=88 align=center id=bg1>특기</td>
|
||||
<td width=68 align=center id=bg1>종능</td>
|
||||
<td width=68 align=center id=bg1>통솔</td>
|
||||
<td width=68 align=center id=bg1>무력</td>
|
||||
<td width=68 align=center id=bg1>지력</td>
|
||||
<td width=78 align=center id=bg1>명성</td>
|
||||
<td width=78 align=center id=bg1>계급</td>
|
||||
<td width=102 align=center class='bg1'>희생된 장수</td>
|
||||
<td width=102 align=center class='bg1'>악령 이름</td>
|
||||
<td width=68 align=center class='bg1'>레벨</td>
|
||||
<td width=118 align=center class='bg1'>국가</td>
|
||||
<td width=68 align=center class='bg1'>성격</td>
|
||||
<td width=88 align=center class='bg1'>특기</td>
|
||||
<td width=68 align=center class='bg1'>종능</td>
|
||||
<td width=68 align=center class='bg1'>통솔</td>
|
||||
<td width=68 align=center class='bg1'>무력</td>
|
||||
<td width=68 align=center class='bg1'>지력</td>
|
||||
<td width=78 align=center class='bg1'>명성</td>
|
||||
<td width=78 align=center class='bg1'>계급</td>
|
||||
</tr>
|
||||
<?php foreach($generalList as $general): ?>
|
||||
<tr>
|
||||
|
||||
+3
-5
@@ -27,12 +27,11 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 세력도</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
||||
<?=WebUtil::printJS('js/map.js')?>
|
||||
<?=WebUtil::printJS('dist_js/map.js')?>
|
||||
<script>
|
||||
window.serverNick = '<?=DB::prefix()?>';
|
||||
window.serverID = '<?=UniqueConst::$serverID?>';
|
||||
@@ -80,4 +79,3 @@ $(function(){
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
+16
-16
@@ -52,9 +52,9 @@ if ($admin['maxonline'] < $curonline) {
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -92,7 +92,7 @@ span.out_bar{
|
||||
<table align=center width=1016>
|
||||
<tr><td align=left>
|
||||
<table align=center class='tb_layout bg0'>
|
||||
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
|
||||
<tr><td colspan=4 align=center class='bg2'><font size=5>접 속 량</font></td></tr>
|
||||
<?php
|
||||
$refresh[] = $admin['refresh'];
|
||||
foreach($refresh as $i=>$value){
|
||||
@@ -101,8 +101,8 @@ foreach($refresh as $i=>$value){
|
||||
$dt = substr($date[$i], 11, 5); ?>
|
||||
<tr height=30>
|
||||
<td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
|
||||
<td width=60 align=center id=bg2><?=$dt?></td>
|
||||
<td width=2 align=center id=bg1></td>
|
||||
<td width=60 align=center class='bg2'><?=$dt?></td>
|
||||
<td width=2 align=center class='bg1'></td>
|
||||
<td width=320>
|
||||
<?php if($w == 0): ?>
|
||||
<span class="out_bar"><?=$value?></span>
|
||||
@@ -111,15 +111,15 @@ foreach($refresh as $i=>$value){
|
||||
<?php else:?>
|
||||
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'><span><?=$value?></span></div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td colspan=4 height=5 align=center id=bg1></td></tr>
|
||||
<tr><td colspan=4 height=5 align=center class='bg1'></td></tr>
|
||||
<tr>
|
||||
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxrefresh']?></td>
|
||||
<td colspan=4 height=30 align=center class='bg0'>최고기록: <?=$admin['maxrefresh']?></td>
|
||||
</tr>
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ foreach($refresh as $i=>$value){
|
||||
</td>
|
||||
<td align=right>
|
||||
<table align=center class='tb_layout bg0'>
|
||||
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr>
|
||||
<tr><td colspan=4 align=center class='bg2'><font size=5>접 속 자</font></td></tr>
|
||||
<?php
|
||||
$online[] = $curonline;
|
||||
foreach($online as $i=>$value){
|
||||
@@ -136,8 +136,8 @@ foreach($online as $i=>$value){
|
||||
$dt = substr($date[$i], 11, 5); ?>
|
||||
<tr height=30>
|
||||
<td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
|
||||
<td width=60 align=center id=bg2><?=$dt?></td>
|
||||
<td width=2 align=center id=bg1></td>
|
||||
<td width=60 align=center class='bg2'><?=$dt?></td>
|
||||
<td width=2 align=center class='bg1'></td>
|
||||
<td width=320>
|
||||
<?php if($w == 0): ?>
|
||||
<span class="out_bar"><?=$value?></span>
|
||||
@@ -146,22 +146,22 @@ foreach($online as $i=>$value){
|
||||
<?php else:?>
|
||||
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'><span><?=$value?></span></div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr><td colspan=4 height=5 align=center id=bg1></td></tr>
|
||||
<tr><td colspan=4 height=5 align=center class='bg1'></td></tr>
|
||||
<tr>
|
||||
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxonline']?></td>
|
||||
<td colspan=4 height=30 align=center class='bg0'>최고기록: <?=$admin['maxonline']?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
<br>
|
||||
<table align=center class='tb_layout bg0'>
|
||||
<tr><td colspan=3 align=center id=bg2><font size=5>주 의 대 상 자 (순간과도갱신)</font></td></tr>
|
||||
<tr><td colspan=3 align=center class='bg2'><font size=5>주 의 대 상 자 (순간과도갱신)</font></td></tr>
|
||||
<?php
|
||||
$max_refresh = $db->queryFirstRow('SELECT sum(refresh) as refresh, sum(`connect`) as `connect` from general');
|
||||
$max_refresh['name'] = '접속자 총합';
|
||||
|
||||
+13
-13
@@ -12,7 +12,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
increaseRefresh("설문조사", 1);
|
||||
|
||||
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
|
||||
$isVoteAdmin |= $session->userGrade >= 5;
|
||||
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,vote from general where owner=%i', $userID);
|
||||
|
||||
@@ -28,9 +28,9 @@ $vote = $admin['vote']?:['-'];
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -60,7 +60,7 @@ function captureKey(e) {
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<form name=form1 action=c_vote.php method=post>
|
||||
<tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr>
|
||||
<tr><td colspan=3 align=center class='bg2'><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr>
|
||||
<?php
|
||||
|
||||
if ($isVoteAdmin) {
|
||||
@@ -76,7 +76,7 @@ if ($isVoteAdmin) {
|
||||
$vote_title = Tag2Code($vote_title);
|
||||
echo "
|
||||
<tr>
|
||||
<td colspan=2 width=148 align=center id=bg1>제 목</td>
|
||||
<td colspan=2 width=148 align=center class='bg1'>제 목</td>
|
||||
<td width=848 align=left> {$vote_title}</td>
|
||||
</tr>
|
||||
";
|
||||
@@ -151,7 +151,7 @@ echo "
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td colspan=4 align=center id=bg1>댓 글</td>
|
||||
<td colspan=4 align=center class='bg1'>댓 글</td>
|
||||
</tr>
|
||||
";
|
||||
for ($i=0; $i < $commentCount; $i++) {
|
||||
@@ -180,7 +180,7 @@ if ($me['no'] > 0) {
|
||||
</table>
|
||||
<br>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td colspan=3 align=center id=bg2><font size=5>
|
||||
<tr><td colspan=3 align=center class='bg2'><font size=5>
|
||||
전 체 통 계
|
||||
<?php
|
||||
if ($isVoteAdmin) {
|
||||
@@ -238,8 +238,8 @@ if ($admin['voteopen'] >= 1 || $isVoteAdmin) {
|
||||
else{
|
||||
$totalPer += $per;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// if($per < 5) { $vote['cnt'] = " "; }
|
||||
?>
|
||||
<?php if($per == 0): ?>
|
||||
@@ -303,7 +303,7 @@ if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
|
||||
foreach($db->query('SELECT nation,color,name,gennum from nation order by gennum desc') as $i=>$nation){
|
||||
$memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc<2', $nation['nation']);
|
||||
|
||||
|
||||
|
||||
|
||||
$voteCount = $nationVoteCount[$nation['nation']] ?? 0;
|
||||
if($memCount == 0){
|
||||
@@ -312,7 +312,7 @@ if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
|
||||
else{
|
||||
$percentage = round($voteCount / $memCount * 100, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
@@ -336,7 +336,7 @@ if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
|
||||
else{
|
||||
$totalPer += $per;
|
||||
}
|
||||
|
||||
|
||||
// if($per < 5) { $vote['cnt'] = " "; }
|
||||
?>
|
||||
<?php if($per == 0): ?>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
APIHelper::launch(dirname(__FILE__));
|
||||
+14
-14
@@ -49,9 +49,9 @@ if ($msg2 == "") {
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -59,12 +59,12 @@ if ($msg2 == "") {
|
||||
<body>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td>거 래 장<br><?=closeButton()?></td></tr>
|
||||
<tr><td align=center id=bg2><font color=orange size=6><b>거 래 장</b></font><input type=button value='갱신' onclick="location.replace('b_auction.php')"></td></tr>
|
||||
<tr><td align=center class='bg2'><font color=orange size=6><b>거 래 장</b></font><input type=button value='갱신' onclick="location.replace('b_auction.php')"></td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<form method=post action=c_auction.php>
|
||||
<tr><td colspan=11 align=center bgcolor=orange><font size=5>팝 니 다</font></td></tr>
|
||||
<tr align=center id=bg1>
|
||||
<tr align=center class='bg1'>
|
||||
<td width=68>거래번호</td>
|
||||
<td width=48>선택</td>
|
||||
<td width=98>판매자</td>
|
||||
@@ -118,18 +118,18 @@ foreach($db->query('SELECT * from auction where type=0 order by expire') as $auc
|
||||
}
|
||||
?>
|
||||
<tr height=25>
|
||||
<td align=center id=bg1>등록결과</td>
|
||||
<td align=center class='bg1'>등록결과</td>
|
||||
<td colspan=10><?=ConvertLog($msg)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>입찰등록</td>
|
||||
<td align=center class='bg1'>입찰등록</td>
|
||||
<td colspan=10>
|
||||
지불할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
|
||||
<input type=<?=$btn?> name=btn value='구매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>거래등록</td>
|
||||
<td align=center class='bg1'>거래등록</td>
|
||||
<td colspan=10>
|
||||
종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
|
||||
물품: 쌀
|
||||
@@ -152,7 +152,7 @@ foreach($db->query('SELECT * from auction where type=0 order by expire') as $auc
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<form method=post action=c_auction.php>
|
||||
<tr><td colspan=11 align=center bgcolor=skyblue><font size=5>삽 니 다</font></td></tr>
|
||||
<tr align=center id=bg1>
|
||||
<tr align=center class='bg1'>
|
||||
<td width=68>거래번호</td>
|
||||
<td width=48>선택</td>
|
||||
<td width=98>구매자</td>
|
||||
@@ -205,18 +205,18 @@ foreach($db->query('SELECT * from auction where type=1 order by expire') as $auc
|
||||
}
|
||||
?>
|
||||
<tr height=25>
|
||||
<td align=center id=bg1>등록결과</td>
|
||||
<td align=center class='bg1'>등록결과</td>
|
||||
<td colspan=10><?=ConvertLog($msg2)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>입찰등록</td>
|
||||
<td align=center class='bg1'>입찰등록</td>
|
||||
<td colspan=10>
|
||||
수령할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
|
||||
<input type=<?=$btn?> name=btn value='판매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>거래등록</td>
|
||||
<td align=center class='bg1'>거래등록</td>
|
||||
<td colspan=10>
|
||||
종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
|
||||
물품: 쌀
|
||||
@@ -237,11 +237,11 @@ foreach($db->query('SELECT * from auction where type=1 order by expire') as $auc
|
||||
</table>
|
||||
<br>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td align=center id=bg2><font size=5>최 근 기 록</font></td></tr>
|
||||
<tr><td align=center class='bg2'><font size=5>최 근 기 록</font></td></tr>
|
||||
<tr><td>
|
||||
<?=getAuctionLogRecent(20)?>
|
||||
</td></tr>
|
||||
<tr><td align=center id=bg2><font size=5>도 움 말</font></td></tr>
|
||||
<tr><td align=center class='bg2'><font size=5>도 움 말</font></td></tr>
|
||||
<tr><td>
|
||||
<font color=white size=2>
|
||||
ㆍ판매거래는 거래자가 판매할 물품을 거래하면, 구입을 희망하는 사람이 현재가보다 높게 입찰하여 구입하는 방식입니다.<br>
|
||||
|
||||
+13
-13
@@ -87,10 +87,10 @@ else if($reqArgType===1){
|
||||
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, %b FROM general WHERE nation = %i', $reqQueryType, $nationID);
|
||||
}
|
||||
else if($reqArgType===2){
|
||||
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, value as %b
|
||||
FROM general LEFT JOIN rank_data
|
||||
ON general.no = rank_data.general_id
|
||||
WHERE rank_data.type = %s AND general.nation = %i',
|
||||
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, value as %b
|
||||
FROM general LEFT JOIN rank_data
|
||||
ON general.no = rank_data.general_id
|
||||
WHERE rank_data.type = %s AND general.nation = %i',
|
||||
$reqQueryType, $reqQueryType, $nationID
|
||||
);
|
||||
}
|
||||
@@ -120,9 +120,9 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -153,8 +153,8 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</table>
|
||||
<table width=1000 align=center class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=50% align=center id=bg1><font color=skyblue size=3>장 수 정 보</font></td>
|
||||
<td width=50% align=center id=bg1><font color=orange size=3>장 수 열 전</font></td>
|
||||
<td width=50% align=center class='bg1'><font color=skyblue size=3>장 수 정 보</font></td>
|
||||
<td width=50% align=center class='bg1'><font color=orange size=3>장 수 열 전</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
@@ -165,8 +165,8 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1><font color=orange size=3>전투 기록</font></td>
|
||||
<td align=center id=bg1><font color=orange size=3>전투 결과</font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3>전투 기록</font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3>전투 결과</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
@@ -178,8 +178,8 @@ $showGeneral = General::createGeneralObjFromDB($gen);
|
||||
</tr>
|
||||
<?php if($showGeneral->getNPCType() > 1 || $permission >= 2): ?>
|
||||
<tr>
|
||||
<td align=center id=bg1><font color=orange size=3>개인 기록</font></td>
|
||||
<td align=center id=bg1><font color=orange size=3> </font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3>개인 기록</font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3> </font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
|
||||
+10
-11
@@ -63,10 +63,9 @@ if($str3){
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 베팅장</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/betting.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/betting.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -79,7 +78,7 @@ if($str3){
|
||||
<table align=center width=1120 class='tb_layout bg0'>
|
||||
<tr><td colspan=16><input type=button value='갱신' onclick='location.reload()'></td></tr>
|
||||
<tr><td colspan=16 align=center><font color=white size=6><?=$tnmt_type?> (<?=$str1.$str2.$str3?>)</font></td></tr>
|
||||
<tr><td height=50 colspan=16 align=center id=bg2><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$globalBetTotal?> / 내 투자 금액 : <?=$myBetTotal?>)</font></td></tr>
|
||||
<tr><td height=50 colspan=16 align=center class='bg2'><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$globalBetTotal?> / 내 투자 금액 : <?=$myBetTotal?>)</font></td></tr>
|
||||
</table>
|
||||
<table align=center width=1120 class='mimic_flex bg0' style='border:solid 1px gray;font-size:10px;'>
|
||||
<tr align=center><td height=10 colspan=16></td></tr>
|
||||
@@ -311,7 +310,7 @@ for ($i=0; $i < 16; $i++) {
|
||||
else{
|
||||
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
@@ -393,8 +392,8 @@ if ($admin['tournament'] == 6) {
|
||||
<tr align=center><td height=10 colspan=16></td></tr>
|
||||
</table>
|
||||
<table align=center width=1120 class='tb_layout bg0'>
|
||||
<tr align=center><td height=50 colspan=4 id=bg2><font color=yellow size=6>토너먼트 랭킹</font></td></tr>
|
||||
<tr align=center><td colspan=4 id=bg2><font color=skyblue size=3>순위 / 장수명 / 능력치 / 경기수 / 승리 / 무승부 / 패배 / 집계점수 / 우승횟수</font></td></tr>
|
||||
<tr align=center><td height=50 colspan=4 class='bg2'><font color=yellow size=6>토너먼트 랭킹</font></td></tr>
|
||||
<tr align=center><td colspan=4 class='bg2'><font color=skyblue size=3>순위 / 장수명 / 능력치 / 경기수 / 승리 / 무승부 / 패배 / 집계점수 / 우승횟수</font></td></tr>
|
||||
<tr align=center>
|
||||
<?php
|
||||
|
||||
@@ -430,7 +429,7 @@ foreach($tournamentType as $tournamentTypeText=>[$statTypeText,$statFunc,$rankCo
|
||||
<td>
|
||||
<table align=center width=280 class='tb_layout bg0'>
|
||||
<tr><td colspan=9 align=center style=color:white;background-color:black;><font size=4><?=$tournamentTypeText?></font></td></tr>
|
||||
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center><?=$statTypeText?></td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>勝</td></tr>
|
||||
<tr class='bg1'><td align=center>순</td><td align=center>장수</td><td align=center><?=$statTypeText?></td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>勝</td></tr>
|
||||
<?php
|
||||
$prizeColumn = "{$rankColumn}p";
|
||||
$gameColumn = "{$rankColumn}g";
|
||||
@@ -446,8 +445,8 @@ foreach($tournamentType as $tournamentTypeText=>[$statTypeText,$statFunc,$rankCo
|
||||
$result = -($lhs->getRankVar($gameColumn) <=> $rhs->getRankVar($gameColumn));
|
||||
if($result !== 0) return $result;
|
||||
$result = -(
|
||||
($lhs->getRankVar($winColumn)+$lhs->getRankVar($drawColumn)+$lhs->getRankVar($loseColumn))
|
||||
<=>
|
||||
($lhs->getRankVar($winColumn)+$lhs->getRankVar($drawColumn)+$lhs->getRankVar($loseColumn))
|
||||
<=>
|
||||
($rhs->getRankVar($winColumn)+$rhs->getRankVar($drawColumn)+$rhs->getRankVar($loseColumn))
|
||||
);
|
||||
if($result !== 0) return $result;
|
||||
|
||||
@@ -15,12 +15,9 @@ $generalObj = General::createGeneralObjFromDB($session->generalID);
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 사령부</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/chiefCenter.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/chiefCenter.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -108,4 +105,3 @@ var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
+15
-13
@@ -16,7 +16,11 @@ $db = DB::db();
|
||||
increaseRefresh("현재도시", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID);
|
||||
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']);
|
||||
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation'])??[
|
||||
'nation'=>0,
|
||||
'level'=>0,
|
||||
'spy'=>''
|
||||
];
|
||||
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
|
||||
@@ -29,11 +33,9 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/currentCity.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/currentCity.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||
@@ -162,6 +164,7 @@ if(!key_exists($citylist, CityConst::all())){
|
||||
|
||||
if($userGrade >= 5){
|
||||
$valid = true;
|
||||
$showDetailedInfo = true;
|
||||
}
|
||||
|
||||
if(!$valid) {
|
||||
@@ -228,7 +231,7 @@ $generalTurnList = [];
|
||||
|
||||
if($generals){
|
||||
foreach($db->queryAllLists(
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
array_column($generals, 'no')
|
||||
) as [$generalID, $turnIdx, $brief]
|
||||
){
|
||||
@@ -267,7 +270,7 @@ foreach($generals as $general){
|
||||
|
||||
$isNPC = $general['npc']>1;
|
||||
$wounded = $general['injury'];
|
||||
|
||||
|
||||
|
||||
$name = $general['name'];
|
||||
$nameText = formatName($name, $general['npc']);
|
||||
@@ -324,7 +327,7 @@ foreach($generals as $general){
|
||||
else{
|
||||
$turnText = '';
|
||||
}
|
||||
|
||||
|
||||
$generalsFormat[] = [
|
||||
'ourGeneral'=>$ourGeneral,
|
||||
'iconPath'=>GetImageURL($general['imgsvr']).'/'.$general['picture'],
|
||||
@@ -376,7 +379,7 @@ $genTotal = 0;
|
||||
|
||||
|
||||
foreach($generalsFormat as $general){
|
||||
if($general['nation'] == 0){
|
||||
if(!$general['nation'] || !$myNation['nation']){
|
||||
continue;
|
||||
}
|
||||
if($general['nation'] != $myNation['nation']){
|
||||
@@ -406,7 +409,7 @@ foreach($generalsFormat as $general){
|
||||
}
|
||||
|
||||
$chkDef = false;
|
||||
|
||||
|
||||
if($minTrain >= 80){
|
||||
$crew80 += $general['crew'];
|
||||
$gen80 += 1;
|
||||
@@ -423,7 +426,7 @@ foreach($generalsFormat as $general){
|
||||
$chkDef = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -519,4 +522,3 @@ foreach($generalsFormat as $general){
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
+11
-14
@@ -55,20 +55,17 @@ $nationStor->cacheValues(['notice', 'scout_msg']);
|
||||
<title><?=UniqueConst::$serverName?>: 내무부</title>
|
||||
<script>
|
||||
var editable = <?=(($me['officer_level']>=5||$permission==4)?'true':'false')?>;
|
||||
var nationMsg = <?=Json::encode($nationStor->notice??'')?>;
|
||||
var scoutmsg = <?=Json::encode($nationStor->scout_msg??'')?>;
|
||||
var storedData = <?=Json::encode([
|
||||
"nationMsg"=>$nationStor->notice??'',
|
||||
"scoutMsg"=>$nationStor->scout_msg??''
|
||||
])?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/summernote-bs4.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/lang/summernote-ko-KR.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/plugin/image-sammo/summernote-image-flip.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/dipcenter.js')?>
|
||||
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/dipcenter.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/summernote/summernote-bs4.css')?>
|
||||
<?=WebUtil::printCSS('dist_css/vendors.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/dipcenter.css')?>
|
||||
@@ -116,14 +113,14 @@ foreach($nationsList as $staticNation):
|
||||
0 => "<font color=red>교 전</font>",
|
||||
1 => "<font color=magenta>선포중</font>",
|
||||
2 => "통 상",
|
||||
7 => "<font color=green>불가침</font>",
|
||||
7 => "<font color=green>불가침</font>",
|
||||
][$diplomacyState['state']];
|
||||
|
||||
if($diplomacyState['term']){
|
||||
$dipEndMonth = $admin['month'] + $diplomacyState['term'] - 1;
|
||||
$dipEndYear = $admin['year'] + intdiv($dipEndMonth, 12);
|
||||
$dipEndMonth = $dipEndMonth % 12 + 1;
|
||||
|
||||
|
||||
$dipTermText = $diplomacyState['term'].'개월';
|
||||
$dipEndDateText = "{$dipEndYear}年 {$dipEndMonth}月";
|
||||
}
|
||||
@@ -200,12 +197,12 @@ if ($budgetricediff > 0) {
|
||||
</div>
|
||||
</div>
|
||||
<div style='border-bottom:solid gray 0.5px;'>870px x 200px를 넘어서는 내용은 표시되지 않습니다.</div>
|
||||
<input type='hidden' class='input_form' name='scoutmsg' data-global='scoutmsg'>
|
||||
<input type='hidden' class='input_form' name='scoutMsg' data-global='scoutMsg'>
|
||||
<div style="width:870px;margin-left:auto;">
|
||||
<div class='edit_form viewer'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=green>예 산 & 정 책</td></tr>
|
||||
<tr>
|
||||
|
||||
+11
-12
@@ -31,8 +31,8 @@ foreach($db->queryAllLists('SELECT nation, count(city) FROM city WHERE nation !=
|
||||
|
||||
$realConflict = [];
|
||||
foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE conflict!=%s', '{}') as [
|
||||
$cityID,
|
||||
$cityName,
|
||||
$cityID,
|
||||
$cityName,
|
||||
$rawConflict
|
||||
])
|
||||
{
|
||||
@@ -62,7 +62,7 @@ foreach($db->queryAllLists('SELECT me, you, state FROM diplomacy') as [$me, $you
|
||||
if(!key_exists($me, $diplomacyList)){
|
||||
$diplomacyList[$me] = [];
|
||||
}
|
||||
|
||||
|
||||
$diplomacyList[$me][$you] = $state;
|
||||
}
|
||||
|
||||
@@ -90,12 +90,11 @@ $neutralStateCharMap = [
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 중원 정보</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
||||
<?=WebUtil::printJS('js/map.js')?>
|
||||
<?=WebUtil::printJS('dist_js/map.js')?>
|
||||
<script>
|
||||
window.serverNick = '<?=DB::prefix()?>';
|
||||
window.serverID = '<?=UniqueConst::$serverID?>';
|
||||
@@ -163,9 +162,9 @@ else{
|
||||
<table class='tb_layout bg0' style='width:100%;'>
|
||||
<?php foreach($conflict as $item): ?>
|
||||
<tr>
|
||||
<td
|
||||
<td
|
||||
width=130
|
||||
align=right
|
||||
align=right
|
||||
style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
|
||||
><?=$item['name']?> </td>
|
||||
<td width=48 align=right><?=(float)$item['percent']?> % </td>
|
||||
@@ -175,14 +174,14 @@ else{
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<tr><td colspan=2 height=5 id=bg1></td></tr>
|
||||
<tr><td colspan=2 height=5 class='bg1'></td></tr>
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<br>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
|
||||
+5
-5
@@ -56,9 +56,9 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -105,7 +105,7 @@ $generals = $db->query(
|
||||
$generalTurnList = [];
|
||||
|
||||
foreach($db->queryAllLists(
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
array_column($generals, 'no')
|
||||
) as [$generalID, $turnIdx, $brief]
|
||||
){
|
||||
@@ -157,7 +157,7 @@ foreach ($generals as &$general) {
|
||||
$general['modeText'] = formatDefenceTrain($general['defence_train']);
|
||||
$general['crewtypeText'] = GameUnitConst::byId($general['crewtype'])->name??'-';
|
||||
|
||||
|
||||
|
||||
if ($general['npc'] < 2) {
|
||||
$turntext = [];
|
||||
foreach($generalTurnList[$general['no']] as $turnRawIdx=>$turn){
|
||||
|
||||
+32
-33
@@ -33,11 +33,10 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 인사부</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/bossInfo.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/bossInfo.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||
@@ -48,7 +47,7 @@ var chiefStatMin = <?=GameConst::$chiefStatMin?>;
|
||||
var myLevel = <?=$meLevel?>;
|
||||
</script>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
$ambassadors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nationID);
|
||||
$auditors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nationID);
|
||||
@@ -112,8 +111,8 @@ $level = Util::convertArrayToDict(
|
||||
);
|
||||
|
||||
|
||||
$tigers = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
$tigers = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
|
||||
$nationID
|
||||
);// 오호장군
|
||||
@@ -122,9 +121,9 @@ $tigerstr = join(', ', array_map(function($arr){
|
||||
return "{$arr['name']}【{$number}】";
|
||||
}, $tigers));
|
||||
|
||||
$eagles = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
|
||||
$eagles = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
|
||||
$nationID
|
||||
);// 건안칠자
|
||||
$eaglestr = join(', ', array_map(function($arr){
|
||||
@@ -146,10 +145,10 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
|
||||
?>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getOfficerLevelText($i1, $nation['level'])?></font></td>
|
||||
<td width=98 align=center class='bg1'><font size=4><?=getOfficerLevelText($i1, $nation['level'])?></font></td>
|
||||
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i1]['name']??'-'?>(<?=$level[$i1]['belong']??'-'?>년)</font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getOfficerLevelText($i2, $nation['level'])?></font></td>
|
||||
<td width=98 align=center class='bg1'><font size=4><?=getOfficerLevelText($i2, $nation['level'])?></font></td>
|
||||
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
|
||||
</tr>
|
||||
@@ -158,11 +157,11 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1>오호장군【승전】</td>
|
||||
<td width=98 align=center class='bg1'>오호장군【승전】</td>
|
||||
<td colspan=5><?=$tigerstr?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1>건안칠자【계략】</td>
|
||||
<td width=98 align=center class='bg1'>건안칠자【계략】</td>
|
||||
<td colspan=5><?=$eaglestr?></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -170,7 +169,7 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
<tr><td colspan=6 height=5></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=red>추 방</td></tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>대상 장수</td>
|
||||
<td width=498 align=right class='bg1'>대상 장수</td>
|
||||
<td width=498>
|
||||
<?php
|
||||
|
||||
@@ -212,9 +211,9 @@ echo "
|
||||
<tr><td colspan=4 height=5></td></tr>
|
||||
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right id=bg1>".getOfficerLevelText(12, $nation['level'])."</td>
|
||||
<td width=98 align=right class='bg1'>".getOfficerLevelText(12, $nation['level'])."</td>
|
||||
<td width=398>{$level[12]['name']} 【".CityConst::byID($level[12]['city'])->name."】</td>
|
||||
<td width=98 align=right id=bg1>{$officerLevelText}</td>
|
||||
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
@@ -240,7 +239,7 @@ if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
|
||||
if(key_exists(11, $level)){
|
||||
echo "{$level[11]['name']} 【".CityConst::byID($level[11]['city'])->name."】";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
@@ -251,11 +250,11 @@ for($i=10; $i >= $lv; $i--) {
|
||||
if($i % 2 == 0) { echo "<tr>"; }
|
||||
$officerLevelText = getOfficerLevelText($i, $nation['level']);
|
||||
echo "
|
||||
<td width=98 align=right id=bg1>{$officerLevelText}</td>
|
||||
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
|
||||
|
||||
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $i)) {
|
||||
echo "
|
||||
<select id='genlist_{$i}' size=1 style=color:white;background-color:black;>
|
||||
@@ -295,13 +294,13 @@ if($meLevel == 12):
|
||||
<tr><td colspan='4' height='5'></td></tr>
|
||||
<tr><td colspan='4' align='center' bgcolor='purple'>외 교 권 자 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right id=bg1>외교권자</td>
|
||||
<td width=98 align=right class='bg1'>외교권자</td>
|
||||
<td width=398>
|
||||
<select id="selectAmbassador" multiple="multiple">
|
||||
</select>
|
||||
<button id='changeAmbassador' type='button'>임명</button>
|
||||
</td>
|
||||
<td width=98 align=right id=bg1>조언자</td>
|
||||
<td width=98 align=right class='bg1'>조언자</td>
|
||||
<td width=398>
|
||||
<select id="selectAuditor" multiple="multiple">
|
||||
</select>
|
||||
@@ -320,7 +319,7 @@ if($meLevel >= 5) {
|
||||
echo "
|
||||
<tr><td colspan=5 align=center bgcolor=orange>도 시 관 직 임 명</td></tr>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_4' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
@@ -367,7 +366,7 @@ if($meLevel >= 5) {
|
||||
</tr>";
|
||||
$officerLevelText = getOfficerLevelText(3, $nation['level']);
|
||||
echo "<tr>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_3' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
@@ -413,7 +412,7 @@ if($meLevel >= 5) {
|
||||
</tr>";
|
||||
$officerLevelText = getOfficerLevelText(2, $nation['level']);
|
||||
echo "<tr>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_2' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
@@ -462,10 +461,10 @@ if($meLevel >= 5) {
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<td width=158 align=center id=bg1 colspan=2><font size=4>도 시</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>태 수 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>군 사 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>종 사 (사관) 【현재도시】</font></td>
|
||||
<td width=158 align=center class='bg1' colspan=2><font size=4>도 시</font></td>
|
||||
<td width=278 align=center class='bg1'><font size=4>태 수 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center class='bg1'><font size=4>군 사 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center class='bg1'><font size=4>종 사 (사관) 【현재도시】</font></td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
@@ -495,15 +494,15 @@ foreach($db->query('SELECT city,name,level,region,officer_set from city where na
|
||||
$cityOfficerList = $officerList[$cityID]??[];
|
||||
?>
|
||||
<?php if($region != $city['region']): ?>
|
||||
<tr><td colspan=5 height=3 id=bg1></td></tr>
|
||||
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 <?=CityConst::$regionMap[$city['region']]?> 】 </font></td></tr>
|
||||
<tr><td colspan=5 height=3 class='bg1'></td></tr>
|
||||
<tr><td colspan=5 class='bg1'><font size=4 color=skyblue> 【 <?=CityConst::$regionMap[$city['region']]?> 】 </font></td></tr>
|
||||
<?php endif; $region = $city['region']; ?>
|
||||
<tr>
|
||||
<td width=78 align=center style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'>【<?=$citylevel[$city['level']]?>】</td>
|
||||
<td width=78 align=right style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'><?=$city['name']?> </td>
|
||||
|
||||
<?php foreach(Util::range(4, 1, -1) as $officerLevel): ?>
|
||||
<?php if(key_exists($officerLevel, $cityOfficerList)):
|
||||
<?php if(key_exists($officerLevel, $cityOfficerList)):
|
||||
$officer = $cityOfficerList[$officerLevel];
|
||||
?>
|
||||
<td style="color:<?=isOfficerSet($city['officer_set'], $officerLevel)?'orange':'white'?>;"><?=$officer['name']?>(<?=$officer['belong']?>년) 【<?=CityConst::byID($officer['city'])->name?>】</td>
|
||||
|
||||
+18
-22
@@ -37,13 +37,10 @@ $sel = [$type => "selected"];
|
||||
<title><?=UniqueConst::$serverName?>: 세력도시</title>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/jquery-ui.min.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-ui.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/ext.expand_city.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/extExpandCity.js')?>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -129,10 +126,10 @@ foreach($cityList as $city){
|
||||
];
|
||||
|
||||
$cityOfficerList = $officerList[$cityID]??[];
|
||||
foreach($cityOfficerList as $cityOfficer){
|
||||
foreach($cityOfficerList as $cityOfficer){
|
||||
$officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']);
|
||||
}
|
||||
|
||||
|
||||
if ($type == 10 && $city['region'] != $region) {
|
||||
echo "<br>";
|
||||
$region = $city['region'];
|
||||
@@ -151,41 +148,41 @@ foreach($cityList as $city){
|
||||
<td colspan=12 style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=2>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=46 id=bg1>주민</td>
|
||||
<td align=center width=46 class='bg1'>주민</td>
|
||||
<td align=center width=140>{$city['pop']}/{$city['pop_max']}</td>
|
||||
<td align=center width=46 id=bg1>농업</td>
|
||||
<td align=center width=46 class='bg1'>농업</td>
|
||||
<td align=center width=140>{$city['agri']}/{$city['agri_max']}</td>
|
||||
<td align=center width=46 id=bg1>상업</td>
|
||||
<td align=center width=46 class='bg1'>상업</td>
|
||||
<td align=center width=140>{$city['comm']}/{$city['comm_max']}</td>
|
||||
<td align=center width=46 id=bg1>치안</td>
|
||||
<td align=center width=46 class='bg1'>치안</td>
|
||||
<td align=center width=140>{$city['secu']}/{$city['secu_max']}</td>
|
||||
<td align=center width=46 id=bg1>수비</td>
|
||||
<td align=center width=46 class='bg1'>수비</td>
|
||||
<td align=center width=140>{$city['def']}/{$city['def_max']}</td>
|
||||
<td align=center width=46 id=bg1>성벽</td>
|
||||
<td align=center width=46 class='bg1'>성벽</td>
|
||||
<td align=center width=140>{$city['wall']}/{$city['wall_max']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>민심</td>
|
||||
<td align=center class='bg1'>민심</td>
|
||||
<td align=center>".round($city['trust'], 1)."</td>
|
||||
<td align=center id=bg1>시세</td>
|
||||
<td align=center class='bg1'>시세</td>
|
||||
<td align=center>{$city['trade']}%</td>
|
||||
<td align=center id=bg1>인구</td>
|
||||
<td align=center class='bg1'>인구</td>
|
||||
<td align=center>".round($city['pop']/$city['pop_max']*100, 2)." %</td>
|
||||
<td align=center id=bg1>태수</td>
|
||||
<td align=center class='bg1'>태수</td>
|
||||
<td align=center>";
|
||||
echo $officerName[4];
|
||||
echo "</td>
|
||||
<td align=center id=bg1>군사</td>
|
||||
<td align=center class='bg1'>군사</td>
|
||||
<td align=center>";
|
||||
echo $officerName[3];
|
||||
echo "</td>
|
||||
<td align=center id=bg1>종사</td>
|
||||
<td align=center class='bg1'>종사</td>
|
||||
<td align=center>";
|
||||
echo $officerName[2];
|
||||
echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>장수</td>
|
||||
<td align=center class='bg1'>장수</td>
|
||||
<td colspan=11>";
|
||||
$generalList = $db->query('SELECT npc, name FROM general WHERE city = %i AND nation = %i', $city['city'], $me['nation']);
|
||||
if (!$generalList) {
|
||||
@@ -209,4 +206,3 @@ foreach($cityList as $city){
|
||||
</body>
|
||||
<div id="helper_genlist" style="display:none;"></div>
|
||||
</html>
|
||||
|
||||
|
||||
+18
-19
@@ -47,9 +47,9 @@ if($gameStor->isunited){
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -104,21 +104,21 @@ $generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special
|
||||
echo"
|
||||
<table align=center class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=64 align=center id=bg1>얼 굴</td>
|
||||
<td width=98 align=center id=bg1>이 름</td>
|
||||
<td width=78 align=center id=bg1>관 직</td>
|
||||
<td width=68 align=center id=bg1>계 급</td>
|
||||
<td width=68 align=center id=bg1>명 성</td>
|
||||
<td width=68 align=center id=bg1>봉 록</td>
|
||||
<td width=48 align=center id=bg1>통솔</td>
|
||||
<td width=48 align=center id=bg1>무력</td>
|
||||
<td width=48 align=center id=bg1>지력</td>
|
||||
<td width=68 align=center id=bg1>자 금</td>
|
||||
<td width=68 align=center id=bg1>군 량</td>
|
||||
<td width=48 align=center id=bg1>성 격</td>
|
||||
<td width=78 align=center id=bg1>특 기</td>
|
||||
<td width=48 align=center id=bg1>사 관</td>
|
||||
<td width=70 align=center id=bg1>벌점</td>
|
||||
<td width=64 align=center class='bg1'>얼 굴</td>
|
||||
<td width=98 align=center class='bg1'>이 름</td>
|
||||
<td width=78 align=center class='bg1'>관 직</td>
|
||||
<td width=68 align=center class='bg1'>계 급</td>
|
||||
<td width=68 align=center class='bg1'>명 성</td>
|
||||
<td width=68 align=center class='bg1'>봉 록</td>
|
||||
<td width=48 align=center class='bg1'>통솔</td>
|
||||
<td width=48 align=center class='bg1'>무력</td>
|
||||
<td width=48 align=center class='bg1'>지력</td>
|
||||
<td width=68 align=center class='bg1'>자 금</td>
|
||||
<td width=68 align=center class='bg1'>군 량</td>
|
||||
<td width=48 align=center class='bg1'>성 격</td>
|
||||
<td width=78 align=center class='bg1'>특 기</td>
|
||||
<td width=48 align=center class='bg1'>사 관</td>
|
||||
<td width=70 align=center class='bg1'>벌점</td>
|
||||
</tr>";
|
||||
foreach($generalList as $general){
|
||||
|
||||
@@ -183,4 +183,3 @@ foreach($generalList as $general){
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
+23
-24
@@ -27,9 +27,9 @@ if($nationID == 0) {
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 세력정보</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -96,57 +96,57 @@ if ($budgetricediff > 0) {
|
||||
<td colspan=8 align=center style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'>【<?=$nation['name']?>】</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1>총주민</td>
|
||||
<td width=98 align=center class='bg1'>총주민</td>
|
||||
<td width=198 align=center><?=number_format($currPop)?>/<?=number_format($maxPop)?></td>
|
||||
<td width=98 align=center id=bg1>총병사</td>
|
||||
<td width=98 align=center class='bg1'>총병사</td>
|
||||
<td width=198 align=center><?=number_format($currCrew)?>/<?=number_format($maxCrew)?></td>
|
||||
<td width=98 align=center id=bg1>국 력</td>
|
||||
<td width=98 align=center class='bg1'>국 력</td>
|
||||
<td width=298 align=center colspan=3><?=$nation['power']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>국 고</td>
|
||||
<td align=center class='bg1'>국 고</td>
|
||||
<td align=center><?=number_format($nation['gold'])?></td>
|
||||
<td align=center id=bg1>병 량</td>
|
||||
<td align=center class='bg1'>병 량</td>
|
||||
<td align=center><?=number_format($nation['rice'])?></td>
|
||||
<td align=center id=bg1>세 율</td>
|
||||
<td align=center class='bg1'>세 율</td>
|
||||
<td align=center colspan=3><?=$nation['rate']?> %</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>세금/단기</td>
|
||||
<td align=center class='bg1'>세금/단기</td>
|
||||
<td align=center>+<?=number_format($goldIncome)?> / +<?=number_format($warIncome)?></td>
|
||||
<td align=center id=bg1>세곡/둔전</td>
|
||||
<td align=center class='bg1'>세곡/둔전</td>
|
||||
<td align=center>+<?=number_format($riceIncome)?> / +<?=number_format($wallIncome)?></td>
|
||||
<td align=center id=bg1>지급률</td>
|
||||
<td align=center class='bg1'>지급률</td>
|
||||
<td align=center colspan=3><?=$nation['bill']?> %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>수입/지출</td>
|
||||
<td align=center class='bg1'>수입/지출</td>
|
||||
<td align=center>+<?=number_format($totalGoldIncome)?> / -<?=number_format($outcome)?></td>
|
||||
<td align=center id=bg1>수입/지출</td>
|
||||
<td align=center class='bg1'>수입/지출</td>
|
||||
<td align=center>+<?=number_format($totalRiceIncome)?> / -<?=number_format($outcome)?></td>
|
||||
<td align=center id=bg1>속 령</td>
|
||||
<td align=center class='bg1'>속 령</td>
|
||||
<td width=98 align=center><?=count($cityList)?></td>
|
||||
<td width=98 align=center id=bg1>장 수</td>
|
||||
<td width=98 align=center class='bg1'>장 수</td>
|
||||
<td width=98 align=center><?=$nation['gennum']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>국고 예산</td>
|
||||
<td align=center class='bg1'>국고 예산</td>
|
||||
<td align=center><?=number_format($budgetgold)?> (<?=$budgetgolddiff?>)</td>
|
||||
<td align=center id=bg1>병량 예산</td>
|
||||
<td align=center class='bg1'>병량 예산</td>
|
||||
<td align=center><?=number_format($budgetrice)?> (<?=$budgetricediff?>)</td>
|
||||
<td align=center id=bg1>기술력</td>
|
||||
<td align=center class='bg1'>기술력</td>
|
||||
<td align=center><?=number_format(floor($nation['tech']))?></td>
|
||||
<td align=center id=bg1>작 위</td>
|
||||
<td align=center class='bg1'>작 위</td>
|
||||
<td align=center><?=getNationLevel($nation['level'])?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center valign=top id=bg1> 속령일람 :</td>
|
||||
<td align=center valign=top class='bg1'> 속령일람 :</td>
|
||||
<td colspan=7><?=join(', ', $cityNames)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center valign=top id=bg1>국가열전</td>
|
||||
<td colspan=7 id=bg0><?=formatHistoryToHTML(getNationHistoryLogAll($nation['nation']))?></td>
|
||||
<td align=center valign=top class='bg1'>국가열전</td>
|
||||
<td colspan=7 class='bg0'><?=formatHistoryToHTML(getNationHistoryLogAll($nation['nation']))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
@@ -158,4 +158,3 @@ if ($budgetricediff > 0) {
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
+8
-9
@@ -51,10 +51,10 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn')??1;
|
||||
<script>
|
||||
var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/myPage.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/myPage.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
@@ -123,8 +123,8 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1><font color=skyblue size=3>개인 기록</font></td>
|
||||
<td align=center id=bg1><font color=orange size=3>전투 기록</font></td>
|
||||
<td align=center class='bg1'><font color=skyblue size=3>개인 기록</font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3>전투 기록</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
@@ -141,8 +141,8 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1><font color=skyblue size=3>장수 열전</font></td>
|
||||
<td align=center id=bg1><font color=orange size=3>전투 결과</font></td>
|
||||
<td align=center class='bg1'><font color=skyblue size=3>장수 열전</font></td>
|
||||
<td align=center class='bg1'><font color=orange size=3>전투 결과</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign=top>
|
||||
@@ -162,4 +162,3 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,420 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['autorun_user', 'develcost']);
|
||||
|
||||
increaseRefresh("NPC 정책", 1);
|
||||
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, npc, nation, city, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$nationID = $me['nation'];
|
||||
$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,tech,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
printLimitMsg($me['turntime']);
|
||||
exit();
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 0) {
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
} else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
$nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']);
|
||||
$gameStor->cacheAll();
|
||||
|
||||
$general = new General($me, null, null, $nation, $gameStor->year, $gameStor->month, false);
|
||||
|
||||
$rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? [];
|
||||
$rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? [];
|
||||
$rawServerGeneralPolicy = $gameStor->getValue('npc_general_policy') ?? [];
|
||||
$rawNationGeneralPolicy = $nationStor->getValue('npc_general_policy') ?? [];
|
||||
|
||||
$defaultNationPolicy = ($rawServerPolicy['values'] ?? []) + AutorunNationPolicy::$defaultPolicy;
|
||||
$currentNationPolicy = ($rawNationPolicy['values'] ?? []) + $defaultNationPolicy;
|
||||
|
||||
$defaultNationPriority = $rawServerPolicy['priority'] ?? (AutorunNationPolicy::$defaultPriority);
|
||||
$currentNationPriority = $rawNationPolicy['priority'] ?? $defaultNationPriority;
|
||||
|
||||
$defaultGeneralActionPriority = $rawServerGeneralPolicy['priority'] ?? (AutorunGeneralPolicy::$default_priority);
|
||||
$currentGeneralActionPriority = $rawNationGeneralPolicy['priority'] ?? $defaultGeneralActionPriority;
|
||||
|
||||
$autoPolicyVariable = [];
|
||||
if ($currentNationPolicy['reqHumanWarUrgentRice'] ?? 0) {
|
||||
$autoPolicyVariable['reqHumanWarUrgentRice'] = $currentNationPolicy['reqHumanWarUrgentRice'];
|
||||
}
|
||||
if ($currentNationPolicy['reqHumanWarUrgentGold'] ?? 0) {
|
||||
$autoPolicyVariable['reqHumanWarUrgentGold'] = $currentNationPolicy['reqHumanWarUrgentGold'];
|
||||
}
|
||||
$autoPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], ['values' => $autoPolicyVariable], null, $nation, $gameStor->getAll(true));
|
||||
$zeroPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], null, null, $nation, $gameStor->getAll(true));
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?= UniqueConst::$serverName ?>: 임시 NPC 정책</title>
|
||||
<script>
|
||||
var nationID = <?= $nationID ?>;
|
||||
|
||||
var defaultNationPolicy = <?= Json::encode($defaultNationPolicy) ?>;
|
||||
var currentNationPolicy = <?= Json::encode($currentNationPolicy) ?>;
|
||||
|
||||
var defaultNationPriority = <?= Json::encode($defaultNationPriority) ?>;
|
||||
var currentNationPriority = <?= Json::encode($currentNationPriority) ?>;
|
||||
var availableNationPriorityItems = <?= Json::encode(AutorunNationPolicy::$defaultPriority) ?>;
|
||||
|
||||
var defaultGeneralActionPriority = <?= Json::encode($defaultGeneralActionPriority) ?>;
|
||||
var currentGeneralActionPriority = <?= Json::encode($currentGeneralActionPriority) ?>;
|
||||
var availableGeneralActionPriorityItems = <?= Json::encode(AutorunGeneralPolicy::$default_priority) ?>;
|
||||
|
||||
var btnHelpMessage = {
|
||||
'선전포고': '군주가 NPC이고, 전쟁중이 아닐 때,<br>주변국중 하나를 골라 선포합니다.<br><br>선포 시점은 다음을 참고합니다.<br>- 인구율<br>- 도시내정률<br>- NPC전투장권장 금 충족률<br>- NPC전투장권장 쌀 충족률<br><br>국력이 낮은 국가를 조금 더 선호합니다.',
|
||||
'천도': '인구가 많은 곳을 찾아 천도를 시도합니다.<br>영토의 가운데를 선호합니다.<br><br>도시 인구가 충분하다면, 굳이 천도하지는 않습니다.',
|
||||
'유저장긴급포상': '금/쌀이 부족한 유저전투장에게 긴급하게 포상합니다.<br>국고가 권장량보다 적어지더라도 시도합니다.',
|
||||
'부대전방발령': '(작동하지 않음)<br>전투 부대를 접경으로 발령합니다.<br>수도->시작점->도착점 경로를 따릅니다.',
|
||||
'유저장구출발령': '아군 영토에 있지 않은 유저장을 아군 영토로 발령합니다.<br>곧 집합하는 부대에 탑승한 경우는 제외합니다.',
|
||||
'유저장후방발령': '유저전투장 중에<br>- 병력이 충분하지 않고,<br>- 도시의 인구가 제자리 징병할 수 있을 정도로 충분하지 않고,<br>- 부대에 탑승하지 않았다면,<br>인구가 충분한 후방도시로 발령합니다.',
|
||||
'부대유저장후방발령': '접경에 위치한 부대에 탑승한 유저전투장 중에,<br>- 병력이 충분하지 않고,<br>- 첫 턴이 징병턴이며,<br>- 부대장 집합 턴 사이라면,<br>인구가 충분한 후방도시로 발령합니다.<br><br>부대장의 위치와 유저장의 위치가 다르다면 발령하지 않습니다.',
|
||||
'유저장전방발령': '후방에 있는 유저장이<br>- 병력을 가지고 있으며,<br>- 곧 훈련/사기진작이 완료될 것 같으면,<br>전방으로 발령합니다.<br><br>도시 관직이 많이 임명된 도시를 선호합니다.',
|
||||
'유저장포상': '금/쌀이 부족한 유저장에게 포상합니다.<br>유저전투장과 유저내정장은 각각 기준을 따릅니다.<br>국고 권장량을 가급적 지킵니다.',
|
||||
'부대후방발령': '(작동하지 않음)<br>후방 부대가 위치한 도시의 인구가 충분하지 않을 경우,<br>인구가 충분한 도시로 발령합니다.',
|
||||
'부대구출발령': '전투 부대, 후방 부대가 아닌 부대가 아군 영토에 있지 않을 때,<br>전방 도시 중 하나를 골라 발령합니다.',
|
||||
'NPC긴급포상': '금/쌀이 부족한 NPC전투장에게 긴급하게 포상합니다.<br>국고가 권장량보다 \'약간\' 적어지더라도 시도합니다.',
|
||||
'NPC구출발령': '아군 영토에 있지 않은 NPC장을 아군 영토로 발령합니다.',
|
||||
'NPC후방발령': 'NPC전투장 중에<br>- 병력이 충분하지 않고,<br>- 도시의 인구가 제자리 징병할 수 있을 정도로 충분하지 않고,<br>- 부대에 탑승하지 않았다면,<br>인구가 충분한 후방도시로 발령합니다.',
|
||||
'NPC포상': '금/쌀이 부족한 유저장에게 포상합니다.<br>NPC전투장과 NPC내정장은 각각 기준을 따릅니다.<br>국고 권장량을 가급적 지킵니다.',
|
||||
'NPC전방발령': '후방에 있는 유저장이<br>- 병력을 가지고 있으며,<br>- 곧 훈련/사기진작이 완료될 것 같으면,<br>전방으로 발령합니다.<br><br>도시 관직이 많이 임명된 도시를 선호합니다.',
|
||||
'유저장내정발령': '내정중인 유저장이 위치한 도시의 내정률이 95% 이상이면<br>개발되지 않은 도시로 발령합니다.',
|
||||
'NPC내정발령': '내정중인 NPC장이 위치한 도시의 내정률이 95% 이상이면<br>개발되지 않은 도시로 발령합니다.',
|
||||
'NPC몰수': '국고가 부족하다면 NPC에게서 몰수합니다. 내정NPC장은 국고가 부족하지 않아도 몰수합니다.',
|
||||
|
||||
'NPC사망대비': 'NPC의 사망까지 5턴 이내인 경우, 헌납합니다.<br>헌납할 금쌀이 없다면 물자조달을 수행합니다.',
|
||||
'귀환': '아국 도시에 있지 않다면 귀환합니다.',
|
||||
'금쌀구매': '전쟁 중에 금쌀의 비율이 크게 차이난다면 금쌀을 거래하여 비슷하게 맞춥니다.<br>금쌀 비율이 적절하는지 판단하는데 살상률을 포함합니다.<br>NPC는 상인이 없어도 금쌀을 구매할 수 있습니다.<br><br>또는 금쌀 한쪽이 지나치게 적은 경우에는 내정 중에도 금쌀을 거래합니다.',
|
||||
'출병': '충분한 병력과 충분한 훈련/사기를 가지고 있는 경우 출병합니다.<br>접경이 여럿인 경우 무작위로 선택합니다.<br><br>타국과 전쟁중인 경우 공백지로는 출병하지 않습니다.',
|
||||
'긴급내정': '전쟁중에 민심이 70 미만이거나,<br>인구가 제자리 징병이 가능하지 않을 정도로 적을 경우,<br>일정확률로 주민선정과 정착장려를 수행합니다.<br><br>통솔이 높을 수록 수행할 확률이 높습니다.',
|
||||
'전투준비': '충분한 병력을 가지고 있지만 훈련과 사기가 부족한 경우 훈련과 사기진작을 수행합니다.',
|
||||
'전방워프': '전투장이 충분한 병력을 가지고 있다면 전방으로 이동합니다.',
|
||||
'NPC헌납': '국고가 부족한데 NPC전쟁장이 충분한 금쌀(권장량 대비 1.5배)을 가지고 있다면 일부를 헌납합니다. <br>NPC내정장은 국고가 넉넉하더라도 충분한 금쌀을 가지고 있다면 권장량만 유지하고 헌납합니다.',
|
||||
'징병': '전쟁 중 병력을 소진하였다면 재 징병합니다.<br><br>기존에 사용한 병종군 중에서 사용가능한 병종을 랜덤하게 선택합니다.<br>고급 병종을 선택할 확률이 조금 더 높습니다.<br><br>NPC의 경우 도시의 인구가 충분하지 않다면 징병을 할 확률이 감소합니다.<br><br>유저장은 최대한 고급병종을 유지하며,<br>유저장 모병이 허용되는 경우 모병을 3회할 수 있다면 모병합니다.',
|
||||
'후방워프': '전쟁 중 병력을 소진하였는데 도시의 인구가 충분하지 않다면,<br>인구가 많은 도시로 이동합니다.',
|
||||
'전쟁내정': '전쟁 중 수행하는 내정입니다.<br>정착장려, 기술연구의 확률이 좀 더 높고,<br>치안강화, 농지개간, 상업투자의 확률이 낮습니다.<br><br>내정이 가능하다 하더라도 전시임을 고려해,<br>30% 확률로 다른 턴을 수행합니다.',
|
||||
'소집해제': '전쟁 중이 아닌 데 병력이 남아있는 경우,<br>3/4 확률로 소집해제합니다.',
|
||||
'일반내정': '도시에서 내정을 수행합니다. 낮은 내정일 수록 수행할 확률이 높습니다.<br>기술 연구는 1등급 이상 뒤쳐지지 않도록 노력합니다.',
|
||||
'내정워프': '도시에서 더이상 내정을 수행할 수 없는 경우,<br>일정확률로 내정이 부족한 다른 도시로 이동합니다.',
|
||||
};
|
||||
</script>
|
||||
<?= WebUtil::printJS('../e_lib/jquery-3.3.1.min.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/Sortable.min.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/jquery-sortable.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/bootstrap.bundle.min.js') ?>
|
||||
<?= WebUtil::printJS('../e_lib/jquery_toast/toast.js') ?>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printJS('js/common.js') ?>
|
||||
<?= WebUtil::printJS('js/npc_control.js') ?>
|
||||
|
||||
<?= WebUtil::printCSS('../e_lib/bootstrap.min.css') ?>
|
||||
<?= WebUtil::printCSS('../e_lib/font_awesome/css/all.min.css') ?>
|
||||
<?= WebUtil::printCSS('../e_lib/jquery_toast/toast.css') ?>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<?= WebUtil::printCSS('css/common.css') ?>
|
||||
<?= WebUtil::printCSS('css/npc_control.css') ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
|
||||
<div class='tb_layout bg0'>임시 NPC 정책<br>
|
||||
<?= backButton() ?></div>
|
||||
|
||||
<div class='bg1 section_bar'>국가 정책</div>
|
||||
<div class="text-right px-3"><small class="form-text text-muted">
|
||||
최근 설정: <?= $rawNationPolicy['valueSetter'] ?? '-없음-' ?> (<?= $rawNationPolicy['valueSetTime'] ?? '설정 기록 없음' ?>)
|
||||
</small></div>
|
||||
<div class="form_list">
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNationGold" class="col-sm-6 col-form-label">국가 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNationGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)</small></div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNationRice" class="col-sm-6 col-form-label">국가 권장 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNationRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanWarUrgentGold" class="col-sm-6 col-form-label">유저전투장 긴급포상 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanWarUrgentGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">
|
||||
유저장긴급포상시 이보다 금이 적은 장수에게 포상합니다.<br>
|
||||
0이면 보병 6회 징병(<?= number_format(GameConst::$defaultStatMax * 100) ?> * 6) 가능한 금을 기준으로 하며, 그 수치는 현재 <?= number_format($zeroPolicy->reqHumanWarUrgentGold) ?>입니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanWarUrgentRice" class="col-sm-6 col-form-label">유저전투장 긴급포상 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanWarUrgentRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">유저장긴급포상시 이보다 쌀이 적은 장수에게 포상합니다.<br>0이면 기본 병종으로 <?= number_format(GameConst::$defaultStatMax * 100 * 6) ?>명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 <?= number_format($zeroPolicy->reqHumanWarUrgentRice) ?>입니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanWarRecommandGold" class="col-sm-6 col-form-label">유저전투장 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanWarRecommandGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">유저전투장에게 주는 금입니다. 이보다 적으면 포상합니다. <br>
|
||||
0이면 유저전투장 긴급포상 금의 2배를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqHumanWarRecommandGold) ?>입니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanWarRecommandRice" class="col-sm-6 col-form-label">유저전투장 권장 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanWarRecommandRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">유저전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다. <br>
|
||||
0이면 유저전투장 긴급포상 쌀의 2배를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqHumanWarRecommandRice) ?>입니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanDevelGold" class="col-sm-6 col-form-label">유저내정장 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanDevelGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">유저내정장에게 주는 금입니다. 이보다 적으면 포상합니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqHumanDevelRice" class="col-sm-6 col-form-label">유저내정장 권장 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqHumanDevelRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">유저내정장에게 주는 쌀입니다. 이보다 적으면 포상합니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNPCWarGold" class="col-sm-6 col-form-label">NPC전투장 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNPCWarGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">NPC전투장에게 주는 금입니다. 이보다 적으면 포상합니다. <br>
|
||||
0이면 기본 병종 4회(<?= number_format(GameConst::$defaultStatNPCMax * 100) ?> * 4) 징병비를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCWarGold) ?>입니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNPCWarRice" class="col-sm-6 col-form-label">NPC전투장 권장 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNPCWarRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">NPC전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다. <br>
|
||||
0이면 기본 병종으로 <?= number_format(GameConst::$defaultStatNPCMax * 100 * 4) ?>명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCWarRice) ?>입니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNPCDevelGold" class="col-sm-6 col-form-label">NPC내정장 권장 금</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNPCDevelGold" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">NPC내정장에게 주는 금입니다. 이보다 5배 더 많다면 헌납합니다.<br>0이면 30턴 내정 가능한 금을 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCDevelGold) ?>입니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="reqNPCDevelRice" class="col-sm-6 col-form-label">NPC내정장 권장 쌀</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="reqNPCDevelRice" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">NPC내정장에게 주는 쌀입니다. 이보다 5배 더 많다면 헌납합니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="minimumResourceActionAmount" class="col-sm-6 col-form-label">포상/몰수/헌납/삼/팜 최소 단위</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="minimumResourceActionAmount" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">연산결과가 이 단위보다 적다면 수행하지 않습니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="minWarCrew" class="col-sm-6 col-form-label">최소 전투 가능 병력 수</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="minWarCrew" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이보다 적을 때에는 징병을 시도합니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="minNPCRecruitCityPopulation" class="col-sm-6 col-form-label">NPC 최소 징병 가능 인구 수</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="minNPCRecruitCityPopulation" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이보다 낮으면 NPC는 도시에서 징병하지 않고 후방 워프합니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="safeRecruitCityPopulationRatio" class="col-sm-6 col-form-label">제자리 징병 허용 인구율(%)</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="percent" id="safeRecruitCityPopulationRatio" min="0" max="100" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">전쟁 시 후방 발령, 후방 워프의 기준 인구입니다. 이보다 많다면 '충분하다'고 판단합니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="minNPCWarLeadership" class="col-sm-6 col-form-label">NPC 전투 참여 통솔 기준</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="minNPCWarLeadership" min="0" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">이 수치보다 같거나 높으면 NPC전투장으로 분류됩니다.</small></div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="row">
|
||||
<label for="properWarTrainAtmos" class="col-sm-6 col-form-label">훈련/사기진작 목표치</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="number" class="form-control" data-type="integer" id="properWarTrainAtmos" min="0" max="100" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<div style='text-align:right;'><small class="form-text text-muted">훈련/사기진작 기준치입니다. 이보다 같거나 높으면 출병합니다.</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-secondary">
|
||||
전투 부대는 작업중입니다(json양식: {부대번호:[시작도시번호(아국),도착도시번호(적군)],...})<br>
|
||||
후방 징병 부대는 작업중입니다(json양식: [부대번호,...])<br>
|
||||
내정 부대는 작업중입니다(json양식: [부대번호,...])
|
||||
<input type="hidden" value="{}" data-type="json" id="CombatForce">
|
||||
<input type="hidden" value="[]" data-type="json" id="SupportForce">
|
||||
<input type="hidden" value="[]" data-type="json" id="DevelopForce">
|
||||
<input type="hidden" value="true" data-type="json" id="allowNpcAttackCity">
|
||||
<!--allowNpcAttackCity는 현재 게임 내 비활성-->
|
||||
</div>
|
||||
<div class='control_bar' data-type="nationPolicy">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
|
||||
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
|
||||
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 half_section_left">
|
||||
<div class='bg1 section_bar'>NPC 사령턴 우선순위</div>
|
||||
<div class="float-right px-3"><small class="form-text text-muted">
|
||||
최근 설정: <?= $rawNationPolicy['prioritySetter'] ?? '-없음-' ?> (<?= $rawNationPolicy['prioritySetTime'] ?? '설정 기록 없음' ?>)
|
||||
</small></div>
|
||||
<div class='text-left px-2'><small class="text-muted">예턴이 없거나, 지정되어 있더라도 실패할경우<br>아래 순위에 따라 사령턴을 시도합니다.</small></div>
|
||||
<div class="form_list">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">비활성</div>
|
||||
<div id="nationPriorityDisabled" class="list-group col" data-type="list">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">활성</div>
|
||||
<div id="nationPriority" class="list-group col" data-type="list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='control_bar' data-type="nationPriority">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
|
||||
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
|
||||
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 half_section_right">
|
||||
<div class='bg1 section_bar'>NPC 일반턴 우선순위</div>
|
||||
<div class="float-right px-3"><small class="form-text text-muted">
|
||||
최근 설정: <?= $rawNationGeneralPolicy['prioritySetter'] ?? '-없음-' ?> (<?= $rawNationGeneralPolicy['prioritySetTime'] ?? '설정 기록 없음' ?>)
|
||||
</small></div>
|
||||
<div class='text-left px-2'><small class="text-muted">순위가 높은 것부터 시도합니다. <br>아무것도 실행할 수 없으면 물자조달이나 인재탐색을 합니다.</small></div>
|
||||
<div class="form_list">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">비활성</div>
|
||||
<div id="generalPriorityDisabled" class="list-group col" data-type="list">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="bg2 sub_bar">활성</div>
|
||||
<div id="generalPriority" class="list-group col" data-type="list">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='control_bar' data-type="generalPriority">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
|
||||
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
|
||||
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+6
-12
@@ -64,7 +64,7 @@ if(!$commandObj->hasPermissionToReserve()){
|
||||
die_redirect();
|
||||
}
|
||||
|
||||
$jsList = $commandObj->getJSFiles();
|
||||
$jsList = $commandObj->getJSPlugins();
|
||||
$cssList = $commandObj->getCSSFiles();
|
||||
?>
|
||||
|
||||
@@ -75,26 +75,19 @@ $cssList = $commandObj->getCSSFiles();
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
||||
<?=WebUtil::printJS('js/map.js')?>
|
||||
<?=WebUtil::printJS('js/processing.js')?>
|
||||
<?=WebUtil::printJS('dist_js/processing.js')?>
|
||||
<script>
|
||||
window.serverNick = '<?=DB::prefix()?>';
|
||||
window.serverID = '<?=UniqueConst::$serverID?>';
|
||||
window.command = '<?=$commandType?>';
|
||||
window.turnList = [<?=join(', ',$turnList)?>];
|
||||
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
|
||||
var jsPlugins = <?=Json::encode($jsList)?>;
|
||||
</script>
|
||||
<?php
|
||||
foreach($jsList as $js){
|
||||
print(WebUtil::printJS($js));
|
||||
}
|
||||
?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||
@@ -103,6 +96,7 @@ foreach($jsList as $js){
|
||||
<?=WebUtil::printCSS('css/main.css')?>
|
||||
<?=WebUtil::printCSS('css/map.css')?>
|
||||
<?=WebUtil::printCSS('css/processing.css')?>
|
||||
|
||||
<?php
|
||||
foreach($cssList as $css){
|
||||
print(WebUtil::printCSS($css));
|
||||
|
||||
@@ -145,7 +145,7 @@ if($str3){
|
||||
?>
|
||||
<tr><td colspan=8>운영자 메세지 : <font color=orange size=5><?=$admin['tnmt_msg']?></font></td></tr>
|
||||
<tr><td colspan=8 align=center><font color=white size=6><?=$tnmt_type?> (<?=$str1.$str2.$str3?>)</font></td></tr>
|
||||
<tr><td colspan=8 align=center id=bg2><font color=magenta size=5>16강 승자전</font></td></tr>
|
||||
<tr><td colspan=8 align=center class='bg2'><font color=magenta size=5>16강 승자전</font></td></tr>
|
||||
<tr><td height=10 colspan=8 align=center></td></tr>
|
||||
<?php
|
||||
|
||||
@@ -398,7 +398,7 @@ if ($admin['tournament'] >= 7 || $admin['tournament'] == 0) {
|
||||
}
|
||||
echo "
|
||||
<tr><td height=10 colspan=8 align=center></td></tr>
|
||||
<tr><td colspan=8 align=center id=bg2><font color=orange size=5>조별 본선 순위</font></td></tr>
|
||||
<tr><td colspan=8 align=center class='bg2'><font color=orange size=5>조별 본선 순위</font></td></tr>
|
||||
<tr>";
|
||||
|
||||
$num = array("一", "二", "三", "四", "五", "六", "七", "八");
|
||||
@@ -409,7 +409,7 @@ for ($i=0; $i < 8; $i++) {
|
||||
<td>
|
||||
<table align=center width=250 class='tb_layout bg0'>
|
||||
<tr><td colspan=9 style=background-color:black;>{$num[$i]}조</td></tr>
|
||||
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
|
||||
<tr class='bg1'><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
|
||||
|
||||
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq',$grp);
|
||||
foreach($generalList as $k=>$general) {
|
||||
@@ -427,7 +427,7 @@ if ($admin['tournament'] == 4 || $admin['tournament'] == 5) {
|
||||
printFighting($admin['tournament'], $admin['phase']);
|
||||
}
|
||||
echo "
|
||||
<tr><td colspan=8 align=center id=bg2><font color=yellow size=5>조별 예선 순위</font></td></tr>
|
||||
<tr><td colspan=8 align=center class='bg2'><font color=yellow size=5>조별 예선 순위</font></td></tr>
|
||||
<tr>";
|
||||
|
||||
for ($i=0; $i < 8; $i++) {
|
||||
@@ -436,7 +436,7 @@ for ($i=0; $i < 8; $i++) {
|
||||
<td>
|
||||
<table align=center width=250 class='tb_layout bg0'>
|
||||
<tr><td colspan=9 style=background-color:black;>{$num[$i]}조</td></tr>
|
||||
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
|
||||
<tr class='bg1'><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
|
||||
|
||||
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq',$grp);
|
||||
foreach($generalList as $k=>$general) {
|
||||
|
||||
+10
-11
@@ -44,7 +44,7 @@ if($troops){
|
||||
$generalTurnList = [];
|
||||
|
||||
foreach($db->queryAllLists(
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
||||
array_column($troopLeaders, 'no')
|
||||
) as [$generalID, $turnIdx, $brief]
|
||||
){
|
||||
@@ -53,10 +53,10 @@ if($troops){
|
||||
}
|
||||
$generalTurnList[$generalID][$turnIdx] = $brief;
|
||||
}
|
||||
|
||||
|
||||
foreach($troopLeaders as $troopLeader){
|
||||
$imageTemp = GetImageURL($troopLeader['imgsvr']);
|
||||
|
||||
|
||||
$troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}";
|
||||
$troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name;
|
||||
|
||||
@@ -85,15 +85,14 @@ uasort($troops, function($lhs, $rhs){
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 부대편성</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/troop.js')?>
|
||||
<?=WebUtil::printJS('js/ext.plugin_troop.js')?>
|
||||
<?=WebUtil::preloadJS('dist_js/troop.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/troops.css')?>
|
||||
<?=WebUtil::printCSS('dist_css/troop.css')?>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@@ -195,7 +194,7 @@ foreach ($troops as $troopNo=>$troop) {
|
||||
<br>
|
||||
<table width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=80 id=bg1>부 대 명</td>
|
||||
<td width=80 class='bg1'>부 대 명</td>
|
||||
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
|
||||
<?php if($me['troop'] == 0): ?>
|
||||
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
|
||||
@@ -210,6 +209,6 @@ foreach ($troops as $troopNo=>$troop) {
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<?=WebUtil::printJS('dist_js/troop.js')?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -50,17 +50,13 @@ else{
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printCSS('css/battle_simulator.css')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/download2.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<script>
|
||||
var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
||||
var city = <?=Json::encode($city)?>;
|
||||
var nation = <?=Json::encode($nation)?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('js/battle_simulator.js')?>
|
||||
<?=WebUtil::printJS('dist_js/battle_simulator.js')?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
@@ -123,7 +119,7 @@ var nation = <?=Json::encode($nation)?>;
|
||||
</div>
|
||||
<select class="custom-select form_nation_type" style="width:25ch;">
|
||||
<?php foreach(GameConst::$availableNationType as $typeID): ?>
|
||||
<?php $nationTypeClass = buildNationTypeClass($typeID) ?>
|
||||
<?php $nationTypeClass = buildNationTypeClass($typeID) ?>
|
||||
<option value="<?=$typeID?>"><?=$nationTypeClass->getName()?> (<?=$nationTypeClass::$pros?>, <?=$nationTypeClass::$cons?>)</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -163,10 +159,10 @@ var nation = <?=Json::encode($nation)?>;
|
||||
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="0" autocomplete="off">N
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -198,7 +194,7 @@ var nation = <?=Json::encode($nation)?>;
|
||||
</div>
|
||||
<select class="custom-select form_nation_type" style="width:25ch;">
|
||||
<?php foreach(GameConst::$availableNationType as $typeID): ?>
|
||||
<?php $nationTypeObj = buildNationTypeClass($typeID) ?>
|
||||
<?php $nationTypeObj = buildNationTypeClass($typeID) ?>
|
||||
<option value="<?=$typeID?>"><?=$nationTypeObj->getName()?> (<?=$nationTypeObj::$pros?>, <?=$nationTypeObj::$cons?>)</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -305,7 +301,7 @@ var nation = <?=Json::encode($nation)?>;
|
||||
<span class="input-group-text">Level</span>
|
||||
</div>
|
||||
<input type="number" class="form-control form_exp_level" value="20" min="0" max="300" step="1">
|
||||
|
||||
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<div class="input-group-prepend">
|
||||
@@ -484,7 +480,7 @@ var nation = <?=Json::encode($nation)?>;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div><!-- <div class="col-sm"> -->
|
||||
</div>
|
||||
<div class="card mb-3">
|
||||
|
||||
+1
-2
@@ -7,7 +7,7 @@ include "func.php";
|
||||
|
||||
$btn = Util::getPost('btn');
|
||||
$msg = Util::getPost('msg');
|
||||
$scoutmsg = Util::getPost('scoutmsg');
|
||||
$scoutmsg = Util::getPost('scoutMsg');
|
||||
$rate = Util::getPost('rate', 'int');
|
||||
$bill = Util::getPost('bill', 'int');
|
||||
$secretlimit = Util::getPost('secretlimit', 'int');
|
||||
@@ -75,4 +75,3 @@ if($btn == "국가방침 수정") {
|
||||
}
|
||||
|
||||
header('location:b_dipcenter.php');
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ $session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
|
||||
$isVoteAdmin |= $session->userGrade >= 5;
|
||||
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -24,7 +24,7 @@ $admin = $gameStor->getValues(['develcost', 'cost', 'vote_title', 'vote', 'votec
|
||||
|
||||
$generalID = Session::getGeneralID();
|
||||
|
||||
$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item','npc'], 2);
|
||||
$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item','npc','imgsvr','picture','aux'], 2);
|
||||
|
||||
if($btn == "투표" && $general->getVar('vote') == 0 && $sel > 0) {
|
||||
$develcost = $admin['develcost'] * 5;
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
#newArticle{
|
||||
width:1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.titleInput{
|
||||
width:100%;
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
margin:1px 5px;
|
||||
}
|
||||
|
||||
.contentInput{
|
||||
width:100%;
|
||||
min-height:3em;
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
padding:1px 5px;
|
||||
}
|
||||
|
||||
.articleFrame{
|
||||
width:1000px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.authorName, .comment .author{
|
||||
width:110px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.date{
|
||||
width:125px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.text{
|
||||
text-align:left;
|
||||
padding:1px 5px;
|
||||
}
|
||||
|
||||
.submitComment{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
padding:1px 5px;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
.section_bar{
|
||||
text-align:center;
|
||||
border:0.5px solid #aaa;
|
||||
padding-right:0;
|
||||
padding-left:0;
|
||||
}
|
||||
|
||||
.sub_bar{
|
||||
text-align:center;
|
||||
border:0.5px solid #aaa;
|
||||
margin-left:-5px;
|
||||
margin-right:-5px;
|
||||
}
|
||||
|
||||
.reset_btn{
|
||||
width:15ch;
|
||||
}
|
||||
|
||||
.submit_btn{
|
||||
margin-left:1em;
|
||||
width:15ch;
|
||||
}
|
||||
|
||||
.control_bar{
|
||||
margin-top:8pt;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
.col-form-label{
|
||||
text-align:right;
|
||||
padding-right:2ch;
|
||||
}
|
||||
|
||||
.form_list{
|
||||
padding:8pt;
|
||||
}
|
||||
|
||||
.half_section_left{
|
||||
padding-right:0;
|
||||
border-right:0.5px solid #aaa;
|
||||
}
|
||||
.half_section_right{
|
||||
padding-left:0;
|
||||
|
||||
}
|
||||
|
||||
.popover{
|
||||
max-width:100%;
|
||||
}
|
||||
@@ -1,8 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
class DB{
|
||||
//https://hub.packtpub.com/eloquent-without-laravel/
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
class DB
|
||||
{
|
||||
private static $uDB = null;
|
||||
private static ?Capsule $uIlluminate = null;
|
||||
|
||||
private static $host = '_tK_host_';
|
||||
private static $user = '_tK_user_';
|
||||
@@ -10,11 +18,36 @@ class DB{
|
||||
private static $dbName = '_tK_dbName_';
|
||||
private static $port = _tK_port_;
|
||||
private static $encoding = 'utf8mb4';
|
||||
private static $collation = 'utf8mb4_general_ci';
|
||||
|
||||
private static $prefix = '_tK_prefix_';
|
||||
|
||||
private function __construct(){
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function illuminate(): Capsule
|
||||
{
|
||||
if(self::$uIlluminate !== null){
|
||||
return self::$uIlluminate;
|
||||
}
|
||||
$capsule = new Capsule;
|
||||
|
||||
$capsule->addConnection([
|
||||
'driver' => 'mysql',
|
||||
'host' => self::$host,
|
||||
'database' => self::$dbName,
|
||||
'username' => self::$user,
|
||||
'password' => self::$password,
|
||||
'charset' => self::$encoding,
|
||||
'collation' => self::$collation,
|
||||
]);
|
||||
|
||||
$capsule->setEventDispatcher(new Dispatcher(new Container));
|
||||
$capsule->setAsGlobal();
|
||||
$capsule->bootEloquent();
|
||||
self::$uIlluminate = $capsule;
|
||||
return $capsule;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,12 +56,14 @@ class DB{
|
||||
* @return \MeekroDB
|
||||
* @suppress PhanTypeMismatchProperty
|
||||
*/
|
||||
public static function db(){
|
||||
if(self::$uDB === null){
|
||||
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
|
||||
public static function db()
|
||||
{
|
||||
if (self::$uDB === null) {
|
||||
self::$uDB = new \MeekroDB(self::$host, self::$user, self::$password, self::$dbName, self::$port, self::$encoding);
|
||||
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
|
||||
|
||||
self::$uDB->error_handler= function(){};
|
||||
self::$uDB->error_handler = function () {
|
||||
};
|
||||
self::$uDB->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
@@ -39,4 +74,4 @@ class DB{
|
||||
{
|
||||
return self::$prefix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class VersionGit extends VersionGitDynamic {
|
||||
}
|
||||
//{"version":"dynamic","hash":"dynamic"}
|
||||
@@ -2,8 +2,15 @@
|
||||
namespace sammo;
|
||||
|
||||
class VersionGit{
|
||||
public static $version = '_tK_verionGit_';
|
||||
static function getVersion()
|
||||
{
|
||||
return '_tK_verionGit_';
|
||||
}
|
||||
|
||||
static function getHash(){
|
||||
return '_tK_hash_';
|
||||
}
|
||||
|
||||
private function __construct(){}
|
||||
}
|
||||
//{"version":"_tK_verionGit_"}
|
||||
//{"version":"_tK_verionGit_","hash":"_tK_hash_"}
|
||||
|
||||
+358
-74
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace sammo;
|
||||
|
||||
use DateTime;
|
||||
use sammo\Event\Action;
|
||||
|
||||
require_once 'process_war.php';
|
||||
@@ -21,10 +22,10 @@ require_once('func_command.php');
|
||||
|
||||
/**
|
||||
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌
|
||||
*
|
||||
*
|
||||
* @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음. 0인 경우에는 재야임
|
||||
* @param bool $forceRefresh 강제 갱신 여부
|
||||
*
|
||||
*
|
||||
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
|
||||
*/
|
||||
function getNationStaticInfo($nationID, $forceRefresh = false)
|
||||
@@ -189,7 +190,7 @@ function myNationInfo(General $generalObj)
|
||||
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
|
||||
$nationID = $generalObj->getNationID();
|
||||
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID)??getNationStaticInfo(0);
|
||||
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID) ?? getNationStaticInfo(0);
|
||||
$city = $db->queryFirstRow(
|
||||
'SELECT COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop_max) as maxpop from city where nation=%i',
|
||||
$nationID
|
||||
@@ -198,16 +199,16 @@ function myNationInfo(General $generalObj)
|
||||
|
||||
$topChiefs = Util::convertArrayToDict($db->query('SELECT officer_level, no, name, npc FROM general WHERE nation = %i AND officer_level >= 11', $nationID), 'officer_level');
|
||||
|
||||
$level12Name = key_exists(12, $topChiefs)?getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']):'-';
|
||||
$level11Name = key_exists(11, $topChiefs)?getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']):'-';
|
||||
$level12Name = key_exists(12, $topChiefs) ? getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']) : '-';
|
||||
$level11Name = key_exists(11, $topChiefs) ? getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']) : '-';
|
||||
|
||||
$impossibleStrategicCommandLists = [];
|
||||
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
|
||||
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
|
||||
foreach($strategicCommandLists as $command){
|
||||
foreach ($strategicCommandLists as $command) {
|
||||
$cmd = buildNationCommandClass($command, $generalObj, $admin, new LastTurn());
|
||||
$nextAvailableTurn = $cmd->getNextAvailableTurn();
|
||||
if($nextAvailableTurn > $yearMonth){
|
||||
if ($nextAvailableTurn > $yearMonth) {
|
||||
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
|
||||
}
|
||||
}
|
||||
@@ -239,28 +240,28 @@ function myNationInfo(General $generalObj)
|
||||
<tr>
|
||||
<td class='bg1 center'><b>총주민</b></td>
|
||||
<td class='center'>";
|
||||
echo $nationID===0 ? "해당 없음" : "{$city['totpop']}/{$city['maxpop']}";
|
||||
echo $nationID === 0 ? "해당 없음" : "{$city['totpop']}/{$city['maxpop']}";
|
||||
echo "</td>
|
||||
<td class='bg1 center'><b>총병사</b></td>
|
||||
<td class='center'>";
|
||||
echo $nationID===0 ? "해당 없음" : "{$general['totcrew']}/{$general['maxcrew']}";
|
||||
echo $nationID === 0 ? "해당 없음" : "{$general['totcrew']}/{$general['maxcrew']}";
|
||||
echo "</td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bg1 center'><b>국 고</b></td>
|
||||
<td class='center'>";
|
||||
echo $nationID===0 ? "해당 없음" : "{$nation['gold']}";
|
||||
echo $nationID === 0 ? "해당 없음" : "{$nation['gold']}";
|
||||
echo "</td>
|
||||
<td class='bg1 center'><b>병 량</b></td>
|
||||
<td class='center'>";
|
||||
echo $nationID===0 ? "해당 없음" : "{$nation['rice']}";
|
||||
echo $nationID === 0 ? "해당 없음" : "{$nation['rice']}";
|
||||
echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bg1 center'><b>지급률</b></td>
|
||||
<td class='center'>";
|
||||
if ($nationID===0) {
|
||||
if ($nationID === 0) {
|
||||
echo "해당 없음";
|
||||
} else {
|
||||
echo $nation['bill'] == 0 ? "0 %" : "{$nation['bill']} %";
|
||||
@@ -269,7 +270,7 @@ function myNationInfo(General $generalObj)
|
||||
</td>
|
||||
<td class='bg1 center'><b>세 율</b></td>
|
||||
<td class='center'>";
|
||||
if ($nationID===0) {
|
||||
if ($nationID === 0) {
|
||||
echo "해당 없음";
|
||||
} else {
|
||||
echo $nation['rate'] == 0 ? "0 %" : "{$nation['rate']} %";
|
||||
@@ -285,7 +286,7 @@ function myNationInfo(General $generalObj)
|
||||
|
||||
$nation['tech'] = "$techCall / {$nation['tech']}";
|
||||
|
||||
if ($nationID===0) {
|
||||
if ($nationID === 0) {
|
||||
$nation['strategic_cmd_limit'] = "<font color=white>해당 없음</font>";
|
||||
$nation['surlimit'] = "<font color=white>해당 없음</font>";
|
||||
$nation['scout'] = "<font color=white>해당 없음</font>";
|
||||
@@ -294,20 +295,20 @@ function myNationInfo(General $generalObj)
|
||||
} else {
|
||||
if ($nation['strategic_cmd_limit'] != 0) {
|
||||
$nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>";
|
||||
} else if($impossibleStrategicCommandLists) {
|
||||
} else if ($impossibleStrategicCommandLists) {
|
||||
$nation['strategic_cmd_limit'] = "<font color=yellow>가 능</font>";
|
||||
} else{
|
||||
} else {
|
||||
$nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>";
|
||||
}
|
||||
|
||||
if($impossibleStrategicCommandLists){
|
||||
if ($impossibleStrategicCommandLists) {
|
||||
$text = [];
|
||||
foreach($impossibleStrategicCommandLists as [$cmdName, $remainTurn]){
|
||||
foreach ($impossibleStrategicCommandLists as [$cmdName, $remainTurn]) {
|
||||
$text[] = "{$cmdName}: {$remainTurn}턴 뒤";
|
||||
}
|
||||
$nation['strategic_cmd_limit'] = $templates->render('tooltip', [
|
||||
'text'=>'<span style="text-decoration:underline dashed;">'.$nation['strategic_cmd_limit'].'</span>',
|
||||
'info'=>'<span class="text-left d-inline-block">'.join('<br>', $text).'</span>',
|
||||
'text' => '<span style="text-decoration:underline dashed;">' . $nation['strategic_cmd_limit'] . '</span>',
|
||||
'info' => '<span class="text-left d-inline-block">' . join('<br>', $text) . '</span>',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -336,11 +337,11 @@ function myNationInfo(General $generalObj)
|
||||
<tr>
|
||||
<td style='text-align:center;' class='bg1'><b>속 령</b></td>
|
||||
<td style='text-align:center;'>";
|
||||
echo $nationID===0 ? "-" : "{$city['cnt']}";
|
||||
echo $nationID === 0 ? "-" : "{$city['cnt']}";
|
||||
echo "</td>
|
||||
<td style='text-align:center;' class='bg1'><b>장 수</b></td>
|
||||
<td style='text-align:center;'>";
|
||||
echo $nationID===0 ? "-" : "{$general['cnt']}";
|
||||
echo $nationID === 0 ? "-" : "{$general['cnt']}";
|
||||
echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -348,7 +349,7 @@ function myNationInfo(General $generalObj)
|
||||
<td style='text-align:center;'>{$nation['power']}</td>
|
||||
<td style='text-align:center;' class='bg1'><b>기술력</b></td>
|
||||
<td style='text-align:center;'>";
|
||||
echo $nationID===0 ? "-" : "{$nation['tech']}";
|
||||
echo $nationID === 0 ? "-" : "{$nation['tech']}";
|
||||
echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -903,17 +904,16 @@ function nationMsg(General $general)
|
||||
$db = DB::db();
|
||||
$nationID = $general->getNationID();
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
|
||||
return $nationStor->notice??'';
|
||||
|
||||
return $nationStor->notice ?? '';
|
||||
}
|
||||
|
||||
function banner()
|
||||
{
|
||||
|
||||
return sprintf(
|
||||
'<font size=2>%s %s / %s</font>',
|
||||
GameConst::$title,
|
||||
VersionGit::$version,
|
||||
VersionGit::getVersion(),
|
||||
GameConst::$banner
|
||||
);
|
||||
}
|
||||
@@ -1006,7 +1006,7 @@ function increaseRefresh($type = "", $cnt = 1)
|
||||
$isunited = $gameStor->isunited;
|
||||
$opentime = $gameStor->opentime;
|
||||
|
||||
if ($isunited != 2 && $generalID && $userGrade < 6 && $opentime <= TimeUtil::DatetimeNow()) {
|
||||
if ($isunited != 2 && $generalID && $userGrade < 6 && $opentime <= TimeUtil::now()) {
|
||||
$db->update('general', [
|
||||
'lastrefresh' => $date,
|
||||
'con' => $db->sqleval('con + %i', $cnt),
|
||||
@@ -1224,17 +1224,17 @@ function updateOnline()
|
||||
|
||||
//동접수
|
||||
$before5Min = TimeUtil::nowAddMinutes(-5);
|
||||
$onlineUser = $db->query('SELECT no,name,nation FROM general WHERE lastrefresh > %s', $before5Min);
|
||||
$onlineUser = $db->query('SELECT no,name,nation FROM general WHERE lastrefresh > %s AND npc < 2', $before5Min);
|
||||
$onlineNum = count($onlineUser);
|
||||
$onlineNationUsers = Util::arrayGroupBy($onlineUser, 'nation');
|
||||
|
||||
uasort($onlineNationUsers, function(array $lhs, array $rhs){
|
||||
return -(count($lhs)<=>count($rhs));
|
||||
|
||||
uasort($onlineNationUsers, function (array $lhs, array $rhs) {
|
||||
return - (count($lhs) <=> count($rhs));
|
||||
});
|
||||
|
||||
$onlineNation = [];
|
||||
$onlineNation = [];
|
||||
|
||||
foreach($onlineNationUsers as $nationID=>$rawOnlineUser){
|
||||
foreach ($onlineNationUsers as $nationID => $rawOnlineUser) {
|
||||
$nationName = getNationStaticInfo($nationID)['name'];
|
||||
$onlineNation[] = "【{$nationName}】";
|
||||
$userList = join(', ', Util::squeezeFromArray($rawOnlineUser, 'name'));
|
||||
@@ -1256,9 +1256,12 @@ function addAge()
|
||||
//나이와 호봉 증가
|
||||
$db->update('general', [
|
||||
'age' => $db->sqleval('age+1'),
|
||||
'belong' => $db->sqleval('belong+1')
|
||||
], true);
|
||||
|
||||
$db->update('general', [
|
||||
'belong' => $db->sqleval('belong+1')
|
||||
], 'nation != 0');
|
||||
|
||||
[$startYear, $year, $month] = $gameStor->getValuesAsArray(['startyear', 'year', 'month']);
|
||||
|
||||
if ($year >= $startYear + 3) {
|
||||
@@ -1266,7 +1269,7 @@ function addAge()
|
||||
$generalID = $general['no'];
|
||||
$special = SpecialityHelper::pickSpecialDomestic(
|
||||
$general,
|
||||
(Json::decode($general['aux'])['prev_types_special'])??[]
|
||||
(Json::decode($general['aux'])['prev_types_special']) ?? []
|
||||
);
|
||||
$specialClass = buildGeneralSpecialDomesticClass($special);
|
||||
$specialText = $specialClass->getName();
|
||||
@@ -1283,16 +1286,25 @@ function addAge()
|
||||
|
||||
foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5,aux from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general) {
|
||||
$generalID = $general['no'];
|
||||
$special2 = SpecialityHelper::pickSpecialWar(
|
||||
$general,
|
||||
(Json::decode($general['aux'])['prev_types_special2'])??[]
|
||||
);
|
||||
$generalAux = Json::decode($general['aux']);
|
||||
|
||||
$updateVars = [];
|
||||
if (key_exists('inheritSpecificSpecialWar', $generalAux)) {
|
||||
$special2 = $generalAux['inheritSpecificSpecialWar'];
|
||||
unset($generalAux['inheritSpecificSpecialWar']);
|
||||
$updateVars['aux'] = Json::encode($generalAux);
|
||||
} else {
|
||||
$special2 = SpecialityHelper::pickSpecialWar(
|
||||
$general,
|
||||
($generalAux['prev_types_special2']) ?? []
|
||||
);
|
||||
}
|
||||
|
||||
$specialClass = buildGeneralSpecialWarClass($special2);
|
||||
$specialText = $specialClass->getName();
|
||||
|
||||
$db->update('general', [
|
||||
'special2' => $special2
|
||||
], 'no=%i', $general['no']);
|
||||
$updateVars['special2'] = $special2;
|
||||
$db->update('general', $updateVars, 'no=%i', $general['no']);
|
||||
|
||||
$logger = new ActionLogger($generalID, $general['nation'], $year, $month);
|
||||
|
||||
@@ -1537,7 +1549,18 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
|
||||
//일단은 '획득' 시에만 동작하므로 이대로 사용하기로...
|
||||
$occupiedUnique = [];
|
||||
|
||||
$invalidItemType = [];
|
||||
foreach (array_keys(GameConst::$allItems) as $itemType) {
|
||||
$ownItem = $general->getItems()[$itemType] ?? null;
|
||||
if ($ownItem !== null && !$ownItem->isBuyable()) {
|
||||
$invalidItemType[$itemType] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (array_keys(GameConst::$allItems) as $itemType) {
|
||||
if (key_exists($itemType, $invalidItemType)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($db->queryAllLists('SELECT %b, count(*) as cnt FROM general GROUP BY %b', $itemType, $itemType) as [$itemCode, $cnt]) {
|
||||
$itemClass = buildItemClass($itemCode);
|
||||
if (!$itemClass) {
|
||||
@@ -1551,7 +1574,13 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
|
||||
}
|
||||
|
||||
foreach (GameConst::$allItems as $itemType => $itemCategories) {
|
||||
if (key_exists($itemType, $invalidItemType)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($itemCategories as $itemCode => $cnt) {
|
||||
if ($cnt == 0) {
|
||||
continue;
|
||||
}
|
||||
if (!key_exists($itemCode, $occupiedUnique)) {
|
||||
$availableUnique[] = [[$itemType, $itemCode], $cnt];
|
||||
continue;
|
||||
@@ -1565,9 +1594,19 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
|
||||
}
|
||||
|
||||
if (!$availableUnique) {
|
||||
if ($general->getAuxVar('inheritRandomUnique')) {
|
||||
$general->setAuxVar('inheritRandomUnique', null);
|
||||
$general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint);
|
||||
$userLogger = new UserLogger($general->getVar('owner'));
|
||||
$userLogger->push(sprintf("얻을 유니크가 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($general->getAuxVar('inheritRandomUnique')) {
|
||||
$general->setAuxVar('inheritRandomUnique', null);
|
||||
}
|
||||
|
||||
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
|
||||
|
||||
$nationName = $general->getStaticNation()['name'];
|
||||
@@ -1591,6 +1630,207 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
|
||||
return true;
|
||||
}
|
||||
|
||||
function rollbackInheritUniqueTrial(General $general, string $itemKey, string $reason)
|
||||
{
|
||||
|
||||
$ownerID = $general->getVar('owner');
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
|
||||
LogText("선택유니크 롤백:{$ownerID}", [$itemKey, $itemTrials]);
|
||||
unset($itemTrials[$itemKey]);
|
||||
if(count($itemTrials) == 0){
|
||||
$itemTrials = null;
|
||||
}
|
||||
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
|
||||
|
||||
|
||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}");
|
||||
$ownTrial = $trialStor->getValue("u{$ownerID}");
|
||||
|
||||
$itemObj = buildItemClass($itemKey);
|
||||
$itemName = $itemObj->getName();
|
||||
|
||||
if ($ownTrial) {
|
||||
//두 값이 general, KVStorage 둘다 있고, 이중에선 KVStorage 값을 기준으로 하자 따르자
|
||||
[,, $amount] = $ownTrial;
|
||||
$trialStor->deleteValue("u{$ownerID}");
|
||||
$general->increaseInheritancePoint('previous', $amount);
|
||||
LogText("선택유니크 롤백포인트:{$ownerID}", $amount);
|
||||
|
||||
$userLogger = new UserLogger($ownerID);
|
||||
$userLogger->push("{$itemName} 입찰에 사용한 {$amount} 포인트 반환", "inheritPoint");
|
||||
}
|
||||
|
||||
//메시지
|
||||
|
||||
$staticNation = $general->getStaticNation();
|
||||
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
$src = new MessageTarget(0, '', 0, 'System', '#000000');
|
||||
$dest = new MessageTarget($general->getID(), $general->getName(), $general->getNationID(), $staticNation['name'], $staticNation['color'], GetImageURL($general->getVar('imgsvr'), $general->getVar('picture')));
|
||||
$josaUl = JosaUtil::pick($itemName, '을');
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_PRIVATE,
|
||||
$src,
|
||||
$dest,
|
||||
"{$itemName}{$josaUl} 얻지 못했습니다. {$reason}",
|
||||
new DateTime(),
|
||||
$unlimited,
|
||||
[]
|
||||
);
|
||||
|
||||
$general->applyDB($db);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
function tryRollbackInheritUniqueItem(General $general): void
|
||||
{
|
||||
tryInheritUniqueItem($general, 'Rollback', true);
|
||||
}
|
||||
|
||||
function tryInheritUniqueItem(General $general, string $acquireType = '아이템', bool $justRollback = false): bool
|
||||
{
|
||||
$ownerID = $general->getVar('owner');
|
||||
if (!$ownerID) {
|
||||
LogText("선택유니크 실패???: {$ownerID}", $general->getName());
|
||||
return false;
|
||||
}
|
||||
|
||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial') ?? [];
|
||||
arsort($itemTrials);
|
||||
LogText("선택유니크항목: {$ownerID}", $itemTrials);
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$ownTarget = null;
|
||||
$ownType = null;
|
||||
|
||||
foreach ($itemTrials as $itemKey => $amount) {
|
||||
$availableItemTypes = [];
|
||||
$reasons = [];
|
||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||
//아직은 그런 경우는 없지만 동일 유니크를 여러 부위에 장착할 수 있을지도 모름
|
||||
if (!key_exists($itemKey, $itemList)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ownItem = $general->getItem($itemType);
|
||||
if ($ownItem->getRawClassName() == $itemKey) {
|
||||
$reasons[] = '이미 그 유니크를 가지고 있습니다.';
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
if (!$ownItem->isBuyable()) {
|
||||
$reasons[] = '이미 다른 유니크를 가지고 있습니다.';
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
$availableCnt = $itemList[$itemKey];
|
||||
$occupiedCnt = $db->queryFirstField('SELECT count(*) FROM general WHERE %b = %s', $itemType, $itemKey);
|
||||
if ($occupiedCnt >= $availableCnt) {
|
||||
$reasons[] = '그 유니크는 모두 점유되었습니다.';
|
||||
continue;
|
||||
}
|
||||
$availableItemTypes[] = $itemType;
|
||||
}
|
||||
|
||||
if (!$availableItemTypes) {
|
||||
rollbackInheritUniqueTrial($general, $itemKey, join(' ', $reasons));
|
||||
continue;
|
||||
}
|
||||
$reasons = [];
|
||||
|
||||
$itemType = Util::choiceRandom($availableItemTypes);
|
||||
|
||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}"); //혹시 itemKey의 크기가 37이 넘을 수 있을까?
|
||||
$anyTrials = $trialStor->getAll();
|
||||
if (!$anyTrials) {
|
||||
//순서가 꼬였던 모양, 실제 값은 storage를 우선시하자
|
||||
rollbackInheritUniqueTrial($general, $itemKey, '절차상의 오류입니다.');
|
||||
continue;
|
||||
}
|
||||
|
||||
//XXX: 정렬할 필요 없지 않나?
|
||||
usort($anyTrials, function ($lhsTrial, $rhsTrial) {
|
||||
[,, $lhsAmount] = $lhsTrial;
|
||||
[,, $rhsAmount] = $rhsTrial;
|
||||
return $rhsAmount <=> $lhsAmount; //큰 값이 앞에 오도록
|
||||
});
|
||||
|
||||
LogText("선택유니크상태 {$ownerID} {$itemKey}", $anyTrials);
|
||||
|
||||
//공동 1등인데 본인이 있을 수도 있다.
|
||||
[,, $topAmount] = $anyTrials[0];
|
||||
if ($amount < $topAmount) {
|
||||
$compAmount = $topAmount / $amount;
|
||||
if ($compAmount > 2.0) {
|
||||
$compText = '엄청난 차이로 ';
|
||||
} else if ($compAmount > 1.2) {
|
||||
$compText = '큰 차이로 ';
|
||||
} else if ($compAmount > 1.05) {
|
||||
$compText = '';
|
||||
} else {
|
||||
$compText = '아슬아슬한 차이로 ';
|
||||
}
|
||||
rollbackInheritUniqueTrial($general, $itemKey, "{$compText}상위 입찰한 장수가 있습니다.");
|
||||
continue;
|
||||
}
|
||||
|
||||
//내가 1위다
|
||||
if ($ownTarget !== null) {
|
||||
//이미 다른 아이템을 얻기로 되어있다.
|
||||
continue;
|
||||
}
|
||||
$ownTarget = $itemKey;
|
||||
$ownType = $itemType;
|
||||
}
|
||||
unset($itemKey);
|
||||
unset($itemType);
|
||||
|
||||
if ($ownTarget === null) {
|
||||
return false;
|
||||
}
|
||||
if ($justRollback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LogText("선택유니크획득{$ownerID}", $ownTarget);
|
||||
|
||||
$trialStor = KVStorage::getStorage($db, "ut_{$ownTarget}");
|
||||
$trialStor->deleteValue("u{$ownerID}");
|
||||
|
||||
//rollbackInheritUniqueTrial 과정 때문에 새로 받아와야함
|
||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
|
||||
unset($itemTrials[$ownTarget]);
|
||||
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
|
||||
|
||||
$nationName = $general->getStaticNation()['name'];
|
||||
$generalName = $general->getName();
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$itemObj = buildItemClass($ownTarget);
|
||||
$itemName = $itemObj->getName();
|
||||
$itemRawName = $itemObj->getRawName();
|
||||
$josaUl = JosaUtil::pick($itemRawName, '을');
|
||||
|
||||
|
||||
$general->setVar($ownType, $ownTarget);
|
||||
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$logger->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 습득했습니다!");
|
||||
$logger->pushGeneralHistoryLog("<C>{$itemName}</>{$josaUl} 습득");
|
||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
|
||||
$logger->pushGlobalHistoryLog("<C><b>【{$acquireType}】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function tryUniqueItemLottery(General $general, string $acquireType = '아이템'): bool
|
||||
{
|
||||
$db = DB::db();
|
||||
@@ -1600,41 +1840,77 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($general->getNPCType() > 6) {
|
||||
$inheritUnique = $general->getAuxVar('inheritUniqueTrial');
|
||||
if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique)) {
|
||||
LogText("유니크 준비?? {$general->getID()}", $inheritUnique);
|
||||
$trialResult = tryInheritUniqueItem($general, $acquireType);
|
||||
if ($trialResult) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$itemTypeCnt = count(GameConst::$allItems);
|
||||
$trialCnt = $itemTypeCnt;
|
||||
|
||||
foreach ($general->getItems() as $item) {
|
||||
if (!$item->isBuyable()) {
|
||||
$trialCnt -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($trialCnt <= 0) {
|
||||
LogText("{$general->getName()}, {$general->getID()} 모든 아이템", $trialCnt);
|
||||
if ($general->getAuxVar('inheritRandomUnique')) {
|
||||
$general->setAuxVar('inheritRandomUnique', null);
|
||||
$general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint);
|
||||
$userLogger = new UserLogger($general->getVar('owner'));
|
||||
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($general->getItems() as $item) {
|
||||
if (!$item) {
|
||||
continue;
|
||||
}
|
||||
if (!$item->isBuyable()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scenario = $gameStor->scenario;
|
||||
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
||||
|
||||
if ($scenario < 100) {
|
||||
$prob = 1 / ($genCount * 5); // 5~6개월에 하나씩 등장
|
||||
$prob = 1 / ($genCount * 3 * $itemTypeCnt); // 3~4개월에 하나씩 등장
|
||||
} else {
|
||||
$prob = 1 / $genCount; // 1~2개월에 하나씩 등장
|
||||
$prob = 1 / ($genCount * $itemTypeCnt); // 1~2개월에 하나씩 등장
|
||||
}
|
||||
|
||||
if ($acquireType == '설문조사') {
|
||||
$prob = 1 / ($genCount * 0.7 / 3); // 투표율 70%, 설문조사 한번에 2~3개 등장
|
||||
$prob = 1 / ($genCount * $itemTypeCnt * 0.7 / 3); // 투표율 70%, 설문조사 한번에 2~3개 등장
|
||||
} else if ($acquireType == '랜덤 임관') {
|
||||
$prob = 1 / ($genCount / 10 / 2); // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
|
||||
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 2); // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
|
||||
} else if ($acquireType == '건국') {
|
||||
$prob = 1 / ($genCount / 10 / 4); // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
|
||||
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 4); // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
|
||||
}
|
||||
|
||||
$prob = Util::valueFit($prob, null, 1 / 3);
|
||||
$prob = Util::valueFit($prob, null, 1 / 4); //최대치 감소
|
||||
$result = false;
|
||||
|
||||
if (!Util::randBool($prob)) {
|
||||
$prob /= sqrt(2);
|
||||
$moreProb = pow(2, 1 / 4);
|
||||
|
||||
if ($general->getAuxVar('inheritRandomUnique')) {
|
||||
//포인트로 랜덤 유니크 획득
|
||||
$prob = 1;
|
||||
}
|
||||
|
||||
foreach (Util::range($trialCnt) as $_idx) {
|
||||
if (Util::randBool($prob)) {
|
||||
$result = true;
|
||||
break;
|
||||
}
|
||||
$prob *= $moreProb;
|
||||
}
|
||||
if (!$result) {
|
||||
LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$trialCnt}", $prob);
|
||||
return false;
|
||||
}
|
||||
LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$trialCnt}", $prob);
|
||||
|
||||
return giveRandomUniqueItem($general, $acquireType);
|
||||
}
|
||||
@@ -1647,7 +1923,7 @@ function getAdmin()
|
||||
}
|
||||
|
||||
/** @return General[] */
|
||||
function deleteNation(General $lord, bool $applyDB):array
|
||||
function deleteNation(General $lord, bool $applyDB): array
|
||||
{
|
||||
$lordID = $lord->getID();
|
||||
$nationID = $lord->getNationID();
|
||||
@@ -1656,7 +1932,7 @@ function deleteNation(General $lord, bool $applyDB):array
|
||||
|
||||
$db = DB::db();
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nationID);
|
||||
$nationName = $nation['name'];
|
||||
|
||||
@@ -1665,17 +1941,18 @@ function deleteNation(General $lord, bool $applyDB):array
|
||||
$josaUn = JosaUtil::pick($nationName, '은');
|
||||
$logger->pushGlobalHistoryLog("<R><b>【멸망】</b></><D><b>{$nationName}</b></>{$josaUn} <R>멸망</>했습니다.");
|
||||
|
||||
|
||||
|
||||
$nationGeneralList = General::createGeneralObjListFromDB(
|
||||
$db->queryFirstColumn(
|
||||
'SELECT `no` FROM general WHERE nation=%i AND no != %i',
|
||||
$nationID,
|
||||
$lordID
|
||||
),
|
||||
['npc', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'aux'], 1
|
||||
),
|
||||
['npc', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'belong', 'aux'],
|
||||
1
|
||||
);
|
||||
$nationGeneralList[$lordID] = $lord;
|
||||
|
||||
|
||||
$nation['generals'] = array_keys($nationGeneralList);
|
||||
$nation['aux'] = Json::decode($nation['aux']);
|
||||
$nation['msg'] = $nationStor->notice;
|
||||
@@ -1688,7 +1965,14 @@ function deleteNation(General $lord, bool $applyDB):array
|
||||
$destroyHistoryLog = "<D><b>{$nationName}</b></>{$josaYi} <R>멸망</>";
|
||||
|
||||
// 전 장수 재야로
|
||||
foreach($nationGeneralList as $general){
|
||||
foreach ($nationGeneralList as $general) {
|
||||
$general->setAuxVar(
|
||||
'max_belong',
|
||||
max(
|
||||
$general->getVar('belong'),
|
||||
$general->getAuxVar('max_belong') ?? 0
|
||||
)
|
||||
);
|
||||
$general->setVar('belong', 0);
|
||||
$general->setVar('troop', 0);
|
||||
$general->setVar('officer_level', 0);
|
||||
@@ -1699,7 +1983,7 @@ function deleteNation(General $lord, bool $applyDB):array
|
||||
$logger->pushGeneralActionLog($destroyLog, ActionLogger::PLAIN);
|
||||
$logger->pushGeneralHistoryLog($destroyHistoryLog);
|
||||
|
||||
if($applyDB){
|
||||
if ($applyDB) {
|
||||
$general->applyDB($db);
|
||||
}
|
||||
}
|
||||
@@ -1736,7 +2020,7 @@ function nextRuler(General $general)
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||
[$year, $month, $fiction] = $gameStor->getValuesAsArray(['year', 'month', 'fiction']);
|
||||
$nation = $general->getStaticNation();
|
||||
$nationName = $nation['name'];
|
||||
$nationID = $nation['nation'];
|
||||
@@ -1744,7 +2028,7 @@ function nextRuler(General $general)
|
||||
$candidate = null;
|
||||
|
||||
//npc or npc유저인 경우 후계 찾기
|
||||
if ($general->getNPCType() > 0) {
|
||||
if (!$fiction && $general->getNPCType() > 0) {
|
||||
$candidate = $db->queryFirstRow(
|
||||
'SELECT no,name,officer_level,IF(ABS(affinity-%i)>75,150-ABS(affinity-%i),ABS(affinity-%i)) as npcmatch2 from general where nation=%i and officer_level!=12 and 1 <= npc and npc<=3 order by npcmatch2,rand() LIMIT 1',
|
||||
$general->getVar('affinity'),
|
||||
@@ -1847,7 +2131,7 @@ function searchDistance(int $from, int $maxDist = 99, bool $distForm = false)
|
||||
* @param $from 기준 도시 코드
|
||||
* @param $to 대상 도시 코드
|
||||
* @param array|null $linkNationList 경로에 해당하는 국가 리스트, null인 경우 제한 없음
|
||||
* @return null|int 거리.
|
||||
* @return null|int 거리.
|
||||
*/
|
||||
function calcCityDistance(int $from, int $to, ?array $linkNationList): ?int
|
||||
{
|
||||
@@ -1861,7 +2145,7 @@ function calcCityDistance(int $from, int $to, ?array $linkNationList): ?int
|
||||
|
||||
if ($linkNationList !== null) {
|
||||
$db = DB::db();
|
||||
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
|
||||
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
|
||||
$allowedCityList = [];
|
||||
foreach ($db->queryFirstColumn(
|
||||
'SELECT city FROM city WHERE nation IN %li',
|
||||
@@ -1924,7 +2208,7 @@ function searchDistanceListToDest(int $from, int $to, array $linkNationList)
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
|
||||
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
|
||||
$allowedCityList = [];
|
||||
foreach ($db->queryAllLists(
|
||||
'SELECT city, nation FROM city WHERE nation IN %li',
|
||||
@@ -2118,7 +2402,7 @@ function getRandTurn($term, ?\DateTimeInterface $baseDateTime = null)
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수
|
||||
|
||||
return $baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s');
|
||||
return TimeUtil::format($baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction)), true);
|
||||
}
|
||||
|
||||
function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null)
|
||||
@@ -2133,5 +2417,5 @@ function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null)
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수
|
||||
|
||||
return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s');
|
||||
return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s.u');
|
||||
}
|
||||
|
||||
+37
-12
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
@@ -6,7 +6,7 @@ use sammo\Command\BaseCommand;
|
||||
|
||||
/**
|
||||
* Value Converter
|
||||
*
|
||||
*
|
||||
* Side effect 없이 값의 변환만을 수행하는 함수들의 모음.
|
||||
* (단, autoload, 정적 변수 초기화는 허용)
|
||||
*/
|
||||
@@ -175,7 +175,7 @@ function buildNationTypeClass(?string $type):BaseNation{
|
||||
return $cache[$type];
|
||||
}
|
||||
$class = getNationTypeClass($type);
|
||||
|
||||
|
||||
$obj = new $class();
|
||||
$cache[$type]= $obj;
|
||||
return $obj;
|
||||
@@ -241,7 +241,7 @@ function buildItemClass(?string $type):BaseItem{
|
||||
return $cache[$type];
|
||||
}
|
||||
$class = getItemClass($type);
|
||||
|
||||
|
||||
$obj = new $class();
|
||||
$cache[$type]= $obj;
|
||||
return $obj;
|
||||
@@ -276,7 +276,7 @@ function buildGeneralSpecialDomesticClass(?string $type):BaseSpecial{
|
||||
return $cache[$type];
|
||||
}
|
||||
$class = getGeneralSpecialDomesticClass($type);
|
||||
|
||||
|
||||
$obj = new $class();
|
||||
$cache[$type]= $obj;
|
||||
return $obj;
|
||||
@@ -311,7 +311,7 @@ function buildGeneralSpecialWarClass(?string $type):BaseSpecial{
|
||||
return $cache[$type];
|
||||
}
|
||||
$class = getGeneralSpecialWarClass($type);
|
||||
|
||||
|
||||
$obj = new $class();
|
||||
$cache[$type]= $obj;
|
||||
return $obj;
|
||||
@@ -357,6 +357,31 @@ function buildNationCommandClass(?string $type, General $generalObj, array $env,
|
||||
return new $class($generalObj, $env, $lastTurn, $arg);
|
||||
}
|
||||
|
||||
function getAPIExecutorClass($path){
|
||||
|
||||
static $basePath = __NAMESPACE__.'\\API\\';
|
||||
if(is_string($path)){
|
||||
}
|
||||
else if(is_array($path)){
|
||||
$path = join('\\', $path);
|
||||
}
|
||||
else{
|
||||
throw new \InvalidArgumentException("{$path}는 올바른 API 지시자가 아님");
|
||||
}
|
||||
|
||||
$classPath = str_replace('/', '\\', $basePath.$path);
|
||||
|
||||
if(class_exists($classPath)){
|
||||
return $classPath;
|
||||
}
|
||||
throw new \InvalidArgumentException("{$path}는 올바른 API 경로가 아님");
|
||||
}
|
||||
|
||||
function buildAPIExecutorClass($type, string $rootPath, array $args):\sammo\BaseAPI{
|
||||
$class = getAPIExecutorClass($type);
|
||||
return new $class($rootPath, $args);
|
||||
}
|
||||
|
||||
function getWarUnitTriggerClass(string $type){
|
||||
static $basePath = __NAMESPACE__.'\\WarUnitTrigger\\';
|
||||
$classPath = ($basePath.$type);
|
||||
@@ -391,8 +416,8 @@ function getGeneralPoolClass(string $type){
|
||||
|
||||
/**
|
||||
* @param \MeekroDB $db
|
||||
* @param int $owner
|
||||
* @param int $pickCnt
|
||||
* @param int $owner
|
||||
* @param int $pickCnt
|
||||
* @param null|string $prefix
|
||||
* @return AbsGeneralPool[]
|
||||
*/
|
||||
@@ -538,8 +563,8 @@ function getExpLevel($experience) {
|
||||
|
||||
function getDedLevel($dedication) {
|
||||
$level = Util::valueFit(
|
||||
ceil(sqrt($dedication) / 10),
|
||||
0,
|
||||
ceil(sqrt($dedication) / 10),
|
||||
0,
|
||||
GameConst::$maxDedLevel
|
||||
);
|
||||
|
||||
@@ -572,7 +597,7 @@ function getCost(int $armtype) : int {
|
||||
function getTechLevel($tech):int{
|
||||
return Util::valueFit(
|
||||
floor($tech / 1000),
|
||||
0,
|
||||
0,
|
||||
GameConst::$maxTechLevel
|
||||
);
|
||||
}
|
||||
@@ -583,7 +608,7 @@ function TechLimit($startYear, $year, $tech) : bool {
|
||||
|
||||
$relMaxTech = Util::valueFit(
|
||||
floor($relYear / 5) + 1,
|
||||
1,
|
||||
1,
|
||||
GameConst::$maxTechLevel
|
||||
);
|
||||
|
||||
|
||||
+84
-14
@@ -623,30 +623,38 @@ function updateNationState()
|
||||
$nation['nation'],
|
||||
$targetKillTurn
|
||||
);
|
||||
$nationGenList = General::createGeneralObjListFromDB($nationGenIDList, ['belong'], 2);
|
||||
$nationGenList = General::createGeneralObjListFromDB($nationGenIDList, ['belong', 'npc', 'aux'], 2);
|
||||
$chiefObj = null;
|
||||
|
||||
$uniqueLotteryWeightList = [];
|
||||
foreach ($nationGenList as $nationGen) {
|
||||
$hasUnique = false;
|
||||
if ($nationGen->getVar('officer_level') == 12) {
|
||||
$chiefObj = $nationGen;
|
||||
}
|
||||
$trialCnt = count(GameConst::$allItems);
|
||||
|
||||
foreach ($nationGen->getItems() as $item) {
|
||||
if (!$item->isBuyable()) {
|
||||
$hasUnique = true;
|
||||
break;
|
||||
$trialCnt -= 1;
|
||||
}
|
||||
}
|
||||
if ($hasUnique) {
|
||||
|
||||
if ($trialCnt <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$score = $nationGen->getVar('belong') + 5;
|
||||
|
||||
if ($nationGen->getVar('officer_level') == 12) {
|
||||
$score += 200; //NOTE: 꼬우면 군주하세요.
|
||||
$score += 100; //NOTE: 꼬우면 군주하세요.
|
||||
} else if ($nationGen->getVar('officer_level') == 11) {
|
||||
$score += 70;
|
||||
$score += 50;
|
||||
} else if ($nationGen->getVar('officer_level') > 4) {
|
||||
$score += 35;
|
||||
}
|
||||
|
||||
$score *= $trialCnt;
|
||||
|
||||
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
|
||||
}
|
||||
|
||||
@@ -661,6 +669,10 @@ function updateNationState()
|
||||
giveRandomUniqueItem($winnerObj, '작위보상');
|
||||
$winnerObj->applyDB($db);
|
||||
}
|
||||
|
||||
if($chiefObj){
|
||||
$chiefObj->increaseInheritancePoint('unifier', 250 * $levelDiff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,7 +694,7 @@ function updateNationState()
|
||||
$lastAssemblerID += 1;
|
||||
$npcObj = new Scenario\GeneralBuilder(
|
||||
sprintf('부대장%4d', $lastAssemblerID),
|
||||
0,
|
||||
false,
|
||||
null,
|
||||
$nation['nation']
|
||||
);
|
||||
@@ -733,7 +745,7 @@ function checkStatistic()
|
||||
];
|
||||
|
||||
$avgGeneral = $db->queryFirstRow(
|
||||
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex,
|
||||
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex,
|
||||
max(dex1+dex2+dex3+dex4) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded
|
||||
FROM general'
|
||||
);
|
||||
@@ -978,6 +990,15 @@ function checkEmperior()
|
||||
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
|
||||
$nationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaYi} 전토를 통일");
|
||||
|
||||
foreach(General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc = 0')) as $genObj){
|
||||
if($genObj->getNationID() == $nationID){
|
||||
if($genObj->getVar('officer_level') > 4){
|
||||
$genObj->increaseInheritancePoint('unifier', 2000);
|
||||
};
|
||||
}
|
||||
$genObj->mergeTotalInheritancePoint();
|
||||
}
|
||||
|
||||
$gameStor->isunited = 2;
|
||||
$gameStor->conlimit = $gameStor->conlimit * 100;
|
||||
|
||||
@@ -1001,8 +1022,8 @@ function checkEmperior()
|
||||
$nation['generals'] = $nationGenerals;
|
||||
|
||||
$tigers = $db->query(
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
|
||||
$nationID
|
||||
); // 오호장군
|
||||
@@ -1013,8 +1034,8 @@ function checkEmperior()
|
||||
}, $tigers));
|
||||
|
||||
$eagles = $db->query(
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
'SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
|
||||
$nationID
|
||||
); // 건안칠자
|
||||
@@ -1031,7 +1052,7 @@ function checkEmperior()
|
||||
$generalLogger->flush();
|
||||
}
|
||||
|
||||
$gen = join(', ', array_column($rawGeneral, 'name'));
|
||||
$gen = join(', ', array_column($rawGeneralList, 'name'));
|
||||
|
||||
$stat = $db->queryFirstRow('SELECT max(nation_count) as nc, max(gen_count) as gc FROM statistic');
|
||||
$genCnt = $db->queryFirstField('SELECT count(*) FROM general');
|
||||
@@ -1128,3 +1149,52 @@ function checkEmperior()
|
||||
//연감 월결산
|
||||
LogHistory();
|
||||
}
|
||||
|
||||
function resetInheritanceUser(int $userID, bool $isRebirth=false):float{
|
||||
$rebirthDegraded = [
|
||||
'dex'=>0.5,
|
||||
];
|
||||
|
||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
|
||||
$totalPoint = 0;
|
||||
$allPoints = $inheritStor->getAll();
|
||||
if(!$allPoints || count($allPoints) == 0){
|
||||
//비었으므로 리셋 안함
|
||||
return 0;
|
||||
}
|
||||
if(count($allPoints) == 1 && key_exists('previous', $allPoints)){
|
||||
//이미 리셋되었으므로 리셋 안함
|
||||
return $allPoints['previous'][0];
|
||||
}
|
||||
|
||||
$userLogger = new UserLogger($userID);
|
||||
|
||||
$previousPoint = ($allPoints['previous']??[0,0])[0];
|
||||
|
||||
foreach($allPoints as $key=>[$value,]){
|
||||
if($isRebirth && key_exists($key, $rebirthDegraded)){
|
||||
$value *= $rebirthDegraded[$key];
|
||||
}
|
||||
$keyText = General::INHERITANCE_KEY[$key][2];
|
||||
$userLogger->push("{$keyText} 포인트 {$value} 증가", "inheritPoint");
|
||||
$totalPoint += $value;
|
||||
}
|
||||
$totalPoint = Util::toInt($totalPoint);
|
||||
$userLogger->push("포인트 {$previousPoint} => {$totalPoint}", "inheritPoint");
|
||||
$userLogger->flush();
|
||||
|
||||
$inheritStor->resetValues();
|
||||
$inheritStor->setValue('previous', [$totalPoint, null]);
|
||||
return $totalPoint;
|
||||
}
|
||||
|
||||
function updateMaxDomesticCritical(General $general, $score){
|
||||
$maxDomesticCritical = $general->getAuxVar('max_domestic_critical')??0;
|
||||
$maxDomesticCritical += $score / 2;
|
||||
$general->setAuxVar('max_domestic_critical', $maxDomesticCritical);
|
||||
|
||||
$oldMaxDomesticCritical = $general->getInheritancePoint('max_domestic_critical');
|
||||
if($maxDomesticCritical > $oldMaxDomesticCritical){
|
||||
$general->setInheritancePoint('max_domestic_critical', $maxDomesticCritical);
|
||||
}
|
||||
}
|
||||
+20
-15
@@ -173,7 +173,7 @@ function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl,
|
||||
if($prmt > 0) { $name = "<font color=orange>".$name."</font>"; }
|
||||
elseif($npc >= 2) { $name = "<font color=cyan>".$name."</font>"; }
|
||||
elseif($npc == 1) { $name = "<font color=skyblue>".$name."</font>"; }
|
||||
echo "<tr align=center><td id=bg2>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
|
||||
echo "<tr align=center><td class='bg2'>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
|
||||
}
|
||||
|
||||
function printFighting($tournament, $phase) {
|
||||
@@ -246,7 +246,7 @@ function startTournament($auto, $type) {
|
||||
}
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
|
||||
$gameStor->tnmt_auto = $auto;
|
||||
$gameStor->tnmt_time = (new \DateTimeImmutable())->add(new \DateInterval("PT{$unit}M"))->format('Y-m-d H:i:s');
|
||||
$gameStor->tournament = 1;
|
||||
@@ -297,7 +297,7 @@ function startTournament($auto, $type) {
|
||||
][$type];
|
||||
|
||||
$history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월:{$openerText}<C>{$typeText}</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>{$genTypeText}</span>들을 모집하고 있습니다!";
|
||||
|
||||
|
||||
pushGlobalHistoryLog($history, $admin['year'], $admin['month']);
|
||||
}
|
||||
|
||||
@@ -689,7 +689,8 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
'grp_no'=>$general['grp_no'],
|
||||
'reward'=>$cost,
|
||||
'msg'=>"<span class='ev_highlight'>16강 진출</span>",
|
||||
'logger'=>$logger
|
||||
'logger'=>$logger,
|
||||
'inheritance_point'=>10,
|
||||
];
|
||||
}
|
||||
//8강자 명성 돈
|
||||
@@ -723,6 +724,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
//포상 장수 이름, 금액
|
||||
$resultHelper[$generalID]['reward'] += $cost;
|
||||
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>4강 진출</span>";
|
||||
General::createGeneralObjFromDB($generalID)->increaseInheritancePoint('tournament', 10);
|
||||
}
|
||||
//결승자 명성 돈
|
||||
$cost = $admin['develcost'] * 6;
|
||||
@@ -739,6 +741,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
//포상 장수 이름, 금액
|
||||
$resultHelper[$generalID]['reward'] += $cost;
|
||||
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>준우승</span>으";
|
||||
$resultHelper[$generalID]['inheritance_point'] = 50;
|
||||
if($general['lose'] > 0){
|
||||
$runnerUp = $general;
|
||||
}
|
||||
@@ -761,6 +764,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
//포상 장수 이름, 금액
|
||||
$resultHelper[$generalID]['reward'] += $cost;
|
||||
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>우승</span>으";
|
||||
$resultHelper[$generalID]['inheritance_point'] = 100;
|
||||
$winner = $general;
|
||||
}
|
||||
|
||||
@@ -775,9 +779,6 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
$runnerUpLogger = $resultHelper[$runnerUp['no']]['logger'];
|
||||
$runnerUpLogger->pushGeneralHistoryLog("<C>{$tp}</> 대회에서 준우승");
|
||||
|
||||
|
||||
|
||||
|
||||
$winnerRewardText = number_format($resultHelper[$winner['no']]['reward']);
|
||||
$runnerUpRewardText = number_format($resultHelper[$runnerUp['no']]['reward']);
|
||||
|
||||
@@ -786,12 +787,16 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
|
||||
$winnerLogger->pushGlobalHistoryLog("<C>{$tp}</> 대회에서 <Y>{$winner['name']}</>{$josaYiWinner} <C>우승</>, <Y>{$runnerUp['name']}</>{$josaYiRunnerUp} <C>준우승</>을 차지하여 천하에 이름을 떨칩니다!", ActionLogger::EVENT_YEAR_MONTH);
|
||||
$winnerLogger->pushGlobalHistoryLog("<C>{$tp}</> 대회의 <S>우승자</>에게는 <C>{$winnerRewardText}</>, <S>준우승자</>에겐 <C>{$runnerUpRewardText}</>의 <S>상금</>과 약간의 <S>명성</>이 주어집니다!", ActionLogger::EVENT_YEAR_MONTH);
|
||||
|
||||
foreach($resultHelper as $general){
|
||||
|
||||
$generalObjList = General::createGeneralObjListFromDB(array_keys($resultHelper));
|
||||
|
||||
foreach($resultHelper as $generalID=>$general){
|
||||
$rewardText = number_format($general['reward']);
|
||||
/** @var ActionLogger */
|
||||
$logger = $general['logger'];
|
||||
$logger->pushGeneralActionLog("<C>{$tp}</> 대회의 {$general['msg']}로 <C>{$rewardText}</>의 <S>상금</>, 약간의 <S>명성</> 획득!", ActionLogger::EVENT_PLAIN);
|
||||
//TODO: 토너먼트의 다른 값이 모두 sql에 직접 입력하므로 기반을 바꿔야함.
|
||||
$generalObjList[$generalID]->increaseInheritancePoint('tournament', $general['inheritance_point']);
|
||||
}
|
||||
|
||||
//우승자 번호
|
||||
@@ -829,7 +834,7 @@ function setRefund() {
|
||||
$db->update('general', [
|
||||
'gold'=>$db->sqleval('gold + %i', $cost)
|
||||
], 'no IN %li', $generalIDList);
|
||||
|
||||
|
||||
//베팅금 환수
|
||||
$db->update(['general', [
|
||||
'gold'=>$db->sqleval('gold + (SELECT bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 FROM betting WHERE general_id = general.no)')
|
||||
@@ -862,16 +867,16 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
if($type == 0) { $turn = 10; }
|
||||
else { $turn = 100; }
|
||||
|
||||
|
||||
|
||||
if($tnmt_type == 1) { $tp = "leadership"; $tp2 = "tl"; }
|
||||
elseif($tnmt_type == 2) { $tp = "strength"; $tp2 = "ts"; }
|
||||
elseif($tnmt_type == 3) { $tp = "intel"; $tp2 = "ti"; }
|
||||
else /*$tnmt_type == 0*/{ $tp = "total"; $tp2 = "tt"; }
|
||||
else /*$tnmt_type == 0*/{ $tp = "total"; $tp2 = "tt"; }
|
||||
|
||||
$e1 = $energy1 = Util::round($gen1[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
$e2 = $energy2 = Util::round($gen2[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
|
||||
|
||||
|
||||
|
||||
foreach([$gen1, $gen2] as $gen){
|
||||
$horse = buildItemClass($gen['h']);
|
||||
@@ -883,7 +888,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
$itemName = $horse->getName();
|
||||
$itemRawName = $horse->getRawName();
|
||||
switch(rand()%4) {
|
||||
case 0:
|
||||
case 0:
|
||||
$josaYi = JosaUtil::pick($itemRawName, '이');
|
||||
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 포효합니다!"; break;
|
||||
case 1:
|
||||
@@ -1085,7 +1090,7 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
'lose'=>$db->sqleval('lose+1'),
|
||||
'gl'=>$db->sqleval('gl-%i', $gl)
|
||||
], 'grp=%i AND grp_no=%i', $group, $g2);
|
||||
|
||||
|
||||
if($general1['gl'] > $general2['gl']) { $gl1 = 1; $gl2 = 0; }
|
||||
elseif($general1['gl'] == $general2['gl']) { $gl1 = 2; $gl2 = -1; }
|
||||
else { $gl1 = 3; $gl2 = -2; }
|
||||
|
||||
+4
-12
@@ -97,18 +97,10 @@ $serverCnt = $gameStor->server_cnt;
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/main.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('d_shared/base_map.js')?>
|
||||
<?=WebUtil::printJS('js/map.js')?>
|
||||
<?=WebUtil::printJS('js/msg.js')?>
|
||||
<?=WebUtil::printJS('dist_js/main.js')?>
|
||||
<script>
|
||||
window.serverNick = '<?=DB::prefix()?>';
|
||||
window.serverID = '<?=UniqueConst::$serverID?>';
|
||||
@@ -295,7 +287,7 @@ else if($session->userGrade == 4){
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:70px;font-size:13px;margin-left:1ch;margin-right:2ch;'
|
||||
><input type=button value='▼미루기' id='pushTurn'
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
|
||||
><input type=button value='▲당기기' id='pullTurn'
|
||||
><input type=button value='▲당기기' id='pullTurn'
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
|
||||
></td>
|
||||
</tr>
|
||||
@@ -306,7 +298,7 @@ else if($session->userGrade == 4){
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
|
||||
><input type=button value='갱 신' id='refreshPage'
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
|
||||
><input type=button value='로비로' onclick="location.replace('../')"
|
||||
><input type=button value='로비로' onclick="location.replace('../')"
|
||||
style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px;
|
||||
>
|
||||
</td>
|
||||
|
||||
+17
-19
@@ -14,7 +14,7 @@ $serverName = DB::prefix();
|
||||
$serverAcl = $session->acl[$serverName]??[];
|
||||
$allowReset = in_array('reset', $serverAcl);
|
||||
$allowFullReset = in_array('fullReset',$serverAcl);
|
||||
$allowReset |= $allowFullReset;
|
||||
$allowReset = $allowReset || $allowFullReset;
|
||||
|
||||
if($session->userGrade < 5 && !$allowReset){
|
||||
die('관리자 아님');
|
||||
@@ -28,11 +28,9 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/install.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/install.js')?>
|
||||
<?=WebUtil::printCSS('css/normalize.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('css/install.css')?>
|
||||
@@ -47,7 +45,7 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
<h3 class="card-header">
|
||||
설치(환경 설정)
|
||||
<!--턴시간, 시간동기화, 시나리오, 상성, 확장장수, NPC유저, 이미지설정-->
|
||||
</h3>
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<form id="game_form" method="post" action="#">
|
||||
<div class="form-group row">
|
||||
@@ -82,7 +80,7 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="sync" class="col-sm-3 col-form-label">시간 동기화</label>
|
||||
<div class="col-sm-9" style="display: inline-flex;">
|
||||
@@ -93,7 +91,7 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
<label class="btn btn-secondary">
|
||||
<input type="radio" name="sync" value="0">N
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
<small class="text-muted">
|
||||
시간 단위에 맞게 년/월이 설정됩니다. <br>예: 120분(오전1시=1월), 60분(오전/오후 1시=1월)
|
||||
@@ -106,7 +104,7 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
<div class="col-sm-9">
|
||||
<select class="form-control" name="scenario" size="1" id="scenario_sel">
|
||||
</select>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,30 +168,30 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-3 col-form-label">휴식 턴 시 장수 턴</label>
|
||||
<label class="col-sm-3 col-form-label" id="autorun_set_label">휴식 턴 시 장수 턴</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="develop" name="autorun_develop" id="autorun_develop">내정
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="develop" name="autorun_user[]" value="develop">내정
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="warp" name="autorun_warp" id="autorun_warp">순간이동
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="warp" name="autorun_user[]" value="warp">순간이동
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_recruit" id="autorun_recruit">징병
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_user[]" value="recruit">징병
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="recruit_high" name="autorun_recruit_high" id="autorun_recruit_high">모병
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="recruit_high" name="autorun_user[]" value="recruit_high">모병
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="train" name="autorun_train" id="autorun_train">훈사
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="train" name="autorun_user[]" value="train">훈사
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_battle" id="autorun_battle">출병
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_user[]" value="battle">출병
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="chief" name="autorun_chief" id="autorun_chief">기본 사령턴
|
||||
<input type="checkbox" class="autorun_user_chk" data-key="chief" name="autorun_user[]" value="chief">기본 사령턴
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
@@ -368,7 +366,7 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan="2">
|
||||
|
||||
|
||||
</td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
+7
-9
@@ -21,11 +21,9 @@ if($session->userGrade == 5){
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/install_db.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('dist_js/vendors.js')?>
|
||||
<?=WebUtil::printJS('dist_js/install_db.js')?>
|
||||
<?=WebUtil::printCSS('css/normalize.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('css/install.css')?>
|
||||
@@ -39,7 +37,7 @@ if($session->userGrade == 5){
|
||||
<div class="card" id="db_form_card">
|
||||
<h3 class="card-header">
|
||||
설치(DB 설정)
|
||||
</h3>
|
||||
</h3>
|
||||
<div class="card-body">
|
||||
<form id="db_form" method="post" action="#">
|
||||
<?php if(class_exists('\\sammo\\DB')): ?>
|
||||
@@ -53,7 +51,7 @@ if($session->userGrade == 5){
|
||||
<label class="btn btn-secondary active">
|
||||
<input type="radio" name="full_reset" value="0" checked>N
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -73,7 +71,7 @@ if($session->userGrade == 5){
|
||||
<input type="text" class="form-control" name="db_port" id="db_port" placeholder="접속 포트" value="3306" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_id" class="col-sm-3 col-form-label">DB계정</label>
|
||||
<div class="col-sm-9">
|
||||
@@ -82,7 +80,7 @@ if($session->userGrade == 5){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label>
|
||||
<div class="col-sm-9">
|
||||
|
||||
@@ -5,9 +5,11 @@ include('lib.php');
|
||||
include 'func.php';
|
||||
|
||||
$result = [
|
||||
"generalID"=>null,
|
||||
"myNationID"=>null,
|
||||
"isChief"=>false
|
||||
"generalID"=>0,
|
||||
"myNationID"=>0,
|
||||
"isChief"=>false,
|
||||
"officerLevel"=>0,
|
||||
"permission"=>0,
|
||||
];
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -157,6 +157,7 @@ foreach ($customViewColumns as $column => $reqPermission) {
|
||||
$resultColumns[] = $column;
|
||||
}
|
||||
|
||||
$generalList = [];
|
||||
foreach ($rawGeneralList as $rawGeneral) {
|
||||
//General 생성?
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ $serverName = DB::prefix();
|
||||
$serverAcl = $session->acl[$serverName]??[];
|
||||
$allowReset = in_array('reset', $serverAcl);
|
||||
$allowFullReset = in_array('fullReset',$serverAcl);
|
||||
$allowReset |= $allowFullReset;
|
||||
$allowReset = $allowReset || $allowFullReset;
|
||||
|
||||
$reserve_open = Util::getPost('reserve_open');
|
||||
if($reserve_open && $reserve_open < date('Y-m-d H:i')){
|
||||
|
||||
@@ -9,7 +9,7 @@ $serverName = DB::prefix();
|
||||
$serverAcl = $session->acl[$serverName]??[];
|
||||
$allowReset = in_array('reset', $serverAcl);
|
||||
$allowFullReset = in_array('fullReset',$serverAcl);
|
||||
$allowReset |= $allowFullReset;
|
||||
$allowReset = $allowReset || $allowFullReset;
|
||||
|
||||
if($session->userGrade < 5 && !$allowReset){
|
||||
Json::die([
|
||||
|
||||
@@ -56,6 +56,6 @@ else{
|
||||
|
||||
|
||||
Json::die([
|
||||
'result' => $result===DiplomaticMessage::ACCEPTED,
|
||||
'result' => $result!==DiplomaticMessage::INVALID,
|
||||
'reason' => $reason
|
||||
]);
|
||||
@@ -32,7 +32,7 @@ $lastMsgGet[] = TimeUtil::now();
|
||||
$session->lastMsgGet = Json::encode($lastMsgGet);
|
||||
|
||||
if($delayTime){
|
||||
sleep(0.2);
|
||||
usleep(200);
|
||||
}
|
||||
$session->setReadOnly();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ else{
|
||||
'name', 'leadership', 'strength', 'intel', 'gold','rice',
|
||||
'troop','officer_level','npc','picture','imgsvr',
|
||||
'permission','penalty','belong', 'crewtype',
|
||||
'experience', 'dedication', 'betray', 'dedlevel', 'explevel', 'makelimit',
|
||||
'experience', 'dedication', 'betray', 'dedlevel', 'explevel', 'makelimit', 'aux',
|
||||
], 1);
|
||||
|
||||
if($general instanceof DummyGeneral){
|
||||
@@ -104,7 +104,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
if($general->getVar('strength') < GameConst::$chiefStatMin){
|
||||
return '무력이 부족합니다.';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
if($general->getVar('intel') < GameConst::$chiefStatMin){
|
||||
@@ -175,7 +175,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
|
||||
$generalName = $general->getVar('name');
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
|
||||
|
||||
|
||||
//추방할사람이 외교권자이면 불가
|
||||
$permission = checkSecretPermission($general->getRaw());
|
||||
@@ -252,7 +252,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
|
||||
]);
|
||||
|
||||
$src = new MessageTarget(
|
||||
$generalID,
|
||||
$generalID,
|
||||
$generalName,
|
||||
$nationID,
|
||||
$nation['name'],
|
||||
@@ -260,7 +260,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
|
||||
GetImageURL($general->getVar('imgsvr'), $general->getVar('picture'))
|
||||
);
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_PUBLIC,
|
||||
Message::MSGTYPE_PUBLIC,
|
||||
$src,
|
||||
$src,
|
||||
$str,
|
||||
|
||||
@@ -115,7 +115,10 @@ foreach(GameConst::$generalPoolAllowOption as $allowOption){
|
||||
}
|
||||
}
|
||||
|
||||
$userNick = $ownerInfo['name'];
|
||||
|
||||
$builder->setOwner($userID);
|
||||
$builder->setOwnerName($userNick);
|
||||
$builder->setKillturn(5);
|
||||
$builder->setNPCType(0);
|
||||
$builder->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * $env['turnterm']));
|
||||
@@ -135,7 +138,7 @@ $db->update('select_pool',[
|
||||
'reserved_until'=>null,
|
||||
], '(owner=%i or reserved_until < %s) AND general_id is NULL', $userID, $now);
|
||||
|
||||
$userNick = $ownerInfo['name'];
|
||||
|
||||
$josaYi = JosaUtil::pick($userNick, '이');
|
||||
$generalName = $builder->getGeneralName();
|
||||
$josaRo = JosaUtil::pick($generalName, '로');
|
||||
|
||||
@@ -39,7 +39,7 @@ $db = DB::db();
|
||||
$me = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
|
||||
if($defence_train != $me->getVar('defence_train')){
|
||||
if($defence_train !== $me->getVar('defence_train')){
|
||||
if($defence_train == 999){
|
||||
$me->increaseVar('myset', -1);
|
||||
$me->setVar('defence_train', $defence_train);
|
||||
@@ -53,14 +53,8 @@ if($defence_train != $me->getVar('defence_train')){
|
||||
}
|
||||
|
||||
$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100));
|
||||
|
||||
if($use_auto_nation_turn != $me->getAuxVar('use_auto_nation_turn')){
|
||||
$me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn);
|
||||
}
|
||||
|
||||
if($me->getVar('tnmt') != $tnmt){
|
||||
$me->setVar('tnmt', $tnmt);
|
||||
}
|
||||
$me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn);
|
||||
$me->setVar('tnmt', $tnmt);
|
||||
|
||||
if($me->getNPCType() == 1 && $detachNPC){
|
||||
$turnterm = $gameStor->turnterm;
|
||||
|
||||
+69
-57
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
@@ -21,18 +22,18 @@ $availableTypes = [
|
||||
'nationPolicy',
|
||||
];
|
||||
|
||||
if(!in_array($type, $availableTypes)){
|
||||
if (!in_array($type, $availableTypes)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바른 타입이 아닙니다.',
|
||||
'result' => false,
|
||||
'reason' => '올바른 타입이 아닙니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
$data = Json::decode($data);
|
||||
if(!$data || !is_array($data)){
|
||||
if (!$data || !is_array($data)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바른 입력이 아닙니다.',
|
||||
'result' => false,
|
||||
'reason' => '올바른 입력이 아닙니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -44,94 +45,95 @@ $me = $db->queryFirstRow('SELECT no, name, npc, nation, city, officer_level, con
|
||||
$nationID = $me['nation'];
|
||||
if (!$nationID) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'국가에 소속되어있지 않습니다.',
|
||||
'result' => false,
|
||||
'reason' => '국가에 소속되어있지 않습니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 3) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 군주, 외교권자, 조언자가 아닙니다.'
|
||||
'result' => false,
|
||||
'reason' => '권한이 부족합니다. 군주, 외교권자, 조언자가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
function applyNationPolicy($policy, $nationID, $generalName):?string{
|
||||
function applyNationPolicy($policy, $nationID, $generalName): ?string
|
||||
{
|
||||
$db = DB::db();
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
|
||||
$defaultPolicy = AutorunNationPolicy::$defaultPolicy;
|
||||
$troopCache = null;
|
||||
foreach($db->queryFirstColumn('SELECT troop_leader FROM troop WHERE nation=%i',$nationID) as $troopID){
|
||||
foreach ($db->queryFirstColumn('SELECT troop_leader FROM troop WHERE nation=%i', $nationID) as $troopID) {
|
||||
$troopCache[$troopID] = 'Neutral';
|
||||
}
|
||||
$cityList = CityConst::all();
|
||||
$nationPolicyRoot = $nationStor->npc_nation_policy;
|
||||
$nationPolicy = $nationPolicyRoot['values']??[];
|
||||
foreach($policy as $key=>$val){
|
||||
$nationPolicy = $nationPolicyRoot['values'] ?? [];
|
||||
foreach ($policy as $key => $val) {
|
||||
|
||||
if($key === 'CombatForce'){
|
||||
if(!is_array($val)){
|
||||
return "{$key}는 올바른 정책값이 아닙니다.";
|
||||
if ($key === 'CombatForce') {
|
||||
if (!is_array($val)) {
|
||||
return "{$key}는 올바른 정책값이 아닙니다.";
|
||||
}
|
||||
foreach($val as $troopID=>$troopTarget){
|
||||
if(!key_exists($troopID, $troopCache)){
|
||||
foreach ($val as $troopID => $troopTarget) {
|
||||
if (!key_exists($troopID, $troopCache)) {
|
||||
return "{$troopID}는 국가의 부대가 아닙니다.";
|
||||
}
|
||||
if($troopCache[$troopID] != 'Neutral'){
|
||||
if ($troopCache[$troopID] != 'Neutral') {
|
||||
return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다.";
|
||||
}
|
||||
if(!is_array($troopTarget) || count($troopTarget)!=2){
|
||||
if (!is_array($troopTarget) || count($troopTarget) != 2) {
|
||||
return "{$troopID}의 입력양식이 올바르지 않습니다.";
|
||||
}
|
||||
[$fromCity, $toCity] = $troopCache;
|
||||
if(!key_exists($fromCity, $cityList) || !key_exists($toCity, $cityList)){
|
||||
if (!key_exists($fromCity, $cityList) || !key_exists($toCity, $cityList)) {
|
||||
return "{$troopID}의 도시 {$fromCity}, {$toCity}가 올바른 도시 번호가 아닙니다.";
|
||||
}
|
||||
$troopCache[$troopID]=$key;
|
||||
$troopCache[$troopID] = $key;
|
||||
}
|
||||
$nationPolicy[$key]=$val;
|
||||
$nationPolicy[$key] = $val;
|
||||
continue;
|
||||
}
|
||||
if(in_array($key, ['SupportForce', 'DevelopForce'])){
|
||||
if(!is_array($val)){
|
||||
return "{$key}는 올바른 정책값이 아닙니다.";
|
||||
if (in_array($key, ['SupportForce', 'DevelopForce'])) {
|
||||
if (!is_array($val)) {
|
||||
return "{$key}는 올바른 정책값이 아닙니다.";
|
||||
}
|
||||
foreach($val as $troopID){
|
||||
if(!key_exists($troopID, $troopCache)){
|
||||
foreach ($val as $troopID) {
|
||||
if (!key_exists($troopID, $troopCache)) {
|
||||
return "{$troopID}는 국가의 부대가 아닙니다.";
|
||||
}
|
||||
if($troopCache[$troopID] != 'Neutral'){
|
||||
if ($troopCache[$troopID] != 'Neutral') {
|
||||
return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다.";
|
||||
}
|
||||
$troopCache[$troopID]=$key;
|
||||
$troopCache[$troopID] = $key;
|
||||
}
|
||||
|
||||
$nationPolicy[$key]=array_values($val);
|
||||
$nationPolicy[$key] = array_values($val);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(!key_exists($key, $defaultPolicy)){
|
||||
if (!key_exists($key, $defaultPolicy)) {
|
||||
return "{$key}는 올바른 정책값이 아닙니다.";
|
||||
}
|
||||
$defaultValue = $defaultPolicy[$key];
|
||||
if(is_numeric($defaultValue) != is_numeric($val)){
|
||||
if (is_numeric($defaultValue) != is_numeric($val)) {
|
||||
return "{$key}는 올바른 값이 아닙니다.";
|
||||
}
|
||||
if(is_integer($defaultValue) != is_integer($val)){
|
||||
if (is_integer($defaultValue) != is_integer($val)) {
|
||||
return "{$key}는 올바른 값이 아닙니다.";
|
||||
}
|
||||
if(is_array($defaultValue) != is_array($val)){
|
||||
if (is_array($defaultValue) != is_array($val)) {
|
||||
return "{$key}는 올바른 값이 아닙니다.";
|
||||
}
|
||||
if(is_integer($val) && $val < 0){
|
||||
if (is_integer($val) && $val < 0) {
|
||||
$val = 0;
|
||||
}
|
||||
$nationPolicy[$key] = $val;
|
||||
}
|
||||
|
||||
|
||||
$nationPolicyRoot['values'] = $nationPolicy;
|
||||
$nationPolicyRoot['valueSetter'] = $generalName;
|
||||
$nationPolicyRoot['valueSetTime'] = TimeUtil::now();
|
||||
@@ -139,14 +141,15 @@ function applyNationPolicy($policy, $nationID, $generalName):?string{
|
||||
return null;
|
||||
}
|
||||
|
||||
function applyNationPriority($priority, $nationID, $generalName):?string{
|
||||
function applyNationPriority($priority, $nationID, $generalName): ?string
|
||||
{
|
||||
$db = DB::db();
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
$nationPolicyRoot = $nationStor->npc_nation_policy;
|
||||
|
||||
$defaultPriority = AutorunNationPolicy::$defaultPriority;
|
||||
foreach($priority as $item){
|
||||
if(!in_array($item, $defaultPriority)){
|
||||
foreach ($priority as $item) {
|
||||
if (!in_array($item, $defaultPriority)) {
|
||||
return "{$item}은 올바른 명령이 아닙니다.";
|
||||
}
|
||||
}
|
||||
@@ -157,17 +160,29 @@ function applyNationPriority($priority, $nationID, $generalName):?string{
|
||||
return null;
|
||||
}
|
||||
|
||||
function applyGeneralPriority($priority, $nationID, $generalName):?string{
|
||||
function applyGeneralPriority($priority, $nationID, $generalName): ?string
|
||||
{
|
||||
$db = DB::db();
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
$generalPolicyRoot = $nationStor->npc_general_policy;
|
||||
|
||||
$defaultPriority = AutorunGeneralPolicy::$default_priority;
|
||||
foreach($priority as $item){
|
||||
if(!in_array($item, $defaultPriority)){
|
||||
$mustHaveActions = ['출병' => 1];
|
||||
foreach ($priority as $item) {
|
||||
if (key_exists($item, $mustHaveActions)) {
|
||||
$mustHaveActions[$item] = 0;
|
||||
}
|
||||
if (!in_array($item, $defaultPriority)) {
|
||||
return "{$item}은 올바른 명령이 아닙니다.";
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($mustHaveActions as $actionKey => $unset) {
|
||||
if ($unset) {
|
||||
return "{$actionKey}은 항상 사용해야 합니다.";
|
||||
}
|
||||
}
|
||||
|
||||
$generalPolicyRoot['priority'] = $priority;
|
||||
$generalPolicyRoot['prioritySetter'] = $generalName;
|
||||
$generalPolicyRoot['prioritySetTime'] = TimeUtil::now();
|
||||
@@ -175,26 +190,23 @@ function applyGeneralPriority($priority, $nationID, $generalName):?string{
|
||||
return null;
|
||||
}
|
||||
|
||||
if($type == 'nationPolicy'){
|
||||
if ($type == 'nationPolicy') {
|
||||
$result = applyNationPolicy($data, $nationID, $me['name']);
|
||||
}
|
||||
else if($type == 'generalPriority'){
|
||||
} else if ($type == 'generalPriority') {
|
||||
$result = applyGeneralPriority($data, $nationID, $me['name']);
|
||||
}
|
||||
else if($type == 'nationPriority'){
|
||||
} else if ($type == 'nationPriority') {
|
||||
$result = applyNationPriority($data, $nationID, $me['name']);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
throw new MustNotBeReachedException();
|
||||
}
|
||||
|
||||
if($result!==null){
|
||||
if ($result !== null) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>$result,
|
||||
'result' => false,
|
||||
'reason' => $result,
|
||||
]);
|
||||
}
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success',
|
||||
]);
|
||||
'result' => true,
|
||||
'reason' => 'success',
|
||||
]);
|
||||
|
||||
@@ -140,6 +140,7 @@ if(!$v->validate()){
|
||||
'reason'=>'[출병자]'.$v->errorStr()
|
||||
]);
|
||||
}
|
||||
$rawAttacker['owner'] = 0;
|
||||
|
||||
$defenderList = [];
|
||||
foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
|
||||
@@ -152,6 +153,7 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
|
||||
'reason'=>"[수비자{$idx}]".$v->errorStr()
|
||||
]);
|
||||
}
|
||||
$rawDefenderGeneral['owner'] = 0;
|
||||
|
||||
$defenderList[] = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ if(key_exists('specialWar', $info)){
|
||||
$generalObj->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * $turnterm));
|
||||
|
||||
$userNick = $ownerInfo['name'];
|
||||
$generalObj->setVar('owner_name', $userNick);
|
||||
$josaYi = JosaUtil::pick($userNick, '이');
|
||||
|
||||
$generalName = $info['generalName'];
|
||||
|
||||
-183
@@ -1,183 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$session = Session::requireLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
if (!$userID) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//회원 테이블에서 정보확인
|
||||
$member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from member where no= %i", $userID);
|
||||
|
||||
if (!$member) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$admin = $gameStor->getValues(['block_general_create','show_img_level','maxgeneral']);
|
||||
if($admin['block_general_create']){
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit(1);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=UniqueConst::$serverName?>: 장수생성</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<script>
|
||||
var defaultStatTotal = <?=GameConst::$defaultStatTotal?>;
|
||||
var defaultStatMin = <?=GameConst::$defaultStatMin?>;
|
||||
var defaultStatMax = <?=GameConst::$defaultStatMax?>;
|
||||
|
||||
var charInfoText = <?php
|
||||
|
||||
$charInfoText = [];
|
||||
foreach(GameConst::$availablePersonality as $personalityID){
|
||||
$personalityInfo = buildPersonalityClass($personalityID)->getInfo();
|
||||
$charInfoText[$personalityID] = $personalityInfo;
|
||||
}
|
||||
echo Json::encode((object)$charInfoText);
|
||||
?>;
|
||||
</script>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/join.js')?>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td>장 수 생 성<br><?=backButton()?></td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td align=center><?=info(0)?></td></tr>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2');
|
||||
|
||||
if ($gencount >= $admin['maxgeneral']) {
|
||||
echo "<script>alert('더 이상 등록할 수 없습니다.');</script>";
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit();
|
||||
}
|
||||
|
||||
$nationList = $db->query('SELECT nation,`name`,color,scout FROM nation');
|
||||
shuffle($nationList);
|
||||
$nationList = Util::convertArrayToDict($nationList, 'nation');
|
||||
//NOTE: join 안할것임
|
||||
$scoutMsgs = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'scout_msg');
|
||||
foreach($scoutMsgs as $nationID=>$scoutMsg){
|
||||
$nationList[$nationID]['scoutmsg'] = $scoutMsg;
|
||||
}
|
||||
|
||||
echo getInvitationList($nationList);
|
||||
?>
|
||||
|
||||
<form id='join_form' name=form1 method=post action=join_post.php>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td colspan=3 align=center id=bg1>장수 생성</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>장수명</td>
|
||||
<td colspan=2>
|
||||
<input id="generalName" type=text name=name maxlength=18 size=18 style="color:white;background-color:black;" value="<?=$member['name']?>">(전각 9글자, 반각 18글자 이내)
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "") {
|
||||
$imageTemp = GetImageURL($member['imgsvr']);
|
||||
echo "
|
||||
<tr>
|
||||
<td align=right id=bg1>전콘 사용 여부</td>
|
||||
<td width=64 height=64>
|
||||
<img width='64' height='64' src='{$imageTemp}/{$member['picture']}' border='0'>
|
||||
</td>
|
||||
<td>
|
||||
<input type=checkbox name=pic value=1 checked>사용
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td align=center colspan=3>
|
||||
계정관리에서 자신만을 표현할 수 있는 아이콘을 업로드 해보세요!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>성격</td>
|
||||
<td colspan=2>
|
||||
<select id="selChar" name=character size=1 maxlength=15 style=color:white;background-color:black;>
|
||||
<option selected value='Random'>????</option>
|
||||
<?php foreach(GameConst::$availablePersonality as $personalityID): ?>
|
||||
<?php $personalityName = buildPersonalityClass($personalityID)->getName(); ?>
|
||||
<option value='<?=$personalityID?>'><?=$personalityName?></option>
|
||||
<?php endforeach; ?>
|
||||
</select> <span id="charInfoText"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>통솔</td>
|
||||
<td colspan=2><input type="number" name="leadership" id="leadership" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>무력</td>
|
||||
<td colspan=2><input type="number" name="strength" id="strength" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>지력</td>
|
||||
<td colspan=2><input type="number" name="intel" id="intel" value="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right id=bg1>능력치 조정</td>
|
||||
<td colspan=2>
|
||||
<input type=button value=랜덤형 onclick=abilityRand()>
|
||||
<input type=button value=통솔무력형 onclick=abilityLeadpow()>
|
||||
<input type=button value=통솔지력형 onclick=abilityLeadint()>
|
||||
<input type=button value=무력지력형 onclick=abilityPowint()>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center colspan=3>
|
||||
<font color=orange>모든 능력치는 ( <?=GameConst::$defaultStatMin?> <= 능력치 <= <?=GameConst::$defaultStatMax?> ) 사이로 잡으셔야 합니다.<br>
|
||||
그 외의 능력치는 가입되지 않습니다.</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center colspan=3>
|
||||
능력치의 총합은 <?=GameConst::$defaultStatTotal?>입니다. 가입후 0~10의 능력치 보너스를 받게 됩니다.<br>
|
||||
임의의 도시에서 재야로 시작하며 건국과 임관은 게임 내에서 실행합니다.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right><input type=submit name=join value=장수생성></td>
|
||||
<td colspan=2><input type=reset name=reset value=다시입력></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=backButton()?></td></tr>
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,339 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$v = new Validator($_POST);
|
||||
$v
|
||||
->rule('required', [
|
||||
'name',
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel'
|
||||
])
|
||||
->rule('integer', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel',
|
||||
])
|
||||
->rule('stringWidthBetween', 'name', 1, 18)
|
||||
->rule('min', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel'
|
||||
], GameConst::$defaultStatMin)
|
||||
->rule('max', [
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel'
|
||||
], GameConst::$defaultStatMax)
|
||||
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']));
|
||||
|
||||
if (!$v->validate()) {
|
||||
MessageBox($v->errorStr());
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$session = Session::requireLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
//NOTE: 이 페이지에서는 세션에 데이터를 등록하지 않음. 로그인은 이후에.
|
||||
|
||||
$name = Util::getPost('name');
|
||||
$name = htmlspecialchars($name);
|
||||
$name = StringUtil::removeSpecialCharacter($name);
|
||||
$name = WebUtil::htmlPurify($name);
|
||||
$name = StringUtil::textStrip($name);
|
||||
$pic = (int)Util::getPost('pic', 'bool', 0);
|
||||
$character = Util::getPost('character');
|
||||
|
||||
$leadership = Util::getPost('leadership', 'int', 50);
|
||||
$strength = Util::getPost('strength', 'int', 50);
|
||||
$intel = Util::getPost('intel', 'int', 50);
|
||||
|
||||
$join = Util::getPost('join'); //쓸모 없음
|
||||
|
||||
$rootDB = RootDB::db();
|
||||
//회원 테이블에서 정보확인
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
|
||||
|
||||
if (!$member) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
echo "<script>history.go(-1);</script>";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['year','month','maxgeneral','scenario','show_img_level','turnterm','turntime','genius','npcmode']);
|
||||
########## 동일 정보 존재여부 확인. ##########
|
||||
|
||||
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
|
||||
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
|
||||
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name);
|
||||
|
||||
if ($oldGeneral) {
|
||||
echo("<script>
|
||||
window.alert('이미 등록하셨습니다!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if ($oldName) {
|
||||
echo("<script>
|
||||
window.alert('이미 있는 장수입니다. 다른 이름으로 등록해 주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if ($gameStor->maxgeneral <= $gencount) {
|
||||
echo("<script>
|
||||
window.alert('더이상 등록할 수 없습니다!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if ($name == '') {
|
||||
echo("<script>
|
||||
window.alert('이름이 짧습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if (mb_strwidth($name) > 18) {
|
||||
echo("<script>
|
||||
window.alert('이름이 유효하지 않습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
if ($leadership + $strength + $intel > GameConst::$defaultStatTotal) {
|
||||
echo("<script>
|
||||
window.alert('능력치가 ".GameConst::$defaultStatTotal."을 넘어섰습니다. 다시 가입해주세요!')
|
||||
history.go(-1)
|
||||
</script>");
|
||||
exit;
|
||||
}
|
||||
|
||||
$genius = Util::randBool(0.01);
|
||||
// 현재 1%
|
||||
if ($genius && $gameStor->genius > 0) {
|
||||
$gameStor->genius = $gameStor->genius-1;
|
||||
} else {
|
||||
$genius = false;
|
||||
}
|
||||
|
||||
// 공백지에서만 태어나게
|
||||
$city = $db->queryFirstField("select city from city where level>=5 and level<=6 and nation=0 order by rand() limit 0,1");
|
||||
if (!$city) {
|
||||
$city = $db->queryFirstField("select city from city where level>=5 and level<=6 order by rand() limit 0,1");
|
||||
}
|
||||
|
||||
$pleadership = 0;
|
||||
$pstrength = 0;
|
||||
$pintel = 0;
|
||||
foreach(Util::range(Util::randRangeInt(3, 5)) as $statIdx){
|
||||
switch (Util::choiceRandomUsingWeight([$leadership, $strength, $intel])) {
|
||||
case 0:
|
||||
$pleadership++;
|
||||
break;
|
||||
case 1:
|
||||
$pstrength++;
|
||||
break;
|
||||
case 2:
|
||||
$pintel++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$leadership = $leadership + $pleadership;
|
||||
$strength = $strength + $pstrength;
|
||||
$intel = $intel + $pintel;
|
||||
|
||||
$admin = $gameStor->getValues(['scenario', 'turnterm', 'turntime', 'show_img_level', 'startyear', 'year']);
|
||||
$relYear = Util::valueFit($admin['year'] - $admin['startyear'], 0);
|
||||
|
||||
$age = 20 + ($pleadership + $pstrength + $pintel) * 2 - (mt_rand(0, 1));
|
||||
// 아직 남았고 천재등록상태이면 특기 부여
|
||||
if ($genius) {
|
||||
$specage2 = $age;
|
||||
$special2 = SpecialityHelper::pickSpecialWar([
|
||||
'leadership'=>$leadership,
|
||||
'strength'=>$strength,
|
||||
'intel'=>$intel,
|
||||
'dex1'=>0,
|
||||
'dex2'=>0,
|
||||
'dex3'=>0,
|
||||
'dex4'=>0,
|
||||
'dex5'=>0
|
||||
]);
|
||||
} else {
|
||||
$specage2 = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/6 - $relYear / 2), 3) + $age;
|
||||
$special2 = GameConst::$defaultSpecialWar;
|
||||
}
|
||||
//내특
|
||||
$specage = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/12 - $relYear / 2), 3) + $age;
|
||||
$special = GameConst::$defaultSpecialDomestic;
|
||||
|
||||
if ($admin['scenario'] >= 1000) {
|
||||
$specage2 = $age + 3;
|
||||
$specage = $age + 3;
|
||||
}
|
||||
|
||||
if($relYear < 3){
|
||||
$experience = 0;
|
||||
}
|
||||
else{
|
||||
$expGenCount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation != 0 AND npc < 5');
|
||||
$targetGenOrder = Util::round($expGenCount * 0.2);
|
||||
$experience = $db->queryFirstField(
|
||||
'SELECT experience FROM general WHERE nation != 0 AND npc < 5 ORDER BY experience ASC LIMIT %i, 1',
|
||||
$targetGenOrder - 1
|
||||
);
|
||||
$experience *= 0.8;
|
||||
}
|
||||
|
||||
$turntime = getRandTurn($admin['turnterm'], new \DateTimeImmutable($admin['turntime']));
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
if ($now >= $turntime) {
|
||||
$turntime = addTurn($turntime, $admin['turnterm']);
|
||||
}
|
||||
|
||||
//특회 전콘
|
||||
if ($admin['show_img_level'] >= 1 && $member['grade'] >= 1 && $member['picture'] != "" && $pic) {
|
||||
$face = $member['picture'];
|
||||
$imgsvr = $member['imgsvr'];
|
||||
} else {
|
||||
$face = "default.jpg";
|
||||
$imgsvr = 0;
|
||||
}
|
||||
|
||||
//성격 랜덤시
|
||||
if (!in_array($character, GameConst::$availablePersonality)){
|
||||
$character = Util::choiceRandom(GameConst::$availablePersonality);
|
||||
}
|
||||
//상성 랜덤
|
||||
$affinity = rand()%150 + 1;
|
||||
|
||||
########## 회원정보 테이블에 입력값을 등록한다. ##########
|
||||
$db->insert('general', [
|
||||
'owner' => $userID,
|
||||
'name' => $name,
|
||||
'owner_name' => $member['name'],
|
||||
'picture' => $face,
|
||||
'imgsvr' => $imgsvr,
|
||||
'nation' => 0,
|
||||
'city' => $city,
|
||||
'troop' => 0,
|
||||
'affinity' => $affinity,
|
||||
'leadership' => $leadership,
|
||||
'strength' => $strength,
|
||||
'intel' => $intel,
|
||||
'experience' => $experience,
|
||||
'dedication' => 0,
|
||||
'gold' => GameConst::$defaultGold,
|
||||
'rice' => GameConst::$defaultRice,
|
||||
'crew' => 0,
|
||||
'train' => 0,
|
||||
'atmos' => 0,
|
||||
'officer_level' => 0,
|
||||
'turntime' => $turntime,
|
||||
'killturn' => 6,
|
||||
'lastconnect' => $now,
|
||||
'lastrefresh' => $now,
|
||||
'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE,
|
||||
'makelimit' => 0,
|
||||
'age' => $age,
|
||||
'startage' => $age,
|
||||
'personal' => $character,
|
||||
'specage' => $specage,
|
||||
'special' => $special,
|
||||
'specage2' => $specage2,
|
||||
'special2' => $special2
|
||||
]);
|
||||
$generalID = $db->insertId();
|
||||
$turnRows = [];
|
||||
foreach(Util::range(GameConst::$maxTurn) as $turnIdx){
|
||||
$turnRows[] = [
|
||||
'general_id'=>$generalID,
|
||||
'turn_idx'=>$turnIdx,
|
||||
'action'=>'휴식',
|
||||
'arg'=>null,
|
||||
'brief'=>'휴식'
|
||||
];
|
||||
}
|
||||
$db->insert('general_turn', $turnRows);
|
||||
|
||||
$rank_data = [];
|
||||
foreach(array_keys(General::RANK_COLUMN) as $rankColumn){
|
||||
$rank_data[] = [
|
||||
'general_id'=>$generalID,
|
||||
'nation_id'=>0,
|
||||
'type'=>$rankColumn,
|
||||
'value'=>0
|
||||
];
|
||||
}
|
||||
$db->insert('rank_data', $rank_data);
|
||||
$db->insert('betting', [
|
||||
'general_id'=>$generalID,
|
||||
]);
|
||||
$cityname = CityConst::byID($city)->name;
|
||||
|
||||
$me = [
|
||||
'no'=>$generalID
|
||||
];
|
||||
|
||||
$log = [];
|
||||
$mylog = [];
|
||||
|
||||
$logger = new ActionLogger($generalID, 0, $gameStor->year, $gameStor->month);
|
||||
|
||||
$josaRa = JosaUtil::pick($name, '라');
|
||||
$speicalText = getGeneralSpecialWarName($special2);
|
||||
if ($genius) {
|
||||
|
||||
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 기재가 천하에 이름을 알립니다.");
|
||||
$logger->pushGlobalActionLog("<C>{$speicalText}</> 특기를 가진 <C>천재</>의 등장으로 온 천하가 떠들썩합니다.");
|
||||
$logger->pushGlobalHistoryLog("<L><b>【천재】</b></><G><b>{$cityname}</b></>에 천재가 등장했습니다.");
|
||||
} else {
|
||||
$logger->pushGlobalActionLog("<G><b>{$cityname}</b></>에서 <Y>{$name}</>{$josaRa}는 호걸이 천하에 이름을 알립니다.");
|
||||
}
|
||||
|
||||
$logger->pushGeneralHistoryLog("<Y>{$name}</>, <G>{$cityname}</>에서 큰 뜻을 품다.");
|
||||
$logger->pushGeneralActionLog("삼국지 모의전투 PHP의 세계에 오신 것을 환영합니다 ^o^", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralActionLog("처음 하시는 경우에는 <D>도움말</>을 참고하시고,", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralActionLog("문의사항이 있으시면 게시판에 글을 남겨주시면 되겠네요~", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralActionLog("부디 즐거운 삼모전 되시길 바랍니다 ^^", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralActionLog("통솔 <C>$pleadership</> 무력 <C>$pstrength</> 지력 <C>$pintel</> 의 보너스를 받으셨습니다.", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralActionLog("연령은 <C>$age</>세로 시작합니다.", ActionLogger::PLAIN);
|
||||
|
||||
if ($genius) {
|
||||
$logger->pushGeneralActionLog("축하합니다! 천재로 태어나 처음부터 <C>{$speicalText}</> 특기를 가지게 됩니다!", ActionLogger::PLAIN);
|
||||
$logger->pushGeneralHistoryLog("<C>{$speicalText}</> 특기를 가진 천재로 탄생.");
|
||||
}
|
||||
|
||||
$logger->flush();
|
||||
|
||||
pushAdminLog(["가입 : {$userID} // {$name} // {$generalID}".getenv("REMOTE_ADDR")]);
|
||||
|
||||
$rootDB->insert('member_log', [
|
||||
'member_no' => $userID,
|
||||
'date'=>TimeUtil::now(),
|
||||
'action_type'=>'make_general',
|
||||
'action'=>Json::encode([
|
||||
'server'=>DB::prefix(),
|
||||
'type'=>'general',
|
||||
'generalID'=>$generalID,
|
||||
'generalName'=>$name
|
||||
])
|
||||
]);
|
||||
|
||||
?>
|
||||
<script>
|
||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$name?> \n위키와 팁/강좌 게시판을 꼭 읽어보세요!');
|
||||
</script>
|
||||
<script>location.replace('./');</script>
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
jQuery(function($){
|
||||
$('.submitBtn').click(function(){
|
||||
var $this = $(this);
|
||||
var target = parseInt($this.data('target'));
|
||||
var amount = $('#target_{0}'.format(target)).val();
|
||||
|
||||
$.post({
|
||||
url:'j_betting.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
target:target,
|
||||
amount:amount
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
return quickReject('베팅을 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('베팅을 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
location.reload();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
-179
@@ -1,179 +0,0 @@
|
||||
|
||||
|
||||
function submitArticle(){
|
||||
var $article = $('#newArticle');
|
||||
var $title = $article.find('.titleInput');
|
||||
var $text = $article.find('.contentInput');
|
||||
var title = $.trim($title.val());
|
||||
var text = $.trim($text.val());
|
||||
|
||||
|
||||
if(!text && !title){
|
||||
return false;
|
||||
}
|
||||
|
||||
$title.val('');
|
||||
$text.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_board_article_add.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
isSecret:isSecretBoard,
|
||||
title:title,
|
||||
text:text
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$title.val(title);
|
||||
$text.val(text);
|
||||
return quickReject('글을 올리는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$title.val(title);
|
||||
$text.val(text);
|
||||
return quickReject('글을 올리는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
return loadArticles().done(drawArticles);
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function submitComment(){
|
||||
var $this = $(this);
|
||||
|
||||
var $article = $this.closest('.articleObj').eq(0);
|
||||
var articleNo = $article.data('no');
|
||||
var $text = $article.find('input.commentText');
|
||||
var text = $.trim($text.val());
|
||||
|
||||
if(!text){
|
||||
return false;
|
||||
}
|
||||
|
||||
$text.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_board_comment_add.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
articleNo:articleNo,
|
||||
text:text
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$text.val(text);
|
||||
return quickReject('댓글을 다는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$text.val(text);
|
||||
return quickReject('댓글을 다는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
return loadArticles().done(drawArticles);
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawArticle(idx, articleObj){
|
||||
var $articleFrame = $('#articleTemplate > .articleFrame');
|
||||
var $commentFrame = $($('#commentTemplate').prop('content'));
|
||||
|
||||
var $article = $articleFrame.clone();
|
||||
$article.addClass('articleObj')
|
||||
.data('no', articleObj.no)
|
||||
.data('author', articleObj.general_no);
|
||||
|
||||
|
||||
$article.find('.articleNo').text(articleObj.no);
|
||||
$article.find('.authorName').text(articleObj.author);
|
||||
$article.find('.articleTitle').text(articleObj.title);
|
||||
$article.find('.date').text(articleObj.date);
|
||||
if(articleObj.author_icon){
|
||||
$article.find('.authorIcon').attr('src', articleObj.author_icon);
|
||||
}
|
||||
//$article.find('.text').text(articleObj.text);
|
||||
$article.find('.text').html(nl2br(escapeHtml(articleObj.text)));
|
||||
//TODO: 바꿀 것
|
||||
|
||||
var $articleComment = $article.find('.commentList');
|
||||
|
||||
$.each(articleObj.comment, function(_, commentObj){
|
||||
var $comment = $commentFrame.clone();
|
||||
$comment.find('.author').text(commentObj.author);
|
||||
//$comment.find('.text').text(commentObj.text);
|
||||
$comment.find('.text').html(nl2br(escapeHtml(commentObj.text)));
|
||||
$comment.find('.date').text(commentObj.date);
|
||||
$articleComment.append($comment);
|
||||
});
|
||||
|
||||
$article.find('.submitComment').click(submitComment);
|
||||
$article.find('.commentText').on('keypress', function (e) {
|
||||
if(e.which === 13){
|
||||
$article.find('.submitComment').click();
|
||||
}
|
||||
});
|
||||
$article.find('.inputCommentHeader').click(function(){
|
||||
$article.find('.commentText').focus();
|
||||
})
|
||||
|
||||
var $board = $('#board');
|
||||
|
||||
$board.prepend($article);
|
||||
}
|
||||
|
||||
function drawArticles(articlesObj){
|
||||
var deferred = $.Deferred();
|
||||
if(!articlesObj){
|
||||
return quickReject('받아오는데 실패했습니다.');
|
||||
}
|
||||
if(!articlesObj.result){
|
||||
return quickReject('에러가 발생했습니다. : '+articlesObj.reason);
|
||||
}
|
||||
|
||||
$('.articleObj').detach();//첫 버전이니까 일괄 삭제 일괄 로드
|
||||
$.each(articlesObj.articles, drawArticle);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadArticles(){
|
||||
return $.post({
|
||||
url:'j_board_get_articles.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
isSecret:isSecretBoard, //첫 버전이니까 전체 다 불러오자
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resizeTextarea($obj){
|
||||
$obj.height(1).height($obj.prop('scrollHeight')+12 );
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('textarea.autosize').on('keydown keyup', function(){
|
||||
resizeTextarea($(this));
|
||||
})
|
||||
|
||||
$('#submitArticle').click(submitArticle);
|
||||
|
||||
loadArticles()
|
||||
.then(drawArticles, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,195 +0,0 @@
|
||||
function changePermission(isAmbassador, rawGeneralList) {
|
||||
console.log(isAmbassador);
|
||||
console.log(rawGeneralList);
|
||||
|
||||
var generalList = [];
|
||||
$.each(rawGeneralList, function(idx, value) {
|
||||
generalList.push(parseInt(value.id));
|
||||
})
|
||||
|
||||
$.post({
|
||||
url: 'j_general_set_permission.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
isAmbassador: isAmbassador,
|
||||
genlist: generalList
|
||||
},
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
alert('변경하지 못했습니다.');
|
||||
return false;
|
||||
}
|
||||
if (!data.result) {
|
||||
alert('변경하지 못했습니다. : ' + data.reason);
|
||||
return false;
|
||||
}
|
||||
alert('변경했습니다.');
|
||||
location.reload();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$('#selectAmbassador').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
allowClear: true,
|
||||
language: "ko",
|
||||
width: 300,
|
||||
maximumSelectionLength: 2,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data: candidateAmbassadors,
|
||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
$('#selectAuditor').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
allowClear: true,
|
||||
language: "ko",
|
||||
width: 300,
|
||||
maximumSelectionLength: 2,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data: candidateAuditors,
|
||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
$('#changeAmbassador').click(function() {
|
||||
if (!confirm('외교권자를 변경할까요?')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
changePermission(true, $('#selectAmbassador').select2('data'));
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#changeAuditor').click(function() {
|
||||
if (!confirm('조언자를 변경할까요?')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
changePermission(false, $('#selectAuditor').select2('data'));
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#btn_kick').click(function() {
|
||||
var $kickSelect = $('#genlist_kick option:selected');
|
||||
var generalID = $kickSelect.val();
|
||||
if (!generalID) {
|
||||
alert('장수를 선택해주세요');
|
||||
return false;
|
||||
}
|
||||
var generalName = $kickSelect.data('name');
|
||||
if (!confirm('{0}를 추방하시겠습니까?'.format(generalName))) {
|
||||
return false;
|
||||
}
|
||||
$.post({
|
||||
url: 'j_myBossInfo.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: '추방',
|
||||
destGeneralID: generalID
|
||||
},
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
alert('추방하지 못했습니다.');
|
||||
return false;
|
||||
}
|
||||
if (!data.result) {
|
||||
alert('추방하지 못했습니다. : ' + data.reason);
|
||||
return false;
|
||||
}
|
||||
alert('{0}를 추방했습니다.'.format(generalName));
|
||||
location.reload();
|
||||
}, errUnknown);
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.btn_appoint').click(function() {
|
||||
var $btn = $(this);
|
||||
var officerLevel = $btn.data('officer_level');
|
||||
var officerLevelText = $btn.data('officer_level_text');
|
||||
var cityID = 0;
|
||||
var cityName = '_';
|
||||
var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel));
|
||||
var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel));
|
||||
|
||||
var generalID = parseInt($generalSelect.val());
|
||||
var generalName = $generalSelect.data('name');
|
||||
var generalOfficerLevel = $generalSelect.data('officer_level');
|
||||
|
||||
|
||||
if (officerLevel >= 5) {
|
||||
if (generalID == 0) {
|
||||
if (!confirm('{0}직을 비우시겠습니까?'.format(officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
} else if (generalOfficerLevel >= 5) {
|
||||
if (!confirm('이미 수뇌인 {0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!confirm('{0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cityID = $citySelect.val();
|
||||
if (!cityID) {
|
||||
alert('도시를 선택해주세요');
|
||||
return false;
|
||||
}
|
||||
cityName = $citySelect.find('option:selected .name_field').text();
|
||||
|
||||
if (generalID == 0) {
|
||||
if (!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
} else if (generalOfficerLevel >= 5) {
|
||||
if (!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.post({
|
||||
url: 'j_myBossInfo.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
action: '임명',
|
||||
destGeneralID: generalID,
|
||||
destCityID: cityID,
|
||||
officerLevel: officerLevel
|
||||
},
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
alert('임명하지 못했습니다.');
|
||||
return false;
|
||||
}
|
||||
if (!data.result) {
|
||||
alert('임명하지 못했습니다. : ' + data.reason);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (generalID) {
|
||||
alert('{0}을(를) 임명했습니다.'.format(generalName));
|
||||
} else {
|
||||
alert('관직을 비웠습니다.');
|
||||
}
|
||||
|
||||
location.reload();
|
||||
}, errUnknown);
|
||||
|
||||
})
|
||||
})
|
||||
@@ -1,185 +0,0 @@
|
||||
var filledChiefList = {};
|
||||
|
||||
var chiefTableObj = {};
|
||||
|
||||
function clearTable(){
|
||||
$('.chiefLevelText').html('-');
|
||||
$('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
||||
}
|
||||
|
||||
function genChiefTableObj(){
|
||||
var objTable = {
|
||||
btns: $('#turnPush,#turnPull,#setCommand')
|
||||
};
|
||||
|
||||
for(var chiefIdx = 5; chiefIdx <= 12; chiefIdx++){
|
||||
var $plate = $('#chief_{0}'.format(chiefIdx));
|
||||
var $officerLevelText = $plate.find('.chiefLevelText');
|
||||
var $name = $plate.find('.chiefName');
|
||||
var turn = [];
|
||||
for(var turnIdx=0;turnIdx<maxChiefTurn;turnIdx++){
|
||||
var $turn = $plate.find('.turn{0}'.format(turnIdx));
|
||||
var $turnTime = $turn.find('.chiefTurnTime');
|
||||
var $turnPad = $turn.find('.chiefTurnPad');
|
||||
var $turnText = $turn.find('.chiefTurnText');
|
||||
turn.push({turnTime:$turnTime,turnPad:$turnPad,turnText:$turnText});
|
||||
}
|
||||
objTable[chiefIdx] = {
|
||||
officerLevelText: $officerLevelText,
|
||||
name: $name,
|
||||
turn: turn
|
||||
};
|
||||
}
|
||||
|
||||
return objTable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function clearChief(chiefIdx){
|
||||
var $plate = $('#chief_{0}'.format(chiefIdx));
|
||||
$plate.find('.chiefLevelText').html('-');
|
||||
$plate.find('.chiefTurnTime, .chiefTurnText, .chiefName').html(' ');
|
||||
}
|
||||
|
||||
function reloadTable(){
|
||||
$.post({
|
||||
url:'j_getChiefTurn.php',
|
||||
dataType:'json',
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
return;
|
||||
}
|
||||
var turnTerm = data.turnTerm;
|
||||
var tmpFilledChiefList = {};
|
||||
|
||||
if(data.isChief){
|
||||
chiefTableObj.btns.css('visibility', 'visible');
|
||||
}
|
||||
else{
|
||||
chiefTableObj.btns.css('visibility', 'hidden');
|
||||
}
|
||||
$.each(data.nationTurnBrief, function(chiefIdx, chiefInfo){
|
||||
tmpFilledChiefList[chiefIdx] = true;
|
||||
filledChiefList[chiefIdx] = true;
|
||||
|
||||
var plateObj = chiefTableObj[chiefIdx];
|
||||
if(chiefInfo.name){
|
||||
var $name = $('<span>{0}</span>'.format(chiefInfo.name));
|
||||
var nameColor = getNpcColor(chiefInfo.npcType);
|
||||
if(nameColor){
|
||||
$name.css('color',nameColor);
|
||||
}
|
||||
plateObj.name.html($name);
|
||||
}
|
||||
else{
|
||||
plateObj.name.html('');
|
||||
}
|
||||
|
||||
plateObj.officerLevelText.text(chiefInfo.officerLevelText);
|
||||
|
||||
if(chiefInfo.turnTime){
|
||||
var turnTimeObj = moment(chiefInfo.turnTime);
|
||||
}
|
||||
else{
|
||||
var turnTimeObj = null;
|
||||
}
|
||||
var turnList = plateObj.turn;
|
||||
$.each(chiefInfo.turn, function(turnIdx, turnText){
|
||||
if(turnTimeObj){
|
||||
turnList[turnIdx].turnTime.text(turnTimeObj.format('HH:mm'));
|
||||
}
|
||||
else{
|
||||
turnList[turnIdx].turnTime.text('');
|
||||
}
|
||||
|
||||
turnList[turnIdx].turnText.html(turnText).css('font-size', '13px');
|
||||
var oWidth = turnList[turnIdx].turnPad.innerWidth();
|
||||
var iWidth = turnList[turnIdx].turnText.outerWidth();
|
||||
if(iWidth > oWidth * 0.95){
|
||||
var newFontSize = 13 * oWidth / iWidth * 0.9;
|
||||
turnList[turnIdx].turnText.css('font-size', '{0}px'.format(newFontSize));
|
||||
}
|
||||
if(turnTimeObj){
|
||||
turnTimeObj = turnTimeObj.add(turnTerm, 'minute');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
for(var idx=5;idx<=12;idx++){
|
||||
if(idx in tmpFilledChiefList){
|
||||
continue;
|
||||
}
|
||||
if(idx in filledChiefList){
|
||||
clearChief(chiefIdx);
|
||||
}
|
||||
}
|
||||
filledChiefList = tmpFilledChiefList;
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
function reserveTurn(turnList, command){
|
||||
console.log(turnList, command);
|
||||
$.post({
|
||||
url:'j_set_chief_command.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:command,
|
||||
turnList:turnList
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadTable();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
function pushTurn(turnCnt){
|
||||
$.post({
|
||||
url:'j_chief_turn.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
amount:turnCnt
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadTable();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
chiefTableObj= genChiefTableObj();
|
||||
reloadTable();
|
||||
$('#reloadTable').click(reloadTable);
|
||||
$('#setCommand').click(function(){
|
||||
var turnList = $('#chiefTurnSelector').val().map(function(v){return parseInt(v);});
|
||||
var $command = $('#chiefCommandList option:selected');
|
||||
if($command.data('reqarg')){
|
||||
$.redirect(
|
||||
"b_processing.php", {
|
||||
command: $command.val(),
|
||||
turnList: turnList.join('_'),
|
||||
is_chief: true
|
||||
}, "GET");
|
||||
}
|
||||
else{
|
||||
reserveTurn(turnList, $command.val());
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#turnPush').click(function(){
|
||||
pushTurn(1);
|
||||
});
|
||||
|
||||
$('#turnPull').click(function(){
|
||||
pushTurn(-1);
|
||||
});
|
||||
|
||||
})
|
||||
@@ -1,417 +0,0 @@
|
||||
/**
|
||||
* <>& 등을 html에서도 그대로 보이도록 escape주는 함수
|
||||
* @see https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
|
||||
* @param {string} string escape하고자 하는 문자열
|
||||
* @returns {string}
|
||||
*/
|
||||
var escapeHtml = (function(string) {
|
||||
var entityMap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'/': '/',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
|
||||
return function(string) {
|
||||
return String(string).replace(/[&<>"'`=\/]/g, function(s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* 변수가 정수인지 확인하는 함수
|
||||
* @param {*} n 정수인지 확인하기 위한 인자
|
||||
* @return {boolean} 정수인지 여부
|
||||
*/
|
||||
function isInt(n) {
|
||||
return +n === n && !(n % 1);
|
||||
}
|
||||
|
||||
;
|
||||
(function(ns) {
|
||||
//https://gist.github.com/demouth/3217440
|
||||
/**
|
||||
* mb_strwidth
|
||||
* @param String
|
||||
* @return int
|
||||
* @see http://php.net/manual/ja/function.mb-strwidth.php
|
||||
*/
|
||||
var mb_strwidth = function(str) {
|
||||
var i = 0,
|
||||
l = str.length,
|
||||
c = '',
|
||||
length = 0;
|
||||
for (; i < l; i++) {
|
||||
c = str.charCodeAt(i);
|
||||
if (0x0000 <= c && c <= 0x0019) {
|
||||
length += 0;
|
||||
} else if (0x0020 <= c && c <= 0x1FFF) {
|
||||
length += 1;
|
||||
} else if (0x2000 <= c && c <= 0xFF60) {
|
||||
length += 2;
|
||||
} else if (0xFF61 <= c && c <= 0xFF9F) {
|
||||
length += 1;
|
||||
} else if (0xFFA0 <= c) {
|
||||
length += 2;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
};
|
||||
|
||||
/**
|
||||
* mb_strimwidth
|
||||
* @param String
|
||||
* @param int
|
||||
* @param int
|
||||
* @param String
|
||||
* @return String
|
||||
* @see http://www.php.net/manual/ja/function.mb-strimwidth.php
|
||||
*/
|
||||
var mb_strimwidth = function(str, start, width, trimmarker) {
|
||||
if (typeof trimmarker === 'undefined') trimmarker = '';
|
||||
var trimmakerWidth = mb_strwidth(trimmarker),
|
||||
i = start,
|
||||
l = str.length,
|
||||
trimmedLength = 0,
|
||||
trimmedStr = '';
|
||||
for (; i < l; i++) {
|
||||
var charCode = str.charCodeAt(i),
|
||||
c = str.charAt(i),
|
||||
charWidth = mb_strwidth(c),
|
||||
next = str.charAt(i + 1),
|
||||
nextWidth = mb_strwidth(next);
|
||||
trimmedLength += charWidth;
|
||||
trimmedStr += c;
|
||||
if (trimmedLength + trimmakerWidth + nextWidth > width) {
|
||||
trimmedStr += trimmarker;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return trimmedStr;
|
||||
};
|
||||
ns.mb_strwidth = mb_strwidth;
|
||||
ns.mb_strimwidth = mb_strimwidth;
|
||||
})(window);
|
||||
|
||||
/**
|
||||
* object의 array를 id를 key로 삼는 object로 재 변환
|
||||
* @param {Array.{id: Object}} arr id를 가진 object의 array
|
||||
* @returns {Object}
|
||||
*/
|
||||
function convertDictById(arr) {
|
||||
var result = {};
|
||||
arr.forEach(function(v, i) {
|
||||
result[v.id] = v;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* array를 set 형태의 object로 변환
|
||||
* @param {Array} arr 값을 가진 array
|
||||
* @returns {Object}
|
||||
*/
|
||||
function convertSet(arr) {
|
||||
var result = {};
|
||||
arr.forEach(function(v) {
|
||||
result[v] = true;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {0}, {1}, {2}형태로 포맷해주는 함수
|
||||
*/
|
||||
String.prototype.format = function() {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function(match, number) {
|
||||
return (typeof args[number] != 'undefined') ? args[number] : match;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function hexToRgb(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null;
|
||||
}
|
||||
|
||||
|
||||
function isBrightColor(color) {
|
||||
color = hexToRgb(color);
|
||||
if ((color.r * 0.299 + color.g * 0.587 + color.b * 0.114) > 140) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게임내에서 지원하는 color type만 선택할 수 있도록 해주는 함수
|
||||
* @param {string} color #AAAAAA 또는 AAAAAA 형태로 작성된 RGB hex color string
|
||||
* @returns {string}
|
||||
*/
|
||||
function convColorValue(color) {
|
||||
if (color.charAt(0) == '#') {
|
||||
color = color.substr(1);
|
||||
}
|
||||
color = color.toUpperCase();
|
||||
|
||||
var colorBase = convertSet([
|
||||
'000080', '0000FF', '008000', '008080', '00BFFF', '00FF00', '00FFFF', '20B2AA',
|
||||
'2E8B57', '483D8B', '6495ED', '7B68EE', '7CFC00', '7FFFD4', '800000', '800080',
|
||||
'808000', '87CEEB', 'A0522D', 'A9A9A9', 'AFEEEE', 'BA55D3', 'E0FFFF', 'F5F5DC',
|
||||
'FF0000', 'FF00FF', 'FF6347', 'FFA500', 'FFC0CB', 'FFD700', 'FFDAB9', 'FFFF00',
|
||||
'FFFFFF'
|
||||
]);
|
||||
|
||||
if (!colorBase.hasOwnProperty(color)) {
|
||||
return '000000';
|
||||
}
|
||||
|
||||
return color;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
function linkifyStrWithOpt(text) {
|
||||
return linkifyStr(text, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 단순한 Template 함수. <%변수명%>으로 template 가능
|
||||
* @see https://github.com/krasimir/absurd/blob/master/lib/processors/html/helpers/TemplateEngine.js
|
||||
* @param {string} html
|
||||
* @param {object} options
|
||||
* @returns {string}
|
||||
*/
|
||||
var TemplateEngine = function(html, options) {
|
||||
var re = /<%(.+?)%>/g,
|
||||
reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g,
|
||||
code = 'with(obj) { var r=[];\n',
|
||||
cursor = 0,
|
||||
result,
|
||||
match;
|
||||
var add = function(line, js) {
|
||||
js ? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') :
|
||||
(code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : '');
|
||||
return add;
|
||||
}
|
||||
options.e = escapeHtml;
|
||||
options.linkifyStr = linkifyStrWithOpt;
|
||||
while (match = re.exec(html)) {
|
||||
add(html.slice(cursor, match.index))(match[1], true);
|
||||
cursor = match.index + match[0].length;
|
||||
}
|
||||
add(html.substr(cursor, html.length - cursor));
|
||||
code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, ' ');
|
||||
try { result = new Function('obj', code).apply(options, [options]); } catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
|
||||
return result;
|
||||
}
|
||||
|
||||
function getIconPath(imgsvr, picture) {
|
||||
// ../d_shared/common_path.js 필요
|
||||
if (!imgsvr) {
|
||||
return pathConfig.sharedIcon + '/' + picture;
|
||||
} else {
|
||||
return pathConfig.root + '/d_pic/' + picture;
|
||||
}
|
||||
}
|
||||
|
||||
function activeFlip($obj) {
|
||||
var $result;
|
||||
if ($obj === undefined) {
|
||||
$result = $('img[data-flip]');
|
||||
} else {
|
||||
$result = $obj.find('img[data-flip]');
|
||||
}
|
||||
|
||||
$result.each(function() {
|
||||
activeFlipItem($(this));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function combineObject(item, columnList) {
|
||||
var newItem = {};
|
||||
for (var columnIdx in columnList) {
|
||||
var columnName = columnList[columnIdx];
|
||||
newItem[columnName] = item[columnIdx];
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
function combineArray(array, columnList) {
|
||||
var result = [];
|
||||
for (var key in array) {
|
||||
var item = array[key];
|
||||
result[key] = combineObject(item, columnList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function activeFlipItem($img) {
|
||||
var imageList = [];
|
||||
imageList.push($img.attr('src'));
|
||||
$.each($img.data('flip').split(','), function(idx, value) {
|
||||
var value = $.trim(value);
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
imageList.push(value);
|
||||
});
|
||||
if (imageList.length <= 1) {
|
||||
return;
|
||||
}
|
||||
$img.data('computed_flip_array', imageList);
|
||||
$img.data('computed_flip_idx', 0);
|
||||
|
||||
$img.click(function() {
|
||||
var arr = $img.data('computed_flip_array');
|
||||
var idx = $img.data('computed_flip_idx');
|
||||
idx = (idx + 1) % (arr.length);
|
||||
$img.attr('src', arr[idx]);
|
||||
$img.data('computed_flip_idx', idx);
|
||||
});
|
||||
$img.css('cursor', 'pointer');
|
||||
}
|
||||
|
||||
jQuery(function($) {
|
||||
$('.obj_tooltip').mouseover(function() {
|
||||
var $objTooltip = $(this);
|
||||
if ($objTooltip.data('setObjTooltip')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var tooltipClassText = $objTooltip.data('tooltip-class');
|
||||
if (!tooltipClassText) {
|
||||
tooltipClassText = '';
|
||||
}
|
||||
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
.format(tooltipClassText);
|
||||
|
||||
$objTooltip.tooltip({
|
||||
title: function() {
|
||||
return $.trim($(this).find('.tooltiptext').html());
|
||||
},
|
||||
template: template,
|
||||
html: true
|
||||
}).tooltip('show');
|
||||
|
||||
$objTooltip.data('setObjTooltip', true);
|
||||
});
|
||||
/*each(function(){
|
||||
var $objTooltip = $(this);
|
||||
|
||||
|
||||
});*/
|
||||
|
||||
activeFlip();
|
||||
|
||||
var customCSS = localStorage.getItem('sam_customCSS');
|
||||
if (customCSS) {
|
||||
var $style = $('<style type="text/css"></style>');
|
||||
$style.text(customCSS);
|
||||
$style.appendTo($('head'));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function errUnknown() {
|
||||
alert('작업을 실패했습니다.');
|
||||
}
|
||||
|
||||
function errUnknownToast() {
|
||||
$.toast({
|
||||
title: '에러!',
|
||||
content: '작업을 실패했습니다.',
|
||||
type: 'danger',
|
||||
delay: 5000
|
||||
});
|
||||
}
|
||||
|
||||
function quickReject(errMsg) {
|
||||
if (errMsg === undefined) {
|
||||
errMsg = '작업을 실패했습니다.';
|
||||
}
|
||||
var deferred = $.Deferred();
|
||||
deferred.reject(errMsg);
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function nl2br(text) {
|
||||
return text.replace(/\n/g, "<br>");
|
||||
}
|
||||
/*
|
||||
function br2nl (text) {
|
||||
return text.replace(/<\s*\/?br\s*[\/]?>/gi, '\n');
|
||||
}
|
||||
*/
|
||||
|
||||
function getNpcColor(npcType) {
|
||||
if (npcType >= 2) {
|
||||
return 'cyan';
|
||||
}
|
||||
if (npcType == 1) {
|
||||
return 'skyblue';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function initTooltip($obj) {
|
||||
if ($obj === undefined) {
|
||||
$obj = $('.obj_tooltip');
|
||||
} else if (!$obj.hasClass('obj_tooltip')) {
|
||||
$obj = $obj.find('.obj_tooltip');
|
||||
}
|
||||
console.log($obj);
|
||||
|
||||
$obj.each(function() {
|
||||
$target = $(this);
|
||||
|
||||
if ($target.data('installHandler')) {
|
||||
return true;
|
||||
}
|
||||
$target.data('installHandler', true);
|
||||
|
||||
$target.mouseover(function() {
|
||||
var $objTooltip = $(this);
|
||||
if ($objTooltip.data('setObjTooltip')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var tooltipClassText = $objTooltip.data('tooltip-class');
|
||||
if (!tooltipClassText) {
|
||||
tooltipClassText = '';
|
||||
}
|
||||
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
.format(tooltipClassText);
|
||||
|
||||
$objTooltip.tooltip({
|
||||
title: function() {
|
||||
return $.trim($(this).find('.tooltiptext').html());
|
||||
},
|
||||
template: template,
|
||||
html: true
|
||||
}).tooltip('show');
|
||||
|
||||
$objTooltip.data('setObjTooltip', true);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
$(function() {
|
||||
var $target = $("#destCityID");
|
||||
reloadWorldMap({
|
||||
isDetailMap: false,
|
||||
clickableAll: true,
|
||||
neutralView: true,
|
||||
useCachedMap: true,
|
||||
selectCallback: function(city) {
|
||||
var currVal = $target.val();
|
||||
$target.val(city.id).trigger("change");
|
||||
if ($target.val() === null) {
|
||||
$target.val(currVal).trigger("change");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
$(function() {
|
||||
var $target = $("#destNationID");
|
||||
reloadWorldMap({
|
||||
isDetailMap: false,
|
||||
clickableAll: true,
|
||||
neutralView: true,
|
||||
useCachedMap: true,
|
||||
selectCallback: function(city) {
|
||||
var currVal = $target.val();
|
||||
$target.val(city.nationId).trigger("change");
|
||||
if ($target.val() === null) {
|
||||
$target.val(currVal).trigger("change");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,135 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
function guiEditorInit($obj, editable){
|
||||
var $submitBtn = $obj.find('.submit');
|
||||
var $noticeInput = $obj.find('.input_form');
|
||||
var globalVariableName = $noticeInput.data('global');
|
||||
var $editForm = $obj.find('.edit_form');
|
||||
var $cancelEdit = $obj.find('.cancel_edit');
|
||||
|
||||
var editMode = false;
|
||||
|
||||
function enableEditor(){
|
||||
editMode = true;
|
||||
$cancelEdit.show();
|
||||
|
||||
var inputText = window[globalVariableName];
|
||||
if(!inputText || inputText == '<p></p>'){
|
||||
inputText = '<p><br></p>';
|
||||
}
|
||||
|
||||
$editForm.removeClass('viewer').summernote({
|
||||
minHeight:200,
|
||||
maxHeight:null,
|
||||
focus:true,
|
||||
lang:'ko-KR',
|
||||
toolbar: [
|
||||
// [groupName, [list of button]]
|
||||
['do', ['undo', 'redo']],
|
||||
['style', ['bold', 'italic', 'underline', 'clear']],
|
||||
['font2', ['fontname', 'fontsize']],
|
||||
['font', ['strikethrough', 'superscript', 'subscript']],
|
||||
['color', ['color']],
|
||||
['in', ['picture', 'link', 'video', 'table', 'hr']],
|
||||
['para', ['ul', 'ol', 'paragraph']],
|
||||
['height', ['height', 'codeview']]
|
||||
],
|
||||
popover: {
|
||||
image: [
|
||||
['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']],
|
||||
['float', ['floatLeft', 'floatRight', 'floatNone']],
|
||||
['remove', ['removeMedia']],
|
||||
['custom', ['imageFlip']],
|
||||
],
|
||||
},
|
||||
fontNames: ['맑은 고딕', 'Nanum Gothic', 'Nanum Myeongjo', 'Nanum Pen Script', '굴림', '굴림체', '바탕', '바탕체', '궁서', '궁서체'],
|
||||
fontSizes: ['8', '9', '10', '11', '12', '14', '16', '20', '24', '28', '32', '36', '40', '46', '52', '60'],
|
||||
callbacks: {
|
||||
onImageUpload: function(files) {
|
||||
$editForm.summernote('saveRange');
|
||||
if(files.length == 0){
|
||||
alert('업로드된 파일이 없습니다.');
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('img', files[0]);
|
||||
$editForm.summernote("pasteHtml", '');
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'j_image_upload.php',
|
||||
dataType:'json',
|
||||
contentType: false,
|
||||
processData:false,
|
||||
data:formData
|
||||
}).then(function(result){
|
||||
if(!result.result){
|
||||
alert(result.reason);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log($editForm.summernote('code'));
|
||||
if($editForm.summernote('isEmpty')){
|
||||
|
||||
console.log('haha?');
|
||||
var $img = $('<img>');
|
||||
$img.attr('src', result.path);
|
||||
$editForm.summernote('code', $img);
|
||||
return;
|
||||
}
|
||||
|
||||
$editForm.summernote("insertImage", result.path, result.path);
|
||||
|
||||
},function(){
|
||||
alert('알 수 없는 이유로 아이콘 업로드를 실패했습니다.');
|
||||
});
|
||||
}
|
||||
}
|
||||
}).summernote('code', inputText);
|
||||
}
|
||||
|
||||
function disableEditor(){
|
||||
editMode = false;
|
||||
$editForm.summernote('destroy');
|
||||
$cancelEdit.hide();
|
||||
$editForm.html(window[globalVariableName]).addClass('viewer');
|
||||
activeFlip($editForm);
|
||||
}
|
||||
|
||||
$cancelEdit.hide();
|
||||
$editForm.html(window[globalVariableName]);
|
||||
activeFlip($editForm);
|
||||
if(editable){
|
||||
$submitBtn.prop('disabled', false);
|
||||
}
|
||||
else{
|
||||
$submitBtn.prop('disabled', true);
|
||||
}
|
||||
|
||||
$submitBtn.click(function(e){
|
||||
if(!editMode){
|
||||
e.preventDefault();
|
||||
enableEditor();
|
||||
return false;
|
||||
}
|
||||
var text = $editForm.summernote('code');
|
||||
window[globalVariableName] = text;
|
||||
$noticeInput.val(text);
|
||||
});
|
||||
|
||||
$cancelEdit.click(function(e){
|
||||
e.preventDefault();
|
||||
disableEditor();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
guiEditorInit($('#noticeForm'), editable);
|
||||
guiEditorInit($('#scoutMsgForm'), editable);
|
||||
|
||||
})
|
||||
@@ -1,422 +0,0 @@
|
||||
|
||||
|
||||
function submitLetter(){
|
||||
var $brief = $('#inputBrief');
|
||||
var $detail = $('#inputDetail');
|
||||
var $prevNo = $('#inputPrevNo');
|
||||
var $destNation = $('#inputDestNation');
|
||||
var brief = $.trim($brief.val());
|
||||
var detail = $.trim($detail.val());
|
||||
var prevNo = parseInt($prevNo.val());
|
||||
var destNation = parseInt($destNation.val());
|
||||
|
||||
if(prevNo !== null && prevNo < 1){
|
||||
prevNo = null;
|
||||
}
|
||||
|
||||
console.log(brief);
|
||||
if(!brief){
|
||||
return false;
|
||||
}
|
||||
|
||||
$brief.val('');
|
||||
$detail.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_diplomacy_send_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
brief:brief,
|
||||
detail:detail,
|
||||
destNation:destNation,
|
||||
prevNo:prevNo
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$brief.val(brief);
|
||||
$detail.val(detail);
|
||||
return quickReject('외교 서신을 보내는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$brief.val(brief);
|
||||
$detail.val(detail);
|
||||
return quickReject('외교 서신을 보내는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
alert('전송했습니다.');
|
||||
location.reload();
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function repondLetter(letterNo, isAgree, reason){
|
||||
$.post({
|
||||
url:'j_diplomacy_respond_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
isAgree:isAgree,
|
||||
reason:reason,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
return quickReject('응답을 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('응답을 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
if(isAgree){
|
||||
alert('승인했습니다.');
|
||||
}
|
||||
else{
|
||||
alert('거부했습니다.');
|
||||
}
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rollbackLetter(letterNo){
|
||||
$.post({
|
||||
url:'j_diplomacy_rollback_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
return quickReject('회수를 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('회수를 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
alert('회수 했습니다.');
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function destroyLetter(letterNo){
|
||||
$.post({
|
||||
url:'j_diplomacy_destroy_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
return quickReject('파기를 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('파기를 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
if(data.state == 'activated'){
|
||||
alert('파기를 요청 했습니다.');
|
||||
}
|
||||
else{
|
||||
alert('파기 되었습니다.');
|
||||
}
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawLetter(idx, letterObj){
|
||||
|
||||
if(letterObj.state == 'cancelled'){
|
||||
//TODO: 취소되거나, 대체된 문서도 보여줄 방법을 찾아볼 것
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(letterObj);
|
||||
|
||||
var $letterFrame = $('#letterTemplate > .letterFrame');
|
||||
|
||||
var srcColorFormat = {
|
||||
'background-color':letterObj.src.nationColor,
|
||||
'color':isBrightColor(letterObj.src.nationColor)?'#000000':'#ffffff'
|
||||
};
|
||||
|
||||
var destColorFormat = {
|
||||
'background-color':letterObj.dest.nationColor,
|
||||
'color':isBrightColor(letterObj.dest.nationColor)?'#000000':'#ffffff'
|
||||
};
|
||||
|
||||
var targetNation = letterObj.src.nationID==myNationID?letterObj.dest:letterObj.src;
|
||||
var targetColor = letterObj.src.nationID==myNationID?destColorFormat:srcColorFormat;
|
||||
|
||||
var $letter = $letterFrame.clone();
|
||||
|
||||
if(letterObj.state == 'replaced'){
|
||||
$letter.hide();
|
||||
}
|
||||
|
||||
$letter.addClass('letterObj')
|
||||
.data('no', letterObj.no)
|
||||
.data('brief', letterObj.brief)
|
||||
.data('detail', letterObj.detail)
|
||||
.attr('id', 'letter_'+letterObj.no);
|
||||
|
||||
$letter.find('.letterHeader').css(targetColor);
|
||||
$letter.find('.letterNationName').text(targetNation.nationName);
|
||||
$letter.find('.letterDate').text(letterObj.date);
|
||||
$letter.find('.letterNo').text('#'+letterObj.no);
|
||||
|
||||
var stateText = {
|
||||
'proposed':'제안됨',
|
||||
'activated':'승인됨',
|
||||
'cancelled':'거부됨',
|
||||
'replaced':'대체됨',
|
||||
};
|
||||
|
||||
var stateOptionText = {
|
||||
'try_destroy_src':'송신측의 파기 요청',
|
||||
'try_destroy_dest':'수신측의 파기 요청',
|
||||
}
|
||||
$letter.find('.letterStatus').text(stateText[letterObj.state]);
|
||||
|
||||
if(letterObj.state_opt !== null){
|
||||
$letter.find('.letterStatusOpt').text('('+stateOptionText[letterObj.state_opt]+')');
|
||||
}
|
||||
if(letterObj.prev_no !== null){
|
||||
var $showPrev = $('<a href="#">#{0}</a>'.format(letterObj.prev_no));
|
||||
$showPrev.click(function(){
|
||||
$('#letter_'+letterObj.prev_no).toggle();
|
||||
})
|
||||
$letter.find('.letterPrevNo').html($showPrev);
|
||||
}
|
||||
else{
|
||||
$letter.find('.letterPrevNo').text('신규');
|
||||
}
|
||||
$letter.find('.letterBrief').html(nl2br(escapeHtml(letterObj.brief)));
|
||||
$letter.find('.letterDetail').html(nl2br(escapeHtml(letterObj.detail)));
|
||||
|
||||
$letter.find('.letterSrc .signerImg img.generalIcon').attr('src', letterObj.src.generalIcon);
|
||||
$letter.find('.letterSrc .signerNation').text(letterObj.src.nationName).css(srcColorFormat);
|
||||
$letter.find('.letterSrc .signerName').text(letterObj.src.generalName).css(srcColorFormat);
|
||||
|
||||
if(letterObj.dest.generalName){
|
||||
$letter.find('.letterDest .signerImg img.generalIcon').attr('src', letterObj.dest.generalIcon);
|
||||
$letter.find('.letterDest .signerNation').text(letterObj.dest.nationName).css(destColorFormat);
|
||||
$letter.find('.letterDest .signerName').text(letterObj.dest.generalName).css(destColorFormat);
|
||||
}
|
||||
|
||||
if(letterObj.state == 'proposed' && letterObj.src.nationID != myNationID){
|
||||
$letter.find('.btnAgree').show().click(function(){
|
||||
if(!confirm('승인하시겠습니까?')){
|
||||
return false;
|
||||
}
|
||||
return repondLetter(letterObj.no, true, null);
|
||||
});
|
||||
$letter.find('.btnDisagree').show().click(function(){
|
||||
var reason = prompt('거부하시겠습니까? (이유 [최대 50자])');
|
||||
if(reason === null){
|
||||
return false;
|
||||
}
|
||||
reason = substr.substr(0, 50);
|
||||
return repondLetter(letterObj.no, false, reason);
|
||||
});
|
||||
}
|
||||
|
||||
if(letterObj.state == 'proposed' && letterObj.src.nationID == myNationID){
|
||||
$letter.find('.btnRollback').show().click(function(){
|
||||
if(!confirm('회수하시겠습니까?')){
|
||||
return false;
|
||||
}
|
||||
return rollbackLetter(letterObj.no);
|
||||
});
|
||||
}
|
||||
|
||||
if(letterObj.state == 'activated'){
|
||||
var $btnDestroy = $letter.find('.btnDestroy');
|
||||
if((letterObj.src.nationID==myNationID && letterObj.state_opt == 'try_destroy_src') ||
|
||||
(letterObj.dest.nationID==myNationID && letterObj.state_opt == 'try_destroy_dest')){
|
||||
$btnDestroy.show().prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$btnDestroy.show().click(function(){
|
||||
if(!confirm('본 문서를 파기하겠습니까? (상호 동의 필요)')){
|
||||
return false;
|
||||
}
|
||||
return destroyLetter(letterObj.no);
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$letter.find('.btnRenew').click(function(){
|
||||
var $inputPrevNo = $('#inputPrevNo');
|
||||
$inputPrevNo.val(letterObj.no);
|
||||
$inputPrevNo.trigger('change');
|
||||
})
|
||||
|
||||
|
||||
$('#letters').prepend($letter);
|
||||
}
|
||||
|
||||
function initNewLetterForm(lettersObj){
|
||||
console.log(lettersObj);
|
||||
var nationList = [];
|
||||
$.each(lettersObj.nations, function(idx, nation){
|
||||
nation.id = nation.nation;
|
||||
nation.text = nation.name;
|
||||
nationList.push(nation);
|
||||
})
|
||||
|
||||
var $destNation = $('#inputDestNation').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
language: "ko",
|
||||
width:300,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:nationList,
|
||||
templateResult: colorNation,
|
||||
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
|
||||
var prevNoList = [{
|
||||
id:0,
|
||||
text:'-새 문서-',
|
||||
nation:null,
|
||||
}];
|
||||
|
||||
$.each(lettersObj.letters, function(idx, letterObj){
|
||||
if(letterObj.state == 'replaced' || letterObj.state == 'cancelled'){
|
||||
return true;
|
||||
}
|
||||
var targetNation = letterObj.src.nationID==myNationID?letterObj.dest:letterObj.src;
|
||||
prevNoList.push({
|
||||
id:letterObj.no,
|
||||
text:'#{0} <{1}>'.format(letterObj.no, targetNation.nationName),
|
||||
nation:targetNation.nationID
|
||||
});
|
||||
});
|
||||
|
||||
var $inputPrevNo = $('#inputPrevNo').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
language: "ko",
|
||||
width:300,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:prevNoList,
|
||||
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
$inputPrevNo.on('change', function(e){
|
||||
var data = $inputPrevNo.select2('data')[0];
|
||||
console.log(data);
|
||||
if(data.nation == null){
|
||||
$destNation.prop("disabled", false);
|
||||
}
|
||||
else{
|
||||
$destNation.val(data.nation).prop("disabled", true);
|
||||
var $targetLetter = $('#letter_'+data.id);
|
||||
resizeTextarea($('#inputBrief').val($targetLetter.data('brief')));
|
||||
resizeTextarea($('#inputDetail').val($targetLetter.data('detail')));
|
||||
}
|
||||
});
|
||||
|
||||
$('#btnSend').click(submitLetter);
|
||||
|
||||
$('#newLetter').show();
|
||||
}
|
||||
|
||||
function drawLetters(lettersObj){
|
||||
var deferred = $.Deferred();
|
||||
if(!lettersObj){
|
||||
return quickReject('받아오는데 실패했습니다.');
|
||||
}
|
||||
|
||||
if(!lettersObj.result){
|
||||
return quickReject('에러가 발생했습니다. : '+lettersObj.reason);
|
||||
}
|
||||
|
||||
window.myNationID = lettersObj.myNationID;
|
||||
|
||||
if(permissionLevel == 4){
|
||||
initNewLetterForm(lettersObj);
|
||||
$('.letterActionPlate').show();
|
||||
}
|
||||
|
||||
$('.letterObj').detach();//첫 버전이니까 일괄 삭제 일괄 로드
|
||||
$.each(lettersObj.letters, drawLetter);
|
||||
return true;
|
||||
}
|
||||
|
||||
function loadLetters(){
|
||||
return $.post({
|
||||
url:'j_diplomacy_get_letter.php',
|
||||
dataType:'json', //첫 버전이니까 전체 다 불러오자
|
||||
data:{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function colorNation(nationInfo){
|
||||
if(!nationInfo.color){
|
||||
return nationInfo.text;
|
||||
}
|
||||
|
||||
var fgColor = isBrightColor(nationInfo.color)?'#000000':'#ffffff';
|
||||
var $nationForm = $('<div>'+nationInfo.text+'</div>').css({
|
||||
'color':fgColor,
|
||||
'background-color':nationInfo.color
|
||||
});
|
||||
return $nationForm;
|
||||
}
|
||||
|
||||
function resizeTextarea($obj){
|
||||
$obj.height(1).height($obj.prop('scrollHeight')+12 );
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
$('textarea.autosize').on('keydown keyup', function(){
|
||||
resizeTextarea($(this));
|
||||
})
|
||||
|
||||
loadLetters()
|
||||
.then(drawLetters, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,899 +0,0 @@
|
||||
|
||||
$(function() {
|
||||
|
||||
var cityList = {};
|
||||
var userList = {};
|
||||
|
||||
var cityGroupOrder = ['하북','중원','서북','서촉','남중','초','오월','동이'];
|
||||
var city규모 = {특:1,대:2,중:3,소:4,이:5,진:6,관:7,수:8};
|
||||
window.cityList = cityList;
|
||||
window.userList = userList;
|
||||
|
||||
var basicPath = document.location.pathname;
|
||||
basicPath = basicPath.substring(0, basicPath.lastIndexOf('/'))+'/';
|
||||
|
||||
|
||||
|
||||
var mergeSort = function(arr,cmpFunc){
|
||||
|
||||
if(typeof cmpFunc == "undefined"){
|
||||
cmpFunc = function(a,b){
|
||||
if(a<b) return -1;
|
||||
if(a>b) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var merge = function(left,right){
|
||||
var retVal=[];
|
||||
|
||||
var leftIdx=0;
|
||||
var rightIdx=0;
|
||||
|
||||
while(leftIdx<left.length && rightIdx<right.length){
|
||||
var cmpVal = cmpFunc(left[leftIdx],right[rightIdx]);
|
||||
|
||||
if(cmpVal<=0){
|
||||
retVal.push(left[leftIdx]);
|
||||
leftIdx++;
|
||||
}
|
||||
else{
|
||||
retVal.push(right[rightIdx]);
|
||||
rightIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
retVal = retVal.concat(left.slice(leftIdx)).concat(right.slice(rightIdx))
|
||||
|
||||
return retVal;
|
||||
};
|
||||
|
||||
var _mergeSort = function(arr){
|
||||
if(arr.length<2){
|
||||
return arr;
|
||||
}
|
||||
|
||||
var middle = Math.floor(arr.length/2);
|
||||
|
||||
var left = arr.slice(0,middle);
|
||||
var right = arr.slice(middle);
|
||||
|
||||
return merge(_mergeSort(left),_mergeSort(right));
|
||||
};
|
||||
|
||||
return _mergeSort(arr);
|
||||
|
||||
};
|
||||
|
||||
window.mergeSort = mergeSort;
|
||||
|
||||
var extDutyWindow = function(userInfo){
|
||||
window.currUser = userInfo;
|
||||
//도시 순서 재구성
|
||||
var subCityGroupList = {};
|
||||
var subCityList = {};
|
||||
|
||||
var tmpOldVal = 0;
|
||||
|
||||
//var callCity = function(num){console.log('city no.'+num+' is clicked!')};
|
||||
|
||||
if($('#ext_win').length==0){
|
||||
|
||||
var $win = $('<div id="ext_win" style="padding:0;" title="관직 임명"><table style="padding:0;margin:0;" cellspacing="0" cellpadding="0" border="0"><tr><td width="700px" style="padding:0;"><iframe id="in_frame" src="map.php?type=1&graphic=1" width="700" height="520" frameborder="0" marginwidth="0" marginheight="0" topmargin="0" scrolling="no"></iframe></td>'+
|
||||
'<td width="305px" style="padding:0;vertical-align:top;height:520px;"><div style="height:520px;width:305px;overflow-y:scroll;overflow-x:hidden;">'+
|
||||
'<table id="inner_table"><thead><tr><th width="35">도시</th><th width="85">태수</th><th width="85">군사</th><th width="85">종사</th></tr></thead><tbody class="content">'+
|
||||
'</tbody></table></div></td></tr></table>'+
|
||||
'<form name="form1" id="fake_form"><span id="user_name"></span> : <select name="double" id="city_select"></select>'+
|
||||
'<div id="duty_radio" style="display:inline;">'+
|
||||
'<input type="radio" id="duty_type1" value="4" name="duty_radio"><label for="duty_type1">태수</label>'+
|
||||
'<input type="radio" id="duty_type2" value="3" name="duty_radio"><label for="duty_type2">군사</label>'+
|
||||
'<input type="radio" id="duty_type3" value="2" name="duty_radio"><label for="duty_type3">종사</label>'+
|
||||
'</div></form></div>');
|
||||
$win.hide();
|
||||
|
||||
$win.css('font-size','9pt');
|
||||
|
||||
|
||||
|
||||
$('#fake_form').css('display','inline');
|
||||
$('body').append($win);
|
||||
|
||||
$('#inner_table').attr('border','1').attr('cellspacing',"0").attr('cellpadding',"0")
|
||||
.attr('bordercolordark',"gray").attr('bordercolorlight',"black").attr('align','center')
|
||||
.css('font-size','13px').css('width','290px');
|
||||
|
||||
$('#inner_table thead tr');
|
||||
|
||||
$('#fake_form').submit(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#in_frame').load(function(){
|
||||
$('#in_frame').contents().find('div').click(function(){$('#city_select').change();});
|
||||
});
|
||||
|
||||
$("#duty_radio").buttonset();
|
||||
|
||||
var $city_select = $('#city_select');
|
||||
$city_select.css('color','white').css('background-color','black');
|
||||
|
||||
|
||||
$city_select.change(function(event){
|
||||
if($city_select.val()==null){
|
||||
$city_select.val(tmpOldVal);
|
||||
return false;
|
||||
}
|
||||
|
||||
if($city_select.val() == tmpOldVal){
|
||||
return false;
|
||||
}
|
||||
|
||||
tmpOldVal = $city_select.val();
|
||||
//console.log(tmpOldVal);
|
||||
var newInfo = subCityList[tmpOldVal];
|
||||
var cityInfo = newInfo.city;
|
||||
|
||||
var p태수 = cityInfo.p태수 && currUser.p태수;
|
||||
var p군사 = cityInfo.p군사 && currUser.p군사;
|
||||
var p종사 = cityInfo.p종사 && currUser.p종사;
|
||||
|
||||
//console.log(p태수,p군사,p종사);
|
||||
|
||||
$('#duty_type1').button({disabled:!p태수});
|
||||
$('#duty_type2').button({disabled:!p군사});
|
||||
$('#duty_type3').button({disabled:!p종사});
|
||||
|
||||
var $태수 = cityInfo.$태수;
|
||||
var $군사 = cityInfo.$군사;
|
||||
var $종사 = cityInfo.$종사;
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
$win.dialog({
|
||||
autoOpen:false,
|
||||
width:1005,
|
||||
height:680,
|
||||
buttons:{
|
||||
"임명":function(){
|
||||
//console.log("임명!");
|
||||
|
||||
var $checked = $('#duty_radio :radio:checked');
|
||||
|
||||
if($checked.length==0 || $checked.attr('disabled')=='disabled'){
|
||||
alert('직책을 선택해주세요!');
|
||||
return false;
|
||||
}
|
||||
var type = $checked.attr('value');
|
||||
var text = $checked.next().text();
|
||||
var userVal = currUser.val;
|
||||
var userName = currUser.name;
|
||||
var cityVal = $city_select.val();
|
||||
|
||||
var cityInfo = subCityList[cityVal].city;
|
||||
|
||||
$.post(basicPath+'j_myBossInfo.php',{
|
||||
destCityID:cityVal,
|
||||
destGeneralID:userVal,
|
||||
officerLevel:type,
|
||||
action:'임명'
|
||||
},function(rawData){
|
||||
|
||||
cityInfo['p'+text]=false;
|
||||
var $target = cityInfo.users.find('.mode_'+type);
|
||||
$target.prop('disabled',true);
|
||||
$target.css('background','transparent');
|
||||
$target.css('border','0');
|
||||
$target.css('color','');
|
||||
|
||||
cityInfo['$'+text].html(userName);
|
||||
|
||||
$win.dialog("close");
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
"닫기":function(){
|
||||
$win.dialog("close");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//console.log($win.parent());
|
||||
$win.parent().css('font-size','10pt');
|
||||
}
|
||||
|
||||
$('#ext_win').dialog("close").dialog( "option", "position", { my: "center top", at: "center bottom", of: userInfo.$user} );
|
||||
|
||||
var $innerContent = $('#inner_table .content');
|
||||
$innerContent.html('');
|
||||
$("#user_name").html(userInfo.name+'['+userInfo.city+']');
|
||||
|
||||
$('#city_select').html('');
|
||||
|
||||
$.each(cityList,function(idx,cityInfo){
|
||||
var 지역 = cityInfo.지역;
|
||||
|
||||
var p태수 = cityInfo.p태수 && currUser.p태수;
|
||||
var p군사 = cityInfo.p군사 && currUser.p군사;
|
||||
var p종사 = cityInfo.p종사 && currUser.p종사;
|
||||
|
||||
var newInfo = {
|
||||
지역 : 지역,
|
||||
규모 : cityInfo.규모,
|
||||
이름 : cityInfo.이름,
|
||||
val : cityInfo.val,
|
||||
city : cityInfo,
|
||||
p태수 : p태수,
|
||||
p군사 : p군사,
|
||||
p종사 : p종사
|
||||
};
|
||||
|
||||
//console.log(newInfo);
|
||||
|
||||
if(p태수 || p군사 || p종사){
|
||||
if(typeof subCityGroupList[지역] == 'undefined'){
|
||||
subCityGroupList[지역] = [];
|
||||
}
|
||||
subCityGroupList[지역].push(newInfo);
|
||||
subCityList[cityInfo.val] = newInfo;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$.each(cityGroupOrder,function(idx,groupName){
|
||||
if(typeof subCityGroupList[groupName] == 'undefined'){
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var subList = subCityGroupList[groupName];
|
||||
|
||||
var $group = $('<tr><td colspan="4" style="color:skyblue;">【 '+groupName+' 】</td></tr>');
|
||||
$innerContent.append($group);
|
||||
|
||||
subList.sort(function(a,b){
|
||||
|
||||
var cmp규모 = city규모[a.규모] - city규모[b.규모];
|
||||
if(cmp규모 != 0) return cmp규모;
|
||||
|
||||
return a.이름.localeCompare(b.이름);
|
||||
});
|
||||
var $optgroup = $('<optgroup label=" 【 '+groupName+' 】 " style="color:skyblue;"></optgroup>');
|
||||
|
||||
$.each(subList,function(idx,newInfo){
|
||||
$optgroup.append('<option value="'+newInfo.val+'" style="color:white;">'+newInfo.이름+'</option>');
|
||||
|
||||
var cityInfo = newInfo.city;
|
||||
var $city = $('<tr><td>'+newInfo.이름+'</td></tr>');
|
||||
|
||||
var $태수 = cityInfo.$태수.clone();
|
||||
$city.append($태수);
|
||||
if(!newInfo.p태수){
|
||||
$태수.css('color','red');
|
||||
}
|
||||
else{
|
||||
$태수.click(function(){
|
||||
$('#duty_radio :radio:eq(0)').attr('checked','checked');
|
||||
$('#duty_radio :radio').button('refresh');
|
||||
}).css('cursor','pointer');
|
||||
}
|
||||
|
||||
|
||||
var $군사 = cityInfo.$군사.clone();
|
||||
$city.append($군사);
|
||||
if(!newInfo.p군사)$군사.css('color','red');
|
||||
else{
|
||||
$군사.click(function(){
|
||||
$('#duty_radio :radio:eq(1)').attr('checked','checked');
|
||||
$('#duty_radio :radio').button('refresh');
|
||||
}).css('cursor','pointer');
|
||||
}
|
||||
|
||||
var $종사 = cityInfo.$종사.clone();
|
||||
$city.append($종사);
|
||||
if(!newInfo.p종사)$종사.css('color','red');
|
||||
else{
|
||||
$종사.click(function(){
|
||||
$('#duty_radio :radio:eq(2)').attr('checked','checked');
|
||||
$('#duty_radio :radio').button('refresh');
|
||||
}).css('cursor','pointer');
|
||||
}
|
||||
|
||||
$innerContent.append($city);
|
||||
$city.click(function(){
|
||||
$('#city_select').val(newInfo.val).change();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('#city_select').append($optgroup);
|
||||
});
|
||||
|
||||
tmpOldVal = $('#city_select').val();
|
||||
$('#city_select').change();
|
||||
$('#ext_win').dialog("open");
|
||||
};
|
||||
|
||||
var loadDuty = function(){
|
||||
|
||||
try{
|
||||
$('.for_duty').remove();
|
||||
$.get(basicPath+'b_myBossInfo.php',function(rawData){
|
||||
$html = $(rawData);
|
||||
//window.$html = $html;
|
||||
|
||||
var cnt =0;
|
||||
var $tmpTable = $html.filter('#officer_list').eq(0);
|
||||
|
||||
$selects = $tmpTable.find("select");
|
||||
if($selects.length == 0){
|
||||
alert("수뇌가 아닙니다!");
|
||||
return false;
|
||||
}
|
||||
|
||||
var setUserAvailable = function($userList,typeName){
|
||||
$userList.each(function(idx){
|
||||
var $this = $(this);
|
||||
|
||||
var val = $this.val();
|
||||
var name = $.trim($this.text());
|
||||
|
||||
for(var i=name.length-1;i>0;i--){
|
||||
if(name[i]=='【'){
|
||||
name = $.trim(name.substr(0,i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(val == '0'){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(typeof userList[name] != 'undefined'){
|
||||
userList[name].val = val;
|
||||
userList[name][typeName] = true;
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
var setCityAvailiable = function($cityList,typeName){
|
||||
$cityList.each(function(idx){
|
||||
|
||||
var $this = $(this);
|
||||
|
||||
var val = $.trim($this.val());
|
||||
var name = $.trim($this.text());
|
||||
|
||||
cityList[name].val = val;
|
||||
cityList[name][typeName] = true;
|
||||
});
|
||||
}
|
||||
|
||||
$.each(cityList,function(idx,cityInfo){
|
||||
cityInfo.p태수=false;
|
||||
cityInfo.p군사=false;
|
||||
cityInfo.p종사=false;
|
||||
});
|
||||
|
||||
$.each(userList,function(idx,userInfo){
|
||||
userInfo.p태수=false;
|
||||
userInfo.p군사=false;
|
||||
userInfo.p종사=false;
|
||||
});
|
||||
|
||||
setUserAvailable($selects.eq(1).find("option"),"p태수");
|
||||
setUserAvailable($selects.eq(3).find("option"),"p군사");
|
||||
setUserAvailable($selects.eq(5).find("option"),"p종사");
|
||||
|
||||
setCityAvailiable($selects.eq(0).find("option"),"p태수");
|
||||
setCityAvailiable($selects.eq(2).find("option"),"p군사");
|
||||
setCityAvailiable($selects.eq(4).find("option"),"p종사");
|
||||
|
||||
|
||||
$.each(cityList,function(idx,cityInfo){
|
||||
|
||||
//console.log(cityInfo.users.children());
|
||||
|
||||
cityInfo.users.children().each(function(idx){
|
||||
//console.log(this);
|
||||
var $this = $(this);
|
||||
|
||||
var username = $this.data('username');
|
||||
|
||||
var userInfo = userList[username];
|
||||
if(!userInfo){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(userInfo.val == '-1'){
|
||||
return true;
|
||||
}
|
||||
|
||||
$name = $this.find('.nameplate');
|
||||
|
||||
$name.append('<br class="for_duty">');
|
||||
|
||||
|
||||
var addBtn=function($name,cityInfo,userInfo,type,text,warn){
|
||||
|
||||
var enabled = cityInfo['p'+text]&&userInfo['p'+text];
|
||||
var cityVal = cityInfo.val;
|
||||
var $btn = $('<button type="button">'+text.substr(0,1)+'</button>');
|
||||
$btn.addClass('mode_'+type);
|
||||
$btn.addClass('for_duty');
|
||||
|
||||
if(!enabled){
|
||||
$btn.prop('disabled',true);
|
||||
$btn.css('background','transparent');
|
||||
$btn.css('border','0');
|
||||
}
|
||||
else{
|
||||
if(userInfo.is수뇌){
|
||||
$btn.css('color','red');
|
||||
}
|
||||
}
|
||||
|
||||
$btn.css('padding','1px 4px');
|
||||
$btn.css('margin','0');
|
||||
|
||||
$btn.click(function(){
|
||||
if(userInfo.is수뇌){
|
||||
if(!confirm('수뇌입니다. 임명할까요?')){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$.post(basicPath+'j_myBossInfo.php',{
|
||||
destCityID:cityVal,
|
||||
destGeneralID:userInfo.val,
|
||||
officerLevel:type,
|
||||
action:'임명'
|
||||
},function(rawData){
|
||||
|
||||
cityInfo['p'+text]=false;
|
||||
var $target = cityInfo.users.find('.mode_'+type);
|
||||
$target.prop('disabled',true);
|
||||
$target.css('background','transparent');
|
||||
$target.css('border','0');
|
||||
$target.css('color','');
|
||||
|
||||
cityInfo['$'+text].html(userInfo.name);
|
||||
});
|
||||
});
|
||||
|
||||
//console.log($btn);
|
||||
$name.append($btn);
|
||||
};
|
||||
|
||||
addBtn($name,cityInfo,userInfo,4,'태수');
|
||||
addBtn($name,cityInfo,userInfo,3,'군사');
|
||||
addBtn($name,cityInfo,userInfo,2,'종사');
|
||||
|
||||
//특수 버튼!
|
||||
if(userInfo.p태수||userInfo.p군사||userInfo.p종사){
|
||||
var $btn = $('<button type="button">...</button>');
|
||||
$btn.addClass('for_duty');
|
||||
if(userInfo.is수뇌){
|
||||
$btn.css('color','red');
|
||||
}
|
||||
$btn.css('padding','1px 4px');
|
||||
$btn.css('margin','0');
|
||||
|
||||
$btn.click(function(){
|
||||
if(userInfo.is수뇌){
|
||||
if(!confirm('수뇌입니다. 임명할까요?')){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extDutyWindow(userInfo);
|
||||
});
|
||||
|
||||
$btn.css('border','solid 1px Chocolate').css('background-color','#400000').css('margin-left','4px');
|
||||
$btn.css('line-hight','20px').css('color','GhostWhite').css('padding','2px 2px').css('height','18px').css('line-height','8px');
|
||||
|
||||
//$name.append($btn);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
catch(a){
|
||||
console.log(a);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var loadUser = function(){
|
||||
$.each(cityList,function(idx,val){
|
||||
if(typeof val.users == "undefined"){
|
||||
val.obj.append('<tr><td colspan="12"><table align="center" class="tb_layout cityUser bg0">'+
|
||||
'<thead><tr>'+
|
||||
'<td width="100" align="center" class="bg1">이 름</td><td width="100" align="center" class="bg1">통무지</td><td width="100" align="center" class="bg1">부 대</td><td width="60" align="center" class="bg1">자 금</td>'+
|
||||
'<td width="60" align="center" class="bg1">군 량</td><td width="30" align="center" class="bg1">守</td><td width="60" align="center" class="bg1">병 종</td>'+
|
||||
'<td width="60" align="center" class="bg1">병 사</td><td width="50" align="center" class="bg1">훈련</td><td width="50" align="center" class="bg1">사기</td><td width="150" align="center" class="bg1">명 령</td>'+
|
||||
'<td width="60" align="center" class="bg1">삭턴</td><td width="60" align="center" class="bg1">턴</td>'+
|
||||
'</tr></thead>'+
|
||||
'<tbody class="cityUserBody"></tbody></table></td></tr>');
|
||||
|
||||
val.users = val.obj.find(".cityUserBody");
|
||||
}
|
||||
else{
|
||||
val.users.html("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$.get(basicPath+'b_genList.php',function(rawData){
|
||||
var cnt =0;
|
||||
|
||||
var $helper = $('#helper_genlist');
|
||||
$helper.html('').append($.parseHTML(rawData));
|
||||
|
||||
var tmpUsers = $('#general_list tbody tr');
|
||||
|
||||
tmpUsers.each(function(idx){
|
||||
var $this = $(this);
|
||||
|
||||
var $city = $this.children('.i_city');
|
||||
$city.remove();
|
||||
var cityName = $.trim($city.text());
|
||||
|
||||
var $name = $this.children('.i_name');
|
||||
$name.addClass('nameplate');
|
||||
|
||||
var name = $name.find('.t_name').text();
|
||||
|
||||
var $work = $this.children('.i_action');
|
||||
|
||||
var cityInfo = cityList[cityName];
|
||||
if(typeof cityInfo == 'undefined'){
|
||||
return true;
|
||||
}
|
||||
if(cityInfo.warn주민)$work.html($work.html().split('정착 장려').join('<span style="color:yellow;">정착 장려</span>'));
|
||||
if(cityInfo.warn농업)$work.html($work.html().split('농지 개간').join('<span style="color:yellow;">농지 개간</span>'));
|
||||
if(cityInfo.warn상업)$work.html($work.html().split('상업 투자').join('<span style="color:yellow;">상업 투자</span>'));
|
||||
if(cityInfo.warn치안)$work.html($work.html().split('치안 강화').join('<span style="color:yellow;">치안 강화</span>'));
|
||||
if(cityInfo.warn수비)$work.html($work.html().split('수비 강화').join('<span style="color:yellow;">수비 강화</span>'));
|
||||
if(cityInfo.warn성벽)$work.html($work.html().split('성벽 보수').join('<span style="color:yellow;">성벽 보수</span>'));
|
||||
|
||||
|
||||
|
||||
var $stat = $this.children('.i_stat');
|
||||
var stat = $stat.text();
|
||||
|
||||
var is수뇌 = stat.indexOf('+')>=0;
|
||||
|
||||
$this.data('username',name);
|
||||
|
||||
if(cityList[cityName].$태수.text() == name){
|
||||
cityList[cityName].$태수.html('<span style="color:lightgreen">{0}</span>'.format(name));
|
||||
}
|
||||
if(cityList[cityName].$군사.text() == name){
|
||||
cityList[cityName].$군사.html('<span style="color:lightgreen">{0}</span>'.format(name));
|
||||
}
|
||||
if(cityList[cityName].$종사.text() == name){
|
||||
cityList[cityName].$종사.html('<span style="color:lightgreen">{0}</span>'.format(name));
|
||||
}
|
||||
|
||||
userList[name]={
|
||||
$city:cityInfo,
|
||||
city:cityName,
|
||||
$user:$this,
|
||||
name:name,
|
||||
val:'-1',
|
||||
p태수:false,
|
||||
p군사:false,
|
||||
p종사:false,
|
||||
is수뇌:is수뇌
|
||||
};
|
||||
|
||||
if(cityList[cityName]){
|
||||
cityList[cityName].users.append($this);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
if($("#loadDutyBtn").length == 0){
|
||||
|
||||
var $onBossList = $('<button id="loadDutyBtn">인사부 연동</button>');
|
||||
$onBossList.click(function(){
|
||||
loadDuty();
|
||||
return false;
|
||||
});
|
||||
|
||||
$('form').append($onBossList);
|
||||
}
|
||||
|
||||
$('#by_users').show();
|
||||
};
|
||||
|
||||
var mainFunc = function(){
|
||||
//대상 추출
|
||||
window.cityList = {};
|
||||
window.userList = {};
|
||||
|
||||
$("form").each(function(){
|
||||
var $this = $(this);
|
||||
$this.attr('name','p'+$this.attr('name'));
|
||||
});
|
||||
|
||||
$("table").each(function(idx,val){
|
||||
$this = $(this);
|
||||
|
||||
|
||||
if($this.attr('class')=='tb_layout bg2'){
|
||||
$this.addClass('cityInfo');
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
|
||||
window.$tmpTable = $this;
|
||||
var cityInfo = {};
|
||||
|
||||
//이름 추출
|
||||
{
|
||||
|
||||
var titleText = $this.find('tr:eq(0)>td:eq(0)').text();
|
||||
var loc0 = titleText.indexOf("【");
|
||||
var loc1 = titleText.indexOf("|");
|
||||
var loc2 = titleText.indexOf("】");
|
||||
|
||||
var cityLoc = $.trim(titleText.substring(loc0+1,loc1));
|
||||
var citySize = $.trim(titleText.substring(loc1+1,loc2));
|
||||
var cityName = $.trim(titleText.substring(loc2+1));
|
||||
|
||||
cityName = cityName.replace("[","");
|
||||
cityName = cityName.replace("]","");
|
||||
|
||||
$this.data('cityname',cityName);
|
||||
|
||||
cityInfo.지역 = cityLoc;
|
||||
cityInfo.규모 = citySize;
|
||||
cityInfo.이름 = cityName;
|
||||
|
||||
cityInfo.val = '-1';
|
||||
|
||||
cityInfo.p태수 = false;
|
||||
cityInfo.p군사 = false;
|
||||
cityInfo.p종사 = false;
|
||||
|
||||
}
|
||||
|
||||
//주민, 농상치성수
|
||||
|
||||
|
||||
{
|
||||
var $baseTr = $this.find('tr:eq(1)');
|
||||
cityInfo.$주민 = $baseTr.find('td:eq(1)');
|
||||
cityInfo.$농업 = $baseTr.find('td:eq(3)');
|
||||
cityInfo.$상업 = $baseTr.find('td:eq(5)');
|
||||
cityInfo.$치안 = $baseTr.find('td:eq(7)');
|
||||
cityInfo.$수비 = $baseTr.find('td:eq(9)');
|
||||
cityInfo.$성벽 = $baseTr.find('td:eq(11)');
|
||||
|
||||
var tmpVal;
|
||||
|
||||
tmpVal = cityInfo.$주민.text().split('/');
|
||||
cityInfo.주민 = parseInt(tmpVal[0]);
|
||||
cityInfo.max주민 = parseInt(tmpVal[1]);
|
||||
|
||||
tmpVal = cityInfo.$농업.text().split('/');
|
||||
cityInfo.농업 = parseInt(tmpVal[0]);
|
||||
cityInfo.max농업 = parseInt(tmpVal[1]);
|
||||
|
||||
tmpVal = cityInfo.$상업.text().split('/');
|
||||
cityInfo.상업 = parseInt(tmpVal[0]);
|
||||
cityInfo.max상업 = parseInt(tmpVal[1]);
|
||||
|
||||
tmpVal = cityInfo.$치안.text().split('/');
|
||||
cityInfo.치안 = parseInt(tmpVal[0]);
|
||||
cityInfo.max치안 = parseInt(tmpVal[1]);
|
||||
|
||||
tmpVal = cityInfo.$수비.text().split('/');
|
||||
cityInfo.수비 = parseInt(tmpVal[0]);
|
||||
cityInfo.max수비 = parseInt(tmpVal[1]);
|
||||
|
||||
tmpVal = cityInfo.$성벽.text().split('/');
|
||||
cityInfo.성벽 = parseInt(tmpVal[0]);
|
||||
cityInfo.max성벽 = parseInt(tmpVal[1]);
|
||||
|
||||
if (cityInfo.주민>cityInfo.max주민*0.9){ cityInfo.$주민.css('color','lightgreen');}
|
||||
else if (cityInfo.주민>cityInfo.max주민*0.7){ cityInfo.$주민.css('color','yellow');}
|
||||
else { cityInfo.$주민.css('color','orangered');}
|
||||
|
||||
if (cityInfo.농업>cityInfo.max농업*0.8){ cityInfo.$농업.css('color','lightgreen');}
|
||||
else if (cityInfo.농업>cityInfo.max농업*0.4){ cityInfo.$농업.css('color','yellow');}
|
||||
else { cityInfo.$농업.css('color','orangered');}
|
||||
|
||||
if (cityInfo.상업>cityInfo.max상업*0.8){ cityInfo.$상업.css('color','lightgreen');}
|
||||
else if (cityInfo.상업>cityInfo.max상업*0.4){ cityInfo.$상업.css('color','yellow');}
|
||||
else { cityInfo.$상업.css('color','orangered');}
|
||||
|
||||
if (cityInfo.치안>cityInfo.max치안*0.8){ cityInfo.$치안.css('color','lightgreen');}
|
||||
else if (cityInfo.치안>cityInfo.max치안*0.4){ cityInfo.$치안.css('color','yellow');}
|
||||
else { cityInfo.$치안.css('color','orangered');}
|
||||
|
||||
if (cityInfo.수비>cityInfo.max수비*0.6){ cityInfo.$수비.css('color','lightgreen');}
|
||||
else if (cityInfo.수비>cityInfo.max수비*0.3){ cityInfo.$수비.css('color','yellow');}
|
||||
else { cityInfo.$수비.css('color','orangered');}
|
||||
|
||||
if (cityInfo.성벽>cityInfo.max성벽*0.6){ cityInfo.$성벽.css('color','lightgreen');}
|
||||
else if (cityInfo.성벽>cityInfo.max성벽*0.3){ cityInfo.$성벽.css('color','yellow');}
|
||||
else { cityInfo.$성벽.css('color','orangered');}
|
||||
|
||||
|
||||
cityInfo.remain주민 = cityInfo.주민-cityInfo.max주민;
|
||||
cityInfo.remain농업 = cityInfo.농업-cityInfo.max농업;
|
||||
cityInfo.remain상업 = cityInfo.상업-cityInfo.max상업;
|
||||
cityInfo.remain치안 = cityInfo.치안-cityInfo.max치안;
|
||||
cityInfo.remain수비 = cityInfo.수비-cityInfo.max수비;
|
||||
cityInfo.remain성벽 = cityInfo.성벽-cityInfo.max성벽;
|
||||
|
||||
cityInfo.warn주민 = false;
|
||||
cityInfo.warn농업 = false;
|
||||
cityInfo.warn상업 = false;
|
||||
cityInfo.warn치안 = false;
|
||||
cityInfo.warn수비 = false;
|
||||
cityInfo.warn성벽 = false;
|
||||
|
||||
if(cityInfo.remain주민 > -10*2000) cityInfo.warn주민 = true;
|
||||
if(cityInfo.주민 > 0.92*cityInfo.max주민) cityInfo.warn주민 = true;
|
||||
if(cityInfo.remain농업 > -10*100) cityInfo.warn농업 = true;
|
||||
if(cityInfo.remain상업 > -10*100) cityInfo.warn상업 = true;
|
||||
if(cityInfo.remain치안 > -10*100) cityInfo.warn치안 = true;
|
||||
if(cityInfo.remain수비 > -10*70) cityInfo.warn수비 = true;
|
||||
if(cityInfo.remain성벽 > -10*70) cityInfo.warn성벽 = true;
|
||||
|
||||
if(cityInfo.warn농업) cityInfo.$농업.append('<span class="remain" style="color:yellow;">['+cityInfo.remain농업+']</span>');
|
||||
if(cityInfo.warn상업) cityInfo.$상업.append('<span class="remain" style="color:yellow;">['+cityInfo.remain상업+']</span>');
|
||||
if(cityInfo.warn치안) cityInfo.$치안.append('<span class="remain" style="color:yellow;">['+cityInfo.remain치안+']</span>');
|
||||
if(cityInfo.warn수비) cityInfo.$수비.append('<span class="remain" style="color:yellow;">['+cityInfo.remain수비+']</span>');
|
||||
if(cityInfo.warn성벽) cityInfo.$성벽.append('<span class="remain" style="color:yellow;">['+cityInfo.remain성벽+']</span>');
|
||||
|
||||
}
|
||||
|
||||
//태수,군사,종사
|
||||
{
|
||||
var $baseTr = $this.find('tr:eq(2)');
|
||||
cityInfo.$태수 = $baseTr.find('td:eq(7)');
|
||||
cityInfo.$군사 = $baseTr.find('td:eq(9)');
|
||||
cityInfo.$종사 = $baseTr.find('td:eq(11)');
|
||||
}
|
||||
|
||||
//기타
|
||||
{
|
||||
|
||||
cityInfo.userCnt = $this.find('tr:eq(3) td:eq(1)').text().split(',').length -1;
|
||||
}
|
||||
|
||||
cityInfo.obj = $this;
|
||||
cityList[cityInfo.이름] = cityInfo;
|
||||
});
|
||||
|
||||
|
||||
var $onGenList = $('<button type="button">암행부 연동</button>');
|
||||
$onGenList.click(function(){
|
||||
loadUser();
|
||||
return false;
|
||||
});
|
||||
$('form').append($onGenList);
|
||||
|
||||
|
||||
$('table:eq(0) tr:last').after('<tr><td id="sort_more"></td></tr>');
|
||||
|
||||
|
||||
$sort_more = $('#sort_more');
|
||||
$sort_more.html('재 정렬 순서 :');
|
||||
|
||||
var sortIt = function(callback){
|
||||
var arCity = [];
|
||||
$('.cityInfo').each(function(){
|
||||
var $this = $(this);
|
||||
var cityName = $this.data('cityname');
|
||||
|
||||
var cityInfo = cityList[cityName];
|
||||
arCity.push(cityInfo);
|
||||
});
|
||||
|
||||
arCity = mergeSort(arCity,callback);
|
||||
//console.log(arCity);
|
||||
|
||||
var $anchor = $('.anchor');
|
||||
//console.log($anchor);
|
||||
|
||||
$('body > br').remove();
|
||||
|
||||
$('.cityInfo').detach();
|
||||
|
||||
$.each(arCity,function(idx,val){
|
||||
$anchor.before('<br>');
|
||||
$anchor.before(val.obj);
|
||||
});
|
||||
$anchor.before('<br>');
|
||||
|
||||
};
|
||||
|
||||
var $btn;
|
||||
|
||||
$btn = $('<button type="button">도시명</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.이름.localeCompare(b.이름);
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">인구율</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return 1.0*a.주민/a.max주민 - 1.0*b.주민/b.max주민;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 주민</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain주민 - b.remain주민;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 농업</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain농업 - b.remain농업;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 상업</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain상업 - b.remain상업;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 치안</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain치안 - b.remain치안;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 수비</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain수비 - b.remain수비;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">남은 성벽</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return a.remain성벽 - b.remain성벽;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
|
||||
$btn = $('<button type="button">배치 장수 수</button>').click(function(){
|
||||
sortIt(function(a,b){
|
||||
return b.userCnt - a.userCnt;
|
||||
});
|
||||
});
|
||||
$sort_more.append($btn);
|
||||
};
|
||||
|
||||
mainFunc();
|
||||
});
|
||||
@@ -1,263 +0,0 @@
|
||||
$(function(){
|
||||
|
||||
var basicPath = document.location.pathname;
|
||||
basicPath = basicPath.substring(0, basicPath.lastIndexOf('/'))+'/';
|
||||
var headTbl = $('table:eq(0)');
|
||||
var $userFrame;
|
||||
|
||||
var 국가테이블= $('table:gt(0):lt(-2)');
|
||||
|
||||
var getUserType = function(통,무,지){
|
||||
var 총 = 통+무+지;
|
||||
if(통 < 40){
|
||||
if(무+지 < 40){
|
||||
return "무능";
|
||||
}
|
||||
return "무지";
|
||||
}
|
||||
|
||||
var 최대능력치 = Math.max(통, 무, 지);
|
||||
var 능력치2합 = Math.min(통+무, 무+지, 지+통);
|
||||
if(최대능력치 >= 70 && 능력치2합 >= 최대능력치 * 1.7){
|
||||
return "만능";
|
||||
}
|
||||
|
||||
if(무 >= 60 && 지 < 무*0.8){
|
||||
return "무";
|
||||
}
|
||||
if(지 >= 60 && 무 < 지*0.8){
|
||||
return "지";
|
||||
}
|
||||
if(통 >= 60 && 무 + 지 < 통){
|
||||
return "통";
|
||||
}
|
||||
|
||||
|
||||
|
||||
return "평범";
|
||||
};
|
||||
|
||||
function formatScore(x) {
|
||||
console.log(x);
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
var runAnalysis = function(){
|
||||
var $content = $('#on_mover .content');
|
||||
$.get(basicPath+'a_genList.php',function(rawData){
|
||||
try{
|
||||
var $html = $(rawData);
|
||||
|
||||
var $장수일람 = {};
|
||||
|
||||
var 국가별 = {};
|
||||
var cnt =0;
|
||||
$html.each(function(idx){
|
||||
|
||||
if(this.tagName == "TABLE"){
|
||||
cnt+=1;
|
||||
if(cnt==2){
|
||||
$장수일람 = $(this);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
$장수일람.find('tr:gt(0)').each(function(){
|
||||
var 장수 = {};
|
||||
$this = $(this);
|
||||
$tds = $this.find('td');
|
||||
|
||||
var 장수명 = $.trim($tds.eq(1).text());
|
||||
var 국가 = $.trim($tds.eq(6).text());
|
||||
|
||||
var 부상 = $this.data('general-wounded');
|
||||
|
||||
장수.html = $this.clone();
|
||||
장수.장수명 = 장수명;
|
||||
장수.국가 = 국가;
|
||||
장수.벌점 = parseInt($tds.eq(-1).text());
|
||||
장수.통 = parseInt($this.data('general-leadership'));
|
||||
장수.무 = parseInt($this.data('general-strength'));
|
||||
장수.지 = parseInt($this.data('general-intel'));
|
||||
장수.삭턴 = parseInt($tds.eq(-2).text());
|
||||
장수.종류 = getUserType(장수.통, 장수.무, 장수.지);
|
||||
장수.NPC = $this.data('is-npc');
|
||||
|
||||
if(!(국가 in 국가별)){
|
||||
국가별[국가] = {};
|
||||
국가별[국가].만능 = [];
|
||||
국가별[국가].통 = [];
|
||||
국가별[국가].무 = [];
|
||||
국가별[국가].지 = [];
|
||||
국가별[국가].평범 = [];
|
||||
국가별[국가].무지 = [];
|
||||
국가별[국가].무능 = [];
|
||||
//국가별[국가].NPC = [];
|
||||
}
|
||||
|
||||
//if(장수.NPC) 국가별[국가].NPC.push(장수);
|
||||
국가별[국가][장수.종류].push(장수);
|
||||
|
||||
장수.html.hide();
|
||||
$content.append(장수.html);
|
||||
|
||||
|
||||
});
|
||||
|
||||
국가테이블.each(function(idx){
|
||||
var $this = $(this);
|
||||
var $tbl = $this;
|
||||
var $td = $this.find('td:last');
|
||||
var name = $.trim($this.find('td:first').text());
|
||||
name = name.substr(2,name.length-4);
|
||||
|
||||
var 국가정보 = 국가별[name];
|
||||
|
||||
var total = 0;
|
||||
var 전투유저장수 = 0;
|
||||
var 통솔합 = 0;
|
||||
var 삭턴장수 = 0;
|
||||
|
||||
var 전투N장수 = 0;
|
||||
var N장통솔합 = 0;
|
||||
$td.html('<p class="sum" style="margin:0;font-weight:bold;color:yellow;text-align:center"></p>');
|
||||
$td.css('text-indent','-5.8em').css('padding-left','5.8em');
|
||||
for(var 종류명 in 국가정보){
|
||||
|
||||
var $p = $("<p></p>").css('margin','0');
|
||||
|
||||
var 테이블 = 국가정보[종류명];
|
||||
|
||||
if(테이블.length == 0)continue;
|
||||
|
||||
테이블.sort(function(좌, 우){
|
||||
if(우.벌점 == 좌.벌점){
|
||||
return 좌.장수명 > 우.장수명 ? 1 : 0;
|
||||
}
|
||||
return 우.벌점 - 좌.벌점
|
||||
});
|
||||
|
||||
|
||||
var text = " "+종류명;
|
||||
text = text.substr(text.length-2);
|
||||
$p.append(text+'장(');
|
||||
|
||||
text = ""+테이블.length;
|
||||
|
||||
$p.append(text + ')');
|
||||
if(text.length<3){
|
||||
$p.append("<span style='display:inline-block;width:"+(3-text.length)/2+"em;'> </span>");
|
||||
}
|
||||
$p.append(': ');
|
||||
|
||||
total += 테이블.length;
|
||||
|
||||
$.each(테이블,function(idx,val){
|
||||
|
||||
var 종능 = val.통 + val.무 + val.지;
|
||||
console.log(val);
|
||||
if(종류명 != '무능' && 종류명 != '무지'){
|
||||
if(val.삭턴 >= 80 && !val.NPC){
|
||||
전투유저장수 += 1;
|
||||
|
||||
통솔합 += val.통;
|
||||
}
|
||||
|
||||
if(val.삭턴 > 5 && val.NPC){
|
||||
전투N장수 += 1;
|
||||
|
||||
N장통솔합 += val.통;
|
||||
}
|
||||
}
|
||||
|
||||
var $obj = $('<span></span>');
|
||||
var $obj2 = $('<span></span>');
|
||||
$obj.html(val.장수명);
|
||||
|
||||
if(!val.NPC && val.삭턴 < 80){
|
||||
$obj.css('text-decoration','line-through');
|
||||
삭턴장수+=1;
|
||||
}
|
||||
if(val.NPC){
|
||||
$obj.css('color','cyan');
|
||||
}
|
||||
if(val.벌점 >= 1500) $obj.css('color','yellow');
|
||||
else if(val.벌점 >= 200) $obj.css('color','lightgreen');
|
||||
|
||||
$obj2.append($obj);
|
||||
if(idx < 테이블.length-1){
|
||||
$obj2.append(', ');
|
||||
}
|
||||
$p.append($obj2);
|
||||
$obj2.hover(function(){
|
||||
var top = $tbl.offset().top + $tbl.outerHeight() + 3;
|
||||
$userFrame.css('top',top);
|
||||
val.html.show();
|
||||
$userFrame.show();
|
||||
console.log('올림!'+val.장수명);
|
||||
},function(){
|
||||
$userFrame.hide();
|
||||
val.html.hide();
|
||||
console.log('내림!'+val.장수명);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
$td.append($p);
|
||||
}
|
||||
|
||||
var result = "* 총("+total+"), 전투장("+전투유저장수+", 약 "+formatScore(통솔합*100)+"명), 전투N장("+전투N장수+", 약 "+formatScore(N장통솔합*100)+"명), 삭턴장("+삭턴장수+") *";
|
||||
$tbl.find('.sum').html(result);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
catch(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$userFrame = $('<div id="on_mover" style="position:absolute;">'+
|
||||
'<table class="tb_layout bg0" style="width:100%;"><thead><tr>'+
|
||||
'<td width="64" align="center" class="bg1">얼 굴</td>'+
|
||||
'<td width="100" align="center" class="bg1">이 름</td>'+
|
||||
'<td width="50" align="center" class="bg1">연령</td>'+
|
||||
'<td width="50" align="center" class="bg1">성격</td>'+
|
||||
'<td width="90" align="center" class="bg1">특기</td>'+
|
||||
'<td width="50" align="center" class="bg1">레 벨</td>'+
|
||||
'<td width="100" align="center" class="bg1">국 가</td>'+
|
||||
'<td width="60" align="center" class="bg1">명 성</td>'+
|
||||
'<td width="60" align="center" class="bg1">계 급</td>'+
|
||||
'<td width="80" align="center" class="bg1">관 직</td>'+
|
||||
'<td width="45" align="center" class="bg1">통솔</td>'+
|
||||
'<td width="45" align="center" class="bg1">무력</td>'+
|
||||
'<td width="45" align="center" class="bg1">지력</td>'+
|
||||
'<td width="45" align="center" class="bg1">삭턴</td>'+
|
||||
'<td width="84" align="center" class="bg1">벌점</td>'+
|
||||
'</tr></thead><tbody class="content"></tbody></table></div>');
|
||||
$userFrame.find('thead td');
|
||||
$userFrame.css('width','1000px').css('margin','0').css('padding','0').css('left','50%').css('margin-left','-500px');
|
||||
$userFrame.css('box-shadow','0px 0px 7px 3px rgba(255,255,255,50)');
|
||||
$userFrame.hide();
|
||||
|
||||
$('body').append($userFrame);
|
||||
|
||||
var $frame = $('table:eq(0) td:eq(0)');
|
||||
$frame.find('br:last').remove();
|
||||
|
||||
var $btn = $('<input type="button" value="장수 일람 연동">');
|
||||
$btn.click(function(){
|
||||
runAnalysis();
|
||||
$btn.prop("disabled",true);
|
||||
var $tr0 = $('table:eq(0) tr:eq(0)');
|
||||
$tr0.append('<td><strong>*벌점 순 정렬*</strong><br><span style="color:yellow">벌점 1500점 이상</span>, <span style="color:lightgreen">벌점 200점 이상</span>, '+
|
||||
'<span style="text-decoration:line-through">삭턴장</span>, <span style="color:cyan">ⓝ장</span>'+'<br><strong>전투장 :</strong> 만능장 + 무장 + 지장 + 평범장 - 삭턴자(만능, 무, 지, 평범) </td>');
|
||||
});
|
||||
|
||||
|
||||
|
||||
$frame.append($btn);
|
||||
});
|
||||
@@ -1,116 +0,0 @@
|
||||
$(function(){
|
||||
|
||||
var userList = {};
|
||||
var groupList = {};
|
||||
var tGroup = [];
|
||||
var basicPath = document.location.pathname;
|
||||
basicPath = basicPath.substring(0, basicPath.lastIndexOf('/'))+'/';
|
||||
|
||||
var $userFrame;
|
||||
|
||||
window.userList = userList;
|
||||
|
||||
var runAnalysis = function(){
|
||||
$.each(groupList,function(idx,val){
|
||||
val.list = [];
|
||||
});
|
||||
userList = [];
|
||||
var $content = $('#on_mover .content');
|
||||
$content.html('');
|
||||
$.get(basicPath+'b_genList.php',function(rawData){
|
||||
|
||||
try{
|
||||
$html = $(rawData);
|
||||
var cnt =0;
|
||||
|
||||
var tmpUsers = {};
|
||||
$html.each(function(idx){
|
||||
var $this = $(this);
|
||||
if($this.attr('id') == "general_list"){
|
||||
tmpUsers = $(this);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
tmpUsers.find("tbody > tr").each(function(idx){
|
||||
var $this = $(this);
|
||||
var $부대 = $this.children('.i_troop');
|
||||
|
||||
var 부대 = $.trim($부대.text());
|
||||
|
||||
if(부대 == '-'){
|
||||
//부대 안탔음!
|
||||
return true;
|
||||
}
|
||||
$부대.remove();
|
||||
|
||||
var generalID = parseInt($this.data('general-id'));
|
||||
userList[generalID] = $this;
|
||||
$this.hide();
|
||||
$content.append($this);
|
||||
});
|
||||
|
||||
$('.troopUser').hover(function(){
|
||||
var $this = $(this);
|
||||
var parent = $this.closest('tr');
|
||||
var generalID = parseInt($this.data('general-id'));
|
||||
console.log(generalID);
|
||||
var top = parent.offset().top + parent.outerHeight();
|
||||
$userFrame.css('top',top);
|
||||
userList[generalID].show();
|
||||
$userFrame.show();
|
||||
},function(){
|
||||
var $this = $(this);
|
||||
var parent = $this.closest('tr');
|
||||
var generalID = parseInt($this.data('general-id'));
|
||||
userList[generalID].hide();
|
||||
$userFrame.hide();
|
||||
});
|
||||
}
|
||||
catch(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
var $frame = $('table:eq(0) td:eq(0)');
|
||||
$frame.find('br:last').remove();
|
||||
|
||||
var $btn = $('<input type="button" value="암행부 연동">');
|
||||
$btn.click(function(){
|
||||
runAnalysis();
|
||||
});
|
||||
|
||||
$frame.append($btn);
|
||||
|
||||
|
||||
|
||||
$userFrame = $("<div id='on_mover' style='position:absolute;'>"+
|
||||
"<table class='tb_layout bg0' style='width:100%;'><thead>"+
|
||||
"<tr>"+
|
||||
"<td width=98 class='bg1 center'>이 름</td>"+
|
||||
"<td width=98 class='bg1 center'>통무지</td>"+
|
||||
"<td width=53 class='bg1 center'>자 금</td>"+
|
||||
"<td width=53 class='bg1 center'>군 량</td>"+
|
||||
"<td width=48 class='bg1 center'>도시</td>"+
|
||||
"<td width=28 class='bg1 center'>守</td>"+
|
||||
"<td width=58 class='bg1 center'>병 종</td>"+
|
||||
"<td width=63 class='bg1 center'>병 사</td>"+
|
||||
"<td width=38 class='bg1 center'>훈련</td>"+
|
||||
"<td width=38 class='bg1 center'>사기</td>"+
|
||||
"<td width=213 class='bg1 center'>명 령</td>"+
|
||||
"<td width=38 class='bg1 center'>삭턴</td>"+
|
||||
"<td width=48 class='bg1 center'>턴</td>"+
|
||||
"</tr>"+
|
||||
"</thead></thead><tbody class='content'></tbody></table></div>");
|
||||
$userFrame.find('thead td');
|
||||
$userFrame.css('width','960px').css('margin','0').css('padding','0').css('left','50%').css('margin-left','-480px');
|
||||
$userFrame.hide();
|
||||
|
||||
|
||||
|
||||
$('body').append($userFrame);
|
||||
|
||||
});
|
||||
@@ -1,10 +0,0 @@
|
||||
jQuery(function($){
|
||||
$('#by_scenario').change(function(){
|
||||
var $this = $(this);
|
||||
var scenarioIdx = $this.val();
|
||||
var seasonIdx = $(this).find('option:selected').data('season');
|
||||
|
||||
|
||||
$.redirect('a_hallOfFame.php', {scenarioIdx:scenarioIdx, seasonIdx:seasonIdx}, 'get');
|
||||
})
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
jQuery(function($){
|
||||
|
||||
|
||||
var currYear = startYear;
|
||||
var currMonth = startMonth;
|
||||
|
||||
var $yearMonth = $('#yearmonth');
|
||||
var $elements = $();
|
||||
|
||||
var endDate = lastYear * 12 + lastMonth - 1;
|
||||
var currDate = startYear * 12 + startMonth - 1;
|
||||
while(currDate <= endDate){
|
||||
|
||||
var target = currYear*100 + currMonth;
|
||||
var sel = '';
|
||||
if(currYear == selectYear && currMonth == selectMonth){
|
||||
sel = 'selected="selected"';
|
||||
}
|
||||
var option = $('<option value="{0}" {1} >{2}년 {3}월</option>'.format(target, sel, currYear, currMonth));
|
||||
$elements = $elements.add(option);
|
||||
|
||||
currMonth += 1;
|
||||
if(currMonth > 12){
|
||||
currYear += 1;
|
||||
currMonth -= 12;
|
||||
}
|
||||
currDate += 1;
|
||||
}
|
||||
$yearMonth.empty();
|
||||
$yearMonth.append($elements);
|
||||
});
|
||||
@@ -1,211 +0,0 @@
|
||||
/*
|
||||
function showCityGeneral(cityIdx){
|
||||
|
||||
}
|
||||
*/
|
||||
/*
|
||||
function loadScenarioPreview(scenarioIdx){
|
||||
$(function(){
|
||||
reloadWorldMap({
|
||||
clickableAll:true,
|
||||
selectCallback:showCityGeneral,
|
||||
hrefTemplate:'#',
|
||||
neutralView:true,
|
||||
showMe:false,
|
||||
targetJson:'j_get_scenario_map.php?scenarioIdx={0}'.format(scenarioIdx)
|
||||
});
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
function loadScenarios() {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: 'j_load_scenarios.php',
|
||||
dataType: 'json'
|
||||
}).then(function(result) {
|
||||
if (!result.result) {
|
||||
var deferred = $.Deferred();
|
||||
deferred.reject('fail');
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
|
||||
var list = {};
|
||||
|
||||
|
||||
$.each(result.scenario, function(idx, value) {
|
||||
var title = value.title || "-";
|
||||
var pat = /【(.*?)[0-9\-_\.a-zA-Z]*】/;
|
||||
var category = pat.exec(title);
|
||||
category = category ? category[1] : '-';
|
||||
|
||||
value.title = title;
|
||||
value.category = category;
|
||||
value.idx = idx;
|
||||
value.year = value.year || 180;
|
||||
|
||||
if (!(category in list)) {
|
||||
list[category] = {};
|
||||
}
|
||||
|
||||
list[category][idx] = value;
|
||||
});
|
||||
|
||||
var $select = $('#scenario_sel');
|
||||
$.each(list, function(category, items) {
|
||||
var $optgroup = $('<optgroup>').attr('label', category);
|
||||
|
||||
$.each(items, function(idx, scenario) {
|
||||
var $option = $('<option>')
|
||||
.data('scenario', scenario)
|
||||
.val(idx)
|
||||
.html(scenario.title);
|
||||
$optgroup.append($option);
|
||||
});
|
||||
|
||||
$select.append($optgroup);
|
||||
});
|
||||
|
||||
$select.val(0);
|
||||
$select.change();
|
||||
});
|
||||
}
|
||||
|
||||
function scenarioPreview() {
|
||||
var $select = $(this);
|
||||
var $option = $select.find('option:selected');
|
||||
|
||||
var $year = $('#scenario_begin');
|
||||
var $npc = $('#scenario_npc');
|
||||
var $npcEx = $('#scenario_npc_extend');
|
||||
var $nation = $('#scenario_nation');
|
||||
|
||||
var scenario = $option.data('scenario');
|
||||
console.log(scenario.idx, scenario.title);
|
||||
|
||||
$year.html('{0}년'.format(scenario.year));
|
||||
$npc.html('{0}명'.format(scenario.npc_cnt));
|
||||
if (scenario.npcEx_cnt == 0) {
|
||||
$npcEx.html('');
|
||||
} else {
|
||||
$npcEx.html('+{0}명'.format(scenario.npcEx_cnt));
|
||||
}
|
||||
|
||||
$nation.html('');
|
||||
$.each(scenario.nation, function(idx, nation) {
|
||||
$nation.append('<span style="color:{0}">{1}</span> {2}명. {3}<br>'.format(
|
||||
nation.color, nation.name, nation.generals, nation.cities.join(', ')
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
function formSetup() {
|
||||
$.validator.addMethod("autorun_user", function(value, element) {
|
||||
var parent = $(element).parent('.input-group');
|
||||
var checkCnt = parent.find('input:checked').length;
|
||||
if (value <= 0) {
|
||||
if (checkCnt > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (checkCnt == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, "유효 시간과 옵션은 동시에 설정해야합니다.");
|
||||
$('#game_form').validate({
|
||||
rules: {
|
||||
turnterm: "required",
|
||||
sync: "required",
|
||||
scenario: "required",
|
||||
fiction: "required",
|
||||
extend: "required",
|
||||
npcmode: "required",
|
||||
show_img_level: "required",
|
||||
tournament_trig: "required",
|
||||
join_mode: 'required',
|
||||
autorun_user_minutes: { required: true, autorun_user: true, min: 0 }
|
||||
},
|
||||
errorElement: "div",
|
||||
errorPlacement: function(error, element) {
|
||||
// Add the `help-block` class to the error element
|
||||
error.addClass("invalid-feedback");
|
||||
|
||||
if (element.prop("type") === "checkbox") {
|
||||
error.insertAfter(element.parent("label"));
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
highlight: function(element, errorClass, validClass) {
|
||||
$(element).addClass("is-invalid").removeClass("is-valid");
|
||||
},
|
||||
unhighlight: function(element, errorClass, validClass) {
|
||||
$(element).addClass("is-valid").removeClass("is-invalid");
|
||||
}
|
||||
});
|
||||
$('#game_form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
if (!$("#game_form").valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var autorun_user_minutes = parseInt($('#autorun_user_minutes').val());
|
||||
var autorun_user = [];
|
||||
if (autorun_user_minutes > 0) {
|
||||
$('.autorun_user_chk:checked').each(function() {
|
||||
autorun_user.push($(this).data('key'));
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
type: 'post',
|
||||
url: 'j_install.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
turnterm: $('#turnterm input:radio:checked').val(),
|
||||
sync: $('#sync input:radio:checked').val(),
|
||||
scenario: $('#scenario_sel').val(),
|
||||
fiction: $('#fiction input:radio:checked').val(),
|
||||
extend: $('#extend input:radio:checked').val(),
|
||||
block_general_create: $('#block_general_create input:radio:checked').val(),
|
||||
npcmode: $('#npcmode input:radio:checked').val(),
|
||||
show_img_level: $('#show_img_level input:radio:checked').val(),
|
||||
tournament_trig: $('#tournament_trig input:radio:checked').val(),
|
||||
reserve_open: $('#reserve_open').val(),
|
||||
pre_reserve_open: $('#pre_reserve_open').val(),
|
||||
join_mode: $('#join_mode input:radio:checked').val(),
|
||||
autorun_user_minutes: autorun_user_minutes,
|
||||
autorun_user: autorun_user
|
||||
}
|
||||
}).then(function(result) {
|
||||
var deferred = $.Deferred();
|
||||
|
||||
if (!result.result) {
|
||||
alert(result.reason);
|
||||
deferred.reject('fail');
|
||||
} else {
|
||||
alert('게임이 리셋되었습니다.');
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}).then(function() {
|
||||
location.href = '..';
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
loadScenarios();
|
||||
$('#scenario_sel').change(scenarioPreview);
|
||||
formSetup();
|
||||
})
|
||||
@@ -1,65 +0,0 @@
|
||||
|
||||
$(document).ready( function () {
|
||||
$('#db_form').validate({
|
||||
rules:{
|
||||
db_host:"required",
|
||||
db_port:"required",
|
||||
db_id:"required",
|
||||
db_pw:"required",
|
||||
db_name:"required"
|
||||
},
|
||||
errorElement: "div",
|
||||
errorPlacement: function ( error, element ) {
|
||||
// Add the `help-block` class to the error element
|
||||
error.addClass( "invalid-feedback" );
|
||||
|
||||
if ( element.prop( "type" ) === "checkbox" ) {
|
||||
error.insertAfter( element.parent( "label" ) );
|
||||
} else {
|
||||
error.insertAfter( element );
|
||||
}
|
||||
},
|
||||
highlight: function ( element, errorClass, validClass ) {
|
||||
$( element ).addClass( "is-invalid" ).removeClass( "is-valid" );
|
||||
},
|
||||
unhighlight: function (element, errorClass, validClass) {
|
||||
$( element ).addClass( "is-valid" ).removeClass( "is-invalid" );
|
||||
}
|
||||
});
|
||||
$('#db_form').submit(function(e){
|
||||
e.preventDefault();
|
||||
if(!$("#db_form").valid()){
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
cache:false,
|
||||
type:'post',
|
||||
url:'j_install_db.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
full_reset:$('#full_reset input:radio:checked').val(),
|
||||
db_host:$('#db_host').val(),
|
||||
db_port:$('#db_port').val(),
|
||||
db_id:$('#db_id').val(),
|
||||
db_pw:$('#db_pw').val(),
|
||||
db_name:$('#db_name').val()
|
||||
}
|
||||
}).then(function(result){
|
||||
var deferred = $.Deferred();
|
||||
|
||||
if(!result.result){
|
||||
alert(result.reason);
|
||||
deferred.reject('fail');
|
||||
}
|
||||
else{
|
||||
alert('DB.php가 생성되었습니다.');
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
}).then(function(){
|
||||
location.href = 'install.php';
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
|
||||
jQuery(function($){
|
||||
var $leadership = $('#leadership');
|
||||
var $strength = $('#strength');
|
||||
var $intel = $('#intel');
|
||||
|
||||
function abilityRand(){
|
||||
var leadership = Math.random()*65 + 10;
|
||||
var strength = Math.random()*65 + 10;
|
||||
var intel = Math.random()*65 + 10;
|
||||
var rate = leadership + strength + intel;
|
||||
|
||||
leadership = Math.floor(leadership / rate * defaultStatTotal);
|
||||
strength = Math.floor(strength / rate * defaultStatTotal);
|
||||
intel = Math.floor(intel / rate * defaultStatTotal);
|
||||
|
||||
|
||||
while(leadership+strength+intel < defaultStatTotal){
|
||||
leadership+=1;
|
||||
}
|
||||
|
||||
if(leadership > defaultStatMax || strength > defaultStatMax || intel > defaultStatMax || leadership < defaultStatMin || strength < defaultStatMin || intel < defaultStatMin){
|
||||
return abilityRand();
|
||||
}
|
||||
|
||||
$leadership.val(leadership);
|
||||
$strength.val(strength);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
|
||||
function abilityLeadpow(){
|
||||
var leadership = Math.random() * 6;
|
||||
var strength = Math.random() * 6;
|
||||
var intel = Math.random() * 1;
|
||||
var rate = leadership + strength + intel;
|
||||
|
||||
leadership = Math.floor(leadership / rate * defaultStatTotal);
|
||||
strength = Math.floor(strength / rate * defaultStatTotal);
|
||||
intel = Math.floor(intel / rate * defaultStatTotal);
|
||||
|
||||
while(leadership+strength+intel < defaultStatTotal){
|
||||
strength+=1;
|
||||
}
|
||||
|
||||
if(intel < defaultStatMin){
|
||||
leadership -= defaultStatMin - intel;
|
||||
intel = defaultStatMin;
|
||||
}
|
||||
|
||||
if(leadership > defaultStatMax){
|
||||
strength += leadership - defaultStatMax;
|
||||
leadership = defaultStatMax;
|
||||
}
|
||||
|
||||
if(strength > defaultStatMax){
|
||||
leadership += strength - defaultStatMax;
|
||||
strength = defaultStatMax;
|
||||
}
|
||||
|
||||
if(leadership > defaultStatMax){
|
||||
intel += leadership - defaultStatMax;
|
||||
leadership = defaultStatMax;
|
||||
}
|
||||
|
||||
$leadership.val(leadership);
|
||||
$strength.val(strength);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityLeadint(){
|
||||
var leadership = Math.random() * 6;
|
||||
var strength = Math.random() * 1;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leadership + strength + intel;
|
||||
|
||||
leadership = Math.floor(leadership / rate * defaultStatTotal);
|
||||
strength = Math.floor(strength / rate * defaultStatTotal);
|
||||
intel = Math.floor(intel / rate * defaultStatTotal);
|
||||
|
||||
while(leadership+strength+intel < defaultStatTotal){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(strength < defaultStatMin){
|
||||
leadership -= defaultStatMin - strength;
|
||||
strength = defaultStatMin;
|
||||
}
|
||||
|
||||
if(leadership > defaultStatMax){
|
||||
intel += leadership - defaultStatMax;
|
||||
leadership = defaultStatMax;
|
||||
}
|
||||
|
||||
if(intel > defaultStatMax){
|
||||
leadership += intel - defaultStatMax;
|
||||
intel = defaultStatMax;
|
||||
}
|
||||
|
||||
if(leadership > defaultStatMax){
|
||||
strength += leadership - defaultStatMax;
|
||||
leadership = defaultStatMax;
|
||||
}
|
||||
|
||||
$leadership.val(leadership);
|
||||
$strength.val(strength);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
function abilityPowint(){
|
||||
var leadership = Math.random() * 1;
|
||||
var strength = Math.random() * 6;
|
||||
var intel = Math.random() * 6;
|
||||
var rate = leadership + strength + intel;
|
||||
|
||||
leadership = Math.floor(leadership / rate * defaultStatTotal);
|
||||
strength = Math.floor(strength / rate * defaultStatTotal);
|
||||
intel = Math.floor(intel / rate * defaultStatTotal);
|
||||
|
||||
while(leadership+strength+intel < defaultStatTotal){
|
||||
intel+=1;
|
||||
}
|
||||
|
||||
if(leadership < defaultStatMin){
|
||||
strength -= defaultStatMin - leadership;
|
||||
leadership = defaultStatMin;
|
||||
}
|
||||
|
||||
if(strength > defaultStatMax){
|
||||
intel += strength - defaultStatMax;
|
||||
strength = defaultStatMax;
|
||||
}
|
||||
|
||||
if(intel > defaultStatMax){
|
||||
strength += intel - defaultStatMax;
|
||||
intel = defaultStatMax;
|
||||
}
|
||||
|
||||
if(strength > defaultStatMax){
|
||||
leadership += strength - defaultStatMax;
|
||||
strength = defaultStatMax;
|
||||
}
|
||||
|
||||
$leadership.val(leadership);
|
||||
$strength.val(strength);
|
||||
$intel.val(intel);
|
||||
}
|
||||
|
||||
window.abilityRand = abilityRand;
|
||||
window.abilityLeadpow = abilityLeadpow;
|
||||
window.abilityLeadint = abilityLeadint;
|
||||
window.abilityPowint = abilityPowint;
|
||||
|
||||
var $charInfoText = $('#charInfoText');
|
||||
var $selChar = $('#selChar');
|
||||
$selChar.change(function(){
|
||||
var $this = $(this);
|
||||
var char = $this.val();
|
||||
if(char in charInfoText){
|
||||
$charInfoText.html(charInfoText[char]);
|
||||
}
|
||||
else{
|
||||
$charInfoText.html('');
|
||||
}
|
||||
});
|
||||
|
||||
var $generalName = $('#generalName');
|
||||
if($generalName.on('change keyup paste', function(){
|
||||
var generalName = $generalName.val();
|
||||
var len = mb_strwidth(generalName);
|
||||
if(len == 0 || len > 18){
|
||||
$generalName.css('color','red');
|
||||
}
|
||||
else{
|
||||
$generalName.css('color','white');
|
||||
}
|
||||
}));
|
||||
|
||||
$('#join_form').submit(function(){
|
||||
var generalName = $generalName.val();
|
||||
if(mb_strwidth(generalName) > 18){
|
||||
alert('장수 이름이 너무 깁니다!');
|
||||
return false;
|
||||
}
|
||||
var currentStatTotal = parseInt($leadership.val()) + parseInt($strength.val()) + parseInt($intel.val());
|
||||
if(currentStatTotal < defaultStatTotal){
|
||||
if(!confirm('현재 능력치 총합은 {0}으로, {1}보다 낮습니다. 장수 생성을 진행할까요?'.format(currentStatTotal, defaultStatTotal))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
var randomGenType = Math.floor(Math.random()*7);
|
||||
if(randomGenType < 3){
|
||||
abilityLeadpow();
|
||||
}
|
||||
else if(randomGenType < 6){
|
||||
abilityLeadint();
|
||||
}
|
||||
else{
|
||||
abilityPowint();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"typeAcquisition": {
|
||||
"include": [
|
||||
"jquery"
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
-155
@@ -1,155 +0,0 @@
|
||||
jQuery(function($){
|
||||
|
||||
$('#refreshPage').click(function(){
|
||||
document.location.reload();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
function reloadCommandList(){
|
||||
$.get({
|
||||
url:'j_get_reserved_command.php',
|
||||
dataType:'json',
|
||||
cache: false,
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
return;
|
||||
}
|
||||
if(!data.result){
|
||||
return;
|
||||
}
|
||||
var game_clock = moment(data.date);
|
||||
var now_clock = moment();
|
||||
var $clock = $('#clock');
|
||||
$clock.data('time-diff', game_clock.diff(now_clock));
|
||||
$clock.val(game_clock.format('YYYY-MM-DD HH:mm:ss'));
|
||||
|
||||
var turnTime = moment(data.turnTime);
|
||||
var nextTurnTime = turnTime.clone();
|
||||
|
||||
var year = data.year;
|
||||
var month = data.month;
|
||||
|
||||
$.each(data.turn, function(turnIdx, turnInfo){
|
||||
var $tr = $('#command_{0}'.format(turnIdx));
|
||||
|
||||
$tr.find('.time_pad').text(nextTurnTime.format('HH:mm'));
|
||||
$tr.find('.month_pad').text('{0}年 {1}月'.format(year, month));
|
||||
var $turn_pad = $tr.find('.turn_pad');
|
||||
var $turn_text = $turn_pad.find('.turn_text');
|
||||
$turn_text.text(turnInfo.brief).css('font-size','13px');
|
||||
|
||||
var oWidth = $turn_pad.innerWidth();
|
||||
var iWidth = $turn_text.outerWidth();
|
||||
if(iWidth > oWidth * 0.95){
|
||||
var newFontSize = 13 * oWidth / iWidth * 0.9;
|
||||
$turn_text.css('font-size', '{0}px'.format(newFontSize));
|
||||
}
|
||||
|
||||
nextTurnTime.add(data.turnTerm, 'minutes');
|
||||
month+=1;
|
||||
if(month >= 13){
|
||||
year += 1;
|
||||
month -= 12;
|
||||
}
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function myclock() {
|
||||
|
||||
var $clock = $('#clock');
|
||||
var now_clock = moment();
|
||||
|
||||
if($clock.data('time-diff') == null){
|
||||
return;
|
||||
}
|
||||
|
||||
var game_clock = now_clock.add(parseInt($clock.data('time-diff')), 'milliseconds');
|
||||
|
||||
$('#clock').val(game_clock.format('YYYY-MM-DD HH:mm:ss'));
|
||||
}
|
||||
|
||||
function pushTurn(pushAmount){
|
||||
$.post({
|
||||
url:'j_general_turn.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
amount:pushAmount
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadCommandList();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
function repeatTurn(repeatAmount){
|
||||
$.post({
|
||||
url:'j_general_turn.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
amount:repeatAmount,
|
||||
is_repeat:true
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadCommandList();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
$('#pullTurn').click(function(){
|
||||
pushTurn(-parseInt($('#repeatAmount').val()));
|
||||
});
|
||||
|
||||
$('#pushTurn').click(function(){
|
||||
pushTurn(parseInt($('#repeatAmount').val()));
|
||||
});
|
||||
|
||||
$('#repeatTurn').click(function(){
|
||||
repeatTurn(parseInt($('#repeatAmount').val()));
|
||||
});
|
||||
|
||||
|
||||
function reserveTurn(turnList, command){
|
||||
console.log(turnList, command);
|
||||
$.post({
|
||||
url:'j_set_general_command.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
action:command,
|
||||
turnList:turnList
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data.result){
|
||||
alert(data.reason);
|
||||
}
|
||||
reloadCommandList();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
$('#reserveTurn').click(function(){
|
||||
var turnList = $('#generalTurnSelector').val().map(function(v){return parseInt(v);});
|
||||
var $command = $('#generalCommandList option:selected');
|
||||
if($command.data('reqarg')){
|
||||
$.redirect(
|
||||
"b_processing.php", {
|
||||
command: $command.val(),
|
||||
turnList: turnList.join('_')
|
||||
}, "GET");
|
||||
}
|
||||
else{
|
||||
reserveTurn(turnList, $command.val());
|
||||
}
|
||||
return false;
|
||||
})
|
||||
|
||||
setInterval(myclock, 500);
|
||||
reloadCommandList();
|
||||
});
|
||||
-686
@@ -1,686 +0,0 @@
|
||||
function is_touch_device() {
|
||||
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
|
||||
var mq = function(query) {
|
||||
return window.matchMedia(query).matches;
|
||||
}
|
||||
|
||||
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
|
||||
// https://git.io/vznFH
|
||||
var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
|
||||
return mq(query);
|
||||
}
|
||||
|
||||
function reloadWorldMap(option, drawTarget) {
|
||||
if (drawTarget === undefined || drawTarget === null) {
|
||||
drawTarget = '.world_map'
|
||||
}
|
||||
var $world_map = $(drawTarget);
|
||||
|
||||
if ($world_map.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var defaultOption = {
|
||||
isDetailMap: true, //복잡 지도, 단순 지도
|
||||
clickableAll: false, //어떤 경우든 클릭을 가능하게 함. 해당 동작의 동작 가능성 여부와는 별도.
|
||||
selectCallback: null, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
|
||||
hrefTemplate: '#', //도시가 클릭가능할 경우 지정할 href값. {0}은 도시 id로 변환됨
|
||||
useCachedMap: false, //맵 캐시를 사용
|
||||
|
||||
//아래부터는 post query에 들어갈 녀석
|
||||
year: null, //year값, 연감등에 사용
|
||||
month: null, //month값, 연감등에 사용
|
||||
aux: null, //기타 넣고 싶은 값을 입력
|
||||
neutralView: false, //clickable, 소속 국가, 첩보 여부 등을 반환여부를 설정
|
||||
showMe: true, //반환 값에 본인이 위치한 도시 값을 반환하도록 설정. neutralView와 별개
|
||||
|
||||
targetJson: 'j_map.php',
|
||||
reqType: 'post',
|
||||
dynamicMapTheme: false,
|
||||
callback: null,
|
||||
|
||||
//기타 보조 값
|
||||
startYear: null,
|
||||
};
|
||||
|
||||
option = $.extend(defaultOption, option);
|
||||
|
||||
var useCachedMap = option.useCachedMap;
|
||||
var isDetailMap = option.isDetailMap;
|
||||
var clickableAll = option.clickableAll;
|
||||
var selectCallback = option.selectCallback;
|
||||
var hrefTemplate = option.hrefTemplate;
|
||||
|
||||
var cityPosition = getCityPosition();
|
||||
|
||||
var storedOldMapKey = 'sam.{0}.map'.format(serverNick);
|
||||
var storedStartYear = 'sam.{0}.startYear'.format(serverNick);
|
||||
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
|
||||
|
||||
function checkReturnObject(obj) {
|
||||
if (!obj.result) {
|
||||
var obj = $.Deferred();
|
||||
obj.reject('fail');
|
||||
return obj.promise();
|
||||
}
|
||||
|
||||
if (!$.isNumeric(obj.startYear) ||
|
||||
!$.isNumeric(obj.year) ||
|
||||
!$.isNumeric(obj.month)
|
||||
) {
|
||||
var obj = $.Deferred();
|
||||
obj.reject('fail');
|
||||
return obj.promise();
|
||||
}
|
||||
|
||||
if (useCachedMap) {
|
||||
localStorage.setItem(storedOldMapKey, JSON.stringify([serverID, obj]));
|
||||
localStorage.setItem(storedStartYear, JSON.stringify(obj.startYear));
|
||||
}
|
||||
|
||||
$world_map.removeClass('draw_required');
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setMapBackground(obj) {
|
||||
function setTheme() {
|
||||
var oldTheme = $world_map.data('currentTheme');
|
||||
var newTheme = obj.theme;
|
||||
if (oldTheme === newTheme) {
|
||||
return;
|
||||
}
|
||||
if (oldTheme) {
|
||||
$world_map.removeClass('map_theme_' + oldTheme);
|
||||
}
|
||||
$world_map.addClass('map_theme_' + newTheme);
|
||||
$world_map.data('currentTheme', newTheme);
|
||||
}
|
||||
if (option.dynamicMapTheme) {
|
||||
setTheme();
|
||||
}
|
||||
var startYear = obj.startYear;
|
||||
var year = obj.year;
|
||||
var month = obj.month;
|
||||
|
||||
if (isDetailMap) {
|
||||
$world_map.addClass('map_detail').removeClass('map_basic');
|
||||
} else {
|
||||
$world_map.addClass('map_basic').removeClass('map_detail');
|
||||
}
|
||||
|
||||
var $map_title = $('.map_title_text');
|
||||
if (year < startYear + 1) {
|
||||
$map_title.css('color', 'magenta');
|
||||
} else if (year < startYear + 2) {
|
||||
$map_title.css('color', 'orange');
|
||||
} else if (year < startYear + 3) {
|
||||
$map_title.css('color', 'yellow');
|
||||
}
|
||||
|
||||
$map_title_tooltip = $('.map_title .tooltiptext');
|
||||
$map_title_tooltip.empty();
|
||||
|
||||
var tooltipTexts = [];
|
||||
if (year < startYear + 3) {
|
||||
var startYearText = [];
|
||||
var remainYear = startYear + 3 - year;
|
||||
var remainMonth = 12 - month + 1;
|
||||
if (remainMonth > 0) {
|
||||
remainYear -= 1;
|
||||
}
|
||||
if (remainYear) {
|
||||
startYearText.push('{0}년'.format(remainYear));
|
||||
}
|
||||
if (remainMonth) {
|
||||
startYearText.push('{0}개월'.format(remainMonth));
|
||||
}
|
||||
|
||||
tooltipTexts.push('초반제한 기간 : {0} ({1}년)'.format(startYearText.join(' '), startYear + 3));
|
||||
}
|
||||
|
||||
var currentTechLimit = Math.floor(Math.max(0, year - startYear) / 5) + 1;
|
||||
var nextTechLimitYear = currentTechLimit * 5 + startYear;
|
||||
|
||||
tooltipTexts.push('기술등급 제한 : {0}등급 ({1}년 해제)'.format(currentTechLimit, nextTechLimitYear, currentTechLimit + 1));
|
||||
$map_title_tooltip.html(tooltipTexts.join('<br>'));
|
||||
|
||||
$world_map.removeClass('map_string map_summer map_fall map_winter');
|
||||
if (month <= 3) {
|
||||
$world_map.addClass('map_spring');
|
||||
} else if (month <= 6) {
|
||||
$world_map.addClass('map_summer');
|
||||
} else if (month <= 9) {
|
||||
$world_map.addClass('map_fall');
|
||||
} else {
|
||||
$world_map.addClass('map_winter');
|
||||
}
|
||||
|
||||
$map_title.html('{0}年 {1}月'.format(year, month));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function convertCityObjs(obj) {
|
||||
//원본 Obj는 굉장히 간소하게 온다, Object 형태로 변환해서 사용한다.
|
||||
|
||||
function toCityObj(arr) {
|
||||
return {
|
||||
id: arr[0],
|
||||
level: arr[1],
|
||||
state: arr[2],
|
||||
nationId: (arr[3] > 0) ? arr[3] : null,
|
||||
region: arr[4],
|
||||
supply: (arr[5] != 0)
|
||||
};
|
||||
}
|
||||
|
||||
function toNationObj(arr) {
|
||||
return {
|
||||
id: arr[0],
|
||||
name: arr[1],
|
||||
color: arr[2],
|
||||
capital: arr[3]
|
||||
};
|
||||
}
|
||||
|
||||
var cityList = obj.cityList.map(toCityObj);
|
||||
var nationList = obj.nationList.map(toNationObj);
|
||||
nationList = convertDictById(nationList); //array of object -> dict
|
||||
|
||||
var spyList = obj.spyList;
|
||||
var shownByGeneralList = convertSet(obj.shownByGeneralList); //Array -> Set
|
||||
|
||||
var myCity = obj.myCity;
|
||||
var myNation = obj.myNation;
|
||||
|
||||
|
||||
function mergePositionInfo(city) {
|
||||
var id = city.id;
|
||||
if (!(id in cityPosition)) {
|
||||
return city;
|
||||
}
|
||||
var xy_val = cityPosition[id];
|
||||
city.name = xy_val[0];
|
||||
city.x = xy_val[1];
|
||||
city.y = xy_val[2];
|
||||
return city;
|
||||
}
|
||||
|
||||
function mergeNationInfo(city) {
|
||||
//nationId 값으로 isCapital, color, nation을 통합
|
||||
|
||||
var nationId = city.nationId;
|
||||
if (nationId === null || !(nationId in nationList)) {
|
||||
city.nationId = null;
|
||||
city.nation = null;
|
||||
city.color = null;
|
||||
city.isCapital = false;
|
||||
return city;
|
||||
}
|
||||
|
||||
var nationObj = nationList[nationId];
|
||||
city.nation = nationObj.name;
|
||||
city.color = nationObj.color;
|
||||
city.isCapital = (nationObj.capital == city.id);
|
||||
|
||||
return city;
|
||||
}
|
||||
|
||||
function mergeClickable(city) {
|
||||
//clickable = (defaultCity << 4 ) | (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll
|
||||
var id = city.id;
|
||||
var nationId = city.nationId;
|
||||
var clickable = 16;
|
||||
if (id in spyList) {
|
||||
clickable |= spyList[id] << 3;
|
||||
}
|
||||
if (myNation !== null && nationId == myNation) {
|
||||
clickable |= 4;
|
||||
}
|
||||
if (shownByGeneralList.hasOwnProperty(id)) {
|
||||
clickable |= 2;
|
||||
}
|
||||
if (myCity !== null && id == myCity) {
|
||||
clickable |= 2;
|
||||
}
|
||||
if (clickableAll) {
|
||||
clickable |= 1;
|
||||
}
|
||||
|
||||
|
||||
city.clickable = clickable;
|
||||
return city;
|
||||
}
|
||||
|
||||
cityList = cityList
|
||||
.map(mergePositionInfo)
|
||||
.map(mergeNationInfo)
|
||||
.map(mergeClickable)
|
||||
.map(formatCityInfo);
|
||||
|
||||
return {
|
||||
'cityList': cityList,
|
||||
'myCity': myCity
|
||||
};
|
||||
}
|
||||
|
||||
function drawDetailWorldMap(obj) {
|
||||
|
||||
var $map_body = $(drawTarget + ' .map_body');
|
||||
|
||||
var cityList = obj.cityList;
|
||||
var myCity = obj.myCity;
|
||||
|
||||
cityList.forEach(function(city) {
|
||||
var id = city.id;
|
||||
$('.city_base_{0}'.format(id)).detach();
|
||||
//이전 도시는 지운다.
|
||||
|
||||
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
||||
$cityObj.addClass('city_level_{0}'.format(city.level));
|
||||
$cityObj.data('obj', city).css({ 'left': city.x - 20, 'top': city.y - 15 });
|
||||
|
||||
if ('color' in city && city.color !== null) {
|
||||
var $bgObj = $('<div class="city_bg"></div>');
|
||||
$cityObj.append($bgObj);
|
||||
$bgObj.css({ 'background-image': 'url({0}/b{1}.png)'.format(pathConfig.gameImage, convColorValue(city.color)) });
|
||||
}
|
||||
|
||||
var $linkObj = $('<a class="city_link"></a>');
|
||||
$linkObj.data({ 'text': city.text, 'nation': city.nation, 'id': city.id });
|
||||
$cityObj.append($linkObj);
|
||||
|
||||
var $imgObj = $('<div class="city_img"><img src="{0}/cast_{1}.gif"><div class="city_filler"></div></div>'.format(pathConfig.gameImage, city.level));
|
||||
$linkObj.append($imgObj);
|
||||
|
||||
|
||||
|
||||
if (city.state > 0) {
|
||||
var $stateObj = $('<div class="city_state"><img src="{0}/event{1}.gif"></div>'.format(pathConfig.gameImage, city.state));
|
||||
$linkObj.append($stateObj);
|
||||
}
|
||||
|
||||
if (city.nationId && city.nationId > 0) {
|
||||
var flagType = city.supply ? 'f' : 'd';
|
||||
var $flagObj = $('<div class="city_flag"><img src="{0}/{1}{2}.gif"></div>'.format(pathConfig.gameImage, flagType, convColorValue(city.color)));
|
||||
if (city.isCapital) {
|
||||
var $capitalObj = $('<div class="city_capital"><img src="{0}/event51.gif"></div>'.format(pathConfig.gameImage));
|
||||
$flagObj.append($capitalObj);
|
||||
}
|
||||
$imgObj.append($flagObj);
|
||||
}
|
||||
|
||||
var $nameObj = $('<span class="city_detail_name">{0}</span>'.format(city.name));
|
||||
$imgObj.append($nameObj);
|
||||
|
||||
|
||||
$map_body.append($cityObj);
|
||||
|
||||
|
||||
});
|
||||
|
||||
$world_map.find('.city_base_{0} .city_filler'.format(myCity)).addClass('my_city');
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function drawBasicWorldMap(obj) {
|
||||
|
||||
var $map_body = $(drawTarget + ' .map_body');
|
||||
|
||||
var cityList = obj.cityList;
|
||||
var myCity = obj.myCity;
|
||||
|
||||
cityList.forEach(function(city) {
|
||||
var id = city.id;
|
||||
$('.city_base_{0}'.format(id)).detach();
|
||||
//이전 도시는 지운다.
|
||||
|
||||
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
||||
$cityObj.addClass('city_level_{0}'.format(city.level));
|
||||
$cityObj.data('obj', city).css({ 'left': city.x - 20, 'top': city.y - 15 });
|
||||
|
||||
var $linkObj = $('<a class="city_link"></a>');
|
||||
$linkObj.data({ 'text': city.text, 'nation': city.nation, 'id': city.id });
|
||||
$cityObj.append($linkObj);
|
||||
|
||||
var $imgObj = $('<div class="city_img"><div class="city_filler"></div></div>');
|
||||
if ('color' in city && city.color !== null) {
|
||||
$imgObj.css({ 'background-color': city.color });
|
||||
}
|
||||
$linkObj.append($imgObj);
|
||||
|
||||
if (city.state > 0) {
|
||||
var state_text = 'wrong';
|
||||
if (city.state < 10) {
|
||||
state_text = 'good';
|
||||
} else if (city.state < 40) {
|
||||
state_text = 'bad';
|
||||
} else if (city.state < 50) {
|
||||
state_text = 'war';
|
||||
}
|
||||
|
||||
var $stateObj = $('<div class="city_state city_state_{0}"></div>'.format(state_text));
|
||||
$imgObj.append($stateObj);
|
||||
}
|
||||
|
||||
//단순 표기에서는 깃발 여부가 없음
|
||||
if (city.isCapital) {
|
||||
var $capitalObj = $('<div class="city_capital"></div>');
|
||||
$imgObj.append($capitalObj);
|
||||
}
|
||||
|
||||
var $nameObj = $('<span class="city_detail_name">{0}</span>'.format(city.name));
|
||||
$imgObj.append($nameObj);
|
||||
|
||||
$map_body.append($cityObj);
|
||||
});
|
||||
|
||||
$world_map.find('.city_base_{0} .city_filler'.format(myCity)).addClass('my_city');
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function setMouseWork(obj) {
|
||||
var $tooltip = $(drawTarget + ' .city_tooltip');
|
||||
var $tooltip_city = $tooltip.find('.city_name');
|
||||
var $tooltip_nation = $tooltip.find('.nation_name');
|
||||
|
||||
var $objs = $(drawTarget + ' .city_link');
|
||||
|
||||
var $map_body = $(drawTarget + ' .map_body');
|
||||
|
||||
//터치스크린 탭
|
||||
|
||||
if (!option.neutralView && is_touch_device()) {
|
||||
$objs.on('touchstart', function(e) {
|
||||
if (window.sam_toggleSingleTap) {
|
||||
return true;
|
||||
}
|
||||
var $this = $(this);
|
||||
|
||||
var touchMode = $this.data('touchMode');
|
||||
if ($tooltip_city.data('target') != $this.data('id')) {
|
||||
$this.data('touchMode', 1);
|
||||
} else if (touchMode === undefined) {
|
||||
$this.data('touchMode', 1);
|
||||
} else {
|
||||
$this.data('touchMode', touchMode + 1);
|
||||
}
|
||||
$map_body.data('touchMode', 1);
|
||||
|
||||
$tooltip_city.data('target', $this.data('id'));
|
||||
|
||||
|
||||
});
|
||||
|
||||
$objs.on('touchend', function(e) {
|
||||
if (window.sam_toggleSingleTap) {
|
||||
return true;
|
||||
}
|
||||
var $this = $(this);
|
||||
var position = $this.parent().position();
|
||||
$tooltip_city.html($this.data('text'));
|
||||
|
||||
var nation_text = $this.data('nation');
|
||||
if (nation_text) {
|
||||
$tooltip_nation.html(nation_text).show();
|
||||
} else {
|
||||
$tooltip_nation.html('').hide();
|
||||
}
|
||||
|
||||
var left = position.left;
|
||||
var top = position.top;
|
||||
|
||||
var scale = $map_body.data('scale');
|
||||
if (scale) {
|
||||
left /= scale;
|
||||
top /= scale;
|
||||
}
|
||||
|
||||
$tooltip.css({ 'top': top + 25, 'left': left + 35 }).show();
|
||||
|
||||
var touchMode = $this.data('touchMode');
|
||||
if (touchMode <= 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
||||
$this.data('touchMode', 0);
|
||||
});
|
||||
|
||||
$map_body.on('touchend', function(e) {
|
||||
if (window.sam_toggleSingleTap) {
|
||||
return true;
|
||||
}
|
||||
//위의 touchend bind에 해당하지 않는 경우 -> 빈 지도 터치
|
||||
$tooltip.hide();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//Mouse over 모드 작동
|
||||
|
||||
$map_body.on('mousemove', function(e) {
|
||||
if ($(this).data('touchMode')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var rect = this.getBoundingClientRect();
|
||||
var left = (e.clientX - rect.left - this.clientLeft + this.scrollLeft);
|
||||
var top = (e.clientY - rect.top - this.clientTop + this.scrollTop);
|
||||
|
||||
var scale = $map_body.data('scale');
|
||||
if (scale) {
|
||||
left /= scale;
|
||||
top /= scale;
|
||||
}
|
||||
|
||||
$tooltip.css({ 'top': top + 10, 'left': left + 10 });
|
||||
});
|
||||
|
||||
$objs.on('mouseenter', function(e) {
|
||||
if ($map_body.data('touchMode')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var $this = $(this);
|
||||
|
||||
$tooltip_city.data('target', $this.data('id'));
|
||||
$tooltip_city.html($this.data('text'));
|
||||
var nation_text = $this.data('nation');
|
||||
if (nation_text) {
|
||||
$tooltip_nation.html(nation_text).show();
|
||||
} else {
|
||||
$tooltip_nation.html('').hide();
|
||||
}
|
||||
|
||||
$tooltip.show();
|
||||
});
|
||||
|
||||
$objs.on('mouseleave', function(event) {
|
||||
$tooltip.hide();
|
||||
});
|
||||
|
||||
$objs.on('click', function(e) {
|
||||
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
||||
var touchMode = $(this).data('touchMode');
|
||||
if (touchMode === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (touchMode === 1) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function setCityClickable(obj) {
|
||||
|
||||
obj.cityList.forEach(function(city) {
|
||||
var $cityLink = $world_map.find('.city_base_{0} .city_link'.format(city.id));
|
||||
|
||||
if ('clickable' in city && city.clickable > 0) {
|
||||
$cityLink.attr('href', hrefTemplate.format(city.id));
|
||||
}
|
||||
|
||||
if (selectCallback) {
|
||||
$cityLink.click(function() {
|
||||
return selectCallback(city);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function saveCityInfo(obj) {
|
||||
$world_map.data('cityInfo', obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
var $hideCityNameBtn = $world_map.find('.map_toggle_cityname');
|
||||
if (localStorage.getItem('sam.hideMapCityName') == 'yes') {
|
||||
$world_map.addClass('hide_cityname');
|
||||
$hideCityNameBtn.addClass('active').attr('aria-pressed', 'true');
|
||||
}
|
||||
|
||||
$hideCityNameBtn.click(function() {
|
||||
//이전 상태 확인
|
||||
var state = !$hideCityNameBtn.hasClass('active');
|
||||
if (state) {
|
||||
$world_map.addClass('hide_cityname');
|
||||
localStorage.setItem('sam.hideMapCityName', 'yes');
|
||||
} else {
|
||||
$world_map.removeClass('hide_cityname');
|
||||
localStorage.setItem('sam.hideMapCityName', 'no');
|
||||
}
|
||||
});
|
||||
|
||||
var $toggleSingleTapBtn = $world_map.find('.map_toggle_single_tap');
|
||||
if (localStorage.getItem('sam.toggleSingleTap') == 'yes') {
|
||||
window.sam_toggleSingleTap = true;
|
||||
$toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true');
|
||||
} else {
|
||||
window.sam_toggleSingleTap = false;
|
||||
}
|
||||
|
||||
var $map_body = $(drawTarget + ' .map_body');
|
||||
|
||||
$toggleSingleTapBtn.click(function() {
|
||||
//이전 상태 확인
|
||||
var state = !$toggleSingleTapBtn.hasClass('active');
|
||||
if (state) {
|
||||
$map_body.removeData('touchMode');
|
||||
localStorage.setItem('sam.toggleSingleTap', 'yes');
|
||||
window.sam_toggleSingleTap = true;
|
||||
} else {
|
||||
localStorage.setItem('sam.toggleSingleTap', 'no');
|
||||
window.sam_toggleSingleTap = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (isDetailMap) {
|
||||
$world_map.addClass('map_detail');
|
||||
} else {
|
||||
$world_map.removeClass('map_datail');
|
||||
}
|
||||
|
||||
//deferred mode of jQuery. != promise-then.
|
||||
var deferred = $.ajax({
|
||||
url: option.targetJson,
|
||||
type: option.reqType,
|
||||
dataType: 'json',
|
||||
ifModified: true,
|
||||
data: {
|
||||
data: JSON.stringify({
|
||||
neutralView: option.neutralView,
|
||||
year: option.year,
|
||||
month: option.month,
|
||||
showMe: option.showMe,
|
||||
aux: option.aux
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
var rawObject = null;
|
||||
|
||||
deferred
|
||||
.then(function(data) {
|
||||
rawObject = data;
|
||||
return data;
|
||||
})
|
||||
.then(checkReturnObject)
|
||||
.then(setMapBackground)
|
||||
.then(convertCityObjs)
|
||||
.then(isDetailMap ? drawDetailWorldMap : drawBasicWorldMap)
|
||||
.then(setMouseWork)
|
||||
.then(setCityClickable)
|
||||
.then(saveCityInfo)
|
||||
.then(function(data) {
|
||||
if (option.callback) {
|
||||
option.callback(data, rawObject);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if ($world_map.hasClass('draw_required')) {
|
||||
if (useCachedMap) {
|
||||
//일단 불러옴
|
||||
do {
|
||||
var storedMap = localStorage.getItem(storedOldMapKey);
|
||||
if (!storedMap) {
|
||||
break;
|
||||
}
|
||||
storedMap = JSON.parse(storedMap);
|
||||
var storedServerID = storedMap[0];
|
||||
if (storedServerID != serverID) {
|
||||
break;
|
||||
}
|
||||
|
||||
storedMap = storedMap[1];
|
||||
storedMap = setMapBackground(storedMap);
|
||||
storedMap = convertCityObjs(storedMap);
|
||||
if (isDetailMap) {
|
||||
storedMap = drawDetailWorldMap(storedMap);
|
||||
} else {
|
||||
storedMap = drawBasicWorldMap(storedMap);
|
||||
}
|
||||
storedMap = setMouseWork(storedMap);
|
||||
storedMap = setCityClickable(storedMap);
|
||||
storedMap = saveCityInfo(storedMap);
|
||||
} while (false);
|
||||
} else if (option.year && option.month) {
|
||||
var startYear = localStorage.getItem(storedStartYear);
|
||||
if (startYear) {
|
||||
startYear = JSON.parse(startYear);
|
||||
} else {
|
||||
startYear = option.year;
|
||||
}
|
||||
var tmp = {
|
||||
year: option.year,
|
||||
month: option.month,
|
||||
startYear: startYear
|
||||
};
|
||||
setMapBackground(tmp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
if (is_touch_device()) {
|
||||
$('.map_body .map_toggle_single_tap').show();
|
||||
}
|
||||
})
|
||||
-562
@@ -1,562 +0,0 @@
|
||||
|
||||
|
||||
|
||||
var messageTemplate = '';
|
||||
var myGeneralID=null;
|
||||
var isChief = false;
|
||||
var lastSequence = 0;
|
||||
var myNation = null;
|
||||
var minMsgSeq = {
|
||||
'private':0x7fffffff,
|
||||
'public':0x7fffffff,
|
||||
'national':0x7fffffff,
|
||||
'diplomacy':0x7fffffff,
|
||||
}
|
||||
|
||||
var generalList = {};
|
||||
|
||||
function responseMessage(msgID, response){
|
||||
$.ajax({
|
||||
url: 'j_msg_decide_opt.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
data: JSON.stringify({
|
||||
msgID:msgID,
|
||||
response:response
|
||||
})
|
||||
}
|
||||
}).then(function(result){
|
||||
if(result && !result.result){
|
||||
alert(result.reason);
|
||||
}
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function deleteMessage(msgID){
|
||||
$.ajax({
|
||||
url: 'j_msg_delete.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
msgID:msgID
|
||||
}
|
||||
}).then(refreshMsg);
|
||||
}
|
||||
|
||||
function refreshMsg(result){
|
||||
if(result && !result.result){
|
||||
alert(result.reason);
|
||||
}
|
||||
return redrawMsg(fetchRecentMsg(), true);
|
||||
}
|
||||
|
||||
function fetchRecentMsg(){
|
||||
return $.ajax({
|
||||
url: 'j_msg_get_recent.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
sequence:lastSequence
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showOldMsg(msgType){
|
||||
var oldMsg = $.ajax({
|
||||
url: 'j_msg_get_old.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
to:minMsgSeq[msgType],
|
||||
type:msgType,
|
||||
}
|
||||
});
|
||||
redrawMsg(oldMsg, false);
|
||||
}
|
||||
|
||||
function redrawMsg(deferred, addFront){
|
||||
function checkErasable(obj){
|
||||
|
||||
var now = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
$('.btn-delete-msg').each(function(){
|
||||
var $btn = $(this);
|
||||
var eraseUntil = $btn.data('erase_until');
|
||||
if(eraseUntil < now){
|
||||
$btn.detach();
|
||||
}
|
||||
})
|
||||
return obj;
|
||||
}
|
||||
function checkClear(obj){
|
||||
if(!obj.result){
|
||||
var t = $.Deferred();
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
if(!obj.keepRecent){
|
||||
var t = $.Deferred();
|
||||
$('.msg_plate').detach();
|
||||
lastSequence = null;
|
||||
console.log('refresh!');
|
||||
redrawMsg(fetchRecentMsg(), true);
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function registerSequence(obj){
|
||||
if(!obj.result){
|
||||
var t = $.Deferred();
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
lastSequence = Math.max(lastSequence, obj.sequence);
|
||||
$.each(['public', 'private', 'national', 'diplomacy'], function (_, msgType) {
|
||||
var msgList = obj[msgType];
|
||||
if(msgList === undefined || msgList.length == 0){
|
||||
return true;
|
||||
}
|
||||
var lastMsg = msgList[msgList.length - 1];
|
||||
minMsgSeq[msgType] = Math.min(minMsgSeq[msgType], lastMsg.id);
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
|
||||
function refineMessageObjs(obj){
|
||||
var msgList = [obj.public, obj.private, obj.diplomacy, obj.national];
|
||||
$.each(msgList, function(){
|
||||
if(!this){
|
||||
return true;
|
||||
}
|
||||
|
||||
$.each(this, function(){
|
||||
var msg = this;
|
||||
if(!msg.src.nation){
|
||||
msg.src.nation = '재야';
|
||||
msg.src.color = '#000000';
|
||||
}
|
||||
|
||||
if(!msg.dest.nation){
|
||||
msg.dest.nation = '재야';
|
||||
msg.dest.color = '#000000';
|
||||
}
|
||||
|
||||
msg.src.colorType = isBrightColor(msg.src.color)?'bright':'dark';
|
||||
msg.dest.colorType = isBrightColor(msg.dest.color)?'bright':'dark';
|
||||
});
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
|
||||
function printTemplate(obj){
|
||||
var printList = [
|
||||
[obj.public, $('#message_board .public_message'), 'public'],
|
||||
[obj.private, $('#message_board .private_message'), 'private'],
|
||||
[obj.diplomacy, $('#message_board .diplomacy_message'), 'diplomacy'],
|
||||
[obj.national, $('#message_board .national_message'), 'national'],
|
||||
];
|
||||
|
||||
$.each(printList, function(){
|
||||
var msgSource = this[0];
|
||||
var $msgBoard = this[1];
|
||||
var msgType = this[2];
|
||||
|
||||
if(!msgSource || $msgBoard.length == 0){
|
||||
console.log('No Items', msgSource, $msgBoard);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
var needRefreshLastContact = (msgType == 'private');
|
||||
|
||||
var now = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
//list의 맨 앞이 가장 최신 메시지임.
|
||||
var $msgs = msgSource.map(function(msg){
|
||||
|
||||
var contactTarget = (msg.src.id != myGeneralID) ? msg.src.id : msg.dest.id;
|
||||
if(needRefreshLastContact && contactTarget != myGeneralID && contactTarget in generalList)
|
||||
{
|
||||
needRefreshLastContact = false;
|
||||
$('#last_contact').val(contactTarget).html(generalList[contactTarget].textName).show();
|
||||
}
|
||||
|
||||
msg.nationID = obj.nationID;
|
||||
msg.generalName = obj.generalName;
|
||||
msg.msgType = msgType;
|
||||
|
||||
if(msg.src.nation_id == msg.dest.nation_id){
|
||||
msg.nationType = 'local';
|
||||
}
|
||||
else if(msg.nationID == msg.src.nation_id){
|
||||
msg.nationType = 'src';
|
||||
}
|
||||
else{
|
||||
msg.nationType = 'dest';
|
||||
}
|
||||
|
||||
|
||||
msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg';
|
||||
if(msgType == 'diplomacy'){
|
||||
msg.allowButton = permissionLevel>=4;
|
||||
}
|
||||
else{
|
||||
msg.allowButton = true;
|
||||
}
|
||||
msg.myGeneralID = myGeneralID;
|
||||
msg.last5min = moment(msg.time).add(5, 'minute').format('YYYY-MM-DD HH:mm:ss');
|
||||
msg.now = now;
|
||||
if(msg.option && msg.option.invalid){
|
||||
msg.invalidType = 'msg_invalid';
|
||||
}
|
||||
else{
|
||||
msg.invalidType = 'msg_valid';
|
||||
}
|
||||
|
||||
if(msg.option && !msg.option.deletable){
|
||||
msg.deletable = false;
|
||||
}
|
||||
else{
|
||||
msg.deletable = true;
|
||||
}
|
||||
|
||||
var msgHtml = TemplateEngine(messageTemplate, msg);
|
||||
|
||||
|
||||
//만약 이전 메시지와 같은 id가 온 경우 덮어씌운다.
|
||||
//NOTE:현 프로세스 상에서는 같은 id가 와선 안된다.
|
||||
var $existMsg = $('#msg_{0}'.format(msg.id));
|
||||
var $msg = $(msgHtml);
|
||||
if($existMsg.length){
|
||||
console.log('메시지 충돌', $msg, $existMsg);
|
||||
$existMsg.html($msg.html());
|
||||
$msg = $existMsg;
|
||||
}
|
||||
|
||||
var hideMsg = false;
|
||||
if(msg.option){
|
||||
if(msg.option.delete !== undefined){
|
||||
//delete는 삭제.
|
||||
$('#msg_{0}'.format(msg.option.delete)).detach();
|
||||
}
|
||||
if(msg.option.overwrite !== undefined){
|
||||
//overwrite는 숨기기.
|
||||
$.map(msg.option.overwrite, function (overwriteID) {
|
||||
var $msg = $('#msg_{0}'.format(overwriteID));
|
||||
$msg.find('.btn-delete-msg').detach();
|
||||
$msg.find('.msg_content').html('삭제된 메시지입니다.').removeClass('msg_valid').addClass('msg_invalid');
|
||||
});
|
||||
|
||||
}
|
||||
if(msg.option.hide){
|
||||
hideMsg = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(hideMsg){
|
||||
return null;
|
||||
}
|
||||
|
||||
$msg.find('.btn-delete-msg').click(function(){
|
||||
if(!confirm("삭제하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
deleteMessage(msg.id);
|
||||
});
|
||||
|
||||
$msg.find('button.prompt_yes').click(function(){
|
||||
if(!confirm("수락하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
responseMessage(msg.id, true);
|
||||
|
||||
});
|
||||
|
||||
$msg.find('button.prompt_no').click(function(){
|
||||
if(!confirm("거절하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
responseMessage(msg.id, false);
|
||||
});
|
||||
|
||||
if($existMsg.length){
|
||||
return null;
|
||||
}
|
||||
else{
|
||||
return $msg;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(addFront){
|
||||
$msgBoard.prepend($msgs);
|
||||
}
|
||||
else{
|
||||
$msgBoard.find('.load_old_message').before($msgs);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
deferred
|
||||
.then(checkErasable)
|
||||
.then(checkClear)
|
||||
.then(registerSequence)
|
||||
.then(refineMessageObjs)
|
||||
.then(printTemplate);
|
||||
}
|
||||
|
||||
function refreshMailboxList(obj){
|
||||
//$.ajax는 data, textStatus, jqXHR를 가진다
|
||||
//when으로 묶었으므로 data를 풀어야함.
|
||||
obj = obj[0];
|
||||
|
||||
|
||||
var $mailboxList = $('#mailbox_list');
|
||||
|
||||
$mailboxList.change(function(){
|
||||
console.log($(this).val());
|
||||
})
|
||||
|
||||
var oldSelected = $mailboxList.val();
|
||||
|
||||
$mailboxList.empty();
|
||||
|
||||
var $lastContact = $('#last_contact');
|
||||
var lastContact = null;
|
||||
if($lastContact.length > 0 && $lastContact.val()>=0){
|
||||
lastContact = {
|
||||
id:$lastContact.val(),
|
||||
textName:$lastContact.html()
|
||||
};
|
||||
$lastContact = null;
|
||||
}
|
||||
|
||||
generalList = {};
|
||||
|
||||
|
||||
obj.nation.sort(function(lhs, rhs){
|
||||
if(lhs.mailbox == myNation.mailbox){
|
||||
return -1;
|
||||
}
|
||||
if(rhs.mailbox == myNation.mailbox){
|
||||
return 1;
|
||||
}
|
||||
return lhs.mailbox - rhs.mailbox;
|
||||
})
|
||||
|
||||
$.each(obj.nation, function(){
|
||||
var nation = this;
|
||||
//console.log(nation);
|
||||
var $optgroup = $('<optgroup label="{0}"></optgroup>'.format(nation.name));
|
||||
$optgroup.css('background-color', nation.color);
|
||||
|
||||
if(myNation.mailbox == nation.mailbox){
|
||||
myNation.color = nation.color;
|
||||
}
|
||||
|
||||
if(isBrightColor(nation.color)){
|
||||
$optgroup.css('color', 'black');
|
||||
}
|
||||
else{
|
||||
$optgroup.css('color', 'white');
|
||||
}
|
||||
|
||||
nation.general.sort(function(lhs, rhs){
|
||||
if(lhs[1] < rhs[1]){
|
||||
return -1;
|
||||
}
|
||||
if(lhs[1] > rhs[1]){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
$.each(nation.general, function(){
|
||||
var generalID = this[0];
|
||||
var generalName = this[1];
|
||||
var isNPC = !!(this[2] & 0x2);
|
||||
var isRuler = !!(this[2] & 0x1);
|
||||
var isAmbassador = !!(this[2] & 0x4);
|
||||
|
||||
|
||||
|
||||
if(generalID == myGeneralID){
|
||||
return true;
|
||||
}
|
||||
|
||||
var textName = generalName;
|
||||
if(isRuler){
|
||||
textName = '*{0}*'.format(textName);
|
||||
}
|
||||
else if(isAmbassador){
|
||||
textName = '#{0}#'.format(textName);
|
||||
}
|
||||
|
||||
generalList[generalID] = {
|
||||
id:generalID,
|
||||
name:generalName,
|
||||
textName:textName,
|
||||
isRuler:isRuler,
|
||||
nation:nation.nationID,
|
||||
color:nation.color
|
||||
};
|
||||
|
||||
var $item = $('<option value="{0}">{1}</option>'.format(generalID, textName));
|
||||
|
||||
if(permissionLevel == 4 && isAmbassador && myNation.mailbox != nation.mailbox){
|
||||
$item.prop('disabled', true);
|
||||
}
|
||||
$optgroup.append($item);
|
||||
});
|
||||
|
||||
$mailboxList.append($optgroup);
|
||||
});
|
||||
|
||||
var $favorite = $('<optgroup label="즐겨찾기"></optgroup>');
|
||||
|
||||
//아국메시지, 전체메시지
|
||||
var $ourCountry = $('<option value="{0}">【 아국 메세지 】</option>'.format(myNation.mailbox))
|
||||
.css({'background-color':myNation.color, 'color':isBrightColor(myNation.color)?'black':'white'});
|
||||
var $toPublic = $('<option value="9999">【 전체 메세지 】</option>');
|
||||
$favorite.append($ourCountry);
|
||||
$favorite.append($toPublic);
|
||||
|
||||
$lastContact = $('<option id="last_contact" value="-1"></option>').hide();
|
||||
if(lastContact){
|
||||
$lastContact.show().val(lastContact.id).html(lastContact.textName);
|
||||
}
|
||||
$favorite.append($lastContact);
|
||||
//TODO:운영자를 추가하는 코드도 넣을 것.
|
||||
|
||||
if(permissionLevel >= 4){
|
||||
$.each(obj.nation, function(){
|
||||
var nation = this;
|
||||
//console.log(nation);
|
||||
var $nation = $('<option value="{0}">{1}</option>'.format(nation.mailbox,nation.name));
|
||||
$nation.css('background-color', nation.color);
|
||||
|
||||
if(isBrightColor(nation.color)){
|
||||
$nation.css('color', 'black');
|
||||
}
|
||||
else{
|
||||
$nation.css('color', 'white');
|
||||
}
|
||||
$favorite.append($nation);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
$mailboxList.prepend($favorite);
|
||||
|
||||
if(!oldSelected){
|
||||
$mailboxList.val(myNation.mailbox);
|
||||
}
|
||||
else{
|
||||
$mailboxList.val(oldSelected);
|
||||
}
|
||||
}
|
||||
|
||||
function registerGlobal(basicInfo){
|
||||
|
||||
window.myNation = {
|
||||
'id':basicInfo.myNationID,
|
||||
'mailbox':basicInfo.myNationID+9000,
|
||||
'color':'#000000',
|
||||
'nation':'재야'
|
||||
};
|
||||
window.myGeneralID = basicInfo.generalID;
|
||||
window.isChief = basicInfo.isChief;
|
||||
window.myOfficerLevel = basicInfo.officerLevel;
|
||||
window.permissionLevel = basicInfo.permission;
|
||||
}
|
||||
|
||||
function activateMessageForm(){
|
||||
var $msgInput = $('#msg_input');
|
||||
var $msgSubmit = $('#msg_submit');
|
||||
var $mailboxList = $('#mailbox_list');
|
||||
|
||||
$msgInput.keypress(function (e) {
|
||||
var code = (e.keyCode ? e.keyCode : e.which);
|
||||
if (code == 13) {
|
||||
$msgSubmit.trigger('click');
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
$msgSubmit.click(function(){
|
||||
|
||||
var text = $.trim($msgInput.val());
|
||||
$msgInput.val('').focus();
|
||||
|
||||
var targetMailbox = $mailboxList.val();
|
||||
console.log(targetMailbox, text);
|
||||
|
||||
var deferred;
|
||||
|
||||
if(text){
|
||||
deferred = $.ajax({
|
||||
url:'j_msg_submit.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
data: JSON.stringify({
|
||||
mailbox:parseInt(targetMailbox),
|
||||
text:text
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
deferred = $.Deferred();
|
||||
deferred.resolve({
|
||||
result:true,
|
||||
reason:'no_text'
|
||||
});
|
||||
}
|
||||
|
||||
deferred.then(refreshMsg);
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
//tmp_template.html은 추후 msg.js에 통합될 수 있음
|
||||
var getTemplate = $.get('js/templates/message.html?12',function(obj){
|
||||
messageTemplate = obj;
|
||||
});
|
||||
|
||||
//basic_info.json은 세션값에 따라 동적으로 바뀌는 데이터임.
|
||||
var basicInfo = $.ajax({
|
||||
url:'j_basic_info.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
}).then(registerGlobal);
|
||||
|
||||
//sender_list.json 은 서버측에선 캐시 가능한 데이터임.
|
||||
var senderList = $.ajax({
|
||||
url: 'j_msg_contact_list.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
});
|
||||
|
||||
var MessageList = fetchRecentMsg();
|
||||
|
||||
senderList = $.when(senderList, basicInfo)
|
||||
.then(refreshMailboxList)
|
||||
.then(activateMessageForm);
|
||||
|
||||
$.when(MessageList, getTemplate, basicInfo, senderList)
|
||||
.then(function(){
|
||||
redrawMsg(MessageList, true);
|
||||
}).then(function(){
|
||||
$('.load_old_message').click(function(){
|
||||
var $this = $(this);
|
||||
var msgType = $this.data('msg_type');
|
||||
showOldMsg(msgType);
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -1,167 +0,0 @@
|
||||
jQuery(function($) {
|
||||
|
||||
|
||||
var initCustomCSSForm = function() {
|
||||
var lastTimeOut = null;
|
||||
var $obj = $('#custom_css');
|
||||
var key = 'sam_customCSS';
|
||||
|
||||
var text = localStorage.getItem(key);
|
||||
if (text) {
|
||||
$obj.val(text);
|
||||
console.log(text);
|
||||
}
|
||||
|
||||
if ($obj.on('change keyup paste', function() {
|
||||
var newText = $obj.val();
|
||||
if (text == newText) {
|
||||
return;
|
||||
}
|
||||
if (lastTimeOut) {
|
||||
clearTimeout(lastTimeOut);
|
||||
}
|
||||
$obj.css('background-color', '#222222');
|
||||
lastTimeOut = setTimeout(function() {
|
||||
text = $obj.val();
|
||||
localStorage.setItem(key, text);
|
||||
$obj.css('background-color', 'black');
|
||||
}, 500);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
$('.load_old_log').click(function() {
|
||||
var $thisBtn = $(this);
|
||||
var logType = $thisBtn.data('log_type');
|
||||
var $last = $('.log_{0}:last'.format(logType));
|
||||
var reqTo = null;
|
||||
if ($last.length) {
|
||||
reqTo = $last.data('seq');
|
||||
}
|
||||
|
||||
$.post({
|
||||
url: 'j_general_log_old.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
to: reqTo,
|
||||
type: logType
|
||||
}
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
return quickReject('로그를 받아오지 못했습니다.');
|
||||
}
|
||||
if (!data.result) {
|
||||
return quickReject('로그를 받아오지 못했습니다. : ' + data.reason);
|
||||
}
|
||||
|
||||
var keys = Object.keys(data.log);
|
||||
if (keys.length > 1 && keys[0] < keys[1]) {
|
||||
keys.reverse();
|
||||
}
|
||||
|
||||
if (keys == 0) {
|
||||
$thisBtn.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var html = [];
|
||||
$.each(keys, function(_, key) {
|
||||
if ($('#log_{0}_{1}'.format(logType, key)).length) {
|
||||
return true;
|
||||
}
|
||||
var item = data.log[key];
|
||||
html.push("<div class='log_{0}' id='log_{0}_{1}' data-seq='{1}'>{2}</div>".format(logType, key, item));
|
||||
});
|
||||
|
||||
$('#{0}Plate'.format(logType)).append(html);
|
||||
}, errUnknown)
|
||||
.fail(function(reason) {
|
||||
alert(reason);
|
||||
location.reload();
|
||||
});
|
||||
})
|
||||
|
||||
initCustomCSSForm();
|
||||
|
||||
|
||||
$('#die_immediately').click(function() {
|
||||
if (!confirm('정말로 삭제하시겠습니까?')) {
|
||||
return false;
|
||||
}
|
||||
$.post({
|
||||
url: 'j_die_immediately.php',
|
||||
dataType: 'json',
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
return quickReject('실패했습니다.');
|
||||
}
|
||||
if (!data.result) {
|
||||
return quickReject(data.reason);
|
||||
}
|
||||
|
||||
location.replace('..');
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason) {
|
||||
alert(reason);
|
||||
location.reload();
|
||||
});
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#vacation').click(function() {
|
||||
if (!confirm('휴가 기능을 신청할까요?')) {
|
||||
return false;
|
||||
}
|
||||
$.post({
|
||||
url: 'j_vacation.php',
|
||||
dataType: 'json',
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
return quickReject('실패했습니다.');
|
||||
}
|
||||
if (!data.result) {
|
||||
return quickReject(data.reason);
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason) {
|
||||
alert(reason);
|
||||
location.reload();
|
||||
});
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#set_my_setting').click(function() {
|
||||
$.post({
|
||||
url: 'j_set_my_setting.php',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
tnmt: $('.tnmt:checked').val(),
|
||||
defence_train: $('#defence_train').val(),
|
||||
use_treatment: $('#use_treatment').val(),
|
||||
use_auto_nation_turn: $('#use_auto_nation_turn').val(),
|
||||
}
|
||||
}).then(function(data) {
|
||||
if (!data) {
|
||||
return quickReject('실패했습니다.');
|
||||
}
|
||||
if (!data.result) {
|
||||
return quickReject(data.reason);
|
||||
}
|
||||
|
||||
location.reload();
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason) {
|
||||
alert(reason);
|
||||
location.reload();
|
||||
});
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user