Fist Push
This commit is contained in:
parent
dd63653413
commit
cab9de1e90
118 changed files with 364726 additions and 0 deletions
59
public/scripts/modules/iconsMap.js
Normal file
59
public/scripts/modules/iconsMap.js
Normal 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;
|
||||
35
public/scripts/modules/math.js
Normal file
35
public/scripts/modules/math.js
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue