Fist Push

This commit is contained in:
troispoils 2024-05-07 18:01:11 +02:00
parent dd63653413
commit cab9de1e90
118 changed files with 364726 additions and 0 deletions

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

BIN
public/icons/green_star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

BIN
public/icons/red_star.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

17
public/index.html Normal file
View file

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>Map : Asheron's Call 2</title>
<link rel="stylesheet" href="/scripts/dist/leaflet.css" />
<script src="/scripts/dist/leaflet-src.js"></script>
<link rel="stylesheet" href="/scripts/dist/MarkerCluster.css" />
<link rel="stylesheet" href="/scripts/dist/MarkerCluster.Default.css" />
<script src="/scripts/dist/leaflet.markercluster-src.js"></script>
<link rel="stylesheet" href="/style/style.css" />
</head>
<body>
<div id="map"></div>
<script type="module" src="/scripts/main.js"></script>
</body>
</html>

View file

@ -0,0 +1,60 @@
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
background-color: rgba(240, 194, 12, 0.6);
}
.marker-cluster-large {
background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
background-color: rgba(241, 128, 23, 0.6);
}
/* IE 6-8 fallback colors */
.leaflet-oldie .marker-cluster-small {
background-color: rgb(181, 226, 140);
}
.leaflet-oldie .marker-cluster-small div {
background-color: rgb(110, 204, 57);
}
.leaflet-oldie .marker-cluster-medium {
background-color: rgb(241, 211, 87);
}
.leaflet-oldie .marker-cluster-medium div {
background-color: rgb(240, 194, 12);
}
.leaflet-oldie .marker-cluster-large {
background-color: rgb(253, 156, 115);
}
.leaflet-oldie .marker-cluster-large div {
background-color: rgb(241, 128, 23);
}
.marker-cluster {
background-clip: padding-box;
border-radius: 20px;
}
.marker-cluster div {
width: 30px;
height: 30px;
margin-left: 5px;
margin-top: 5px;
text-align: center;
border-radius: 15px;
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.marker-cluster span {
line-height: 30px;
}

14
public/scripts/dist/MarkerCluster.css vendored Normal file
View file

@ -0,0 +1,14 @@
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
}

View file

@ -0,0 +1,5 @@
We don't ship the .js files in the git master branch.
They are only present in version tags and in npm.
See how to get the JS files here: https://github.com/Leaflet/Leaflet.markercluster#using-the-plugin
Or how to build them: https://github.com/Leaflet/Leaflet.markercluster#building-testing-and-linting-scripts

BIN
public/scripts/dist/images/layers-2x.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/scripts/dist/images/layers.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

14419
public/scripts/dist/leaflet-src.esm.js vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

14512
public/scripts/dist/leaflet-src.js vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

661
public/scripts/dist/leaflet.css vendored Normal file
View file

