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