forked from devsam/core
Compare commits
33
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2e578e485 | ||
|
|
bb26366769
|
||
|
|
71849a457b
|
||
|
|
7c1a8d96a2
|
||
|
|
cebd152daf
|
||
|
|
2ca03389d2
|
||
|
|
cacf0981ce
|
||
|
|
bcf5b5cb7d
|
||
|
|
66b2f1a8f2
|
||
|
|
40ecca5440
|
||
|
|
a96c2312d0
|
||
|
|
faff3f4e6a | ||
|
|
83abf44380
|
||
|
|
e83960d67f
|
||
|
|
c6b2e64c05
|
||
|
|
029f719112 | ||
|
|
46f460c8ad | ||
|
|
af4401d9bb | ||
|
|
2f00aee947 | ||
|
|
dd2b032fa3 | ||
|
|
1b858ae36c
|
||
|
|
69f4d8e2c7 | ||
|
|
f24aea0120 | ||
|
|
f6dc7f49e2 | ||
|
|
c1f105226f
|
||
|
|
cecab2b0cf
|
||
|
|
39f4e89b03
|
||
|
|
83f595a27a
|
||
|
|
b0db11544d
|
||
|
|
8e3551cb11
|
||
|
|
61d99a3043
|
||
|
|
fe80deff0c | ||
|
|
c5ed2d47fc |
+2
-2
@@ -1054,10 +1054,10 @@ function increaseRefresh($type = "", $cnt = 1)
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => "refresh",
|
||||
'arg' => JSON::encode([
|
||||
'arg' => Json::encode([
|
||||
'type' => $type,
|
||||
]),
|
||||
'aux' => JSON::encode([
|
||||
'aux' => Json::encode([
|
||||
'generalID' => $generalID,
|
||||
'generalName' => $session->generalName,
|
||||
'userName' => $session->userName,
|
||||
|
||||
@@ -213,7 +213,7 @@ function _setGeneralCommand(GeneralCommand $command, array $turnList):void {
|
||||
|
||||
$db->update('general_turn', [
|
||||
'action'=>$commandName,
|
||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
||||
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||
'brief'=>$brief
|
||||
], 'general_id = %i AND turn_idx IN %li', $generalID, $turnList);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ function _setNationCommand(NationCommand $command, array $turnList):void {
|
||||
|
||||
$db->update('nation_turn', [
|
||||
'action'=>$commandName,
|
||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
||||
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||
'brief'=>$brief
|
||||
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
||||
}
|
||||
|
||||
+15
-4
@@ -899,7 +899,7 @@ function checkEmperior()
|
||||
'tiger' => $tigerstr,
|
||||
'eagle' => $eaglestr,
|
||||
'gen' => $gen,
|
||||
'history' => JSON::encode($nationHistory),
|
||||
'history' => Json::encode($nationHistory),
|
||||
'aux' => $statGeneral['aux']
|
||||
]);
|
||||
|
||||
@@ -951,8 +951,19 @@ function updateMaxDomesticCritical(General $general, $score)
|
||||
}
|
||||
}
|
||||
|
||||
function genGenericUniqueRNG(int $year, int $month, int $generalID): RandUtil
|
||||
function genGenericUniqueRNG(int $year, int $month, int $generalID, ?string $reason = null): RandUtil
|
||||
{
|
||||
if($reason){
|
||||
return new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'unique',
|
||||
$year,
|
||||
$month,
|
||||
$generalID,
|
||||
$reason
|
||||
)));
|
||||
}
|
||||
|
||||
return new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'unique',
|
||||
@@ -962,7 +973,7 @@ function genGenericUniqueRNG(int $year, int $month, int $generalID): RandUtil
|
||||
)));
|
||||
}
|
||||
|
||||
function genGenericUniqueRNGFromGeneral(General $general): RandUtil
|
||||
function genGenericUniqueRNGFromGeneral(General $general, string $reason): RandUtil
|
||||
{
|
||||
$logger = $general->getLogger();
|
||||
if (!$logger) {
|
||||
@@ -971,5 +982,5 @@ function genGenericUniqueRNGFromGeneral(General $general): RandUtil
|
||||
$year = $logger->getYear();
|
||||
$month = $logger->getMonth();
|
||||
$generalID = $general->getID();
|
||||
return genGenericUniqueRNG($year, $month, $generalID);
|
||||
return genGenericUniqueRNG($year, $month, $generalID, $reason);
|
||||
}
|
||||
|
||||
@@ -148,63 +148,6 @@ function allButton(bool $seizeNPCMode, array $opts = [])
|
||||
], $opts));
|
||||
}
|
||||
|
||||
|
||||
function commandButton(array $opts = [])
|
||||
{
|
||||
$session = Session::getInstance();
|
||||
$userID = Session::getUserID();
|
||||
if (!$session->isGameLoggedIn()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow("select no,nation,officer_level,belong,permission,penalty from general where owner=%i", $userID);
|
||||
|
||||
$nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i", $me['nation']) ?? [
|
||||
'nation' => 0,
|
||||
'level' => 0,
|
||||
'secretlimit' => 99,
|
||||
'color' => '#000000'
|
||||
];
|
||||
|
||||
$bgColor = $nation['color'] ?? '#000000';
|
||||
$fgColor = newColor($bgColor);
|
||||
|
||||
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
$showSecret = false;
|
||||
$permission = checkSecretPermission($me);
|
||||
$btnClassForTournament = $opts['btnClass'];
|
||||
if ($opts['isTournamentApplicationOpen']) {
|
||||
if ($btnClassForTournament != 'dropdown-item') {
|
||||
$btnClassForTournament = 'toolbarButton2';
|
||||
}
|
||||
}
|
||||
|
||||
$btnClassForBetting = $opts['btnClass'];
|
||||
if ($opts['isBettingActive']) {
|
||||
if ($btnClassForTournament != 'dropdown-item') {
|
||||
$btnClassForBetting = 'toolbarButton2';
|
||||
}
|
||||
}
|
||||
|
||||
if ($permission >= 1) {
|
||||
$showSecret = true;
|
||||
} else if ($me['officer_level'] == 0) {
|
||||
$showSecret = false;
|
||||
}
|
||||
|
||||
return $templates->render('commandButton', array_merge([
|
||||
'bgColor' => $bgColor,
|
||||
'fgColor' => $fgColor,
|
||||
'meLevel' => $me['officer_level'],
|
||||
'nationLevel' => $nation['level'],
|
||||
'showSecret' => $showSecret,
|
||||
'permission' => $permission,
|
||||
'btnClassForTournament' => $btnClassForTournament,
|
||||
'btnClassForBetting' => $btnClassForBetting,
|
||||
], $opts));
|
||||
}
|
||||
|
||||
function formatWounded(int $value, int $wound): string
|
||||
{
|
||||
if ($wound == 0) {
|
||||
|
||||
@@ -27,14 +27,18 @@ $rootDB = RootDB::db();
|
||||
$oNow = new \DateTimeImmutable();
|
||||
$now = $oNow->format('Y-m-d H:i:s');
|
||||
|
||||
$userNick = RootDB::db()->queryFirstField('SELECT `NAME` FROM member WHERE `NO`=%i',$userID);
|
||||
if(!$userNick){
|
||||
$member = $rootDB->queryFirstRow('SELECT `name`, `penalty` FROM member WHERE `NO`=%i', $userID);
|
||||
if(!$member){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'멤버 정보를 가져오지 못했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$userNick = $member['name'];
|
||||
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
|
||||
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
||||
|
||||
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
|
||||
if(!$pickResult){
|
||||
Json::die([
|
||||
@@ -86,7 +90,8 @@ $db->update('general', [
|
||||
'defence_train'=>80,
|
||||
'permission'=>'normal',
|
||||
'owner'=>$userID,
|
||||
'aux'=>Json::encode($genAux)
|
||||
'aux'=>Json::encode($genAux),
|
||||
'penalty'=>Json::encode($penalty),
|
||||
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
|
||||
$db->insertIgnore('general_access_log', [
|
||||
GeneralAccessLogColumn::generalID->value => $pick,
|
||||
|
||||
@@ -285,19 +285,6 @@ if ($lastVoteID) {
|
||||
<div id="general-position"><?php generalInfo($generalObj); ?></div>
|
||||
<div id="generalCommandButton" class="row gx-0">
|
||||
<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>
|
||||
@@ -398,18 +385,6 @@ if ($lastVoteID) {
|
||||
국가 메뉴
|
||||
</div>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
|
||||
<?= 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">
|
||||
|
||||
@@ -6,6 +6,7 @@ use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\GameConst;
|
||||
use sammo\Json;
|
||||
use sammo\KVStorage;
|
||||
use sammo\TimeUtil;
|
||||
@@ -32,8 +33,18 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$generalID = $session->generalID;
|
||||
|
||||
$invalidTurnList = 0;
|
||||
|
||||
$rawTurn = $db->queryAllLists('SELECT turn_idx, action, arg, brief FROM general_turn WHERE general_id = %i ORDER BY turn_idx ASC', $generalID);
|
||||
foreach ($rawTurn as [$turn_idx, $action, $arg, $brief]) {
|
||||
if($turn_idx < 0) {
|
||||
$invalidTurnList = -1;
|
||||
$turn_idx += GameConst::$maxTurn;
|
||||
}
|
||||
else if($turn_idx >= GameConst::$maxTurn) {
|
||||
$invalidTurnList = 1;
|
||||
$turn_idx -= GameConst::$maxTurn;
|
||||
}
|
||||
$commandList[$turn_idx] = [
|
||||
'action' => $action,
|
||||
'brief' => $brief,
|
||||
@@ -41,6 +52,19 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
];
|
||||
}
|
||||
|
||||
if($invalidTurnList != 0){
|
||||
if($invalidTurnList > 0){
|
||||
$db->update('general_turn', [
|
||||
'turn_idx' => $db->sqleval('turn_idx - %i', GameConst::$maxTurn)
|
||||
], 'general_id=%i AND turn_idx >= %i', $generalID, GameConst::$maxTurn);
|
||||
}
|
||||
else{
|
||||
$db->update('general_turn', [
|
||||
'turn_idx' => $db->sqleval('turn_idx + %i', GameConst::$maxTurn)
|
||||
], 'general_id=%i AND turn_idx < 0', $generalID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[$turnTerm, $year, $month, $lastExecute] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month', 'turntime']);
|
||||
|
||||
|
||||
@@ -90,6 +90,9 @@ class BuildNationCandidate extends \sammo\BaseAPI
|
||||
return '거병을 실패했습니다.';
|
||||
}
|
||||
|
||||
$generalObj->setVar('killturn', $env['killturn']);
|
||||
$generalObj->applyDB($db);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class Join extends \sammo\BaseAPI
|
||||
'leadership',
|
||||
'strength',
|
||||
'intel',
|
||||
'inheritTurntime',
|
||||
'inheritTurntimeZone',
|
||||
])
|
||||
->rule('boolean', [
|
||||
'pic'
|
||||
@@ -72,7 +72,8 @@ class Join extends \sammo\BaseAPI
|
||||
], GameConst::$defaultStatMax)
|
||||
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']))
|
||||
->rule('in', 'inheritSpecial', GameConst::$availableSpecialWar)
|
||||
->rule('min', 'inheritTurntime', 0)
|
||||
->rule('min', 'inheritTurntimeZone', 0)
|
||||
->rule('max', 'inheritTurntimeZone', 59)
|
||||
->rule('in', 'inheritCity', array_keys(CityConst::all()))
|
||||
->rule('integerArray', 'inheritBonusStat');
|
||||
|
||||
@@ -139,22 +140,21 @@ class Join extends \sammo\BaseAPI
|
||||
$intel = $this->args['intel'];
|
||||
|
||||
$inheritSpecial = $this->args['inheritSpecial'] ?? null;
|
||||
$inheritTurntime = $this->args['inheritTurntime'] ?? null;
|
||||
$inheritTurntimeZone = $this->args['inheritTurntimeZone'] ?? null;
|
||||
$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);
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr, `penalty` FROM member WHERE no=%i', $userID);
|
||||
|
||||
if (!$member) {
|
||||
return "잘못된 접근입니다!!!";
|
||||
}
|
||||
|
||||
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
|
||||
$penalty = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'block_general_create', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
||||
@@ -232,7 +232,7 @@ class Join extends \sammo\BaseAPI
|
||||
if ($inheritSpecial !== null) {
|
||||
$inheritRequiredPoint += GameConst::$inheritBornSpecialPoint;
|
||||
}
|
||||
if ($inheritTurntime !== null) {
|
||||
if ($inheritTurntimeZone !== null) {
|
||||
$inheritRequiredPoint += GameConst::$inheritBornTurntimePoint;
|
||||
}
|
||||
|
||||
@@ -347,12 +347,14 @@ class Join extends \sammo\BaseAPI
|
||||
$experience *= 0.8;
|
||||
}
|
||||
|
||||
if ($inheritTurntime !== null) {
|
||||
$inheritTurntime = $inheritTurntime % ($admin['turnterm'] * 60);
|
||||
if ($inheritTurntimeZone !== null) {
|
||||
$inheritTurntime = $inheritTurntimeZone * $admin['turnterm'];
|
||||
$inheritTurntime += $rng->nextRangeInt(0, Util::clamp($admin['turnterm'] - 1, 0));
|
||||
|
||||
$userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime % 60), "inheritPoint");
|
||||
|
||||
$inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000;
|
||||
|
||||
$turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm']));
|
||||
$turntime = $turntime->add(TimeUtil::secondsToDateInterval($inheritTurntime));
|
||||
$turntime = TimeUtil::format($turntime, true);
|
||||
@@ -424,7 +426,8 @@ class Join extends \sammo\BaseAPI
|
||||
'specage' => $specage,
|
||||
'special' => $special,
|
||||
'specage2' => $specage2,
|
||||
'special2' => $special2
|
||||
'special2' => $special2,
|
||||
'penalty' => Json::encode($penalty),
|
||||
]);
|
||||
$generalID = $db->insertId();
|
||||
$db->insert('general_access_log', [
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\API\InheritAction;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\RankColumn;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\KVStorage;
|
||||
use sammo\LiteHashDRBG;
|
||||
use sammo\RandUtil;
|
||||
use sammo\TimeUtil;
|
||||
use sammo\UniqueConst;
|
||||
use sammo\UserLogger;
|
||||
use sammo\Util;
|
||||
|
||||
class CalcResetTurnTimeRange extends \sammo\BaseAPI
|
||||
{
|
||||
public function validateArgs(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getRequiredSessionMode(): int
|
||||
{
|
||||
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
|
||||
}
|
||||
|
||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag): null | string | array | APIRecoveryType
|
||||
{
|
||||
$userID = $session->userID;
|
||||
$generalID = $session->generalID;
|
||||
|
||||
$general = General::createObjFromDB($generalID);
|
||||
if ($userID != $general->getVar('owner')) {
|
||||
return '로그인 상태가 이상합니다. 다시 로그인해 주세요.';
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$turnTerm, $serverTurnTime] = $gameStor->getValuesAsArray(['turnterm', 'turntime']);
|
||||
|
||||
$currTurnTime = new DateTimeImmutable($general->getTurnTime());
|
||||
$serverTurnTimeObj = new DateTimeImmutable($serverTurnTime);
|
||||
|
||||
$minTurnTime = $currTurnTime->add(TimeUtil::secondsToDateInterval($turnTerm * -30));
|
||||
$maxTurnTime = $currTurnTime->add(TimeUtil::secondsToDateInterval($turnTerm * 30));
|
||||
|
||||
$timeDiff = $serverTurnTimeObj->diff($minTurnTime);
|
||||
$timeDiffSec = TimeUtil::DateIntervalToSeconds($timeDiff);
|
||||
if($timeDiffSec > 0){
|
||||
$minTurnTime = $minTurnTime->add(TimeUtil::secondsToDateInterval($timeDiffSec));
|
||||
$maxTurnTime = $maxTurnTime->add(TimeUtil::secondsToDateInterval($timeDiffSec));
|
||||
}
|
||||
|
||||
return [
|
||||
'result' => true,
|
||||
'timeDiffSec' => $timeDiffSec,
|
||||
'minTurnTime' => TimeUtil::format($minTurnTime, false),
|
||||
'maxTurnTime' => TimeUtil::format($maxTurnTime, false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ class ResetTurnTime extends \sammo\BaseAPI
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
if($gameStor->isunited){
|
||||
if ($gameStor->isunited) {
|
||||
return '이미 천하가 통일되었습니다.';
|
||||
}
|
||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
||||
@@ -62,36 +62,25 @@ class ResetTurnTime extends \sammo\BaseAPI
|
||||
}
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$turnTerm, $serverTurnTime] = $gameStor->getValuesAsArray(['turnterm', 'turntime']);
|
||||
$turnTerm = $gameStor->getValue('turnterm');
|
||||
|
||||
$currTurnTime = new DateTimeImmutable($general->getTurnTime());
|
||||
$serverTurnTimeObj = new DateTimeImmutable($serverTurnTime);
|
||||
|
||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'ResetTurnTime',
|
||||
$userID,
|
||||
$general->getTurnTime()
|
||||
$general->getAuxVar('nextTurnTimeBase') ?? $general->getTurnTime()
|
||||
)));
|
||||
|
||||
$afterTurn = $rng->nextRange($turnTerm * -60 / 2, $turnTerm * 60 / 2);
|
||||
$afterTurn = $rng->nextFloat1() * $turnTerm * 60;
|
||||
|
||||
$userLogger = new UserLogger($userID);
|
||||
if($afterTurn >= 0){
|
||||
$userLogger->push(sprintf("{$reqPoint} 포인트로 턴 시간을 바꾼 결과 %02d:%02d 뒤로 밀림", intdiv(Util::toInt($afterTurn), 60), $afterTurn%60), "inheritPoint");
|
||||
}
|
||||
else{
|
||||
$userLogger->push(sprintf("{$reqPoint} 포인트로 턴 시간을 바꾼 결과 %02d:%02d 앞으로 당김", intdiv(Util::toInt(-$afterTurn), 60), (-$afterTurn)%60), "inheritPoint");
|
||||
}
|
||||
$userLogger->push(sprintf("{$reqPoint} 포인트로 턴 시간을 바꾸어 다다음 턴부터 %02d:%02d 적용", intdiv(Util::toInt($afterTurn), 60), $afterTurn % 60), "inheritPoint");
|
||||
$userLogger->flush();
|
||||
|
||||
$turnTime = $currTurnTime->add(TimeUtil::secondsToDateInterval($afterTurn));
|
||||
if ($turnTime <= $serverTurnTimeObj && $serverTurnTimeObj <= $currTurnTime) {
|
||||
$turnTime = $turnTime->add(TimeUtil::secondsToDateInterval($turnTerm * 60));
|
||||
}
|
||||
|
||||
$general->setVar('turntime', TimeUtil::format($turnTime, true));
|
||||
$general->setAuxVar('inheritResetTurnTime', $nextLevel);
|
||||
$general->setAuxVar('nextTurnTimeBase', $afterTurn);
|
||||
$inheritStor->setValue('previous', [$previousPoint - $reqPoint, null]);
|
||||
$general->increaseRankVar(RankColumn::inherit_point_spent_dynamic, $reqPoint);
|
||||
$general->applyDB($db);
|
||||
|
||||
@@ -7,9 +7,11 @@ use DateTimeInterface;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\MessageType;
|
||||
use sammo\Json;
|
||||
use sammo\Message;
|
||||
use sammo\MessageTarget;
|
||||
use sammo\Validator;
|
||||
use sammo\Util;
|
||||
|
||||
use function sammo\checkLimit;
|
||||
use function sammo\checkSecretPermission;
|
||||
@@ -170,6 +172,8 @@ class SendMessage extends \sammo\BaseAPI
|
||||
return '장수가 없습니다.';
|
||||
}
|
||||
|
||||
$penalty = Json::decode($me['penalty'] ?? '{}');
|
||||
|
||||
$limitState = checkLimit($me['refresh_score']);
|
||||
if ($limitState >= 2) {
|
||||
return '접속 제한입니다.';
|
||||
@@ -226,8 +230,10 @@ class SendMessage extends \sammo\BaseAPI
|
||||
$now = new \DateTime();
|
||||
$lastMsg = new \DateTime($session->lastMsg ?? '0000-00-00');
|
||||
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
|
||||
if ($msg_interval < 2) {
|
||||
return '개인메세지는 2초당 1건만 보낼 수 있습니다!';
|
||||
|
||||
$msg_min_interval = $penalty['sendPrivateMsgDelay'] ?? 2;
|
||||
if ($msg_interval < $msg_min_interval) {
|
||||
return "개인메세지는 {$msg_min_interval}초당 1건만 보낼 수 있습니다!";
|
||||
}
|
||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ class GeneralList extends \sammo\BaseAPI
|
||||
foreach ($rawGeneralList as $rawGeneral) {
|
||||
//General 생성?
|
||||
if (key_exists('aux', $rawGeneral)) {
|
||||
$rawGeneral['aux'] = \sammo\JSON::decode($rawGeneral['aux']);
|
||||
$rawGeneral['aux'] = \sammo\Json::decode($rawGeneral['aux']);
|
||||
}
|
||||
|
||||
$item = [];
|
||||
|
||||
@@ -73,6 +73,11 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
}
|
||||
|
||||
$nationTurnList = [];
|
||||
|
||||
//혹시 정규 턴을 벗어난 턴이 있는지 체크
|
||||
$invalidUnderTurnList = [];
|
||||
$invalidOverTurnList = [];
|
||||
|
||||
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']
|
||||
@@ -80,6 +85,14 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
if (!key_exists($officer_level, $nationTurnList)) {
|
||||
$nationTurnList[$officer_level] = [];
|
||||
}
|
||||
if($turn_idx < 0){
|
||||
$invalidUnderTurnList[$officer_level] = $turn_idx;
|
||||
$turn_idx += GameConst::$maxChiefTurn;
|
||||
}
|
||||
else if($turn_idx >= GameConst::$maxChiefTurn){
|
||||
$invalidOverTurnList[$officer_level] = $turn_idx;
|
||||
$turn_idx -= GameConst::$maxChiefTurn;
|
||||
}
|
||||
$nationTurnList[$officer_level][$turn_idx] = [
|
||||
'action' => $action,
|
||||
'brief' => $brief,
|
||||
@@ -87,6 +100,21 @@ class GetReservedCommand extends \sammo\BaseAPI
|
||||
];
|
||||
}
|
||||
|
||||
if($invalidUnderTurnList){
|
||||
$db->update(
|
||||
'nation_turn', [
|
||||
'turn_idx' => $db->sqleval('`turn_idx` + %i', GameConst::$maxChiefTurn)
|
||||
], 'nation_id = %i AND officer_level IN %li AND turn_idx < 0', $me['nation'], array_keys($invalidUnderTurnList)
|
||||
);
|
||||
}
|
||||
if($invalidOverTurnList){
|
||||
$db->update(
|
||||
'nation_turn', [
|
||||
'turn_idx' => $db->sqleval('`turn_idx` - %i', GameConst::$maxChiefTurn)
|
||||
], 'nation_id = %i AND officer_level IN %li AND turn_idx >= %i', $me['nation'], array_keys($invalidOverTurnList), GameConst::$maxChiefTurn
|
||||
);
|
||||
}
|
||||
|
||||
$troopList = [];
|
||||
foreach ($db->queryAllLists(
|
||||
'SELECT troop_leader, `name` FROM troop WHERE `nation` = %i',
|
||||
|
||||
@@ -9,7 +9,7 @@ class che_오두미도 extends \sammo\BaseNation{
|
||||
protected $name = '오두미도';
|
||||
protected $info = '';
|
||||
static $pros = '쌀수입↑ 인구↑';
|
||||
static $cons = '기술↓ 수성↓ 내정↓';
|
||||
static $cons = '기술↓ 수성↓ 농상↓';
|
||||
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
@@ -40,4 +40,4 @@ class che_오두미도 extends \sammo\BaseNation{
|
||||
return $amount;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class che_유가 extends \sammo\BaseNation{
|
||||
|
||||
protected $name = '유가';
|
||||
protected $info = '';
|
||||
static $pros = '내정↑ 민심↑';
|
||||
static $pros = '농상↑ 민심↑';
|
||||
static $cons = '쌀수입↓';
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
@@ -31,4 +31,4 @@ class che_유가 extends \sammo\BaseNation{
|
||||
|
||||
return $amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class che_음양가 extends \sammo\BaseNation{
|
||||
|
||||
protected $name = '음양가';
|
||||
protected $info = '';
|
||||
static $pros = '내정↑ 인구↑';
|
||||
static $pros = '농상↑ 인구↑';
|
||||
static $cons = '기술↓ 전략↓';
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
@@ -29,14 +29,14 @@ class che_음양가 extends \sammo\BaseNation{
|
||||
if($type == 'pop' && $amount > 0){
|
||||
return $amount * 1.2;
|
||||
}
|
||||
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||
if($varType == 'delay'){
|
||||
return $value * 2;
|
||||
return Util::round($value * 4 / 3);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class che_종횡가 extends \sammo\BaseNation{
|
||||
protected $name = '종횡가';
|
||||
protected $info = '';
|
||||
static $pros = '전략↑ 수성↑';
|
||||
static $cons = '금수입↓ 내정↓';
|
||||
static $cons = '금수입↓ 농상↓';
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
if($turnType == '수비' || $turnType == '성벽'){
|
||||
@@ -42,4 +42,4 @@ class che_종횡가 extends \sammo\BaseNation{
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class che_강행 extends Command\GeneralCommand
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ class che_거병 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ class che_건국 extends Command\GeneralCommand
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -112,7 +112,7 @@ class che_견문 extends Command\GeneralCommand{
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class che_귀환 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class che_기술연구 extends che_상업투자{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -126,7 +126,7 @@ class che_단련 extends Command\GeneralCommand{
|
||||
$general->increaseVar($incStat, 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -169,7 +169,7 @@ class che_등용 extends Command\GeneralCommand
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ class che_랜덤임관 extends Command\GeneralCommand
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '랜덤 임관');
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '랜덤 임관');
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -216,7 +216,7 @@ class che_무작위건국 extends Command\GeneralCommand
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -148,7 +148,7 @@ class che_물자조달 extends Command\GeneralCommand{
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ class che_사기진작 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -218,7 +218,7 @@ class che_상업투자 extends Command\GeneralCommand{
|
||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -179,7 +179,7 @@ class che_숙련전환 extends Command\GeneralCommand
|
||||
$general->increaseVar('leadership_exp', 2);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -75,7 +75,7 @@ class che_은퇴 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralActionLog("은퇴하였습니다. <1>$date</>");
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -164,7 +164,7 @@ class che_이동 extends Command\GeneralCommand
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ class che_인재탐색 extends Command\GeneralCommand
|
||||
$general->increaseVar($incStat, 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
return true;
|
||||
}
|
||||
@@ -218,7 +218,7 @@ class che_인재탐색 extends Command\GeneralCommand
|
||||
$general->increaseVar($incStat, 3);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class che_임관 extends Command\GeneralCommand
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -196,7 +196,7 @@ class che_장비매매 extends Command\GeneralCommand
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -170,7 +170,7 @@ class che_장수대상임관 extends Command\GeneralCommand{
|
||||
$general->addExperience($exp);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -121,7 +121,7 @@ class che_전투태세 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 3);
|
||||
$this->setResultTurn($turnResult);
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -103,7 +103,7 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date</>");
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -188,7 +188,7 @@ class che_정착장려 extends Command\GeneralCommand{
|
||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -188,7 +188,7 @@ class che_주민선정 extends Command\GeneralCommand{
|
||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -170,7 +170,7 @@ class che_증여 extends Command\GeneralCommand
|
||||
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
|
||||
$general->applyDB($db);
|
||||
$destGeneral->applyDB($db);
|
||||
|
||||
@@ -103,7 +103,7 @@ class che_집합 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -227,7 +227,7 @@ class che_징병 extends Command\GeneralCommand
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
$general->setAuxVar('armType', $reqCrewType->armType);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -253,7 +253,7 @@ class che_출병 extends Command\GeneralCommand
|
||||
|
||||
processWar($warRngSeed, $general, $this->nation, $this->destCity);
|
||||
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -30,11 +30,8 @@ class che_하야 extends Command\GeneralCommand{
|
||||
|
||||
$this->setNation();
|
||||
|
||||
$relYear = $env['year'] - $env['startyear'];
|
||||
|
||||
$this->fullConditionConstraints=[
|
||||
ConstraintHelper::NotBeNeutral(),
|
||||
ConstraintHelper::NotOpeningPart($relYear),
|
||||
ConstraintHelper::NotLord(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ class che_헌납 extends Command\GeneralCommand
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -107,7 +107,7 @@ class che_훈련 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -201,7 +201,7 @@ class cr_건국 extends Command\GeneralCommand
|
||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -105,7 +105,7 @@ class cr_맹훈련 extends Command\GeneralCommand{
|
||||
$general->increaseVar('leadership_exp', 1);
|
||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
$general->checkStatChange();
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||
$general->applyDB($db);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -164,9 +164,7 @@ class che_이호경식 extends Command\NationCommand
|
||||
$nationGeneralLogger->flush();
|
||||
}
|
||||
|
||||
$josaYiCommand = JosaUtil::pick($commandName, '이');
|
||||
|
||||
$broadcastMessage = "아국에 <M>{$commandName}</>{$josaYiCommand} 발동되었습니다.";
|
||||
$broadcastMessage = "<D><b>{$nationName}</b></>{$josaYiNation} 아국에 <M>{$commandName}</>{$josaUl} 발동하였습니다.";
|
||||
|
||||
$destNationGeneralList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i', $destNationID);
|
||||
foreach ($destNationGeneralList as $destNationGeneralID) {
|
||||
|
||||
@@ -179,10 +179,13 @@ class che_종전수락 extends Command\NationCommand
|
||||
$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>종전 합의</> 하였습니다.");
|
||||
|
||||
$josaWa = JosaUtil::pick($destNationName, '와');
|
||||
$logger->pushNationalHistoryLog("<D><b>{$destNationName}</b></>{$josaWa} 종전");
|
||||
|
||||
$josaWa = JosaUtil::pick($nationName, '와');
|
||||
$destLogger->pushGeneralActionLog("<D><b>{$nationName}</b></>{$josaWa} 종전에 성공했습니다.", ActionLogger::PLAIN);
|
||||
$destLogger->pushGeneralHistoryLog("<D><b>{$nationName}</b></>{$josaWa} 종전 성공");
|
||||
$destLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaWa} 종전");
|
||||
|
||||
$general->applyDB($db);
|
||||
$destLogger->flush();
|
||||
|
||||
@@ -35,6 +35,12 @@ class HasRouteWithEnemy extends Constraint{
|
||||
$allowedNationList[] = $this->general['nation'];
|
||||
$allowedNationList[] = 0;
|
||||
|
||||
$destCityNation = $db->queryFirstField('SELECT nation FROM city WHERE city = %i', $this->destCity['city']);
|
||||
if($destCityNation !== 0 && $destCityNation !== $this->general['nation'] && !in_array($destCityNation, $allowedNationList)){
|
||||
$this->reason = "교전중인 국가가 아닙니다.";
|
||||
return false;
|
||||
}
|
||||
|
||||
$distanceList = \sammo\searchDistanceListToDest($this->general['city'], $this->destCity['city'], $allowedNationList);
|
||||
if(!$distanceList){
|
||||
$this->reason = "경로에 도달할 방법이 없습니다.";
|
||||
|
||||
@@ -67,7 +67,7 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
|
||||
foreach ($db->queryAllLists('SELECT capital, nation from nation WHERE capital in %li', $cities) as $row) {
|
||||
[$oldCapital, $nation] = $row;
|
||||
$capitalCandidates = $db->queryFirstColumn('SELECT from city WHERE nation = %i AND city != %i', $nation);
|
||||
$capitalCandidates = $db->queryFirstColumn('SELECT from city WHERE nation = %i AND city != %i', $nation, $oldCapital);
|
||||
if (!$capitalCandidates) {
|
||||
$disabledInvaderCity->add($oldCapital);
|
||||
continue;
|
||||
|
||||
@@ -216,7 +216,7 @@ class GameConstBase
|
||||
|
||||
public static $minMonthToAllowInheritItem = 4;
|
||||
public static $inheritBornSpecialPoint = 6000;
|
||||
public static $inheritBornTurntimePoint = 3000;
|
||||
public static $inheritBornTurntimePoint = 2500;
|
||||
public static $inheritBornCityPoint = 1000;
|
||||
public static $inheritBornStatPoint = 1000;
|
||||
public static $inheritItemUniqueMinPoint = 5000;
|
||||
@@ -318,7 +318,6 @@ class GameConstBase
|
||||
'che_치안강화',
|
||||
'che_정착장려',
|
||||
'che_주민선정',
|
||||
'che_물자조달',
|
||||
],
|
||||
'군사' => [
|
||||
'che_징병',
|
||||
@@ -349,6 +348,7 @@ class GameConstBase
|
||||
'국가' => [
|
||||
'che_증여',
|
||||
'che_헌납',
|
||||
'che_물자조달',
|
||||
'che_하야',
|
||||
'che_거병',
|
||||
'che_건국',
|
||||
|
||||
@@ -365,14 +365,14 @@ class General extends GeneralBase implements iAction
|
||||
}
|
||||
}
|
||||
|
||||
$this->calcCache[$cKey] = $statValue;
|
||||
|
||||
$statValue = Util::clamp($statValue, 0, GameConst::$maxLevel);
|
||||
|
||||
if ($useFloor) {
|
||||
return Util::toInt($statValue);
|
||||
}
|
||||
|
||||
$this->calcCache[$cKey] = $statValue;
|
||||
|
||||
return $statValue;
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ class General extends GeneralBase implements iAction
|
||||
continue;
|
||||
}
|
||||
/** @var iAction $iObj */
|
||||
$value = $iObj->onCalcStat($this, $statName, $value, $aux);
|
||||
$value = $iObj->onCalcStat($general, $statName, $value, $aux);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
@@ -819,7 +819,7 @@ class General extends GeneralBase implements iAction
|
||||
continue;
|
||||
}
|
||||
/** @var iAction $iObj */
|
||||
$value = $iObj->onCalcOpposeStat($this, $statName, $value, $aux);
|
||||
$value = $iObj->onCalcOpposeStat($general, $statName, $value, $aux);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
+35
-20
@@ -82,8 +82,9 @@ class GeneralAI
|
||||
const d직전 = 3;
|
||||
const d전쟁 = 4;
|
||||
|
||||
protected function updateInstance(): void{
|
||||
if(!$this->reqUpdateInstance){
|
||||
protected function updateInstance(): void
|
||||
{
|
||||
if (!$this->reqUpdateInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,11 +216,10 @@ class GeneralAI
|
||||
);
|
||||
|
||||
if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
||||
if(!$warTarget){
|
||||
if (!$warTarget) {
|
||||
$this->dipState = self::d평화;
|
||||
$this->attackable = false;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$this->dipState = self::d선포;
|
||||
$this->attackable = false;
|
||||
}
|
||||
@@ -2992,7 +2992,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
foreach ($this->frontCities as $frontCity) {
|
||||
if(!$frontCity['supply']){
|
||||
if (!$frontCity['supply']) {
|
||||
continue;
|
||||
}
|
||||
$candidateCities[$frontCity['city']] = $frontCity['important'];
|
||||
@@ -3120,6 +3120,11 @@ class GeneralAI
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$dupLord = $db->queryFirstField('SELECT COUNT(*) FROM general WHERE officer_level = 12 AND city = %i', $this->general->getCityID());
|
||||
if($dupLord <= 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$general = $this->general;
|
||||
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0');
|
||||
$nationCities = $db->queryFirstColumn('SELECT city FROM city WHERE nation != 0');
|
||||
@@ -3352,10 +3357,9 @@ class GeneralAI
|
||||
if ($this->rng->nextBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
//임관 기간이 끝나면 고정 확률로 낮춤 0.3 * 0.5 = 0.15
|
||||
if ($this->rng->nextBool()){
|
||||
if ($this->rng->nextBool()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -3439,8 +3443,12 @@ class GeneralAI
|
||||
|
||||
$cmd = buildGeneralCommandClass($this->rng->choice($candidate), $this->general, $this->env);
|
||||
if (!$cmd->hasFullConditionMet()) {
|
||||
return buildGeneralCommandClass('che_물자조달', $this->general, $this->env);
|
||||
$cmd = buildGeneralCommandClass('che_물자조달', $this->general, $this->env);
|
||||
if (!$cmd->hasFullConditionMet()) {
|
||||
$cmd = buildGeneralCommandClass('che_견문', $this->general, $this->env);
|
||||
}
|
||||
}
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
@@ -3477,7 +3485,7 @@ class GeneralAI
|
||||
}
|
||||
if ($nationCity['front']) {
|
||||
$frontCities[$cityID] = $nationCity;
|
||||
} else if($nationCity['supply']) {
|
||||
} else if ($nationCity['supply']) {
|
||||
$backupCities[$cityID] = $nationCity;
|
||||
}
|
||||
|
||||
@@ -3779,21 +3787,28 @@ class GeneralAI
|
||||
|
||||
if ($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']) {
|
||||
//방랑군 건국
|
||||
$result = $this->do건국();
|
||||
if ($result !== null) {
|
||||
$result->reason = 'do건국';
|
||||
return $result;
|
||||
$relYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']) - Util::joinYearMonth($this->env['init_year'], $this->env['init_month']);
|
||||
|
||||
if ($relYearMonth > 1) {
|
||||
$result = $this->do건국();
|
||||
if ($result !== null) {
|
||||
$result->reason = 'do건국';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $this->do방랑군이동();
|
||||
if ($result !== null) {
|
||||
$result->reason = 'do방랑군이동';
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = $this->do해산();
|
||||
if ($result !== null) {
|
||||
$result->reason = 'do해산';
|
||||
return $result;
|
||||
if ($relYearMonth > 1) {
|
||||
$result = $this->do해산();
|
||||
if ($result !== null) {
|
||||
$result->reason = 'do해산';
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4035,7 +4050,7 @@ class GeneralAI
|
||||
if (!key_exists($chiefLevel, $this->chiefGenerals) && !key_exists($chiefLevel, $nextChiefs)) {
|
||||
$newChiefProb = 1;
|
||||
} else {
|
||||
$newChiefProb = $this->rng->nextBool(0.1)?1:0;
|
||||
$newChiefProb = $this->rng->nextBool(0.1) ? 1 : 0;
|
||||
}
|
||||
|
||||
if ($newChiefProb < 1 && !$this->rng->nextBool($newChiefProb)) {
|
||||
|
||||
@@ -216,6 +216,16 @@ class TurnExecutionHelper
|
||||
}
|
||||
|
||||
$turntime = addTurn($general->getTurnTime(), $gameStor->turnterm);
|
||||
|
||||
$nextTurnTimeBase = $general->getAuxVar('nextTurnTimeBase');
|
||||
if($nextTurnTimeBase !== null){
|
||||
$turntime = cutTurn($turntime, $gameStor->turnterm);
|
||||
$turntimeObj = new \DateTimeImmutable($turntime);
|
||||
$turntimeObj = $turntimeObj->add(TimeUtil::secondsToDateInterval($nextTurnTimeBase));
|
||||
$turntime = TimeUtil::format($turntimeObj, true);
|
||||
$general->setAuxVar('nextTurnTimeBase', null);
|
||||
}
|
||||
|
||||
$general->setVar('turntime', $turntime);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?=$btnBegin??''?><a href='v_board.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>회 의 실</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_board.php?isSecret=true' class='commandButton <?= $permission >= 2 ? '' : 'disabled' ?> <?=$btnClass??""?>'>기 밀 실</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_troop.php' class='commandButton <?= ($meLevel >= 1 && $nationLevel >= 1) ? '' : 'disabled' ?> <?=$btnClass??""?>'>부대 편성</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='t_diplomacy.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>외 교 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myBossInfo.php' class='commandButton <?= $meLevel >= 1 ? '' : 'disabled' ?> <?=$btnClass??""?>'>인 사 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_nationStratFinan.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>내 무 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_chiefCenter.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>사 령 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_NPCControl.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>NPC 정책</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_genList.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>암 행 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_tournament.php' target='_blank' class='open-window <?=$btnClassForTournament??""?>'>토 너 먼 트</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myKingdomInfo.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 정보</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myCityInfo.php' class='commandButton <?=$btnClass??""?> <?= ($meLevel >= 1 && $nationLevel >= 1) ? '' : 'disabled' ?>'>세력 도시</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_nationGeneral.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 장수</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_globalDiplomacy.php' class='commandButton <?=$btnClass??""?>'>중원 정보</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_currentCity.php' class='commandButton <?=$btnClass??""?>'>현재 도시</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_battleCenter.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>감 찰 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_inheritPoint.php' class='commandButton <?=$btnClass??""?>'>유산 관리</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myPage.php' class='commandButton <?=$btnClass??""?>'>내 정보&설정</a><?=$btnEnd??''?>
|
||||
<?=$splitBtnBegin??''?>
|
||||
<?=$splitMainBegin??''?><a href='v_auction.php' target='_blank' class='open-window commandButton <?=$btnClass??""?>'>경 매 장</a><?=$splitMainEnd??''?>
|
||||
<?=$splitZoneSign??''?>
|
||||
<?=$splitZoneBegin??''?>
|
||||
<?=$splitSubBtnBegin??''?><a href='v_auction.php' target='_blank' class='open-window commandButton <?=$btnSplitClass??''?>'>금/쌀 경매장</a><?=$splitSubBtnEnd??''?>
|
||||
<?=$splitSubBtnBegin??''?><a href='v_auction.php?type=unique' target='_blank' class='open-window commandButton <?=$btnSplitClass??''?>'>유니크 경매장</a><?=$splitSubBtnEnd??''?>
|
||||
<?=$splitZoneEnd??''?>
|
||||
<?=$splitBtnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_betting.php' target='_blank' class='open-window <?=$btnClassForBetting??""?>'>베 팅 장</a><?=$btnEnd??''?>
|
||||
@@ -111,7 +111,7 @@
|
||||
</div>
|
||||
<div class="a-right">
|
||||
<small class="form-text text-muted"
|
||||
>다음 턴 시간이 앞, 뒤 랜덤하게 바뀝니다. (필요 포인트가 피보나치식으로 증가합니다)<br /><span style="color: white"
|
||||
>다다음턴부터 시간이 랜덤하게 바뀝니다. (필요 포인트가 피보나치식으로 증가합니다)<br /><span style="color: white"
|
||||
>필요 포인트: {{ inheritActionCost.resetTurnTime }}</span
|
||||
></small
|
||||
>
|
||||
@@ -458,14 +458,7 @@ async function tryResestTurnTime(){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { minTurnTime, maxTurnTime } = await SammoAPI.InheritAction.CalcResetTurnTimeRange();
|
||||
|
||||
//YYYY-MM-DD hh:mm:ss 에서 hh:mm:ss 까지만 보여줄 예정
|
||||
const textMinTurnTime = minTurnTime.substring(11, 19);
|
||||
const textMaxTurnTime = maxTurnTime.substring(11, 19);
|
||||
|
||||
const msg = `${cost} 포인트로 턴을 초기화 하시겠습니까?\n${textMinTurnTime} ~ ${textMaxTurnTime} 사이의 시간으로 초기화 됩니다.`;
|
||||
const msg = `${cost} 포인트로 턴을 초기화 하시겠습니까?\n다다음턴부터 무작위 시간으로 초기화 됩니다.`;
|
||||
if (!confirm(msg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+45
-80
@@ -186,58 +186,45 @@
|
||||
</div>
|
||||
|
||||
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
|
||||
<div class="a-center">
|
||||
<label> <input v-model="inheritTurnTimeSet" type="checkbox" />턴 시간 고정 </label>
|
||||
</div>
|
||||
<div class="row turn_time_pad">
|
||||
<div class="col col-lg-4 offset-lg-3 col-4 offset-3">
|
||||
<NumberInputWithInfo
|
||||
v-model="inheritTurnTimeMinute"
|
||||
:readonly="!inheritTurnTimeSet"
|
||||
:min="0"
|
||||
:max="turnterm - 1"
|
||||
:right="true"
|
||||
title="분"
|
||||
/>
|
||||
</div>
|
||||
<div class="col col-lg-4 col-4">
|
||||
<NumberInputWithInfo
|
||||
v-model="inheritTurnTimeSecond"
|
||||
:readonly="!inheritTurnTimeSet"
|
||||
:min="0"
|
||||
:max="60"
|
||||
:right="true"
|
||||
title="초"
|
||||
/>
|
||||
<div class="row">
|
||||
<div class="col col-6 a-right align-self-center">턴 시간 지정</div>
|
||||
<div class="col col-6 align-self-center">
|
||||
<select v-model.number="inheritTurnTimeZone" class="form-select form-inline" style="max-width: 24ch">
|
||||
<option :value="undefined">사용안함</option>
|
||||
<option v-for="(zone, idx) in turnTimeZoneList" :key="idx" :value="idx">
|
||||
{{ zone }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-lg-6 col-12 p-2">
|
||||
<div class="a-center">추가 능력치 고정</div>
|
||||
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
|
||||
<div class="row">
|
||||
<div class="col col-6 a-right align-self-center">추가 능력치 고정(통/무/지)</div>
|
||||
<div class="col col-6 align-self-center">
|
||||
<div class="row g-1">
|
||||
<div class="col">
|
||||
<NumberInputWithInfo
|
||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]"
|
||||
:max="stats.bonusMax"
|
||||
title="통솔"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<NumberInputWithInfo
|
||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]"
|
||||
:max="stats.bonusMax"
|
||||
title="무력"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<NumberInputWithInfo
|
||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]"
|
||||
:max="stats.bonusMax"
|
||||
title="지력"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -284,7 +271,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
|
||||
import { getIconPath } from "@util/getIconPath";
|
||||
import { isBrightColor } from "@util/isBrightColor";
|
||||
import { abilityLeadint, abilityLeadpow, abilityPowint, abilityRand } from "@util/generalStats";
|
||||
import { shuffle, sum } from "lodash-es";
|
||||
import { range, shuffle, sum } from "lodash-es";
|
||||
import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
||||
import { SammoAPI } from "./SammoAPI";
|
||||
import type { JoinArgs } from "./defs/API/General";
|
||||
@@ -378,7 +365,7 @@ watch(gameConstStore, (gameConst) => {
|
||||
inheritCity: undefined,
|
||||
inheritBonusStat: [0, 0, 0],
|
||||
inheritSpecial: undefined,
|
||||
inheritTurntime: undefined,
|
||||
inheritTurntimeZone: undefined,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -462,7 +449,7 @@ const inheritRequiredPoint = computed(() => {
|
||||
if (args.value.inheritSpecial !== undefined) {
|
||||
inheritRequiredPoint += gameConst.inheritBornSpecialPoint;
|
||||
}
|
||||
if (args.value.inheritTurntime !== undefined) {
|
||||
if (args.value.inheritTurntimeZone !== undefined) {
|
||||
inheritRequiredPoint += gameConst.inheritBornTurntimePoint;
|
||||
}
|
||||
if (args.value.inheritBonusStat !== undefined && sum(args.value.inheritBonusStat) != 0) {
|
||||
@@ -494,55 +481,37 @@ watch(inheritCity, (newValue: undefined | number) => {
|
||||
args.value.inheritCity = inheritCity.value;
|
||||
});
|
||||
|
||||
const inheritTurnTimeSet = ref(false);
|
||||
watch(inheritTurnTimeSet, (newValue: boolean) => {
|
||||
if (!args.value) throw "nyc";
|
||||
|
||||
if (!newValue) {
|
||||
args.value.inheritTurntime = undefined;
|
||||
return;
|
||||
const inheritTurnTimeZone = ref<number>();
|
||||
const turnTimeZoneList: string[] = (()=>{
|
||||
const result: string[] = [];
|
||||
const zoneSec = turnterm; // * 60 / 60
|
||||
let zoneCur = 0;
|
||||
for(const idx of range(60)){
|
||||
const zoneNext = zoneCur + zoneSec;
|
||||
|
||||
const zoneCurMin = Math.floor(zoneCur / 60);
|
||||
const zoneCurSec = zoneCur % 60;
|
||||
const zoneCurText = `${zoneCurMin.toString().padStart(2, "0")}:${zoneCurSec.toString().padStart(2, "0")}.000`;
|
||||
|
||||
const zoneCurEnd = zoneCur + zoneSec - 1;
|
||||
const zoneCurEndMin = Math.floor(zoneCurEnd / 60);
|
||||
const zoneCurEndSec = zoneCurEnd % 60;
|
||||
const zoneCurEndText = `${zoneCurEndMin.toString().padStart(2, "0")}:${zoneCurEndSec.toString().padStart(2, "0")}.999`;
|
||||
|
||||
// aa:bb.000 ~ cc:dd.999
|
||||
const zoneStr = `${zoneCurText} ~ ${zoneCurEndText}`;
|
||||
result.push(zoneStr);
|
||||
zoneCur = zoneNext;
|
||||
}
|
||||
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + inheritTurnTimeSecond.value;
|
||||
return result;
|
||||
})();
|
||||
|
||||
watch(inheritTurnTimeZone, (newValue: undefined | number) => {
|
||||
if (!args.value) throw "nyc";
|
||||
args.value.inheritTurntimeZone = inheritTurnTimeZone.value;
|
||||
});
|
||||
|
||||
watch(
|
||||
[inheritCity, inheritTurnTimeSet],
|
||||
([newInheritCity, newInheritTurnTimeSet], [oldInheritCity, oldInheritTurnTimeSet]) => {
|
||||
if (newInheritCity === undefined || newInheritTurnTimeSet === false) {
|
||||
return;
|
||||
}
|
||||
alert("도시와 턴 시간을 동시에 설정할 수 없습니다.");
|
||||
|
||||
if (newInheritCity !== oldInheritCity) {
|
||||
inheritCity.value = undefined;
|
||||
}
|
||||
if (newInheritTurnTimeSet !== oldInheritTurnTimeSet) {
|
||||
inheritTurnTimeSet.value = false;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const inheritTurnTimeMinute = ref(0);
|
||||
watch(inheritTurnTimeMinute, (newValue: number) => {
|
||||
if (!args.value) throw "nyc";
|
||||
if (!inheritTurnTimeSet.value) {
|
||||
args.value.inheritTurntime = undefined;
|
||||
return;
|
||||
}
|
||||
args.value.inheritTurntime = newValue * 60 + inheritTurnTimeSecond.value;
|
||||
});
|
||||
|
||||
const inheritTurnTimeSecond = ref(0);
|
||||
watch(inheritTurnTimeSecond, (newValue: number) => {
|
||||
if (!args.value) throw "nyc";
|
||||
|
||||
if (!inheritTurnTimeSet.value) {
|
||||
args.value.inheritTurntime = undefined;
|
||||
return;
|
||||
}
|
||||
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + newValue;
|
||||
});
|
||||
</script>
|
||||
<style lang="scss">
|
||||
@import "@scss/common/base.scss";
|
||||
@@ -569,10 +538,6 @@ watch(inheritTurnTimeSecond, (newValue: number) => {
|
||||
.col-form-label {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.turn_time_pad .col-form-label {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -174,11 +174,6 @@ const apiRealPath = {
|
||||
BuyRandomUnique: PUT as APICallT<undefined>,
|
||||
ResetSpecialWar: PUT as APICallT<undefined>,
|
||||
ResetTurnTime: PUT as APICallT<undefined>,
|
||||
CalcResetTurnTimeRange: GET as APICallT<undefined, {
|
||||
result: true,
|
||||
minTurnTime: string,
|
||||
maxTurnTime: string,
|
||||
}>,
|
||||
SetNextSpecialWar: PUT as APICallT<{
|
||||
type: string;
|
||||
}>,
|
||||
|
||||
@@ -152,7 +152,7 @@ async function refreshDetail() {
|
||||
currentAuction.value = await SammoAPI.Auction.GetUniqueItemAuctionDetail({ auctionID });
|
||||
const bidList = currentAuction.value.bidList;
|
||||
const highestBidAmount = Math.max(bidList[0].amount, bidList[bidList.length-1].amount);
|
||||
bidAmount.value = Math.max(bidAmount.value, Math.ceil(highestBidAmount * 1.01));
|
||||
bidAmount.value = Math.ceil(highestBidAmount * 1.01);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (isString(e)) {
|
||||
|
||||
@@ -6,7 +6,7 @@ export type JoinArgs = {
|
||||
pic: boolean;
|
||||
character: string;
|
||||
inheritSpecial?: string;
|
||||
inheritTurntime?: number;
|
||||
inheritTurntimeZone?: number;
|
||||
inheritCity?: number;
|
||||
inheritBonusStat?: [number, number, number];
|
||||
};
|
||||
|
||||
@@ -551,7 +551,7 @@ $(function () {
|
||||
{
|
||||
cityInfo.태수.$obj = $this.find('.officer-4-value');
|
||||
cityInfo.군사.$obj = $this.find('.officer-3-value');
|
||||
cityInfo.종사.$obj = $this.find('.officer-2-valuet');
|
||||
cityInfo.종사.$obj = $this.find('.officer-2-value');
|
||||
}
|
||||
|
||||
//기타
|
||||
|
||||
+23
-20
@@ -93,8 +93,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'validate',
|
||||
'reason' => $validateResult
|
||||
@@ -123,8 +123,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'launch',
|
||||
'reason' => $result
|
||||
@@ -139,8 +139,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'launch',
|
||||
'reason' => $recoveryType->info(),
|
||||
@@ -168,8 +168,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => true,
|
||||
'state' => 'cache_not_modified',
|
||||
]),
|
||||
@@ -183,8 +183,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => true,
|
||||
'state' => 'cache_not_modified',
|
||||
]),
|
||||
@@ -199,8 +199,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => true,
|
||||
'state' => 'success_simple',
|
||||
'set_cache' => $setCache,
|
||||
@@ -216,8 +216,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => true,
|
||||
'state' => 'success_complex',
|
||||
'set_cache' => $setCache,
|
||||
@@ -226,6 +226,7 @@ class APIHelper
|
||||
$result['result'] = $result['result'] ?? true;
|
||||
Json::die($result, $setCache ? 0 : Json::NO_CACHE);
|
||||
} catch (\Exception $e) {
|
||||
$session = Session::getInstance();
|
||||
$errMsg = $e->getMessage();
|
||||
$errTrace = $e->getTraceAsString();
|
||||
$logDB->insert('api_log', [
|
||||
@@ -233,8 +234,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'error_exception',
|
||||
'errMsg' => $errMsg,
|
||||
@@ -244,6 +245,7 @@ class APIHelper
|
||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||
} catch (\Throwable $e) {
|
||||
logExceptionByCustomHandler($e, false);
|
||||
$session = Session::getInstance();
|
||||
$errMsg = $e->getMessage();
|
||||
$errTrace = $e->getTraceAsString();
|
||||
$logDB->insert('api_log', [
|
||||
@@ -251,8 +253,8 @@ class APIHelper
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'error_throwable',
|
||||
'errMsg' => $errMsg,
|
||||
@@ -261,14 +263,15 @@ class APIHelper
|
||||
]);
|
||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||
} catch (mixed $e) {
|
||||
$session = Session::getInstance();
|
||||
$errStr = strval($e);
|
||||
$logDB->insert('api_log', [
|
||||
'user_id' => $session->userID ?? 0,
|
||||
'ip' => $ip,
|
||||
'date' => $date,
|
||||
'path' => $actionPath,
|
||||
'arg' => JSON::encode($filteredArgs),
|
||||
'aux' => JSON::encode([
|
||||
'arg' => Json::encode($filteredArgs),
|
||||
'aux' => Json::encode([
|
||||
'result' => false,
|
||||
'state' => 'error_mixed',
|
||||
'errMsg' => $errStr,
|
||||
|
||||
Reference in New Issue
Block a user