// ==UserScript==
// @name PathCreator
// @namespace http://tampermonkey.net/
// @version 1.4.6
// @description Create path has never been so easy
// @author Drigtime
// @match https://dofus-map.com/
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @require https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function () {
var icon = {
top: {
move: L.icon({
iconUrl: 'https://svgshare.com/i/54N.svg',
className: 'top-arrow'
}),
gather: L.icon({
iconUrl: 'https://svgshare.com/i/556.svg',
className: 'top-arrow'
}),
fight: L.icon({
iconUrl: 'https://svgshare.com/i/53n.svg',
className: 'top-arrow'
}),
bank: L.icon({
iconUrl: 'https://svgshare.com/i/54G.svg',
className: 'top-arrow'
}),
phoenix: L.icon({
iconUrl: 'https://svgshare.com/i/54x.svg',
className: 'top-arrow'
}),
},
left: {
move: L.icon({
iconUrl: 'https://svgshare.com/i/54m.svg',
className: 'left-arrow'
}),
gather: L.icon({
iconUrl: 'https://svgshare.com/i/555.svg',
className: 'left-arrow'
}),
fight: L.icon({
iconUrl: 'https://svgshare.com/i/54H.svg',
className: 'left-arrow'
}),
bank: L.icon({
iconUrl: 'https://svgshare.com/i/54v.svg',
className: 'left-arrow'
}),
phoenix: L.icon({
iconUrl: 'https://svgshare.com/i/557.svg',
className: 'left-arrow'
}),
},
bottom: {
move: L.icon({
iconUrl: 'https://svgshare.com/i/51x.svg',
className: 'bottom-arrow'
}),
gather: L.icon({
iconUrl: 'https://svgshare.com/i/54b.svg',
className: 'bottom-arrow'
}),
fight: L.icon({
iconUrl: 'https://svgshare.com/i/54o.svg',
className: 'bottom-arrow'
}),
bank: L.icon({
iconUrl: 'https://svgshare.com/i/53x.svg',
className: 'bottom-arrow'
}),
phoenix: L.icon({
iconUrl: 'https://svgshare.com/i/54q.svg',
className: 'bottom-arrow'
}),
},
right: {
move: L.icon({
iconUrl: 'https://svgshare.com/i/53t.svg',
className: 'right-arrow'
}),
gather: L.icon({
iconUrl: 'https://svgshare.com/i/54p.svg',
className: 'right-arrow'
}),
fight: L.icon({
iconUrl: 'https://svgshare.com/i/527.svg',
className: 'right-arrow'
}),
bank: L.icon({
iconUrl: 'https://svgshare.com/i/54w.svg',
className: 'right-arrow'
}),
phoenix: L.icon({
iconUrl: 'https://svgshare.com/i/543.svg',
className: 'right-arrow'
}),
},
havenbag: {
move: L.icon({
iconUrl: 'https://svgshare.com/i/58M.svg',
className: 'havenbag-icon'
}),
gather: L.icon({
iconUrl: 'https://svgshare.com/i/58N.svg',
className: 'havenbag-icon'
}),
fight: L.icon({
iconUrl: 'https://svgshare.com/i/5BW.svg',
className: 'havenbag-icon'
}),
bank: L.icon({
iconUrl: 'https://svgshare.com/i/5BL.svg',
className: 'havenbag-icon'
}),
phoenix: L.icon({
iconUrl: 'https://svgshare.com/i/5BB.svg',
className: 'havenbag-icon'
}),
}
};
$(function preloader() {
if (document.images) {
var img1 = new Image();
var img2 = new Image();
var img3 = new Image();
var img4 = new Image();
var img5 = new Image();
var img6 = new Image();
var img7 = new Image();
var img8 = new Image();
var img9 = new Image();
var img10 = new Image();
var img11 = new Image();
var img12 = new Image();
var img13 = new Image();
var img14 = new Image();
var img15 = new Image();
var img16 = new Image();
var img17 = new Image();
var img18 = new Image();
var img19 = new Image();
var img20 = new Image();
var img21 = new Image();
var img22 = new Image();
var img23 = new Image();
var img24 = new Image();
var img25 = new Image();
img1.src = "https://svgshare.com/i/54N.svg";
img2.src = "https://svgshare.com/i/54m.svg";
img3.src = "https://svgshare.com/i/51x.svg";
img4.src = "https://svgshare.com/i/53t.svg";
img5.src = "https://svgshare.com/i/556.svg";
img6.src = "https://svgshare.com/i/555.svg";
img7.src = "https://svgshare.com/i/54b.svg";
img8.src = "https://svgshare.com/i/54p.svg";
img9.src = "https://svgshare.com/i/53n.svg";
img10.src = "https://svgshare.com/i/54H.svg";
img11.src = "https://svgshare.com/i/54o.svg";
img12.src = "https://svgshare.com/i/527.svg";
img13.src = "https://svgshare.com/i/54G.svg";
img14.src = "https://svgshare.com/i/54w.svg";
img15.src = "https://svgshare.com/i/54v.svg";
img16.src = "https://svgshare.com/i/53x.svg";
img17.src = "https://svgshare.com/i/54x.svg";
img18.src = "https://svgshare.com/i/557.svg";
img19.src = "https://svgshare.com/i/54q.svg";
img20.src = "https://svgshare.com/i/543.svg";
img21.src = "https://svgshare.com/i/58M.svg";
img22.src = "https://svgshare.com/i/58N.svg";
img23.src = "https://svgshare.com/i/5BW.svg";
img24.src = "https://svgshare.com/i/5BL.svg";
img25.src = "https://svgshare.com/i/5BB.svg";
}
});
var actualMap;
var pathData = [];
var pathLinearData = [];
var bankData = [];
var phenixData = [];
var havenBagData = [];
var ressources = [
[1, "Frêne"],
[8, "Chêne"],
[17, "Fer"],
[24, "Argent"],
[25, "Or"],
[26, "Pierre de Bauxite"],
[28, "If"],
[29, "Ebène"],
[30, "Orme"],
[31, "Erable"],
[32, "Charme"],
[33, "Châtaignier"],
[34, "Noyer"],
[35, "Merisier"],
[37, "Pierre de Kobalte"],
[38, "Blé"],
[39, "Houblon"],
[42, "Lin"],
[43, "Orge"],
[44, "Seigle"],
[45, "Avoine"],
[46, "Chanvre"],
[47, "Malt"],
[52, "Etain"],
[53, "Pierre Cuivrée"],
[54, "Manganèse"],
[55, "Bronze"],
[61, "Edelweiss"],
[66, "Menthe Sauvage"],
[67, "Trèfle à 5 feuilles"],
[68, "Orchidée Freyesque"],
[71, "Greuvette"],
[74, "Truite"],
[75, "Goujon"],
[76, "Poisson-Chaton"],
[77, "Crabe"],
[78, "Poisson Pané"],
[79, "Carpe d'Iem"],
[80, "Truite Vaseuse"],
[81, "Sardine Brillante"],
[84, "Puits"],
[98, "Bombu"],
[100, "Pichon"],
[101, "Oliviolet"],
[108, "Bambou"],
[109, "Bambou sombre"],
[110, "Bambou sacré"],
[111, "Riz"],
[112, "Pandouille"],
[113, "Dolomite"],
[114, "Silicate"],
[121, "Kaliptus"],
[131, "Perce-neige"],
[132, "Poisskaille"],
[133, "Tremble"],
[134, "Frostiz"],
[135, "Obsidienne"],
[169, "Bar Akouda"],
[254, "Ortie"],
[255, "Sauge"],
[256, "Ginseng"],
[257, "Belladone"],
[258, "Mandragore"],
[259, "Noisetier"],
[260, "Maïs"],
[261, "Millet"],
[263, "Brochet"],
[264, "Kralamoure"],
[265, "Anguille"],
[266, "Dorade Grise"],
[267, "Perche"],
[268, "Raie"],
[269, "Lotte"],
[270, "Requin Marteau-Faucille"],
[271, "Bar Rikain"],
[272, "Morue"],
[273, "Tanche"],
[274, "Espadon"],
[281, "Trèfle à 4 feuilles"],
[283, "Chathon"],
[287, "Aquajou"],
[288, "Salikrone"],
[289, "Quisnoa"],
[290, "Patelle"],
[291, "Écume de mer"],
[293, "Écume de mer"],
[294, "Aquajou"],
[295, "Salikrone"],
[296, "Quisnoa"],
[297, "Patelle"],
];
var picker = 4;
var gatherData = [];
var loadingFile = false;
var havenToggle = false;
var css = document.createElement('style');
css.type = 'text/css';
css.textContent = 'body{font-family:"Open Sans",sans-serif!important;font-size:12px!important}#pathcreator{background:#212121;border-radius:5px;padding:10px;color:#fff;box-shadow:0 0 10px 0 rgba(0,0,0,0.6);font-family:arial;opacity:.95}.form-group input[type="radio"],.form-group input[type="checkbox"]{display:none}.form-group input[type="checkbox"] + .btn-group > label,.form-group input[type="radio"] + .btn-group > label{white-space:normal}.form-group input[type="checkbox"] + .btn-group > label.btn-default,.form-group input[type="radio"] + .btn-group > label.btn-default{color:#333;background-color:#fff;border-color:#ccc}.form-group input[type="checkbox"] + .btn-group > label.btn-primary,.form-group input[type="radio"] + .btn-group > label.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.form-group input[type="checkbox"] + .btn-group > label.btn-success,.form-group input[type="radio"] + .btn-group > label.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.form-group input[type="checkbox"] + .btn-group > label.btn-info,.form-group input[type="radio"] + .btn-group > label.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.form-group input[type="checkbox"] + .btn-group > label.btn-warning,.form-group input[type="radio"] + .btn-group > label.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.form-group input[type="checkbox"] + .btn-group > label.btn-danger,.form-group input[type="radio"] + .btn-group > label.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.form-group input[type="checkbox"] + .btn-group > label.btn-link,.form-group input[type="radio"] + .btn-group > label.btn-link{font-weight:400;color:#428bca;border-radius:0}.form-group input[type="radio"] + .btn-group > label span:first-child,.form-group input[type="checkbox"] + .btn-group > label span:first-child{display:none}.form-group input[type="radio"] + .btn-group > label span:first-child + span,.form-group input[type="checkbox"] + .btn-group > label span:first-child + span{display:inline-block}.form-group input[type="radio"]:checked + .btn-group > label span:first-child,.form-group input[type="checkbox"]:checked + .btn-group > label span:first-child{display:inline-block}.form-group input[type="radio"]:checked + .btn-group > label span:first-child + span,.form-group input[type="checkbox"]:checked + .btn-group > label span:first-child + span{display:none}.form-group input[type="checkbox"] + .btn-group > label span[class*="fa-"],.form-group input[type="radio"] + .btn-group > label span[class*="fa-"]{width:15px;float:left;margin:4px 0 2px -2px}.form-group input[type="checkbox"] + .btn-group > label span.content,.form-group input[type="radio"] + .btn-group > label span.content{margin-left:10px}.path-selector{padding-top:.5rem!important;padding-left:1rem!important;margin-right:0!important;margin-left:0!important}.no-gutters{margin-right:0!important;margin-left:0!important}.col-xs-6,.col-xs-12{padding-right:0!important;padding-left:0!important}.checkbox{padding-left:20px;margin-top:0!important;margin-bottom:5px!important}.checkbox label{display:inline-block;position:relative;padding-left:5px!important}.checkbox label::before{content:"";display:inline-block;position:absolute;width:17px;height:17px;left:0;margin-left:-20px;border:1px solid #ccc;border-radius:3px;background-color:#fff;-webkit-transition:border .15s ease-in-out,color .15s ease-in-out;-o-transition:border .15s ease-in-out,color .15s ease-in-out;transition:border .15s ease-in-out,color .15s ease-in-out}.checkbox label::after{display:inline-block;position:absolute;width:16px;height:16px;left:0;top:0;margin-left:-20px;padding-left:3px;padding-top:1px;font-size:11px;color:#555}.checkbox input[type="checkbox"]{opacity:0}.checkbox input[type="checkbox"]:checked + label::after{font-family:"FontAwesome";content:"\\f00c"}.checkbox input[type="checkbox"]:disabled + label{opacity:.65}.checkbox input[type="checkbox"]:disabled + label::before{background-color:#eee;cursor:not-allowed}.checkbox.checkbox-circle label::before{border-radius:50%}.checkbox.checkbox-inline{margin-top:0}.checkbox-primary input[type="checkbox"]:checked + label::before{background-color:#428bca;border-color:#428bca}.checkbox-primary input[type="checkbox"]:checked + label::after{color:#fff}.radio{padding-left:20px;margin-top:0!important;margin-bottom:5px!important}.radio label{display:inline-block;position:relative;padding-left:5px!important}.radio label::before{content:"";display:inline-block;position:absolute;width:17px;height:17px;left:0;margin-left:-20px;border:1px solid #ccc;border-radius:50%;background-color:#fff;-webkit-transition:border .15s ease-in-out;-o-transition:border .15s ease-in-out;transition:border .15s ease-in-out}.radio label::after{display:inline-block;position:absolute;content:" ";width:11px;height:11px;left:3px;top:3px;margin-left:-20px;border-radius:50%;background-color:#555;-webkit-transform:scale(0,0);-ms-transform:scale(0,0);-o-transform:scale(0,0);transform:scale(0,0);-webkit-transition:-webkit-transform .1s cubic-bezier(0.8,-0.33,0.2,1.33);-moz-transition:-moz-transform .1s cubic-bezier(0.8,-0.33,0.2,1.33);-o-transition:-o-transform .1s cubic-bezier(0.8,-0.33,0.2,1.33);transition:transform .1s cubic-bezier(0.8,-0.33,0.2,1.33)}.radio input[type="radio"]{opacity:0}.radio input[type="radio"]:checked + label::after{-webkit-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1)}.radio input[type="radio"]:disabled + label{opacity:.65}.radio input[type="radio"]:disabled + label::before{cursor:not-allowed}.radio.radio-inline{margin-top:0}.radio-primary input[type="radio"] + label::after{background-color:#428bca}.radio-primary input[type="radio"]:checked + label::before{border-color:#428bca}.radio-primary input[type="radio"]:checked + label::after{background-color:#428bca}.radio-danger input[type="radio"] + label::after{background-color:#d9534f}.radio-danger input[type="radio"]:checked + label::before{border-color:#d9534f}.radio-danger input[type="radio"]:checked + label::after{background-color:#d9534f}.radio-phenix input[type="radio"] + label::after,.radio-phenix input[type="radio"]:checked + label::after{background-color:#ab37c8}.radio-phenix input[type="radio"]:checked + label::before{border-color:#ab37c8}.radio-success input[type="radio"] + label::after{background-color:#5cb85c}.radio-success input[type="radio"]:checked + label::before{border-color:#5cb85c}.radio-success input[type="radio"]:checked + label::after{background-color:#5cb85c}.btn-flex{display:flex!important;align-items:stretch;align-content:stretch}.btn-flex .btn:first-child{flex-grow:1}.btn{outline:none!important}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover,.btn-dark:focus,.btn-dark:active,.btn-dark.active,.open .dropdown-toggle.btn-dark{color:#fff;background-color:#23272b;border-color:#343a40}.btn-dark:active,.btn-dark.active,.open .dropdown-toggle.btn-dark{background-image:none}.btn-dark.disabled,.btn-dark[disabled],fieldset[disabled] .btn-dark,.btn-dark.disabled:hover,.btn-dark[disabled]:hover,fieldset[disabled] .btn-dark:hover,.btn-dark.disabled:focus,.btn-dark[disabled]:focus,fieldset[disabled] .btn-dark:focus,.btn-dark.disabled:active,.btn-dark[disabled]:active,fieldset[disabled] .btn-dark:active,.btn-dark.disabled.active,.btn-dark[disabled].active,fieldset[disabled] .btn-dark.active{background-color:#343a40;border-color:#343a40}.btn-dark .badge{color:#343a40;background-color:#fff}.btn-flex{display:flex;align-items:stretch;align-content:stretch}.btn-flex .btn:first-child{flex-grow:1}.btn{outline:none!important}.btn-dark{color:#fff;background-color:#343a40;border-color:#343a40}.btn-dark:hover,.btn-dark:focus,.btn-dark:active,.btn-dark.active,.open .dropdown-toggle.btn-dark{color:#fff;background-color:#23272b;border-color:#343a40}.btn-dark:active,.btn-dark.active,.open .dropdown-toggle.btn-dark{background-image:none}.btn-dark.disabled,.btn-dark[disabled],fieldset[disabled] .btn-dark,.btn-dark.disabled:hover,.btn-dark[disabled]:hover,fieldset[disabled] .btn-dark:hover,.btn-dark.disabled:focus,.btn-dark[disabled]:focus,fieldset[disabled] .btn-dark:focus,.btn-dark.disabled:active,.btn-dark[disabled]:active,fieldset[disabled] .btn-dark:active,.btn-dark.disabled.active,.btn-dark[disabled].active,fieldset[disabled] .btn-dark.active{background-color:#343a40;border-color:#343a40}.btn-dark .badge{color:#343a40;background-color:#fff}#mapContainer[data-zoom="7"] .top-arrow{width:145px;margin-left:528.5px}#mapContainer[data-zoom="6"] .top-arrow{width:75px;margin-left:262.5px}#mapContainer[data-zoom="5"] .top-arrow{width:36px;margin-left:131.5px}#mapContainer[data-zoom="4"] .top-arrow{width:19px;margin-left:65.75px}#mapContainer[data-zoom="3"] .top-arrow{width:15px;margin-left:30.13px}#mapContainer[data-zoom="2"] .top-arrow{width:9.9px;margin-left:13.86px}#mapContainer[data-zoom="1"] .top-arrow{width:7px;margin-left:5.91px}#mapContainer[data-zoom="0"] .top-arrow{width:5.38px;margin-left:5.01px}#mapContainer[data-zoom="7"] .havenbag-icon{width:500.83px;margin-left:350.5833333px;margin-top:135.8px}#mapContainer[data-zoom="6"] .havenbag-icon{width:250px;margin-left:175px;margin-top:67.5px}#mapContainer[data-zoom="5"] .havenbag-icon{width:124.58px;margin-left:87.20833333px;margin-top:33.35px}#mapContainer[data-zoom="4"] .havenbag-icon{width:61.88px;margin-left:43.3125px;margin-top:16.28px}#mapContainer[data-zoom="3"] .havenbag-icon{width:30.52px;margin-left:21.36458333px;margin-top:7.74px}#mapContainer[data-zoom="2"] .havenbag-icon{width:14.84px;margin-left:10.390625px;margin-top:3.47px}#mapContainer[data-zoom="1"] .havenbag-icon{width:7.01px;margin-left:4.903645833px;margin-top:1.33px}#mapContainer[data-zoom="0"] .havenbag-icon{width:3.09px;margin-left:2.16015625px;margin-top:.27px}#mapContainer[data-zoom="7"] .left-arrow{width:324.26px;margin-top:356.5px}#mapContainer[data-zoom="6"] .left-arrow{width:161.59px;margin-top:177.75px}#mapContainer[data-zoom="5"] .left-arrow{width:80.53px;margin-top:88.38px}#mapContainer[data-zoom="4"] .left-arrow{width:40.13px;margin-top:44.19px}#mapContainer[data-zoom="3"] .left-arrow{width:30.87px;margin-top:19.34px}#mapContainer[data-zoom="2"] .left-arrow{width:23.75px;margin-top:7.42px}#mapContainer[data-zoom="1"] .left-arrow{width:18.27px;margin-top:1.86px}#mapContainer[data-zoom="0"] .left-arrow{width:14.05px;margin-top:1px}#mapContainer[data-zoom="7"] .right-arrow{width:324.26px;margin-left:878.74px;margin-top:356.5px}#mapContainer[data-zoom="6"] .right-arrow{width:161.59px;margin-left:439.41px;margin-top:177.75px}#mapContainer[data-zoom="5"] .right-arrow{width:80.53px;margin-left:219.47px;margin-top:88.38px}#mapContainer[data-zoom="4"] .right-arrow{width:40.13px;margin-left:110.37px;margin-top:44.19px}#mapContainer[data-zoom="3"] .right-arrow{width:30.87px;margin-left:43.38px;margin-top:19.34px}#mapContainer[data-zoom="2"] .right-arrow{width:23.75px;margin-left:12.88px;margin-top:7.42px}#mapContainer[data-zoom="1"] .right-arrow{width:18.27px;margin-left:1px;margin-top:1.86px}#mapContainer[data-zoom="0"] .right-arrow{width:14.05px;margin-left:1px;margin-top:1px}#mapContainer[data-zoom="7"] .bottom-arrow{width:145px;margin-left:528.5px;margin-top:648.2px}#mapContainer[data-zoom="6"] .bottom-arrow{width:75px;margin-left:262.5px;margin-top:319.5px}#mapContainer[data-zoom="5"] .bottom-arrow{width:36px;margin-left:131.5px;margin-top:160.91px}#mapContainer[data-zoom="4"] .bottom-arrow{width:19px;margin-left:65.75px;margin-top:78.02px}#mapContainer[data-zoom="3"] .bottom-arrow{width:15px;margin-left:30.13px;margin-top:31.09px}#mapContainer[data-zoom="2"] .bottom-arrow{width:9.9px;margin-left:13.86px;margin-top:11.59px}#mapContainer[data-zoom="1"] .bottom-arrow{width:7px;margin-left:5.91px;margin-top:3px}#mapContainer[data-zoom="0"] .bottom-arrow{width:5.38px;margin-left:5.01px;margin-top:0}#mapContainer[data-zoom="7"] .leaflet-popup{margin-left:601px}#mapContainer[data-zoom="6"] .leaflet-popup{margin-left:3005px}#mapContainer[data-zoom="5"] .leaflet-popup{margin-left:149.5px}#mapContainer[data-zoom="4"] .leaflet-popup{margin-left:74.25px}#mapContainer[data-zoom="3"] .leaflet-popup{margin-left:36.625px}#mapContainer[data-zoom="2"] .leaflet-popup{margin-left:17.8125px}#mapContainer[data-zoom="1"] .leaflet-popup{margin-left:8.40625px}#mapContainer[data-zoom="0"] .leaflet-popup{margin-left:3.703125px}';
document.getElementsByTagName('head')[0].appendChild(css);
var contenu = '';
contenu = `
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.9.0/css/flag-icon.css">
<div id="pathcreator" class="container" style="width: 186px;">
<div class="row no-gutters" style="text-align: right; margin-right: 0rem;">
<div class="btn-group">
<button type="button" class="btn dropdown-toggle btn-dark" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div id="keyboardLayout" class="fa fa-keyboard-o"></div>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" id="azerty">
<span class="fa fa-keyboard-o"></span> AZERTY</a></li>
<li><a class="dropdown-item" href="#" id="qwerty">
<span class="fa fa-keyboard-o"></span> QWERTY</a></li>
</ul>
</div>
<div class="btn-group">
<button type="button" class="btn dropdown-toggle btn-dark" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><div id="languageDisplayer" class="flag-icon flag-icon-fr"></div>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" id="fr">
<span class="flag-icon flag-icon-fr"></span> Français</a></li>
<li><a class="dropdown-item" href="#" id="en">
<span class="flag-icon flag-icon-gb"></span> English</a></li>
<li><a class="dropdown-item" href="#" id="es">
<span class="flag-icon flag-icon-es"></span> Español</a></li>
</ul>
</div>
</div>
<div class="path-selector">
<div class="row no-gutters">
<div class="col-xs-6">
<div class="checkbox checkbox-primary">
<input type="checkbox" id="pathTop">
<label id="top" for="pathTop">Haut</label>
</div>
</div>
<div class="col-xs-6">
<div class="checkbox checkbox-primary">
<input type="checkbox" id="pathBottom">
<label id="bottom" for="pathBottom">Bas</label>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-xs-6">
<div class="checkbox checkbox-primary">
<input type="checkbox" id="pathLeft">
<label id="left" for="pathLeft">Gauche</label>
</div>
</div>
<div class="col-xs-6">
<div class="checkbox checkbox-primary">
<input type="checkbox" id="pathRight">
<label id="right" for="pathRight">Droite</label>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-xs-12">
<div class="checkbox checkbox-primary">
<input type="checkbox" id="pathHavenBag">
<label id="havenBag" for="pathHavenBag">Havre-sac</label>
</div>
</div>
</div>
</div>
<button id="moveOption" class="btn btn-dark btn-block" data-toggle="collapse" data-target="#demo">More <span class="caret"></span></button>
<div id="demo" class="collapse">
<div class="form-group row" style="margin-top: 5px;margin-bottom: 5px;margin-left: 0px;">
<div class="col-xs-12">
<input type="checkbox" id="linear" />
<div class="btn-group">
<label for="linear" class="btn btn-default">
<span class="fa fa-check-square-o fa-lg"></span>
<span class="fa fa-square-o fa-lg"></span>
<span id="linearButtonText" class="content">Linéaire</span>
</label>
<button type="button" class="btn btn-default dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fa fa-info-circle"></span>
</button>
<div class="dropdown-menu" style="color: #111;padding: 10px">
<p id="infoLinear">L'option linéaire permet de créer des trajet avec plusieur actions différente dans un ordre précis sur une même map</p>
</div>
</div>
</div>
</div>
</div>
<hr style="border-top: 3px solid #111;margin-top:7px;margin-bottom:7px;" />
<form>
<div class="path-selector">
<div class="row no-gutters">
<div class="col-xs-6">
<div class="radio radio-success">
<input type="radio" id="gather" name="radioOption">
<label id="tdgather" for="gather">Recolte</label>
</div>
</div>
<div class="col-xs-6">
<div class="radio radio-danger">
<input type="radio" id="fight" name="radioOption">
<label id="tdfight" for="fight">Combat</label>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-xs-6">
<div class="radio radio-primary">
<input type="radio" id="bank" name="radioOption">
<label id="tdbank" for="bank">Banque</label>
</div>
</div>
<div class="col-xs-6">
<div class="radio radio-phenix">
<input type="radio" id="phenix" name="radioOption">
<label id="tdphoenix" for="phenix">Phenix</label>
</div>
</div>
</div>
<div class="row no-gutters">
<div class="col-xs-12">
<div class="radio">
<input type="radio" id="move" name="radioOption" checked>
<label id="tdMove" for="move">Deplacement</label>
</div>
</div>
</div>
</div>
</form>
<hr style="border-top: 3px solid #111;margin-top:7px;margin-bottom:7px;" />
<p style="text-align: center;" id="restogather">Ressources à récolter</p>
<div id="ressourcePickerBot" style="text-align: center;"><span id="ressourcePickerCreator" class="pickRessource" style="background-color: #0000008a; background-position: -260px 0px;">+</span></div>
<hr style="border-top: 3px solid #111;margin-top:7px;margin-bottom:7px;" />
<div class="btn-group btn-flex" style="margin-bottom: .5rem">
<button type="button" class="btn btn-dark" id="saveFile">Sauvegarder</button>
<button type="button" class="btn btn-dark dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right">
<input type="text" style="color: black;" placeholder="Nom du trajet" id="fileName">
</div>
</div>
<button class="btn btn-dark btn-block" id="deletePath">Supprimer</button>
<label class="btn btn-dark btn-block btn-file"><div id="loadAFile">Charger</div><input id="file" type="file" style="display: none;">
</label>
</div>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="top: 300px;">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Zaap : </h4>
</div>
<div class="modal-body">
<label>Zaap d'arrivée :</label>
<select class="form-control" id="sel1">
<option value='{"map": "4,-19", "mapid": "84674563"}'>Astrub | 4,-19</option>
<option value='{"map": "-32,-56", "mapid": "147768"}'>Bonta | -32,-56</option>
<option value='{"map": "-26,35", "mapid": "144419"}'>Brâkmar | -26,35</option>
<option value='{"map": "-1,13", "mapid": "88212746"}'>Amakna (Bord de la forêt maléfique) | -1,13</option>
<option value='{"map": "3,-5", "mapid": "68552706"}'>Amakna (Château d'Amakna) | 3,-5</option>
<option value='{"map": "5,7", "mapid": "88082704"}'>Amakna (Coins des Bouftous) | 5,7</option>
<option value='{"map": "7,-4", "mapid": "68419587"}'>Amakna (Port de Madrestam) | 7,-4</option>
<option value='{"map": "-2,0", "mapid": "88213271"}'>Amakna (Village d'Amakna) | -2,0</option>
<option value='{"map": "-1,24", "mapid": "88212481"}'>Amakna (Plaîne des Scarafeuilles) | -1,24</option>
<option value='{"map": "10,22", "mapid": "88085249"}'>Baie de Sufokia (Rivage Sufokien) | 10,22</option>
<option value='{"map": "13,26", "mapid": "95422468"}'>Baie de Sufokia (Sufokia) | 13,26</option>
<option value='{"map": "-46,18", "mapid": "154642"}'>Île d'Otomaïl (Village côtier) | -46,18</option>
<option value='{"map": "-79,-41", "mapid": "54172969"}'>Île de Frigost (La Bourgade) | -79,-41</option>
<option value='{"map": "-77,-73", "mapid": "54172489"}'>Île de Frigost (Village enseveli) | -77,-73</option>
<option value='{"map": "35,12", "mapid": "156762120"}'>Île de Moon (Plage de la Tortue) | 35,12</option>
<option value='{"map": "-16,1", "mapid": "73400320"}'>Montagne des Koalaks (Village des Eleveurs) | -16,1</option>
<option value='{"map": "26,-37", "mapid": "13605"}'>Pandala Neutre (Faubourgs de Pandala) | 26,-37</option>
<option value='{"map": "29,-49", "mapid": "15153"}'>Pandala Feu (Village de Feudala) | 29,-49</option>
<option value='{"map": "-27,-36", "mapid": "142087694"}'>Plaine de Cania (Champs de Cania) | -27,-36</option>
<option value='{"map": "-3,-42", "mapid": "156240386"}'>Plaine de Cania (Lac de Cania) | -3,-42</option>
<option value='{"map": "-13,-28", "mapid": "165152263"}'>Plaine de Cania (Massif de Cania) | -13,-28</option>
<option value='{"map": "-5,-23", "mapid": "84806401"}'>Plaine de Cania (Plaine des Porkass) | -5,-23</option>
<option value='{"map": "-17,-47", "mapid": "147590153"}'>Plaine de Cania (Plaines Rocheuses) | -17,-47</option>
<option value='{"map": "-20,-20", "mapid": "164364304"}'>Plaine de Cania (Route Rocailleuse) | -20,-20</option>
<option value='{"map": "15,-58", "mapid": "173278210"}'>Saharach (Dunes des ossements) | 15,-58</option>
<option value='{"map": "-25,12", "mapid": "171967506"}'>Landes de Sidimote (Route des Roulottes) | -25,12</option>
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-primary">Valider</button>
</div>
</div>
</div>
</div>`;
$('#pickRessourceContainer').append(contenu);
function checkMaps(mapcoord, array) {
for (let key = 0; key < array.length; key++) {
if (array[key].map == mapcoord) {
return true;
}
}
return false;
}
function getMapIndex(mapcoord, array) {
for (let key = 0; key < array.length; key++) {
if (array[key].map == mapcoord) {
return key;
}
}
}
function onMapClick() {
if (!loadingFile)
actualMap = $('#mapCoordinates').html();
if (RegExp(/<span>/).test(actualMap)) {
actualMap = $('#mapCoordinates').html().split(/<span>/)[0];
}
if ($('#pathHavenBag').is(":checked")) {
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
if (!havenToggle) {
if (!checkMaps(actualMap.split(', ')[0] + ',' + actualMap.split(', ')[1], havenBagData)) {
havenToggle = true;
$('#exampleModal').appendTo("body").modal('show');
return;
} else {
havenBagData.splice(getMapIndex(actualMap.split(', ')[0] + ',' + actualMap.split(', ')[1], havenBagData), 1);
}
} else {
havenToggle = false;
}
}
if ($('#bank').is(":checked")) {
if (!checkMaps(actualMap, bankData)) {
if ($('#pathHavenBag').is(":checked")) {
if (checkMaps(actualMap, pathData)) {
removeArrow(getMapIndex(actualMap, pathData), pathData);
deleteEmptyPath(pathData);
return;
} else if (checkMaps(actualMap, phenixData)) {
removeArrow(getMapIndex(actualMap, phenixData), phenixData);
deleteEmptyPath(phenixData);
return;
}
}
bankData.push({
map: actualMap,
top: {
path: false,
icon: undefined
},
bottom: {
path: false,
icon: undefined
},
right: {
path: false,
icon: undefined
},
left: {
path: false,
icon: undefined
},
havenbag: {
path: false,
icon: undefined
},
bank: false
});
createMarker(getMapIndex(actualMap, bankData), bankData);
deleteEmptyPath(bankData);
} else {
removeArrow(getMapIndex(actualMap, bankData), bankData);
deleteEmptyPath(bankData);
}
console.clear();
for (let key in bankData) {
console.log(key + ', map : ' + bankData[key].map + ', top : ' + bankData[key].top.path + ', bottom : ' + bankData[key].bottom.path + ', right : ' + bankData[key].right.path + ', left : ' + bankData[key].left.path + ', havenbag : ' + bankData[key].havenbag.path);
}
} else if ($('#phenix').is(":checked")) {
if (!checkMaps(actualMap, phenixData)) {
if ($('#pathHavenBag').is(":checked")) {
if (checkMaps(actualMap, pathData)) {
removeArrow(getMapIndex(actualMap, pathData), pathData);
deleteEmptyPath(pathData);
return;
} else if (checkMaps(actualMap, bankData)) {
removeArrow(getMapIndex(actualMap, bankData), bankData);
deleteEmptyPath(bankData);
return;
}
}
phenixData.push({
map: actualMap,
top: {
path: false,
icon: undefined
},
bottom: {
path: false,
icon: undefined
},
right: {
path: false,
icon: undefined
},
left: {
path: false,
icon: undefined
},
havenbag: {
path: false,
icon: undefined
},
phenix: false
});
createMarker(getMapIndex(actualMap, phenixData), phenixData);
deleteEmptyPath(phenixData);
} else {
removeArrow(getMapIndex(actualMap, phenixData), phenixData);
deleteEmptyPath(phenixData);
}
console.clear();
for (let key in phenixData) {
console.log(key + ', map : ' + phenixData[key].map + ', top : ' + phenixData[key].top.path + ', bottom : ' + phenixData[key].bottom.path + ', right : ' + phenixData[key].right.path + ', left : ' + phenixData[key].left.path + ', havenbag : ' + phenixData[key].havenbag.path);
}
} else {
if (!checkMaps(actualMap, pathData)) {
if ($('#pathHavenBag').is(":checked")) {
if (checkMaps(actualMap, bankData)) {
removeArrow(getMapIndex(actualMap, bankData), bankData);
deleteEmptyPath(bankData);
return;
} else if (checkMaps(actualMap, phenixData)) {
removeArrow(getMapIndex(actualMap, phenixData), phenixData);
deleteEmptyPath(phenixData);
return;
}
}
if ($('#linear').is(":checked")) {
if (!checkMaps(actualMap, pathLinearData)) {
pathLinearData.push({
map: actualMap,
top: {
index: undefined,
path: false,
icon: undefined
},
bottom: {
index: undefined,
path: false,
icon: undefined
},
right: {
index: undefined,
path: false,
icon: undefined
},
left: {
index: undefined,
path: false,
icon: undefined
},
havenbag: {
index: undefined,
path: false,
icon: undefined
},
gather: false,
fight: false,
index: false
});
createMarker(getMapIndex(actualMap, pathLinearData), pathLinearData);
deleteEmptyPath(pathLinearData);
} else {
removeArrow(getMapIndex(actualMap, pathLinearData), pathLinearData);
deleteEmptyPath(pathLinearData);
}
} else {
pathData.push({
map: actualMap,
top: {
path: false,
icon: undefined
},
bottom: {
path: false,
icon: undefined
},
right: {
path: false,
icon: undefined
},
left: {
path: false,
icon: undefined
},
havenbag: {
path: false,
icon: undefined
},
gather: false,
fight: false,
});
createMarker(getMapIndex(actualMap, pathData), pathData);
deleteEmptyPath(pathData);
}
} else {
removeArrow(getMapIndex(actualMap, pathData), pathData);
deleteEmptyPath(pathData);
}
console.clear();
for (let key in pathData) {
console.log(key + ', map : ' + pathData[key].map + ', top : ' + pathData[key].top.path + ', bottom : ' + pathData[key].bottom.path + ', right : ' + pathData[key].right.path + ', left : ' + pathData[key].left.path + ', havenbag : ' + pathData[key].havenbag.path + ', gather : ' + pathData[key].gather + ', fight : ' + pathData[key].fight);
}
}
}
function deleteEmptyPath(array) {
if (!array[getMapIndex(actualMap, array)].top.path && !array[getMapIndex(actualMap, array)].bottom.path && !array[getMapIndex(actualMap, array)].left.path && !array[getMapIndex(actualMap, array)].right.path && !array[getMapIndex(actualMap, array)].havenbag.path) {
array.splice(getMapIndex(actualMap, array), 1);
}
}
function removeArrow(key, array) {
removeArrowWay(key, array, "pathTop", "top");
removeArrowWay(key, array, "pathLeft", "left");
removeArrowWay(key, array, "pathBottom", "bottom");
removeArrowWay(key, array, "pathRight", "right");
removeArrowWay(key, array, "pathHavenBag", "havenbag");
}
function removeArrowWay(key, array, className, iconType) {
if ($('#' + className).is(":checked")) {
if ($('#linear').is(":checked")) {
if (array[key][iconType].icon !== undefined) {
if (array[key].index == 4) {
if (iconType == "top") {
if (array[key].top.index == 1) {
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].top.index == 2) {
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
} else if (array[key].top.index == 3) {
if (array[key].bottom.index > 3) array[key].bottom.index -= 1;
if (array[key].left.index > 3) array[key].left.index -= 1;
if (array[key].right.index > 3) array[key].right.index -= 1;
}
} else if (iconType == "bottom") {
if (array[key].bottom.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].bottom.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
} else if (array[key].bottom.index == 3) {
if (array[key].top.index > 3) array[key].top.index -= 1;
if (array[key].left.index > 3) array[key].left.index -= 1;
if (array[key].right.index > 3) array[key].right.index -= 1;
}
} else if (iconType == "left") {
if (array[key].left.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].left.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
} else if (array[key].left.index == 3) {
if (array[key].top.index > 3) array[key].top.index -= 1;
if (array[key].bottom.index > 3) array[key].bottom.index -= 1;
if (array[key].right.index > 3) array[key].right.index -= 1;
}
} else if (iconType == "right") {
if (array[key].right.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
} else if (array[key].right.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
} else if (array[key].right.index == 3) {
if (array[key].top.index > 3) array[key].top.index -= 1;
if (array[key].left.index > 3) array[key].left.index -= 1;
if (array[key].bottom.index > 3) array[key].bottom.index -= 1;
}
}
} else if (array[key].index == 3) {
if (iconType == "top") {
if (array[key].top.index == 1) {
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].top.index == 2) {
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
}
} else if (iconType == "bottom") {
if (array[key].bottom.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].bottom.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
}
} else if (iconType == "left") {
if (array[key].left.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
} else if (array[key].left.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
if (array[key].right.index > 2) array[key].right.index -= 1;
}
} else if (iconType == "right") {
if (array[key].right.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
} else if (array[key].right.index == 2) {
if (array[key].top.index > 2) array[key].top.index -= 1;
if (array[key].left.index > 2) array[key].left.index -= 1;
if (array[key].bottom.index > 2) array[key].bottom.index -= 1;
}
}
} else if (array[key].index == 2) {
if (iconType == "top") {
if (array[key].top.index == 1) {
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
}
} else if (iconType == "bottom") {
if (array[key].bottom.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
}
} else if (iconType == "left") {
if (array[key].left.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
if (array[key].right.index > 1) array[key].right.index -= 1;
}
} else if (iconType == "right") {
if (array[key].right.index == 1) {
if (array[key].top.index > 1) array[key].top.index -= 1;
if (array[key].left.index > 1) array[key].left.index -= 1;
if (array[key].bottom.index > 1) array[key].bottom.index -= 1;
}
}
}
array[key].index -= 1;
array[key][iconType].index = undefined;
array[key][iconType].path = false;
map.removeLayer(array[key][iconType].icon);
array[key][iconType].icon = undefined;
} else createMarkerWay(key, array, className, iconType);
} else if (array[key][iconType].icon !== undefined) {
array[key][iconType].path = false;
map.removeLayer(array[key][iconType].icon);
array[key][iconType].icon = undefined;
} else createMarkerWay(key, array, className, iconType);
}
}
function createMarker(key, array) {
createMarkerWay(key, array, "pathTop", "top");
createMarkerWay(key, array, "pathLeft", "left");
createMarkerWay(key, array, "pathBottom", "bottom");
createMarkerWay(key, array, "pathRight", "right");
createMarkerWay(key, array, "pathHavenBag", "havenbag");
}
function createMarkerWay(key, array, className, iconType) {
if ($('#' + className).is(":checked")) {
if ($('#gather').is(":checked")) {
if (iconType == "havenbag") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: true,
zIndexOffset: 5000,
icon: icon[iconType].gather
}).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length - 1].mapTogo + ' | mapID : ' + havenBagData[havenBagData.length - 1].mapidTogo);
} else {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: false,
zIndexOffset: 5000,
icon: icon[iconType].gather
}).addTo(map);
}
array[key].gather = true;
} else if ($('#fight').is(":checked")) {
if (iconType == "havenbag") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: true,
zIndexOffset: 5000,
icon: icon[iconType].fight
}).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length - 1].mapTogo + ' | mapID : ' + havenBagData[havenBagData.length - 1].mapidTogo);
} else {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: false,
zIndexOffset: 5000,
icon: icon[iconType].fight
}).addTo(map);
}
array[key].fight = true;
} else if ($('#bank').is(":checked")) {
if (iconType == "right" || iconType == "left") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1] * 1 + (0.2)), {
interactive: false,
zIndexOffset: 4500,
icon: icon[iconType].bank
}).addTo(map);
} else if (iconType == "top" || iconType == "bottom") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0] * 1 + (0.1), actualMap.split(", ")[1]), {
interactive: false,
zIndexOffset: 4500,
icon: icon[iconType].bank
}).addTo(map);
} else if (iconType == "havenbag") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: true,
zIndexOffset: 5000,
icon: icon[iconType].bank
}).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length - 1].mapTogo + ' | mapID : ' + havenBagData[havenBagData.length - 1].mapidTogo);
}
array[key].bank = true;
} else if ($('#phenix').is(":checked")) {
if (iconType == "right" || iconType == "left") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1] * 1 - (0.2)), {
interactive: false,
zIndexOffset: 4000,
icon: icon[iconType].phoenix
}).addTo(map);
} else if (iconType == "top" || iconType == "bottom") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0] * 1 - (0.1), actualMap.split(", ")[1]), {
interactive: false,
zIndexOffset: 4000,
icon: icon[iconType].phoenix
}).addTo(map);
} else if (iconType == "havenbag") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: true,
zIndexOffset: 5000,
icon: icon[iconType].phoenix
}).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length - 1].mapTogo + ' | mapID : ' + havenBagData[havenBagData.length - 1].mapidTogo);
}
array[key].phenix = true;
} else {
if (iconType == "havenbag") {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: true,
zIndexOffset: 5000,
icon: icon[iconType].move
}).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length - 1].mapTogo + ' | mapID : ' + havenBagData[havenBagData.length - 1].mapidTogo);
} else {
array[key][iconType].icon = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
interactive: false,
zIndexOffset: 5000,
icon: icon[iconType].move
}).addTo(map);
}
}
if ($('#linear').is(":checked")) {
array[key].index += 1;
array[key][iconType].index = array[key].index;
array[key][iconType].path = true;
} else {
array[key][iconType].path = true;
}
}
}
function pathGenerator(index, array) {
var path = "";
if (index !== undefined) {
if (array.length !== 0) {
if (array[index].havenbag.path)
path = "havenbag";
else {
if (array[index].top.path)
path = "top";
if (array[index].bottom.path)
path += (path === "" ? "" : "|") + "bottom";
if (array[index].left.path)
path += (path === "" ? "" : "|") + "left";
if (array[index].right.path)
path += (path === "" ? "" : "|") + "right";
}
return path;
}
}
}
function afterPhenix(map) {
for (let index = 0; index < pathData.length; index++) {
if (map == pathData[index].map) {
return index;
}
}
}
function gatherFigh(index, array) {
var path = "";
if (array[index].gather)
path = ", gather = true";
if (array[index].fight)
path += ", fight = true";
return path;
}
function addGather() {
let res = "";
for (let key in gatherData) {
let str = $('#' + gatherData[key]).attr("data-name");
for (let index in ressources) {
if (ressources[index] !== null) if (ressources[index][1] !== null) if (ressources[index][1] == str) res += '\t' + ressources[index][0] + ',' + ' -- ' + ressources[index][1] + '\r\n';
}
}
return res;
}
function havenbagCheck(option) {
for (let index = 0; index < havenBagData.length; index++) {
if (havenBagData[index][option]) {
return true;
}
}
return false;
}
function getLinearAction(params, key) {
if (pathLinearData[key].top.index == params) {
return "top";
} else if (pathLinearData[key].left.index == params) {
return "left";
} else if (pathLinearData[key].bottom.index == params) {
return "bottom";
} else if (pathLinearData[key].right.index == params) {
return "right";
} else if (pathLinearData[key].havenbag.index == params) {
return "havenbag";
}
}
$('#saveFile').on("click", function () {
var firstIf = false;
var txt = "-- Generated On Dofus-Map with Drigtime's SwiftPath Script Maker --\r\n";
txt += "GATHER = {\r\n";
txt += addGather();
txt += "} -- Les éléments à récolter\r\n" +
"OPEN_BAGS = true -- Ouvrir les sacs de ressources au fur et à mesure\r\n" +
"AUTO_DELETE = { } -- Les éléments à supprimer\r\n\r\n" +
"MAX_MONSTERS = 8 -- Le nombre maximum de monstres dans un groupe à combattre.\r\n" +
"MIN_MONSTERS = 1 -- Le nombre minimum de monstres dans un groupe à combattre.\r\n\r\n" +
"FORBIDDEN_MONSTERS = { } -- Monstres interdits\r\n" +
"FORCE_MONSTERS = { } -- Monstres obligatoires\r\n\r\n" +
"MAX_COMBAT = 800 -- Nombre de combats maximum\r\n";
if (pathLinearData.length !== 0) {
txt +=
'-- Drigtime Linear --\r\n' +
'-- Function Custom :\r\n' +
'\r\n' +
'function GatherFight()\r\n' +
'\tfor index, actualMap in pairs(mapsWithChangeMap) do\r\n' +
'\t\tif (map:onMap(actualMap.map)) then\r\n' +
'\t\t\tif actualMap.gather and actualMap.fight then\r\n' +
'\t\t\t\treturn "both"\r\n' +
'\t\t\telseif actualMap.gather then\r\n' +
'\t\t\t\treturn "gather"\r\n' +
'\t\t\telseif actualMap.forcegather then\r\n' +
'\t\t\t\treturn "forcegather"\r\n' +
'\t\t\telseif actualMap.fight then\r\n' +
'\t\t\t\treturn "fight"\r\n' +
'\t\t\telseif actualMap.forcefight then\r\n' +
'\t\t\t\treturn "forcefight"\r\n' +
'\t\t\tend\r\n' +
'\t\t\treturn "path"\r\n' +
'\t\tend\r\n' +
'\tend\r\n' +
'\treturn false\r\n' +
'end\r\n' +
'\r\n' +
'------------------\r\n' +
'\r\n' +
'function move()\r\n';
if (havenbagCheck('move')) {
txt += "\tif map:onMap(\"0,0\") then\r\n";
firstIf = false;
for (let index = 0; index < havenBagData.length; index++) {
if (havenBagData[index].move) {
if (!firstIf) {
txt += "\t\tif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
firstIf = true;
} else
txt += "\t\telseif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
}
}
txt += '\t\tend\r\n' +
'\telse\r\n' +
'\t\tactualMap = map:currentMap()\r\n' +
'\tend\r\n';
}
txt += '\tif GatherFight() == "both" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap, gather = true, fight = true}\r\n' +
'\t\t}\r\n' +
'\telseif GatherFight() == "gather" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap, gather = true}\r\n' +
'\t\t}\r\n' +
'\telseif GatherFight() == "forcegather" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap, forcegather = true}\r\n' +
'\t\t}\r\n' +
'\telseif GatherFight() == "fight" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap, fight = true}\r\n' +
'\t\t}\r\n' +
'\telseif GatherFight() == "forcefight" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap, forcefight = true}\r\n' +
'\t\t}\r\n' +
'\telseif GatherFight() == "path" then\r\n' +
'\t\treturn {\r\n' +
'\t\t\t{map = map:currentMap(), custom = processMap}\r\n' +
'\t\t}\r\n' +
'\telse\r\n' +
'\t\tglobal:printError("Aucune action sur la map : " .. map:currentMap() .. " | mapID : " .. map:currentMapId())\r\n' +
'\t\tglobal:disconnect()\r\n' +
'\tend\r\n' +
'end\r\n' +
'\r\n' +
'mapsWithChangeMap = {\r\n';
for (let key in pathLinearData) {
if (pathLinearData[key].index == 4) {
txt += '\t{map = "' + pathLinearData[key].map.replace(' ', '') + '", changeMap = "' + getLinearAction(1, key) + '", nextMap = "' + getLinearAction(2, key) + '", doNextMap = "no", thirdMap = "' + getLinearAction(3, key) + '", doThirdMap = "no", fourthMap = "' + getLinearAction(4, key) + '", doFourthMap = "no"' + gatherFigh(key, pathLinearData) + '},\r\n';
} else if (pathLinearData[key].index == 3) {
txt += '\t{map = "' + pathLinearData[key].map.replace(' ', '') + '", changeMap = "' + getLinearAction(1, key) + '", nextMap = "' + getLinearAction(2, key) + '", doNextMap = "no", thirdMap = "' + getLinearAction(3, key) + '", doThirdMap = "no"' + gatherFigh(key, pathLinearData) + '},\r\n';
} else if (pathLinearData[key].index == 2) {
txt += '\t{map = "' + pathLinearData[key].map.replace(' ', '') + '", changeMap = "' + getLinearAction(1, key) + '", nextMap = "' + getLinearAction(2, key) + '", doNextMap = "no"' + gatherFigh(key, pathLinearData) + '},\r\n';
} else {
txt += '\t{map = "' + pathLinearData[key].map.replace(' ', '') + '", changeMap = "' + getLinearAction(1, key) + '"' + gatherFigh(key, pathLinearData) + '},\r\n';
}
}
txt += '}\r\n' +
'\r\n' +
'function processMap()\r\n' +
'\tfor index, actualMap in pairs(mapsWithChangeMap) do\r\n' +
'\t\tif (map:onMap(actualMap.map)) then\r\n' +
'\t\t\tif (actualMap.doNextMap) and (actualMap.doThirdMap) and (actualMap.doFourthMap) then\r\n' +
'\t\t\t\tif (actualMap.doFourthMap) == "yes" then\r\n' +
'\t\t\t\t\tactualMap.doFourthMap = "no"\r\n' +
'\t\t\t\t\tif (actualMap.fourthMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.fourthMapDoor = tonumber(actualMap.fourthMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.fourthMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.fourthMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.fourthMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.fourthMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.doThirdMap) == "yes" then\r\n' +
'\t\t\t\t\tactualMap.doThirdMap = "no"\r\n' +
'\t\t\t\t\tactualMap.doFourthMap = "yes"\r\n' +
'\t\t\t\t\tif (actualMap.thirdMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.thirdMapDoor = tonumber(actualMap.thirdMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.thirdMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.thirdMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.thirdMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.thirdMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.doNextMap == "yes") then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "no"\r\n' +
'\t\t\t\t\tactualMap.doThirdMap = "yes"\r\n' +
'\t\t\t\t\tif (actualMap.nextMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.nextMapDoor = tonumber(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.nextMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.nextMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.nextMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.changeMapDoor) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tactualMap.changeMapDoor = tonumber(actualMap.changeMapDoor)\r\n' +
'\t\t\t\t\tmap:door(actualMap.changeMapDoor)\r\n' +
'\t\t\t\telseif (actualMap.changeMapCustom) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\treturn (actualMap.changeMapCustom)()\r\n' +
'\t\t\t\telseif (actualMap.changeMap) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tmap:changeMap(actualMap.changeMap)\r\n' +
'\t\t\t\tend\r\n' +
'\t\t\telseif (actualMap.doNextMap) and (actualMap.doThirdMap) then\r\n' +
'\t\t\t\tif (actualMap.doThirdMap) == "yes" then\r\n' +
'\t\t\t\t\tactualMap.doThirdMap = "no"\r\n' +
'\t\t\t\t\tif (actualMap.thirdMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.thirdMapDoor = tonumber(actualMap.thirdMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.thirdMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.thirdMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.thirdMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.thirdMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.doNextMap == "yes") then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "no"\r\n' +
'\t\t\t\t\tactualMap.doThirdMap = "yes"\r\n' +
'\t\t\t\t\tif (actualMap.nextMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.nextMapDoor = tonumber(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.nextMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.nextMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.nextMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.changeMapDoor) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tactualMap.changeMapDoor = tonumber(actualMap.changeMapDoor)\r\n' +
'\t\t\t\t\tmap:door(actualMap.changeMapDoor)\r\n' +
'\t\t\t\telseif (actualMap.changeMapCustom) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\treturn (actualMap.changeMapCustom)()\r\n' +
'\t\t\t\telseif (actualMap.changeMap) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tmap:changeMap(actualMap.changeMap)\r\n' +
'\t\t\t\tend\r\n' +
'\t\t\telseif (actualMap.doNextMap) then\r\n' +
'\t\t\t\tif (actualMap.doNextMap == "yes") then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "no"\r\n' +
'\t\t\t\t\tif (actualMap.nextMapDoor) then\r\n' +
'\t\t\t\t\t\tactualMap.nextMapDoor = tonumber(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\t\tmap:door(actualMap.nextMapDoor)\r\n' +
'\t\t\t\t\telseif (actualMap.nextMapCustom) then\r\n' +
'\t\t\t\t\t\treturn (actualMap.nextMapCustom)()\r\n' +
'\t\t\t\t\telse\r\n' +
'\t\t\t\t\t\tmap:changeMap(actualMap.nextMap)\r\n' +
'\t\t\t\t\tend\r\n' +
'\t\t\t\telseif (actualMap.changeMapDoor) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tactualMap.changeMapDoor = tonumber(actualMap.changeMapDoor)\r\n' +
'\t\t\t\t\tmap:door(actualMap.changeMapDoor)\r\n' +
'\t\t\t\telseif (actualMap.changeMapCustom) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\treturn (actualMap.changeMapCustom)()\r\n' +
'\t\t\t\telseif (actualMap.changeMap) then\r\n' +
'\t\t\t\t\tactualMap.doNextMap = "yes"\r\n' +
'\t\t\t\t\tmap:changeMap(actualMap.changeMap)\r\n' +
'\t\t\t\tend\r\n' +
'\t\t\telseif (actualMap.changeMapDoor) then\r\n' +
'\t\t\t\tactualMap.changeMapDoor = tonumber(actualMap.changeMapDoor)\r\n' +
'\t\t\t\tmap:door(actualMap.changeMapDoor)\r\n' +
'\t\t\telseif (actualMap.changeMapCustom) then\r\n' +
'\t\t\t\treturn (actualMap.changeMapCustom)()\r\n' +
'\t\t\telseif (actualMap.changeMap) then\r\n' +
'\t\t\t\tmap:changeMap(actualMap.changeMap)\r\n' +
'\t\t\telseif (actualMap.forcegather) then\r\n' +
'\t\t\tend\r\n' +
'\t\tend\r\n' +
'\tend\r\n' +
'end\r\n';
} else {
txt += "\r\nfunction move()\r\n";
if (havenbagCheck('move')) {
txt += "\tif map:onMap(\"0,0\") then\r\n";
firstIf = false;
for (let index = 0; index < havenBagData.length; index++) {
if (havenBagData[index].move) {
if (!firstIf) {
txt += "\t\tif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
firstIf = true;
} else
txt += "\t\telseif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
}
}
txt += '\t\tend\r\n' +
'\telse\r\n' +
'\t\tactualMap = map:currentMap()\r\n' +
'\tend\r\n';
}
txt += '\treturn {\r\n' +
'\t\t{map = "83887104", path = "396"}, --Interieur banque Astrub vers Sortie--\r\n' +
'\t\t{map = "54534165", path = "424"}, --Interieur banque Frigost vers Sortie--\r\n' +
'\t\t{map = "2885641", path = "424"}, --Interieur banque Bonta vers Sortie--\r\n' +
'\t\t{map = "99095051", path = "410"}, --Interieur banque Amakna vers Sortie--\r\n' +
'\t\t{map = "8912911", path = "424"}, --Interieur banque Brakmar vers Sortie--\r\n' +
'\t\t{map = "91753985", path = "396"}, --Interieur banque Sufokia vers Sortie--\r\n' +
'\t\t{map = "86511105", door = "452"}, --Interieur banque Ottomaï vers Sortie--\r\n' +
'\t\t{map = "8129542", path = "409"}, --Interieur banque Pandala vers Sortie--\r\n' +
'\t\t{map = "84935175", path = "425"}, --Interieur banque Montagne Koalak vers Sortie--\r\n';
for (let key in pathData) {
txt += '\t\t{map = "' + pathData[key].map.replace(" ", "") + '", path = "' + pathGenerator(key, pathData) + '"' + gatherFigh(key, pathData) + '},\r\n';
}
txt += '\t}\r\nend\r\n\r\n';
}
txt += "function bank()\r\n";
if (havenbagCheck('bank')) {
txt += "\tif map:onMap(\"0,0\") then\r\n";
firstIf = false;
for (let index = 0; index < havenBagData.length; index++) {
if (havenBagData[index].bank) {
if (!firstIf) {
txt += "\t\tif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
firstIf = true;
} else
txt += "\t\telseif actualMap == \"" + havenBagData[index].actualMap + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index].mapidToGo + ")\")\r\n";
}
}
txt += "\t\tend\r\n" +
"\telse\r\n" +
"\t\tactualMap = map:currentMap()\r\n" +
"\tend\r\n";
}
txt += "\treturn {\r\n";
for (let key in bankData) {
txt += '\t\t{map = "' + bankData[key].map.replace(" ", "") + '", path = "' + pathGenerator(key, bankData) + '"},\r\n';
}
txt += '\t\t{map = "84674566", door = "303"}, --Devant banque Astrub--\r\n' +
'\t\t{map = "83887104", path = "396", npcBank = true}, --Banque Astrub--\r\n' +
'\t\t{map = "54172457", door = "358"}, --Devant banque Frigost--\r\n' +
'\t\t{map = "54534165", path = "424", npcBank = true}, --Banque Frigost--\r\n' +
'\t\t{map = "147254", door = "383"}, --Devant banque Bonta--\r\n' +
'\t\t{map = "2885641", path = "424", npcBank = true}, --Banque Bonta--\r\n' +
'\t\t{map = "88081177", door = "216"}, --Devant banque Amakna--\r\n' +
'\t\t{map = "99095051", path = "410", npcBank = true}, --Banque Amakna--\r\n' +
'\t\t{map = "144931", door = "248"}, --Devant banque Brakmar--\r\n' +
'\t\t{map = "8912911", path = "424", npcBank = true}, --Banque Brakmar--\r\n' +
'\t\t{map = "90703872", door = "302"}, --Devant banque Sufokia --\r\n' +
'\t\t{map = "91753985", path = "494", npcBank = true}, --Banque Sufokia--\r\n' +
'\t\t{map = "155157", door = "355"}, --Devant banque Ottomaï--\r\n' +
'\t\t{map = "86511105", door = "452", npcBank = true}, --Banque Ottomaï--\r\n' +
'\t\t{map = "12580", door = "284"}, --Devant banque Pandala--\r\n' +
'\t\t{map = "8129542", path = "409", npcBank = true}, --Banque Pandala--\r\n' +
'\t\t{map = "73400323", door = "330"}, --Devant banque Montagne Koalak--\r\n' +
'\t\t{map = "84935175", path = "425", npcBank = true}, --Banque Montagne Koalak--\r\n\t}\r\nend\r\n' +
'\r\n\r\nfunction phenix()\r\n';
if (havenbagCheck('phenix')) {
txt += "\tif map:onMap(\"0,0\") then\r\n";
firstIf = false;
for (let index = 0; index < havenBagData.length; index++) {
if (havenBagData[index].phenix) {
if (!firstIf) {
txt += '\t\tif actualMap == \"' + havenBagData[index].actualMap + '\" then\r\n\t\t\tmap:changeMap(\"zaap(' + havenBagData[index].mapidToGo + ')\")\r\n';
firstIf = true;
} else
txt += '\t\telseif actualMap == \"' + havenBagData[index].actualMap + '\" then\r\n\t\t\tmap:changeMap(\"zaap(' + havenBagData[index].mapidToGo + ')\")\r\n';
}
}
txt += 't\tend\r\n' +
'telse\r\n' +
't\tactualMap = map:currentMap()\r\n' +
'tend\r\n';
} else if (havenbagCheck('move')) txt += '\tactualMap = map:currentMap()\r\n';
txt += "\treturn {\r\n";
for (let key in phenixData) {
txt += '\t\t{map = "' + phenixData[key].map.replace(" ", "") + '", path = "' + pathGenerator(key, phenixData) + '"},\r\n';
}
txt += '\t\t{map = "12,12", phenix = "184", path = "' + pathGenerator(afterPhenix("12, 12"), pathData) + '"},\r\n' +
'\t\t{map = "7,36", phenix = "0", path = "' + pathGenerator(afterPhenix("7, 36"), pathData) + '"},\r\n' +
'\t\t{map = "22,22", phenix = "272", path = "' + pathGenerator(afterPhenix("22, 22"), pathData) + '"},\r\n' +
'\t\t{map = "10,19", phenix = "192", path = "' + pathGenerator(afterPhenix("10, 19"), pathData) + '"},\r\n' +
'\t\t{map = "5,1", phenix = "0", path = "' + pathGenerator(afterPhenix("5, 1"), pathData) + '"},\r\n' +
'\t\t{map = "2,-1", phenix = "0", path = "' + pathGenerator(afterPhenix("2, -1"), pathData) + '"},\r\n' +
'\t\t{map = "13,-7", phenix = "0", path = "' + pathGenerator(afterPhenix("13, -7"), pathData) + '"},\r\n' +
'\t\t{map = "5,-9", phenix = "116", path = "' + pathGenerator(afterPhenix("5, -9"), pathData) + '"},\r\n' +
'\t\t{map = "2,-12", phenix = "272", path = "' + pathGenerator(afterPhenix("2, -12"), pathData) + '"},\r\n' +
'\t\t{map = "-6,-12", phenix = "0", path = "' + pathGenerator(afterPhenix("-6, -12"), pathData) + '"},\r\n' +
'\t\t{map = "36,10", phenix = "330", path = "' + pathGenerator(afterPhenix("36, 10"), pathData) + '"},\r\n' +
'\t\t{map = "25,-4", phenix = "450", path = "' + pathGenerator(afterPhenix("25, -4"), pathData) + '"},\r\n' +
'\t\t{map = "27,-33", phenix = "0", path = "' + pathGenerator(afterPhenix("27, -33"), pathData) + '"},\r\n' +
'\t\t{map = "24,-43", phenix = "245", path = "' + pathGenerator(afterPhenix("24, -43"), pathData) + '"},\r\n' +
'\t\t{map = "17,-36", phenix = "0", path = "' + pathGenerator(afterPhenix("17, -36"), pathData) + '"},\r\n' +
'\t\t{map = "-13,-29", phenix = "0", path = "' + pathGenerator(afterPhenix("-13, -29"), pathData) + '"},\r\n' +
'\t\t{map = "-10,-54", phenix = "342", path = "' + pathGenerator(afterPhenix("-10, -54"), pathData) + '"},\r\n' +
'\t\t{map = "-33,-56", phenix = "0", path = "' + pathGenerator(afterPhenix("-33, -56"), pathData) + '"},\r\n' +
'\t\t{map = "-10,13", phenix = "354", path = "' + pathGenerator(afterPhenix("-10, 13"), pathData) + '"},\r\n' +
'\t\t{map = "-14,31", phenix = "243", path = "' + pathGenerator(afterPhenix("-14, 31"), pathData) + '"},\r\n' +
'\t\t{map = "-26,34", phenix = "0", path = "' + pathGenerator(afterPhenix("-26, 34"), pathData) + '"},\r\n' +
'\t\t{map = "-26,36", phenix = "0", path = "' + pathGenerator(afterPhenix("-26, 36"), pathData) + '"},\r\n' +
'\t\t{map = "-55,40", phenix = "240", path = "' + pathGenerator(afterPhenix("-55, 40"), pathData) + '"},\r\n' +
'\t\t{map = "-58,18", phenix = "354", path = "' + pathGenerator(afterPhenix("-58, 18"), pathData) + '"},\r\n' +
'\t\t{map = "-60,-3", phenix = "0", path = "' + pathGenerator(afterPhenix("-60, -3"), pathData) + '"},\r\n' +
'\t\t{map = "-43,0", phenix = "259", path = "' + pathGenerator(afterPhenix("-43, 0"), pathData) + '"},\r\n' +
'\t\t{map = "-41,-17", phenix = "0", path = "' + pathGenerator(afterPhenix("-41, -17"), pathData) + '"},\r\n' +
'\t\t{map = "-43,-19", phenix = "0", path = "' + pathGenerator(afterPhenix("-43, -19"), pathData) + '"},\r\n' +
'\t\t{map = "-53,-40", phenix = "0", path = "' + pathGenerator(afterPhenix("-53, -40"), pathData) + '"},\r\n' +
'\t\t{map = "-67,-44", phenix = "219", path = "' + pathGenerator(afterPhenix("-67 ,-44"), pathData) + '"},\r\n' +
'\t\t{map = "-60,-79", phenix = "0", path = "' + pathGenerator(afterPhenix("-60, -79"), pathData) + '"}\r\n\t}\r\nend\r\n';
saveTextAsFile(txt);
});
function saveTextAsFile(txt) {
var textToSaveAsBlob = new Blob([txt], {
type: "text/plain"
});
var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
var fileNameToSaveAs;
if ($('#fileName').val() == "") fileNameToSaveAs = "Trajet.lua";
else fileNameToSaveAs = $('#fileName').val() + ".lua";
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
downloadLink.href = textToSaveAsURL;
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
downloadLink.click();
}
function languageSelector(params) {
switch (params) {
case "fr":
$('#top').empty().append('Haut');
$('#bottom').empty().append('Bas');
$('#left').empty().append('Gauche');
$('#right').empty().append('Droite');
$('#havenBag').empty().append('Havre-sac');
$('#tdgather').empty().append('Récolte');
$('#tdfight').empty().append('Combat');
$('#tdbank').empty().append('Banque');
$('#tdphoenix').empty().append('Phenix');
$('#tdMove').empty().append('Deplacement');
$('#restogather').empty().append('Ressources à récolter :');
$('#saveFile').empty().append('Sauvegarder');
$('#fileName').attr('placeholder', 'Nom du fichier');
$('#deletePath').empty().append('Supprimer');
$('#loadAFile').empty().append('Charger');
$('#moveOption').empty().append('Plus');
$('#linearButtonText').empty().append('Linéaire');
$('#infoLinear').empty().append('L\'option linéaire permet de créer des trajet avec plusieur actions différente dans un ordre précis sur une même map.');
$('#languageDisplayer').addClass('flag-icon-fr');
$('#languageDisplayer').removeClass('flag-icon-es');
$('#languageDisplayer').removeClass('flag-icon-gb');
GM_setValue("language", "fr");
break;
case "en":
$('#top').empty().append('Top');
$('#bottom').empty().append('Bottom');
$('#left').empty().append('Left');
$('#right').empty().append('Right');
$('#havenBag').empty().append('Haven bag');
$('#tdgather').empty().append('Gather');
$('#tdfight').empty().append('Fight');
$('#tdbank').empty().append('Bank');
$('#tdphoenix').empty().append('Phoenix');
$('#tdMove').empty().append('Move');
$('#restogather').empty().append('Resources to gather :');
$('#saveFile').empty().append('Save');
$('#fileName').attr('placeholder', 'Name of the file');
$('#deletePath').empty().append('Delete');
$('#loadAFile').empty().append('Load');
$('#moveOption').empty().append('More');
$('#linearButtonText').empty().append('Linear');
$('#infoLinear').empty().append('The linear option gives the possibility to put multiple action in a specific order on the same map.');
$('#languageDisplayer').removeClass('flag-icon-fr');
$('#languageDisplayer').removeClass('flag-icon-es');
$('#languageDisplayer').addClass('flag-icon-gb');
GM_setValue("language", "en");
break;
case "es":
$('#top').empty().append('Arriba');
$('#bottom').empty().append('Bajo');
$('#left').empty().append('Izquierda');
$('#right').empty().append('Derecha');
$('#havenBag').empty().append('Merkasako');
$('#tdgather').empty().append('Cosecha');
$('#tdfight').empty().append('Lucha');
$('#tdbank').empty().append('Banco');
$('#tdphoenix').empty().append('Fénix');
$('#tdMove').empty().append('Desplazamiento');
$('#restogather').empty().append('Recursos para cosechar :');
$('#saveFile').empty().append('Salvar');
$('#fileName').attr('placeholder', 'Nombre del archivo');
$('#deletePath').empty().append('Borrar');
$('#loadAFile').empty().append('Carga');
$('#moveOption').empty().append('Más');
$('#linearButtonText').empty().append('Lineal');
$('#infoLinear').empty().append('La opción lineal ofrece la posibilidad de poner varias acciones en un orden específico en el mismo mapa.');
$('#languageDisplayer').removeClass('flag-icon-fr');
$('#languageDisplayer').addClass('flag-icon-es');
$('#languageDisplayer').removeClass('flag-icon-gb');
GM_setValue("language", "es");
break;
default:
$('#top').empty().append('Haut');
$('#bottom').empty().append('Bas');
$('#left').empty().append('Gauche');
$('#right').empty().append('Droite');
$('#tdgather').empty().append('Récolte');
$('#tdfight').empty().append('Combat');
$('#tdbank').empty().append('Banque');
$('#tdphoenix').empty().append('Phenix');
$('#tdMove').empty().append('Deplacement');
$('#restogather').empty().append('Ressources à récolter :');
$('#saveFile').empty().append('Sauvegarder');
$('#fileName').attr('placeholder', 'Nom du fichier');
$('#deletePath').empty().append('Supprimer');
$('#loadAFile').empty().append('Charger');
$('#moveOption').empty().append('Plus');
$('#linearButtonText').empty().append('Linéaire');
$('#infoLinear').empty().append('L\'option linéaire permet de créer des trajet avec plusieur actions différente dans un ordre précis sur une même map.');
$('#languageDisplayer').addClass('flag-icon-fr');
$('#languageDisplayer').removeClass('flag-icon-es');
$('#languageDisplayer').removeClass('flag-icon-gb');
GM_setValue("language", "fr");
break;
}
}
languageSelector(GM_getValue("language"));
$('#file').change(function () {
var file = this.files[0];
var content;
var reader = new FileReader();
reader.onload = function (progressEvent) {
// Entire file
content = this.result;
let regexPath = /function move\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
let regexPathLinear = /mapsWithChangeMap.?=.?{\r\n([\s\S]+?)}\r\n/g;
let regexBank = /function bank\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
let regexPhenix = /function phenix\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
let result;
let matche = regexBank.exec(content);
loadingFile = true;
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
$('#pathHavenBag').prop('checked', false);
if (matche !== null) {
result = matche[1];
result = result.split('\r\n');
for (let index = 0; index < result.length; index++) {
matche = /map.?=.?"(.*?)"/g.exec(result[index]);
if (matche !== null) actualMap = matche[1];
actualMap = actualMap.replace(/,/g, ", ");
if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
matche = /top/g.exec(result[index]);
if (matche !== null) $('#pathTop').prop('checked', true);
matche = /left/g.exec(result[index]);
if (matche !== null) $('#pathLeft').prop('checked', true);
matche = /bottom/g.exec(result[index]);
if (matche !== null) $('#pathBottom').prop('checked', true);
matche = /right/g.exec(result[index]);
if (matche !== null) $('#pathRight').prop('checked', true);
$('#bank').prop('checked', true);
onMapClick();
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
}
}
}
matche = regexPathLinear.exec(content);
if (matche !== null) {
result = matche[1];
result = result.split('\r\n');
$('#linear').prop('checked', true);
for (let index = 0; index < result.length; index++) {
matche = /map.?=.?"(.*?)"/g.exec(result[index]);
if (matche !== null) actualMap = matche[1];
actualMap = actualMap.replace(/,/g, ", ");
if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
let loadAddLinearAction = function (param) {
matche = param.exec(result[index]);
if (matche !== null) {
if (matche[1] == "top") $('#pathTop').prop('checked', true);
if (matche[1] == "left") $('#pathLeft').prop('checked', true);
if (matche[1] == "bottom") $('#pathBottom').prop('checked', true);
if (matche[1] == "right") $('#pathRight').prop('checked', true);
}
$('#move').prop('checked', true);
matche = /gather/g.exec(result[index]);
if (matche !== null) $('#gather').prop('checked', true);
matche = /fight/g.exec(result[index]);
if (matche !== null) $('#fight').prop('checked', true);
onMapClick();
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
$('#gather').prop('checked', false);
$('#fight').prop('checked', false);
};
loadAddLinearAction(/changeMap.?=.?"(.+?)"/g);
loadAddLinearAction(/nextMap.?=.?"(.+?)"/g);
loadAddLinearAction(/thirdMap.?=.?"(.+?)"/g);
loadAddLinearAction(/fourthMap.?=.?"(.+?)"/g);
}
}
$('#linear').prop('checked', false);
} else if ((matche = regexPath.exec(content)) !== null) {
result = matche[1];
result = result.split('\r\n');
for (let index = 0; index < result.length; index++) {
matche = /map.?=.?"(.*?)"/g.exec(result[index]);
if (matche !== null) actualMap = matche[1];
actualMap = actualMap.replace(/,/g, ", ");
if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
matche = /top/g.exec(result[index]);
if (matche !== null) $('#pathTop').prop('checked', true);
matche = /left/g.exec(result[index]);
if (matche !== null) $('#pathLeft').prop('checked', true);
matche = /bottom/g.exec(result[index]);
if (matche !== null) $('#pathBottom').prop('checked', true);
matche = /right/g.exec(result[index]);
if (matche !== null) $('#pathRight').prop('checked', true);
matche = /gather/g.exec(result[index]);
$('#move').prop('checked', true);
if (matche !== null) $('#gather').prop('checked', true);
matche = /fight/g.exec(result[index]);
if (matche !== null) $('#fight').prop('checked', true);
onMapClick();
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
$('#gather').prop('checked', false);
$('#fight').prop('checked', false);
}
}
}
matche = regexPhenix.exec(content);
if (matche !== null) {
result = matche[1];
result = result.split('\r\n');
for (let index = 0; index < result.length; index++) {
matche = /map.?=.?"(.*?)"/g.exec(result[index]);
if (matche !== null) actualMap = matche[1];
actualMap = actualMap.replace(/,/g, ", ");
if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
matche = /top/g.exec(result[index]);
if (matche !== null) $('#pathTop').prop('checked', true);
matche = /left/g.exec(result[index]);
if (matche !== null) $('#pathLeft').prop('checked', true);
matche = /bottom/g.exec(result[index]);
if (matche !== null) $('#pathBottom').prop('checked', true);
matche = /right/g.exec(result[index]);
if (matche !== null) $('#pathRight').prop('checked', true);
$('#phenix').prop('checked', true);
onMapClick();
$('#pathTop').prop('checked', false);
$('#pathLeft').prop('checked', false);
$('#pathBottom').prop('checked', false);
$('#pathRight').prop('checked', false);
}
}
}
$('#move').prop('checked', true);
loadingFile = false;
};
reader.readAsText(file);
});
$(document).keypress(function (evt) {
var keyCode = evt.key;
if (GM_getValue("keyboardLayout", "azerty") == "azerty") {
switch (keyCode) {
case "z":
if (!$('#pathTop').is(":checked"))
$('#pathTop').prop('checked', true);
else
$('#pathTop').prop('checked', false);
break;
case "q":
if (!$('#pathLeft').is(":checked"))
$('#pathLeft').prop('checked', true);
else
$('#pathLeft').prop('checked', false);
break;
case "s":
if (!$('#pathBottom').is(":checked"))
$('#pathBottom').prop('checked', true);
else
$('#pathBottom').prop('checked', false);
break;
case "d":
if (!$('#pathRight').is(":checked"))
$('#pathRight').prop('checked', true);
else
$('#pathRight').prop('checked', false);
break;
case "a":
if (!$('#pathHavenBag').is(":checked"))
$('#pathHavenBag').prop('checked', true);
else
$('#pathHavenBag').prop('checked', false);
break;
default:
break;
}
} else if (GM_getValue("keyboardLayout", "azerty") == "qwerty") {
switch (keyCode) {
case "w":
if (!$('#pathTop').is(":checked"))
$('#pathTop').prop('checked', true);
else
$('#pathTop').prop('checked', false);
break;
case "a":
if (!$('#pathLeft').is(":checked"))
$('#pathLeft').prop('checked', true);
else
$('#pathLeft').prop('checked', false);
break;
case "s":
if (!$('#pathBottom').is(":checked"))
$('#pathBottom').prop('checked', true);
else
$('#pathBottom').prop('checked', false);
break;
case "d":
if (!$('#pathRight').is(":checked"))
$('#pathRight').prop('checked', true);
else
$('#pathRight').prop('checked', false);
break;
case "q":
if (!$('#pathHavenBag').is(":checked"))
$('#pathHavenBag').prop('checked', true);
else
$('#pathHavenBag').prop('checked', false);
break;
default:
break;
}
}
});
$('#exampleModal').on('click', '.btn-primary', function () {
let e = $('#sel1 option:selected');
var objMap = JSON.parse(e.val());
if ($('#move').is(":checked") || $('#gather').is(":checked") || $('#fight').is(":checked"))
havenBagData.push({
actualMap: actualMap.split(", ")[0] + "," + actualMap.split(", ")[1],
mapToGo: objMap.map,
mapidToGo: objMap.mapid,
move: true,
});
else if ($('#bank').is(":checked"))
havenBagData.push({
actualMap: actualMap.split(", ")[0] + "," + actualMap.split(", ")[1],
mapToGo: objMap.map,
mapidToGo: objMap.mapid,
bank: true,
});
else if ($('#phenix').is(":checked"))
havenBagData.push({
actualMap: actualMap.split(", ")[0] + "," + actualMap.split(", ")[1],
mapToGo: objMap.map,
mapidToGo: objMap.mapid,
phenix: true
});
$('#exampleModal').modal('hide');
onMapClick();
});
$('#exampleModal').on('click', '.btn-secondary', function () {
havenToggle = false;
$('#exampleModal').modal('hide');
});
$('#exampleModal').on('click', '.close', function () {
havenToggle = false;
$('#exampleModal').modal('hide');
});
function linearActualItem(index, time) {
if (GM_getValue('language') == 'fr') {
if (pathLinearData[index].top.index == time) return 'Haut';
else if (pathLinearData[index].left.index == time) return 'Gauche';
else if (pathLinearData[index].bottom.index == time) return 'Bas';
else if (pathLinearData[index].right.index == time) return 'Droite';
else if (pathLinearData[index].havenbag.index == time) return 'Havre-sac';
} else if (GM_getValue('language') == 'en') {
if (pathLinearData[index].top.index == time) return 'Top';
else if (pathLinearData[index].left.index == time) return 'Left';
else if (pathLinearData[index].bottom.index == time) return 'Bottom';
else if (pathLinearData[index].right.index == time) return 'Right';
else if (pathLinearData[index].havenbag.index == time) return 'Havenbag';
} else if (GM_getValue('language') == 'es') {
if (pathLinearData[index].top.index == time) return 'Arriba';
else if (pathLinearData[index].left.index == time) return 'Bajo';
else if (pathLinearData[index].bottom.index == time) return 'Izquierda';
else if (pathLinearData[index].right.index == time) return 'Derecha';
else if (pathLinearData[index].havenbag.index == time) return 'Merkasako';
}
}
function LMap() {
if (map) {
map.on('click', onMapClick);
map.on('mousemove', function () {
for (let index = 0; index < pathLinearData.length; index++) {
if (pathLinearData[index].map == $('#mapCoordinates').text()) {
if (pathLinearData[index].index == 4) {
if (GM_getValue('language') == 'fr') {
$('#mapCoordinates').append(
'<span><br />Premiére action sur la map : ' + linearActualItem(index, 1) +
'<br />Deuxiéme action sur la map : ' + linearActualItem(index, 2) +
'<br />Troisiéme action sur la map : ' + linearActualItem(index, 3) +
'<br />Quatrième action sur la map : ' + linearActualItem(index, 4) + '</span>'
);
} else if (GM_getValue('language') == 'en') {
$('#mapCoordinates').append(
'<span><br />First action on the map : ' + linearActualItem(index, 1) +
'<br />Second action on the map : ' + linearActualItem(index, 2) +
'<br />Third action on the map : ' + linearActualItem(index, 3) +
'<br />Fourth action on the map : ' + linearActualItem(index, 4) + '</span>'
);
} else if (GM_getValue('language') == 'es') {
$('#mapCoordinates').append(
'<span><br />Primera acción en el mapa: ' + linearActualItem(index, 1) +
'<br />Segunda acción en el mapa : ' + linearActualItem(index, 2) +
'<br />Tercera acción en el mapa : ' + linearActualItem(index, 3) +
'<br />Cuarta acción en el mapa : ' + linearActualItem(index, 4) + '</span>'
);
}
} else if (pathLinearData[index].index == 3) {
if (GM_getValue('language') == 'fr') {
$('#mapCoordinates').append(
'<span><br />Premiére action sur la map : ' + linearActualItem(index, 1) +
'<br />Deuxiéme action sur la map : ' + linearActualItem(index, 2) +
'<br />Troisiéme action sur la map : ' + linearActualItem(index, 3) + '</span>'
);
} else if (GM_getValue('language') == 'en') {
$('#mapCoordinates').append(
'<span><br />First action on the map : ' + linearActualItem(index, 1) +
'<br />Second action on the map : ' + linearActualItem(index, 2) +
'<br />Third action on the map : ' + linearActualItem(index, 3) + '</span>'
);
} else if (GM_getValue('language') == 'es') {
$('#mapCoordinates').append(
'<span><br />Primera acción en el mapa: ' + linearActualItem(index, 1) +
'<br />Segunda acción en el mapa : ' + linearActualItem(index, 2) +
'<br />Tercera acción en el mapa : ' + linearActualItem(index, 3) + '</span>'
);
}
} else if (pathLinearData[index].index == 2) {
if (GM_getValue('language') == 'fr') {
$('#mapCoordinates').append(
'<span><br />Premiére action sur la map : ' + linearActualItem(index, 1) +
'<br />Deuxiéme action sur la map : ' + linearActualItem(index, 2) + '</span>'
);
} else if (GM_getValue('language') == 'en') {
$('#mapCoordinates').append(
'<span><br />First action on the map : ' + linearActualItem(index, 1) +
'<br />Second action on the map : ' + linearActualItem(index, 2) + '</span>'
);
} else if (GM_getValue('language') == 'es') {
$('#mapCoordinates').append(
'<span><br />Primera acción en el mapa: ' + linearActualItem(index, 1) +
'<br />Segunda acción en el mapa : ' + linearActualItem(index, 2) + '</span>'
);
}
} else if (pathLinearData[index].index == 1) {
if (GM_getValue('language') == 'fr') {
$('#mapCoordinates').append(
'<span><br />Premiére action sur la map : ' + linearActualItem(index, 1) + '</span>'
);
} else if (GM_getValue('language') == 'en') {
$('#mapCoordinates').append(
'<span><br />PFirst action on the map : ' + linearActualItem(index, 1) + '</span>'
);
} else if (GM_getValue('language') == 'es') {
$('#mapCoordinates').append(
'<span><br />Primera acción en el mapa: ' + linearActualItem(index, 1) + '</span>'
);
}
}
}
}
});
} else {
setTimeout(function () {
LMap();
}, 50);
}
}
LMap();
$('#linear').change(function () {
if (this.checked) {
$('#move').prop('checked', true);
$('#phenix').prop("disabled", true);
$('#bank').prop("disabled", true);
} else {
$('#phenix').prop("disabled", false);
$('#bank').prop("disabled", false);
}
});
$('#ressourcePickerCreator').on("click", function () {
$('#ressourcePickerBot').prepend('<span id="pickRessource' + picker + '" class="pickRessource ressourceColor1" onclick="clickOnTypePicker(\'' + picker + '\');" data-name="" data-ressourceid=""' +
'style="background-position: -260px 0px; line-height: 49px !important; width: 49px !important; margin: 2px !important; height: 49px !important;">?</span>');
gatherData.push('pickRessource' + picker);
picker += 1;
});
$('#deletePath').on("click", function () {
let deleteAll = function (array) {
for (let index = 0; index < array.length; index) {
if (array[index].top)
if (array[index].top.icon) map.removeLayer(array[index].top.icon);
if (array[index].bottom)
if (array[index].bottom.icon) map.removeLayer(array[index].bottom.icon);
if (array[index].left)
if (array[index].left.icon) map.removeLayer(array[index].left.icon);
if (array[index].right)
if (array[index].right.icon) map.removeLayer(array[index].right.icon);
if (array[index].havenbag)
if (array[index].havenbag.icon) map.removeLayer(array[index].havenbag.icon);
array.splice(index, 1);
}
};
deleteAll(pathData);
deleteAll(pathLinearData);
deleteAll(bankData);
deleteAll(phenixData);
deleteAll(havenBagData);
console.clear();
});
$('#fr').on("click", function () {
languageSelector("fr");
});
$('#en').on("click", function () {
languageSelector("en");
});
$('#es').on("click", function () {
languageSelector("es");
});
$('#azerty').on("click", function () {
GM_setValue("keyboardLayout", "azerty");
});
$('#qwerty').on("click", function () {
GM_setValue("keyboardLayout", "qwerty");
});
})();