refac, fix: General 객체 생성 과정에서 accessLog 분리
- 생성자 인수 1개 추가, - mergeQueryColumn에서 $accessLogColumn에 정상적으로 enum[] 반영 - createGeneralObjListFromDB를 쿼리 1회 분리 - General에 getAccessLogVar() 추가 - 변경 기능 제공 예정 '없음' - 변경된 생성자에 맞게 호출 부 변경 - NPC인 경우 accessLog 조회값이 null일 수 있으므로 반영
This commit is contained in:
@@ -327,7 +327,7 @@ $templates = new \League\Plates\Engine('templates');
|
|||||||
|
|
||||||
if ($ourGeneral && !$isNPC) {
|
if ($ourGeneral && !$isNPC) {
|
||||||
$turnText = [];
|
$turnText = [];
|
||||||
$generalObj = new General($general, null, null, null, null, null, false);
|
$generalObj = new General($general, null, null, null, null, null, null, false);
|
||||||
foreach ($generalTurnList[$generalObj->getID()] as $turnRawIdx => $turn) {
|
foreach ($generalTurnList[$generalObj->getID()] as $turnRawIdx => $turn) {
|
||||||
$turnIdx = $turnRawIdx + 1;
|
$turnIdx = $turnRawIdx + 1;
|
||||||
$turnText[] = "{$turnIdx} : $turn";
|
$turnText[] = "{$turnIdx} : $turn";
|
||||||
|
|||||||
+6
-2
@@ -1026,12 +1026,16 @@ function increaseRefresh($type = "", $cnt = 1)
|
|||||||
GeneralAccessLogColumn::generalID->value => $generalID,
|
GeneralAccessLogColumn::generalID->value => $generalID,
|
||||||
GeneralAccessLogColumn::userID->value => $userID,
|
GeneralAccessLogColumn::userID->value => $userID,
|
||||||
GeneralAccessLogColumn::lastRefresh->value => $date,
|
GeneralAccessLogColumn::lastRefresh->value => $date,
|
||||||
GeneralAccessLogColumn::refreshTotal->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refreshTotal->value, $cnt),
|
GeneralAccessLogColumn::refreshTotal->value => $cnt,
|
||||||
GeneralAccessLogColumn::refresh->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refresh->value, $cnt),
|
GeneralAccessLogColumn::refresh->value => $cnt,
|
||||||
|
GeneralAccessLogColumn::refreshScore->value => $cnt,
|
||||||
|
GeneralAccessLogColumn::refreshScoreTotal->value => $cnt,
|
||||||
], [
|
], [
|
||||||
GeneralAccessLogColumn::lastRefresh->value => $date,
|
GeneralAccessLogColumn::lastRefresh->value => $date,
|
||||||
GeneralAccessLogColumn::refreshTotal->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refreshTotal->value, $cnt),
|
GeneralAccessLogColumn::refreshTotal->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refreshTotal->value, $cnt),
|
||||||
GeneralAccessLogColumn::refresh->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refresh->value, $cnt),
|
GeneralAccessLogColumn::refresh->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refresh->value, $cnt),
|
||||||
|
GeneralAccessLogColumn::refreshScore->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refreshScore->value, $cnt),
|
||||||
|
GeneralAccessLogColumn::refreshScoreTotal->value => $db->sqleval('%b + %i', GeneralAccessLogColumn::refreshScoreTotal->value, $cnt),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$serverPath = __DIR__;
|
$serverPath = __DIR__;
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ function disaster(RandUtil $rng) {
|
|||||||
|
|
||||||
$generalList = array_map(
|
$generalList = array_map(
|
||||||
function($rawGeneral) use ($city, $year, $month){
|
function($rawGeneral) use ($city, $year, $month){
|
||||||
return new General($rawGeneral, null, $city, null, $year, $month, false);
|
return new General($rawGeneral, null, null, $city, null, $year, $month, false);
|
||||||
},
|
},
|
||||||
$generalListByCity[$city['city']]??[]
|
$generalListByCity[$city['city']]??[]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ if (key_exists('inheritBuff', $rawAttacker)) {
|
|||||||
}
|
}
|
||||||
$rawAttacker['aux'] = Json::encode($rawAttacker['aux']);
|
$rawAttacker['aux'] = Json::encode($rawAttacker['aux']);
|
||||||
$rawAttacker['owner'] = 0;
|
$rawAttacker['owner'] = 0;
|
||||||
$attackerGeneral = new General($rawAttacker, extractRankVar($rawAttacker), $rawAttackerCity, $rawAttackerNation, $year, $month);
|
$attackerGeneral = new General($rawAttacker, extractRankVar($rawAttacker), null, $rawAttackerCity, $rawAttackerNation, $year, $month);
|
||||||
$attacker = new WarUnitGeneral(
|
$attacker = new WarUnitGeneral(
|
||||||
$tmpRNG,
|
$tmpRNG,
|
||||||
$attackerGeneral,
|
$attackerGeneral,
|
||||||
@@ -308,7 +308,7 @@ foreach ($rawDefenderList as $idx => $rawDefenderGeneral) {
|
|||||||
$rawDefenderGeneral['aux'] = Json::encode($rawDefenderGeneral['aux']);
|
$rawDefenderGeneral['aux'] = Json::encode($rawDefenderGeneral['aux']);
|
||||||
$rawDefenderGeneral['owner'] = 0;
|
$rawDefenderGeneral['owner'] = 0;
|
||||||
|
|
||||||
$defenderGeneral = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
$defenderGeneral = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), null, $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
||||||
|
|
||||||
$defenderList[] = new WarUnitGeneral(
|
$defenderList[] = new WarUnitGeneral(
|
||||||
$tmpRNG,
|
$tmpRNG,
|
||||||
@@ -382,7 +382,7 @@ function simulateBattle(
|
|||||||
|
|
||||||
$warRng = new RandUtil(new LiteHashDRBG($warSeed));
|
$warRng = new RandUtil(new LiteHashDRBG($warSeed));
|
||||||
|
|
||||||
$attackerGeneral = new General($rawAttacker, extractRankVar($rawAttacker), $rawAttackerCity, $rawAttackerNation, $year, $month);
|
$attackerGeneral = new General($rawAttacker, extractRankVar($rawAttacker), null, $rawAttackerCity, $rawAttackerNation, $year, $month);
|
||||||
$attacker = new WarUnitGeneral(
|
$attacker = new WarUnitGeneral(
|
||||||
$warRng,
|
$warRng,
|
||||||
$attackerGeneral,
|
$attackerGeneral,
|
||||||
@@ -395,7 +395,7 @@ function simulateBattle(
|
|||||||
$defenderList = [];
|
$defenderList = [];
|
||||||
|
|
||||||
foreach ($rawDefenderList as $rawDefenderGeneral) {
|
foreach ($rawDefenderList as $rawDefenderGeneral) {
|
||||||
$defenderGeneral = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
$defenderGeneral = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), null, $rawDefenderCity, $rawAttackerNation, $year, $month, true);
|
||||||
|
|
||||||
$defenderList[] = new WarUnitGeneral(
|
$defenderList[] = new WarUnitGeneral(
|
||||||
$warRng,
|
$warRng,
|
||||||
|
|||||||
+1
-1
@@ -598,7 +598,7 @@ function ConquerCity(array $admin, General $general, array $city)
|
|||||||
Util::formatListOfBackticks(General::mergeQueryColumn(['npc', 'gold', 'rice', 'experience', 'explevel', 'belong', 'dedication', 'dedlevel', 'aux'], 1)[0]),
|
Util::formatListOfBackticks(General::mergeQueryColumn(['npc', 'gold', 'rice', 'experience', 'explevel', 'belong', 'dedication', 'dedlevel', 'aux'], 1)[0]),
|
||||||
$defenderNationID,
|
$defenderNationID,
|
||||||
12
|
12
|
||||||
), null, $city, $loseNation, $year, $month, false);
|
), null, null, $city, $loseNation, $year, $month, false);
|
||||||
|
|
||||||
$josaUl = JosaUtil::pick($defenderNationName, '을');
|
$josaUl = JosaUtil::pick($defenderNationName, '을');
|
||||||
$attackerLogger->pushNationalHistoryLog("<D><b>{$defenderNationName}</b></>{$josaUl} 정복");
|
$attackerLogger->pushNationalHistoryLog("<D><b>{$defenderNationName}</b></>{$josaUl} 정복");
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
'personal' => $general->getVar(GeneralColumn::personal), // GameObjClassKey;
|
'personal' => $general->getVar(GeneralColumn::personal), // GameObjClassKey;
|
||||||
'belong' => $general->getVar(GeneralColumn::belong), // number;
|
'belong' => $general->getVar(GeneralColumn::belong), // number;
|
||||||
|
|
||||||
'refreshScoreTotal' => $general->getVar(GeneralAccessLogColumn::refreshScoreTotal), // number;
|
'refreshScoreTotal' => $general->getAccessLogVar(GeneralAccessLogColumn::refreshScoreTotal, 0), // number;
|
||||||
|
|
||||||
'officerLevel' => $general->getVar(GeneralColumn::officer_level), // number;
|
'officerLevel' => $general->getVar(GeneralColumn::officer_level), // number;
|
||||||
'officerLevelText' => getOfficerLevelText($general->getVar(GeneralColumn::officer_level), $rawNation['level']), // string;
|
'officerLevelText' => getOfficerLevelText($general->getVar(GeneralColumn::officer_level), $rawNation['level']), // string;
|
||||||
@@ -402,7 +402,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
'troop' => $general->getVar(GeneralColumn::troop), // number;
|
'troop' => $general->getVar(GeneralColumn::troop), // number;
|
||||||
//P0 End
|
//P0 End
|
||||||
|
|
||||||
'refreshScore' => $general->getVar(GeneralAccessLogColumn::refreshScore), // number;
|
'refreshScore' => $general->getAccessLogVar(GeneralAccessLogColumn::refreshScore, 0), // number;
|
||||||
'specage' => $general->getVar(GeneralColumn::specage), // number;
|
'specage' => $general->getVar(GeneralColumn::specage), // number;
|
||||||
'specage2' => $general->getVar(GeneralColumn::specage2), // number;
|
'specage2' => $general->getVar(GeneralColumn::specage2), // number;
|
||||||
'leadership_exp' => $general->getVar(GeneralColumn::leadership_exp), // number;
|
'leadership_exp' => $general->getVar(GeneralColumn::leadership_exp), // number;
|
||||||
@@ -537,7 +537,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
|||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
$cityID = $general->getCityID();
|
$cityID = $general->getCityID();
|
||||||
|
|
||||||
$limitState = checkLimit($general->getVar('refresh_score') ?? 0);
|
$limitState = checkLimit($general->getAccessLogVar(GeneralAccessLogColumn::refreshScore, 0));
|
||||||
if ($limitState >= 2) {
|
if ($limitState >= 2) {
|
||||||
return [
|
return [
|
||||||
'result' => false,
|
'result' => false,
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
getDed($dedication),
|
getDed($dedication),
|
||||||
getOfficerLevelText($officerLevel, $nationArr['level']),
|
getOfficerLevelText($officerLevel, $nationArr['level']),
|
||||||
$killturn,
|
$killturn,
|
||||||
$refreshScoreTotal
|
$refreshScoreTotal ?: 0,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
'owner_name' => 9, //안씀.
|
'owner_name' => 9, //안씀.
|
||||||
|
|
||||||
|
|
||||||
//acessLog
|
//accessLog
|
||||||
'refresh_score_total' => 0,
|
'refresh_score_total' => 0,
|
||||||
'refresh_score' => 1,
|
'refresh_score' => 1,
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@ class GeneralList extends \sammo\BaseAPI
|
|||||||
static $columnRemap = [
|
static $columnRemap = [
|
||||||
'special' => 'specialDomestic',
|
'special' => 'specialDomestic',
|
||||||
'special2' => 'specialWar',
|
'special2' => 'specialWar',
|
||||||
|
'refresh_score_total' => 'refreshScoreTotal',
|
||||||
|
'refresh_score' => 'refreshScore',
|
||||||
'aux' => null,
|
'aux' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class GetReservedCommand extends \sammo\BaseAPI
|
|||||||
|
|
||||||
$generals = [];
|
$generals = [];
|
||||||
foreach ($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5', $nationID) as $rawGeneral) {
|
foreach ($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5', $nationID) as $rawGeneral) {
|
||||||
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, null, $year, $month, false);
|
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, null, null, null, $year, $month, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$nationTurnList = [];
|
$nationTurnList = [];
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ReqGeneralCrewMargin extends Constraint{
|
|||||||
|
|
||||||
//XXX: 왜 General -> obj -> General 변환을 하고 있나?
|
//XXX: 왜 General -> obj -> General 변환을 하고 있나?
|
||||||
//FIXME: RankVar, city에 따라 통솔이 바뀐다면 이 부분에 문제가 발생.
|
//FIXME: RankVar, city에 따라 통솔이 바뀐다면 이 부분에 문제가 발생.
|
||||||
$generalObj = new General($this->general, null, null, null, null, null, true);
|
$generalObj = new General($this->general, null, null, null, null, null, null, true);
|
||||||
|
|
||||||
if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){
|
if($reqCrewType->id != $generalObj->getCrewTypeObj()->id){
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ class ProcessIncome extends \sammo\Event\Action
|
|||||||
|
|
||||||
// 각 장수들에게 지급
|
// 각 장수들에게 지급
|
||||||
foreach ($generalRawList as $rawGeneral) {
|
foreach ($generalRawList as $rawGeneral) {
|
||||||
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
|
$generalObj = new General($rawGeneral, null, null, null, null, $year, $month, false);
|
||||||
$gold = Util::round(getBill($generalObj->getVar('dedication')) * $ratio);
|
$gold = Util::round(getBill($generalObj->getVar('dedication')) * $ratio);
|
||||||
$generalObj->increaseVar('gold', $gold);
|
$generalObj->increaseVar('gold', $gold);
|
||||||
|
|
||||||
@@ -169,7 +169,7 @@ class ProcessIncome extends \sammo\Event\Action
|
|||||||
|
|
||||||
// 각 장수들에게 지급
|
// 각 장수들에게 지급
|
||||||
foreach ($generalRawList as $rawGeneral) {
|
foreach ($generalRawList as $rawGeneral) {
|
||||||
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
|
$generalObj = new General($rawGeneral, null, null, null, null, $year, $month, false);
|
||||||
$rice = Util::round(getBill($generalObj->getVar('dedication')) * $ratio);
|
$rice = Util::round(getBill($generalObj->getVar('dedication')) * $ratio);
|
||||||
$generalObj->increaseVar('rice', $rice);
|
$generalObj->increaseVar('rice', $rice);
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class RaiseDisaster extends \sammo\Event\Action
|
|||||||
|
|
||||||
$generalList = array_map(
|
$generalList = array_map(
|
||||||
function ($rawGeneral) use ($city, $year, $month) {
|
function ($rawGeneral) use ($city, $year, $month) {
|
||||||
return new General($rawGeneral, null, $city, null, $year, $month, false);
|
return new General($rawGeneral, null, null, $city, null, $year, $month, false);
|
||||||
},
|
},
|
||||||
$generalListByCity[$city['city']] ?? []
|
$generalListByCity[$city['city']] ?? []
|
||||||
);
|
);
|
||||||
|
|||||||
+84
-42
@@ -24,6 +24,9 @@ class General implements iAction
|
|||||||
/** @var Map<RankColumn,int|float> */
|
/** @var Map<RankColumn,int|float> */
|
||||||
protected Map $rankVarSet;
|
protected Map $rankVarSet;
|
||||||
|
|
||||||
|
/** @var Map<GeneralAccessLogColumn,int|float> */
|
||||||
|
protected ?Map $accessLogRead;
|
||||||
|
|
||||||
/** @var \sammo\ActionLogger */
|
/** @var \sammo\ActionLogger */
|
||||||
protected $logger;
|
protected $logger;
|
||||||
|
|
||||||
@@ -79,12 +82,13 @@ class General implements iAction
|
|||||||
/**
|
/**
|
||||||
* @param array $raw DB row값.
|
* @param array $raw DB row값.
|
||||||
* @param null|Map<RankColumn,int|float> $rawRank
|
* @param null|Map<RankColumn,int|float> $rawRank
|
||||||
|
* @param null|Map<GeneralAccessLogColumn,int> $rawAccessLog
|
||||||
* @param null|array $city DB city 테이블의 row값
|
* @param null|array $city DB city 테이블의 row값
|
||||||
* @param int|null $year 게임 연도
|
* @param int|null $year 게임 연도
|
||||||
* @param int|null $month 게임 월
|
* @param int|null $month 게임 월
|
||||||
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능
|
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능
|
||||||
*/
|
*/
|
||||||
public function __construct(array $raw, ?Map $rawRank, ?array $city, ?array $nation, ?int $year, ?int $month, bool $fullConstruct = true)
|
public function __construct(array $raw, ?Map $rawRank, ?Map $rawAccessLog, ?array $city, ?array $nation, ?int $year, ?int $month, bool $fullConstruct = true)
|
||||||
{
|
{
|
||||||
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
||||||
|
|
||||||
@@ -110,6 +114,10 @@ class General implements iAction
|
|||||||
} else {
|
} else {
|
||||||
$this->rankVarRead = new Map();
|
$this->rankVarRead = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->accessLogRead = $rawAccessLog;
|
||||||
|
|
||||||
|
|
||||||
$this->rankVarIncrease = new Map();
|
$this->rankVarIncrease = new Map();
|
||||||
$this->rankVarSet = new Map();
|
$this->rankVarSet = new Map();
|
||||||
|
|
||||||
@@ -772,6 +780,19 @@ class General implements iAction
|
|||||||
return $this->rankVarRead[$key];
|
return $this->rankVarRead[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAccessLogVar(GeneralAccessLogColumn $key, $defaultValue = null): int | string | null
|
||||||
|
{
|
||||||
|
if (!$this->accessLogRead) {
|
||||||
|
return $defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->accessLogRead->hasKey($key)) {
|
||||||
|
return $defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->accessLogRead[$key];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \MeekroDB $db
|
* @param \MeekroDB $db
|
||||||
*/
|
*/
|
||||||
@@ -1026,11 +1047,15 @@ class General implements iAction
|
|||||||
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
||||||
'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'betray',
|
'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'betray',
|
||||||
'recent_war', 'last_turn', 'myset',
|
'recent_war', 'last_turn', 'myset',
|
||||||
'specage', 'specage2', 'refresh_score', 'refresh_score_total', 'aux', 'permission', 'penalty',
|
'specage', 'specage2', 'aux', 'permission', 'penalty',
|
||||||
|
];
|
||||||
|
$fullAcessLogColumn = [
|
||||||
|
GeneralAccessLogColumn::refreshScore,
|
||||||
|
GeneralAccessLogColumn::refreshScoreTotal,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($reqColumns === null) {
|
if ($reqColumns === null) {
|
||||||
return [$fullColumn, RankColumn::cases()];
|
return [$fullColumn, RankColumn::cases(), $fullAcessLogColumn];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var RankColumn[] */
|
/** @var RankColumn[] */
|
||||||
@@ -1098,44 +1123,17 @@ class General implements iAction
|
|||||||
[$column, $rankColumn, $accessLogColumn] = static::mergeQueryColumn($column, $constructMode);
|
[$column, $rankColumn, $accessLogColumn] = static::mergeQueryColumn($column, $constructMode);
|
||||||
|
|
||||||
if ($generalIDList === null) {
|
if ($generalIDList === null) {
|
||||||
if (!$accessLogColumn) {
|
$rawGenerals = Util::convertArrayToDict(
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
$db->query('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
||||||
$db->query('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
'no'
|
||||||
'no'
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
|
||||||
$db->query(
|
|
||||||
'SELECT %l, %l FROM `general` LEFT JOIN general_access_log
|
|
||||||
ON general.no = general_access_log.general_id WHERE 1',
|
|
||||||
Util::formatListOfBackticks($column),
|
|
||||||
Util::formatListOfBackticks($accessLogColumn)
|
|
||||||
),
|
|
||||||
'no'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$generalIDList = array_keys($rawGenerals);
|
$generalIDList = array_keys($rawGenerals);
|
||||||
} else {
|
} else {
|
||||||
if(!$accessLogColumn){
|
$rawGenerals = Util::convertArrayToDict(
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
$db->query('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
||||||
$db->query('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
'no'
|
||||||
'no'
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
|
||||||
$db->query(
|
|
||||||
'SELECT %l, %l FROM `general` LEFT JOIN general_access_log
|
|
||||||
ON general.no = general_access_log.general_id WHERE no IN %li',
|
|
||||||
Util::formatListOfBackticks($column),
|
|
||||||
Util::formatListOfBackticks($accessLogColumn),
|
|
||||||
$generalIDList
|
|
||||||
),
|
|
||||||
'no'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1157,6 +1155,23 @@ class General implements iAction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rawAccessLogs = new Map();
|
||||||
|
if ($accessLogColumn) {
|
||||||
|
$rawValue = $db->query(
|
||||||
|
'SELECT `general_id`, %l FROM general_access_log WHERE general_id IN %li',
|
||||||
|
Util::formatListOfBackticks($accessLogColumn),
|
||||||
|
$generalIDList
|
||||||
|
);
|
||||||
|
foreach ($rawValue as $rawLog) {
|
||||||
|
$generalID = $rawLog['general_id'];
|
||||||
|
$logValue = new Map();
|
||||||
|
foreach ($rawLog as $key => $value) {
|
||||||
|
$logValue[GeneralAccessLogColumn::from($key)] = $value;
|
||||||
|
}
|
||||||
|
$rawAccessLogs[$generalID] = $logValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($generalIDList as $generalID) {
|
foreach ($generalIDList as $generalID) {
|
||||||
if (!key_exists($generalID, $rawGenerals)) {
|
if (!key_exists($generalID, $rawGenerals)) {
|
||||||
@@ -1166,7 +1181,7 @@ class General implements iAction
|
|||||||
if ($rawRanks->hasKey($generalID) && $rawRanks[$generalID]->count() !== count($rankColumn)) {
|
if ($rawRanks->hasKey($generalID) && $rawRanks[$generalID]->count() !== count($rankColumn)) {
|
||||||
throw new \RuntimeException('column의 수가 일치하지 않음 : ' . $generalID);
|
throw new \RuntimeException('column의 수가 일치하지 않음 : ' . $generalID);
|
||||||
}
|
}
|
||||||
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID] ?? null, null, null, $year, $month, $constructMode > 1);
|
$result[$generalID] = new static($rawGenerals[$generalID], $rawRanks[$generalID] ?? null, $rawAccessLogs[$generalID] ?? null, null, null, $year, $month, $constructMode > 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@@ -1186,10 +1201,37 @@ class General implements iAction
|
|||||||
/**
|
/**
|
||||||
* @var string[] $column
|
* @var string[] $column
|
||||||
* @var RankColumn[] $rankColumn
|
* @var RankColumn[] $rankColumn
|
||||||
|
* @var GeneralAccessLogCoumn[] $accessLogColumn
|
||||||
*/
|
*/
|
||||||
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
|
[$column, $rankColumn, $accessLogColumn] = static::mergeQueryColumn($column, $constructMode);
|
||||||
|
|
||||||
|
/** @var Map<GeneralAccessLog,int>|null */
|
||||||
|
$rawAccessLog = null;
|
||||||
|
|
||||||
|
if (!$accessLogColumn) {
|
||||||
|
$rawGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no = %i', Util::formatListOfBackticks($column), $generalID);
|
||||||
|
} else {
|
||||||
|
$rawGeneral = $db->queryFirstRow(
|
||||||
|
'SELECT %l, %l FROM `general` LEFT JOIN general_access_log
|
||||||
|
ON general.no = general_access_log.general_id WHERE no = %i',
|
||||||
|
Util::formatListOfBackticks($column),
|
||||||
|
Util::formatListOfBackticks($accessLogColumn),
|
||||||
|
$generalID
|
||||||
|
);
|
||||||
|
|
||||||
|
$rawAccessLog = new Map();
|
||||||
|
foreach($accessLogColumn as $accessLogKey) {
|
||||||
|
if(!key_exists($accessLogKey->value, $rawGeneral)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$rawAccessLog[$accessLogKey] = $rawGeneral[$accessLogKey->value];
|
||||||
|
unset($rawGeneral[$accessLogKey->value]);
|
||||||
|
}
|
||||||
|
if($rawAccessLog->count() === 0){
|
||||||
|
$rawAccessLog = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$rawGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no = %i', Util::formatListOfBackticks($column), $generalID);
|
|
||||||
if (!$rawGeneral) {
|
if (!$rawGeneral) {
|
||||||
return new DummyGeneral($constructMode > 0);
|
return new DummyGeneral($constructMode > 0);
|
||||||
}
|
}
|
||||||
@@ -1208,7 +1250,7 @@ class General implements iAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$general = new static($rawGeneral, $rawRankValues, null, null, $year, $month, $constructMode > 1);
|
$general = new static($rawGeneral, $rawRankValues, $rawAccessLog, null, null, $year, $month, $constructMode > 1);
|
||||||
|
|
||||||
return $general;
|
return $general;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="bg1">벌점</div>
|
<div class="bg1">벌점</div>
|
||||||
<div class="general-refresh-score-total">
|
<div class="general-refresh-score-total">
|
||||||
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ general.refreshScoreTotal.toLocaleString() }}점({{ general.refreshScore }})
|
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점({{ general.refreshScore ?? 0 }})
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
class="form-check-label"
|
class="form-check-label"
|
||||||
:for="`column-type-${colID}`"
|
:for="`column-type-${colID}`"
|
||||||
:style="{
|
:style="{
|
||||||
textDecoration: validColumns.has(colID) ? undefined : 'line-through',
|
textDecoration: validColumns.has(colID) ? undefined : 'line-through'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ col.getColDef().headerName }}
|
{{ col.getColDef().headerName }}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<div
|
<div
|
||||||
class="component-general-list"
|
class="component-general-list"
|
||||||
:style="{
|
:style="{
|
||||||
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`,
|
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<AgGridVue
|
<AgGridVue
|
||||||
@@ -92,7 +92,7 @@ import {
|
|||||||
GridReadyEvent,
|
GridReadyEvent,
|
||||||
CellClickedEvent,
|
CellClickedEvent,
|
||||||
IRowNode,
|
IRowNode,
|
||||||
NumberFilter,
|
NumberFilter
|
||||||
} from "ag-grid-community";
|
} from "ag-grid-community";
|
||||||
import { ProvidedColumnGroup } from "ag-grid-community";
|
import { ProvidedColumnGroup } from "ag-grid-community";
|
||||||
import { getNPCColor } from "@/utilGame";
|
import { getNPCColor } from "@/utilGame";
|
||||||
@@ -100,7 +100,7 @@ import type {
|
|||||||
ValueGetterParams,
|
ValueGetterParams,
|
||||||
ValueFormatterFunc,
|
ValueFormatterFunc,
|
||||||
ValueGetterFunc,
|
ValueGetterFunc,
|
||||||
ValueFormatterParams,
|
ValueFormatterParams
|
||||||
} from "ag-grid-community/dist/lib/entities/colDef";
|
} from "ag-grid-community/dist/lib/entities/colDef";
|
||||||
import type { GameConstStore } from "@/GameConstStore";
|
import type { GameConstStore } from "@/GameConstStore";
|
||||||
import { unwrap } from "@/util/unwrap";
|
import { unwrap } from "@/util/unwrap";
|
||||||
@@ -117,36 +117,36 @@ import { defaultDisplaySetting, type GridDisplaySetting } from "@/defs/gridDefs"
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
type: Array as PropType<GeneralListItem[]>,
|
type: Array as PropType<GeneralListItem[]>,
|
||||||
required: true,
|
required: true
|
||||||
},
|
},
|
||||||
troops: {
|
troops: {
|
||||||
type: Object as PropType<Record<number, string>>,
|
type: Object as PropType<Record<number, string>>,
|
||||||
required: true,
|
required: true
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String as PropType<"static" | "fill" | number | `${number}px` | `${number}%`>,
|
type: String as PropType<"static" | "fill" | number | `${number}px` | `${number}%`>,
|
||||||
required: false,
|
required: false,
|
||||||
default: "static",
|
default: "static"
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
type: Object as PropType<GeneralListResponse["env"]>,
|
type: Object as PropType<GeneralListResponse["env"]>,
|
||||||
required: true,
|
required: true
|
||||||
},
|
},
|
||||||
toolbarID: {
|
toolbarID: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: undefined,
|
default: undefined
|
||||||
},
|
},
|
||||||
role: {
|
role: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: "generic",
|
default: "generic"
|
||||||
},
|
},
|
||||||
availableGeneralClick: {
|
availableGeneralClick: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: true,
|
default: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -271,7 +271,7 @@ watch(
|
|||||||
displaySettingsKey,
|
displaySettingsKey,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
version: displaySettingVersion,
|
version: displaySettingVersion,
|
||||||
settings,
|
settings
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
console.log("저장!", Array.from(newSettings.keys()));
|
console.log("저장!", Array.from(newSettings.keys()));
|
||||||
@@ -305,7 +305,7 @@ function storeDisplaySetting() {
|
|||||||
|
|
||||||
const setting: GridDisplaySetting = {
|
const setting: GridDisplaySetting = {
|
||||||
column: columnApi.value.getColumnState(),
|
column: columnApi.value.getColumnState(),
|
||||||
columnGroup: columnApi.value.getColumnGroupState(),
|
columnGroup: columnApi.value.getColumnGroupState()
|
||||||
};
|
};
|
||||||
|
|
||||||
displaySettings.value.set(nickName, setting);
|
displaySettings.value.set(nickName, setting);
|
||||||
@@ -485,14 +485,14 @@ const sortableNumber: Omit<GenColDef, "colId" | "headerName"> = {
|
|||||||
comparator: (a, b, _a, _b, _desc) => a - b,
|
comparator: (a, b, _a, _b, _desc) => a - b,
|
||||||
sortingOrder: ["desc", "asc", null],
|
sortingOrder: ["desc", "asc", null],
|
||||||
filter: NumberFilter,
|
filter: NumberFilter,
|
||||||
cellClass: rightAlignClass,
|
cellClass: rightAlignClass
|
||||||
};
|
};
|
||||||
const defaultColDef = ref<ColDef>({
|
const defaultColDef = ref<ColDef>({
|
||||||
resizable: true,
|
resizable: true,
|
||||||
headerClass: "default-cell-header",
|
headerClass: "default-cell-header",
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
floatingFilter: true,
|
floatingFilter: true,
|
||||||
width: 80,
|
width: 80
|
||||||
});
|
});
|
||||||
const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>>>({
|
const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>>>({
|
||||||
icon: {
|
icon: {
|
||||||
@@ -510,7 +510,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
pinned: "left",
|
pinned: "left",
|
||||||
cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
|
cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
|
||||||
lockPosition: true,
|
lockPosition: true
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
headerName: "장수명",
|
headerName: "장수명",
|
||||||
@@ -524,7 +524,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
cellStyle: (val: CellClassParams<GeneralListItem>) => {
|
cellStyle: (val: CellClassParams<GeneralListItem>) => {
|
||||||
const gen = unwrap(val.data);
|
const gen = unwrap(val.data);
|
||||||
const style: StyleValue = {
|
const style: StyleValue = {
|
||||||
color: getNPCColor(gen.npc),
|
color: getNPCColor(gen.npc)
|
||||||
};
|
};
|
||||||
return style as CellStyle;
|
return style as CellStyle;
|
||||||
},
|
},
|
||||||
@@ -546,7 +546,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
|
cellClass: [props.availableGeneralClick ? "clickable-cell" : "", ...defaultCellClass],
|
||||||
filter: true,
|
filter: true,
|
||||||
hide: false,
|
hide: false,
|
||||||
lockVisible: true,
|
lockVisible: true
|
||||||
},
|
},
|
||||||
//npc: { headerName: "NPC", colId: "npc", field: "npc" },
|
//npc: { headerName: "NPC", colId: "npc", field: "npc" },
|
||||||
stat: {
|
stat: {
|
||||||
@@ -562,7 +562,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
const gen = unwrap(obj.data);
|
const gen = unwrap(obj.data);
|
||||||
return `${gen.leadership}|${gen.strength}|${gen.intel}`;
|
return `${gen.leadership}|${gen.strength}|${gen.intel}`;
|
||||||
},
|
},
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "leadership",
|
colId: "leadership",
|
||||||
@@ -571,7 +571,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60,
|
||||||
type: "numericColumn",
|
type: "numericColumn"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "strength",
|
colId: "strength",
|
||||||
@@ -579,7 +579,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "strength",
|
field: "strength",
|
||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "intel",
|
colId: "intel",
|
||||||
@@ -587,9 +587,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "intel",
|
field: "intel",
|
||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
officerLevel: {
|
officerLevel: {
|
||||||
@@ -620,7 +620,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
filter: true,
|
filter: true,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
width: 70,
|
width: 70
|
||||||
},
|
},
|
||||||
expDedLv: {
|
expDedLv: {
|
||||||
headerName: "명성/계급",
|
headerName: "명성/계급",
|
||||||
@@ -637,7 +637,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return `Lv ${data.explevel}<br>${data.dedLevelText}`;
|
return `Lv ${data.explevel}<br>${data.dedLevelText}`;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "explevel",
|
colId: "explevel",
|
||||||
@@ -652,7 +652,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "dedlevel",
|
colId: "dedlevel",
|
||||||
@@ -667,14 +667,14 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
comparator: (a, b, _a, _b, _desc) => {
|
comparator: (a, b, _a, _b, _desc) => {
|
||||||
return (_a.data?.dedlevel??0) - (_b.data?.dedlevel??0);
|
return (_a.data?.dedlevel ?? 0) - (_b.data?.dedlevel ?? 0);
|
||||||
},
|
},
|
||||||
sortingOrder: ["desc", "asc", null],
|
sortingOrder: ["desc", "asc", null],
|
||||||
filter: true,
|
filter: true,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
goldRice: {
|
goldRice: {
|
||||||
headerName: "자금",
|
headerName: "자금",
|
||||||
@@ -704,7 +704,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
const lhsAmount = lhs.gold + lhs.rice;
|
const lhsAmount = lhs.gold + lhs.rice;
|
||||||
const rhsAmount = rhs.gold + rhs.rice;
|
const rhsAmount = rhs.gold + rhs.rice;
|
||||||
return lhsAmount - rhsAmount;
|
return lhsAmount - rhsAmount;
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "gold",
|
colId: "gold",
|
||||||
@@ -713,7 +713,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter("금"),
|
valueFormatter: numberFormatter("금"),
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "rice",
|
colId: "rice",
|
||||||
@@ -722,9 +722,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter("쌀"),
|
valueFormatter: numberFormatter("쌀"),
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
city: {
|
city: {
|
||||||
colId: "city",
|
colId: "city",
|
||||||
@@ -744,7 +744,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return convertSearch초성(gameConstStore.value.cityConst[data.city].name);
|
return convertSearch초성(gameConstStore.value.cityConst[data.city].name);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
troop: {
|
troop: {
|
||||||
colId: "troop",
|
colId: "troop",
|
||||||
@@ -795,7 +795,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
const [troopName, troopLeader] = troopInfo;
|
const [troopName, troopLeader] = troopInfo;
|
||||||
const cityName = gameConstStore.value.cityConst[troopLeader.city].name;
|
const cityName = gameConstStore.value.cityConst[troopLeader.city].name;
|
||||||
return convertSearch초성(`${troopName}$${cityName}`);
|
return convertSearch초성(`${troopName}$${cityName}`);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
crewtypeAndCrew: {
|
crewtypeAndCrew: {
|
||||||
groupId: "crewtypeAndCrew",
|
groupId: "crewtypeAndCrew",
|
||||||
@@ -809,11 +809,11 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
cells: ((): GridCellInfo[][] => {
|
cells: ((): GridCellInfo[][] => {
|
||||||
return [
|
return [
|
||||||
[{ target: "crewtype", iActionMap: gameConstStore.value.iActionInfo.crewtype }],
|
[{ target: "crewtype", iActionMap: gameConstStore.value.iActionInfo.crewtype }],
|
||||||
[{ target: "crew", converter: (value) => [`${value.crew.toLocaleString()}명`, undefined] }],
|
[{ target: "crew", converter: (value) => [`${value.crew.toLocaleString()}명`, undefined] }]
|
||||||
];
|
];
|
||||||
})(),
|
})()
|
||||||
},
|
},
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "crewtype",
|
colId: "crewtype",
|
||||||
@@ -821,7 +821,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "crewtype",
|
field: "crewtype",
|
||||||
cellRenderer: SimpleTooltipCell,
|
cellRenderer: SimpleTooltipCell,
|
||||||
cellRendererParams: {
|
cellRendererParams: {
|
||||||
iActionMap: gameConstStore.value.iActionInfo.crewtype,
|
iActionMap: gameConstStore.value.iActionInfo.crewtype
|
||||||
},
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
@@ -832,7 +832,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
}
|
}
|
||||||
const name = gameConstStore.value.iActionInfo.crewtype[data.crewtype].name;
|
const name = gameConstStore.value.iActionInfo.crewtype[data.crewtype].name;
|
||||||
return convertSearch초성(name);
|
return convertSearch초성(name);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "crew",
|
colId: "crew",
|
||||||
@@ -841,9 +841,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter("명"),
|
valueFormatter: numberFormatter("명"),
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
trainAtmos: {
|
trainAtmos: {
|
||||||
groupId: "trainAtmos",
|
groupId: "trainAtmos",
|
||||||
@@ -859,7 +859,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
}
|
}
|
||||||
return `${data.train}<br>${data.atmos}`;
|
return `${data.train}<br>${data.atmos}`;
|
||||||
},
|
},
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "train",
|
colId: "train",
|
||||||
@@ -868,7 +868,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter(),
|
valueFormatter: numberFormatter(),
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "atmos",
|
colId: "atmos",
|
||||||
@@ -877,7 +877,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter(),
|
valueFormatter: numberFormatter(),
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "defence_train",
|
colId: "defence_train",
|
||||||
@@ -886,9 +886,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
sortingOrder: ["desc", "asc", null],
|
sortingOrder: ["desc", "asc", null],
|
||||||
valueFormatter: (value: GenValueParams<number>) => formatDefenceTrain(value.value),
|
valueFormatter: (value: GenValueParams<number>) => formatDefenceTrain(value.value),
|
||||||
width: 50,
|
width: 50
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
specials: {
|
specials: {
|
||||||
groupId: "specials",
|
groupId: "specials",
|
||||||
@@ -904,13 +904,13 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
[{ target: "personal", iActionMap: gameConstStore.value.iActionInfo.personality }],
|
[{ target: "personal", iActionMap: gameConstStore.value.iActionInfo.personality }],
|
||||||
[
|
[
|
||||||
{ target: "specialDomestic", iActionMap: gameConstStore.value.iActionInfo.specialDomestic },
|
{ target: "specialDomestic", iActionMap: gameConstStore.value.iActionInfo.specialDomestic },
|
||||||
{ target: "specialWar", iActionMap: gameConstStore.value.iActionInfo.specialWar },
|
{ target: "specialWar", iActionMap: gameConstStore.value.iActionInfo.specialWar }
|
||||||
],
|
]
|
||||||
];
|
];
|
||||||
})(),
|
})()
|
||||||
},
|
},
|
||||||
width: 80,
|
width: 80,
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "personal",
|
colId: "personal",
|
||||||
@@ -918,7 +918,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "personal",
|
field: "personal",
|
||||||
cellRenderer: SimpleTooltipCell,
|
cellRenderer: SimpleTooltipCell,
|
||||||
cellRendererParams: {
|
cellRendererParams: {
|
||||||
iActionMap: gameConstStore.value.iActionInfo.personality,
|
iActionMap: gameConstStore.value.iActionInfo.personality
|
||||||
},
|
},
|
||||||
width: 60,
|
width: 60,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@@ -927,7 +927,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
filterValueGetter: ({ data }) => {
|
filterValueGetter: ({ data }) => {
|
||||||
const name = gameConstStore.value.iActionInfo.personality[data.personal].name;
|
const name = gameConstStore.value.iActionInfo.personality[data.personal].name;
|
||||||
return convertSearch초성(name);
|
return convertSearch초성(name);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "specialDomestic",
|
colId: "specialDomestic",
|
||||||
@@ -935,7 +935,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "specialDomestic",
|
field: "specialDomestic",
|
||||||
cellRenderer: SimpleTooltipCell,
|
cellRenderer: SimpleTooltipCell,
|
||||||
cellRendererParams: {
|
cellRendererParams: {
|
||||||
iActionMap: gameConstStore.value.iActionInfo.specialDomestic,
|
iActionMap: gameConstStore.value.iActionInfo.specialDomestic
|
||||||
},
|
},
|
||||||
width: 60,
|
width: 60,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@@ -944,7 +944,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
filterValueGetter: ({ data }) => {
|
filterValueGetter: ({ data }) => {
|
||||||
const name = gameConstStore.value.iActionInfo.specialDomestic[data.specialDomestic].name;
|
const name = gameConstStore.value.iActionInfo.specialDomestic[data.specialDomestic].name;
|
||||||
return convertSearch초성(name);
|
return convertSearch초성(name);
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "specialWar",
|
colId: "specialWar",
|
||||||
@@ -952,7 +952,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
field: "specialWar",
|
field: "specialWar",
|
||||||
cellRenderer: SimpleTooltipCell,
|
cellRenderer: SimpleTooltipCell,
|
||||||
cellRendererParams: {
|
cellRendererParams: {
|
||||||
iActionMap: gameConstStore.value.iActionInfo.specialWar,
|
iActionMap: gameConstStore.value.iActionInfo.specialWar
|
||||||
},
|
},
|
||||||
width: 60,
|
width: 60,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@@ -961,9 +961,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
filterValueGetter: ({ data }) => {
|
filterValueGetter: ({ data }) => {
|
||||||
const name = gameConstStore.value.iActionInfo.specialWar[data.specialWar].name;
|
const name = gameConstStore.value.iActionInfo.specialWar[data.specialWar].name;
|
||||||
return convertSearch초성(name);
|
return convertSearch초성(name);
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
reservedCommandShort: {
|
reservedCommandShort: {
|
||||||
groupId: "reservedCommandShort",
|
groupId: "reservedCommandShort",
|
||||||
@@ -1005,9 +1005,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
cellStyle: {
|
cellStyle: {
|
||||||
lineHeight: "1em",
|
lineHeight: "1em",
|
||||||
fontSize: "0.85em",
|
fontSize: "0.85em"
|
||||||
},
|
},
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "reservedCommand",
|
colId: "reservedCommand",
|
||||||
@@ -1042,11 +1042,11 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
cellStyle: {
|
cellStyle: {
|
||||||
lineHeight: "1em",
|
lineHeight: "1em",
|
||||||
fontSize: "0.85em",
|
fontSize: "0.85em"
|
||||||
},
|
},
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
turntime: {
|
turntime: {
|
||||||
colId: "turntime",
|
colId: "turntime",
|
||||||
@@ -1061,7 +1061,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
return turntime.substring(14, 19);
|
return turntime.substring(14, 19);
|
||||||
},
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass
|
||||||
},
|
},
|
||||||
recent_war: {
|
recent_war: {
|
||||||
colId: "recent_war",
|
colId: "recent_war",
|
||||||
@@ -1076,7 +1076,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
return turntime.substring(14, 19);
|
return turntime.substring(14, 19);
|
||||||
},
|
},
|
||||||
sortable: true,
|
sortable: true,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass
|
||||||
},
|
},
|
||||||
years: {
|
years: {
|
||||||
groupId: "years",
|
groupId: "years",
|
||||||
@@ -1093,7 +1093,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
return `${data.age}세<br>${data.belong}년`;
|
return `${data.age}세<br>${data.belong}년`;
|
||||||
},
|
},
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "age",
|
colId: "age",
|
||||||
@@ -1103,7 +1103,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
valueFormatter: (v: GenValueParams<number>) => `${v.value}세`,
|
valueFormatter: (v: GenValueParams<number>) => `${v.value}세`,
|
||||||
width: 60,
|
width: 60,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "belong",
|
colId: "belong",
|
||||||
@@ -1113,9 +1113,9 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
valueFormatter: (v: GenValueParams<number>) => `${v.value}년`,
|
valueFormatter: (v: GenValueParams<number>) => `${v.value}년`,
|
||||||
width: 60,
|
width: 60,
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
killturnAndRefresh: {
|
killturnAndRefresh: {
|
||||||
groupId: "killturnAndRefresh",
|
groupId: "killturnAndRefresh",
|
||||||
@@ -1128,11 +1128,11 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
if (data === undefined) {
|
if (data === undefined) {
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
return `${data.killturn.toLocaleString()}턴<br>${data.refreshScoreTotal.toLocaleString()}점`;
|
return `${data.killturn.toLocaleString()}턴<br>${(data.refreshScoreTotal ?? 0).toLocaleString()}점`;
|
||||||
},
|
},
|
||||||
cellClass: rightAlignClass,
|
cellClass: rightAlignClass,
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed",
|
||||||
width: 70,
|
width: 70
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "killturn",
|
colId: "killturn",
|
||||||
@@ -1146,7 +1146,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "refreshScoreTotal",
|
colId: "refreshScoreTotal",
|
||||||
@@ -1156,13 +1156,15 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
if (data === undefined) {
|
if (data === undefined) {
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
return `${data.refreshScoreTotal.toLocaleString()}점<br>(${formatRefreshScore(data.refreshScoreTotal)})`;
|
return `${(data.refreshScoreTotal ?? 0).toLocaleString()}점<br>(${formatRefreshScore(
|
||||||
|
data.refreshScoreTotal
|
||||||
|
)})`;
|
||||||
},
|
},
|
||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
width: 70,
|
width: 70,
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open"
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
warResults: {
|
warResults: {
|
||||||
groupId: "warResults",
|
groupId: "warResults",
|
||||||
@@ -1180,7 +1182,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
cellClass: centerCellClass,
|
cellClass: centerCellClass,
|
||||||
columnGroupShow: "closed",
|
columnGroupShow: "closed",
|
||||||
width: 90,
|
width: 90
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "warnum",
|
colId: "warnum",
|
||||||
@@ -1189,7 +1191,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter("전"),
|
valueFormatter: numberFormatter("전"),
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "killnum",
|
colId: "killnum",
|
||||||
@@ -1198,7 +1200,7 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
...sortableNumber,
|
...sortableNumber,
|
||||||
valueFormatter: numberFormatter("승"),
|
valueFormatter: numberFormatter("승"),
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: "killcrew",
|
colId: "killcrew",
|
||||||
@@ -1214,10 +1216,10 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
|
|||||||
},
|
},
|
||||||
valueFormatter: numberFormatter("%"),
|
valueFormatter: numberFormatter("%"),
|
||||||
columnGroupShow: "open",
|
columnGroupShow: "open",
|
||||||
width: 60,
|
width: 60
|
||||||
},
|
}
|
||||||
],
|
]
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
const columnDefs = ref([...Object.values(columnRawDefs.value)]);
|
const columnDefs = ref([...Object.values(columnRawDefs.value)]);
|
||||||
watch(columnRawDefs, (val) => {
|
watch(columnRawDefs, (val) => {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
<div class="bg1">벌점</div>
|
<div class="bg1">벌점</div>
|
||||||
<div class="general-refresh-score-total">
|
<div class="general-refresh-score-total">
|
||||||
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ general.refreshScoreTotal.toLocaleString() }}점
|
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ (general.refreshScoreTotal ?? 0).toLocaleString() }}점
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export type GeneralListItemP0 = {
|
|||||||
specialWar: GameObjClassKey;
|
specialWar: GameObjClassKey;
|
||||||
personal: GameObjClassKey;
|
personal: GameObjClassKey;
|
||||||
belong: number;
|
belong: number;
|
||||||
refreshScoreTotal: number;
|
refreshScoreTotal: number | null;
|
||||||
|
|
||||||
officerLevel: number; //권한에따라 태수,군사,시종 노출 여부가 다름
|
officerLevel: number; //권한에따라 태수,군사,시종 노출 여부가 다름
|
||||||
officerLevelText: string;
|
officerLevelText: string;
|
||||||
@@ -46,7 +46,7 @@ export type GeneralListItemP0 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type GeneralListItemP1 = {
|
export type GeneralListItemP1 = {
|
||||||
refreshScore: number;
|
refreshScore: number | null;
|
||||||
specage: number;
|
specage: number;
|
||||||
specage2: number;
|
specage2: number;
|
||||||
leadership_exp: number;
|
leadership_exp: number;
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ const refreshScoreMap: [number, string][] = [
|
|||||||
[12800, "헐..."],
|
[12800, "헐..."],
|
||||||
];
|
];
|
||||||
|
|
||||||
export function formatRefreshScore(refreshScore: number) {
|
export function formatRefreshScore(refreshScore: number | null) {
|
||||||
|
if (!refreshScore) refreshScore = 0;
|
||||||
const idx = bs(refreshScoreMap, refreshScore, ([key], needle) => key - needle);
|
const idx = bs(refreshScoreMap, refreshScore, ([key], needle) => key - needle);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
return refreshScoreMap[idx][1] ?? "?";
|
return refreshScoreMap[idx][1] ?? "?";
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
|
|||||||
$nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']);
|
$nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']);
|
||||||
$gameStor->cacheAll();
|
$gameStor->cacheAll();
|
||||||
|
|
||||||
$general = new General($me, null, null, $nation, $gameStor->year, $gameStor->month, false);
|
$general = new General($me, null, null, null, $nation, $gameStor->year, $gameStor->month, false);
|
||||||
|
|
||||||
$rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? [];
|
$rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? [];
|
||||||
$rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? [];
|
$rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? [];
|
||||||
|
|||||||
Reference in New Issue
Block a user