Advertisement
Guest User

Margo pogromca z mgła wojny

a guest
Apr 21st, 2019
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 92.33 KB | None | 0 0
  1. //3.3 - naprawiony bug z nieładowaniem postaci gracza po wejściu na nową mapę do momentu zrobienia kroku, dodano "mas/exit-h64c.gif" to listy grafik npc-drzwi, dodano pokazywanie "mgły wojny"
  2. //3.2
  3. //-(SI) ppm na gracza na minimapie -> menu takie jakie by się otworzyło po kliknięciu na mapie
  4. //-kompatybilność z dodatkiem ccarderra pokazującym graczy z innych światów
  5. //-naprawiony bug z grobami
  6. //3.1.9b - nowe respy
  7. //3.1.9 - oczywiście że 3.1.8 coś popsuło :^)
  8. //3.1.8 - uzupełniono elity do questa dziennego na .com
  9. //3.1.7 - czemu każdą aktualizacją coś psuję
  10. //3.1.6 - to coś z cookie __mExts i kompatybilność z jedną rzeczą którą robię (w wersji 2.x była ale zapomniałem robiąc 3.0)
  11. //3.1.5 - wersja na stary silnik xd
  12. //3.1.4 - ciągle coś psuję
  13. //3.1.3 - ._.' warto używać isset
  14. //3.1.2 - zmiany w chodzeniu postaci po kliknięciu punktu na mapie (teraz moze iść gdziekolwiek sie kliknie), optymalizacje dla urządzeń mobilnych (toucheventy mają mniejsze opóźnienie)
  15. //3.1.1 - naprawa głupiego błędu prezez który minimapa psuła grę
  16. //3.1 - pokazywanie qm przy npc na minimapie, poprawione wartości przy których elementy dolnego paska są chowane, licznik instalacji (przez dislike niepublicznego dodatku)
  17. //3.0 - dodatek napisany od nowa
  18. window.miniMapPlus = new (function() {
  19. var interface = (function() {
  20. if (typeof API != "undefined" && typeof Engine != "undefined" && typeof margoStorage == "undefined") {
  21. return "new"; //NI
  22. } else if (typeof dbget == "undefined" && typeof proceed == "undefined") {
  23. return "old"; //SI
  24. } else {
  25. return "superold"; //Stary silnik
  26. };
  27. })();
  28. var self = this;
  29. var masks = ["obj/cos.gif", "mas/nic32x32.gif", "mas/nic64x64.gif"];
  30. var gws = ["mas/exit-ith.gif", "mas/exit-ith1.gif", "mas/exit.gif", "mas/drzwi.gif", "obj/drzwi.gif", "mas/exit-h64c.gif"];
  31. var oldPos = {x: -1, y: -1};
  32. var otherRanks = ["Administrator", "Super Mistrz Gry", "Mistrz Gry", "Moderator Chatu", "Super Moderator Chatu"];
  33. var $map,
  34. $wrapper,
  35. $info,
  36. $search,
  37. $userStyle,
  38. objScale,
  39. objSize,
  40. $chatInput,
  41. $searchTxt;
  42. var search = {
  43. type: "",
  44. data: ""
  45. };
  46. var manualMode = false;
  47. var innerDotKeys = ["friend", "enemy", "clan", "ally"];
  48. this.version = "3.3";
  49.  
  50. var settings = new (function() {
  51. var path = "mmp";
  52. var Storage = interface != "old" ? API.Storage : margoStorage;
  53. this.set = function(p, val) {
  54. Storage.set(path + p, val);
  55. };
  56. this.get = function(p) {
  57. return Storage.get(path + p);
  58. };
  59. this.remove = function(p) {
  60. try {
  61. Storage.remove(path + p);
  62. } catch (e) {};
  63. };
  64. this.exist = function() {
  65. return Storage.get(path) != null;
  66. };
  67. })();
  68.  
  69. var mobileDevice = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || settings.get("/forceMobileMode"));
  70.  
  71. const $visibility = (function() {
  72. let $div = document.createElement("div");
  73. $div.classList.add("mmp-visibility");
  74. return $div;
  75. })();
  76.  
  77. this.initSettings = function() {
  78. if (!settings.exist()) {
  79. this.setDefaultSettings();
  80. } else {
  81. this.fixSettings();
  82. };
  83. };
  84.  
  85. this.fixSettings = function() {
  86. var loaded = settings.get("");
  87. var def = this.getDefaultSettings();
  88. var overwrite = false;
  89. for (var key in def) {
  90. if (!isset(loaded[key])) {
  91. loaded[key] = def[key];
  92. overwrite = true;
  93. };
  94. };
  95. if (overwrite) settings.set("", loaded);
  96. };
  97.  
  98. this.setDefaultSettings = function() {
  99. settings.set("", this.getDefaultSettings());
  100. };
  101.  
  102. this.convertOldSettings = function(json) {
  103. var sett = JSON.parse(json);
  104. sett.darkmode = false;
  105. sett.altmobilebtt = false;
  106. sett.mapsize = 1;
  107. sett.minlvl = parseInt(sett.minlvl);
  108. sett.opacity = 1 - sett.opacity;
  109. if (isNaN(sett.minlvl)) sett.minlvl = 1;
  110. localStorage.removeItem("miniMapPlus");
  111. return sett;
  112. };
  113.  
  114. this.getDefaultSettings = function() {
  115. var oldVersion = localStorage.getItem("miniMapPlus");
  116. if (oldVersion) return this.convertOldSettings(oldVersion);
  117. return {
  118. show: 82,
  119. minlvl: "1",
  120. colors: {
  121. hero: "#FF0000",
  122. other: "#FFFFFF",
  123. friend: "#08ad00",
  124. enemy: "#FF0000",
  125. clan: "#08ad00",
  126. ally: "#9eff91",
  127. npc: "#ddff00",
  128. mob: "#222222",
  129. elite: "#00ffe9",
  130. elite2: "#039689",
  131. elite3: "#007500",
  132. heros: "#c6ba35",
  133. titan: "#809912",
  134. item: "#f56bff",
  135. gw: "#0000FF",
  136. },
  137. trackedNpcs: [],
  138. trackedItems: [],
  139. maxlvl: 13,
  140. mapsize: 1,
  141. opacity: 1,
  142. interpolerate: true,
  143. darkmode: false,
  144. showqm: true,
  145. showevonetwork: true
  146. };
  147. };
  148.  
  149. this.getInstallSource = function() {
  150. if (interface != "old") return "addon";
  151. var panelAddons = getCookie("__mExts");
  152. if (panelAddons == null) return "addon";
  153. var srcs = {
  154. p: "panel dodatków (pub.)",
  155. d: "dev",
  156. v: "panel dodatków"
  157. };
  158. for (var i in srcs) {
  159. if (panelAddons.indexOf(i+"64196") > -1) return srcs[i];
  160. };
  161. return "addon";
  162. };
  163.  
  164. this.initHTML = function() {
  165. $wrapper = document.createElement("div");
  166. $wrapper.classList.add("mmpWrapper");
  167.  
  168. $map = document.createElement("div");
  169. $map.classList.add("mmpMap");
  170. if (!mobileDevice) $map.addEventListener("click", this.goTo);
  171. else $map.addEventListener("touchstart", this.goTo);
  172. $map.addEventListener("contextmenu", this.rclick);
  173.  
  174. var $bottombar = document.createElement("div");
  175. $bottombar.classList.add("mmpBottombar");
  176. $info = document.createElement("span");
  177. $info.innerHTML = "miniMapPlus by <a href='https://www.margonem.pl/?task=profile&id=3779166' target='_blank'>Priweejt</a> |&nbsp;";
  178. $bottombar.appendChild($info);
  179. $searchTxt = document.createElement("span");
  180. $searchTxt.innerHTML = "Szukaj:&nbsp;";
  181. $bottombar.appendChild($searchTxt);
  182. $search = document.createElement("input");
  183. $search.addEventListener("keyup", this.searchBarHandler);
  184. $bottombar.appendChild($search);
  185. var $settings = document.createElement("img");
  186. $settings.src = "http://i.imgur.com/S7FugOv.png";
  187. $settings.classList.add("mmpSettingIcon");
  188. $settings.addEventListener("click", niceSettings.toggle);
  189. $settings.setAttribute(interface == "new" ? "data-tip" : "tip", "Ustawienia");
  190. $bottombar.appendChild($settings);
  191.  
  192. $wrapper.appendChild($map);
  193. $wrapper.appendChild($bottombar);
  194.  
  195. if (interface == "new") document.querySelector(".game-window-positioner").appendChild($wrapper);
  196. else if (interface == "old") document.querySelector("#centerbox2").appendChild($wrapper);
  197. else document.querySelector("body").appendChild($wrapper);
  198.  
  199. this.appendMainStyles();
  200. this.initEventListener();
  201. };
  202.  
  203. this.appendMobileButton = function() {
  204. if (interface == "old" && mobileDevice) {
  205. //przycisk otwierania mapy dla urządzeń mobilnych
  206. var $btt = document.createElement("div");
  207. $btt.innerHTML = "MM+";
  208. $btt.classList.add("mmpMobileButton");
  209. $btt.addEventListener("touchstart", event => {
  210. self.toggleView();
  211. event.preventDefault();
  212. });
  213. document.getElementById("centerbox2").appendChild($btt);
  214. };
  215. };
  216.  
  217. this.initEventListener = function() {
  218. document.addEventListener("keydown", function(e) {
  219. if (e.target.tagName != "INPUT" && e.target.tagName != "TEXTAREA" && e.keyCode == settings.get("/show")) {
  220. self.toggleView();
  221. };
  222. }, false);
  223. };
  224.  
  225. this.appendMainStyles = function() {
  226. var $style = document.createElement("style");
  227. var css = `
  228. .mmpMobileButton {
  229. z-index: 390;
  230. border: 1px solid black;
  231. opacity: 0.7;
  232. background: white;
  233. position: absolute;
  234. top: 240px;
  235. left: -1px;
  236. width: 32px;
  237. height: 32px;
  238. color: gray;
  239. text-align: center;
  240. line-height: 32px;
  241. font-size: 80%;
  242. border-radius: 3px;
  243. border-top-right-radius: 8px;
  244. }
  245. .mmpWrapper {
  246. position: absolute;
  247. z-index: 380;
  248. border: 3px solid black;
  249. border-radius: 5px;
  250. border-bottom-left-radius: 20px;
  251. overflow: hidden;
  252. display: none;
  253. }
  254. .mmpWrapper .mmpMap {
  255. overflow: hidden;
  256. background-size: 100%;
  257. position: relative;
  258. }
  259. .mmpWrapper .mmpBottombar {
  260. height: 19px;
  261. background: #CCCCCC;
  262. border-top: 1px solid black;
  263. color: #232323;
  264. padding-left: 8px;
  265. line-height: 19px;
  266. }
  267. .mmpWrapper .mmpBottombar input {
  268. height: 11px;
  269. width: 130px;
  270. }
  271. .mmpWrapper .mmpBottombar .mmpSettingIcon {
  272. height: 15px;
  273. width: 15px;
  274. float: right;
  275. background: rgba(100,100,100,.8);
  276. border-radius: 5px;
  277. cursor: pointer;
  278. margin-top: 2px;
  279. }
  280. .mmpMapObject {
  281. position: absolute;
  282. }
  283. .mmpMapObject.hidden {
  284. display: none;
  285. }
  286. .mmpMapObject.hiddenBySearch {
  287. display: none;
  288. }
  289. .mmpMapObject .innerDot{
  290. position: absolute;
  291. }
  292. .mmpMapObject.evoNetwork {
  293. opacity: 0.5 !important;
  294. }
  295. .mmp-visibility {
  296. pointer-events: none;
  297. border: 1px solid yellow;
  298. box-sizing: border-box;
  299. }
  300. `;
  301. $style.innerHTML = css;
  302. document.head.appendChild($style);
  303. };
  304.  
  305. this.onSettingsUpdate = function() {
  306. self.appendUserStyles();
  307. self.objectMgr.manageDisplay();
  308. self.resetQtrack();
  309. message("<span style='color:white;'>Zapisano</span>");
  310. };
  311.  
  312. this.appendUserStyles = function() {
  313. if (!$userStyle) {
  314. $userStyle = document.createElement("style");
  315. document.head.appendChild($userStyle);
  316. };
  317. $userStyle.innerHTML = this.generateUserCss();
  318. };
  319.  
  320. this.generateUserCss = function() {
  321. var css = "";
  322. var colors = settings.get("/colors");
  323. for (var name in colors) {
  324. css += this.getSingleCssLine(name, colors[name]);
  325. };
  326. css += ".mmpWrapper { opacity: "+settings.get("/opacity")+"; }\n"
  327. if (settings.get("/interpolerate")) css += ".mmpMapObject { transition: all .5s ease-in-out; }\n";
  328. if (settings.get("/darkmode")) {
  329. css += ".mmpWrapper .mmpBottombar { background: #222222; color: #CCCCCC; }\n";
  330. css += ".mmpWrapper .mmpBottombar input {background: black; border: 1px solid #333333; color: white;}\n";
  331. css += ".mmpWrapper .mmpBottombar a {color: #009c9c;}\n"
  332. css += ".mmpMobileButton {background: #222222; color: #CCCCCC;}\n"
  333. };
  334. if (settings.get("/altmobilebtt")) {
  335. css += ".mmpMobileButton { top: 470px; left: 665px; }\n";
  336. };
  337. if (!settings.get("/showqm")) {
  338. css += ".mmpQM { display: none; }\n";
  339. } else {
  340. css += ".mmpQM { display: block; position: absolute; top: -200%;}\n";
  341. };
  342.  
  343. return css;
  344. };
  345.  
  346. this.getSingleCssLine = function(name, val) {
  347. if (innerDotKeys.indexOf(name) > -1) {
  348. return ".mmpMapObject .innerDot.mmp-"+name+" { background: "+val+";}\n";
  349. } else {
  350. return ".mmpMapObject.mmp-"+name+" { background: "+val+";}\n";
  351. };
  352. };
  353.  
  354. //functionality
  355. this.rclick = function(e) {
  356. if (interface != "old") return; //TODO: support other interfaces
  357. var tar = false
  358. if (e.target.classList.contains("mmp-other")) tar = e.target;
  359. else if (e.target.parentElement.classList.contains("mmp-other")) tar = e.target.parentElement; //for others with innerdot
  360. if (tar) {
  361. var obj = self.objectMgr.getByElem(tar);
  362. if (obj.d.evoNetwork) return;
  363. var id = obj.d.id;
  364. id = id.split("-")[1]; //id = OTHER-rid, where rid = char id of the other player
  365. var $other = document.querySelector("#other"+id);
  366. //hacky solution
  367. var sm = window.showMenu;
  368. var otherMenu = false;
  369. window.showMenu = function(e, menu) {
  370. otherMenu = menu;
  371. window.showMenu = sm;
  372. };
  373. $other.click();
  374. if (otherMenu) {
  375. for (var i in otherMenu) {
  376. //idk it doesn't hide automatically for whatever reason (I mean it does, but only after it has been clicked 2 times)
  377. otherMenu[i][1] += ";hideMenu();";
  378. };
  379. window.showMenu(e, otherMenu, true);
  380. };
  381. e.preventDefault();
  382. };
  383. };
  384.  
  385. this.goTo = function(e) {
  386. if (e.type == "touchstart") {
  387. var offsets = self.getOffsets(e.target);
  388. e.offsetX = e.touches[0].pageX - offsets[0];
  389. e.offsetY = e.touches[0].pageY - offsets[1];
  390. e.stopPropagation();
  391. };
  392.  
  393. var coords = self.getCoordsFromEvent(e);
  394. if (interface == "new") {
  395. Engine.hero.autoGoTo({x: coords.x, y: coords.y});
  396. } else if (interface == "old") {
  397. self.searchPath.call(window.hero, coords.x, coords.y);
  398. } else {
  399. self.oldMargoGoTo(coords.x, coords.y);
  400. };
  401. };
  402.  
  403. this.oldMargoGoTo = function(x, y) {
  404. //window,hero.setMousePos(x*32,y*32);
  405. window.hero.mx = x;
  406. window.hero.my = y;
  407. window.global.movebymouse = true;
  408. this.cancelMouseMovement = true;
  409. };
  410.  
  411. this.getCoordsFromEvent = function(e) {
  412. if (e.target == $map) {
  413. return {
  414. x: Math.round(e.offsetX/(objScale*32)),
  415. y: Math.round(e.offsetY/(objScale*32))
  416. };
  417. } else {
  418. var obj = this.objectMgr.getByElem(e.target);
  419. return {
  420. x: obj.d.x,
  421. y: obj.d.y
  422. };
  423. };
  424. };
  425.  
  426. this.getOffsets = function($el, offs) {
  427. var offsets = offs ? offs : [0,0];
  428. offsets[0] += $el.offsetLeft;
  429. offsets[1] += $el.offsetTop;
  430. if ($el.parentElement != null) {
  431. this.getOffsets($el.parentElement, offsets);
  432. };
  433. return offsets;
  434. };
  435.  
  436. this.searchBarHandler = function(e) {
  437. //keyup event handler
  438. var input = $search.value;
  439. var noSpace = input.replace(/ /g, "");
  440. self.objectMgr.resetSearch();
  441. if (/([0-9]+)-([0-9]+)/.test(noSpace)) {
  442. self.parseRangeSearch(noSpace);
  443. } else if (/([0-9]+),([0-9]+)/.test(noSpace)) {
  444. self.parseCoordSearch(noSpace);
  445. } else {
  446. self.parseStringSearch(input);
  447. };
  448. };
  449. this.parseRangeSearch = function(str) {
  450. var nums = str.split("-");
  451. this.objectMgr.filterByLvl(parseInt(nums[0]), parseInt(nums[1]));
  452. };
  453. this.parseCoordSearch = function(str) {
  454. var coords = str.split(",");
  455. this.objectMgr.createCoordMarker(parseInt(coords[0]), parseInt(coords[1]));
  456. };
  457. this.parseStringSearch = function(str) {
  458. this.objectMgr.filterByString(str);
  459. };
  460.  
  461. this.makeTip = function(data) {
  462. var tip = data.nocenter ? "" : "<center>";
  463. tip += data.txt+"<div style='text-align: center;color: gray'>("+data.x+","+data.y+")</div>";
  464. return tip + (data.nocenter ? "" : "</center>");
  465. };
  466.  
  467. this.toggleView = function() {
  468. $wrapper.style["display"] = $wrapper.style["display"] == "block" ? "none" : "block";
  469. };
  470.  
  471. this.initResponseParser = function() {
  472. if (interface == "new") {
  473. API.priw.emmiter.on("before-game-response", data => {
  474. if (!manualMode) this.parseInput(data);
  475. })
  476. } else if (interface == "old") {
  477. var _parseInput = parseInput;
  478. parseInput = function(data) {
  479. if (!manualMode) self.parseInput(data);
  480. return _parseInput.apply(this, arguments);
  481. };
  482. } else {
  483. API.emmiter.on("response", data => {
  484. if (!manualMode) self.parseInput(self.parseOldMargonemData(data));
  485. })
  486. };
  487. };
  488.  
  489. self.arr2obj = function(arr) {
  490. var ret = {};
  491. for (var i=0; i<arr.length; i++) {
  492. ret[arr[i].id] = arr[i];
  493. };
  494. return ret;
  495. };
  496.  
  497. self.parseOldMargonemData = function(data) {
  498. //data.gw2 = [];
  499. //data.townname = {};
  500. /*if (data.elements) {
  501. if (data.elements.npc) Object.assign(data.npc, this.arr2obj(data.elements.npc));
  502. if (data.elements.other) Object.assign(data.other, this.arr2obj(data.elements.other));
  503. }
  504. if (data.delete) {
  505. if (data.delete.npc) Object.assign(data.npc, this.arr2obj(data.delete.npc));
  506. if (data.delete.other) Object.assign(data.other, this.arr2obj(data.delete.other));
  507. }
  508. if (data.othermove) {
  509. Object.assign(data.other, this.arr2obj(data.othermove));
  510. console.log(data.othermove);
  511. };*/
  512. return data;
  513. };
  514.  
  515. this.enableManualMode = function() { //tryb w którym ignoruje wszystkie dane z silnika gry; na potrzeby mojego dodatku klanowego
  516. manualMode = true;
  517. };
  518. this.disableManualMode = function() {
  519. manualMode = false;
  520. };
  521.  
  522. this.parseInput = function(data) {
  523. for (var i in data) {
  524. if (typeof this.eventHandlers[i] == "function") this.eventHandlers[i](data[i]);
  525. };
  526. if (data.townname) this.eventHandlers.gateways(data.gw2, data.townname);
  527. };
  528.  
  529. this.eventHandlers = {
  530. town: function(town) {
  531. self.loadMap(town);
  532. },
  533. npc: function(npc) {
  534. self.parseNpc(npc);
  535. },
  536. gateways: function(gws, townname) {
  537. self.parseGws(gws, townname);
  538. },
  539. other: function(others) {
  540. self.parseOther(others);
  541. },
  542. item: function(items) {
  543. self.parseItem(items);
  544. },
  545. rip: function(rip) {
  546. self.parseRip(rip);
  547. }
  548. };
  549.  
  550. this.resetQtrack = function() {
  551. qTrack.reset();
  552. var npc = settings.get("/trackedNpcs");
  553. for (var i=0; i<npc.length; i++) {
  554. qTrack.add({
  555. type: "NPC",
  556. name: npc[i]
  557. });
  558. };
  559. var item = settings.get("/trackedItems");
  560. for (i=0; i<item.length; i++) {
  561. qTrack.add({
  562. type: "ITEM",
  563. name: item[i]
  564. });
  565. };
  566. };
  567.  
  568. this.loadMap = function(town) {
  569. if (interface == "superold") town.file = town.img;
  570. this.resetQtrack();
  571. this.objectMgr.deleteAll();
  572. var mapsize = interface == "new" ? 700 : 440;
  573. mapsize = mapsize*settings.get("/mapsize");
  574. if (town.x > town.y) {
  575. var height = Math.floor(town.y/town.x * mapsize);
  576. var width = mapsize;
  577. } else {
  578. var width = Math.floor(town.x/town.y * mapsize);
  579. var height = mapsize;
  580. };
  581. objScale = width/(town.x*32);
  582. objSize = Math.round(objScale*32);
  583.  
  584. var left = 0;
  585. var top = 0;
  586. if (interface != "new") {
  587. top = -30;
  588. left = -144;
  589. };
  590.  
  591. Object.assign($wrapper.style, {
  592. //$map will stretch the $wrapper
  593. //width: width + "px",
  594. //height: (height+20) + "px",
  595. left: "calc(50% - "+(width/2 - left)+"px)",
  596. top: "calc(50% - "+(height/2 - top)+"px)"
  597. });
  598. Object.assign($map.style, {
  599. width: width + "px",
  600. height: height + "px",
  601. });
  602. if (width < 385) $info.style["display"] = "none";
  603. else $info.style["display"] = "inline-block";
  604. if (width < 210) $searchTxt.style["display"] = "none";
  605. else $searchTxt.style["display"] = "inline-block";
  606.  
  607. this.loadMapImg(town.file);
  608. if (interface != "superold") {
  609. this.addSpawnsToMap(herosDB, true, town.name, town.id);
  610. this.addSpawnsToMap(eliteDB, false, town.name, town.id);
  611. };
  612. this.updateVisibility(town.visibility, objScale);
  613. this.updateHero(true);
  614. };
  615.  
  616. this.updateVisibility = function(n, scale) {
  617. if (n) {
  618. let size = (n*2 + 1)*scale*32;
  619. Object.assign($visibility.style, {
  620. width: size + "px",
  621. height: size + "px",
  622. "margin-top": (size/-2) + "px",
  623. "margin-left": (size/-2) + "px",
  624. opacity: 1
  625. });
  626. } else {
  627. $visibility.style.opacity = 0;
  628. }
  629. }
  630.  
  631. this.loadMapImg = function(file) {
  632. $map.style["background-image"] = "";
  633. $map.style["background"] = "#444444";
  634. var miniMapImg = new Image();
  635. if (file.indexOf("http") == -1) {
  636. var mpath = interface == "old" ? g.mpath : "/obrazki/miasta/";
  637. miniMapImg.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + mpath + file;
  638. } else {
  639. miniMapImg.src = file;
  640. };
  641. miniMapImg.onload = function() {
  642. $map.style["background"] = "";
  643. $map.style["background-image"] = "url("+miniMapImg.src+")";
  644. };
  645. };
  646.  
  647. this.parseNpc = function(npcs) {
  648. for (var id in npcs) {
  649. var npc = npcs[id];
  650. if (!npc.del) {
  651. this.addNewNpcToMap(npc, id);
  652. } else {
  653. this.objectMgr.updateObject({
  654. id: "NPC-"+id,
  655. del: 1
  656. });
  657. if (npcTrack[id]) {
  658. qTrack.remove({
  659. type: "NPC",
  660. nick: npcTrack[id].nick
  661. });
  662. delete npcTrack[id];
  663. };
  664. };
  665. };
  666. };
  667. this.addNewNpcToMap = function(npc, id) {
  668. var {type, flash} = this.getNpcType(npc, id);
  669. if (type == undefined) return;
  670. var {tip, ctip} = this.getNpcTip(npc, type, flash);
  671. var data = {
  672. id: "NPC-"+id,
  673. type: type,
  674. flash: flash,
  675. tip: tip,
  676. ctip: ctip,
  677. x: npc.x,
  678. y: npc.y,
  679. qm: npc.qm || (npc.actions && npc.actions & 128)
  680. };
  681. if (type != "npc" && type != "gw" && type != "item") {
  682. data.lvl = npc.lvl;
  683. };
  684. this.objectMgr.updateObject(data)
  685. };
  686. this.getNpcTip = function(npc, type, important) {
  687. var tip = "";
  688. var mask = false;
  689. for (var i=0; i<masks.length; i++) {
  690. if (masks[i].indexOf(npc.icon) > -1) mask = true;
  691. };
  692. if (!mask) tip += "<img src='"+this.npcIconHTML(npc.icon)+"'>";
  693. var ctip = "t_npc";
  694. if (type == "gw") {
  695. ctip = false;
  696. tip = this.makeTip({
  697. txt: npc.nick + "<br>",
  698. x: npc.x,
  699. y: npc.y
  700. })
  701. } else if (type == "item") {
  702. ctip = "t_item";
  703. tip = this.makeTip({
  704. x: npc.x,
  705. y: npc.y,
  706. txt: tip + "<br>" + npc.nick
  707. })
  708. } else {
  709. tip = this.normalNpcTip(npc, type, important, tip);
  710. };
  711. return {
  712. tip: tip,
  713. ctip: ctip
  714. }
  715. };
  716. this.npcIconHTML = function(icon) {
  717. if (icon.indexOf("://") > -1 || icon.indexOf("obrazki/") > -1) return icon; //zapomniałem o kompatybilności z jedną rzeczą którą robię xd
  718. else if (interface == "superold") return "http://oldmargonem.pl/obrazki/npc/"+icon;
  719. else return (interface == "old" ? g.opath : "/obrazki/")+"npc/"+icon;
  720. };
  721. this.oldNpcTip = function(npc, type, eve) {
  722. var icon = npc.icon;
  723. npc.icon = "kappa";
  724. if (type == "elite2" && !eve) {
  725. npc.wt = 30;
  726. };
  727.  
  728. if (!g.tips.npc) newNpc();
  729. var tip = g.tips.npc(npc);
  730.  
  731. if (type == "elite2") {
  732. if (!eve) {
  733. npc.wt = 20;
  734. tip = tip.replace("elita III", "elita II");
  735. } else {
  736. tip = tip.replace("elita", "specjalna elita");
  737. };
  738. };
  739. npc.icon = icon;
  740. return typeof tip == "string" ? tip : "";
  741. };
  742. this.newNpcTip = function(npc, type, eve) {
  743. var nick = "<div><strong>"+npc.nick+"</strong></div>";
  744. switch (type) {
  745. case "titan":
  746. var type = "<i>tytan</i>";
  747. break;
  748. case "heros":
  749. var type = "<i>heros</i>";
  750. break;
  751. case "elite3":
  752. var type = "<i>elita III</i>";
  753. break;
  754. case "elite2":
  755. if (eve) {
  756. var type = "<i>specjalna elita</i>";
  757. } else {
  758. var type = "<i>elita II</i>";
  759. }
  760. break;
  761. case "elite":
  762. var type = "<i>elita</i>";
  763. break;
  764. default:
  765. var type = "";
  766. break;
  767. };
  768. var lvl = npc.lvl ? npc.lvl + " lvl" : "";
  769. var grp = npc.grp ? " grp" : "";
  770. var lvlgrp = "<span>"+lvl+grp+"</span>";
  771. return nick + type + lvlgrp;
  772. };
  773. this.oldMargoNpcTip = function(npc, type, eve) {
  774. var nick = "<b style='color:orange;'>"+npc.nick+"</b>";
  775. switch (type) {
  776. case "titan":
  777. var type = "<i>tytan</i><br>";
  778. break;
  779. case "heros":
  780. var type = "<i>heros</i><br>";
  781. break;
  782. case "elite3":
  783. var type = "<i>elita III</i><br>";
  784. break;
  785. case "elite2":
  786. if (eve) {
  787. var type = "<i>specjalna elita</i><br>";
  788. } else {
  789. var type = "<i>elita II</i><br>";
  790. }
  791. break;
  792. case "elite":
  793. var type = "<i>elita</i><br>";
  794. break;
  795. default:
  796. var type = "";
  797. break;
  798. };
  799. var lvl = npc.lvl ? "Lvl: "+npc.lvl : "";
  800. var grp = npc.grp ? " grp" : "";
  801. var lvlgrp = "<span>"+lvl+grp+"</span>";
  802. return nick + type + lvlgrp;
  803. };
  804. this.normalNpcTip = function(npc, type, important, before) {
  805. if (interface == "old") {
  806. var tip = this.oldNpcTip(npc, type, important).replace("<span ></span><br>", "").replace("<span ></span>", "");
  807. } else if (interface == "new") {
  808. var tip = this.newNpcTip(npc, type, important);
  809. } else {
  810. var tip = this.oldMargoNpcTip(npc, type, important);
  811. };
  812. if (npc.lvl > 0) tip += "<br>";
  813. return this.makeTip({
  814. txt: before+tip,
  815. x: npc.x,
  816. y: npc.y
  817. });
  818. };
  819. var npcTrack = {};
  820. this.addNpcToTrack = function(npc, id, heros) {
  821. npcTrack[id] = npc;
  822. qTrack.add({
  823. type: "NPC",
  824. name: npc.nick
  825. });
  826. if (interface != "superold") this.checkForUnknownResp(npc, heros);
  827. };
  828. this.checkForUnknownResp = function(npc, heros) {
  829. var map = interface == "new" ? Engine.map.d : window.map;
  830. var db = heros ? herosDB : eliteDB;
  831. if (db[npc.nick] && db[npc.nick].spawns) {
  832. var spawns = db[npc.nick].spawns;
  833. if (spawns[map.name] || spawns[map.id]) {
  834. var spawnsOnMap = spawns[map.name] ? spawns[map.name] : spawns[map.id];
  835. if (spawns[map.name]) this.unknownMapId(map.name, map.id, heros);
  836. if (!this.coordsExistInSpawns(spawnsOnMap, npc.x, npc.y)) this.unknownResp(npc, map, heros);
  837. };
  838. };
  839. };
  840. this.coordsExistInSpawns = function(spawns, x, y) {
  841. for (var i=0; i<spawns.length; i++) {
  842. if (spawns[i][0] == x && spawns[i][1] == y) return true;
  843. };
  844. return false;
  845. };
  846. this.unknownResp = function(npc, map, heros) {
  847. var log = interface == "new" ? API.priw.console.log : window.log;
  848. log("<hr>"+(heros ? "Heros" : "Elita")+" znajduje się na respie, który nie jest w bazie danych minimapy.",1);
  849. log("Prosiłbym o zamieszczenie poniższej informacji w <a style='color: gold' href='https://www.margonem.pl/?task=forum&show=posts&id=488564' target='_blank'>tym temacie</a><br><br>miniMap+ - Nieznany resp: "+npc.nick+", "+map.name+"(ID: "+map.id+")("+npc.x+","+npc.y+")<br><hr>");
  850. };
  851. this.unknownMapId = function(name, id, heros) {
  852. var log = interface == "new" ? API.priw.console.log : window.log;
  853. log("<hr>"+"Mapa, na której "+(heros ? "zrespił się heros" : "zrespiła się elita")+", nie jest zapisana w bazie danych po ID.",1);
  854. log("Prosiłbym o zamieszczenie poniższej informacji w <a style='color: gold' href='https://www.margonem.pl/?task=forum&show=posts&id=488564' target='_blank'>tym temacie</a><br><br>miniMap+ - nieznane ID mapy - '"+name+"'="+id+"<br><hr>");
  855. };
  856. this.getNpcType = function(npc, id) {
  857. if (npc.type == 2 || npc.type == 3) {
  858. var flash = false;
  859. if (npc.wt > 99) {
  860. //tytan
  861. var type = "titan";
  862. } else if (npc.wt > 79) {
  863. //heros
  864. var type = "heros";
  865. this.addNpcToTrack(npc, id, true);
  866. flash = true;
  867. } else if (eliteDB[npc.nick]) {
  868. //specjalna elita
  869. var type = "elite2";
  870. this.addNpcToTrack(npc, id, false);
  871. flash = true;
  872. } else if (npc.wt > 29) {
  873. //e3
  874. var type = "elite3";
  875. } else if (npc.wt > 19) {
  876. //e2
  877. var type = "elite2";
  878. } else if (npc.wt > 9) {
  879. //e
  880. var type = "elite";
  881. } else {
  882. //nub
  883. var type = "mob";
  884. };
  885. } else if (npc.type == 0 || npc.type == 5) {
  886. if (gws.indexOf(npc.icon) == -1) {
  887. var type = "npc";
  888. } else {
  889. var type = "gw";
  890. };
  891. } else if (_l() == "en" && npc.type == 7) {
  892. var type = "item";
  893. };
  894. return {
  895. type: type,
  896. flash: flash
  897. };
  898. };
  899.  
  900. this.initHeroUpdating = function() {
  901. if (interface != "new") {
  902. var _run = hero.run;
  903. hero.run = function() {
  904. self.updateHero();
  905. var ret = _run.apply(this, arguments);
  906. if (interface == "superold" && self.cancelMouseMovement) {
  907. self.cancelMouseMovement = false;
  908. window.global.movebymouse = false;
  909. }
  910. return ret;
  911. };
  912. } else if (interface == "new") {
  913. var _draw = Engine.map.draw;
  914. Engine.map.draw = function() {
  915. self.updateHero();
  916. return _draw.apply(this, arguments);
  917. };
  918. };
  919. };
  920.  
  921. this.updateHero = function(ignore) {
  922. qTrack.update();
  923. if (interface == "new") var hero = Engine.hero.d;
  924. else var hero = window.hero;
  925. if (!ignore && oldPos.x == hero.x && oldPos.y == hero.y) return;
  926. this.objectMgr.updateObject({
  927. id: "HERO",
  928. x: hero.x,
  929. y: hero.y,
  930. tip: "Moja postać",
  931. type: "hero",
  932. children: [$visibility]
  933. });
  934. oldPos.x = hero.x;
  935. oldPos.y = hero.y;
  936. };
  937.  
  938. this.parseGws = function(gws, townname) {
  939. for (var i=0; i<gws.length; i+=5) {
  940. var tip = townname[gws[i]];
  941. if (gws[i+3]) {
  942. if (gws[i+3] == 2) {
  943. tip += interface != "superold" ? "<br>("+_t("require_key", null , "gtw")+")" : "<br>(wymaga klucza)";
  944. };
  945. };
  946. if (gws[i+4]) {
  947. var min = (parseInt(gws[i+4]) & 65535);
  948. var max = ((parseInt(gws[i+4]) >> 16) & 65535);
  949. tip += "<br>" + _t("gateway_availavle", null , "gtw");
  950. tip += min ? _t("from_lvl %lvl%", {"%lvl%": min }, "gtw") : "";
  951. tip += max >= 1000 ? "" : _t("to_lvl %lvl%", { "%lvl%": max }, "gtw") + _t("lvl_lvl", null , "gtw");
  952. };
  953. this.objectMgr.updateObject({
  954. tip: this.makeTip({
  955. txt: tip + "<br>",
  956. x: gws[i+1],
  957. y: gws[i+2]
  958. }),
  959. type: "gw",
  960. x: gws[i+1],
  961. y: gws[i+2],
  962. id: "GW-"+gws[i]+"-"+i
  963. });
  964. };
  965. };
  966.  
  967. this.parseOther = function(others) {
  968. for (var id in others) {
  969. var other = others[id];
  970. if (!other.del) {
  971. if ((interface != "new" && !g.other[id]) || (interface == "new" && !Engine.others.getById(id))) {
  972. if (interface != "superold" || other.nick) this.addNewOtherToMap(other, id); //dumb fix
  973. } else {
  974. this.updateOther(other, id);
  975. };
  976. } else {
  977. this.objectMgr.updateObject({
  978. id: "OTHER-"+id,
  979. del: 1
  980. });
  981. };
  982. }
  983. };
  984. this.updateOther = function(other, id) {
  985. var evoNetwork = this.checkIfOtherFromEvoNetwork(id);
  986. var data = {};
  987. var canLoadImgFromCache = !other.icon;
  988. var previousData = interface == "new" ? Engine.others.getById(id).d : g.other[id];
  989. var other = Object.assign({}, previousData, other);
  990. if (isset(other.x)) data.x = other.x;
  991. if (isset(other.y)) data.y = other.y;
  992. var {tip, ctip} = this.getOtherTip(other, evoNetwork);
  993. if (canLoadImgFromCache && this.otherImgCache[id]) {
  994. var img = this.otherImgCache[id];
  995. tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip;
  996. } else {
  997. this.loadOtherImg(other, id, tip);
  998. }
  999. data.tip = tip;
  1000. data.ctip = ctip;
  1001. data.id = "OTHER-"+id;
  1002. this.objectMgr.updateObject(data);
  1003. };
  1004. this.otherImgCache = {};
  1005. this.checkIfOtherFromEvoNetwork = function(id) {
  1006. //rozpoznawanie postaci z innych światów dodawanych przez dodatek ccarederra
  1007. return String(id).split("_")[1] == "wsync";
  1008. };
  1009. this.addNewOtherToMap = function(other, id) {
  1010. var type;
  1011. var evoNetwork = this.checkIfOtherFromEvoNetwork(id);
  1012. if (evoNetwork && !settings.get("/showevonetwork")) return;
  1013. switch (other.relation) {
  1014. case "": //obcy
  1015. type = "other";
  1016. break;
  1017. case "cl-fr": //sojusznik
  1018. case "fr-fr": //fraction friend
  1019. type = "ally";
  1020. break;
  1021. case "cl": //klanowicz
  1022. type = "clan";
  1023. break;
  1024. case "fr": //znajomy
  1025. type = "friend";
  1026. break;
  1027. case "en": //wróg
  1028. case "cl-en": //wrogi klan
  1029. case "fr-en": //fraction enemy
  1030. type = "enemy";
  1031. break;
  1032. default:
  1033. type = "other";
  1034. break;
  1035. };
  1036. if (evoNetwork) type = "evoNetwork";
  1037. var {tip, ctip} = this.getOtherTip(other, evoNetwork);
  1038. this.objectMgr.updateObject({
  1039. tip: tip,
  1040. ctip: ctip,
  1041. type: "other",
  1042. type2: type,
  1043. x: other.x,
  1044. y: other.y,
  1045. id: "OTHER-"+id,
  1046. evoNetwork: evoNetwork,
  1047. click: function() {
  1048. if (evoNetwork) return; //gdy ccarderr zrobi jakieś kanały prywatne w swoim chacie to kliknięcie gracza będzie taki otwierać
  1049. if (interface != "old") {
  1050. $chatInput.value = "@" + other.nick.replace(/ /g, "_") + " ";
  1051. $chatInput.focus();
  1052. if (interface == "superold") {
  1053. //switch from eq to chat
  1054. if (window.chat.style.display == "none") {
  1055. var btt = document.querySelector("#eqbutton");
  1056. btt.click();
  1057. btt.style["background-position"] = "";
  1058. };
  1059. };
  1060. } else if (interface == "old") {
  1061. chatTo(other.nick);
  1062. };
  1063. }
  1064. });
  1065. this.loadOtherImg(other, id, tip);
  1066. };
  1067. this.loadOtherImg = function(other, id, tip) {
  1068. var img = new Image();
  1069. img.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + "/obrazki/postacie/"+other.icon;
  1070. img.onload = function() {
  1071. self.otherImgCache[id] = img;
  1072. tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip;
  1073. self.objectMgr.updateObject({
  1074. tip: tip,
  1075. id: "OTHER-"+id
  1076. });
  1077. };
  1078. }
  1079. this.getOtherTip = function(other, evoNetwork) {
  1080. if (interface == "old") {
  1081. var tip = this.oldOtherTip(other);
  1082. } else if (interface == "new") {
  1083. var tip = this.newOtherTip(other);
  1084. } else {
  1085. var tip = this.oldMargoOtherTip(other);
  1086. };
  1087. if (evoNetwork) {
  1088. tip += "<i>Postać z dodatku World Sync</i>";
  1089. };
  1090. return {
  1091. tip: this.makeTip({
  1092. txt: tip + (evoNetwork ? "" : "<br>"),
  1093. x: other.x,
  1094. y: other.y
  1095. }),
  1096. ctip: "t_other" + (other.relation != "" && interface != "new" ? " t_"+other.relation : "")
  1097. };
  1098. };
  1099. this.oldOtherTip = function(other) {
  1100. if (!g.tips.other) newOther({0:{}});newOther({0:{del:1}});
  1101. var tip = g.tips.other(other);
  1102. return tip.replace(/'/g, "&apos;")
  1103. };
  1104. this.newOtherTip = function(other) {
  1105. //pre-wrapper
  1106. if (other.rights) {
  1107. var rank;
  1108. if (other.rights & 1) rank = 0;
  1109. else if (other.rights & 16) rank = 1;
  1110. else if (other.rights & 2) rank = 2;
  1111. else if (other.rights & 4) rank = 4;
  1112. else rank = 3;
  1113. rank = "<div class='rank'>"+otherRanks[rank]+"</div>";
  1114. } else {
  1115. var rank = "";
  1116. };
  1117. var guest = isset(other.guest) ? "<div class='rank'>Zastępca</div>" : "";
  1118. var preWrapper = rank + guest;
  1119. //wrapper
  1120. var nick = "<div class='nick'>" + other.nick + "</div>";
  1121. var prof = "<div class='profs-icon "+other.prof+"'></div>";
  1122. var bless = isset(other.ble) ? "<div class='bless'></div>" : "";
  1123. var infoWrapper = "<div class='info-wrapper'>" + nick + bless + prof + "</div>";
  1124. //post-wrapper
  1125. var wanted = isset(other.wanted) ? "<div class='wanted'></div>" : "";
  1126. var clan = (isset(other.clan) && other.clan.name != "") ? "<div class='clan-in-tip'>"+other.clan.name+"</div><div class='line'></div>" : "";
  1127. var lvl = isset(other.lvl) ? "<div class='lvl'>"+other.lvl+" lvl</div>" : "";
  1128. var mute = (other.attr & 1) ? "<div class='mute'></div>" : "";
  1129. var postWrapper = wanted + clan + lvl + mute;
  1130.  
  1131. return preWrapper + infoWrapper + postWrapper;
  1132. };
  1133. this.oldMargoOtherTip = function(other) {
  1134. var tip = "<b style='color:yellow'>"+other.nick+"</b>";
  1135. if (other.clan) tip += "<span style='color:#fd9;'>["+g.clanname[other.clan]+"]</span><br>";
  1136. tip += "Lvl: "+other.lvl+other.prof;
  1137. return tip;
  1138.  
  1139. };
  1140.  
  1141. this.parseItem = function(items) {
  1142. for (var id in items) {
  1143. var item = items[id];
  1144. if (item.loc == "m") {
  1145. this.addNewItemToMap(item, id);
  1146. } else {
  1147. var previousData = interface == "new" ? Engine.items.getItemById(id) : g.item[id];
  1148. if (interface == "new" && previousData) previousData = previousData.d;
  1149. if (previousData && previousData.loc == "m") {
  1150. this.objectMgr.updateObject({
  1151. id: "ITEM-"+id,
  1152. del: 1
  1153. });
  1154. };
  1155. }
  1156. }
  1157. };
  1158. this.addNewItemToMap = function(item, id) {
  1159. var tip = this.getItemTip(item);
  1160. this.objectMgr.updateObject({
  1161. id: "ITEM-"+id,
  1162. tip: tip,
  1163. ctip: "t_item",
  1164. x: item.x,
  1165. y: item.y,
  1166. type: "item"
  1167. });
  1168. };
  1169. this.oldMargoItemTip = function(item) {
  1170. return "<b>"+item.name+"</b>"+item.stats;
  1171. };
  1172. this.getItemTip = function(item) {
  1173. var nocenter = true;
  1174. var tip = interface == "new" ? MargoTipsParser.getTip(item) : (interface == "old" ? itemTip(item) : this.oldMargoItemTip(item));
  1175. if (interface == "old" && tip.indexOf("tip-section") == -1) { //kompatybilność z moim dodatkiem na nowe tipy
  1176. tip = "<img src='"+(interface == "superold" ? "http://oldmargonem.pl" : "") +"/obrazki/itemy/"+item.icon+"'>" + tip;
  1177. nocenter = false;
  1178. };
  1179. return this.makeTip({
  1180. txt: tip,
  1181. x: item.x,
  1182. y: item.y,
  1183. nocenter: nocenter
  1184. });
  1185. };
  1186. var ripCount = 0;
  1187. this.parseRip = function(rips) {
  1188. for (var i=0; i<rips.length; i+=8) {
  1189. this.addNewRipToMap({
  1190. nick: rips[i],
  1191. lvl: rips[i+1],
  1192. prof: rips[i+2],
  1193. x: parseInt(rips[i+3]),
  1194. y: parseInt(rips[i+4]),
  1195. ts: parseInt(rips[i+5]),
  1196. desc1: rips[i+6],
  1197. desc2: rips[i+7]
  1198. });
  1199. ripCount++;
  1200. };
  1201. };
  1202. this.addNewRipToMap = function(rip) {
  1203. var isHerosRip = false;
  1204. var timeToDisappear = 300 + rip.ts - unix_time();
  1205. if (timeToDisappear <= 0) return;
  1206. var tip = "<b>" + _t("rip_prefix") + " " + htmlspecialchars(rip.nick) + "</b>Lvl: " + rip.lvl + rip.prof + "<i>" + htmlspecialchars(rip.desc1) + "</i><i>" + htmlspecialchars(rip.desc2) + "</i>";
  1207. this.objectMgr.updateObject({
  1208. tip: this.makeTip({
  1209. txt: tip,
  1210. x: rip.x,
  1211. y: rip.y
  1212. }),
  1213. type: "other",
  1214. x: rip.x,
  1215. y: rip.y,
  1216. circle: true,
  1217. border: true,
  1218. id: "RIP-"+ripCount,
  1219. ctip: "t_rip"
  1220. });
  1221. var id = "RIP-"+ripCount;
  1222. var nick;
  1223. if (nick = this.checkHerosRip(rip.desc1)) {
  1224. qTrack.add({type: "COORDS", name: "Grób gracza zabitego przez herosa "+nick+"<br>Możliwe, że heros tam stoi!", coords: [rip.x, rip.y] });
  1225. isHerosRip = true;
  1226. message("Na mapie znajduje się grób gracza zabitego przez herosa "+nick);
  1227. };
  1228. setTimeout(() => {
  1229. self.objectMgr.updateObject({
  1230. id: id,
  1231. del: 1
  1232. });
  1233. if (isHerosRip) qTrack.remove({type: "COORDS", name: "Grób gracza zabitego przez herosa "+nick+"<br>Możliwe, że heros tam stoi!"});
  1234. }, timeToDisappear*1000);
  1235. };
  1236. this.checkHerosRip = function(desc) {
  1237. for (var nick in herosDB) {
  1238. var needle = nick + "(" + herosDB[nick].lvl + herosDB[nick].prof + ")";
  1239. if (desc.indexOf(needle) > -1) {
  1240. return nick;
  1241. };
  1242. };
  1243. return false;
  1244. };
  1245.  
  1246. this.objectMgr = new (function() {
  1247. var self = this;
  1248. var mgr = this;
  1249. var objs = {};
  1250. var flashables = [];
  1251. function MapObject(data) {
  1252. var self = this;
  1253. this.d = data;
  1254. var currentColor = settings.get("/colors")[this.d.type];
  1255.  
  1256. this.initHTML = function() {
  1257. this.$ = document.createElement("div");
  1258. this.$.classList.add("mmpMapObject", "mmp-"+data.type);
  1259. if (innerDotKeys.indexOf(data.type2) != -1) {
  1260. var $dot = document.createElement("div");
  1261. $dot.classList.add("innerDot", "mmp-"+data.type2);
  1262. Object.assign($dot.style, {
  1263. left: objSize/4 + "px",
  1264. top: objSize/4 + "px",
  1265. width: objSize/2 + "px",
  1266. height: objSize/2 + "px"
  1267. });
  1268. this.$.appendChild($dot);
  1269. } else if (data.type2 == "evoNetwork") {
  1270. this.$.classList.add("evoNetwork");
  1271. };
  1272. if (data.children) {
  1273. // append extra children to the object
  1274. for (let i=0; i<data.children.length; i++) {
  1275. this.$.appendChild(data.children[i]);
  1276. }
  1277. }
  1278. var left = data.x * objScale * 32;
  1279. var top = data.y * objScale * 32;
  1280. Object.assign(this.$.style, {
  1281. top: top + "px",
  1282. left: left + "px",
  1283. width: objSize + "px",
  1284. height: objSize + "px",
  1285. opacity: "0"
  1286. });
  1287. setTimeout(() => this.$.style.opacity = "1.0", 1);
  1288. if (interface != "new") {
  1289. this.$.setAttribute("tip", data.tip);
  1290. if (data.ctip) this.$.setAttribute("ctip", data.ctip);
  1291. } else {
  1292. this.$.setAttribute("data-tip", data.tip);
  1293. if (data.ctip) this.$.setAttribute("data-tip-type", data.ctip);
  1294. };
  1295. if (data.circle) {
  1296. this.$.style["border-radius"] = objScale*18 + "px";
  1297. };
  1298. if (data.border) {
  1299. this.$.style["border"] = "1px solid black";
  1300. };
  1301. if (data.qm) {
  1302. this.$.innerHTML = "<img class='mmpQM' width='"+objSize+"' height='"+objSize*2+"' src='http://jaruna.margonem.pl/img/quest-mark.gif'>";
  1303. };
  1304. $map.appendChild(this.$);
  1305. };
  1306.  
  1307. this.invertColor = function() {
  1308. var c = currentColor;
  1309. var c1 = (255 - parseInt("0x"+c.substring(1,3))).toString(16);
  1310. var c2 = (255 - parseInt("0x"+c.substring(3,5))).toString(16);
  1311. var c3 = (255 - parseInt("0x"+c.substring(5,7))).toString(16);
  1312. if (c1.length < 2) c1 = "0" + c1;
  1313. if (c2.length < 2) c2 = "0" + c2;
  1314. if (c3.length < 2) c3 = "0" + c3;
  1315. currentColor = "#"+c1+c2+c3;
  1316. this.$.style.background = currentColor;
  1317. };
  1318.  
  1319. this.remove = function() {
  1320. if (this.d.flash) flashables.splice(flashables.indexOf(this), 1);
  1321. this.$.style["opacity"] = "0";
  1322. if (settings.get("/interpolerate")) setTimeout(() => this.$.remove(), 500);
  1323. else this.$.remove();
  1324. };
  1325.  
  1326. this.update = function(data) {
  1327. Object.assign(this.d, data);
  1328. if (data.x) {
  1329. this.$.style["left"] = data.x * objScale * 32 + "px";
  1330. };
  1331. if (data.y) {
  1332. this.$.style["top"] = data.y * objScale * 32 + "px";
  1333. };
  1334. if (data.tip) {
  1335. this.$.setAttribute(interface == "new" ? "data-tip" : "tip", data.tip);
  1336. };
  1337. if (data.invertColor) {
  1338. this.invertColor();
  1339. };
  1340. };
  1341.  
  1342. this.initEventListener = function() {
  1343. if (data.click) {
  1344. var type = mobileDevice ? "touchstart" : "click";
  1345. this.$.addEventListener(type, e => {
  1346. data.click(e);
  1347. e.stopPropagation();
  1348. });
  1349. };// else {
  1350. //this.$.addEventListener("click", this.goTo);
  1351. //}
  1352. };
  1353.  
  1354. //this.goTo = function() {
  1355. // if (newInterface) {
  1356. // Engine.hero.autoGoTo({x :self.d.x, y: self.d.y});
  1357. // } else {
  1358. // self.searchPath.call(window.hero, self.d.x, self.d.y);
  1359. // };
  1360. //};
  1361.  
  1362. this.manageDisplay = function() {
  1363. if (!this.d.flash && isset(this.d.lvl) && this.d.lvl < settings.get("/minlvl")) {
  1364. this.$.classList.add("hidden");
  1365. } else {
  1366. this.$.classList.remove("hidden");
  1367. };
  1368. };
  1369.  
  1370. this.checkStringSearch = function(str) {
  1371. if (this.d.tip.toLowerCase().indexOf(str) == -1 && this.d.type != "hero") {
  1372. this.$.classList.add("hiddenBySearch");
  1373. };
  1374. };
  1375.  
  1376. this.checkRangeSearch = function(n1, n2) {
  1377. if (isset(this.d.lvl)) {
  1378. if (this.d.lvl < n1 || this.d.lvl > n2) {
  1379. this.$.classList.add("hiddenBySearch");
  1380. };
  1381. };
  1382. };
  1383.  
  1384. this.manageFilters = function() {
  1385. if (search.type == "string" && search.data != "") {
  1386. this.checkStringSearch(search.data);
  1387. } else if (search.type == "lvl") {
  1388. this.checkRangeSearch(search.data[0], search.data[1]);
  1389. };
  1390. };
  1391.  
  1392. this.init = function() {
  1393. if (data.flash) flashables.push(this);
  1394. this.initHTML();
  1395. this.initEventListener();
  1396. this.manageDisplay();
  1397. this.manageFilters();
  1398. };
  1399. this.init();
  1400. };
  1401. this.getByElem = function($el) {
  1402. for (var i in objs) {
  1403. if (objs[i].$ == $el) return objs[i];
  1404. };
  1405. };
  1406. this.deleteAll = function() {
  1407. for (var i in objs) {
  1408. objs[i].remove();
  1409. delete objs[i];
  1410. };
  1411. };
  1412. this.updateObject = function(data) {
  1413. if (!objs[data.id] && !data.del) {
  1414. if (!data.dontCreate) objs[data.id] = new MapObject(data);
  1415. } else if (data.del) {
  1416. if (objs[data.id]) {
  1417. objs[data.id].remove();
  1418. delete objs[data.id];
  1419. };
  1420. } else {
  1421. objs[data.id].update(data);
  1422. }
  1423. };
  1424. this.resetSearch = function() {
  1425. this.removeCoordMarker();
  1426. for (var id in objs) {
  1427. objs[id].$.classList.remove("hiddenBySearch");
  1428. };
  1429. };
  1430. this.filterByLvl = function(n1, n2) {
  1431. search.type = "lvl",
  1432. search.data = [n1, n2];
  1433. for (var id in objs) {
  1434. objs[id].checkRangeSearch(n1, n2);
  1435. };
  1436. };
  1437. this.filterByString = function(str) {
  1438. str = str.toLowerCase();
  1439. search.type = "string",
  1440. search.data = str;
  1441. for (var id in objs) {
  1442. objs[id].checkStringSearch(str);
  1443. };
  1444. };
  1445. this.removeCoordMarker = function() {
  1446. this.updateObject({
  1447. id: "COORDS",
  1448. del: 1
  1449. });
  1450. };
  1451. this.createCoordMarker = function(x, y) {
  1452. this.updateObject({
  1453. id: "COORDS",
  1454. x: x,
  1455. y: y,
  1456. tip: "koordy "+x+","+y,
  1457. circle: true,
  1458. type: "hero",
  1459. flash: true
  1460. })
  1461. };
  1462. this.manageDisplay = function() {
  1463. for (var id in objs) {
  1464. objs[id].manageDisplay();
  1465. };
  1466. };
  1467. this.invertFlashables = function() {
  1468. for (var i=0; i<flashables.length; i++) {
  1469. flashables[i].update({
  1470. invertColor: true
  1471. });
  1472. };
  1473. };
  1474. setInterval(this.invertFlashables, 500);
  1475. })();
  1476.  
  1477. this.addSpawnsToMap = function(db, heros, map, mapId) {
  1478. map = map.toLowerCase();
  1479. var maxlvl = settings.get("/maxlvl");
  1480. var hero = interface == "new" ? Engine.hero.d : window.hero;
  1481. for (var i in db) {
  1482. var mob = db[i];
  1483. if (mob.ver && mob.ver != _l()) continue;
  1484. var minlvl = Math.max(mob.lvl/2, mob.lvl-50);
  1485. if ((maxlvl+mob.lvl >= hero.lvl && minlvl <= hero.lvl) || mob.lvl >= 242 || mob.lvl == -1) {
  1486. for (var loc in mob.spawns) {
  1487. if (loc.toLowerCase() == map || loc == mapId) {
  1488. var spawns = mob.spawns[loc];
  1489. for (var j=0; j<spawns.length; j++) {
  1490. var x = spawns[j][0];
  1491. var y = spawns[j][1];
  1492. this.objectMgr.updateObject({
  1493. id: "SPAWN-"+i+"-"+j,
  1494. tip: this.makeTip({
  1495. txt: "Resp " + (heros ? "herosa " : "elity ") + i,
  1496. x: x,
  1497. y: y
  1498. }),
  1499. x: x,
  1500. y: y,
  1501. type: heros ? "heros" : "elite2",
  1502. circle: true
  1503. });
  1504. };
  1505. };
  1506. };
  1507. };
  1508. };
  1509. };
  1510.  
  1511. this.init = function() {
  1512. this.initSettings();
  1513. this.initHTML();
  1514. this.appendUserStyles();
  1515. this.initResponseParser();
  1516. this.initHeroUpdating();
  1517. this.appendMobileButton();
  1518. this.installationCounter.count();
  1519. if (interface == "old") this.searchPath = function(a,t){if(this.isBlockedSearchPath())return this.blockedInfoSearchPath();for(var h=[],i=128&hero.opt?8:20,r=Math.max(0,Math.min(a,this.x)-i),s=Math.min(map.x-1,Math.max(a,this.x)+i),o=Math.max(0,Math.min(t,this.y)-i),e=Math.min(map.y-1,Math.max(t,this.y)+i),d=r-1;s+1>=d;d++){h[d]=[];for(var x=o-1;e+1>=x;x++)h[d][x]=!(d>=r&&s>=d&&x>=o&&e>=x)||isset(g.npccol[d+256*x])||map.col&&"0"!=map.col.charAt(d+x*map.x)?-2:-1}h[this.x][this.y]=0,b=-1,road=[];for(var c={x:-1,y:-1,dist:99},y=1;s-r+e-o+3>y;y++)for(var d=r;s>=d;d++)for(var x=o;e>=x;x++){if(-1!=h[d][x]||h[d][x-1]!=y-1&&h[d][x+1]!=y-1&&h[d-1][x]!=y-1&&h[d+1][x]!=y-1||(h[d][x]=y),h[a][t]>0){d=s+1;break}c.dist2=Math.abs(a-d)+Math.abs(t-x),h[d][x]==y&&c.dist2<c.dist&&(c.x=d,c.y=x,c.dist=c.dist2)}if(c.hdist=Math.abs(a-hero.x)+Math.abs(t-hero.y),h[a][t]>0||c.dist<c.hdist){h[a][t]<0&&(a>c.x?b=2:a<c.x?b=1:t>c.y?b=0:t<c.y&&(b=3),a=c.x,t=c.y),road[0]={x:a,y:t};for(var f=h[a][t]-1,l=a,m=t;f>0;f--)h[l][m-1]==f?m--:h[l][m+1]==f?m++:h[l-1][m]==f?l--:h[l+1][m]==f?l++:f=0,f&&(road[h[a][t]-f]={x:l,y:m})}road.length>1&&null==g.playerCatcher.follow&&$("#target").stop().css({left:32*a,top:32*t,display:"block",opacity:1}).fadeOut(1e3)};
  1520. $chatInput = interface == "new" ? document.querySelector("[data-section='chat'] .input-wrapper input") : (interface == "superold" ? document.querySelector("#chatIn") : null);
  1521. };
  1522.  
  1523. //questtrack (fuzja kodu z wersji minimapy na SI i NI więc wygląda jak wygląda)
  1524. var qTrack = new (function() {
  1525. var self = this;
  1526. var hero = interface == "new" ? Engine.hero : window.hero;
  1527. var $hero = interface == "old" ? $("#hero") : (interface == "superold" ? document.querySelector("#oHero") : null);
  1528. var $canvas = interface == "new" ? $("#GAME_CANVAS") : null;
  1529. if (interface == "new") {
  1530. this.npcs = {};
  1531. API.addCallbackToEvent("newNpc", function(npc) {
  1532. if (npc) self.npcs[npc.d.id] = npc.d;
  1533. });
  1534. API.addCallbackToEvent("removeNpc", function(npc) {
  1535. if (npc) delete self.npcs[npc.d.id];
  1536. });
  1537. };
  1538. this.getOldMargoHeroPos = function() {
  1539. return {
  1540. left: $hero.offsetLeft,
  1541. top: $hero.offsetTop
  1542. };
  1543. };
  1544. this.getHeroPos = function() {
  1545. if (interface == "old") return $hero.position();
  1546. if (interface == "superold") return this.getOldMargoHeroPos();
  1547. if (!Engine.map.size) return {x: 0, y: 0};
  1548. var tilesX = $canvas.width()/32;
  1549. var tilesY = $canvas.height()/32;
  1550. var pos = {
  1551. x: Engine.hero.rx,
  1552. y: Engine.hero.ry
  1553. };
  1554. var actualPos = {};
  1555. if (pos.x < tilesX/2) {
  1556. actualPos.x = pos.x*32;
  1557. } else if (Engine.map.size.x - pos.x < tilesX/2) {
  1558. actualPos.x = (pos.x - (Engine.map.size.x - tilesX/2) + tilesX/2)*32;
  1559. } else {
  1560. actualPos.x = (tilesX/2)*32;
  1561. };
  1562. if (pos.y < tilesY/2) {
  1563. actualPos.y = pos.y*32;
  1564. } else if (Engine.map.size.y - pos.y < tilesY/2) {
  1565. actualPos.y = (pos.y - (Engine.map.size.y - tilesY/2) + tilesY/2)*32;
  1566. } else {
  1567. actualPos.y = (tilesY/2)*32;
  1568. };
  1569. var canvasOffset = $canvas.offset();
  1570. return {
  1571. left: actualPos.x + canvasOffset.left,
  1572. top: actualPos.y + canvasOffset.top
  1573. };
  1574. };
  1575. this.update = function() {
  1576. for (var i=0; i<this.arrows.length; i++) {
  1577. this.drawArrow(this.arrows[i]);
  1578. };
  1579. };
  1580. this.drawArrow = function(objective) {
  1581. if (objective.type == "NPC") {
  1582. var nameKey = "nick";
  1583. var obj = interface == "new" ? this.npcs : g.npc;
  1584. var item = false;
  1585. } else if (objective.type == "ITEM") { //item
  1586. var nameKey = "name";
  1587. if (interface == "new") {
  1588. var itemArr = Engine.items.fetchLocationItems("m");
  1589. var obj = {};
  1590. for (var i in itemArr) {
  1591. var it = itemArr[i];
  1592. if (it.id) obj[it.id] = it;
  1593. else obj[it.hid] = it;
  1594. };
  1595. } else {
  1596. var obj = g.item;
  1597. };
  1598. var item = true;
  1599. } else if (objective.type == "COORDS") { //coords
  1600. var coords = objective.coords;
  1601. var size = [32, 32];
  1602. var x = Math.abs(hero.rx-coords[0]);
  1603. var y = Math.abs(hero.ry-coords[1]);
  1604. var closest = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
  1605. };
  1606. if (objective.type != "COORDS") {
  1607. var closest = Infinity;
  1608. var coords = false;
  1609. var size = false;
  1610. for (var i in obj) {
  1611. var entity = obj[i];
  1612. if (entity[nameKey] == objective.name && (!item || entity.loc == "m")) {
  1613. var x = Math.abs(hero.rx-entity.x);
  1614. var y = Math.abs(hero.ry-entity.y);
  1615. var dist = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
  1616. if (dist < closest) {
  1617. closest = dist;
  1618. coords = [entity.x, entity.y];
  1619. size = item ? [32,32] : [entity.fw, entity.fh];
  1620. };
  1621. };
  1622. };
  1623. };
  1624. if (coords) {
  1625. var cos = (coords[0] - hero.rx)/closest;
  1626. var sin = (coords[1] - hero.ry)/closest;
  1627. var heropos = this.getHeroPos();
  1628. var top = 150*sin;
  1629. var left = 150*cos;
  1630. var opacity = 1;
  1631. if (closest < 9) {
  1632. top = top*Math.pow(closest/9, 1.8);
  1633. left = left*Math.pow(closest/9, 1.8);
  1634. opacity = Math.pow(closest/9, 2.1);
  1635. };
  1636. if (interface != "new") top+=20;
  1637. left+= interface == "new" ? -12 : 4;
  1638. if ((cos >= 0 && sin >= 0) || (cos >= 0 && sin <= 0)) {
  1639. var angle = Math.asin(sin) * 180 / Math.PI;
  1640. } else {
  1641. var angle = 180+Math.asin(0-sin) * 180 / Math.PI;
  1642. };
  1643. objective.$.css({
  1644. top: top + heropos.top,
  1645. left: left + heropos.left,
  1646. display: opacity > 0.09 ? "block" : "none",
  1647. "-ms-transform": "rotate("+angle+"deg)",
  1648. "-webkit-transform": "rotate("+angle+"deg)",
  1649. transform: "rotate("+angle+"deg)",
  1650. opacity: opacity
  1651. });
  1652. if (interface == "old") {
  1653. objective.$highlight.css({
  1654. left: coords[0]*32 - 11,
  1655. top: coords[1]*32 + 14,
  1656. display: "block",
  1657. opacity: 1-opacity
  1658. });
  1659. };
  1660. } else {
  1661. objective.$.hide();
  1662. if (interface == "old") objective.$highlight.hide();
  1663. };
  1664. };
  1665. this.arrows = [];
  1666. this.add = function(objective) {
  1667. for (var i in this.arrows) {
  1668. if (objective.type == this.arrows[i].type && objective.name == this.arrows[i].name) return;
  1669. };
  1670. objective.$ = this.arrowTemplate.clone().appendTo(interface == "old" ? "#centerbox" : (interface == "new" ? ".game-window-positioner" : "#oMap"));
  1671. objective.$.attr(interface == "new" ? "data-tip" : "tip", objective.name);
  1672. if (interface == "old") objective.$highlight = this.highlightTemplate.clone().appendTo(interface == "old" ? "#ground" : "#oMap");
  1673. objective.index = this.arrows.push(objective) -1;
  1674. objective.remove = function() {
  1675. self.arrows.splice(this.index, 1);
  1676. for (var i=this.index; i<self.arrows.length; i++) {
  1677. self.arrows[i].index--;
  1678. };
  1679. this.$.remove();
  1680. if (interface == "old") this.$highlight.remove();
  1681. };
  1682. this.update();
  1683. };
  1684. this.remove = function(objective) {
  1685. for (var i=0; i<this.arrows.length; i++) {
  1686. if (this.arrows[i].name == objective.name && this.arrows[i].type == objective.type) this.arrows[i].remove();
  1687. };
  1688. };
  1689. this.reset = function() {
  1690. while (this.arrows.length) {
  1691. this.arrows[0].remove();
  1692. };
  1693. };
  1694. this.arrowTemplate = $("<div>").css({
  1695. background: "url(http://priweejt.ct8.pl/addons/img/qt-arrow-red.gif)",
  1696. width: 24,
  1697. height: 24,
  1698. zIndex: 250,
  1699. position: "absolute"
  1700. });
  1701. this.highlightTemplate = $("<div>").css({
  1702. background: "url(/img/glow-blue.png)",
  1703. position: "absolute",
  1704. width: 52,
  1705. height: 24,
  1706. zIndex: 1
  1707. });
  1708. })();
  1709.  
  1710. this.installationCounter = new (function() {
  1711. var self = this;
  1712. var id = 87771;
  1713.  
  1714. this.count = function() {
  1715. if (interface == "superold") return;
  1716. if (!settings.get("/counted")) {
  1717. //extManager.toggleLike(id, 'unlike')
  1718. $.ajax({
  1719. url: "/tools/addons.php?task=details&id="+id,
  1720. type: "POST",
  1721. data: {like: "unlike"}
  1722. });
  1723. settings.set("/counted", true);
  1724. };
  1725. };
  1726. this.get = function(clb) {
  1727. if (interface == "superold") return clb("<span tip='Niedostępne dla oldmargonem'>-</span>");
  1728. $.ajax({
  1729. url: "/tools/addons.php?task=details&id="+id,
  1730. datatype: "json",
  1731. success: function(r) {
  1732. clb(-r.addon.points);
  1733. }
  1734. });
  1735. };
  1736. })();
  1737.  
  1738. //databases
  1739. //porzuciłem ręczne edytowanie tego więc w jednej linii jest bo tak wypluwa skrypt
  1740. var herosDB = {"Domina Ecclesiae":{"lvl":21,"prof":"b","spawns":{"3":[[53,11],[50,23]],"169":[[14,8],[8,9]],"171":[[25,26],[7,28],[15,29],[8,8],[22,9]],"175":[[12,4]],"217":[[7,35],[22,13],[37,39]],"249":[[12,5]],"251":[[11,10],[10,13]],"290":[[11,8],[16,5]],"298":[[7,10]],"300":[[7,8]],"2070":[[6,4],[10,29],[7,17]],"2071":[[42,5],[17,4],[37,9]],"2073":[[21,9]],"2546":[[44,43],[33,10],[41,14],[50,5],[25,28],[9,11]],"2710":[[6,11],[24,6],[8,15]],"2712":[[5,7],[9,7],[7,12]],"2713":[[10,6],[8,12]],"2714":[[8,5],[27,10],[7,8],[16,8]],"2715":[[24,17],[6,13],[5,18],[32,18]],"2718":[[23,8],[15,8]],"2719":[[7,35],[4,10]],"2721":[[4,5],[29,15],[20,15],[15,9]],"2722":[[8,22],[8,7]],"2879":[[12,7],[7,20],[11,13]],"2880":[[10,19]],"2885":[[38,57],[11,22],[23,56],[48,36]],"2886":[[41,57],[13,46],[12,12],[29,60],[24,12]],"Przeklęty Zamek p.1":[[12,4]],"Strażnica północno-wschodnia":[[8,3]],"Strażnica północno-zachodnia":[[8,3]],"Mury - zbrojownia - piwnica":[[12,11]],"Mury - skrzydło wschodnie":[[12,13]],"Mury - kwatera główna":[[10,11]],"Opuszczony dom":[[5,8]],"Posterunek":[[9,10]],"Posterunek - piwnica":[[11,4]],"Podziemia siedziby maga p.1 - sala 1":[[22,28],[13,9]],"Podziemia siedziby maga p.1 - sala 2":[[10,9]],"Fortyfikacja p.1":[[13,6],[7,16]],"Fortyfikacja p.5":[[9,9]],"Przeklęta Strażnica p.1":[[9,10]]}},"Mroczny Patryk":{"lvl":35,"prof":"w","spawns":{"3":[[31,58],[19,71],[11,47],[58,46],[19,21],[2,49],[14,7],[19,52],[54,71],[33,62],[57,75],[7,17],[48,79],[52,27],[28,3],[56,4],[10,84]],"4":[[45,51],[52,39],[54,66],[17,15],[35,14],[3,87],[38,59],[55,78],[25,44],[3,68],[42,18],[45,84],[59,92],[21,25],[5,27],[2,21],[6,4]],"8":[[5,40],[15,24],[58,18],[40,36],[24,54],[52,29],[26,6],[15,44],[7,10],[38,26],[54,45],[51,55],[51,5],[48,16],[42,22],[26,29],[4,56],[37,54]],"11":[[37,11],[61,22],[14,4],[52,50],[45,28],[5,75],[55,19],[56,94],[10,47],[9,30],[21,15],[37,71],[39,51],[48,83],[25,6],[55,32],[54,65],[11,17],[57,93]],"12":[[53,47],[76,17],[5,9],[21,41],[65,15],[10,31],[74,17]],"19":[[9,10]],"110":[[20,41],[52,23],[22,24],[60,23],[41,40],[36,11],[55,3],[52,77],[30,8],[39,61],[17,89],[9,8],[29,42],[46,83],[31,21],[54,51],[0,23],[27,65],[48,2],[5,85],[31,50],[19,78],[55,12],[3,4],[4,77],[31,21],[53,77],[25,39],[18,2]],"111":[[49,20],[60,3],[11,19],[9,47],[18,58],[22,28],[42,55],[30,2]],"115":[[41,43],[52,29],[21,10],[8,19],[57,48],[34,36],[38,43],[7,55],[49,43]],"634":[[26,7]],"1110":[[52,59],[32,9],[18,24],[11,13],[35,22]],"3402":[[37,24],[47,52],[5,27],[53,11]]}},"Karmazynowy Mściciel":{"lvl":45,"prof":"m","spawns":{"121":[[47,26],[3,2],[2,54],[41,12],[48,75],[12,39],[5,65]],"128":[[3,87],[4,55],[33,18],[42,88],[52,55],[12,18],[51,19]],"132":[[11,17]],"133":[[13,18]],"134":[[8,13]],"135":[[10,11],[12,8]],"136":[[14,8]],"151":[[12,6],[26,5],[58,37],[46,60],[22,54],[37,57],[55,5],[39,13],[47,7],[19,34],[16,4],[45,52]],"182":[[8,5]],"183":[[14,9]],"198":[[53,56],[60,5],[10,44],[10,7],[57,22],[43,4],[37,2],[24,7],[14,19],[28,62],[9,6],[58,38],[9,33],[34,37],[9,45]],"226":[[13,37],[15,71],[20,90]],"227":[[10,35],[14,35]],"228":[[51,21],[50,24]],"229":[[36,82],[45,6],[8,70],[20,14]]}},"Złodziej":{"lvl":50,"prof":"h","spawns":{"1180":[[12,8],[11,8]],"1188":[[6,6]],"1247":[[9,9]],"1278":[[8,6]],"1280":[[8,6]],"1320":[[8,8]],"1335":[[10,8]],"1382":[[7,8]],"1407":[[8,7],[9,7]],"1423":[[8,7]],"1433":[[7,8]],"1438":[[12,6]],"1489":[[7,8]],"1493":[[7,8]],"1500":[[10,8]],"1542":[[28,6]],"1566":[[4,11]],"1567":[[7,6]],"1568":[[4,8]],"1589":[[6,8]],"1590":[[4,7],[4,6]],"1605":[[4,10]],"Chata Ficjusza":[[3,8]]}},"Złodziej znajduje się w tym domu (parter)":{"lvl":50,"spawns":{"589":[[39,14],[40,14],[62,14],[63,14],[74,38],[52,54],[53,54]],"630":[[69,40],[44,41]],"1233":[[68,29],[75,16]],"1262":[[52,9],[53,9]]}},"Złodziej znajduje się w tym domu (2. piętro)":{"lvl":50,"spawns":{"589":[[31,33],[83,36],[84,36]]}},"Złodziej znajduje się w tej latarnii (2. piętro) (uwaga na kraby przy dochodzeniu tutaj)":{"lvl":50,"spawns":{"1262":[[20,54]]}},"Złodziej znajduje się w tym domu (1. piętro)":{"lvl":50,"spawns":{"589":[[17,33],[33,17]],"630":[[40,27],[41,27]],"1262":[[61,17],[62,17]]}},"Złodziej znajduje się w tym domu (piwnica)":{"lvl":50,"spawns":{"589":[[57,14],[43,54]],"630":[[78,17],[77,17],[81,28],[82,28],[88,23]],"1233":[[57,39]]}},"Złodziej znajduje się w tym domu (pokój Grety)":{"lvl":50,"spawns":{"589":[[59,29],[60,29]]}},"Zły Przewodnik":{"lvl":63,"prof":"w","spawns":{"116":[[5,26],[40,35],[35,3],[52,30],[10,44],[54,43],[18,8],[28,57],[37,8],[7,17],[35,3],[53,31],[39,34],[34,2],[27,56]],"122":[[35,20],[19,6],[54,18],[32,7],[54,25]],"140":[[26,54],[44,29],[56,27],[10,49],[49,2]],"150":[[57,3],[18,4],[3,34],[40,38],[89,51],[27,50],[40,37],[57,3]],"180":[[54,28],[22,20],[15,6],[14,44],[31,4],[34,17],[4,19]],"2730":[[19,13],[28,38],[12,23],[53,6],[49,15],[38,58],[6,46],[38,58]]}},"Piekielny Kościej":{"lvl":74,"prof":"w","spawns":{"Labirynt Margorii":[[15,38],[49,24],[57,55],[35,18],[34,46]],"Margoria Sala Królewska":[[23,61],[10,77],[51,24],[38,82],[22,30]],"Kopalnia Margorii":[[30,22],[53,62],[11,39],[50,12],[52,40],[27,38],[8,49]],"Zdradzieckie Przejście":[[21,6],[22,56],[67,38]]}},"Opętany Paladyn":{"lvl":85,"prof":"w","spawns":{"180":[[49,28]],"203":[[15,28],[31,9]],"204":[[18,27]],"205":[[18,27]],"210":[[84,7],[33,45],[54,11],[78,25],[15,26]],"211":[[19,38],[19,11],[45,57]],"601":[[17,41],[87,5],[25,55],[59,35],[92,54],[22,21]],"602":[[40,31],[6,58],[4,16]],"Podziemia świątyni":[[28,5],[54,32]],"Zbrojownia Andarum":[[25,59],[7,35],[7,20]]}},"Kochanka Nocy":{"lvl":100,"prof":"m","spawns":{"246":[[12,8],[28,60],[77,60]],"253":[[88,34],[77,46],[80,59],[6,34],[6,41],[34,22],[60,7],[90,20]],"268":[[83,6],[10,15],[34,47]],"330":[[6,8],[88,6],[60,24],[14,43],[45,40],[16,19]],"331":[[22,12],[5,58],[82,41],[82,8]],"332":[[77,13],[64,7],[35,19],[19,36]],"339":[[91,41],[81,1],[44,9],[39,33],[45,56],[67,59]],"3765":[[70,34],[83,51],[9,43],[29,37]],"3766":[[5,46],[11,11],[60,11],[72,52],[53,55]]}},"Perski Książę":{"lvl":116,"prof":"b","spawns":{"Dolina Pustynnych Kręgów":[[11,89],[11,89],[10,21]],"Piachy Zniewolonych":[[33,23],[11,7],[75,30]],"Ruchome Piaski":[[79,54],[63,29],[15,16]],"Korsarska Nora - sala 2":[[4,22]],"Korsarska Nora - sala 4":[[10,6]],"Korsarska Nora p.2":[[11,6]],"Ukryta Grota Morskich Diabłów":[[51,32],[25,16]],"Ukryta Grota Morskich Diabłów - arsenał":[[4,14]],"Ukryta Grota Morskich Diabłów - skarbiec":[[8,4]],"Oaza Siedmiu Wichrów":[[61,15],[42,24]],"Ruiny Pustynnych Burz":[[42,46],[9,7],[42,79]],"Dolina Suchych Łez":[[71,16],[41,22],[61,55]]}},"Baca Bez Łowiec":{"lvl":123,"prof":"h","spawns":{"Wyjący Wąwóz":[[58,30],[7,10],[58,51],[35,3],[52,72],[8,75],[58,18],[54,50],[21,41],[50,32],[50,7],[44,71],[40,87],[14,36],[23,71],[38,53]],"Wyjąca Jaskinia":[[14,61],[35,28],[54,27],[23,51],[4,19],[24,19],[50,32],[10,18],[32,7],[17,60],[50,25]],"Niedźwiedzie Urwisko":[[20,6],[34,8],[33,23]],"Babi wzgórek":[[36,43],[55,7],[40,4],[54,78],[41,2],[34,54],[41,78],[56,67],[60,36],[12,60],[19,22],[15,88],[38,25],[38,33]],"Góralska Pieczara p.1":[[19,17],[19,22],[25,24],[35,4],[34,12]],"Góralska Pieczara p.2":[[7,5],[15,20],[5,31]],"Góralska Pieczara p.3":[[16,28],[24,38]],"Góralskie przejście":[[29,2],[38,46],[28,19],[48,87],[48,70],[42,64],[60,70],[3,46],[7,9],[22,39],[18,53],[56,5],[47,2],[33,27],[8,72],[6,46]],"Grota Halnego Wiatru p.1":[[4,12]],"Grota Halnego Wiatru p.2":[[26,27],[5,31],[7,5],[13,17]]}},"Lichwiarz Grauhaz":{"lvl":129,"prof":"w","spawns":{"286":[[7,16],[50,48]],"287":[[26,30]],"594":[[29,18]],"1192":[[55,48],[30,54]],"1227":[[6,43],[54,10],[51,21],[49,42]],"1228":[[8,51],[51,3],[5,18],[42,37]],"1229":[[53,9],[11,43],[8,13],[7,16],[37,40]],"1231":[[39,58],[33,47],[12,11]],"1232":[[41,14],[33,7],[58,11],[42,25]],"1234":[[21,19],[46,53],[5,39],[6,23]],"3468":[[32,32]],"3469":[[13,14]],"3470":[[18,27],[30,5],[21,31],[59,56]],"3471":[[39,6]],"3472":[[44,50]],"3473":[[36,43],[66,9]],"Śnieżna Grota p.2":[[34,10]],"Kryształowa Sala Smutku":[[16,7]],"Przejście magicznego mrozu":[[41,49]],"Przejście lodowatego wiatru":[[6,33]],"Szlak Thorpa p.2":[[32,32]],"Zasypane Ograbar-Dun":[[55,48],[30,54]],"Przejście zamarzniętych kości":[29,18]}},"Obłąkany Łowca Orków":{"lvl":144,"prof":"w","spawns":{"344":[[25,8],[61,36],[45,23],[86,4],[25,38],[45,61],[14,4],[24,40],[85,33],[19,10]],"Złudny Trakt":[[38,13],[58,17],[17,5],[9,51],[21,6],[7,59],[32,16],[37,9]],"Orcza Wyżyna":[[74,47],[16,16],[52,12],[59,35],[87,7]],"Grota Orczych Szamanów":[[12,19]],"Osada Czerwonych Orków":[[18,24],[19,23],[14,25],[62,42],[35,27],[41,78],[43,4],[60,47]],"Siedziba Rady Orków":[[11,25]],"Nawiedzone Kazamaty p.1":[[19,33],[45,13],[10,44],[42,39],[6,43],[45,9],[12,6],[32,16],[10,16],[25,7],[40,38],[16,16],[36,7]],"Nawiedzone Kazamaty p.3":[[27,22],[26,22]],"Nawiedzone Kazamaty p.4":[[19,36],[12,13],[48,19],[4,9],[9,9],[31,18],[7,25],[45,39],[31,19],[16,22],[34,30],[41,41],[6,45],[29,42],[48,38],[32,10],[5,30]],"Nawiedzone Kazamaty p.5":[[4,41],[26,13],[49,27],[9,33],[6,15],[31,35],[10,20],[4,43],[41,26],[8,16]],"Nawiedzone Kazamaty p.6":[[27,36]]}},"Czarująca Atalia":{"lvl":157,"prof":"m","spawns":{"1293":[[5,5],[46,56],[10,59],[82,4],[62,50],[89,24]],"1294":[[34,11],[54,12],[27,16],[46,40],[19,51]],"1297":[[45,4],[55,11],[44,54],[75,33],[1,43]],"1298":[[7,7],[9,16]],"1299":[[17,7],[23,13],[19,6]],"1300":[[5,8]],"1301":[[6,8],[2,6]],"1303":[[15,10],[11,13]],"1308":[[4,5],[9,10]]}},"Święty Braciszek":{"lvl":165,"prof":"b","spawns":{"Dom Rumiry i Dobromira p.1":[[5,7]],"Sklep z winem":[[5,7]],"Dom Wazira":[[6,6]],"Magazyn win p.1":[[6,5]],"Jezioro Ważek":[[17,11],[86,9],[7,57],[59,43]],"Pachnący Gąszcz":[[88,43],[26,44],[28,5]],"Las Zadumy":[[11,30],[46,47],[85,23]],"Agia Triada":[[67,38],[18,57],[34,21],[59,43]],"Grota Drążących Kropli p.1":[],"Grota Drążących Kropli p.2":[[11,8]],"Klasztor Różanitów - korytarz wejściowy":[[6,8],[5,8]],"Klasztor Różanitów - pomieszczenie gospodarcze":[[9,12]],"Klasztor Różanitów - klasztorny browar":[[12,6]],"Klasztor Różanitów - klasztorna piekarnia":[[2,10]],"Klasztor Różanitów - warsztat":[[12,6]],"Klasztor Różanitów - wirydarz":[[8,14]],"Klasztor Różanitów - dormitoria":[[13,15]],"Klasztor Różanitów - refektarz":[[4,22]],"Klasztor Różanitów - fraternia":[[5,15]],"Klasztor Różanitów - dzwonnica":[[11,8]],"Klasztor Różanitów - piwniczka":[[6,6]],"Klasztor Różanitów - lawaterz":[[3,10]],"Klasztor Różanitów - klatka schodowa":[[8,8],[8,12]],"Klasztor Różanitów - kapitularz":[[3,15]],"Klasztor Różanitów - świątynia":[[44,25],[8,14]],"Klasztor Różanitów - magazyn ksiąg":[[11,5]],"Klasztor Różanitów - cela opata":[[10,6]],"Klasztor Różanitów - wieża płn.-zach. p.1":[[9,12]],"Klasztor Różanitów - wieża płn.-zach. p.2":[[10,12]],"Klasztor Różanitów - wieża płn.-wsch. p.1":[[4,11]],"Klasztor Różanitów - strych p.1":[[20,12]],"Klasztor Różanitów - strych p.2":[[31,6],[22,20]],"Tunel pod Skałą p.1":[[14,53],[13,54]],"Tunel pod Skałą p.2":[[45,41]],"Tunel pod Skałą p.3":[[10,24]],"Ogrza kawerna p.1":[[26,4]],"Ogrza kawerna p.2":[[49,18]],"Ogrza kawerna p.3":[[26,16],[52,8]]}},"Viviana Nandid":{"lvl":184,"prof":"h","spawns":{"2056":[[16,6],[85,13],[68,46],[85,51],[8,26],[8,9],[56,14],[63,5],[22,23]],"Rozlewisko Kai":[[1,8],[28,14],[41,8],[12,32],[14,14],[71,62],[21,48],[13,55],[27,53],[75,26],[46,50],[42,14]],"Ruiny Tass Zhil":[[37,5],[57,21],[21,7],[55,40],[67,18],[50,12],[80,1],[10,45],[8,10],[59,52],[5,41],[37,5],[14,58],[62,58]],"Błota Sham Al":[[31,3],[51,11],[35,26],[5,40],[6,26],[32,38],[30,10]],"Gvar Hamryd":[[15,6],[72,5],[50,37],[63,19],[73,50],[3,27],[86,39],[6,44],[16,60],[90,27],[32,60],[25,26],[32,37],[53,35],[44,57],[77,60],[39,35]]}},"Mulher Ma":{"lvl":197,"prof":"b","spawns":{"114":[[71,4],[33,44],[25,18]],"574":[[22,3]],"575":[[14,53]],"730":[[90,9],[93,61]],"731":[[91,33],[14,4]],"865":[[11,5]],"1992":[[19,18]],"2002":[[4,17]],"2020":[[22,36],[48,41],[15,40],[76,58],[70,37],[74,58]],"2056":[[13,49],[65,38],[89,41]],"2063":[[18,48],[52,11]],"2126":[[7,6]],"2127":[[8,13]],"2163":[[6,8]],"2183":[[10,11],[18,14]],"2432":[[4,5]]}},"Demonis Pan Nicości":{"lvl":210,"prof":"m","spawns":{"971":[[14,15],[30,41],[30,32],[59,34],[15,34],[33,7],[15,17]],"973":[[48,33],[73,24],[89,49],[48,53],[48,14],[24,30],[23,30],[48,13],[48,34],[88,50],[73,23]],"974":[[15,27]],"975":[[18,11],[44,33],[18,12]],"976":[[32,44],[50,45],[50,46]],"977":[[47,45]]}},"Vapor Veneno":{"lvl":227,"prof":"w","spawns":{"1399":[[14,10],[63,9]],"1448":[[63,50],[63,23],[81,36],[53,7],[91,10],[40,37]],"1449":[[81,34],[86,52],[57,34],[53,51],[14,50],[32,33],[87,59],[27,35]],"1458":[[30,20],[2,25],[77,42],[51,29]],"1464":[[9,18]],"2902":[[20,23],[37,26]],"3135":[[50,57],[11,24],[29,47],[14,4],[17,45],[34,19],[58,34]],"3136":[[40,84],[47,11],[29,7],[24,74],[24,43],[12,52],[57,28],[54,76],[37,53],[43,29]],"3137":[[57,50],[49,39],[57,14],[33,29],[23,9]],"3138":[[37,83],[38,56],[18,57],[47,46],[50,87]],"3209":[[55,80],[52,60],[24,46],[39,51],[10,7],[8,78],[8,49],[31,78]]}},"Dęborożec":{"lvl":242,"prof":"w","spawns":{"3594":[[28,28],[41,46],[11,21],[80,50]],"3595":[[33,28],[75,27],[85,50]],"3596":[[40,8],[58,26],[60,50]],"3597":[[31,83],[2,31]],"3598":[[34,11],[46,48]],"3610":[[39,11],[7,57],[52,45]],"3611":[[30,9]],"3612":[[19,17],[17,17]],"3613":[[21,8],[52,22]],"3614":[[11,15]],"3615":[[13,11]],"3620":[[7,13]],"3621":[[11,18]],"3622":[[36,22]],"3623":[[17,17]],"3624":[[12,19]],"3625":[[23,27]],"3626":[[9,12]],"3627":[[20,23]]}},"Tepeyollotl":{"lvl":260,"prof":"b","spawns":{"1901":[[50,11],[18,71],[45,20],[24,33],[19,49]],"1924":[[10,7],[70,22],[76,47]],"1926":[[8,76],[11,16],[12,87],[5,76]],"1963":[[9,6]],"1964":[[17,7]],"1966":[[16,27]],"1982":[[13,19]],"3029":[[8,10]],"3030":[[10,20]],"3031":[[10,13]],"3032":[[49,22],[11,15],[17,35]],"3033":[[12,40],[70,40]],"3034":[[19,19]],"3035":[[31,31]],"3036":[[13,40],[14,40],[16,19],[16,8]],"3037":[[30,26],[37,13]],"3038":[[24,6],[21,32]],"3039":[[32,72]],"3040":[[12,12]],"3041":[[17,15],[15,12]],"3042":[[21,25],[22,24]],"3043":[[22,41],[32,11],[54,9],[9,19]]}},"Młody Smok":{"lvl":282,"prof":"m","spawns":{"Pustynia Shaiharrud - wschód":[[5,2],[47,24],[24,61],[4,38],[21,76]],"Pustynia Shaiharrud - zachód":[[4,19],[26,8],[52,38],[22,85]],"Urwisko Vapora":[[64,37],[83,48],[29,46],[20,58]],"Jaskinia Sępa s.1":[[27,11]],"Jaskinia Piaskowej Burzy s.1":[[16,8]],"Jaskinia Smoczej Paszczy p.1":[[31,34]],"Jaskinia Smoczej Paszczy p.2":[[25,27]],"Jurta Nomadzka":[[3,6]],"Jaskinia Piaskowej Burzy s.2":[[5,20]],"Świątynia Hebrehotha - przedsionek":[[26,12]],"Skały Umarłych":[[31,87],[54,70],[60,30],[30,31]],"Jaskinia Próby":[[14,19]],"Jaskinia Odwagi":[[31,40],[29,11]],"Smocze Skalisko":[[52,50],[67,27]],"Sępiarnia":[[7,5]],"Grota Poświęcenia":[[4,21]]}}};
  1741. var eliteDB = {
  1742. //elity do dziennego questa w margonem.com
  1743. "Masked Blaise": {
  1744. lvl: -1,
  1745. ver: "en",
  1746. //spawns: {196:[[8,5]]} w sumie to ich na całą mapę ładuje więc bez sensu
  1747. },
  1748. "Cula Joshua": {
  1749. lvl: -1,
  1750. ver: "en",
  1751. spawns: {}
  1752. },
  1753. "Mola Nito": {
  1754. lvl: -1,
  1755. ver: "en",
  1756. spawns: {}
  1757. },
  1758. "Toto Acirfa": {
  1759. lvl: -1,
  1760. ver: "en",
  1761. spawns: {}
  1762. },
  1763. "Masked Roman": {
  1764. lvl: -1,
  1765. ver: "en",
  1766. spawns: {}
  1767. },
  1768. "Possessed Fissit": {
  1769. lvl: -1,
  1770. ver: "en",
  1771. spawns: {}
  1772. },
  1773. "Soda": {
  1774. lvl: -1,
  1775. ver: "en",
  1776. spawns: {}
  1777. },
  1778. "Molybdenum Matityahu": {
  1779. lvl: -1,
  1780. ver: "en",
  1781. spawns: {}
  1782. },
  1783. "Hummopapa": {
  1784. lvl: -1,
  1785. ver: "en",
  1786. spawns: {}
  1787. },
  1788. "Shponder":{
  1789. lvl: -1,
  1790. ver:"en",
  1791. spawns:{}
  1792. },
  1793. "Mobile Jeecus":{
  1794. lvl: -1,
  1795. ver:"en",
  1796. spawns:{}
  1797. }
  1798. };
  1799.  
  1800. this.getHerosDB = function() {
  1801. return herosDB;
  1802. };
  1803.  
  1804. var niceSettings = new (function(options) {
  1805. var self = this;
  1806. var {get, set, data, header, onSave} = options;
  1807. var panels = {};
  1808. var $currentPanel = false;
  1809. var $activeLPanelEntry;
  1810. var $rpanel;
  1811. var $wrapper;
  1812. var shown = false;
  1813. this.toggle = function() {
  1814. var lock = interface == "new" ? Engine.lock : (interface == "old" ? g.lock : null);
  1815. if (shown) {
  1816. if (lock) lock.remove("ns-"+header);
  1817. else global.dontmove = false;
  1818. $wrapper.style["display"] = "none";
  1819. } else {
  1820. if (lock) lock.add("ns-"+header);
  1821. else global.dontmove = true;
  1822. $wrapper.style["display"] = "block";
  1823. };
  1824. shown = !shown;
  1825. };
  1826. this.initHTML = function() {
  1827. $wrapper = document.createElement("div");
  1828. $wrapper.classList.add("ns-wrapper");
  1829. document.body.appendChild($wrapper);
  1830.  
  1831. var $header = document.createElement("div");
  1832. $header.innerHTML = header + " - ustawienia";
  1833. $header.classList.add("ns-header");
  1834. $wrapper.appendChild($header);
  1835.  
  1836. var $close = document.createElement("div");
  1837. $close.innerHTML = "X";
  1838. $close.classList.add("ns-close");
  1839. $close.addEventListener("click", this.toggle);
  1840. $wrapper.appendChild($close);
  1841.  
  1842. var $panels = document.createElement("div");
  1843. $panels.classList.add("ns-panels");
  1844. $wrapper.appendChild($panels);
  1845.  
  1846. var $lpanel = document.createElement("div");
  1847. $lpanel.addEventListener("click", this.lPanelClick);
  1848. $lpanel.classList.add("ns-lpanel");
  1849. $panels.appendChild($lpanel);
  1850.  
  1851. $rpanel = document.createElement("div");
  1852. $rpanel.classList.add("ns-rpanel");
  1853. $rpanel.addEventListener("click", this.globalRpanelHandler);
  1854. $panels.appendChild($rpanel);
  1855.  
  1856. $lpanel.innerHTML = this.generateLpanelHtml();
  1857. this.genereteRpanels();
  1858. };
  1859. this.lPanelClick = function(e) {
  1860. if (e.target.dataset["name"]) {
  1861. self.togglePanel(e.target.dataset["name"]);
  1862. if ($activeLPanelEntry) $activeLPanelEntry.classList.remove("active");
  1863. $activeLPanelEntry = e.target;
  1864. $activeLPanelEntry.classList.add("active");
  1865. };
  1866. };
  1867. this.globalRpanelHandler = function(e) {
  1868. var tar = e.target;
  1869. if (tar.dataset["listbtt"]) {
  1870. var key = tar.dataset["listbtt"];
  1871. var $content = document.querySelector(".ns-list-content[data-list='"+key+"']");
  1872. var $input = document.querySelector("input[data-list='"+key+"']");
  1873. self.adddContentToList($content, $input);
  1874. } else if (tar.dataset["listitem"]) {
  1875. tar.remove();
  1876. };
  1877. };
  1878. this.adddContentToList = function($content, $input) {
  1879. var val = $input.value;
  1880. if (val == "") return;
  1881. $input.value = "";
  1882. var items = this.getContentItems($content);
  1883. if (items.indexOf(val) > -1) return
  1884. var $div = document.createElement("div");
  1885. $div.classList.add("ns-list-item");
  1886. $div.dataset["listitem"] = "1";
  1887. $div.innerText = val;
  1888. $content.appendChild($div);
  1889. };
  1890. this.getContentItems = function($content) {
  1891. var items = [];
  1892. for (var i=0; i<$content.children.length; i++) {
  1893. items.push($content.children[i].innerHTML);
  1894. };
  1895. return items;
  1896. };
  1897. this.togglePanel = function(name) {
  1898. if ($currentPanel) $currentPanel.remove();
  1899. $currentPanel = panels[name];
  1900. $rpanel.appendChild($currentPanel);
  1901. this.setAsyncPanelContent(name);
  1902. };
  1903. this.setAsyncPanelContent = function(name) {
  1904. var entries = options.data[name];
  1905. for (var i=0; i<entries.length; i++) {
  1906. var entry = entries[i];
  1907. if (entry.asyncid) {
  1908. entry.fun(val => {
  1909. var el = document.getElementById(entry.asyncid);
  1910. if (el) el.innerHTML = val;
  1911. });
  1912. };
  1913. };
  1914. };
  1915. this.genereteRpanels = function() {
  1916. for (var name in data) {
  1917. this.generateRpanel(name, data[name]);
  1918. };
  1919. };
  1920. this.generateRpanel = function(name, content) {
  1921. var $panel = document.createElement("div");
  1922. panels[name] = $panel;
  1923. var html = "";
  1924. for (var i=0; i<content.length; i++) {
  1925. html += this.generateRpanelEntryHtml(content[i]);
  1926. };
  1927. $panel.innerHTML = html;
  1928. var $btt = document.createElement("div");
  1929. $btt.innerHTML = "Zapisz";
  1930. $btt.classList.add("ns-save-button");
  1931. $btt.addEventListener("click", () => this.savePanel(name));
  1932. $panel.appendChild($btt);
  1933. };
  1934. this.generateRpanelEntryHtml = function(entry) {
  1935. var {type, special} = this.getEntryType(entry.type);
  1936. if (!special) {
  1937. var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+get(entry.key)+"'></input>";
  1938. return this.getRpanelEntry(entry.name, input, entry.tip);
  1939. } else {
  1940. if (type == "range") {
  1941. var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+get(entry.key)*100+"' min='"+entry.data[0]*100+"' max='"+entry.data[1]*100+"'></input>";
  1942. return this.getRpanelEntry(entry.name, input, entry.tip);
  1943. } else if (type == "checkbox") {
  1944. var input = "<input data-key='"+entry.key+"' type='"+type+"' "+(get(entry.key) ? "checked" : "")+"></input>";
  1945. return this.getRpanelEntry(entry.name, input, entry.tip);
  1946. } else if (special == "char") {
  1947. var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+String.fromCharCode(get(entry.key))+"' maxlength='1' style='width: 10px; text-align: center'></input>";
  1948. return this.getRpanelEntry(entry.name, input, entry.tip);
  1949. } else if (special == "noinput") {
  1950. if (type != "async") {
  1951. return this.getRpanelEntry(entry.t1, entry.t2, entry.tip);
  1952. } else {
  1953. var id = "NS-async-"+Math.random()*10;
  1954. entry.asyncid = id;
  1955. return this.getRpanelEntry(entry.t1, "<div id='"+id+"'>"+entry.placeholder+"</div>", entry.tip);
  1956. };
  1957. } else if (type == "list") {
  1958. return this.generateListInput(entry);
  1959. };
  1960. };
  1961. };
  1962. this.generateListInput = function(entry) {
  1963. var list = get(entry.key);
  1964. var html;
  1965. html = "<div class='ns-list-wrapper'>";
  1966. html += "<div class='ns-list-header'>"+entry.name+"</div>";
  1967. html += "<div class='ns-list-content' data-list='"+entry.key+"'>";
  1968. for (var i=0; i<list.length; i++) {
  1969. html += "<div class='ns-list-item' data-listitem='1'>"+list[i]+"</div>";
  1970. };
  1971. html += "</div>";
  1972. html += "<div class='ns-list-bottombar'>";
  1973. html += "<div class='ns-list-input'><input data-list='"+entry.key+"' type='text'></div>";
  1974. html += "<div class='ns-list-addbtt' data-listbtt='"+entry.key+"'>+</div>";
  1975. html += "</div>";
  1976. html += "</div>";
  1977. return html;
  1978. };
  1979. this.getRpanelEntry = function(txt, input, tip) {
  1980. return "<div "+(tip ? (interface == "new" ? "data-tip" : "tip") + "='"+tip+"'" : "")+" class='ns-rpanel-entry'><div class='ns-rpanel-entry-left'>"+txt+"</div><div class='ns-rpanel-entry-right'>"+input+"</div></div>";
  1981. };
  1982. this.getEntryType = function(entrytype) {
  1983. var special = false;
  1984. switch (entrytype) {
  1985. case "string":
  1986. var type = "text";
  1987. break;
  1988. case "color":
  1989. var type = "color";
  1990. break;
  1991. case "range":
  1992. special = true;
  1993. var type = "range";
  1994. break;
  1995. case "check":
  1996. special = true;
  1997. var type = "checkbox";
  1998. break;
  1999. case "char":
  2000. special = "char";
  2001. var type = "text";
  2002. break;
  2003. case "list":
  2004. special = true;
  2005. var type = "list";
  2006. break;
  2007. case "numstring":
  2008. var type = "number";
  2009. break;
  2010. case "info-async":
  2011. var type = "async";
  2012. special = "noinput";
  2013. break;
  2014. default:
  2015. special = "noinput";
  2016. };
  2017. return {
  2018. type: type,
  2019. special: special
  2020. };
  2021. }
  2022. this.generateLpanelHtml = function() {
  2023. var html = "";
  2024. for (var name in data) {
  2025. html += "<div class='ns-lpanel-entry' data-name='"+name+"'>"+name+"</div>";
  2026. };
  2027. return html;
  2028. };
  2029. this.savePanel = function(name) {
  2030. var panel = data[name];
  2031. for (var i=0; i<panel.length; i++) {
  2032. this.savePanelEntry(panel[i]);
  2033. };
  2034. onSave();
  2035. };
  2036. this.savePanelEntry = function(entry) {
  2037. var {type, special} = this.getEntryType(entry.type);
  2038. if (!special) {
  2039. var val = this.getEntryValue(entry.key);
  2040. if (type == "number") {
  2041. val = parseInt(val);
  2042. if (isNaN(val)) return;
  2043. };
  2044. set(entry.key, val);
  2045. } else {
  2046. if (type == "range") {
  2047. set(entry.key, this.getEntryValue(entry.key)/100);
  2048. } else if (type == "checkbox") {
  2049. set(entry.key, this.getCheckboxState(entry.key));
  2050. } else if (special == "char") {
  2051. var val = this.getEntryValue(entry.key).toUpperCase().charCodeAt(0);
  2052. if (isNaN(val)) return;
  2053. set(entry.key, val);
  2054. } else if (type == "list") {
  2055. var $content = document.querySelector(".ns-list-content[data-list='"+entry.key+"']");
  2056. var items = this.getContentItems($content);
  2057. set(entry.key, items);
  2058. };
  2059. };
  2060. };
  2061. this.getEntryValue = function(key) {
  2062. return document.querySelector("input[data-key='"+key+"']").value;
  2063. };
  2064. this.getCheckboxState = function(key) {
  2065. return document.querySelector("input[data-key='"+key+"']").checked;
  2066. };
  2067. this.initCss = function() {
  2068. var css = `
  2069. .ns-wrapper {
  2070. width: 600px;
  2071. height: 600px;
  2072. background: rgba(0,0,0,.8);
  2073. border: 2px solid #222222;
  2074. border-radius: 20px;
  2075. position: absolute;
  2076. left: calc(50% - 300px);
  2077. top: calc(50% - 300px);
  2078. z-index: 500;
  2079. color: white;
  2080. display: none;
  2081. ${interface == "superold" ? "transform: scale(0.8, 0.8);" : ""}
  2082. }
  2083. .ns-wrapper .ns-close {
  2084. width: 30px;
  2085. height: 30px;
  2086. font-size: 20px;
  2087. line-height: 30px;
  2088. text-align: center;
  2089. background: rgba(0,0,0,.6);
  2090. transition: background .1s ease-in-out;
  2091. position: absolute;
  2092. right: 3px;
  2093. top: 3px;
  2094. cursor: pointer;
  2095. }
  2096. .ns-wrapper .ns-close:hover {
  2097. background: rgba(0,0,0,.9);
  2098. }
  2099. .ns-wrapper .ns-header {
  2100. border-bottom: 1px solid #333333;
  2101. font-size: 26px;
  2102. padding-left: 15px;
  2103. color: white;
  2104. height: 39px;
  2105. line-height: 40px;
  2106. background: rgba(50,50,50,.8);
  2107. }
  2108. .ns-wrapper .ns-panels {
  2109. height: 560px;
  2110. }
  2111. .ns-wrapper .ns-panels .ns-lpanel {
  2112. height: 560px;
  2113. width: 200px;
  2114. border-right: 1px solid #333333;
  2115. float: left;
  2116. }
  2117. .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry {
  2118. width: 75%;
  2119. height: 30px;
  2120. line-height: 30px;
  2121. font-size: 19px;
  2122. padding-left: 5px;
  2123. background: linear-gradient(to right, rgba(100,100,100,0.45) , rgba(100,100,100,0));
  2124. transition: all .15s ease-in-out;
  2125. cursor: pointer;
  2126. margin-bottom: 1px;
  2127. }
  2128. .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry.active {
  2129. background: linear-gradient(to right, rgba(150,150,150,0.45) , rgba(150,150,150,0));
  2130. width: 100%;
  2131. padding-left: 13px;
  2132. }
  2133. .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry:hover {
  2134. width: 100%;
  2135. padding-left: 13px;
  2136. }
  2137. .ns-wrapper .ns-panels .ns-rpanel {
  2138. height: 560px;
  2139. width: 390px;
  2140. float: left;
  2141. }
  2142. .ns-wrapper .ns-panels .ns-rpanel .ns-rpanel-entry {
  2143. height: 30px;
  2144. margin: 3px;
  2145. line-height: 30px;
  2146. background: rgba(50,50,50,0.5);
  2147. }
  2148. .ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-left {
  2149. float: left;
  2150. height: 30px;
  2151. width: 180px;
  2152. padding-left: 6px;
  2153. }
  2154. .ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right {
  2155. float: right;
  2156. height: 30px;
  2157. width: 180px;
  2158. text-align: right;
  2159. padding-right: 6px;
  2160. }
  2161. .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color'] {
  2162. background: black;
  2163. border: none;
  2164. transition: background .15s ease-in-out;
  2165. }
  2166. .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color']:hover {
  2167. background: #282828;
  2168. }
  2169. .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='text'], .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='number'] {
  2170. background: rgba(0,0,0,0.8);
  2171. border: 1px solid black;
  2172. width: 80px;
  2173. color: #CCCCCC;
  2174. text-align: right;
  2175. }
  2176. .ns-rpanel .ns-save-button {
  2177. position: absolute;
  2178. bottom: 10px;
  2179. right: 10px;
  2180. height: 30px;
  2181. width: 70px;
  2182. font-size: 20px;
  2183. line-height: 30px;
  2184. text-align: center;
  2185. border: 1px solid #333333;
  2186. background: rgba(50,50,50,0.5);
  2187. cursor: pointer;
  2188. transition: background .1s ease-in-out;
  2189. }
  2190. .ns-rpanel .ns-save-button:hover {
  2191. background: rgba(50,50,50,0.7);
  2192. }
  2193. .ns-list-wrapper {
  2194. background: rgba(50,50,50,0.5);
  2195. width: 350px;
  2196. margin: 10px;
  2197. border: 1px solid #333333;
  2198. }
  2199. .ns-list-wrapper .ns-list-header {
  2200. text-align: center;
  2201. height: 20px;
  2202. font-size: 15px;
  2203. line-height: 20px;
  2204. }
  2205. .ns-list-wrapper .ns-list-content {
  2206. min-height: 80px;
  2207. max-height: 1700px;
  2208. overflow-y: auto;
  2209. border-top: 1px solid #333333;
  2210. border-bottom: 1px solid #333333;
  2211. }
  2212. .ns-list-wrapper .ns-list-content .ns-list-item {
  2213. cursor: pointer;
  2214. margin: 1px;
  2215. background: rgba(50,50,50,0.4);
  2216. text-align: center;
  2217. height: 15px;
  2218. line-height: 15px;
  2219. font-size: 12px;
  2220. }
  2221. .ns-list-wrapper .ns-list-bottombar {
  2222. height: 20px;
  2223. }
  2224. .ns-list-wrapper .ns-list-bottombar .ns-list-input {
  2225. float: left;
  2226. width: 270px;
  2227. }
  2228. .ns-list-wrapper .ns-list-bottombar .ns-list-input input {
  2229. background: rgba(0,0,0,0.8);
  2230. border: 1px solid black;
  2231. color: #CCCCCC;
  2232. width: 320px;
  2233. }
  2234. .ns-list-wrapper .ns-list-bottombar .ns-list-addbtt {
  2235. width: 20px;
  2236. float: right;
  2237. text-align: center;
  2238. line-height: 20px;
  2239. background: rgba(50,50,50,0.6);
  2240. cursor: pointer;
  2241. }
  2242. .ns-list-wrapper .ns-list-bottombar .ns-list-addbtt:hover {
  2243. background: rgba(50,50,50,0.9);
  2244. }
  2245. `;
  2246. var $style = document.createElement("style");
  2247. $style.innerHTML = css;
  2248. document.head.appendChild($style);
  2249. };
  2250. this.init = function() {
  2251. this.initHTML();
  2252. this.initCss();
  2253. };
  2254. })({
  2255. get: settings.get,
  2256. set: settings.set,
  2257. onSave: this.onSettingsUpdate,
  2258. header: "miniMapPlus",
  2259. data: {
  2260. "Kolory": [
  2261. {
  2262. key: "/colors/hero",
  2263. name: "Twoja postać",
  2264. type: "color"
  2265. },
  2266. {
  2267. key: "/colors/other",
  2268. name: "Inni gracze",
  2269. type: "color"
  2270. },
  2271. {
  2272. key: "/colors/friend",
  2273. name: "Znajomi",
  2274. type: "color"
  2275. },
  2276. {
  2277. key: "/colors/enemy",
  2278. name: "Wrogowie",
  2279. type: "color"
  2280. },
  2281. {
  2282. key: "/colors/clan",
  2283. name: "Klanowicze",
  2284. type: "color"
  2285. },
  2286. {
  2287. key: "/colors/ally",
  2288. name: "Sojusznicy",
  2289. type: "color"
  2290. },
  2291. {
  2292. key: "/colors/npc",
  2293. name: "Zwykły NPC",
  2294. type: "color"
  2295. },
  2296. {
  2297. key: "/colors/mob",
  2298. name: "Zwykły mob",
  2299. type: "color"
  2300. },
  2301. {
  2302. key: "/colors/elite",
  2303. name: "Elita",
  2304. type: "color"
  2305. },
  2306. {
  2307. key: "/colors/elite2",
  2308. name: "Elita II/eventowa",
  2309. type: "color"
  2310. },
  2311. {
  2312. key: "/colors/elite3",
  2313. name: "Elita III",
  2314. type: "color"
  2315. },
  2316. {
  2317. key: "/colors/heros",
  2318. name: "Heros",
  2319. type: "color"
  2320. },
  2321. {
  2322. key: "/colors/titan",
  2323. name: "Tytan",
  2324. type: "color"
  2325. },
  2326. {
  2327. key: "/colors/item",
  2328. name: "Przedmiot",
  2329. type: "color"
  2330. },
  2331. {
  2332. key: "/colors/gw",
  2333. name: "Przejście",
  2334. type: "color"
  2335. }
  2336. ],
  2337. "Wygląd mapy": [
  2338. {
  2339. key: "/mapsize",
  2340. name: "Rozmiar mapy",
  2341. type: "range",
  2342. tip: "Zmiany widoczne po odświeżeniu gry",
  2343. data: [0.6, 1.4]
  2344. },
  2345. {
  2346. key: "/opacity",
  2347. name: "Widoczność mapy",
  2348. type: "range",
  2349. data: [0.5, 1]
  2350. },
  2351. {
  2352. key: "/darkmode",
  2353. name: "Motyw ciemny",
  2354. type: "check"
  2355. }
  2356. ],
  2357. "Tracking": [
  2358. {
  2359. type: "info",
  2360. t1: "Co to jest?",
  2361. t2: "",
  2362. tip: "Tracking (tropienie) to alternatywna opcja wyszukiwania NPC/itemów na mapie. Polega na tym, że gdy na mapie pojawi się coś z poniższej listy, w oknie gry ukaże się strzałka, która będzie wzkazywała drogę do tej rzeczy.<br>Dodatkowo gdy na mapie pojawia się heros, automatycznie uruchamia się tracking na niego, co jest przydatne np. w podchodzeniu do herosów eventowych."
  2363. },
  2364. {
  2365. key: "/trackedNpcs",
  2366. name: "Tracking NPC",
  2367. type: "list"
  2368. },
  2369. {
  2370. key: "/trackedItems",
  2371. name: "Tracking itemów",
  2372. type: "list"
  2373. }
  2374.  
  2375. ],
  2376. "Inne": [
  2377. {
  2378. key: "/minlvl",
  2379. name: "Min. lvl potworków",
  2380. type: "numstring"
  2381. },
  2382. {
  2383. key: "/maxlvl",
  2384. name: "Max. przewaga",
  2385. tip: "Maksymalna różnica poziomów między Tobą a potworkiem przy której nie niszczy się loot na świecie na którym grasz. Jeśli nie wiesz co to, zostaw 13.",
  2386. type: "numstring"
  2387. },
  2388. {
  2389. key: "/show",
  2390. name: "Hotkey",
  2391. type: "char"
  2392. },
  2393. {
  2394. key: "/altmobilebtt",
  2395. name: "Przesuń przycisk mobilny",
  2396. type: "check",
  2397. tip: "Przesuwa przycisk widoczny na urządzeniach mobilnych pomiędzy torby"
  2398. },
  2399. {
  2400. key: "/interpolerate",
  2401. name: "Animacje na mapie",
  2402. type: "check"
  2403. },
  2404. {
  2405. key: "/showqm",
  2406. name: "Zaznaczaj questy",
  2407. type: "check"
  2408. },
  2409. {
  2410. key: "/novisibility",
  2411. name: "Nie pokazuj \"mgły wojny\"",
  2412. type: "check",
  2413. tip: "Wyłącza pokazywanie widzianego obszaru na czerwonych mapach.<br>Nie pozdrawiam klanu Game Over (Jaruna), który utrudniał testowanie tej funkcjonalności dedając mnie bez powodu."
  2414. }
  2415. /*,
  2416. {
  2417. key: "/showevonetwork",
  2418. name: "Pokazuj postacie z WSync",
  2419. tip: "World Sync to dodatek stworzony przez CcarderRa, który pozwala widzieć graczy z innych światów. Jest częścią Evolution Managera, którego można znaleźć na forum w dziale Dodatki do gry.",
  2420. type: "check"
  2421. }*/
  2422. ],
  2423. "Informacje": [
  2424. {
  2425. type: "info",
  2426. t1: "Wersja",
  2427. t2: "v"+this.version+(interface == "new" ? " NI" : (interface == "old" ? " SI" : " OM"))
  2428. },
  2429. {
  2430. type: "info",
  2431. t1: "Źródło instalacji",
  2432. t2: this.getInstallSource()
  2433. },
  2434. {
  2435. type: "info-async",
  2436. t1: "Licznik instalacji",
  2437. placeholder: "wczytywanie...",
  2438. tip: "Liczy od wersji 3.1 minimapy",
  2439. fun: this.installationCounter.get
  2440. }
  2441. ]
  2442. }
  2443. });
  2444. this.init();
  2445. niceSettings.init();
  2446. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement