feat: GeneralList를 API로 이동
This commit is contained in:
+1
-2
@@ -101,8 +101,7 @@ return [
|
|||||||
'hwe/j_general_set_permission.php',
|
'hwe/j_general_set_permission.php',
|
||||||
'hwe/j_get_basic_general_list.php',
|
'hwe/j_get_basic_general_list.php',
|
||||||
'hwe/j_get_city_list.php',
|
'hwe/j_get_city_list.php',
|
||||||
'hwe/j_get_general_list.php',
|
'hwe/j_get_reserved_command.php',
|
||||||
'hwe/j_get_nation_general_list.php',
|
|
||||||
'hwe/j_get_select_npc_token.php',
|
'hwe/j_get_select_npc_token.php',
|
||||||
'hwe/j_get_select_pool.php',
|
'hwe/j_get_select_pool.php',
|
||||||
'hwe/j_image_upload.php',
|
'hwe/j_image_upload.php',
|
||||||
|
|||||||
@@ -1,109 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireLogin([]);
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$withToken = Util::getPost('with_token', 'bool', false);
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
|
|
||||||
if($session->isGameLoggedIn()){
|
|
||||||
increaseRefresh("장수일람", 2);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
|
|
||||||
$con = checkLimit($me['con']);
|
|
||||||
if ($con >= 2) {
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>'접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$availableNextCall = $session->availableNextCallGetGeneralList??'2000-01-01 00:00:00';
|
|
||||||
$now = new \DateTimeImmutable();
|
|
||||||
|
|
||||||
if($now <= new \DateTimeImmutable($availableNextCall) && $session->userGrade < 5){
|
|
||||||
Json::die([
|
|
||||||
'result'=>false,
|
|
||||||
'reason'=>"장수 리스트는 10초에 한번 갱신 가능합니다.\n다음 시간 : ".$availableNextCall
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$availableNextCall = $now->add(new \DateInterval('PT10S'))->format('Y-m-d H:i:s');
|
|
||||||
$session->availableNextCallGetGeneralList = $availableNextCall;
|
|
||||||
}
|
|
||||||
|
|
||||||
$session->setReadOnly();
|
|
||||||
|
|
||||||
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general');
|
|
||||||
|
|
||||||
$ownerNameList = [];
|
|
||||||
if($gameStor->isunited){
|
|
||||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
|
||||||
$ownerNameList[$ownerID] = $ownerName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$generalList = [];
|
|
||||||
foreach($rawGeneralList as $rawGeneral){
|
|
||||||
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$officerLevel,$killturn,$connectCnt] = $rawGeneral;
|
|
||||||
|
|
||||||
if(key_exists($owner, $ownerNameList)){
|
|
||||||
$ownerName = $ownerNameList[$owner];
|
|
||||||
}
|
|
||||||
|
|
||||||
$nationArr = getNationStaticInfo($nation);
|
|
||||||
$lbonus = calcLeadershipBonus($officerLevel, $nationArr['level']);
|
|
||||||
|
|
||||||
$generalList[] = [
|
|
||||||
$no,
|
|
||||||
$picture,
|
|
||||||
$imgsvr,
|
|
||||||
$npc,
|
|
||||||
$age,
|
|
||||||
$nationArr['name'],
|
|
||||||
getGeneralSpecialDomesticName($special),
|
|
||||||
getGeneralSpecialWarName($special2),
|
|
||||||
getGenChar($personal),
|
|
||||||
$name,
|
|
||||||
$npc==1?$ownerName:null,
|
|
||||||
$injury,
|
|
||||||
$leadership,
|
|
||||||
$lbonus,
|
|
||||||
$strength,
|
|
||||||
$intel,
|
|
||||||
getExpLevel($experience),
|
|
||||||
getHonor($experience),
|
|
||||||
getDed($dedication),
|
|
||||||
getOfficerLevelText($officerLevel, $nationArr['level']),
|
|
||||||
$killturn,
|
|
||||||
$connectCnt
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = [
|
|
||||||
'result'=>'true',
|
|
||||||
'list'=>$generalList,
|
|
||||||
];
|
|
||||||
|
|
||||||
if($withToken){
|
|
||||||
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
|
|
||||||
$tokens = [];
|
|
||||||
foreach($db->query('SELECT * FROM select_npc_token WHERE `valid_until`>=%s', $now) as $token){
|
|
||||||
$validUntil = $token['valid_until'];
|
|
||||||
|
|
||||||
foreach(Json::decode($token['pick_result']) as $pickResult){
|
|
||||||
$tokens[$pickResult['no']]=$pickResult['keepCnt'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$result['token'] = $tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
Json::die($result);
|
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
//통합 세력장수&암행부 viewer
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin([])->setReadOnly();
|
|
||||||
$userID = Session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$reqType = Util::getReq('req', 'int', 1);
|
|
||||||
$reqForce = Util::getReq('force', 'bool', false);
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
|
|
||||||
increaseRefresh("세력장수", 1);
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $userID);
|
|
||||||
$con = checkLimit($me['con']);
|
|
||||||
if ($con >= 2) {
|
|
||||||
Json::die([
|
|
||||||
'result' => false,
|
|
||||||
'reason' => '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$nationID = $me['nation'];
|
|
||||||
$permission = checkSecretPermission($me, true);
|
|
||||||
if ($reqForce && $reqType > $permission) {
|
|
||||||
Json::die([
|
|
||||||
'result' => false,
|
|
||||||
'reason' => '권한이 부족합니다.'
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
$permission = min($reqType, $permission);
|
|
||||||
$nationArr = getNationStaticInfo($nationID);
|
|
||||||
$viewColumns = [
|
|
||||||
'no' => 0,
|
|
||||||
'name' => 0,
|
|
||||||
'owner_name' => 9,
|
|
||||||
'nation' => 0,
|
|
||||||
'city' => 1,
|
|
||||||
'officer_level' => 2,
|
|
||||||
'officer_city' => 2,
|
|
||||||
'npc' => 0,
|
|
||||||
'defence_train' => 2,
|
|
||||||
'troop' => 2,
|
|
||||||
'injury' => 0,
|
|
||||||
'leadership' => 0,
|
|
||||||
'strength' => 0,
|
|
||||||
'intel' => 0,
|
|
||||||
'experience' => 1,
|
|
||||||
'explevel' => 0,
|
|
||||||
'dedication' => 1,
|
|
||||||
'dedlevel' => 0,
|
|
||||||
'gold' => 0,
|
|
||||||
'rice' => 0,
|
|
||||||
'crewtype' => 2,
|
|
||||||
'crew' => 2,
|
|
||||||
'train' => 2,
|
|
||||||
'atmos' => 2,
|
|
||||||
'killturn' => 0,
|
|
||||||
'turntime' => 2,
|
|
||||||
'picture' => 0,
|
|
||||||
'imgsvr' => 0,
|
|
||||||
'age' => 0,
|
|
||||||
'special' => 0,
|
|
||||||
'special2' => 0,
|
|
||||||
'personal' => 0,
|
|
||||||
'belong' => 0,
|
|
||||||
'horse' => 2,
|
|
||||||
'weapon' => 2,
|
|
||||||
'book' => 2,
|
|
||||||
'item' => 2,
|
|
||||||
'connect' => 0
|
|
||||||
];
|
|
||||||
|
|
||||||
$customViewColumns = [
|
|
||||||
'officerLevel' => 0,
|
|
||||||
'officerLevelText' => 0,
|
|
||||||
'lbonus' => 0,
|
|
||||||
'ownerName' => 0,
|
|
||||||
'honorText' => 0
|
|
||||||
];
|
|
||||||
|
|
||||||
function getOfficerLevel($rawGeneral)
|
|
||||||
{
|
|
||||||
global $permission;
|
|
||||||
$level = $rawGeneral['officer_level'];
|
|
||||||
if ($level >= 5) {
|
|
||||||
return $level;
|
|
||||||
}
|
|
||||||
if ($permission > 1) {
|
|
||||||
return $level;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$specialViewFilter = [
|
|
||||||
'officerLevel' => function ($rawGeneral){
|
|
||||||
return getOfficerLevel($rawGeneral);
|
|
||||||
},
|
|
||||||
'special' => function ($rawGeneral) {
|
|
||||||
return getGeneralSpecialDomesticName($rawGeneral['special']);
|
|
||||||
},
|
|
||||||
'special2' => function ($rawGeneral) {
|
|
||||||
return getGeneralSpecialWarName($rawGeneral['special2']);
|
|
||||||
},
|
|
||||||
'personal' => function ($rawGeneral) {
|
|
||||||
return getGenChar($rawGeneral['personal']);
|
|
||||||
},
|
|
||||||
'lbonus' => function ($rawGeneral) use ($nationArr) {
|
|
||||||
return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']);
|
|
||||||
},
|
|
||||||
'ownerName' => function ($rawGeneral) {
|
|
||||||
if ($rawGeneral['npc'] != 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return $rawGeneral['owner_name'];
|
|
||||||
},
|
|
||||||
'officerLevelText' => function ($rawGeneral) use ($nationArr) {
|
|
||||||
$level = getOfficerLevel($rawGeneral);
|
|
||||||
return getOfficerLevelText($level, $nationArr['level']);
|
|
||||||
},
|
|
||||||
'honorText' => function ($rawGeneral) {
|
|
||||||
return getHonor($rawGeneral['experience']);
|
|
||||||
},
|
|
||||||
'dedLevelText' => function ($rawGeneral) {
|
|
||||||
return getDedLevelText($rawGeneral['dedLevel']);
|
|
||||||
},
|
|
||||||
'turntime' => function ($rawGeneral) {
|
|
||||||
//'0000-00-00 11:23';
|
|
||||||
return substr($rawGeneral['turntime'], 11, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
[$queryColumns, $rankColumns] = General::mergeQueryColumn(array_keys($viewColumns), 1);
|
|
||||||
|
|
||||||
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
|
||||||
|
|
||||||
$resultColumns = [];
|
|
||||||
foreach ($viewColumns as $column => $reqPermission) {
|
|
||||||
if ($reqPermission > $permission) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$resultColumns[] = $column;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($customViewColumns as $column => $reqPermission) {
|
|
||||||
if ($reqPermission > $permission) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$resultColumns[] = $column;
|
|
||||||
}
|
|
||||||
|
|
||||||
$generalList = [];
|
|
||||||
foreach ($rawGeneralList as $rawGeneral) {
|
|
||||||
//General 생성?
|
|
||||||
|
|
||||||
$item = [];
|
|
||||||
foreach ($resultColumns as $column) {
|
|
||||||
if (key_exists($column, $specialViewFilter)) {
|
|
||||||
$value = $specialViewFilter[$column]($rawGeneral);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$value = $rawGeneral[$column];
|
|
||||||
}
|
|
||||||
$item[] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$generalList[] = $item;
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = [
|
|
||||||
'result' => true,
|
|
||||||
'column' => $resultColumns,
|
|
||||||
'list' => $generalList,
|
|
||||||
];
|
|
||||||
|
|
||||||
Json::die($result);
|
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace sammo\API\List\Nation;
|
||||||
|
|
||||||
|
use sammo\DB;
|
||||||
|
use sammo\General;
|
||||||
|
use sammo\Json;
|
||||||
|
use sammo\KVStorage;
|
||||||
|
use sammo\RootDB;
|
||||||
|
use sammo\Session;
|
||||||
|
use sammo\Util;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
|
use function sammo\calcLeadershipBonus;
|
||||||
|
use function sammo\checkLimit;
|
||||||
|
use function sammo\checkSecretPermission;
|
||||||
|
use function sammo\getDed;
|
||||||
|
use function sammo\getDedLevelText;
|
||||||
|
use function sammo\getExpLevel;
|
||||||
|
use function sammo\getGenChar;
|
||||||
|
use function sammo\getGeneralSpecialDomesticName;
|
||||||
|
use function sammo\getGeneralSpecialWarName;
|
||||||
|
use function sammo\getHonor;
|
||||||
|
use function sammo\getNationStaticInfo;
|
||||||
|
use function sammo\getOfficerLevelText;
|
||||||
|
use function sammo\increaseRefresh;
|
||||||
|
|
||||||
|
class GeneralList extends \sammo\BaseAPI
|
||||||
|
{
|
||||||
|
public function validateArgs(): ?string
|
||||||
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v
|
||||||
|
->rule('boolean', 'with_token');
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRequiredSessionMode(): int
|
||||||
|
{
|
||||||
|
return static::REQ_LOGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
|
||||||
|
{
|
||||||
|
$db = DB::db();
|
||||||
|
$withToken = $this->args['with_token']??false;
|
||||||
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
|
$userID = $session->userID;
|
||||||
|
if ($session->isGameLoggedIn()) {
|
||||||
|
increaseRefresh("장수일람", 2);
|
||||||
|
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
|
||||||
|
$con = checkLimit($me['con']);
|
||||||
|
if ($con >= 2) {
|
||||||
|
return '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$availableNextCall = $session->availableNextCallGetGeneralList ?? '2000-01-01 00:00:00';
|
||||||
|
$now = new \DateTimeImmutable();
|
||||||
|
|
||||||
|
if ($now <= new \DateTimeImmutable($availableNextCall) && $session->userGrade < 5) {
|
||||||
|
return "장수 리스트는 10초에 한번 갱신 가능합니다.\n다음 시간 : " . $availableNextCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
$availableNextCall = $now->add(new \DateInterval('PT10S'))->format('Y-m-d H:i:s');
|
||||||
|
$session->availableNextCallGetGeneralList = $availableNextCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
$session->setReadOnly();
|
||||||
|
|
||||||
|
|
||||||
|
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general');
|
||||||
|
|
||||||
|
$ownerNameList = [];
|
||||||
|
if ($gameStor->isunited) {
|
||||||
|
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
|
||||||
|
$ownerNameList[$ownerID] = $ownerName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$generalList = [];
|
||||||
|
foreach ($rawGeneralList as $rawGeneral) {
|
||||||
|
[$owner, $no, $picture, $imgsvr, $npc, $age, $nation, $special, $special2, $personal, $name, $ownerName, $injury, $leadership, $strength, $intel, $experience, $dedication, $officerLevel, $killturn, $connectCnt] = $rawGeneral;
|
||||||
|
|
||||||
|
if (key_exists($owner, $ownerNameList)) {
|
||||||
|
$ownerName = $ownerNameList[$owner];
|
||||||
|
}
|
||||||
|
|
||||||
|
$nationArr = getNationStaticInfo($nation);
|
||||||
|
$lbonus = calcLeadershipBonus($officerLevel, $nationArr['level']);
|
||||||
|
|
||||||
|
$generalList[] = [
|
||||||
|
$no,
|
||||||
|
$picture,
|
||||||
|
$imgsvr,
|
||||||
|
$npc,
|
||||||
|
$age,
|
||||||
|
$nationArr['name'],
|
||||||
|
getGeneralSpecialDomesticName($special),
|
||||||
|
getGeneralSpecialWarName($special2),
|
||||||
|
getGenChar($personal),
|
||||||
|
$name,
|
||||||
|
$npc == 1 ? $ownerName : null,
|
||||||
|
$injury,
|
||||||
|
$leadership,
|
||||||
|
$lbonus,
|
||||||
|
$strength,
|
||||||
|
$intel,
|
||||||
|
getExpLevel($experience),
|
||||||
|
getHonor($experience),
|
||||||
|
getDed($dedication),
|
||||||
|
getOfficerLevelText($officerLevel, $nationArr['level']),
|
||||||
|
$killturn,
|
||||||
|
$connectCnt
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$resultColumns = [
|
||||||
|
'no',
|
||||||
|
'picture',
|
||||||
|
'imgsvr',
|
||||||
|
'npc',
|
||||||
|
'age',
|
||||||
|
'nationName',
|
||||||
|
'special',
|
||||||
|
'special2',
|
||||||
|
'personal',
|
||||||
|
'name',
|
||||||
|
'ownerName',
|
||||||
|
'injury',
|
||||||
|
'leadership',
|
||||||
|
'lbonus',
|
||||||
|
'strength',
|
||||||
|
'intel',
|
||||||
|
'explevel',
|
||||||
|
'honorText',
|
||||||
|
'dedLevelText',
|
||||||
|
'officerLevelText',
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'result' => 'true',
|
||||||
|
'column' => $resultColumns,
|
||||||
|
'list' => $generalList,
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if ($withToken) {
|
||||||
|
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
|
||||||
|
$tokens = [];
|
||||||
|
foreach ($db->query('SELECT * FROM select_npc_token WHERE `valid_until`>=%s', $now) as $token) {
|
||||||
|
$validUntil = $token['valid_until'];
|
||||||
|
|
||||||
|
foreach (Json::decode($token['pick_result']) as $pickResult) {
|
||||||
|
$tokens[$pickResult['no']] = $pickResult['keepCnt'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result['token'] = $tokens;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,31 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\API\List;
|
namespace sammo\API\List\Nation;
|
||||||
|
|
||||||
use sammo\ActionLogger;
|
|
||||||
use sammo\CityConst;
|
|
||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\GameConst;
|
|
||||||
use sammo\GameUnitConst;
|
|
||||||
use sammo\General;
|
use sammo\General;
|
||||||
use sammo\JosaUtil;
|
|
||||||
use sammo\Json;
|
|
||||||
use sammo\KVStorage;
|
|
||||||
use sammo\RootDB;
|
|
||||||
use sammo\Session;
|
use sammo\Session;
|
||||||
use sammo\SpecialityHelper;
|
|
||||||
use sammo\StringUtil;
|
|
||||||
use sammo\TimeUtil;
|
|
||||||
use sammo\UserLogger;
|
|
||||||
use sammo\Util;
|
use sammo\Util;
|
||||||
use sammo\Validator;
|
use sammo\Validator;
|
||||||
use sammo\WebUtil;
|
|
||||||
|
|
||||||
use function sammo\addTurn;
|
|
||||||
use function sammo\calcLeadershipBonus;
|
use function sammo\calcLeadershipBonus;
|
||||||
use function sammo\checkLimit;
|
use function sammo\checkLimit;
|
||||||
use function sammo\checkSecretPermission;
|
use function sammo\checkSecretPermission;
|
||||||
use function sammo\cutTurn;
|
|
||||||
use function sammo\getDedLevelText;
|
use function sammo\getDedLevelText;
|
||||||
use function sammo\getGenChar;
|
use function sammo\getGenChar;
|
||||||
use function sammo\getGeneralSpecialDomesticName;
|
use function sammo\getGeneralSpecialDomesticName;
|
||||||
@@ -33,12 +18,9 @@ use function sammo\getGeneralSpecialWarName;
|
|||||||
use function sammo\getHonor;
|
use function sammo\getHonor;
|
||||||
use function sammo\getNationStaticInfo;
|
use function sammo\getNationStaticInfo;
|
||||||
use function sammo\getOfficerLevelText;
|
use function sammo\getOfficerLevelText;
|
||||||
use function sammo\getRandTurn;
|
|
||||||
use function sammo\increaseRefresh;
|
use function sammo\increaseRefresh;
|
||||||
use function sammo\pushAdminLog;
|
|
||||||
use function sammo\resetInheritanceUser;
|
|
||||||
|
|
||||||
class NationGeneral extends \sammo\BaseAPI
|
class GeneralList extends \sammo\BaseAPI
|
||||||
{
|
{
|
||||||
|
|
||||||
private int $reqType;
|
private int $reqType;
|
||||||
+26
-15
@@ -270,7 +270,7 @@ function printGenerals(value: NPCToken) {
|
|||||||
function printGeneralList(value: GeneralListResponse) {
|
function printGeneralList(value: GeneralListResponse) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
const tokenList = value.token;
|
const tokenList = value.token;
|
||||||
const generalList:NPCPickPrintable[] = value.list.map((rawGeneral) => {
|
const generalList: NPCPickPrintable[] = value.list.map((rawGeneral) => {
|
||||||
const general: NPCPickPrintableR = {
|
const general: NPCPickPrintableR = {
|
||||||
no: rawGeneral[0],
|
no: rawGeneral[0],
|
||||||
picture: rawGeneral[1],
|
picture: rawGeneral[1],
|
||||||
@@ -317,7 +317,7 @@ function printGeneralList(value: GeneralListResponse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (general.reserved == 1) {
|
if (general.reserved == 1) {
|
||||||
general.nameAux += `<br><small>(${tokenList[general.no]}회)</small>`;
|
general.nameAux += `<br><small>(${tokenList[general.no]}회)</small>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ function printGeneralList(value: GeneralListResponse) {
|
|||||||
_printGeneralList(true);
|
_printGeneralList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _printGeneralList(clear?:boolean) {
|
function _printGeneralList(clear?: boolean) {
|
||||||
const $generalTable = $('#general_list');
|
const $generalTable = $('#general_list');
|
||||||
if (clear) {
|
if (clear) {
|
||||||
$generalTable.empty();
|
$generalTable.empty();
|
||||||
@@ -438,20 +438,31 @@ $(function ($) {
|
|||||||
}, errUnknown);
|
}, errUnknown);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_load_general_list').click(function () {
|
$('#btn_load_general_list').click(async function () {
|
||||||
$.post({
|
|
||||||
url: 'j_get_general_list.php',
|
let result: InvalidResponse | GeneralListResponse;
|
||||||
dataType: 'json',
|
try {
|
||||||
data: {
|
const response = await axios({
|
||||||
with_token: true
|
url: "api.php",
|
||||||
}
|
method: "post",
|
||||||
}).then(function (result) {
|
responseType: "json",
|
||||||
|
data: {
|
||||||
|
path: "Global/GeneralList",
|
||||||
|
args: {
|
||||||
|
with_token: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
result = response.data;
|
||||||
if (!result.result) {
|
if (!result.result) {
|
||||||
alert(result.reason);
|
throw result.reason;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
printGeneralList(result);
|
} catch (e) {
|
||||||
}, errUnknown);
|
console.error(e);
|
||||||
|
alert(`실패했습니다: ${e}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
printGeneralList(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btn_print_more').click(function () {
|
$('#btn_print_more').click(function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user