LiveAtlas/src/dynmap.d.ts

213 lines
4.1 KiB
TypeScript
Raw Normal View History

2020-12-01 23:20:38 +00:00
import {CircleMarkerOptions, PathOptions, PointTuple, PolylineOptions} from "leaflet";
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-01 23:20:38 +00:00
maps: Map<String, DynmapMap>;
2020-11-23 12:13:28 +00:00
}
interface DynmapMap {
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>;
2020-11-23 12:13:28 +00:00
timestamp: number;
//TODO: Tiles etc
}
interface DynmapPlayer {
account: string
armor: number
health: number
name: string
sort: number
location: DynmapLocation;
}
2020-12-01 23:20:38 +00:00
interface DynmapMarkerSet {
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;
style: CircleMarkerOptions;
label: string;
isHTML: boolean;
minZoom?: number;
maxZoom?: number;
popupContent?: string;
}