LiveAtlas/src/dynmap.d.ts

253 lines
4.9 KiB
TypeScript
Raw Normal View History

import {PathOptions, PointTuple, PolylineOptions} from "leaflet";
2020-12-01 23:20:38 +00:00
import {CoordinatesControlOptions} from "@/leaflet/control/CoordinatesControl";
import {LogoControlOptions} from "@/leaflet/control/LogoControl";
import {ClockControlOptions} from "@/leaflet/control/ClockControl";
2020-11-23 12:13:28 +00:00
declare global {
interface Window {
2020-12-01 23:20:38 +00:00
config: DynmapConfig;
hideSplash: Function;
2020-11-23 12:13:28 +00:00
}
}
type DynmapConfig = {
url: DynmapUrlConfig;
};
type DynmapUrlConfig = {
configuration: string;
update: string;
sendmessage: string;
login: string;
register: string;
tiles: string;
markers: string;
}
interface DynmapServerConfig {
version: string;
allowChat: boolean;
chatRequiresLogin: boolean;
chatInterval: number;
defaultMap?: string;
defaultWorld?: string;
2020-12-01 23:20:38 +00:00
defaultZoom: number;
2020-11-23 12:13:28 +00:00
followMap?: string;
2020-12-01 23:20:38 +00:00
followZoom: number;
2020-11-23 12:13:28 +00:00
updateInterval: number;
showLayerControl: boolean;
title: string;
loginEnabled: boolean;
loginRequired: boolean;
maxPlayers: number;
hash: number;
}
interface DynmapMessageConfig {
chatNotAllowed: string;
chatRequiresLogin: string;
chatCooldown: string;
mapTypes: string;
players: string;
playerJoin: string;
playerQuit: string;
anonymousJoin: string;
anonymousQuit: string;
}
interface DynmapComponentConfig {
2020-12-01 23:20:38 +00:00
markers: DynmapMarkersConfig;
playerMarkers?: DynmapPlayerMarkersConfig;
2020-12-01 23:20:38 +00:00
coordinatesControl?: CoordinatesControlOptions;
clockControl ?: ClockControlOptions;
linkControl: boolean;
logoControls: Array<LogoControlOptions>;
}
interface DynmapMarkersConfig {
showLabels: boolean
}
interface DynmapPlayerMarkersConfig {
hideByDefault: boolean;
layerName: string;
layerPriority: number;
showBodies: boolean;
showSkinFaces: boolean;
showHealth: boolean;
smallFaces: boolean;
}
2020-11-23 12:13:28 +00:00
interface DynmapWorld {
seaLevel: number;
name: string;
protected: boolean;
title: string;
height: number;
center: Coordinate;
2020-12-11 21:38:50 +00:00
maps: Map<String, DynmapWorldMap>;
2020-11-23 12:13:28 +00:00
}
2020-12-11 21:38:50 +00:00
interface DynmapWorldMap {
world: DynmapWorld;
2020-11-23 12:13:28 +00:00
background: string;
backgroundDay: string;
backgroundNight: string;
compassView: string;
icon: string;
imageFormat: string;
name: string;
nightAndDay: boolean;
prefix: string;
protected: boolean;
title: string;
type: string;
mapToWorld: [number, number, number, number, number, number, number, number, number];
worldToMap: [number, number, number, number, number, number, number, number, number];
nativeZoomLevels: number;
extraZoomLevels: number;
}
2020-12-01 23:20:38 +00:00
interface DynmapWorldState {
raining: boolean;
thundering: boolean;
timeOfDay: number;
}
2020-11-23 12:13:28 +00:00
interface Coordinate {
x: number;
y: number;
z: number;
}
interface DynmapLocation {
x: number;
y: number;
z: number;
world?: string;
}
interface DynmapConfigurationResponse {
config: DynmapServerConfig,
messages: DynmapMessageConfig,
worlds: Array<DynmapWorld>,
components: DynmapComponentConfig,
2020-11-23 12:13:28 +00:00
}
interface DynmapUpdateResponse {
2020-12-01 23:20:38 +00:00
worldState: DynmapWorldState;
2020-11-23 12:13:28 +00:00
configHash: number;
playerCount: number;
2020-12-01 23:20:38 +00:00
players: Set<DynmapPlayer>;
updates: DynmapUpdates;
2020-11-23 12:13:28 +00:00
timestamp: number;
}
interface DynmapPlayer {
account: string
armor: number
health: number
name: string
sort: number
location: DynmapLocation;
}
2020-12-01 23:20:38 +00:00
interface DynmapMarkerSet {
id: string,
2020-12-01 23:20:38 +00:00
label: string;
hidden: boolean;
priority: number;
minZoom?: number;
maxZoom?: number;
showLabels?: boolean;
markers: Map<string, DynmapMarker>;
areas: Map<string, DynmapArea>;
lines: Map<string, DynmapLine>;
circles: Map<string, DynmapCircle>;
}
2020-11-23 12:13:28 +00:00
2020-12-01 23:20:38 +00:00
interface DynmapMarker {
dimensions: PointTuple;
icon: string;
label: string;
isHTML: boolean;
location: Coordinate;
minZoom?: number;
maxZoom?: number;
popupContent?: string;
}
interface DynmapArea {
style: PolylineOptions;
label: string;
isHTML: boolean;
x: Array<number>;
y: PointTuple;
z: Array<number>;
minZoom?: number;
maxZoom?: number;
popupContent?: string;
}
interface DynmapLine {
x: Array<number>;
y: Array<number>;
z: Array<number>;
style: PolylineOptions;
label: string;
isHTML: boolean;
minZoom?: number;
maxZoom?: number;
popupContent?: string;
}
interface DynmapCircle {
location: Coordinate;
radius: PointTuple;
2020-12-10 02:23:22 +00:00
style: PathOptions;
2020-12-01 23:20:38 +00:00
label: string;
isHTML: boolean;
minZoom?: number;
maxZoom?: number;
popupContent?: string;
}
interface DynmapUpdates {
markerSets: Map<string, DynmapMarkerSetUpdates>,
tiles: Array<DynmapTileUpdate>,
chat: Array<any> //TODO
}
interface DynmapMarkerSetUpdates {
markerUpdates: Array<DynmapMarkerUpdate>
areaUpdates: Array<DynmapAreaUpdate>
circleUpdates: Array<DynmapCircleUpdate>
lineUpdates: Array<DynmapLineUpdate>
}
interface DynmapUpdate {
id: string,
removed: boolean,
payload?: any,
}
interface DynmapMarkerUpdate extends DynmapUpdate {
payload?: DynmapMarker
}
interface DynmapAreaUpdate extends DynmapUpdate {
payload?: DynmapArea
}
interface DynmapCircleUpdate extends DynmapUpdate {
payload?: DynmapCircle
}
interface DynmapLineUpdate extends DynmapUpdate {
payload?: DynmapLine
}
interface DynmapTileUpdate {
name: string
timestamp: number
}