feat,refac: vue3로 작성한 새 연감 페이지 #217
@@ -39,7 +39,6 @@ return [
|
||||
'hwe/a_emperior.php',
|
||||
'hwe/a_genList.php',
|
||||
'hwe/a_hallOfFame.php',
|
||||
'hwe/a_history.php',
|
||||
'hwe/a_kingdomList.php',
|
||||
'hwe/a_npcList.php',
|
||||
'hwe/api.php',
|
||||
@@ -108,7 +107,6 @@ return [
|
||||
'hwe/j_install_db.php',
|
||||
'hwe/j_install.php',
|
||||
'hwe/j_load_scenarios.php',
|
||||
'hwe/j_map_history.php',
|
||||
'hwe/j_map.php',
|
||||
'hwe/j_map_recent.php',
|
||||
'hwe/j_msg_contact_list.php',
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ increaseRefresh("왕조일람", 1);
|
||||
<tr>
|
||||
<td style="background-color:#333333;" align=center colspan=8>
|
||||
<font size=5>현재 (<?= $year ?>年 <?= $month ?>月)</font>
|
||||
<a href="a_history.php"><button type='button'>역사 보기</button></a>
|
||||
<a href="v_history.php"><button type='button'>역사 보기</button></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -75,7 +75,7 @@ increaseRefresh("왕조일람", 1);
|
||||
<a href="a_emperior_detail.php?select=<?= $emperior['no'] ?>"><button type='button'>자세히</button></a>
|
||||
|
||||
<?php if ($emperior['server_id']) : ?>
|
||||
<a href="a_history.php?serverID=<?= $emperior['server_id'] ?>"><button type='button'>역사 보기</button></a>
|
||||
<a href="v_history.php?serverID=<?= $emperior['server_id'] ?>"><button type='button'>역사 보기</button></a>
|
||||
<?php endif ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
$btn = Util::getReq('btn');
|
||||
$yearMonth = Util::getReq('yearmonth', 'int');
|
||||
$serverID = Util::getReq('serverID', 'string', null);
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
if (!$serverID) {
|
||||
$serverID = UniqueConst::$serverID;
|
||||
}
|
||||
|
||||
if ($serverID === UniqueConst::$serverID) {
|
||||
increaseRefresh("연감", 1);
|
||||
}
|
||||
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
printLimitMsg($me['turntime']);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
|
||||
$s = Util::joinYearMonth($s_year, $s_month);
|
||||
|
||||
if ($s_year === null) {
|
||||
echo '인자 에러';
|
||||
exit();
|
||||
}
|
||||
|
||||
[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
|
||||
$e = Util::joinYearMonth($e_year, $e_month);
|
||||
|
||||
if ($serverID !== UniqueConst::$serverID) {
|
||||
$mapName = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
|
||||
} else {
|
||||
$mapName = GameConst::$mapName;
|
||||
}
|
||||
|
||||
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
|
||||
if ($serverID !== UniqueConst::$serverID && !$yearMonth) {
|
||||
$yearMonth = $s;
|
||||
} else if (!$yearMonth) {
|
||||
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
|
||||
} else {
|
||||
if ($btn == "◀◀ 이전달") {
|
||||
$yearMonth -= 1;
|
||||
} elseif ($btn == "다음달 ▶▶") {
|
||||
$yearMonth += 1;
|
||||
}
|
||||
}
|
||||
|
||||
$isCurrent = false;
|
||||
if ($yearMonth < $s) {
|
||||
$yearMonth = $s;
|
||||
}
|
||||
if ($yearMonth > $e) {
|
||||
$isCurrent = true;
|
||||
$yearMonth = $e + 1;
|
||||
}
|
||||
|
||||
[$year, $month] = Util::parseYearMonth($yearMonth);
|
||||
|
||||
function getHistory($serverID, $year, $month):array{
|
||||
$db = DB::db();
|
||||
$history = $db->queryFirstRow('SELECT * FROM ng_history WHERE server_id = %s AND year = %i AND month = %i', $serverID, $year, $month);
|
||||
$history['global_history'] = Json::decode($history['global_history']);
|
||||
$history['global_action'] = Json::decode($history['global_action']);
|
||||
$history['nations'] = Json::decode($history['nations']);
|
||||
return $history;
|
||||
}
|
||||
|
||||
|
||||
if($isCurrent){
|
||||
$history = getCurrentHistory();
|
||||
}
|
||||
else{
|
||||
$history = getHistory($serverID, $year, $month);
|
||||
}
|
||||
|
||||
$nations = $history['nations'];
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?= UniqueConst::$serverName ?>: 연감</title>
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
|
||||
<?= WebUtil::printJS("js/map/theme_{$mapName}.js") ?>
|
||||
<?= WebUtil::printCSS('../d_shared/common.css') ?>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||
<?= WebUtil::printCSS('css/map.css') ?>
|
||||
<?= WebUtil::printCSS('css/history.css') ?>
|
||||
<?= WebUtil::printStaticValues([
|
||||
'staticValues' => [
|
||||
'startYear' => $s_year,
|
||||
'startMonth' => $s_month,
|
||||
'lastYear' => $e_year,
|
||||
'lastMonth' => $e_month,
|
||||
'selectYear' => $year,
|
||||
'selectMonth' => $month,
|
||||
'nations' => $nations ? $history['nations'] : [],
|
||||
'serverNick' => DB::prefix(),
|
||||
'serverID' => UniqueConst::$serverID,
|
||||
]
|
||||
])?>
|
||||
<?= WebUtil::printDist('ts', ['common', 'history']) ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td>연 감<br><?= closeButton() ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<form name=form1 method=post>
|
||||
연월 선택 :
|
||||
<input type=submit name=btn value="◀◀ 이전달">
|
||||
<select id='yearmonth' name=yearmonth size=1>
|
||||
<option selected='selected'><?= $year ?>년 <?= $month ?>월</option>
|
||||
<option><?= $e_year ?>년 12월 (현재)</option>
|
||||
</select>
|
||||
<input type=submit name=btn value='조회하기'>
|
||||
<input type=submit name=btn value="다음달 ▶▶">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align=center width=1000 height=520 class='tb_layout bg0'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan=5 align=center class='bg1'>중 원 지 도</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr height=520>
|
||||
<td width=698>
|
||||
<?= getMapHtml($mapName) ?>
|
||||
</td>
|
||||
<td id='nation_list_frame'>
|
||||
<table id='nation_list'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th width=130>국명</th>
|
||||
<th width=70>국력</th>
|
||||
<th width=45>장수</th>
|
||||
<th width=45>속령</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($nations as $nation) : ?>
|
||||
<tr>
|
||||
<td><span style='color:<?= newColor($nation['color']) ?>;background-color:<?= $nation['color'] ?>'><?= $nation['name'] ?></td>
|
||||
<td style='text-align:right'><?= number_format($nation['power']) ?></td>
|
||||
<td style='text-align:right'><?= number_format($nation['gennum']) ?></td>
|
||||
<td style='text-align:right'><?= number_format(count($nation['cities'] ?? [])) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot></tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=5 align=center class='bg1'>중 원 정 세</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?= formatHistoryToHTML($history['global_history']) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan=5 align=center class='bg1'>장 수 동 향</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=5 valign=top>
|
||||
<?= formatHistoryToHTML($history['global_action']) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td><?= closeButton() ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?= banner() ?> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
<?php if($isCurrent): ?>
|
||||
reloadWorldMap({
|
||||
showMe: false,
|
||||
neutralView: true,
|
||||
useCachedMap: true,
|
||||
});
|
||||
<?php else: ?>
|
||||
reloadWorldMap({
|
||||
targetJson: 'j_map_history.php?year=<?= $year ?>&month=<?= $month ?>&serverID=<?= $serverID ?>',
|
||||
showMe: false,
|
||||
neutralView: true,
|
||||
useCachedMap: false,
|
||||
year: <?= $year ?>,
|
||||
month: <?= $month ?>,
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$year = Util::getReq('year', 'int');
|
||||
$month = Util::getReq('month', 'int');
|
||||
$serverID = Util::getReq('serverID', 'string', null);
|
||||
|
||||
$url = '/a_history.php';
|
||||
|
||||
if(!strpos($_SERVER['HTTP_REFERER'], $url)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'Invalid Referer'
|
||||
]);
|
||||
}
|
||||
|
||||
if($year === null || !$month) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'year, month가 지정되지 않았습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
if(!$serverID){
|
||||
$serverID = UniqueConst::$serverID;
|
||||
}
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$map = $db->queryFirstField('SELECT map FROM ng_history WHERE server_id=%s AND year=%i AND month=%i', $serverID, $year, $month);
|
||||
|
||||
if(!$map){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'해당하는 연월의 지도가 없습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
Json::die($map, Json::PASS_THROUGH);
|
||||
@@ -0,0 +1,42 @@
|
||||
@import "./common/bootstrap5.scss";
|
||||
@import "./editor_component.scss";
|
||||
@import "./util.scss";
|
||||
|
||||
@include media-1000px {
|
||||
#container {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
.year-selector{
|
||||
margin-left: 100%/24*5;
|
||||
}
|
||||
|
||||
.map_position{
|
||||
flex: 0 0 auto;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
.nation_position{
|
||||
flex: 0 0 auto;
|
||||
width: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@include media-500px {
|
||||
#container {
|
||||
width: 500px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.map_position{
|
||||
flex: 0 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.nation_position{
|
||||
flex: 0 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<?=$btnBegin??''?><a href="a_kingdomList.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">세력일람</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_genList.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">장수일람</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_bestGeneral.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">명장일람</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_history.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">연감</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="v_history.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">연감</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_hallOfFame.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">명예의전당</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_emperior.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">왕조일람</a><?=$btnEnd??''?>
|
||||
<?=$btnBegin??''?><a href="a_traffic.php" target="_blank" class="open-window toolbarButton <?=$btnClass??""?>">접속량정보</a><?=$btnEnd??''?>
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<BContainer v-if="asyncReady" id="container" :toast="{ root: true }" class="bg0 pageHistory">
|
||||
<TopBackBar title="연감" type="close"></TopBackBar>
|
||||
<div class="center row mx-0 s-border-tb">
|
||||
<div class="col-md-1 col-2 year-selector text-end align-self-center">연월 선택:</div>
|
||||
<BButton class="col-md-1 col-2" @click="queryYearMonth -= 1">◀ 이전달</BButton>
|
||||
<div class="col-md-3 col-5 d-grid">
|
||||
<BFormSelect v-model="queryYearMonth" :options="generateYearMonthList()" />
|
||||
</div>
|
||||
<BButton class="col-md-1 col-2" @click="queryYearMonth += 1">다음달 ▶</BButton>
|
||||
</div>
|
||||
<div v-if="history" class="mx-0">
|
||||
<div class="row g-0">
|
||||
<div class="map_position">
|
||||
<MapViewer
|
||||
:server-nick="serverNick"
|
||||
:serverID="queryServerID"
|
||||
:map-name="unwrap(gameConstStore?.gameConst.mapName)"
|
||||
:model-value="history.map"
|
||||
:is-detail-map="false"
|
||||
:city-position="cityPosition"
|
||||
:format-city-info="formatCityInfoText"
|
||||
:image-path="imagePath"
|
||||
:disallow-click="true"
|
||||
/>
|
||||
</div>
|
||||
<div class="nation_position"><SimpleNationList :nations="history.nations" /></div>
|
||||
</div>
|
||||
<div class="world_history">
|
||||
<div class="bg1 center s-border-tb"><b>중원 정세</b></div>
|
||||
<div class="content">
|
||||
<template v-for="(item, idx) in history.global_history" :key="idx">
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<span v-html="formatLog(item)"></span>
|
||||
<br />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="general_public_record">
|
||||
<div class="bg1 center s-border-tb"><b>장수 동향</b></div>
|
||||
<div class="content">
|
||||
<template v-for="(item, idx) in history.global_action" :key="idx">
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<span v-html="formatLog(item)"></span>
|
||||
<br />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BottomBar type="close"></BottomBar>
|
||||
</BContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
declare const staticValues: {
|
||||
fisrtYearMonth: number;
|
||||
lastYearMonth: number;
|
||||
currentYearMonth: number;
|
||||
serverNick: string;
|
||||
serverID: string;
|
||||
};
|
||||
declare const query: {
|
||||
yearMonth: number | null;
|
||||
serverID: string;
|
||||
};
|
||||
|
||||
declare const getCityPosition: () => CityPositionMap;
|
||||
declare const formatCityInfo: (city: MapCityParsedRaw) => MapCityParsed;
|
||||
</script>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, provide, ref, watch } from "vue";
|
||||
import { BContainer, BButton, BFormSelect } from "bootstrap-vue-3";
|
||||
import TopBackBar from "@/components/TopBackBar.vue";
|
||||
import BottomBar from "@/components/BottomBar.vue";
|
||||
import type { HistoryObj } from "./defs/API/Global";
|
||||
import { SammoAPI } from "./SammoAPI";
|
||||
import { joinYearMonth } from "./util/joinYearMonth";
|
||||
import { parseYearMonth } from "./util/parseYearMonth";
|
||||
import { formatLog } from "./utilGame/formatLog";
|
||||
import SimpleNationList from "./components/SimpleNationList.vue";
|
||||
import MapViewer, { type CityPositionMap, type MapCityParsedRaw, type MapCityParsed} from "./components/MapViewer.vue";
|
||||
import { getGameConstStore, type GameConstStore } from "./GameConstStore";
|
||||
import { unwrap } from "@/util/unwrap";
|
||||
|
||||
const queryYearMonth = ref<number>();
|
||||
const queryServerID = query.serverID;
|
||||
const serverNick = staticValues.serverNick;
|
||||
|
||||
const lastYearMonth = ref(staticValues.lastYearMonth);
|
||||
const firstYearMonth = ref(staticValues.fisrtYearMonth);
|
||||
const currentYearMonth = ref(staticValues.currentYearMonth);
|
||||
|
||||
const asyncReady = ref<boolean>(false);
|
||||
const gameConstStore = ref<GameConstStore>();
|
||||
provide("gameConstStore", gameConstStore);
|
||||
const storeP = getGameConstStore().then((store) => {
|
||||
gameConstStore.value = store;
|
||||
});
|
||||
|
||||
void Promise.all([storeP]).then(() => {
|
||||
asyncReady.value = true;
|
||||
});
|
||||
|
||||
const cityPosition = getCityPosition();
|
||||
const formatCityInfoText = formatCityInfo;
|
||||
const imagePath = window.pathConfig.gameImage;
|
||||
|
||||
const history = ref<HistoryObj>();
|
||||
|
||||
function generateYearMonthList(): { text: string; value: number }[] {
|
||||
const result: { text: string; value: number }[] = [];
|
||||
let yearMonth = firstYearMonth.value;
|
||||
while (yearMonth <= lastYearMonth.value) {
|
||||
const [year, month] = parseYearMonth(yearMonth);
|
||||
const info: string[] = [];
|
||||
if (queryYearMonth.value === yearMonth) {
|
||||
info.push("선택");
|
||||
}
|
||||
result.push({ text: `${year}년 ${month}월 ${info.length > 0 ? `(${info.join(", ")})` : ""}`, value: yearMonth });
|
||||
yearMonth += 1;
|
||||
}
|
||||
const [year, month] = parseYearMonth(yearMonth);
|
||||
const info: string[] = [];
|
||||
if (queryYearMonth.value === yearMonth) {
|
||||
info.push("선택");
|
||||
}
|
||||
info.push("현재");
|
||||
result.push({ text: `${year}년 ${month}월 ${info.length > 0 ? `(${info.join(", ")})` : ""}`, value: yearMonth });
|
||||
return result;
|
||||
}
|
||||
|
||||
watch(queryYearMonth, async (yearMonth) => {
|
||||
if (yearMonth === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (yearMonth < firstYearMonth.value) {
|
||||
queryYearMonth.value = firstYearMonth.value;
|
||||
return;
|
||||
}
|
||||
if (yearMonth > lastYearMonth.value + 1) {
|
||||
queryYearMonth.value = lastYearMonth.value + 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (yearMonth > lastYearMonth.value) {
|
||||
try {
|
||||
const result = await SammoAPI.Global.GetCurrentHistory();
|
||||
history.value = result.data;
|
||||
console.log(result);
|
||||
const newLastYearMonth = joinYearMonth(result.data.year, result.data.month) - 1;
|
||||
if (newLastYearMonth > lastYearMonth.value) {
|
||||
lastYearMonth.value = newLastYearMonth;
|
||||
currentYearMonth.value = newLastYearMonth + 1;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const [year, month] = parseYearMonth(yearMonth);
|
||||
try {
|
||||
const result = await SammoAPI.Global.GetHistory[queryServerID][year][month]();
|
||||
history.value = result.data;
|
||||
console.log(result);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
queryYearMonth.value = (() => {
|
||||
if (query.yearMonth === null) {
|
||||
return staticValues.currentYearMonth;
|
||||
}
|
||||
if (query.yearMonth > staticValues.lastYearMonth + 1) {
|
||||
return staticValues.currentYearMonth;
|
||||
}
|
||||
if (query.yearMonth < staticValues.fisrtYearMonth) {
|
||||
return staticValues.currentYearMonth;
|
||||
}
|
||||
return query.yearMonth;
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
@@ -28,6 +28,7 @@
|
||||
"v_NPCControl": "v_NPCControl.ts",
|
||||
"v_join": "v_join.ts",
|
||||
"v_main": "v_main.ts",
|
||||
"v_history": "v_history.ts",
|
||||
"v_nationStratFinan": "v_nationStratFinan.ts",
|
||||
"v_processing": "v_processing.ts",
|
||||
"v_nationBetting": "v_nationBetting.ts",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<template>
|
||||
<div class="bg0" style="padding-top: 20px">
|
||||
<button type="button" class="btn btn-sammo-base2 back_btn" @click="back">돌아가기</button>
|
||||
<button type="button" class="btn btn-sammo-base2 back_btn" @click="back">
|
||||
{{ props.type == "close" ? "창 닫기" : "돌아가기" }}
|
||||
</button>
|
||||
<div />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<table class="simple_nation_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 44%">국명</th>
|
||||
<th style="width: 23%">국력</th>
|
||||
<th style="width: 15%">장수</th>
|
||||
<th style="width: 15%">속령</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="nation of nations" :key="nation.nation">
|
||||
<td>
|
||||
<span
|
||||
:style="{
|
||||
color: isBrightColor(nation.color) ? '#000' : '#fff',
|
||||
backgroundColor: nation.color,
|
||||
}"
|
||||
>{{ nation.name }}</span
|
||||
>
|
||||
</td>
|
||||
<td style="text-align: right">{{ nation.power.toLocaleString() }}</td>
|
||||
<td style="text-align: right">{{ nation.gennum.toLocaleString() }}</td>
|
||||
<td v-b-tooltip.hover style="text-align: right" :title="(nation.cities ?? []).join(', ')">
|
||||
{{ (nation.cities ?? []).length }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot></tfoot>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { SimpleNationObj } from "@/defs";
|
||||
import type { PropType } from "vue";
|
||||
import { isBrightColor } from "@/util/isBrightColor";
|
||||
|
||||
defineProps({
|
||||
nations: {
|
||||
type: Array as PropType<SimpleNationObj[]>,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.simple_nation_list {
|
||||
width: 100%;
|
||||
|
||||
thead {
|
||||
background-color: #cccccc;
|
||||
color: black;
|
||||
text-align: center;
|
||||
}
|
||||
th {
|
||||
border: 0;
|
||||
border-left: 1px solid gray;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 0;
|
||||
border-left: 1px solid gray;
|
||||
padding: 1px 6px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div :class="['bg0', 'back_bar', teleportZone?'back_bar_teleport':undefined]">
|
||||
<button type="button" class="btn btn-sammo-base2 back_btn" @click="back">돌아가기</button
|
||||
<div :class="['bg0', 'back_bar', teleportZone ? 'back_bar_teleport' : undefined]">
|
||||
<button type="button" class="btn btn-sammo-base2 back_btn" @click="back">
|
||||
{{ props.type == "close" ? "창 닫기" : "돌아가기" }}</button
|
||||
><button v-if="reloadable" type="button" class="btn btn-sammo-base2 reload_btn" @click="reload">갱신</button>
|
||||
<div v-else />
|
||||
<h2 class="title">
|
||||
@@ -94,7 +95,7 @@ function reload() {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.teleport-zone{
|
||||
.teleport-zone {
|
||||
height: 24pt;
|
||||
}
|
||||
|
||||
|
||||
+14
-1
@@ -1,6 +1,6 @@
|
||||
import type { Args } from "@/processing/args";
|
||||
import type { ValidResponse, InvalidResponse } from "@/util/callSammoAPI";
|
||||
import type { GameObjClassKey } from "./GameObj";
|
||||
import type { GameIActionKey, GameObjClassKey } from "./GameObj";
|
||||
|
||||
export type { ValidResponse, InvalidResponse };
|
||||
export type BasicGeneralListResponse = {
|
||||
@@ -247,4 +247,17 @@ export type MapResult = {
|
||||
|
||||
theme?: string,
|
||||
history?: string[],
|
||||
}
|
||||
|
||||
|
||||
export type SimpleNationObj = {
|
||||
capital: number,
|
||||
cities: string[],
|
||||
color: string,
|
||||
gennum: number,
|
||||
level: number,
|
||||
name: string,
|
||||
nation: number,
|
||||
power: number,
|
||||
type: GameIActionKey
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
const regex = /<([RBGMCLSODYW]1?|1|\/)>/g;
|
||||
|
||||
//TODO: <R>에서 더 확장해서, <R|G>, <R|N> 형태로 뒤에 타입을 지정할 수 있도록 한다.
|
||||
|
||||
const convertMap: Record<string, string> = {
|
||||
"R": 'color: red;',
|
||||
"B": 'color: blue;',
|
||||
"G": 'color: green;',
|
||||
"M": 'color: magenta;',
|
||||
"C": 'color: cyan;',
|
||||
"L": 'color: limegreen;',
|
||||
"S": 'color: skyblue;',
|
||||
"O": 'color: orangered;',
|
||||
"D": 'color: orangered;',
|
||||
"Y": 'color: yellow;',
|
||||
"W": 'color: white;',
|
||||
"1": 'font-size: 0.9em;',
|
||||
}
|
||||
|
||||
const convertMap2: Record<string, string> = {
|
||||
"1": 'font-size: 0.9em;',
|
||||
}
|
||||
|
||||
export function formatLog(text?: string): string {
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let matchRes;
|
||||
let lastIndex = 0;
|
||||
const result = [];
|
||||
while ((matchRes = regex.exec(text)) !== null) {
|
||||
const {
|
||||
0: partAll,
|
||||
1: subPart,
|
||||
index,
|
||||
} = matchRes;
|
||||
if (lastIndex != index) {
|
||||
result.push(text.slice(lastIndex, index));
|
||||
}
|
||||
|
||||
if (subPart == '/') {
|
||||
result.push(`</span>`);
|
||||
}
|
||||
else if (subPart.length == 2) {
|
||||
result.push(`<span style="${convertMap[subPart[0]] ?? ''}${convertMap2[subPart[1]] ?? ''}">`);
|
||||
}
|
||||
else {
|
||||
result.push(`<span style="${convertMap[subPart] ?? ''}">`);
|
||||
}
|
||||
|
||||
lastIndex = index + partAll.length;
|
||||
}
|
||||
|
||||
if (lastIndex != text.length) {
|
||||
result.push(text.slice(lastIndex));
|
||||
}
|
||||
|
||||
return result.join('');
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
import { clamp } from "lodash";
|
||||
|
||||
export const TECH_LEVEL_YEAR_GAP = 5;
|
||||
export const TECH_LEVEL_STEP = 1000;
|
||||
|
||||
export function isTechLimited(startYear: number, year: number, tech: number, maxTechLevel: number): boolean {
|
||||
const relMaxTech = getMaxRelativeTechLevel(startYear, year, maxTechLevel);
|
||||
const techLevel = convTechLevel(tech, maxTechLevel);
|
||||
|
||||
return techLevel >= relMaxTech;
|
||||
}
|
||||
|
||||
export function convTechLevel(tech: number, maxTechLevel: number): number{
|
||||
return clamp(Math.floor(tech / TECH_LEVEL_STEP), 0, maxTechLevel);
|
||||
}
|
||||
|
||||
|
||||
export function getMaxRelativeTechLevel(startYear: number, year: number, maxTechLevel: number): number {
|
||||
const relYear = year - startYear;
|
||||
return clamp(Math.floor(relYear / TECH_LEVEL_YEAR_GAP) + 1, 1, maxTechLevel);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import "@scss/history.scss";
|
||||
import { createApp } from 'vue'
|
||||
import PageHistory from '@/PageHistory.vue';
|
||||
import { BootstrapVue3, BToastPlugin } from 'bootstrap-vue-3'
|
||||
import { setAxiosXMLHttpRequest } from '@util/setAxiosXMLHttpRequest';
|
||||
import { auto500px } from "./util/auto500px";
|
||||
import { htmlReady } from "./util/htmlReady";
|
||||
import { insertCustomCSS } from "./util/customCSS";
|
||||
|
||||
setAxiosXMLHttpRequest();
|
||||
auto500px();
|
||||
|
||||
htmlReady(() => {
|
||||
insertCustomCSS();
|
||||
});
|
||||
createApp(PageHistory).use(BootstrapVue3).use(BToastPlugin).mount('#app');
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$serverID = Util::getReq('serverID', 'string', null);
|
||||
if (!$serverID) {
|
||||
$serverID = UniqueConst::$serverID;
|
||||
}
|
||||
if ($serverID !== UniqueConst::$serverID) {
|
||||
$mapName = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
|
||||
} else {
|
||||
$mapName = GameConst::$mapName;
|
||||
}
|
||||
|
||||
[$f_year, $f_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
|
||||
[$l_year, $l_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
|
||||
[$currentYear, $currentMonth] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title><?= UniqueConst::$serverName ?>:연감</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=500" />
|
||||
<?= WebUtil::printJS('../d_shared/common_path.js', true) ?>
|
||||
<?= WebUtil::printJS("js/map/theme_{$mapName}.js") ?>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
|
||||
<?= WebUtil::printStaticValues([
|
||||
'staticValues' => [
|
||||
'fisrtYearMonth' => Util::joinYearMonth($f_year, $f_month),
|
||||
'lastYearMonth' => Util::joinYearMonth($l_year, $l_month),
|
||||
'currentYearMonth' => Util::joinYearMonth($currentYear, $currentMonth),
|
||||
'serverNick' => DB::prefix(),
|
||||
'serverID' => UniqueConst::$serverID,
|
||||
],
|
||||
'query' => [
|
||||
'serverID' => $serverID,
|
||||
'yearMonth' => Util::getReq('yearMonth', 'int'),
|
||||
],
|
||||
]) ?>
|
||||
<?= WebUtil::printDist('vue', 'v_history', true) ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user