2021-07-25 14:12:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2021 James Lyne
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-05-27 13:30:56 +00:00
|
|
|
import {State} from "@/store";
|
2021-07-24 01:27:25 +00:00
|
|
|
import {DynmapUrlConfig} from "@/dynmap";
|
2021-07-23 19:32:15 +00:00
|
|
|
import LiveAtlasMapDefinition from "@/model/LiveAtlasMapDefinition";
|
2021-07-24 03:06:19 +00:00
|
|
|
import {PathOptions, PointTuple, PolylineOptions} from "leaflet";
|
2021-07-25 13:53:45 +00:00
|
|
|
import {CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
|
|
|
|
import {ClockControlOptions} from "@/leaflet/control/ClockControl";
|
|
|
|
import {LogoControlOptions} from "@/leaflet/control/LogoControl";
|
2021-05-15 19:25:03 +00:00
|
|
|
|
|
|
|
declare module "*.png" {
|
|
|
|
const value: any;
|
|
|
|
export = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
declare module '*.vue' {
|
2021-07-19 15:40:30 +00:00
|
|
|
import type {DefineComponent} from 'vue'
|
|
|
|
const component: DefineComponent<{}, {}, any>
|
2021-05-15 19:25:03 +00:00
|
|
|
export default component
|
2020-12-20 16:01:15 +00:00
|
|
|
}
|
|
|
|
|
2021-07-20 20:12:08 +00:00
|
|
|
declare global {
|
|
|
|
// noinspection JSUnusedGlobalSymbols
|
|
|
|
interface Window {
|
|
|
|
liveAtlasConfig: LiveAtlasGlobalConfig,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-19 15:40:30 +00:00
|
|
|
interface Coordinate {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
z: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasLocation {
|
|
|
|
x: number;
|
|
|
|
y: number;
|
|
|
|
z: number;
|
|
|
|
world?: string;
|
|
|
|
}
|
|
|
|
|
2021-07-20 20:12:08 +00:00
|
|
|
interface LiveAtlasGlobalConfig {
|
|
|
|
servers: Map<string, LiveAtlasServerDefinition>;
|
|
|
|
messages: LiveAtlasGlobalMessageConfig;
|
|
|
|
ui: LiveAtlasUIConfig;
|
|
|
|
}
|
|
|
|
|
2021-05-18 15:48:56 +00:00
|
|
|
interface LiveAtlasServerDefinition {
|
2021-07-25 01:02:42 +00:00
|
|
|
id: string;
|
|
|
|
label?: string;
|
|
|
|
type: 'dynmap'
|
|
|
|
dynmap: DynmapUrlConfig;
|
2021-05-20 15:13:25 +00:00
|
|
|
}
|
|
|
|
|
2021-07-20 20:12:08 +00:00
|
|
|
// Messages defined directly in LiveAtlas and used for all servers
|
|
|
|
interface LiveAtlasGlobalMessageConfig {
|
2021-05-20 15:13:25 +00:00
|
|
|
chatNoMessages: string;
|
2021-05-20 15:39:41 +00:00
|
|
|
chatTitle: string;
|
2021-05-20 15:13:25 +00:00
|
|
|
chatLogin: string;
|
|
|
|
chatLoginLink: string;
|
|
|
|
chatSend: string;
|
2021-05-20 15:39:41 +00:00
|
|
|
chatPlaceholder: string;
|
2021-05-20 15:13:25 +00:00
|
|
|
chatErrorDisabled: string;
|
|
|
|
chatErrorUnknown: string;
|
2021-05-20 15:39:41 +00:00
|
|
|
serversHeading: string;
|
|
|
|
worldsSkeleton: string;
|
|
|
|
playersSkeleton: string;
|
|
|
|
playersTitle: string;
|
|
|
|
playersTitleHidden: string;
|
|
|
|
playersTitleOtherWorld: string;
|
2021-07-21 15:19:18 +00:00
|
|
|
playersSearchPlaceholder: string;
|
|
|
|
playersSearchSkeleton: string;
|
2021-05-20 15:39:41 +00:00
|
|
|
followingHeading: string;
|
|
|
|
followingUnfollow: string;
|
|
|
|
followingTitleUnfollow: string;
|
|
|
|
followingHidden: string;
|
|
|
|
linkTitle: string;
|
|
|
|
loadingTitle: string;
|
|
|
|
locationRegion: string;
|
|
|
|
locationChunk: string;
|
2021-05-24 17:23:35 +00:00
|
|
|
contextMenuCopyLink: string;
|
|
|
|
contextMenuCenterHere: string;
|
2021-05-25 18:26:14 +00:00
|
|
|
toggleTitle: string;
|
2021-05-26 20:13:54 +00:00
|
|
|
mapTitle: string;
|
2021-05-28 20:28:21 +00:00
|
|
|
layersTitle: string;
|
2021-05-28 23:38:29 +00:00
|
|
|
copyToClipboardSuccess: string;
|
|
|
|
copyToClipboardError: string;
|
2021-05-25 18:26:14 +00:00
|
|
|
}
|
|
|
|
|
2021-07-20 20:12:08 +00:00
|
|
|
// Messages defined by dynmap configuration responses and can vary per server
|
|
|
|
interface LiveAtlasServerMessageConfig {
|
|
|
|
chatPlayerJoin: string;
|
|
|
|
chatPlayerQuit: string;
|
|
|
|
chatAnonymousJoin: string;
|
|
|
|
chatAnonymousQuit: string;
|
|
|
|
chatErrorNotAllowed: string;
|
|
|
|
chatErrorRequiresLogin: string;
|
|
|
|
chatErrorCooldown: string;
|
|
|
|
worldsHeading: string;
|
|
|
|
playersHeading: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
type LiveAtlasMessageConfig = LiveAtlasGlobalMessageConfig & LiveAtlasServerMessageConfig;
|
|
|
|
|
|
|
|
interface LiveAtlasUIConfig {
|
|
|
|
playersAboveMarkers: boolean;
|
2021-07-21 15:19:18 +00:00
|
|
|
playersSearch: boolean;
|
2021-07-20 20:12:08 +00:00
|
|
|
}
|
|
|
|
|
2021-05-28 18:14:06 +00:00
|
|
|
export type LiveAtlasUIElement = 'layers' | 'chat' | 'players' | 'maps' | 'settings';
|
2021-06-23 16:40:56 +00:00
|
|
|
export type LiveAtlasSidebarSection = 'servers' | 'players' | 'maps';
|
2021-07-21 16:27:24 +00:00
|
|
|
export type LiveAtlasDimension = 'overworld' | 'nether' | 'end';
|
2021-06-23 16:40:56 +00:00
|
|
|
|
2021-07-24 01:27:25 +00:00
|
|
|
interface LiveAtlasPlayer {
|
|
|
|
name: string;
|
|
|
|
displayName: string;
|
|
|
|
uuid?: string;
|
|
|
|
armor: number;
|
|
|
|
health: number;
|
|
|
|
sort: number;
|
|
|
|
hidden: boolean;
|
|
|
|
location: LiveAtlasLocation;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasSortedPlayers extends Array<LiveAtlasPlayer> {
|
2021-06-23 16:40:56 +00:00
|
|
|
dirty?: boolean;
|
|
|
|
}
|
2021-07-19 15:40:30 +00:00
|
|
|
|
2021-07-23 19:32:15 +00:00
|
|
|
interface LiveAtlasWorldDefinition {
|
2021-07-19 15:40:30 +00:00
|
|
|
seaLevel: number;
|
|
|
|
name: string;
|
2021-07-24 19:12:18 +00:00
|
|
|
displayName: string;
|
2021-07-21 16:27:24 +00:00
|
|
|
dimension: LiveAtlasDimension;
|
2021-07-19 15:40:30 +00:00
|
|
|
protected: boolean;
|
|
|
|
height: number;
|
|
|
|
center: Coordinate;
|
2021-07-23 19:32:15 +00:00
|
|
|
maps: Map<string, LiveAtlasMapDefinition>;
|
2021-07-19 15:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasWorldState {
|
|
|
|
raining: boolean;
|
|
|
|
thundering: boolean;
|
|
|
|
timeOfDay: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasParsedUrl {
|
|
|
|
world?: string;
|
|
|
|
map?: string;
|
|
|
|
location?: Coordinate;
|
|
|
|
zoom?: number;
|
|
|
|
legacy: boolean;
|
|
|
|
}
|
2021-07-24 00:15:52 +00:00
|
|
|
|
|
|
|
interface LiveAtlasMapProvider {
|
|
|
|
loadServerConfiguration(): Promise<void>;
|
2021-07-25 00:57:59 +00:00
|
|
|
populateWorld(world: LiveAtlasWorldDefinition): Promise<void>;
|
2021-07-24 00:15:52 +00:00
|
|
|
startUpdates(): void;
|
|
|
|
stopUpdates(): void;
|
|
|
|
sendChatMessage(message: string): void;
|
|
|
|
destroy(): void;
|
2021-07-25 00:57:59 +00:00
|
|
|
|
|
|
|
getPlayerHeadUrl(entry: HeadQueueEntry): string;
|
|
|
|
getTilesUrl(): string;
|
|
|
|
getMarkerIconUrl(icon: string): string;
|
2021-07-24 00:15:52 +00:00
|
|
|
}
|
2021-07-24 03:06:19 +00:00
|
|
|
|
|
|
|
interface LiveAtlasMarkerSet {
|
|
|
|
id: string,
|
|
|
|
label: string;
|
|
|
|
hidden: boolean;
|
|
|
|
priority: number;
|
|
|
|
minZoom?: number;
|
|
|
|
maxZoom?: number;
|
|
|
|
showLabels?: boolean;
|
|
|
|
markers: Map<string, LiveAtlasMarker>;
|
|
|
|
areas: Map<string, LiveAtlasArea>;
|
|
|
|
lines: Map<string, LiveAtlasLine>;
|
|
|
|
circles: Map<string, LiveAtlasCircle>;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasMarker {
|
|
|
|
dimensions: PointTuple;
|
|
|
|
icon: string;
|
|
|
|
label: string;
|
|
|
|
isHTML: boolean;
|
|
|
|
location: Coordinate;
|
|
|
|
minZoom?: number;
|
|
|
|
maxZoom?: number;
|
|
|
|
popupContent?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasArea {
|
|
|
|
style: PolylineOptions;
|
|
|
|
label: string;
|
|
|
|
isHTML: boolean;
|
|
|
|
x: Array<number>;
|
|
|
|
y: PointTuple;
|
|
|
|
z: Array<number>;
|
|
|
|
minZoom?: number;
|
|
|
|
maxZoom?: number;
|
|
|
|
popupContent?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasLine {
|
|
|
|
x: Array<number>;
|
|
|
|
y: Array<number>;
|
|
|
|
z: Array<number>;
|
|
|
|
style: PolylineOptions;
|
|
|
|
label: string;
|
|
|
|
isHTML: boolean;
|
|
|
|
minZoom?: number;
|
|
|
|
maxZoom?: number;
|
|
|
|
popupContent?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasCircle {
|
|
|
|
location: Coordinate;
|
|
|
|
radius: PointTuple;
|
|
|
|
style: PathOptions;
|
|
|
|
label: string;
|
|
|
|
isHTML: boolean;
|
|
|
|
minZoom?: number;
|
|
|
|
maxZoom?: number;
|
|
|
|
popupContent?: string;
|
|
|
|
}
|
2021-07-25 00:57:59 +00:00
|
|
|
|
|
|
|
interface HeadQueueEntry {
|
|
|
|
cacheKey: string;
|
|
|
|
name: string;
|
|
|
|
uuid?: string;
|
|
|
|
size: string;
|
|
|
|
image: HTMLImageElement;
|
|
|
|
}
|
2021-07-25 13:53:45 +00:00
|
|
|
|
|
|
|
interface LiveAtlasServerConfig {
|
|
|
|
defaultMap?: string;
|
|
|
|
defaultWorld?: string;
|
|
|
|
defaultZoom: number;
|
|
|
|
followMap?: string;
|
|
|
|
followZoom: number;
|
|
|
|
title: string;
|
|
|
|
maxPlayers: number;
|
|
|
|
grayHiddenPlayers: boolean;
|
|
|
|
expandUI: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasComponentConfig {
|
|
|
|
markers: {
|
|
|
|
showLabels: boolean;
|
|
|
|
};
|
|
|
|
playerMarkers?: LiveAtlasPlayerMarkerConfig;
|
|
|
|
coordinatesControl?: CoordinatesControlOptions;
|
|
|
|
clockControl?: ClockControlOptions;
|
|
|
|
linkControl: boolean;
|
|
|
|
layerControl: boolean;
|
|
|
|
logoControls: Array<LogoControlOptions>;
|
|
|
|
chatBox?: LiveAtlasChatBoxConfig;
|
|
|
|
chatSending?: LiveAtlasChatSendingConfig;
|
|
|
|
chatBalloons: boolean;
|
|
|
|
login: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasPlayerMarkerConfig {
|
|
|
|
hideByDefault: boolean;
|
|
|
|
layerName: string;
|
|
|
|
layerPriority: number;
|
|
|
|
showBodies: boolean;
|
|
|
|
showSkinFaces: boolean;
|
|
|
|
showHealth: boolean;
|
|
|
|
smallFaces: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasChatBoxConfig {
|
|
|
|
allowUrlName: boolean;
|
|
|
|
showPlayerFaces: boolean;
|
|
|
|
messageLifetime: number;
|
|
|
|
messageHistory: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasChatSendingConfig {
|
|
|
|
loginRequired: boolean;
|
|
|
|
maxLength: number;
|
|
|
|
cooldown: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface LiveAtlasChat {
|
|
|
|
type: 'chat' | 'playerjoin' | 'playerleave';
|
|
|
|
playerAccount?: string;
|
|
|
|
playerName?: string;
|
|
|
|
channel?: string;
|
|
|
|
message?: string;
|
|
|
|
source?: string;
|
|
|
|
timestamp: number;
|
|
|
|
}
|