Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88c78ec892
|
||
|
|
006ca76922
|
||
|
|
8cb2e2a447
|
||
|
|
517c85d003
|
||
|
|
83556b710c
|
||
|
|
a43b9091f8
|
||
|
|
e83a1bef49
|
||
|
|
1147a8262c
|
||
|
|
8a987cc55e
|
||
|
|
b28ca864f9
|
||
|
|
4bf77a5c55
|
||
|
|
4ebc20f182
|
||
|
|
9eff1ccaed
|
||
|
|
66170c98dd
|
||
|
|
397c054c66
|
||
|
|
0611551dc0
|
||
|
|
008f88d995
|
||
|
|
7fe450bc07
|
||
|
|
a88ec71b44
|
||
|
|
8a5a3b67f7
|
||
|
|
63771da876
|
||
|
|
68891fafdb
|
||
|
|
df31300a0b
|
||
|
|
16fb782bbf
|
||
|
|
ed3e013a53
|
||
|
|
0bf568a655
|
||
|
|
a5e481af96
|
||
|
|
78a9641c14
|
||
|
|
b517000650
|
||
|
|
1d20eb3c3e
|
||
|
|
8248ccbcd5
|
||
|
|
b880b9bace
|
||
|
|
2da374410b
|
||
|
|
fff8f9493b
|
||
|
|
987baaa307
|
||
|
|
9512ea9b52
|
||
|
|
b0f3c1c97d
|
||
|
|
e823b97cf2
|
||
|
|
203859ee5f
|
||
|
|
4870e2fa30
|
||
|
|
970b702a2b
|
||
|
|
053288b227
|
||
|
|
e9b975bea7
|
||
|
|
89fda44db8
|
||
|
|
fac8536095
|
||
|
|
c79e65b6b7
|
||
|
|
677e65ff6d
|
||
|
|
0c7589d524
|
||
|
|
da27ae2bad
|
||
|
|
f8cd58bcb3 | ||
|
|
3671a289b8 | ||
|
|
48f4dbec50 | ||
|
|
bdb29006e9 | ||
|
|
5ea324f103 | ||
|
|
2f0cd32c18 | ||
|
|
e8911d40df | ||
|
|
89f173e7e3 | ||
|
|
b0ab3f6ace | ||
|
|
641af435d4 | ||
|
|
16a2f20af0 | ||
|
|
79734a6dcf | ||
|
|
2e2ff1b150 | ||
|
|
5ce899ee6e | ||
|
|
e041080773 | ||
|
|
f8448fbb51 | ||
|
|
8defcd29a4 | ||
|
|
fba60df9d1 | ||
|
|
a4ff1f44ba | ||
|
|
7b75f4e01b | ||
|
|
a9fc69e70f | ||
|
|
a06c574327 | ||
|
|
420ae2f45b | ||
|
|
850073a096 | ||
|
|
e40aa88253 | ||
|
|
ff92b0149a | ||
|
|
e6049a17a2 | ||
|
|
9bc1bc13f2 | ||
|
|
b9cda08a4e | ||
|
|
4e2193fe6f | ||
|
|
155af45378 | ||
|
|
66d6bbc772 | ||
|
|
066a6d4e6a | ||
|
|
94f5834b61 | ||
|
|
947286bd09 | ||
|
|
a0dee353b5 | ||
|
|
308b1f2348 | ||
|
|
897780cf1c | ||
|
|
0f8a8011be | ||
|
|
7ebfd960b1 | ||
|
|
7b3d64996d | ||
|
|
e578a2f310 | ||
|
|
eecb4f699b | ||
|
|
9f4f7a759e | ||
|
|
11a98eb184 | ||
|
|
ed0bc5e19f | ||
|
|
020a2d2668 | ||
|
|
27cdd3ee4b | ||
|
|
43a95979e1 | ||
|
|
800106f9cb | ||
|
|
e5c50e48d3 | ||
|
|
08e43bed71 | ||
|
|
6773b8cddb | ||
|
|
23c030fd00 | ||
|
|
d5e67bb16d | ||
|
|
188e3a0fa6 | ||
|
|
b31ee022af | ||
|
|
87e063e03e | ||
|
|
48fe26e4b1 | ||
|
|
88fcc64537 | ||
|
|
d9beabbbbc | ||
|
|
3da0a7d950 | ||
|
|
50b1db75f0 | ||
|
|
94bb96d208 | ||
|
|
93490276fd | ||
|
|
73a7bf5a61 | ||
|
|
8a1f8f8e2c | ||
|
|
39c88c11c4 | ||
|
|
c2e956a639 | ||
|
|
368f31d1fa | ||
|
|
d3390dc490 | ||
|
|
eb36b6a52f | ||
|
|
be882000ad | ||
|
|
266c1c6a5b |
@@ -45,7 +45,6 @@ return [
|
|||||||
'hwe/api.php',
|
'hwe/api.php',
|
||||||
'hwe/a_traffic.php',
|
'hwe/a_traffic.php',
|
||||||
'hwe/battle_simulator.php',
|
'hwe/battle_simulator.php',
|
||||||
'hwe/b_battleCenter.php',
|
|
||||||
'hwe/b_betting.php',
|
'hwe/b_betting.php',
|
||||||
'hwe/v_chiefCenter.php',
|
'hwe/v_chiefCenter.php',
|
||||||
'hwe/b_currentCity.php',
|
'hwe/b_currentCity.php',
|
||||||
@@ -58,7 +57,6 @@ return [
|
|||||||
'hwe/b_myPage.php',
|
'hwe/b_myPage.php',
|
||||||
'hwe/v_processing.php',
|
'hwe/v_processing.php',
|
||||||
'hwe/b_tournament.php',
|
'hwe/b_tournament.php',
|
||||||
'hwe/b_troop.php',
|
|
||||||
'hwe/c_tournament.php',
|
'hwe/c_tournament.php',
|
||||||
'hwe/func_auction.php',
|
'hwe/func_auction.php',
|
||||||
'hwe/func_command.php',
|
'hwe/func_command.php',
|
||||||
|
|||||||
+2
-2
@@ -26,8 +26,8 @@
|
|||||||
"nette/caching": "^3.0",
|
"nette/caching": "^3.0",
|
||||||
"illuminate/database": "^9.12",
|
"illuminate/database": "^9.12",
|
||||||
"illuminate/events": "^9.12",
|
"illuminate/events": "^9.12",
|
||||||
"spatie/data-transfer-object": "^3.7",
|
"php-ds/php-ds": "^1.4",
|
||||||
"php-ds/php-ds": "^1.4"
|
"hided62/ldto": "^1.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
Generated
+56
-65
@@ -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": "908099160e2765c04448fef3f35794c4",
|
"content-hash": "fe4387d1f2df3d3162c053a1d50a733a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brandonwamboldt/utilphp",
|
"name": "brandonwamboldt/utilphp",
|
||||||
@@ -537,6 +537,60 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-06-11T22:34:44+00:00"
|
"time": "2021-06-11T22:34:44+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "hided62/ldto",
|
||||||
|
"version": "v1.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/hided62/ldto.git",
|
||||||
|
"reference": "4c05401406f8afc1636a90763c13884f8fff0d14"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/hided62/ldto/zipball/4c05401406f8afc1636a90763c13884f8fff0d14",
|
||||||
|
"reference": "4c05401406f8afc1636a90763c13884f8fff0d14",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phan/phan": "^5.3",
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"LDTO\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Hide_D",
|
||||||
|
"email": "hided62@gmail.com",
|
||||||
|
"homepage": "https://hided.net",
|
||||||
|
"role": "Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "php lightweight dto library",
|
||||||
|
"homepage": "https://github.com/hided62/ldto",
|
||||||
|
"keywords": [
|
||||||
|
"data-transfer-object",
|
||||||
|
"dto",
|
||||||
|
"hided62",
|
||||||
|
"lightweight",
|
||||||
|
"serialize"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/hided62/ldto/issues",
|
||||||
|
"source": "https://github.com/hided62/ldto/tree/v1.0.0"
|
||||||
|
},
|
||||||
|
"time": "2022-08-05T14:30:13+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/bus",
|
"name": "illuminate/bus",
|
||||||
"version": "v9.12.2",
|
"version": "v9.12.2",
|
||||||
@@ -2238,69 +2292,6 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-06-29T04:31:23+00:00"
|
"time": "2021-06-29T04:31:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "spatie/data-transfer-object",
|
|
||||||
"version": "3.7.3",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/spatie/data-transfer-object.git",
|
|
||||||
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/spatie/data-transfer-object/zipball/341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
|
|
||||||
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": "^8.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"illuminate/collections": "^8.36",
|
|
||||||
"jetbrains/phpstorm-attributes": "^1.0",
|
|
||||||
"larapack/dd": "^1.1",
|
|
||||||
"phpunit/phpunit": "^9.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Spatie\\DataTransferObject\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Brent Roose",
|
|
||||||
"email": "brent@spatie.be",
|
|
||||||
"homepage": "https://spatie.be",
|
|
||||||
"role": "Developer"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Data transfer objects with batteries included",
|
|
||||||
"homepage": "https://github.com/spatie/data-transfer-object",
|
|
||||||
"keywords": [
|
|
||||||
"data-transfer-object",
|
|
||||||
"spatie"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/spatie/data-transfer-object/issues",
|
|
||||||
"source": "https://github.com/spatie/data-transfer-object/tree/3.7.3"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://spatie.be/open-source/support-us",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/spatie",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2021-12-30T20:31:10+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v6.0.8",
|
"version": "v6.0.8",
|
||||||
@@ -5337,5 +5328,5 @@
|
|||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.1"
|
"php": "8.1"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.2.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ $admin = getAdmin();
|
|||||||
<tr>
|
<tr>
|
||||||
<td width=110 align=right>시작시간변경</td>
|
<td width=110 align=right>시작시간변경</td>
|
||||||
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=substr($admin['starttime'], 0, 19)?>'><input type=submit name=btn value=변경1></td>
|
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=substr($admin['starttime'], 0, 19)?>'><input type=submit name=btn value=변경1></td>
|
||||||
<td width=110 align=right>현재도시훈사</td>
|
|
||||||
<td width=285><?=$admin['city_rate']?></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width=110 align=right>최대 장수</td>
|
<td width=110 align=right>최대 장수</td>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'bestGeneral']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'bestGeneral']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ increaseRefresh("왕조일람", 1);
|
|||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', 'common') ?>
|
<?= WebUtil::printDist('ts', 'common') ?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ $serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null);
|
|||||||
<meta name="viewport" content="width=1024" />
|
<meta name="viewport" content="width=1024" />
|
||||||
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
|
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', 'common', true) ?>
|
<?= WebUtil::printDist('ts', 'common', true) ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ if ($gameStor->isunited) {
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', 'common') ?>
|
<?= WebUtil::printDist('ts', 'common') ?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ if ($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx] ?? [])) {
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'hallOfFame']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'hallOfFame']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ if ($con >= 2) {
|
|||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
|
||||||
<?= WebUtil::printStaticValues($gameStor->getValues(['killturn', 'autorun_user', 'turnterm'])) ?>
|
<?= WebUtil::printStaticValues($gameStor->getValues(['killturn', 'autorun_user', 'turnterm'])) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ $sel[$type] = "selected";
|
|||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ if ($admin['maxonline'] < $curonline) {
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -1,208 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
$v = new Validator($_POST + $_GET);
|
|
||||||
$v->rule('required', 'gen')
|
|
||||||
->rule('integer', 'gen');
|
|
||||||
|
|
||||||
$btn = Util::getReq('btn');
|
|
||||||
$gen = Util::getReq('gen', 'int', 0);
|
|
||||||
$reqQueryType = Util::getReq('query_type', 'string', null);
|
|
||||||
|
|
||||||
// $queryTypeText, $reqArgType(0=>None, 1=>AdditionalColumn, 2=>rankVal, 3=>aux), $comp
|
|
||||||
$queryMap = [
|
|
||||||
'turntime' => ['최근턴', 0, function ($lhs, $rhs) {
|
|
||||||
return - ($lhs['turntime'] <=> $rhs['turntime']);
|
|
||||||
}],
|
|
||||||
'recent_war' => ['최근전투', 1, function ($lhs, $rhs) {
|
|
||||||
return - ($lhs['recent_war'] <=> $rhs['recent_war']);
|
|
||||||
}],
|
|
||||||
'name' => ['장수명', 0, function ($lhs, $rhs) {
|
|
||||||
if ($lhs['npc'] !== $rhs['npc']) {
|
|
||||||
return $lhs['npc'] <=> $rhs['npc'];
|
|
||||||
}
|
|
||||||
return $lhs['name'] <=> $rhs['name'];
|
|
||||||
}],
|
|
||||||
'warnum' => ['전투수', 2, function ($lhs, $rhs) {
|
|
||||||
return - ($lhs['warnum'] <=> $rhs['warnum']);
|
|
||||||
}]
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($reqQueryType === null || !key_exists($reqQueryType, $queryMap)) {
|
|
||||||
$reqQueryType = Util::array_first_key($queryMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
|
|
||||||
increaseRefresh("감찰부", 2);
|
|
||||||
//전투 추진을 위해 갱신
|
|
||||||
TurnExecutionHelper::executeAllCommand();
|
|
||||||
$gameStor->resetCache();
|
|
||||||
|
|
||||||
$testGeneralNationID = $db->queryFirstField('SELECT nation FROM general WHERE no = %i', $gen);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner=%i', $userID);
|
|
||||||
$nationID = $me['nation'];
|
|
||||||
|
|
||||||
$con = checkLimit($me['con']);
|
|
||||||
if ($con >= 2) {
|
|
||||||
printLimitMsg($me['turntime']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$permission = checkSecretPermission($me);
|
|
||||||
if ($permission < 0) {
|
|
||||||
echo '국가에 소속되어있지 않습니다.';
|
|
||||||
die();
|
|
||||||
} else if ($permission < 1) {
|
|
||||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
//잘못된 접근
|
|
||||||
if ($testGeneralNationID != $nationID) {
|
|
||||||
$gen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($btn == '정렬') {
|
|
||||||
$gen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[$queryTypeText, $reqArgType, $comp] = $queryMap[$reqQueryType];
|
|
||||||
if ($reqArgType === 0) {
|
|
||||||
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level FROM general WHERE nation = %i', $nationID);
|
|
||||||
} else if ($reqArgType === 1) {
|
|
||||||
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, %b FROM general WHERE nation = %i', $reqQueryType, $nationID);
|
|
||||||
} else if ($reqArgType === 2) {
|
|
||||||
$generalBasicList = $db->query(
|
|
||||||
'SELECT no, name, npc, turntime, officer_level, value as %b
|
|
||||||
FROM general LEFT JOIN rank_data
|
|
||||||
ON general.no = rank_data.general_id
|
|
||||||
WHERE rank_data.type = %s AND general.nation = %i',
|
|
||||||
$reqQueryType,
|
|
||||||
$reqQueryType,
|
|
||||||
$nationID
|
|
||||||
);
|
|
||||||
} else if ($reqArgType === 3) {
|
|
||||||
$generalBasicList = array_map(function ($arr) {
|
|
||||||
$arr['aux'] = Json::decode($arr['aux']);
|
|
||||||
return $arr;
|
|
||||||
}, $db->query('SELECT no, name, npc, turntime, officer_level, aux FROM general WHERE nation = %i', $nationID));
|
|
||||||
} else {
|
|
||||||
throw new \sammo\MustNotBeReachedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
usort($generalBasicList, $comp);
|
|
||||||
|
|
||||||
if (!$gen) {
|
|
||||||
$gen = $generalBasicList[0]['no'];
|
|
||||||
}
|
|
||||||
$showGeneral = General::createGeneralObjFromDB($gen);
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title><?= UniqueConst::$serverName ?>: 감찰부</title>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=500" />
|
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
|
||||||
<?= WebUtil::printDist('ts', ['common', 'battleCenter']) ?>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="container" class="bg0">
|
|
||||||
<div class="row gx-0">
|
|
||||||
<div class="col">감 찰 부<br><?= closeButton() ?></div>
|
|
||||||
</div>
|
|
||||||
<div class="row gx-0">
|
|
||||||
<div class="col-12" style="border-left: solid 1px gray; border-right:solid 1px gray;">
|
|
||||||
<form name=form1 method=get>
|
|
||||||
정렬순서 :
|
|
||||||
<select name='query_type' size=1>
|
|
||||||
<?php foreach ($queryMap as $queryType => [$queryTypeText,]) : ?>
|
|
||||||
<option <?= $queryType == $reqQueryType ? 'selected' : '' ?> value='<?= $queryType ?>'><?= $queryTypeText ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
<input type=submit name=btn value='정렬'>
|
|
||||||
대상장수 :
|
|
||||||
<select name=gen size=1>
|
|
||||||
<?php foreach ($generalBasicList as $general) : ?>
|
|
||||||
<option <?= $gen == $general['no'] ? 'selected' : '' ?> value='<?= $general['no'] ?>'><?= $general['officer_level'] > 4 ? "*{$general['name']}*" : $general['name'] ?> (<?= substr($general['turntime'], 14, 5) ?>)</option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select>
|
|
||||||
<input type=submit name=btn value='조회'>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="row mx-0">
|
|
||||||
<div class="col bg1 header-cell" style="color:skyblue">장수 정보</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col"><?php generalInfo($showGeneral); ?><?php generalInfo2($showGeneral); ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="row mx-0">
|
|
||||||
<div class="col bg1 header-cell">장수 열전</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col"><?= formatHistoryToHTML(getGeneralHistoryLogAll($gen)) ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="row mx-0">
|
|
||||||
<div class="col bg1 header-cell">전투 기록</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col"><?= formatHistoryToHTML(getBattleDetailLogRecent($gen, 24)) ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="row mx-0">
|
|
||||||
<div class="col bg1 header-cell">전투 결과</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col"><?= formatHistoryToHTML(getBattleResultRecent($gen, 24)) ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($showGeneral->getNPCType() > 1 || $permission >= 2) : ?>
|
|
||||||
<div class="col col-12 col-md-6">
|
|
||||||
<div class="row mx-0">
|
|
||||||
<div class="col bg1 header-cell">개인 기록</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col"><?= formatHistoryToHTML(getGeneralActionLogRecent($gen, 24)) ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="row gx-0">
|
|
||||||
<div class="col "><?= closeButton() ?></div>
|
|
||||||
</div>
|
|
||||||
<div class="row bg0 gx-0">
|
|
||||||
<div class="col bg0"><?= banner() ?></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -119,6 +119,7 @@ if ($str3) {
|
|||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'betting']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'betting']) ?>
|
||||||
<?= WebUtil::printStaticValues([
|
<?= WebUtil::printStaticValues([
|
||||||
'staticValues'=>[
|
'staticValues'=>[
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ $templates = new \League\Plates\Engine('templates');
|
|||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'currentCity']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'currentCity']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ $templates = new \League\Plates\Engine('templates');
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ if ($meLevel >= 5) {
|
|||||||
var chiefStatMin = <?= GameConst::$chiefStatMin ?>;
|
var chiefStatMin = <?= GameConst::$chiefStatMin ?>;
|
||||||
var myLevel = <?= $meLevel ?>;
|
var myLevel = <?= $meLevel ?>;
|
||||||
</script>
|
</script>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'bossInfo']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'bossInfo']) ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ $sel = [$type => "selected"];
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'extExpandCity']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'extExpandCity']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ if ($gameStor->isunited) {
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ if ($nationID == 0) {
|
|||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -70,6 +70,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
|
|||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['myPage']) ?>
|
<?= WebUtil::printDist('ts', ['myPage']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
|
|||||||
<?php foreach ([90, 80, 60, 40] as $targetDefenceTrain) : ?>
|
<?php foreach ([90, 80, 60, 40] as $targetDefenceTrain) : ?>
|
||||||
<option value='<?= $targetDefenceTrain ?>' <?= $me->getVar('defence_train') == $targetDefenceTrain ? "selected" : ""; ?>><?= formatDefenceTrain($targetDefenceTrain) ?>(훈사<?= $targetDefenceTrain ?>)</option>
|
<option value='<?= $targetDefenceTrain ?>' <?= $me->getVar('defence_train') == $targetDefenceTrain ? "selected" : ""; ?>><?= formatDefenceTrain($targetDefenceTrain) ?>(훈사<?= $targetDefenceTrain ?>)</option>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<option value=999 <?= $me->getVar('defence_train') == 999 ? "selected" : ""; ?>><?= formatDefenceTrain(999) ?>[훈련, 사기 -3]</option>
|
<option value=999 <?= $me->getVar('defence_train') == 999 ? "selected" : ""; ?>><?= formatDefenceTrain(999) ?>[훈련 -3, 사기 -6]</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:14px; value=설정저장><br>
|
<input type=<?= $submit ?> id='set_my_setting' name=btn style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px; value=설정저장><br>
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ $globalBetTotal = array_sum($globalBet);
|
|||||||
<meta name="viewport" content="width=1024" />
|
<meta name="viewport" content="width=1024" />
|
||||||
<title><?= UniqueConst::$serverName ?>: 토너먼트</title>
|
<title><?= UniqueConst::$serverName ?>: 토너먼트</title>
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', 'common', true) ?>
|
<?= WebUtil::printDist('ts', 'common', true) ?>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
-251
@@ -1,251 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
|
|
||||||
increaseRefresh("부대편성", 1);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT no,nation,troop,`officer_level`,permission,penalty FROM general WHERE owner=%i', $userID);
|
|
||||||
$permission = checkSecretPermission($me, false);
|
|
||||||
|
|
||||||
$troops = [];
|
|
||||||
foreach ($db->query('SELECT troop_leader,name FROM troop WHERE nation = %i', $me['nation']) as $rawTroop) {
|
|
||||||
$troops[$rawTroop['troop_leader']] = [
|
|
||||||
'name' => $rawTroop['name'],
|
|
||||||
'users' => []
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($db->query(
|
|
||||||
'SELECT no,name,turntime,troop,city FROM general WHERE troop!=0 AND nation = %i ORDER BY turntime ASC',
|
|
||||||
$me['nation']
|
|
||||||
) as $general) {
|
|
||||||
if (!key_exists($general['troop'], $troops)) {
|
|
||||||
trigger_error("올바르지 않은 부대 소속 {$general['no']}, {$general['name']} : {$general['troop']}");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$general['cityText'] = CityConst::byID($general['city'])->name;
|
|
||||||
|
|
||||||
$troops[$general['troop']]['users'][] = $general;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($troops) {
|
|
||||||
$troopLeaders = $db->query(
|
|
||||||
'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li',
|
|
||||||
array_keys($troops)
|
|
||||||
);
|
|
||||||
$generalTurnList = [];
|
|
||||||
|
|
||||||
foreach ($db->queryAllLists(
|
|
||||||
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
|
|
||||||
array_column($troopLeaders, 'no')
|
|
||||||
) as [$generalID, $turnIdx, $brief]) {
|
|
||||||
if (!key_exists($generalID, $generalTurnList)) {
|
|
||||||
$generalTurnList[$generalID] = [];
|
|
||||||
}
|
|
||||||
$generalTurnList[$generalID][$turnIdx] = $brief;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($troopLeaders as $troopLeader) {
|
|
||||||
$imageTemp = GetImageURL($troopLeader['imgsvr']);
|
|
||||||
|
|
||||||
$troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}";
|
|
||||||
$troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name;
|
|
||||||
|
|
||||||
$turnText = [];
|
|
||||||
foreach ($generalTurnList[$troopLeader['no']] as $rawTurnIdx => $brief) {
|
|
||||||
if ($brief != '집합') {
|
|
||||||
$brief = '~';
|
|
||||||
}
|
|
||||||
$turnIdx = $rawTurnIdx + 1;
|
|
||||||
$turnText[] = "{$turnIdx} : {$brief}";
|
|
||||||
}
|
|
||||||
$troopLeader['turnText'] = join('<br>', $turnText);
|
|
||||||
$troops[$troopLeader['troop']]['leader'] = $troopLeader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uasort($troops, function ($lhs, $rhs) {
|
|
||||||
return $lhs['leader']['turntime'] <=> $rhs['leader']['turntime'];
|
|
||||||
})
|
|
||||||
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=1024" />
|
|
||||||
<title><?= UniqueConst::$serverName ?>: 부대편성</title>
|
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
|
||||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
|
||||||
<?= WebUtil::printDist('ts', ['common', 'troop'], true) ?>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div style="width:1000px;margin:auto;">
|
|
||||||
<table width=1000 class='tb_layout bg0'>
|
|
||||||
<tr>
|
|
||||||
<td>부 대 편 성<br><?= backButton() ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<table id="troop_list" class='tb_layout bg0'>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<td width=64 class='bg1 center'>선 택</td>
|
|
||||||
<td width=130 class='bg1 center'>부 대 정 보</td>
|
|
||||||
<td width=100 class='bg1 center'>부 대 장</td>
|
|
||||||
<td width=576 class='bg1 center' style=table-layout:fixed;word-break:break-all;>장 수</td>
|
|
||||||
<td width=130 class='bg1 center' style=table-layout:fixed;word-break:break-all;>부대장행동</td>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<td colspan='5'>
|
|
||||||
<?php if (!$troops) : ?>
|
|
||||||
<?php elseif ($me['troop'] == 0) : ?>
|
|
||||||
<input type=button id='btnJoinTroop' value='부 대 가 입'>
|
|
||||||
<?php else : ?>
|
|
||||||
<input type=button id="btnLeaveTroop" value='부 대 탈 퇴'>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<?php
|
|
||||||
foreach ($troops as $troopNo => $troop) {
|
|
||||||
$troopLeader = $troop['leader'];
|
|
||||||
$genlistText = [];
|
|
||||||
$cityText = $troopLeader['cityText'];
|
|
||||||
$cityID = $troopLeader['city'];
|
|
||||||
$leaderID = $troopLeader['no'];
|
|
||||||
|
|
||||||
foreach ($troop['users'] as $troopUser) {
|
|
||||||
$spanClass = 'troopUser';
|
|
||||||
if ($troopUser['city'] !== $cityID) {
|
|
||||||
$spanClass .= ' diffCity';
|
|
||||||
}
|
|
||||||
if ($troopUser['no'] == $leaderID) {
|
|
||||||
$spanClass .= ' leader';
|
|
||||||
}
|
|
||||||
$genlistText[] = "<span class='$spanClass' data-general-id='{$troopUser['no']}'
|
|
||||||
><span class='generalName'>{$troopUser['name']}</span><span class='cityText'>【{$troopUser['cityText']}】</span
|
|
||||||
></span>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?>
|
|
||||||
|
|
||||||
<?php if ($me['troop'] == 0) : ?>
|
|
||||||
<tr>
|
|
||||||
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?= $troopNo ?>'></td>
|
|
||||||
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
|
|
||||||
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'> </td>
|
|
||||||
<td rowspan=2 width=62><?= $genlistText ?></td>
|
|
||||||
<td rowspan=2><?= $troopLeader['turnText'] ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align=center>
|
|
||||||
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
|
|
||||||
</td>
|
|
||||||
<td align=center>
|
|
||||||
<font size=1><?= $troopLeader['name'] ?></font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan=5>
|
|
||||||
|
|
||||||
<?php else : ?>
|
|
||||||
<tr>
|
|
||||||
<td align=center rowspan=2> </td>
|
|
||||||
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
|
|
||||||
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'> </td>
|
|
||||||
<td rowspan=2 width=62><?= $genlistText ?></td>
|
|
||||||
<td rowspan=2>
|
|
||||||
<?php if ($me['no'] == $troopLeader['no']) : ?>
|
|
||||||
<select id='genNo' name=gen size=3 style=color:white;background-color:black;font-size:14px;width:128px;>";
|
|
||||||
<?php foreach ($troop['users'] as $troopUser) : ?>
|
|
||||||
<?php if ($troopUser['no'] == $me['no']) {
|
|
||||||
continue;
|
|
||||||
} ?>
|
|
||||||
<option value='<?= $troopUser['no'] ?>'><?= $troopUser['name'] ?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</select><br>
|
|
||||||
<input type=button id='btnKickTroop' value='부 대 추 방' style=width:130px;height:25px;>
|
|
||||||
<?php else : ?>
|
|
||||||
<?= $troopLeader['turnText'] ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td align=center>
|
|
||||||
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
|
|
||||||
</td>
|
|
||||||
<td align=center>
|
|
||||||
<font size=1><?= $troopLeader['name'] ?></font>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan=5></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif;
|
|
||||||
} //foreach ($troops as $troopNo=>$troop) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
<br>
|
|
||||||
<div class="row">
|
|
||||||
<?php if($me['troop'] == 0): ?>
|
|
||||||
<div class="col-6"><?php /*TODO: 모바일 */ ?>
|
|
||||||
<div class="row gx-0 bg0">
|
|
||||||
<div class="bg1 col d-grid"><span class="align-self-center center">부대명</span></div>
|
|
||||||
<div class="col d-grid"><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='newTroopName'></div>
|
|
||||||
<div class="col d-grid"><button type='button' id="btnCreateTroop" class='btn btn-sm btn-secondary'>부대 창설</button></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($troops && ($me['troop'] == $me['no'] || $permission == 4)): ?>
|
|
||||||
<div class="col-6">
|
|
||||||
<div class="row gx-0 bg0">
|
|
||||||
<div class="bg1 col d-grid"><span class="align-self-center center">부대명</span></div>
|
|
||||||
<div class="col d-grid"><select class="form-select" id="changeNameTroopID">
|
|
||||||
<?php if($permission != 4): ?>
|
|
||||||
<option value="<?=$me['troop']?>"><?=$troops[$me['troop']]['name']?></option>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php foreach ($troops as $troopNo => $troop): ?>
|
|
||||||
<option value="<?=$troopNo?>"><?=$troop['name']?></option>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col d-grid"><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='changeTroopName'></div>
|
|
||||||
<div class="col d-grid"><button type='button' id="btnChangeTroopName" class='btn btn-sm btn-secondary'>이름 변경</button></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<table width=1000 class='tb_layout bg0'>
|
|
||||||
<tr>
|
|
||||||
<td><?= backButton() ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><?= banner() ?> </td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -54,6 +54,7 @@ if ($nationID) {
|
|||||||
var city = <?= Json::encode($city) ?>;
|
var city = <?= Json::encode($city) ?>;
|
||||||
var nation = <?= Json::encode($nation) ?>;
|
var nation = <?= Json::encode($nation) ?>;
|
||||||
</script>
|
</script>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'battle_simulator']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'battle_simulator']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -906,7 +906,7 @@ function nationMsg(General $general)
|
|||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
|
|
||||||
return $nationStor->notice ?? '';
|
return $nationStor->nationNotice['msg'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function banner()
|
function banner()
|
||||||
@@ -1812,7 +1812,7 @@ function deleteNation(General $lord, bool $applyDB): array
|
|||||||
|
|
||||||
$nation['generals'] = array_keys($nationGeneralList);
|
$nation['generals'] = array_keys($nationGeneralList);
|
||||||
$nation['aux'] = Json::decode($nation['aux']);
|
$nation['aux'] = Json::decode($nation['aux']);
|
||||||
$nation['msg'] = $nationStor->notice;
|
$nation['msg'] = $nationStor->nationNotice['msg'] ?? '';
|
||||||
$nation['scout_msg'] = $nationStor->scout_msg;
|
$nation['scout_msg'] = $nationStor->scout_msg;
|
||||||
$nation['aux'] += $nationStor->max_power;
|
$nation['aux'] += $nationStor->max_power;
|
||||||
$nation['history'] = getNationHistoryLogAll($nationID);
|
$nation['history'] = getNationHistoryLogAll($nationID);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function registerAuction(RandUtil $rng)
|
|||||||
[AuctionType::BuyRice->value, AuctionType::SellRice->value],
|
[AuctionType::BuyRice->value, AuctionType::SellRice->value],
|
||||||
));
|
));
|
||||||
|
|
||||||
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value];
|
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value] ?? 0;
|
||||||
|
|
||||||
// 판매건 등록
|
// 판매건 등록
|
||||||
if ($rng->nextBool(1 / ($neutralbuyRiceCnt + 5))) {
|
if ($rng->nextBool(1 / ($neutralbuyRiceCnt + 5))) {
|
||||||
@@ -38,7 +38,7 @@ function registerAuction(RandUtil $rng)
|
|||||||
AuctionBuyRice::openResourceAuction($dummyGeneral, $amount, $term, $cost, $topv);
|
AuctionBuyRice::openResourceAuction($dummyGeneral, $amount, $term, $cost, $topv);
|
||||||
}
|
}
|
||||||
|
|
||||||
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value];
|
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value] ?? 0;
|
||||||
// 구매건 등록
|
// 구매건 등록
|
||||||
if ($rng->nextBool(1 / ($neutralSellRiceCnt + 5))) {
|
if ($rng->nextBool(1 / ($neutralSellRiceCnt + 5))) {
|
||||||
//평균 쌀의 5% ~ 25%
|
//평균 쌀의 5% ~ 25%
|
||||||
|
|||||||
+68
-40
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
|
use sammo\DTO\AuctionInfo;
|
||||||
|
use sammo\Enums\AuctionType;
|
||||||
use sammo\Enums\InheritanceKey;
|
use sammo\Enums\InheritanceKey;
|
||||||
use sammo\Enums\RankColumn;
|
use sammo\Enums\RankColumn;
|
||||||
|
|
||||||
@@ -283,13 +285,8 @@ function preUpdateMonthly()
|
|||||||
'rate_tmp' => $db->sqleval('rate')
|
'rate_tmp' => $db->sqleval('rate')
|
||||||
], true);
|
], true);
|
||||||
|
|
||||||
//도시훈사 180년 60, 220년 87, 240년 100
|
|
||||||
$rate = Util::round(($admin['year'] - $admin['startyear']) / 1.5) + 60;
|
|
||||||
if ($rate > 100) $rate = 100;
|
|
||||||
|
|
||||||
// 20 ~ 140원
|
// 20 ~ 140원
|
||||||
$develcost = ($admin['year'] - $admin['startyear'] + 10) * 2;
|
$develcost = ($admin['year'] - $admin['startyear'] + 10) * 2;
|
||||||
$gameStor->city_rate = $rate;
|
|
||||||
$gameStor->develcost = $develcost;
|
$gameStor->develcost = $develcost;
|
||||||
|
|
||||||
//매달 사망자 수입 결산
|
//매달 사망자 수입 결산
|
||||||
@@ -526,7 +523,7 @@ function checkWander(RandUtil $rng)
|
|||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year', 'month']);
|
$admin = $gameStor->getValues(['year', 'month', 'init_year', 'init_month']);
|
||||||
|
|
||||||
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`officer_level` = 12');
|
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`officer_level` = 12');
|
||||||
|
|
||||||
@@ -557,32 +554,39 @@ function updateNationState()
|
|||||||
$startYear = $admin['startyear'];
|
$startYear = $admin['startyear'];
|
||||||
|
|
||||||
$assemblerCnts = [];
|
$assemblerCnts = [];
|
||||||
|
|
||||||
|
$nationCityCounts = [];
|
||||||
|
foreach($db->queryAllLists('SELECT nation, count(*) FROM city WHERE LEVEL>=4 GROUP BY nation') as [$nationID, $cityCnt]){
|
||||||
|
$nationCityCounts[$nationID] = $cityCnt;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($db->queryAllLists('SELECT nation,count(no) FROM general WHERE npc = 5 GROUP BY nation') as [$nationID, $assemblerCnt]) {
|
foreach ($db->queryAllLists('SELECT nation,count(no) FROM general WHERE npc = 5 GROUP BY nation') as [$nationID, $assemblerCnt]) {
|
||||||
$assemblerCnts[$nationID] = $assemblerCnt;
|
$assemblerCnts[$nationID] = $assemblerCnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$nationLevelByCityCnt = [
|
||||||
|
0, //방랑군
|
||||||
|
1, //호족
|
||||||
|
2, //군벌
|
||||||
|
5, //주자사
|
||||||
|
8, //주목
|
||||||
|
11, //공
|
||||||
|
16, //왕
|
||||||
|
21, //황제
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($db->query('SELECT nation,name,level,tech,aux FROM nation') as $nation) {
|
foreach ($db->query('SELECT nation,name,level,tech,aux FROM nation') as $nation) {
|
||||||
//TODO: level이 진관수이소중대특 체계를 벗어날 수 있음
|
//TODO: level이 진관수이소중대특 체계를 벗어날 수 있음
|
||||||
$nationID = $nation['nation'];
|
$nationID = $nation['nation'];
|
||||||
$citycount = $db->queryFirstField('SELECT count(*) FROM city WHERE nation=%i AND level>=4', $nationID);
|
$cityCnt = $nationCityCounts[$nationID] ?? 0;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
if ($citycount == 0) {
|
$nationlevel = 0;
|
||||||
$nationlevel = 0; // 방랑군
|
foreach($nationLevelByCityCnt as $cmpNationLevel => $cmpCityCnt){
|
||||||
} elseif ($citycount == 1) {
|
if($cityCnt < $cmpCityCnt){
|
||||||
$nationlevel = 1; // 호족
|
break;
|
||||||
} elseif ($citycount <= 4) {
|
}
|
||||||
$nationlevel = 2; // 군벌
|
$nationlevel = $cmpNationLevel;
|
||||||
} elseif ($citycount <= 7) {
|
|
||||||
$nationlevel = 3; // 주자사
|
|
||||||
} elseif ($citycount <= 10) {
|
|
||||||
$nationlevel = 4; // 주목
|
|
||||||
} elseif ($citycount <= 15) {
|
|
||||||
$nationlevel = 5; // 공
|
|
||||||
} elseif ($citycount <= 20) {
|
|
||||||
$nationlevel = 6; // 왕
|
|
||||||
} else {
|
|
||||||
$nationlevel = 7; // 황제
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nationlevel > $nation['level']) {
|
if ($nationlevel > $nation['level']) {
|
||||||
@@ -596,33 +600,47 @@ function updateNationState()
|
|||||||
'rice' => $db->sqleval('rice + %i', $nationlevel * 1000),
|
'rice' => $db->sqleval('rice + %i', $nationlevel * 1000),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$nationName = $nation['name'];
|
||||||
|
$lordName = $db->queryFirstField('SELECT name FROM general WHERE nation = %i AND officer_level = 12', $nationID);
|
||||||
|
|
||||||
|
$oldNationLevelText = getNationLevel($oldLevel);
|
||||||
|
$nationLevelText = getNationLevel($nationlevel);
|
||||||
|
|
||||||
|
$logger = new ActionLogger(0, $nationID, $year, $month, false);
|
||||||
|
$josaYi = JosaUtil::pick($lordName, '이');
|
||||||
|
|
||||||
switch ($nationlevel) {
|
switch ($nationlevel) {
|
||||||
case 7:
|
case 7: //황제
|
||||||
$josaUl = JosaUtil::pick(getNationLevel($nationlevel), '을');
|
$josaRo = JosaUtil::pick($nationLevelText, '로');
|
||||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭하였습니다.";
|
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></> {$oldNationLevelText} <Y>{$lordName}</>{$josaYi} <C>{$nationLevelText}</>{$josaRo} 옹립되었습니다.");
|
||||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭"]);
|
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></> {$oldNationLevelText} <Y>{$lordName}</>{$josaYi} <C>{$nationLevelText}</>{$josaRo} 옹립");
|
||||||
$auxVal = Json::decode($nation['aux']);
|
$auxVal = Json::decode($nation['aux']);
|
||||||
$auxVal['can_국기변경'] = 1;
|
$auxVal['can_국기변경'] = 1;
|
||||||
$auxVal['can_국호변경'] = 1;
|
$auxVal['can_국호변경'] = 1;
|
||||||
$updateVals['aux'] = Json::encode($auxVal);
|
$updateVals['aux'] = Json::encode($auxVal);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6: //왕
|
||||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극하였습니다.";
|
$josaRo = JosaUtil::pick($nationLevelText, '로');
|
||||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극"]);
|
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 책봉되었습니다.");
|
||||||
|
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 책봉");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5: //공
|
||||||
case 4:
|
case 4: //주목
|
||||||
case 3:
|
case 3: //주자사
|
||||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명되었습니다.";
|
$josaRo = JosaUtil::pick($nationLevelText, '로');
|
||||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명됨"]);
|
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 임명되었습니다.");
|
||||||
|
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 임명됨");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: //군벌
|
||||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 독립하여 <Y>" . getNationLevel($nationlevel) . "</>로 나섰습니다.";
|
$josaRa = JosaUtil::pick($nationName, '라');
|
||||||
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>로 나서다"]);
|
$josaRo = JosaUtil::pick($nationLevelText, '로');
|
||||||
|
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><Y>{$lordName}</>{$josaYi} 독립하여 <D><b>{$nationName}</b></>{$josaRa}는 <C>$nationLevelText</>{$josaRo} 나섰습니다.");
|
||||||
|
$logger->pushNationalHistoryLog("<Y>{$lordName}</>{$josaYi} 독립하여 <D><b>{$nationName}</b></>{$josaRa}는 <C>$nationLevelText</>{$josaRo} 나서다");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->update('nation', $updateVals, 'nation=%i', $nation['nation']);
|
$db->update('nation', $updateVals, 'nation=%i', $nation['nation']);
|
||||||
|
$logger->flush();
|
||||||
|
|
||||||
$turnRows = [];
|
$turnRows = [];
|
||||||
foreach (Util::range(getNationChiefLevel($nation['level']), 12) as $chiefLevel) {
|
foreach (Util::range(getNationChiefLevel($nation['level']), 12) as $chiefLevel) {
|
||||||
@@ -1053,6 +1071,16 @@ function checkEmperior()
|
|||||||
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
|
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
|
||||||
$nationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaYi} 전토를 통일");
|
$nationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaYi} 전토를 통일");
|
||||||
|
|
||||||
|
/** @var int[] */
|
||||||
|
$auctionList = $db->queryFirstColumn(
|
||||||
|
'SELECT `id` FROM `ng_auction` WHERE `type` = %s AND `finished` = 0 ORDER BY `close_date` ASC',
|
||||||
|
AuctionType::UniqueItem->value
|
||||||
|
);
|
||||||
|
foreach($auctionList as $auctionID){
|
||||||
|
$auction = new AuctionUniqueItem($auctionID, new DummyGeneral(true));
|
||||||
|
$auction->closeAuction(true);
|
||||||
|
}
|
||||||
|
|
||||||
$inheritPointManager = InheritancePointManager::getInstance();
|
$inheritPointManager = InheritancePointManager::getInstance();
|
||||||
$allUserGenerals = General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc < 2'));
|
$allUserGenerals = General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc < 2'));
|
||||||
foreach ($allUserGenerals as $genObj) {
|
foreach ($allUserGenerals as $genObj) {
|
||||||
@@ -1135,7 +1163,7 @@ function checkEmperior()
|
|||||||
$nation = $nation;
|
$nation = $nation;
|
||||||
$nation['generals'] = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
|
$nation['generals'] = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
|
||||||
$nation['aux'] = Json::decode($nation['aux']);
|
$nation['aux'] = Json::decode($nation['aux']);
|
||||||
$nation['msg'] = $nationStor->notice;
|
$nation['msg'] = $nationStor->nationNotice['msg'] ?? '';;
|
||||||
$nation['scout_msg'] = $nationStor->scout_msg;
|
$nation['scout_msg'] = $nationStor->scout_msg;
|
||||||
$nation['aux'] += $nationStor->max_power;
|
$nation['aux'] += $nationStor->max_power;
|
||||||
$nation['history'] = getNationHistoryLogAll($nation['nation']);
|
$nation['history'] = getNationHistoryLogAll($nation['nation']);
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $mon
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
function getGeneralHistoryLogAll(int $generalID):array {
|
function getGeneralHistoryLogAll(int $generalID):array {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
@@ -263,6 +264,15 @@ function getGeneralHistoryLogAll(int $generalID):array {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getGeneralHistoryLogWithLogID(int $generalID):array {
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
return Util::convertPairArrayToDict($db->queryAllLists(
|
||||||
|
'SELECT `id`, `text` from general_record WHERE general_id = %i AND log_type = "history" order by id desc',
|
||||||
|
$generalID
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ?int $month=null) {
|
function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ?int $month=null) {
|
||||||
if(!$history){
|
if(!$history){
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ if ($session->userGrade < 5 && !$allowReset) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||||
<?= WebUtil::printCSS('css/install.css') ?>
|
<?= WebUtil::printCSS('css/install.css') ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'install']) ?>
|
<?= WebUtil::printDist('ts', ['common', 'install']) ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ if(in_array($stateOpt, ['try_destroy_src', 'try_destroy_dest'])){
|
|||||||
'reason'=>'파기'
|
'reason'=>'파기'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$msgText = "외교 서신 #{$letterNo}를 파기했습니다.";
|
$msgText = "외교 서신(#{$letterNo})을 파기했습니다.";
|
||||||
$lastState = 'cancelled';
|
$lastState = 'cancelled';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -114,7 +114,7 @@ else{
|
|||||||
'aux'=>Json::encode($aux)
|
'aux'=>Json::encode($aux)
|
||||||
], 'no=%i', $letterNo);
|
], 'no=%i', $letterNo);
|
||||||
|
|
||||||
$msgText = "외교 서신 #{$letterNo}를 파기 요청합니다.";
|
$msgText = "외교 서신(#{$letterNo})을 파기 요청합니다.";
|
||||||
$lastState = 'activated';
|
$lastState = 'activated';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ if($isAgree){
|
|||||||
], 'no=%i', $prevLetterNo);
|
], 'no=%i', $prevLetterNo);
|
||||||
$prevLetterNo = $db->queryFirstField('SELECT prev_no FROM ng_diplomacy WHERE state != \'cancelled\' AND no = %i', $prevLetterNo);
|
$prevLetterNo = $db->queryFirstField('SELECT prev_no FROM ng_diplomacy WHERE state != \'cancelled\' AND no = %i', $prevLetterNo);
|
||||||
}
|
}
|
||||||
$msgText = "외교 서신 #{$letterNo}가 승인되었습니다.";
|
$msgText = "외교 서신( #{$letterNo})이 승인되었습니다.";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$aux['reason'] = [
|
$aux['reason'] = [
|
||||||
@@ -97,7 +97,7 @@ else{
|
|||||||
'state'=>'cancelled',
|
'state'=>'cancelled',
|
||||||
'aux'=>Json::encode($aux)
|
'aux'=>Json::encode($aux)
|
||||||
], 'no=%i', $letterNo);
|
], 'no=%i', $letterNo);
|
||||||
$msgText = "외교 서신 #{$letterNo}가 거부되었습니다.";
|
$msgText = "외교 서신(#{$letterNo})이 거부되었습니다.";
|
||||||
if($reason){
|
if($reason){
|
||||||
$msgText .= ' 이유 : '.$reason;
|
$msgText .= ' 이유 : '.$reason;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ $db->update('ng_diplomacy', [
|
|||||||
'state'=>'cancelled',
|
'state'=>'cancelled',
|
||||||
'aux'=>Json::encode($aux)
|
'aux'=>Json::encode($aux)
|
||||||
], 'no=%i', $letterNo);
|
], 'no=%i', $letterNo);
|
||||||
$msgText = "외교 서신 #{$letterNo}가 회수되었습니다.";
|
$msgText = "외교 서신(#{$letterNo})이 회수되었습니다.";
|
||||||
|
|
||||||
$msg = new Message(
|
$msg = new Message(
|
||||||
Message::MSGTYPE_DIPLOMACY,
|
Message::MSGTYPE_DIPLOMACY,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ if($defence_train !== $me->getVar('defence_train')){
|
|||||||
$me->increaseVar('myset', -1);
|
$me->increaseVar('myset', -1);
|
||||||
$me->setVar('defence_train', $defence_train);
|
$me->setVar('defence_train', $defence_train);
|
||||||
$me->increaseVarWithLimit('train', -3, 20);
|
$me->increaseVarWithLimit('train', -3, 20);
|
||||||
$me->increaseVarWithLimit('atmos', -3, 20);
|
$me->increaseVarWithLimit('atmos', -6, 20);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$me->increaseVar('myset', -1);
|
$me->increaseVar('myset', -1);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function applyNationPolicy($policy, $nationID, $generalName): ?string
|
|||||||
return "{$troopID}는 국가의 부대가 아닙니다.";
|
return "{$troopID}는 국가의 부대가 아닙니다.";
|
||||||
}
|
}
|
||||||
if ($troopCache[$troopID] != 'Neutral') {
|
if ($troopCache[$troopID] != 'Neutral') {
|
||||||
return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다.";
|
return "부대({$troopID})는 하나의 역할만 지정할 수 있습니다.";
|
||||||
}
|
}
|
||||||
if (!is_array($troopTarget) || count($troopTarget) != 2) {
|
if (!is_array($troopTarget) || count($troopTarget) != 2) {
|
||||||
return "{$troopID}의 입력양식이 올바르지 않습니다.";
|
return "{$troopID}의 입력양식이 올바르지 않습니다.";
|
||||||
|
|||||||
@@ -281,7 +281,6 @@ unset($defenderList);
|
|||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$startYear = $gameStor->startyear;
|
$startYear = $gameStor->startyear;
|
||||||
$cityRate = Util::round(($year - $startYear) / 1.5) + 60;
|
|
||||||
|
|
||||||
function extractRankVar(array $rawVal):Map{
|
function extractRankVar(array $rawVal):Map{
|
||||||
$rankVars = new Map;
|
$rankVars = new Map;
|
||||||
@@ -298,7 +297,7 @@ function extractRankVar(array $rawVal):Map{
|
|||||||
function simulateBattle(
|
function simulateBattle(
|
||||||
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
||||||
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
||||||
$startYear, $year, $month, $cityRate
|
$startYear, $year, $month
|
||||||
){
|
){
|
||||||
|
|
||||||
$warSeed = bin2hex(random_bytes(16));
|
$warSeed = bin2hex(random_bytes(16));
|
||||||
@@ -310,7 +309,7 @@ function simulateBattle(
|
|||||||
$rawAttackerNation,
|
$rawAttackerNation,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
|
||||||
|
|
||||||
$iterDefender = new \ArrayIterator($rawDefenderList);
|
$iterDefender = new \ArrayIterator($rawDefenderList);
|
||||||
$iterDefender->rewind();
|
$iterDefender->rewind();
|
||||||
@@ -367,7 +366,7 @@ function simulateBattle(
|
|||||||
$rice = $city->getKilled() / 100 * 0.8;
|
$rice = $city->getKilled() / 100 * 0.8;
|
||||||
$rice *= $city->getCrewType()->rice;
|
$rice *= $city->getCrewType()->rice;
|
||||||
$rice *= getTechCost($rawDefenderNation['tech']);
|
$rice *= getTechCost($rawDefenderNation['tech']);
|
||||||
$rice *= $cityRate / 100 - 0.2;
|
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
|
||||||
Util::setRound($rice);
|
Util::setRound($rice);
|
||||||
|
|
||||||
$defenderRice += $rice;
|
$defenderRice += $rice;
|
||||||
@@ -406,7 +405,7 @@ foreach(Util::range($repeatCnt) as $repeatIdx){
|
|||||||
[$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle(
|
[$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle(
|
||||||
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
|
||||||
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
|
||||||
$startYear, $year, $month, $cityRate
|
$startYear, $year, $month
|
||||||
);
|
);
|
||||||
$lastWarLog = Util::mapWithKey(function($key, $values){
|
$lastWarLog = Util::mapWithKey(function($key, $values){
|
||||||
return ConvertLog(join('<br>', $values));
|
return ConvertLog(join('<br>', $values));
|
||||||
|
|||||||
+5
-6
@@ -29,11 +29,11 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
|||||||
}
|
}
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
[$startYear, $year, $month, $cityRate, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'city_rate', 'join_mode']);
|
[$startYear, $year, $month, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'join_mode']);
|
||||||
|
|
||||||
$attacker = new WarUnitGeneral($rng, $attackerGeneral,$rawAttackerNation, true);
|
$attacker = new WarUnitGeneral($rng, $attackerGeneral,$rawAttackerNation, true);
|
||||||
|
|
||||||
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
|
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
|
||||||
|
|
||||||
$defenderIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city'));
|
$defenderIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city'));
|
||||||
$defenderList = General::createGeneralObjListFromDB($defenderIDList, null, 2);
|
$defenderList = General::createGeneralObjListFromDB($defenderIDList, null, 2);
|
||||||
@@ -90,7 +90,7 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
|||||||
$rice = $city->getKilled() / 100 * 0.8;
|
$rice = $city->getKilled() / 100 * 0.8;
|
||||||
$rice *= $city->getCrewType()->rice;
|
$rice *= $city->getCrewType()->rice;
|
||||||
$rice *= getTechCost($rawDefenderNation['tech']);
|
$rice *= getTechCost($rawDefenderNation['tech']);
|
||||||
$rice *= $cityRate / 100 - 0.2;
|
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
|
||||||
Util::setRound($rice);
|
Util::setRound($rice);
|
||||||
|
|
||||||
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
|
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
|
||||||
@@ -113,8 +113,8 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
|||||||
'dead' => $db->sqleval('dead + %i', $totalDead * 0.6)
|
'dead' => $db->sqleval('dead + %i', $totalDead * 0.6)
|
||||||
], 'city=%i', $rawDefenderCity['city']);
|
], 'city=%i', $rawDefenderCity['city']);
|
||||||
|
|
||||||
$attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalcDomestic('기술', 'score', $attacker->getDead() * 0.01);
|
$attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalcDomestic('기술', 'score', $attacker->getDead() * 0.012);
|
||||||
$defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.01);
|
$defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.009);
|
||||||
|
|
||||||
$attackerGenCnt = $rawAttackerNation['gennum'];
|
$attackerGenCnt = $rawAttackerNation['gennum'];
|
||||||
$defenderGenCnt = $rawDefenderNation['gennum'];
|
$defenderGenCnt = $rawDefenderNation['gennum'];
|
||||||
@@ -175,7 +175,6 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
|
|||||||
'startyear' => $startYear,
|
'startyear' => $startYear,
|
||||||
'year' => $year,
|
'year' => $year,
|
||||||
'month' => $month,
|
'month' => $month,
|
||||||
'city_rate' => $cityRate,
|
|
||||||
'join_mode' => $joinMode,
|
'join_mode' => $joinMode,
|
||||||
], $attacker->getGeneral(), $city->getRaw());
|
], $attacker->getGeneral(), $city->getRaw());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ include "func.php";
|
|||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||||
<?= WebUtil::printCSS('css/map.css') ?>
|
<?= WebUtil::printCSS('css/map.css') ?>
|
||||||
<?= WebUtil::printDist('ts', ['common', 'recent_map'], true) ?>
|
<?= WebUtil::printDist('ts', ['common', 'recent_map'], true) ?>
|
||||||
|
<?= WebUtil::printDist('vue', [], true) ?>
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
width: 700px;
|
width: 700px;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class BidUniqueAuction extends \sammo\BaseAPI
|
|||||||
{
|
{
|
||||||
$auctionID = $this->args['auctionID'];
|
$auctionID = $this->args['auctionID'];
|
||||||
$amount = $this->args['amount'];
|
$amount = $this->args['amount'];
|
||||||
$tryExtendCloseDate = $this->arg['extendCloseDate'] ?? false;
|
$tryExtendCloseDate = $this->args['extendCloseDate'] ?? false;
|
||||||
|
|
||||||
$generalID = $session->generalID;
|
$generalID = $session->generalID;
|
||||||
$general = General::createGeneralObjFromDB($generalID);
|
$general = General::createGeneralObjFromDB($generalID);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Bet extends \sammo\BaseAPI
|
|||||||
->rule('int', 'bettingID')
|
->rule('int', 'bettingID')
|
||||||
->rule('integerArray', 'bettingType')
|
->rule('integerArray', 'bettingType')
|
||||||
->rule('int', 'amount')
|
->rule('int', 'amount')
|
||||||
->rule('min', 'amount', 1);
|
->rule('min', 'amount', 10);
|
||||||
|
|
||||||
if (!$v->validate()) {
|
if (!$v->validate()) {
|
||||||
return $v->errorStr();
|
return $v->errorStr();
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ class GetGeneralLog extends GetNationGeneralLog
|
|||||||
$v = new Validator($this->args);
|
$v = new Validator($this->args);
|
||||||
$v
|
$v
|
||||||
->rule('required', [
|
->rule('required', [
|
||||||
'type',
|
'reqType',
|
||||||
])
|
])
|
||||||
->rule('int', [
|
->rule('int', [
|
||||||
'reqTo',
|
'reqTo',
|
||||||
])
|
])
|
||||||
->rule('in', 'type', [
|
->rule('in', 'reqType', [
|
||||||
self::GENERAL_HISTORY,
|
self::GENERAL_HISTORY,
|
||||||
self::GENERAL_ACTION,
|
self::GENERAL_ACTION,
|
||||||
self::BATTLE_RESULT,
|
self::BATTLE_RESULT,
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
namespace sammo\API\Global;
|
namespace sammo\API\Global;
|
||||||
|
|
||||||
use sammo\Session;
|
use sammo\Session;
|
||||||
|
use sammo\DB;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use sammo\TurnExecutionHelper;
|
use sammo\TurnExecutionHelper;
|
||||||
|
use sammo\UniqueConst;
|
||||||
|
|
||||||
class ExecuteEngine extends \sammo\BaseAPI
|
class ExecuteEngine extends \sammo\BaseAPI
|
||||||
{
|
{
|
||||||
@@ -20,10 +22,23 @@ class ExecuteEngine extends \sammo\BaseAPI
|
|||||||
|
|
||||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
{
|
{
|
||||||
$updated = TurnExecutionHelper::executeAllCommand();
|
$reqServerID = $this->args['serverID'] ?? null;
|
||||||
|
if($reqServerID && $reqServerID !== UniqueConst::$serverID){
|
||||||
|
return [
|
||||||
|
'result' => false,
|
||||||
|
'reason' => '서버 아이디가 다릅니다',
|
||||||
|
'reqRefresh' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$updated = false;
|
||||||
|
$locked = false;
|
||||||
|
$lastExecuted = TurnExecutionHelper::executeAllCommand($updated, $locked);
|
||||||
return [
|
return [
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'updated' => $updated,
|
'updated' => $updated,
|
||||||
|
'locked' => $locked,
|
||||||
|
'lastExecuted' => $lastExecuted,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Global;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
class GetRecentRecord extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
|
||||||
|
const ROW_LIMIT = 15;
|
||||||
|
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('int', 'lastGeneralRecordID')
|
||||||
|
->rule('int', 'lastWorldHistoryID');
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
$this->args['lastGeneralRecordID'] = (int)($this->args['lastGeneralRecordID']??0);
|
||||||
|
$this->args['lastWorldHistoryID'] = (int)($this->args['lastWorldHistoryID']??0);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getGlobalRecord(int $lastRecordID): array
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$globalRecord = $db->queryAllLists(
|
||||||
|
'SELECT id, `text` FROM general_record WHERE `general_id` = 0 AND log_type = %s AND id >= %i ORDER BY `id` DESC LIMIT %i',
|
||||||
|
'history',
|
||||||
|
$lastRecordID,
|
||||||
|
static::ROW_LIMIT + 1,
|
||||||
|
);
|
||||||
|
return $globalRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getGeneralRecord(int $generalID, int $lastRecordID): array
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$generalRecord = $db->queryAllLists(
|
||||||
|
'SELECT id, `text` FROM general_record WHERE `general_id` = %i AND log_type = %s AND id >= %i ORDER BY `id` DESC LIMIT %i',
|
||||||
|
$generalID,
|
||||||
|
'action',
|
||||||
|
$lastRecordID,
|
||||||
|
static::ROW_LIMIT + 1,
|
||||||
|
);
|
||||||
|
return $generalRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getHistory(int $lastHistoryID): array
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$history = $db->queryAllLists(
|
||||||
|
'SELECT id, `text` FROM world_history WHERE nation_id = 0 AND id >= %i ORDER BY `id` DESC LIMIT %i',
|
||||||
|
$lastHistoryID,
|
||||||
|
static::ROW_LIMIT + 1,
|
||||||
|
);
|
||||||
|
return $history;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$lastHistoryID = $this->args['lastWorldHistoryID'];
|
||||||
|
$lastRecordID = $this->args['lastGeneralRecordID'];
|
||||||
|
|
||||||
|
$history = $this->getHistory($lastHistoryID);
|
||||||
|
$globalRecord = $this->getGlobalRecord($lastRecordID);
|
||||||
|
$generalRecord = $this->getGeneralRecord($session->generalID, $lastRecordID);
|
||||||
|
|
||||||
|
$flushHistory = true;
|
||||||
|
$flushGlobalRecord = true;
|
||||||
|
$flushGeneralRecord = true;
|
||||||
|
|
||||||
|
if($history){
|
||||||
|
if(Util::array_last($history)[0] == $lastHistoryID){
|
||||||
|
$flushHistory = false;
|
||||||
|
array_pop($history);
|
||||||
|
}
|
||||||
|
else if(count($history) > static::ROW_LIMIT){
|
||||||
|
array_pop($history);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($globalRecord){
|
||||||
|
if(Util::array_last($globalRecord)[0] == $lastRecordID){
|
||||||
|
$flushGlobalRecord = false;
|
||||||
|
array_pop($globalRecord);
|
||||||
|
}
|
||||||
|
else if(count($globalRecord) > static::ROW_LIMIT){
|
||||||
|
array_pop($globalRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($generalRecord){
|
||||||
|
if(Util::array_last($generalRecord)[0] == $lastRecordID){
|
||||||
|
$flushGeneralRecord = false;
|
||||||
|
array_pop($generalRecord);
|
||||||
|
}
|
||||||
|
else if(count($generalRecord) > static::ROW_LIMIT){
|
||||||
|
array_pop($generalRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'history' => $history,
|
||||||
|
'global' => $globalRecord,
|
||||||
|
'general' => $generalRecord,
|
||||||
|
'flushHistory' => $flushHistory?1:0,
|
||||||
|
'flushGlobal' => $flushGlobalRecord?1:0,
|
||||||
|
'flushGeneral' => $flushGeneralRecord?1:0,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,6 +67,10 @@ class BuyHiddenBuff extends \sammo\BaseAPI
|
|||||||
$reqAmount = GameConst::$inheritBuffPoints[$level] - GameConst::$inheritBuffPoints[$prevLevel];
|
$reqAmount = GameConst::$inheritBuffPoints[$level] - GameConst::$inheritBuffPoints[$prevLevel];
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
if($gameStor->isunited){
|
||||||
|
return '이미 천하가 통일되었습니다.';
|
||||||
|
}
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0,0])[0];
|
$previousPoint = ($inheritStor->getValue('previous') ?? [0,0])[0];
|
||||||
if ($previousPoint < $reqAmount) {
|
if ($previousPoint < $reqAmount) {
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ class BuyRandomUnique extends \sammo\BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
if($gameStor->isunited){
|
||||||
|
return '이미 천하가 통일되었습니다.';
|
||||||
|
}
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||||
$previousPoint = ($inheritStor->getValue('previous')??[0, 0])[0];
|
$previousPoint = ($inheritStor->getValue('previous')??[0, 0])[0];
|
||||||
$reqAmount = GameConst::$inheritItemRandomPoint;
|
$reqAmount = GameConst::$inheritItemRandomPoint;
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ class ResetSpecialWar extends \sammo\BaseAPI
|
|||||||
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
if($gameStor->isunited){
|
||||||
|
return '이미 천하가 통일되었습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||||
if ($previousPoint < $reqPoint) {
|
if ($previousPoint < $reqPoint) {
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ class ResetTurnTime extends \sammo\BaseAPI
|
|||||||
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
if($gameStor->isunited){
|
||||||
|
return '이미 천하가 통일되었습니다.';
|
||||||
|
}
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||||
if ($previousPoint < $reqPoint) {
|
if ($previousPoint < $reqPoint) {
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ class SetNextSpecialWar extends \sammo\BaseAPI
|
|||||||
$reqAmount = GameConst::$inheritSpecificSpecialPoint;
|
$reqAmount = GameConst::$inheritSpecificSpecialPoint;
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
if($gameStor->isunited){
|
||||||
|
return '이미 천하가 통일되었습니다.';
|
||||||
|
}
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||||
if ($previousPoint < $reqAmount) {
|
if ($previousPoint < $reqAmount) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace sammo\API\Nation;
|
namespace sammo\API\Nation;
|
||||||
|
|
||||||
|
use ArrayObject;
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\General;
|
use sammo\General;
|
||||||
use sammo\Session;
|
use sammo\Session;
|
||||||
@@ -44,9 +45,12 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'belong' => 0,
|
'belong' => 0,
|
||||||
'connect' => 0,
|
'connect' => 0,
|
||||||
|
|
||||||
|
'troop' => 0,
|
||||||
|
'city' => 0,
|
||||||
|
|
||||||
'con' => 1,
|
'con' => 1,
|
||||||
'specage' => 1,
|
'specage' => 0,
|
||||||
'specage2' => 1,
|
'specage2' => 0,
|
||||||
'leadership_exp' => 1,
|
'leadership_exp' => 1,
|
||||||
'strength_exp' => 1,
|
'strength_exp' => 1,
|
||||||
'intel_exp' => 1,
|
'intel_exp' => 1,
|
||||||
@@ -56,14 +60,12 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'dex4' => 1,
|
'dex4' => 1,
|
||||||
'dex5' => 1,
|
'dex5' => 1,
|
||||||
|
|
||||||
'city' => 1,
|
|
||||||
'experience' => 1,
|
'experience' => 1,
|
||||||
'dedication' => 1,
|
'dedication' => 1,
|
||||||
|
|
||||||
'officer_level' => 1,
|
'officer_level' => 1,
|
||||||
'officer_city' => 1,
|
'officer_city' => 1,
|
||||||
'defence_train' => 1,
|
'defence_train' => 1,
|
||||||
'troop' => 1,
|
|
||||||
'crewtype' => 1,
|
'crewtype' => 1,
|
||||||
'crew' => 1,
|
'crew' => 1,
|
||||||
'train' => 1,
|
'train' => 1,
|
||||||
@@ -125,7 +127,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
if ($level >= 5) {
|
if ($level >= 5) {
|
||||||
return $level;
|
return $level;
|
||||||
}
|
}
|
||||||
if ($this->permission > 1) {
|
if ($this->permission >= 1) {
|
||||||
return $level;
|
return $level;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -157,35 +159,59 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
|
|
||||||
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i ORDER BY turntime ASC', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i ORDER BY turntime ASC', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
||||||
|
|
||||||
|
/** @var ArrayObject[] */
|
||||||
|
$troops = [];
|
||||||
|
foreach ($db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID) as [$troopLeaderID, $troopName]) {
|
||||||
|
if (!key_exists($troopLeaderID, $rawGeneralList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$troopTurnTime = $rawGeneralList[$troopLeaderID]['turntime'];
|
||||||
|
$troops[$troopLeaderID] = new ArrayObject([
|
||||||
|
'id' => $troopLeaderID,
|
||||||
|
'name' => $troopName,
|
||||||
|
'turntime' => $troopTurnTime,
|
||||||
|
'reservedCommand' => [],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$reservedCommand = [];
|
$reservedCommand = [];
|
||||||
if ($this->permission >= 1) {
|
if ($this->permission >= 1 || count($troops)) {
|
||||||
$nonNPCGeneralIDList = [];
|
$reservedCommandTargetGeneralIDList = [];
|
||||||
foreach ($rawGeneralList as $rawGeneral) {
|
|
||||||
if ($rawGeneral['npc'] < 2) {
|
if($this->permission >= 1){
|
||||||
$nonNPCGeneralIDList[] = $rawGeneral['no'];
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
|
if ($rawGeneral['npc'] < 2) {
|
||||||
|
$reservedCommandTargetGeneralIDList[$rawGeneral['no']] = $rawGeneral['no'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach($troops as $troop){
|
||||||
|
$reservedCommandTargetGeneralIDList[$troop['id']] = $troop['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$rawTurnList = $db->query(
|
if($reservedCommandTargetGeneralIDList){
|
||||||
'SELECT general_id, turn_idx, action, arg, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id asc, turn_idx asc',
|
$rawTurnList = $db->query(
|
||||||
$nonNPCGeneralIDList
|
'SELECT general_id, turn_idx, action, arg, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id asc, turn_idx asc',
|
||||||
);
|
array_values($reservedCommandTargetGeneralIDList)
|
||||||
|
);
|
||||||
foreach ($rawTurnList as $rawTurn) {
|
|
||||||
[
|
foreach ($rawTurnList as $rawTurn) {
|
||||||
'general_id' => $generalID,
|
[
|
||||||
'action' => $action,
|
'general_id' => $generalID,
|
||||||
'arg' => $arg,
|
'action' => $action,
|
||||||
'brief' => $brief,
|
'arg' => $arg,
|
||||||
] = $rawTurn;
|
'brief' => $brief,
|
||||||
if (!key_exists($generalID, $reservedCommand)) {
|
] = $rawTurn;
|
||||||
$reservedCommand[$generalID] = [];
|
if (!key_exists($generalID, $reservedCommand)) {
|
||||||
|
$reservedCommand[$generalID] = [];
|
||||||
|
}
|
||||||
|
$reservedCommand[$generalID][] = [
|
||||||
|
'action' => $action,
|
||||||
|
'arg' => $arg,
|
||||||
|
'brief' => $brief
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$reservedCommand[$generalID][] = [
|
|
||||||
'action' => $action,
|
|
||||||
'arg' => $arg,
|
|
||||||
'brief' => $brief
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +277,17 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
$resultColumns[$column] = $column;
|
$resultColumns[$column] = $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($troops as $troop){
|
||||||
|
$troopLeaderID = $troop['id'];
|
||||||
|
$troop['reservedCommand'] = array_map(function($turnObj){
|
||||||
|
$brief = $turnObj['brief'];
|
||||||
|
if($brief == '집합'){
|
||||||
|
return $brief;
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
}, $specialViewFilter['reservedCommand']($rawGeneralList[$troopLeaderID]));
|
||||||
|
}
|
||||||
|
|
||||||
$generalList = [];
|
$generalList = [];
|
||||||
foreach ($rawGeneralList as $rawGeneral) {
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
//General 생성?
|
//General 생성?
|
||||||
@@ -271,20 +308,14 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
$generalList[] = $item;
|
$generalList[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->permission >= 1) {
|
|
||||||
$troops = $db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID);
|
|
||||||
} else {
|
|
||||||
$troops = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$result = [
|
$result = [
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'permission' => $this->permission,
|
'permission' => $this->permission,
|
||||||
'column' => array_keys($resultColumns),
|
'column' => array_keys($resultColumns),
|
||||||
'list' => $generalList,
|
'list' => $generalList,
|
||||||
'troops' => $troops,
|
'troops' => array_values($troops),
|
||||||
'env' => $env,
|
'env' => $env,
|
||||||
|
'myGeneralID' => $session->generalID,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ use sammo\Validator;
|
|||||||
use function sammo\checkLimit;
|
use function sammo\checkLimit;
|
||||||
use function sammo\checkSecretPermission;
|
use function sammo\checkSecretPermission;
|
||||||
use function sammo\getBattleDetailLogMore;
|
use function sammo\getBattleDetailLogMore;
|
||||||
|
use function sammo\getBattleDetailLogRecent;
|
||||||
use function sammo\getBattleResultMore;
|
use function sammo\getBattleResultMore;
|
||||||
use function sammo\getBattleResultRecent;
|
use function sammo\getBattleResultRecent;
|
||||||
use function sammo\getGeneralActionLogMore;
|
use function sammo\getGeneralActionLogMore;
|
||||||
use function sammo\getGeneralActionLogRecent;
|
use function sammo\getGeneralActionLogRecent;
|
||||||
use function sammo\getGeneralHistoryLogAll;
|
use function sammo\getGeneralHistoryLogWithLogID;
|
||||||
|
|
||||||
class GetGeneralLog extends \sammo\BaseAPI
|
class GetGeneralLog extends \sammo\BaseAPI
|
||||||
{
|
{
|
||||||
@@ -28,13 +29,13 @@ class GetGeneralLog extends \sammo\BaseAPI
|
|||||||
$v
|
$v
|
||||||
->rule('required', [
|
->rule('required', [
|
||||||
'generalID',
|
'generalID',
|
||||||
'type',
|
'reqType',
|
||||||
])
|
])
|
||||||
->rule('integer', [
|
->rule('integer', [
|
||||||
'generalID',
|
'generalID',
|
||||||
'reqTo',
|
'reqTo',
|
||||||
])
|
])
|
||||||
->rule('in', 'type', [
|
->rule('in', 'reqType', [
|
||||||
self::GENERAL_HISTORY,
|
self::GENERAL_HISTORY,
|
||||||
self::GENERAL_ACTION,
|
self::GENERAL_ACTION,
|
||||||
self::BATTLE_RESULT,
|
self::BATTLE_RESULT,
|
||||||
@@ -76,11 +77,11 @@ class GetGeneralLog extends \sammo\BaseAPI
|
|||||||
return '같은 나라의 장수가 아닙니다.';
|
return '같은 나라의 장수가 아닙니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
$reqType = $this->args['type'];
|
$reqType = $this->args['reqType'];
|
||||||
if (
|
if (
|
||||||
$reqType === self::GENERAL_ACTION &&
|
$reqType === self::GENERAL_ACTION &&
|
||||||
$testGeneralNPCType < 2 &&
|
$testGeneralNPCType < 2 &&
|
||||||
$generalID !== $me['generalID'] &&
|
$generalID !== $me['no'] &&
|
||||||
$permission < 2
|
$permission < 2
|
||||||
) {
|
) {
|
||||||
return '권한이 부족합니다. 유저 장수의 개인 기록은 수뇌만 열람 가능합니다.';
|
return '권한이 부족합니다. 유저 장수의 개인 기록은 수뇌만 열람 가능합니다.';
|
||||||
@@ -103,7 +104,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
|||||||
$userID = $session->userID;
|
$userID = $session->userID;
|
||||||
|
|
||||||
$targetGeneralID = $this->getTargetGeneralID($session);
|
$targetGeneralID = $this->getTargetGeneralID($session);
|
||||||
$reqType = $this->args['type'];
|
$reqType = $this->args['reqType'];
|
||||||
$reqTo = $this->args['reqTo'] ?? null;
|
$reqTo = $this->args['reqTo'] ?? null;
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
@@ -124,7 +125,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
|||||||
'result' => true,
|
'result' => true,
|
||||||
'reqType' => $reqType,
|
'reqType' => $reqType,
|
||||||
'generalID' => $targetGeneralID,
|
'generalID' => $targetGeneralID,
|
||||||
'log' => getGeneralHistoryLogAll($targetGeneralID)
|
'log' => getGeneralHistoryLogWithLogID($targetGeneralID)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +157,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
|||||||
'reqType' => $reqType,
|
'reqType' => $reqType,
|
||||||
'generalID' => $targetGeneralID,
|
'generalID' => $targetGeneralID,
|
||||||
'log' => $reqTo === null
|
'log' => $reqTo === null
|
||||||
? getBattleResultRecent($targetGeneralID, 30)
|
? getBattleDetailLogRecent($targetGeneralID, 30)
|
||||||
: getBattleDetailLogMore($targetGeneralID, $reqTo, 30)
|
: getBattleDetailLogMore($targetGeneralID, $reqTo, 30)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Nation;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\GameConst;
|
||||||
|
use sammo\General;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\LastTurn;
|
||||||
|
use sammo\Session;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
use function sammo\buildNationCommandClass;
|
||||||
|
use function sammo\checkLimit;
|
||||||
|
use function sammo\checkSecretPermission;
|
||||||
|
use function sammo\getBattleDetailLogMore;
|
||||||
|
use function sammo\getBattleResultMore;
|
||||||
|
use function sammo\getBattleResultRecent;
|
||||||
|
use function sammo\getGeneralActionLogMore;
|
||||||
|
use function sammo\getGeneralActionLogRecent;
|
||||||
|
use function sammo\getGeneralHistoryLogAll;
|
||||||
|
use function sammo\getNationStaticInfo;
|
||||||
|
|
||||||
|
class GetNationInfo extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('boolean', 'full');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$userID = $session->userID;
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$nationID = $db->queryFirstField('SELECT nation FROM general WHERE `owner` = %i', $userID);
|
||||||
|
|
||||||
|
if (!$nationID) {
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'nation' => getNationStaticInfo(0)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$isFull = $this->args['full'] ?? false;
|
||||||
|
|
||||||
|
if(!$isFull){
|
||||||
|
$nation = getNationStaticInfo($nationID);
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'nation' => $nation,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$generalObj = General::createGeneralObjFromDB($session->generalID, null, 1);
|
||||||
|
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
$gameEnv = $gameStor->getValues(['year', 'month', 'startyear']);
|
||||||
|
|
||||||
|
$nation = $db->queryFirstRow(
|
||||||
|
'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE id = %i',
|
||||||
|
$nationID
|
||||||
|
);
|
||||||
|
$nationStor = \sammo\KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
|
$nationStor->cacheAll();
|
||||||
|
|
||||||
|
|
||||||
|
//전략 정보를 매번 읽어와야하나?
|
||||||
|
$impossibleStrategicCommandLists = [];
|
||||||
|
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
|
||||||
|
$yearMonth = Util::joinYearMonth($gameEnv['year'], $gameEnv['month']);
|
||||||
|
foreach ($strategicCommandLists as $command) {
|
||||||
|
$cmd = buildNationCommandClass($command, $generalObj, $gameEnv, new LastTurn());
|
||||||
|
$nextAvailableTurn = $cmd->getNextAvailableTurn();
|
||||||
|
if ($nextAvailableTurn > $yearMonth) {
|
||||||
|
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$troopName = [];
|
||||||
|
foreach ($db->queryAllLists('SELECT troop_leader, name FROM troop WHERE nation=%i', $nationID) as [$troopID, $tName]) {
|
||||||
|
$troopName[$troopID] = $tName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'result' => true,
|
||||||
|
'nation' => $nation,
|
||||||
|
'impossibleStrategicCommandLists' => $impossibleStrategicCommandLists,
|
||||||
|
'troops' => $troopName,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ use sammo\Session;
|
|||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\KVStorage;
|
use sammo\KVStorage;
|
||||||
|
use sammo\TimeUtil;
|
||||||
use sammo\Validator;
|
use sammo\Validator;
|
||||||
use sammo\WebUtil;
|
use sammo\WebUtil;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ class SetNotice extends \sammo\BaseAPI
|
|||||||
$msg = $this->args['msg'];
|
$msg = $this->args['msg'];
|
||||||
$userID = $session->userID;
|
$userID = $session->userID;
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
$me = $db->queryFirstRow('SELECT `no`,`name`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||||
|
|
||||||
$permission = checkSecretPermission($me, false);
|
$permission = checkSecretPermission($me, false);
|
||||||
if($permission < 0){
|
if($permission < 0){
|
||||||
@@ -49,7 +50,12 @@ class SetNotice extends \sammo\BaseAPI
|
|||||||
$nationID = $me['nation'];
|
$nationID = $me['nation'];
|
||||||
|
|
||||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
$nationStor->notice = WebUtil::htmlPurify($msg);
|
$nationStor->nationNotice = [
|
||||||
|
'date'=>TimeUtil::now(),
|
||||||
|
'msg'=>WebUtil::htmlPurify($msg),
|
||||||
|
'author'=>$me['name'],
|
||||||
|
'authorID'=>$me['no'],
|
||||||
|
];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'result' => true
|
'result' => true
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use sammo\Validator;
|
|||||||
|
|
||||||
use function sammo\checkSecretPermission;
|
use function sammo\checkSecretPermission;
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
class SetTroopName extends \sammo\BaseAPI
|
class SetTroopName extends \sammo\BaseAPI
|
||||||
{
|
{
|
||||||
public function validateArgs(): ?string
|
public function validateArgs(): ?string
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
|
|
||||||
$nationTurnList = [];
|
$nationTurnList = [];
|
||||||
foreach ($db->queryAllLists(
|
foreach ($db->queryAllLists(
|
||||||
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
||||||
$me['nation']
|
$me['nation']
|
||||||
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
|
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
|
||||||
if (!key_exists($officer_level, $nationTurnList)) {
|
if (!key_exists($officer_level, $nationTurnList)) {
|
||||||
$nationTurnList[$officer_level] = [];
|
$nationTurnList[$officer_level] = [];
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,14 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$troopList = [];
|
||||||
|
foreach ($db->queryAllLists(
|
||||||
|
'SELECT troop_leader, `name` FROM troop WHERE `nation` = %i',
|
||||||
|
$nationID
|
||||||
|
) as [$troopID, $troopName]) {
|
||||||
|
$troopList[$troopID] = $troopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$nationChiefList = [];
|
$nationChiefList = [];
|
||||||
foreach ($nationTurnList as $officer_level => $turnBrief) {
|
foreach ($nationTurnList as $officer_level => $turnBrief) {
|
||||||
@@ -111,7 +119,8 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
'turnTerm' => $turnTerm,
|
'turnTerm' => $turnTerm,
|
||||||
'date' => TimeUtil::now(true),
|
'date' => TimeUtil::now(true),
|
||||||
'chiefList' => $nationChiefList,
|
'chiefList' => $nationChiefList,
|
||||||
'isChief'=>($me['officer_level'] > 4),
|
'troopList' => $troopList,
|
||||||
|
'isChief' => ($me['officer_level'] > 4),
|
||||||
'autorun_limit' => $generalObj->getAuxVar('autorun_limit'),
|
'autorun_limit' => $generalObj->getAuxVar('autorun_limit'),
|
||||||
'officerLevel' => $me['officer_level'],
|
'officerLevel' => $me['officer_level'],
|
||||||
'commandList' => getChiefCommandTable($generalObj),
|
'commandList' => getChiefCommandTable($generalObj),
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Troop;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
|
||||||
|
class ExitTroop extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$generalID = $session->generalID;
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$troopID = $db->queryFirstField('SELECT troop FROM general WHERE no = %i', $generalID);
|
||||||
|
if($troopID == 0){
|
||||||
|
return '부대에 소속되어 있지 않습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($generalID != $troopID){
|
||||||
|
$db->update('general', [
|
||||||
|
'troop' => 0,
|
||||||
|
], '`no` = %i', $generalID);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//부대장이다.
|
||||||
|
$db->update('general', [
|
||||||
|
'troop' => 0,
|
||||||
|
], '`troop` = %i', $troopID);
|
||||||
|
$db->delete('troop', 'troop_leader = %i', $troopID);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Troop;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\StringUtil;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
class JoinTroop extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'troopID',
|
||||||
|
])
|
||||||
|
->rule('integer', 'troopID');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$userID = $session->userID;
|
||||||
|
$troopID = $this->args['troopID'];
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$me = $db->queryFirstRow('SELECT `no`,nation,`troop`,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||||
|
if ($me['troop'] != 0) {
|
||||||
|
return '이미 부대에 소속되어 있습니다.';
|
||||||
|
}
|
||||||
|
$nationID = $me['nation'];
|
||||||
|
if ($nationID == 0) {
|
||||||
|
return '국가에 소속되어 있지 않습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$troopExists = $db->queryFirstField('SELECT `troop_leader` FROM `troop` WHERE `troop_leader` = %i AND `nation` = %i', $troopID, $nationID);
|
||||||
|
if (!$troopExists) {
|
||||||
|
return '부대가 올바르지 않습니다.';
|
||||||
|
}
|
||||||
|
$generalID = $me['no'];
|
||||||
|
|
||||||
|
$db->update('general', [
|
||||||
|
'troop' => $troopID,
|
||||||
|
], '`no` = %i AND `troop` = %i', $generalID, 0);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Troop;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
class KickFromTroop extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'troopID',
|
||||||
|
'generalID',
|
||||||
|
])
|
||||||
|
->rule('integer', 'troopID')
|
||||||
|
->rule('integer', 'generalID');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$generalID = $this->args['generalID'];
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
|
$troopID = $db->queryFirstField('SELECT troop FROM general WHERE no = %i', $generalID);
|
||||||
|
if($troopID == 0){
|
||||||
|
return '부대에 소속되어 있지 않습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($troopID != $this->args['troopID']){
|
||||||
|
return '다른 부대에 소속되어 있습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($troopID == $generalID){
|
||||||
|
return '부대장을 추방할 수 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->update('general', [
|
||||||
|
'troop' => 0,
|
||||||
|
], '`no` = %i AND `troop` = %i', $generalID, $troopID);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Troop;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\StringUtil;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
class NewTroop extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'troopName',
|
||||||
|
])
|
||||||
|
->rule('stringWidthBetween', 'troopName', 1, 18);
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$userID = $session->userID;
|
||||||
|
$troopName = StringUtil::neutralize($this->args['troopName']);
|
||||||
|
if(!$troopName){
|
||||||
|
return '부대 이름이 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = DB::db();
|
||||||
|
$me = $db->queryFirstRow('SELECT `no`,nation,`troop`,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||||
|
if($me['troop'] != 0){
|
||||||
|
return '이미 부대에 소속되어 있습니다.';
|
||||||
|
}
|
||||||
|
$nationID = $me['nation'];
|
||||||
|
if($nationID == 0){
|
||||||
|
return '국가에 소속되어 있지 않습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$generalID = $me['no'];
|
||||||
|
|
||||||
|
$db->insert('troop', [
|
||||||
|
'name'=>$troopName,
|
||||||
|
'troop_leader'=>$generalID,
|
||||||
|
'nation'=>$nationID,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if($db->affectedRows() == 0){
|
||||||
|
return '부대가 생성되지 않았습니다. 버그일 수 있습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->update('general', [
|
||||||
|
'troop'=>$generalID
|
||||||
|
], '`no` = %i', $generalID);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\Troop;
|
||||||
|
|
||||||
|
use sammo\Session;
|
||||||
|
use DateTimeInterface;
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\StringUtil;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
use function sammo\checkSecretPermission;
|
||||||
|
|
||||||
|
class SetTroopName extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('required', [
|
||||||
|
'troopID',
|
||||||
|
'troopName',
|
||||||
|
])
|
||||||
|
->rule('stringWidthBetween', 'troopName', 1, 18)
|
||||||
|
->rule('integer', 'troopID');
|
||||||
|
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$userID = $session->userID;
|
||||||
|
$db = DB::db();
|
||||||
|
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||||
|
$permission = checkSecretPermission($me, false);
|
||||||
|
$troopID = $this->args['troopID'];
|
||||||
|
|
||||||
|
$generalID = $me['no'];
|
||||||
|
if($generalID != $troopID && $permission < 4){
|
||||||
|
return "권한이 부족합니다.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$troopName = StringUtil::neutralize($this->args['troopName']);
|
||||||
|
if(!$troopName){
|
||||||
|
return '부대 이름이 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$nationID = $me['nation'];
|
||||||
|
$db->update('troop', [
|
||||||
|
'name'=>$troopName
|
||||||
|
], 'troop_leader=%i AND `nation`=%i',$troopID, $nationID);
|
||||||
|
|
||||||
|
if($db->affectedRows() == 0){
|
||||||
|
return '부대가 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,8 @@ use \sammo\General;
|
|||||||
|
|
||||||
class che_계략_향낭 extends \sammo\BaseItem{
|
class che_계략_향낭 extends \sammo\BaseItem{
|
||||||
|
|
||||||
protected $rawName = '항냥';
|
protected $rawName = '향낭';
|
||||||
protected $name = '항냥(계략)';
|
protected $name = '향낭(계략)';
|
||||||
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
|
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
|
||||||
protected $cost = 3000;
|
protected $cost = 3000;
|
||||||
protected $consumable = true;
|
protected $consumable = true;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class che_내정_납금박산로 extends \sammo\BaseItem{
|
|||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null): float{
|
||||||
if(in_array($turnType, ['상업', '농업', '기술', '성벽', '수비', '치안', '민심', '인구'])){
|
if(in_array($turnType, ['상업', '농업', '기술', '성벽', '수비', '치안', '민심', '인구'])){
|
||||||
if($varType == 'success') return $value + 0.15;
|
if($varType == 'success') return $value + 0.15;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class che_조달_주판 extends \sammo\BaseItem{
|
|||||||
protected $cost = 200;
|
protected $cost = 200;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
|
|
||||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
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.2;
|
||||||
if($varType == 'score') return $value * 2;
|
if($varType == 'score') return $value * 2;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class event_전투특기_필살 extends \sammo\BaseItem{
|
|||||||
|
|
||||||
protected $rawName = '비급';
|
protected $rawName = '비급';
|
||||||
protected $name = '비급(필살)';
|
protected $name = '비급(필살)';
|
||||||
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 항상 최대';
|
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 향상';
|
||||||
protected $cost = 100;
|
protected $cost = 100;
|
||||||
protected $buyable = true;
|
protected $buyable = true;
|
||||||
protected $consumable = false;
|
protected $consumable = false;
|
||||||
@@ -22,8 +22,8 @@ class event_전투특기_필살 extends \sammo\BaseItem{
|
|||||||
return $value + 0.3;
|
return $value + 0.3;
|
||||||
}
|
}
|
||||||
if($statName === 'criticalDamageRange'){
|
if($statName === 'criticalDamageRange'){
|
||||||
[, $rangeMax] = $value;
|
[$rangeMin, $rangeMax] = $value;
|
||||||
return [$rangeMax, $rangeMax];
|
return [($rangeMin + $rangeMax) / 2, $rangeMax];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class che_event_필살 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 71;
|
protected $id = 71;
|
||||||
protected $name = '필살';
|
protected $name = '필살';
|
||||||
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 항상 최대';
|
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 향상';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -26,10 +26,10 @@ class che_event_필살 extends \sammo\BaseSpecial{
|
|||||||
return $value + 0.30;
|
return $value + 0.30;
|
||||||
}
|
}
|
||||||
if($statName === 'criticalDamageRange'){
|
if($statName === 'criticalDamageRange'){
|
||||||
[, $rangeMax] = $value;
|
[$rangeMin, $rangeMax] = $value;
|
||||||
return [$rangeMax, $rangeMax];
|
return [($rangeMin + $rangeMax) / 2, $rangeMax];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class che_필살 extends \sammo\BaseSpecial{
|
|||||||
|
|
||||||
protected $id = 71;
|
protected $id = 71;
|
||||||
protected $name = '필살';
|
protected $name = '필살';
|
||||||
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 항상 최대';
|
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가, 필살 계수 향상';
|
||||||
|
|
||||||
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
|
||||||
static $selectWeight = 1;
|
static $selectWeight = 1;
|
||||||
@@ -29,8 +29,8 @@ class che_필살 extends \sammo\BaseSpecial{
|
|||||||
return $value + 0.30;
|
return $value + 0.30;
|
||||||
}
|
}
|
||||||
if($statName === 'criticalDamageRange'){
|
if($statName === 'criticalDamageRange'){
|
||||||
[, $rangeMax] = $value;
|
[$rangeMin, $rangeMax] = $value;
|
||||||
return [$rangeMax, $rangeMax];
|
return [($rangeMin + $rangeMax) / 2, $rangeMax];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ abstract class Auction
|
|||||||
|
|
||||||
public const COEFF_AUCTION_CLOSE_MINUTES = 24;
|
public const COEFF_AUCTION_CLOSE_MINUTES = 24;
|
||||||
public const COEFF_EXTENSION_MINUTES_PER_BID = (1 / 6);
|
public const COEFF_EXTENSION_MINUTES_PER_BID = (1 / 6);
|
||||||
public const COEFF_EXTENSION_MINUTES_LIMIT_BY_BID = 1;
|
public const COEFF_EXTENSION_MINUTES_LIMIT_BY_BID = 0.5;
|
||||||
public const COEFF_EXTENSION_MINUTES_BY_EXTENSION_QUERY = 1;
|
public const COEFF_EXTENSION_MINUTES_BY_EXTENSION_QUERY = 1;
|
||||||
public const MIN_AUCTION_CLOSE_MINUTES = 30;
|
public const MIN_AUCTION_CLOSE_MINUTES = 30;
|
||||||
public const MIN_EXTENSION_MINUTES_PER_BID = 1;
|
public const MIN_EXTENSION_MINUTES_PER_BID = 1;
|
||||||
@@ -40,6 +40,7 @@ abstract class Auction
|
|||||||
if ($namePool === null) {
|
if ($namePool === null) {
|
||||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||||
UniqueConst::$hiddenSeed,
|
UniqueConst::$hiddenSeed,
|
||||||
|
'obfuscatedNamePool',
|
||||||
)));
|
)));
|
||||||
$namePool = [];
|
$namePool = [];
|
||||||
foreach (GameConst::$randGenFirstName as $ch0) {
|
foreach (GameConst::$randGenFirstName as $ch0) {
|
||||||
@@ -281,6 +282,9 @@ abstract class Auction
|
|||||||
$general = $this->general;
|
$general = $this->general;
|
||||||
|
|
||||||
$highestBid = $this->getHighestBid();
|
$highestBid = $this->getHighestBid();
|
||||||
|
if ($highestBid !== null && $amount < $highestBid->amount * 1.01) {
|
||||||
|
return '현재입찰가보다 1% 높게 입찰해야 합니다.';
|
||||||
|
}
|
||||||
if ($highestBid !== null && $amount < $highestBid->amount + 10) {
|
if ($highestBid !== null && $amount < $highestBid->amount + 10) {
|
||||||
return '현재입찰가보다 10 포인트 높게 입찰해야 합니다.';
|
return '현재입찰가보다 10 포인트 높게 입찰해야 합니다.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,12 +53,19 @@ class AuctionUniqueItem extends Auction
|
|||||||
}
|
}
|
||||||
|
|
||||||
$availableCnt = 0;
|
$availableCnt = 0;
|
||||||
foreach(GameConst::$allItems as $itemType => $itemList){
|
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||||
$availableCnt += $itemList[$itemKey] ?? 0;
|
if (!key_exists($itemKey, $itemList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ownItem = $general->getItem($itemType);
|
||||||
|
if ($ownItem !== null && !$ownItem->isBuyable()) {
|
||||||
|
return '이미 가진 아이템이 있습니다.';
|
||||||
|
}
|
||||||
|
$availableCnt += $itemList[$itemKey];
|
||||||
$availableCnt -= $db->queryFirstField('SELECT count(*) FROM `general` WHERE %b = %s', $itemType, $itemKey);
|
$availableCnt -= $db->queryFirstField('SELECT count(*) FROM `general` WHERE %b = %s', $itemType, $itemKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($availableCnt <= 0){
|
if ($availableCnt <= 0) {
|
||||||
return '그 유니크를 더 얻을 수 없습니다.';
|
return '그 유니크를 더 얻을 수 없습니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +136,7 @@ class AuctionUniqueItem extends Auction
|
|||||||
public function bid(int $amount, bool $tryExtendCloseDate): ?string
|
public function bid(int $amount, bool $tryExtendCloseDate): ?string
|
||||||
{
|
{
|
||||||
|
|
||||||
if($this->info->finished){
|
if ($this->info->finished) {
|
||||||
return '경매가 종료되었습니다.';
|
return '경매가 종료되었습니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +153,7 @@ class AuctionUniqueItem extends Auction
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
if($auctionIDList){
|
if ($auctionIDList) {
|
||||||
$rawHighestBids = Util::convertArrayToDict($db->query(
|
$rawHighestBids = Util::convertArrayToDict($db->query(
|
||||||
'SELECT bid.* FROM `ng_auction_bid` bid INNER JOIN (
|
'SELECT bid.* FROM `ng_auction_bid` bid INNER JOIN (
|
||||||
SELECT `auction_id`, MAX(`amount`) as `max_amount`
|
SELECT `auction_id`, MAX(`amount`) as `max_amount`
|
||||||
@@ -158,8 +165,7 @@ class AuctionUniqueItem extends Auction
|
|||||||
ON bid.`auction_id` = max_bid.`auction_id` AND bid.`amount` = max_bid.`max_amount`',
|
ON bid.`auction_id` = max_bid.`auction_id` AND bid.`amount` = max_bid.`max_amount`',
|
||||||
$auctionIDList,
|
$auctionIDList,
|
||||||
) ?? [], 'auction_id');
|
) ?? [], 'auction_id');
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$rawHighestBids = [];
|
$rawHighestBids = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +183,14 @@ class AuctionUniqueItem extends Auction
|
|||||||
|
|
||||||
$bidItemTypes = new Set();
|
$bidItemTypes = new Set();
|
||||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||||
if (($itemList[$itemCode] ?? 0) <= 0) {
|
if (!key_exists($itemCode, $itemList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$ownItem = $this->general->getItem($itemType);
|
||||||
|
if ($ownItem !== null && !$ownItem->isBuyable()) {
|
||||||
|
return '이미 가진 아이템이 있습니다.';
|
||||||
|
}
|
||||||
|
if ($itemList[$itemCode] <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$bidItemTypes->add($itemType);
|
$bidItemTypes->add($itemType);
|
||||||
@@ -212,6 +225,11 @@ class AuctionUniqueItem extends Auction
|
|||||||
return $this->_bid($amount, $tryExtendCloseDate);
|
return $this->_bid($amount, $tryExtendCloseDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function setHostAsNeutral(){
|
||||||
|
$this->info->hostGeneralID = 0;
|
||||||
|
$this->info->detail->hostName = '(상인)';
|
||||||
|
}
|
||||||
|
|
||||||
protected function finishAuction(AuctionBidItem $highestBid, General $bidder): ?string
|
protected function finishAuction(AuctionBidItem $highestBid, General $bidder): ?string
|
||||||
{
|
{
|
||||||
$itemKey = $this->info->target;
|
$itemKey = $this->info->target;
|
||||||
@@ -250,6 +268,9 @@ class AuctionUniqueItem extends Auction
|
|||||||
max(static::MIN_EXTENSION_MINUTES_BY_EXTENSION_QUERY, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_UNIQUE_CNT) * 60
|
max(static::MIN_EXTENSION_MINUTES_BY_EXTENSION_QUERY, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_UNIQUE_CNT) * 60
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if($bidder->getID() != $this->info->hostGeneralID){
|
||||||
|
$this->setHostAsNeutral();
|
||||||
|
}
|
||||||
$this->extendCloseDate($extendedCloseDate, true);
|
$this->extendCloseDate($extendedCloseDate, true);
|
||||||
$this->extendLatestBidCloseDate(null);
|
$this->extendLatestBidCloseDate(null);
|
||||||
$this->applyDB();
|
$this->applyDB();
|
||||||
@@ -295,8 +316,12 @@ class AuctionUniqueItem extends Auction
|
|||||||
max(static::MIN_EXTENSION_MINUTES_LIMIT_BY_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_BY_BID) * 60
|
max(static::MIN_EXTENSION_MINUTES_LIMIT_BY_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_BY_BID) * 60
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if($bidder->getID() != $this->info->hostGeneralID){
|
||||||
|
$this->setHostAsNeutral();
|
||||||
|
}
|
||||||
$this->extendCloseDate($extendedCloseDate, true);
|
$this->extendCloseDate($extendedCloseDate, true);
|
||||||
$this->extendLatestBidCloseDate(null);
|
$this->extendLatestBidCloseDate(null);
|
||||||
|
$this->applyDB();
|
||||||
}
|
}
|
||||||
return join(' ', $reasons);
|
return join(' ', $reasons);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,8 @@ class AutorunNationPolicy {
|
|||||||
public $safeRecruitCityPopulationRatio = 0.5;
|
public $safeRecruitCityPopulationRatio = 0.5;
|
||||||
public $properWarTrainAtmos = 90;
|
public $properWarTrainAtmos = 90;
|
||||||
|
|
||||||
|
public $cureThreshold = 10;
|
||||||
|
|
||||||
///이쪽의 값이 실제 초기화 값임
|
///이쪽의 값이 실제 초기화 값임
|
||||||
public static $defaultPolicy = [
|
public static $defaultPolicy = [
|
||||||
'reqNationGold'=>10000,
|
'reqNationGold'=>10000,
|
||||||
@@ -173,6 +175,8 @@ class AutorunNationPolicy {
|
|||||||
'minNPCRecruitCityPopulation'=>50000,
|
'minNPCRecruitCityPopulation'=>50000,
|
||||||
'safeRecruitCityPopulationRatio'=>0.5,
|
'safeRecruitCityPopulationRatio'=>0.5,
|
||||||
'properWarTrainAtmos'=>90,
|
'properWarTrainAtmos'=>90,
|
||||||
|
|
||||||
|
'cureThreshold'=>10,
|
||||||
];
|
];
|
||||||
|
|
||||||
function __construct(General $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env)
|
function __construct(General $general, $aiOptions, ?array $nationPolicy, ?array $serverPolicy, array $nation, array $env)
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ class che_강행 extends Command\GeneralCommand
|
|||||||
|
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||||
|
$general->increaseVarWithLimit('train', -5, 20);
|
||||||
|
$general->increaseVarWithLimit('atmos', -5, 20);
|
||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class che_집합 extends Command\GeneralCommand{
|
|||||||
}
|
}
|
||||||
foreach($generalList as $targetGeneralID){
|
foreach($generalList as $targetGeneralID){
|
||||||
$targetLogger = new ActionLogger($targetGeneralID, $general->getNationID(), $env['year'], $env['month']);
|
$targetLogger = new ActionLogger($targetGeneralID, $general->getNationID(), $env['year'], $env['month']);
|
||||||
$targetLogger->pushGeneralActionLog("{$troopName}의 부대원들은 <G><b>{$cityName}</b></>{$josaRo} 집합되었습니다.", ActionLogger::PLAIN);
|
$targetLogger->pushGeneralActionLog("{$troopName} 부대원들은 <G><b>{$cityName}</b></>{$josaRo} 집합되었습니다.", ActionLogger::PLAIN);
|
||||||
$targetLogger->flush();
|
$targetLogger->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,17 @@ class che_해산 extends Command\GeneralCommand{
|
|||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
$logger = $general->getLogger();
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
|
$initYearMonth = Util::joinYearMonth($env['init_year'], $env['init_month']);
|
||||||
|
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
||||||
|
if($yearMonth <= $initYearMonth){
|
||||||
|
$logger->pushGeneralActionLog("다음 턴부터 해산할 수 있습니다. <1>$date</>");
|
||||||
|
$this->alternative = new che_인재탐색($general, $this->env, null);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$generalName = $general->getName();
|
$generalName = $general->getName();
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
|
|
||||||
@@ -87,7 +96,7 @@ class che_해산 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
refreshNationStaticInfo();
|
refreshNationStaticInfo();
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("세력을 해산했습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("세력을 해산했습니다. <1>$date</>");
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 세력을 해산했습니다.");
|
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 세력을 해산했습니다.");
|
||||||
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 해산");
|
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 해산");
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ class che_물자원조 extends Command\NationCommand
|
|||||||
ConstraintHelper::OccupiedCity(),
|
ConstraintHelper::OccupiedCity(),
|
||||||
ConstraintHelper::BeChief(),
|
ConstraintHelper::BeChief(),
|
||||||
ConstraintHelper::SuppliedCity(),
|
ConstraintHelper::SuppliedCity(),
|
||||||
|
ConstraintHelper::DifferentDestNation(),
|
||||||
ConstraintHelper::ReqNationGold(GameConst::$basegold + (($goldAmount > 0) ? 1 : 0)),
|
ConstraintHelper::ReqNationGold(GameConst::$basegold + (($goldAmount > 0) ? 1 : 0)),
|
||||||
ConstraintHelper::ReqNationRice(GameConst::$baserice + (($riceAmount > 0) ? 1 : 0)),
|
ConstraintHelper::ReqNationRice(GameConst::$baserice + (($riceAmount > 0) ? 1 : 0)),
|
||||||
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class che_불가침파기수락 extends Command\NationCommand
|
|||||||
$logger->pushGeneralHistoryLog("<D><b>{$destNationName}</b></>{$josaWa}의 불가침 파기 수락");
|
$logger->pushGeneralHistoryLog("<D><b>{$destNationName}</b></>{$josaWa}의 불가침 파기 수락");
|
||||||
|
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYiGeneral} <D><b>{$destNationName}</b></>{$josaWa}의 불가침 조약을 <M>파기</> 하였습니다.");
|
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYiGeneral} <D><b>{$destNationName}</b></>{$josaWa}의 불가침 조약을 <M>파기</> 하였습니다.");
|
||||||
$logger->pushGlobalHistoryLog("<Y><b>【종전】</b></><D><b>{$nationName}</b></>{$josaYiNation} <D><b>{$destNationName}</b></>{$josaWa}의 불가침 조약을 <M>파기</> 하였습니다.");
|
$logger->pushGlobalHistoryLog("<Y><b>【파기】</b></><D><b>{$nationName}</b></>{$josaYiNation} <D><b>{$destNationName}</b></>{$josaWa}의 불가침 조약을 <M>파기</> 하였습니다.");
|
||||||
|
|
||||||
|
|
||||||
$josaWa = JosaUtil::pick($nationName, '와');
|
$josaWa = JosaUtil::pick($nationName, '와');
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class che_의병모집 extends Command\NationCommand
|
|||||||
$gameStor = KVStorage::getStorage($db, 'game_env'); //TODO: 차라리 env가 이거여야..?
|
$gameStor = KVStorage::getStorage($db, 'game_env'); //TODO: 차라리 env가 이거여야..?
|
||||||
|
|
||||||
$avgGenCnt = $db->queryFirstField('SELECT avg(gennum) FROM nation WHERE level > 0');
|
$avgGenCnt = $db->queryFirstField('SELECT avg(gennum) FROM nation WHERE level > 0');
|
||||||
$createGenCnt = 5 + Util::round($avgGenCnt / 10);
|
$createGenCnt = 3 + Util::round($avgGenCnt / 8);
|
||||||
$createGenIdx = $gameStor->npccount + 1;
|
$createGenIdx = $gameStor->npccount + 1;
|
||||||
$lastCreatGenIdx = $createGenIdx + $createGenCnt;
|
$lastCreatGenIdx = $createGenIdx + $createGenCnt;
|
||||||
|
|
||||||
@@ -156,6 +156,7 @@ class che_의병모집 extends Command\NationCommand
|
|||||||
$newNPC->setNPCType(4);
|
$newNPC->setNPCType(4);
|
||||||
$newNPC->setMoney(1000, 1000);
|
$newNPC->setMoney(1000, 1000);
|
||||||
$newNPC->setSpecYear(19, 19);
|
$newNPC->setSpecYear(19, 19);
|
||||||
|
$newNPC->setExpDed($avgGen['exp'], $avgGen['ded']);
|
||||||
$newNPC->fillRemainSpecAsRandom($pickTypeList, $avgGen, $env);
|
$newNPC->fillRemainSpecAsRandom($pickTypeList, $avgGen, $env);
|
||||||
|
|
||||||
$newNPC->build($this->env);
|
$newNPC->build($this->env);
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\Convert;
|
use LDTO\Attr\Convert;
|
||||||
use sammo\DTO\Attr\JsonString;
|
use LDTO\Attr\JsonString;
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
use sammo\DTO\Attr\RawName;
|
use LDTO\Attr\RawName;
|
||||||
use sammo\DTO\Converter\DateTimeConverter;
|
use LDTO\Converter\DateTimeConverter;
|
||||||
|
|
||||||
class AuctionBidItem extends DTO
|
class AuctionBidItem extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[NullIsUndefined]
|
#[NullIsUndefined]
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
|
|
||||||
class AuctionBidItemData extends DTO
|
class AuctionBidItemData extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[NullIsUndefined]
|
#[NullIsUndefined]
|
||||||
|
|||||||
@@ -2,15 +2,15 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\Convert;
|
use LDTO\Attr\Convert;
|
||||||
use sammo\DTO\Attr\JsonString;
|
use LDTO\Attr\JsonString;
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
use sammo\DTO\Attr\RawName;
|
use LDTO\Attr\RawName;
|
||||||
use sammo\DTO\Converter\DateTimeConverter;
|
use LDTO\Converter\DateTimeConverter;
|
||||||
use sammo\Enums\AuctionType;
|
use sammo\Enums\AuctionType;
|
||||||
use sammo\Enums\ResourceType;
|
use sammo\Enums\ResourceType;
|
||||||
|
|
||||||
class AuctionInfo extends DTO
|
class AuctionInfo extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[NullIsUndefined]
|
#[NullIsUndefined]
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\Convert;
|
use LDTO\Attr\Convert;
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
use sammo\DTO\Converter\DateTimeConverter;
|
use LDTO\Converter\DateTimeConverter;
|
||||||
|
|
||||||
class AuctionInfoDetail extends DTO
|
class AuctionInfoDetail extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $title,
|
public string $title,
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\Convert;
|
use LDTO\Attr\Convert;
|
||||||
use sammo\DTO\Converter\MapConverter;
|
use LDTO\Converter\MapConverter;
|
||||||
use sammo\DTO\SelectItem;
|
use sammo\DTO\SelectItem;
|
||||||
|
|
||||||
//https://json2dto.atymic.dev/
|
//https://json2dto.atymic.dev/
|
||||||
|
|
||||||
class BettingInfo extends DTO
|
class BettingInfo extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public int $id,
|
public int $id,
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
use sammo\DTO\Attr\RawName;
|
use LDTO\Attr\RawName;
|
||||||
|
|
||||||
class BettingItem extends DTO
|
class BettingItem extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[RawName('id')]
|
#[RawName('id')]
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\Convert;
|
use LDTO\Attr\Convert;
|
||||||
use sammo\DTO\Converter\MapConverter;
|
use LDTO\Converter\MapConverter;
|
||||||
|
|
||||||
class SelectItem extends DTO
|
class SelectItem extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $title,
|
public string $title,
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
use sammo\DTO\Attr\NullIsUndefined;
|
use LDTO\Attr\NullIsUndefined;
|
||||||
use sammo\DTO\Attr\RawName;
|
use LDTO\Attr\RawName;
|
||||||
|
|
||||||
class VoteComment extends DTO
|
class VoteComment extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
#[NullIsUndefined]
|
#[NullIsUndefined]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace sammo\DTO;
|
namespace sammo\DTO;
|
||||||
|
|
||||||
class VoteInfo extends DTO
|
class VoteInfo extends \LDTO\DTO
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public int $id,
|
public int $id,
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 호출 결과가 false이면서, 대상 API가 처리할 수 없는 추가 동작이 있는 경우 사용.
|
||||||
|
* 예시: 턴을 예약해야 하지만, 장수가 사망하여 게이트웨이로 이동해야함.
|
||||||
|
*/
|
||||||
|
enum APIRecoveryType: string{
|
||||||
|
case Login = 'login';//로그인 재시도부터 시작한다
|
||||||
|
case TwoFactorAuth = '2fa';//로그인은 가능하지만 인증코드 입력이 필요하다
|
||||||
|
case Gateway = 'gateway';//로그인 완료. 게임 서버 리스트를 띄워야한다
|
||||||
|
case GameLogin = 'game_login';//서버 업데이트 등으로 다시 게임 정보 수신 필요
|
||||||
|
case GameQuota = 'game_quota';//접속 제한
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* City Table column
|
||||||
|
* schemal.sql과 일치
|
||||||
|
*/
|
||||||
|
enum CityColumn: string{
|
||||||
|
case city = 'city';
|
||||||
|
case name = 'name';
|
||||||
|
case level = 'level';
|
||||||
|
case nation = 'nation';
|
||||||
|
case supply = 'supply';
|
||||||
|
case front = 'front';
|
||||||
|
case pop = 'pop';
|
||||||
|
case pop_max = 'pop_max';
|
||||||
|
case agri = 'agri';
|
||||||
|
case agri_max = 'agri_max';
|
||||||
|
case comm = 'comm';
|
||||||
|
case comm_max = 'comm_max';
|
||||||
|
case secu = 'secu';
|
||||||
|
case secu_max = 'secu_max';
|
||||||
|
case trust = 'trust';
|
||||||
|
case trade = 'trade';
|
||||||
|
case dead = 'dead';
|
||||||
|
case def = 'def';
|
||||||
|
case def_max = 'def_max';
|
||||||
|
case wall = 'wall';
|
||||||
|
case wall_max = 'wall_max';
|
||||||
|
case officer_set = 'officer_set';
|
||||||
|
case state = 'state';
|
||||||
|
case region = 'region';
|
||||||
|
case term = 'term';
|
||||||
|
case conflict = 'conflict';
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo\Enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General Table column
|
||||||
|
* schemal.sql과 일치
|
||||||
|
*/
|
||||||
|
enum GeneralColumn: string{
|
||||||
|
case no = 'no';
|
||||||
|
case owner = 'owner';
|
||||||
|
case npcmsg = 'npcmsg';
|
||||||
|
case npc = 'npc';
|
||||||
|
case npc_org = 'npc_org';
|
||||||
|
case affinity = 'affinity';
|
||||||
|
case bornyear = 'bornyear';
|
||||||
|
case deadyear = 'deadyear';
|
||||||
|
case newmsg = 'newmsg';
|
||||||
|
case con = 'con';
|
||||||
|
case connect = 'connect';
|
||||||
|
case refresh = 'refresh';
|
||||||
|
case logcnt = 'logcnt';
|
||||||
|
case refcnt = 'refcnt';
|
||||||
|
case picture = 'picture';
|
||||||
|
case imgsvr = 'imgsvr';
|
||||||
|
case name = 'name';
|
||||||
|
case owner_name = 'owner_name';
|
||||||
|
case nation = 'nation';
|
||||||
|
case city = 'city';
|
||||||
|
case troop = 'troop';
|
||||||
|
case leadership = 'leadership';
|
||||||
|
case leadership_exp = 'leadership_exp';
|
||||||
|
case strength = 'strength';
|
||||||
|
case strength_exp = 'strength_exp';
|
||||||
|
case intel = 'intel';
|
||||||
|
case intel_exp = 'intel_exp';
|
||||||
|
case injury = 'injury';
|
||||||
|
case experience = 'experience';
|
||||||
|
case dedication = 'dedication';
|
||||||
|
case dex1 = 'dex1';
|
||||||
|
case dex2 = 'dex2';
|
||||||
|
case dex3 = 'dex3';
|
||||||
|
case dex4 = 'dex4';
|
||||||
|
case dex5 = 'dex5';
|
||||||
|
case officer_level = 'officer_level';
|
||||||
|
case officer_city = 'officer_city';
|
||||||
|
case permission = 'permission';
|
||||||
|
case gold = 'gold';
|
||||||
|
case rice = 'rice';
|
||||||
|
case crew = 'crew';
|
||||||
|
case crewtype = 'crewtype';
|
||||||
|
case train = 'train';
|
||||||
|
case atmos = 'atmos';
|
||||||
|
case weapon = 'weapon';
|
||||||
|
case book = 'book';
|
||||||
|
case horse = 'horse';
|
||||||
|
case item = 'item';
|
||||||
|
case turntime = 'turntime';
|
||||||
|
case recent_war = 'recent_war';
|
||||||
|
case makelimit = 'makelimit';
|
||||||
|
case killturn = 'killturn';
|
||||||
|
case lastconnect = 'lastconnect';
|
||||||
|
case lastrefresh = 'lastrefresh';
|
||||||
|
case ip = 'ip';
|
||||||
|
case block = 'block';
|
||||||
|
case dedlevel = 'dedlevel';
|
||||||
|
case explevel = 'explevel';
|
||||||
|
case age = 'age';
|
||||||
|
case startage = 'startage';
|
||||||
|
case belong = 'belong';
|
||||||
|
case betray = 'betray';
|
||||||
|
case personal = 'personal';
|
||||||
|
case special = 'special';
|
||||||
|
case specage = 'specage';
|
||||||
|
case special2 = 'special2';
|
||||||
|
case specage2 = 'specage2';
|
||||||
|
case defence_train = 'defence_train';
|
||||||
|
case tnmt = 'tnmt';
|
||||||
|
case myset = 'myset';
|
||||||
|
case tournament = 'tournament';
|
||||||
|
case newvote = 'newvote';
|
||||||
|
case last_turn = 'last_turn';
|
||||||
|
case aux = 'aux';
|
||||||
|
case penalty = 'penalty';
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ class CreateManyNPC extends \sammo\Event\Action
|
|||||||
|
|
||||||
protected function generateNPC($env, int $cnt)
|
protected function generateNPC($env, int $cnt)
|
||||||
{
|
{
|
||||||
$pickTypeList = ['무' => 1, '지' => 1];
|
$pickTypeList = ['무' => 0.333, '지' => 0.333, '무지' => 0.334];
|
||||||
|
|
||||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||||
UniqueConst::$hiddenSeed,
|
UniqueConst::$hiddenSeed,
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ class GameUnitConstBase{
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
1502, self::T_SIEGE, '벽력거',
|
1502, self::T_SIEGE, '벽력거',
|
||||||
200, 100, 6, 10, 0, 18, 5,
|
200, 100, 6, 5, 0, 20, 5,
|
||||||
3000, ['업'], null, 0,
|
3000, ['업'], null, 0,
|
||||||
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
|
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
|
||||||
[self::T_FOOTMAN=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833, 1106=>0.909],
|
[self::T_FOOTMAN=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833, 1106=>0.909],
|
||||||
@@ -338,10 +338,10 @@ class GameUnitConstBase{
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
1503, self::T_SIEGE, '목우',
|
1503, self::T_SIEGE, '목우',
|
||||||
50, 200, 5, 0, 0, 18, 5,
|
50, 200, 5, 0, 0, 15, 5,
|
||||||
3000, ['성도'], null, 0,
|
3000, ['성도'], null, 0,
|
||||||
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8],
|
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
|
||||||
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
|
[self::T_FOOTMAN=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833, 1106=>0.909],
|
||||||
['상대를 저지하는 특수병기입니다.'],
|
['상대를 저지하는 특수병기입니다.'],
|
||||||
['che_성벽부상무효'], ['che_저지시도', 'che_저지발동']
|
['che_성벽부상무효'], ['che_저지시도', 'che_저지발동']
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class GameUnitDetail implements iAction{
|
|||||||
public function __construct(
|
public function __construct(
|
||||||
int $id,
|
int $id,
|
||||||
int $armType,
|
int $armType,
|
||||||
string $name,
|
string $name,
|
||||||
int $attack,
|
int $attack,
|
||||||
int $defence,
|
int $defence,
|
||||||
int $speed,
|
int $speed,
|
||||||
@@ -110,7 +110,7 @@ class GameUnitDetail implements iAction{
|
|||||||
}
|
}
|
||||||
else if($this->armType == GameUnitConst::T_MISC){
|
else if($this->armType == GameUnitConst::T_MISC){
|
||||||
$ratio = $general->getIntel(true, true, true) +
|
$ratio = $general->getIntel(true, true, true) +
|
||||||
$general->getLeadership(true, true, true) +
|
$general->getLeadership(true, true, true) +
|
||||||
$general->getStrength(true, true, true);
|
$general->getStrength(true, true, true);
|
||||||
$ratio = $ratio*2/3 - 40;
|
$ratio = $ratio*2/3 - 40;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ class GameUnitDetail implements iAction{
|
|||||||
$defaultWar *= 1 + $this->speed / 2;
|
$defaultWar *= 1 + $this->speed / 2;
|
||||||
$defaultWar /= Util::valueFit(1 - $this->avoid / 100, 0.1);
|
$defaultWar /= Util::valueFit(1 - $this->avoid / 100, 0.1);
|
||||||
$defaultWar *= 1 + $this->magicCoef / 2;
|
$defaultWar *= 1 + $this->magicCoef / 2;
|
||||||
return sqrt($defaultWar);
|
return $defaultWar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
|
public function isValid($ownCities, $ownRegions, $relativeYear, $tech){
|
||||||
@@ -256,6 +256,6 @@ class GameUnitDetail implements iAction{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new WarUnitTriggerCaller(...$triggerList);
|
return new WarUnitTriggerCaller(...$triggerList);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -803,7 +803,7 @@ class General implements iAction
|
|||||||
$db->update('rank_data', [
|
$db->update('rank_data', [
|
||||||
'value' => $rankVal
|
'value' => $rankVal
|
||||||
], 'general_id = %i AND type = %s', $generalID, $rankKey->value);
|
], 'general_id = %i AND type = %s', $generalID, $rankKey->value);
|
||||||
$this->rankVarRead[$rankKey->value] = $rankVal;
|
$this->rankVarRead[$rankKey] = $rankVal;
|
||||||
}
|
}
|
||||||
$result = true;
|
$result = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-8
@@ -205,9 +205,15 @@ class GeneralAI
|
|||||||
$nationID
|
$nationID
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$warTarget && $yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
||||||
$this->dipState = self::d평화;
|
if(!$warTarget){
|
||||||
$this->attackable = false;
|
$this->dipState = self::d평화;
|
||||||
|
$this->attackable = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$this->dipState = self::d선포;
|
||||||
|
$this->attackable = false;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,8 +243,6 @@ class GeneralAI
|
|||||||
|
|
||||||
$this->warTargetNation = $warTargetNation;
|
$this->warTargetNation = $warTargetNation;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||||
$minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID);
|
$minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID);
|
||||||
if ($minWarTerm === null) {
|
if ($minWarTerm === null) {
|
||||||
@@ -2570,7 +2574,7 @@ class GeneralAI
|
|||||||
$gold = $general->getVar('gold');
|
$gold = $general->getVar('gold');
|
||||||
$gold -= $this->fullLeadership * 3;
|
$gold -= $this->fullLeadership * 3;
|
||||||
$rice = $general->getVar('rice');
|
$rice = $general->getVar('rice');
|
||||||
$rice -= $this->fullLeadership * 4 + 500;
|
$rice -= $this->fullLeadership * 4;
|
||||||
|
|
||||||
if ($gold <= 0 || $rice <= 0) {
|
if ($gold <= 0 || $rice <= 0) {
|
||||||
return null;
|
return null;
|
||||||
@@ -3509,7 +3513,7 @@ class GeneralAI
|
|||||||
|
|
||||||
if ($officerLevel > 4) {
|
if ($officerLevel > 4) {
|
||||||
$chiefGenerals[$officerLevel] = $nationGeneral;
|
$chiefGenerals[$officerLevel] = $nationGeneral;
|
||||||
} else if ($officerLevel > 2) {
|
} else if ($officerLevel >= 2) {
|
||||||
$nationCities[$officerCity]['important'] += 1;
|
$nationCities[$officerCity]['important'] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3714,7 +3718,7 @@ class GeneralAI
|
|||||||
return $reservedCommand;
|
return $reservedCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($general->getVar('injury') > 10) {
|
if ($general->getVar('injury') > $this->nationPolicy->cureThreshold) {
|
||||||
$result = buildGeneralCommandClass('che_요양', $general, $this->env);
|
$result = buildGeneralCommandClass('che_요양', $general, $this->env);
|
||||||
$result->reason = 'do요양';
|
$result->reason = 'do요양';
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class InheritancePointManager
|
|||||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||||
if ($storeType === true || ($gameStor->isunited != 0 && !$forceCalc)) {
|
if ($storeType === true || ($gameStor->isunited != 0 && !$forceCalc)) {
|
||||||
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$ownerID}");
|
||||||
[$value, $aux] = $inheritStor->getValue($key);
|
[$value, $aux] = $inheritStor->getValue($key) ?? [0, null];
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ class InheritancePointManager
|
|||||||
}
|
}
|
||||||
[$startYear, $year] = $gameStor->getValuesAsArray(['startyear', 'year']);
|
[$startYear, $year] = $gameStor->getValuesAsArray(['startyear', 'year']);
|
||||||
|
|
||||||
if (($year - $pickYearMonth) * 2 <= ($year - $startYear)) {
|
if (($year - Util::parseYearMonth($pickYearMonth)[0]) * 2 <= ($year - $startYear)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,21 @@ trait LazyVarUpdater{
|
|||||||
return $this->raw;
|
return $this->raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVar(string $key){
|
function getVar(string|\BackedEnum $key){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
return $this->raw[$key];
|
return $this->raw[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVars(string ...$keys){
|
function getVars(string|\BackedEnum ...$keys){
|
||||||
return array_map([$this, 'getVar'], $keys);
|
return array_map([$this, 'getVar'], $keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
function touchVar(string $key):bool{
|
function touchVar(string|\BackedEnum $key):bool{
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
if(key_exists($key, $this->raw)){
|
if(key_exists($key, $this->raw)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -41,16 +47,25 @@ trait LazyVarUpdater{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVar(string $key, $value){
|
function setVar(string|\BackedEnum $key, $value){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
return $this->updateVar($key, $value);
|
return $this->updateVar($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAuxVar(string $key){
|
function getAuxVar(string|\BackedEnum $key){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
$this->unpackAux();
|
$this->unpackAux();
|
||||||
return $this->raw['auxVar'][$key]??null;
|
return $this->raw['auxVar'][$key]??null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAuxVar(string $key, $var){
|
function setAuxVar(string|\BackedEnum $key, $var){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
$oldVar = $this->getAuxVar($key);
|
$oldVar = $this->getAuxVar($key);
|
||||||
|
|
||||||
if($oldVar === $var){
|
if($oldVar === $var){
|
||||||
@@ -66,7 +81,10 @@ trait LazyVarUpdater{
|
|||||||
$this->auxUpdated = true;
|
$this->auxUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVar(string $key, $value){
|
function updateVar(string|\BackedEnum $key, $value){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
if(($this->raw[$key]??null) === $value){
|
if(($this->raw[$key]??null) === $value){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -76,7 +94,10 @@ trait LazyVarUpdater{
|
|||||||
$this->raw[$key] = $value;
|
$this->raw[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateVarWithLimit(string $key, $value, $min = null, $max = null){
|
function updateVarWithLimit(string|\BackedEnum $key, $value, $min = null, $max = null){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
if($min !== null && $value < $min){
|
if($min !== null && $value < $min){
|
||||||
$value = $min;
|
$value = $min;
|
||||||
}
|
}
|
||||||
@@ -86,8 +107,11 @@ trait LazyVarUpdater{
|
|||||||
$this->updateVar($key, $value);
|
$this->updateVar($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function increaseVar(string $key, $value)
|
function increaseVar(string|\BackedEnum $key, $value)
|
||||||
{
|
{
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
if($value === 0){
|
if($value === 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -95,7 +119,10 @@ trait LazyVarUpdater{
|
|||||||
$this->updateVar($key, $targetValue);
|
$this->updateVar($key, $targetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function increaseVarWithLimit(string $key, $value, $min = null, $max = null){
|
function increaseVarWithLimit(string|\BackedEnum $key, $value, $min = null, $max = null){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
$targetValue = $this->raw[$key] + $value;
|
$targetValue = $this->raw[$key] + $value;
|
||||||
if($min !== null && $targetValue < $min){
|
if($min !== null && $targetValue < $min){
|
||||||
$targetValue = $min;
|
$targetValue = $min;
|
||||||
@@ -106,8 +133,11 @@ trait LazyVarUpdater{
|
|||||||
$this->updateVar($key, $targetValue);
|
$this->updateVar($key, $targetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiplyVar(string $key, $value)
|
function multiplyVar(string|\BackedEnum $key, $value)
|
||||||
{
|
{
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
if($value === 1){
|
if($value === 1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -115,7 +145,10 @@ trait LazyVarUpdater{
|
|||||||
$this->updateVar($key, $targetValue);
|
$this->updateVar($key, $targetValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function multiplyVarWithLimit(string $key, $value, $min = null, $max = null){
|
function multiplyVarWithLimit(string|\BackedEnum $key, $value, $min = null, $max = null){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
$targetValue = $this->raw[$key] * $value;
|
$targetValue = $this->raw[$key] * $value;
|
||||||
if($min !== null && $targetValue < $min){
|
if($min !== null && $targetValue < $min){
|
||||||
$targetValue = $min;
|
$targetValue = $min;
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ use \sammo\GameConst;
|
|||||||
use sammo\RandUtil;
|
use sammo\RandUtil;
|
||||||
use \sammo\SpecialityHelper;
|
use \sammo\SpecialityHelper;
|
||||||
use sammo\TimeUtil;
|
use sammo\TimeUtil;
|
||||||
|
|
||||||
|
use function sammo\getPersonalityClass;
|
||||||
|
|
||||||
class GeneralBuilder{
|
class GeneralBuilder{
|
||||||
|
|
||||||
protected $generalID = null;
|
protected $generalID = null;
|
||||||
@@ -161,7 +164,11 @@ class GeneralBuilder{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setEgo(?string $ego):self{
|
public function setEgo(?string $ego):self{
|
||||||
$this->ego = $ego;
|
if($ego === null){
|
||||||
|
$this->ego = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
$this->ego = Util::getClassName(getPersonalityClass($ego));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -353,26 +353,26 @@ class TurnExecutionHelper
|
|||||||
return [false, $currentTurn];
|
return [false, $currentTurn];
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function executeAllCommand(): bool
|
static public function executeAllCommand(&$executed = false, &$locked = false): string
|
||||||
{
|
{
|
||||||
//if(!timeover()) { return; }
|
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
if (TimeUtil::now(true) < $gameStor->turntime) {
|
if (TimeUtil::now(true) < $gameStor->turntime) {
|
||||||
//턴 시각 이전이면 아무것도 하지 않음
|
//턴 시각 이전이면 아무것도 하지 않음
|
||||||
return false;
|
return $gameStor->turntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tryLock()) {
|
if (!tryLock()) {
|
||||||
return false;
|
$locked = true;
|
||||||
|
return $gameStor->turntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gameStor->isunited == 2 || $gameStor->isunited == 3) {
|
if ($gameStor->isunited == 2 || $gameStor->isunited == 3) {
|
||||||
//천통시에는 동결
|
//천통시에는 동결
|
||||||
return false;
|
$locked = true;
|
||||||
|
return $gameStor->turntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameStor->cacheAll();
|
$gameStor->cacheAll();
|
||||||
@@ -414,10 +414,14 @@ class TurnExecutionHelper
|
|||||||
|
|
||||||
if ($executionOver) {
|
if ($executionOver) {
|
||||||
if ($currentTurn !== null) {
|
if ($currentTurn !== null) {
|
||||||
|
$executed = true;
|
||||||
$gameStor->turntime = $currentTurn;
|
$gameStor->turntime = $currentTurn;
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
return $currentTurn !== null && $lastExecuted !== $currentTurn;
|
if($lastExecuted !== $currentTurn){
|
||||||
|
$executed = true;
|
||||||
|
}
|
||||||
|
return $gameStor->turntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
$monthlyRng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
$monthlyRng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||||
@@ -505,6 +509,7 @@ class TurnExecutionHelper
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($currentTurn !== null) {
|
if ($currentTurn !== null) {
|
||||||
|
$executed = true;
|
||||||
$gameStor->turntime = $currentTurn;
|
$gameStor->turntime = $currentTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,10 +517,17 @@ class TurnExecutionHelper
|
|||||||
processTournament();
|
processTournament();
|
||||||
//거래 처리
|
//거래 처리
|
||||||
processAuction();
|
processAuction();
|
||||||
// 잡금 해제
|
// 잠금 해제
|
||||||
|
|
||||||
|
$turntime = $gameStor->turntime;
|
||||||
|
|
||||||
$gameStor->resetCache();
|
$gameStor->resetCache();
|
||||||
unlock();
|
unlock();
|
||||||
|
|
||||||
return $currentTurn !== null && $lastExecuted !== $currentTurn;
|
if($lastExecuted !== $currentTurn){
|
||||||
|
$executed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $turntime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ class WarUnitCity extends WarUnit{
|
|||||||
|
|
||||||
protected $hp;
|
protected $hp;
|
||||||
|
|
||||||
protected $cityRate;
|
protected $cityTrainAtmos;
|
||||||
|
|
||||||
function __construct(public readonly RandUtil $rng, $raw, $rawNation, int $year, int $month, $cityRate){
|
function __construct(public readonly RandUtil $rng, $raw, $rawNation, int $year, int $month, int $startYear){
|
||||||
$general = new DummyGeneral(false);
|
$general = new DummyGeneral(false);
|
||||||
$general->setVar('city', $raw['city']);
|
$general->setVar('city', $raw['city']);
|
||||||
$general->setVar('nation', $raw['nation']);
|
$general->setVar('nation', $raw['nation']);
|
||||||
@@ -18,7 +18,9 @@ class WarUnitCity extends WarUnit{
|
|||||||
$this->rawNation = $rawNation;
|
$this->rawNation = $rawNation;
|
||||||
|
|
||||||
$this->isAttacker = false;
|
$this->isAttacker = false;
|
||||||
$this->cityRate = $cityRate;
|
|
||||||
|
//도시 훈사. 181년 60, 201년 80, 221년 100, 231년 110(최대)
|
||||||
|
$this->cityTrainAtmos = Util::clamp($year - $startYear + 59, 60, 110);
|
||||||
|
|
||||||
$this->logger = $general->getLogger();
|
$this->logger = $general->getLogger();
|
||||||
$this->crewType = GameUnitConst::byID(GameUnitConst::CREWTYPE_CASTLE);
|
$this->crewType = GameUnitConst::byID(GameUnitConst::CREWTYPE_CASTLE);
|
||||||
@@ -34,11 +36,18 @@ class WarUnitCity extends WarUnit{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCityTrainAtmos(): int{
|
||||||
|
return $this->cityTrainAtmos;
|
||||||
|
}
|
||||||
|
|
||||||
function getName():string{
|
function getName():string{
|
||||||
return $this->getVar('name');
|
return $this->getVar('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCityVar(string $key){
|
function getCityVar(string|\BackedEnum $key){
|
||||||
|
if($key instanceof \BackedEnum){
|
||||||
|
$key = $key->value;
|
||||||
|
}
|
||||||
return $this->raw[$key];
|
return $this->raw[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,11 +66,11 @@ class WarUnitCity extends WarUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getComputedTrain(){
|
function getComputedTrain(){
|
||||||
return $this->cityRate + $this->trainBonus;
|
return $this->cityTrainAtmos + $this->trainBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComputedAtmos(){
|
function getComputedAtmos(){
|
||||||
return $this->cityRate + $this->atmosBonus;
|
return $this->cityTrainAtmos + $this->atmosBonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHP():int{
|
function getHP():int{
|
||||||
@@ -69,7 +78,7 @@ class WarUnitCity extends WarUnit{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getDex(GameUnitDetail $crewType){
|
function getDex(GameUnitDetail $crewType){
|
||||||
return ($this->cityRate - 60) * 7200;
|
return ($this->cityTrainAtmos - 60) * 7200;
|
||||||
}
|
}
|
||||||
|
|
||||||
function decreaseHP(int $damage):int{
|
function decreaseHP(int $damage):int{
|
||||||
|
|||||||
@@ -271,6 +271,9 @@ class WarUnitGeneral extends WarUnit
|
|||||||
if (!$this->isAttacker) {
|
if (!$this->isAttacker) {
|
||||||
$rice *= 0.8;
|
$rice *= 0.8;
|
||||||
}
|
}
|
||||||
|
if ($this->oppose instanceof WarUnitCity){
|
||||||
|
$rice *= 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
$rice *= $this->crewType->rice;
|
$rice *= $this->crewType->rice;
|
||||||
$rice *= getTechCost($this->getNationVar('tech'));
|
$rice *= getTechCost($this->getNationVar('tech'));
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class che_격노발동 extends BaseWarUnitTrigger{
|
|||||||
|
|
||||||
$self->getLogger()->pushGeneralBattleDetailLog("상대의 {$targetAct}에 <C>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
$self->getLogger()->pushGeneralBattleDetailLog("상대의 {$targetAct}에 <C>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
||||||
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
||||||
|
|
||||||
if($is진노){
|
if($is진노){
|
||||||
$self->addBonusPhase(1);
|
$self->addBonusPhase(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use sammo\ObjectTrigger;
|
|||||||
use sammo\Util;
|
use sammo\Util;
|
||||||
|
|
||||||
class che_격노시도 extends BaseWarUnitTrigger{
|
class che_격노시도 extends BaseWarUnitTrigger{
|
||||||
protected $priority = ObjectTrigger::PRIORITY_POST + 300;
|
protected $priority = ObjectTrigger::PRIORITY_BODY + 400;
|
||||||
|
|
||||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||||
if(!$oppose->hasActivatedSkill('필살') && !$oppose->hasActivatedSkill('회피')){
|
if(!$oppose->hasActivatedSkill('필살') && !$oppose->hasActivatedSkill('회피')){
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use sammo\ObjectTrigger;
|
|||||||
use sammo\ActionLogger;
|
use sammo\ActionLogger;
|
||||||
|
|
||||||
class che_계략발동 extends BaseWarUnitTrigger{
|
class che_계략발동 extends BaseWarUnitTrigger{
|
||||||
protected $priority = ObjectTrigger::PRIORITY_POST + 100;
|
protected $priority = ObjectTrigger::PRIORITY_POST + 300;
|
||||||
|
|
||||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||||
if(!$self->hasActivatedSkill('계략')){
|
if(!$self->hasActivatedSkill('계략')){
|
||||||
|
|||||||
@@ -44,7 +44,13 @@ class che_계략시도 extends BaseWarUnitTrigger{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($self->getPhase() == 0){
|
$rawIntel = $general->getIntel(false, false, false, false);
|
||||||
|
$allStat =
|
||||||
|
$general->getLeadership(false, false, false, false) +
|
||||||
|
$general->getStrength(false, false, false, false) +
|
||||||
|
$rawIntel;
|
||||||
|
|
||||||
|
if($self->getPhase() == 0 && $rawIntel * 3 >= $allStat){
|
||||||
$magicTrialProb *= 3;
|
$magicTrialProb *= 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user