@ -0,0 +1,661 @@
/* required styles */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
position: absolute;
left: 0;
top: 0;
}
.leaflet-container {
overflow: hidden;
}
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
-webkit-user-drag: none;
}
/* Prevents IE11 from highlighting tiles in blue */
.leaflet-tile::selection {
background: transparent;
}
/* Safari renders non-retina tile on retina better with this, but Chrome is worse */
.leaflet-safari .leaflet-tile {
image-rendering: -webkit-optimize-contrast;
}
/* hack that prevents hw layers "stretching" when loading new tiles */
.leaflet-safari .leaflet-tile-container {
width: 1600px;
height: 1600px;
-webkit-transform-origin: 0 0;
}
.leaflet-marker-icon,
.leaflet-marker-shadow {
display: block;
}
/* .leaflet-container svg: reset svg max-width decleration shipped in Joomla! (joomla.org) 3.x */
/* .leaflet-container img: map is broken in FF if you have max-width: 100% on tiles */
.leaflet-container .leaflet-overlay-pane svg {
max-width: none !important;
max-height: none !important;
}
.leaflet-container .leaflet-marker-pane img,
.leaflet-container .leaflet-shadow-pane img,
.leaflet-container .leaflet-tile-pane img,
.leaflet-container img.leaflet-image-layer,
.leaflet-container .leaflet-tile {
max-width: none !important;
max-height: none !important;
width: auto;
padding: 0;
}
.leaflet-container img.leaflet-tile {
/* See: https://bugs.chromium.org/p/chromium/issues/detail?id=600120 */
mix-blend-mode: plus-lighter;
}
.leaflet-container.leaflet-touch-zoom {
-ms-touch-action: pan-x pan-y;
touch-action: pan-x pan-y;
}
.leaflet-container.leaflet-touch-drag {
-ms-touch-action: pinch-zoom;
/* Fallback for FF which doesn't support pinch-zoom */
touch-action: none;
touch-action: pinch-zoom;
}
.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom {
-ms-touch-action: none;
touch-action: none;
}
.leaflet-container {
-webkit-tap-highlight-color: transparent;
}
.leaflet-container a {
-webkit-tap-highlight-color: rgba(51, 181, 229, 0.4);
}
.leaflet-tile {
filter: inherit;
visibility: hidden;
}
.leaflet-tile-loaded {
visibility: inherit;
}
.leaflet-zoom-box {
width: 0;
height: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
z-index: 800;
}
/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */
.leaflet-overlay-pane svg {
-moz-user-select: none;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-vml-shape {
width: 1px;
height: 1px;
}
.lvml {
behavior: url(#default#VML);
display: inline-block;
position: absolute;
}
/* control positioning */
.leaflet-control {
position: relative;
z-index: 800;
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
.leaflet-top,
.leaflet-bottom {
position: absolute;
z-index: 1000;
pointer-events: none;
}
.leaflet-top {
top: 0;
}
.leaflet-right {
right: 0;
}
.leaflet-bottom {
bottom: 0;
}
.leaflet-left {
left: 0;
}
.leaflet-control {
float: left;
clear: both;
}
.leaflet-right .leaflet-control {
float: right;
}
.leaflet-top .leaflet-control {
margin-top: 10px;
}
.leaflet-bottom .leaflet-control {
margin-bottom: 10px;
}
.leaflet-left .leaflet-control {
margin-left: 10px;
}
.leaflet-right .leaflet-control {
margin-right: 10px;
}
/* zoom and fade animations */
.leaflet-fade-anim .leaflet-popup {
opacity: 0;
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.leaflet-fade-anim .leaflet-map-pane .leaflet-popup {
opacity: 1;
}
.leaflet-zoom-animated {
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
}
svg.leaflet-zoom-animated {
will-change: transform;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
-webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1);
-moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1);
transition: transform 0.25s cubic-bezier(0,0,0.25,1);
}
.leaflet-zoom-anim .leaflet-tile,
.leaflet-pan-anim .leaflet-tile {
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
.leaflet-zoom-anim .leaflet-zoom-hide {
visibility: hidden;
}
/* cursors */
.leaflet-interactive {
cursor: pointer;
}
.leaflet-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.leaflet-crosshair,
.leaflet-crosshair .leaflet-interactive {
cursor: crosshair;
}
.leaflet-popup-pane,
.leaflet-control {
cursor: auto;
}
.leaflet-dragging .leaflet-grab,
.leaflet-dragging .leaflet-grab .leaflet-interactive,
.leaflet-dragging .leaflet-marker-draggable {
cursor: move;
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
/* marker & overlays interactivity */
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-image-layer,
.leaflet-pane > svg path,
.leaflet-tile-container {
pointer-events: none;
}
.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane > svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
pointer-events: visiblePainted; /* IE 9-10 doesn't have auto */
pointer-events: auto;
}
/* visual tweaks */
.leaflet-container {
background: #ddd;
outline-offset: 1px;
}
.leaflet-container a {
color: #0078A8;
}
.leaflet-zoom-box {
border: 2px dotted #38f;
background: rgba(255,255,255,0.5);
}
/* general typography */
.leaflet-container {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
font-size: 12px;
font-size: 0.75rem;
line-height: 1.5;
}
/* general toolbar styles */
.leaflet-bar {
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
border-radius: 4px;
}
.leaflet-bar a {
background-color: #fff;
border-bottom: 1px solid #ccc;
width: 26px;
height: 26px;
line-height: 26px;
display: block;
text-align: center;
text-decoration: none;
color: black;
}
.leaflet-bar a,
.leaflet-control-layers-toggle {
background-position: 50% 50%;
background-repeat: no-repeat;
display: block;
}
.leaflet-bar a:hover,
.leaflet-bar a:focus {
background-color: #f4f4f4;
}
.leaflet-bar a:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-bar a:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom: none;
}
.leaflet-bar a.leaflet-disabled {
cursor: default;
background-color: #f4f4f4;
color: #bbb;
}
.leaflet-touch .leaflet-bar a {
width: 30px;
height: 30px;
line-height: 30px;
}
.leaflet-touch .leaflet-bar a:first-child {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
.leaflet-touch .leaflet-bar a:last-child {
border-bottom-left-radius: 2px;
border-bottom-right-radius: 2px;
}
/* zoom control */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
font: bold 18px 'Lucida Console', Monaco, monospace;
text-indent: 1px;
}
.leaflet-touch .leaflet-control-zoom-in, .leaflet-touch .leaflet-control-zoom-out {
font-size: 22px;
}
/* layers control */
.leaflet-control-layers {
box-shadow: 0 1px 5px rgba(0,0,0,0.4);
background: #fff;
border-radius: 5px;
}
.leaflet-control-layers-toggle {
background-image: url(images/layers.png);
width: 36px;
height: 36px;
}
.leaflet-retina .leaflet-control-layers-toggle {
background-image: url(images/layers-2x.png);
background-size: 26px 26px;
}
.leaflet-touch .leaflet-control-layers-toggle {
width: 44px;
height: 44px;
}
.leaflet-control-layers .leaflet-control-layers-list,
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
display: none;
}
.leaflet-control-layers-expanded .leaflet-control-layers-list {
display: block;
position: relative;
}
.leaflet-control-layers-expanded {
padding: 6px 10px 6px 6px;
color: #333;
background: #fff;
}
.leaflet-control-layers-scrollbar {
overflow-y: scroll;
overflow-x: hidden;
padding-right: 5px;
}
.leaflet-control-layers-selector {
margin-top: 2px;
position: relative;
top: 1px;
}
.leaflet-control-layers label {
display: block;
font-size: 13px;
font-size: 1.08333em;
}
.leaflet-control-layers-separator {
height: 0;
border-top: 1px solid #ddd;
margin: 5px -10px 5px -6px;
}
/* Default icon URLs */
.leaflet-default-icon-path { /* used only in path-guessing heuristic, see L.Icon.Default */
background-image: url(images/marker-icon.png);
}
/* attribution and scale controls */
.leaflet-container .leaflet-control-attribution {
background: #fff;
background: rgba(255, 255, 255, 0.8);
margin: 0;
}
.leaflet-control-attribution,
.leaflet-control-scale-line {
padding: 0 5px;
color: #333;
line-height: 1.4;
}
.leaflet-control-attribution a {
text-decoration: none;
}
.leaflet-control-attribution a:hover,
.leaflet-control-attribution a:focus {
text-decoration: underline;
}
.leaflet-attribution-flag {
display: inline !important;
vertical-align: baseline !important;
width: 1em;
height: 0.6669em;
}
.leaflet-left .leaflet-control-scale {
margin-left: 5px;
}
.leaflet-bottom .leaflet-control-scale {
margin-bottom: 5px;
}
.leaflet-control-scale-line {
border: 2px solid #777;
border-top: none;
line-height: 1.1;
padding: 2px 5px 1px;
white-space: nowrap;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: rgba(255, 255, 255, 0.8);
text-shadow: 1px 1px #fff;
}
.leaflet-control-scale-line:not(:first-child) {
border-top: 2px solid #777;
border-bottom: none;
margin-top: -2px;
}
.leaflet-control-scale-line:not(:first-child):not(:last-child) {
border-bottom: 2px solid #777;
}
.leaflet-touch .leaflet-control-attribution,
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
box-shadow: none;
}
.leaflet-touch .leaflet-control-layers,
.leaflet-touch .leaflet-bar {
border: 2px solid rgba(0,0,0,0.2);
background-clip: padding-box;
}
/* popup */
.leaflet-popup {
position: absolute;
text-align: center;
margin-bottom: 20px;
}
.leaflet-popup-content-wrapper {
padding: 1px;
text-align: left;
border-radius: 12px;
}
.leaflet-popup-content {
margin: 13px 24px 13px 20px;
line-height: 1.3;
font-size: 13px;
font-size: 1.08333em;
min-height: 1px;
}
.leaflet-popup-content p {
margin: 17px 0;
margin: 1.3em 0;
}
.leaflet-popup-tip-container {
width: 40px;
height: 20px;
position: absolute;
left: 50%;
margin-top: -1px;
margin-left: -20px;
overflow: hidden;
pointer-events: none;
}
.leaflet-popup-tip {
width: 17px;
height: 17px;
padding: 1px;
margin: -10px auto 0;
pointer-events: auto;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: white;
color: #333;
box-shadow: 0 3px 14px rgba(0,0,0,0.4);
}
.leaflet-container a.leaflet-popup-close-button {
position: absolute;
top: 0;
right: 0;
border: none;
text-align: center;
width: 24px;
height: 24px;
font: 16px/24px Tahoma, Verdana, sans-serif;
color: #757575;
text-decoration: none;
background: transparent;
}
.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus {
color: #585858;
}
.leaflet-popup-scrolled {
overflow: auto;
}
.leaflet-oldie .leaflet-popup-content-wrapper {
-ms-zoom: 1;
}
.leaflet-oldie .leaflet-popup-tip {
width: 24px;
margin: 0 auto;
-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678);
}
.leaflet-oldie .leaflet-control-zoom,
.leaflet-oldie .leaflet-control-layers,
.leaflet-oldie .leaflet-popup-content-wrapper,
.leaflet-oldie .leaflet-popup-tip {
border: 1px solid #999;
}
/* div icon */
.leaflet-div-icon {
background: #fff;
border: 1px solid #666;
}
/* Tooltip */
/* Base styles for the element that has a tooltip */
.leaflet-tooltip {
position: absolute;
padding: 6px;
background-color: #fff;
border: 1px solid #fff;
border-radius: 3px;
color: #222;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.leaflet-tooltip.leaflet-interactive {
cursor: pointer;
pointer-events: auto;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
position: absolute;
pointer-events: none;
border: 6px solid transparent;
background: transparent;
content: "";
}
/* Directions */
.leaflet-tooltip-bottom {
margin-top: 6px;
}
.leaflet-tooltip-top {
margin-top: -6px;
}
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-top:before {
left: 50%;
margin-left: -6px;
}
.leaflet-tooltip-top:before {
bottom: 0;
margin-bottom: -12px;
border-top-color: #fff;
}
.leaflet-tooltip-bottom:before {
top: 0;
margin-top: -12px;
margin-left: -6px;
border-bottom-color: #fff;
}
.leaflet-tooltip-left {
margin-left: -6px;
}
.leaflet-tooltip-right {
margin-left: 6px;
}
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
top: 50%;
margin-top: -6px;
}
.leaflet-tooltip-left:before {
right: 0;
margin-right: -12px;
border-left-color: #fff;
}
.leaflet-tooltip-right:before {
left: 0;
margin-left: -12px;
border-right-color: #fff;
}
/* Printing */
@media print {
/* Prevent printers from removing background-images of controls. */
.leaflet-control {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
}

6
public/scripts/dist/leaflet.js vendored Normal file

File diff suppressed because one or more lines are too long

1
public/scripts/dist/leaflet.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

53446
public/scripts/dist/three.cjs vendored Normal file

File diff suppressed because one or more lines are too long

53032
public/scripts/dist/three.module.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

18
public/scripts/main.js Normal file
View file

@ -0,0 +1,18 @@
import InitMap, { map } from "./map.js";
import InitOverlayPoi from "./overlays/overlaysPoi.js";
import InitOverlayCoord, { UpdateCoord } from "./overlays/overlaysCoord.js";
import InitOverlayPlayer from "./overlays/overlaysPlayer.js";
//Init leaflet
InitMap();
//Init Overlay Control
InitOverlayPoi(map);
InitOverlayCoord(map);
map.on("click", function (ev) {
UpdateCoord(ev, map);
});
//Interval Player Overlay
setInterval(InitOverlayPlayer, 5000);

33
public/scripts/map.js Normal file
View file

@ -0,0 +1,33 @@
// Constantes
const TILE_SIZE = 255;
const CENTER_LAT = -127.5;
const CENTER_LON = 127.5;
const ZOOM_LEVEL = 4;
const BOUNDS_MAX = [
[-255, 0],
[0, 255],
];
// Variables
export var map = {};
// Fonction pour initialiser la carte
export default function InitialisationMap() {
map = L.map("map", {
crs: L.CRS.Simple,
minZoom: 1,
maxZoom: 8,
}).setView([CENTER_LAT, CENTER_LON], ZOOM_LEVEL);
addTileLayer();
}
// Fonction pour ajouter la couche de tuiles
function addTileLayer() {
L.tileLayer("/tiles/{z}/{x}/{y}.jpg", {
tileSize: TILE_SIZE,
noWrap: true,
bounds: BOUNDS_MAX,
attribution: "© Asheron's call 2 maps",
}).addTo(map);
}

View file

@ -0,0 +1,59 @@
const customIcons = {
redCrossFullIcon: new L.Icon({
iconUrl: "./icons/red_cross_full.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
redCrossVoidIcon: new L.Icon({
iconUrl: "./icons/red_cross_void.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
blueCircleFullIcon: new L.Icon({
iconUrl: "./icons/blue_circle_full.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
blueCircleVoidIcon: new L.Icon({
iconUrl: "./icons/blue_circle_void.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
blueCrossFullIcon: new L.Icon({
iconUrl: "./icons/blue_cross_full.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
greySquareIcon: new L.Icon({
iconUrl: "./icons/grey_square.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
yellowSquareFullIcon: new L.Icon({
iconUrl: "./icons/yellow_square_full.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
yellowSquareVoidIcon: new L.Icon({
iconUrl: "./icons/yellow_square_void.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
yellowCrownIcon: new L.Icon({
iconUrl: "./icons/yellow_crown.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
greenPlayer: new L.Icon({
iconUrl: "./icons/green_circle_full.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
yellowNpc: new L.Icon({
iconUrl: "./icons/yellow_star_big.png",
iconSize: [9, 9],
iconAnchor: [4.5, 4.5],
}),
};
export default customIcons;

View file

@ -0,0 +1,35 @@
const CENTER = 127.5;
export function coordToCardinal(lat, lng) {
// Vérifier que les valeurs de lat et lng sont dans la plage spécifiée
if (lat > 0 || lat < -255 || lng < 0 || lng > 255) {
return "Coordonnées invalides";
}
let cardinalLng = 0;
if (lng < CENTER) cardinalLng = 100 - (lng * 100 / CENTER);
else if (lng > CENTER) cardinalLng = (lng - CENTER) * 100 / CENTER;
else if (lng === CENTER) cardinalLng = 0;
let cardinalLat = 0;
lat = lat * -1;
if (lat < CENTER) cardinalLat = 100 - (lat * 100 / CENTER);
else if (lat > CENTER) cardinalLat = (lat - CENTER) * 100 / CENTER;
else if (lat === 0) cardinalLat = 0;
// Déterminer les directions
let directionLat = lat < CENTER ? "N" : "S";
let directionLng = lng < CENTER ? "W" : "E";
// Retourner la chaîne de caractères résultante
return cardinalLat.toFixed(1) + " " + directionLat + " - " + cardinalLng.toFixed(1) + " " + directionLng;
}
export function GetLandBlockId(ev, map) {
var latlng = ev.latlng;
var pointATmp = map.project(latlng, 4);
const blockSize = 16; // Taille d'un bloc
var y = Math.floor((4080 - pointATmp.y) / blockSize);
var x = Math.floor(pointATmp.x / blockSize);
return L.point(x, y);
}

View file

@ -0,0 +1,26 @@
import * as math from "../modules/math.js";
var coordOverlay = L.control({ position: "bottomleft" });
coordOverlay.onAdd = function (map) {
this._div = L.DomUtil.create("div", "coordinates-overlay");
this._div.innerHTML = "Cliquez sur la carte pour voir les coordonnées";
return this._div;
};
coordOverlay.update = function (coord, cardinal) {
this._div.innerHTML = "LandBlockId:" + "<br>" +
"0x" + coord.x.toString(16).toUpperCase().padStart(2, '0')
+ "" + coord.y.toString(16).toUpperCase().padStart(2, '0')
+ "FFFF"
+ "<br>"
+ cardinal;
};
export function UpdateCoord(ev, map) {
coordOverlay.update(math.GetLandBlockId(ev, map), math.coordToCardinal(ev.latlng.lat, ev.latlng.lng));
}
export default function InitialisationOverlayCoord(map) {
coordOverlay.addTo(map);
}

View 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);
}
}

View file

@ -0,0 +1,46 @@
import customIcons from '../modules/iconsMap.js';
import { map } from "../map.js";
// Dictionnaire pour stocker les marqueurs des personnages
var characterMarkers = {};
// Fonction pour récupérer les positions des personnages
export default function fetchCharacterLocations() {
fetch("/characterloc") // Effectuer une requête GET vers /characterloc
.then((response) => response.json()) // Convertir la réponse en JSON
.then((data) => {
// Parcourir les données et afficher chaque position de personnage
data.forEach((character) => {
updateCharacterMarker(
character.literalValue,
character.locy,
character.locx
);
});
})
.catch((error) => {
console.error("Error fetching character locations:", error);
});
}
// Fonction pour créer ou mettre à jour un marqueur de personnage
function updateCharacterMarker(characterId, lat, lng) {
// Vérifier si le marqueur existe déjà
if (characterMarkers[characterId]) {
// Mettre à jour la position du marqueur existant
characterMarkers[characterId].setLatLng([lat, lng]);
} else {
// Créer un nouveau marqueur
var marker = L.marker([lat, lng], { icon: customIcons.greenPlayer }).bindPopup(characterId).addTo(map);
// Stocker le marqueur dans le dictionnaire
characterMarkers[characterId] = marker;
}
}
// Fonction pour récupérer les positions des personnages
async function getPlayersLocations() {
const url = `/characterloc`;
try {
const response = await fetch(url);
let data = await response.json();
return data;
} catch (error) {
console.error(`Error fetching ${key} data:`, error);
}
}

View file

@ -0,0 +1,54 @@
import customIcons from '../modules/iconsMap.js';
import npcLocOverlay from "./overlaysNpc.js";
var overlayMaps = {};
var layerControl = {};
async function setupOverlayMaps() {
var overlayPoi = await getOverlayMaps(); // Attend que overlayPoi soit chargé
// Itérer sur les clés de overlayPoi
Object.keys(overlayPoi).forEach(key => {
const layerGroup = overlayPoi[key];
//overlayMaps[key] = layerGroup; // Assigner chaque layerGroup à la clé correspondante dans overlayMaps
layerControl.addOverlay(layerGroup, key); // Ajoute chaque couche à la carte avec son nom
});
//ADD OVERLAY NPC
let test = await npcLocOverlay();
overlayMaps["Npc"] = test;
layerControl.addOverlay(test, "Npc");
}
async function getOverlayMaps() {
await Promise.all(Object.keys(overlayMapsTemplate).map(async (key) => {
const url = `/poi/${key.toLowerCase()}/`;
try {
const response = await fetch(url);
const data = await response.json();
let icon = overlayMapsTemplate[key].icon;
overlayMaps[key] = L.layerGroup(data.map((item) => L.marker([item.y, item.x], { icon: icon }).bindPopup(item.description)));
} catch (error) {
console.error(`Error fetching ${key} data:`, error);
}
}));
return overlayMaps;
}
// overlayMapsTemplate est l'objet avec les clés que vous avez définies
const overlayMapsTemplate = {
Ringways: { icon: customIcons.blueCircleVoidIcon },
Gateways: { icon: customIcons.blueCircleFullIcon },
PoI: { icon: customIcons.blueCrossFullIcon },
Town: { icon: customIcons.yellowSquareFullIcon },
Outpost: { icon: customIcons.yellowSquareVoidIcon },
Vault: { icon: customIcons.redCrossFullIcon },
Dungeon: { icon: customIcons.redCrossVoidIcon },
City: { icon: customIcons.yellowCrownIcon },
Faction: { icon: customIcons.greySquareIcon },
};
export default function InitialisationOverlay(map) {
setupOverlayMaps();
layerControl = L.control.layers(null, overlayMaps).addTo(map);
}

File diff suppressed because it is too large Load diff

24
public/style/style.css Normal file
View file

@ -0,0 +1,24 @@
html, body {
height: 100%; /* Assurez-vous que le corps prend toute la hauteur de la fenêtre */
margin: 0;
padding: 0;
}
#map {
height: 100vh; /* Hauteur de la fenêtre de visualisation */
width: 100vw; /* Largeur de la fenêtre de visualisation */
}
.leaflet-tile {
border: 1px solid #ff000000; /* Ajoute une bordure noire d'un pixel */
}
.coordinates-overlay {
width: 126px;
position: absolute;
bottom: 10px;
left: 10px;
background: white;
padding: 5px 10px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,0.5);
font-size: 16px;
z-index: 1000; /* S'assure que l'overlay est visible au-dessus de la carte */
}