Fist Push
This commit is contained in:
parent
dd63653413
commit
cab9de1e90
118 changed files with 364726 additions and 0 deletions
21
public/scripts/overlays/overlaysNpc.js
Normal file
21
public/scripts/overlays/overlaysNpc.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import customIcons from '../modules/iconsMap.js';
|
||||
|
||||
export default async function getOverlayNpc() {
|
||||
const url = `/npcloc`;
|
||||
try {
|
||||
var markers = L.markerClusterGroup({
|
||||
chunkedLoading: true,
|
||||
disableClusteringAtZoom: 8,
|
||||
});
|
||||
const layerNpc = L.layerGroup();
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
let npcLoc = [];
|
||||
data.forEach((npc) => {
|
||||
markers.addLayer(L.marker([npc.locy, npc.locx], { icon: customIcons.yellowNpc }).bindPopup(npc.literalValue));
|
||||
});
|
||||
return markers;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching ${url} data:`, error);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue