PathCreator

Create path has never been so easy

目前为 2018-01-27 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name PathCreator
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1.7
  5. // @description Create path has never been so easy
  6. // @author Drigtime
  7. // @match https://dofus-map.com/
  8. // @grant none
  9. // @require https://code.jquery.com/jquery-3.2.1.slim.min.js
  10. // @require https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16.  
  17. var icon = {
  18. top: {
  19. move: L.icon({
  20. iconUrl: 'https://svgshare.com/i/54N.svg',
  21. className: 'top-arrow'
  22. }),
  23. gather: L.icon({
  24. iconUrl: 'https://svgshare.com/i/556.svg',
  25. className: 'top-arrow'
  26. }),
  27. fight: L.icon({
  28. iconUrl: 'https://svgshare.com/i/53n.svg',
  29. className: 'top-arrow'
  30. }),
  31. bank: L.icon({
  32. iconUrl: 'https://svgshare.com/i/54G.svg',
  33. className: 'top-arrow'
  34. }),
  35. phoenix: L.icon({
  36. iconUrl: 'https://svgshare.com/i/54x.svg',
  37. className: 'top-arrow'
  38. }),
  39. },
  40. left: {
  41. move: L.icon({
  42. iconUrl: 'https://svgshare.com/i/54m.svg',
  43. className: 'left-arrow'
  44. }),
  45. gather: L.icon({
  46. iconUrl: 'https://svgshare.com/i/555.svg',
  47. className: 'left-arrow'
  48. }),
  49. fight: L.icon({
  50. iconUrl: 'https://svgshare.com/i/54H.svg',
  51. className: 'left-arrow'
  52. }),
  53. bank: L.icon({
  54. iconUrl: 'https://svgshare.com/i/54v.svg',
  55. className: 'left-arrow'
  56. }),
  57. phoenix: L.icon({
  58. iconUrl: 'https://svgshare.com/i/557.svg',
  59. className: 'left-arrow'
  60. }),
  61. },
  62. bottom: {
  63. move: L.icon({
  64. iconUrl: 'https://svgshare.com/i/51x.svg',
  65. className: 'bottom-arrow'
  66. }),
  67. gather: L.icon({
  68. iconUrl: 'https://svgshare.com/i/54b.svg',
  69. className: 'bottom-arrow'
  70. }),
  71. fight: L.icon({
  72. iconUrl: 'https://svgshare.com/i/54o.svg',
  73. className: 'bottom-arrow'
  74. }),
  75. bank: L.icon({
  76. iconUrl: 'https://svgshare.com/i/53x.svg',
  77. className: 'bottom-arrow'
  78. }),
  79. phoenix: L.icon({
  80. iconUrl: 'https://svgshare.com/i/54q.svg',
  81. className: 'bottom-arrow'
  82. }),
  83. },
  84. right: {
  85. move: L.icon({
  86. iconUrl: 'https://svgshare.com/i/53t.svg',
  87. className: 'right-arrow'
  88. }),
  89. gather: L.icon({
  90. iconUrl: 'https://svgshare.com/i/54p.svg',
  91. className: 'right-arrow'
  92. }),
  93. fight: L.icon({
  94. iconUrl: 'https://svgshare.com/i/527.svg',
  95. className: 'right-arrow'
  96. }),
  97. bank: L.icon({
  98. iconUrl: 'https://svgshare.com/i/54w.svg',
  99. className: 'right-arrow'
  100. }),
  101. phoenix: L.icon({
  102. iconUrl: 'https://svgshare.com/i/543.svg',
  103. className: 'right-arrow'
  104. }),
  105. },
  106. havenbag: {
  107. move: L.icon({
  108. iconUrl: 'https://svgshare.com/i/58M.svg',
  109. className: 'havenbag-icon'
  110. }),
  111. gather: L.icon({
  112. iconUrl: 'https://svgshare.com/i/58N.svg',
  113. className: 'havenbag-icon'
  114. }),
  115. fight: L.icon({
  116. iconUrl: 'https://svgshare.com/i/5BW.svg',
  117. className: 'havenbag-icon'
  118. }),
  119. bank: L.icon({
  120. iconUrl: 'https://svgshare.com/i/5BL.svg',
  121. className: 'havenbag-icon'
  122. }),
  123. phoenix: L.icon({
  124. iconUrl: 'https://svgshare.com/i/5BB.svg',
  125. className: 'havenbag-icon'
  126. }),
  127. }
  128. };
  129.  
  130. function preloader() {
  131. if (document.images) {
  132. var img1 = new Image();
  133. var img2 = new Image();
  134. var img3 = new Image();
  135. var img4 = new Image();
  136. var img5 = new Image();
  137. var img6 = new Image();
  138. var img7 = new Image();
  139. var img8 = new Image();
  140. var img9 = new Image();
  141. var img10 = new Image();
  142. var img11 = new Image();
  143. var img12 = new Image();
  144. var img13 = new Image();
  145. var img14 = new Image();
  146. var img15 = new Image();
  147. var img16 = new Image();
  148. var img17 = new Image();
  149. var img18 = new Image();
  150. var img19 = new Image();
  151. var img20 = new Image();
  152. var img21 = new Image();
  153. var img22 = new Image();
  154. var img23 = new Image();
  155. var img24 = new Image();
  156. var img25 = new Image();
  157.  
  158. img1.src = "https://svgshare.com/i/54N.svg";
  159. img2.src = "https://svgshare.com/i/54m.svg";
  160. img3.src = "https://svgshare.com/i/51x.svg";
  161. img4.src = "https://svgshare.com/i/53t.svg";
  162. img5.src = "https://svgshare.com/i/556.svg";
  163. img6.src = "https://svgshare.com/i/555.svg";
  164. img7.src = "https://svgshare.com/i/54b.svg";
  165. img8.src = "https://svgshare.com/i/54p.svg";
  166. img9.src = "https://svgshare.com/i/53n.svg";
  167. img10.src = "https://svgshare.com/i/54H.svg";
  168. img11.src = "https://svgshare.com/i/54o.svg";
  169. img12.src = "https://svgshare.com/i/527.svg";
  170. img13.src = "https://svgshare.com/i/54G.svg";
  171. img14.src = "https://svgshare.com/i/54w.svg";
  172. img15.src = "https://svgshare.com/i/54v.svg";
  173. img16.src = "https://svgshare.com/i/53x.svg";
  174. img17.src = "https://svgshare.com/i/54x.svg";
  175. img18.src = "https://svgshare.com/i/557.svg";
  176. img19.src = "https://svgshare.com/i/54q.svg";
  177. img20.src = "https://svgshare.com/i/543.svg";
  178. img21.src = "https://svgshare.com/i/58M.svg";
  179. img22.src = "https://svgshare.com/i/58N.svg";
  180. img23.src = "https://svgshare.com/i/5BW.svg";
  181. img24.src = "https://svgshare.com/i/5BL.svg";
  182. img25.src = "https://svgshare.com/i/5BB.svg";
  183. }
  184. }
  185.  
  186. function addLoadEvent(func) {
  187. var oldonload = window.onload;
  188. if (typeof window.onload != 'function') {
  189. window.onload = func;
  190. } else {
  191. window.onload = function () {
  192. if (oldonload) {
  193. oldonload();
  194. }
  195. func();
  196. };
  197. }
  198. }
  199. addLoadEvent(preloader);
  200.  
  201. var actualMap;
  202. var pathData = [];
  203. var bankData = [];
  204. var phenixData = [];
  205. var havenBagData = [];
  206.  
  207. var ressources = [
  208. [1, "Frêne"],
  209. [8, "Chêne"],
  210. [17, "Fer"],
  211. [24, "Argent"],
  212. [25, "Or"],
  213. [26, "Pierre de Bauxite"],
  214. [28, "If"],
  215. [29, "Ebène"],
  216. [30, "Orme"],
  217. [31, "Erable"],
  218. [32, "Charme"],
  219. [33, "Châtaignier"],
  220. [34, "Noyer"],
  221. [35, "Merisier"],
  222. [37, "Pierre de Kobalte"],
  223. [38, "Blé"],
  224. [39, "Houblon"],
  225. [42, "Lin"],
  226. [43, "Orge"],
  227. [44, "Seigle"],
  228. [45, "Avoine"],
  229. [46, "Chanvre"],
  230. [47, "Malt"],
  231. [48, "Tas de patates"],
  232. [52, "Etain"],
  233. [53, "Pierre Cuivrée"],
  234. [54, "Manganèse"],
  235. [55, "Bronze"],
  236. [61, "Edelweiss"],
  237. [63, "Froment"],
  238. [64, "Epeautre"],
  239. [65, "Sorgho"],
  240. [66, "Menthe Sauvage"],
  241. [67, "Trèfle à 5 feuilles"],
  242. [68, "Orchidée Freyesque"],
  243. [71, "Greuvette"],
  244. [72, "Somoon Agressif"],
  245. [73, "Pwoulpe"],
  246. [74, "Truite"],
  247. [75, "Goujon"],
  248. [76, "Poisson-Chaton"],
  249. [77, "Crabe"],
  250. [78, "Poisson Pané"],
  251. [79, "Carpe d'Iem"],
  252. [80, "Truite Vaseuse"],
  253. [81, "Sardine Brillante"],
  254. [82, "Coton"],
  255. [84, "Puits"],
  256. [98, "Bombu"],
  257. [99, "Ombre étrange"],
  258. [100, "Pichon"],
  259. [101, "Oliviolet"],
  260. [102, "Machine de force"],
  261. [104, "Koinkoin"],
  262. [108, "Bambou"],
  263. [109, "Bambou sombre"],
  264. [110, "Bambou sacré"],
  265. [111, "Riz"],
  266. [112, "Pandouille"],
  267. [113, "Dolomite"],
  268. [114, "Silicate"],
  269. [121, "Kaliptus"],
  270. [131, "Perce-neige"],
  271. [132, "Poisskaille"],
  272. [133, "Tremble"],
  273. [134, "Frostiz"],
  274. [135, "Obsidienne"],
  275. [136, "Coquillage"],
  276. [137, "Machine à coudre de Poss'Ybel"],
  277. [138, "Fabrique"],
  278. [141, "Établi de mauvaise qualité"],
  279. [142, "Machine à coudre de mauvaise qualité"],
  280. [143, "Machine à jouets"],
  281. [144, "Pressoir à poisson"],
  282. [146, "Paquet Cadeau"],
  283. [167, "Arène"],
  284. [168, "Banque"],
  285. [169, "Bar Akouda"],
  286. [170, "Bibliothèque"],
  287. [171, "Boutiques de Nowel"],
  288. [172, "Dojo"],
  289. [173, "Église"],
  290. [174, "Épicerie"],
  291. [175, "Fabricant de skis"],
  292. [176, "Hôtel de ville"],
  293. [177, "Hôtel des métiers"],
  294. [178, "Kanojedo"],
  295. [179, "Kolizéum"],
  296. [180, "Milice"],
  297. [181, "Médecin de Frigost"],
  298. [206, "Sous-marin Steamer"],
  299. [207, "Autel"],
  300. [208, "Krosmaster"],
  301. [219, "Métier d'Avenir"],
  302. [220, "Tonneau d'explosifs"],
  303. [221, "Fleur de Sutol"],
  304. [222, "Barbecue"],
  305. [223, "Cawotte fraîche"],
  306. [224, "Alambic patiné de l'hôtel des métiers"],
  307. [225, "Bouteille de Rhum"],
  308. [226, "Ascenseur"],
  309. [227, "Champignon"],
  310. [230, "Portail des Bworks"],
  311. [231, "Distributeur de missions"],
  312. [232, "Portail"],
  313. [234, "Glaçon"],
  314. [235, "Aller vers"],
  315. [236, "Pupitre"],
  316. [253, "Portail Eliotrope"],
  317. [254, "Ortie"],
  318. [255, "Sauge"],
  319. [256, "Ginseng"],
  320. [257, "Belladone"],
  321. [258, "Mandragore"],
  322. [259, "Noisetier"],
  323. [260, "Maïs"],
  324. [261, "Millet"],
  325. [262, "Bloc de pierre"],
  326. [263, "Brochet"],
  327. [264, "Kralamoure"],
  328. [265, "Anguille"],
  329. [266, "Dorade Grise"],
  330. [267, "Perche"],
  331. [268, "Raie"],
  332. [269, "Lotte"],
  333. [270, "Requin Marteau-Faucille"],
  334. [271, "Bar Rikain"],
  335. [272, "Morue"],
  336. [273, "Tanche"],
  337. [274, "Espadon"],
  338. [275, "Enclume de Mulic Bere"],
  339. [276, "Établi de Mulic Bere"],
  340. [278, "Assembleur de Mulic Bere"],
  341. [280, "Plate-forme Huppermage"],
  342. [281, "Trèfle à 4 feuilles"],
  343. [282, "Indiquer une sortie"],
  344. [283, "Chathon"],
  345. [284, "Escalier"],
  346. [285, "Porte blindée"],
  347. [287, "Aquajou"],
  348. [288, "Salikrone"],
  349. [289, "Quisnoa"],
  350. [290, "Patelle"],
  351. [291, "Écume de mer"],
  352. [293, "Écume de mer"],
  353. [294, "Aquajou"],
  354. [295, "Salikrone"],
  355. [296, "Quisnoa"],
  356. [297, "Patelle"],
  357. [299, "Œufs frais"]
  358. ];
  359. var picker = 4;
  360. var gatherData = [];
  361. var loadingFile = false;
  362. var havenToggle = false;
  363.  
  364. setTimeout(function () {
  365. var script2 = document.createElement('script');
  366. script2.type = 'text/javascript';
  367. script2.src = 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.3/js/bootstrap.js';
  368. document.getElementsByTagName('head')[0].appendChild(script2);
  369. }, 0);
  370.  
  371. var css = document.createElement('style');
  372. css.type = 'text/css';
  373. css.textContent = '.checkbox.checkbox-inline,.radio.radio-inline{margin-top:0}#pathcreator{background:#212121;border-radius:5px;padding:10px;color:#fff;box-shadow:0 0 10px 0 rgba(0,0,0,.6);font-family:arial;opacity:.95}.row{padding-top:.5rem;padding-left:1rem}.checkbox{padding-left:20px}.checkbox label{display:inline-block;position:relative;padding-left:5px}.checkbox label::after,.checkbox label::before{position:absolute;margin-left:-20px;display:inline-block;left:0}.checkbox label::before{content:"";width:17px;height:17px;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{width:16px;height:16px;top:0;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-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}.radio label{display:inline-block;position:relative;padding-left:5px}.radio label::after,.radio label::before{display:inline-block;position:absolute;margin-left:-20px}.radio label::before{content:"";width:17px;height:17px;left:0;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{content:" ";width:11px;height:11px;left:3px;top:3px;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(.8,-.33,.2,1.33);-moz-transition:-moz-transform .1s cubic-bezier(.8,-.33,.2,1.33);-o-transition:-o-transform .1s cubic-bezier(.8,-.33,.2,1.33);transition:transform .1s cubic-bezier(.8,-.33,.2,1.33)}.radio-primary input[type=radio]+label::after,.radio-primary input[type=radio]:checked+label::after{background-color:#428bca}.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-primary input[type=radio]:checked+label::before{border-color:#428bca}.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-danger input[type=radio]+label::after,.radio-danger input[type=radio]:checked+label::after{background-color:#d9534f}.radio-danger input[type=radio]:checked+label::before{border-color:#d9534f}.radio-success input[type=radio]+label::after,.radio-success input[type=radio]:checked+label::after{background-color:#5cb85c}.radio-success input[type=radio]:checked+label::before{border-color:#5cb85c}.btn-secondary{color:#bfbfbf;background-color:#0d0d0d;border-color:#1a1a1a}.btn-secondary.active,.btn-secondary:active,.btn-secondary:focus,.btn-secondary:hover,.open .dropdown-toggle.btn-secondary{color:#bfbfbf;background-color:#1a1a1a;border-color:#0d0d0d}.btn-file{position:relative;overflow:hidden}.btn-file input[type=file]{position:absolute;top:0;right:0;min-width:100%;min-height:100%;font-size:100px;text-align:right;filter:alpha(opacity=0);opacity:0;outline:0;background:#fff;cursor:inherit;display:block}#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}';
  374. document.getElementsByTagName('head')[0].appendChild(css);
  375.  
  376.  
  377. document.getElementById('pickRessourceContainer').innerHTML += `
  378. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
  379. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.css">
  380. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.9.0/css/flag-icon.css">
  381. <div id="pathcreator" class="container">
  382. <div style="text-align: right;">
  383. <div class="btn-group">
  384. <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>
  385. </button>
  386. <div class="dropdown-menu dropdown-menu-right">
  387. <a class="dropdown-item" href="#" id="fr"><div class="flag-icon flag-icon-fr"></div> Français</a>
  388. <a class="dropdown-item" href="#" id="en"><div class="flag-icon flag-icon-gb"></div> English</a>
  389. <a class="dropdown-item" href="#" id="es"><div class="flag-icon flag-icon-es"></div> Español</a>
  390. </div>
  391. </div>
  392. </div>
  393. <div class="row no-gutters">
  394. <div class="col checkbox checkbox-primary">
  395. <input type="checkbox" id="pathTop" value="option1">
  396. <label id="top" for="pathTop">Haut</label>
  397. </div>
  398. <div class="col checkbox checkbox-primary">
  399. <input type="checkbox" id="pathBottom" value="option1">
  400. <label id="bottom" for="pathBottom">Bas</label>
  401. </div>
  402. <div class="w-100"></div>
  403. <div class="col checkbox checkbox-primary">
  404. <input type="checkbox" id="pathLeft" value="option1">
  405. <label id="left" for="pathLeft">Gauche</label>
  406. </div>
  407. <div class="col checkbox checkbox-primary">
  408. <input type="checkbox" id="pathRight" value="option1">
  409. <label id="right" for="pathRight">Droite</label>
  410. </div>
  411. <div class="w-100"></div>
  412. <div class="col checkbox checkbox-primary">
  413. <input type="checkbox" id="pathHavenBag" value="option1">
  414. <label id="havenBag" for="pathHavenBag">Havre-sac</label>
  415. </div>
  416. </div>
  417. <hr style="border-top: 3px solid #111;" />
  418. <form>
  419. <div class="row no-gutters">
  420. <div class="col radio radio-success">
  421. <input type="radio" id="gather" name="radioOption">
  422. <label id="tdgather" for="gather">Recolte</label>
  423. </div>
  424. <div class="col radio radio-danger">
  425. <input type="radio" id="fight" name="radioOption">
  426. <label id="tdfight" for="fight">Combat</label>
  427. </div>
  428. <div class="w-100"></div>
  429. <div class="col radio radio-primary">
  430. <input type="radio" id="bank" name="radioOption">
  431. <label id="tdbank" for="bank">Banque</label>
  432. </div>
  433. <div class="col radio radio-phenix">
  434. <input type="radio" id="phenix" name="radioOption">
  435. <label id="tdphoenix" for="phenix">Phenix</label>
  436. </div>
  437. <div class="w-100"></div>
  438. <div class="col radio">
  439. <input type="radio" id="move" name="radioOption" checked>
  440. <label id="tdMove" for="move">Deplacement</label>
  441. </div>
  442. </div>
  443. </form>
  444. <hr style="border-top: 3px solid #111;" />
  445. <p style="text-align: center;" id="restogather">Ressources à récolter</p>
  446. <div id="ressourcePickerBot" style="text-align: center;"><span id="ressourcePickerCreator" class="pickRessource" style="background-color: #0000008a; background-position: -260px 0px;">+</span></div>
  447. <hr style="border-top: 3px solid #111;" />
  448. <div class="btn-group btn-block">
  449. <button type="button" class="btn btn-dark btn-block" id="saveFile">Sauvegarder</button>
  450. <button type="button" class="btn btn-dark dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  451. </button>
  452. <div class="dropdown-menu dropdown-menu-right">
  453. <input type="text" placeholder="Nom du trajet" id="fileName">
  454. </div>
  455. </div>
  456. <button class="btn btn-dark btn-block" id="deletePath">Supprimer</button>
  457. <label class="btn btn-dark btn-block btn-file"><div id="loadAFile">Charger</div><input id="file" type="file" style="display: none;">
  458. </label>
  459. </div>
  460. <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style=" top: 300px;">
  461. <div class="modal-dialog" role="document">
  462. <div class="modal-content">
  463. <div class="modal-header">
  464. <h5 class="modal-title" id="exampleModalLabel">Zaap</h5>
  465. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  466. <span aria-hidden="true">&times;</span>
  467. </button>
  468. </div>
  469. <div class="modal-body">
  470. <form>
  471. <div class="form-group">
  472. <label for="recipient-name" class="form-control-label">Zaap d'arrivée :</label>
  473. <select class="form-control" id="sel1">
  474. <option value='{"map": "4,-19", "mapid": "84674563"}'>Astrub | 4,-19</option>
  475. <option value='{"map": "-32,-56", "mapid": "147768"}'>Bonta | -32,-56</option>
  476. <option value='{"map": "-26,35", "mapid": "144419"}'>Brâkmar | -26,35</option>
  477. <option value='{"map": "-1,13", "mapid": "88212746"}'>Amakna (Bord de la forêt maléfique) | -1,13</option>
  478. <option value='{"map": "3,-5", "mapid": "68552706"}'>Amakna (Château d'Amakna) | 3,-5</option>
  479. <option value='{"map": "5,7", "mapid": "88082704"}'>Amakna (Coins des Bouftous) | 5,7</option>
  480. <option value='{"map": "7,-4", "mapid": "68419587"}'>Amakna (Port de Madrestam) | 7,-4</option>
  481. <option value='{"map": "-2,0", "mapid": "88213271"}'>Amakna (Village d'Amakna) | -2,0</option>
  482. <option value='{"map": "-1,24", "mapid": "88212481"}'>Amakna (Plaîne des Scarafeuilles) | -1,24</option>
  483. <option value='{"map": "10,22", "mapid": "88085249"}'>Baie de Sufokia (Rivage Sufokien) | 10,22</option>
  484. <option value='{"map": "13,26", "mapid": "95422468"}'>Baie de Sufokia (Sufokia) | 13,26</option>
  485. <option value='{"map": "-46,18", "mapid": "154642"}'le d'Otomaïl (Village côtier) | -46,18</option>
  486. <option value='{"map": "-79,-41", "mapid": "54172969"}'le de Frigost (La Bourgade) | -79,-41</option>
  487. <option value='{"map": "-77,-73", "mapid": "54172489"}'le de Frigost (Village enseveli) | -77,-73</option>
  488. <option value='{"map": "35,12", "mapid": "156762120"}'le de Moon (Plage de la Tortue) | 35,12</option>
  489. <option value='{"map": "-16,1", "mapid": "73400320"}'>Montagne des Koalaks (Village des Eleveurs) | -16,1</option>
  490. <option value='{"map": "26,-37", "mapid": "13605"}'>Pandala Neutre (Faubourgs de Pandala) | 26,-37</option>
  491. <option value='{"map": "29,-49", "mapid": "15153"}'>Pandala Feu (Village de Feudala) | 29,-49</option>
  492. <option value='{"map": "-27,-36", "mapid": "142087694"}'>Plaine de Cania (Champs de Cania) | -27,-36</option>
  493. <option value='{"map": "-3,-42", "mapid": "156240386"}'>Plaine de Cania (Lac de Cania) | -3,-42</option>
  494. <option value='{"map": "-13,-28", "mapid": "165152263"}'>Plaine de Cania (Massif de Cania) | -13,-28</option>
  495. <option value='{"map": "-5,-23", "mapid": "84806401"}'>Plaine de Cania (Plaine des Porkass) | -5,-23</option>
  496. <option value='{"map": "-17,-47", "mapid": "147590153"}'>Plaine de Cania (Plaines Rocheuses) | -17,-47</option>
  497. <option value='{"map": "-20,-20", "mapid": "164364304"}'>Plaine de Cania (Route Rocailleuse) | -20,-20</option>
  498. <option value='{"map": "15,-58", "mapid": "173278210"}'>Saharach (Dunes des ossements) | 15,-58</option>
  499. <option value='{"map": "-25,12", "mapid": "171967506"}'>Landes de Sidimote (Route des Roulottes) | -25,12</option>
  500. </select>
  501. </div>
  502. </form>
  503. </div>
  504. <div class="modal-footer">
  505. <button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
  506. <button type="button" class="btn btn-primary">Valider</button>
  507. </div>
  508. </div>
  509. </div>
  510. </div>`;
  511.  
  512. function checkMaps(mapcoord, array) {
  513. for (let key = 0; key < array.length; key++) {
  514. if (array[key][0] == mapcoord) {
  515. return true;
  516. }
  517. }
  518. return false;
  519. }
  520.  
  521. function getMapIndex(mapcoord, array) {
  522. for (let key = 0; key < array.length; key++) {
  523. if (array[key][0] == mapcoord) {
  524. return key;
  525. }
  526. }
  527. }
  528.  
  529. function onMapClick() {
  530.  
  531. if (!loadingFile)
  532. actualMap = document.getElementById('mapCoordinates').innerText;
  533.  
  534. if (document.getElementById("pathHavenBag").checked) {
  535. document.getElementById("pathTop").checked = false;
  536. document.getElementById("pathLeft").checked = false;
  537. document.getElementById("pathBottom").checked = false;
  538. document.getElementById("pathRight").checked = false;
  539. if (!havenToggle) {
  540. if (!checkMaps(actualMap.split(', ')[0] + ',' + actualMap.split(', ')[1], havenBagData)) {
  541. havenToggle = true;
  542. $('#exampleModal').modal('show');
  543. return;
  544. } else {
  545. havenBagData.splice(getMapIndex(actualMap.split(', ')[0] + ',' + actualMap.split(', ')[1], havenBagData), 1);
  546. }
  547. } else {
  548. havenToggle = false;
  549. }
  550. }
  551. if (document.getElementById("bank").checked) {
  552. if (!checkMaps(actualMap, bankData)) {
  553. bankData.push([actualMap, false, undefined, false, undefined, false, undefined, false, undefined, false, undefined, false]);
  554. createMarker(getMapIndex(actualMap, bankData), bankData);
  555. deleteEmptyPath(bankData);
  556. } else if (checkMaps(actualMap, bankData)) {
  557. removeArrow(getMapIndex(actualMap, bankData), bankData);
  558. deleteEmptyPath(bankData);
  559. }
  560. console.clear();
  561. for (let key in bankData) {
  562. console.log(key + ', map : ' + bankData[key][0] + ', top : ' + bankData[key][1] + ', bottom : ' + bankData[key][5] + ', right : ' + bankData[key][7] + ', left : ' + bankData[key][3] + ', havenbag : ' + bankData[key][9]);
  563. }
  564. } else if (document.getElementById("phenix").checked) {
  565. if (!checkMaps(actualMap, phenixData)) {
  566. phenixData.push([actualMap, false, undefined, false, undefined, false, undefined, false, undefined, false, undefined, false]);
  567. createMarker(getMapIndex(actualMap, phenixData), phenixData);
  568. deleteEmptyPath(phenixData);
  569. } else if (checkMaps(actualMap, phenixData)) {
  570. removeArrow(getMapIndex(actualMap, phenixData), phenixData);
  571. deleteEmptyPath(phenixData);
  572. }
  573. console.clear();
  574. for (let key in phenixData) {
  575. console.log(key + ', map : ' + phenixData[key][0] + ', top : ' + phenixData[key][1] + ', bottom : ' + phenixData[key][5] + ', right : ' + phenixData[key][7] + ', left : ' + phenixData[key][3] + ', havenbag : ' + phenixData[key][9]);
  576. }
  577. } else {
  578. if (!checkMaps(actualMap, pathData)) {
  579. pathData.push([actualMap, false, undefined, false, undefined, false, undefined, false, undefined, false, undefined, false, false]);
  580. createMarker(getMapIndex(actualMap, pathData), pathData);
  581. deleteEmptyPath(pathData);
  582. } else if (checkMaps(actualMap, pathData)) {
  583. removeArrow(getMapIndex(actualMap, pathData), pathData);
  584. deleteEmptyPath(pathData);
  585. }
  586. console.clear();
  587. for (let key in pathData) {
  588. console.log(key + ', map : ' + pathData[key][0] + ', top : ' + pathData[key][1] + ', bottom : ' + pathData[key][5] + ', right : ' + pathData[key][7] + ', left : ' + pathData[key][3] + ', havenbag : ' + pathData[key][9] + ', gather : ' + pathData[key][11] + ', fight : ' + pathData[key][12]);
  589. }
  590. }
  591. }
  592.  
  593. function deleteEmptyPath(array) {
  594. if (!array[getMapIndex(actualMap, array)][1] && !array[getMapIndex(actualMap, array)][3] && !array[getMapIndex(actualMap, array)][5] && !array[getMapIndex(actualMap, array)][7] && !array[getMapIndex(actualMap, array)][9]) {
  595. array.splice(getMapIndex(actualMap, array), 1);
  596. }
  597. }
  598.  
  599. function removeArrow(key, array) {
  600. removeArrowWay(key, array, "pathTop", 2, "top", 1);
  601. removeArrowWay(key, array, "pathLeft", 4, "left", 1, 3);
  602. removeArrowWay(key, array, "pathBottom", 6, "bottom", 5);
  603. removeArrowWay(key, array, "pathRight", 8, "right", 7);
  604. removeArrowWay(key, array, "pathHavenBag", 10, "havenbag", 9);
  605. }
  606.  
  607. function removeArrowWay(key, array, className, wayMarker, iconType, wayToggle) {
  608. if (document.getElementById(className).checked) {
  609. if (array[key][wayMarker] !== undefined) {
  610. array[key][wayToggle] = false;
  611. map.removeLayer(array[key][wayMarker]);
  612. array[key][wayMarker] = undefined;
  613. } else createMarkerWay(key, array, className, wayMarker, iconType, wayToggle);
  614. }
  615. }
  616.  
  617. function createMarker(key, array) {
  618. createMarkerWay(key, array, "pathTop", 2, "top", 1);
  619. createMarkerWay(key, array, "pathLeft", 4, "left", 3);
  620. createMarkerWay(key, array, "pathBottom", 6, "bottom", 5);
  621. createMarkerWay(key, array, "pathRight", 8, "right", 7);
  622. createMarkerWay(key, array, "pathHavenBag", 10, "havenbag", 9);
  623. }
  624.  
  625. function createMarkerWay(key, array, className, wayMarker, iconType, wayToggle) {
  626. if (document.getElementById(className).checked) {
  627. if (document.getElementById("gather").checked) {
  628. if (iconType == "havenbag"){
  629. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  630. interactive: true,
  631. zIndexOffset: 5000,
  632. icon: icon[iconType].gather
  633. }).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length-1][1] + ' | mapID : ' + havenBagData[havenBagData.length-1][2]);
  634. } else {
  635. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  636. interactive: false,
  637. zIndexOffset: 5000,
  638. icon: icon[iconType].gather
  639. }).addTo(map);
  640. }
  641. array[key][11] = true;
  642. } else if (document.getElementById("fight").checked) {
  643. if (iconType == "havenbag"){
  644. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  645. interactive: true,
  646. zIndexOffset: 5000,
  647. icon: icon[iconType].fight
  648. }).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length-1][1] + ' | mapID : ' + havenBagData[havenBagData.length-1][2]);
  649. } else {
  650. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  651. interactive: false,
  652. zIndexOffset: 5000,
  653. icon: icon[iconType].fight
  654.  
  655. }).addTo(map);
  656. }
  657. array[key][12] = true;
  658. } else if (document.getElementById("bank").checked) {
  659. if (iconType == "right" || iconType == "left") {
  660. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1] * 1 + (0.2)), {
  661. interactive: false,
  662. zIndexOffset: 4500,
  663. icon: icon[iconType].bank
  664. }).addTo(map);
  665. } else if (iconType == "top" || iconType == "bottom") {
  666. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0] * 1 + (0.1), actualMap.split(", ")[1]), {
  667. interactive: false,
  668. zIndexOffset: 4500,
  669. icon: icon[iconType].bank
  670. }).addTo(map);
  671. } else if (iconType == "havenbag"){
  672. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  673. interactive: true,
  674. zIndexOffset: 5000,
  675. icon: icon[iconType].bank
  676. }).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length-1][1] + ' | mapID : ' + havenBagData[havenBagData.length-1][2]);
  677. }
  678. array[key][11] = true;
  679. } else if (document.getElementById("phenix").checked) {
  680. if (iconType == "right" || iconType == "left") {
  681. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1] * 1 - (0.2)), {
  682. interactive: false,
  683. zIndexOffset: 4000,
  684. icon: icon[iconType].phoenix
  685. }).addTo(map);
  686. } else if (iconType == "top" || iconType == "bottom") {
  687. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0] * 1 - (0.1), actualMap.split(", ")[1]), {
  688. interactive: false,
  689. zIndexOffset: 4000,
  690. icon: icon[iconType].phoenix
  691. }).addTo(map);
  692. } else if (iconType == "havenbag"){
  693. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  694. interactive: true,
  695. zIndexOffset: 5000,
  696. icon: icon[iconType].phoenix
  697. }).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length-1][1] + ' | mapID : ' + havenBagData[havenBagData.length-1][2]);
  698. }
  699. array[key][11] = true;
  700. } else {
  701. if (iconType == "havenbag"){
  702. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  703. interactive: true,
  704. zIndexOffset: 5000,
  705. icon: icon[iconType].move
  706. }).addTo(map).bindPopup('Téléportation au zaap map : ' + havenBagData[havenBagData.length-1][1] + ' | mapID : ' + havenBagData[havenBagData.length-1][2]);
  707. } else {
  708. array[key][wayMarker] = L.marker(dofusXYToMapXY(actualMap.split(", ")[0], actualMap.split(", ")[1]), {
  709. interactive: false,
  710. zIndexOffset: 5000,
  711. icon: icon[iconType].move
  712. }).addTo(map);
  713. }
  714. }
  715. array[key][wayToggle] = true;
  716. }
  717. }
  718.  
  719. function newRessourcePicker() {
  720. document.getElementById("ressourcePickerBot").innerHTML = '<span id="pickRessource' + picker + '" class="pickRessource ressourceColor1" onclick="clickOnTypePicker(\'' + picker + '\');" data-name="" data-ressourceid=""' +
  721. 'style="background-position: -260px 0px; line-height: 49px !important; width: 49px !important; margin: 2px !important; height: 49px !important;">?</span>' + document.getElementById("ressourcePickerBot").innerHTML;
  722. gatherData.push('pickRessource' + picker);
  723. picker += 1;
  724. document.getElementById("ressourcePickerCreator").addEventListener("click", newRessourcePicker, false);
  725. }
  726.  
  727. function pathGenerator(index, array) {
  728. var path = "";
  729. if (index !== undefined) {
  730. if (array.length !== 0) {
  731. if (array[index][9])
  732. path = "havenbag";
  733. else {
  734. if (array[index][1])
  735. path = "top";
  736. if (array[index][5])
  737. path += (path === "" ? "" : "|") + "bottom";
  738. if (array[index][3])
  739. path += (path === "" ? "" : "|") + "left";
  740. if (array[index][7])
  741. path += (path === "" ? "" : "|") + "right";
  742. }
  743. return path;
  744. }
  745. }
  746. }
  747.  
  748. function afterPhenix(map) {
  749. for (let index = 0; index < pathData.length; index++) {
  750. if (map == pathData[index][0]) {
  751. return index;
  752. }
  753. }
  754. }
  755.  
  756. function gatherFigh(index) {
  757. var path = "";
  758. if (pathData[index][11])
  759. path = ", gather = true";
  760. if (pathData[index][12])
  761. path += ", fight = true";
  762. return path;
  763. }
  764.  
  765. function addGather() {
  766. let res = "";
  767. for (let index = 0; index < gatherData.length; index++) {
  768. let str = document.getElementById(gatherData[index]).outerHTML;
  769. let regex = /data-name=\"(.*?)\"/g;
  770. let matche = regex.exec(str);
  771. for (let i = 0; i < ressources.length; i++) {
  772. if (ressources[i][1] == matche[1]) {
  773. res += '\t' + ressources[i][0] + ',' + ' -- ' + ressources[i][1] + '\r\n';
  774. }
  775. }
  776. }
  777. return res;
  778. }
  779.  
  780. function havenbagCheck(option) {
  781. for (let index = 0; index < havenBagData.length; index++) {
  782. if (havenBagData[index][option]) {
  783. return true;
  784. }
  785. }
  786. return false;
  787. }
  788.  
  789. function generate() {
  790. var firstIf = false;
  791. var txt = "-- Generated On Dofus-Map with Drigtime's SwiftPath Script Maker --\r\n";
  792. txt += "GATHER = {\r\n";
  793. txt += addGather();
  794. txt += "} -- Les éléments à récolter\r\n" +
  795. "OPEN_BAGS = true -- Ouvrir les sacs de ressources au fur et à mesure\r\n" +
  796. "AUTO_DELETE = { } -- Les éléments à supprimer\r\n\r\n" +
  797. "MAX_MONSTERS = 8 -- Le nombre maximum de monstres dans un groupe à combattre.\r\n" +
  798. "MIN_MONSTERS = 1 -- Le nombre minimum de monstres dans un groupe à combattre.\r\n\r\n" +
  799. "FORBIDDEN_MONSTERS = { } -- Monstres interdits\r\n" +
  800. "FORCE_MONSTERS = { } -- Monstres obligatoires\r\n\r\n" +
  801. "MAX_COMBAT = 800 -- Nombre de combats maximum\r\n" +
  802. "\r\nfunction move()\r\n";
  803. if (havenbagCheck(3)) {
  804. txt += "\tif map:onMap(\"0,0\") then\r\n";
  805. firstIf = false;
  806. for (let index = 0; index < havenBagData.length; index++) {
  807. if (havenBagData[index][3]) {
  808. if (!firstIf) {
  809. txt += "\t\tif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  810. firstIf = true;
  811. } else
  812. txt += "\t\telseif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  813. }
  814. }
  815. txt += "\t\tend\r\n" +
  816. "\telse\r\n" +
  817. "\t\tactualMap = map:currentMap()\r\n" +
  818. "\tend\r\n";
  819. }
  820. txt += "\treturn {\r\n" +
  821. "\t\t{map = \"83887104\", path = \"396\"}, --Interieur banque Astrub vers Sortie--\r\n" +
  822. "\t\t{map = \"54534165\", path = \"424\"}, --Interieur banque Frigost vers Sortie--\r\n" +
  823. "\t\t{map = \"2885641\", path = \"424\"}, --Interieur banque Bonta vers Sortie--\r\n" +
  824. "\t\t{map = \"99095051\", path = \"410\"}, --Interieur banque Amakna vers Sortie--\r\n" +
  825. "\t\t{map = \"8912911\", path = \"424\"}, --Interieur banque Brakmar vers Sortie--\r\n" +
  826. "\t\t{map = \"91753985\", path = \"396\"}, --Interieur banque Sufokia vers Sortie (Non fait)--\r\n" +
  827. "\t\t{map = \"86511105\", door = \"452\"}, --Interieur banque Ottomaï vers Sortie--\r\n" +
  828. "\t\t{map = \"8129542\", path = \"409\"}, --Interieur banque Pandala vers Sortie--\r\n" +
  829. "\t\t{map = \"84935175\", path = \"425\"}, --Interieur banque Montagne Koalak vers Sortie--\r\n";
  830. for (let key in pathData) {
  831. txt += '\t\t{map = "' + pathData[key][0].replace(" ", "") + '", path = "' + pathGenerator(key, pathData) + '"' + gatherFigh(key) + '},\r\n';
  832. }
  833. txt += "\t}\r\nend\r\n\r\nfunction bank()\r\n";
  834. if (havenbagCheck(4)) {
  835. txt += "\tif map:onMap(\"0,0\") then\r\n";
  836. firstIf = false;
  837. for (let index = 0; index < havenBagData.length; index++) {
  838. if (havenBagData[index][4]) {
  839. if (!firstIf) {
  840. txt += "\t\tif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  841. firstIf = true;
  842. } else
  843. txt += "\t\telseif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  844. }
  845. }
  846. txt += "\t\tend\r\n" +
  847. "\telse\r\n" +
  848. "\t\tactualMap = map:currentMap()\r\n" +
  849. "\tend\r\n";
  850. }
  851. txt += "\treturn {\r\n";
  852. for (let key in bankData) {
  853. txt += '\t\t{map = "' + bankData[key][0].replace(" ", "") + '", path = "' + pathGenerator(key, bankData) + '"},\r\n';
  854. }
  855. txt += "\t\t{map = \"84674566\", door = \"303\"}, --Devant banque Astrub--\r\n" +
  856. "\t\t{map = \"83887104\", path = \"396\", npcBank = true}, --Banque Astrub--\r\n" +
  857. "\t\t{map = \"54172457\", door = \"358\"}, --Devant banque Frigost--\r\n" +
  858. "\t\t{map = \"54534165\", path = \"424\", npcBank = true}, --Banque Frigost--\r\n" +
  859. "\t\t{map = \"147254\", door = \"383\"}, --Devant banque Bonta--\r\n" +
  860. "\t\t{map = \"2885641\", path = \"424\", npcBank = true}, --Banque Bonta--\r\n" +
  861. "\t\t{map = \"88081177\", door = \"216\"}, --Devant banque Amakna--\r\n" +
  862. "\t\t{map = \"99095051\", path = \"410\", npcBank = true}, --Banque Amakna--\r\n" +
  863. "\t\t{map = \"144931\", door = \"248\"}, --Devant banque Brakmar--\r\n" +
  864. "\t\t{map = \"8912911\", path = \"424\", npcBank = true}, --Banque Brakmar--\r\n" +
  865. "\t\t{map = \"90703872\", door = \"302\"}, --Devant banque Sufokia --\r\n" +
  866. "\t\t{map = \"91753985\", path = \"494\", npcBank = true}, --Banque Sufokia--\r\n" +
  867. "\t\t{map = \"155157\", door = \"355\"}, --Devant banque Ottomaï--\r\n" +
  868. "\t\t{map = \"86511105\", door = \"452\", npcBank = true}, --Banque Ottomaï--\r\n" +
  869. "\t\t{map = \"12580\", door = \"284\"}, --Devant banque Pandala--\r\n" +
  870. "\t\t{map = \"8129542\", path = \"409\", npcBank = true}, --Banque Pandala--\r\n" +
  871. "\t\t{map = \"73400323\", door = \"330\"}, --Devant banque Montagne Koalak--\r\n" +
  872. "\t\t{map = \"84935175\", path = \"425\", npcBank = true}, --Banque Montagne Koalak--\r\n\t}\r\nend\r\n" +
  873. "\r\n\r\nfunction phenix()\r\n";
  874. if (havenbagCheck(5)) {
  875. txt += "\tif map:onMap(\"0,0\") then\r\n";
  876. firstIf = false;
  877. for (let index = 0; index < havenBagData.length; index++) {
  878. if (havenBagData[index][5]) {
  879. if (!firstIf) {
  880. txt += "\t\tif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  881. firstIf = true;
  882. } else
  883. txt += "\t\telseif actualMap == \"" + havenBagData[index][0] + "\" then\r\n\t\t\tmap:changeMap(\"zaap(" + havenBagData[index][2] + ")\")\r\n";
  884. }
  885. }
  886. txt += "\t\tend\r\n" +
  887. "\telse\r\n" +
  888. "\t\tactualMap = map:currentMap()\r\n" +
  889. "\tend\r\n";
  890. }
  891. txt += "\treturn {\r\n";
  892. for (let key in phenixData) {
  893. txt += '\t\t{map = "' + phenixData[key][0].replace(" ", "") + '", path = "' + pathGenerator(key, phenixData) + '"},\r\n';
  894. }
  895. txt += "\t\t{map = \"12,12\", phenix = \"184\", path = \"" + pathGenerator(afterPhenix("12, 12"), pathData) + "\"},\r\n" +
  896. "\t\t{map = \"7,36\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("7, 36"), pathData) + "\"},\r\n" +
  897. "\t\t{map = \"22,22\", phenix = \"272\", path = \"" + pathGenerator(afterPhenix("22, 22"), pathData) + "\"},\r\n" +
  898. "\t\t{map = \"10,19\", phenix = \"192\", path = \"" + pathGenerator(afterPhenix("10, 19"), pathData) + "\"},\r\n" +
  899. "\t\t{map = \"5,1\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("5, 1"), pathData) + "\"},\r\n" +
  900. "\t\t{map = \"2,-1\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("2, -1"), pathData) + "\"},\r\n" +
  901. "\t\t{map = \"13,-7\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("13, -7"), pathData) + "\"},\r\n" +
  902. "\t\t{map = \"5,-9\", phenix = \"116\", path = \"" + pathGenerator(afterPhenix("5, -9"), pathData) + "\"},\r\n" +
  903. "\t\t{map = \"2,-12\", phenix = \"272\", path = \"" + pathGenerator(afterPhenix("2, -12"), pathData) + "\"},\r\n" +
  904. "\t\t{map = \"-6,-12\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-6, -12"), pathData) + "\"},\r\n" +
  905. "\t\t{map = \"36,10\", phenix = \"330\", path = \"" + pathGenerator(afterPhenix("36, 10"), pathData) + "\"},\r\n" +
  906. "\t\t{map = \"25,-4\", phenix = \"450\", path = \"" + pathGenerator(afterPhenix("25, -4"), pathData) + "\"},\r\n" +
  907. "\t\t{map = \"27,-33\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("27, -33"), pathData) + "\"},\r\n" +
  908. "\t\t{map = \"24,-43\", phenix = \"245\", path = \"" + pathGenerator(afterPhenix("24, -43"), pathData) + "\"},\r\n" +
  909. "\t\t{map = \"17,-36\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("17, -36"), pathData) + "\"},\r\n" +
  910. "\t\t{map = \"-13,-29\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-13, -29"), pathData) + "\"},\r\n" +
  911. "\t\t{map = \"-10,-54\", phenix = \"342\", path = \"" + pathGenerator(afterPhenix("-10, -54"), pathData) + "\"},\r\n" +
  912. "\t\t{map = \"-33,-56\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-33, -56"), pathData) + "\"},\r\n" +
  913. "\t\t{map = \"-10,13\", phenix = \"354\", path = \"" + pathGenerator(afterPhenix("-10, 13"), pathData) + "\"},\r\n" +
  914. "\t\t{map = \"-14,31\", phenix = \"243\", path = \"" + pathGenerator(afterPhenix("-14, 31"), pathData) + "\"},\r\n" +
  915. "\t\t{map = \"-26,34\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-26, 34"), pathData) + "\"},\r\n" +
  916. "\t\t{map = \"-26,36\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-26, 36"), pathData) + "\"},\r\n" +
  917. "\t\t{map = \"-55,40\", phenix = \"240\", path = \"" + pathGenerator(afterPhenix("-55, 40"), pathData) + "\"},\r\n" +
  918. "\t\t{map = \"-58,18\", phenix = \"354\", path = \"" + pathGenerator(afterPhenix("-58, 18"), pathData) + "\"},\r\n" +
  919. "\t\t{map = \"-60,-3\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-60, -3"), pathData) + "\"},\r\n" +
  920. "\t\t{map = \"-43,0\", phenix = \"259\", path = \"" + pathGenerator(afterPhenix("-43, 0"), pathData) + "\"},\r\n" +
  921. "\t\t{map = \"-41,-17\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-41, -17"), pathData) + "\"},\r\n" +
  922. "\t\t{map = \"-43,-19\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-43, -19"), pathData) + "\"},\r\n" +
  923. "\t\t{map = \"-53,-40\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-53, -40"), pathData) + "\"},\r\n" +
  924. "\t\t{map = \"-67,-44\", phenix = \"219\", path = \"" + pathGenerator(afterPhenix("-67 ,-44"), pathData) + "\"},\r\n" +
  925. "\t\t{map = \"-60,-79\", phenix = \"0\", path = \"" + pathGenerator(afterPhenix("-60, -79"), pathData) + "\"}\r\n\t}\r\nend\r\n";
  926.  
  927. saveTextAsFile(txt);
  928. }
  929.  
  930. function saveTextAsFile(txt) {
  931. var textToSaveAsBlob = new Blob([txt], {
  932. type: "text/plain"
  933. });
  934. var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
  935. var fileNameToSaveAs;
  936. if (document.getElementById('fileName').value == "") fileNameToSaveAs = "Trajet.lua";
  937. else fileNameToSaveAs = document.getElementById('fileName').value + ".lua";
  938. var downloadLink = document.createElement("a");
  939. downloadLink.download = fileNameToSaveAs;
  940. downloadLink.innerHTML = "Download File";
  941. downloadLink.href = textToSaveAsURL;
  942. downloadLink.style.display = "none";
  943. document.body.appendChild(downloadLink);
  944. downloadLink.click();
  945. }
  946.  
  947. function deletePath() {
  948. for (let index = 0; index < pathData.length; index) {
  949. if (pathData[index][2]) map.removeLayer(pathData[index][2]);
  950. if (pathData[index][4]) map.removeLayer(pathData[index][4]);
  951. if (pathData[index][6]) map.removeLayer(pathData[index][6]);
  952. if (pathData[index][8]) map.removeLayer(pathData[index][8]);
  953. if (pathData[index][10]) map.removeLayer(pathData[index][10]);
  954. pathData.splice(index, 1);
  955. }
  956. for (let index = 0; index < bankData.length; index) {
  957. if (bankData[index][2]) map.removeLayer(bankData[index][2]);
  958. if (bankData[index][4]) map.removeLayer(bankData[index][4]);
  959. if (bankData[index][6]) map.removeLayer(bankData[index][6]);
  960. if (bankData[index][8]) map.removeLayer(bankData[index][8]);
  961. if (bankData[index][10]) map.removeLayer(bankData[index][10]);
  962. bankData.splice(index, 1);
  963. }
  964. for (let index = 0; index < phenixData.length; index) {
  965. if (phenixData[index][2]) map.removeLayer(phenixData[index][2]);
  966. if (phenixData[index][4]) map.removeLayer(phenixData[index][4]);
  967. if (phenixData[index][6]) map.removeLayer(phenixData[index][6]);
  968. if (phenixData[index][8]) map.removeLayer(phenixData[index][8]);
  969. if (phenixData[index][10]) map.removeLayer(phenixData[index][10]);
  970. phenixData.splice(index, 1);
  971. }
  972. console.clear();
  973. }
  974.  
  975. function languageSelector(params) {
  976. switch (params) {
  977. case "fr":
  978. document.getElementById('top').innerHTML = 'Haut';
  979. document.getElementById('bottom').innerHTML = 'Bas';
  980. document.getElementById('left').innerHTML = 'Gauche';
  981. document.getElementById('right').innerHTML = 'Droite';
  982. document.getElementById('havenBag').innerHTML = 'Havre-sac';
  983. document.getElementById('tdgather').innerHTML = 'Récolte';
  984. document.getElementById('tdfight').innerHTML = 'Combat';
  985. document.getElementById('tdbank').innerHTML = 'Banque';
  986. document.getElementById('tdphoenix').innerHTML = 'Phenix';
  987. document.getElementById('tdMove').innerHTML = 'Deplacement';
  988. document.getElementById('restogather').innerText = 'Ressources à récolter :';
  989. document.getElementById('saveFile').innerText = 'Sauvegarder';
  990. document.getElementById('fileName').placeholder = 'Nom du fichier';
  991. document.getElementById('deletePath').innerText = 'Supprimer';
  992. document.getElementById('loadAFile').innerText = 'Charger';
  993. document.getElementById('languageDisplayer').classList.add('flag-icon-fr');
  994. document.getElementById('languageDisplayer').classList.remove('flag-icon-es');
  995. document.getElementById('languageDisplayer').classList.remove('flag-icon-gb');
  996. break;
  997. case "en":
  998. document.getElementById('top').innerHTML = 'Top';
  999. document.getElementById('bottom').innerHTML = 'Bottom';
  1000. document.getElementById('left').innerHTML = 'Left';
  1001. document.getElementById('right').innerHTML = 'Right';
  1002. document.getElementById('havenBag').innerHTML = 'Haven bag';
  1003. document.getElementById('tdgather').innerHTML = 'Gather';
  1004. document.getElementById('tdfight').innerHTML = 'Fight';
  1005. document.getElementById('tdbank').innerHTML = 'Bank';
  1006. document.getElementById('tdphoenix').innerHTML = 'Phoenix';
  1007. document.getElementById('tdMove').innerHTML = 'Move';
  1008. document.getElementById('restogather').innerText = 'Resources to gather :';
  1009. document.getElementById('saveFile').innerText = 'Save';
  1010. document.getElementById('fileName').placeholder = 'Name of the file';
  1011. document.getElementById('deletePath').innerText = 'Delete';
  1012. document.getElementById('loadAFile').innerText = 'Load';
  1013. document.getElementById('languageDisplayer').classList.remove('flag-icon-fr');
  1014. document.getElementById('languageDisplayer').classList.remove('flag-icon-es');
  1015. document.getElementById('languageDisplayer').classList.add('flag-icon-gb');
  1016. break;
  1017. case "es":
  1018. document.getElementById('top').innerHTML = 'Arriba';
  1019. document.getElementById('bottom').innerHTML = 'Abajo';
  1020. document.getElementById('left').innerHTML = 'Izquierda';
  1021. document.getElementById('right').innerHTML = 'Derecho';
  1022. document.getElementById('havenBag').innerHTML = 'Merkasako';
  1023. document.getElementById('tdgather').innerHTML = 'Cosecha';
  1024. document.getElementById('tdfight').innerHTML = 'Lucha';
  1025. document.getElementById('tdbank').innerHTML = 'Banco';
  1026. document.getElementById('tdphoenix').innerHTML = 'Fénix';
  1027. document.getElementById('tdMove').innerHTML = 'Desplazamiento';
  1028. document.getElementById('restogather').innerText = 'Recursos para cosechar :';
  1029. document.getElementById('saveFile').innerText = 'Salvar';
  1030. document.getElementById('fileName').placeholder = 'Nombre del archivo';
  1031. document.getElementById('deletePath').innerText = 'Borrar';
  1032. document.getElementById('loadAFile').innerText = 'Carga';
  1033. document.getElementById('languageDisplayer').classList.remove('flag-icon-fr');
  1034. document.getElementById('languageDisplayer').classList.add('flag-icon-es');
  1035. document.getElementById('languageDisplayer').classList.remove('flag-icon-gb');
  1036. break;
  1037. default:
  1038. document.getElementById('top').innerHTML = 'Haut';
  1039. document.getElementById('bottom').innerHTML = 'Bas';
  1040. document.getElementById('left').innerHTML = 'Gauche';
  1041. document.getElementById('right').innerHTML = 'Droite';
  1042. document.getElementById('tdgather').innerHTML = 'Récolte';
  1043. document.getElementById('tdfight').innerHTML = 'Combat';
  1044. document.getElementById('tdbank').innerHTML = 'Banque';
  1045. document.getElementById('tdphoenix').innerHTML = 'Phenix';
  1046. document.getElementById('tdMove').innerHTML = 'Deplacement';
  1047. document.getElementById('restogather').innerText = 'Ressources à récolter :';
  1048. document.getElementById('saveFile').innerText = 'Sauvegarder';
  1049. document.getElementById('fileName').placeholder = 'Nom du fichier';
  1050. document.getElementById('deletePath').innerText = 'Supprimer';
  1051. document.getElementById('loadAFile').innerText = 'Charger';
  1052. document.getElementById('languageDisplayer').classList.add('flag-icon-fr');
  1053. document.getElementById('languageDisplayer').classList.remove('flag-icon-es');
  1054. document.getElementById('languageDisplayer').classList.remove('flag-icon-gb');
  1055. break;
  1056. }
  1057. }
  1058.  
  1059. document.getElementById('file').onchange = function () {
  1060.  
  1061. var file = this.files[0];
  1062. var content;
  1063. var reader = new FileReader();
  1064. reader.onload = function (progressEvent) {
  1065. // Entire file
  1066. content = this.result;
  1067. let regexPath = /function move\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
  1068. let regexBank = /function bank\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
  1069. let regexPhenix = /function phenix\(\)[\s\S]+?return.*?{\r\n([\s\S]+?)}\r\n.*end/g;
  1070. let result;
  1071. let matche = regexBank.exec(content);
  1072. loadingFile = true;
  1073. document.getElementById("pathTop").checked = false;
  1074. document.getElementById("pathLeft").checked = false;
  1075. document.getElementById("pathBottom").checked = false;
  1076. document.getElementById("pathRight").checked = false;
  1077. document.getElementById("pathHavenBag").checked = false;
  1078. if (matche !== null) {
  1079. result = matche[1];
  1080. result = result.split('\r\n');
  1081. for (let index = 0; index < result.length; index++) {
  1082. matche = /map.?=.?"(.*?)"/g.exec(result[index]);
  1083. if (matche !== null) actualMap = matche[1];
  1084. actualMap = actualMap.replace(/,/g, ", ");
  1085. if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
  1086. matche = /top/g.exec(result[index]);
  1087. if (matche !== null) document.getElementById("pathTop").checked = true;
  1088. matche = /left/g.exec(result[index]);
  1089. if (matche !== null) document.getElementById("pathLeft").checked = true;
  1090. matche = /bottom/g.exec(result[index]);
  1091. if (matche !== null) document.getElementById("pathBottom").checked = true;
  1092. matche = /right/g.exec(result[index]);
  1093. if (matche !== null) document.getElementById("pathRight").checked = true;
  1094. document.getElementById("bank").checked = true;
  1095. onMapClick();
  1096. document.getElementById("pathTop").checked = false;
  1097. document.getElementById("pathLeft").checked = false;
  1098. document.getElementById("pathBottom").checked = false;
  1099. document.getElementById("pathRight").checked = false;
  1100. }
  1101. }
  1102. }
  1103. matche = regexPath.exec(content);
  1104. if (matche !== null) {
  1105. result = matche[1];
  1106. result = result.split('\r\n');
  1107. for (let index = 0; index < result.length; index++) {
  1108. matche = /map.?=.?"(.*?)"/g.exec(result[index]);
  1109. if (matche !== null) actualMap = matche[1];
  1110. actualMap = actualMap.replace(/,/g, ", ");
  1111. if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
  1112. matche = /top/g.exec(result[index]);
  1113. if (matche !== null) document.getElementById("pathTop").checked = true;
  1114. matche = /left/g.exec(result[index]);
  1115. if (matche !== null) document.getElementById("pathLeft").checked = true;
  1116. matche = /bottom/g.exec(result[index]);
  1117. if (matche !== null) document.getElementById("pathBottom").checked = true;
  1118. matche = /right/g.exec(result[index]);
  1119. if (matche !== null) document.getElementById("pathRight").checked = true;
  1120. matche = /gather/g.exec(result[index]);
  1121. if (matche !== null) document.getElementById("gather").checked = true;
  1122. matche = /fight/g.exec(result[index]);
  1123. if (matche !== null) document.getElementById("fight").checked = true;
  1124. onMapClick();
  1125. document.getElementById("pathTop").checked = false;
  1126. document.getElementById("pathLeft").checked = false;
  1127. document.getElementById("pathBottom").checked = false;
  1128. document.getElementById("pathRight").checked = false;
  1129. document.getElementById("gather").checked = false;
  1130. document.getElementById("fight").checked = false;
  1131. }
  1132. }
  1133. }
  1134. matche = regexPhenix.exec(content);
  1135. if (matche !== null) {
  1136. result = matche[1];
  1137. result = result.split('\r\n');
  1138. for (let index = 0; index < result.length; index++) {
  1139. matche = /map.?=.?"(.*?)"/g.exec(result[index]);
  1140. if (matche !== null) actualMap = matche[1];
  1141. actualMap = actualMap.replace(/,/g, ", ");
  1142. if (/(-|)[0-9]+?,\s(-|)[0-9]+?/g.exec(actualMap)) {
  1143. matche = /top/g.exec(result[index]);
  1144. if (matche !== null) document.getElementById("pathTop").checked = true;
  1145. matche = /left/g.exec(result[index]);
  1146. if (matche !== null) document.getElementById("pathLeft").checked = true;
  1147. matche = /bottom/g.exec(result[index]);
  1148. if (matche !== null) document.getElementById("pathBottom").checked = true;
  1149. matche = /right/g.exec(result[index]);
  1150. if (matche !== null) document.getElementById("pathRight").checked = true;
  1151. document.getElementById("phenix").checked = true;
  1152. onMapClick();
  1153. document.getElementById("pathTop").checked = false;
  1154. document.getElementById("pathLeft").checked = false;
  1155. document.getElementById("pathBottom").checked = false;
  1156. document.getElementById("pathRight").checked = false;
  1157. }
  1158. }
  1159. }
  1160. document.getElementById("move").checked = true;
  1161. loadingFile = false;
  1162. };
  1163. reader.readAsText(file);
  1164. };
  1165.  
  1166. function keypressHandler(evt) {
  1167. var keyCode = evt.key;
  1168. switch (keyCode) {
  1169. case "z":
  1170. if (!document.getElementById("pathTop").checked)
  1171. document.getElementById("pathTop").checked = true;
  1172. else
  1173. document.getElementById("pathTop").checked = false;
  1174. break;
  1175. case "q":
  1176. if (!document.getElementById("pathLeft").checked)
  1177. document.getElementById("pathLeft").checked = true;
  1178. else
  1179. document.getElementById("pathLeft").checked = false;
  1180. break;
  1181. case "s":
  1182. if (!document.getElementById("pathBottom").checked)
  1183. document.getElementById("pathBottom").checked = true;
  1184. else
  1185. document.getElementById("pathBottom").checked = false;
  1186. break;
  1187. case "d":
  1188. if (!document.getElementById("pathRight").checked)
  1189. document.getElementById("pathRight").checked = true;
  1190. else
  1191. document.getElementById("pathRight").checked = false;
  1192. break;
  1193. default:
  1194. break;
  1195. }
  1196. }
  1197.  
  1198. setTimeout(function () {
  1199. $('#exampleModal').on('click', '.btn-primary', function () {
  1200. let e = document.getElementById("sel1");
  1201. var objMap = JSON.parse(e.options[e.selectedIndex].value);
  1202. if (document.getElementById('move').checked || document.getElementById('gather').checked || document.getElementById('fight').checked)
  1203. havenBagData.push([actualMap.split(", ")[0] + "," + actualMap.split(", ")[1], objMap.map, objMap.mapid, true, false, false]);
  1204. else if (document.getElementById('bank').checked)
  1205. havenBagData.push([actualMap.split(", ")[0] + "," + actualMap.split(", ")[1], objMap.map, objMap.mapid, false, true, false]);
  1206. else if (document.getElementById('phenix').checked)
  1207. havenBagData.push([actualMap.split(", ")[0] + "," + actualMap.split(", ")[1], objMap.map, objMap.mapid, false, false, true]);
  1208. $('#exampleModal').modal('hide');
  1209. onMapClick();
  1210. });
  1211. }, 0);
  1212.  
  1213. setTimeout(function () {
  1214. $('#exampleModal').on('click', '.btn-secondary', function () {
  1215. havenToggle = false;
  1216. $('#exampleModal').modal('hide');
  1217. });
  1218. }, 0);
  1219.  
  1220. setTimeout(function () {
  1221. $('#exampleModal').on('click', '.close', function () {
  1222. havenToggle = false;
  1223. $('#exampleModal').modal('hide');
  1224. });
  1225. }, 0);
  1226.  
  1227. setTimeout(function () {
  1228. map.on('click', onMapClick);
  1229. }, 0);
  1230.  
  1231. document.addEventListener("keypress", keypressHandler, false);
  1232. document.getElementById("saveFile").addEventListener("click", generate, false);
  1233. document.getElementById("ressourcePickerCreator").addEventListener("click", newRessourcePicker, false);
  1234. document.getElementById("deletePath").addEventListener("click", deletePath, false);
  1235. document.getElementById("fr").addEventListener("click", function () {
  1236. languageSelector("fr");
  1237. }, false);
  1238. document.getElementById("en").addEventListener("click", function () {
  1239. languageSelector("en");
  1240. }, false);
  1241. document.getElementById("es").addEventListener("click", function () {
  1242. languageSelector("es");
  1243. }, false);
  1244. })();