refac, wip: 벌점(connect, con) 변경
- 벌점: refreshScoreTotal - 순간벌점: refreshScore
This commit is contained in:
@@ -9,6 +9,7 @@ use sammo\DB;
|
||||
use sammo\DTO\VoteInfo;
|
||||
use sammo\Enums\APIRecoveryType;
|
||||
use sammo\Enums\CityColumn;
|
||||
use sammo\Enums\GeneralAccessLogColumn;
|
||||
use sammo\Enums\GeneralColumn;
|
||||
use sammo\Enums\RankColumn;
|
||||
use sammo\GameConst;
|
||||
@@ -383,7 +384,8 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
'specialWar' => $general->getVar(GeneralColumn::special2), // GameObjClassKey;
|
||||
'personal' => $general->getVar(GeneralColumn::personal), // GameObjClassKey;
|
||||
'belong' => $general->getVar(GeneralColumn::belong), // number;
|
||||
'connect' => $general->getVar(GeneralColumn::connect), // number;
|
||||
|
||||
'refreshScoreTotal' => $general->getVar(GeneralAccessLogColumn::refreshScoreTotal), // number;
|
||||
|
||||
'officerLevel' => $general->getVar(GeneralColumn::officer_level), // number;
|
||||
'officerLevelText' => getOfficerLevelText($general->getVar(GeneralColumn::officer_level), $rawNation['level']), // string;
|
||||
@@ -400,7 +402,7 @@ class GetFrontInfo extends \sammo\BaseAPI
|
||||
'troop' => $general->getVar(GeneralColumn::troop), // number;
|
||||
//P0 End
|
||||
|
||||
'con' => $general->getVar(GeneralColumn::con), // number;
|
||||
'refreshScore' => $general->getVar(GeneralAccessLogColumn::refreshScore), // number;
|
||||
'specage' => $general->getVar(GeneralColumn::specage), // number;
|
||||
'specage2' => $general->getVar(GeneralColumn::specage2), // number;
|
||||
'leadership_exp' => $general->getVar(GeneralColumn::leadership_exp), // number;
|
||||
|
||||
@@ -62,7 +62,8 @@ class GeneralList extends \sammo\BaseAPI
|
||||
$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');
|
||||
$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,refresh_score_total from `general` LEFT JOIN `general_access_log` ON general.no = general_access_log.general_id');
|
||||
|
||||
$ownerNameList = [];
|
||||
if ($gameStor->isunited) {
|
||||
@@ -73,7 +74,7 @@ class GeneralList extends \sammo\BaseAPI
|
||||
|
||||
$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;
|
||||
[$owner, $no, $picture, $imgsvr, $npc, $age, $nation, $special, $special2, $personal, $name, $ownerName, $injury, $leadership, $strength, $intel, $experience, $dedication, $officerLevel, $killturn, $refreshScoreTotal] = $rawGeneral;
|
||||
|
||||
if (key_exists($owner, $ownerNameList)) {
|
||||
$ownerName = $ownerNameList[$owner];
|
||||
@@ -104,7 +105,7 @@ class GeneralList extends \sammo\BaseAPI
|
||||
getDed($dedication),
|
||||
getOfficerLevelText($officerLevel, $nationArr['level']),
|
||||
$killturn,
|
||||
$connectCnt
|
||||
$refreshScoreTotal
|
||||
];
|
||||
}
|
||||
|
||||
@@ -129,6 +130,8 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'honorText',
|
||||
'dedLevelText',
|
||||
'officerLevelText',
|
||||
'killturn',
|
||||
'refreshScoreTotal',
|
||||
];
|
||||
|
||||
$result = [
|
||||
|
||||
@@ -44,12 +44,10 @@ class GeneralList extends \sammo\BaseAPI
|
||||
'special2' => 0,
|
||||
'personal' => 0,
|
||||
'belong' => 0,
|
||||
'connect' => 0,
|
||||
|
||||
'troop' => 0,
|
||||
'city' => 0,
|
||||
|
||||
'con' => 1,
|
||||
'specage' => 0,
|
||||
'specage2' => 0,
|
||||
'leadership_exp' => 1,
|
||||
@@ -83,6 +81,11 @@ class GeneralList extends \sammo\BaseAPI
|
||||
|
||||
'owner_name' => 9, //안씀.
|
||||
|
||||
|
||||
//acessLog
|
||||
'refresh_score_total' => 0,
|
||||
'refresh_score' => 1,
|
||||
|
||||
//RANK
|
||||
'warnum' => 1,
|
||||
'killnum' => 1,
|
||||
@@ -156,9 +159,18 @@ class GeneralList extends \sammo\BaseAPI
|
||||
|
||||
|
||||
|
||||
[$queryColumns, $rankColumns] = General::mergeQueryColumn(array_keys(static::$viewColumns), 1);
|
||||
[$queryColumns, $rankColumns, $accessLogColumns] = General::mergeQueryColumn(array_keys(static::$viewColumns), 1);
|
||||
|
||||
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i ORDER BY turntime ASC', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
|
||||
$rawGeneralList = Util::convertArrayToDict(
|
||||
$db->query(
|
||||
'SELECT %l, %l from `general` LEFT JOIN general_access_log
|
||||
ON `general`.`no` = general_access_log.general_id WHERE nation = %i ORDER BY turntime ASC',
|
||||
Util::formatListOfBackticks($queryColumns),
|
||||
Util::formatListOfBackticks($accessLogColumns),
|
||||
$nationID
|
||||
),
|
||||
'no'
|
||||
);
|
||||
|
||||
/** @var ArrayObject[] */
|
||||
$troops = [];
|
||||
@@ -179,19 +191,19 @@ class GeneralList extends \sammo\BaseAPI
|
||||
if ($this->permission >= 1 || count($troops)) {
|
||||
$reservedCommandTargetGeneralIDList = [];
|
||||
|
||||
if($this->permission >= 1){
|
||||
if ($this->permission >= 1) {
|
||||
foreach ($rawGeneralList as $rawGeneral) {
|
||||
if ($rawGeneral['npc'] < 2) {
|
||||
$reservedCommandTargetGeneralIDList[$rawGeneral['no']] = $rawGeneral['no'];
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($troops as $troop){
|
||||
foreach ($troops as $troop) {
|
||||
$reservedCommandTargetGeneralIDList[$troop['id']] = $troop['id'];
|
||||
}
|
||||
|
||||
|
||||
if($reservedCommandTargetGeneralIDList){
|
||||
if ($reservedCommandTargetGeneralIDList) {
|
||||
$rawTurnList = $db->query(
|
||||
'SELECT general_id, turn_idx, action, arg, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id asc, turn_idx asc',
|
||||
array_values($reservedCommandTargetGeneralIDList)
|
||||
@@ -278,11 +290,11 @@ class GeneralList extends \sammo\BaseAPI
|
||||
$resultColumns[$column] = $column;
|
||||
}
|
||||
|
||||
foreach ($troops as $troop){
|
||||
foreach ($troops as $troop) {
|
||||
$troopLeaderID = $troop['id'];
|
||||
$troop['reservedCommand'] = array_map(function($turnObj){
|
||||
$troop['reservedCommand'] = array_map(function ($turnObj) {
|
||||
$brief = $turnObj['brief'];
|
||||
if($brief == '집합'){
|
||||
if ($brief == '집합') {
|
||||
return $brief;
|
||||
}
|
||||
return '-';
|
||||
|
||||
@@ -9,6 +9,6 @@ enum GeneralAccessLogColumn: string {
|
||||
case lastRefresh = 'last_refresh';
|
||||
case refresh = 'refresh'; //순간 갱신 횟수(00:00에 초기화)
|
||||
case refreshTotal = 'refresh_total'; //누적 갱신 횟수
|
||||
case refreshScore = 'refreshScore'; //순간 벌점(턴 시간에 초기화)
|
||||
case refreshScoreTotal = 'refreshScoreTotal'; //누적 벌점(지속적으로 감소, refreshScoreTotal <= refreshTotal)
|
||||
case refreshScore = 'refresh_score'; //순간 벌점(턴 시간에 초기화)
|
||||
case refreshScoreTotal = 'refresh_score_total'; //누적 벌점(지속적으로 감소, refreshScoreTotal <= refreshTotal)
|
||||
}
|
||||
@@ -15,8 +15,6 @@ enum GeneralColumn: string{
|
||||
case bornyear = 'bornyear';
|
||||
case deadyear = 'deadyear';
|
||||
case newmsg = 'newmsg';
|
||||
case con = 'con';
|
||||
case connect = 'connect';
|
||||
case picture = 'picture';
|
||||
case imgsvr = 'imgsvr';
|
||||
case name = 'name';
|
||||
|
||||
+62
-21
@@ -330,7 +330,7 @@ class General implements iAction
|
||||
|
||||
function getCrewTypeObj(): GameUnitDetail
|
||||
{
|
||||
if($this->crewType === null) {
|
||||
if ($this->crewType === null) {
|
||||
throw new \InvalidArgumentException('Invalid CrewType:' . $this->getVar('crewtype'));
|
||||
}
|
||||
return $this->crewType;
|
||||
@@ -845,7 +845,7 @@ class General implements iAction
|
||||
$this->increaseVar($statName, -1);
|
||||
$result = true;
|
||||
} else if ($this->getVar($statExpName) >= $limit) {
|
||||
if($this->getVar($statName) < GameConst::$maxLevel) {
|
||||
if ($this->getVar($statName) < GameConst::$maxLevel) {
|
||||
$logger->pushGeneralActionLog("<S>{$statNickName}</>이 <C>1</> 올랐습니다!", ActionLogger::PLAIN);
|
||||
$this->increaseVar($statName, 1);
|
||||
}
|
||||
@@ -857,7 +857,8 @@ class General implements iAction
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getActionList(): array{
|
||||
protected function getActionList(): array
|
||||
{
|
||||
return array_merge([
|
||||
$this->nationType,
|
||||
$this->officerLevelObj,
|
||||
@@ -1024,7 +1025,7 @@ class General implements iAction
|
||||
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
||||
'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'betray',
|
||||
'recent_war', 'last_turn', 'myset',
|
||||
'specage', 'specage2', 'con', 'connect', 'aux', 'permission', 'penalty',
|
||||
'specage', 'specage2', 'refresh_score', 'refresh_score_total', 'aux', 'permission', 'penalty',
|
||||
];
|
||||
|
||||
if ($reqColumns === null) {
|
||||
@@ -1034,25 +1035,36 @@ class General implements iAction
|
||||
/** @var RankColumn[] */
|
||||
$rankColumn = [];
|
||||
$subColumn = [];
|
||||
$accessLogColumn = [];
|
||||
foreach ($reqColumns as $column) {
|
||||
if ($column instanceof RankColumn) {
|
||||
$rankColumn[] = $column;
|
||||
continue;
|
||||
}
|
||||
|
||||
$rankKey = RankColumn::tryFrom($column);
|
||||
if ($rankKey !== null) {
|
||||
$rankColumn[] = $rankKey;
|
||||
} else {
|
||||
$subColumn[] = $column;
|
||||
if ($column instanceof GeneralAccessLogColumn) {
|
||||
$accessLogColumn[] = $column;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$enumKey = RankColumn::tryFrom($column);
|
||||
if ($enumKey !== null) {
|
||||
$rankColumn[] = $enumKey;
|
||||
continue;
|
||||
}
|
||||
$enumKey = GeneralAccessLogColumn::tryFrom($column);
|
||||
if ($enumKey !== null) {
|
||||
$accessLogColumn[] = $enumKey;
|
||||
continue;
|
||||
}
|
||||
$subColumn[] = $column;
|
||||
}
|
||||
|
||||
if ($constructMode > 1) {
|
||||
return [array_unique(array_merge($defaultEventColumn, $subColumn)), $rankColumn];
|
||||
return [array_unique(array_merge($defaultEventColumn, $subColumn)), $rankColumn, $accessLogColumn];
|
||||
}
|
||||
|
||||
return [array_unique(array_merge($minimumColumn, $subColumn)), $rankColumn];
|
||||
return [array_unique(array_merge($minimumColumn, $subColumn)), $rankColumn, $accessLogColumn];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1080,20 +1092,49 @@ class General implements iAction
|
||||
/**
|
||||
* @var string[] $column
|
||||
* @var RankColumn[] $rankColumn
|
||||
* @var GeneralAccessLogColumn[] $accessLogColumn
|
||||
*/
|
||||
[$column, $rankColumn] = static::mergeQueryColumn($column, $constructMode);
|
||||
[$column, $rankColumn, $accessLogColumn] = static::mergeQueryColumn($column, $constructMode);
|
||||
|
||||
if ($generalIDList === null) {
|
||||
$rawGenerals = Util::convertArrayToDict(
|
||||
$db->query('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
||||
'no'
|
||||
);
|
||||
if (!$accessLogColumn) {
|
||||
$rawGenerals = Util::convertArrayToDict(
|
||||
$db->query('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
||||
'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);
|
||||
} else {
|
||||
$rawGenerals = Util::convertArrayToDict(
|
||||
$db->query('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
||||
'no'
|
||||
);
|
||||
if(!$accessLogColumn){
|
||||
$rawGenerals = Util::convertArrayToDict(
|
||||
$db->query('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
||||
'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'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user