Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1e6ac7b89 | ||
|
|
7b24f66f93 | ||
|
|
b2b2934ce9 | ||
|
|
6ed3e673df | ||
|
|
aa7dcab1fd | ||
|
|
e2e578e485 | ||
|
|
6cebc903c9 | ||
|
|
c0190959e3 | ||
|
|
bb26366769
|
||
|
|
71849a457b
|
||
|
|
7c1a8d96a2
|
||
|
|
cebd152daf
|
||
|
|
2ca03389d2
|
||
|
|
cacf0981ce
|
||
|
|
bcf5b5cb7d
|
||
|
|
66b2f1a8f2
|
||
|
|
40ecca5440
|
||
|
|
a96c2312d0
|
||
|
|
faff3f4e6a | ||
|
|
83abf44380
|
||
|
|
e83960d67f
|
||
|
|
c6b2e64c05
|
||
|
|
029f719112 | ||
|
|
46f460c8ad | ||
|
|
af4401d9bb | ||
|
|
2f00aee947 | ||
|
|
dd2b032fa3 | ||
|
|
1b858ae36c
|
||
|
|
69f4d8e2c7 | ||
|
|
f24aea0120 | ||
|
|
f6dc7f49e2 | ||
|
|
c1f105226f
|
||
|
|
c5ed2d47fc |
+5
-5
@@ -408,14 +408,14 @@ function checkSecretPermission(array $me, $checkSecretLimit = true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$secretMin = 0;
|
$secretMin = 0;
|
||||||
$secretMax = checkSecretMaxPermission($me, $penalty);
|
$secretMax = checkSecretMaxPermission($penalty);
|
||||||
|
|
||||||
|
|
||||||
if ($me['officer_level'] == 12) {
|
if ($me['officer_level'] == 12) {
|
||||||
$secretMin = 4;
|
$secretMin = 4;
|
||||||
} else if ($me['permission'] == 'ambassador') {
|
} else if ($permission == 'ambassador') {
|
||||||
$secretMin = 4;
|
$secretMin = 4;
|
||||||
} else if ($me['permission'] == 'auditor') {
|
} else if ($permission == 'auditor') {
|
||||||
$secretMin = 3;
|
$secretMin = 3;
|
||||||
} else if ($me['officer_level'] >= 5) {
|
} else if ($me['officer_level'] >= 5) {
|
||||||
$secretMin = 2;
|
$secretMin = 2;
|
||||||
@@ -1054,10 +1054,10 @@ function increaseRefresh($type = "", $cnt = 1)
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => "refresh",
|
'path' => "refresh",
|
||||||
'arg' => JSON::encode([
|
'arg' => Json::encode([
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
]),
|
]),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'generalID' => $generalID,
|
'generalID' => $generalID,
|
||||||
'generalName' => $session->generalName,
|
'generalName' => $session->generalName,
|
||||||
'userName' => $session->userName,
|
'userName' => $session->userName,
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ function _setGeneralCommand(GeneralCommand $command, array $turnList):void {
|
|||||||
|
|
||||||
$db->update('general_turn', [
|
$db->update('general_turn', [
|
||||||
'action'=>$commandName,
|
'action'=>$commandName,
|
||||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||||
'brief'=>$brief
|
'brief'=>$brief
|
||||||
], 'general_id = %i AND turn_idx IN %li', $generalID, $turnList);
|
], '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', [
|
$db->update('nation_turn', [
|
||||||
'action'=>$commandName,
|
'action'=>$commandName,
|
||||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
'arg'=>Json::encode($arg, Json::EMPTY_ARRAY_IS_DICT),
|
||||||
'brief'=>$brief
|
'brief'=>$brief
|
||||||
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,40 +291,6 @@ function buildScenarioEffectClass(?string $type):iAction{
|
|||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBuffClass(?string $type){
|
|
||||||
if($type === null || $type === ''){
|
|
||||||
$type = 'None';
|
|
||||||
}
|
|
||||||
|
|
||||||
static $basePath = __NAMESPACE__.'\\ActionBuff\\';
|
|
||||||
$classPath = ($basePath.$type);
|
|
||||||
|
|
||||||
if(class_exists($classPath)){
|
|
||||||
return $classPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
$classPath = ($basePath.'che_'.$type);
|
|
||||||
if(class_exists($classPath)){
|
|
||||||
return $classPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \InvalidArgumentException("{$type}은 버프 클래스가 아님");
|
|
||||||
}
|
|
||||||
function buildBuffClass(?string $type):iAction{
|
|
||||||
static $cache = [];
|
|
||||||
if($type === null){
|
|
||||||
$type = 'None';
|
|
||||||
}
|
|
||||||
if(key_exists($type, $cache)){
|
|
||||||
return $cache[$type];
|
|
||||||
}
|
|
||||||
$class = getBuffClass($type);
|
|
||||||
|
|
||||||
$obj = new $class();
|
|
||||||
$cache[$type]= $obj;
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getGeneralSpecialDomesticClass(?string $type){
|
function getGeneralSpecialDomesticClass(?string $type){
|
||||||
if($type === null || $type === ''){
|
if($type === null || $type === ''){
|
||||||
$type = GameConst::$defaultSpecialDomestic;
|
$type = GameConst::$defaultSpecialDomestic;
|
||||||
@@ -450,27 +416,6 @@ function buildGeneralCommandClass(?string $type, General $generalObj, array $env
|
|||||||
return new $class($generalObj, $env, $arg);
|
return new $class($generalObj, $env, $arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserActionCommandClass(?string $type){
|
|
||||||
if($type === null || $type === ''){
|
|
||||||
$type = '휴식';
|
|
||||||
}
|
|
||||||
|
|
||||||
static $basePath = __NAMESPACE__.'\\Command\\UserAction\\';
|
|
||||||
$classPath = ($basePath.$type);
|
|
||||||
|
|
||||||
if(class_exists($classPath)){
|
|
||||||
return $classPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \InvalidArgumentException("{$type}은 올바른 개변 전략 커맨드가 아님");
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildUserActionCommandClass(?string $type, General $generalObj, array $env, $arg = null):Command\UserActionCommand{
|
|
||||||
$class = getUserActionCommandClass($type);
|
|
||||||
return new $class($generalObj, $env, $arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getNationCommandClass(?string $type){
|
function getNationCommandClass(?string $type){
|
||||||
if($type === null || $type === ''){
|
if($type === null || $type === ''){
|
||||||
$type = '휴식';
|
$type = '휴식';
|
||||||
|
|||||||
+15
-4
@@ -899,7 +899,7 @@ function checkEmperior()
|
|||||||
'tiger' => $tigerstr,
|
'tiger' => $tigerstr,
|
||||||
'eagle' => $eaglestr,
|
'eagle' => $eaglestr,
|
||||||
'gen' => $gen,
|
'gen' => $gen,
|
||||||
'history' => JSON::encode($nationHistory),
|
'history' => Json::encode($nationHistory),
|
||||||
'aux' => $statGeneral['aux']
|
'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(
|
return new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||||
UniqueConst::$hiddenSeed,
|
UniqueConst::$hiddenSeed,
|
||||||
'unique',
|
'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();
|
$logger = $general->getLogger();
|
||||||
if (!$logger) {
|
if (!$logger) {
|
||||||
@@ -971,5 +982,5 @@ function genGenericUniqueRNGFromGeneral(General $general): RandUtil
|
|||||||
$year = $logger->getYear();
|
$year = $logger->getYear();
|
||||||
$month = $logger->getMonth();
|
$month = $logger->getMonth();
|
||||||
$generalID = $general->getID();
|
$generalID = $general->getID();
|
||||||
return genGenericUniqueRNG($year, $month, $generalID);
|
return genGenericUniqueRNG($year, $month, $generalID, $reason);
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-3
@@ -27,14 +27,25 @@ $rootDB = RootDB::db();
|
|||||||
$oNow = new \DateTimeImmutable();
|
$oNow = new \DateTimeImmutable();
|
||||||
$now = $oNow->format('Y-m-d H:i:s');
|
$now = $oNow->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
$userNick = RootDB::db()->queryFirstField('SELECT `NAME` FROM member WHERE `NO`=%i',$userID);
|
$member = $rootDB->queryFirstRow('SELECT `name`, `penalty` FROM member WHERE `NO`=%i', $userID);
|
||||||
if(!$userNick){
|
if(!$member){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result'=>false,
|
'result'=>false,
|
||||||
'reason'=>'멤버 정보를 가져오지 못했습니다.'
|
'reason'=>'멤버 정보를 가져오지 못했습니다.'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userNick = $member['name'];
|
||||||
|
$memberPenalty = Json::decode($member['penalty'] ?? '{}');
|
||||||
|
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
||||||
|
|
||||||
|
$penalty = [];
|
||||||
|
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
|
||||||
|
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
|
||||||
|
$penalty[$penaltyKey] = $penaltyValue['value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
|
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
|
||||||
if(!$pickResult){
|
if(!$pickResult){
|
||||||
Json::die([
|
Json::die([
|
||||||
@@ -86,7 +97,8 @@ $db->update('general', [
|
|||||||
'defence_train'=>80,
|
'defence_train'=>80,
|
||||||
'permission'=>'normal',
|
'permission'=>'normal',
|
||||||
'owner'=>$userID,
|
'owner'=>$userID,
|
||||||
'aux'=>Json::encode($genAux)
|
'aux'=>Json::encode($genAux),
|
||||||
|
'penalty'=>Json::encode($penalty),
|
||||||
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
|
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
|
||||||
$db->insertIgnore('general_access_log', [
|
$db->insertIgnore('general_access_log', [
|
||||||
GeneralAccessLogColumn::generalID->value => $pick,
|
GeneralAccessLogColumn::generalID->value => $pick,
|
||||||
|
|||||||
+1
-4
@@ -222,10 +222,7 @@ function extractBattleOrder(WarUnit $defender, WarUnit $attacker)
|
|||||||
$totalStat = ($realStat + $fullStat) / 2;
|
$totalStat = ($realStat + $fullStat) / 2;
|
||||||
|
|
||||||
$totalCrew = $general->getVar('crew') / 1000000 * (($general->getVar('train') * $general->getVar('atmos')) ** 1.5);
|
$totalCrew = $general->getVar('crew') / 1000000 * (($general->getVar('train') * $general->getVar('atmos')) ** 1.5);
|
||||||
$value = $totalStat + $totalCrew / 100;
|
return $totalStat + $totalCrew / 100;
|
||||||
$value = $general->onCalcStat($general, 'battleOrder', $value, ['attacker' => $attacker->getGeneral()]);
|
|
||||||
$value = $attacker->getGeneral()->onCalcOpposeStat($general, 'battleOrder', $value, ['attacker' => $attacker->getGeneral()]);
|
|
||||||
return $value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processWar_NG(
|
function processWar_NG(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use sammo\Session;
|
|||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\Enums\APIRecoveryType;
|
use sammo\Enums\APIRecoveryType;
|
||||||
|
use sammo\GameConst;
|
||||||
use sammo\Json;
|
use sammo\Json;
|
||||||
use sammo\KVStorage;
|
use sammo\KVStorage;
|
||||||
use sammo\TimeUtil;
|
use sammo\TimeUtil;
|
||||||
@@ -32,8 +33,18 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$generalID = $session->generalID;
|
$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);
|
$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]) {
|
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] = [
|
$commandList[$turn_idx] = [
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'brief' => $brief,
|
'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']);
|
[$turnTerm, $year, $month, $lastExecute] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month', 'turntime']);
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\API\Command;
|
|
||||||
|
|
||||||
use sammo\Session;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use sammo\Command\UserActionCommand;
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\Enums\APIRecoveryType;
|
|
||||||
use sammo\Json;
|
|
||||||
use sammo\KVStorage;
|
|
||||||
use sammo\TimeUtil;
|
|
||||||
use sammo\DTO\UserAction;
|
|
||||||
|
|
||||||
use function sammo\cutTurn;
|
|
||||||
|
|
||||||
class GetReservedUserAction 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
|
|
||||||
{
|
|
||||||
$db = DB::db();
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
|
|
||||||
$userActionKey = UserActionCommand::USER_ACTION_KEY;
|
|
||||||
|
|
||||||
$rawUserActions = $db->queryFirstField('SELECT JSON_QUERY(`aux`, %s) FROM general WHERE no=%i', "$.{$userActionKey}", $generalID);
|
|
||||||
if($rawUserActions === null){
|
|
||||||
$rawUserActions = '{}';
|
|
||||||
}
|
|
||||||
|
|
||||||
$userActions = UserAction::fromArray(Json::decode($rawUserActions));
|
|
||||||
|
|
||||||
return [
|
|
||||||
'result' => true,
|
|
||||||
'userActions' => $userActions->toArray(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\API\Command;
|
|
||||||
|
|
||||||
use sammo\Session;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use sammo\Command\UserActionCommand;
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\DTO\UserAction;
|
|
||||||
use sammo\DTO\UserActionItem;
|
|
||||||
use sammo\Enums\APIRecoveryType;
|
|
||||||
use sammo\GameConst;
|
|
||||||
use sammo\General;
|
|
||||||
use sammo\Json;
|
|
||||||
use sammo\KVStorage;
|
|
||||||
use sammo\Util;
|
|
||||||
use sammo\Validator;
|
|
||||||
|
|
||||||
use function sammo\buildUserActionCommandClass;
|
|
||||||
use function sammo\setGeneralCommand;
|
|
||||||
|
|
||||||
class ReserveUserAction extends \sammo\BaseAPI
|
|
||||||
{
|
|
||||||
public function validateArgs(): ?string
|
|
||||||
{
|
|
||||||
$v = new Validator($this->args);
|
|
||||||
$v->rule('required', [
|
|
||||||
'turnIdx',
|
|
||||||
'action'
|
|
||||||
])
|
|
||||||
->rule('int', 'turnIdx')
|
|
||||||
->rule('max', 'turnIdx', GameConst::$maxTurn)
|
|
||||||
->rule('min', 'turnIdx', 0)
|
|
||||||
->rule('lengthMin', 'action', 1);
|
|
||||||
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): null | string | array | APIRecoveryType
|
|
||||||
{
|
|
||||||
$turnIdx = $this->args['turnIdx'];
|
|
||||||
$action = $this->args['action'];
|
|
||||||
|
|
||||||
$userActionKey = UserActionCommand::USER_ACTION_KEY;
|
|
||||||
|
|
||||||
if($turnIdx < 0 || $turnIdx >= GameConst::$maxTurn){
|
|
||||||
return '올바르지 않은 턴입니다.';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!in_array($action, Util::array_flatten(GameConst::$availableUserActionCommand))){
|
|
||||||
return '사용할 수 없는 커맨드입니다.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
$rawUserActions = $db->queryFirstField('SELECT JSON_QUERY(`aux`, %s) FROM general WHERE no=%i', "$.{$userActionKey}", $generalID);
|
|
||||||
if(!$rawUserActions){
|
|
||||||
$rawUserActions = '{}';
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmp = Json::decode($rawUserActions);
|
|
||||||
$userActions = UserAction::fromArray($tmp);
|
|
||||||
|
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$gameStor->cacheAll();
|
|
||||||
$general = General::createObjFromDB($generalID);
|
|
||||||
|
|
||||||
$item = buildUserActionCommandClass($action, $general, $gameStor->getAll());
|
|
||||||
$userActions->reserved[$turnIdx] = new UserActionItem(
|
|
||||||
$item->getRawClassName(),
|
|
||||||
$item->getBrief(),
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
|
|
||||||
$db->update('general', [
|
|
||||||
'aux' => $db->sqleval('JSON_SET(`aux`, %s, JSON_EXTRACT(%s, "$"))', "$.{$userActionKey}", Json::encode($userActions->toArray())),
|
|
||||||
], 'no=%i', $generalID);
|
|
||||||
|
|
||||||
return [
|
|
||||||
'result' => true,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -90,6 +90,9 @@ class BuildNationCandidate extends \sammo\BaseAPI
|
|||||||
return '거병을 실패했습니다.';
|
return '거병을 실패했습니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$generalObj->setVar('killturn', $env['killturn']);
|
||||||
|
$generalObj->applyDB($db);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,11 @@ namespace sammo\API\General;
|
|||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use MeekroDB;
|
use MeekroDB;
|
||||||
use sammo\CityConst;
|
use sammo\CityConst;
|
||||||
use sammo\Command\UserActionCommand;
|
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\DTO\UserAction;
|
|
||||||
use sammo\DTO\VoteInfo;
|
use sammo\DTO\VoteInfo;
|
||||||
use sammo\Enums\APIRecoveryType;
|
use sammo\Enums\APIRecoveryType;
|
||||||
use sammo\Enums\CityColumn;
|
use sammo\Enums\CityColumn;
|
||||||
use sammo\Enums\GeneralAccessLogColumn;
|
use sammo\Enums\GeneralAccessLogColumn;
|
||||||
use sammo\Enums\GeneralAuxKey;
|
|
||||||
use sammo\Enums\GeneralColumn;
|
use sammo\Enums\GeneralColumn;
|
||||||
use sammo\Enums\GeneralQueryMode;
|
use sammo\Enums\GeneralQueryMode;
|
||||||
use sammo\Enums\RankColumn;
|
use sammo\Enums\RankColumn;
|
||||||
@@ -30,7 +27,6 @@ use function sammo\buildNationCommandClass;
|
|||||||
use function sammo\checkLimit;
|
use function sammo\checkLimit;
|
||||||
use function sammo\getTournamentTermText;
|
use function sammo\getTournamentTermText;
|
||||||
use function sammo\buildNationTypeClass;
|
use function sammo\buildNationTypeClass;
|
||||||
use function sammo\buildUserActionCommandClass;
|
|
||||||
use function sammo\calcLeadershipBonus;
|
use function sammo\calcLeadershipBonus;
|
||||||
use function sammo\checkSecretPermission;
|
use function sammo\checkSecretPermission;
|
||||||
use function sammo\getBillByLevel;
|
use function sammo\getBillByLevel;
|
||||||
@@ -105,8 +101,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
return $history;
|
return $history;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateRecentRecord(int $generalID)
|
private function generateRecentRecord(int $generalID){
|
||||||
{
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
@@ -252,7 +247,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
$nationID
|
$nationID
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($nationPopulation['cityCnt'] == 0) {
|
if($nationPopulation['cityCnt'] == 0){
|
||||||
$nationPopulation = [
|
$nationPopulation = [
|
||||||
'cityCnt' => 0,
|
'cityCnt' => 0,
|
||||||
'now' => 0,
|
'now' => 0,
|
||||||
@@ -366,8 +361,6 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
|
|
||||||
public function generateGeneralInfo(MeekroDB $db, General $general, array $rawNation): array
|
public function generateGeneralInfo(MeekroDB $db, General $general, array $rawNation): array
|
||||||
{
|
{
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$admin = $gameStor->getAll(true);
|
|
||||||
|
|
||||||
$permission = checkSecretPermission($general->getRaw());
|
$permission = checkSecretPermission($general->getRaw());
|
||||||
|
|
||||||
@@ -450,21 +443,6 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
'permission' => $permission,
|
'permission' => $permission,
|
||||||
];
|
];
|
||||||
|
|
||||||
$rawUserAction = $general->getAuxVar(UserActionCommand::USER_ACTION_KEY) ?? [];
|
|
||||||
$userAction = UserAction::fromArray($rawUserAction);
|
|
||||||
$impossibleUserAction = [];
|
|
||||||
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
|
|
||||||
|
|
||||||
if ($userAction->nextAvailableTurn) {
|
|
||||||
foreach ($userAction->nextAvailableTurn as $command => $nextAvailableTurn) {
|
|
||||||
if ($nextAvailableTurn > $yearMonth) {
|
|
||||||
$impossibleUserAction[] = [$command, $nextAvailableTurn - $yearMonth];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$result['impossibleUserAction'] = $impossibleUserAction;
|
|
||||||
|
|
||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
$troopID = $general->getVar(GeneralColumn::troop);
|
$troopID = $general->getVar(GeneralColumn::troop);
|
||||||
if (!$troopID) {
|
if (!$troopID) {
|
||||||
@@ -505,7 +483,6 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
'name' => $troopName,
|
'name' => $troopName,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +576,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
|
|
||||||
if ($globalInfo['lastVote']) {
|
if ($globalInfo['lastVote']) {
|
||||||
$myLastVoteID = $db->queryFirstField('SELECT vote_id FROM vote WHERE general_id = %i ORDER BY vote_id DESC LIMIT 1', $generalID);
|
$myLastVoteID = $db->queryFirstField('SELECT vote_id FROM vote WHERE general_id = %i ORDER BY vote_id DESC LIMIT 1', $generalID);
|
||||||
if ($myLastVoteID) {
|
if($myLastVoteID) {
|
||||||
$auxInfo['myLastVote'] = $myLastVoteID;
|
$auxInfo['myLastVote'] = $myLastVoteID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\API\General;
|
|
||||||
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\Enums\APIRecoveryType;
|
|
||||||
use sammo\GameConst;
|
|
||||||
use sammo\General;
|
|
||||||
use sammo\Session;
|
|
||||||
use sammo\KVStorage;
|
|
||||||
use sammo\Util;
|
|
||||||
|
|
||||||
use function sammo\buildUserActionCommandClass;
|
|
||||||
|
|
||||||
class GetUserActionCommandTable 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
|
|
||||||
{
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$gameStor->turnOnCache();
|
|
||||||
$env = $gameStor->getAll();
|
|
||||||
|
|
||||||
|
|
||||||
$general = General::createObjFromDB($generalID);
|
|
||||||
|
|
||||||
$commandTable = [];
|
|
||||||
foreach (GameConst::$availableUserActionCommand as $commandCategory => $commandList) {
|
|
||||||
$subList = [];
|
|
||||||
foreach ($commandList as $commandClassName) {
|
|
||||||
$commandObj = buildUserActionCommandClass($commandClassName, $general, $env);
|
|
||||||
if (!$commandObj->canDisplay()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$subList[] = [
|
|
||||||
'value' => Util::getClassNameFromObj($commandObj),
|
|
||||||
'compensation' => $commandObj->getCompensationStyle(),
|
|
||||||
'possible' => $commandObj->hasMinConditionMet(),
|
|
||||||
'title' => $commandObj->getCommandDetailTitle(),
|
|
||||||
'simpleName' => $commandObj->getName(),
|
|
||||||
'reqArg' => $commandObj::$reqArg,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$commandTable[] = [
|
|
||||||
'category' => $commandCategory,
|
|
||||||
'values' => $subList
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'result' => true,
|
|
||||||
'commandTable' => $commandTable,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -54,7 +54,7 @@ class Join extends \sammo\BaseAPI
|
|||||||
'leadership',
|
'leadership',
|
||||||
'strength',
|
'strength',
|
||||||
'intel',
|
'intel',
|
||||||
'inheritTurntime',
|
'inheritTurntimeZone',
|
||||||
])
|
])
|
||||||
->rule('boolean', [
|
->rule('boolean', [
|
||||||
'pic'
|
'pic'
|
||||||
@@ -72,7 +72,8 @@ class Join extends \sammo\BaseAPI
|
|||||||
], GameConst::$defaultStatMax)
|
], GameConst::$defaultStatMax)
|
||||||
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']))
|
->rule('in', 'character', array_merge(GameConst::$availablePersonality, ['Random']))
|
||||||
->rule('in', 'inheritSpecial', GameConst::$availableSpecialWar)
|
->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('in', 'inheritCity', array_keys(CityConst::all()))
|
||||||
->rule('integerArray', 'inheritBonusStat');
|
->rule('integerArray', 'inheritBonusStat');
|
||||||
|
|
||||||
@@ -139,22 +140,28 @@ class Join extends \sammo\BaseAPI
|
|||||||
$intel = $this->args['intel'];
|
$intel = $this->args['intel'];
|
||||||
|
|
||||||
$inheritSpecial = $this->args['inheritSpecial'] ?? null;
|
$inheritSpecial = $this->args['inheritSpecial'] ?? null;
|
||||||
$inheritTurntime = $this->args['inheritTurntime'] ?? null;
|
$inheritTurntimeZone = $this->args['inheritTurntimeZone'] ?? null;
|
||||||
$inheritCity = $this->args['inheritCity'] ?? null;
|
$inheritCity = $this->args['inheritCity'] ?? null;
|
||||||
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
|
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
|
||||||
|
|
||||||
if ($inheritTurntime !== null && $inheritCity !== null) {
|
|
||||||
return '턴과 도시를 동시에 지정할 수 없습니다.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$rootDB = RootDB::db();
|
$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) {
|
if (!$member) {
|
||||||
return "잘못된 접근입니다!!!";
|
return "잘못된 접근입니다!!!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$memberPenalty = Json::decode($member['penalty'] ?? "{}");
|
||||||
|
$penaltyInfo = array_merge($memberPenalty['any'] ?? [], $memberPenalty[DB::prefix()] ?? []);
|
||||||
|
|
||||||
|
$penalty = [];
|
||||||
|
foreach($penaltyInfo as $penaltyKey => $penaltyValue){
|
||||||
|
if($penaltyValue['expire'] ?? 0 > TimeUtil::now()){
|
||||||
|
$penalty[$penaltyKey] = $penaltyValue['value'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'block_general_create', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'block_general_create', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
||||||
@@ -232,7 +239,7 @@ class Join extends \sammo\BaseAPI
|
|||||||
if ($inheritSpecial !== null) {
|
if ($inheritSpecial !== null) {
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornSpecialPoint;
|
$inheritRequiredPoint += GameConst::$inheritBornSpecialPoint;
|
||||||
}
|
}
|
||||||
if ($inheritTurntime !== null) {
|
if ($inheritTurntimeZone !== null) {
|
||||||
$inheritRequiredPoint += GameConst::$inheritBornTurntimePoint;
|
$inheritRequiredPoint += GameConst::$inheritBornTurntimePoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,12 +354,14 @@ class Join extends \sammo\BaseAPI
|
|||||||
$experience *= 0.8;
|
$experience *= 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inheritTurntime !== null) {
|
if ($inheritTurntimeZone !== null) {
|
||||||
$inheritTurntime = $inheritTurntime % ($admin['turnterm'] * 60);
|
$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");
|
$userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime % 60), "inheritPoint");
|
||||||
|
|
||||||
$inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000;
|
$inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000;
|
||||||
|
|
||||||
$turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm']));
|
$turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm']));
|
||||||
$turntime = $turntime->add(TimeUtil::secondsToDateInterval($inheritTurntime));
|
$turntime = $turntime->add(TimeUtil::secondsToDateInterval($inheritTurntime));
|
||||||
$turntime = TimeUtil::format($turntime, true);
|
$turntime = TimeUtil::format($turntime, true);
|
||||||
@@ -424,7 +433,8 @@ class Join extends \sammo\BaseAPI
|
|||||||
'specage' => $specage,
|
'specage' => $specage,
|
||||||
'special' => $special,
|
'special' => $special,
|
||||||
'specage2' => $specage2,
|
'specage2' => $specage2,
|
||||||
'special2' => $special2
|
'special2' => $special2,
|
||||||
|
'penalty' => Json::encode($penalty),
|
||||||
]);
|
]);
|
||||||
$generalID = $db->insertId();
|
$generalID = $db->insertId();
|
||||||
$db->insert('general_access_log', [
|
$db->insert('general_access_log', [
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ use DateTimeInterface;
|
|||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\Enums\APIRecoveryType;
|
use sammo\Enums\APIRecoveryType;
|
||||||
use sammo\Enums\MessageType;
|
use sammo\Enums\MessageType;
|
||||||
|
use sammo\Json;
|
||||||
use sammo\Message;
|
use sammo\Message;
|
||||||
use sammo\MessageTarget;
|
use sammo\MessageTarget;
|
||||||
use sammo\Validator;
|
use sammo\Validator;
|
||||||
|
use sammo\Util;
|
||||||
|
|
||||||
use function sammo\checkLimit;
|
use function sammo\checkLimit;
|
||||||
use function sammo\checkSecretPermission;
|
use function sammo\checkSecretPermission;
|
||||||
@@ -170,6 +172,8 @@ class SendMessage extends \sammo\BaseAPI
|
|||||||
return '장수가 없습니다.';
|
return '장수가 없습니다.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$penalty = Json::decode($me['penalty'] ?? '{}');
|
||||||
|
|
||||||
$limitState = checkLimit($me['refresh_score']);
|
$limitState = checkLimit($me['refresh_score']);
|
||||||
if ($limitState >= 2) {
|
if ($limitState >= 2) {
|
||||||
return '접속 제한입니다.';
|
return '접속 제한입니다.';
|
||||||
@@ -226,8 +230,10 @@ class SendMessage extends \sammo\BaseAPI
|
|||||||
$now = new \DateTime();
|
$now = new \DateTime();
|
||||||
$lastMsg = new \DateTime($session->lastMsg ?? '0000-00-00');
|
$lastMsg = new \DateTime($session->lastMsg ?? '0000-00-00');
|
||||||
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
|
$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');
|
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
namespace sammo\API\Nation;
|
namespace sammo\API\Nation;
|
||||||
|
|
||||||
use ArrayObject;
|
use ArrayObject;
|
||||||
use sammo\Command\UserActionCommand;
|
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\DTO\UserAction;
|
|
||||||
use sammo\Enums\APIRecoveryType;
|
use sammo\Enums\APIRecoveryType;
|
||||||
use sammo\Enums\GeneralLiteQueryMode;
|
use sammo\Enums\GeneralLiteQueryMode;
|
||||||
use sammo\Enums\GeneralQueryMode;
|
use sammo\Enums\GeneralQueryMode;
|
||||||
@@ -119,9 +117,6 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'reservedCommand' => 1,
|
'reservedCommand' => 1,
|
||||||
|
|
||||||
'autorun_limit' => 1,
|
'autorun_limit' => 1,
|
||||||
|
|
||||||
'impossibleUserAction' => 1,
|
|
||||||
'reservedUserAction' => 1,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function validateArgs(): ?string
|
public function validateArgs(): ?string
|
||||||
@@ -158,8 +153,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
|
|
||||||
$me = $db->queryFirstRow(
|
$me = $db->queryFirstRow(
|
||||||
'SELECT refresh_score, turntime, belong, nation, officer_level, permission, penalty FROM `general`
|
'SELECT refresh_score, turntime, belong, nation, officer_level, permission, penalty FROM `general`
|
||||||
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i',
|
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i', $session->getUserID()
|
||||||
$session->getUserID()
|
|
||||||
);
|
);
|
||||||
$limitState = checkLimit($me['refresh_score']);
|
$limitState = checkLimit($me['refresh_score']);
|
||||||
if ($limitState >= 2) {
|
if ($limitState >= 2) {
|
||||||
@@ -275,50 +269,6 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
|
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
|
||||||
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
|
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
|
||||||
'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0,
|
'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0,
|
||||||
'impossibleUserAction' => function ($rawGeneral) use ($env) {
|
|
||||||
$rawUserAction = ($rawGeneral['aux'] ?? [])[UserActionCommand::USER_ACTION_KEY] ?? [];
|
|
||||||
$userAction = UserAction::fromArray($rawUserAction);
|
|
||||||
$impossibleUserAction = [];
|
|
||||||
$yearMonth = Util::joinYearMonth($env['year'], $env['month']);
|
|
||||||
|
|
||||||
if ($userAction->nextAvailableTurn) {
|
|
||||||
foreach ($userAction->nextAvailableTurn as $command => $nextAvailableTurn) {
|
|
||||||
if ($nextAvailableTurn > $yearMonth) {
|
|
||||||
$impossibleUserAction[] = [$command, $nextAvailableTurn - $yearMonth];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $impossibleUserAction;
|
|
||||||
},
|
|
||||||
'reservedUserAction' => function ($rawGeneral) use ($env) {
|
|
||||||
$rawUserAction = ($rawGeneral['aux'] ?? [])[UserActionCommand::USER_ACTION_KEY] ?? [];
|
|
||||||
$userAction = UserAction::fromArray($rawUserAction);
|
|
||||||
$reservedUserAction = [];
|
|
||||||
|
|
||||||
$emptyTurnObj = [
|
|
||||||
'brief' => '휴식',
|
|
||||||
'action' => '휴식',
|
|
||||||
'arg' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
for($i = 0; $i < 5; $i++){
|
|
||||||
$reservedUserAction[] = $emptyTurnObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($userAction->reserved) {
|
|
||||||
foreach ($userAction->reserved as $turnIdx => $reserved) {
|
|
||||||
if($turnIdx >= 5){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$reservedUserAction[$turnIdx] = [
|
|
||||||
'brief' => $reserved->brief,
|
|
||||||
'action' => $reserved->command,
|
|
||||||
'arg' => [],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $reservedUserAction;
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($rankColumns as $rankKey) {
|
foreach ($rankColumns as $rankKey) {
|
||||||
@@ -363,7 +313,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
foreach ($rawGeneralList as $rawGeneral) {
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
//General 생성?
|
//General 생성?
|
||||||
if (key_exists('aux', $rawGeneral)) {
|
if (key_exists('aux', $rawGeneral)) {
|
||||||
$rawGeneral['aux'] = \sammo\JSON::decode($rawGeneral['aux']);
|
$rawGeneral['aux'] = \sammo\Json::decode($rawGeneral['aux']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = [];
|
$item = [];
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
$nationTurnList = [];
|
$nationTurnList = [];
|
||||||
|
|
||||||
|
//혹시 정규 턴을 벗어난 턴이 있는지 체크
|
||||||
|
$invalidUnderTurnList = [];
|
||||||
|
$invalidOverTurnList = [];
|
||||||
|
|
||||||
foreach ($db->queryAllLists(
|
foreach ($db->queryAllLists(
|
||||||
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
||||||
$me['nation']
|
$me['nation']
|
||||||
@@ -80,6 +85,14 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
if (!key_exists($officer_level, $nationTurnList)) {
|
if (!key_exists($officer_level, $nationTurnList)) {
|
||||||
$nationTurnList[$officer_level] = [];
|
$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] = [
|
$nationTurnList[$officer_level][$turn_idx] = [
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'brief' => $brief,
|
'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 = [];
|
$troopList = [];
|
||||||
foreach ($db->queryAllLists(
|
foreach ($db->queryAllLists(
|
||||||
'SELECT troop_leader, `name` FROM troop WHERE `nation` = %i',
|
'SELECT troop_leader, `name` FROM troop WHERE `nation` = %i',
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use sammo\General;
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_계략성공 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
|
||||||
{
|
|
||||||
if($turnType == '계략'){
|
|
||||||
if($varType == 'success') return $value + 20;
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use sammo\General;
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_내정성공 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
static protected $target = ['상업', '농업', '치안', '기술', '인구', '성벽', '수비', '민심'];
|
|
||||||
|
|
||||||
function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
|
||||||
{
|
|
||||||
if ($varType == 'success' && in_array($turnType, static::$target)) {
|
|
||||||
return $value + 1;
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use sammo\General;
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_사기40 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
function onCalcStat(General $general, string $statName, $value, $aux = null)
|
|
||||||
{
|
|
||||||
if ($statName == 'bonusAtmos') {
|
|
||||||
return $value + 40;
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use sammo\GameUnitConst;
|
|
||||||
use sammo\General;
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_전투순위보정 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
function onCalcStat(General $defender, string $statName, $value, $aux = null)
|
|
||||||
{
|
|
||||||
//방어자 입장에서 coef가 높다면 전투순위를 높인다.
|
|
||||||
if ($statName == 'battleOrder') {
|
|
||||||
if ($aux === null) throw new \RuntimeException('전투순위보정에 필요한 aux가 없습니다.');
|
|
||||||
/** @var General */
|
|
||||||
$attacker = $aux['attacker'];
|
|
||||||
$defenderCrewType = $defender->getCrewTypeObj();
|
|
||||||
$attackerCrewType = $attacker->getCrewTypeObj();
|
|
||||||
|
|
||||||
$attackerCoef = $attackerCrewType->getAttackCoef($defenderCrewType) * $defenderCrewType->getDefenceCoef($attackerCrewType);
|
|
||||||
$defenderCoef = $defenderCrewType->getAttackCoef($attackerCrewType) * $attackerCrewType->getDefenceCoef($defenderCrewType);
|
|
||||||
|
|
||||||
if ($attackerCoef < $defenderCoef) {
|
|
||||||
return $value * 4;
|
|
||||||
} else if ($attackerCoef > $defenderCoef) {
|
|
||||||
return $value / 2;
|
|
||||||
} else if ($attackerCrewType->armType == $defenderCrewType->armType) {
|
|
||||||
return $value * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onCalcOpposeStat(General $defender, string $statName, $value, $aux = null)
|
|
||||||
{
|
|
||||||
//공격자 입장에서 coef가 높다면 전투순위를 높인다.
|
|
||||||
if ($statName == 'battleOrder') {
|
|
||||||
if ($aux === null) throw new \RuntimeException('전투순위보정에 필요한 aux가 없습니다.');
|
|
||||||
/** @var General */
|
|
||||||
$attacker = $aux['attacker'];
|
|
||||||
$defenderCrewType = $defender->getCrewTypeObj();
|
|
||||||
$attackerCrewType = $attacker->getCrewTypeObj();
|
|
||||||
|
|
||||||
$attackerCoef = $attackerCrewType->getAttackCoef($defenderCrewType) * $defenderCrewType->getDefenceCoef($attackerCrewType);
|
|
||||||
$defenderCoef = $defenderCrewType->getAttackCoef($attackerCrewType) * $attackerCrewType->getDefenceCoef($defenderCrewType);
|
|
||||||
|
|
||||||
if ($attackerCoef > $defenderCoef) {
|
|
||||||
return $value * 4;
|
|
||||||
} else if ($attackerCoef < $defenderCoef) {
|
|
||||||
return $value / 2;
|
|
||||||
} else if ($attackerCrewType->armType == $defenderCrewType->armType) {
|
|
||||||
return $value * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_징병비용무시 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
|
||||||
{
|
|
||||||
if ($varType == 'cost' && in_array($turnType, ['징병', '모병'])) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\ActionBuff;
|
|
||||||
|
|
||||||
use \sammo\iAction;
|
|
||||||
|
|
||||||
class g65_징병인구무시 implements iAction
|
|
||||||
{
|
|
||||||
use \sammo\DefaultAction;
|
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux = null): float
|
|
||||||
{
|
|
||||||
if ($turnType == '징집인구' && $varType == 'score') {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ class che_오두미도 extends \sammo\BaseNation{
|
|||||||
protected $name = '오두미도';
|
protected $name = '오두미도';
|
||||||
protected $info = '';
|
protected $info = '';
|
||||||
static $pros = '쌀수입↑ 인구↑';
|
static $pros = '쌀수입↑ 인구↑';
|
||||||
static $cons = '기술↓ 수성↓ 내정↓';
|
static $cons = '기술↓ 수성↓ 농상↓';
|
||||||
|
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
@@ -40,4 +40,4 @@ class che_오두미도 extends \sammo\BaseNation{
|
|||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class che_유가 extends \sammo\BaseNation{
|
|||||||
|
|
||||||
protected $name = '유가';
|
protected $name = '유가';
|
||||||
protected $info = '';
|
protected $info = '';
|
||||||
static $pros = '내정↑ 민심↑';
|
static $pros = '농상↑ 민심↑';
|
||||||
static $cons = '쌀수입↓';
|
static $cons = '쌀수입↓';
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
@@ -31,4 +31,4 @@ class che_유가 extends \sammo\BaseNation{
|
|||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class che_음양가 extends \sammo\BaseNation{
|
|||||||
|
|
||||||
protected $name = '음양가';
|
protected $name = '음양가';
|
||||||
protected $info = '';
|
protected $info = '';
|
||||||
static $pros = '내정↑ 인구↑';
|
static $pros = '농상↑ 인구↑';
|
||||||
static $cons = '기술↓ 전략↓';
|
static $cons = '기술↓ 전략↓';
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
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){
|
if($type == 'pop' && $amount > 0){
|
||||||
return $amount * 1.2;
|
return $amount * 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $amount;
|
return $amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||||
if($varType == 'delay'){
|
if($varType == 'delay'){
|
||||||
return $value * 2;
|
return Util::round($value * 4 / 3);
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class che_종횡가 extends \sammo\BaseNation{
|
|||||||
protected $name = '종횡가';
|
protected $name = '종횡가';
|
||||||
protected $info = '';
|
protected $info = '';
|
||||||
static $pros = '전략↑ 수성↑';
|
static $pros = '전략↑ 수성↑';
|
||||||
static $cons = '금수입↓ 내정↓';
|
static $cons = '금수입↓ 농상↓';
|
||||||
|
|
||||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||||
if($turnType == '수비' || $turnType == '성벽'){
|
if($turnType == '수비' || $turnType == '성벽'){
|
||||||
@@ -42,4 +42,4 @@ class che_종횡가 extends \sammo\BaseNation{
|
|||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class che_강행 extends Command\GeneralCommand
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ class che_거병 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class che_건국 extends Command\GeneralCommand
|
|||||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class che_견문 extends Command\GeneralCommand{
|
|||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class che_군량매매 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class che_귀환 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class che_기술연구 extends che_상업투자{
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ class che_단련 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar($incStat, 1);
|
$general->increaseVar($incStat, 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class che_등용 extends Command\GeneralCommand
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class che_랜덤임관 extends Command\GeneralCommand
|
|||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '랜덤 임관');
|
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '랜덤 임관');
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ class che_무작위건국 extends Command\GeneralCommand
|
|||||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class che_물자조달 extends Command\GeneralCommand{
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class che_사기진작 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ class che_상업투자 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class che_숙련전환 extends Command\GeneralCommand
|
|||||||
$general->increaseVar('leadership_exp', 2);
|
$general->increaseVar('leadership_exp', 2);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class che_은퇴 extends Command\GeneralCommand{
|
|||||||
$logger->pushGeneralActionLog("은퇴하였습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("은퇴하였습니다. <1>$date</>");
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class che_이동 extends Command\GeneralCommand
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class che_인재탐색 extends Command\GeneralCommand
|
|||||||
$general->increaseVar($incStat, 1);
|
$general->increaseVar($incStat, 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ class che_인재탐색 extends Command\GeneralCommand
|
|||||||
$general->increaseVar($incStat, 3);
|
$general->increaseVar($incStat, 3);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class che_임관 extends Command\GeneralCommand
|
|||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ class che_장비매매 extends Command\GeneralCommand
|
|||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class che_장수대상임관 extends Command\GeneralCommand{
|
|||||||
$general->addExperience($exp);
|
$general->addExperience($exp);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class che_전투태세 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 3);
|
$general->increaseVar('leadership_exp', 3);
|
||||||
$this->setResultTurn($turnResult);
|
$this->setResultTurn($turnResult);
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class che_전투특기초기화 extends Command\GeneralCommand{
|
|||||||
$logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date</>");
|
$logger->pushGeneralActionLog("새로운 {$specialName}를 가질 준비가 되었습니다. <1>$date</>");
|
||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ class che_접경귀환 extends Command\GeneralCommand{
|
|||||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다.");
|
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다.");
|
||||||
$general->setVar('city', $destCityID);
|
$general->setVar('city', $destCityID);
|
||||||
|
|
||||||
$general->setRawCity(null);
|
|
||||||
|
|
||||||
//TODO: InstantAction일때에만 설정하지 않는게 나은데..
|
//TODO: InstantAction일때에만 설정하지 않는게 나은데..
|
||||||
//$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
//$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ class che_정착장려 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ class che_주민선정 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar(static::$statKey.'_exp', 1);
|
$general->increaseVar(static::$statKey.'_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class che_증여 extends Command\GeneralCommand
|
|||||||
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
|
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
$destGeneral->applyDB($db);
|
$destGeneral->applyDB($db);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class che_집합 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ class che_징병 extends Command\GeneralCommand
|
|||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
$general->setAuxVar('armType', $reqCrewType->armType);
|
$general->setAuxVar('armType', $reqCrewType->armType);
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ class che_출병 extends Command\GeneralCommand
|
|||||||
|
|
||||||
processWar($warRngSeed, $general, $this->nation, $this->destCity);
|
processWar($warRngSeed, $general, $this->nation, $this->destCity);
|
||||||
|
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class che_헌납 extends Command\GeneralCommand
|
|||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
|
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class che_훈련 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class cr_건국 extends Command\GeneralCommand
|
|||||||
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
$general->increaseInheritancePoint(InheritanceKey::active_action, 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general), $general, '건국');
|
tryUniqueItemLottery(genGenericUniqueRNGFromGeneral($general, static::$actionName), $general, '건국');
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class cr_맹훈련 extends Command\GeneralCommand{
|
|||||||
$general->increaseVar('leadership_exp', 1);
|
$general->increaseVar('leadership_exp', 1);
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$general->checkStatChange();
|
$general->checkStatChange();
|
||||||
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general), $general);
|
tryUniqueItemLottery(\sammo\genGenericUniqueRNGFromGeneral($general, static::$actionName), $general);
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\Util;
|
|
||||||
|
|
||||||
class g65_군량급매 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '군량급매';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '군량 급매';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "금/쌀 동등화(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
//아무것도 하지 않음
|
|
||||||
$this->fullConditionConstraints=[];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
$general = $this->generalObj;
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$gold = $general->getVar('gold');
|
|
||||||
$rice = $general->getVar('rice');
|
|
||||||
|
|
||||||
$avg = Util::toInt(($gold + $rice + 1) / 2);
|
|
||||||
$general->setVar('gold', $avg);
|
|
||||||
$general->setVar('rice', $avg);
|
|
||||||
|
|
||||||
$logger = $this->generalObj->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("지나가는 상인과 금과 쌀을 거래합니다. <1>$date</>");
|
|
||||||
$general->applyDB(DB::db());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_사기40;
|
|
||||||
use \sammo\Command;
|
|
||||||
|
|
||||||
class g65_병사연회 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '병사연회';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '병사 연회';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "3턴 간 사기 +40(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
//아무것도 하지 않음
|
|
||||||
$this->fullConditionConstraints=[];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_사기40(), 3);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("병사에게 연회를 열어 3턴간 사기가 40 상승합니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_징병비용무시;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
|
|
||||||
class g65_병장기지원 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '병장기지원';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '병장기 지원';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "이번턴의 징병/모병 비용 무시(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral(),
|
|
||||||
ConstraintHelper::OccupiedCity()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_징병비용무시(), 1);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("상인에게 병사들의 병장기를 지원받습니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_전투순위보정;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
|
|
||||||
class g65_약점간파 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '약점간파';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '약점 간파';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "1턴동안 유리한 병종과 상대할 가능성 대폭 증가(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_전투순위보정(), 1);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("상대진영의 약점을 꿰뚫어 유리한 상대를 찾습니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\DB;
|
|
||||||
|
|
||||||
class g65_의원소환 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '의원 소환';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '의원 소환';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "부상 시 치료(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
//아무것도 하지 않음
|
|
||||||
$this->fullConditionConstraints=[];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
$general = $this->generalObj;
|
|
||||||
if($general->getVar('injury') == 0){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$general->setVar('injury', 0);
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $this->generalObj->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("의원을 불러 부상을 치료합니다. <1>$date</>");
|
|
||||||
$general->applyDB(DB::db());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_징병인구무시;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
|
|
||||||
class g65_입대독려 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '입대독려';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '입대 독려';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "이번턴의 징병/모병 인구 무시(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral(),
|
|
||||||
ConstraintHelper::OccupiedCity()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_징병인구무시(), 1);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("성 밖의 주민들에게 입대를 요청합니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\CityConst;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\JosaUtil;
|
|
||||||
|
|
||||||
use function sammo\searchDistance;
|
|
||||||
|
|
||||||
class g65_접경귀환 extends Command\UserActionCommand
|
|
||||||
{
|
|
||||||
static protected $actionName = '접경귀환';
|
|
||||||
|
|
||||||
protected function argTest(): bool
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '접경 귀환';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "적군 도시 소재 시 접경으로 귀환(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init()
|
|
||||||
{
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral(),
|
|
||||||
ConstraintHelper::NotWanderingNation(),
|
|
||||||
ConstraintHelper::NotOccupiedCity()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn(): int
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn(): int
|
|
||||||
{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost(): array
|
|
||||||
{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng): bool
|
|
||||||
{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$cityID = $general->getCityID();
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
|
|
||||||
$distanceList = searchDistance($cityID, 3, true);
|
|
||||||
|
|
||||||
$occupiedCityList = new \Ds\Set($db->queryFirstColumn(
|
|
||||||
'SELECT city FROM city WHERE nation = %i AND city IN %li AND supply = 1',
|
|
||||||
$general->getNationID(),
|
|
||||||
array_merge(...$distanceList)
|
|
||||||
));
|
|
||||||
|
|
||||||
$nearestCityList = [];
|
|
||||||
foreach ($distanceList as $cityList) {
|
|
||||||
foreach ($cityList as $cityID) {
|
|
||||||
if ($occupiedCityList->contains($cityID)) {
|
|
||||||
$nearestCityList[] = $cityID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($nearestCityList) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$nearestCityList) {
|
|
||||||
$logger->pushGeneralActionLog("3칸 이내에 아국 도시가 없습니다.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$destCityID = $rng->choice($nearestCityList);
|
|
||||||
$destCityName = CityConst::byID($destCityID)->name;
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$josaRo = JosaUtil::pick($destCityName, '로');
|
|
||||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다. <1>$date</>");
|
|
||||||
$general->setVar('city', $destCityID);
|
|
||||||
|
|
||||||
$general->setRawCity(null);
|
|
||||||
|
|
||||||
|
|
||||||
$general->applyDB($db);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_내정성공;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
|
|
||||||
class g65_철야내정 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '철야내정';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '철야 내정';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "2턴 간 내정 항상 성공(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral(),
|
|
||||||
ConstraintHelper::OccupiedCity()
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_내정성공(), 2);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("2턴 간 내정을 철저히 지휘합니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use sammo\ActionBuff\g65_계략성공;
|
|
||||||
use \sammo\Command;
|
|
||||||
use sammo\Constraint\ConstraintHelper;
|
|
||||||
|
|
||||||
class g65_필중계략 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '신산귀모';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBrief(): string
|
|
||||||
{
|
|
||||||
return '신산귀모';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
|
||||||
{
|
|
||||||
$postReqTurn = $this->getPostReqTurn();
|
|
||||||
return "이번 턴의 계략 성공률 대폭 향상(재사용 대기 {$postReqTurn})";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
$this->setCity();
|
|
||||||
$this->setNation();
|
|
||||||
|
|
||||||
$env = $this->env;
|
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
|
||||||
ConstraintHelper::NotBeNeutral(),
|
|
||||||
ConstraintHelper::OccupiedCity(),
|
|
||||||
ConstraintHelper::NotOpeningPart($relYear),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
if (!$this->hasFullConditionMet()) {
|
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
|
||||||
}
|
|
||||||
|
|
||||||
$general = $this->generalObj;
|
|
||||||
$general->addInstantBuff(new g65_계략성공(), 1);
|
|
||||||
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
$logger->pushGeneralActionLog("이번 턴의 계략을 집중합니다. <1>$date</>");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo\Command\UserAction;
|
|
||||||
|
|
||||||
use \sammo\Command;
|
|
||||||
use \sammo\Util;
|
|
||||||
use \sammo\JosaUtil;
|
|
||||||
use sammo\LastTurn;
|
|
||||||
|
|
||||||
class 휴식 extends Command\UserActionCommand{
|
|
||||||
static protected $actionName = '휴식';
|
|
||||||
|
|
||||||
protected function argTest():bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function init(){
|
|
||||||
//아무것도 하지 않음
|
|
||||||
$this->fullConditionConstraints=[];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPostReqTurn():int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getCost():array{
|
|
||||||
return [0, 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function run(\Sammo\RandUtil $rng):bool{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\Command;
|
|
||||||
|
|
||||||
use \sammo\Util;
|
|
||||||
|
|
||||||
abstract class UserActionCommand extends BaseCommand
|
|
||||||
{
|
|
||||||
const USER_ACTION_KEY = 'user_action';
|
|
||||||
|
|
||||||
public function getNextExecuteKey(): string
|
|
||||||
{
|
|
||||||
//NOTE: 일반 턴 체계와 다르므로 쓸 일은 없음
|
|
||||||
$turnKey = static::$actionName;
|
|
||||||
$userActionKey = static::USER_ACTION_KEY;
|
|
||||||
$generalID = $this->getGeneral()->getID();
|
|
||||||
$executeKey = "next_execute_{$generalID}_{$userActionKey}_{$turnKey}";
|
|
||||||
return $executeKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNextAvailableTurn(): ?int
|
|
||||||
{
|
|
||||||
if ($this->isArgValid && !$this->getPostReqTurn()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$rawUserAction = $this->generalObj->getAuxVar(static::USER_ACTION_KEY);
|
|
||||||
if ($rawUserAction === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$userAction = \sammo\DTO\UserAction::fromArray($rawUserAction);
|
|
||||||
$nextAvailableTurn = $userAction->nextAvailableTurn;
|
|
||||||
if ($nextAvailableTurn === null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$nextAvailableTurn = $nextAvailableTurn[static::$actionName] ?? null;
|
|
||||||
return $nextAvailableTurn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setNextAvailable(?int $yearMonth = null)
|
|
||||||
{
|
|
||||||
if (!$this->getPostReqTurn()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$rawUserAction = $this->generalObj->getAuxVar(static::USER_ACTION_KEY);
|
|
||||||
if ($rawUserAction === null) {
|
|
||||||
$rawUserAction = [];
|
|
||||||
}
|
|
||||||
$userAction = \sammo\DTO\UserAction::fromArray($rawUserAction);
|
|
||||||
|
|
||||||
if ($userAction->nextAvailableTurn === null) {
|
|
||||||
$userAction->nextAvailableTurn = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($yearMonth === null) {
|
|
||||||
$yearMonth = Util::joinYearMonth($this->env['year'], $this->env['month'])
|
|
||||||
+ $this->getPostReqTurn() - $this->getPreReqTurn();
|
|
||||||
}
|
|
||||||
$userAction->nextAvailableTurn[static::$actionName] = $yearMonth;
|
|
||||||
$this->generalObj->setAuxVar(static::USER_ACTION_KEY, $userAction->toArray());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\DTO;
|
|
||||||
|
|
||||||
use LDTO\DTO;
|
|
||||||
|
|
||||||
class InstantBuff extends DTO{
|
|
||||||
public function __construct(
|
|
||||||
public readonly string $buffName,
|
|
||||||
public readonly int $untilYearMonth,
|
|
||||||
){
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\DTO;
|
|
||||||
|
|
||||||
use LDTO\Attr\Convert;
|
|
||||||
use LDTO\Converter\ArrayConverter;
|
|
||||||
use LDTO\Converter\MapConverter;
|
|
||||||
use LDTO\DTO;
|
|
||||||
|
|
||||||
|
|
||||||
class UserAction extends \LDTO\DTO
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param UserActionItem[] $active
|
|
||||||
* @param Array<int,UserActionItem> $reserved
|
|
||||||
* @param Array<string,int> $nextAvailableTurn
|
|
||||||
* */
|
|
||||||
public function __construct(
|
|
||||||
|
|
||||||
#[Convert(MapConverter::class, [UserActionItem::class])]
|
|
||||||
public ?array $reserved,
|
|
||||||
#[Convert(MapConverter::class, ['int'])]
|
|
||||||
public ?array $nextAvailableTurn,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\DTO;
|
|
||||||
|
|
||||||
class UserActionItem extends \LDTO\DTO {
|
|
||||||
public function __construct(
|
|
||||||
public string $command,
|
|
||||||
public string $brief,
|
|
||||||
#[\LDTO\Attr\NullIsUndefined]
|
|
||||||
public ?int $untilYearMonth,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\Enums;
|
|
||||||
|
|
||||||
enum GeneralAuxKey: string{
|
|
||||||
case instantBuffList = 'instantBuffList';
|
|
||||||
}
|
|
||||||
@@ -67,12 +67,14 @@ class RaiseInvader extends \sammo\Event\Action
|
|||||||
|
|
||||||
foreach ($db->queryAllLists('SELECT capital, nation from nation WHERE capital in %li', $cities) as $row) {
|
foreach ($db->queryAllLists('SELECT capital, nation from nation WHERE capital in %li', $cities) as $row) {
|
||||||
[$oldCapital, $nation] = $row;
|
[$oldCapital, $nation] = $row;
|
||||||
$capitalCandidates = $db->queryFirstColumn('SELECT from city WHERE nation = %i AND city != %i', $nation);
|
$capitalCandidates = $db->queryFirstColumn('SELECT city from city WHERE nation = %i AND city != %i NOT IN %li', $nation, $oldCapital, $cities);
|
||||||
if (!$capitalCandidates) {
|
if (!$capitalCandidates) {
|
||||||
$disabledInvaderCity->add($oldCapital);
|
$disabledInvaderCity->add($oldCapital);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newCapital = $rng->choice($capitalCandidates);
|
$newCapital = $rng->choice($capitalCandidates);
|
||||||
|
|
||||||
$db->update('nation', ['capital' => $newCapital], 'nation=%i', $nation);
|
$db->update('nation', ['capital' => $newCapital], 'nation=%i', $nation);
|
||||||
$db->update('general', ['city' => $newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
|
$db->update('general', ['city' => $newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,14 +216,14 @@ class GameConstBase
|
|||||||
|
|
||||||
public static $minMonthToAllowInheritItem = 4;
|
public static $minMonthToAllowInheritItem = 4;
|
||||||
public static $inheritBornSpecialPoint = 6000;
|
public static $inheritBornSpecialPoint = 6000;
|
||||||
public static $inheritBornTurntimePoint = 3000;
|
public static $inheritBornTurntimePoint = 2500;
|
||||||
public static $inheritBornCityPoint = 1000;
|
public static $inheritBornCityPoint = 1000;
|
||||||
public static $inheritBornStatPoint = 1000;
|
public static $inheritBornStatPoint = 1000;
|
||||||
public static $inheritItemUniqueMinPoint = 5000;
|
public static $inheritItemUniqueMinPoint = 5000;
|
||||||
public static $inheritItemRandomPoint = 3000;
|
public static $inheritItemRandomPoint = 3000;
|
||||||
public static $inheritBuffPoints = [0, 200, 600, 1200, 2000, 3000];
|
public static $inheritBuffPoints = [0, 200, 600, 1200, 2000, 3000];
|
||||||
public static $inheritSpecificSpecialPoint = 4000;
|
public static $inheritSpecificSpecialPoint = 4000;
|
||||||
public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000]; //필요하면 늘려서 쓰기
|
public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000];//필요하면 늘려서 쓰기
|
||||||
|
|
||||||
/** @var ?string */
|
/** @var ?string */
|
||||||
public static $scenarioEffect = null;
|
public static $scenarioEffect = null;
|
||||||
@@ -246,7 +246,7 @@ class GameConstBase
|
|||||||
'che_명마_07_백마' => 2, 'che_명마_07_기주마' => 2, 'che_명마_07_오환마' => 2, 'che_명마_07_백상' => 2,
|
'che_명마_07_백마' => 2, 'che_명마_07_기주마' => 2, 'che_명마_07_오환마' => 2, 'che_명마_07_백상' => 2,
|
||||||
'che_명마_08_양주마' => 2, 'che_명마_08_흉노마' => 2, 'che_명마_09_과하마' => 2, 'che_명마_09_의남백마' => 2,
|
'che_명마_08_양주마' => 2, 'che_명마_08_흉노마' => 2, 'che_명마_09_과하마' => 2, 'che_명마_09_의남백마' => 2,
|
||||||
'che_명마_10_대완마' => 2, 'che_명마_10_옥추마' => 2, 'che_명마_11_서량마' => 2, 'che_명마_11_화종마' => 2,
|
'che_명마_10_대완마' => 2, 'che_명마_10_옥추마' => 2, 'che_명마_11_서량마' => 2, 'che_명마_11_화종마' => 2,
|
||||||
'che_명마_12_사륜거' => 2, 'che_명마_12_옥란백용구' => 2, 'che_명마_13_절영' => 2, 'che_명마_13_적로' => 2,
|
'che_명마_12_사륜거' => 2, 'che_명마_12_옥란백용구'=> 2, 'che_명마_13_절영' => 2, 'che_명마_13_적로' => 2,
|
||||||
'che_명마_14_적란마' => 2, 'che_명마_14_조황비전' => 2, 'che_명마_15_한혈마' => 2, 'che_명마_15_적토마' => 2,
|
'che_명마_14_적란마' => 2, 'che_명마_14_조황비전' => 2, 'che_명마_15_한혈마' => 2, 'che_명마_15_적토마' => 2,
|
||||||
],
|
],
|
||||||
'weapon' => [
|
'weapon' => [
|
||||||
@@ -278,7 +278,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, '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,
|
||||||
@@ -318,7 +318,6 @@ class GameConstBase
|
|||||||
'che_치안강화',
|
'che_치안강화',
|
||||||
'che_정착장려',
|
'che_정착장려',
|
||||||
'che_주민선정',
|
'che_주민선정',
|
||||||
'che_물자조달',
|
|
||||||
],
|
],
|
||||||
'군사' => [
|
'군사' => [
|
||||||
'che_징병',
|
'che_징병',
|
||||||
@@ -349,6 +348,7 @@ class GameConstBase
|
|||||||
'국가' => [
|
'국가' => [
|
||||||
'che_증여',
|
'che_증여',
|
||||||
'che_헌납',
|
'che_헌납',
|
||||||
|
'che_물자조달',
|
||||||
'che_하야',
|
'che_하야',
|
||||||
'che_거병',
|
'che_거병',
|
||||||
'che_건국',
|
'che_건국',
|
||||||
@@ -395,23 +395,6 @@ class GameConstBase
|
|||||||
'che_국호변경',
|
'che_국호변경',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var array 개인 전략 커맨드 */
|
|
||||||
public static $availableUserActionCommand = [
|
|
||||||
'개인 전략' => [
|
|
||||||
'휴식',
|
|
||||||
'g65_의원소환',
|
|
||||||
'g65_철야내정',
|
|
||||||
'g65_군량급매',
|
|
||||||
'g65_접경귀환',
|
|
||||||
'g65_필중계략',
|
|
||||||
'g65_병장기지원',
|
|
||||||
'g65_입대독려',
|
|
||||||
'g65_병사연회',
|
|
||||||
'g65_약점간파',
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
public static $retirementYear = 80;
|
public static $retirementYear = 80;
|
||||||
|
|
||||||
public static $targetGeneralPool = 'RandomNameGeneral';
|
public static $targetGeneralPool = 'RandomNameGeneral';
|
||||||
|
|||||||
+3
-111
@@ -4,10 +4,7 @@ namespace sammo;
|
|||||||
|
|
||||||
use Ds\Map;
|
use Ds\Map;
|
||||||
use sammo\Command\GeneralCommand;
|
use sammo\Command\GeneralCommand;
|
||||||
use sammo\Command\UserActionCommand;
|
|
||||||
use sammo\DTO\InstantBuff;
|
|
||||||
use sammo\Enums\GeneralAccessLogColumn;
|
use sammo\Enums\GeneralAccessLogColumn;
|
||||||
use sammo\Enums\GeneralAuxKey;
|
|
||||||
use sammo\Enums\GeneralQueryMode;
|
use sammo\Enums\GeneralQueryMode;
|
||||||
use sammo\Enums\InheritanceKey;
|
use sammo\Enums\InheritanceKey;
|
||||||
use sammo\Enums\RankColumn;
|
use sammo\Enums\RankColumn;
|
||||||
@@ -48,9 +45,6 @@ class General extends GeneralBase implements iAction
|
|||||||
/** @var ?iAction */
|
/** @var ?iAction */
|
||||||
protected $scenarioEffect = null;
|
protected $scenarioEffect = null;
|
||||||
|
|
||||||
/** @var iAction[] */
|
|
||||||
protected $instantBuffList = [];
|
|
||||||
|
|
||||||
/** @var ?GameUnitDetail */
|
/** @var ?GameUnitDetail */
|
||||||
protected $crewType = null;
|
protected $crewType = null;
|
||||||
|
|
||||||
@@ -59,9 +53,6 @@ class General extends GeneralBase implements iAction
|
|||||||
|
|
||||||
protected $calcCache = [];
|
protected $calcCache = [];
|
||||||
|
|
||||||
/** @var int */
|
|
||||||
protected $yearMonth;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $raw DB row값.
|
* @param array $raw DB row값.
|
||||||
* @param null|Map<RankColumn,int|float> $rawRank
|
* @param null|Map<RankColumn,int|float> $rawRank
|
||||||
@@ -81,8 +72,6 @@ class General extends GeneralBase implements iAction
|
|||||||
$this->raw = $raw;
|
$this->raw = $raw;
|
||||||
$this->rawCity = $city;
|
$this->rawCity = $city;
|
||||||
|
|
||||||
$this->yearMonth = Util::joinYearMonth($year, $month);
|
|
||||||
|
|
||||||
$this->resultTurn = new LastTurn();
|
$this->resultTurn = new LastTurn();
|
||||||
if (key_exists('last_turn', $this->raw)) {
|
if (key_exists('last_turn', $this->raw)) {
|
||||||
$this->lastTurn = LastTurn::fromJson($this->raw['last_turn']);
|
$this->lastTurn = LastTurn::fromJson($this->raw['last_turn']);
|
||||||
@@ -126,63 +115,6 @@ class General extends GeneralBase implements iAction
|
|||||||
if(GameConst::$scenarioEffect){
|
if(GameConst::$scenarioEffect){
|
||||||
$this->scenarioEffect = buildScenarioEffectClass(GameConst::$scenarioEffect);
|
$this->scenarioEffect = buildScenarioEffectClass(GameConst::$scenarioEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->refreshInstantBuff(Util::joinYearMonth($year, $month));
|
|
||||||
}
|
|
||||||
|
|
||||||
function refreshInstantBuff(){
|
|
||||||
$this->instantBuffList = [];
|
|
||||||
$rawBuffList = $this->getAuxVar(GeneralAuxKey::instantBuffList);
|
|
||||||
if($rawBuffList === null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($rawBuffList as $rawBuff){
|
|
||||||
$buffItem = InstantBuff::fromArray($rawBuff);
|
|
||||||
$this->instantBuffList[] = buildBuffClass($buffItem->buffName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//기한이 지난 버프를 삭제
|
|
||||||
function clearExpiredBuff()
|
|
||||||
{
|
|
||||||
$this->instantBuffList = [];
|
|
||||||
$rawBuffList = $this->getAuxVar(GeneralAuxKey::instantBuffList);
|
|
||||||
if($rawBuffList === null){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$newRawBuffList = [];
|
|
||||||
$reqUpdate = false;
|
|
||||||
|
|
||||||
foreach($rawBuffList as $rawBuff){
|
|
||||||
$buffItem = InstantBuff::fromArray($rawBuff);
|
|
||||||
if($buffItem->untilYearMonth < $this->yearMonth){
|
|
||||||
$reqUpdate = true;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$newRawBuffList[] = $rawBuff;
|
|
||||||
$this->instantBuffList[] = buildBuffClass($buffItem->buffName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($reqUpdate){
|
|
||||||
$this->setAuxVar(GeneralAuxKey::instantBuffList, $newRawBuffList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function addInstantBuff(iAction $buffObj, int $month){
|
|
||||||
$this->instantBuffList[] = $buffObj;
|
|
||||||
|
|
||||||
$untilYearMonth = $this->yearMonth + $month - 1;
|
|
||||||
$buffItem = new InstantBuff(Util::getClassName($buffObj::class), $untilYearMonth);
|
|
||||||
$rawBuffList = $this->getAuxVar(GeneralAuxKey::instantBuffList);
|
|
||||||
if($rawBuffList === null){
|
|
||||||
$rawBuffList = [];
|
|
||||||
}
|
|
||||||
$rawBuffList[] = $buffItem->toArray();
|
|
||||||
$this->setAuxVar(GeneralAuxKey::instantBuffList, $rawBuffList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setItem(string $itemKey = 'item', ?string $itemCode)
|
function setItem(string $itemKey = 'item', ?string $itemCode)
|
||||||
@@ -337,46 +269,6 @@ class General extends GeneralBase implements iAction
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReservedUserAction(array $env): ?UserActionCommand
|
|
||||||
{
|
|
||||||
$rawUserAction = $this->getAuxVar(UserActionCommand::USER_ACTION_KEY);
|
|
||||||
if(!$rawUserAction){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$userAction = \sammo\DTO\UserAction::fromArray($rawUserAction);
|
|
||||||
if(!$userAction->reserved){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$reservedAction = $userAction->reserved;
|
|
||||||
if(!key_exists(0, $reservedAction)){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$action = $reservedAction[0];
|
|
||||||
return buildUserActionCommandClass($action->command, $this, $env);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pullUserAction(){
|
|
||||||
$rawUserAction = $this->getAuxVar(UserActionCommand::USER_ACTION_KEY);
|
|
||||||
if(!$rawUserAction){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$userAction = \sammo\DTO\UserAction::fromArray($rawUserAction);
|
|
||||||
if(!$userAction->reserved){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$reservedAction = $userAction->reserved;
|
|
||||||
|
|
||||||
$newReservedAction = [];
|
|
||||||
foreach($reservedAction as $idx => $action){
|
|
||||||
if($idx <= 0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$newReservedAction[$idx - 1] = $action;
|
|
||||||
}
|
|
||||||
$userAction->reserved = $newReservedAction;
|
|
||||||
$this->setAuxVar(UserActionCommand::USER_ACTION_KEY, $userAction->toArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReservedTurn(int $turnIdx, array $env): GeneralCommand
|
function getReservedTurn(int $turnIdx, array $env): GeneralCommand
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
@@ -473,14 +365,14 @@ class General extends GeneralBase implements iAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->calcCache[$cKey] = $statValue;
|
|
||||||
|
|
||||||
$statValue = Util::clamp($statValue, 0, GameConst::$maxLevel);
|
$statValue = Util::clamp($statValue, 0, GameConst::$maxLevel);
|
||||||
|
|
||||||
if ($useFloor) {
|
if ($useFloor) {
|
||||||
return Util::toInt($statValue);
|
return Util::toInt($statValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->calcCache[$cKey] = $statValue;
|
||||||
|
|
||||||
return $statValue;
|
return $statValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +769,7 @@ class General extends GeneralBase implements iAction
|
|||||||
$this->crewType,
|
$this->crewType,
|
||||||
$this->inheritBuffObj,
|
$this->inheritBuffObj,
|
||||||
$this->scenarioEffect
|
$this->scenarioEffect
|
||||||
], $this->itemObjs, $this->instantBuffList);
|
], $this->itemObjs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreTurnExecuteTriggerList(General $general): ?GeneralTriggerCaller
|
public function getPreTurnExecuteTriggerList(General $general): ?GeneralTriggerCaller
|
||||||
|
|||||||
+35
-20
@@ -82,8 +82,9 @@ class GeneralAI
|
|||||||
const d직전 = 3;
|
const d직전 = 3;
|
||||||
const d전쟁 = 4;
|
const d전쟁 = 4;
|
||||||
|
|
||||||
protected function updateInstance(): void{
|
protected function updateInstance(): void
|
||||||
if(!$this->reqUpdateInstance){
|
{
|
||||||
|
if (!$this->reqUpdateInstance) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,11 +216,10 @@ class GeneralAI
|
|||||||
);
|
);
|
||||||
|
|
||||||
if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
if ($yearMonth <= Util::joinYearMonth($env['startyear'] + 2, 5)) {
|
||||||
if(!$warTarget){
|
if (!$warTarget) {
|
||||||
$this->dipState = self::d평화;
|
$this->dipState = self::d평화;
|
||||||
$this->attackable = false;
|
$this->attackable = false;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$this->dipState = self::d선포;
|
$this->dipState = self::d선포;
|
||||||
$this->attackable = false;
|
$this->attackable = false;
|
||||||
}
|
}
|
||||||
@@ -2992,7 +2992,7 @@ class GeneralAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->frontCities as $frontCity) {
|
foreach ($this->frontCities as $frontCity) {
|
||||||
if(!$frontCity['supply']){
|
if (!$frontCity['supply']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$candidateCities[$frontCity['city']] = $frontCity['important'];
|
$candidateCities[$frontCity['city']] = $frontCity['important'];
|
||||||
@@ -3120,6 +3120,11 @@ class GeneralAI
|
|||||||
{
|
{
|
||||||
$db = DB::db();
|
$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;
|
$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');
|
$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');
|
$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))) {
|
if ($this->rng->nextBool(pow(1 / ($nationCnt + 1) / pow($notFullNationCnt, 3), 1 / 4))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
//임관 기간이 끝나면 고정 확률로 낮춤 0.3 * 0.5 = 0.15
|
//임관 기간이 끝나면 고정 확률로 낮춤 0.3 * 0.5 = 0.15
|
||||||
if ($this->rng->nextBool()){
|
if ($this->rng->nextBool()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3439,8 +3443,12 @@ class GeneralAI
|
|||||||
|
|
||||||
$cmd = buildGeneralCommandClass($this->rng->choice($candidate), $this->general, $this->env);
|
$cmd = buildGeneralCommandClass($this->rng->choice($candidate), $this->general, $this->env);
|
||||||
if (!$cmd->hasFullConditionMet()) {
|
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;
|
return $cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3477,7 +3485,7 @@ class GeneralAI
|
|||||||
}
|
}
|
||||||
if ($nationCity['front']) {
|
if ($nationCity['front']) {
|
||||||
$frontCities[$cityID] = $nationCity;
|
$frontCities[$cityID] = $nationCity;
|
||||||
} else if($nationCity['supply']) {
|
} else if ($nationCity['supply']) {
|
||||||
$backupCities[$cityID] = $nationCity;
|
$backupCities[$cityID] = $nationCity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3779,21 +3787,28 @@ class GeneralAI
|
|||||||
|
|
||||||
if ($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']) {
|
if ($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']) {
|
||||||
//방랑군 건국
|
//방랑군 건국
|
||||||
$result = $this->do건국();
|
$relYearMonth = Util::joinYearMonth($this->env['year'], $this->env['month']) - Util::joinYearMonth($this->env['init_year'], $this->env['init_month']);
|
||||||
if ($result !== null) {
|
|
||||||
$result->reason = 'do건국';
|
if ($relYearMonth > 1) {
|
||||||
return $result;
|
$result = $this->do건국();
|
||||||
|
if ($result !== null) {
|
||||||
|
$result->reason = 'do건국';
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->do방랑군이동();
|
$result = $this->do방랑군이동();
|
||||||
if ($result !== null) {
|
if ($result !== null) {
|
||||||
$result->reason = 'do방랑군이동';
|
$result->reason = 'do방랑군이동';
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->do해산();
|
if ($relYearMonth > 1) {
|
||||||
if ($result !== null) {
|
$result = $this->do해산();
|
||||||
$result->reason = 'do해산';
|
if ($result !== null) {
|
||||||
return $result;
|
$result->reason = 'do해산';
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4035,7 +4050,7 @@ class GeneralAI
|
|||||||
if (!key_exists($chiefLevel, $this->chiefGenerals) && !key_exists($chiefLevel, $nextChiefs)) {
|
if (!key_exists($chiefLevel, $this->chiefGenerals) && !key_exists($chiefLevel, $nextChiefs)) {
|
||||||
$newChiefProb = 1;
|
$newChiefProb = 1;
|
||||||
} else {
|
} else {
|
||||||
$newChiefProb = $this->rng->nextBool(0.1)?1:0;
|
$newChiefProb = $this->rng->nextBool(0.1) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newChiefProb < 1 && !$this->rng->nextBool($newChiefProb)) {
|
if ($newChiefProb < 1 && !$this->rng->nextBool($newChiefProb)) {
|
||||||
|
|||||||
@@ -69,42 +69,6 @@ class TurnExecutionHelper
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processUserAction(RandUtil $rng, Command\UserActionCommand $commandObj): LastTurn{
|
|
||||||
$general = $this->getGeneral();
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (!$commandObj->hasFullConditionMet()) {
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
$failString = $commandObj->getFailString();
|
|
||||||
$text = "{$failString} <1>{$date}</>";
|
|
||||||
$general->getLogger()->pushGeneralActionLog($text);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$commandObj->addTermStack()) {
|
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
|
||||||
$termString = $commandObj->getTermString();
|
|
||||||
$text = "{$termString} <1>{$date}</>";
|
|
||||||
$general->getLogger()->pushGeneralActionLog($text);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $commandObj->run($rng);
|
|
||||||
if ($result) {
|
|
||||||
$commandObj->setNextAvailable();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$alt = $commandObj->getAlternativeCommand();
|
|
||||||
if ($alt === null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$commandObj = $alt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $commandObj->getResultTurn();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processNationCommand(RandUtil $rng, Command\NationCommand $commandObj): LastTurn
|
public function processNationCommand(RandUtil $rng, Command\NationCommand $commandObj): LastTurn
|
||||||
{
|
{
|
||||||
$general = $this->getGeneral();
|
$general = $this->getGeneral();
|
||||||
@@ -313,8 +277,6 @@ class TurnExecutionHelper
|
|||||||
|
|
||||||
$general->increaseInheritancePoint(InheritanceKey::lived_month, 1);
|
$general->increaseInheritancePoint(InheritanceKey::lived_month, 1);
|
||||||
|
|
||||||
$general->clearExpiredBuff();
|
|
||||||
|
|
||||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||||
UniqueConst::$hiddenSeed,
|
UniqueConst::$hiddenSeed,
|
||||||
'preprocess',
|
'preprocess',
|
||||||
@@ -361,12 +323,6 @@ class TurnExecutionHelper
|
|||||||
$general->setRawCity(null);
|
$general->setRawCity(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
$userActionObj = $general->getReservedUserAction($env);
|
|
||||||
if($userActionObj){
|
|
||||||
$turnObj->processUserAction($rng, $userActionObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$generalCommandObj = $general->getReservedTurn(0, $env);
|
$generalCommandObj = $general->getReservedTurn(0, $env);
|
||||||
if (!($generalCommandObj instanceof Command\General\휴식)) {
|
if (!($generalCommandObj instanceof Command\General\휴식)) {
|
||||||
$hasReservedTurn = true;
|
$hasReservedTurn = true;
|
||||||
@@ -392,7 +348,6 @@ class TurnExecutionHelper
|
|||||||
$turnObj->processCommand($rng, $generalCommandObj, $autorunMode);
|
$turnObj->processCommand($rng, $generalCommandObj, $autorunMode);
|
||||||
}
|
}
|
||||||
pullNationCommand($general->getVar('nation'), $general->getVar('officer_level'));
|
pullNationCommand($general->getVar('nation'), $general->getVar('officer_level'));
|
||||||
$general->pullUserAction();
|
|
||||||
pullGeneralCommand($general->getID());
|
pullGeneralCommand($general->getID());
|
||||||
|
|
||||||
$currentTurn = $general->getTurnTime();
|
$currentTurn = $general->getTurnTime();
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
{
|
|
||||||
"title":"【공백지】 개인전략",
|
|
||||||
"startYear":180,
|
|
||||||
"map":{
|
|
||||||
"mapName":"miniche"
|
|
||||||
},
|
|
||||||
"history":[
|
|
||||||
"<C>●</>180년 1월:<L><b>【공백지】</b></>별도의 전략을 사용할 수 있는 이벤트 깃수"
|
|
||||||
],
|
|
||||||
"const": {
|
|
||||||
"joinRuinedNPCProp":0,
|
|
||||||
"npcBanMessageProb":1,
|
|
||||||
"availableUserActionCommand":{
|
|
||||||
"개인 전략": [
|
|
||||||
"휴식",
|
|
||||||
"g65_의원소환",
|
|
||||||
"g65_철야내정",
|
|
||||||
"g65_군량급매",
|
|
||||||
"g65_접경귀환",
|
|
||||||
"g65_필중계략",
|
|
||||||
"g65_병장기지원",
|
|
||||||
"g65_입대독려",
|
|
||||||
"g65_병사연회",
|
|
||||||
"g65_약점간파"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"events":[
|
|
||||||
[
|
|
||||||
"month", 1000,
|
|
||||||
["or", ["Date", "==", null, 12], ["Date", "==", null, 6]],
|
|
||||||
["CreateManyNPC", 10, 10],
|
|
||||||
["DeleteEvent"]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"month", 1000,
|
|
||||||
["Date", "==", 181, 1],
|
|
||||||
["RaiseNPCNation"],
|
|
||||||
["DeleteEvent"]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"month", 999,
|
|
||||||
["Date", "==", 181, 1],
|
|
||||||
["OpenNationBetting", 4, 5000],
|
|
||||||
["OpenNationBetting", 1, 2000],
|
|
||||||
["DeleteEvent"]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"month", 999,
|
|
||||||
["and",
|
|
||||||
["Date", ">=", 183, 1],
|
|
||||||
["RemainNation", "<=", 8]
|
|
||||||
],
|
|
||||||
["OpenNationBetting", 1, 1000],
|
|
||||||
["DeleteEvent"]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"destroy_nation", 1000,
|
|
||||||
["and",
|
|
||||||
["Date", ">=", 183, 1],
|
|
||||||
["RemainNation", "==", 1]
|
|
||||||
],
|
|
||||||
["BlockScoutAction"],
|
|
||||||
["DeleteEvent"]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
+45
-80
@@ -186,58 +186,45 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
|
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
|
||||||
<div class="a-center">
|
<div class="row">
|
||||||
<label> <input v-model="inheritTurnTimeSet" type="checkbox" />턴 시간 고정 </label>
|
<div class="col col-6 a-right align-self-center">턴 시간 지정</div>
|
||||||
</div>
|
<div class="col col-6 align-self-center">
|
||||||
<div class="row turn_time_pad">
|
<select v-model.number="inheritTurnTimeZone" class="form-select form-inline" style="max-width: 24ch">
|
||||||
<div class="col col-lg-4 offset-lg-3 col-4 offset-3">
|
<option :value="undefined">사용안함</option>
|
||||||
<NumberInputWithInfo
|
<option v-for="(zone, idx) in turnTimeZoneList" :key="idx" :value="idx">
|
||||||
v-model="inheritTurnTimeMinute"
|
{{ zone }}
|
||||||
:readonly="!inheritTurnTimeSet"
|
</option>
|
||||||
:min="0"
|
</select>
|
||||||
: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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col col-lg-6 col-12 p-2">
|
<div class="col col-lg-6 col-sm-6 col-12 p-2 align-self-center">
|
||||||
<div class="a-center">추가 능력치 고정</div>
|
|
||||||
<div class="row">
|
<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">
|
<div class="col">
|
||||||
<NumberInputWithInfo
|
<NumberInputWithInfo
|
||||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]"
|
v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]"
|
||||||
:max="stats.bonusMax"
|
:max="stats.bonusMax"
|
||||||
title="통솔"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<NumberInputWithInfo
|
<NumberInputWithInfo
|
||||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]"
|
v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]"
|
||||||
:max="stats.bonusMax"
|
:max="stats.bonusMax"
|
||||||
title="무력"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<NumberInputWithInfo
|
<NumberInputWithInfo
|
||||||
v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]"
|
v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]"
|
||||||
:max="stats.bonusMax"
|
:max="stats.bonusMax"
|
||||||
title="지력"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -284,7 +271,7 @@ import TopBackBar from "@/components/TopBackBar.vue";
|
|||||||
import { getIconPath } from "@util/getIconPath";
|
import { getIconPath } from "@util/getIconPath";
|
||||||
import { isBrightColor } from "@util/isBrightColor";
|
import { isBrightColor } from "@util/isBrightColor";
|
||||||
import { abilityLeadint, abilityLeadpow, abilityPowint, abilityRand } from "@util/generalStats";
|
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 NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
||||||
import { SammoAPI } from "./SammoAPI";
|
import { SammoAPI } from "./SammoAPI";
|
||||||
import type { JoinArgs } from "./defs/API/General";
|
import type { JoinArgs } from "./defs/API/General";
|
||||||
@@ -378,7 +365,7 @@ watch(gameConstStore, (gameConst) => {
|
|||||||
inheritCity: undefined,
|
inheritCity: undefined,
|
||||||
inheritBonusStat: [0, 0, 0],
|
inheritBonusStat: [0, 0, 0],
|
||||||
inheritSpecial: undefined,
|
inheritSpecial: undefined,
|
||||||
inheritTurntime: undefined,
|
inheritTurntimeZone: undefined,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -462,7 +449,7 @@ const inheritRequiredPoint = computed(() => {
|
|||||||
if (args.value.inheritSpecial !== undefined) {
|
if (args.value.inheritSpecial !== undefined) {
|
||||||
inheritRequiredPoint += gameConst.inheritBornSpecialPoint;
|
inheritRequiredPoint += gameConst.inheritBornSpecialPoint;
|
||||||
}
|
}
|
||||||
if (args.value.inheritTurntime !== undefined) {
|
if (args.value.inheritTurntimeZone !== undefined) {
|
||||||
inheritRequiredPoint += gameConst.inheritBornTurntimePoint;
|
inheritRequiredPoint += gameConst.inheritBornTurntimePoint;
|
||||||
}
|
}
|
||||||
if (args.value.inheritBonusStat !== undefined && sum(args.value.inheritBonusStat) != 0) {
|
if (args.value.inheritBonusStat !== undefined && sum(args.value.inheritBonusStat) != 0) {
|
||||||
@@ -494,55 +481,37 @@ watch(inheritCity, (newValue: undefined | number) => {
|
|||||||
args.value.inheritCity = inheritCity.value;
|
args.value.inheritCity = inheritCity.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const inheritTurnTimeSet = ref(false);
|
|
||||||
watch(inheritTurnTimeSet, (newValue: boolean) => {
|
|
||||||
if (!args.value) throw "nyc";
|
|
||||||
|
|
||||||
if (!newValue) {
|
const inheritTurnTimeZone = ref<number>();
|
||||||
args.value.inheritTurntime = undefined;
|
const turnTimeZoneList: string[] = (()=>{
|
||||||
return;
|
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>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "@scss/common/base.scss";
|
@import "@scss/common/base.scss";
|
||||||
@@ -569,10 +538,6 @@ watch(inheritTurnTimeSecond, (newValue: number) => {
|
|||||||
.col-form-label {
|
.col-form-label {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.turn_time_pad .col-form-label {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
<template>
|
|
||||||
<BContainer id="container" ref="container" :toast="{ root: true }">
|
|
||||||
<TopBackBar :reloadable="true" title="개인 전략" @reload="refresh" />
|
|
||||||
<div v-if="asyncReady && gameConstStore && generalInfo && frontInfo && globalInfo && nationStaticInfo" id="pages"
|
|
||||||
class="bg0">
|
|
||||||
<div id="leftPanel">
|
|
||||||
<GeneralBasicCard :general="generalInfo" :nation="nationStaticInfo" :troopInfo="frontInfo.general.troopInfo"
|
|
||||||
:turnTerm="globalInfo.turnterm" :lastExecuted="lastExecuted" />
|
|
||||||
<div class="bg1" style="margin-top: 10px;">
|
|
||||||
대기 중인 전략
|
|
||||||
</div>
|
|
||||||
<div v-for="[command, turn] of frontInfo.general.impossibleUserAction" :key="command">
|
|
||||||
<span>{{ command }}</span>: {{ turn.toLocaleString() }}턴 뒤
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="actionForm">
|
|
||||||
<ReservedCommandForUserAction ref="reservedCommandPanel" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</BContainer>
|
|
||||||
</template>
|
|
||||||
<script lang="ts">
|
|
||||||
declare const staticValues: {
|
|
||||||
serverName: string;
|
|
||||||
serverNick: string;
|
|
||||||
serverID: string;
|
|
||||||
mapName: string;
|
|
||||||
unitSet: string;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script setup lang="ts">
|
|
||||||
import ReservedCommandForUserAction from './ReservedCommandForUserAction.vue';
|
|
||||||
import { GameConstStore, getGameConstStore } from "./GameConstStore";
|
|
||||||
import { useToast } from 'bootstrap-vue-next';
|
|
||||||
import { unwrap } from './util/unwrap';
|
|
||||||
import { onMounted, provide, ref, watch } from 'vue';
|
|
||||||
import TopBackBar from './components/TopBackBar.vue';
|
|
||||||
import { SammoAPI } from './SammoAPI';
|
|
||||||
import { delay } from './util/delay';
|
|
||||||
import GeneralBasicCard from './components/GeneralBasicCard.vue';
|
|
||||||
import { GetFrontInfoResponse } from './defs/API/Global';
|
|
||||||
import { NationStaticItem } from './defs';
|
|
||||||
import { parseTime } from './util/parseTime';
|
|
||||||
|
|
||||||
const { serverID } = staticValues;
|
|
||||||
|
|
||||||
const toasts = unwrap(useToast());
|
|
||||||
|
|
||||||
const lastExecuted = ref<Date>(parseTime("2022-08-15 00:00:00"));
|
|
||||||
|
|
||||||
const asyncReady = ref(false);
|
|
||||||
const gameConstStore = ref<GameConstStore>();
|
|
||||||
provide("gameConstStore", gameConstStore);
|
|
||||||
const storeP = getGameConstStore().then((store) => {
|
|
||||||
gameConstStore.value = store;
|
|
||||||
});
|
|
||||||
|
|
||||||
const frontInfo = ref<GetFrontInfoResponse>();
|
|
||||||
const globalInfo = ref<GetFrontInfoResponse["global"]>({} as GetFrontInfoResponse["global"]);
|
|
||||||
const generalInfo = ref<GetFrontInfoResponse["general"]>();
|
|
||||||
const nationColorClass = ref('sam-color-000000');
|
|
||||||
const nationStaticInfo = ref<NationStaticItem>();
|
|
||||||
|
|
||||||
watch(nationStaticInfo, (newNation) => {
|
|
||||||
if (!newNation) {
|
|
||||||
nationColorClass.value = 'sam-color-000000';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nationColorClass.value = `sam-color-${newNation.color.substring(1, 7)}`;
|
|
||||||
});
|
|
||||||
|
|
||||||
void Promise.all([storeP]).then(() => {
|
|
||||||
asyncReady.value = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
const reservedCommandPanel = ref<InstanceType<typeof ReservedCommandForUserAction> | null>(null);
|
|
||||||
|
|
||||||
async function refresh() {
|
|
||||||
const serverExecuteP = SammoAPI.Global.ExecuteEngine({ serverID }, true).then((response) => {
|
|
||||||
if (response.result) {
|
|
||||||
lastExecuted.value = parseTime(response.lastExecuted);
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
await Promise.race([delay(1000), serverExecuteP]);
|
|
||||||
reservedCommandPanel.value?.reloadCommandList();
|
|
||||||
reservedCommandPanel.value?.updateCommandTable();
|
|
||||||
const frontResponse = await SammoAPI.General.GetFrontInfo({
|
|
||||||
lastNationNoticeDate: "9999-12-31 23:59:59",
|
|
||||||
lastGeneralRecordID: 99999999,
|
|
||||||
lastWorldHistoryID: 99999999,
|
|
||||||
});
|
|
||||||
|
|
||||||
frontInfo.value = frontResponse;
|
|
||||||
generalInfo.value = frontResponse.general;
|
|
||||||
|
|
||||||
const rawNation = frontResponse.nation;
|
|
||||||
nationStaticInfo.value = {
|
|
||||||
nation: rawNation.id,
|
|
||||||
name: rawNation.name,
|
|
||||||
color: rawNation.color,
|
|
||||||
type: rawNation.type.raw,
|
|
||||||
level: rawNation.level,
|
|
||||||
capital: rawNation.capital,
|
|
||||||
gennum: rawNation.gennum,
|
|
||||||
power: rawNation.power
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void refresh();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
@import "@scss/common/break_500px.scss";
|
|
||||||
|
|
||||||
//grid
|
|
||||||
@include media-1000px {
|
|
||||||
#pages {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include media-500px {
|
|
||||||
#pages {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,434 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="commandPad">
|
|
||||||
<div class="col alert alert-dark m-0 p-1 center">
|
|
||||||
<h4 class="m-0">명령 목록</h4>
|
|
||||||
</div>
|
|
||||||
<div :style="{ position: 'relative' }">
|
|
||||||
<div class="bg-dark" :style="{
|
|
||||||
position: 'absolute',
|
|
||||||
top: `${basicModeRowHeight * currentQuickReserveTarget + 30}px`,
|
|
||||||
width: '100%',
|
|
||||||
zIndex: 9,
|
|
||||||
}">
|
|
||||||
<CommandSelectForm ref="commandQuickReserveForm" :activatedCategory="'개인 전략'" :commandList="commandList"
|
|
||||||
:hideClose="false" @onClose="chooseQuickReserveCommand($event)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :class="{
|
|
||||||
commandTable: true,
|
|
||||||
}">
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedCommandList.slice(0, viewMaxTurn)" :key="turnIdx" :turnIdx="turnIdx"
|
|
||||||
class="idx_pad center d-grid">
|
|
||||||
<div class="plain-center">
|
|
||||||
{{ turnIdx + 1 }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedCommandList.slice(0, viewMaxTurn)" :key="turnIdx" height="24"
|
|
||||||
class="month_pad center" :turnIdx="turnIdx" :style="{
|
|
||||||
'white-space': 'nowrap',
|
|
||||||
'font-size': `${Math.min(14, (75 / (`${turnObj.year ?? 1}`.length + 8)) * 1.8)}px`,
|
|
||||||
overflow: 'hidden',
|
|
||||||
}">
|
|
||||||
{{ turnObj.year ? `${turnObj.year}年` : "" }}
|
|
||||||
{{ turnObj.month ? `${turnObj.month}月` : "" }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedCommandList.slice(0, viewMaxTurn)" :key="turnIdx"
|
|
||||||
class="time_pad center" :style="{
|
|
||||||
backgroundColor: 'black',
|
|
||||||
whiteSpace: 'nowrap',
|
|
||||||
overflow: 'hidden',
|
|
||||||
}">
|
|
||||||
{{ turnObj.time }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedCommandList.slice(0, viewMaxTurn)" :key="turnIdx"
|
|
||||||
class="turn_pad center">
|
|
||||||
<span v-b-tooltip.hover="turnObj.tooltip" class="turn_text" :style="turnObj.style">
|
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
||||||
<span v-html="turnObj.brief" />
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedUserActionList.slice(0, viewMaxTurn)" :key="turnIdx"
|
|
||||||
class="turn_pad center">
|
|
||||||
<span v-if="turnObj" class="turn_text">
|
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
||||||
<span v-html="turnObj.brief" />
|
|
||||||
</span>
|
|
||||||
<span v-else class="turn_text">
|
|
||||||
<span>휴식</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div :style="rowGridStyle">
|
|
||||||
<div v-for="(turnObj, turnIdx) in reservedUserActionList.slice(0, viewMaxTurn)" :key="turnIdx"
|
|
||||||
class="action_pad d-grid">
|
|
||||||
<BButton :variant="turnIdx % 2 == 0 ? 'secondary' : 'dark'" size="sm" class="simple_action_btn bi bi-pencil"
|
|
||||||
:disabled="!commandList.length" @click="toggleQuickReserveForm(turnIdx)" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row gx-1">
|
|
||||||
<div class="col d-grid">
|
|
||||||
</div>
|
|
||||||
<div class="col alert alert-primary m-0 p-0"
|
|
||||||
style="text-align: center; display: flex; justify-content: center; align-items: center">
|
|
||||||
<SimpleClock :serverTime="serverNow" />
|
|
||||||
</div>
|
|
||||||
<div class="col d-grid">
|
|
||||||
<BButton @click="toggleViewMaxTurn">
|
|
||||||
{{ flippedMaxTurn == viewMaxTurn ? "펼치기" : "접기" }}
|
|
||||||
</BButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
declare const staticValues: {
|
|
||||||
maxTurn: number;
|
|
||||||
maxPushTurn: number;
|
|
||||||
serverNow: string;
|
|
||||||
serverNick: string;
|
|
||||||
mapName: string;
|
|
||||||
unitSet: string;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import addMinutes from "date-fns/esm/addMinutes";
|
|
||||||
import { isString, range, trim } from "lodash-es";
|
|
||||||
import queryString from "query-string";
|
|
||||||
import { onMounted, ref, watch } from "vue";
|
|
||||||
import { formatTime } from "@util/formatTime";
|
|
||||||
import { joinYearMonth } from "@util/joinYearMonth";
|
|
||||||
import { mb_strwidth } from "@util/mb_strwidth";
|
|
||||||
import { parseTime } from "@util/parseTime";
|
|
||||||
import { parseYearMonth } from "@util/parseYearMonth";
|
|
||||||
import { SammoAPI } from "./SammoAPI";
|
|
||||||
import type { CommandItem, CommandTableResponse } from "@/defs";
|
|
||||||
import CommandSelectForm from "@/components/CommandSelectForm.vue";
|
|
||||||
import { BButton, BButtonGroup, BDropdownItem, BDropdown, BDropdownText, BDropdownDivider, useToast } from "bootstrap-vue-next";
|
|
||||||
import { StoredActionsHelper } from "./util/StoredActionsHelper";
|
|
||||||
import type { TurnObj } from "@/defs";
|
|
||||||
import type { Args } from "./processing/args";
|
|
||||||
import { getEmptyTurn } from "./util/QueryActionHelper";
|
|
||||||
import SimpleClock from "./components/SimpleClock.vue";
|
|
||||||
import type { ReservedCommandResponse, ReservedUserActionResponse, UserActionItem } from "./defs/API/Command";
|
|
||||||
import { unwrap } from "./util/unwrap";
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
updateCommandTable,
|
|
||||||
reloadCommandList,
|
|
||||||
})
|
|
||||||
|
|
||||||
const toasts = unwrap(useToast());
|
|
||||||
|
|
||||||
const { maxTurn } = staticValues;
|
|
||||||
|
|
||||||
const commandList = ref<CommandTableResponse['commandTable']>([]);
|
|
||||||
|
|
||||||
const nullCommand: CommandItem = {
|
|
||||||
'value': '휴식',
|
|
||||||
'compensation': 0,
|
|
||||||
'simpleName': '휴식',
|
|
||||||
'possible': true,
|
|
||||||
'info': '휴식',
|
|
||||||
'title': '휴식',
|
|
||||||
'reqArg': false,
|
|
||||||
}
|
|
||||||
|
|
||||||
const selectedCommand = ref<CommandItem>(nullCommand);
|
|
||||||
const invCommandMap = new Map<string, CommandItem>();
|
|
||||||
|
|
||||||
async function updateCommandTable() {
|
|
||||||
try {
|
|
||||||
const response = await SammoAPI.General.GetUserActionCommandTable();
|
|
||||||
console.log(response);
|
|
||||||
commandList.value = response.commandTable;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(commandList, (commandList) => {
|
|
||||||
if (!commandList) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const commandCategories of commandList) {
|
|
||||||
if (!commandCategories.values) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (const commandObj of commandCategories.values) {
|
|
||||||
if (!commandObj.reqArg) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
console.warn(`명령 ${commandObj.value}에는 인자가 필요하나, 현재는 지원하지 않습니다.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
invCommandMap.clear();
|
|
||||||
for (const category of commandList) {
|
|
||||||
for (const command of category.values) {
|
|
||||||
invCommandMap.set(command.value, command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedCommand.value === nullCommand || !invCommandMap.has(selectedCommand.value.value)) {
|
|
||||||
selectedCommand.value = commandList[0].values[0];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void updateCommandTable();
|
|
||||||
});
|
|
||||||
|
|
||||||
const reservedCommandList = ref(getEmptyTurn(maxTurn));
|
|
||||||
const reservedUserActionList = ref<(UserActionItem | undefined)[]>([]);
|
|
||||||
const flippedMaxTurn = 14;
|
|
||||||
|
|
||||||
const basicModeRowHeight = 34.4;
|
|
||||||
const viewMaxTurn = ref(flippedMaxTurn);
|
|
||||||
const rowGridStyle = ref({
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateRows: `repeat(${viewMaxTurn.value}, ${basicModeRowHeight}px)`,
|
|
||||||
});
|
|
||||||
|
|
||||||
watch([viewMaxTurn], ([maxTurn]) => {
|
|
||||||
rowGridStyle.value.gridTemplateRows = `repeat(${maxTurn}, ${basicModeRowHeight}px)`;
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggleViewMaxTurn() {
|
|
||||||
if (viewMaxTurn.value == flippedMaxTurn) {
|
|
||||||
viewMaxTurn.value = maxTurn;
|
|
||||||
} else {
|
|
||||||
viewMaxTurn.value = flippedMaxTurn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const serverNow = ref(new Date());
|
|
||||||
|
|
||||||
async function reloadCommandList() {
|
|
||||||
let result: ReservedCommandResponse;
|
|
||||||
let userActions: ReservedUserActionResponse;
|
|
||||||
try {
|
|
||||||
[result, userActions] = await Promise.all([
|
|
||||||
SammoAPI.Command.GetReservedCommand(),
|
|
||||||
SammoAPI.Command.GetReservedUserAction(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
if (isString(e)) {
|
|
||||||
toasts.danger({
|
|
||||||
title: "에러",
|
|
||||||
body: e,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.error(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let yearMonth = joinYearMonth(result.year, result.month);
|
|
||||||
|
|
||||||
const turnTime = parseTime(result.turnTime);
|
|
||||||
let nextTurnTime = new Date(turnTime);
|
|
||||||
|
|
||||||
const autorunLimitYearMonth = result.autorun_limit ?? yearMonth - 1;
|
|
||||||
const [autorunLimitYear, autorunLimitMonth] = parseYearMonth(autorunLimitYearMonth);
|
|
||||||
|
|
||||||
reservedCommandList.value = [];
|
|
||||||
for (const obj of result.turn) {
|
|
||||||
const [year, month] = parseYearMonth(yearMonth);
|
|
||||||
let tooltip: string[] = [];
|
|
||||||
let style: Record<string, string> = {};
|
|
||||||
|
|
||||||
const brief = obj.brief;
|
|
||||||
|
|
||||||
if (yearMonth <= autorunLimitYearMonth) {
|
|
||||||
if (obj.brief == "휴식") {
|
|
||||||
obj.brief = "휴식<small>(자율 행동)</small>";
|
|
||||||
}
|
|
||||||
style.color = "#aaffff";
|
|
||||||
|
|
||||||
tooltip.push(`자율 행동 기간: ${autorunLimitYear}년 ${autorunLimitMonth}월까지`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mb_strwidth(brief) > 22) {
|
|
||||||
tooltip.push(brief);
|
|
||||||
}
|
|
||||||
|
|
||||||
reservedCommandList.value.push({
|
|
||||||
...obj,
|
|
||||||
year,
|
|
||||||
month,
|
|
||||||
time: formatTime(nextTurnTime, "HH:mm"),
|
|
||||||
tooltip: tooltip.length == 0 ? undefined : tooltip.join("\n"),
|
|
||||||
style,
|
|
||||||
});
|
|
||||||
|
|
||||||
yearMonth += 1;
|
|
||||||
nextTurnTime = addMinutes(nextTurnTime, result.turnTerm);
|
|
||||||
}
|
|
||||||
|
|
||||||
serverNow.value = parseTime(result.date);
|
|
||||||
|
|
||||||
const newReservedUserActionList: (UserActionItem | undefined)[] = [];
|
|
||||||
newReservedUserActionList.length = maxTurn;
|
|
||||||
for (const [idx, item] of Object.entries(userActions.userActions.reserved ?? {})) {
|
|
||||||
newReservedUserActionList[parseInt(idx)] = item;
|
|
||||||
}
|
|
||||||
reservedUserActionList.value = newReservedUserActionList;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function reserveCommand() {
|
|
||||||
const turnIdx = currentQuickReserveTarget.value;
|
|
||||||
|
|
||||||
const commandName = selectedCommand.value.value;
|
|
||||||
if (turnIdx < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const result = await SammoAPI.Command.ReserveUserAction({
|
|
||||||
turnIdx,
|
|
||||||
action: commandName,
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
if (isString(e)) {
|
|
||||||
toasts.danger({
|
|
||||||
title: "에러",
|
|
||||||
body: e,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.error(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await reloadCommandList();
|
|
||||||
}
|
|
||||||
|
|
||||||
const commandQuickReserveForm = ref<InstanceType<typeof CommandSelectForm> | null>(null);
|
|
||||||
|
|
||||||
const currentQuickReserveTarget = ref(-1);
|
|
||||||
function chooseQuickReserveCommand(val?: string) {
|
|
||||||
if (!val) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selectedCommand.value = unwrap(invCommandMap.get(val));
|
|
||||||
void reserveCommand();
|
|
||||||
}
|
|
||||||
function toggleQuickReserveForm(turnIdx: number) {
|
|
||||||
if (turnIdx == currentQuickReserveTarget.value) {
|
|
||||||
commandQuickReserveForm.value?.toggle();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
currentQuickReserveTarget.value = turnIdx;
|
|
||||||
commandQuickReserveForm.value?.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void reloadCommandList();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<style lang="scss">
|
|
||||||
@use "sass:color";
|
|
||||||
|
|
||||||
@import "@scss/common/break_500px.scss";
|
|
||||||
@import "@scss/common/variables.scss";
|
|
||||||
@import "@scss/common/bootswatch_custom_variables.scss";
|
|
||||||
@import "@scss/game_bg.scss";
|
|
||||||
|
|
||||||
.commandPad {
|
|
||||||
background-color: $gray-900;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.commandTable {
|
|
||||||
width: 100%;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns:
|
|
||||||
minmax(20px, 0.6fr) minmax(75px, 2.0fr) minmax(40px, 0.9fr) 4.0fr 3.2fr minmax(28px, 0.8fr);
|
|
||||||
//30, 70, 37.65, 160
|
|
||||||
}
|
|
||||||
|
|
||||||
@include media-1000px {
|
|
||||||
.commandPad {
|
|
||||||
margin-left: 10px;
|
|
||||||
|
|
||||||
.turn_pad {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect__content-wrapper {
|
|
||||||
margin-left: calc(-100% / 7 * 2);
|
|
||||||
width: calc(100% / 7 * 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect__single {
|
|
||||||
display: inline-block;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include media-500px {
|
|
||||||
.dropdown-item {
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.commandPad {
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
transition: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.month_pad,
|
|
||||||
.time_pad,
|
|
||||||
.turn_pad {
|
|
||||||
padding: 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.plain-center {
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.plain-center,
|
|
||||||
.month_pad,
|
|
||||||
.time_pad,
|
|
||||||
.turn_pad {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.turn_pad {
|
|
||||||
white-space: nowrap;
|
|
||||||
background-color: $nbase2color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.turn_pad:nth-child(2n) {
|
|
||||||
background-color: color.adjust($nbase2color, $lightness: -5%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.turn_pad .turn_text {
|
|
||||||
display: inline-block;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
+1
-7
@@ -15,7 +15,7 @@ import {
|
|||||||
export type { ValidResponse, InvalidResponse };
|
export type { ValidResponse, InvalidResponse };
|
||||||
import { APIPathGen, NumVar, StrVar } from "./util/APIPathGen.js";
|
import { APIPathGen, NumVar, StrVar } from "./util/APIPathGen.js";
|
||||||
import type { BettingDetailResponse, BettingListResponse } from "./defs/API/Betting";
|
import type { BettingDetailResponse, BettingListResponse } from "./defs/API/Betting";
|
||||||
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse, ReservedUserActionResponse } from "./defs/API/Command";
|
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse } from "./defs/API/Command";
|
||||||
import type { ChiefResponse } from "./defs/API/NationCommand";
|
import type { ChiefResponse } from "./defs/API/NationCommand";
|
||||||
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
||||||
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse, NationInfoResponse } from "./defs/API/Nation";
|
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse, NationInfoResponse } from "./defs/API/Nation";
|
||||||
@@ -109,7 +109,6 @@ const apiRealPath = {
|
|||||||
},
|
},
|
||||||
ReserveCommandResponse
|
ReserveCommandResponse
|
||||||
>,
|
>,
|
||||||
GetReservedUserAction: GET as APICallT<undefined, ReservedUserActionResponse>,
|
|
||||||
ReserveBulkCommand: PUT as APICallT<
|
ReserveBulkCommand: PUT as APICallT<
|
||||||
{
|
{
|
||||||
turnList: number[];
|
turnList: number[];
|
||||||
@@ -118,10 +117,6 @@ const apiRealPath = {
|
|||||||
}[],
|
}[],
|
||||||
ReserveBulkCommandResponse
|
ReserveBulkCommandResponse
|
||||||
>,
|
>,
|
||||||
ReserveUserAction: PUT as APICallT<{
|
|
||||||
turnIdx: number;
|
|
||||||
action: string;
|
|
||||||
}>
|
|
||||||
},
|
},
|
||||||
General: {
|
General: {
|
||||||
Join: POST as APICallT<JoinArgs>,
|
Join: POST as APICallT<JoinArgs>,
|
||||||
@@ -139,7 +134,6 @@ const apiRealPath = {
|
|||||||
InstantRetreat: POST as APICallT<undefined>,
|
InstantRetreat: POST as APICallT<undefined>,
|
||||||
BuildNationCandidate: POST as APICallT<undefined>,
|
BuildNationCandidate: POST as APICallT<undefined>,
|
||||||
GetCommandTable: GET as APICallT<undefined, CommandTableResponse>,
|
GetCommandTable: GET as APICallT<undefined, CommandTableResponse>,
|
||||||
GetUserActionCommandTable: GET as APICallT<undefined, CommandTableResponse>,
|
|
||||||
GetFrontInfo: GET as APICallT<{
|
GetFrontInfo: GET as APICallT<{
|
||||||
lastNationNoticeDate?: string,
|
lastNationNoticeDate?: string,
|
||||||
lastGeneralRecordID?: number,
|
lastGeneralRecordID?: number,
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
"v_globalDiplomacy": "v_globalDiplomacy",
|
"v_globalDiplomacy": "v_globalDiplomacy",
|
||||||
"v_troop": "v_troop.ts",
|
"v_troop": "v_troop.ts",
|
||||||
"v_vote": "v_vote.ts",
|
"v_vote": "v_vote.ts",
|
||||||
"v_front": "v_front.ts",
|
"v_front": "v_front.ts"
|
||||||
"v_userAction": "v_userAction.ts"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ async function refreshDetail() {
|
|||||||
currentAuction.value = await SammoAPI.Auction.GetUniqueItemAuctionDetail({ auctionID });
|
currentAuction.value = await SammoAPI.Auction.GetUniqueItemAuctionDetail({ auctionID });
|
||||||
const bidList = currentAuction.value.bidList;
|
const bidList = currentAuction.value.bidList;
|
||||||
const highestBidAmount = Math.max(bidList[0].amount, bidList[bidList.length-1].amount);
|
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) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
if (isString(e)) {
|
if (isString(e)) {
|
||||||
|
|||||||
@@ -150,17 +150,6 @@
|
|||||||
{{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
|
{{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg1">전략</div>
|
|
||||||
<div
|
|
||||||
v-if="impossibleUserActionText"
|
|
||||||
v-b-tooltip.hover="impossibleUserActionText"
|
|
||||||
style="text-decoration: underline dashed red"
|
|
||||||
>
|
|
||||||
<span style="color: yellow">가능</span>
|
|
||||||
</div>
|
|
||||||
<div v-else class="strategicClg-body tb-body">
|
|
||||||
<span style="color: limegreen">가능</span>
|
|
||||||
</div>
|
|
||||||
<div class="bg1">벌점</div>
|
<div class="bg1">벌점</div>
|
||||||
<div class="general-refresh-score-total">
|
<div class="general-refresh-score-total">
|
||||||
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
||||||
@@ -283,25 +272,6 @@ watch(
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const impossibleUserActionText = ref<string>("");
|
|
||||||
watch(
|
|
||||||
general,
|
|
||||||
(general) => {
|
|
||||||
const impossibleUserAction = general.impossibleUserAction;
|
|
||||||
if (impossibleUserAction.length == 0) {
|
|
||||||
impossibleUserActionText.value = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const texts = [];
|
|
||||||
for (const [cmdName, turnCnt] of impossibleUserAction) {
|
|
||||||
texts.push(`${cmdName}: ${turnCnt.toLocaleString()}턴 뒤`);
|
|
||||||
}
|
|
||||||
impossibleUserActionText.value = texts.join("<br>\n");
|
|
||||||
},
|
|
||||||
{ immediate: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
const nextExecuteMinute = ref(999);
|
const nextExecuteMinute = ref(999);
|
||||||
watch(
|
watch(
|
||||||
general,
|
general,
|
||||||
@@ -371,4 +341,7 @@ watch(
|
|||||||
grid-column: 2 / 4;
|
grid-column: 2 / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.general-refresh-score-total {
|
||||||
|
grid-column: 5 / 8;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,50 +7,71 @@
|
|||||||
<BDropdownDivider />
|
<BDropdownDivider />
|
||||||
<BDropdownItem @click="storeDisplaySetting"><i class="bi bi-bookmark-plus-fill" /> 보관하기</BDropdownItem>
|
<BDropdownItem @click="storeDisplaySetting"><i class="bi bi-bookmark-plus-fill" /> 보관하기</BDropdownItem>
|
||||||
<BDropdownDivider />
|
<BDropdownDivider />
|
||||||
<BDropdownItem v-for="[key, setting] of displaySettings.entries()" :key="key"
|
<BDropdownItem
|
||||||
@click="setDisplaySetting([false, key], setting)">
|
v-for="[key, setting] of displaySettings.entries()"
|
||||||
<div class="row gx-0">
|
:key="key"
|
||||||
|
@click="setDisplaySetting([false, key], setting)"
|
||||||
|
><div class="row gx-0">
|
||||||
<div class="col-9 text-wrap">
|
<div class="col-9 text-wrap">
|
||||||
<span class="align-middle">{{ key }}</span>
|
<span class="align-middle">{{ key }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<div class="d-grid">
|
<div class="d-grid"><BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton></div>
|
||||||
<BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div></BDropdownItem
|
||||||
</BDropdownItem>
|
>
|
||||||
</BDropdown>
|
</BDropdown>
|
||||||
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
|
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
|
||||||
<BDropdown class="w-50" variant="info" text="열 선택" menuClass="column-menu" right>
|
<BDropdown class="w-50" variant="info" text="열 선택" menuClass="column-menu" right>
|
||||||
<template v-for="[colID, col, depth] of getColumnList()" :key="[colID, depth]">
|
<template v-for="[colID, col, depth] of getColumnList()" :key="[colID, depth]">
|
||||||
<BDropdownItem v-if="col instanceof ProvidedColumnGroup" disabled>
|
<BDropdownItem v-if="col instanceof ProvidedColumnGroup" disabled>
|
||||||
<span :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }">
|
<span :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }">
|
||||||
{{ col.getColGroupDef()?.headerName }}</span>
|
{{ col.getColGroupDef()?.headerName }}</span
|
||||||
</BDropdownItem>
|
></BDropdownItem
|
||||||
|
>
|
||||||
<BDropdownItem v-else>
|
<BDropdownItem v-else>
|
||||||
<div :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }" class="form-check" @click.stop="1">
|
<div :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }" class="form-check" @click.stop="1">
|
||||||
<input :id="`column-type-${colID}`" class="form-check-input" type="checkbox" :checked="col.isVisible()"
|
<input
|
||||||
@change.stop="toggleColumn(colID, col)" />
|
:id="`column-type-${colID}`"
|
||||||
<label class="form-check-label" :for="`column-type-${colID}`" :style="{
|
class="form-check-input"
|
||||||
textDecoration: validColumns.has(colID) ? undefined : 'line-through'
|
type="checkbox"
|
||||||
}">
|
:checked="col.isVisible()"
|
||||||
|
@change.stop="toggleColumn(colID, col)"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
class="form-check-label"
|
||||||
|
:for="`column-type-${colID}`"
|
||||||
|
:style="{
|
||||||
|
textDecoration: validColumns.has(colID) ? undefined : 'line-through'
|
||||||
|
}"
|
||||||
|
>
|
||||||
{{ col.getColDef().headerName }}
|
{{ col.getColDef().headerName }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div></BDropdownItem
|
||||||
</BDropdownItem>
|
>
|
||||||
</template>
|
</template>
|
||||||
<BDropdownDivider />
|
<BDropdownDivider />
|
||||||
</BDropdown>
|
</BDropdown>
|
||||||
</BButtonGroup>
|
</BButtonGroup>
|
||||||
</Teleport>
|
</Teleport>
|
||||||
<div class="component-general-list" :style="{
|
<div
|
||||||
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
|
class="component-general-list"
|
||||||
}">
|
:style="{
|
||||||
<AgGridVue style="width: 100%; height: 100%" class="ag-theme-balham-dark" :getRowId="getRowId"
|
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
|
||||||
:getRowHeight="getRowHeight" :columnDefs="columnDefs" :rowData="list" :defaultColDef="defaultColDef"
|
}"
|
||||||
:suppressColumnMoveAnimation="suppressColumnMoveAnimation" @grid-ready="onGridReady"
|
>
|
||||||
@cell-clicked="onCellClicked" />
|
<AgGridVue
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
class="ag-theme-balham-dark"
|
||||||
|
:getRowId="getRowId"
|
||||||
|
:getRowHeight="getRowHeight"
|
||||||
|
:columnDefs="columnDefs"
|
||||||
|
:rowData="list"
|
||||||
|
:defaultColDef="defaultColDef"
|
||||||
|
:suppressColumnMoveAnimation="suppressColumnMoveAnimation"
|
||||||
|
@grid-ready="onGridReady"
|
||||||
|
@cell-clicked="onCellClicked"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts"></script>
|
<script lang="ts"></script>
|
||||||
@@ -1027,34 +1048,6 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
reservedUserAction: {
|
|
||||||
colId: "reservedUserAction",
|
|
||||||
headerName: "개인전략",
|
|
||||||
field: "reservedUserAction",
|
|
||||||
width: 120,
|
|
||||||
cellRenderer: ({ data }: GenValueParams) => {
|
|
||||||
if (data === undefined) {
|
|
||||||
return "?";
|
|
||||||
}
|
|
||||||
if (data.npc >= 2) {
|
|
||||||
return "NPC 장수";
|
|
||||||
}
|
|
||||||
if(!data.st1){
|
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
const commandList = data.reservedUserAction;
|
|
||||||
if (!commandList) {
|
|
||||||
return "???";
|
|
||||||
}
|
|
||||||
return commandList
|
|
||||||
.map(({ brief }) => brief)
|
|
||||||
.join("<br>");
|
|
||||||
},
|
|
||||||
cellStyle: {
|
|
||||||
lineHeight: "1em",
|
|
||||||
fontSize: "0.85em"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
turntime: {
|
turntime: {
|
||||||
colId: "turntime",
|
colId: "turntime",
|
||||||
headerName: "턴",
|
headerName: "턴",
|
||||||
@@ -1238,7 +1231,6 @@ watch(columnRawDefs, (val) => {
|
|||||||
.g-tr {
|
.g-tr {
|
||||||
border-bottom: solid gray 1px;
|
border-bottom: solid gray 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.g-thead-tr {
|
.g-thead-tr {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0px;
|
top: 0px;
|
||||||
@@ -1255,63 +1247,51 @@ watch(columnRawDefs, (val) => {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-root-wrapper .cell-middle {
|
.ag-root-wrapper .cell-middle {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-root-wrapper {
|
.ag-root-wrapper {
|
||||||
font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic";
|
font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic";
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-root {
|
.ag-root {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-header {
|
.ag-header {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-center {
|
.cell-center {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-right {
|
.cell-right {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-sp .col {
|
.cell-sp .col {
|
||||||
min-width: 30px;
|
min-width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-header-cell,
|
.ag-header-cell,
|
||||||
.ag-header-group-cell,
|
.ag-header-group-cell,
|
||||||
.ag-cell {
|
.ag-cell {
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-header-cell-label,
|
.ag-header-cell-label,
|
||||||
.ag-header-group-cell-label {
|
.ag-header-group-cell-label {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-ltr .ag-floating-filter-button {
|
.ag-ltr .ag-floating-filter-button {
|
||||||
margin-left: 2px;
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ag-rtl .ag-floating-filter-button {
|
.ag-rtl .ag-floating-filter-button {
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.general-list-toolbar {
|
.general-list-toolbar {
|
||||||
.column-menu {
|
.column-menu {
|
||||||
column-count: 3;
|
column-count: 3;
|
||||||
|
|||||||
@@ -1,24 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="controlBar">
|
<div class="controlBar">
|
||||||
<div class="btn-group">
|
<a href="v_board.php" :class="`btn btn-sammo-nation ${myLevel >= 1 ? '' : 'disabled'}`">회 의 실</a>
|
||||||
<a href="v_board.php" :class="`btn btn-sammo-nation ${myLevel >= 1 ? '' : 'disabled'}`">회 의 실</a>
|
<a href="v_board.php?isSecret=true" :class="`${permission >= 2 ? '' : 'disabled'} btn btn-sammo-nation`"
|
||||||
<button
|
>기 밀 실</a
|
||||||
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>
|
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
|
||||||
<li>
|
|
||||||
<a href="v_board.php" :class="`dropdown-item ${myLevel >= 1 ? '' : 'disabled'}`">회의실</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="v_board.php?isSecret=true" :class="`dropdown-item ${permission >= 2 ? '' : 'disabled'}`">기밀실</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<a href="v_troop.php" :class="`${myLevel >= 1 && nationLevel >= 1 ? '' : 'disabled'} btn btn-sammo-nation`"
|
<a href="v_troop.php" :class="`${myLevel >= 1 && nationLevel >= 1 ? '' : 'disabled'} btn btn-sammo-nation`"
|
||||||
>부대 편성</a
|
>부대 편성</a
|
||||||
>
|
>
|
||||||
@@ -27,7 +12,6 @@
|
|||||||
<a href="v_nationStratFinan.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">내 무 부</a>
|
<a href="v_nationStratFinan.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">내 무 부</a>
|
||||||
<a href="v_chiefCenter.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">사 령 부</a>
|
<a href="v_chiefCenter.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">사 령 부</a>
|
||||||
<a href="v_NPCControl.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">NPC 정책</a>
|
<a href="v_NPCControl.php" :class="`${showSecret ? '' : 'disabled'} btn btn-sammo-nation`">NPC 정책</a>
|
||||||
<a href="v_userAction.php" class="btn btn-sammo-nation">개인 전략</a>
|
|
||||||
<a href="b_genList.php" target="_blank" :class="`btn btn-sammo-nation ${showSecret ? '' : 'disabled'}`"
|
<a href="b_genList.php" target="_blank" :class="`btn btn-sammo-nation ${showSecret ? '' : 'disabled'}`"
|
||||||
>암 행 부</a
|
>암 행 부</a
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
<li><a href="v_nationStratFinan.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">내무부</a></li>
|
<li><a href="v_nationStratFinan.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">내무부</a></li>
|
||||||
<li><a href="v_chiefCenter.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">사령부</a></li>
|
<li><a href="v_chiefCenter.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">사령부</a></li>
|
||||||
<li><a href="v_NPCControl.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">NPC 정책</a></li>
|
<li><a href="v_NPCControl.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">NPC 정책</a></li>
|
||||||
<li><a href="v_userAction.php" class="dropdown-item">개인 전략</a></li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="b_genList.php" target="_blank" :class="`dropdown-item open-window ${showSecret ? '' : 'disabled'}`"
|
<a href="b_genList.php" target="_blank" :class="`dropdown-item open-window ${showSecret ? '' : 'disabled'}`"
|
||||||
>암행부</a
|
>암행부</a
|
||||||
|
|||||||
@@ -20,19 +20,3 @@ export type ReserveBulkCommandResponse = {
|
|||||||
result: true,
|
result: true,
|
||||||
briefList: string[],
|
briefList: string[],
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserActionItem = {
|
|
||||||
command: string,
|
|
||||||
brief: string,
|
|
||||||
untilYearMonth?: number,
|
|
||||||
};
|
|
||||||
|
|
||||||
type UserAction = {
|
|
||||||
reserved?: Record<number, UserActionItem>,
|
|
||||||
active?: UserActionItem[],
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ReservedUserActionResponse = {
|
|
||||||
result: true,
|
|
||||||
userActions: UserAction,
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ export type JoinArgs = {
|
|||||||
pic: boolean;
|
pic: boolean;
|
||||||
character: string;
|
character: string;
|
||||||
inheritSpecial?: string;
|
inheritSpecial?: string;
|
||||||
inheritTurntime?: number;
|
inheritTurntimeZone?: number;
|
||||||
inheritCity?: number;
|
inheritCity?: number;
|
||||||
inheritBonusStat?: [number, number, number];
|
inheritBonusStat?: [number, number, number];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ export type GeneralListItemP1 = {
|
|||||||
killcrew: number;
|
killcrew: number;
|
||||||
deathcrew: number;
|
deathcrew: number;
|
||||||
firenum: number;
|
firenum: number;
|
||||||
|
|
||||||
impossibleUserAction: [string, number][];
|
|
||||||
reservedUserAction: TurnObj[] | null;
|
|
||||||
} & GeneralListItemP0;
|
} & GeneralListItemP0;
|
||||||
|
|
||||||
export type GeneralListItemP2 = GeneralListItemP1;
|
export type GeneralListItemP2 = GeneralListItemP1;
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import { createApp } from 'vue'
|
|
||||||
import UserAction from '@/PageUserAction.vue';
|
|
||||||
import { auto500px } from "./util/auto500px";
|
|
||||||
import { htmlReady } from "./util/htmlReady";
|
|
||||||
import { insertCustomCSS } from "./util/customCSS";
|
|
||||||
import { installVue3Components } from './util/installVue3Components';
|
|
||||||
|
|
||||||
auto500px();
|
|
||||||
|
|
||||||
htmlReady(() => {
|
|
||||||
insertCustomCSS();
|
|
||||||
});
|
|
||||||
installVue3Components(createApp(UserAction)).mount('#app')
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$gameStor->cacheValues(['autorun_user', 'develcost']);
|
|
||||||
|
|
||||||
//TODO: 개인 전략 옵션이 활성화된 경우여야만 함!
|
|
||||||
|
|
||||||
increaseRefresh("개인 전략", 1);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow(
|
|
||||||
'SELECT no, npc, nation, city, officer_level, refresh_score, turntime, belong, permission, penalty FROM `general`
|
|
||||||
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i', $userID
|
|
||||||
);
|
|
||||||
|
|
||||||
$nationID = $me['nation'];
|
|
||||||
$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,tech,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID);
|
|
||||||
|
|
||||||
$limitState = checkLimit($me['refresh_score']);
|
|
||||||
if ($limitState >= 2) {
|
|
||||||
printLimitMsg($me['turntime']);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="color-scheme" content="dark">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=500" />
|
|
||||||
<title><?= UniqueConst::$serverName ?>: 개인 전략</title>
|
|
||||||
<?= WebUtil::printStaticValues([
|
|
||||||
'staticValues' => [
|
|
||||||
'serverName' => UniqueConst::$serverName,
|
|
||||||
'serverNick' => DB::prefix(),
|
|
||||||
'serverID' => UniqueConst::$serverID,
|
|
||||||
'mapName' => GameConst::$mapName,
|
|
||||||
'unitSet' => GameConst::$unitSet,
|
|
||||||
|
|
||||||
'maxTurn' => GameConst::$maxTurn,
|
|
||||||
'serverNow' => TimeUtil::now(false),
|
|
||||||
]
|
|
||||||
], false) ?>
|
|
||||||
<?= WebUtil::printJS('../d_shared/common_path.js', true) ?>
|
|
||||||
<?= WebUtil::printDist('vue', ['v_userAction'], true) ?>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id='app'>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
+23
-20
@@ -93,8 +93,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'validate',
|
'state' => 'validate',
|
||||||
'reason' => $validateResult
|
'reason' => $validateResult
|
||||||
@@ -123,8 +123,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'launch',
|
'state' => 'launch',
|
||||||
'reason' => $result
|
'reason' => $result
|
||||||
@@ -139,8 +139,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'launch',
|
'state' => 'launch',
|
||||||
'reason' => $recoveryType->info(),
|
'reason' => $recoveryType->info(),
|
||||||
@@ -168,8 +168,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'cache_not_modified',
|
'state' => 'cache_not_modified',
|
||||||
]),
|
]),
|
||||||
@@ -183,8 +183,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'cache_not_modified',
|
'state' => 'cache_not_modified',
|
||||||
]),
|
]),
|
||||||
@@ -199,8 +199,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'success_simple',
|
'state' => 'success_simple',
|
||||||
'set_cache' => $setCache,
|
'set_cache' => $setCache,
|
||||||
@@ -216,8 +216,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'state' => 'success_complex',
|
'state' => 'success_complex',
|
||||||
'set_cache' => $setCache,
|
'set_cache' => $setCache,
|
||||||
@@ -226,6 +226,7 @@ class APIHelper
|
|||||||
$result['result'] = $result['result'] ?? true;
|
$result['result'] = $result['result'] ?? true;
|
||||||
Json::die($result, $setCache ? 0 : Json::NO_CACHE);
|
Json::die($result, $setCache ? 0 : Json::NO_CACHE);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
$session = Session::getInstance();
|
||||||
$errMsg = $e->getMessage();
|
$errMsg = $e->getMessage();
|
||||||
$errTrace = $e->getTraceAsString();
|
$errTrace = $e->getTraceAsString();
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
@@ -233,8 +234,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_exception',
|
'state' => 'error_exception',
|
||||||
'errMsg' => $errMsg,
|
'errMsg' => $errMsg,
|
||||||
@@ -244,6 +245,7 @@ class APIHelper
|
|||||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
logExceptionByCustomHandler($e, false);
|
logExceptionByCustomHandler($e, false);
|
||||||
|
$session = Session::getInstance();
|
||||||
$errMsg = $e->getMessage();
|
$errMsg = $e->getMessage();
|
||||||
$errTrace = $e->getTraceAsString();
|
$errTrace = $e->getTraceAsString();
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
@@ -251,8 +253,8 @@ class APIHelper
|
|||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_throwable',
|
'state' => 'error_throwable',
|
||||||
'errMsg' => $errMsg,
|
'errMsg' => $errMsg,
|
||||||
@@ -261,14 +263,15 @@ class APIHelper
|
|||||||
]);
|
]);
|
||||||
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
Json::dieWithReason("{$errMsg}\n{$errTrace}");
|
||||||
} catch (mixed $e) {
|
} catch (mixed $e) {
|
||||||
|
$session = Session::getInstance();
|
||||||
$errStr = strval($e);
|
$errStr = strval($e);
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
'user_id' => $session->userID ?? 0,
|
'user_id' => $session->userID ?? 0,
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'path' => $actionPath,
|
'path' => $actionPath,
|
||||||
'arg' => JSON::encode($filteredArgs),
|
'arg' => Json::encode($filteredArgs),
|
||||||
'aux' => JSON::encode([
|
'aux' => Json::encode([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
'state' => 'error_mixed',
|
'state' => 'error_mixed',
|
||||||
'errMsg' => $errStr,
|
'errMsg' => $errStr,
|
||||||
|
|||||||
Reference in New Issue
Block a user