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