feat: MapViewer와 API의 버전이 같을 때에만 지도 출력
This commit is contained in:
+9
-8
@@ -35,7 +35,7 @@ function getHistoryMap($year, $month, ?string $serverID=null){
|
|||||||
|
|
||||||
$map = DB::db()->queryFirstField('SELECT map FROM ng_history WHERE server_id = %s AND year=%i and month=%i',
|
$map = DB::db()->queryFirstField('SELECT map FROM ng_history WHERE server_id = %s AND year=%i and month=%i',
|
||||||
$serverID,
|
$serverID,
|
||||||
$year,
|
$year,
|
||||||
$month);
|
$month);
|
||||||
|
|
||||||
if(!$map){
|
if(!$map){
|
||||||
@@ -53,7 +53,7 @@ function getWorldMap($req){
|
|||||||
if(is_array($req)){
|
if(is_array($req)){
|
||||||
$req = new MapRequest($req);
|
$req = new MapRequest($req);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($req->year && $req->month){
|
if($req->year && $req->month){
|
||||||
return getHistoryMap($req->year, $req->month, $req->serverID??null);
|
return getHistoryMap($req->year, $req->month, $req->serverID??null);
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ function getWorldMap($req){
|
|||||||
$spyInfo = (object)null;
|
$spyInfo = (object)null;
|
||||||
|
|
||||||
if($myNation){
|
if($myNation){
|
||||||
$rawSpy = $db->queryFirstField('select `spy` from `nation` where `nation`=%i',
|
$rawSpy = $db->queryFirstField('select `spy` from `nation` where `nation`=%i',
|
||||||
$myNation);
|
$myNation);
|
||||||
|
|
||||||
if(strpos($rawSpy, '|') !== false || is_numeric($rawSpy)){
|
if(strpos($rawSpy, '|') !== false || is_numeric($rawSpy)){
|
||||||
@@ -123,16 +123,16 @@ function getWorldMap($req){
|
|||||||
$nationList = [];
|
$nationList = [];
|
||||||
foreach($db->query('select `nation`, `name`, `color`, `capital` from `nation`') as $row){
|
foreach($db->query('select `nation`, `name`, `color`, `capital` from `nation`') as $row){
|
||||||
$nationList[] = [
|
$nationList[] = [
|
||||||
Util::toInt($row['nation']),
|
Util::toInt($row['nation']),
|
||||||
$row['name'],
|
$row['name'],
|
||||||
$row['color'],
|
$row['color'],
|
||||||
Util::toInt($row['capital'])
|
Util::toInt($row['capital'])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($myNation){
|
if($myNation){
|
||||||
//굳이 타국 도시에 있는 아국 장수 리스트를 뽑을 이유가 없음. 일단 다 뽑자.
|
//굳이 타국 도시에 있는 아국 장수 리스트를 뽑을 이유가 없음. 일단 다 뽑자.
|
||||||
$shownByGeneralList =
|
$shownByGeneralList =
|
||||||
array_map('\\sammo\\Util::toInt',
|
array_map('\\sammo\\Util::toInt',
|
||||||
$db->queryFirstColumn('select distinct `city` from `general` where `nation` = %i',
|
$db->queryFirstColumn('select distinct `city` from `general` where `nation` = %i',
|
||||||
$myNation));
|
$myNation));
|
||||||
@@ -143,7 +143,7 @@ function getWorldMap($req){
|
|||||||
|
|
||||||
$cityList = [];
|
$cityList = [];
|
||||||
foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){
|
foreach($db->query('select `city`, `level`, `state`, `nation`, `region`, `supply` from `city`') as $r){
|
||||||
$cityList[] =
|
$cityList[] =
|
||||||
array_map('\\sammo\\Util::toInt', [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]);
|
array_map('\\sammo\\Util::toInt', [$r['city'], $r['level'], $r['state'], $r['nation'], $r['region'], $r['supply']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,6 +164,7 @@ function getWorldMap($req){
|
|||||||
'shownByGeneralList' => $shownByGeneralList,
|
'shownByGeneralList' => $shownByGeneralList,
|
||||||
'myCity' => $myCity,
|
'myCity' => $myCity,
|
||||||
'myNation' => $myNation,
|
'myNation' => $myNation,
|
||||||
|
'version' => 0,
|
||||||
'result' => true
|
'result' => true
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
|
v-if="(modelValue.version ?? 0) == CURRENT_MAP_VERSION"
|
||||||
:id="uuid"
|
:id="uuid"
|
||||||
:class="[
|
:class="[
|
||||||
'world_map',
|
'world_map',
|
||||||
@@ -99,6 +100,13 @@
|
|||||||
<div class="nation_name">{{ activatedCity?.nation }}</div>
|
<div class="nation_name">{{ activatedCity?.nation }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="world_map">
|
||||||
|
<span class="map_title_text">
|
||||||
|
맵 버전이 맞지 않습니다.<br />
|
||||||
|
렌더러 버전: {{ CURRENT_MAP_VERSION }}<br />
|
||||||
|
API 버전: {{ modelValue.version ?? 0 }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
@@ -156,7 +164,7 @@ export type CityPositionMap = {
|
|||||||
import "@/../scss/map.scss";
|
import "@/../scss/map.scss";
|
||||||
import { type PropType, toRef, inject, type Ref, ref, watch, type ComponentPublicInstance } from "vue";
|
import { type PropType, toRef, inject, type Ref, ref, watch, type ComponentPublicInstance } from "vue";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import type { MapResult } from "@/defs";
|
import { CURRENT_MAP_VERSION, type MapResult } from "@/defs";
|
||||||
import { joinYearMonth } from "@/util/joinYearMonth";
|
import { joinYearMonth } from "@/util/joinYearMonth";
|
||||||
import { parseYearMonth } from "@/util/parseYearMonth";
|
import { parseYearMonth } from "@/util/parseYearMonth";
|
||||||
import vMyTooltip from "@/directives/vMyTooltip";
|
import vMyTooltip from "@/directives/vMyTooltip";
|
||||||
|
|||||||
@@ -230,11 +230,14 @@ export const diplomacyStateInfo: Record<diplomacyState, diplomacyInfo> = {
|
|||||||
7: { name: '불가침', color: 'green' },
|
7: { name: '불가침', color: 'green' },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CURRENT_MAP_VERSION = 0 as const;
|
||||||
|
|
||||||
//Map
|
//Map
|
||||||
type MapCityCompact = [number, number, number, number, number, number];
|
type MapCityCompact = [number, number, number, number, number, number];
|
||||||
type MapNationCompact = [number, string, string, number];
|
type MapNationCompact = [number, string, string, number];
|
||||||
export type MapResult = {
|
export type MapResult = {
|
||||||
result: true,
|
result: true,
|
||||||
|
version?: typeof CURRENT_MAP_VERSION,
|
||||||
startYear: number,
|
startYear: number,
|
||||||
year: number,
|
year: number,
|
||||||
month: number,
|
month: number,
|
||||||
|
|||||||
Reference in New Issue
Block a user