refac, wip: 벌점(connect, con) 변경

- 벌점: refreshScoreTotal
- 순간벌점: refreshScore
This commit is contained in:
2023-07-07 10:57:52 +00:00
parent 3ae49456b1
commit c9dd873019
22 changed files with 194 additions and 131 deletions
+10 -5
View File
@@ -102,7 +102,7 @@ if ($gameStor->isunited) {
6 => ['dedication', true],
7 => ['officer_level', true],
8 => ['killturn', false],
9 => ['connect', true],
9 => ['refresh_score_total', true],
10 => ['experience', true],
11 => ['personal', true],
12 => ['special', true],
@@ -111,7 +111,12 @@ if ($gameStor->isunited) {
15 => ['npc', true],
][$type];
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc ? 'desc' : '');
$generalList = $db->query(
'SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,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 order by %b %l',
$orderKey,
$orderDesc ? 'desc' : ''
);
echo "
<table align=center width=1000 class='tb_layout bg0'>
@@ -163,7 +168,7 @@ if ($gameStor->isunited) {
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
}
$general['connect'] = Util::round($general['connect'], -1);
$general['refresh_score_total'] = Util::round($general['refresh_score_total'], -1);
$imageTemp = GetImageURL($general['imgsvr']);
echo "
@@ -192,8 +197,8 @@ if ($gameStor->isunited) {
<td align=center>$strength</td>
<td align=center>$intel</td>
<td align=center>{$general['killturn']}</td>
<td align=center>{$general['connect']}";
echo "<br>【" . getConnect($general['connect']) . "】</td>
<td align=center>" . $general['refresh_score_total'] ?? 0;
echo "<br>【" . getRefreshScoreText($general['refresh_score_total'] ?? 0) . "】</td>
</tr>";
}
echo "
+5 -7
View File
@@ -196,16 +196,14 @@ if ($admin['maxonline'] < $curonline) {
</tr>
<?php
$totalRefresh = [
'connect' => $db->queryFirstField('SELECT sum(`connect`) as `connect` from general'),
'refresh' => $db->queryFirstField('SELECT sum(`refresh`) as `refresh` from general_access_log'),
...$db->queryFirstRow('SELECT sum(`refresh`) as `refresh`, sum(`refresh_score_total`) as `refresh_score_total` from general_access_log'),
'name' => '접속자 총합'
];
$top5Refresh = $db->query(
'SELECT `name`, `log`.`refresh`, `connect` FROM `general_access_log` AS `log`
INNER JOIN `general` ON `log`.`general_id` = `general`.`no` ORDER BY `log`.`refresh` DESC LIMIT 5');
$refresh_result = array_merge([$max_refresh], $db->query('SELECT `no`,`name`,refresh,`connect` FROM general ORDER BY refresh DESC LIMIT 5'));
'SELECT `name`, `log`.`refresh`, `refresh_score_total` FROM `general_access_log` AS `log`
INNER JOIN `general` ON `log`.`general_id` = `general`.`no` ORDER BY `log`.`refresh` DESC LIMIT 5'
);
foreach (array_merge([$totalRefresh], $top5Refresh) as $i => $user) {
$w = round($user['refresh'] / max(1, $max_refresh['refresh']) * 100, 1);
@@ -214,7 +212,7 @@ if ($admin['maxonline'] < $curonline) {
?>
<tr>
<td width=98 align=center><?= $user['name'] ?></td>
<td width=98 align=center><?= $user['connect'] ?>(<?= $user['refresh'] ?>)</td>
<td width=98 align=center><?= $user['refresh_score_total'] ?>(<?= $user['refresh'] ?>)</td>
<td width=798>
<?php if ($w == 0) : ?>
<?php elseif ($w < 10) : ?>
+6 -4
View File
@@ -97,7 +97,7 @@ if ($gameStor->isunited) {
7 => ['gold', true],
8 => ['rice', true],
9 => ['crew', true],
10 => ['connect', true],
10 => ['refresh_score_total', true],
11 => ['personal', true],
12 => ['special', true],
13 => ['special2', true],
@@ -105,7 +105,9 @@ if ($gameStor->isunited) {
15 => ['npc', true],
][$type];
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc ? 'desc' : '');
$generalList = $db->query(
'SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,refresh_score_total,gold,rice,crew,belong
FROM `general` LEFT JOIN `general_access_log` ON general.no = general_access_log.general_id where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc ? 'desc' : '');
echo "
<table align=center class='tb_layout bg0'>
@@ -173,8 +175,8 @@ if ($gameStor->isunited) {
<td align=center>" . displayCharInfo($general['personal']) . "</td>
<td align=center>" . displaySpecialDomesticInfo($general['special']) . " / " . displaySpecialWarInfo($general['special2']) . "</td>
<td align=center>{$general['belong']}</td>
<td align=center>{$general['connect']}";
echo "<br>(" . getConnect($general['connect']) . ")</td>
<td align=center>". $general['refresh_score_total'] ?? 0;
echo "<br>(" . getRefreshScoreText($general['refresh_score_total'] ?? 0) . ")</td>
</tr>";
}
echo "
+2 -2
View File
@@ -644,7 +644,7 @@ function generalInfo(General $generalObj)
$age = "<font color=red>{$age} 세</font>";
}
$connectCnt = round($generalObj->getVar('connect'), -1);
$refreshScoreTotal = round($generalObj->getVar(GeneralAccessLogColumn::refreshScoreTotal) ?? 0, -1);
$specialDomestic = $generalObj->getVar('special') === GameConst::$defaultSpecialDomestic
? "{$generalObj->getVar('specage')}세"
: "<font color=limegreen>" . displayiActionObjInfo($generalObj->getSpecialDomestic()) . "</font>";
@@ -753,7 +753,7 @@ function generalInfo(General $generalObj)
<td style='text-align:center;' class='bg1'><b>부대</b></td>
<td style='text-align:center;' colspan=3>{$troopInfo}</td>
<td style='text-align:center;' class='bg1'><b>벌점</b></td>
<td style='text-align:center;' colspan=5>" . getConnect($connectCnt) . " {$connectCnt}({$generalObj->getVar('con')})</td>
<td style='text-align:center;' colspan=5>" . getRefreshScoreText($refreshScoreTotal) . " {$refreshScoreTotal}({$generalObj->getVar('con')})</td>
</tr>
</table>";
}
+1 -1
View File
@@ -133,7 +133,7 @@ function getNationType(?string $type) {
}
function getConnect($con) {
function getRefreshScoreText($con) {
if($con < 50) $conname = '안함';
elseif($con < 100) $conname = '무관심';
elseif($con < 200) $conname = '가끔';
+3 -1
View File
@@ -202,8 +202,10 @@ function preUpdateMonthly()
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
//접률감소, 건국제한-1
$db->update('general_access_log', [
'refresh_score_total' => $db->sqleval('floor(refresh_score_total*0.99)'),
], true);
$db->update('general', [
'connect' => $db->sqleval('floor(connect*0.99)'),
'makelimit' => $db->sqleval('greatest(0, makelimit - 1)'),
], true);
//전략제한-1, 외교제한-1, 세율동기화
+4 -2
View File
@@ -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;
+6 -3
View File
@@ -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 = [
+16 -4
View File
@@ -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 = [];
+2 -2
View File
@@ -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)
}
-2
View File
@@ -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';
+52 -11
View File
@@ -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,21 +1092,50 @@ 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) {
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 {
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'
);
}
}
/** @var Map<int,Map<RankColumn,int|float>> */
+35 -35
View File
@@ -1,48 +1,48 @@
import chai, { assert } from "chai";
import _ from "lodash-es";
import { formatConnectScore } from "../ts/utilGame/formatConnectScore";
import { formatRefreshScore } from "../ts/utilGame/formatRefreshScore";
import { formatDexLevel } from "../ts/utilGame/formatDexLevel";
import { formatDefenceTrain } from "../ts/utilGame/formatDefenceTrain";
import { formatHonor } from "../ts/utilGame/formatHonor";
describe("formatConnectScore", () => {
it("connectScoreEqual", () => {
assert.equal(formatConnectScore(0), "안함");
assert.equal(formatConnectScore(50), "무관심");
assert.equal(formatConnectScore(100), "보통");
assert.equal(formatConnectScore(200), "가끔");
assert.equal(formatConnectScore(400), "자주");
assert.equal(formatConnectScore(800), "열심");
assert.equal(formatConnectScore(1600), "중독");
assert.equal(formatConnectScore(3200), "폐인");
assert.equal(formatConnectScore(6400), "경고");
assert.equal(formatConnectScore(12800), "헐...");
describe("formatRefreshScore", () => {
it("refreshScoreEqual", () => {
assert.equal(formatRefreshScore(0), "안함");
assert.equal(formatRefreshScore(50), "무관심");
assert.equal(formatRefreshScore(100), "보통");
assert.equal(formatRefreshScore(200), "가끔");
assert.equal(formatRefreshScore(400), "자주");
assert.equal(formatRefreshScore(800), "열심");
assert.equal(formatRefreshScore(1600), "중독");
assert.equal(formatRefreshScore(3200), "폐인");
assert.equal(formatRefreshScore(6400), "경고");
assert.equal(formatRefreshScore(12800), "헐...");
});
it("connectScore+1", () => {
assert.equal(formatConnectScore(1), "안함");
assert.equal(formatConnectScore(51), "무관심");
assert.equal(formatConnectScore(101), "보통");
assert.equal(formatConnectScore(201), "가끔");
assert.equal(formatConnectScore(401), "자주");
assert.equal(formatConnectScore(801), "열심");
assert.equal(formatConnectScore(1601), "중독");
assert.equal(formatConnectScore(3201), "폐인");
assert.equal(formatConnectScore(6401), "경고");
assert.equal(formatConnectScore(12801), "헐...");
it("refreshScore+1", () => {
assert.equal(formatRefreshScore(1), "안함");
assert.equal(formatRefreshScore(51), "무관심");
assert.equal(formatRefreshScore(101), "보통");
assert.equal(formatRefreshScore(201), "가끔");
assert.equal(formatRefreshScore(401), "자주");
assert.equal(formatRefreshScore(801), "열심");
assert.equal(formatRefreshScore(1601), "중독");
assert.equal(formatRefreshScore(3201), "폐인");
assert.equal(formatRefreshScore(6401), "경고");
assert.equal(formatRefreshScore(12801), "헐...");
});
it("connectScoreF-1", () => {
assert.equal(formatConnectScore(49), "안함");
assert.equal(formatConnectScore(99), "무관심");
assert.equal(formatConnectScore(199), "보통");
assert.equal(formatConnectScore(399), "가끔");
assert.equal(formatConnectScore(799), "자주");
assert.equal(formatConnectScore(1599), "열심");
assert.equal(formatConnectScore(3199), "중독");
assert.equal(formatConnectScore(6399), "폐인");
assert.equal(formatConnectScore(11799), "경고");
assert.equal(formatConnectScore(20000), "헐...");
it("refreshScoreF-1", () => {
assert.equal(formatRefreshScore(49), "안함");
assert.equal(formatRefreshScore(99), "무관심");
assert.equal(formatRefreshScore(199), "보통");
assert.equal(formatRefreshScore(399), "가끔");
assert.equal(formatRefreshScore(799), "자주");
assert.equal(formatRefreshScore(1599), "열심");
assert.equal(formatRefreshScore(3199), "중독");
assert.equal(formatRefreshScore(6399), "폐인");
assert.equal(formatRefreshScore(11799), "경고");
assert.equal(formatRefreshScore(20000), "헐...");
});
});
+4 -4
View File
@@ -151,8 +151,8 @@
</span>
</div>
<div class="bg1">벌점</div>
<div class="general-connect-score">
{{ formatConnectScore(general.connect) }} {{ general.connect.toLocaleString() }}({{ general.con }})
<div class="general-refresh-score-total">
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ general.refreshScoreTotal.toLocaleString() }}({{ general.refreshScore }})
</div>
</div>
</template>
@@ -168,7 +168,7 @@ import { unwrap } from "@/util/unwrap";
import type { GameConstStore } from "@/GameConstStore";
import { formatGeneralTypeCall } from "@/utilGame/formatGeneralTypeCall";
import { nextExpLevelRemain } from "@/utilGame/nextExpLevelRemain";
import { formatConnectScore } from "@/utilGame/formatConnectScore";
import { formatRefreshScore } from "@/utilGame/formatRefreshScore";
import SammoBar from "@/components/SammoBar.vue";
import { parseTime } from "@/util/parseTime";
import { clamp } from "lodash-es";
@@ -341,7 +341,7 @@ watch(
grid-column: 2 / 4;
}
.general-connect-score {
.general-refresh-score-total {
grid-column: 5 / 8;
}
</style>
+9 -9
View File
@@ -106,7 +106,7 @@ import type { GameConstStore } from "@/GameConstStore";
import { unwrap } from "@/util/unwrap";
import SimpleTooltipCell from "@/gridCellRenderer/SimpleTooltipCell.vue";
import GridTooltipCell, { type GridCellInfo } from "@/gridCellRenderer/GridTooltipCell.vue";
import { formatConnectScore } from "@/utilGame/formatConnectScore";
import { formatRefreshScore } from "@/utilGame/formatRefreshScore";
import { convertSearch초성 } from "@/util/convertSearch초성";
import { isString } from "lodash-es";
import { formatDefenceTrain } from "@/utilGame/formatDefenceTrain";
@@ -353,7 +353,7 @@ type headerType =
| "trainAtmos"
| "specials"
| "reservedCommandShort"
| "killturnAndConnect"
| "killturnAndRefresh"
| "years"
| "warResults";
@@ -1117,18 +1117,18 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
},
],
},
killturnAndConnect: {
groupId: "killturnAndConnect",
killturnAndRefresh: {
groupId: "killturnAndRefresh",
headerName: "기타",
children: [
{
colId: "killturnAndConnect",
colId: "killturnAndRefresh",
headerName: "삭/벌",
cellRenderer: ({ data }: GenValueParams) => {
if (data === undefined) {
return "?";
}
return `${data.killturn.toLocaleString()}턴<br>${data.connect.toLocaleString()}`;
return `${data.killturn.toLocaleString()}턴<br>${data.refreshScoreTotal.toLocaleString()}`;
},
cellClass: rightAlignClass,
columnGroupShow: "closed",
@@ -1149,14 +1149,14 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
columnGroupShow: "open",
},
{
colId: "connect",
colId: "refreshScoreTotal",
headerName: "벌점",
field: "connect",
field: "refreshScoreTotal",
cellRenderer: ({ data }: GenValueParams) => {
if (data === undefined) {
return "?";
}
return `${data.connect.toLocaleString()}점<br>(${formatConnectScore(data.connect)})`;
return `${data.refreshScoreTotal.toLocaleString()}점<br>(${formatRefreshScore(data.refreshScoreTotal)})`;
},
...sortableNumber,
width: 70,
+4 -4
View File
@@ -78,8 +78,8 @@
<div>{{ general.killturn }} </div>
<div class="bg1">벌점</div>
<div class="general-connect-score">
{{ formatConnectScore(general.connect) }} {{ general.connect.toLocaleString() }}
<div class="general-refresh-score-total">
{{ formatRefreshScore(general.refreshScoreTotal) }} {{ general.refreshScoreTotal.toLocaleString() }}
</div>
</div>
</template>
@@ -94,7 +94,7 @@ import type { NationStaticItem } from "@/defs";
import { unwrap } from "@/util/unwrap";
import type { GameConstStore } from "@/GameConstStore";
import { formatGeneralTypeCall } from "@/utilGame/formatGeneralTypeCall";
import { formatConnectScore } from "@/utilGame/formatConnectScore";
import { formatRefreshScore } from "@/utilGame/formatRefreshScore";
import { calcInjury } from "@/utilGame/calcInjury";
import type { GameIActionInfo } from "@/defs/GameObj";
import { isValidObjKey } from "@/utilGame/isValidObjKey";
@@ -204,7 +204,7 @@ watch(
font-weight: bold;
}
.general-connect-score {
.general-refresh-score-total {
grid-column: 5 / 8;
}
</style>
+2 -2
View File
@@ -27,7 +27,7 @@ export type GeneralListItemP0 = {
specialWar: GameObjClassKey;
personal: GameObjClassKey;
belong: number;
connect: number;
refreshScoreTotal: number;
officerLevel: number; //권한에따라 태수,군사,시종 노출 여부가 다름
officerLevelText: string;
@@ -46,7 +46,7 @@ export type GeneralListItemP0 = {
};
export type GeneralListItemP1 = {
con: number;
refreshScore: number;
specage: number;
specage2: number;
leadership_exp: number;
+6 -6
View File
@@ -210,7 +210,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
sort: null,
},
{
colId: "killturnAndConnect_1",
colId: "killturnAndRefresh_1",
width: 70,
hide: false,
sort: null,
@@ -222,7 +222,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
sort: null,
},
{
colId: "connect",
colId: "refreshScoreTotal",
width: 70,
hide: true,
sort: null,
@@ -310,7 +310,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
open: false,
},
{
groupId: "killturnAndConnect",
groupId: "killturnAndRefresh",
open: true,
},
{
@@ -522,7 +522,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
sort: null,
},
{
colId: "killturnAndConnect_1",
colId: "killturnAndRefresh_1",
width: 70,
hide: false,
sort: null,
@@ -534,7 +534,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
sort: null,
},
{
colId: "connect",
colId: "refreshScoreTotal",
width: 70,
hide: false,
sort: "desc",
@@ -623,7 +623,7 @@ export const defaultDisplaySetting: Record<"war" | "normal", GridDisplaySetting>
open: false
},
{
groupId: "killturnAndConnect",
groupId: "killturnAndRefresh",
open: true
},
{
+2 -2
View File
@@ -39,7 +39,7 @@ export type PublicGeneralItem = {
dedicationStr: string,
officerLevelStr: string,
killturn: number,
connect: number,
refreshScoreTotal: number,
}
@@ -55,7 +55,7 @@ export type GeneralListResponse = {
PublicGeneralItem['leadership'], PublicGeneralItem['lbonus'], PublicGeneralItem['strength'], PublicGeneralItem['intel'],
PublicGeneralItem['explevel'],
PublicGeneralItem['experienceStr'], PublicGeneralItem['dedicationStr'], PublicGeneralItem['officerLevelStr'],
PublicGeneralItem['killturn'], PublicGeneralItem['connect']
PublicGeneralItem['killturn'], PublicGeneralItem['refreshScoreTotal']
][],
token?: Record<number, number>,
}
+1 -1
View File
@@ -273,7 +273,7 @@ function printGeneralList(value: GeneralListResponse) {
dedicationStr: rawGeneral[18],
officerLevelStr: rawGeneral[19],
killturn: rawGeneral[20],
connect: rawGeneral[21],
refreshScoreTotal: rawGeneral[21],
reserved: 0
};
if (general.npc < 2) {
@@ -1,6 +1,6 @@
import bs from "binary-search";
const connectMap: [number, string][] = [
const refreshScoreMap: [number, string][] = [
[0, "안함"],
[50, "무관심"],
[100, "보통"],
@@ -13,11 +13,11 @@ const connectMap: [number, string][] = [
[12800, "헐..."],
];
export function formatConnectScore(connect: number) {
const idx = bs(connectMap, connect, ([key], needle) => key - needle);
export function formatRefreshScore(refreshScore: number) {
const idx = bs(refreshScoreMap, refreshScore, ([key], needle) => key - needle);
if (idx >= 0) {
return connectMap[idx][1] ?? "?";
return refreshScoreMap[idx][1] ?? "?";
}
const uidx = (~idx) - 1;
return connectMap[uidx][1];
return refreshScoreMap[uidx][1];
}
+1 -1
View File
@@ -1,6 +1,6 @@
export { calcInjury } from './calcInjury';
export { formatCityName } from './formatCityName';
export { formatConnectScore } from './formatConnectScore';
export { formatRefreshScore } from './formatRefreshScore';
export { formatDefenceTrain } from './formatDefenceTrain';
export { formatDexLevel } from './formatDexLevel';
export { formatGeneralTypeCall } from './formatGeneralTypeCall';