Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1c5113d1b | ||
|
|
617d3b86db | ||
|
|
88206354f1
|
||
|
|
8ea85dd155
|
||
|
|
f0feb9a91c
|
||
|
|
a893da6a5c
|
||
|
|
2cdb00aac6
|
||
|
|
a8e26b5f60
|
||
|
|
94b1de7cd7
|
||
|
|
1c1b0de415
|
||
|
|
b29c4742a0
|
||
|
|
997223031e
|
||
|
|
a508d5b903
|
||
|
|
616c37d09c
|
||
|
|
d5e9639767
|
||
|
|
bd0b20a737
|
||
|
|
5f130139b3
|
||
|
|
5a6088ae5c
|
||
|
|
19f365b5d3
|
||
|
|
613a51db0d
|
||
|
|
ad96a2eedc
|
||
|
|
c84d66b985
|
||
|
|
ca46061d17
|
||
|
|
8e93c69582
|
||
|
|
8241071b61
|
||
|
|
2958dcbc49
|
||
|
|
4edb994ac9
|
||
|
|
05eb4366b1
|
||
|
|
f5dfb83356
|
||
|
|
2bcdbb0177
|
||
|
|
53474ab3d2
|
||
|
|
1fe55b83bd
|
||
|
|
0f621b22a5
|
||
|
|
eb36e7ccf4
|
||
|
|
85dc5347c5
|
||
|
|
6cf8e4fc40
|
@@ -291,6 +291,40 @@ function buildScenarioEffectClass(?string $type):iAction{
|
||||
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){
|
||||
if($type === null || $type === ''){
|
||||
$type = GameConst::$defaultSpecialDomestic;
|
||||
@@ -416,6 +450,27 @@ function buildGeneralCommandClass(?string $type, General $generalObj, array $env
|
||||
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){
|
||||
if($type === null || $type === ''){
|
||||
$type = '휴식';
|
||||
|
||||
@@ -148,63 +148,6 @@ function allButton(bool $seizeNPCMode, array $opts = [])
|
||||
], $opts));
|
||||
}
|
||||
|
||||
|
||||
function commandButton(array $opts = [])
|
||||
{
|
||||
$session = Session::getInstance();
|
||||
$userID = Session::getUserID();
|
||||
if (!$session->isGameLoggedIn()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow("select no,nation,officer_level,belong,permission,penalty from general where owner=%i", $userID);
|
||||
|
||||
$nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i", $me['nation']) ?? [
|
||||
'nation' => 0,
|
||||
'level' => 0,
|
||||
'secretlimit' => 99,
|
||||
'color' => '#000000'
|
||||
];
|
||||
|
||||
$bgColor = $nation['color'] ?? '#000000';
|
||||
$fgColor = newColor($bgColor);
|
||||
|
||||
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
|
||||
$showSecret = false;
|
||||
$permission = checkSecretPermission($me);
|
||||
$btnClassForTournament = $opts['btnClass'];
|
||||
if ($opts['isTournamentApplicationOpen']) {
|
||||
if ($btnClassForTournament != 'dropdown-item') {
|
||||
$btnClassForTournament = 'toolbarButton2';
|
||||
}
|
||||
}
|
||||
|
||||
$btnClassForBetting = $opts['btnClass'];
|
||||
if ($opts['isBettingActive']) {
|
||||
if ($btnClassForTournament != 'dropdown-item') {
|
||||
$btnClassForBetting = 'toolbarButton2';
|
||||
}
|
||||
}
|
||||
|
||||
if ($permission >= 1) {
|
||||
$showSecret = true;
|
||||
} else if ($me['officer_level'] == 0) {
|
||||
$showSecret = false;
|
||||
}
|
||||
|
||||
return $templates->render('commandButton', array_merge([
|
||||
'bgColor' => $bgColor,
|
||||
'fgColor' => $fgColor,
|
||||
'meLevel' => $me['officer_level'],
|
||||
'nationLevel' => $nation['level'],
|
||||
'showSecret' => $showSecret,
|
||||
'permission' => $permission,
|
||||
'btnClassForTournament' => $btnClassForTournament,
|
||||
'btnClassForBetting' => $btnClassForBetting,
|
||||
], $opts));
|
||||
}
|
||||
|
||||
function formatWounded(int $value, int $wound): string
|
||||
{
|
||||
if ($wound == 0) {
|
||||
|
||||
@@ -285,19 +285,6 @@ if ($lastVoteID) {
|
||||
<div id="general-position"><?php generalInfo($generalObj); ?></div>
|
||||
<div id="generalCommandButton" class="row gx-0">
|
||||
<div class="buttonPlate bg2">
|
||||
<?= commandButton([
|
||||
'splitBtnBegin' => '<div class="btn-group">',
|
||||
'splitBtnEnd' => '</div>',
|
||||
'splitZoneSign' => '<button type="button" class="btn btn-sammo-nation dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle Dropdown</span></button>',
|
||||
'splitZoneBegin' => '<ul class="dropdown-menu dropdown-menu-end">',
|
||||
'splitZoneEnd' => '</ul>',
|
||||
'splitSubBtnBegin' => '<li>',
|
||||
'splitSubBtnEnd' => '</li>',
|
||||
'btnClass' => 'btn btn-sammo-nation',
|
||||
'btnSplitClass' => 'dropdown-item',
|
||||
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
|
||||
'isBettingActive' => $isBettingActive
|
||||
])
|
||||
?></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -398,18 +385,6 @@ if ($lastVoteID) {
|
||||
국가 메뉴
|
||||
</div>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
|
||||
<?= commandButton([
|
||||
'btnBegin' => '<li>',
|
||||
'btnEnd' => '</li>',
|
||||
'splitMainBegin' => '<div class="d-none">',
|
||||
'splitMainEnd' => '</div>',
|
||||
'splitSubBtnBegin' => '<li>',
|
||||
'splitSubBtnEnd' => '</li>',
|
||||
'btnClass' => 'dropdown-item',
|
||||
'btnSplitClass' => 'dropdown-item',
|
||||
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
|
||||
'isBettingActive' => $isBettingActive
|
||||
]) ?>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item dropup">
|
||||
|
||||
+4
-1
@@ -222,7 +222,10 @@ function extractBattleOrder(WarUnit $defender, WarUnit $attacker)
|
||||
$totalStat = ($realStat + $fullStat) / 2;
|
||||
|
||||
$totalCrew = $general->getVar('crew') / 1000000 * (($general->getVar('train') * $general->getVar('atmos')) ** 1.5);
|
||||
return $totalStat + $totalCrew / 100;
|
||||
$value = $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(
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,14 @@ namespace sammo\API\General;
|
||||
use DateTimeInterface;
|
||||
use MeekroDB;
|
||||
use sammo\CityConst;
|
||||
use sammo\Command\UserActionCommand;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\UserAction;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\CityColumn;
|
||||
use sammo\Enums\GeneralAccessLogColumn;
|
||||
use sammo\Enums\GeneralAuxKey;
|
||||
use sammo\Enums\GeneralColumn;
|
||||
use sammo\Enums\GeneralQueryMode;
|
||||
use sammo\Enums\RankColumn;
|
||||
@@ -27,6 +30,7 @@ use function sammo\buildNationCommandClass;
|
||||
use function sammo\checkLimit;
|
||||
use function sammo\getTournamentTermText;
|
||||
use function sammo\buildNationTypeClass;
|
||||
use function sammo\buildUserActionCommandClass;
|
||||
use function sammo\calcLeadershipBonus;
|
||||
use function sammo\checkSecretPermission;
|
||||
use function sammo\getBillByLevel;
|
||||
@@ -101,7 +105,8 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
return $history;
|
||||
}
|
||||
|
||||
private function generateRecentRecord(int $generalID){
|
||||
private function generateRecentRecord(int $generalID)
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -247,7 +252,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
$nationID
|
||||
);
|
||||
|
||||
if($nationPopulation['cityCnt'] == 0){
|
||||
if ($nationPopulation['cityCnt'] == 0) {
|
||||
$nationPopulation = [
|
||||
'cityCnt' => 0,
|
||||
'now' => 0,
|
||||
@@ -361,6 +366,8 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
|
||||
public function generateGeneralInfo(MeekroDB $db, General $general, array $rawNation): array
|
||||
{
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$admin = $gameStor->getAll(true);
|
||||
|
||||
$permission = checkSecretPermission($general->getRaw());
|
||||
|
||||
@@ -443,6 +450,21 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
'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();
|
||||
$troopID = $general->getVar(GeneralColumn::troop);
|
||||
if (!$troopID) {
|
||||
@@ -483,6 +505,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
'name' => $troopName,
|
||||
];
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -576,7 +599,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
|
||||
if ($globalInfo['lastVote']) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -70,13 +70,13 @@ class ResetTurnTime extends \sammo\BaseAPI
|
||||
UniqueConst::$hiddenSeed,
|
||||
'ResetTurnTime',
|
||||
$userID,
|
||||
$general->getTurnTime()
|
||||
$general->getAuxVar('nextTurnTimeBase') ?? $general->getTurnTime()
|
||||
)));
|
||||
|
||||
$afterTurn = $rng->nextFloat1() * $turnTerm * 60;
|
||||
|
||||
$userLogger = new UserLogger($userID);
|
||||
$userLogger->push(sprintf("{$reqPoint} 포인트로 턴 시간을 바꾸어 다음 턴부터 %02d:%02d 적용", intdiv(Util::toInt($afterTurn), 60), $afterTurn % 60), "inheritPoint");
|
||||
$userLogger->push(sprintf("{$reqPoint} 포인트로 턴 시간을 바꾸어 다다음 턴부터 %02d:%02d 적용", intdiv(Util::toInt($afterTurn), 60), $afterTurn % 60), "inheritPoint");
|
||||
$userLogger->flush();
|
||||
|
||||
$general->setAuxVar('inheritResetTurnTime', $nextLevel);
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
namespace sammo\API\Nation;
|
||||
|
||||
use ArrayObject;
|
||||
use sammo\Command\UserActionCommand;
|
||||
use sammo\DB;
|
||||
use sammo\DTO\UserAction;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\GeneralLiteQueryMode;
|
||||
use sammo\Enums\GeneralQueryMode;
|
||||
@@ -117,6 +119,9 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'reservedCommand' => 1,
|
||||
|
||||
'autorun_limit' => 1,
|
||||
|
||||
'impossibleUserAction' => 1,
|
||||
'reservedUserAction' => 1,
|
||||
];
|
||||
|
||||
public function validateArgs(): ?string
|
||||
@@ -153,7 +158,8 @@ class GeneralList extends \sammo\BaseAPI
|
||||
|
||||
$me = $db->queryFirstRow(
|
||||
'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', $session->getUserID()
|
||||
LEFT JOIN general_access_log AS l ON `general`.no = l.general_id WHERE owner=%i',
|
||||
$session->getUserID()
|
||||
);
|
||||
$limitState = checkLimit($me['refresh_score']);
|
||||
if ($limitState >= 2) {
|
||||
@@ -269,6 +275,50 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
|
||||
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
|
||||
'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) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,8 @@ class che_접경귀환 extends Command\GeneralCommand{
|
||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 접경귀환했습니다.");
|
||||
$general->setVar('city', $destCityID);
|
||||
|
||||
$general->setRawCity(null);
|
||||
|
||||
//TODO: InstantAction일때에만 설정하지 않는게 나은데..
|
||||
//$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?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());
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\DTO;
|
||||
|
||||
use LDTO\DTO;
|
||||
|
||||
class InstantBuff extends DTO{
|
||||
public function __construct(
|
||||
public readonly string $buffName,
|
||||
public readonly int $untilYearMonth,
|
||||
){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\DTO;
|
||||
|
||||
class UserActionItem extends \LDTO\DTO {
|
||||
public function __construct(
|
||||
public string $command,
|
||||
public string $brief,
|
||||
#[\LDTO\Attr\NullIsUndefined]
|
||||
public ?int $untilYearMonth,
|
||||
) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace sammo\Enums;
|
||||
|
||||
enum GeneralAuxKey: string{
|
||||
case instantBuffList = 'instantBuffList';
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class GameConstBase
|
||||
public static $inheritItemRandomPoint = 3000;
|
||||
public static $inheritBuffPoints = [0, 200, 600, 1200, 2000, 3000];
|
||||
public static $inheritSpecificSpecialPoint = 4000;
|
||||
public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000];//필요하면 늘려서 쓰기
|
||||
public static $inheritResetAttrPointBase = [1000, 1000, 2000, 3000]; //필요하면 늘려서 쓰기
|
||||
|
||||
/** @var ?string */
|
||||
public static $scenarioEffect = null;
|
||||
@@ -246,7 +246,7 @@ class GameConstBase
|
||||
'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_명마_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,
|
||||
],
|
||||
'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,
|
||||
@@ -395,6 +395,23 @@ class GameConstBase
|
||||
'che_국호변경',
|
||||
]
|
||||
];
|
||||
|
||||
/** @var array 개인 전략 커맨드 */
|
||||
public static $availableUserActionCommand = [
|
||||
'개인 전략' => [
|
||||
'휴식',
|
||||
'g65_의원소환',
|
||||
'g65_철야내정',
|
||||
'g65_군량급매',
|
||||
'g65_접경귀환',
|
||||
'g65_필중계략',
|
||||
'g65_병장기지원',
|
||||
'g65_입대독려',
|
||||
'g65_병사연회',
|
||||
'g65_약점간파',
|
||||
]
|
||||
];
|
||||
|
||||
public static $retirementYear = 80;
|
||||
|
||||
public static $targetGeneralPool = 'RandomNameGeneral';
|
||||
|
||||
+111
-3
@@ -4,7 +4,10 @@ namespace sammo;
|
||||
|
||||
use Ds\Map;
|
||||
use sammo\Command\GeneralCommand;
|
||||
use sammo\Command\UserActionCommand;
|
||||
use sammo\DTO\InstantBuff;
|
||||
use sammo\Enums\GeneralAccessLogColumn;
|
||||
use sammo\Enums\GeneralAuxKey;
|
||||
use sammo\Enums\GeneralQueryMode;
|
||||
use sammo\Enums\InheritanceKey;
|
||||
use sammo\Enums\RankColumn;
|
||||
@@ -45,6 +48,9 @@ class General extends GeneralBase implements iAction
|
||||
/** @var ?iAction */
|
||||
protected $scenarioEffect = null;
|
||||
|
||||
/** @var iAction[] */
|
||||
protected $instantBuffList = [];
|
||||
|
||||
/** @var ?GameUnitDetail */
|
||||
protected $crewType = null;
|
||||
|
||||
@@ -53,6 +59,9 @@ class General extends GeneralBase implements iAction
|
||||
|
||||
protected $calcCache = [];
|
||||
|
||||
/** @var int */
|
||||
protected $yearMonth;
|
||||
|
||||
/**
|
||||
* @param array $raw DB row값.
|
||||
* @param null|Map<RankColumn,int|float> $rawRank
|
||||
@@ -72,6 +81,8 @@ class General extends GeneralBase implements iAction
|
||||
$this->raw = $raw;
|
||||
$this->rawCity = $city;
|
||||
|
||||
$this->yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
$this->resultTurn = new LastTurn();
|
||||
if (key_exists('last_turn', $this->raw)) {
|
||||
$this->lastTurn = LastTurn::fromJson($this->raw['last_turn']);
|
||||
@@ -115,6 +126,63 @@ class General extends GeneralBase implements iAction
|
||||
if(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)
|
||||
@@ -269,6 +337,46 @@ class General extends GeneralBase implements iAction
|
||||
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
|
||||
{
|
||||
$db = DB::db();
|
||||
@@ -769,7 +877,7 @@ class General extends GeneralBase implements iAction
|
||||
$this->crewType,
|
||||
$this->inheritBuffObj,
|
||||
$this->scenarioEffect
|
||||
], $this->itemObjs);
|
||||
], $this->itemObjs, $this->instantBuffList);
|
||||
}
|
||||
|
||||
public function getPreTurnExecuteTriggerList(General $general): ?GeneralTriggerCaller
|
||||
@@ -806,7 +914,7 @@ class General extends GeneralBase implements iAction
|
||||
continue;
|
||||
}
|
||||
/** @var iAction $iObj */
|
||||
$value = $iObj->onCalcStat($this, $statName, $value, $aux);
|
||||
$value = $iObj->onCalcStat($general, $statName, $value, $aux);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
@@ -819,7 +927,7 @@ class General extends GeneralBase implements iAction
|
||||
continue;
|
||||
}
|
||||
/** @var iAction $iObj */
|
||||
$value = $iObj->onCalcOpposeStat($this, $statName, $value, $aux);
|
||||
$value = $iObj->onCalcOpposeStat($general, $statName, $value, $aux);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,42 @@ class TurnExecutionHelper
|
||||
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
|
||||
{
|
||||
$general = $this->getGeneral();
|
||||
@@ -277,6 +313,8 @@ class TurnExecutionHelper
|
||||
|
||||
$general->increaseInheritancePoint(InheritanceKey::lived_month, 1);
|
||||
|
||||
$general->clearExpiredBuff();
|
||||
|
||||
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
|
||||
UniqueConst::$hiddenSeed,
|
||||
'preprocess',
|
||||
@@ -323,6 +361,12 @@ class TurnExecutionHelper
|
||||
$general->setRawCity(null);
|
||||
}
|
||||
|
||||
$userActionObj = $general->getReservedUserAction($env);
|
||||
if($userActionObj){
|
||||
$turnObj->processUserAction($rng, $userActionObj);
|
||||
}
|
||||
|
||||
|
||||
$generalCommandObj = $general->getReservedTurn(0, $env);
|
||||
if (!($generalCommandObj instanceof Command\General\휴식)) {
|
||||
$hasReservedTurn = true;
|
||||
@@ -348,6 +392,7 @@ class TurnExecutionHelper
|
||||
$turnObj->processCommand($rng, $generalCommandObj, $autorunMode);
|
||||
}
|
||||
pullNationCommand($general->getVar('nation'), $general->getVar('officer_level'));
|
||||
$general->pullUserAction();
|
||||
pullGeneralCommand($general->getID());
|
||||
|
||||
$currentTurn = $general->getTurnTime();
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"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"]
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?=$btnBegin??''?><a href='v_board.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>회 의 실</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_board.php?isSecret=true' class='commandButton <?= $permission >= 2 ? '' : 'disabled' ?> <?=$btnClass??""?>'>기 밀 실</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_troop.php' class='commandButton <?= ($meLevel >= 1 && $nationLevel >= 1) ? '' : 'disabled' ?> <?=$btnClass??""?>'>부대 편성</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='t_diplomacy.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>외 교 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myBossInfo.php' class='commandButton <?= $meLevel >= 1 ? '' : 'disabled' ?> <?=$btnClass??""?>'>인 사 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_nationStratFinan.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>내 무 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_chiefCenter.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>사 령 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_NPCControl.php' class='commandButton <?= $showSecret ? '' : 'disabled' ?> <?=$btnClass??""?>'>NPC 정책</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_genList.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>암 행 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_tournament.php' target='_blank' class='open-window <?=$btnClassForTournament??""?>'>토 너 먼 트</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myKingdomInfo.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 정보</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myCityInfo.php' class='commandButton <?=$btnClass??""?> <?= ($meLevel >= 1 && $nationLevel >= 1) ? '' : 'disabled' ?>'>세력 도시</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_nationGeneral.php' class='commandButton <?=$btnClass??""?> <?= $meLevel >= 1 ? '' : 'disabled' ?>'>세력 장수</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_globalDiplomacy.php' class='commandButton <?=$btnClass??""?>'>중원 정보</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_currentCity.php' class='commandButton <?=$btnClass??""?>'>현재 도시</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_battleCenter.php' target='_blank' class='open-window commandButton <?=$btnClass??""?> <?= $showSecret ? '' : 'disabled' ?>'>감 찰 부</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='v_inheritPoint.php' class='commandButton <?=$btnClass??""?>'>유산 관리</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_myPage.php' class='commandButton <?=$btnClass??""?>'>내 정보&설정</a><?=$btnEnd??''?>
|
||||
<?=$splitBtnBegin??''?>
|
||||
<?=$splitMainBegin??''?><a href='v_auction.php' target='_blank' class='open-window commandButton <?=$btnClass??""?>'>경 매 장</a><?=$splitMainEnd??''?>
|
||||
<?=$splitZoneSign??''?>
|
||||
<?=$splitZoneBegin??''?>
|
||||
<?=$splitSubBtnBegin??''?><a href='v_auction.php' target='_blank' class='open-window commandButton <?=$btnSplitClass??''?>'>금/쌀 경매장</a><?=$splitSubBtnEnd??''?>
|
||||
<?=$splitSubBtnBegin??''?><a href='v_auction.php?type=unique' target='_blank' class='open-window commandButton <?=$btnSplitClass??''?>'>유니크 경매장</a><?=$splitSubBtnEnd??''?>
|
||||
<?=$splitZoneEnd??''?>
|
||||
<?=$splitBtnEnd??''?>
|
||||
<?=$btnBegin??''?><a href='b_betting.php' target='_blank' class='open-window <?=$btnClassForBetting??""?>'>베 팅 장</a><?=$btnEnd??''?>
|
||||
@@ -0,0 +1,133 @@
|
||||
<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>
|
||||
@@ -0,0 +1,434 @@
|
||||
<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>
|
||||
+7
-1
@@ -15,7 +15,7 @@ import {
|
||||
export type { ValidResponse, InvalidResponse };
|
||||
import { APIPathGen, NumVar, StrVar } from "./util/APIPathGen.js";
|
||||
import type { BettingDetailResponse, BettingListResponse } from "./defs/API/Betting";
|
||||
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse } from "./defs/API/Command";
|
||||
import type { ReserveBulkCommandResponse, ReserveCommandResponse, ReservedCommandResponse, ReservedUserActionResponse } from "./defs/API/Command";
|
||||
import type { ChiefResponse } from "./defs/API/NationCommand";
|
||||
import type { inheritBuffType, InheritLogResponse } from "./defs/API/InheritAction";
|
||||
import type { SetBlockWarResponse, GeneralListResponse as NationGeneralListResponse, NationInfoResponse } from "./defs/API/Nation";
|
||||
@@ -109,6 +109,7 @@ const apiRealPath = {
|
||||
},
|
||||
ReserveCommandResponse
|
||||
>,
|
||||
GetReservedUserAction: GET as APICallT<undefined, ReservedUserActionResponse>,
|
||||
ReserveBulkCommand: PUT as APICallT<
|
||||
{
|
||||
turnList: number[];
|
||||
@@ -117,6 +118,10 @@ const apiRealPath = {
|
||||
}[],
|
||||
ReserveBulkCommandResponse
|
||||
>,
|
||||
ReserveUserAction: PUT as APICallT<{
|
||||
turnIdx: number;
|
||||
action: string;
|
||||
}>
|
||||
},
|
||||
General: {
|
||||
Join: POST as APICallT<JoinArgs>,
|
||||
@@ -134,6 +139,7 @@ const apiRealPath = {
|
||||
InstantRetreat: POST as APICallT<undefined>,
|
||||
BuildNationCandidate: POST as APICallT<undefined>,
|
||||
GetCommandTable: GET as APICallT<undefined, CommandTableResponse>,
|
||||
GetUserActionCommandTable: GET as APICallT<undefined, CommandTableResponse>,
|
||||
GetFrontInfo: GET as APICallT<{
|
||||
lastNationNoticeDate?: string,
|
||||
lastGeneralRecordID?: number,
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"v_globalDiplomacy": "v_globalDiplomacy",
|
||||
"v_troop": "v_troop.ts",
|
||||
"v_vote": "v_vote.ts",
|
||||
"v_front": "v_front.ts"
|
||||
"v_front": "v_front.ts",
|
||||
"v_userAction": "v_userAction.ts"
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,17 @@
|
||||
{{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
|
||||
</span>
|
||||
</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="general-refresh-score-total">
|
||||
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
||||
@@ -272,6 +283,25 @@ watch(
|
||||
{ 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);
|
||||
watch(
|
||||
general,
|
||||
@@ -341,7 +371,4 @@ watch(
|
||||
grid-column: 2 / 4;
|
||||
}
|
||||
|
||||
.general-refresh-score-total {
|
||||
grid-column: 5 / 8;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,71 +7,50 @@
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem @click="storeDisplaySetting"><i class="bi bi-bookmark-plus-fill" /> 보관하기</BDropdownItem>
|
||||
<BDropdownDivider />
|
||||
<BDropdownItem
|
||||
v-for="[key, setting] of displaySettings.entries()"
|
||||
:key="key"
|
||||
@click="setDisplaySetting([false, key], setting)"
|
||||
><div class="row gx-0">
|
||||
<BDropdownItem v-for="[key, setting] of displaySettings.entries()" :key="key"
|
||||
@click="setDisplaySetting([false, key], setting)">
|
||||
<div class="row gx-0">
|
||||
<div class="col-9 text-wrap">
|
||||
<span class="align-middle">{{ key }}</span>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="d-grid"><BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton></div>
|
||||
<div class="d-grid">
|
||||
<BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton>
|
||||
</div>
|
||||
</div>
|
||||
</div></BDropdownItem
|
||||
>
|
||||
</div>
|
||||
</BDropdownItem>
|
||||
</BDropdown>
|
||||
<!-- eslint-disable-next-line vue/max-attributes-per-line -->
|
||||
<BDropdown class="w-50" variant="info" text="열 선택" menuClass="column-menu" right>
|
||||
<template v-for="[colID, col, depth] of getColumnList()" :key="[colID, depth]">
|
||||
<BDropdownItem v-if="col instanceof ProvidedColumnGroup" disabled>
|
||||
<span :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }">
|
||||
{{ col.getColGroupDef()?.headerName }}</span
|
||||
></BDropdownItem
|
||||
>
|
||||
{{ col.getColGroupDef()?.headerName }}</span>
|
||||
</BDropdownItem>
|
||||
<BDropdownItem v-else>
|
||||
<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()"
|
||||
@change.stop="toggleColumn(colID, col)"
|
||||
/>
|
||||
<label
|
||||
class="form-check-label"
|
||||
:for="`column-type-${colID}`"
|
||||
:style="{
|
||||
textDecoration: validColumns.has(colID) ? undefined : 'line-through'
|
||||
}"
|
||||
>
|
||||
<input :id="`column-type-${colID}`" class="form-check-input" 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 }}
|
||||
</label>
|
||||
</div></BDropdownItem
|
||||
>
|
||||
</div>
|
||||
</BDropdownItem>
|
||||
</template>
|
||||
<BDropdownDivider />
|
||||
</BDropdown>
|
||||
</BButtonGroup>
|
||||
</Teleport>
|
||||
<div
|
||||
class="component-general-list"
|
||||
:style="{
|
||||
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
|
||||
}"
|
||||
>
|
||||
<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 class="component-general-list" :style="{
|
||||
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
|
||||
}">
|
||||
<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>
|
||||
</template>
|
||||
<script lang="ts"></script>
|
||||
@@ -1048,6 +1027,34 @@ 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: {
|
||||
colId: "turntime",
|
||||
headerName: "턴",
|
||||
@@ -1231,6 +1238,7 @@ watch(columnRawDefs, (val) => {
|
||||
.g-tr {
|
||||
border-bottom: solid gray 1px;
|
||||
}
|
||||
|
||||
.g-thead-tr {
|
||||
position: sticky;
|
||||
top: 0px;
|
||||
@@ -1247,51 +1255,63 @@ watch(columnRawDefs, (val) => {
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ag-root-wrapper .cell-middle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ag-root-wrapper {
|
||||
font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic";
|
||||
font-size: 14px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.ag-root {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.ag-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.cell-center {
|
||||
justify-content: space-around;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cell-right {
|
||||
justify-content: flex-end;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.cell-sp .col {
|
||||
min-width: 30px;
|
||||
}
|
||||
|
||||
.ag-header-cell,
|
||||
.ag-header-group-cell,
|
||||
.ag-cell {
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.ag-header-cell-label,
|
||||
.ag-header-group-cell-label {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ag-ltr .ag-floating-filter-button {
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.ag-rtl .ag-floating-filter-button {
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.general-list-toolbar {
|
||||
.column-menu {
|
||||
column-count: 3;
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
<template>
|
||||
<div class="controlBar">
|
||||
<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`"
|
||||
>기 밀 실</a
|
||||
>
|
||||
<div class="btn-group">
|
||||
<a href="v_board.php" :class="`btn btn-sammo-nation ${myLevel >= 1 ? '' : 'disabled'}`">회 의 실</a>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sammo-nation dropdown-toggle dropdown-toggle-split"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<span class="visually-hidden">Toggle Dropdown</span>
|
||||
</button>
|
||||
<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
|
||||
>
|
||||
@@ -12,6 +27,7 @@
|
||||
<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_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
|
||||
>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<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_NPCControl.php" :class="`dropdown-item ${showSecret ? '' : 'disabled'} `">NPC 정책</a></li>
|
||||
<li><a href="v_userAction.php" class="dropdown-item">개인 전략</a></li>
|
||||
<li>
|
||||
<a href="b_genList.php" target="_blank" :class="`dropdown-item open-window ${showSecret ? '' : 'disabled'}`"
|
||||
>암행부</a
|
||||
|
||||
@@ -20,3 +20,19 @@ export type ReserveBulkCommandResponse = {
|
||||
result: true,
|
||||
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,
|
||||
}
|
||||
@@ -81,6 +81,9 @@ export type GeneralListItemP1 = {
|
||||
killcrew: number;
|
||||
deathcrew: number;
|
||||
firenum: number;
|
||||
|
||||
impossibleUserAction: [string, number][];
|
||||
reservedUserAction: TurnObj[] | null;
|
||||
} & GeneralListItemP0;
|
||||
|
||||
export type GeneralListItemP2 = GeneralListItemP1;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
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')
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user