Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
923cac5408 | ||
|
|
23505326c7 | ||
|
|
5f1a48f523 | ||
|
|
a607d39030 | ||
|
|
96d108729e | ||
|
|
ef15adaaf8 | ||
|
|
f190b74a7e | ||
|
|
edbc2b88b6 | ||
|
|
dc000cecf1 | ||
|
|
7c95a483df | ||
|
|
27e5d73da1 | ||
|
|
6306dae92d | ||
|
|
a427ddff83 | ||
|
|
b62ee6e820 | ||
|
|
3c18666080 | ||
|
|
40968b301a | ||
|
|
05904d31fd | ||
|
|
75aeaf4ee7 | ||
|
|
ff4e67a9f6 | ||
|
|
5f672d5bd1 | ||
|
|
5cb39eba8b | ||
|
|
4d8c3c75d6 | ||
|
|
8bdd19fc06 | ||
|
|
0ec99d8ba1 | ||
|
|
929d2db5a5 | ||
|
|
a7ad77f433 | ||
|
|
9cd47d5deb | ||
|
|
3cb5691aae | ||
|
|
dce63919fa | ||
|
|
1cdbedcb96 | ||
|
|
1586712ce5 | ||
|
|
f059186494 | ||
|
|
0af0be57b0 | ||
|
|
dad2b03212 | ||
|
|
b6e307660f | ||
|
|
c21c14825a | ||
|
|
39f9c986e9 | ||
|
|
393683aebc | ||
|
|
a87fcb44a6 | ||
|
|
0a6496ddfb | ||
|
|
fa2841fac6 | ||
|
|
861e45419b | ||
|
|
15fd943456 | ||
|
|
b538bfc27e | ||
|
|
e0f32eddc4 | ||
|
|
75a704c196 | ||
|
|
6565fdbe7e | ||
|
|
6248d72852 | ||
|
|
00d1797b96 | ||
|
|
911194eba8 | ||
|
|
0fad3ae31d | ||
|
|
b6988d866a | ||
|
|
e30959a656 | ||
|
|
52eeff3466 | ||
|
|
a06ded552d | ||
|
|
e9b8a84243 | ||
|
|
1fc3cfd1f2 |
@@ -35,6 +35,8 @@ d_setting/*.php
|
|||||||
*/d_setting/*.php
|
*/d_setting/*.php
|
||||||
*/d_setting/templates/*.php
|
*/d_setting/templates/*.php
|
||||||
|
|
||||||
|
*/data/file_cache
|
||||||
|
|
||||||
**/old/*
|
**/old/*
|
||||||
test.php
|
test.php
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -27,7 +27,8 @@
|
|||||||
"xemlock/htmlpurifier-html5": "^0.1.7",
|
"xemlock/htmlpurifier-html5": "^0.1.7",
|
||||||
"catfan/medoo": "^1.5",
|
"catfan/medoo": "^1.5",
|
||||||
"phan/phan": "^2.7",
|
"phan/phan": "^2.7",
|
||||||
"erusev/parsedown-extra": "^0.8.1"
|
"erusev/parsedown-extra": "^0.8.1",
|
||||||
|
"nette/caching": "^3.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
Generated
+208
-1
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "1c2e0182ebdf9bfe795e52a5d7fc6abd",
|
"content-hash": "ab1175c8592ba7f7756d5f02a3aa051c",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brandonwamboldt/utilphp",
|
"name": "brandonwamboldt/utilphp",
|
||||||
@@ -843,6 +843,213 @@
|
|||||||
"description": "Map nested JSON structures onto PHP classes",
|
"description": "Map nested JSON structures onto PHP classes",
|
||||||
"time": "2020-04-16T18:48:43+00:00"
|
"time": "2020-04-16T18:48:43+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "nette/caching",
|
||||||
|
"version": "v3.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nette/caching.git",
|
||||||
|
"reference": "b9ecbf920f240bd1ab14900d9a77876924ad7fb4"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nette/caching/zipball/b9ecbf920f240bd1ab14900d9a77876924ad7fb4",
|
||||||
|
"reference": "b9ecbf920f240bd1ab14900d9a77876924ad7fb4",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"nette/finder": "^2.4 || ^3.0",
|
||||||
|
"nette/utils": "^2.4 || ^3.0",
|
||||||
|
"php": ">=7.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"latte/latte": "^2.4",
|
||||||
|
"nette/di": "^v3.0",
|
||||||
|
"nette/tester": "^2.0",
|
||||||
|
"tracy/tracy": "^2.4"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause",
|
||||||
|
"GPL-2.0",
|
||||||
|
"GPL-3.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "David Grudl",
|
||||||
|
"homepage": "https://davidgrudl.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nette Community",
|
||||||
|
"homepage": "https://nette.org/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.",
|
||||||
|
"homepage": "https://nette.org",
|
||||||
|
"keywords": [
|
||||||
|
"cache",
|
||||||
|
"journal",
|
||||||
|
"memcached",
|
||||||
|
"nette",
|
||||||
|
"sqlite"
|
||||||
|
],
|
||||||
|
"time": "2019-11-19T18:41:40+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "nette/finder",
|
||||||
|
"version": "v2.5.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nette/finder.git",
|
||||||
|
"reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nette/finder/zipball/4ad2c298eb8c687dd0e74ae84206a4186eeaed50",
|
||||||
|
"reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"nette/utils": "^2.4 || ^3.0",
|
||||||
|
"php": ">=7.1"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"nette/nette": "<2.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"nette/tester": "^2.0",
|
||||||
|
"phpstan/phpstan": "^0.12",
|
||||||
|
"tracy/tracy": "^2.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.5-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause",
|
||||||
|
"GPL-2.0",
|
||||||
|
"GPL-3.0"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "David Grudl",
|
||||||
|
"homepage": "https://davidgrudl.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nette Community",
|
||||||
|
"homepage": "https://nette.org/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "🔍 Nette Finder: find files and directories with an intuitive API.",
|
||||||
|
"homepage": "https://nette.org",
|
||||||
|
"keywords": [
|
||||||
|
"filesystem",
|
||||||
|
"glob",
|
||||||
|
"iterator",
|
||||||
|
"nette"
|
||||||
|
],
|
||||||
|
"time": "2020-01-03T20:35:40+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "nette/utils",
|
||||||
|
"version": "v3.1.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nette/utils.git",
|
||||||
|
"reference": "488f58378bba71767e7831c83f9e0fa808bf83b9"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nette/utils/zipball/488f58378bba71767e7831c83f9e0fa808bf83b9",
|
||||||
|
"reference": "488f58378bba71767e7831c83f9e0fa808bf83b9",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"nette/tester": "~2.0",
|
||||||
|
"phpstan/phpstan": "^0.12",
|
||||||
|
"tracy/tracy": "^2.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-gd": "to use Image",
|
||||||
|
"ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",
|
||||||
|
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
|
||||||
|
"ext-json": "to use Nette\\Utils\\Json",
|
||||||
|
"ext-mbstring": "to use Strings::lower() etc...",
|
||||||
|
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()",
|
||||||
|
"ext-xml": "to use Strings::length() etc. when mbstring is not available"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "3.1-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause",
|
||||||
|
"GPL-2.0-only",
|
||||||
|
"GPL-3.0-only"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "David Grudl",
|
||||||
|
"homepage": "https://davidgrudl.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Nette Community",
|
||||||
|
"homepage": "https://nette.org/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
|
||||||
|
"homepage": "https://nette.org",
|
||||||
|
"keywords": [
|
||||||
|
"array",
|
||||||
|
"core",
|
||||||
|
"datetime",
|
||||||
|
"images",
|
||||||
|
"json",
|
||||||
|
"nette",
|
||||||
|
"paginator",
|
||||||
|
"password",
|
||||||
|
"slugify",
|
||||||
|
"string",
|
||||||
|
"unicode",
|
||||||
|
"utf-8",
|
||||||
|
"utility",
|
||||||
|
"validation"
|
||||||
|
],
|
||||||
|
"time": "2020-05-27T09:58:51+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "pguardiario/phpuri",
|
"name": "pguardiario/phpuri",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
|
|||||||
+75
-74
@@ -1,131 +1,132 @@
|
|||||||
body, html{
|
body,
|
||||||
|
html {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main{
|
.main {
|
||||||
margin-top: 70px;
|
margin-top: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1.title {
|
h1.title {
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
font-family: 'Passion One', cursive;
|
font-family: 'Passion One', cursive;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr{
|
hr {
|
||||||
width: 10%;
|
width: 10%;
|
||||||
/*color: #fff;*/
|
/*color: #fff;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group{
|
.form-group {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label{
|
label {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
input::-webkit-input-placeholder {
|
input::-webkit-input-placeholder {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
padding-top: 3px;
|
padding-top: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-login{
|
.main-login {
|
||||||
/*background-color: #fff;*/
|
/*background-color: #fff;*/
|
||||||
/* shadows and rounded borders */
|
/* shadows and rounded borders */
|
||||||
-moz-border-radius: 2px;
|
-moz-border-radius: 2px;
|
||||||
-webkit-border-radius: 2px;
|
-webkit-border-radius: 2px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||||
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||||
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-center{
|
.main-center {
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 330px;
|
max-width: 330px;
|
||||||
padding: 40px 40px;
|
padding: 40px 40px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.login_btn_group{
|
.login_btn_group {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-register{
|
.login-register {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.col-form-label {
|
||||||
.col-form-label{
|
text-align: center;
|
||||||
text-align:center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.terms{
|
.terms {
|
||||||
max-height: 200px; overflow-y: auto;
|
max-height: 200px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terms pre{
|
.terms pre {
|
||||||
width:100%;
|
width: 100%;
|
||||||
white-space: pre-wrap; /* Since CSS 2.1 */
|
white-space: pre-wrap;
|
||||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
/* Since CSS 2.1 */
|
||||||
white-space: -pre-wrap; /* Opera 4-6 */
|
white-space: -moz-pre-wrap;
|
||||||
white-space: -o-pre-wrap; /* Opera 7 */
|
/* Mozilla, since 1999 */
|
||||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
white-space: -pre-wrap;
|
||||||
|
/* Opera 4-6 */
|
||||||
|
white-space: -o-pre-wrap;
|
||||||
|
/* Opera 7 */
|
||||||
|
word-wrap: break-word;
|
||||||
|
/* Internet Explorer 5.5+ */
|
||||||
}
|
}
|
||||||
|
|
||||||
.vertical-center {
|
.vertical-center {
|
||||||
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
|
min-height: 100%;
|
||||||
min-height: 100vh; /* These two lines are counted as one :-) */
|
/* Fallback for browsers do NOT support vh unit */
|
||||||
|
min-height: 100vh;
|
||||||
|
/* These two lines are counted as one :-) */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.full-content {
|
#login_card {
|
||||||
position:fixed;
|
z-index: 801;
|
||||||
left:0;
|
|
||||||
top:0;
|
|
||||||
width:100%;
|
|
||||||
height:100%;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
z-index:800;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#login_card{
|
#btn_kakao_login {
|
||||||
z-index:801;
|
|
||||||
}
|
|
||||||
|
|
||||||
#btn_kakao_login{
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height:46px;
|
height: 46px;
|
||||||
width:116px;
|
width: 116px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color:transparent;
|
color: transparent;
|
||||||
border:0;
|
border: 0;
|
||||||
background-size: 100%; /* To fill the dimensions of container (button), or */
|
background-size: 100%;
|
||||||
|
/* To fill the dimensions of container (button), or */
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: bottom center;
|
background-position: bottom center;
|
||||||
margin-top:5px;
|
margin-top: 5px;
|
||||||
background-image:url('../oauth_kakao/kakao_login_join.png');
|
background-image: url('../oauth_kakao/kakao_login_join.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#btn_kakao_login:hover {
|
#btn_kakao_login:hover {
|
||||||
background-image:url('../oauth_kakao/kakao_login_join_ov.png');
|
background-image: url('../oauth_kakao/kakao_login_join_ov.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
#bottom_box{
|
#bottom_box .container {
|
||||||
position:fixed;
|
text-align: center;
|
||||||
bottom:0;
|
|
||||||
width:100%;
|
|
||||||
left:0;
|
|
||||||
}
|
}
|
||||||
#bottom_box .container{
|
|
||||||
text-align:center;
|
.btn-group-xs>.btn,
|
||||||
|
.btn-xs {
|
||||||
|
padding: .25rem .4rem;
|
||||||
|
font-size: .875rem;
|
||||||
|
line-height: .5;
|
||||||
|
border-radius: .2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#running_map {
|
||||||
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,15 @@ $result = Util::generateFileUsingSimpleTemplate(
|
|||||||
'sharedIconPath' => $sharedIconPath,
|
'sharedIconPath' => $sharedIconPath,
|
||||||
'gameImagePath' => $gameImagePath,
|
'gameImagePath' => $gameImagePath,
|
||||||
'imageRequestPath' => $imageRequestPath,
|
'imageRequestPath' => $imageRequestPath,
|
||||||
'imageRequestKey' => $imageRequestKey
|
'imageRequestKey' => $imageRequestKey,
|
||||||
|
'serverList' => [
|
||||||
|
['che', '체', 'white'],
|
||||||
|
['kwe', '퀘', 'yellow'],
|
||||||
|
['pwe', '풰', 'orange'],
|
||||||
|
['twe', '퉤', 'magenta'],
|
||||||
|
['nya', '냐', '#e67e22'],
|
||||||
|
['pya', '퍄', '#9b59b6']
|
||||||
|
]
|
||||||
],
|
],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class ServConfig
|
|||||||
public static $gameImagePath = "_tK_gameImagePath_";
|
public static $gameImagePath = "_tK_gameImagePath_";
|
||||||
public static $imageRequestPath = "_tK_imageRequestPath_";
|
public static $imageRequestPath = "_tK_imageRequestPath_";
|
||||||
public static $imageRequestKey = '_tK_imageRequestKey_';
|
public static $imageRequestKey = '_tK_imageRequestKey_';
|
||||||
|
private static $serverList = null;
|
||||||
|
|
||||||
public static function getSharedIconPath(string $filepath = ''): string
|
public static function getSharedIconPath(string $filepath = ''): string
|
||||||
{
|
{
|
||||||
@@ -42,6 +43,24 @@ class ServConfig
|
|||||||
return static::$imageRequestPath . "?req={$req_hash}&time={$now}";
|
return static::$imageRequestPath . "?req={$req_hash}&time={$now}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 서버 설정 반환
|
||||||
|
*
|
||||||
|
* @return \sammo\Setting[]
|
||||||
|
*/
|
||||||
|
public static function getServerList(): array{
|
||||||
|
$servKeyList = [/*_tK_serverList_*/];
|
||||||
|
$servKeyList[] = ['hwe', '훼', 'red'];
|
||||||
|
|
||||||
|
if (self::$serverList === null) {
|
||||||
|
self::$serverList = [];
|
||||||
|
foreach($servKeyList as [$servKey, $servNick, $servColor]){
|
||||||
|
self::$serverList[$servKey] = new Setting(ROOT.'/'.$servKey, $servNick, $servColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self::$serverList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
|
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
|
||||||
|
|||||||
+18
-12
@@ -14,6 +14,7 @@ $generalID = $session->generalID;
|
|||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$gameStor->cacheValues(['turntime', 'opentime', 'autorun_user']);
|
||||||
|
|
||||||
increaseRefresh("내정보", 1);
|
increaseRefresh("내정보", 1);
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ if($gameStor->turntime <= $gameStor->opentime){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$use_treatment = $me->getAuxVar('use_treatment')??10;
|
$use_treatment = $me->getAuxVar('use_treatment')??10;
|
||||||
|
$use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn')??1;
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -77,20 +78,25 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
|
|||||||
∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br>
|
∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br>
|
||||||
|
|
||||||
환약 사용 【<select id='use_treatment' name='use_treatment'>
|
환약 사용 【<select id='use_treatment' name='use_treatment'>
|
||||||
<option value=10 <?=$use_treatment==10?"selected":""; ?>>경상</option>
|
<option value=10 <?=($use_treatment==10)?"selected":""; ?>>경상</option>
|
||||||
<option value=20 <?=$use_treatment==21?"selected":""; ?>>중상</option>
|
<option value=21 <?=($use_treatment==21)?"selected":""; ?>>중상</option>
|
||||||
<option value=40 <?=$use_treatment==41?"selected":""; ?>>심각</option>
|
<option value=41 <?=($use_treatment==41)?"selected":""; ?>>심각</option>
|
||||||
<option value=60 <?=$use_treatment==61?"selected":""; ?>>위독</option>
|
<option value=61 <?=($use_treatment==61)?"selected":""; ?>>위독</option>
|
||||||
<option value=100 <?=$use_treatment==100?"selected":""; ?>>사용안함</option>
|
<option value=100 <?=($use_treatment==100)?"selected":""; ?>>사용안함</option>
|
||||||
</select>】<br>
|
</select>】<br>
|
||||||
∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br>
|
∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br>
|
||||||
|
<?php if(($gameStor->autorun_user['options']['chief'])??false) : ?>
|
||||||
|
자동 사령턴 허용 【<select id='use_auto_nation_turn' name='use_auto_nation_turn'>
|
||||||
|
<option value=1 <?=$use_auto_nation_turn?"selected":""; ?>>허용</option>
|
||||||
|
<option value=0 <?=(!$use_auto_nation_turn)?"selected":""; ?>>허용 안함</option>
|
||||||
|
</select>】<br>
|
||||||
|
∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br>
|
||||||
|
<?php endif; ?>
|
||||||
수비 【<select id='defence_train' name='defence_train'>
|
수비 【<select id='defence_train' name='defence_train'>
|
||||||
<option value=90 <?=$me->getVar('defence_train')==90?"selected":""; ?>>☆(훈사90)</option>
|
<?php foreach([90, 80, 60, 40] as $targetDefenceTrain): ?>
|
||||||
<option value=80 <?=$me->getVar('defence_train')==80?"selected":""; ?>>◎(훈사80)</option>
|
<option value='<?=$targetDefenceTrain?>' <?=$me->getVar('defence_train')==$targetDefenceTrain?"selected":""; ?>><?=formatDefenceTrain($targetDefenceTrain)?>(훈사<?=$targetDefenceTrain?>)</option>
|
||||||
<option value=60 <?=$me->getVar('defence_train')==60?"selected":""; ?>>○(훈사60)</option>
|
<?php endforeach; ?>
|
||||||
<option value=40 <?=$me->getVar('defence_train')==40?"selected":""; ?>>△(훈사40)</option>
|
<option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>><?=formatDefenceTrain(999)?>[훈련, 사기 -3]</option>
|
||||||
<option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>>×[훈련, 사기 -3]</option>
|
|
||||||
</select>
|
</select>
|
||||||
】<br><br>
|
】<br><br>
|
||||||
<input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
|
<input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
|
||||||
|
|||||||
@@ -8,7 +8,34 @@ $session = Session::requireLogin()->setReadOnly();
|
|||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$startYear = $gameStor->getValue('startyear');
|
$gameStor->cacheValues(['startyear', 'year']);
|
||||||
|
$startYear = $gameStor->startyear;
|
||||||
|
$year = $gameStor->year;
|
||||||
|
|
||||||
|
$me = $db->queryFirstRow('SELECT no, nation, city FROM general WHERE owner =%i', Session::getUserID());
|
||||||
|
|
||||||
|
if($me){
|
||||||
|
$generalID = $me['no'];
|
||||||
|
$nationID = $me['nation'];
|
||||||
|
$city = $db->queryFirstRow('SELECT city, level, def, wall FROM city WHERE city = %i', $me['city']);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$generalID = 0;
|
||||||
|
$nationID = 0;
|
||||||
|
$city = [
|
||||||
|
'city'=>0,
|
||||||
|
'level'=>5,
|
||||||
|
'def'=>1000,
|
||||||
|
'wall'=>1000,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if($nationID){
|
||||||
|
$nation = $db->queryFirstRow('SELECT level, type, tech, capital FROM nation WHERE nation = %i', $nationID);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$nation = null;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -30,6 +57,8 @@ $startYear = $gameStor->getValue('startyear');
|
|||||||
<?=WebUtil::printJS('js/common.js')?>
|
<?=WebUtil::printJS('js/common.js')?>
|
||||||
<script>
|
<script>
|
||||||
var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
||||||
|
var city = <?=Json::encode($city)?>;
|
||||||
|
var nation = <?=Json::encode($nation)?>;
|
||||||
</script>
|
</script>
|
||||||
<?=WebUtil::printJS('js/battle_simulator.js')?>
|
<?=WebUtil::printJS('js/battle_simulator.js')?>
|
||||||
</head>
|
</head>
|
||||||
@@ -47,7 +76,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text">년 시작</span>
|
<span class="input-group-text">년 시작</span>
|
||||||
</div>
|
</div>
|
||||||
<input type="number" class="form-control" id="year" value="<?=$startYear+3?>" min="<?=$startYear?>">
|
<input type="number" class="form-control" id="year" value="<?=$year?>" min="<?=$startYear?>">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<span class="input-group-text">년</span>
|
<span class="input-group-text">년</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,7 +160,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="1" autocomplete="off">Y
|
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="1" autocomplete="off">Y
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-secondary active">
|
<label class="btn btn-secondary active">
|
||||||
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="2" autocomplete="off" checked>N
|
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="0" autocomplete="off">N
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -145,6 +174,9 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="float-sm-left" style="line-height:25px;">출병자 설정</div>
|
<div class="float-sm-left" style="line-height:25px;">출병자 설정</div>
|
||||||
<div class="float-sm-right btn-toolbar" role="toolbar">
|
<div class="float-sm-right btn-toolbar" role="toolbar">
|
||||||
|
<div class="btn-group btn-group-sm mr-2" role="group">
|
||||||
|
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
|
||||||
|
</div>
|
||||||
<div class="btn-group btn-group-sm mr-2" role="group">
|
<div class="btn-group btn-group-sm mr-2" role="group">
|
||||||
<button type="button" class="btn btn-info btn-general-save">저장</button>
|
<button type="button" class="btn btn-info btn-general-save">저장</button>
|
||||||
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
|
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
|
||||||
@@ -203,7 +235,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<input type="radio" name="is_defender_capital" class="form_is_capital" value="1" autocomplete="off">Y
|
<input type="radio" name="is_defender_capital" class="form_is_capital" value="1" autocomplete="off">Y
|
||||||
</label>
|
</label>
|
||||||
<label class="btn btn-secondary active">
|
<label class="btn btn-secondary active">
|
||||||
<input type="radio" name="is_defender_capital" class="form_is_capital" value="0" autocomplete="off" checked>N
|
<input type="radio" name="is_defender_capital" class="form_is_capital" value="0" autocomplete="off">N
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -236,6 +268,9 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<div class="float-sm-left" style="line-height:25px;">수비자 설정</div>
|
<div class="float-sm-left" style="line-height:25px;">수비자 설정</div>
|
||||||
<div class="float-sm-right btn-toolbar" role="toolbar">
|
<div class="float-sm-right btn-toolbar" role="toolbar">
|
||||||
|
<div class="btn-group btn-group-sm mr-2" role="group">
|
||||||
|
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
|
||||||
|
</div>
|
||||||
<div class="btn-group btn-group-sm mr-2" role="group">
|
<div class="btn-group btn-group-sm mr-2" role="group">
|
||||||
<button type="button" class="btn btn-info btn-general-save">저장</button>
|
<button type="button" class="btn btn-info btn-general-save">저장</button>
|
||||||
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
|
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
|
||||||
@@ -404,7 +439,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-1">
|
<div class="input-group mb-3">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text">귀병숙련</span>
|
<span class="input-group-text">귀병숙련</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -425,11 +460,27 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
<span class="input-group-text">수비여부</span>
|
<span class="input-group-text">수비여부</span>
|
||||||
</div>
|
</div>
|
||||||
<select class="custom-select form_defence_train only_defender">
|
<select class="custom-select form_defence_train only_defender">
|
||||||
|
<option value="90">훈사 90</option>
|
||||||
<option value="80">훈사 80</option>
|
<option value="80">훈사 80</option>
|
||||||
<option value="60">훈사 60</option>
|
<option value="60">훈사 60</option>
|
||||||
|
<option value="40">훈사 40</option>
|
||||||
<option value="999">안함</option>
|
<option value="999">안함</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="input-group mb-1">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">전투 수</span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control form_warnum" value="0" step="1">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">승리 수</span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control form_killnum" value="0" step="1">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text">사살 수</span>
|
||||||
|
</div>
|
||||||
|
<input type="number" class="form-control form_killcrew" value="0" step="1">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -477,5 +528,25 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="importModal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">장수 목록</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<select id="modalSelector"></select>
|
||||||
|
<p>타국 장수를 선택한 경우 숙련과 아이템은 0으로 초기화됩니다.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary" id='importFromDB'>가져오기</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+27
-2
@@ -185,7 +185,8 @@ function myNationInfo(General $generalObj)
|
|||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['startyear', 'year']);
|
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
|
||||||
|
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||||
|
|
||||||
$nationID = $generalObj->getNationID();
|
$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);
|
||||||
@@ -200,6 +201,17 @@ function myNationInfo(General $generalObj)
|
|||||||
$level12Name = key_exists(12, $topChiefs)?getColoredName($topChiefs[12]['name'], $topChiefs[12]['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']):'-';
|
$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){
|
||||||
|
$cmd = buildNationCommandClass($command, $generalObj, $admin, new LastTurn());
|
||||||
|
$nextAvailableTurn = $cmd->getNextAvailableTurn();
|
||||||
|
if($nextAvailableTurn > $yearMonth){
|
||||||
|
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo "<table width=498 class='tb_layout bg2 nation_info'>
|
echo "<table width=498 class='tb_layout bg2 nation_info'>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=4 ";
|
<td colspan=4 ";
|
||||||
@@ -282,10 +294,23 @@ function myNationInfo(General $generalObj)
|
|||||||
} else {
|
} else {
|
||||||
if ($nation['strategic_cmd_limit'] != 0) {
|
if ($nation['strategic_cmd_limit'] != 0) {
|
||||||
$nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>";
|
$nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>";
|
||||||
} else {
|
} else if($impossibleStrategicCommandLists) {
|
||||||
|
$nation['strategic_cmd_limit'] = "<font color=yellow>가 능</font>";
|
||||||
|
} else{
|
||||||
$nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>";
|
$nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($impossibleStrategicCommandLists){
|
||||||
|
$text = [];
|
||||||
|
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>',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($nation['surlimit'] != 0) {
|
if ($nation['surlimit'] != 0) {
|
||||||
$nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>";
|
$nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ function checkCommandArg(?array $arg):?string{
|
|||||||
}
|
}
|
||||||
$defaultCheck = [
|
$defaultCheck = [
|
||||||
/*'string'=>[
|
/*'string'=>[
|
||||||
'nationName', 'optionText', 'itemType', 'nationType'
|
'nationName', 'optionText', 'itemType', 'nationType', 'commandType',
|
||||||
],*/
|
],*/
|
||||||
'integer'=>[
|
'integer'=>[
|
||||||
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
||||||
@@ -284,14 +284,14 @@ function setGeneralCommand(int $generalID, array $rawTurnList, string $command,
|
|||||||
$turnList[$turnIdx] = true;
|
$turnList[$turnIdx] = true;
|
||||||
}
|
}
|
||||||
else if($turnIdx == -1){
|
else if($turnIdx == -1){
|
||||||
//홀수
|
//홀수, 0부터 맞다.
|
||||||
foreach(Util::range(1, GameConst::$maxTurn, 2) as $subIdx){
|
foreach(Util::range(0, GameConst::$maxTurn, 2) as $subIdx){
|
||||||
$turnList[$subIdx] = true;
|
$turnList[$subIdx] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($turnIdx == -2){
|
else if($turnIdx == -2){
|
||||||
//짝수
|
//짝수, 1부터 맞다.
|
||||||
foreach(Util::range(0, GameConst::$maxTurn, 2) as $subIdx){
|
foreach(Util::range(1, GameConst::$maxTurn, 2) as $subIdx){
|
||||||
$turnList[$subIdx] = true;
|
$turnList[$subIdx] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ function checkWander()
|
|||||||
$logger = $wanderer->getLogger();
|
$logger = $wanderer->getLogger();
|
||||||
$logger->pushGeneralActionLog('초반 제한후 방랑군은 자동 해산됩니다.', ActionLogger::PLAIN);
|
$logger->pushGeneralActionLog('초반 제한후 방랑군은 자동 해산됩니다.', ActionLogger::PLAIN);
|
||||||
$wanderCmd->run();
|
$wanderCmd->run();
|
||||||
|
$wanderCmd->setNextAvailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,10 +217,14 @@ function formatDefenceTrain(int $value): string
|
|||||||
{
|
{
|
||||||
if ($value === 999) {
|
if ($value === 999) {
|
||||||
return "×";
|
return "×";
|
||||||
|
} else if ($value >= 90){
|
||||||
|
return "☆";
|
||||||
} else if ($value >= 80) {
|
} else if ($value >= 80) {
|
||||||
return "◎";
|
return "◎";
|
||||||
} else {
|
} else if ($value >= 60) {
|
||||||
return "○";
|
return "○";
|
||||||
|
} else{
|
||||||
|
return "△";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ function selection($tnmt_type, $tnmt, $phase) {
|
|||||||
if($phase < 31) {
|
if($phase < 31) {
|
||||||
$gameStor->phase+=1;
|
$gameStor->phase+=1;
|
||||||
} else {
|
} else {
|
||||||
$gameStor->tournamemt = 4;
|
$gameStor->tournament = 4;
|
||||||
$gameStor->phase=0;
|
$gameStor->phase=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ $scenario = $gameStor->scenario_text;
|
|||||||
$nationID = $generalObj->getNationID();
|
$nationID = $generalObj->getNationID();
|
||||||
if($nationID){
|
if($nationID){
|
||||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
$nationStor->cacheValues(['notice', 'online_genenerals']);
|
$nationStor->cacheAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
$valid = 0;
|
$valid = 0;
|
||||||
|
|||||||
+4
-4
@@ -52,7 +52,7 @@ else if(
|
|||||||
$now->getTimestamp() - $lastTurn->getTimestamp() > $reservedDate->getTimestamp() - $now->getTimestamp()
|
$now->getTimestamp() - $lastTurn->getTimestamp() > $reservedDate->getTimestamp() - $now->getTimestamp()
|
||||||
){
|
){
|
||||||
//정지 상태 & 중간 넘음
|
//정지 상태 & 중간 넘음
|
||||||
AppConf::getList()[DB::prefix()]->closeServer();
|
ServConfig::getServerList()[DB::prefix()]->closeServer();
|
||||||
$status = 'closed';
|
$status = 'closed';
|
||||||
}
|
}
|
||||||
else if(
|
else if(
|
||||||
@@ -60,12 +60,12 @@ else if(
|
|||||||
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
|
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
|
||||||
){
|
){
|
||||||
//천통 & 비정지 상태 & 2/3 넘음
|
//천통 & 비정지 상태 & 2/3 넘음
|
||||||
AppConf::getList()[DB::prefix()]->closeServer();
|
ServConfig::getServerList()[DB::prefix()]->closeServer();
|
||||||
$status = 'closed';
|
$status = 'closed';
|
||||||
}
|
}
|
||||||
else if($reservedDate->getTimestamp() - $now->getTimestamp() <= 60*10){
|
else if($reservedDate->getTimestamp() - $now->getTimestamp() <= 60*10){
|
||||||
//어쨌든 간에 10분 남았다면.
|
//어쨌든 간에 10분 남았다면.
|
||||||
AppConf::getList()[DB::prefix()]->closeServer();
|
ServConfig::getServerList()[DB::prefix()]->closeServer();
|
||||||
$status = 'closed';
|
$status = 'closed';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +96,6 @@ $result = ResetHelper::buildScenario(
|
|||||||
$result['affected']=1;
|
$result['affected']=1;
|
||||||
|
|
||||||
$prefix = DB::prefix();
|
$prefix = DB::prefix();
|
||||||
AppConf::getList()[$prefix]->openServer();
|
ServConfig::getServerList()[$prefix]->openServer();
|
||||||
|
|
||||||
Json::die($result);
|
Json::die($result);
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
include "lib.php";
|
||||||
|
include "func.php";
|
||||||
|
|
||||||
|
WebUtil::requireAJAX();
|
||||||
|
|
||||||
|
$destGeneralID = Util::getPost('destGeneralID', 'int', 0);
|
||||||
|
|
||||||
|
if(!$destGeneralID || $destGeneralID <= 0){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'올바르지 않은 장수 코드입니다'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$session = Session::requireGameLogin([])->setReadOnly();
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
increaseRefresh("시뮬레이터 추출", 1);
|
||||||
|
|
||||||
|
$userID = Session::getUserID();
|
||||||
|
$me = $db->queryFirstRow('SELECT no,nation from general where owner=%i', $userID);
|
||||||
|
$nationID = $me['nation'];
|
||||||
|
|
||||||
|
$reqColumns = [
|
||||||
|
'nation',
|
||||||
|
'name', 'officer_level', 'explevel', 'injury',
|
||||||
|
'leadership', 'horse', 'strength', 'weapon', 'intel', 'book', 'item',
|
||||||
|
'rice', 'personal', 'special2',
|
||||||
|
'crew', 'crewtype',
|
||||||
|
'atmos', 'train', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'defence_train',
|
||||||
|
];
|
||||||
|
|
||||||
|
$reqRankColumns = [
|
||||||
|
'warnum', 'killnum', 'killcrew'
|
||||||
|
];
|
||||||
|
|
||||||
|
$dummyItems = [
|
||||||
|
'officer_level'=>1,
|
||||||
|
'horse'=>'None',
|
||||||
|
'weapon'=>'None',
|
||||||
|
'book'=>'None',
|
||||||
|
'item'=>'None',
|
||||||
|
'crew'=>0,
|
||||||
|
'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE,
|
||||||
|
'rice'=>10000,
|
||||||
|
'train'=>GameConst::$maxTrainByCommand,
|
||||||
|
'atmos'=>GameConst::$maxTrainByCommand,
|
||||||
|
'dex1'=>0,
|
||||||
|
'dex2'=>0,
|
||||||
|
'dex3'=>0,
|
||||||
|
'dex4'=>0,
|
||||||
|
'dex5'=>0,
|
||||||
|
'defence_train'=>80,
|
||||||
|
'warnum'=>0,
|
||||||
|
'killnum'=>0,
|
||||||
|
'killcrew'=>0,
|
||||||
|
];
|
||||||
|
|
||||||
|
$rawDestGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no=%i', Util::formatListOfBackticks($reqColumns), $destGeneralID);
|
||||||
|
|
||||||
|
if($nationID == 0 || $rawDestGeneral['nation'] != $nationID){
|
||||||
|
foreach($dummyItems as $key=>$val){
|
||||||
|
$rawDestGeneral[$key] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$rawRankValue = $db->queryAllLists('SELECT `type`, `value` FROM rank_data WHERE general_id = %i AND `type` IN %ls', $destGeneralID, $reqRankColumns);
|
||||||
|
foreach($rawRankValue as [$rankType, $rankValue]){
|
||||||
|
$rawDestGeneral[$rankType] = $rankValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(['dex1', 'dex2', 'dex3', 'dex4', 'dex5'] as $dexKey){
|
||||||
|
$dex = $rawDestGeneral[$dexKey];
|
||||||
|
$rawDestGeneral[$dexKey] = getDexLevelList()[getDexLevel($dex)][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
Json::die([
|
||||||
|
'result'=>true,
|
||||||
|
'reason'=>'success',
|
||||||
|
'general'=>$rawDestGeneral,
|
||||||
|
]);
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
include "lib.php";
|
||||||
|
include "func.php";
|
||||||
|
|
||||||
|
//로그인 검사
|
||||||
|
$session = Session::requireGameLogin([]);
|
||||||
|
$generalID = Session::getGeneralID();
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$rawList = Util::convertArrayToDict($db->query('SELECT no, name, npc, nation FROM general'), 'no');
|
||||||
|
$nationID = $rawList[$generalID]['nation'];
|
||||||
|
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'result'=>true,
|
||||||
|
'reason'=>'success',
|
||||||
|
'nationID'=>$nationID,
|
||||||
|
'generalID'=>$generalID,
|
||||||
|
'column'=>['no', 'name', 'npc']
|
||||||
|
];
|
||||||
|
|
||||||
|
$resultItem = [];
|
||||||
|
foreach(Util::arrayGroupBy($rawList, 'nation') as $subNationID=>$generals){
|
||||||
|
$subNation = [];
|
||||||
|
foreach($generals as $general){
|
||||||
|
$subNation[] = [$general['no'], $general['name'], $general['npc']];
|
||||||
|
}
|
||||||
|
$resultItem[$subNationID] = $subNation;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result['list'] = $resultItem;
|
||||||
|
$result['nation'] = Util::convertArrayToDict($db->query('SELECT nation, name, color FROM nation'), 'nation');
|
||||||
|
Json::die($result);
|
||||||
@@ -6,7 +6,7 @@ include "func.php";
|
|||||||
|
|
||||||
|
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
$session = Session::requireLogin();
|
$session = Session::requireLogin([]);
|
||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|||||||
+1
-1
@@ -187,7 +187,7 @@ if($reserve_open){
|
|||||||
'options'=>Json::encode($reserveInfo),
|
'options'=>Json::encode($reserveInfo),
|
||||||
'date'=>$open_date
|
'date'=>$open_date
|
||||||
]);
|
]);
|
||||||
AppConf::getList()[DB::prefix()]->closeServer();
|
ServConfig::getServerList()[DB::prefix()]->closeServer();
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>true,
|
'result'=>true,
|
||||||
'reason'=>'예약'
|
'reason'=>'예약'
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ if($result !== true){
|
|||||||
|
|
||||||
ResetHelper::clearDB();
|
ResetHelper::clearDB();
|
||||||
|
|
||||||
AppConf::getList()[$prefix]->closeServer();
|
ServConfig::getServerList()[$prefix]->closeServer();
|
||||||
|
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>true,
|
'result'=>true,
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
use Nette\Caching\Cache;
|
||||||
|
|
||||||
|
include "lib.php";
|
||||||
|
include "func.php";
|
||||||
|
|
||||||
|
if(!class_exists('\\sammo\\UniqueConst')){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'서버 초기화되지 않음'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!prepareDir('data/file_cache')){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'cache 불가'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$storage = new \Nette\Caching\Storages\FileStorage('data/file_cache');
|
||||||
|
$cache = new Cache($storage);
|
||||||
|
$serverID = UniqueConst::$serverID;
|
||||||
|
|
||||||
|
$mapInfo = $cache->load("recent_map");
|
||||||
|
//로그인 검사
|
||||||
|
|
||||||
|
$now = time();
|
||||||
|
|
||||||
|
if($mapInfo && ($now - $mapInfo['timestamp'] < 600)){
|
||||||
|
$mapEtag = $mapInfo['etag'];
|
||||||
|
$mapModified = $mapInfo['timestamp'];
|
||||||
|
|
||||||
|
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mapModified)." GMT");
|
||||||
|
header("Etag: $mapEtag");
|
||||||
|
|
||||||
|
if (
|
||||||
|
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']??'2000-01-01') === $mapModified ||
|
||||||
|
trim($_SERVER['HTTP_IF_NONE_MATCH']??'') === $mapEtag
|
||||||
|
) {
|
||||||
|
header("HTTP/1.1 304 Not Modified");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
Json::die($mapInfo['data'], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaultPost = [
|
||||||
|
'year' => null,
|
||||||
|
'month' => null,
|
||||||
|
'aux' => null,
|
||||||
|
'neutralView' => true,
|
||||||
|
'showMe' => false,
|
||||||
|
];
|
||||||
|
|
||||||
|
$history = formatHistoryToHTML(getGlobalHistoryLogRecent(10));
|
||||||
|
$rawMap = getWorldMap([
|
||||||
|
'year' => null,
|
||||||
|
'month' => null,
|
||||||
|
'aux' => null,
|
||||||
|
'neutralView' => true,
|
||||||
|
'showMe' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$mapTheme = $gameStor->map_theme ?? 'che';
|
||||||
|
|
||||||
|
$rawMap['history'] = $history;
|
||||||
|
$rawMap['theme'] = $mapTheme;
|
||||||
|
|
||||||
|
$etag = hash('sha256', $serverID.$now);
|
||||||
|
$map = [
|
||||||
|
'etag'=>$etag,
|
||||||
|
'timestamp'=>$now,
|
||||||
|
'data'=>$rawMap,
|
||||||
|
];
|
||||||
|
$cache->save("recent_map", $map);
|
||||||
|
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $now)." GMT");
|
||||||
|
header("Etag: $etag");
|
||||||
|
|
||||||
|
Json::die($map['data'], 0);
|
||||||
@@ -40,6 +40,7 @@ if($action === '추방' && $destGeneralID==0){
|
|||||||
|
|
||||||
if($destGeneralID==0){
|
if($destGeneralID==0){
|
||||||
$general = new DummyGeneral(true);
|
$general = new DummyGeneral(true);
|
||||||
|
$general->setVar('nation', $nationID);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$general = General::createGeneralObjFromDB($destGeneralID, [
|
$general = General::createGeneralObjFromDB($destGeneralID, [
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ $action = Util::getPost('action');
|
|||||||
$tnmt = Util::getPost('tnmt', 'int', 1);
|
$tnmt = Util::getPost('tnmt', 'int', 1);
|
||||||
$defence_train = Util::getPost('defence_train', 'int', 80);
|
$defence_train = Util::getPost('defence_train', 'int', 80);
|
||||||
$use_treatment = Util::getPost('use_treatment', 'int', 10);
|
$use_treatment = Util::getPost('use_treatment', 'int', 10);
|
||||||
|
$use_auto_nation_turn = Util::getPost('use_auto_nation_turn', 'int', 1);
|
||||||
//$detachNPC = Util::getPost('detachNPC', 'bool');
|
//$detachNPC = Util::getPost('detachNPC', 'bool');
|
||||||
$detachNPC = false;
|
$detachNPC = false;
|
||||||
|
|
||||||
@@ -53,6 +54,10 @@ if($defence_train != $me->getVar('defence_train')){
|
|||||||
|
|
||||||
$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100));
|
$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){
|
if($me->getVar('tnmt') != $tnmt){
|
||||||
$me->setVar('tnmt', $tnmt);
|
$me->setVar('tnmt', $tnmt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,12 +87,13 @@ $generalCheck = [
|
|||||||
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
||||||
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
|
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
|
||||||
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||||
'recent_war'
|
'recent_war', 'warnum', 'killnum', 'killcrew',
|
||||||
],
|
],
|
||||||
'integer'=>[
|
'integer'=>[
|
||||||
'no', 'nation', 'crew', 'crewtype', 'atmos', 'train',
|
'no', 'nation', 'crew', 'crewtype', 'atmos', 'train',
|
||||||
'intel', 'intel_exp', 'strength', 'strength_exp', 'injury', 'leadership', 'leadership_exp',
|
'intel', 'intel_exp', 'strength', 'strength_exp', 'injury', 'leadership', 'leadership_exp',
|
||||||
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||||
|
'warnum', 'killnum', 'killcrew',
|
||||||
],
|
],
|
||||||
'min'=>[
|
'min'=>[
|
||||||
['no', 1],
|
['no', 1],
|
||||||
@@ -109,6 +110,9 @@ $generalCheck = [
|
|||||||
['dex3', 0],
|
['dex3', 0],
|
||||||
['dex4', 0],
|
['dex4', 0],
|
||||||
['dex5', 0],
|
['dex5', 0],
|
||||||
|
['warnum', 0],
|
||||||
|
['killnum', 0],
|
||||||
|
['killcrew', 0],
|
||||||
],
|
],
|
||||||
'between'=>[
|
'between'=>[
|
||||||
['train', [40, GameConst::$maxTrainByWar]],
|
['train', [40, GameConst::$maxTrainByWar]],
|
||||||
@@ -148,7 +152,8 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
|
|||||||
'reason'=>"[수비자{$idx}]".$v->errorStr()
|
'reason'=>"[수비자{$idx}]".$v->errorStr()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$defenderList[] = new General($rawDefenderGeneral, null, $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
|
||||||
|
$defenderList[] = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -273,6 +278,15 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
|||||||
$startYear = $gameStor->startyear;
|
$startYear = $gameStor->startyear;
|
||||||
$cityRate = Util::round(($year - $startYear) / 1.5) + 60;
|
$cityRate = Util::round(($year - $startYear) / 1.5) + 60;
|
||||||
|
|
||||||
|
function extractRankVar(array $rawVal):array{
|
||||||
|
$rankVars = [];
|
||||||
|
foreach($rawVal as $rawKey=>$rawVal){
|
||||||
|
if(key_exists($rawKey, General::RANK_COLUMN)){
|
||||||
|
$rankVars[$rawKey] = $rawVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $rankVars;
|
||||||
|
}
|
||||||
|
|
||||||
function simulateBattle(
|
function simulateBattle(
|
||||||
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
||||||
@@ -280,7 +294,7 @@ function simulateBattle(
|
|||||||
$startYear, $year, $month, $cityRate
|
$startYear, $year, $month, $cityRate
|
||||||
){
|
){
|
||||||
$attacker = new WarUnitGeneral(
|
$attacker = new WarUnitGeneral(
|
||||||
new General($rawAttacker, null, $rawAttackerCity, $rawAttackerNation, $year, $month),
|
new General($rawAttacker, extractRankVar($rawAttacker), $rawAttackerCity, $rawAttackerNation, $year, $month),
|
||||||
$rawAttackerNation,
|
$rawAttackerNation,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@@ -312,7 +326,7 @@ function simulateBattle(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defenderObj = new General($iterDefender->current(), null, $rawDefenderCity, $rawDefenderNation, $year, $month);
|
$defenderObj = new General($iterDefender->current(), extractRankVar($iterDefender->current()), $rawDefenderCity, $rawDefenderNation, $year, $month);
|
||||||
if(extractBattleOrder($defenderObj) <= 0){
|
if(extractBattleOrder($defenderObj) <= 0){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+361
-229
@@ -1,4 +1,4 @@
|
|||||||
jQuery(function($){
|
jQuery(function($) {
|
||||||
|
|
||||||
|
|
||||||
var $generalForm = $('.form_sample .general_detail');
|
var $generalForm = $('.form_sample .general_detail');
|
||||||
@@ -9,9 +9,28 @@ jQuery(function($){
|
|||||||
|
|
||||||
var $attackerCard = $('.attacker_form');
|
var $attackerCard = $('.attacker_form');
|
||||||
|
|
||||||
var initBasicEvent = function(){
|
var initBasicEvent = function() {
|
||||||
|
|
||||||
$('.form_injury').change(function(){
|
if (window.nation) {
|
||||||
|
$('.form_city_level').val(window.city.level);
|
||||||
|
$('.form_def').val(parseInt(window.city.def));
|
||||||
|
$('.form_wall').val(parseInt(window.city.wall));
|
||||||
|
$('.form_nation_type').val(window.nation.type);
|
||||||
|
$('.form_nation_level').val(window.nation.level);
|
||||||
|
$('.form_tech').val(parseInt(window.nation.tech / 1000));
|
||||||
|
if (window.nation.capital == window.city.city) {
|
||||||
|
$('.attacker_nation .form_is_capital:first').click();
|
||||||
|
$('.defender_nation .form_is_capital:first').click();
|
||||||
|
} else {
|
||||||
|
$('.attacker_nation .form_is_capital:last').click();
|
||||||
|
$('.defender_nation .form_is_capital:last').click();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('.attacker_nation .form_is_capital:last').click();
|
||||||
|
$('.defender_nation .form_is_capital:last').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.form_injury').change(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $general = getGeneralDetail($this);
|
var $general = getGeneralDetail($this);
|
||||||
var $helptext = $general.find('.injury_helptext');
|
var $helptext = $general.find('.injury_helptext');
|
||||||
@@ -20,51 +39,48 @@ jQuery(function($){
|
|||||||
//FIXME: PHP 코드와 항상 일치하도록 변경
|
//FIXME: PHP 코드와 항상 일치하도록 변경
|
||||||
var text = '건강';
|
var text = '건강';
|
||||||
var color = 'white';
|
var color = 'white';
|
||||||
if(injury > 60){
|
if (injury > 60) {
|
||||||
text = '위독';
|
text = '위독';
|
||||||
color = 'red';
|
color = 'red';
|
||||||
}
|
} else if (injury > 40) {
|
||||||
else if(injury > 40){
|
|
||||||
text = '심각';
|
text = '심각';
|
||||||
color = 'magenta';
|
color = 'magenta';
|
||||||
}
|
} else if (injury > 20) {
|
||||||
else if(injury > 20){
|
|
||||||
text = '중상';
|
text = '중상';
|
||||||
color = 'orange';
|
color = 'orange';
|
||||||
}
|
} else if (injury > 0) {
|
||||||
else if(injury > 0){
|
|
||||||
text = '경상';
|
text = '경상';
|
||||||
color = 'yellow';
|
color = 'yellow';
|
||||||
}
|
}
|
||||||
$helptext.html(text).css('color', color);
|
$helptext.html(text).css('color', color);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.export_general').click(function(){
|
$('.export_general').click(function() {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
var $general = getGeneralDetail($btn);
|
var $general = getGeneralDetail($btn);
|
||||||
|
|
||||||
var values = exportGeneralInfo($general);
|
var values = exportGeneralInfo($general);
|
||||||
console.log(values);
|
console.log(values);
|
||||||
});
|
});
|
||||||
$('.delete-defender').click(function(){
|
$('.delete-defender').click(function() {
|
||||||
var $card = getGeneralFrame($(this));
|
var $card = getGeneralFrame($(this));
|
||||||
deleteDefender($card);
|
deleteDefender($card);
|
||||||
});
|
});
|
||||||
$('.copy-defender').click(function(){
|
$('.copy-defender').click(function() {
|
||||||
var $card = getGeneralFrame($(this));
|
var $card = getGeneralFrame($(this));
|
||||||
copyDefender($card);
|
copyDefender($card);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.add-defender').click(function(){
|
$('.add-defender').click(function() {
|
||||||
addDefender();
|
addDefender();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-general-load').click(function(){
|
$('.btn-general-load').click(function() {
|
||||||
var $file = $(this).prev();
|
var $file = $(this).prev();
|
||||||
$file[0].click();
|
$file[0].click();
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.form_load_general_file').on('change', function(e){
|
$('.form_load_general_file').on('change', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $card = getGeneralFrame($this);
|
var $card = getGeneralFrame($this);
|
||||||
@@ -75,26 +91,35 @@ jQuery(function($){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-general-save').click(function(){
|
$('.btn-general-import-server').click(function() {
|
||||||
|
var $this = $(this);
|
||||||
|
var $card = getGeneralFrame($this);
|
||||||
|
|
||||||
|
var $modal = $('#importModal');
|
||||||
|
$modal.data('target', $card);
|
||||||
|
$modal.modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-general-save').click(function() {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $general = getGeneralDetail($this);
|
var $general = getGeneralDetail($this);
|
||||||
var generalData = exportGeneralInfo($general);
|
var generalData = exportGeneralInfo($general);
|
||||||
|
|
||||||
var filename = "general_{0}.json".format(generalData.name);
|
var filename = "general_{0}.json".format(generalData.name);
|
||||||
var saveData = JSON.stringify({
|
var saveData = JSON.stringify({
|
||||||
objType:'general',
|
objType: 'general',
|
||||||
data:generalData
|
data: generalData
|
||||||
}, null, 4);
|
}, null, 4);
|
||||||
|
|
||||||
download(saveData, filename, 'application/json');
|
download(saveData, filename, 'application/json');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-battle-load').click(function(){
|
$('.btn-battle-load').click(function() {
|
||||||
var $file = $(this).prev();
|
var $file = $(this).prev();
|
||||||
$file[0].click();
|
$file[0].click();
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.form_load_battle_file').on('change', function(e){
|
$('.form_load_battle_file').on('change', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var files = e.target.files;
|
var files = e.target.files;
|
||||||
@@ -103,12 +128,12 @@ jQuery(function($){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-battle-save').click(function(){
|
$('.btn-battle-save').click(function() {
|
||||||
var battleData = exportAllData();
|
var battleData = exportAllData();
|
||||||
var filename = "battle_{0}.json".format(moment().format('YYYYMMDD_hhmmss'));
|
var filename = "battle_{0}.json".format(moment().format('YYYYMMDD_hhmmss'));
|
||||||
var saveData = JSON.stringify({
|
var saveData = JSON.stringify({
|
||||||
objType:'battle',
|
objType: 'battle',
|
||||||
data:battleData
|
data: battleData
|
||||||
}, null, 4);
|
}, null, 4);
|
||||||
|
|
||||||
download(saveData, filename, 'application/json');
|
download(saveData, filename, 'application/json');
|
||||||
@@ -119,7 +144,7 @@ jQuery(function($){
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
$generals.bind('drop', function(e){
|
$generals.bind('drop', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var $card = getGeneralFrame($this);
|
var $card = getGeneralFrame($this);
|
||||||
@@ -135,7 +160,7 @@ jQuery(function($){
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
$battlePad.bind('drop', function(e){
|
$battlePad.bind('drop', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var files = e.originalEvent.dataTransfer.files;
|
var files = e.originalEvent.dataTransfer.files;
|
||||||
@@ -145,8 +170,8 @@ jQuery(function($){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var importGeneralInfo = function($general, data){
|
var importGeneralInfo = function($general, data) {
|
||||||
var setVal = function(query, val){
|
var setVal = function(query, val) {
|
||||||
$general.find(query).val(val).change();
|
$general.find(query).val(val).change();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +179,6 @@ jQuery(function($){
|
|||||||
|
|
||||||
setVal('.form_officer_level', data.officer_level);
|
setVal('.form_officer_level', data.officer_level);
|
||||||
setVal('.form_exp_level', data.explevel);
|
setVal('.form_exp_level', data.explevel);
|
||||||
setVal('.form_injury', data.injury);
|
|
||||||
|
|
||||||
setVal('.form_leadership', data.leadership);
|
setVal('.form_leadership', data.leadership);
|
||||||
setVal('.form_general_horse', data.horse);
|
setVal('.form_general_horse', data.horse);
|
||||||
@@ -183,93 +207,103 @@ jQuery(function($){
|
|||||||
setVal('.form_dex5', data.dex5);
|
setVal('.form_dex5', data.dex5);
|
||||||
setVal('.form_defence_train', data.defence_train);
|
setVal('.form_defence_train', data.defence_train);
|
||||||
|
|
||||||
if(!setGeneralNo($general, data.no)){
|
setVal('.form_warnum', data.warnum);
|
||||||
|
setVal('.form_killnum', data.killnum);
|
||||||
|
setVal('.form_killcrew', data.killcrew);
|
||||||
|
|
||||||
|
if (!setGeneralNo($general, data.no)) {
|
||||||
setGeneralNo($general, generateNewGeneralNo());
|
setGeneralNo($general, generateNewGeneralNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var exportGeneralInfo = function($general){
|
var exportGeneralInfo = function($general) {
|
||||||
var getInt = function(query){
|
var getInt = function(query) {
|
||||||
return parseInt($general.find(query).val());
|
return parseInt($general.find(query).val());
|
||||||
}
|
}
|
||||||
|
|
||||||
var getVal = function(query){
|
var getVal = function(query) {
|
||||||
return $general.find(query).val();
|
return $general.find(query).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
no:getGeneralNo($general),
|
no: getGeneralNo($general),
|
||||||
name:getVal('.form_general_name'),
|
name: getVal('.form_general_name'),
|
||||||
officer_level:getInt('.form_officer_level'),
|
officer_level: getInt('.form_officer_level'),
|
||||||
explevel:getInt('.form_exp_level'),
|
explevel: getInt('.form_exp_level'),
|
||||||
|
|
||||||
leadership:getInt('.form_leadership'),
|
leadership: getInt('.form_leadership'),
|
||||||
horse:getVal('.form_general_horse'),
|
horse: getVal('.form_general_horse'),
|
||||||
strength:getInt('.form_strength'),
|
strength: getInt('.form_strength'),
|
||||||
weapon:getVal('.form_general_weap'),
|
weapon: getVal('.form_general_weap'),
|
||||||
intel:getInt('.form_intel'),
|
intel: getInt('.form_intel'),
|
||||||
book:getVal('.form_general_book'),
|
book: getVal('.form_general_book'),
|
||||||
item:getVal('.form_general_item'),
|
item: getVal('.form_general_item'),
|
||||||
|
|
||||||
injury:getInt('.form_injury'),
|
injury: getInt('.form_injury'),
|
||||||
|
|
||||||
rice:getInt('.form_rice'),
|
rice: getInt('.form_rice'),
|
||||||
|
|
||||||
personal:getVal('.form_general_character'),
|
personal: getVal('.form_general_character'),
|
||||||
special2:getVal('.form_general_special_war'),
|
special2: getVal('.form_general_special_war'),
|
||||||
|
|
||||||
crew:getInt('.form_crew'),
|
crew: getInt('.form_crew'),
|
||||||
crewtype:getInt('.form_crewtype'),
|
crewtype: getInt('.form_crewtype'),
|
||||||
atmos:getInt('.form_atmos'),
|
atmos: getInt('.form_atmos'),
|
||||||
train:getInt('.form_train'),
|
train: getInt('.form_train'),
|
||||||
|
|
||||||
|
dex1: getInt('.form_dex1'),
|
||||||
|
dex2: getInt('.form_dex2'),
|
||||||
|
dex3: getInt('.form_dex3'),
|
||||||
|
dex4: getInt('.form_dex4'),
|
||||||
|
dex5: getInt('.form_dex5'),
|
||||||
|
|
||||||
|
defence_train: getInt('.form_defence_train'),
|
||||||
|
|
||||||
|
warnum: getInt('.form_warnum'),
|
||||||
|
killnum: getInt('.form_killnum'),
|
||||||
|
killcrew: getInt('.form_killcrew'),
|
||||||
|
|
||||||
dex1:getInt('.form_dex1'),
|
|
||||||
dex2:getInt('.form_dex2'),
|
|
||||||
dex3:getInt('.form_dex3'),
|
|
||||||
dex4:getInt('.form_dex4'),
|
|
||||||
dex5:getInt('.form_dex5'),
|
|
||||||
defence_train:getInt('.form_defence_train'),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var importBattleInfoByFile = function(files){
|
var importBattleInfoByFile = function(files) {
|
||||||
if(files === null){
|
if (files === null) {
|
||||||
alert('파일 에러!');
|
alert('파일 에러!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files.length < 1){
|
if (files.length < 1) {
|
||||||
alert("파일 에러!");
|
alert("파일 에러!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var file = files[0];
|
var file = files[0];
|
||||||
if(file.size > 1024*1024){
|
if (file.size > 1024 * 1024) {
|
||||||
alert('파일이 너무 큽니다!');
|
alert('파일이 너무 큽니다!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(file.type === ''){
|
if (file.type === '') {
|
||||||
alert('폴더를 업로드할 수 없습니다!');
|
alert('폴더를 업로드할 수 없습니다!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function(){
|
reader.onload = function() {
|
||||||
var battleData = {};
|
var battleData = {};
|
||||||
try {
|
try {
|
||||||
battleData = JSON.parse(reader.result);
|
battleData = JSON.parse(reader.result);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
alert('올바르지 않은 파일 형식입니다');
|
alert('올바르지 않은 파일 형식입니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!('objType' in battleData)){
|
if (!('objType' in battleData)) {
|
||||||
alert('파일 형식을 확인할 수 없습니다');
|
alert('파일 형식을 확인할 수 없습니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(battleData.objType != 'battle'){
|
if (battleData.objType != 'battle') {
|
||||||
alert('전투 데이터가 아닙니다');
|
alert('전투 데이터가 아닙니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -281,8 +315,7 @@ jQuery(function($){
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
}
|
} catch (e) {
|
||||||
catch(e) {
|
|
||||||
alert('파일을 읽는데 실패했습니다.');
|
alert('파일을 읽는데 실패했습니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -290,52 +323,52 @@ jQuery(function($){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var importGeneralInfoByFile = function(files, $card){
|
var importGeneralInfoByFile = function(files, $card) {
|
||||||
if($card === undefined){
|
if ($card === undefined) {
|
||||||
$card = addDefender();
|
$card = addDefender();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files === null){
|
if (files === null) {
|
||||||
alert('파일 에러!');
|
alert('파일 에러!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(files.length < 1){
|
if (files.length < 1) {
|
||||||
alert("파일 에러!");
|
alert("파일 에러!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var file = files[0];
|
var file = files[0];
|
||||||
if(file.size > 1024*1024){
|
if (file.size > 1024 * 1024) {
|
||||||
alert('파일이 너무 큽니다!');
|
alert('파일이 너무 큽니다!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(file.type === ''){
|
if (file.type === '') {
|
||||||
alert('폴더를 업로드할 수 없습니다!');
|
alert('폴더를 업로드할 수 없습니다!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function(){
|
reader.onload = function() {
|
||||||
var generalData = {};
|
var generalData = {};
|
||||||
try {
|
try {
|
||||||
generalData = JSON.parse(reader.result);
|
generalData = JSON.parse(reader.result);
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
alert('올바르지 않은 파일 형식입니다');
|
alert('올바르지 않은 파일 형식입니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!('objType' in generalData)){
|
if (!('objType' in generalData)) {
|
||||||
alert('파일 형식을 확인할 수 없습니다');
|
alert('파일 형식을 확인할 수 없습니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(generalData.objType == 'battle'){
|
if (generalData.objType == 'battle') {
|
||||||
importBattleInfo(generalData.data);
|
importBattleInfo(generalData.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(generalData.objType != 'general'){
|
if (generalData.objType != 'general') {
|
||||||
alert('장수 데이터가 아닙니다');
|
alert('장수 데이터가 아닙니다');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -349,8 +382,7 @@ jQuery(function($){
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
}
|
} catch (e) {
|
||||||
catch(e) {
|
|
||||||
alert('파일을 읽는데 실패했습니다.');
|
alert('파일을 읽는데 실패했습니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -358,49 +390,49 @@ jQuery(function($){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var extendGeneralInfoForDB = function(generalData){
|
var extendGeneralInfoForDB = function(generalData) {
|
||||||
|
|
||||||
var dbVal = {
|
var dbVal = {
|
||||||
nation: (generalData.no)<=1 ? 1 : 2,
|
nation: (generalData.no) <= 1 ? 1 : 2,
|
||||||
city: (generalData.no)<=1 ? 1 : 3,
|
city: (generalData.no) <= 1 ? 1 : 3,
|
||||||
turntime:'2018-08-26 12:00',
|
turntime: '2018-08-26 12:00',
|
||||||
special:defaultSpecialDomestic,
|
special: defaultSpecialDomestic,
|
||||||
leadership_exp:0,
|
leadership_exp: 0,
|
||||||
strength_exp:0,
|
strength_exp: 0,
|
||||||
intel_exp:0,
|
intel_exp: 0,
|
||||||
|
|
||||||
gold:10000,
|
gold: 10000,
|
||||||
|
|
||||||
dedication:0,
|
dedication: 0,
|
||||||
|
|
||||||
recent_war:'2018-08-26 12:00',
|
recent_war: '2018-08-26 12:00',
|
||||||
experience:Math.pow(generalData.explevel, 2),
|
experience: Math.pow(generalData.explevel, 2),
|
||||||
};
|
};
|
||||||
|
|
||||||
return $.extend({}, generalData, dbVal);
|
return $.extend({}, generalData, dbVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
var getGeneralFrame = function($btn){
|
var getGeneralFrame = function($btn) {
|
||||||
var $card = $btn.closest('.general_form');
|
var $card = $btn.closest('.general_form');
|
||||||
return $card;
|
return $card;
|
||||||
}
|
}
|
||||||
|
|
||||||
var getGeneralDetail = function($btn){
|
var getGeneralDetail = function($btn) {
|
||||||
var $card = getGeneralFrame($btn);
|
var $card = getGeneralFrame($btn);
|
||||||
var $general = $card.find('.general_detail');
|
var $general = $card.find('.general_detail');
|
||||||
return $general;
|
return $general;
|
||||||
}
|
}
|
||||||
|
|
||||||
var getGeneralNo = function($btn){
|
var getGeneralNo = function($btn) {
|
||||||
return parseInt(getGeneralFrame($btn).data('general_no'));
|
return parseInt(getGeneralFrame($btn).data('general_no'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var setGeneralNo = function($btn, value){
|
var setGeneralNo = function($btn, value) {
|
||||||
if(value == 1){
|
if (value == 1) {
|
||||||
//1번은 무조건 공격자임
|
//1번은 무조건 공격자임
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(value in defenderNoList){
|
if (value in defenderNoList) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var $card = getGeneralFrame($btn);
|
var $card = getGeneralFrame($btn);
|
||||||
@@ -409,35 +441,34 @@ jQuery(function($){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var generateNewGeneralNo = function(){
|
var generateNewGeneralNo = function() {
|
||||||
while(true){
|
while (true) {
|
||||||
var newGeneralNo = parseInt(Math.random()*(1<<24))+2;
|
var newGeneralNo = parseInt(Math.random() * (1 << 24)) + 2;
|
||||||
if(newGeneralNo in defenderNoList){
|
if (newGeneralNo in defenderNoList) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return newGeneralNo;
|
return newGeneralNo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var deleteGeneralNo = function($btn){
|
var deleteGeneralNo = function($btn) {
|
||||||
var $card = getGeneralFrame($btn);
|
var $card = getGeneralFrame($btn);
|
||||||
$card.removeData('general_no');
|
$card.removeData('general_no');
|
||||||
var generalNo = getGeneralNo($card);
|
var generalNo = getGeneralNo($card);
|
||||||
delete defenderNoList[generalNo];
|
delete defenderNoList[generalNo];
|
||||||
}
|
}
|
||||||
|
|
||||||
var addDefender = function($cardAfter){
|
var addDefender = function($cardAfter) {
|
||||||
var $newCard = $('<div class="card mb-2 defender_form general_form"></div>');
|
var $newCard = $('<div class="card mb-2 defender_form general_form"></div>');
|
||||||
|
|
||||||
if($cardAfter === undefined){
|
if ($cardAfter === undefined) {
|
||||||
$defenderColumn.append($newCard);
|
$defenderColumn.append($newCard);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$cardAfter.after($newCard);
|
$cardAfter.after($newCard);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newCard.append($defenderHeaderForm.clone(true,true));
|
$newCard.append($defenderHeaderForm.clone(true, true));
|
||||||
$newCard.append($generalForm.clone(true,true));
|
$newCard.append($generalForm.clone(true, true));
|
||||||
|
|
||||||
$newGeneral = getGeneralDetail($newCard);
|
$newGeneral = getGeneralDetail($newCard);
|
||||||
setGeneralNo($newCard, generateNewGeneralNo());
|
setGeneralNo($newCard, generateNewGeneralNo());
|
||||||
@@ -445,12 +476,12 @@ jQuery(function($){
|
|||||||
return $newCard;
|
return $newCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
var deleteDefender = function($card){
|
var deleteDefender = function($card) {
|
||||||
deleteGeneralNo($card);
|
deleteGeneralNo($card);
|
||||||
$card.detach();
|
$card.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
var copyDefender = function($card){
|
var copyDefender = function($card) {
|
||||||
var $general = getGeneralDetail($card);
|
var $general = getGeneralDetail($card);
|
||||||
|
|
||||||
var generalData = exportGeneralInfo($general);
|
var generalData = exportGeneralInfo($general);
|
||||||
@@ -458,7 +489,7 @@ jQuery(function($){
|
|||||||
importGeneralInfo(getGeneralDetail($newObj), generalData);
|
importGeneralInfo(getGeneralDetail($newObj), generalData);
|
||||||
}
|
}
|
||||||
|
|
||||||
var importBattleInfo = function(battleData){
|
var importBattleInfo = function(battleData) {
|
||||||
|
|
||||||
$('.form_load_battle_file').val('');
|
$('.form_load_battle_file').val('');
|
||||||
console.log(battleData);
|
console.log(battleData);
|
||||||
@@ -481,12 +512,11 @@ jQuery(function($){
|
|||||||
$('.delete-defender').click();
|
$('.delete-defender').click();
|
||||||
|
|
||||||
$attackerNation.find('.form_nation_type').val(attackerNation.type);
|
$attackerNation.find('.form_nation_type').val(attackerNation.type);
|
||||||
$attackerNation.find('.form_tech').val(Math.floor(attackerNation.tech/1000));
|
$attackerNation.find('.form_tech').val(Math.floor(attackerNation.tech / 1000));
|
||||||
$attackerNation.find('.form_nation_level').val(attackerNation.level);
|
$attackerNation.find('.form_nation_level').val(attackerNation.level);
|
||||||
if(attackerNation.capital == 1){
|
if (attackerNation.capital == 1) {
|
||||||
$attackerNation.find('.form_is_capital:first').click();
|
$attackerNation.find('.form_is_capital:first').click();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$attackerNation.find('.form_is_capital:last').click();
|
$attackerNation.find('.form_is_capital:last').click();
|
||||||
}
|
}
|
||||||
$attackerNation.find('.form_city_level').val(attackerCity.level);
|
$attackerNation.find('.form_city_level').val(attackerCity.level);
|
||||||
@@ -494,56 +524,55 @@ jQuery(function($){
|
|||||||
importGeneralInfo($('.attacker_form'), attackerGeneral);
|
importGeneralInfo($('.attacker_form'), attackerGeneral);
|
||||||
|
|
||||||
$defenderNation.find('.form_nation_type').val(defenderNation.type);
|
$defenderNation.find('.form_nation_type').val(defenderNation.type);
|
||||||
$defenderNation.find('.form_tech').val(Math.floor(defenderNation.tech/1000));
|
$defenderNation.find('.form_tech').val(Math.floor(defenderNation.tech / 1000));
|
||||||
$defenderNation.find('.form_nation_level').val(defenderNation.level);
|
$defenderNation.find('.form_nation_level').val(defenderNation.level);
|
||||||
if(defenderNation.capital == 1){
|
if (defenderNation.capital == 1) {
|
||||||
$defenderNation.find('.form_is_capital:first').click();
|
$defenderNation.find('.form_is_capital:first').click();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$defenderNation.find('.form_is_capital:last').click();
|
$defenderNation.find('.form_is_capital:last').click();
|
||||||
}
|
}
|
||||||
$defenderNation.find('.form_city_level').val(defenderCity.level);
|
$defenderNation.find('.form_city_level').val(defenderCity.level);
|
||||||
$('#city_def').val(defenderCity.def);
|
$('#city_def').val(defenderCity.def);
|
||||||
$('#city_wall').val(defenderCity.wall);
|
$('#city_wall').val(defenderCity.wall);
|
||||||
|
|
||||||
$.each(defenderGenerals, function(idx, defenderGeneral){
|
$.each(defenderGenerals, function(idx, defenderGeneral) {
|
||||||
var $card = addDefender();
|
var $card = addDefender();
|
||||||
importGeneralInfo($card, defenderGeneral);
|
importGeneralInfo($card, defenderGeneral);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var exportAllData = function(){
|
var exportAllData = function() {
|
||||||
var $attackerNation = $('.attacker_nation');
|
var $attackerNation = $('.attacker_nation');
|
||||||
var $defenderNation = $('.defender_nation');
|
var $defenderNation = $('.defender_nation');
|
||||||
|
|
||||||
var attackerGeneral = exportGeneralInfo($('.attacker_form'));
|
var attackerGeneral = exportGeneralInfo($('.attacker_form'));
|
||||||
|
|
||||||
var attackerCity = {
|
var attackerCity = {
|
||||||
level:parseInt($attackerNation.find('.form_city_level').val()),
|
level: parseInt($attackerNation.find('.form_city_level').val()),
|
||||||
};
|
};
|
||||||
|
|
||||||
var attackerNation = {
|
var attackerNation = {
|
||||||
type:$attackerNation.find('.form_nation_type').val(),
|
type: $attackerNation.find('.form_nation_type').val(),
|
||||||
tech:parseInt($attackerNation.find('.form_tech').val()) * 1000,
|
tech: parseInt($attackerNation.find('.form_tech').val()) * 1000,
|
||||||
level:parseInt($attackerNation.find('.form_nation_level').val()),
|
level: parseInt($attackerNation.find('.form_nation_level').val()),
|
||||||
capital:$attackerNation.find('.form_is_capital:checked').val()=='1'?1:2,
|
capital: $attackerNation.find('.form_is_capital:checked').val() == '1' ? 1 : 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
var defenderGenerals = $('.defender_form').map(function(){
|
var defenderGenerals = $('.defender_form').map(function() {
|
||||||
return exportGeneralInfo($(this));
|
return exportGeneralInfo($(this));
|
||||||
}).toArray();
|
}).toArray();
|
||||||
|
|
||||||
var defenderCity = {
|
var defenderCity = {
|
||||||
def: parseInt($('#city_def').val()),
|
def: parseInt($('#city_def').val()),
|
||||||
wall: parseInt($('#city_wall').val()),
|
wall: parseInt($('#city_wall').val()),
|
||||||
level:parseInt($defenderNation.find('.form_city_level').val()),
|
level: parseInt($defenderNation.find('.form_city_level').val()),
|
||||||
};
|
};
|
||||||
|
|
||||||
var defenderNation = {
|
var defenderNation = {
|
||||||
type:$defenderNation.find('.form_nation_type').val(),
|
type: $defenderNation.find('.form_nation_type').val(),
|
||||||
tech:parseInt($defenderNation.find('.form_tech').val()) * 1000,
|
tech: parseInt($defenderNation.find('.form_tech').val()) * 1000,
|
||||||
level:parseInt($defenderNation.find('.form_nation_level').val()),
|
level: parseInt($defenderNation.find('.form_nation_level').val()),
|
||||||
capital:$defenderNation.find('.form_is_capital:checked').val()=='1'?3:4,
|
capital: $defenderNation.find('.form_is_capital:checked').val() == '1' ? 3 : 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
var year = parseInt($('#year').val());
|
var year = parseInt($('#year').val());
|
||||||
@@ -551,59 +580,59 @@ jQuery(function($){
|
|||||||
var repeatCnt = parseInt($('#repeat_cnt').val());
|
var repeatCnt = parseInt($('#repeat_cnt').val());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
attackerGeneral:attackerGeneral,
|
attackerGeneral: attackerGeneral,
|
||||||
attackerCity:attackerCity,
|
attackerCity: attackerCity,
|
||||||
attackerNation:attackerNation,
|
attackerNation: attackerNation,
|
||||||
|
|
||||||
defenderGenerals:defenderGenerals,
|
defenderGenerals: defenderGenerals,
|
||||||
defenderCity:defenderCity,
|
defenderCity: defenderCity,
|
||||||
defenderNation:defenderNation,
|
defenderNation: defenderNation,
|
||||||
|
|
||||||
year:year,
|
year: year,
|
||||||
month:month,
|
month: month,
|
||||||
repeatCnt:repeatCnt,
|
repeatCnt: repeatCnt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var extendAllDataForDB = function(allData){
|
var extendAllDataForDB = function(allData) {
|
||||||
var defaultNation = {
|
var defaultNation = {
|
||||||
nation:0,
|
nation: 0,
|
||||||
name:'재야',
|
name: '재야',
|
||||||
capital:0,
|
capital: 0,
|
||||||
level:0,
|
level: 0,
|
||||||
gold:0,
|
gold: 0,
|
||||||
rice:2000,
|
rice: 2000,
|
||||||
type:'None',
|
type: 'None',
|
||||||
tech:0,
|
tech: 0,
|
||||||
gennum:200,
|
gennum: 200,
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultCity = {
|
var defaultCity = {
|
||||||
nation:0,
|
nation: 0,
|
||||||
supply:1,
|
supply: 1,
|
||||||
name:'도시',
|
name: '도시',
|
||||||
|
|
||||||
pop:500000,
|
pop: 500000,
|
||||||
agri:10000,
|
agri: 10000,
|
||||||
comm:10000,
|
comm: 10000,
|
||||||
secu:10000,
|
secu: 10000,
|
||||||
def:1000,
|
def: 1000,
|
||||||
wall:1000,
|
wall: 1000,
|
||||||
|
|
||||||
trust:100,
|
trust: 100,
|
||||||
|
|
||||||
pop_max:600000,
|
pop_max: 600000,
|
||||||
agri_max:12000,
|
agri_max: 12000,
|
||||||
comm_max:12000,
|
comm_max: 12000,
|
||||||
secu_max:10000,
|
secu_max: 10000,
|
||||||
def_max:12000,
|
def_max: 12000,
|
||||||
wall_max:12000,
|
wall_max: 12000,
|
||||||
|
|
||||||
dead:0,
|
dead: 0,
|
||||||
|
|
||||||
state:0,
|
state: 0,
|
||||||
|
|
||||||
conflict:'{}',
|
conflict: '{}',
|
||||||
};
|
};
|
||||||
|
|
||||||
var attackerNation = $.extend({}, defaultNation, allData.attackerNation);
|
var attackerNation = $.extend({}, defaultNation, allData.attackerNation);
|
||||||
@@ -615,10 +644,9 @@ jQuery(function($){
|
|||||||
attackerCity.city = 1;
|
attackerCity.city = 1;
|
||||||
|
|
||||||
var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral);
|
var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral);
|
||||||
if(2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4){
|
if (2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4) {
|
||||||
attackerGeneral.officer_city = 1;
|
attackerGeneral.officer_city = 1;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
attackerGeneral.officer_city = 0;
|
attackerGeneral.officer_city = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,16 +657,15 @@ jQuery(function($){
|
|||||||
var defenderCity = $.extend({}, defaultCity, allData.defenderCity);
|
var defenderCity = $.extend({}, defaultCity, allData.defenderCity);
|
||||||
defenderCity.nation = 2;
|
defenderCity.nation = 2;
|
||||||
defenderCity.city = 3;
|
defenderCity.city = 3;
|
||||||
defenderCity.wall_max = defenderCity.wall/5*6;
|
defenderCity.wall_max = parseInt(defenderCity.wall / 5 * 6);
|
||||||
defenderCity.def_max = defenderCity.def/5*6;
|
defenderCity.def_max = parseInt(defenderCity.def / 5 * 6);
|
||||||
|
|
||||||
var defenderGenerals = [];
|
var defenderGenerals = [];
|
||||||
$.each(allData.defenderGenerals, function(){
|
$.each(allData.defenderGenerals, function() {
|
||||||
var defenderGeneral = extendGeneralInfoForDB(this);
|
var defenderGeneral = extendGeneralInfoForDB(this);
|
||||||
if(2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4){
|
if (2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4) {
|
||||||
defenderGeneral.officer_city = 3;
|
defenderGeneral.officer_city = 3;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
defenderGeneral.officer_city = 0;
|
defenderGeneral.officer_city = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,58 +674,55 @@ jQuery(function($){
|
|||||||
|
|
||||||
|
|
||||||
return $.extend({}, allData, {
|
return $.extend({}, allData, {
|
||||||
attackerGeneral:attackerGeneral,
|
attackerGeneral: attackerGeneral,
|
||||||
attackerCity:attackerCity,
|
attackerCity: attackerCity,
|
||||||
attackerNation:attackerNation,
|
attackerNation: attackerNation,
|
||||||
|
|
||||||
defenderGenerals:defenderGenerals,
|
defenderGenerals: defenderGenerals,
|
||||||
defenderCity:defenderCity,
|
defenderCity: defenderCity,
|
||||||
defenderNation:defenderNation,
|
defenderNation: defenderNation,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseSkillCount = function(skills){
|
var parseSkillCount = function(skills) {
|
||||||
var result = [];
|
var result = [];
|
||||||
$.each(skills, function(key, value){
|
$.each(skills, function(key, value) {
|
||||||
result.push("{0}({1}회)".format(key, toPretty(value)));
|
result.push("{0}({1}회)".format(key, toPretty(value)));
|
||||||
})
|
})
|
||||||
|
|
||||||
if(result.length == 0){
|
if (result.length == 0) {
|
||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
return result.join(', ');
|
return result.join(', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
var toPretty = function(number){
|
var toPretty = function(number) {
|
||||||
if(isInt(number)){
|
if (isInt(number)) {
|
||||||
number = parseInt(number);
|
number = parseInt(number);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
number = parseFloat(number).toFixed(2);
|
number = parseFloat(number).toFixed(2);
|
||||||
}
|
}
|
||||||
return numberWithCommas(number);
|
return numberWithCommas(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
var showBattleResult = function(result){
|
var showBattleResult = function(result) {
|
||||||
$('#result_datetime').html(result.datetime);
|
$('#result_datetime').html(result.datetime);
|
||||||
$('#result_warcnt').html(toPretty(result.avgWar));
|
$('#result_warcnt').html(toPretty(result.avgWar));
|
||||||
$('#result_phase').html(toPretty(result.phase));
|
$('#result_phase').html(toPretty(result.phase));
|
||||||
$('#result_killed').html(toPretty(result.killed));
|
$('#result_killed').html(toPretty(result.killed));
|
||||||
if(result.minKilled != result.maxKilled){
|
if (result.minKilled != result.maxKilled) {
|
||||||
$('#result_maxKilled').html(toPretty(result.maxKilled));
|
$('#result_maxKilled').html(toPretty(result.maxKilled));
|
||||||
$('#result_minKilled').html(toPretty(result.minKilled));
|
$('#result_minKilled').html(toPretty(result.minKilled));
|
||||||
$('#result_varKilled').show();
|
$('#result_varKilled').show();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$('#result_varKilled').hide();
|
$('#result_varKilled').hide();
|
||||||
}
|
}
|
||||||
$('#result_dead').html(toPretty(result.dead));
|
$('#result_dead').html(toPretty(result.dead));
|
||||||
if(result.minDead != result.maxDead){
|
if (result.minDead != result.maxDead) {
|
||||||
$('#result_maxDead').html(toPretty(result.maxDead));
|
$('#result_maxDead').html(toPretty(result.maxDead));
|
||||||
$('#result_minDead').html(toPretty(result.minDead));
|
$('#result_minDead').html(toPretty(result.minDead));
|
||||||
$('#result_varDead').show();
|
$('#result_varDead').show();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$('#result_varDead').hide();
|
$('#result_varDead').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,7 +734,7 @@ jQuery(function($){
|
|||||||
|
|
||||||
var $summary = $('#battle_result_summary');
|
var $summary = $('#battle_result_summary');
|
||||||
|
|
||||||
$.each(result.defendersSkills, function(idx, defenderSkills){
|
$.each(result.defendersSkills, function(idx, defenderSkills) {
|
||||||
console.log(defenderSkills);
|
console.log(defenderSkills);
|
||||||
var $result = $("<tr class='result_defenderSkills'><th>수비자{0} 스킬</th><td></td></tr>".format(idx + 1));
|
var $result = $("<tr class='result_defenderSkills'><th>수비자{0} 스킬</th><td></td></tr>".format(idx + 1));
|
||||||
$result.find('td').html(parseSkillCount(defenderSkills));
|
$result.find('td').html(parseSkillCount(defenderSkills));
|
||||||
@@ -722,35 +746,35 @@ jQuery(function($){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var beginBattle = function(){
|
var beginBattle = function() {
|
||||||
var data = extendAllDataForDB(exportAllData());
|
var data = extendAllDataForDB(exportAllData());
|
||||||
console.log(data);
|
console.log(data);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:'post',
|
type: 'post',
|
||||||
url:'j_simulate_battle.php',
|
url: 'j_simulate_battle.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
action:'battle',
|
action: 'battle',
|
||||||
query:JSON.stringify(data),
|
query: JSON.stringify(data),
|
||||||
}
|
}
|
||||||
}).then(function(result){
|
}).then(function(result) {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if(!result.result){
|
if (!result.result) {
|
||||||
alert(result.reason);
|
alert(result.reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showBattleResult(result);
|
showBattleResult(result);
|
||||||
|
|
||||||
}, function(result){
|
}, function(result) {
|
||||||
alert('전투 개시 실패!');
|
alert('전투 개시 실패!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var reorderDefender = function(defenderOrder){
|
var reorderDefender = function(defenderOrder) {
|
||||||
$.each(defenderOrder, function(idx, generalNo){
|
$.each(defenderOrder, function(idx, generalNo) {
|
||||||
|
|
||||||
if(!(generalNo in defenderNoList)){
|
if (!(generalNo in defenderNoList)) {
|
||||||
//음..?
|
//음..?
|
||||||
alert("{0}이 수비자 리스트에 없습니다. 버그인 듯 합니다.".format(generalNo));
|
alert("{0}이 수비자 리스트에 없습니다. 버그인 듯 합니다.".format(generalNo));
|
||||||
return true;
|
return true;
|
||||||
@@ -762,39 +786,147 @@ jQuery(function($){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var requestReorderDefender = function(){
|
var requestReorderDefender = function() {
|
||||||
var data = extendAllDataForDB(exportAllData());
|
var data = extendAllDataForDB(exportAllData());
|
||||||
console.log(data);
|
console.log(data);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:'post',
|
type: 'post',
|
||||||
url:'j_simulate_battle.php',
|
url: 'j_simulate_battle.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
action:'reorder',
|
action: 'reorder',
|
||||||
query:JSON.stringify(data),
|
query: JSON.stringify(data),
|
||||||
}
|
}
|
||||||
}).then(function(result){
|
}).then(function(result) {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
if(!result.result){
|
if (!result.result) {
|
||||||
alert(result.reason);
|
alert(result.reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reorderDefender(result.order);
|
reorderDefender(result.order);
|
||||||
|
|
||||||
}, function(result){
|
}, function(result) {
|
||||||
alert('재정렬 실패!');
|
alert('재정렬 실패!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var initGeneralList = false;
|
||||||
|
|
||||||
|
$('#importFromDB').click(function() {
|
||||||
|
var generalID = $('#modalSelector').val();
|
||||||
|
console.log(generalID);
|
||||||
|
|
||||||
|
|
||||||
|
$.post({
|
||||||
|
url: 'j_export_simulator_object.php',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
destGeneralID: generalID
|
||||||
|
}
|
||||||
|
}).then(function(data) {
|
||||||
|
|
||||||
|
if (!data.result) {
|
||||||
|
alert(data.reason);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var $modal = $('#importModal');
|
||||||
|
var $card = $modal.data('target');
|
||||||
|
importGeneralInfo($card, data.general);
|
||||||
|
|
||||||
|
$modal.modal('hide');
|
||||||
|
}, errUnknown);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#importModal').on('show.bs.modal', function(e) {
|
||||||
|
if (!initGeneralList) {
|
||||||
|
var $list = $('#modalSelector');
|
||||||
|
|
||||||
|
var addNation = function(generalList, nationName, color) {
|
||||||
|
|
||||||
|
generalList.sort(function(lhs, rhs) {
|
||||||
|
if (lhs.npc != rhs.npc) {
|
||||||
|
return lhs.npc - rhs.npc;
|
||||||
|
}
|
||||||
|
if (lhs.name < rhs.name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (lhs.name > rhs.name) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
})
|
||||||
|
var $optGroup = $('<optgroup label="{0}"></optgroup>'.format(nationName));
|
||||||
|
$optGroup.css('background-color', color);
|
||||||
|
$optGroup.css('color', isBrightColor(color) ? 'black' : 'white');
|
||||||
|
|
||||||
|
$.each(generalList, function(idx, general) {
|
||||||
|
$item = $('<option value="{0}">{1}</option>'.format(general.no, general.name));
|
||||||
|
if (general.npc) {
|
||||||
|
$item.css('color', getNpcColor(general.npc));
|
||||||
|
} else {
|
||||||
|
$item.css('color', 'white');
|
||||||
|
}
|
||||||
|
$item.css('background-color', 'black');
|
||||||
|
$optGroup.append($item);
|
||||||
|
|
||||||
|
});
|
||||||
|
$list.append($optGroup);
|
||||||
|
}
|
||||||
|
$.post({
|
||||||
|
url: 'j_get_basic_general_list.php',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
req: 2,
|
||||||
|
}
|
||||||
|
}).then(function(data) {
|
||||||
|
if (!data.result) {
|
||||||
|
alert(data.reason);
|
||||||
|
$('#importModal').modal('hide');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var nations = data.nation;
|
||||||
|
var myNationID = data.nationID;
|
||||||
|
|
||||||
|
$list.empty();
|
||||||
|
//자국 먼저
|
||||||
|
|
||||||
|
if (0 in data.list) {
|
||||||
|
nations[0] = {
|
||||||
|
nation: 0,
|
||||||
|
name: '재야',
|
||||||
|
color: '#000000'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
addNation(combineArray(data.list[myNationID], data.column), nations[myNationID].name, nations[myNationID].color);
|
||||||
|
|
||||||
|
for (var nationID in data.list) {
|
||||||
|
if (nationID == myNationID) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
addNation(combineArray(data.list[nationID], data.column), nations[nationID].name, nations[nationID].color);
|
||||||
|
}
|
||||||
|
initGeneralList = true;
|
||||||
|
}, errUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
initBasicEvent();
|
initBasicEvent();
|
||||||
$attackerCard.append($generalForm.clone(true,true));
|
$attackerCard.append($generalForm.clone(true, true));
|
||||||
addDefender();
|
addDefender();
|
||||||
|
|
||||||
$('.btn-begin_battle').click(function(){
|
$('.btn-begin_battle').click(function() {
|
||||||
beginBattle();
|
beginBattle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn-reorder_defender').click(function(){
|
$('.btn-reorder_defender').click(function() {
|
||||||
requestReorderDefender();
|
requestReorderDefender();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
+66
-72
@@ -1,26 +1,26 @@
|
|||||||
function changePermission(isAmbassador, rawGeneralList){
|
function changePermission(isAmbassador, rawGeneralList) {
|
||||||
console.log(isAmbassador);
|
console.log(isAmbassador);
|
||||||
console.log(rawGeneralList);
|
console.log(rawGeneralList);
|
||||||
|
|
||||||
var generalList = [];
|
var generalList = [];
|
||||||
$.each(rawGeneralList, function(idx, value){
|
$.each(rawGeneralList, function(idx, value) {
|
||||||
generalList.push(parseInt(value.id));
|
generalList.push(parseInt(value.id));
|
||||||
})
|
})
|
||||||
|
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_general_set_permission.php',
|
url: 'j_general_set_permission.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
isAmbassador:isAmbassador,
|
isAmbassador: isAmbassador,
|
||||||
genlist:generalList
|
genlist: generalList
|
||||||
},
|
},
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
alert('변경하지 못했습니다.');
|
alert('변경하지 못했습니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
alert('변경하지 못했습니다. : '+data.reason);
|
alert('변경하지 못했습니다. : ' + data.reason);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
alert('변경했습니다.');
|
alert('변경했습니다.');
|
||||||
@@ -28,19 +28,19 @@ function changePermission(isAmbassador, rawGeneralList){
|
|||||||
}, errUnknown);
|
}, errUnknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#selectAmbassador').select2({
|
$('#selectAmbassador').select2({
|
||||||
theme: 'bootstrap4',
|
theme: 'bootstrap4',
|
||||||
placeholder: "",
|
placeholder: "",
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
language: "ko",
|
language: "ko",
|
||||||
width:300,
|
width: 300,
|
||||||
maximumSelectionLength: 2,
|
maximumSelectionLength: 2,
|
||||||
containerCss: {
|
containerCss: {
|
||||||
display: "inline-block !important;",
|
display: "inline-block !important;",
|
||||||
color: 'white !important'
|
color: 'white !important'
|
||||||
},
|
},
|
||||||
data:candidateAmbassadors,
|
data: candidateAmbassadors,
|
||||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
});
|
});
|
||||||
@@ -50,19 +50,19 @@ $(function(){
|
|||||||
placeholder: "",
|
placeholder: "",
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
language: "ko",
|
language: "ko",
|
||||||
width:300,
|
width: 300,
|
||||||
maximumSelectionLength: 2,
|
maximumSelectionLength: 2,
|
||||||
containerCss: {
|
containerCss: {
|
||||||
display: "inline-block !important;",
|
display: "inline-block !important;",
|
||||||
color: 'white !important'
|
color: 'white !important'
|
||||||
},
|
},
|
||||||
data:candidateAuditors,
|
data: candidateAuditors,
|
||||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#changeAmbassador').click(function(){
|
$('#changeAmbassador').click(function() {
|
||||||
if(!confirm('외교권자를 변경할까요?')){
|
if (!confirm('외교권자를 변경할까요?')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +70,8 @@ $(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#changeAuditor').click(function(){
|
$('#changeAuditor').click(function() {
|
||||||
if(!confirm('조언자를 변경할까요?')){
|
if (!confirm('조언자를 변경할까요?')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,31 +79,31 @@ $(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_kick').click(function(){
|
$('#btn_kick').click(function() {
|
||||||
var $kickSelect = $('#genlist_kick option:selected');
|
var $kickSelect = $('#genlist_kick option:selected');
|
||||||
var generalID = $kickSelect.val();
|
var generalID = $kickSelect.val();
|
||||||
if(!generalID){
|
if (!generalID) {
|
||||||
alert('장수를 선택해주세요');
|
alert('장수를 선택해주세요');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var generalName = $kickSelect.data('name');
|
var generalName = $kickSelect.data('name');
|
||||||
if(!confirm('{0}를 추방하시겠습니까?'.format(generalName))){
|
if (!confirm('{0}를 추방하시겠습니까?'.format(generalName))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_myBossInfo.php',
|
url: 'j_myBossInfo.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
action:'추방',
|
action: '추방',
|
||||||
destGeneralID:generalID
|
destGeneralID: generalID
|
||||||
},
|
},
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
alert('추방하지 못했습니다.');
|
alert('추방하지 못했습니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
alert('추방하지 못했습니다. : '+data.reason);
|
alert('추방하지 못했습니다. : ' + data.reason);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
alert('{0}를 추방했습니다.'.format(generalName));
|
alert('{0}를 추방했습니다.'.format(generalName));
|
||||||
@@ -112,7 +112,7 @@ $(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btn_appoint').click(function(){
|
$('.btn_appoint').click(function() {
|
||||||
var $btn = $(this);
|
var $btn = $(this);
|
||||||
var officerLevel = $btn.data('officer_level');
|
var officerLevel = $btn.data('officer_level');
|
||||||
var officerLevelText = $btn.data('officer_level_text');
|
var officerLevelText = $btn.data('officer_level_text');
|
||||||
@@ -121,76 +121,70 @@ $(function(){
|
|||||||
var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel));
|
var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel));
|
||||||
var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel));
|
var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel));
|
||||||
|
|
||||||
var generalID = $generalSelect.val();
|
var generalID = parseInt($generalSelect.val());
|
||||||
var generalName = $generalSelect.data('name');
|
var generalName = $generalSelect.data('name');
|
||||||
var generalOfficerLevel = $generalSelect.data('officer_level');
|
var generalOfficerLevel = $generalSelect.data('officer_level');
|
||||||
|
|
||||||
|
|
||||||
if(officerLevel >= 5){
|
if (officerLevel >= 5) {
|
||||||
if(generalID == 0){
|
if (generalID == 0) {
|
||||||
if(!confirm('{0}직을 비우시겠습니까?'.format(officerLevelText))){
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(generalOfficerLevel >= 5){
|
} else {
|
||||||
if(!confirm('이미 수뇌인 {0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if(!confirm('{0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
cityID = $citySelect.val();
|
cityID = $citySelect.val();
|
||||||
if(!cityID){
|
if (!cityID) {
|
||||||
alert('도시를 선택해주세요');
|
alert('도시를 선택해주세요');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cityName = $citySelect.find('option:selected .name_field').text();
|
cityName = $citySelect.find('option:selected .name_field').text();
|
||||||
|
|
||||||
if(generalID == 0){
|
if (generalID == 0) {
|
||||||
if(!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))){
|
if (!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else if (generalOfficerLevel >= 5) {
|
||||||
else if(generalOfficerLevel >= 5){
|
if (!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
|
||||||
if(!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
if (!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
|
||||||
if(!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_myBossInfo.php',
|
url: 'j_myBossInfo.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
action:'임명',
|
action: '임명',
|
||||||
destGeneralID:generalID,
|
destGeneralID: generalID,
|
||||||
destCityID:cityID,
|
destCityID: cityID,
|
||||||
officerLevel:officerLevel
|
officerLevel: officerLevel
|
||||||
},
|
},
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
alert('임명하지 못했습니다.');
|
alert('임명하지 못했습니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
alert('임명하지 못했습니다. : '+data.reason);
|
alert('임명하지 못했습니다. : ' + data.reason);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(generalID){
|
if (generalID) {
|
||||||
alert('{0}을(를) 임명했습니다.'.format(generalName));
|
alert('{0}을(를) 임명했습니다.'.format(generalName));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
alert('관직을 비웠습니다.');
|
alert('관직을 비웠습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+125
-99
@@ -3,8 +3,8 @@
|
|||||||
* @see https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
|
* @see https://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery
|
||||||
* @param {string} string escape하고자 하는 문자열
|
* @param {string} string escape하고자 하는 문자열
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
var escapeHtml = (function (string) {
|
var escapeHtml = (function(string) {
|
||||||
var entityMap = {
|
var entityMap = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
'<': '<',
|
'<': '<',
|
||||||
@@ -32,58 +32,70 @@ function isInt(n) {
|
|||||||
return +n === n && !(n % 1);
|
return +n === n && !(n % 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
;(function(ns){
|
;
|
||||||
|
(function(ns) {
|
||||||
//https://gist.github.com/demouth/3217440
|
//https://gist.github.com/demouth/3217440
|
||||||
/**
|
/**
|
||||||
* mb_strwidth
|
* mb_strwidth
|
||||||
* @param String
|
* @param String
|
||||||
* @return int
|
* @return int
|
||||||
* @see http://php.net/manual/ja/function.mb-strwidth.php
|
* @see http://php.net/manual/ja/function.mb-strwidth.php
|
||||||
*/
|
*/
|
||||||
var mb_strwidth = function(str){
|
var mb_strwidth = function(str) {
|
||||||
var i=0,l=str.length,c='',length=0;
|
var i = 0,
|
||||||
for(;i<l;i++){
|
l = str.length,
|
||||||
c=str.charCodeAt(i);
|
c = '',
|
||||||
if(0x0000<=c&&c<=0x0019){
|
length = 0;
|
||||||
length += 0;
|
for (; i < l; i++) {
|
||||||
}else if(0x0020<=c&&c<=0x1FFF){
|
c = str.charCodeAt(i);
|
||||||
length += 1;
|
if (0x0000 <= c && c <= 0x0019) {
|
||||||
}else if(0x2000<=c&&c<=0xFF60){
|
length += 0;
|
||||||
length += 2;
|
} else if (0x0020 <= c && c <= 0x1FFF) {
|
||||||
}else if(0xFF61<=c&&c<=0xFF9F){
|
length += 1;
|
||||||
length += 1;
|
} else if (0x2000 <= c && c <= 0xFF60) {
|
||||||
}else if(0xFFA0<=c){
|
length += 2;
|
||||||
length += 2;
|
} else if (0xFF61 <= c && c <= 0xFF9F) {
|
||||||
}
|
length += 1;
|
||||||
}
|
} else if (0xFFA0 <= c) {
|
||||||
return length;
|
length += 2;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
return length;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mb_strimwidth
|
* mb_strimwidth
|
||||||
* @param String
|
* @param String
|
||||||
* @param int
|
* @param int
|
||||||
* @param int
|
* @param int
|
||||||
* @param String
|
* @param String
|
||||||
* @return String
|
* @return String
|
||||||
* @see http://www.php.net/manual/ja/function.mb-strimwidth.php
|
* @see http://www.php.net/manual/ja/function.mb-strimwidth.php
|
||||||
*/
|
*/
|
||||||
var mb_strimwidth = function(str,start,width,trimmarker){
|
var mb_strimwidth = function(str, start, width, trimmarker) {
|
||||||
if(typeof trimmarker === 'undefined') trimmarker='';
|
if (typeof trimmarker === 'undefined') trimmarker = '';
|
||||||
var trimmakerWidth = mb_strwidth(trimmarker),i=start,l=str.length,trimmedLength=0,trimmedStr='';
|
var trimmakerWidth = mb_strwidth(trimmarker),
|
||||||
for(;i<l;i++){
|
i = start,
|
||||||
var charCode=str.charCodeAt(i),c=str.charAt(i),charWidth=mb_strwidth(c),next=str.charAt(i+1),nextWidth=mb_strwidth(next);
|
l = str.length,
|
||||||
trimmedLength += charWidth;
|
trimmedLength = 0,
|
||||||
trimmedStr += c;
|
trimmedStr = '';
|
||||||
if(trimmedLength+trimmakerWidth+nextWidth>width){
|
for (; i < l; i++) {
|
||||||
trimmedStr += trimmarker;
|
var charCode = str.charCodeAt(i),
|
||||||
break;
|
c = str.charAt(i),
|
||||||
}
|
charWidth = mb_strwidth(c),
|
||||||
}
|
next = str.charAt(i + 1),
|
||||||
return trimmedStr;
|
nextWidth = mb_strwidth(next);
|
||||||
};
|
trimmedLength += charWidth;
|
||||||
ns.mb_strwidth = mb_strwidth;
|
trimmedStr += c;
|
||||||
ns.mb_strimwidth = mb_strimwidth;
|
if (trimmedLength + trimmakerWidth + nextWidth > width) {
|
||||||
|
trimmedStr += trimmarker;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return trimmedStr;
|
||||||
|
};
|
||||||
|
ns.mb_strwidth = mb_strwidth;
|
||||||
|
ns.mb_strimwidth = mb_strimwidth;
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +105,7 @@ function isInt(n) {
|
|||||||
*/
|
*/
|
||||||
function convertDictById(arr) {
|
function convertDictById(arr) {
|
||||||
var result = {};
|
var result = {};
|
||||||
arr.forEach(function (v, i) {
|
arr.forEach(function(v, i) {
|
||||||
result[v.id] = v;
|
result[v.id] = v;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -106,7 +118,7 @@ function convertDictById(arr) {
|
|||||||
*/
|
*/
|
||||||
function convertSet(arr) {
|
function convertSet(arr) {
|
||||||
var result = {};
|
var result = {};
|
||||||
arr.forEach(function (v) {
|
arr.forEach(function(v) {
|
||||||
result[v] = true;
|
result[v] = true;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -115,7 +127,7 @@ function convertSet(arr) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {0}, {1}, {2}형태로 포맷해주는 함수
|
* {0}, {1}, {2}형태로 포맷해주는 함수
|
||||||
*/
|
*/
|
||||||
String.prototype.format = function() {
|
String.prototype.format = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
return this.replace(/{(\d+)}/g, function(match, number) {
|
return this.replace(/{(\d+)}/g, function(match, number) {
|
||||||
@@ -134,12 +146,11 @@ function hexToRgb(hex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function isBrightColor(color){
|
function isBrightColor(color) {
|
||||||
color = hexToRgb(color);
|
color = hexToRgb(color);
|
||||||
if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){
|
if ((color.r * 0.299 + color.g * 0.587 + color.b * 0.114) > 140) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +188,7 @@ function numberWithCommas(x) {
|
|||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
function linkifyStrWithOpt(text){
|
function linkifyStrWithOpt(text) {
|
||||||
return linkifyStr(text, {});
|
return linkifyStr(text, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,14 +199,14 @@ function linkifyStrWithOpt(text){
|
|||||||
* @param {object} options
|
* @param {object} options
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
var TemplateEngine = function (html, options) {
|
var TemplateEngine = function(html, options) {
|
||||||
var re = /<%(.+?)%>/g,
|
var re = /<%(.+?)%>/g,
|
||||||
reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g,
|
reExp = /(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g,
|
||||||
code = 'with(obj) { var r=[];\n',
|
code = 'with(obj) { var r=[];\n',
|
||||||
cursor = 0,
|
cursor = 0,
|
||||||
result,
|
result,
|
||||||
match;
|
match;
|
||||||
var add = function (line, js) {
|
var add = function(line, js) {
|
||||||
js ? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') :
|
js ? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') :
|
||||||
(code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : '');
|
(code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : '');
|
||||||
return add;
|
return add;
|
||||||
@@ -208,82 +219,97 @@ var TemplateEngine = function (html, options) {
|
|||||||
}
|
}
|
||||||
add(html.substr(cursor, html.length - cursor));
|
add(html.substr(cursor, html.length - cursor));
|
||||||
code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, ' ');
|
code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, ' ');
|
||||||
try { result = new Function('obj', code).apply(options, [options]); }
|
try { result = new Function('obj', code).apply(options, [options]); } catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
|
||||||
catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIconPath(imgsvr, picture){
|
function getIconPath(imgsvr, picture) {
|
||||||
// ../d_shared/common_path.js 필요
|
// ../d_shared/common_path.js 필요
|
||||||
if(!imgsvr){
|
if (!imgsvr) {
|
||||||
return pathConfig.sharedIcon+'/'+picture;
|
return pathConfig.sharedIcon + '/' + picture;
|
||||||
}
|
} else {
|
||||||
else{
|
return pathConfig.root + '/d_pic/' + picture;
|
||||||
return pathConfig.root+'/d_pic/'+picture;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function activeFlip($obj){
|
function activeFlip($obj) {
|
||||||
var $result;
|
var $result;
|
||||||
if($obj === undefined){
|
if ($obj === undefined) {
|
||||||
$result = $('img[data-flip]');
|
$result = $('img[data-flip]');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$result = $obj.find('img[data-flip]');
|
$result = $obj.find('img[data-flip]');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result.each(function(){
|
$result.each(function() {
|
||||||
activeFlipItem($(this));
|
activeFlipItem($(this));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function activeFlipItem($img){
|
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 = [];
|
var imageList = [];
|
||||||
imageList.push($img.attr('src'));
|
imageList.push($img.attr('src'));
|
||||||
$.each($img.data('flip').split(','), function(idx, value){
|
$.each($img.data('flip').split(','), function(idx, value) {
|
||||||
var value = $.trim(value);
|
var value = $.trim(value);
|
||||||
if(!value){
|
if (!value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
imageList.push(value);
|
imageList.push(value);
|
||||||
});
|
});
|
||||||
if(imageList.length <= 1){
|
if (imageList.length <= 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$img.data('computed_flip_array', imageList);
|
$img.data('computed_flip_array', imageList);
|
||||||
$img.data('computed_flip_idx', 0);
|
$img.data('computed_flip_idx', 0);
|
||||||
|
|
||||||
$img.click(function(){
|
$img.click(function() {
|
||||||
var arr = $img.data('computed_flip_array');
|
var arr = $img.data('computed_flip_array');
|
||||||
var idx = $img.data('computed_flip_idx');
|
var idx = $img.data('computed_flip_idx');
|
||||||
idx = (idx + 1)%(arr.length);
|
idx = (idx + 1) % (arr.length);
|
||||||
$img.attr('src', arr[idx]);
|
$img.attr('src', arr[idx]);
|
||||||
$img.data('computed_flip_idx', idx);
|
$img.data('computed_flip_idx', idx);
|
||||||
});
|
});
|
||||||
$img.css('cursor','pointer');
|
$img.css('cursor', 'pointer');
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(function($){
|
jQuery(function($) {
|
||||||
$('.obj_tooltip').mouseover(function(){
|
$('.obj_tooltip').mouseover(function() {
|
||||||
var $objTooltip = $(this);
|
var $objTooltip = $(this);
|
||||||
if($objTooltip.data('setObjTooltip')){
|
if ($objTooltip.data('setObjTooltip')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltipClassText = $objTooltip.data('tooltip-class');
|
var tooltipClassText = $objTooltip.data('tooltip-class');
|
||||||
if(!tooltipClassText){
|
if (!tooltipClassText) {
|
||||||
tooltipClassText = '';
|
tooltipClassText = '';
|
||||||
}
|
}
|
||||||
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||||
.format(tooltipClassText);
|
.format(tooltipClassText);
|
||||||
|
|
||||||
$objTooltip.tooltip({
|
$objTooltip.tooltip({
|
||||||
title:function(){
|
title: function() {
|
||||||
return $.trim($(this).find('.tooltiptext').html());
|
return $.trim($(this).find('.tooltiptext').html());
|
||||||
},
|
},
|
||||||
template:template,
|
template: template,
|
||||||
html:true
|
html: true
|
||||||
}).tooltip('show');
|
}).tooltip('show');
|
||||||
|
|
||||||
$objTooltip.data('setObjTooltip', true);
|
$objTooltip.data('setObjTooltip', true);
|
||||||
@@ -297,7 +323,7 @@ jQuery(function($){
|
|||||||
activeFlip();
|
activeFlip();
|
||||||
|
|
||||||
var customCSS = localStorage.getItem('sam_customCSS');
|
var customCSS = localStorage.getItem('sam_customCSS');
|
||||||
if(customCSS){
|
if (customCSS) {
|
||||||
var $style = $('<style type="text/css"></style>');
|
var $style = $('<style type="text/css"></style>');
|
||||||
$style.text(customCSS);
|
$style.text(customCSS);
|
||||||
$style.appendTo($('head'));
|
$style.appendTo($('head'));
|
||||||
@@ -307,11 +333,11 @@ jQuery(function($){
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function errUnknown(){
|
function errUnknown() {
|
||||||
alert('작업을 실패했습니다.');
|
alert('작업을 실패했습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
function errUnknownToast(){
|
function errUnknownToast() {
|
||||||
$.toast({
|
$.toast({
|
||||||
title: '에러!',
|
title: '에러!',
|
||||||
content: '작업을 실패했습니다.',
|
content: '작업을 실패했습니다.',
|
||||||
@@ -320,8 +346,8 @@ function errUnknownToast(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function quickReject(errMsg){
|
function quickReject(errMsg) {
|
||||||
if(errMsg === undefined){
|
if (errMsg === undefined) {
|
||||||
errMsg = '작업을 실패했습니다.';
|
errMsg = '작업을 실패했습니다.';
|
||||||
}
|
}
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
@@ -329,8 +355,8 @@ function quickReject(errMsg){
|
|||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
function nl2br(text){
|
function nl2br(text) {
|
||||||
return text.replace(/\n/g,"<br>");
|
return text.replace(/\n/g, "<br>");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
function br2nl (text) {
|
function br2nl (text) {
|
||||||
@@ -338,11 +364,11 @@ function br2nl (text) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getNpcColor(npcType){
|
function getNpcColor(npcType) {
|
||||||
if(npcType >= 2){
|
if (npcType >= 2) {
|
||||||
return 'cyan';
|
return 'cyan';
|
||||||
}
|
}
|
||||||
if(npcType == 1){
|
if (npcType == 1) {
|
||||||
return 'skyblue';
|
return 'skyblue';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+216
-184
@@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
function is_touch_device() {
|
function is_touch_device() {
|
||||||
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
|
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
|
||||||
var mq = function(query) {
|
var mq = function(query) {
|
||||||
return window.matchMedia(query).matches;
|
return window.matchMedia(query).matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
|
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
|
||||||
@@ -14,32 +13,39 @@ function is_touch_device() {
|
|||||||
// https://git.io/vznFH
|
// https://git.io/vznFH
|
||||||
var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
|
var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
|
||||||
return mq(query);
|
return mq(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadWorldMap(option){
|
function reloadWorldMap(option, drawTarget) {
|
||||||
var $world_map = $('.world_map');
|
if (drawTarget === undefined || drawTarget === null) {
|
||||||
|
drawTarget = '.world_map'
|
||||||
|
}
|
||||||
|
var $world_map = $(drawTarget);
|
||||||
|
|
||||||
if($world_map.length == 0){
|
if ($world_map.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultOption = {
|
var defaultOption = {
|
||||||
isDetailMap:true, //복잡 지도, 단순 지도
|
isDetailMap: true, //복잡 지도, 단순 지도
|
||||||
clickableAll:false, //어떤 경우든 클릭을 가능하게 함. 해당 동작의 동작 가능성 여부와는 별도.
|
clickableAll: false, //어떤 경우든 클릭을 가능하게 함. 해당 동작의 동작 가능성 여부와는 별도.
|
||||||
selectCallback:null, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
|
selectCallback: null, //callback을 지정시 clickable과 관계 없이 해당 함수를 실행.
|
||||||
hrefTemplate:'#', //도시가 클릭가능할 경우 지정할 href값. {0}은 도시 id로 변환됨
|
hrefTemplate: '#', //도시가 클릭가능할 경우 지정할 href값. {0}은 도시 id로 변환됨
|
||||||
useCachedMap:false, //맵 캐시를 사용
|
useCachedMap: false, //맵 캐시를 사용
|
||||||
|
|
||||||
//아래부터는 post query에 들어갈 녀석
|
//아래부터는 post query에 들어갈 녀석
|
||||||
year:null, //year값, 연감등에 사용
|
year: null, //year값, 연감등에 사용
|
||||||
month:null, //month값, 연감등에 사용
|
month: null, //month값, 연감등에 사용
|
||||||
aux:null, //기타 넣고 싶은 값을 입력
|
aux: null, //기타 넣고 싶은 값을 입력
|
||||||
neutralView:false, //clickable, 소속 국가, 첩보 여부 등을 반환여부를 설정
|
neutralView: false, //clickable, 소속 국가, 첩보 여부 등을 반환여부를 설정
|
||||||
showMe:true, //반환 값에 본인이 위치한 도시 값을 반환하도록 설정. neutralView와 별개
|
showMe: true, //반환 값에 본인이 위치한 도시 값을 반환하도록 설정. neutralView와 별개
|
||||||
targetJson:'j_map.php',
|
|
||||||
|
targetJson: 'j_map.php',
|
||||||
|
reqType: 'post',
|
||||||
|
dynamicMapTheme: false,
|
||||||
|
callback: null,
|
||||||
|
|
||||||
//기타 보조 값
|
//기타 보조 값
|
||||||
startYear:null,
|
startYear: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
option = $.extend(defaultOption, option);
|
option = $.extend(defaultOption, option);
|
||||||
@@ -56,23 +62,23 @@ function reloadWorldMap(option){
|
|||||||
var storedStartYear = 'sam.{0}.startYear'.format(serverNick);
|
var storedStartYear = 'sam.{0}.startYear'.format(serverNick);
|
||||||
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
|
//OBJ : startYear, year, month, cityList, nationList, spyList, shownByGeneralList, myCity
|
||||||
|
|
||||||
function checkReturnObject(obj){
|
function checkReturnObject(obj) {
|
||||||
if(!obj.result){
|
if (!obj.result) {
|
||||||
var obj = $.Deferred();
|
var obj = $.Deferred();
|
||||||
obj.reject('fail');
|
obj.reject('fail');
|
||||||
return obj.promise();
|
return obj.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$.isNumeric(obj.startYear)
|
if (!$.isNumeric(obj.startYear) ||
|
||||||
||!$.isNumeric(obj.year)
|
!$.isNumeric(obj.year) ||
|
||||||
||!$.isNumeric(obj.month)
|
!$.isNumeric(obj.month)
|
||||||
){
|
) {
|
||||||
var obj = $.Deferred();
|
var obj = $.Deferred();
|
||||||
obj.reject('fail');
|
obj.reject('fail');
|
||||||
return obj.promise();
|
return obj.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(useCachedMap){
|
if (useCachedMap) {
|
||||||
localStorage.setItem(storedOldMapKey, JSON.stringify([serverID, obj]));
|
localStorage.setItem(storedOldMapKey, JSON.stringify([serverID, obj]));
|
||||||
localStorage.setItem(storedStartYear, JSON.stringify(obj.startYear));
|
localStorage.setItem(storedStartYear, JSON.stringify(obj.startYear));
|
||||||
}
|
}
|
||||||
@@ -82,26 +88,40 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMapBackground(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 startYear = obj.startYear;
|
||||||
var year = obj.year;
|
var year = obj.year;
|
||||||
var month = obj.month;
|
var month = obj.month;
|
||||||
|
|
||||||
if(isDetailMap){
|
if (isDetailMap) {
|
||||||
$world_map.addClass('map_detail').removeClass('map_basic');
|
$world_map.addClass('map_detail').removeClass('map_basic');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$world_map.addClass('map_basic').removeClass('map_detail');
|
$world_map.addClass('map_basic').removeClass('map_detail');
|
||||||
}
|
}
|
||||||
|
|
||||||
var $map_title = $('.map_title_text');
|
var $map_title = $('.map_title_text');
|
||||||
if(year < startYear + 1){
|
if (year < startYear + 1) {
|
||||||
$map_title.css('color', 'magenta');
|
$map_title.css('color', 'magenta');
|
||||||
}
|
} else if (year < startYear + 2) {
|
||||||
else if(year < startYear + 2){
|
|
||||||
$map_title.css('color', 'orange');
|
$map_title.css('color', 'orange');
|
||||||
}
|
} else if (year < startYear + 3) {
|
||||||
else if(year < startYear + 3){
|
|
||||||
$map_title.css('color', 'yellow');
|
$map_title.css('color', 'yellow');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,17 +129,17 @@ function reloadWorldMap(option){
|
|||||||
$map_title_tooltip.empty();
|
$map_title_tooltip.empty();
|
||||||
|
|
||||||
var tooltipTexts = [];
|
var tooltipTexts = [];
|
||||||
if(year < startYear + 3){
|
if (year < startYear + 3) {
|
||||||
var startYearText = [];
|
var startYearText = [];
|
||||||
var remainYear = startYear + 3 - year;
|
var remainYear = startYear + 3 - year;
|
||||||
var remainMonth = 12 - month + 1;
|
var remainMonth = 12 - month + 1;
|
||||||
if(remainMonth > 0){
|
if (remainMonth > 0) {
|
||||||
remainYear -= 1;
|
remainYear -= 1;
|
||||||
}
|
}
|
||||||
if(remainYear){
|
if (remainYear) {
|
||||||
startYearText.push('{0}년'.format(remainYear));
|
startYearText.push('{0}년'.format(remainYear));
|
||||||
}
|
}
|
||||||
if(remainMonth){
|
if (remainMonth) {
|
||||||
startYearText.push('{0}개월'.format(remainMonth));
|
startYearText.push('{0}개월'.format(remainMonth));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,20 +149,17 @@ function reloadWorldMap(option){
|
|||||||
var currentTechLimit = Math.floor(Math.max(0, year - startYear) / 5) + 1;
|
var currentTechLimit = Math.floor(Math.max(0, year - startYear) / 5) + 1;
|
||||||
var nextTechLimitYear = currentTechLimit * 5 + startYear;
|
var nextTechLimitYear = currentTechLimit * 5 + startYear;
|
||||||
|
|
||||||
tooltipTexts.push('기술등급 제한 : {0}등급 ({1}년 해제)'.format(currentTechLimit, nextTechLimitYear, currentTechLimit+1));
|
tooltipTexts.push('기술등급 제한 : {0}등급 ({1}년 해제)'.format(currentTechLimit, nextTechLimitYear, currentTechLimit + 1));
|
||||||
$map_title_tooltip.html(tooltipTexts.join('<br>'));
|
$map_title_tooltip.html(tooltipTexts.join('<br>'));
|
||||||
|
|
||||||
$world_map.removeClass('map_string map_summer map_fall map_winter');
|
$world_map.removeClass('map_string map_summer map_fall map_winter');
|
||||||
if(month <= 3){
|
if (month <= 3) {
|
||||||
$world_map.addClass('map_spring');
|
$world_map.addClass('map_spring');
|
||||||
}
|
} else if (month <= 6) {
|
||||||
else if(month <= 6){
|
|
||||||
$world_map.addClass('map_summer');
|
$world_map.addClass('map_summer');
|
||||||
}
|
} else if (month <= 9) {
|
||||||
else if(month <= 9){
|
|
||||||
$world_map.addClass('map_fall');
|
$world_map.addClass('map_fall');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$world_map.addClass('map_winter');
|
$world_map.addClass('map_winter');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,26 +168,26 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertCityObjs(obj){
|
function convertCityObjs(obj) {
|
||||||
//원본 Obj는 굉장히 간소하게 온다, Object 형태로 변환해서 사용한다.
|
//원본 Obj는 굉장히 간소하게 온다, Object 형태로 변환해서 사용한다.
|
||||||
|
|
||||||
function toCityObj(arr){
|
function toCityObj(arr) {
|
||||||
return {
|
return {
|
||||||
id:arr[0],
|
id: arr[0],
|
||||||
level:arr[1],
|
level: arr[1],
|
||||||
state:arr[2],
|
state: arr[2],
|
||||||
nationId:(arr[3]>0)?arr[3]:null,
|
nationId: (arr[3] > 0) ? arr[3] : null,
|
||||||
region:arr[4],
|
region: arr[4],
|
||||||
supply:(arr[5]!=0)
|
supply: (arr[5] != 0)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function toNationObj(arr){
|
function toNationObj(arr) {
|
||||||
return {
|
return {
|
||||||
id:arr[0],
|
id: arr[0],
|
||||||
name:arr[1],
|
name: arr[1],
|
||||||
color:arr[2],
|
color: arr[2],
|
||||||
capital:arr[3]
|
capital: arr[3]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,15 +196,15 @@ function reloadWorldMap(option){
|
|||||||
nationList = convertDictById(nationList); //array of object -> dict
|
nationList = convertDictById(nationList); //array of object -> dict
|
||||||
|
|
||||||
var spyList = obj.spyList;
|
var spyList = obj.spyList;
|
||||||
var shownByGeneralList = convertSet(obj.shownByGeneralList);//Array -> Set
|
var shownByGeneralList = convertSet(obj.shownByGeneralList); //Array -> Set
|
||||||
|
|
||||||
var myCity = obj.myCity;
|
var myCity = obj.myCity;
|
||||||
var myNation = obj.myNation;
|
var myNation = obj.myNation;
|
||||||
|
|
||||||
|
|
||||||
function mergePositionInfo(city){
|
function mergePositionInfo(city) {
|
||||||
var id = city.id;
|
var id = city.id;
|
||||||
if(!(id in cityPosition)){
|
if (!(id in cityPosition)) {
|
||||||
return city;
|
return city;
|
||||||
}
|
}
|
||||||
var xy_val = cityPosition[id];
|
var xy_val = cityPosition[id];
|
||||||
@@ -197,11 +214,11 @@ function reloadWorldMap(option){
|
|||||||
return city;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeNationInfo(city){
|
function mergeNationInfo(city) {
|
||||||
//nationId 값으로 isCapital, color, nation을 통합
|
//nationId 값으로 isCapital, color, nation을 통합
|
||||||
|
|
||||||
var nationId = city.nationId;
|
var nationId = city.nationId;
|
||||||
if(nationId === null || !(nationId in nationList)){
|
if (nationId === null || !(nationId in nationList)) {
|
||||||
city.nationId = null;
|
city.nationId = null;
|
||||||
city.nation = null;
|
city.nation = null;
|
||||||
city.color = null;
|
city.color = null;
|
||||||
@@ -217,24 +234,24 @@ function reloadWorldMap(option){
|
|||||||
return city;
|
return city;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mergeClickable(city){
|
function mergeClickable(city) {
|
||||||
//clickable = (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll
|
//clickable = (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll
|
||||||
var id = city.id;
|
var id = city.id;
|
||||||
var nationId = city.nationId;
|
var nationId = city.nationId;
|
||||||
var clickable = 0;
|
var clickable = 0;
|
||||||
if(id in spyList){
|
if (id in spyList) {
|
||||||
clickable |= spyList[id] << 3;
|
clickable |= spyList[id] << 3;
|
||||||
}
|
}
|
||||||
if(myNation !== null && nationId == myNation){
|
if (myNation !== null && nationId == myNation) {
|
||||||
clickable |= 4;
|
clickable |= 4;
|
||||||
}
|
}
|
||||||
if(shownByGeneralList.hasOwnProperty(id)){
|
if (shownByGeneralList.hasOwnProperty(id)) {
|
||||||
clickable |= 2;
|
clickable |= 2;
|
||||||
}
|
}
|
||||||
if(myCity !== null && id == myCity){
|
if (myCity !== null && id == myCity) {
|
||||||
clickable |= 2;
|
clickable |= 2;
|
||||||
}
|
}
|
||||||
if(clickableAll){
|
if (clickableAll) {
|
||||||
clickable |= 1;
|
clickable |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,35 +267,35 @@ function reloadWorldMap(option){
|
|||||||
.map(formatCityInfo);
|
.map(formatCityInfo);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'cityList' : cityList,
|
'cityList': cityList,
|
||||||
'myCity' : myCity
|
'myCity': myCity
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawDetailWorldMap(obj){
|
function drawDetailWorldMap(obj) {
|
||||||
|
|
||||||
var $map_body = $('.world_map .map_body');
|
var $map_body = $(drawTarget + ' .map_body');
|
||||||
|
|
||||||
var cityList = obj.cityList;
|
var cityList = obj.cityList;
|
||||||
var myCity = obj.myCity;
|
var myCity = obj.myCity;
|
||||||
|
|
||||||
cityList.forEach(function(city){
|
cityList.forEach(function(city) {
|
||||||
var id = city.id;
|
var id = city.id;
|
||||||
$('.city_base_{0}'.format(id)).detach();
|
$('.city_base_{0}'.format(id)).detach();
|
||||||
//이전 도시는 지운다.
|
//이전 도시는 지운다.
|
||||||
|
|
||||||
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
||||||
$cityObj.addClass('city_level_{0}'.format(city.level));
|
$cityObj.addClass('city_level_{0}'.format(city.level));
|
||||||
$cityObj.data('obj', city).css({'left':city.x-20,'top':city.y-15});
|
$cityObj.data('obj', city).css({ 'left': city.x - 20, 'top': city.y - 15 });
|
||||||
|
|
||||||
if('color' in city && city.color !== null){
|
if ('color' in city && city.color !== null) {
|
||||||
var $bgObj = $('<div class="city_bg"></div>');
|
var $bgObj = $('<div class="city_bg"></div>');
|
||||||
$cityObj.append($bgObj);
|
$cityObj.append($bgObj);
|
||||||
$bgObj.css({'background-image':'url({0}/b{1}.png)'.format(pathConfig.gameImage, convColorValue(city.color))});
|
$bgObj.css({ 'background-image': 'url({0}/b{1}.png)'.format(pathConfig.gameImage, convColorValue(city.color)) });
|
||||||
}
|
}
|
||||||
|
|
||||||
var $linkObj = $('<a class="city_link"></a>');
|
var $linkObj = $('<a class="city_link"></a>');
|
||||||
$linkObj.data({'text':city.text,'nation':city.nation,'id':city.id});
|
$linkObj.data({ 'text': city.text, 'nation': city.nation, 'id': city.id });
|
||||||
$cityObj.append($linkObj);
|
$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));
|
var $imgObj = $('<div class="city_img"><img src="{0}/cast_{1}.gif"><div class="city_filler"></div></div>'.format(pathConfig.gameImage, city.level));
|
||||||
@@ -286,15 +303,15 @@ function reloadWorldMap(option){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(city.state > 0){
|
if (city.state > 0) {
|
||||||
var $stateObj = $('<div class="city_state"><img src="{0}/event{1}.gif"></div>'.format(pathConfig.gameImage, city.state));
|
var $stateObj = $('<div class="city_state"><img src="{0}/event{1}.gif"></div>'.format(pathConfig.gameImage, city.state));
|
||||||
$linkObj.append($stateObj);
|
$linkObj.append($stateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(city.nationId && city.nationId > 0){
|
if (city.nationId && city.nationId > 0) {
|
||||||
var flagType = city.supply?'f':'d';
|
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)));
|
var $flagObj = $('<div class="city_flag"><img src="{0}/{1}{2}.gif"></div>'.format(pathConfig.gameImage, flagType, convColorValue(city.color)));
|
||||||
if(city.isCapital){
|
if (city.isCapital) {
|
||||||
var $capitalObj = $('<div class="city_capital"><img src="{0}/event51.gif"></div>'.format(pathConfig.gameImage));
|
var $capitalObj = $('<div class="city_capital"><img src="{0}/event51.gif"></div>'.format(pathConfig.gameImage));
|
||||||
$flagObj.append($capitalObj);
|
$flagObj.append($capitalObj);
|
||||||
}
|
}
|
||||||
@@ -315,41 +332,39 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBasicWorldMap(obj){
|
function drawBasicWorldMap(obj) {
|
||||||
|
|
||||||
var $map_body = $('.world_map .map_body');
|
var $map_body = $(drawTarget + ' .map_body');
|
||||||
|
|
||||||
var cityList = obj.cityList;
|
var cityList = obj.cityList;
|
||||||
var myCity = obj.myCity;
|
var myCity = obj.myCity;
|
||||||
|
|
||||||
cityList.forEach(function(city){
|
cityList.forEach(function(city) {
|
||||||
var id = city.id;
|
var id = city.id;
|
||||||
$('.city_base_{0}'.format(id)).detach();
|
$('.city_base_{0}'.format(id)).detach();
|
||||||
//이전 도시는 지운다.
|
//이전 도시는 지운다.
|
||||||
|
|
||||||
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
var $cityObj = $('<div class="city_base city_base_{0}"></div>'.format(id));
|
||||||
$cityObj.addClass('city_level_{0}'.format(city.level));
|
$cityObj.addClass('city_level_{0}'.format(city.level));
|
||||||
$cityObj.data('obj', city).css({'left':city.x-20,'top':city.y-15});
|
$cityObj.data('obj', city).css({ 'left': city.x - 20, 'top': city.y - 15 });
|
||||||
|
|
||||||
var $linkObj = $('<a class="city_link"></a>');
|
var $linkObj = $('<a class="city_link"></a>');
|
||||||
$linkObj.data({'text':city.text,'nation':city.nation,'id':city.id});
|
$linkObj.data({ 'text': city.text, 'nation': city.nation, 'id': city.id });
|
||||||
$cityObj.append($linkObj);
|
$cityObj.append($linkObj);
|
||||||
|
|
||||||
var $imgObj = $('<div class="city_img"><div class="city_filler"></div></div>');
|
var $imgObj = $('<div class="city_img"><div class="city_filler"></div></div>');
|
||||||
if('color' in city && city.color !== null){
|
if ('color' in city && city.color !== null) {
|
||||||
$imgObj.css({'background-color':city.color});
|
$imgObj.css({ 'background-color': city.color });
|
||||||
}
|
}
|
||||||
$linkObj.append($imgObj);
|
$linkObj.append($imgObj);
|
||||||
|
|
||||||
if(city.state > 0){
|
if (city.state > 0) {
|
||||||
var state_text = 'wrong';
|
var state_text = 'wrong';
|
||||||
if(city.state < 10){
|
if (city.state < 10) {
|
||||||
state_text = 'good';
|
state_text = 'good';
|
||||||
}
|
} else if (city.state < 40) {
|
||||||
else if(city.state < 40){
|
|
||||||
state_text = 'bad';
|
state_text = 'bad';
|
||||||
}
|
} else if (city.state < 50) {
|
||||||
else if(city.state < 50){
|
|
||||||
state_text = 'war';
|
state_text = 'war';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +373,7 @@ function reloadWorldMap(option){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//단순 표기에서는 깃발 여부가 없음
|
//단순 표기에서는 깃발 여부가 없음
|
||||||
if(city.isCapital){
|
if (city.isCapital) {
|
||||||
var $capitalObj = $('<div class="city_capital"></div>');
|
var $capitalObj = $('<div class="city_capital"></div>');
|
||||||
$imgObj.append($capitalObj);
|
$imgObj.append($capitalObj);
|
||||||
}
|
}
|
||||||
@@ -374,32 +389,30 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMouseWork(obj){
|
function setMouseWork(obj) {
|
||||||
var $tooltip = $('.world_map .city_tooltip');
|
var $tooltip = $(drawTarget + ' .city_tooltip');
|
||||||
var $tooltip_city = $tooltip.find('.city_name');
|
var $tooltip_city = $tooltip.find('.city_name');
|
||||||
var $tooltip_nation = $tooltip.find('.nation_name');
|
var $tooltip_nation = $tooltip.find('.nation_name');
|
||||||
|
|
||||||
var $objs = $('.world_map .city_link');
|
var $objs = $(drawTarget + ' .city_link');
|
||||||
|
|
||||||
var $map_body = $('.world_map .map_body');
|
var $map_body = $(drawTarget + ' .map_body');
|
||||||
|
|
||||||
//터치스크린 탭
|
//터치스크린 탭
|
||||||
|
|
||||||
if(!option.neutralView && is_touch_device()){
|
if (!option.neutralView && is_touch_device()) {
|
||||||
$objs.on('touchstart', function(e){
|
$objs.on('touchstart', function(e) {
|
||||||
if(window.sam_toggleSingleTap){
|
if (window.sam_toggleSingleTap) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
|
|
||||||
var touchMode = $this.data('touchMode');
|
var touchMode = $this.data('touchMode');
|
||||||
if($tooltip_city.data('target') != $this.data('id')){
|
if ($tooltip_city.data('target') != $this.data('id')) {
|
||||||
$this.data('touchMode', 1);
|
$this.data('touchMode', 1);
|
||||||
}
|
} else if (touchMode === undefined) {
|
||||||
else if(touchMode === undefined){
|
|
||||||
$this.data('touchMode', 1);
|
$this.data('touchMode', 1);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$this.data('touchMode', touchMode + 1);
|
$this.data('touchMode', touchMode + 1);
|
||||||
}
|
}
|
||||||
$map_body.data('touchMode', 1);
|
$map_body.data('touchMode', 1);
|
||||||
@@ -409,8 +422,8 @@ function reloadWorldMap(option){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$objs.on('touchend', function(e){
|
$objs.on('touchend', function(e) {
|
||||||
if(window.sam_toggleSingleTap){
|
if (window.sam_toggleSingleTap) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
@@ -418,17 +431,25 @@ function reloadWorldMap(option){
|
|||||||
$tooltip_city.html($this.data('text'));
|
$tooltip_city.html($this.data('text'));
|
||||||
|
|
||||||
var nation_text = $this.data('nation');
|
var nation_text = $this.data('nation');
|
||||||
if(nation_text){
|
if (nation_text) {
|
||||||
$tooltip_nation.html(nation_text).show();
|
$tooltip_nation.html(nation_text).show();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$tooltip_nation.html('').hide();
|
$tooltip_nation.html('').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show();
|
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');
|
var touchMode = $this.data('touchMode');
|
||||||
if(touchMode <= 1){
|
if (touchMode <= 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,8 +457,8 @@ function reloadWorldMap(option){
|
|||||||
$this.data('touchMode', 0);
|
$this.data('touchMode', 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
$map_body.on('touchend',function(e){
|
$map_body.on('touchend', function(e) {
|
||||||
if(window.sam_toggleSingleTap){
|
if (window.sam_toggleSingleTap) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//위의 touchend bind에 해당하지 않는 경우 -> 빈 지도 터치
|
//위의 touchend bind에 해당하지 않는 경우 -> 빈 지도 터치
|
||||||
@@ -448,20 +469,26 @@ function reloadWorldMap(option){
|
|||||||
|
|
||||||
//Mouse over 모드 작동
|
//Mouse over 모드 작동
|
||||||
|
|
||||||
$map_body.on('mousemove', function(e){
|
$map_body.on('mousemove', function(e) {
|
||||||
if($(this).data('touchMode')){
|
if ($(this).data('touchMode')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentOffset = $map_body.offset();
|
var rect = this.getBoundingClientRect();
|
||||||
var relX = e.pageX - parentOffset.left;
|
var left = (e.clientX - rect.left - this.clientLeft + this.scrollLeft);
|
||||||
var relY = e.pageY - parentOffset.top;
|
var top = (e.clientY - rect.top - this.clientTop + this.scrollTop);
|
||||||
|
|
||||||
$tooltip.css({'top': relY + 10, 'left': relX + 10});
|
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){
|
$objs.on('mouseenter', function(e) {
|
||||||
if($map_body.data('touchMode')){
|
if ($map_body.data('touchMode')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,28 +497,27 @@ function reloadWorldMap(option){
|
|||||||
$tooltip_city.data('target', $this.data('id'));
|
$tooltip_city.data('target', $this.data('id'));
|
||||||
$tooltip_city.html($this.data('text'));
|
$tooltip_city.html($this.data('text'));
|
||||||
var nation_text = $this.data('nation');
|
var nation_text = $this.data('nation');
|
||||||
if(nation_text){
|
if (nation_text) {
|
||||||
$tooltip_nation.html(nation_text).show();
|
$tooltip_nation.html(nation_text).show();
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$tooltip_nation.html('').hide();
|
$tooltip_nation.html('').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$tooltip.show();
|
$tooltip.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$objs.on('mouseleave', function(event){
|
$objs.on('mouseleave', function(event) {
|
||||||
$tooltip.hide();
|
$tooltip.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$objs.on('click', function(e){
|
$objs.on('click', function(e) {
|
||||||
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
||||||
var touchMode = $(this).data('touchMode');
|
var touchMode = $(this).data('touchMode');
|
||||||
if(touchMode === undefined){
|
if (touchMode === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(touchMode === 1){
|
if (touchMode === 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -500,17 +526,17 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCityClickable(obj){
|
function setCityClickable(obj) {
|
||||||
|
|
||||||
obj.cityList.forEach(function(city){
|
obj.cityList.forEach(function(city) {
|
||||||
var $cityLink = $world_map.find('.city_base_{0} .city_link'.format(city.id));
|
var $cityLink = $world_map.find('.city_base_{0} .city_link'.format(city.id));
|
||||||
|
|
||||||
if('clickable' in city && city.clickable > 0){
|
if ('clickable' in city && city.clickable > 0) {
|
||||||
$cityLink.attr('href',hrefTemplate.format(city.id));
|
$cityLink.attr('href', hrefTemplate.format(city.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selectCallback){
|
if (selectCallback) {
|
||||||
$cityLink.click(function(){
|
$cityLink.click(function() {
|
||||||
return selectCallback(city);
|
return selectCallback(city);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -519,127 +545,133 @@ function reloadWorldMap(option){
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveCityInfo(obj){
|
function saveCityInfo(obj) {
|
||||||
$world_map.data('cityInfo', obj);
|
$world_map.data('cityInfo', obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $hideCityNameBtn = $world_map.find('.map_toggle_cityname');
|
var $hideCityNameBtn = $world_map.find('.map_toggle_cityname');
|
||||||
if(localStorage.getItem('sam.hideMapCityName') == 'yes'){
|
if (localStorage.getItem('sam.hideMapCityName') == 'yes') {
|
||||||
$world_map.addClass('hide_cityname');
|
$world_map.addClass('hide_cityname');
|
||||||
$hideCityNameBtn.addClass('active').attr('aria-pressed', 'true');
|
$hideCityNameBtn.addClass('active').attr('aria-pressed', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
$hideCityNameBtn.click(function(){
|
$hideCityNameBtn.click(function() {
|
||||||
//이전 상태 확인
|
//이전 상태 확인
|
||||||
var state = !$hideCityNameBtn.hasClass('active');
|
var state = !$hideCityNameBtn.hasClass('active');
|
||||||
if(state){
|
if (state) {
|
||||||
$world_map.addClass('hide_cityname');
|
$world_map.addClass('hide_cityname');
|
||||||
localStorage.setItem('sam.hideMapCityName', 'yes');
|
localStorage.setItem('sam.hideMapCityName', 'yes');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$world_map.removeClass('hide_cityname');
|
$world_map.removeClass('hide_cityname');
|
||||||
localStorage.setItem('sam.hideMapCityName', 'no');
|
localStorage.setItem('sam.hideMapCityName', 'no');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var $toggleSingleTapBtn = $world_map.find('.map_toggle_single_tap');
|
var $toggleSingleTapBtn = $world_map.find('.map_toggle_single_tap');
|
||||||
if(localStorage.getItem('sam.toggleSingleTap') == 'yes'){
|
if (localStorage.getItem('sam.toggleSingleTap') == 'yes') {
|
||||||
window.sam_toggleSingleTap = true;
|
window.sam_toggleSingleTap = true;
|
||||||
$toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true');
|
$toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
window.sam_toggleSingleTap = false;
|
window.sam_toggleSingleTap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $map_body = $('.world_map .map_body');
|
var $map_body = $(drawTarget + ' .map_body');
|
||||||
|
|
||||||
$toggleSingleTapBtn.click(function(){
|
$toggleSingleTapBtn.click(function() {
|
||||||
//이전 상태 확인
|
//이전 상태 확인
|
||||||
var state = !$toggleSingleTapBtn.hasClass('active');
|
var state = !$toggleSingleTapBtn.hasClass('active');
|
||||||
if(state){
|
if (state) {
|
||||||
$map_body.removeData('touchMode');
|
$map_body.removeData('touchMode');
|
||||||
localStorage.setItem('sam.toggleSingleTap', 'yes');
|
localStorage.setItem('sam.toggleSingleTap', 'yes');
|
||||||
window.sam_toggleSingleTap = true;
|
window.sam_toggleSingleTap = true;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
localStorage.setItem('sam.toggleSingleTap', 'no');
|
localStorage.setItem('sam.toggleSingleTap', 'no');
|
||||||
window.sam_toggleSingleTap = false;
|
window.sam_toggleSingleTap = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(isDetailMap){
|
if (isDetailMap) {
|
||||||
$world_map.addClass('map_detail');
|
$world_map.addClass('map_detail');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$world_map.removeClass('map_datail');
|
$world_map.removeClass('map_datail');
|
||||||
}
|
}
|
||||||
|
|
||||||
//deferred mode of jQuery. != promise-then.
|
//deferred mode of jQuery. != promise-then.
|
||||||
var deferred = $.ajax({
|
var deferred = $.ajax({
|
||||||
url: option.targetJson,
|
url: option.targetJson,
|
||||||
type: 'post',
|
type: option.reqType,
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
|
ifModified: true,
|
||||||
data: {
|
data: {
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
neutralView:option.neutralView,
|
neutralView: option.neutralView,
|
||||||
year:option.year,
|
year: option.year,
|
||||||
month:option.month,
|
month: option.month,
|
||||||
showMe:option.showMe,
|
showMe: option.showMe,
|
||||||
aux:option.aux
|
aux: option.aux
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var rawObject = null;
|
||||||
|
|
||||||
deferred
|
deferred
|
||||||
|
.then(function(data) {
|
||||||
|
rawObject = data;
|
||||||
|
return data;
|
||||||
|
})
|
||||||
.then(checkReturnObject)
|
.then(checkReturnObject)
|
||||||
.then(setMapBackground)
|
.then(setMapBackground)
|
||||||
.then(convertCityObjs)
|
.then(convertCityObjs)
|
||||||
.then(isDetailMap?drawDetailWorldMap:drawBasicWorldMap)
|
.then(isDetailMap ? drawDetailWorldMap : drawBasicWorldMap)
|
||||||
.then(setMouseWork)
|
.then(setMouseWork)
|
||||||
.then(setCityClickable)
|
.then(setCityClickable)
|
||||||
.then(saveCityInfo);
|
.then(saveCityInfo)
|
||||||
|
.then(function(data) {
|
||||||
|
if (option.callback) {
|
||||||
|
option.callback(data, rawObject);
|
||||||
|
}
|
||||||
|
|
||||||
if($world_map.hasClass('draw_required')){
|
});
|
||||||
if(useCachedMap){
|
|
||||||
|
if ($world_map.hasClass('draw_required')) {
|
||||||
|
if (useCachedMap) {
|
||||||
//일단 불러옴
|
//일단 불러옴
|
||||||
do{
|
do {
|
||||||
var storedMap = localStorage.getItem(storedOldMapKey);
|
var storedMap = localStorage.getItem(storedOldMapKey);
|
||||||
if(!storedMap){
|
if (!storedMap) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
storedMap = JSON.parse(storedMap);
|
storedMap = JSON.parse(storedMap);
|
||||||
var storedServerID = storedMap[0];
|
var storedServerID = storedMap[0];
|
||||||
if(storedServerID != serverID){
|
if (storedServerID != serverID) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedMap = storedMap[1];
|
storedMap = storedMap[1];
|
||||||
storedMap = setMapBackground(storedMap);
|
storedMap = setMapBackground(storedMap);
|
||||||
storedMap = convertCityObjs(storedMap);
|
storedMap = convertCityObjs(storedMap);
|
||||||
if(isDetailMap){
|
if (isDetailMap) {
|
||||||
storedMap = drawDetailWorldMap(storedMap);
|
storedMap = drawDetailWorldMap(storedMap);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
storedMap = drawBasicWorldMap(storedMap);
|
storedMap = drawBasicWorldMap(storedMap);
|
||||||
}
|
}
|
||||||
storedMap = setMouseWork(storedMap);
|
storedMap = setMouseWork(storedMap);
|
||||||
storedMap = setCityClickable(storedMap);
|
storedMap = setCityClickable(storedMap);
|
||||||
storedMap = saveCityInfo(storedMap);
|
storedMap = saveCityInfo(storedMap);
|
||||||
}while(false);
|
} while (false);
|
||||||
}
|
} else if (option.year && option.month) {
|
||||||
else if(option.year && option.month){
|
|
||||||
var startYear = localStorage.getItem(storedStartYear);
|
var startYear = localStorage.getItem(storedStartYear);
|
||||||
if(startYear){
|
if (startYear) {
|
||||||
startYear = JSON.parse(startYear);
|
startYear = JSON.parse(startYear);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
startYear = option.year;
|
startYear = option.year;
|
||||||
}
|
}
|
||||||
var tmp = {
|
var tmp = {
|
||||||
year : option.year,
|
year: option.year,
|
||||||
month : option.month,
|
month: option.month,
|
||||||
startYear : startYear
|
startYear: startYear
|
||||||
};
|
};
|
||||||
setMapBackground(tmp);
|
setMapBackground(tmp);
|
||||||
}
|
}
|
||||||
@@ -647,8 +679,8 @@ function reloadWorldMap(option){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(function(){
|
$(function() {
|
||||||
if(is_touch_device()){
|
if (is_touch_device()) {
|
||||||
$('.map_body .map_toggle_single_tap').show();
|
$('.map_body .map_toggle_single_tap').show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
+88
-87
@@ -1,166 +1,167 @@
|
|||||||
jQuery(function($){
|
jQuery(function($) {
|
||||||
|
|
||||||
|
|
||||||
var initCustomCSSForm = function(){
|
var initCustomCSSForm = function() {
|
||||||
var lastTimeOut = null;
|
var lastTimeOut = null;
|
||||||
var $obj = $('#custom_css');
|
var $obj = $('#custom_css');
|
||||||
var key = 'sam_customCSS';
|
var key = 'sam_customCSS';
|
||||||
|
|
||||||
var text = localStorage.getItem(key);
|
var text = localStorage.getItem(key);
|
||||||
if(text){
|
if (text) {
|
||||||
$obj.val(text);
|
$obj.val(text);
|
||||||
console.log(text);
|
console.log(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($obj.on('change keyup paste', function(){
|
if ($obj.on('change keyup paste', function() {
|
||||||
var newText = $obj.val();
|
var newText = $obj.val();
|
||||||
if(text == newText){
|
if (text == newText) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(lastTimeOut){
|
if (lastTimeOut) {
|
||||||
clearTimeout(lastTimeOut);
|
clearTimeout(lastTimeOut);
|
||||||
}
|
}
|
||||||
$obj.css('background-color', '#222222');
|
$obj.css('background-color', '#222222');
|
||||||
lastTimeOut = setTimeout(function(){
|
lastTimeOut = setTimeout(function() {
|
||||||
text = $obj.val();
|
text = $obj.val();
|
||||||
localStorage.setItem(key, text);
|
localStorage.setItem(key, text);
|
||||||
$obj.css('background-color', 'black');
|
$obj.css('background-color', 'black');
|
||||||
}, 500);
|
}, 500);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.load_old_log').click(function(){
|
$('.load_old_log').click(function() {
|
||||||
var $thisBtn = $(this);
|
var $thisBtn = $(this);
|
||||||
var logType = $thisBtn.data('log_type');
|
var logType = $thisBtn.data('log_type');
|
||||||
var $last = $('.log_{0}:last'.format(logType));
|
var $last = $('.log_{0}:last'.format(logType));
|
||||||
var reqTo = null;
|
var reqTo = null;
|
||||||
if($last.length){
|
if ($last.length) {
|
||||||
reqTo = $last.data('seq');
|
reqTo = $last.data('seq');
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_general_log_old.php',
|
url: 'j_general_log_old.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
to:reqTo,
|
to: reqTo,
|
||||||
type:logType
|
type: logType
|
||||||
}
|
}
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return quickReject('로그를 받아오지 못했습니다.');
|
return quickReject('로그를 받아오지 못했습니다.');
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
return quickReject('로그를 받아오지 못했습니다. : '+data.reason);
|
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);
|
var keys = Object.keys(data.log);
|
||||||
}, errUnknown)
|
if (keys.length > 1 && keys[0] < keys[1]) {
|
||||||
.fail(function(reason){
|
keys.reverse();
|
||||||
alert(reason);
|
}
|
||||||
location.reload();
|
|
||||||
});
|
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();
|
initCustomCSSForm();
|
||||||
|
|
||||||
|
|
||||||
$('#die_immediately').click(function(){
|
$('#die_immediately').click(function() {
|
||||||
if(!confirm('정말로 삭제하시겠습니까?')){
|
if (!confirm('정말로 삭제하시겠습니까?')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_die_immediately.php',
|
url: 'j_die_immediately.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return quickReject('실패했습니다.');
|
return quickReject('실패했습니다.');
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
return quickReject(data.reason);
|
return quickReject(data.reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
location.replace('..');
|
location.replace('..');
|
||||||
|
|
||||||
}, errUnknown)
|
}, errUnknown)
|
||||||
.fail(function(reason){
|
.fail(function(reason) {
|
||||||
alert(reason);
|
alert(reason);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#vacation').click(function(){
|
$('#vacation').click(function() {
|
||||||
if(!confirm('휴가 기능을 신청할까요?')){
|
if (!confirm('휴가 기능을 신청할까요?')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_vacation.php',
|
url: 'j_vacation.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return quickReject('실패했습니다.');
|
return quickReject('실패했습니다.');
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
return quickReject(data.reason);
|
return quickReject(data.reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
}, errUnknown)
|
}, errUnknown)
|
||||||
.fail(function(reason){
|
.fail(function(reason) {
|
||||||
alert(reason);
|
alert(reason);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#set_my_setting').click(function(){
|
$('#set_my_setting').click(function() {
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_set_my_setting.php',
|
url: 'j_set_my_setting.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
tnmt:$('.tnmt:checked').val(),
|
tnmt: $('.tnmt:checked').val(),
|
||||||
defence_train:$('#defence_train').val(),
|
defence_train: $('#defence_train').val(),
|
||||||
use_treatment:$('#use_treatment').val(),
|
use_treatment: $('#use_treatment').val(),
|
||||||
|
use_auto_nation_turn: $('#use_auto_nation_turn').val(),
|
||||||
}
|
}
|
||||||
}).then(function(data){
|
}).then(function(data) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
return quickReject('실패했습니다.');
|
return quickReject('실패했습니다.');
|
||||||
}
|
}
|
||||||
if(!data.result){
|
if (!data.result) {
|
||||||
return quickReject(data.reason);
|
return quickReject(data.reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
||||||
}, errUnknown)
|
}, errUnknown)
|
||||||
.fail(function(reason){
|
.fail(function(reason) {
|
||||||
alert(reason);
|
alert(reason);
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -35,7 +35,7 @@ jQuery(function($) {
|
|||||||
//checkCommandArg 참고
|
//checkCommandArg 참고
|
||||||
var availableArgumentList = {
|
var availableArgumentList = {
|
||||||
'string': [
|
'string': [
|
||||||
'nationName', 'optionText', 'itemType', 'nationType', 'itemCode',
|
'nationName', 'optionText', 'itemType', 'nationType', 'itemCode', 'commandType',
|
||||||
],
|
],
|
||||||
'int': [
|
'int': [
|
||||||
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
'crewType', 'destGeneralID', 'destCityID', 'destNationID',
|
||||||
@@ -73,9 +73,11 @@ jQuery(function($) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'integerArray': function($obj) {
|
'integerArray': function($obj) {
|
||||||
return $obj.map(function() {
|
var result = [];
|
||||||
return parseInt($(this).val());
|
$obj.each(function() {
|
||||||
|
result.push(parseInt($(this).val()));
|
||||||
});
|
});
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+138
-145
@@ -1,5 +1,5 @@
|
|||||||
var templateGeneralCard =
|
var templateGeneralCard =
|
||||||
'<div class="general_card">\
|
'<div class="general_card">\
|
||||||
<h4 class="bg1 with_border"><%name%></h4>\
|
<h4 class="bg1 with_border"><%name%></h4>\
|
||||||
<h4><img src="<%iconPath%>" height=64 width=64></h4>\
|
<h4><img src="<%iconPath%>" height=64 width=64></h4>\
|
||||||
<p><%leadership%> / <%strength%> / <%intel%><br>\
|
<p><%leadership%> / <%strength%> / <%intel%><br>\
|
||||||
@@ -11,7 +11,7 @@ var templateGeneralCard =
|
|||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
var templateSpecial =
|
var templateSpecial =
|
||||||
'<span class="obj_tooltip" data-toggle="tooltip" data-placement="top"><%text%>\
|
'<span class="obj_tooltip" data-toggle="tooltip" data-placement="top"><%text%>\
|
||||||
<span class="tooltiptext">\
|
<span class="tooltiptext">\
|
||||||
<%info%>\
|
<%info%>\
|
||||||
</span>\
|
</span>\
|
||||||
@@ -19,7 +19,7 @@ var templateSpecial =
|
|||||||
';
|
';
|
||||||
|
|
||||||
var templateGeneralRow =
|
var templateGeneralRow =
|
||||||
'<tr>\
|
'<tr>\
|
||||||
<td><img class="generalIcon" width="64" height="64" src="<%iconPath%>"></td>\
|
<td><img class="generalIcon" width="64" height="64" src="<%iconPath%>"></td>\
|
||||||
<td style="<%userCSS%>"><%name%><%nameAux%></td>\
|
<td style="<%userCSS%>"><%name%><%nameAux%></td>\
|
||||||
<td><%age%>세</td>\
|
<td><%age%>세</td>\
|
||||||
@@ -37,7 +37,7 @@ var templateGeneralRow =
|
|||||||
<td><%killturn%></td>\
|
<td><%killturn%></td>\
|
||||||
</tr>';
|
</tr>';
|
||||||
|
|
||||||
function pickGeneral(){
|
function pickGeneral() {
|
||||||
$btn = $(this);
|
$btn = $(this);
|
||||||
|
|
||||||
if (!confirm('빙의할까요? : {0}'.format($btn.data('name')))) {
|
if (!confirm('빙의할까요? : {0}'.format($btn.data('name')))) {
|
||||||
@@ -45,13 +45,13 @@ function pickGeneral(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_select_npc.php',
|
url: 'j_select_npc.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
pick:$btn.val()
|
pick: $btn.val()
|
||||||
}
|
}
|
||||||
}).then(function(result){
|
}).then(function(result) {
|
||||||
if(!result.result){
|
if (!result.result) {
|
||||||
alert(result.reason);
|
alert(result.reason);
|
||||||
location.refresh();
|
location.refresh();
|
||||||
}
|
}
|
||||||
@@ -62,32 +62,30 @@ function pickGeneral(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateOutdateTimer(){
|
function updateOutdateTimer() {
|
||||||
var $validUntilText = $('#valid_until_text');
|
var $validUntilText = $('#valid_until_text');
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var validUntil = $validUntilText.data('until');
|
var validUntil = $validUntilText.data('until');
|
||||||
if(validUntil <= 0){
|
if (validUntil <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
} else if (validUntil < now) {
|
||||||
else if(validUntil < now){
|
$validUntilText.data('until', 0);
|
||||||
$validUntilText.data('until',0);
|
|
||||||
$('#valid_until').hide();
|
$('#valid_until').hide();
|
||||||
$('#outdate_token').show();
|
$('#outdate_token').show();
|
||||||
return;
|
return;
|
||||||
}
|
} else if (validUntil - now <= 30000) {
|
||||||
else if(validUntil - now <= 30000){
|
$validUntilText.css('color', "rgb(255, {0}, {0})".format(255 * (validUntil - now) / 30000));
|
||||||
$validUntilText.css('color', "rgb(255, {0}, {0})".format(255*(validUntil - now)/30000));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(updateOutdateTimer, 1000);
|
setTimeout(updateOutdateTimer, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePickMoreTimer(){
|
function updatePickMoreTimer() {
|
||||||
var $btn = $('#btn_pick_more');
|
var $btn = $('#btn_pick_more');
|
||||||
|
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var remain = ($btn.data('available') - now) / 1000;
|
var remain = ($btn.data('available') - now) / 1000;
|
||||||
if(remain <= 0){
|
if (remain <= 0) {
|
||||||
$btn.prop('disabled', false)
|
$btn.prop('disabled', false)
|
||||||
$btn.html('다른 장수 보기');
|
$btn.html('다른 장수 보기');
|
||||||
return;
|
return;
|
||||||
@@ -98,53 +96,50 @@ function updatePickMoreTimer(){
|
|||||||
setTimeout(updatePickMoreTimer, 250);
|
setTimeout(updatePickMoreTimer, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
function printGenerals(value){
|
function printGenerals(value) {
|
||||||
$('.card_holder').empty();
|
$('.card_holder').empty();
|
||||||
$('#valid_until').show();
|
$('#valid_until').show();
|
||||||
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color','white');
|
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color', 'white');
|
||||||
$('#outdate_token').hide();
|
$('#outdate_token').hide();
|
||||||
var time = Date.now() + value.pickMoreSeconds*1000;
|
var time = Date.now() + value.pickMoreSeconds * 1000;
|
||||||
$('#btn_pick_more').data('available', time).prop('disabled',true);
|
$('#btn_pick_more').data('available', time).prop('disabled', true);
|
||||||
|
|
||||||
var pick = $.map(value.pick, function(value, key) {
|
var pick = $.map(value.pick, function(value, key) {
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
|
|
||||||
pick.sort(function(lhs, rhs){
|
pick.sort(function(lhs, rhs) {
|
||||||
var lsum = lhs.leadership+lhs.strength+lhs.intel;
|
var lsum = lhs.leadership + lhs.strength + lhs.intel;
|
||||||
var rsum = rhs.leadership+rhs.strength+rhs.intel;
|
var rsum = rhs.leadership + rhs.strength + rhs.intel;
|
||||||
return lsum - rsum;
|
return lsum - rsum;
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(pick, function(idx, cardData){
|
$.each(pick, function(idx, cardData) {
|
||||||
cardData.iconPath = getIconPath(cardData.imgsvr, cardData.picture);
|
cardData.iconPath = getIconPath(cardData.imgsvr, cardData.picture);
|
||||||
if(cardData.special in specialInfo){
|
if (cardData.special in specialInfo) {
|
||||||
cardData.specialText = TemplateEngine(templateSpecial, {
|
cardData.specialText = TemplateEngine(templateSpecial, {
|
||||||
text:cardData.special,
|
text: cardData.special,
|
||||||
info:specialInfo[cardData.special]
|
info: specialInfo[cardData.special]
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
cardData.specialText = cardData.special;
|
cardData.specialText = cardData.special;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cardData.special2 in specialInfo){
|
if (cardData.special2 in specialInfo) {
|
||||||
cardData.special2Text = TemplateEngine(templateSpecial, {
|
cardData.special2Text = TemplateEngine(templateSpecial, {
|
||||||
text:cardData.special2,
|
text: cardData.special2,
|
||||||
info:specialInfo[cardData.special2]
|
info: specialInfo[cardData.special2]
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
cardData.special2Text = cardData.special2;
|
cardData.special2Text = cardData.special2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cardData.personal in characterInfo){
|
if (cardData.personal in characterInfo) {
|
||||||
cardData.personalText = TemplateEngine(templateSpecial, {
|
cardData.personalText = TemplateEngine(templateSpecial, {
|
||||||
text:cardData.personal,
|
text: cardData.personal,
|
||||||
info:characterInfo[cardData.personal]
|
info: characterInfo[cardData.personal]
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
cardData.personalText = cardData.personal;
|
cardData.personalText = cardData.personal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,10 +149,10 @@ function printGenerals(value){
|
|||||||
$('.card_holder').append($card);
|
$('.card_holder').append($card);
|
||||||
$card.find('.select_btn').click(pickGeneral);
|
$card.find('.select_btn').click(pickGeneral);
|
||||||
$card.find('.obj_tooltip').tooltip({
|
$card.find('.obj_tooltip').tooltip({
|
||||||
title:function(){
|
title: function() {
|
||||||
return $.trim($(this).find('.tooltiptext').html());
|
return $.trim($(this).find('.tooltiptext').html());
|
||||||
},
|
},
|
||||||
html:true
|
html: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -165,59 +160,57 @@ function printGenerals(value){
|
|||||||
updateOutdateTimer();
|
updateOutdateTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
function printGeneralList(value){
|
function printGeneralList(value) {
|
||||||
var tokenList = value.token;
|
var tokenList = value.token;
|
||||||
var generalList = $.map(value.list, function(general){
|
var generalList = $.map(value.list, function(general) {
|
||||||
general = {
|
general = {
|
||||||
no:general[0],
|
no: general[0],
|
||||||
picture:general[1],
|
picture: general[1],
|
||||||
imgsvr:general[2],
|
imgsvr: general[2],
|
||||||
npc:general[3],
|
npc: general[3],
|
||||||
age:general[4],
|
age: general[4],
|
||||||
nation:general[5],
|
nation: general[5],
|
||||||
special:general[6],
|
special: general[6],
|
||||||
special2:general[7],
|
special2: general[7],
|
||||||
personal:general[8],
|
personal: general[8],
|
||||||
name:general[9],
|
name: general[9],
|
||||||
ownerName:general[10],
|
ownerName: general[10],
|
||||||
injury:general[11],
|
injury: general[11],
|
||||||
leadership:general[12],
|
leadership: general[12],
|
||||||
lbonus:general[13],
|
lbonus: general[13],
|
||||||
strength:general[14],
|
strength: general[14],
|
||||||
intel:general[15],
|
intel: general[15],
|
||||||
explevel:general[16],
|
explevel: general[16],
|
||||||
experience:general[17],
|
experience: general[17],
|
||||||
dedication:general[18],
|
dedication: general[18],
|
||||||
officerLevel:general[19],
|
officerLevel: general[19],
|
||||||
killturn:general[20],
|
killturn: general[20],
|
||||||
connect:general[21],
|
connect: general[21],
|
||||||
reserved:0
|
reserved: 0
|
||||||
};
|
};
|
||||||
if(general.npc < 2){
|
if (general.npc < 2) {
|
||||||
general.reserved = 2;
|
general.reserved = 2;
|
||||||
}
|
}
|
||||||
if(general.no in tokenList){
|
if (general.no in tokenList) {
|
||||||
general.reserved = 1;
|
general.reserved = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
general.userCSS = "";
|
general.userCSS = "";
|
||||||
general.nameAux = "";
|
general.nameAux = "";
|
||||||
|
|
||||||
if(general.reserved == 1){
|
if (general.reserved == 1) {
|
||||||
general.userCSS = 'color:violet';
|
general.userCSS = 'color:violet';
|
||||||
}
|
} else if (general.npc >= 2) {
|
||||||
else if(general.npc >= 2){
|
|
||||||
general.userCSS = 'color:cyan';
|
general.userCSS = 'color:cyan';
|
||||||
}
|
} else if (general.npc == 1) {
|
||||||
else if(general.npc == 1){
|
|
||||||
general.userCSS = 'color:skyblue';
|
general.userCSS = 'color:skyblue';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(general.ownerName){
|
if (general.ownerName) {
|
||||||
general.nameAux += '<br><small>({0})</small>'.format(general.ownerName);
|
general.nameAux += '<br><small>({0})</small>'.format(general.ownerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(general.reserved == 1){
|
if (general.reserved == 1) {
|
||||||
general.nameAux += '<br><small>({0}회)</small>'.format(tokenList[general.no]);
|
general.nameAux += '<br><small>({0}회)</small>'.format(tokenList[general.no]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,41 +219,41 @@ function printGeneralList(value){
|
|||||||
general.iconPath = getIconPath(general.imgsvr, general.picture);
|
general.iconPath = getIconPath(general.imgsvr, general.picture);
|
||||||
|
|
||||||
general.specialDomesticWithTooltip = TemplateEngine(templateSpecial, {
|
general.specialDomesticWithTooltip = TemplateEngine(templateSpecial, {
|
||||||
text:general.special,
|
text: general.special,
|
||||||
info:specialInfo[general.special]
|
info: specialInfo[general.special]
|
||||||
});
|
});
|
||||||
|
|
||||||
general.speicalWarWithTooltip = TemplateEngine(templateSpecial, {
|
general.speicalWarWithTooltip = TemplateEngine(templateSpecial, {
|
||||||
text:general.special2,
|
text: general.special2,
|
||||||
info:specialInfo[general.special2]
|
info: specialInfo[general.special2]
|
||||||
});
|
});
|
||||||
|
|
||||||
general.personalWithTooltip = TemplateEngine(templateSpecial, {
|
general.personalWithTooltip = TemplateEngine(templateSpecial, {
|
||||||
text:general.personal,
|
text: general.personal,
|
||||||
info:characterInfo[general.personal]
|
info: characterInfo[general.personal]
|
||||||
});
|
});
|
||||||
|
|
||||||
return general;
|
return general;
|
||||||
});
|
});
|
||||||
|
|
||||||
generalList.sort(function(lhs, rhs){
|
generalList.sort(function(lhs, rhs) {
|
||||||
if(lhs.reserved > rhs.reserved){
|
if (lhs.reserved > rhs.reserved) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(lhs.reserved < rhs.reserved){
|
if (lhs.reserved < rhs.reserved) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(lhs.total != rhs.total){
|
if (lhs.total != rhs.total) {
|
||||||
return rhs.total - lhs.total;
|
return rhs.total - lhs.total;
|
||||||
}
|
}
|
||||||
if(lhs.leadership != rhs.leadership){
|
if (lhs.leadership != rhs.leadership) {
|
||||||
return rhs.leadership - lhs.total;
|
return rhs.leadership - lhs.total;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lhs.name < rhs.name){
|
if (lhs.name < rhs.name) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(lhs.name > rhs.name){
|
if (lhs.name > rhs.name) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -270,9 +263,9 @@ function printGeneralList(value){
|
|||||||
_printGeneralList(true);
|
_printGeneralList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _printGeneralList(clear){
|
function _printGeneralList(clear) {
|
||||||
var $generalTable = $('#general_list');
|
var $generalTable = $('#general_list');
|
||||||
if(clear){
|
if (clear) {
|
||||||
$generalTable.empty();
|
$generalTable.empty();
|
||||||
$generalTable.data('lastIdx', 0);
|
$generalTable.data('lastIdx', 0);
|
||||||
$('#row_print_more').show();
|
$('#row_print_more').show();
|
||||||
@@ -284,77 +277,77 @@ function _printGeneralList(clear){
|
|||||||
var idxTo = Math.min(idxFrom + 50, generalList.length);
|
var idxTo = Math.min(idxFrom + 50, generalList.length);
|
||||||
$generalTable.data('lastIdx', idxTo);
|
$generalTable.data('lastIdx', idxTo);
|
||||||
|
|
||||||
for(var idx = idxFrom; idx < idxFrom + 50; idx++){
|
for (var idx = idxFrom; idx < idxFrom + 50; idx++) {
|
||||||
var general = generalList[idx];
|
var general = generalList[idx];
|
||||||
$generalTable.append(TemplateEngine(templateGeneralRow, general));
|
$generalTable.append(TemplateEngine(templateGeneralRow, general));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(idxTo == generalList.length){
|
if (idxTo == generalList.length) {
|
||||||
$('#row_print_more').hide();
|
$('#row_print_more').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$generalTable.find('.obj_tooltip').tooltip({
|
$generalTable.find('.obj_tooltip').tooltip({
|
||||||
title:function(){
|
title: function() {
|
||||||
return $.trim($(this).find('.tooltiptext').html());
|
return $.trim($(this).find('.tooltiptext').html());
|
||||||
},
|
},
|
||||||
html:true
|
html: true
|
||||||
});
|
});
|
||||||
$('#tb_general_list').show();
|
$('#tb_general_list').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function($){
|
$(function($) {
|
||||||
window.generalList = [];
|
window.generalList = [];
|
||||||
|
|
||||||
$.post('j_get_select_npc_token.php').then(function(value){
|
$.post('j_get_select_npc_token.php').then(function(value) {
|
||||||
if(!value.result){
|
if (!value.result) {
|
||||||
alert(value.reason);
|
alert(value.reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(value);
|
console.log(value);
|
||||||
printGenerals(value);
|
printGenerals(value);
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_pick_more').click(function(){
|
|
||||||
var generals = $.map($('.keep_select:checked'), function(value){
|
|
||||||
return $(value).val();
|
|
||||||
});
|
});
|
||||||
console.log(generals);
|
|
||||||
$.post({
|
$('#btn_pick_more').click(function() {
|
||||||
url:'j_get_select_npc_token.php',
|
var generals = $.map($('.keep_select:checked'), function(value) {
|
||||||
dataType:'json',
|
return $(value).val();
|
||||||
data:{
|
});
|
||||||
refresh:true,
|
console.log(generals);
|
||||||
keep:generals
|
$.post({
|
||||||
}
|
url: 'j_get_select_npc_token.php',
|
||||||
}).then(function(result){
|
dataType: 'json',
|
||||||
if(!result.result){
|
data: {
|
||||||
alert(result.reason);
|
refresh: true,
|
||||||
location.refresh();
|
keep: generals
|
||||||
}
|
}
|
||||||
console.log(result);
|
}).then(function(result) {
|
||||||
printGenerals(result);
|
if (!result.result) {
|
||||||
|
alert(result.reason);
|
||||||
|
location.refresh();
|
||||||
|
}
|
||||||
|
console.log(result);
|
||||||
|
printGenerals(result);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_load_general_list').click(function(){
|
$('#btn_load_general_list').click(function() {
|
||||||
$.post({
|
$.post({
|
||||||
url:'j_get_general_list.php',
|
url: 'j_get_general_list.php',
|
||||||
dataType:'json',
|
dataType: 'json',
|
||||||
data:{
|
data: {
|
||||||
with_token:true
|
with_token: true
|
||||||
}
|
}
|
||||||
}).then(function(result){
|
}).then(function(result) {
|
||||||
if(!result.result){
|
if (!result.result) {
|
||||||
alert(result.reason);
|
alert(result.reason);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
printGeneralList(result);
|
printGeneralList(result);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('#btn_print_more').click(function(){
|
$('#btn_print_more').click(function() {
|
||||||
_printGeneralList();
|
_printGeneralList();
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
+17
@@ -55,3 +55,20 @@ function LogText($prefix, $variable)
|
|||||||
$text = sprintf('%s : %s'."\r\n", $prefix, TVarDumper::dump($variable));
|
$text = sprintf('%s : %s'."\r\n", $prefix, TVarDumper::dump($variable));
|
||||||
file_put_contents(ROOT.'/d_log/'.UniqueConst::$serverName.'_dbg_logs.txt', $text, FILE_APPEND);
|
file_put_contents(ROOT.'/d_log/'.UniqueConst::$serverName.'_dbg_logs.txt', $text, FILE_APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareDir(string $dirPath, bool $forceCreate=true):bool{
|
||||||
|
if(file_exists($dirPath)){
|
||||||
|
if(is_dir($dirPath)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(!$forceCreate){
|
||||||
|
throw new \RuntimeException('이미 파일이 있습니다');
|
||||||
|
}
|
||||||
|
if(!unlink($dirPath)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return mkdir($dirPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mkdir($dirPath, 0777, true);
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ class che_계략_삼략 extends \sammo\BaseItem{
|
|||||||
protected $id = 22;
|
protected $id = 22;
|
||||||
protected $rawName = '삼략';
|
protected $rawName = '삼략';
|
||||||
protected $name = '삼략(계략)';
|
protected $name = '삼략(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
@@ -19,4 +19,14 @@ class che_계략_삼략 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'warMagicTrialProb'){
|
||||||
|
return $value + 0.1;
|
||||||
|
}
|
||||||
|
if($statName === 'warMagicSuccessProb'){
|
||||||
|
return $value + 0.1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ class che_계략_육도 extends \sammo\BaseItem{
|
|||||||
protected $id = 21;
|
protected $id = 21;
|
||||||
protected $rawName = '육도';
|
protected $rawName = '육도';
|
||||||
protected $name = '육도(계략)';
|
protected $name = '육도(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
@@ -19,4 +19,14 @@ class che_계략_육도 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'warMagicTrialProb'){
|
||||||
|
return $value + 0.1;
|
||||||
|
}
|
||||||
|
if($statName === 'warMagicSuccessProb'){
|
||||||
|
return $value + 0.1;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ class che_계략_이추 extends \sammo\BaseItem{
|
|||||||
protected $id = 5;
|
protected $id = 5;
|
||||||
protected $rawName = '이추';
|
protected $rawName = '이추';
|
||||||
protected $name = '이추(계략)';
|
protected $name = '이추(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
||||||
protected $cost = 1000;
|
protected $cost = 1000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -16,7 +16,7 @@ class che_계략_이추 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
if($turnType == '계략'){
|
if($turnType == '계략'){
|
||||||
if($varType == 'success') return $value + 0.1;
|
if($varType == 'success') return $value + 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
|
|||||||
protected $id = 5;
|
protected $id = 5;
|
||||||
protected $rawName = '항냥';
|
protected $rawName = '항냥';
|
||||||
protected $name = '항냥(계략)';
|
protected $name = '항냥(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
|
||||||
protected $cost = 3000;
|
protected $cost = 3000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -16,7 +16,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
if($turnType == '계략'){
|
if($turnType == '계략'){
|
||||||
if($varType == 'success') return $value + 0.2;
|
if($varType == 'success') return $value + 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use \sammo\BaseWarUnitTrigger;
|
||||||
|
use \sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use \sammo\WarUnitTrigger\che_반계시도;
|
||||||
|
use \sammo\WarUnitTrigger\che_반계발동;
|
||||||
|
|
||||||
|
class che_반계_백우선 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 45;
|
||||||
|
protected $rawName = '백우선';
|
||||||
|
protected $name = '백우선(반계)';
|
||||||
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||||
|
new che_반계시도($unit),
|
||||||
|
new che_반계발동($unit)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use \sammo\BaseWarUnitTrigger;
|
||||||
|
use \sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use \sammo\WarUnitTrigger\che_반계시도;
|
||||||
|
use \sammo\WarUnitTrigger\che_반계발동;
|
||||||
|
|
||||||
|
class che_반계_파초선 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 45;
|
||||||
|
protected $rawName = '파초선';
|
||||||
|
protected $name = '파초선(반계)';
|
||||||
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||||
|
new che_반계시도($unit),
|
||||||
|
new che_반계발동($unit)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\GeneralTrigger;
|
||||||
|
use \sammo\GeneralTriggerCaller;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use sammo\BaseWarUnitTrigger;
|
||||||
|
use sammo\WarUnitTrigger\che_부상무효;
|
||||||
|
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
|
||||||
|
class che_부적_태현청생부 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 9;
|
||||||
|
protected $rawName = '태현청생부';
|
||||||
|
protected $name = '태현청생부(부적)';
|
||||||
|
protected $info = '[전투] 저격 불가, 부상 없음';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\GeneralTrigger;
|
||||||
|
use \sammo\GeneralTriggerCaller;
|
||||||
|
use \sammo\BaseWarUnitTrigger;
|
||||||
|
use \sammo\WarUnitTriggerCaller;
|
||||||
|
use sammo\WarUnitTrigger\che_전투치료발동;
|
||||||
|
use sammo\WarUnitTrigger\che_전투치료시도;
|
||||||
|
|
||||||
|
class che_의술_상한잡병론 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 24;
|
||||||
|
protected $rawName = '상한잡병론';
|
||||||
|
protected $name = '상한잡병론(의술)';
|
||||||
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
|
||||||
|
return new GeneralTriggerCaller(
|
||||||
|
new GeneralTrigger\che_도시치료($general)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
|
||||||
|
{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_전투치료시도($unit, BaseWarUnitTrigger::TYPE_ITEM),
|
||||||
|
new che_전투치료발동($unit, BaseWarUnitTrigger::TYPE_ITEM)
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ class che_의술_청낭서 extends \sammo\BaseItem{
|
|||||||
protected $id = 23;
|
protected $id = 23;
|
||||||
protected $rawName = '청낭서';
|
protected $rawName = '청낭서';
|
||||||
protected $name = '청낭서(의술)';
|
protected $name = '청낭서(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class che_의술_태평청령 extends \sammo\BaseItem{
|
|||||||
protected $id = 24;
|
protected $id = 24;
|
||||||
protected $rawName = '태평청령';
|
protected $rawName = '태평청령';
|
||||||
protected $name = '태평청령(의술)';
|
protected $name = '태평청령(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use \sammo\WarUnitTrigger\che_저격시도;
|
||||||
|
use \sammo\WarUnitTrigger\che_저격발동;
|
||||||
|
|
||||||
|
class che_저격_매화수전 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 70;
|
||||||
|
protected $rawName = '매화수전';
|
||||||
|
protected $name = '매화수전(저격)';
|
||||||
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
|
||||||
|
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
use \sammo\SpecialityHelper;
|
||||||
|
use \sammo\WarUnit;
|
||||||
|
use sammo\WarUnitTriggerCaller;
|
||||||
|
use \sammo\WarUnitTrigger\che_저격시도;
|
||||||
|
use \sammo\WarUnitTrigger\che_저격발동;
|
||||||
|
|
||||||
|
class che_저격_비도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 70;
|
||||||
|
protected $rawName = '비도';
|
||||||
|
protected $name = '비도(저격)';
|
||||||
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
|
return new WarUnitTriggerCaller(
|
||||||
|
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
|
||||||
|
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ class che_저격_수극 extends \sammo\BaseItem{
|
|||||||
protected $id = 2;
|
protected $id = 2;
|
||||||
protected $rawName = '수극';
|
protected $rawName = '수극';
|
||||||
protected $name = '수극(저격)';
|
protected $name = '수극(저격)';
|
||||||
protected $info = '[전투] 전투 개시 전 20% 확률로 저격 시도. 1회용';
|
protected $info = '[전투] 전투 개시 전 50% 확률로 저격 시도. 1회용';
|
||||||
protected $cost = 1000;
|
protected $cost = 1000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
@@ -21,7 +21,7 @@ class che_저격_수극 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.2, 20, 40),
|
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.5, 20, 40),
|
||||||
new che_저격발동($unit)
|
new che_저격발동($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\ActionItem;
|
||||||
|
use \sammo\iAction;
|
||||||
|
use \sammo\General;
|
||||||
|
|
||||||
|
class che_행동_서촉지형도 extends \sammo\BaseItem{
|
||||||
|
|
||||||
|
protected $id = 22;
|
||||||
|
protected $rawName = '서촉지형도';
|
||||||
|
protected $name = '서촉지형도(행동)';
|
||||||
|
protected $info = '[전투] 공격 시 페이즈 + 2';
|
||||||
|
protected $cost = 200;
|
||||||
|
protected $consumable = false;
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if($statName === 'initWarPhase'){
|
||||||
|
return $value + 2;
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ class event_전투특기_격노 extends \sammo\BaseItem{
|
|||||||
protected $id = 74;
|
protected $id = 74;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(격노)';
|
protected $name = '비급(격노)';
|
||||||
protected $info = '[전투] 상대방 필살 및 회피 시도시 일정 확률로 격노(필살) 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class event_전투특기_공성 extends \sammo\BaseItem{
|
|||||||
protected $id = 53;
|
protected $id = 53;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(공성)';
|
protected $name = '비급(공성)';
|
||||||
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%';
|
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -32,4 +32,18 @@ class event_전투특기_공성 extends \sammo\BaseItem{
|
|||||||
}
|
}
|
||||||
return [1, 1];
|
return [1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_SIEGE;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ class event_전투특기_궁병 extends \sammo\BaseItem{
|
|||||||
protected $id = 51;
|
protected $id = 51;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(궁병)';
|
protected $name = '비급(궁병)';
|
||||||
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p';
|
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -29,6 +29,16 @@ class event_전투특기_궁병 extends \sammo\BaseItem{
|
|||||||
if($statName === 'warAvoidRatio'){
|
if($statName === 'warAvoidRatio'){
|
||||||
return $value + 0.2;
|
return $value + 0.2;
|
||||||
}
|
}
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_ARCHER;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ class event_전투특기_귀병 extends \sammo\BaseItem{
|
|||||||
protected $id = 40;
|
protected $id = 40;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(귀병)';
|
protected $name = '비급(귀병)';
|
||||||
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p';
|
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -29,6 +29,16 @@ class event_전투특기_귀병 extends \sammo\BaseItem{
|
|||||||
if($statName === 'warMagicSuccessProb'){
|
if($statName === 'warMagicSuccessProb'){
|
||||||
return $value + 0.2;
|
return $value + 0.2;
|
||||||
}
|
}
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_WIZARD;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ class event_전투특기_기병 extends \sammo\BaseItem{
|
|||||||
protected $id = 52;
|
protected $id = 52;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(기병)';
|
protected $name = '비급(기병)';
|
||||||
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%';
|
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -31,4 +31,18 @@ class event_전투특기_기병 extends \sammo\BaseItem{
|
|||||||
}
|
}
|
||||||
return [1.1, 1];
|
return [1.1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_CAVALRY;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,13 +7,14 @@ use \sammo\WarUnit;
|
|||||||
use \sammo\BaseWarUnitTrigger;
|
use \sammo\BaseWarUnitTrigger;
|
||||||
use \sammo\WarUnitTriggerCaller;
|
use \sammo\WarUnitTriggerCaller;
|
||||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use \sammo\WarUnitTrigger\che_돌격지속;
|
||||||
|
|
||||||
class event_전투특기_돌격 extends \sammo\BaseItem{
|
class event_전투특기_돌격 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 60;
|
protected $id = 60;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(돌격)';
|
protected $name = '비급(돌격)';
|
||||||
protected $info = '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%';
|
protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -21,21 +22,20 @@ class event_전투특기_돌격 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'initWarPhase'){
|
if($statName === 'initWarPhase'){
|
||||||
return $value + 1;
|
return $value + 2;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
if($unit->isAttacker()){
|
if($unit->isAttacker()){
|
||||||
return [1.1, 1];
|
return [1.05, 1];
|
||||||
}
|
}
|
||||||
return [1, 1];
|
return [1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
(new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '회피불가'))->setPriority(BaseWarUnitTrigger::PRIORITY_BEGIN + 200)
|
new che_돌격지속($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,14 @@ use \sammo\iAction;
|
|||||||
use \sammo\General;
|
use \sammo\General;
|
||||||
use \sammo\SpecialityHelper;
|
use \sammo\SpecialityHelper;
|
||||||
use \sammo\WarUnit;
|
use \sammo\WarUnit;
|
||||||
|
use \sammo\Util;
|
||||||
|
|
||||||
class event_전투특기_무쌍 extends \sammo\BaseItem{
|
class event_전투특기_무쌍 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $id = 61;
|
protected $id = 61;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(무쌍)';
|
protected $name = '비급(무쌍)';
|
||||||
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p';
|
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p, <br>승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)<br>승리 수만큼 피해 0.05%씩 감소(최대50%)';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -24,6 +25,11 @@ class event_전투특기_무쌍 extends \sammo\BaseItem{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
return [1.1, 1];
|
$attackMultiplier = 1.1;
|
||||||
|
$defenceMultiplier = 1;
|
||||||
|
$killnum = $unit->getGeneral()->getRankVar('killnum');
|
||||||
|
$attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4);
|
||||||
|
$defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.5);
|
||||||
|
return [$attackMultiplier, $defenceMultiplier];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ class event_전투특기_반계 extends \sammo\BaseItem{
|
|||||||
protected $id = 45;
|
protected $id = 45;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(반계)';
|
protected $name = '비급(반계)';
|
||||||
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)';
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -23,15 +23,15 @@ class event_전투특기_반계 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
||||||
return $value + 0.4;
|
return $value + 0.9;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM, false, '계략약화'),
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
|
||||||
new che_반계시도($unit, che_반계시도::TYPE_ITEM),
|
new che_반계시도($unit),
|
||||||
new che_반계발동($unit)
|
new che_반계발동($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class event_전투특기_보병 extends \sammo\BaseItem{
|
|||||||
protected $id = 50;
|
protected $id = 50;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(보병)';
|
protected $name = '비급(보병)';
|
||||||
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%';
|
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -32,4 +32,18 @@ class event_전투특기_보병 extends \sammo\BaseItem{
|
|||||||
}
|
}
|
||||||
return [1, 0.8];
|
return [1, 0.8];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_FOOTMAN;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ class event_전투특기_위압 extends \sammo\BaseItem{
|
|||||||
protected $id = 63;
|
protected $id = 63;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(위압)';
|
protected $name = '비급(위압)';
|
||||||
protected $info = '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)';
|
protected $info = '[전투] 첫 페이즈 위압 발동(적 공격, 회피 불가, 사기 5 감소)';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class event_전투특기_의술 extends \sammo\BaseItem{
|
|||||||
protected $id = 73;
|
protected $id = 73;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(의술)';
|
protected $name = '비급(의술)';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class event_전투특기_저격 extends \sammo\BaseItem{
|
|||||||
protected $id = 70;
|
protected $id = 70;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(저격)';
|
protected $name = '비급(저격)';
|
||||||
protected $info = '[전투] 새로운 상대와 전투 시 1/3 확률로 저격 발동, 성공 시 사기+10';
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -21,7 +21,7 @@ class event_전투특기_저격 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 1/3, 20, 60),
|
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
|
||||||
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
|
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class event_전투특기_필살 extends \sammo\BaseItem{
|
|||||||
protected $id = 71;
|
protected $id = 71;
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(필살)';
|
protected $name = '비급(필살)';
|
||||||
protected $info = '[전투] 필살 확률 +20%p, 필살 발동시 대상 회피 불가';
|
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -20,7 +20,7 @@ class event_전투특기_필살 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'warCriticalRatio'){
|
if($statName === 'warCriticalRatio'){
|
||||||
return $value + 0.2;
|
return $value + 0.3;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ class che_종횡가 extends \sammo\BaseNation{
|
|||||||
if($varType == 'delay'){
|
if($varType == 'delay'){
|
||||||
return Util::round($value / 2);
|
return Util::round($value / 2);
|
||||||
}
|
}
|
||||||
|
if($varType == 'globalDelay'){
|
||||||
|
return Util::round($value / 2);
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ class che_격노 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 74;
|
protected $id = 74;
|
||||||
protected $name = '격노';
|
protected $name = '격노';
|
||||||
protected $info = '[전투] 상대방 필살 및 회피 시도시 일정 확률로 격노(필살) 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가), 격노마다 대미지 20% 추가 중첩';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -20,6 +20,11 @@ class che_격노 extends \sammo\BaseSpecial{
|
|||||||
SpecialityHelper::STAT_STRENGTH,
|
SpecialityHelper::STAT_STRENGTH,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
|
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
|
||||||
|
return [1 + 0.2*$activatedCnt, 1];
|
||||||
|
}
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_격노시도($unit),
|
new che_격노시도($unit),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class che_견고 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 62;
|
protected $id = 62;
|
||||||
protected $name = '견고';
|
protected $name = '견고';
|
||||||
protected $info = '[전투] 상대 필살, 격노, 위압, 저격 불가, 상대 계략 시도시 성공 확률 -10%p, 부상 없음, 아군 피해 -5%';
|
protected $info = '[전투] 상대 필살, 저격 불가, 상대 계략 시도시 성공 확률 -10%p, 부상 없음, 아군 피해 -10%';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -30,11 +30,11 @@ class che_견고 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '위압불가', '격노불가', '계략약화', '저격불가')
|
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '계략약화', '저격불가')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
return [1, 0.95];
|
return [1, 0.9];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ class che_공성 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 53;
|
protected $id = 53;
|
||||||
protected $name = '공성';
|
protected $name = '공성';
|
||||||
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%';
|
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -33,4 +33,18 @@ class che_공성 extends \sammo\BaseSpecial{
|
|||||||
}
|
}
|
||||||
return [1, 1];
|
return [1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_SIEGE;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ class che_궁병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 51;
|
protected $id = 51;
|
||||||
protected $name = '궁병';
|
protected $name = '궁병';
|
||||||
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p';
|
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -31,6 +31,16 @@ class che_궁병 extends \sammo\BaseSpecial{
|
|||||||
if($statName === 'warAvoidRatio'){
|
if($statName === 'warAvoidRatio'){
|
||||||
return $value + 0.2;
|
return $value + 0.2;
|
||||||
}
|
}
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_ARCHER;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ class che_귀병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 40;
|
protected $id = 40;
|
||||||
protected $name = '귀병';
|
protected $name = '귀병';
|
||||||
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p';
|
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -30,6 +30,16 @@ class che_귀병 extends \sammo\BaseSpecial{
|
|||||||
if($statName === 'warMagicSuccessProb'){
|
if($statName === 'warMagicSuccessProb'){
|
||||||
return $value + 0.2;
|
return $value + 0.2;
|
||||||
}
|
}
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_WIZARD;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ class che_기병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 52;
|
protected $id = 52;
|
||||||
protected $name = '기병';
|
protected $name = '기병';
|
||||||
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%';
|
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -33,4 +33,18 @@ class che_기병 extends \sammo\BaseSpecial{
|
|||||||
}
|
}
|
||||||
return [1.1, 1];
|
return [1.1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_CAVALRY;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,12 +7,13 @@ use \sammo\WarUnit;
|
|||||||
use \sammo\BaseWarUnitTrigger;
|
use \sammo\BaseWarUnitTrigger;
|
||||||
use \sammo\WarUnitTriggerCaller;
|
use \sammo\WarUnitTriggerCaller;
|
||||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||||
|
use \sammo\WarUnitTrigger\che_돌격지속;
|
||||||
|
|
||||||
class che_돌격 extends \sammo\BaseSpecial{
|
class che_돌격 extends \sammo\BaseSpecial{
|
||||||
|
|
||||||
protected $id = 60;
|
protected $id = 60;
|
||||||
protected $name = '돌격';
|
protected $name = '돌격';
|
||||||
protected $info = '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%';
|
protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -22,21 +23,20 @@ class che_돌격 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'initWarPhase'){
|
if($statName === 'initWarPhase'){
|
||||||
return $value + 1;
|
return $value + 2;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
if($unit->isAttacker()){
|
if($unit->isAttacker()){
|
||||||
return [1.1, 1];
|
return [1.05, 1];
|
||||||
}
|
}
|
||||||
return [1, 1];
|
return [1, 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
(new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '회피불가'))->setPriority(BaseWarUnitTrigger::PRIORITY_BEGIN + 200)
|
new che_돌격지속($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,13 @@ use \sammo\iAction;
|
|||||||
use \sammo\General;
|
use \sammo\General;
|
||||||
use \sammo\SpecialityHelper;
|
use \sammo\SpecialityHelper;
|
||||||
use \sammo\WarUnit;
|
use \sammo\WarUnit;
|
||||||
|
use \sammo\Util;
|
||||||
|
|
||||||
class che_무쌍 extends \sammo\BaseSpecial{
|
class che_무쌍 extends \sammo\BaseSpecial{
|
||||||
|
|
||||||
protected $id = 61;
|
protected $id = 61;
|
||||||
protected $name = '무쌍';
|
protected $name = '무쌍';
|
||||||
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p';
|
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p, <br>승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)<br>승리 수만큼 피해 0.05%씩 감소(최대50%)';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -25,6 +26,11 @@ class che_무쌍 extends \sammo\BaseSpecial{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
return [1.1, 1];
|
$attackMultiplier = 1.1;
|
||||||
|
$defenceMultiplier = 1;
|
||||||
|
$killnum = $unit->getGeneral()->getRankVar('killnum');
|
||||||
|
$attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4);
|
||||||
|
$defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.5);
|
||||||
|
return [$attackMultiplier, $defenceMultiplier];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ class che_반계 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 45;
|
protected $id = 45;
|
||||||
protected $name = '반계';
|
protected $name = '반계';
|
||||||
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)';
|
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -24,7 +24,7 @@ class che_반계 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
|
||||||
return $value + 0.4;
|
return $value + 0.9;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class che_보병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 50;
|
protected $id = 50;
|
||||||
protected $name = '보병';
|
protected $name = '보병';
|
||||||
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%';
|
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -33,4 +33,18 @@ class che_보병 extends \sammo\BaseSpecial{
|
|||||||
}
|
}
|
||||||
return [1, 0.8];
|
return [1, 0.8];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
|
if(\sammo\Util::starts_with($statName, 'dex')){
|
||||||
|
$myArmType = 'dex'.GameUnitConst::T_FOOTMAN;
|
||||||
|
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
|
||||||
|
if($aux['isAttacker'] && $opposeArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
if(!$aux['isAttacker'] && $myArmType === $statName){
|
||||||
|
return $value + $general->getVar($myArmType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ class che_위압 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 63;
|
protected $id = 63;
|
||||||
protected $name = '위압';
|
protected $name = '위압';
|
||||||
protected $info = '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)';
|
protected $info = '[전투] 첫 페이즈 위압 발동(적 공격, 회피 불가, 사기 5 감소)';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -21,9 +21,6 @@ class che_위압 extends \sammo\BaseSpecial{
|
|||||||
];
|
];
|
||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
if($unit->getPhase() != 0){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_위압시도($unit),
|
new che_위압시도($unit),
|
||||||
new che_위압발동($unit)
|
new che_위압발동($unit)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class che_의술 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 73;
|
protected $id = 73;
|
||||||
protected $name = '의술';
|
protected $name = '의술';
|
||||||
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)';
|
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
|
static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
|
||||||
static $selectWeight = 2;
|
static $selectWeight = 2;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class che_저격 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 70;
|
protected $id = 70;
|
||||||
protected $name = '저격';
|
protected $name = '저격';
|
||||||
protected $info = '[전투] 새로운 상대와 전투 시 1/3 확률로 저격 발동, 성공 시 사기+10';
|
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -24,7 +24,7 @@ class che_저격 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||||
return new WarUnitTriggerCaller(
|
return new WarUnitTriggerCaller(
|
||||||
new che_저격시도($unit, che_저격시도::TYPE_NONE, 1/3, 20, 60),
|
new che_저격시도($unit, che_저격시도::TYPE_NONE, 0.5, 20, 40),
|
||||||
new che_저격발동($unit)
|
new che_저격발동($unit)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class che_징병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 72;
|
protected $id = 72;
|
||||||
protected $name = '징병';
|
protected $name = '징병';
|
||||||
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +15%';
|
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +25%';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -29,7 +29,7 @@ class che_징병 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'leadership'){
|
if($statName === 'leadership'){
|
||||||
return $value *= 1.15;
|
return $value + $general->getVar('leadership') * 0.25;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class che_척사 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 75;
|
protected $id = 75;
|
||||||
protected $name = '척사';
|
protected $name = '척사';
|
||||||
protected $info = '[전투] 지역·도시 병종 상대로 대미지 +10%, 아군 피해 -10%';
|
protected $info = '[전투] 지역·도시 병종 상대로 대미지 +15%, 아군 피해 -15%';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -22,7 +22,7 @@ class che_척사 extends \sammo\BaseSpecial{
|
|||||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||||
$opposeCrewType = $unit->getOppose()->getCrewType();
|
$opposeCrewType = $unit->getOppose()->getCrewType();
|
||||||
if($opposeCrewType->reqCities || $opposeCrewType->reqRegions){
|
if($opposeCrewType->reqCities || $opposeCrewType->reqRegions){
|
||||||
return [1.1, 0.9];
|
return [1.15, 0.85];
|
||||||
}
|
}
|
||||||
return [1, 1];
|
return [1, 1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class che_필살 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 71;
|
protected $id = 71;
|
||||||
protected $name = '필살';
|
protected $name = '필살';
|
||||||
protected $info = '[전투] 필살 확률 +20%p, 필살 발동시 대상 회피 불가';
|
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -23,7 +23,7 @@ class che_필살 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||||
if($statName === 'warCriticalRatio'){
|
if($statName === 'warCriticalRatio'){
|
||||||
return $value + 0.2;
|
return $value + 0.30;
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ abstract class BaseWarUnitTrigger extends ObjectTrigger{
|
|||||||
$itemRawName = $item->getRawName();
|
$itemRawName = $item->getRawName();
|
||||||
$self->activateSkill($itemName);
|
$self->activateSkill($itemName);
|
||||||
|
|
||||||
if (!($this->raiseType & static::TYPE_CONSUMABLE_ITEM)) {
|
if ($this->raiseType != static::TYPE_CONSUMABLE_ITEM) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ use \sammo\Constraint\ConstraintHelper;
|
|||||||
abstract class BaseCommand{
|
abstract class BaseCommand{
|
||||||
static protected $actionName = 'CommandName';
|
static protected $actionName = 'CommandName';
|
||||||
static public $reqArg = false;
|
static public $reqArg = false;
|
||||||
|
static protected $isLazyCalcReqTurn = false;
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle():string{
|
||||||
return $this->getName();
|
return $this->getName();
|
||||||
@@ -54,7 +55,6 @@ abstract class BaseCommand{
|
|||||||
|
|
||||||
static protected $isInitStatic = true;
|
static protected $isInitStatic = true;
|
||||||
protected static function initStatic(){
|
protected static function initStatic(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(General $generalObj, array $env, $arg = null){
|
public function __construct(General $generalObj, array $env, $arg = null){
|
||||||
@@ -271,6 +271,29 @@ abstract class BaseCommand{
|
|||||||
return $this->logger;
|
return $this->logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract public function getNextExecuteKey():string;
|
||||||
|
abstract public function getNextAvailableTurn():?int;
|
||||||
|
abstract public function setNextAvailable(?int $yearMonth=null);
|
||||||
|
|
||||||
|
protected function testPostReqTurn():?array{
|
||||||
|
if(!$this->getPostReqTurn()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nextAvailableTurn = $this->getNextAvailableTurn();
|
||||||
|
if($nextAvailableTurn === null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||||
|
$remainTurn = $nextAvailableTurn - $yearMonth;
|
||||||
|
if($remainTurn <= 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['testPostReqTurn', "{$remainTurn}턴 더 기다려야 합니다"];
|
||||||
|
}
|
||||||
|
|
||||||
public function testPermissionToReserve():?string{
|
public function testPermissionToReserve():?string{
|
||||||
if($this->cachedPermissionToReserve){
|
if($this->cachedPermissionToReserve){
|
||||||
return $this->reasonNoPermissionToReserve;
|
return $this->reasonNoPermissionToReserve;
|
||||||
@@ -331,6 +354,11 @@ abstract class BaseCommand{
|
|||||||
];
|
];
|
||||||
|
|
||||||
[$this->reasonConstraint, $this->reasonNotMinConditionMet] = Constraint::testAll($this->minConditionConstraints??[], $constraintInput, $this->env);
|
[$this->reasonConstraint, $this->reasonNotMinConditionMet] = Constraint::testAll($this->minConditionConstraints??[], $constraintInput, $this->env);
|
||||||
|
|
||||||
|
if($this->reasonNotMinConditionMet === null && !self::$isLazyCalcReqTurn){
|
||||||
|
[$this->reasonConstraint, $this->reasonNotMinConditionMet] = $this->testPostReqTurn();
|
||||||
|
}
|
||||||
|
|
||||||
$this->cachedMinConditionMet = true;
|
$this->cachedMinConditionMet = true;
|
||||||
return $this->reasonNotMinConditionMet;
|
return $this->reasonNotMinConditionMet;
|
||||||
|
|
||||||
@@ -364,6 +392,11 @@ abstract class BaseCommand{
|
|||||||
];
|
];
|
||||||
|
|
||||||
[$this->reasonConstraint, $this->reasonNotFullConditionMet] = Constraint::testAll($this->fullConditionConstraints??[], $constraintInput, $this->env);
|
[$this->reasonConstraint, $this->reasonNotFullConditionMet] = Constraint::testAll($this->fullConditionConstraints??[], $constraintInput, $this->env);
|
||||||
|
|
||||||
|
if($this->reasonNotFullConditionMet === null){
|
||||||
|
[$this->reasonConstraint, $this->reasonNotFullConditionMet] = $this->testPostReqTurn();
|
||||||
|
}
|
||||||
|
|
||||||
$this->cachedFullConditionMet = true;
|
$this->cachedFullConditionMet = true;
|
||||||
return $this->reasonNotFullConditionMet;
|
return $this->reasonNotFullConditionMet;
|
||||||
|
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ class che_기술연구 extends che_상업투자{
|
|||||||
if($trust < 80){
|
if($trust < 80){
|
||||||
$successRatio *= $trust / 80;
|
$successRatio *= $trust / 80;
|
||||||
}
|
}
|
||||||
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
|
$successRatio = $general->onCalcDomestic(static::$actionKey, 'success', $successRatio);
|
||||||
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
|
$failRatio = $general->onCalcDomestic(static::$actionKey, 'fail', $failRatio);
|
||||||
|
|
||||||
$successRatio = Util::valueFit($successRatio, 0, 1);
|
$successRatio = Util::valueFit($successRatio, 0, 1);
|
||||||
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ class che_상업투자 extends Command\GeneralCommand{
|
|||||||
if($trust < 80){
|
if($trust < 80){
|
||||||
$successRatio *= $trust / 80;
|
$successRatio *= $trust / 80;
|
||||||
}
|
}
|
||||||
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
|
$successRatio = $general->onCalcDomestic(static::$actionKey, 'success', $successRatio);
|
||||||
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
|
$failRatio = $general->onCalcDomestic(static::$actionKey, 'fail', $failRatio);
|
||||||
|
|
||||||
$successRatio = Util::valueFit($successRatio, 0, 1);
|
$successRatio = Util::valueFit($successRatio, 0, 1);
|
||||||
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class che_숙련전환 extends Command\GeneralCommand
|
|||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
$srcDex = $general->getVar('dex' . $this->srcArmType);
|
$srcDex = $general->getVar('dex' . $this->srcArmType);
|
||||||
$cutDex = Util::toInt($srcDex * 0.25);
|
$cutDex = Util::toInt($srcDex * 0.4);
|
||||||
$cutDexText = number_format($cutDex);
|
$cutDexText = number_format($cutDex);
|
||||||
$addDex = Util::toInt($cutDex * 9 / 10);
|
$addDex = Util::toInt($cutDex * 9 / 10);
|
||||||
$addDexText = number_format($addDex);
|
$addDexText = number_format($addDex);
|
||||||
@@ -207,7 +207,7 @@ class che_숙련전환 extends Command\GeneralCommand
|
|||||||
foreach (GameUnitConst::allType() as $armType => $armName) {
|
foreach (GameUnitConst::allType() as $armType => $armName) {
|
||||||
$dexVal = $general->getVar('dex' . $armType);
|
$dexVal = $general->getVar('dex' . $armType);
|
||||||
$dexValText = number_format($dexVal);
|
$dexValText = number_format($dexVal);
|
||||||
$cutDex = Util::toInt($dexVal * 0.25);
|
$cutDex = Util::toInt($dexVal * 0.4);
|
||||||
$addDex = Util::toInt($cutDex * 9 / 10);
|
$addDex = Util::toInt($cutDex * 9 / 10);
|
||||||
$addDexText = number_format($addDex);
|
$addDexText = number_format($addDex);
|
||||||
$newDex = $dexVal - $cutDex;
|
$newDex = $dexVal - $cutDex;
|
||||||
@@ -220,7 +220,7 @@ class che_숙련전환 extends Command\GeneralCommand
|
|||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
본인의 특정 병종 숙련을 25% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종 숙련으로 전환합니다.<br>
|
본인의 특정 병종 숙련을 40% 줄이고, 줄어든 숙련 중 9/10(90%p)를 다른 병종 숙련으로 전환합니다.<br>
|
||||||
|
|
||||||
<select class='formInput' name="srcArmType" id="srcArmType" size='1' style='color:white;background-color:black;'>
|
<select class='formInput' name="srcArmType" id="srcArmType" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach ($dexSrcTexts as $armType => $infoText) : ?>
|
<?php foreach ($dexSrcTexts as $armType => $infoText) : ?>
|
||||||
|
|||||||
@@ -131,17 +131,9 @@ class che_인재탐색 extends Command\GeneralCommand
|
|||||||
|
|
||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
$nationCnt = count(getAllNationStaticInfo());
|
|
||||||
|
|
||||||
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
||||||
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
||||||
|
|
||||||
$genCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc < 2', $nationID);
|
|
||||||
$npcCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND 3 <= npc AND npc <= 4', $nationID);
|
|
||||||
|
|
||||||
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
|
|
||||||
$avgCnt = $currCnt / $nationCnt;
|
|
||||||
|
|
||||||
$foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt));
|
$foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt));
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|||||||
@@ -32,24 +32,6 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function init(){
|
protected function init(){
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$env = $this->env;
|
|
||||||
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
|
||||||
$auxYearMonth = $general->getAuxVar('used_'.$this->getName())??-999;
|
|
||||||
|
|
||||||
if($yearMonth < $auxYearMonth + 60){
|
|
||||||
$this->minConditionConstraints=[
|
|
||||||
ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다')
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
|
||||||
ConstraintHelper::AlwaysFail('초기화한 지 5년이 지나야합니다')
|
|
||||||
];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$this->minConditionConstraints=[
|
$this->minConditionConstraints=[
|
||||||
ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.'),
|
ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.'),
|
||||||
];
|
];
|
||||||
@@ -57,7 +39,6 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
|||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints=[
|
||||||
ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.')
|
ConstraintHelper::ReqGeneralValue(static::$specialType, static::$specialText, '!=', 'None', '특기가 없습니다.')
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle():string{
|
||||||
@@ -82,7 +63,7 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn():int{
|
||||||
return 0;
|
return 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTermString():string{
|
public function getTermString():string{
|
||||||
@@ -113,7 +94,6 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$general->setVar(static::$specialType, 'None');
|
$general->setVar(static::$specialType, 'None');
|
||||||
$general->setVar(static::$speicalAge, $general->getVar('age') + 1);
|
$general->setVar(static::$speicalAge, $general->getVar('age') + 1);
|
||||||
$general->setAuxVar('used_'.$this->getName(), $yearMonth);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
|
|
||||||
|
|||||||
@@ -127,8 +127,8 @@ class che_정착장려 extends Command\GeneralCommand{
|
|||||||
$score = Util::valueFit($this->calcBaseScore(), 1);
|
$score = Util::valueFit($this->calcBaseScore(), 1);
|
||||||
|
|
||||||
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
|
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
|
||||||
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
|
$successRatio = $general->onCalcDomestic(static::$actionKey, 'success', $successRatio);
|
||||||
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
|
$failRatio = $general->onCalcDomestic(static::$actionKey, 'fail', $failRatio);
|
||||||
|
|
||||||
$successRatio = Util::valueFit($successRatio, 0, 1);
|
$successRatio = Util::valueFit($successRatio, 0, 1);
|
||||||
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
||||||
|
|||||||
@@ -128,8 +128,8 @@ class che_주민선정 extends Command\GeneralCommand{
|
|||||||
$score = Util::valueFit($this->calcBaseScore(), 1);
|
$score = Util::valueFit($this->calcBaseScore(), 1);
|
||||||
|
|
||||||
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
|
['success'=>$successRatio, 'fail'=>$failRatio] = CriticalRatioDomestic($general, static::$statKey);
|
||||||
$successRatio = $general->onCalcDomestic(static::$cityKey, 'success', $successRatio);
|
$successRatio = $general->onCalcDomestic(static::$actionKey, 'success', $successRatio);
|
||||||
$failRatio = $general->onCalcDomestic(static::$cityKey, 'fail', $failRatio);
|
$failRatio = $general->onCalcDomestic(static::$actionKey, 'fail', $failRatio);
|
||||||
|
|
||||||
$successRatio = Util::valueFit($successRatio, 0, 1);
|
$successRatio = Util::valueFit($successRatio, 0, 1);
|
||||||
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
$failRatio = Util::valueFit($failRatio, 0, 1 - $successRatio);
|
||||||
|
|||||||
@@ -1,6 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo\Command;
|
namespace sammo\Command;
|
||||||
|
use \sammo\Util;
|
||||||
|
|
||||||
abstract class GeneralCommand extends BaseCommand{
|
abstract class GeneralCommand extends BaseCommand{
|
||||||
|
|
||||||
|
public function getNextExecuteKey():string{
|
||||||
|
$turnKey = static::$actionName;
|
||||||
|
$generalID = $this->getGeneral()->getID();
|
||||||
|
$executeKey = "next_execute_{$generalID}_{$turnKey}";
|
||||||
|
return $executeKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNextAvailableTurn():?int{
|
||||||
|
if($this->isArgValid && !$this->getPostReqTurn()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$db = \sammo\DB::db();
|
||||||
|
$lastExecuteStor = \sammo\KVStorage::getStorage($db, 'next_execute');
|
||||||
|
return $lastExecuteStor->getValue($this->getNextExecuteKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNextAvailable(?int $yearMonth=null){
|
||||||
|
if(!$this->getPostReqTurn()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if($yearMonth === null){
|
||||||
|
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month'])
|
||||||
|
+ $this->getPostReqTurn() - $this->getPreReqTurn();
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = \sammo\DB::db();
|
||||||
|
$lastExecuteStor = \sammo\KVStorage::getStorage($db, 'next_execute');
|
||||||
|
$lastExecuteStor->setValue($this->getNextExecuteKey(), $yearMonth);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -99,7 +99,7 @@ class che_급습 extends Command\NationCommand
|
|||||||
$reqTurn = $this->getPreReqTurn() + 1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
@@ -193,7 +193,7 @@ class che_급습 extends Command\NationCommand
|
|||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
$db->update('diplomacy', [
|
$db->update('diplomacy', [
|
||||||
'term' => $db->sqleval('`term` - %i', 3),
|
'term' => $db->sqleval('`term` - %i', 3),
|
||||||
|
|||||||
@@ -124,9 +124,18 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn():int{
|
||||||
|
//NOTE: 자체 postReqTurn 사용
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNextAvailableTurn():?int{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNextAvailable(?int $yearMonth=null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public function getBrief():string{
|
public function getBrief():string{
|
||||||
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
[$goldAmount, $riceAmount] = $this->arg['amountList'];
|
||||||
$goldAmountText = number_format($goldAmount);
|
$goldAmountText = number_format($goldAmount);
|
||||||
@@ -264,12 +273,12 @@ class che_물자원조 extends Command\NationCommand{
|
|||||||
>【<?=$nation['name']?> 】</option>
|
>【<?=$nation['name']?> 】</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
국고 <select class='formInput' name="amountList[]" class="amountList" size='1' style='color:white;background-color:black;'>
|
국고 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
||||||
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
병량 <select class='formInput' name="amountList[]" class="amountList" size='1' style='color:white;background-color:black;'>
|
병량 <select class='formInput amountList' name="amountList[]" size='1' style='color:white;background-color:black;'>
|
||||||
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
<?php foreach(Util::range($currentNationLevel+1) as $nationLevel): ?>
|
||||||
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
<option value='<?=$nationLevel*GameConst::$coefAidAmount?>'><?=$nationLevel*GameConst::$coefAidAmount?></option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@@ -72,9 +72,6 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints=[
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::AllowDiplomacyStatus($this->generalObj->getNationID(), [
|
|
||||||
0, 1
|
|
||||||
], '전쟁중이 아닙니다.'),
|
|
||||||
ConstraintHelper::OccupiedDestCity(),
|
ConstraintHelper::OccupiedDestCity(),
|
||||||
ConstraintHelper::AvailableStrategicCommand()
|
ConstraintHelper::AvailableStrategicCommand()
|
||||||
];
|
];
|
||||||
@@ -85,7 +82,7 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn()+1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
@@ -161,7 +158,7 @@ class che_백성동원 extends Command\NationCommand{
|
|||||||
$logger->pushNationalHistoryLog("<L><b>【전략】</b></><D><b>{$nationName}</b></>{$josaYiNation} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 하였습니다.");
|
$logger->pushNationalHistoryLog("<L><b>【전략】</b></><D><b>{$nationName}</b></>{$josaYiNation} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 하였습니다.");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn()+1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
@@ -179,7 +179,7 @@ class che_수몰 extends Command\NationCommand{
|
|||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>수몰</>을 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class che_의병모집 extends Command\NationCommand
|
|||||||
$reqTurn = $this->getPreReqTurn() + 1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
@@ -232,7 +232,7 @@ class che_의병모집 extends Command\NationCommand
|
|||||||
$gameStor->npccount = $lastCreatGenIdx;
|
$gameStor->npccount = $lastCreatGenIdx;
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'gennum' => $db->sqleval('gennum + %i', $createGenCnt),
|
'gennum' => $db->sqleval('gennum + %i', $createGenCnt),
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class che_이호경식 extends Command\NationCommand
|
|||||||
$reqTurn = $this->getPreReqTurn() + 1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
@@ -190,7 +190,7 @@ class che_이호경식 extends Command\NationCommand
|
|||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
$db->update('diplomacy', [
|
$db->update('diplomacy', [
|
||||||
'term' => $db->sqleval('IF(`state`=0, %i, `term`+ %i)', 3, 3),
|
'term' => $db->sqleval('IF(`state`=0, %i, `term`+ %i)', 3, 3),
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class che_초토화 extends Command\NationCommand{
|
|||||||
ConstraintHelper::ReqNationValue('surlimit', '제한 턴', '==', 0, '외교제한 턴이 남아있습니다.'),
|
ConstraintHelper::ReqNationValue('surlimit', '제한 턴', '==', 0, '외교제한 턴이 남아있습니다.'),
|
||||||
ConstraintHelper::DisallowDiplomacyStatus($this->generalObj->getNationID(), [
|
ConstraintHelper::DisallowDiplomacyStatus($this->generalObj->getNationID(), [
|
||||||
0 => '평시에만 가능합니다.',
|
0 => '평시에만 가능합니다.',
|
||||||
1 => '평시에만 가능합니다.'
|
|
||||||
], ),
|
], ),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -96,9 +95,18 @@ class che_초토화 extends Command\NationCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn():int{
|
||||||
|
//NOTE: 자체 postReqTurn 사용
|
||||||
return 24;
|
return 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNextAvailableTurn():?int{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNextAvailable(?int $yearMonth=null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle():string{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ use \sammo\{
|
|||||||
LastTurn,
|
LastTurn,
|
||||||
GameUnitConst,
|
GameUnitConst,
|
||||||
Command,
|
Command,
|
||||||
|
KVStorage,
|
||||||
Message, MessageTarget
|
Message, MessageTarget
|
||||||
};
|
};
|
||||||
|
|
||||||
use function \sammo\{
|
use function \sammo\{
|
||||||
|
buildNationCommandClass,
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
@@ -38,6 +40,7 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$destNationID = $this->arg['destNationID'];
|
$destNationID = $this->arg['destNationID'];
|
||||||
|
$commandType = $this->arg['commandType'];
|
||||||
|
|
||||||
if(!is_int($destNationID)){
|
if(!is_int($destNationID)){
|
||||||
return false;
|
return false;
|
||||||
@@ -46,8 +49,17 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!is_string($commandType)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!in_array($commandType, GameConst::$availableChiefCommand['전략'])){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->arg = [
|
$this->arg = [
|
||||||
'destNationID'=>$destNationID
|
'destNationID'=>$destNationID,
|
||||||
|
'commandType'=>$commandType
|
||||||
];
|
];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -58,12 +70,11 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$this->setCity();
|
$this->setCity();
|
||||||
$this->setNation(['strategic_cmd_limit']);
|
$this->setNation();
|
||||||
|
|
||||||
$this->minConditionConstraints=[
|
$this->minConditionConstraints=[
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::AvailableStrategicCommand(),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +82,24 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
{
|
{
|
||||||
$this->setDestNation($this->arg['destNationID'], null);
|
$this->setDestNation($this->arg['destNationID'], null);
|
||||||
|
|
||||||
|
if($this->getNationID() == 0){
|
||||||
|
$this->fullConditionConstraints=[
|
||||||
|
ConstraintHelper::OccupiedCity()
|
||||||
|
];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cmd = buildNationCommandClass($this->arg['commandType'], $this->generalObj, $this->env, new LastTurn());
|
||||||
|
|
||||||
|
$currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||||
|
$nextAvailableTurn = $cmd->getNextAvailableTurn();
|
||||||
|
if($currYearMonth < $nextAvailableTurn){
|
||||||
|
$this->fullConditionConstraints=[
|
||||||
|
ConstraintHelper::AlwaysFail('해당 전략을 아직 사용할 수 없습니다')
|
||||||
|
];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->fullConditionConstraints=[
|
$this->fullConditionConstraints=[
|
||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
@@ -79,16 +108,14 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
[0, 1],
|
[0, 1],
|
||||||
'선포, 전쟁중인 상대국에게만 가능합니다.'
|
'선포, 전쟁중인 상대국에게만 가능합니다.'
|
||||||
),
|
),
|
||||||
ConstraintHelper::AvailableStrategicCommand(),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle():string{
|
public function getCommandDetailTitle():string{
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn()+1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(대상 재사용 대기 {$this->getTargetPostReqTurn()})";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
@@ -96,10 +123,14 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
public function getPreReqTurn():int{
|
||||||
return 2;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
public function getPostReqTurn():int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTargetPostReqTurn():int{
|
||||||
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
$genCount = Util::valueFit($this->nation['gennum'], GameConst::$initialNationGenLimit);
|
||||||
$nextTerm = Util::round(sqrt($genCount*2)*10);
|
$nextTerm = Util::round(sqrt($genCount*2)*10);
|
||||||
|
|
||||||
@@ -109,8 +140,10 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
|
|
||||||
public function getBrief():string{
|
public function getBrief():string{
|
||||||
$commandName = $this->getName();
|
$commandName = $this->getName();
|
||||||
|
$cmd = buildNationCommandClass($this->arg['commandType'], $this->generalObj, $this->env, new LastTurn());
|
||||||
|
$targetCommandName = $cmd->getName();
|
||||||
$destNationName = getNationStaticInfo($this->arg['destNationID'])['name'];
|
$destNationName = getNationStaticInfo($this->arg['destNationID'])['name'];
|
||||||
return "【{$destNationName}】에 {$commandName}";
|
return "【{$destNationName}】에 【{$targetCommandName}】 {$commandName}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -144,13 +177,16 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
$commandName = $this->getName();
|
$commandName = $this->getName();
|
||||||
$josaUl = JosaUtil::pick($commandName, '을');
|
$josaUl = JosaUtil::pick($commandName, '을');
|
||||||
|
|
||||||
|
$cmd = buildNationCommandClass($this->arg['commandType'], $this->generalObj, $this->env, new LastTurn());
|
||||||
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
$logger = $general->getLogger();
|
||||||
$logger->pushGeneralActionLog("{$commandName} 발동! <1>$date</>");
|
$logger->pushGeneralActionLog("<G><b>{$cmd->getName()}</b></> 전략의 {$commandName} 발동! <1>$date</>");
|
||||||
|
|
||||||
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
$general->addExperience(5 * ($this->getPreReqTurn() + 1));
|
||||||
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
$general->addDedication(5 * ($this->getPreReqTurn() + 1));
|
||||||
|
|
||||||
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동하였습니다.";
|
$broadcastMessage = "<Y>{$generalName}</>{$josaYi} <G><b>{$destNationName}</b></>에 <G><b>{$cmd->getName()}</b></> 전략의 <M>{$commandName}</>{$josaUl} 발동하였습니다.";
|
||||||
|
|
||||||
$nationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
$nationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
||||||
foreach($nationGeneralList as $nationGeneralID){
|
foreach($nationGeneralList as $nationGeneralID){
|
||||||
@@ -161,7 +197,7 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
|
|
||||||
$josaYiCommand = JosaUtil::pick($commandName, '이');
|
$josaYiCommand = JosaUtil::pick($commandName, '이');
|
||||||
|
|
||||||
$broadcastMessage = "아국에 <M>{$commandName}</>{$josaYiCommand} 발동되었습니다.";
|
$broadcastMessage = "아국에 <G><b>{$cmd->getName()}</b></> 전략의 <M>{$commandName}</>{$josaYiCommand} 발동되었습니다.";
|
||||||
|
|
||||||
$destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
$destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no != %i', $nationID, $generalID);
|
||||||
foreach($destNationGeneralList as $destNationGeneralID){
|
foreach($destNationGeneralList as $destNationGeneralID){
|
||||||
@@ -171,17 +207,17 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$destNationLogger = new ActionLogger(0, $destNationID, $year, $month);
|
$destNationLogger = new ActionLogger(0, $destNationID, $year, $month);
|
||||||
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} 아국에 <M>{$commandName}</>{$josaUl} 발동");
|
$destNationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} 아국에 <G><b>{$cmd->getName()}</b></> <M>{$commandName}</>{$josaUl} 발동");
|
||||||
$destNationLogger->flush();
|
$destNationLogger->flush();
|
||||||
|
|
||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <M>{$commandName}</>{$josaUl} 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <D><b>{$destNationName}</b></>에 <G><b>{$cmd->getName()}</b></> <M>{$commandName}</>{$josaUl} 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
$destNationStor = KVStorage::getStorage($db, $destNationID, 'nation_env');
|
||||||
], 'nation=%i', $nationID);
|
|
||||||
$db->update('nation', [
|
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
||||||
'strategic_cmd_limit' => $db->sqleval('strategic_cmd_limit + %i', static::$delayCnt)
|
$nationStor->setValue($cmd->getNextExecuteKey(), $yearMonth + $this->getTargetPostReqTurn());
|
||||||
], 'nation = %i', $destNationID);
|
$destNationStor->setValue($cmd->getNextExecuteKey(), $yearMonth + static::$delayCnt);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
@@ -218,10 +254,26 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
$nationList[] = $destNation;
|
$nationList[] = $destNation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$availableCommandTypeList = [];
|
||||||
|
$currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||||
|
foreach(GameConst::$availableChiefCommand['전략'] as $commandType){
|
||||||
|
$cmd = buildNationCommandClass($commandType, $generalObj, $this->env, new LastTurn());
|
||||||
|
$cmdName = $cmd->getName();
|
||||||
|
$remainTurn = 0;
|
||||||
|
$nextAvailableTurn = $cmd->getNextAvailableTurn();
|
||||||
|
|
||||||
|
if($nextAvailableTurn !== null && $currYearMonth < $nextAvailableTurn){
|
||||||
|
$remainTurn = $nextAvailableTurn - $currYearMonth;
|
||||||
|
}
|
||||||
|
$availableCommandTypeList[$commandType] = [$cmdName, $remainTurn];
|
||||||
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<?=\sammo\getMapHtml()?><br>
|
<?=\sammo\getMapHtml()?><br>
|
||||||
선택된 국가에 피장파장을 발동합니다.<br>
|
선택된 국가에 피장파장을 발동합니다.<br>
|
||||||
|
지정한 전략을 상대국이 <?=static::$delayCnt?>턴 동안 사용할 수 없게됩니다.<br>
|
||||||
|
대신 아국은 지정한 전략을<?=$this->getTargetPostReqTurn()?>턴 동안 사용할 수 없습니다.<br>
|
||||||
선포, 전쟁중인 상대국에만 가능합니다.<br>
|
선포, 전쟁중인 상대국에만 가능합니다.<br>
|
||||||
상대 국가를 목록에서 선택하세요.<br>
|
상대 국가를 목록에서 선택하세요.<br>
|
||||||
배경색은 현재 피장파장 불가능 국가는 <font color=red>붉은색</font>으로 표시됩니다.<br>
|
배경색은 현재 피장파장 불가능 국가는 <font color=red>붉은색</font>으로 표시됩니다.<br>
|
||||||
@@ -232,6 +284,17 @@ class che_피장파장 extends Command\NationCommand{
|
|||||||
style='color:<?=$nation['color']?>;<?=$nation['availableCommand']?'':'background-color:red;'?>'
|
style='color:<?=$nation['color']?>;<?=$nation['availableCommand']?'':'background-color:red;'?>'
|
||||||
>【<?=$nation['name']?> 】</option>
|
>【<?=$nation['name']?> 】</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
</select>에
|
||||||
|
<select class='formInput' name="commandType" id="commandType" size='1' style='color:white;background-color:black;'>
|
||||||
|
<?php foreach($availableCommandTypeList as $commandType=>[$cmdName, $cmdRemainTurn]):
|
||||||
|
/** @var \sammo\Command\NationCommand $cmdObj */
|
||||||
|
?>
|
||||||
|
<option
|
||||||
|
value='<?=$commandType?>'
|
||||||
|
style='color:white;<?=$cmdRemainTurn?'background-color:red;':''?>'
|
||||||
|
><?=$cmdName?><?=$cmdRemainTurn?"({$cmdRemainTurn}턴 뒤)":''?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select> 전략을
|
||||||
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
<input type=button id="commonSubmit" value="<?=$this->getName()?>">
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class che_필사즉생 extends Command\NationCommand{
|
|||||||
$reqTurn = $this->getPreReqTurn()+1;
|
$reqTurn = $this->getPreReqTurn()+1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost():array{
|
public function getCost():array{
|
||||||
@@ -123,7 +123,7 @@ class che_필사즉생 extends Command\NationCommand{
|
|||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>필사즉생</>을 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <M>필사즉생</>을 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class che_허보 extends Command\NationCommand
|
|||||||
$reqTurn = $this->getPreReqTurn() + 1;
|
$reqTurn = $this->getPreReqTurn() + 1;
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
$postReqTurn = $this->getPostReqTurn();
|
||||||
|
|
||||||
return "{$name}/{$reqTurn}턴(전략$postReqTurn)";
|
return "{$name}/{$reqTurn}턴(재사용 대기 $postReqTurn)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
@@ -204,7 +204,7 @@ class che_허보 extends Command\NationCommand
|
|||||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>허보</>를 발동");
|
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>허보</>를 발동");
|
||||||
|
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
'strategic_cmd_limit' => $this->getPostReqTurn()
|
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
|
||||||
], 'nation=%i', $nationID);
|
], 'nation=%i', $nationID);
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
$this->setResultTurn(new LastTurn($this->getName(), $this->arg, 0));
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo\Command;
|
namespace sammo\Command;
|
||||||
use \sammo\General;
|
use \sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
use \sammo\LastTurn;
|
use \sammo\LastTurn;
|
||||||
|
use \sammo\Util;
|
||||||
|
|
||||||
abstract class NationCommand extends BaseCommand{
|
abstract class NationCommand extends BaseCommand{
|
||||||
protected $lastTurn;
|
protected $lastTurn;
|
||||||
@@ -25,6 +27,33 @@ abstract class NationCommand extends BaseCommand{
|
|||||||
return $this->resultTurn;
|
return $this->resultTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getNextExecuteKey():string{
|
||||||
|
$turnKey = static::$actionName;
|
||||||
|
$executeKey = "next_execute_{$turnKey}";
|
||||||
|
return $executeKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNextAvailableTurn():?int{
|
||||||
|
if($this->isArgValid && !$this->getPostReqTurn()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$db = \sammo\DB::db();
|
||||||
|
$nationStor = \sammo\KVStorage::getStorage($db, $this->getNationID(), 'nation_env');
|
||||||
|
return $nationStor->getValue($this->getNextExecuteKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNextAvailable(?int $yearMonth=null){
|
||||||
|
if(!$this->getPostReqTurn()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if($yearMonth === null){
|
||||||
|
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month'])
|
||||||
|
+ $this->getPostReqTurn() - $this->getPreReqTurn();
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = \sammo\DB::db();
|
||||||
|
$nationStor = \sammo\KVStorage::getStorage($db, $this->getNationID(), 'nation_env');
|
||||||
|
$nationStor->setValue($this->getNextExecuteKey(), $yearMonth);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace sammo\Constraint;
|
namespace sammo\Constraint;
|
||||||
|
|
||||||
class AvailableStrategicCommand extends Constraint{
|
class AvailableStrategicCommand extends Constraint{
|
||||||
const REQ_VALUES = Constraint::REQ_NATION;
|
const REQ_VALUES = Constraint::REQ_NATION | Constraint::REQ_INT_ARG;
|
||||||
|
|
||||||
public function checkInputValues(bool $throwExeception=true):bool{
|
public function checkInputValues(bool $throwExeception=true):bool{
|
||||||
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
|
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
|
||||||
@@ -22,7 +22,7 @@ class AvailableStrategicCommand extends Constraint{
|
|||||||
$this->checkInputValues();
|
$this->checkInputValues();
|
||||||
$this->tested = true;
|
$this->tested = true;
|
||||||
|
|
||||||
if($this->nation['strategic_cmd_limit'] == 0){
|
if($this->nation['strategic_cmd_limit'] <= $this->arg){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ class ConstraintHelper{
|
|||||||
return [__FUNCTION__, $crewTypeID];
|
return [__FUNCTION__, $crewTypeID];
|
||||||
}
|
}
|
||||||
|
|
||||||
static function AvailableStrategicCommand():array{
|
static function AvailableStrategicCommand(int $allowTurnCnt=0):array{
|
||||||
return [__FUNCTION__];
|
return [__FUNCTION__, $allowTurnCnt];
|
||||||
}
|
}
|
||||||
|
|
||||||
static function BattleGroundCity():array{
|
static function BattleGroundCity():array{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace sammo\Constraint;
|
namespace sammo\Constraint;
|
||||||
|
|
||||||
class ExistsDestNation extends Constraint{
|
class ExistsDestNation extends Constraint{
|
||||||
const REQ_VALUES = Constraint::REQ_DEST_NATION;
|
const REQ_VALUES = 0;
|
||||||
|
|
||||||
public function checkInputValues(bool $throwExeception=true):bool{
|
public function checkInputValues(bool $throwExeception=true):bool{
|
||||||
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
|
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
|
||||||
@@ -17,7 +17,7 @@ class ExistsDestNation extends Constraint{
|
|||||||
$this->checkInputValues();
|
$this->checkInputValues();
|
||||||
$this->tested = true;
|
$this->tested = true;
|
||||||
|
|
||||||
if($this->destNation['nation']){
|
if($this->destNation['nation']??0){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user