anythingpls

Untitled

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