forked from devsam/core
Compare commits
97
Commits
v0.31.0-pre
...
v0.31.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
7864fe1e0f | ||
|
|
fe08fe0e2e | ||
|
|
87775a9471 | ||
|
|
8089457aa8 | ||
|
|
e443f92ddb | ||
|
|
cb65666600 | ||
|
|
6ed174e5dc | ||
|
|
dd7f0ef3bf | ||
|
|
ec8e43a2a9 | ||
|
|
a83b6b55cd | ||
|
|
d43f15e096 | ||
|
|
e09fdefa68 | ||
|
|
2b483749bc | ||
|
|
048d71920c | ||
|
|
47366086d5 | ||
|
|
f9a73be82b | ||
|
|
e7918469e5 | ||
|
|
687559a1a3 | ||
|
|
398c11e607 | ||
|
|
191544d28b | ||
|
|
647c2439e3 | ||
|
|
da2a6f347a | ||
|
|
dca341f35e | ||
|
|
d38ddcd79e | ||
|
|
03675349d8 | ||
|
|
72768ba7b5 | ||
|
|
a5477db6b6 | ||
|
|
c146e8587b | ||
|
|
24b65b0395 | ||
|
|
2f42691d2b | ||
|
|
ea619bd693 | ||
|
|
35a56e74bb | ||
|
|
6fb2358161 | ||
|
|
a039fb871b | ||
|
|
a19da6cda5 | ||
|
|
e5ba980865 | ||
|
|
f95ee8fab8 | ||
|
|
120706ef3f | ||
|
|
58da20f276 | ||
|
|
64af68e2d6 | ||
|
|
76a8740644 | ||
|
|
0863fafec0 |
@@ -45,7 +45,6 @@ return [
|
||||
'hwe/api.php',
|
||||
'hwe/a_traffic.php',
|
||||
'hwe/battle_simulator.php',
|
||||
'hwe/b_battleCenter.php',
|
||||
'hwe/b_betting.php',
|
||||
'hwe/v_chiefCenter.php',
|
||||
'hwe/b_currentCity.php',
|
||||
@@ -58,7 +57,6 @@ return [
|
||||
'hwe/b_myPage.php',
|
||||
'hwe/v_processing.php',
|
||||
'hwe/b_tournament.php',
|
||||
'hwe/b_troop.php',
|
||||
'hwe/c_tournament.php',
|
||||
'hwe/func_auction.php',
|
||||
'hwe/func_command.php',
|
||||
@@ -83,7 +81,6 @@ return [
|
||||
'hwe/j_board_article_add.php',
|
||||
'hwe/j_board_comment_add.php',
|
||||
'hwe/j_board_get_articles.php',
|
||||
'hwe/j_die_immediately.php',
|
||||
'hwe/j_diplomacy_destroy_letter.php',
|
||||
'hwe/j_diplomacy_get_letter.php',
|
||||
'hwe/j_diplomacy_respond_letter.php',
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace sammo;
|
||||
|
||||
use Ds\Set;
|
||||
use sammo\Enums\RankColumn;
|
||||
use sammo\Enums\AuctionType;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
@@ -19,6 +21,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
increaseRefresh("명장일람", 1);
|
||||
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -31,6 +34,7 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'bestGeneral']) ?>
|
||||
</head>
|
||||
|
||||
@@ -326,6 +330,32 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dummyAuctionGeneral = [
|
||||
'nation' => 0,
|
||||
'no' => 0,
|
||||
'ownerName' => '',
|
||||
'pictureFullPath' => GetImageURL(0) . "/default.jpg",
|
||||
'name' => '경매중',
|
||||
'bgColor' => '#00582c',
|
||||
'fgColor' => 'white',
|
||||
'nationName' => '-',
|
||||
];
|
||||
|
||||
foreach ($db->queryFirstColumn(
|
||||
'SELECT `target` FROM ng_auction WHERE `finished` = 0 AND `type` = %s',
|
||||
AuctionType::UniqueItem->value
|
||||
) as $itemClassName) {
|
||||
if(key_exists($itemClassName, $itemOwners)) {
|
||||
$itemOwners[$itemClassName][] = $dummyAuctionGeneral;
|
||||
}
|
||||
else{
|
||||
$itemOwners[$itemClassName] = [$dummyAuctionGeneral];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||
$itemNameType = $itemTypes[$itemType];
|
||||
$itemList = array_reverse($itemList, true);
|
||||
|
||||
@@ -20,6 +20,7 @@ increaseRefresh("왕조일람", 1);
|
||||
<?= 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('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', 'common') ?>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -28,6 +28,7 @@ $serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null);
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<?= WebUtil::printDist('vue', [], 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" />
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ if ($gameStor->isunited) {
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', 'common') ?>
|
||||
|
||||
</head>
|
||||
|
||||
@@ -49,6 +49,7 @@ if ($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx] ?? [])) {
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'hallOfFame']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ if ($con >= 2) {
|
||||
<?= 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('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
|
||||
<?= WebUtil::printStaticValues($gameStor->getValues(['killturn', 'autorun_user', 'turnterm'])) ?>
|
||||
</head>
|
||||
|
||||
@@ -30,6 +30,7 @@ $sel[$type] = "selected";
|
||||
<?= 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('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ if ($admin['maxonline'] < $curonline) {
|
||||
}
|
||||
</style>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||
</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>
|
||||
+9
-8
@@ -23,8 +23,8 @@ $generalID = $session->generalID;
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,tournament,con,turntime from general where owner=%i', $userID);
|
||||
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'develcost']);
|
||||
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'turnterm', 'develcost']);
|
||||
$turnTerm = $admin['turnterm'];
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
printLimitMsg($me['turntime']);
|
||||
@@ -99,7 +99,7 @@ $str2 = getTournamentTime();
|
||||
if ($str2) {
|
||||
$str2 = ', ' . $str2;
|
||||
}
|
||||
$str3 = getTournamentTermText();
|
||||
$str3 = getTournamentTermText($turnTerm);
|
||||
if ($str3) {
|
||||
$str3 = ', ' . $str3;
|
||||
}
|
||||
@@ -119,6 +119,7 @@ if ($str3) {
|
||||
<?= 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('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'betting']) ?>
|
||||
<?= WebUtil::printStaticValues([
|
||||
'staticValues'=>[
|
||||
@@ -135,7 +136,7 @@ if ($str3) {
|
||||
</table>
|
||||
<table align=center width=1120 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td colspan=16><input type=button value='갱신' onclick='location.reload()'></td>
|
||||
<td colspan=16><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=16 align=center>
|
||||
@@ -441,13 +442,13 @@ if ($str3) {
|
||||
|
||||
if ($admin['tournament'] == 6) {
|
||||
echo "
|
||||
<tr align=center>";
|
||||
<tr align=center style='height:2.5em;'>";
|
||||
|
||||
foreach (range(0, 15) as $i) {
|
||||
$key = $keyMap[$i] ?? -1;
|
||||
echo "
|
||||
<td>
|
||||
<select size=1 id='target_{$key}' style=color:white;background-color:black;>
|
||||
<select size=1 id='target_{$key}' style='color:white;background-color:black;padding:0.2rem 0.1rem;'>
|
||||
<option style=color:white; value=10>금10</option>
|
||||
<option style=color:white; value=20>금20</option>
|
||||
<option style=color:white; value=50>금50</option>
|
||||
@@ -461,12 +462,12 @@ if ($str3) {
|
||||
|
||||
echo "
|
||||
</tr>
|
||||
<tr align=center>";
|
||||
<tr align=center style='height:2.2em;'>";
|
||||
|
||||
foreach (range(0, 15) as $i) {
|
||||
$key = $keyMap[$i] ?? -1;
|
||||
echo "
|
||||
<td><input type=button class='submitBtn' data-target='{$key}' value=베팅! style=width:100%;color:white;background-color:black;></td>";
|
||||
<td><input type=button class='submitBtn' data-target='{$key}' value=베팅! style='width:100%;color:white;padding:0.2rem 0.1rem;background-color:black;'></td>";
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
|
||||
@@ -13,9 +13,11 @@ $userID = Session::getUserID();
|
||||
$userGrade = Session::getUserGrade();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
increaseRefresh("현재도시", 1);
|
||||
|
||||
$lastExecute = substr($gameStor->turntime, 5, 14);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID);
|
||||
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']) ?? [
|
||||
'nation' => 0,
|
||||
@@ -53,6 +55,7 @@ $templates = new \League\Plates\Engine('templates');
|
||||
font-size: x-small;
|
||||
}
|
||||
</style>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'currentCity']) ?>
|
||||
</head>
|
||||
|
||||
@@ -446,7 +449,7 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<table align=center width=1000 class='tb_layout bg2'>
|
||||
<tr>
|
||||
<td colspan=11 align=center style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>'>【 <?= CityConst::$regionMap[$city['region']] ?> | <?= CityConst::$levelMap[$city['level']] ?> 】 <?= $city['name'] ?></td>
|
||||
<td style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>' class='center'><?= date('m-d H:i:s') ?></td>
|
||||
<td style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>' class='center'><?= $lastExecute ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=48 class=bg1>주민</td>
|
||||
|
||||
@@ -57,6 +57,7 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
+48
-48
@@ -25,6 +25,17 @@ if ($meLevel == 0) {
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nation where nation=%i', $nationID); //국가정보
|
||||
|
||||
if ($meLevel >= 5) {
|
||||
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
|
||||
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
|
||||
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
|
||||
} else {
|
||||
$candidateStrength = [];
|
||||
$candidateIntel = [];
|
||||
$candidateAny = [];
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -43,6 +54,7 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
|
||||
var chiefStatMin = <?= GameConst::$chiefStatMin ?>;
|
||||
var myLevel = <?= $meLevel ?>;
|
||||
</script>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'bossInfo']) ?>
|
||||
|
||||
<?php
|
||||
@@ -180,61 +192,21 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
|
||||
<td colspan=5><?= $eaglestr ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td colspan=6 height=5></td>
|
||||
<td colspan=4 height=5></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 align=center bgcolor=red>추 방</td>
|
||||
<td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right class='bg1'>대상 장수</td>
|
||||
<td width=498>
|
||||
<?php $officerLevelText = getOfficerLevelText(11, $nation['level']); ?>
|
||||
<td width=98 align=right class='bg1'><?= getOfficerLevelText(12, $nation['level']) ?></td>
|
||||
<td width=398><?= $level[12]['name'] ?> 【<?= CityConst::byID($level[12]['city'])->name ?>】</td>
|
||||
<td width=98 align=right class='bg1'><?= $officerLevelText ?></td>
|
||||
<td width=398>
|
||||
<?php
|
||||
|
||||
if ($meLevel >= 5) {
|
||||
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
|
||||
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
|
||||
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
|
||||
} else {
|
||||
$candidateStrength = [];
|
||||
$candidateIntel = [];
|
||||
$candidateAny = [];
|
||||
}
|
||||
|
||||
|
||||
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) {
|
||||
echo "
|
||||
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
|
||||
|
||||
foreach ($candidateAny as $general) {
|
||||
if ($general['no'] === $me['no']) {
|
||||
continue;
|
||||
}
|
||||
echo "
|
||||
<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input type=$btn id='btn_kick' value=추방>";
|
||||
}
|
||||
|
||||
$officerLevelText = getOfficerLevelText(11, $nation['level']);
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td colspan=4 height=5></td></tr>
|
||||
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right class='bg1'>" . getOfficerLevelText(12, $nation['level']) . "</td>
|
||||
<td width=398>{$level[12]['name']} 【" . CityConst::byID($level[12]['city'])->name . "】</td>
|
||||
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
|
||||
echo "
|
||||
<select id='genlist_11' size=1 maxlength=15 style=color:white;background-color:black;>
|
||||
@@ -553,6 +525,34 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
|
||||
<td colspan=5>※ <font color=orange>노란색</font>은 변경 불가능, 하얀색은 변경 가능 관직입니다.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td colspan=6 height=5></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 align=center bgcolor=red>추 방</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 align=right class='bg1'>대상 장수</td>
|
||||
<td width=498>
|
||||
<?php
|
||||
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) : ?>
|
||||
|
||||
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
|
||||
|
||||
<?php foreach ($candidateAny as $general) : ?>
|
||||
<?php if ($general['no'] === $me['no']) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<option data-officer_level='<?= $general['officer_level'] ?>' data-name='<?= $general['name'] ?>' value='<?= $general['no'] ?>'><?= $general['name'] ?> <small>(<?= $general['leadership'] ?>/<?= $general['strength'] ?>/<?= $general['intel'] ?>, <?= $general['killturn'] ?>턴)</small></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type=<?= $btn ?> id='btn_kick' value=추방>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
|
||||
@@ -39,6 +39,7 @@ $sel = [$type => "selected"];
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'extExpandCity']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ if ($gameStor->isunited) {
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ if ($nationID == 0) {
|
||||
<?= 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('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
+19
-8
@@ -5,8 +5,9 @@ namespace sammo;
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$showDieImmediatelyBtn = false;
|
||||
$availableDieImmediately = false;
|
||||
$showDieOnPrestartBtn = false;
|
||||
$showBuildNationCandidateBtn = false;
|
||||
$availableDieOnPrestart = false;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
@@ -31,12 +32,16 @@ if ($myset > 0) {
|
||||
$targetTime = addTurn($me->getVar('lastrefresh'), $gameStor->turnterm, 2);
|
||||
if ($gameStor->turntime <= $gameStor->opentime) {
|
||||
//서버 가오픈시 할 수 있는 행동
|
||||
if ($me->getNPCType() == 0) {
|
||||
$showDieImmediatelyBtn = true;
|
||||
if ($me->getNPCType() == 0 && $me->getNationID() == 0) {
|
||||
$showDieOnPrestartBtn = true;
|
||||
if ($targetTime <= TimeUtil::now()) {
|
||||
$availableDieImmediately = true;
|
||||
$availableDieOnPrestart = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($me->getNationID() == 0){
|
||||
$showBuildNationCandidateBtn = true;
|
||||
}
|
||||
}
|
||||
|
||||
$use_treatment = $me->getAuxVar('use_treatment') ?? 10;
|
||||
@@ -51,7 +56,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
|
||||
<meta name="viewport" content="width=500" />
|
||||
<title><?= UniqueConst::$serverName ?>: 내정보</title>
|
||||
<?= WebUtil::printStaticValues([
|
||||
'availableDieImmediately' => $availableDieImmediately,
|
||||
'availableDieOnPrestart' => $availableDieOnPrestart,
|
||||
'staticValues' => [
|
||||
'items' => Util::mapWithKey(fn (string $key, BaseItem $item) => [
|
||||
'name' => $item->getName(),
|
||||
@@ -65,6 +70,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
|
||||
<?= 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::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['myPage']) ?>
|
||||
</head>
|
||||
|
||||
@@ -122,9 +128,14 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
|
||||
<!--빙의 해제용 삭턴 조절<br>
|
||||
<a href="b_myPage.php?detachNPC=1"><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>빙의 해체 요청</button></a>-->
|
||||
|
||||
<?php if ($showDieImmediatelyBtn) : ?>
|
||||
<?php if ($showDieOnPrestartBtn) : ?>
|
||||
가오픈 기간 내 장수 삭제 (<?= substr($targetTime, 0, 19) ?> 부터)<br>
|
||||
<a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>장수 삭제</button></a><br><br>
|
||||
<button type="button" id='dieOnPrestart' style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>장수 삭제</button><br><br>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($showBuildNationCandidateBtn) : ?>
|
||||
서버 개시 이전 거병(2턴부터 건국 가능)<br>
|
||||
<button type="button" id='buildNationCandidate' style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>사전 거병</button><br><br>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($gameStor->npcmode == 2 && $me->getNPCType() == 0) : ?>
|
||||
|
||||
+68
-114
@@ -17,7 +17,8 @@ TurnExecutionHelper::executeAllCommand();
|
||||
$me = $db->queryFirstRow('select no,tournament,con,turntime from general where owner=%i', $userID);
|
||||
$generalID = $session->generalID;
|
||||
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_msg', 'tnmt_type', 'develcost', 'tnmt_trig']);
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'turnterm', 'tnmt_msg', 'tnmt_type', 'develcost', 'tnmt_trig']);
|
||||
$turnTerm = $admin['turnterm'];
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
@@ -109,6 +110,7 @@ $globalBetTotal = array_sum($globalBet);
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?= UniqueConst::$serverName ?>: 토너먼트</title>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<?= WebUtil::printDist('vue', [], 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" />
|
||||
</head>
|
||||
@@ -120,128 +122,80 @@ $globalBetTotal = array_sum($globalBet);
|
||||
</tr>
|
||||
</table>
|
||||
<table align=center class='tb_layout bg0'>
|
||||
<?php
|
||||
if ($session->userGrade >= 5) {
|
||||
$sel = [];
|
||||
echo "
|
||||
<form method=post action=c_tournament.php>
|
||||
<tr><td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td></tr>
|
||||
<tr><td colspan=8>
|
||||
<input type=button value='갱신' onclick='location.reload()'>";
|
||||
<?php if ($session->userGrade >= 5) : ?>
|
||||
<form method=post action=c_tournament.php>
|
||||
<tr>
|
||||
<td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=8>
|
||||
<button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button>
|
||||
<?php if ($admin['tournament'] == 0) : ?>
|
||||
<select name=auto size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0 <?= !$admin['tnmt_trig'] ? 'selected' : '' ?>>수동진행</option>
|
||||
<option style=color:white; value=1 <?= $admin['tnmt_trig'] ? 'selected' : '' ?>>자동진행</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='자동개최설정'>
|
||||
<?php else : ?>
|
||||
<input type=submit name=btn value='중단' onclick='return confirm("진짜 중단하시겠습니까?")'>
|
||||
<?php endif; ?>
|
||||
|
||||
switch ($admin['tnmt_trig']) {
|
||||
case 0:
|
||||
$sel[0] = "selected";
|
||||
break;
|
||||
case 1:
|
||||
$sel[1] = "selected";
|
||||
break;
|
||||
case 2:
|
||||
$sel[2] = "selected";
|
||||
break;
|
||||
case 3:
|
||||
$sel[3] = "selected";
|
||||
break;
|
||||
case 4:
|
||||
$sel[4] = "selected";
|
||||
break;
|
||||
case 5:
|
||||
$sel[5] = "selected";
|
||||
break;
|
||||
case 6:
|
||||
$sel[6] = "selected";
|
||||
break;
|
||||
case 7:
|
||||
$sel[7] = "selected";
|
||||
break;
|
||||
}
|
||||
|
||||
if ($admin['tournament'] == 0) {
|
||||
?>
|
||||
<select name=auto size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0>수동진행</option>
|
||||
<option style=color:white; value=1>12분 05일</option>
|
||||
<option style=color:white; value=2>07분 10시</option>
|
||||
<option style=color:white; value=3>03분 04시</option>
|
||||
<option style=color:white; value=4>01분 82분</option>
|
||||
<option style=color:white; value=5>30초 41분</option>
|
||||
<option style=color:white; value=6>15초 21분</option>
|
||||
<option style=color:white; value=7>05초 07분</option>
|
||||
</select>
|
||||
<select name=type size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0>전력전</option>
|
||||
<option style=color:white; value=1>통솔전</option>
|
||||
<option style=color:white; value=2>일기토</option>
|
||||
<option style=color:white; value=3>설전</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='개최'>
|
||||
<select name=trig size=1 style=color:white;background-color:black;>
|
||||
<option style=color:white; value=0 <?= $sel[0] ?? '' ?>>수동진행</option>
|
||||
<option style=color:white; value=1 <?= $sel[1] ?? '' ?>>12분 05일</option>
|
||||
<option style=color:white; value=2 <?= $sel[2] ?? '' ?>>07분 10시</option>
|
||||
<option style=color:white; value=3 <?= $sel[3] ?? '' ?>>03분 04시</option>
|
||||
<option style=color:white; value=4 <?= $sel[4] ?? '' ?>>01분 82분</option>
|
||||
<option style=color:white; value=5 <?= $sel[5] ?? '' ?>>30초 41분</option>
|
||||
<option style=color:white; value=6 <?= $sel[6] ?? '' ?>>15초 21분</option>
|
||||
<option style=color:white; value=7 <?= $sel[7] ?? '' ?>>05초 07분</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='자동개최설정'>
|
||||
<input type=submit name=btn value='포상'>
|
||||
<input type=submit name=btn value='회수'>
|
||||
<?php
|
||||
} else {
|
||||
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
|
||||
}
|
||||
<?php switch ($admin['tournament']) {
|
||||
case 1:
|
||||
echo "<input type=submit name=btn value='랜덤투입'>";
|
||||
echo "<input type=submit name=btn value='랜덤전부투입'>";
|
||||
break;
|
||||
case 2:
|
||||
echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>";
|
||||
break;
|
||||
case 3:
|
||||
echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>";
|
||||
break;
|
||||
case 4:
|
||||
echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>";
|
||||
break;
|
||||
case 5:
|
||||
echo "<input type=submit name=btn value='배정'>";
|
||||
break;
|
||||
case 6:
|
||||
echo "<input type=submit name=btn value='베팅마감'>";
|
||||
break;
|
||||
case 7:
|
||||
echo "<input type=submit name=btn value='16강'>";
|
||||
break;
|
||||
case 8:
|
||||
echo "<input type=submit name=btn value='8강'>";
|
||||
break;
|
||||
case 9:
|
||||
echo "<input type=submit name=btn value='4강'>";
|
||||
break;
|
||||
case 10:
|
||||
echo "<input type=submit name=btn value='결승'>";
|
||||
break;
|
||||
} ?>
|
||||
|
||||
switch ($admin['tournament']) {
|
||||
case 1:
|
||||
echo "<input type=submit name=btn value='랜덤투입'>";
|
||||
echo "<input type=submit name=btn value='랜덤전부투입'>";
|
||||
break;
|
||||
case 2:
|
||||
echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>";
|
||||
break;
|
||||
case 3:
|
||||
echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>";
|
||||
break;
|
||||
case 4:
|
||||
echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>";
|
||||
break;
|
||||
case 5:
|
||||
echo "<input type=submit name=btn value='배정'>";
|
||||
break;
|
||||
case 6:
|
||||
echo "<input type=submit name=btn value='베팅마감'>";
|
||||
break;
|
||||
case 7:
|
||||
echo "<input type=submit name=btn value='16강'>";
|
||||
break;
|
||||
case 8:
|
||||
echo "<input type=submit name=btn value='8강'>";
|
||||
break;
|
||||
case 9:
|
||||
echo "<input type=submit name=btn value='4강'>";
|
||||
break;
|
||||
case 10:
|
||||
echo "<input type=submit name=btn value='결승'>";
|
||||
break;
|
||||
}
|
||||
|
||||
echo "
|
||||
</td></tr>
|
||||
</form>";
|
||||
} elseif ($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) {
|
||||
echo "<form method=post action=c_tournament.php><tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'><input type=submit name=btn value='참가' onclick='return confirm(\"참가비 금{$admin['develcost']}이 필요합니다. 참가하시겠습니까?\")'></td></tr></form>";
|
||||
} else {
|
||||
echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>";
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php elseif ($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) : ?>
|
||||
<form method=post action=c_tournament.php>
|
||||
<tr>
|
||||
<td colspan=8><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button><button type="submit" class="btn btn-sammo-base2" onclick='return confirm("참가비 금<?= $admin['develcost'] ?>이 필요합니다. 참가하시겠습니까?")'>참가</button><input type='hidden' name='btn' value='참가'/></td>
|
||||
</tr>
|
||||
</form>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan=8><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button></td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
|
||||
$str1 = getTournament($admin['tournament']);
|
||||
$str2 = getTournamentTime();
|
||||
if ($str2) {
|
||||
$str2 = ', ' . $str2;
|
||||
}
|
||||
$str3 = getTournamentTermText();
|
||||
$str3 = getTournamentTermText($turnTerm);
|
||||
if ($str3) {
|
||||
$str3 = ', ' . $str3;
|
||||
}
|
||||
|
||||
-230
@@ -1,230 +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 FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$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>
|
||||
<table width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=80 class='bg1'>부 대 명</td>
|
||||
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
|
||||
<?php if ($me['troop'] == 0) : ?>
|
||||
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
|
||||
<?php else : ?>
|
||||
<td><input type=button id='btnChangeTroopName' value='부 대 변 경'></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<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 nation = <?= Json::encode($nation) ?>;
|
||||
</script>
|
||||
<?= WebUtil::printDist('vue', [], true) ?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'battle_simulator']) ?>
|
||||
</head>
|
||||
|
||||
|
||||
@@ -113,11 +113,11 @@ if($session->userGrade < 5) {
|
||||
}
|
||||
|
||||
if($btn == "자동개최설정") {
|
||||
$gameStor->tnmt_trig = $trig;
|
||||
$gameStor->tnmt_trig = !!$trig;
|
||||
} elseif($btn == "개최") {
|
||||
startTournament($auto, $type);
|
||||
} elseif($btn == "중단") {
|
||||
$gameStor->tnmt_auto = 0;
|
||||
$gameStor->tnmt_auto = false;
|
||||
$gameStor->tournament = 0;
|
||||
$gameStor->phase = 0;
|
||||
} elseif($btn == "랜덤투입") {
|
||||
|
||||
+2
-2
@@ -1358,7 +1358,7 @@ function triggerTournament(RandUtil $rng)
|
||||
if ($tournament != 0) {
|
||||
return;
|
||||
}
|
||||
if ($tnmt_trig == 0) {
|
||||
if (!$tnmt_trig) {
|
||||
return;
|
||||
}
|
||||
if (!$rng->nextBool(0.4)) {
|
||||
@@ -1374,7 +1374,7 @@ function triggerTournament(RandUtil $rng)
|
||||
|
||||
$tnmt_type = array_pop($tnmt_pattern);
|
||||
$gameStor->setValue('tnmt_pattern', $tnmt_pattern);
|
||||
startTournament($tnmt_trig, $tnmt_type);
|
||||
startTournament($tnmt_type);
|
||||
}
|
||||
|
||||
function CheckHall($no)
|
||||
|
||||
@@ -18,7 +18,7 @@ function registerAuction(RandUtil $rng)
|
||||
[AuctionType::BuyRice->value, AuctionType::SellRice->value],
|
||||
));
|
||||
|
||||
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value];
|
||||
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value] ?? 0;
|
||||
|
||||
// 판매건 등록
|
||||
if ($rng->nextBool(1 / ($neutralbuyRiceCnt + 5))) {
|
||||
@@ -38,7 +38,7 @@ function registerAuction(RandUtil $rng)
|
||||
AuctionBuyRice::openResourceAuction($dummyGeneral, $amount, $term, $cost, $topv);
|
||||
}
|
||||
|
||||
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value];
|
||||
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value] ?? 0;
|
||||
// 구매건 등록
|
||||
if ($rng->nextBool(1 / ($neutralSellRiceCnt + 5))) {
|
||||
//평균 쌀의 5% ~ 25%
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace sammo;
|
||||
|
||||
use sammo\DTO\AuctionInfo;
|
||||
use sammo\Enums\AuctionType;
|
||||
use sammo\Enums\InheritanceKey;
|
||||
use sammo\Enums\RankColumn;
|
||||
|
||||
@@ -1053,6 +1055,16 @@ function checkEmperior()
|
||||
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
|
||||
$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();
|
||||
$allUserGenerals = General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc < 2'));
|
||||
foreach ($allUserGenerals as $genObj) {
|
||||
|
||||
@@ -254,6 +254,7 @@ function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $mon
|
||||
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
function getGeneralHistoryLogAll(int $generalID):array {
|
||||
$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) {
|
||||
if(!$history){
|
||||
|
||||
+22
-77
@@ -5,17 +5,25 @@ namespace sammo;
|
||||
use sammo\DTO\BettingInfo;
|
||||
use sammo\Enums\InheritanceKey;
|
||||
|
||||
/**
|
||||
* @param int $turnTerm 서버 턴 단위
|
||||
* @return int 토너먼트 초 단위
|
||||
*/
|
||||
function calcTournamentTerm(int $turnTerm): int{
|
||||
return Util::valueFit($turnTerm, 5, 120);
|
||||
}
|
||||
|
||||
function processTournament()
|
||||
{
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'last_tournament_betting_id']);
|
||||
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'turnterm', 'last_tournament_betting_id']);
|
||||
$now = new \DateTime();
|
||||
$offset = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
|
||||
|
||||
//수동일땐 무시
|
||||
if ($admin['tnmt_auto'] == 0) {
|
||||
if (!$admin['tnmt_auto']) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,18 +36,7 @@ function processTournament()
|
||||
}
|
||||
|
||||
//현시간이 스탬프 지나친경우
|
||||
$unit = [
|
||||
1 => 720,
|
||||
2 => 420,
|
||||
3 => 180,
|
||||
4 => 60,
|
||||
5 => 30,
|
||||
6 => 15,
|
||||
7 => 5,
|
||||
][$admin['tnmt_auto']] ?? null;
|
||||
if($unit === null){
|
||||
throw new MustNotBeReachedException();
|
||||
}
|
||||
$unit = calcTournamentTerm($admin['turnterm']);
|
||||
|
||||
//업데이트 횟수
|
||||
$iter = intdiv($offset, $unit) + 1;
|
||||
@@ -123,10 +120,7 @@ function processTournament()
|
||||
|
||||
//베팅은 무조건 60페이즈후 진행(최대 1시간)
|
||||
if ($tnmt == 6) {
|
||||
$betTerm = $unit * 60;
|
||||
if ($betTerm > 3600) {
|
||||
$betTerm = 3600;
|
||||
}
|
||||
$betTerm = Util::valueFit($unit * 60, null, 3600);
|
||||
//처리 초 더한 날짜
|
||||
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm);
|
||||
$gameStor->tournament = $tnmt;
|
||||
@@ -134,20 +128,6 @@ function processTournament()
|
||||
$gameStor->tnmt_time = $dt;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($admin['tnmt_auto'] == 1) {
|
||||
//처리 초 더한 날짜
|
||||
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i);
|
||||
$hr = substr($dt, 11, 2);
|
||||
//지정시간대 넘어가면 중단 20~24시
|
||||
if ($hr < 20) {
|
||||
$dt = substr($dt, 0, 11) . "20:00:00";
|
||||
$gameStor->tournament = $tnmt;
|
||||
$gameStor->phase = $phase;
|
||||
$gameStor->tnmt_time = $dt;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$second = $unit * $iter;
|
||||
@@ -156,35 +136,9 @@ function processTournament()
|
||||
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
function getTournamentTerm(): ?int
|
||||
function getTournamentTermText(int $turnTerm)
|
||||
{
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$tnmt_auto = $gameStor->tnmt_auto;
|
||||
if ($tnmt_auto === null) {
|
||||
$tnmt_auto = $gameStor->tnmt_trig;
|
||||
}
|
||||
|
||||
return [
|
||||
0 => null,
|
||||
1 => 12 * 60,
|
||||
2 => 7 * 60,
|
||||
3 => 3 * 60,
|
||||
4 => 1 * 60,
|
||||
5 => 30,
|
||||
6 => 15,
|
||||
7 => 5,
|
||||
][$tnmt_auto] ?? null;
|
||||
}
|
||||
|
||||
function getTournamentTermText()
|
||||
{
|
||||
$term = getTournamentTerm();
|
||||
|
||||
if ($term === null) {
|
||||
return '수동';
|
||||
}
|
||||
$term = calcTournamentTerm($turnTerm);
|
||||
|
||||
if ($term % 60 === 0) {
|
||||
$termMin = intdiv($term, 60);
|
||||
@@ -320,26 +274,18 @@ function printFighting($tournament, $phase)
|
||||
}
|
||||
}
|
||||
|
||||
function startTournament($auto, $type)
|
||||
function startTournament($type)
|
||||
{
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
eraseTnmtFightLogAll();
|
||||
|
||||
$unit = [
|
||||
1 => 60,
|
||||
2 => 60,
|
||||
3 => 60,
|
||||
4 => 60,
|
||||
5 => 30,
|
||||
6 => 15,
|
||||
7 => 5,
|
||||
][$auto] ?? 60;
|
||||
$admin = $gameStor->getValues(['year', 'month', 'turnterm']);
|
||||
$turnTerm = $admin['turnterm'];
|
||||
$unit = calcTournamentTerm($turnTerm);
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
$gameStor->tnmt_auto = $auto;
|
||||
$gameStor->tnmt_auto = true;
|
||||
$gameStor->tnmt_time = (new \DateTimeImmutable())->add(new \DateInterval("PT{$unit}M"))->format('Y-m-d H:i:s');
|
||||
$gameStor->tournament = 1;
|
||||
$gameStor->tnmt_type = $type;
|
||||
@@ -392,7 +338,7 @@ function getDummyBettingInfo(string $tnmt_type): BettingInfo
|
||||
);
|
||||
}
|
||||
|
||||
function startBetting($type, $unit)
|
||||
function startBetting($type)
|
||||
{
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -431,7 +377,6 @@ function startBetting($type, $unit)
|
||||
aux: $general
|
||||
);
|
||||
}
|
||||
$candidateCnt = count($candidates);
|
||||
|
||||
Betting::openBetting(new BettingInfo(
|
||||
id: $bettingID,
|
||||
@@ -982,7 +927,7 @@ function setGift($tnmt_type, $tnmt, $phase)
|
||||
}
|
||||
|
||||
//자동진행 끝
|
||||
$gameStor->tnmt_auto = 0;
|
||||
$gameStor->tnmt_auto = false;
|
||||
|
||||
//장수열전 기록
|
||||
/** @var ActionLogger */
|
||||
@@ -1041,7 +986,7 @@ function setRefund()
|
||||
}
|
||||
|
||||
//자동진행 끝
|
||||
$gameStor->tnmt_auto = 0;
|
||||
$gameStor->tnmt_auto = false;
|
||||
}
|
||||
|
||||
//10차이 1.1, 50 차이 1.17, 100차이 1.2
|
||||
|
||||
+30
-5
@@ -114,10 +114,10 @@ if (!$otherTextInfo) {
|
||||
|
||||
$lastVoteID = $gameStor->lastVote;
|
||||
$lastVote = null;
|
||||
if($lastVoteID){
|
||||
if ($lastVoteID) {
|
||||
$voteStor = KVStorage::getStorage($db, 'vote');
|
||||
$lastVote = VoteInfo::fromArray($voteStor->getValue("vote_{$lastVoteID}"));
|
||||
if($lastVote->endDate && $lastVote->endDate < TimeUtil::now()){
|
||||
if ($lastVote->endDate && $lastVote->endDate < TimeUtil::now()) {
|
||||
$lastVote = null;
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ if($lastVoteID){
|
||||
NPC선택 : <?= $npcmode ?>
|
||||
</div>
|
||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||
토너먼트 : <?= getTournamentTermText() ?>
|
||||
토너먼트 : <?= getTournamentTermText($gameStor->turnterm) ?>
|
||||
</div>
|
||||
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
|
||||
기타 설정: <?= $otherTextInfo ?>
|
||||
@@ -282,7 +282,21 @@ if($lastVoteID){
|
||||
<div id="nation-position"><?php myNationInfo($generalObj); ?></div>
|
||||
<div id="general-position"><?php generalInfo($generalObj); ?></div>
|
||||
<div id="generalCommandButton" class="row gx-0">
|
||||
<div class="buttonPlate bg2"><?= commandButton(['btnClass' => 'btn btn-sammo-nation', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?></div>
|
||||
<div class="buttonPlate bg2">
|
||||
<?= commandButton([
|
||||
'splitBtnBegin' => '<div class="btn-group">',
|
||||
'splitBtnEnd' => '</div>',
|
||||
'splitZoneSign' => '<button type="button" class="btn btn-sammo-nation dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle Dropdown</span></button>',
|
||||
'splitZoneBegin' => '<ul class="dropdown-menu dropdown-menu-end">',
|
||||
'splitZoneEnd' => '</ul>',
|
||||
'splitSubBtnBegin' => '<li>',
|
||||
'splitSubBtnEnd' => '</li>',
|
||||
'btnClass' => 'btn btn-sammo-nation',
|
||||
'btnSplitClass' => 'dropdown-item',
|
||||
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
|
||||
'isBettingActive' => $isBettingActive
|
||||
])
|
||||
?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -382,7 +396,18 @@ if($lastVoteID){
|
||||
국가 메뉴
|
||||
</div>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
|
||||
<?= commandButton(['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?>
|
||||
<?= commandButton([
|
||||
'btnBegin' => '<li>',
|
||||
'btnEnd' => '</li>',
|
||||
'splitMainBegin' => '<div class="d-none">',
|
||||
'splitMainEnd' => '</div>',
|
||||
'splitSubBtnBegin' => '<li>',
|
||||
'splitSubBtnEnd' => '</li>',
|
||||
'btnClass' => 'dropdown-item',
|
||||
'btnSplitClass' => 'dropdown-item',
|
||||
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
|
||||
'isBettingActive' => $isBettingActive
|
||||
]) ?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropup">
|
||||
|
||||
+3
-9
@@ -194,17 +194,11 @@ if ($session->userGrade < 5 && !$allowReset) {
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="tournament_trig" class="col-sm-3 col-form-label"><span class="text-nowrap">토너먼트 자동 시작</span> <span class="text-nowrap">경기 단위</span></label>
|
||||
<label for="tournament_trig" class="col-sm-3 col-form-label"><span class="text-nowrap">토너먼트 자동 시작</span></label>
|
||||
<div class="col-sm-9" id="tournament_trig">
|
||||
<div id="tournament_trig" class="btn-group-toggle btn-group flex-wrap" data-bs-toggle="buttons">
|
||||
<input type="radio" class="btn-check" id="tournament_trig_0" name="tournament_trig" value="0"><label for="tournament_trig_0" class="btn btn-secondary w-25">안함</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_1" name="tournament_trig" value="1"><label for="tournament_trig_1" class="btn btn-secondary w-25">12분(총 5일)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_2" name="tournament_trig" value="2"><label for="tournament_trig_2" class="btn btn-secondary w-25">7분(총 10시간)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_3" name="tournament_trig" value="3"><label for="tournament_trig_3" class="btn btn-secondary w-25">3분(총 4시간)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_4" name="tournament_trig" value="4" checked><label for="tournament_trig_4" class="btn btn-secondary w-25">1분(총 82분)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_5" name="tournament_trig" value="5"><label for="tournament_trig_5" class="btn btn-secondary w-25">30초(총 41분)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_6" name="tournament_trig" value="6"><label for="tournament_trig_6" class="btn btn-secondary w-25">15초(총 21분)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_7" name="tournament_trig" value="7"><label for="tournament_trig_7" class="btn btn-secondary w-25">5초(총 7분)</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_0" name="tournament_trig" value="0"><label for="tournament_trig_0" class="btn btn-secondary w-25">수동</label>
|
||||
<input type="radio" class="btn-check" id="tournament_trig_1" name="tournament_trig" checked value="1"><label for="tournament_trig_1" class="btn btn-secondary w-25">자동</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ else if(
|
||||
$status = 'closed';
|
||||
}
|
||||
else if(
|
||||
$isUnited > 0 &&
|
||||
$isUnited > 0 &&
|
||||
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
|
||||
){
|
||||
//천통 & 비정지 상태 & 2/3 넘음
|
||||
@@ -88,7 +88,7 @@ $result = ResetHelper::buildScenario(
|
||||
$options['block_general_create'],
|
||||
$options['npcmode'],
|
||||
$options['show_img_level'],
|
||||
$options['tournament_trig'],
|
||||
!!$options['tournament_trig'],
|
||||
$options['join_mode'],
|
||||
$options['starttime'],
|
||||
$options['autorun_user']?:null
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
|
||||
WebUtil::requireAJAX();
|
||||
|
||||
$availableDieImmediately = false;
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$general = $db->queryFirstRow('SELECT no,name,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
|
||||
|
||||
if(!$general){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'장수가 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
increaseRefresh("장수 삭제", 1);
|
||||
$gameStor->cacheValues(['turnterm', 'opentime', 'turntime', 'year', 'month']);
|
||||
|
||||
if($gameStor->turntime > $gameStor->opentime){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'이미 서버가 시작되었습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$targetTime = addTurn($general['lastrefresh'], $gameStor->turnterm, 2);
|
||||
if($targetTime > TimeUtil::now()){
|
||||
$targetTimeShort = substr($targetTime, 0, 19);
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>"아직 삭제할 수 없습니다. {$targetTimeShort} 부터 가능합니다."
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$generalObj = General::createGeneralObjFromDB($general['no']);
|
||||
if($generalObj instanceof DummyGeneral){
|
||||
trigger_error("올바르지 않은 삭제 프로세스 $userID", E_USER_WARNING);
|
||||
}
|
||||
$generalName = $generalObj->getName();
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$generalObj->kill($db, true, "<Y>{$generalName}</>{$josaYi} 이 홀연히 모습을 <R>감추었습니다</>");
|
||||
|
||||
$session->logoutGame();
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
+2
-2
@@ -111,7 +111,7 @@ $extend = (int)$_POST['extend'];
|
||||
$npcmode = (int)$_POST['npcmode'];
|
||||
$block_general_create = (bool)$_POST['block_general_create'];
|
||||
$show_img_level = (int)$_POST['show_img_level'];
|
||||
$tournament_trig = (int)$_POST['tournament_trig'];
|
||||
$tournament_trig = !!(int)$_POST['tournament_trig'];
|
||||
$join_mode = $_POST['join_mode'];
|
||||
$autorun_user_minutes = (int)$_POST['autorun_user_minutes'];
|
||||
$autorun_user_options = [];
|
||||
@@ -208,7 +208,7 @@ Json::die(ResetHelper::buildScenario(
|
||||
$block_general_create,
|
||||
$npcmode,
|
||||
$show_img_level,
|
||||
$tournament_trig,
|
||||
!!$tournament_trig,
|
||||
$join_mode,
|
||||
TimeUtil::now(),
|
||||
$autorun_user
|
||||
|
||||
@@ -53,32 +53,6 @@ if($action == '부대창설'){
|
||||
]);
|
||||
}
|
||||
|
||||
if($action == '부대변경'){
|
||||
$name = StringUtil::neutralize($name);
|
||||
if(!$name){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'부대 이름이 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$db->update('troop', [
|
||||
'name'=>$name
|
||||
], 'troop_leader=%i',$generalID);
|
||||
|
||||
if($db->affectedRows() == 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'부대장이 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
}
|
||||
|
||||
if($action == '부대추방'){
|
||||
if (!$gen){
|
||||
Json::die([
|
||||
|
||||
@@ -37,7 +37,7 @@ class BidUniqueAuction extends \sammo\BaseAPI
|
||||
{
|
||||
$auctionID = $this->args['auctionID'];
|
||||
$amount = $this->args['amount'];
|
||||
$tryExtendCloseDate = $this->arg['extendCloseDate'] ?? false;
|
||||
$tryExtendCloseDate = $this->args['extendCloseDate'] ?? false;
|
||||
|
||||
$generalID = $session->generalID;
|
||||
$general = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
@@ -9,8 +9,11 @@ use sammo\DB;
|
||||
use sammo\DTO\AuctionBidItem;
|
||||
use sammo\DTO\AuctionInfo;
|
||||
use sammo\Enums\AuctionType;
|
||||
use sammo\Enums\InheritanceKey;
|
||||
use sammo\InheritancePointManager;
|
||||
use sammo\TimeUtil;
|
||||
use sammo\Validator;
|
||||
use sammo\General;
|
||||
|
||||
class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
{
|
||||
@@ -69,6 +72,13 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
];
|
||||
}
|
||||
|
||||
$inheritMgr = InheritancePointManager::getInstance();
|
||||
//preveious라서 column을 최대한 비울 수 있다.
|
||||
$remainPoint = $inheritMgr->getInheritancePoint(
|
||||
General::createGeneralObjFromDB($generalID, ['owner'], 0),
|
||||
InheritanceKey::previous
|
||||
);
|
||||
|
||||
$obfuscatedName = AuctionUniqueItem::genObfuscatedName($generalID);
|
||||
|
||||
return [
|
||||
@@ -86,6 +96,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
],
|
||||
'bidList' => $responseBid,
|
||||
'obfuscatedName' => $obfuscatedName,
|
||||
'remainPoint' => $remainPoint,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class OpenBuyRiceAuction extends \sammo\BaseAPI
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
if($yearMonth < $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class OpenSellRiceAuction extends \sammo\BaseAPI
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
if($yearMonth < $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class OpenUniqueAuction extends \sammo\BaseAPI
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
if($yearMonth < $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\General;
|
||||
|
||||
use sammo\Command\General\che_거병;
|
||||
use sammo\DB;
|
||||
use sammo\Validator;
|
||||
|
||||
use sammo\Session;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\JosaUtil;
|
||||
use sammo\KVStorage;
|
||||
use sammo\LiteHashDRBG;
|
||||
use sammo\RandUtil;
|
||||
use sammo\UniqueConst;
|
||||
use sammo\Util;
|
||||
|
||||
use function sammo\increaseRefresh;
|
||||
|
||||
class BuildNationCandidate 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)
|
||||
{
|
||||
$userID = $session->userID;
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['opentime', 'turntime']);
|
||||
|
||||
$general = $db->queryFirstRow('SELECT no,name,nation,owner_name,npc,lastrefresh FROM general WHERE owner=%i', $userID);
|
||||
|
||||
if (!$general) {
|
||||
return '장수가 없습니다';
|
||||
}
|
||||
|
||||
$generalID = $general['no'];
|
||||
|
||||
increaseRefresh("사전 거병", 1);
|
||||
|
||||
if ($gameStor->turntime > $gameStor->opentime) {
|
||||
return '게임이 시작되었습니다.';
|
||||
}
|
||||
|
||||
if ($general['nation'] != 0) {
|
||||
return '이미 국가에 소속되어있습니다.';
|
||||
}
|
||||
|
||||
$env = $gameStor->getAll();
|
||||
|
||||
$generalObj = General::createGeneralObjFromDB($general['no']);
|
||||
|
||||
$validCmd = false;
|
||||
foreach(GameConst::$availableGeneralCommand as $cmdList){
|
||||
if(in_array('che_거병', $cmdList)){
|
||||
$validCmd = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$validCmd){
|
||||
return '거병할 수 없는 모드입니다.';
|
||||
}
|
||||
|
||||
$cmd = new che_거병($generalObj, $env);
|
||||
$failReason = $cmd->testFullConditionMet();
|
||||
if ($failReason !== null) {
|
||||
return $failReason;
|
||||
}
|
||||
|
||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'BuildNationCandidate',
|
||||
$generalID,
|
||||
)));
|
||||
$result = $cmd->run($rng);
|
||||
|
||||
if(!$result){
|
||||
return '거병을 실패했습니다.';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\General;
|
||||
|
||||
use sammo\DB;
|
||||
use sammo\DummyGeneral;
|
||||
|
||||
use sammo\Session;
|
||||
use sammo\General;
|
||||
use sammo\JosaUtil;
|
||||
use sammo\KVStorage;
|
||||
use sammo\TimeUtil;
|
||||
|
||||
use function sammo\addTurn;
|
||||
use function sammo\increaseRefresh;
|
||||
|
||||
class DieOnPrestart 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)
|
||||
{
|
||||
//로그인 검사
|
||||
$userID = $session->userID;
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['turnterm', 'opentime', 'turntime', 'year', 'month']);
|
||||
|
||||
$general = $db->queryFirstRow('SELECT no,name,nation,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
|
||||
|
||||
if (!$general) {
|
||||
return '장수가 없습니다';
|
||||
}
|
||||
|
||||
increaseRefresh("장수 삭제", 1);
|
||||
|
||||
|
||||
if ($gameStor->turntime > $gameStor->opentime) {
|
||||
return '게임이 시작되었습니다.';
|
||||
}
|
||||
|
||||
if ($general['nation'] != 0){
|
||||
return '이미 국가에 소속되어있습니다.';
|
||||
}
|
||||
|
||||
//서버 가오픈시 할 수 있는 행동
|
||||
$targetTime = addTurn($general['lastrefresh'], $gameStor->turnterm, 2);
|
||||
if ($targetTime > TimeUtil::now()) {
|
||||
$targetTimeShort = substr($targetTime, 0, 19);
|
||||
return "아직 삭제할 수 없습니다. {$targetTimeShort} 부터 가능합니다.";
|
||||
}
|
||||
|
||||
$generalObj = General::createGeneralObjFromDB($general['no']);
|
||||
if ($generalObj instanceof DummyGeneral) {
|
||||
trigger_error("올바르지 않은 삭제 프로세스 $userID", E_USER_WARNING);
|
||||
}
|
||||
|
||||
$generalName = $generalObj->getName();
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$generalObj->kill($db, true, "<Y>{$generalName}</>{$josaYi} 이 홀연히 모습을 <R>감추었습니다</>");
|
||||
|
||||
$session->logoutGame();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@ class GetGeneralLog extends GetNationGeneralLog
|
||||
$v = new Validator($this->args);
|
||||
$v
|
||||
->rule('required', [
|
||||
'type',
|
||||
'reqType',
|
||||
])
|
||||
->rule('int', [
|
||||
'reqTo',
|
||||
])
|
||||
->rule('in', 'type', [
|
||||
->rule('in', 'reqType', [
|
||||
self::GENERAL_HISTORY,
|
||||
self::GENERAL_ACTION,
|
||||
self::BATTLE_RESULT,
|
||||
|
||||
@@ -75,6 +75,7 @@ class Join extends \sammo\BaseAPI
|
||||
if (!$v->validate()) {
|
||||
return $v->errorStr();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -104,6 +105,10 @@ class Join extends \sammo\BaseAPI
|
||||
$inheritCity = $this->args['inheritCity'] ?? null;
|
||||
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
|
||||
|
||||
if($inheritTurntime !== null && $inheritCity !== null){
|
||||
return '턴과 도시를 동시에 지정할 수 없습니다.';
|
||||
}
|
||||
|
||||
$rootDB = RootDB::db();
|
||||
//회원 테이블에서 정보확인
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
|
||||
|
||||
@@ -67,6 +67,10 @@ class BuyHiddenBuff extends \sammo\BaseAPI
|
||||
$reqAmount = GameConst::$inheritBuffPoints[$level] - GameConst::$inheritBuffPoints[$prevLevel];
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0,0])[0];
|
||||
if ($previousPoint < $reqAmount) {
|
||||
|
||||
@@ -40,6 +40,10 @@ class BuyRandomUnique extends \sammo\BaseAPI
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous')??[0, 0])[0];
|
||||
$reqAmount = GameConst::$inheritItemRandomPoint;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\InheritAction;
|
||||
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Session;
|
||||
use sammo\Validator;
|
||||
use sammo\Util;
|
||||
|
||||
class GetMoreLog extends \sammo\BaseAPI
|
||||
{
|
||||
public function validateArgs(): ?string
|
||||
{
|
||||
$v = new Validator($this->args);
|
||||
$v->rule('integer', 'lastID');
|
||||
if (!$v->validate()) {
|
||||
return $v->errorStr();
|
||||
}
|
||||
$this->args['lastID'] = Util::toInt($this->args['lastID']);
|
||||
return null;
|
||||
}
|
||||
function getRequiredSessionMode(): int
|
||||
{
|
||||
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||
{
|
||||
$userID = $session->userID;
|
||||
$lastID = $this->args['lastID'];
|
||||
$db = DB::db();
|
||||
$lastInheritPointLogs = $db->query('SELECT id, server_id, year, month, date, text FROM user_record WHERE log_type = %s AND `user_id` = %i AND id < %i ORDER BY id desc LIMIT 30', "inheritPoint", $userID, $lastID);
|
||||
|
||||
return [
|
||||
'result'=> true,
|
||||
'log' => $lastInheritPointLogs,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,11 @@ class ResetSpecialWar extends \sammo\BaseAPI
|
||||
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||
if ($previousPoint < $reqPoint) {
|
||||
|
||||
@@ -50,6 +50,10 @@ class ResetTurnTime extends \sammo\BaseAPI
|
||||
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||
if ($previousPoint < $reqPoint) {
|
||||
|
||||
@@ -65,6 +65,10 @@ class SetNextSpecialWar extends \sammo\BaseAPI
|
||||
$reqAmount = GameConst::$inheritSpecificSpecialPoint;
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
||||
if ($previousPoint < $reqAmount) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace sammo\API\Nation;
|
||||
|
||||
use ArrayObject;
|
||||
use sammo\DB;
|
||||
use sammo\General;
|
||||
use sammo\Session;
|
||||
@@ -44,9 +45,12 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'belong' => 0,
|
||||
'connect' => 0,
|
||||
|
||||
'troop' => 0,
|
||||
'city' => 0,
|
||||
|
||||
'con' => 1,
|
||||
'specage' => 1,
|
||||
'specage2' => 1,
|
||||
'specage' => 0,
|
||||
'specage2' => 0,
|
||||
'leadership_exp' => 1,
|
||||
'strength_exp' => 1,
|
||||
'intel_exp' => 1,
|
||||
@@ -56,14 +60,12 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'dex4' => 1,
|
||||
'dex5' => 1,
|
||||
|
||||
'city' => 1,
|
||||
'experience' => 1,
|
||||
'dedication' => 1,
|
||||
|
||||
'officer_level' => 1,
|
||||
'officer_city' => 1,
|
||||
'defence_train' => 1,
|
||||
'troop' => 1,
|
||||
'crewtype' => 1,
|
||||
'crew' => 1,
|
||||
'train' => 1,
|
||||
@@ -125,7 +127,7 @@ class GeneralList extends \sammo\BaseAPI
|
||||
if ($level >= 5) {
|
||||
return $level;
|
||||
}
|
||||
if ($this->permission > 1) {
|
||||
if ($this->permission >= 1) {
|
||||
return $level;
|
||||
}
|
||||
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');
|
||||
|
||||
/** @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 = [];
|
||||
if ($this->permission >= 1) {
|
||||
$nonNPCGeneralIDList = [];
|
||||
foreach ($rawGeneralList as $rawGeneral) {
|
||||
if ($rawGeneral['npc'] < 2) {
|
||||
$nonNPCGeneralIDList[] = $rawGeneral['no'];
|
||||
if ($this->permission >= 1 || count($troops)) {
|
||||
$reservedCommandTargetGeneralIDList = [];
|
||||
|
||||
if($this->permission >= 1){
|
||||
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(
|
||||
'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',
|
||||
$nonNPCGeneralIDList
|
||||
);
|
||||
|
||||
foreach ($rawTurnList as $rawTurn) {
|
||||
[
|
||||
'general_id' => $generalID,
|
||||
'action' => $action,
|
||||
'arg' => $arg,
|
||||
'brief' => $brief,
|
||||
] = $rawTurn;
|
||||
if (!key_exists($generalID, $reservedCommand)) {
|
||||
$reservedCommand[$generalID] = [];
|
||||
if($reservedCommandTargetGeneralIDList){
|
||||
$rawTurnList = $db->query(
|
||||
'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) {
|
||||
[
|
||||
'general_id' => $generalID,
|
||||
'action' => $action,
|
||||
'arg' => $arg,
|
||||
'brief' => $brief,
|
||||
] = $rawTurn;
|
||||
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;
|
||||
}
|
||||
|
||||
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 = [];
|
||||
foreach ($rawGeneralList as $rawGeneral) {
|
||||
//General 생성?
|
||||
@@ -271,20 +308,14 @@ class GeneralList extends \sammo\BaseAPI
|
||||
$generalList[] = $item;
|
||||
}
|
||||
|
||||
if ($this->permission >= 1) {
|
||||
$troops = $db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID);
|
||||
} else {
|
||||
$troops = null;
|
||||
}
|
||||
|
||||
|
||||
$result = [
|
||||
'result' => true,
|
||||
'permission' => $this->permission,
|
||||
'column' => array_keys($resultColumns),
|
||||
'list' => $generalList,
|
||||
'troops' => $troops,
|
||||
'troops' => array_values($troops),
|
||||
'env' => $env,
|
||||
'myGeneralID' => $session->generalID,
|
||||
];
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -9,11 +9,12 @@ use sammo\Validator;
|
||||
use function sammo\checkLimit;
|
||||
use function sammo\checkSecretPermission;
|
||||
use function sammo\getBattleDetailLogMore;
|
||||
use function sammo\getBattleDetailLogRecent;
|
||||
use function sammo\getBattleResultMore;
|
||||
use function sammo\getBattleResultRecent;
|
||||
use function sammo\getGeneralActionLogMore;
|
||||
use function sammo\getGeneralActionLogRecent;
|
||||
use function sammo\getGeneralHistoryLogAll;
|
||||
use function sammo\getGeneralHistoryLogWithLogID;
|
||||
|
||||
class GetGeneralLog extends \sammo\BaseAPI
|
||||
{
|
||||
@@ -28,13 +29,13 @@ class GetGeneralLog extends \sammo\BaseAPI
|
||||
$v
|
||||
->rule('required', [
|
||||
'generalID',
|
||||
'type',
|
||||
'reqType',
|
||||
])
|
||||
->rule('integer', [
|
||||
'generalID',
|
||||
'reqTo',
|
||||
])
|
||||
->rule('in', 'type', [
|
||||
->rule('in', 'reqType', [
|
||||
self::GENERAL_HISTORY,
|
||||
self::GENERAL_ACTION,
|
||||
self::BATTLE_RESULT,
|
||||
@@ -76,7 +77,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
||||
return '같은 나라의 장수가 아닙니다.';
|
||||
}
|
||||
|
||||
$reqType = $this->args['type'];
|
||||
$reqType = $this->args['reqType'];
|
||||
if (
|
||||
$reqType === self::GENERAL_ACTION &&
|
||||
$testGeneralNPCType < 2 &&
|
||||
@@ -103,7 +104,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
||||
$userID = $session->userID;
|
||||
|
||||
$targetGeneralID = $this->getTargetGeneralID($session);
|
||||
$reqType = $this->args['type'];
|
||||
$reqType = $this->args['reqType'];
|
||||
$reqTo = $this->args['reqTo'] ?? null;
|
||||
|
||||
$db = DB::db();
|
||||
@@ -124,7 +125,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
||||
'result' => true,
|
||||
'reqType' => $reqType,
|
||||
'generalID' => $targetGeneralID,
|
||||
'log' => getGeneralHistoryLogAll($targetGeneralID)
|
||||
'log' => getGeneralHistoryLogWithLogID($targetGeneralID)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ class GetGeneralLog extends \sammo\BaseAPI
|
||||
'reqType' => $reqType,
|
||||
'generalID' => $targetGeneralID,
|
||||
'log' => $reqTo === null
|
||||
? getBattleResultRecent($targetGeneralID, 30)
|
||||
? getBattleDetailLogRecent($targetGeneralID, 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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\Nation;
|
||||
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\StringUtil;
|
||||
use sammo\Validator;
|
||||
|
||||
use function sammo\checkSecretPermission;
|
||||
|
||||
/** @deprecated */
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -63,9 +63,9 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
|
||||
$nationTurnList = [];
|
||||
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',
|
||||
$me['nation']
|
||||
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
|
||||
'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']
|
||||
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
|
||||
if (!key_exists($officer_level, $nationTurnList)) {
|
||||
$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 = [];
|
||||
foreach ($nationTurnList as $officer_level => $turnBrief) {
|
||||
@@ -111,7 +119,8 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
'turnTerm' => $turnTerm,
|
||||
'date' => TimeUtil::now(true),
|
||||
'chiefList' => $nationChiefList,
|
||||
'isChief'=>($me['officer_level'] > 4),
|
||||
'troopList' => $troopList,
|
||||
'isChief' => ($me['officer_level'] > 4),
|
||||
'autorun_limit' => $generalObj->getAuxVar('autorun_limit'),
|
||||
'officerLevel' => $me['officer_level'],
|
||||
'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;
|
||||
}
|
||||
}
|
||||
@@ -7,13 +7,13 @@ class che_간파_노군입산부 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '노군입산부';
|
||||
protected $name = '노군입산부(간파)';
|
||||
protected $info = '[전투] 상대 회피 확률 -30%p, 상대 필살 확률 -10%p';
|
||||
protected $info = '[전투] 상대 회피 확률 -25%p, 상대 필살 확률 -10%p';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcOpposeStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warAvoidRatio'){
|
||||
return $value - 0.30;
|
||||
return $value - 0.25;
|
||||
}
|
||||
if($statName === 'warCriticalRatio'){
|
||||
return $value - 0.10;
|
||||
|
||||
@@ -12,10 +12,15 @@ class che_격노_구정신단경 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '구정신단경';
|
||||
protected $name = '구정신단경(격노)';
|
||||
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
|
||||
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가), 격노마다 대미지 5% 추가 중첩';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function getWarPowerMultiplier(WarUnit $unit):array{
|
||||
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
|
||||
return [1 + 0.05*$activatedCnt, 1];
|
||||
}
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new che_격노시도($unit, che_격노시도::TYPE_ITEM),
|
||||
|
||||
@@ -8,13 +8,13 @@ class che_내정_납금박산로 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '납금박산로';
|
||||
protected $name = '납금박산로(내정)';
|
||||
protected $info = '[내정] 내정 성공률 +20%p';
|
||||
protected $info = '[내정] 내정 성공률 +15%p';
|
||||
protected $cost = 200;
|
||||
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($varType == 'success') return $value + 0.2;
|
||||
if($varType == 'success') return $value + 0.15;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class che_능력치_무력_두강주 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '두강주';
|
||||
protected $name = '두강주(무력)';
|
||||
protected $info = '[능력치] 무력 +5 +(5년마다 +1)';
|
||||
protected $info = '[능력치] 무력 +5 +(4년마다 +1)';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
@@ -21,7 +21,7 @@ class che_능력치_무력_두강주 extends \sammo\BaseItem{
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||
$relYear = $year - $startYear;
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 4), 0, GameConst::$maxTechLevel);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class che_능력치_지력_이강주 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '이강주';
|
||||
protected $name = '이강주(지력)';
|
||||
protected $info = '[능력치] 지력 +5 +(5년마다 +1)';
|
||||
protected $info = '[능력치] 지력 +5 +(4년마다 +1)';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
@@ -21,7 +21,7 @@ class che_능력치_지력_이강주 extends \sammo\BaseItem{
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||
$relYear = $year - $startYear;
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 4), 0, GameConst::$maxTechLevel);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class che_능력치_통솔_보령압주 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '보령압주';
|
||||
protected $name = '보령압주(통솔)';
|
||||
protected $info = '[능력치] 통솔 +5 +(5년마다 +1)';
|
||||
protected $info = '[능력치] 통솔 +5 +(4년마다 +1)';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
@@ -21,7 +21,7 @@ class che_능력치_통솔_보령압주 extends \sammo\BaseItem{
|
||||
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
|
||||
[$year, $startYear] = $gameStor->getValuesAsArray(['year', 'startyear']);
|
||||
$relYear = $year - $startYear;
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 5), 0, GameConst::$maxTechLevel);
|
||||
return $value + 5 + Util::valueFit(intdiv($relYear, 4), 0, GameConst::$maxTechLevel);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ class che_명성_구석 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '구석';
|
||||
protected $name = '구석(명성)';
|
||||
protected $info = '명성 +15%';
|
||||
protected $info = '명성 +20%';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName == 'experience'){
|
||||
return $value * 1.15;
|
||||
return $value * 1.20;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class che_불굴_상편 extends \sammo\BaseItem
|
||||
|
||||
protected $rawName = '상편';
|
||||
protected $name = '상편(불굴)';
|
||||
protected $info = '[전투] 남은 병력이 적을수록 공격력 증가. 최대 +50%';
|
||||
protected $info = '[전투] 남은 병력이 적을수록 공격력 증가. 최대 +60%';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
@@ -25,7 +25,7 @@ class che_불굴_상편 extends \sammo\BaseItem
|
||||
|
||||
$crewRatio = Util::valueFit($crew / ($leadership * 100), 0, 1);
|
||||
return new WarUnitTriggerCaller(
|
||||
new 전투력보정($unit, 1 + 0.5 * (1 - $crewRatio))
|
||||
new 전투력보정($unit, 1 + 0.6 * (1 - $crewRatio))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ class che_숙련_동작 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '동작';
|
||||
protected $name = '동작(숙련)';
|
||||
protected $info = '숙련 +15%';
|
||||
protected $info = '숙련 +20%';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName == 'addDex'){
|
||||
return $value * 1.15;
|
||||
return $value * 1.20;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ class che_전략_평만지장도 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '평만지장도';
|
||||
protected $name = '평만지장도(전략)';
|
||||
protected $info = '[전략] 국가전략 사용시 재사용 대기 기간 -15%';
|
||||
protected $info = '[전략] 국가전략 사용시 재사용 대기 기간 -20%';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||
if($varType == 'delay'){
|
||||
return Util::round($value * 0.85);
|
||||
return Util::round($value * 0.80);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class che_조달_주판 extends \sammo\BaseItem{
|
||||
protected $cost = 200;
|
||||
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($varType == 'success') return $value + 0.2;
|
||||
if($varType == 'score') return $value * 2;
|
||||
|
||||
@@ -7,17 +7,17 @@ use sammo\WarUnitTrigger\che_저지발동;
|
||||
use sammo\WarUnitTrigger\WarActivateSkills;
|
||||
use sammo\WarUnitTriggerCaller;
|
||||
|
||||
class che_반계저지_박혁론 extends \sammo\BaseItem{
|
||||
class che_진압_박혁론 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '박혁론';
|
||||
protected $name = '박혁론(반계저지)';
|
||||
protected $info = '[전투] 상대의 계략 되돌림 불가';
|
||||
protected $name = '박혁론(진압)';
|
||||
protected $info = '[전투] 상대의 계략 되돌림, 격노 불가';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
|
||||
return new WarUnitTriggerCaller(
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '반계불가'),
|
||||
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '반계불가', '격노불가'),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ class che_징병_낙주 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '낙주';
|
||||
protected $name = '낙주(징병)';
|
||||
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +15%';
|
||||
protected $info = '[군사] 징·모병비 -30%, 통솔 순수 능력치 보정 +15%';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
if(in_array($turnType, ['징병', '모병'])){
|
||||
if($varType == 'cost') return $value * 0.5;
|
||||
if($varType == 'cost') return $value * 0.7;
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
||||
@@ -7,13 +7,13 @@ class che_필살_둔갑천서 extends \sammo\BaseItem{
|
||||
|
||||
protected $rawName = '둔갑천서';
|
||||
protected $name = '둔갑천서(필살)';
|
||||
protected $info = '[전투] 필살 확률 +25%p';
|
||||
protected $info = '[전투] 필살 확률 +20%p';
|
||||
protected $cost = 200;
|
||||
protected $consumable = false;
|
||||
|
||||
public function onCalcStat(General $general, string $statName, $value, $aux=null){
|
||||
if($statName === 'warCriticalRatio'){
|
||||
return $value + 0.25;
|
||||
return $value + 0.20;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -281,8 +281,8 @@ abstract class Auction
|
||||
$general = $this->general;
|
||||
|
||||
$highestBid = $this->getHighestBid();
|
||||
if ($highestBid !== null && $amount <= $highestBid->amount) {
|
||||
return '현재입찰가보다 높게 입찰해야 합니다.';
|
||||
if ($highestBid !== null && $amount < $highestBid->amount + 10) {
|
||||
return '현재입찰가보다 10 포인트 높게 입찰해야 합니다.';
|
||||
}
|
||||
|
||||
$myPrevBid = $this->getMyPrevBid();
|
||||
|
||||
@@ -124,6 +124,13 @@ abstract class AuctionBasicResource extends Auction
|
||||
$auctionHost->increaseVar($hostRes->value, $this->info->detail->amount);
|
||||
$auctionHost->applyDB(DB::db());
|
||||
|
||||
if($this->info->hostGeneralID != 0){
|
||||
$josaYiHost = JosaUtil::pick($auctionHost->getName(), '이');
|
||||
$auctionAmount = $this->info->detail->amount;
|
||||
$auctionLog = "{$this->auctionID}번 {$hostResName} 경매 <M>유찰</> : <Y>{$auctionHost->getName()}</>{$josaYiHost} {$hostResName} <C>{$auctionAmount}</> 판매, 그러나 입찰자 부재";
|
||||
pushAuctionLog($auctionHost->getLogger()->formatText($auctionLog, ActionLogger::EVENT_PLAIN));
|
||||
}
|
||||
|
||||
$staticNation = $auctionHost->getStaticNation();
|
||||
$src = new MessageTarget(0, '', 0, 'System', '#000000');
|
||||
$dest = new MessageTarget(
|
||||
@@ -187,11 +194,11 @@ abstract class AuctionBasicResource extends Auction
|
||||
$auctionID = $this->info->id;
|
||||
|
||||
$auctionHost->getLogger()->pushGeneralActionLog(
|
||||
"{$auctionID}번 거래 <C>성사</>로 {$bidderResName} <C>{$bidAmount}</>{$josaUlBidder} 지불, {$hostResName} <C>{$auctionAmount}</>{$josaUlHost} 획득!",
|
||||
"{$auctionID}번 거래 <C>성사</>로 {$hostResName} <C>{$auctionAmount}</>{$josaUlHost} 판매, {$bidderResName} <C>{$bidAmount}</>{$josaUlBidder} 획득!",
|
||||
ActionLogger::EVENT_PLAIN
|
||||
);
|
||||
$bidder->getLogger()->pushGeneralActionLog(
|
||||
"{$auctionID}번 거래 <C>성사</>로 {$hostResName} <C>{$auctionAmount}</>{$josaUlHost} 판매, {$bidderResName} <C>{$bidAmount}</>{$josaUlBidder} 획득!",
|
||||
"{$auctionID}번 거래 <C>성사</>로 {$bidderResName} <C>{$bidAmount}</>{$josaUlBidder} 지불, {$hostResName} <C>{$auctionAmount}</>{$josaUlHost} 획득!",
|
||||
ActionLogger::EVENT_PLAIN
|
||||
);
|
||||
|
||||
@@ -199,13 +206,14 @@ abstract class AuctionBasicResource extends Auction
|
||||
$josaYiBidder = JosaUtil::pick($bidder->getName(), '이');
|
||||
|
||||
$auctionLog = [];
|
||||
$auctionLog[] = "{$auctionID}번 {$hostResName} 경매 <C>성사</> : <Y>{$auctionHost->getName()}</>{$josaYiHost} {$hostResName} <C>{$auctionAmount}</> 판매, <Y>{$bidder->getName()}</>{$josaYiBidder} <C>{$bidAmount}</> 구매";
|
||||
$josaRoBidder = JosaUtil::pick($bidAmount, '로');
|
||||
$auctionLog[] = "{$auctionID}번 {$hostResName} 경매 <C>성사</> : <Y>{$auctionHost->getName()}</>{$josaYiHost} {$hostResName} <C>{$auctionAmount}</> 판매, <Y>{$bidder->getName()}</>{$josaYiBidder} {$bidderResName} <C>{$bidAmount}</>{$josaRoBidder} 구매";
|
||||
|
||||
|
||||
if ($highestBid->amount === $this->info->detail->finishBidAmount) {
|
||||
$auctionLog[0] .= ' <M>★ 즉시구매가 거래 ★</>';
|
||||
$auctionLog[0] .= ' <M>★ 마감가 거래 ★</>';
|
||||
} else if ($highestBid->amount === $this->info->detail->startBidAmount) {
|
||||
$auctionLog[0] .= " <R>★ 최고가 거래 ★</>";
|
||||
$auctionLog[0] .= " <R>★ 최저가 거래 ★</>";
|
||||
}
|
||||
|
||||
pushAuctionLog(array_map(
|
||||
|
||||
@@ -52,6 +52,24 @@ class AuctionUniqueItem extends Auction
|
||||
return '아직 경매가 끝나지 않았습니다.';
|
||||
}
|
||||
|
||||
$availableCnt = 0;
|
||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||
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);
|
||||
}
|
||||
|
||||
if ($availableCnt <= 0) {
|
||||
return '그 유니크를 더 얻을 수 없습니다.';
|
||||
}
|
||||
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$now = new DateTimeImmutable();
|
||||
@@ -118,6 +136,10 @@ class AuctionUniqueItem extends Auction
|
||||
public function bid(int $amount, bool $tryExtendCloseDate): ?string
|
||||
{
|
||||
|
||||
if ($this->info->finished) {
|
||||
return '경매가 종료되었습니다.';
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
/** @var AuctionInfo[] */
|
||||
$openUniqueAuctions = array_map(fn ($raw) => AuctionInfo::fromArray($raw), $db->query(
|
||||
@@ -126,21 +148,27 @@ class AuctionUniqueItem extends Auction
|
||||
) ?? []);
|
||||
|
||||
$auctionIDList = [];
|
||||
foreach($openUniqueAuctions as $auction){
|
||||
foreach ($openUniqueAuctions as $auction) {
|
||||
$auctionIDList[] = $auction->id;
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$rawHighestBids = Util::convertArrayToDict($db->query(
|
||||
'SELECT bid.* FROM `ng_auction_bid` bid INNER JOIN (
|
||||
SELECT `auction_id`, MAX(`amount`) as `max_amount`
|
||||
FROM `ng_auction_bid`
|
||||
WHERE `auction_id` IN %li
|
||||
GROUP BY `auction_id`
|
||||
ORDER BY `amount`
|
||||
) AS max_bid
|
||||
ON bid.`auction_id` = max_bid.`auction_id` AND bid.`amount` = max_bid.`max_amount`',
|
||||
$auctionIDList,
|
||||
) ?? [], 'auction_id');
|
||||
if ($auctionIDList) {
|
||||
$rawHighestBids = Util::convertArrayToDict($db->query(
|
||||
'SELECT bid.* FROM `ng_auction_bid` bid INNER JOIN (
|
||||
SELECT `auction_id`, MAX(`amount`) as `max_amount`
|
||||
FROM `ng_auction_bid`
|
||||
WHERE `auction_id` IN %li
|
||||
GROUP BY `auction_id`
|
||||
ORDER BY `amount`
|
||||
) AS max_bid
|
||||
ON bid.`auction_id` = max_bid.`auction_id` AND bid.`amount` = max_bid.`max_amount`',
|
||||
$auctionIDList,
|
||||
) ?? [], 'auction_id');
|
||||
} else {
|
||||
$rawHighestBids = [];
|
||||
}
|
||||
|
||||
/** @var array<int,AuctionBidItem> */
|
||||
$highestBids = Util::mapWithKey(
|
||||
fn ($auctionID, $bid) => AuctionBidItem::fromArray($bid),
|
||||
@@ -149,13 +177,20 @@ class AuctionUniqueItem extends Auction
|
||||
|
||||
$itemCode = $this->info->target;
|
||||
|
||||
if($itemCode === null){
|
||||
if ($itemCode === null) {
|
||||
throw new \Exception('아이템 코드가 없습니다.');
|
||||
}
|
||||
|
||||
$bidItemTypes = new Set();
|
||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||
if (key_exists($itemCode, $itemList) && $itemList[$itemCode] <= 0) {
|
||||
if (!key_exists($itemCode, $itemList)) {
|
||||
continue;
|
||||
}
|
||||
$ownItem = $this->general->getItem($itemType);
|
||||
if ($ownItem !== null && !$ownItem->isBuyable()) {
|
||||
return '이미 가진 아이템이 있습니다.';
|
||||
}
|
||||
if ($itemList[$itemCode] <= 0) {
|
||||
continue;
|
||||
}
|
||||
$bidItemTypes->add($itemType);
|
||||
@@ -190,6 +225,11 @@ class AuctionUniqueItem extends Auction
|
||||
return $this->_bid($amount, $tryExtendCloseDate);
|
||||
}
|
||||
|
||||
protected function setHostAsNeutral(){
|
||||
$this->info->hostGeneralID = 0;
|
||||
$this->info->detail->hostName = '(상인)';
|
||||
}
|
||||
|
||||
protected function finishAuction(AuctionBidItem $highestBid, General $bidder): ?string
|
||||
{
|
||||
$itemKey = $this->info->target;
|
||||
@@ -228,12 +268,16 @@ class AuctionUniqueItem extends Auction
|
||||
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->extendLatestBidCloseDate(null);
|
||||
$this->applyDB();
|
||||
return '유니크 아이템 소유 제한 상태입니다. 종료 시간이 연장됩니다.';
|
||||
}
|
||||
|
||||
$isExtendCloseDateRequired = false;
|
||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
||||
//아직은 그런 경우는 없지만 동일 유니크를 여러 부위에 장착할 수 있을지도 모름
|
||||
if (!key_exists($itemKey, $itemList)) {
|
||||
@@ -243,11 +287,13 @@ class AuctionUniqueItem extends Auction
|
||||
$ownItem = $general->getItem($itemType);
|
||||
if ($ownItem->getRawClassName() == $itemKey) {
|
||||
//FIXME: 이 경우에는 환불이 되던가 해야함.
|
||||
$isExtendCloseDateRequired = true;
|
||||
$reasons[] = '이미 그 유니크를 가지고 있습니다.';
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$ownItem->isBuyable()) {
|
||||
$isExtendCloseDateRequired = true;
|
||||
$reasons[] = '이미 다른 유니크를 가지고 있습니다.';
|
||||
continue;
|
||||
}
|
||||
@@ -263,6 +309,20 @@ class AuctionUniqueItem extends Auction
|
||||
}
|
||||
|
||||
if (!$availableItemTypes) {
|
||||
if ($isExtendCloseDateRequired) {
|
||||
$turnTerm = $gameStor->getValue('turnterm');
|
||||
//동일 부위 제한에 걸렸다면 자동 연장
|
||||
$extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval(
|
||||
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->extendLatestBidCloseDate(null);
|
||||
$this->applyDB();
|
||||
}
|
||||
return join(' ', $reasons);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,6 +146,8 @@ class AutorunNationPolicy {
|
||||
public $safeRecruitCityPopulationRatio = 0.5;
|
||||
public $properWarTrainAtmos = 90;
|
||||
|
||||
public $cureThreshold = 10;
|
||||
|
||||
///이쪽의 값이 실제 초기화 값임
|
||||
public static $defaultPolicy = [
|
||||
'reqNationGold'=>10000,
|
||||
@@ -173,6 +175,8 @@ class AutorunNationPolicy {
|
||||
'minNPCRecruitCityPopulation'=>50000,
|
||||
'safeRecruitCityPopulationRatio'=>0.5,
|
||||
'properWarTrainAtmos'=>90,
|
||||
|
||||
'cureThreshold'=>10,
|
||||
];
|
||||
|
||||
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();
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
$general->increaseVarWithLimit('train', -5, 20);
|
||||
$general->increaseVarWithLimit('atmos', -5, 20);
|
||||
$general->addExperience($exp);
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -139,6 +139,16 @@ class che_건국 extends Command\GeneralCommand
|
||||
$general = $this->generalObj;
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
$generalName = $general->getName();
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
|
||||
$nationName = $this->arg['nationName'];
|
||||
@@ -149,7 +159,7 @@ class che_건국 extends Command\GeneralCommand
|
||||
|
||||
$josaUl = JosaUtil::pick($nationName, '을');
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
|
||||
$nationTypeClass = buildNationTypeClass($nationType);
|
||||
$nationTypeName = $nationTypeClass->getName();
|
||||
|
||||
@@ -98,6 +98,9 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
|
||||
$general->addDex($general->getCrewTypeObj(), $score, false);
|
||||
|
||||
[$reqGold,] = $this->getCost();
|
||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||
|
||||
$general->addExperience($exp);
|
||||
$general->addDedication($ded);
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
|
||||
@@ -91,7 +91,7 @@ class che_집합 extends Command\GeneralCommand{
|
||||
}
|
||||
foreach($generalList as $targetGeneralID){
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,8 +65,17 @@ class che_해산 extends Command\GeneralCommand{
|
||||
$env = $this->env;
|
||||
|
||||
$general = $this->generalObj;
|
||||
$logger = $general->getLogger();
|
||||
$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();
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
|
||||
@@ -87,7 +96,7 @@ class che_해산 extends Command\GeneralCommand{
|
||||
|
||||
refreshNationStaticInfo();
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$logger->pushGeneralActionLog("세력을 해산했습니다. <1>$date</>");
|
||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} 세력을 해산했습니다.");
|
||||
$logger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaUl} 해산");
|
||||
|
||||
@@ -111,6 +111,7 @@ class che_물자원조 extends Command\NationCommand
|
||||
ConstraintHelper::OccupiedCity(),
|
||||
ConstraintHelper::BeChief(),
|
||||
ConstraintHelper::SuppliedCity(),
|
||||
ConstraintHelper::DifferentDestNation(),
|
||||
ConstraintHelper::ReqNationGold(GameConst::$basegold + (($goldAmount > 0) ? 1 : 0)),
|
||||
ConstraintHelper::ReqNationRice(GameConst::$baserice + (($riceAmount > 0) ? 1 : 0)),
|
||||
ConstraintHelper::ReqNationValue('surlimit', '외교제한', '==', 0, '외교제한중입니다.'),
|
||||
|
||||
@@ -165,7 +165,7 @@ class che_불가침파기수락 extends Command\NationCommand
|
||||
$logger->pushGeneralHistoryLog("<D><b>{$destNationName}</b></>{$josaWa}의 불가침 파기 수락");
|
||||
|
||||
$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, '와');
|
||||
|
||||
@@ -243,30 +243,14 @@ class che_피장파장 extends Command\NationCommand
|
||||
{
|
||||
$generalObj = $this->generalObj;
|
||||
$nationID = $generalObj->getNationID();
|
||||
$nationList = [];
|
||||
$testTurn = new LastTurn($this->getName(), null, $this->getPreReqTurn());
|
||||
foreach (getAllNationStaticInfo() as $destNation) {
|
||||
$testCommand = new static($generalObj, $this->env, $testTurn, ['destNationID' => $destNation['nation']]);
|
||||
|
||||
$nationTarget = [
|
||||
'id' => $destNation['nation'],
|
||||
'name' => $destNation['name'],
|
||||
'color' => $destNation['color'],
|
||||
'power' => $destNation['power'],
|
||||
];
|
||||
if (!$testCommand->hasFullConditionMet()) {
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
if ($destNation['nation'] == $nationID) {
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
|
||||
$nationList[] = $nationTarget;
|
||||
}
|
||||
|
||||
$testTurn = new LastTurn($this->getName(), null, null);
|
||||
|
||||
$availableCommandTypeList = [];
|
||||
$currYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']);
|
||||
|
||||
$oneAvailableCommandName = null;
|
||||
|
||||
foreach (GameConst::$availableChiefCommand['전략'] as $commandType) {
|
||||
$cmd = buildNationCommandClass($commandType, $generalObj, $this->env, new LastTurn());
|
||||
$cmdName = $cmd->getName();
|
||||
@@ -276,9 +260,40 @@ class che_피장파장 extends Command\NationCommand
|
||||
if ($nextAvailableTurn !== null && $currYearMonth < $nextAvailableTurn) {
|
||||
$remainTurn = $nextAvailableTurn - $currYearMonth;
|
||||
}
|
||||
else{
|
||||
$oneAvailableCommandName = $cmd->getRawClassName();
|
||||
}
|
||||
$availableCommandTypeList[$commandType] = ['name' => $cmdName, 'remainTurn' => $remainTurn];
|
||||
}
|
||||
|
||||
$nationList = [];
|
||||
foreach (getAllNationStaticInfo() as $destNation) {
|
||||
$nationTarget = [
|
||||
'id' => $destNation['nation'],
|
||||
'name' => $destNation['name'],
|
||||
'color' => $destNation['color'],
|
||||
'power' => $destNation['power'],
|
||||
];
|
||||
|
||||
if($oneAvailableCommandName === null){
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
else if ($destNation['nation'] == $nationID) {
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
else {
|
||||
$testCommand = new static($generalObj, $this->env, $testTurn, [
|
||||
'destNationID' => $destNation['nation'],
|
||||
'commandType' => $oneAvailableCommandName
|
||||
]);
|
||||
if (!$testCommand->hasFullConditionMet()) {
|
||||
$nationTarget['notAvailable'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$nationList[] = $nationTarget;
|
||||
}
|
||||
|
||||
return [
|
||||
'procRes' => [
|
||||
'nationList' => $nationList,
|
||||
|
||||
@@ -33,12 +33,12 @@ class CreateManyNPC extends \sammo\Event\Action
|
||||
$env['year'],
|
||||
$env['month']
|
||||
)));
|
||||
$age = $rng->nextRangeInt(20, 25);
|
||||
$birthYear = $env['year'] - $age;
|
||||
$deathYear = $env['year'] + $rng->nextRangeInt(10, 60);
|
||||
|
||||
$result = [];
|
||||
foreach (pickGeneralFromPool(DB::db(), $rng, 0, $cnt) as $pickedNPC) {
|
||||
$age = $rng->nextRangeInt(20, 25);
|
||||
$birthYear = $env['year'] - $age;
|
||||
$deathYear = $env['year'] + $rng->nextRangeInt(10, 50);
|
||||
$newNPC = $pickedNPC->getGeneralBuilder();
|
||||
$newNPC->setNationID(0)
|
||||
->setNPCType(3)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace sammo\Event\Action;
|
||||
|
||||
use DateTime;
|
||||
use sammo\Betting;
|
||||
use \sammo\GameConst;
|
||||
use \sammo\Util;
|
||||
@@ -10,8 +11,12 @@ use sammo\DTO\BettingInfo;
|
||||
use sammo\DTO\SelectItem;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Message;
|
||||
use sammo\MessageTarget;
|
||||
|
||||
use function sammo\getAllNationStaticInfo;
|
||||
use function sammo\GetImageURL;
|
||||
use function sammo\getNationStaticInfo;
|
||||
|
||||
class OpenNationBetting extends \sammo\Event\Action
|
||||
{
|
||||
@@ -50,8 +55,8 @@ class OpenNationBetting extends \sammo\Event\Action
|
||||
$candidates = [];
|
||||
|
||||
$nations = getAllNationStaticInfo();
|
||||
uasort($nations, function($lhs, $rhs){
|
||||
return -($lhs['power'] <=> $rhs['power']);
|
||||
uasort($nations, function ($lhs, $rhs) {
|
||||
return - ($lhs['power'] <=> $rhs['power']);
|
||||
});
|
||||
|
||||
foreach ($nations as $nationRaw) {
|
||||
@@ -117,6 +122,32 @@ class OpenNationBetting extends \sammo\Event\Action
|
||||
}
|
||||
|
||||
$logger->flush();
|
||||
$now = new DateTime();
|
||||
$text = "새로운 {$name} 내기가 열렸습니다. 천통국 베팅란을 확인해주세요.";
|
||||
|
||||
$src = new MessageTarget(0, '', 0, 'System', '#000000');
|
||||
foreach ($db->query('SELECT `no`, `name`, `nation`, `imgsvr`, `picture` FROM `general` WHERE `npc` <= 1') as $general) {
|
||||
$generalID = $general['no'];
|
||||
$staticNation = getNationStaticInfo($general['nation']);
|
||||
$dest = new MessageTarget(
|
||||
$generalID,
|
||||
$general['name'],
|
||||
$general['nation'],
|
||||
$staticNation['name'],
|
||||
$staticNation['color'],
|
||||
GetImageURL($general['imgsvr'], $general['picture'])
|
||||
);
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_PRIVATE,
|
||||
$src,
|
||||
$dest,
|
||||
$text,
|
||||
$now,
|
||||
new DateTime('9999-12-31'),
|
||||
[]
|
||||
);
|
||||
$msg->send(true);
|
||||
}
|
||||
|
||||
return [__CLASS__, true];
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class GameConstBase
|
||||
'che_저격_매화수전' => 1, 'che_저격_비도'=>1, 'che_위압_조목삭' => 1, 'che_공성_묵자' => 1,
|
||||
'che_집중_전국책' => 1, 'che_환술_논어집해' => 1,
|
||||
|
||||
'che_반계저지_박혁론' => 1, 'che_부적_태현청생부' => 1, 'che_저지_삼황내문' => 1,
|
||||
'che_진압_박혁론' => 1, 'che_부적_태현청생부' => 1, 'che_저지_삼황내문' => 1,
|
||||
'che_행동_서촉지형도' => 1, 'che_간파_노군입산부' => 1, 'che_불굴_상편' => 1,
|
||||
'che_약탈_옥벽' => 1,
|
||||
|
||||
@@ -334,7 +334,6 @@ class GameConstBase
|
||||
'che_건국',
|
||||
'che_선양',
|
||||
'che_해산',
|
||||
'che_모반시도',
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ class GameUnitConstBase{
|
||||
],
|
||||
[
|
||||
1502, self::T_SIEGE, '벽력거',
|
||||
200, 100, 6, 10, 0, 18, 5,
|
||||
200, 100, 6, 5, 0, 20, 5,
|
||||
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=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833, 1106=>0.909],
|
||||
@@ -338,7 +338,7 @@ class GameUnitConstBase{
|
||||
],
|
||||
[
|
||||
1503, self::T_SIEGE, '목우',
|
||||
50, 200, 5, 0, 0, 18, 5,
|
||||
50, 200, 5, 0, 0, 15, 5,
|
||||
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.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
|
||||
|
||||
+15
-11
@@ -200,9 +200,20 @@ class GeneralAI
|
||||
|
||||
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
||||
|
||||
$warTarget = $db->queryAllLists(
|
||||
'SELECT you, state, term FROM diplomacy WHERE me = %i AND state IN (0, 1)',
|
||||
$nationID
|
||||
);
|
||||
|
||||
if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
||||
$this->dipState = self::d평화;
|
||||
$this->attackable = false;
|
||||
if(!$warTarget){
|
||||
$this->dipState = self::d평화;
|
||||
$this->attackable = false;
|
||||
}
|
||||
else{
|
||||
$this->dipState = self::d선포;
|
||||
$this->attackable = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -210,11 +221,6 @@ class GeneralAI
|
||||
// 공격가능도시 있으면
|
||||
$this->attackable = !!$frontStatus;
|
||||
|
||||
$warTarget = $db->queryAllLists(
|
||||
'SELECT you, state, term FROM diplomacy WHERE me = %i AND state IN (0, 1)',
|
||||
$nationID
|
||||
);
|
||||
|
||||
$onWar = 0;
|
||||
$onWarReady = 0;
|
||||
$onWarYet = 0;
|
||||
@@ -237,8 +243,6 @@ class GeneralAI
|
||||
|
||||
$this->warTargetNation = $warTargetNation;
|
||||
|
||||
|
||||
|
||||
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
||||
$minWarTerm = $db->queryFirstField('SELECT min(term) FROM diplomacy WHERE me = %i AND state=1', $nationID);
|
||||
if ($minWarTerm === null) {
|
||||
@@ -2570,7 +2574,7 @@ class GeneralAI
|
||||
$gold = $general->getVar('gold');
|
||||
$gold -= $this->fullLeadership * 3;
|
||||
$rice = $general->getVar('rice');
|
||||
$rice -= $this->fullLeadership * 4 + 500;
|
||||
$rice -= $this->fullLeadership * 4;
|
||||
|
||||
if ($gold <= 0 || $rice <= 0) {
|
||||
return null;
|
||||
@@ -3714,7 +3718,7 @@ class GeneralAI
|
||||
return $reservedCommand;
|
||||
}
|
||||
|
||||
if ($general->getVar('injury') > 10) {
|
||||
if ($general->getVar('injury') > $this->nationPolicy->cureThreshold) {
|
||||
$result = buildGeneralCommandClass('che_요양', $general, $this->env);
|
||||
$result->reason = 'do요양';
|
||||
return $result;
|
||||
|
||||
@@ -163,7 +163,7 @@ class ResetHelper{
|
||||
bool $block_general_create,
|
||||
int $npcmode,
|
||||
int $show_img_level,
|
||||
int $tournament_trig,
|
||||
bool $tournament_trig,
|
||||
string $join_mode,
|
||||
string $turntime,
|
||||
?array $autorun_user
|
||||
@@ -176,13 +176,6 @@ class ResetHelper{
|
||||
];
|
||||
}
|
||||
|
||||
if($tournament_trig < 0 || $tournament_trig > 7){
|
||||
return [
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 토너먼트 주기입니다.'
|
||||
];
|
||||
}
|
||||
|
||||
$clearResult = self::clearDB();
|
||||
if(!$clearResult['result']){
|
||||
return $clearResult;
|
||||
|
||||
@@ -11,6 +11,9 @@ use \sammo\GameConst;
|
||||
use sammo\RandUtil;
|
||||
use \sammo\SpecialityHelper;
|
||||
use sammo\TimeUtil;
|
||||
|
||||
use function sammo\getPersonalityClass;
|
||||
|
||||
class GeneralBuilder{
|
||||
|
||||
protected $generalID = null;
|
||||
@@ -161,7 +164,11 @@ class GeneralBuilder{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class che_격노발동 extends BaseWarUnitTrigger{
|
||||
|
||||
$self->getLogger()->pushGeneralBattleDetailLog("상대의 {$targetAct}에 <C>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
||||
$oppose->getLogger()->pushGeneralBattleDetailLog("{$targetAct}에 상대가 <R>{$reaction}</>했다!</>", ActionLogger::PLAIN);
|
||||
|
||||
|
||||
if($is진노){
|
||||
$self->addBonusPhase(1);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use sammo\ObjectTrigger;
|
||||
use sammo\Util;
|
||||
|
||||
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{
|
||||
if(!$oppose->hasActivatedSkill('필살') && !$oppose->hasActivatedSkill('회피')){
|
||||
|
||||
@@ -10,7 +10,7 @@ use sammo\ObjectTrigger;
|
||||
use sammo\ActionLogger;
|
||||
|
||||
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{
|
||||
if(!$self->hasActivatedSkill('계략')){
|
||||
|
||||
@@ -10,7 +10,7 @@ use sammo\ObjectTrigger;
|
||||
use sammo\ActionLogger;
|
||||
|
||||
class che_계략실패 extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_POST + 200;
|
||||
protected $priority = ObjectTrigger::PRIORITY_POST + 300;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->hasActivatedSkill('계략실패')){
|
||||
|
||||
@@ -14,7 +14,7 @@ use sammo\ObjectTrigger;
|
||||
|
||||
class che_궁병선제사격 extends BaseWarUnitTrigger
|
||||
{
|
||||
protected $priority = ObjectTrigger::PRIORITY_BEGIN;
|
||||
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 50;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv): bool
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ use sammo\Util;
|
||||
use sammo\ObjectTrigger;
|
||||
|
||||
class che_기병병종전투 extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_FINAL; //최후미
|
||||
protected $priority = ObjectTrigger::PRIORITY_FINAL + 100; //최후미
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->isAttacker()){
|
||||
|
||||
@@ -10,7 +10,7 @@ use sammo\ObjectTrigger;
|
||||
use sammo\ActionLogger;
|
||||
|
||||
class che_반계발동 extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_POST + 150;
|
||||
protected $priority = ObjectTrigger::PRIORITY_POST + 250;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->hasActivatedSkill('반계')){
|
||||
@@ -20,7 +20,7 @@ class che_반계발동 extends BaseWarUnitTrigger{
|
||||
$general = $self->getGeneral();
|
||||
|
||||
[$opposeMagic, $damage] = $opposeEnv['magic'];
|
||||
|
||||
|
||||
|
||||
$josaUl = \sammo\JosaUtil::pick($opposeMagic, '을');
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use sammo\Util;
|
||||
use sammo\ObjectTrigger;
|
||||
|
||||
class che_방어력증가5p extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_FINAL; //최후미
|
||||
protected $priority = ObjectTrigger::PRIORITY_FINAL + 200; //최후미
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
if(!$self->isAttacker()){
|
||||
|
||||
@@ -8,7 +8,7 @@ use sammo\GameUnitDetail;
|
||||
use sammo\ObjectTrigger;
|
||||
|
||||
class che_성벽부상무효 extends BaseWarUnitTrigger{
|
||||
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 100;
|
||||
protected $priority = ObjectTrigger::PRIORITY_BEGIN + 150;
|
||||
|
||||
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv):bool{
|
||||
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user