Merge branch 'master' into feat-jar-plugin
This commit is contained in:
commit
47492949e9
618
package-lock.json
generated
618
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -19,23 +19,24 @@
|
||||
"@soerenmartius/vue3-clipboard": "^0.1",
|
||||
"leaflet": "git+https://github.com/JLyne/leaflet.git",
|
||||
"modern-normalize": "^1.1.0",
|
||||
"vue": "^3.2.20",
|
||||
"vue": "^3.2.21",
|
||||
"vuex": "^4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/dynmap": "^3.1.1",
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/jest-in-case": "^1.0.5",
|
||||
"@types/leaflet": "1.7.5",
|
||||
"@types/node": "^16.11.6",
|
||||
"@types/node": "^16.11.7",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3",
|
||||
"@typescript-eslint/parser": "^5.3",
|
||||
"@vitejs/plugin-vue": "^1.9",
|
||||
"@vue/compiler-sfc": "^3.2.18",
|
||||
"@vue/compiler-sfc": "^3.2.21",
|
||||
"@vue/eslint-config-typescript": "^9.0",
|
||||
"@vue/test-utils": "^2.0.0-rc.16",
|
||||
"@vue/vue3-jest": "^27.0.0-alpha.1",
|
||||
"cpy-cli": "^3.1.1",
|
||||
"eslint": "^8.1",
|
||||
"eslint": "^8.2",
|
||||
"eslint-plugin-vue": "^8.0",
|
||||
"jest": "^27.3.1",
|
||||
"jest-in-case": "^1.0.2",
|
||||
@ -49,7 +50,7 @@
|
||||
"typescript": "^4.4",
|
||||
"vite": "^2.6.10",
|
||||
"vite-plugin-svg-sprite-component": "^1.0",
|
||||
"vue-tsc": "0.28.7"
|
||||
"vue-tsc": "0.29.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
|
@ -17,6 +17,7 @@
|
||||
<template>
|
||||
<li :class="`message message--${message.type}`">
|
||||
<img v-if="showFace" width="16" height="16" class="message__face" :src="image" alt="" />
|
||||
<span v-if="messageChannel" class="message__channel" v-html="messageChannel"></span>
|
||||
<span v-if="showSender" class="message__sender" v-html="message.playerName"></span>
|
||||
<span class="message__content" v-html="messageContent"></span>
|
||||
</li>
|
||||
@ -41,6 +42,7 @@
|
||||
let image = ref(defaultImage),
|
||||
showFace = computed(() => store.state.components.chatBox?.showPlayerFaces && props.message.playerAccount),
|
||||
showSender = computed(() => props.message.playerName && props.message.type === 'chat'),
|
||||
messageChannel = computed(() => props.message.type === 'chat' ? props.message.channel : undefined),
|
||||
messageContent = computed(() => {
|
||||
switch(props.message.type) {
|
||||
case 'chat':
|
||||
@ -73,6 +75,7 @@
|
||||
image,
|
||||
showFace,
|
||||
showSender,
|
||||
messageChannel,
|
||||
messageContent
|
||||
}
|
||||
}
|
||||
@ -87,10 +90,23 @@
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
.message__channel,
|
||||
.message__sender {
|
||||
margin-right: 0.5rem;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.message__channel {
|
||||
&:not(:empty):before {
|
||||
content: '[';
|
||||
}
|
||||
|
||||
&:not(:empty):after {
|
||||
content: ']';
|
||||
}
|
||||
}
|
||||
|
||||
.message__sender {
|
||||
&:not(:empty):after {
|
||||
content: ': ';
|
||||
}
|
||||
|
@ -25,18 +25,7 @@ import {computed, watch} from "@vue/runtime-core";
|
||||
import {ComputedRef} from "@vue/reactivity";
|
||||
import {WatchStopHandle} from "vue";
|
||||
import {ActionTypes} from "@/store/action-types";
|
||||
|
||||
export interface TileInfo {
|
||||
prefix: string;
|
||||
nightday: string;
|
||||
scaledx: number;
|
||||
scaledy: number;
|
||||
zoom: string;
|
||||
zoomprefix: string;
|
||||
x: number;
|
||||
y: number;
|
||||
fmt: string;
|
||||
}
|
||||
import {TileInformation} from "dynmap";
|
||||
|
||||
const store = useStore();
|
||||
|
||||
@ -160,7 +149,7 @@ export class DynmapTileLayer extends LiveAtlasTileLayer {
|
||||
return 'z'.repeat(amount) + (amount === 0 ? '' : '_');
|
||||
}
|
||||
|
||||
private getTileInfo(coords: Coordinate): TileInfo {
|
||||
private getTileInfo(coords: Coordinate): TileInformation {
|
||||
// zoom: max zoomed in = this.options.maxZoom, max zoomed out = 0
|
||||
// izoom: max zoomed in = 0, max zoomed out = this.options.maxZoom
|
||||
// zoomoutlevel: izoom < mapzoomin -> 0, else -> izoom - mapzoomin (which ranges from 0 till mapzoomout)
|
||||
|
@ -17,6 +17,7 @@
|
||||
import {Coordinate, LiveAtlasWorldDefinition} from "@/index";
|
||||
import {LatLng} from "leaflet";
|
||||
import {LiveAtlasProjection} from "@/model/LiveAtlasProjection";
|
||||
import {ImageFormat} from "dynmap";
|
||||
|
||||
export interface LiveAtlasMapDefinitionOptions {
|
||||
world: LiveAtlasWorldDefinition;
|
||||
@ -27,7 +28,7 @@ export interface LiveAtlasMapDefinitionOptions {
|
||||
nightAndDay?: boolean;
|
||||
backgroundDay?: string;
|
||||
backgroundNight?: string;
|
||||
imageFormat: string;
|
||||
imageFormat: ImageFormat;
|
||||
prefix?: string;
|
||||
mapToWorld?: [number, number, number, number, number, number, number, number, number];
|
||||
worldToMap?: [number, number, number, number, number, number, number, number, number];
|
||||
@ -45,7 +46,7 @@ export default class LiveAtlasMapDefinition {
|
||||
readonly nightAndDay: boolean;
|
||||
readonly backgroundDay?: string;
|
||||
readonly backgroundNight?: string;
|
||||
readonly imageFormat: string;
|
||||
readonly imageFormat: ImageFormat;
|
||||
readonly prefix: string;
|
||||
private readonly projection?: Readonly<LiveAtlasProjection>;
|
||||
readonly nativeZoomLevels: number;
|
||||
|
@ -35,6 +35,7 @@ import {
|
||||
buildServerConfig, buildUpdates, buildWorlds
|
||||
} from "@/util/dynmap";
|
||||
import {getImagePixelSize} from "@/util";
|
||||
import {MarkerSet} from "dynmap";
|
||||
|
||||
export default class DynmapMapProvider extends MapProvider {
|
||||
private configurationAbort?: AbortController = undefined;
|
||||
@ -69,7 +70,7 @@ export default class DynmapMapProvider extends MapProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
const set = response.sets[key],
|
||||
const set: MarkerSet = response.sets[key],
|
||||
markers = buildMarkers(set.markers || {}),
|
||||
circles = buildCircles(set.circles || {}),
|
||||
areas = buildAreas(set.areas || {}),
|
||||
|
@ -208,5 +208,5 @@ const decodeTextarea = document.createElement('textarea');
|
||||
|
||||
export const decodeHTMLEntities = (text: string) => {
|
||||
decodeTextarea.innerHTML = text;
|
||||
return decodeTextarea.textContent;
|
||||
return decodeTextarea.textContent || '';
|
||||
}
|
||||
|
@ -31,20 +31,36 @@ import {getPoints} from "@/util/areas";
|
||||
import {decodeHTMLEntities, endWorldNameRegex, netherWorldNameRegex, titleColoursRegex} from "@/util";
|
||||
import {getLinePoints} from "@/util/lines";
|
||||
import LiveAtlasMapDefinition from "@/model/LiveAtlasMapDefinition";
|
||||
import {
|
||||
Configuration,
|
||||
Marker, MarkerArea, MarkerCircle, MarkerLine, MarkerSet,
|
||||
Options,
|
||||
WorldConfiguration,
|
||||
WorldMapConfiguration
|
||||
} from "dynmap";
|
||||
import {PointTuple} from "leaflet";
|
||||
|
||||
export function buildServerConfig(response: Options): LiveAtlasServerConfig {
|
||||
let title = 'Dynmap';
|
||||
|
||||
if(response.title) {
|
||||
title = response.title.replace(titleColoursRegex, '') || title;
|
||||
}
|
||||
|
||||
const followZoom = parseInt(response.followzoom || "", 10);
|
||||
|
||||
export function buildServerConfig(response: any): LiveAtlasServerConfig {
|
||||
return {
|
||||
defaultMap: response.defaultmap || undefined,
|
||||
defaultWorld: response.defaultworld || undefined,
|
||||
defaultZoom: response.defaultzoom || 0,
|
||||
followMap: response.followmap || undefined,
|
||||
followZoom: response.followzoom,
|
||||
title: response.title.replace(titleColoursRegex, '') || 'Dynmap',
|
||||
expandUI: response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason
|
||||
followZoom: isNaN(followZoom) ? undefined : followZoom,
|
||||
title: title,
|
||||
expandUI: !!response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason
|
||||
};
|
||||
}
|
||||
|
||||
export function buildMessagesConfig(response: any): LiveAtlasServerMessageConfig {
|
||||
export function buildMessagesConfig(response: Options): LiveAtlasServerMessageConfig {
|
||||
return {
|
||||
chatPlayerJoin: response.joinmessage || '',
|
||||
chatPlayerQuit: response.quitmessage || '',
|
||||
@ -58,11 +74,11 @@ export function buildMessagesConfig(response: any): LiveAtlasServerMessageConfig
|
||||
}
|
||||
}
|
||||
|
||||
export function buildWorlds(response: any): Array<LiveAtlasWorldDefinition> {
|
||||
export function buildWorlds(response: Configuration): Array<LiveAtlasWorldDefinition> {
|
||||
const worlds: Map<string, LiveAtlasWorldDefinition> = new Map<string, LiveAtlasWorldDefinition>();
|
||||
|
||||
//Get all the worlds first so we can handle append_to_world properly
|
||||
(response.worlds || []).forEach((world: any) => {
|
||||
(response.worlds || []).forEach((world: WorldConfiguration) => {
|
||||
let worldType: LiveAtlasDimension = 'overworld';
|
||||
|
||||
if (netherWorldNameRegex.test(world.name) || (world.name == 'DIM-1')) {
|
||||
@ -85,9 +101,10 @@ export function buildWorlds(response: any): Array<LiveAtlasWorldDefinition> {
|
||||
});
|
||||
});
|
||||
|
||||
(response.worlds || []).forEach((world: any) => {
|
||||
(world.maps || []).forEach((map: any) => {
|
||||
(response.worlds || []).forEach((world: WorldConfiguration) => {
|
||||
(world.maps || []).forEach((map: WorldMapConfiguration) => {
|
||||
const actualWorld = worlds.get(world.name),
|
||||
// @ts-ignore
|
||||
assignedWorldName = map.append_to_world || world.name, //handle append_to_world
|
||||
assignedWorld = worlds.get(assignedWorldName);
|
||||
|
||||
@ -101,7 +118,7 @@ export function buildWorlds(response: any): Array<LiveAtlasWorldDefinition> {
|
||||
background: map.background || '#000000',
|
||||
backgroundDay: map.backgroundday || '#000000',
|
||||
backgroundNight: map.backgroundnight || '#000000',
|
||||
icon: map.icon || undefined,
|
||||
icon: (map.icon || undefined) as string | undefined,
|
||||
imageFormat: map['image-format'] || 'png',
|
||||
name: map.name || '(Unnamed map)',
|
||||
nightAndDay: map.nightandday || false,
|
||||
@ -118,7 +135,7 @@ export function buildWorlds(response: any): Array<LiveAtlasWorldDefinition> {
|
||||
return Array.from(worlds.values());
|
||||
}
|
||||
|
||||
export function buildComponents(response: any): LiveAtlasComponentConfig {
|
||||
export function buildComponents(response: Configuration): LiveAtlasComponentConfig {
|
||||
const components: LiveAtlasComponentConfig = {
|
||||
markers: {
|
||||
showLabels: false,
|
||||
@ -130,7 +147,7 @@ export function buildComponents(response: any): LiveAtlasComponentConfig {
|
||||
showImages: response.showplayerfacesinmenu || false,
|
||||
},
|
||||
coordinatesControl: undefined,
|
||||
layerControl: response.showlayercontrol && response.showlayercontrol !== 'false', //Sent as a string for some reason
|
||||
layerControl: !!response.showlayercontrol && response.showlayercontrol !== 'false', //Sent as a string for some reason
|
||||
linkControl: false,
|
||||
clockControl: undefined,
|
||||
logoControls: [],
|
||||
@ -237,7 +254,7 @@ export function buildComponents(response: any): LiveAtlasComponentConfig {
|
||||
return components;
|
||||
}
|
||||
|
||||
export function buildMarkerSet(id: string, data: any): any {
|
||||
export function buildMarkerSet(id: string, data: MarkerSet): any {
|
||||
return {
|
||||
id,
|
||||
label: data.label || "Unnamed set",
|
||||
@ -263,7 +280,17 @@ export function buildMarkers(data: any): Map<string, LiveAtlasMarker> {
|
||||
return markers;
|
||||
}
|
||||
|
||||
export function buildMarker(data: any): LiveAtlasMarker {
|
||||
export function buildMarker(data: Marker): LiveAtlasMarker {
|
||||
let dimensions;
|
||||
|
||||
if(data.dim) {
|
||||
dimensions = data.dim.split('x').slice(0, 2).map(value => parseInt(value));
|
||||
|
||||
if(dimensions.length !== 2) {
|
||||
dimensions = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const marker = Object.seal({
|
||||
label: data.label || '',
|
||||
isLabelHTML: data.markup || false,
|
||||
@ -272,7 +299,7 @@ export function buildMarker(data: any): LiveAtlasMarker {
|
||||
y: data.y || 0,
|
||||
z: data.z || 0,
|
||||
},
|
||||
dimensions: data.dim ? data.dim.split('x') : [16, 16],
|
||||
dimensions: (dimensions || [16, 16]) as PointTuple,
|
||||
icon: data.icon || "default",
|
||||
minZoom: typeof data.minzoom !== 'undefined' && data.minzoom > -1 ? data.minzoom : undefined,
|
||||
maxZoom: typeof data.maxzoom !== 'undefined' && data.maxzoom > -1 ? data.maxzoom : undefined,
|
||||
@ -301,7 +328,7 @@ export function buildAreas(data: any): Map<string, LiveAtlasArea> {
|
||||
return areas;
|
||||
}
|
||||
|
||||
export function buildArea(area: any): LiveAtlasArea {
|
||||
export function buildArea(area: MarkerArea): LiveAtlasArea {
|
||||
const opacity = area.fillopacity || 0,
|
||||
x = area.x || [0, 0],
|
||||
y: [number, number] = [area.ybottom || 0, area.ytop || 0],
|
||||
@ -339,7 +366,7 @@ export function buildLines(data: any): Map<string, LiveAtlasLine> {
|
||||
return lines;
|
||||
}
|
||||
|
||||
export function buildLine(line: any): LiveAtlasLine {
|
||||
export function buildLine(line: MarkerLine): LiveAtlasLine {
|
||||
return Object.seal({
|
||||
style: {
|
||||
color: line.color || '#ff0000',
|
||||
@ -369,7 +396,7 @@ export function buildCircles(data: any): Map<string, LiveAtlasCircle> {
|
||||
return circles;
|
||||
}
|
||||
|
||||
export function buildCircle(circle: any): LiveAtlasCircle {
|
||||
export function buildCircle(circle: MarkerCircle): LiveAtlasCircle {
|
||||
return Object.seal({
|
||||
location: {
|
||||
x: circle.x || 0,
|
||||
@ -487,7 +514,7 @@ export function buildUpdates(data: Array<any>, lastUpdate: Date) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.source !== 'player' && entry.source !== 'web') {
|
||||
if (entry.source !== 'player' && entry.source !== 'web' && entry.source !== 'plugin') {
|
||||
dropped.notImplemented++;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user