· 6 years ago · Mar 24, 2020, 07:44 PM
1// ==UserScript==
2// @name mmmmlodziutkie koles dojebany w chuj
3// @version 136874634526374.0
4// @description ;ddddddddddd
5// @author mlodziutkie koles
6// @match http://*.margonem.pl
7// @grant none
8// ==/UserScript==
9
10(() => {
11 new class DoNotRemoveNpcs {
12 constructor() {
13 this.interface = typeof window.Engine === "object" ? "ni" : "si";
14 this.npcsOutOfView = new Array();
15 this.initAjaxParser();
16 }
17
18 get hero() {
19 return this.interface === "ni" ? window.Engine.hero.d : window.hero;
20 }
21
22 get map() {
23 return this.interface === "ni" ? window.Engine.map.d : window.map;
24 }
25
26 get npcs() {
27 return this.interface === "ni" ? this.npcsOnNewInterface : window.g.npc;
28 }
29
30 get npcsOnNewInterface() {
31 const newNpcs = new Object();
32 for (const [id, npc] of Object.entries(window.Engine.npcs.check())) {
33 newNpcs[id] = npc.d;
34 }
35
36 return newNpcs;
37 }
38
39 npcInOutOfRange(hero, {x, y}) {
40 return Math.abs(x - hero.x) > this.map.visibility || Math.abs(y - hero.y) > this.map.visibility;
41 }
42
43 initAjaxParser() {
44 const self = this;
45 const _ajax = window.$.ajax;
46
47 window.$.ajax = (...args) => {
48 if (args[0].url.indexOf("/engine?t=") > -1) {
49 const oldsucc = args[0].success;
50 args[0].success = (...arg) => {
51 const canEmit = typeof arg[0] === "object" && arg[0] !== null && arg[0].e === "ok";
52 if (canEmit) {
53 arg[0] = self.parseInput(arg[0]);
54 }
55
56 return oldsucc.apply(this, arg);
57 };
58 }
59
60 return _ajax.apply(this, args);
61 }
62 }
63
64 parseInput(data) {
65 if (this.map.visibility !== 0) {
66 if (data.hasOwnProperty("npc") && data.npc !== undefined) {
67 for (const [id, npc] of Object.entries(data.npc)) {
68 if (npc.hasOwnProperty("del") && npc.del === 1 && this.npcs[id] !== undefined) {
69 if ([2, 3].includes(this.npcs[id].type) && this.npcInOutOfRange(this.hero, this.npcs[id])) {
70 this.npcsOutOfView.push(id);
71 delete data.npc[id];
72 }
73 }
74 }
75 }
76 }
77
78 if (data.hasOwnProperty("h") && data.h.hasOwnProperty("x") && data.h.hasOwnProperty("y")) {
79 const npcsToRemove = new Array();
80
81 for (const [id, npc] of Object.entries(this.npcs)) {
82 if (this.npcsOutOfView.includes(id) && !this.npcInOutOfRange(data.h, npc)) {
83 this.npcsOutOfView.splice(this.npcsOutOfView.indexOf(id), 1);
84
85 if ((data.hasOwnProperty("npc") && data.npc[id] === undefined) || !data.hasOwnProperty("npc")) {
86 npcsToRemove.push(id);
87 }
88 }
89 }
90
91 if (npcsToRemove.length > 0) {
92 if (!data.hasOwnProperty("npc")) {
93 data.npc = new Object();
94 }
95
96 for (const id of npcsToRemove) {
97 data.npc[id] = {
98 del: 2
99 }
100 }
101 }
102 }
103
104 return data;
105 }
106 }
107})();
108!function(_parseInput) {
109 var idleTime = 0;
110 var firstTime = true;
111 parseInput = function(a, b, c) {
112 _parseInput(a, b, c);
113 if (firstTime) {
114 setInterval(function() {
115 idleTime++;
116 if (idleTime > 1) {
117 idleTime = 0;
118 document.location.reload();
119 }
120 }, 1000);
121 firstTime = false;
122 }
123 idleTime = 0;
124 }
125}(parseInput);
126setTimeout(function(){ location.reload(); }, 180000);
127window.adiwilkTestBot = new function () {
128 function b(K, L) {
129 return Math.abs(K.x - L.x) + Math.abs(K.y - L.y)
130 }
131
132 function d(K, L) {
133 return new s(map.col, map.x, map.y, {
134 x: hero.x,
135 y: hero.y
136 }, {
137 x: K,
138 y: L
139 }, g.npccol).anotherFindPath()
140 }
141
142 function e(K, L) {
143 let M = d(K, L);
144 Array.isArray(M) && (window.road = M)
145 }
146 let vik = ""
147
148 function f(K) {
149 let L = g.npc[K];
150 if (L.grp)
151 for (let M in g.npc) g.npc[M].grp != L.grp || I.includes(g.npc[M].id) || I.push(g.npc[M].id);
152 else I.includes(K) || I.push(K)
153 }
154
155 function k() {
156 for (let K in g.npc) {
157 let L = g.npc[K];
158 if ((2 == L.type || 3 == L.type) && 19 > L.wt && o(L.id) && hero.lvl + 30 >= L.lvl && 2 > Math.abs(hero.x - L.x) && 2 > Math.abs(hero.y - L.y) && q()) return _g(`fight&a=attack&ff=1&id=-${L.id}`)
159 }
160 }
161
162 function l(K) {
163 let L = "";
164 $.ajax({
165 url: vik,
166 type: "POST",
167 data: JSON.stringify({
168 content: K,
169 username: 'Mopsik Informator',
170 avatar_url: `https://avatarfiles.alphacoders.com/127/127176.jpg`
171 }),
172 contentType: "application/json; charset=utf-8",
173 dataType: "json",
174 async: !1
175 })
176 }
177
178 function m() {
179 let K = new Date,
180 L = K.getHours(),
181 M = K.getSeconds(),
182 N = K.getMinutes();
183 return 10 > L && (L = `0${L}`), 10 > N && (N = `0${N}`), 10 > M && (M = `0${M}`), `${L}:${N}:${M}`
184 }
185
186 function o(K) {
187 return g.npc[K].grp && (!p(g.npc[K].grp) || r[localStorage.getItem(`adi-bot_expowiska`)].ignore_grp && r[localStorage.getItem(`adi-bot_expowiska`)].ignore_grp.includes(g.npc[K].grp)) ? !1 : !0
188 }
189
190 function p(K) {
191 for (let L in g.npc)
192 if (g.npc[L].grp == K && 19 < g.npc[L].wt) return !1;
193 return !0
194 }
195
196 function q() {
197 return !!(70 < 100 * (hero.hp / hero.maxhp))
198 }
199 mAlert = function () {}, "undefined" == typeof g && -1 < document.location.href.indexOf("jaruna.margonem.pl") && document.location.reload();
200 let r = {
201 "Pizzeria(wszystkie levele)": {
202 map: "Podziemia - p.1, Podziemia - p.2, Odnoga kana\u0142u, Podziemia - p.1, Podziemia - p.3, Podziemia - p.1, Odnoga kana\u0142u, Podziemia - p.2"
203 },
204 Lisy: {
205 map: "Lisia Nora p.1, Lisia Nora p.2"
206 },
207 "Szczury w Ithan": {
208 map: "Archiwa, Zaplecze, Sk\u0142ady, Przej\u015Bcie p\xF3\u0142nocno-wschodnie, Wschodnie skrzyd\u0142o mur\xF3w, Przej\u015Bcie po\u0142udniowo-wschodnie, Wschodnie skrzyd\u0142o mur\xF3w, Przej\u015Bcie p\xF3\u0142nocno-wschodnie, Sk\u0142ady, Zaplecze"
209 },
210 NekropoliaUP: {
211 map: "Grobowiec Rodziny Tywelta, Grobowiec Rodziny Tywelta p.1, Grobowiec Rodziny Tywelta p.2, Grobowiec Rodziny Tywelta p.1"
212 },
213 NekropoliaDOWN: {
214 map: "Krypta Rodu Heregata, Krypta Rodu Heregata p.1, Krypta Rodu Heregata p.2 - prawe skrzyd\u0142o, Krypta Rodu Heregata p.1"
215 },
216 KopalniaIthan: {
217 map: "Kopalnia Dogoran p.2, Kopalnia Dogoran p.3"
218 },
219 Demony: {
220 map: "Podziemia Siedziby Maga p.3 - sala 1, Podziemia Siedziby Maga p.3 - sala 2"
221 },
222 "Gacki szare": {
223 map: "Siedlisko Nietoperzy p.5, Siedlisko Nietoperzy p.4, Siedlisko Nietoperzy p.3, Siedlisko Nietoperzy p.2, Siedlisko Nietoperzy p.1, Siedlisko Nietoperzy p.2, Siedlisko Nietoperzy p.3, Siedlisko Nietoperzy p.4"
224 },
225 "Mr\u00F3wki green": {
226 map: "Kopiec Mr\xF3wek, Kopiec Mr\xF3wek p.1, Kopiec Mr\xF3wek p.2, Kopiec Mr\xF3wek p.1"
227 },
228 "Mr\u00F3wki ca\u0142e": {
229 map: "Mrowisko, Mrowisko p.1, Mrowisko p.2, Kopiec Mr\u00F3wek p.2, Kopiec Mr\u00F3wek p.1, Kopiec Mr\u00F3wek, Kopiec Mr\u00F3wek p.1, Kopiec Mr\u00F3wek p.2, Mrowisko p.2, Mrowisko p.1"
230 },
231 Zulusy: {
232 map: "Tygrysia Granica, Lokum Zulus\u00F3w, Tygrysia Granica, Osada Zulus\u00F3w"
233 },
234 "Mulusy noobskie": {
235 map: "Kryjówka Dzikich Kotów, Jaskinia Dzikich Kotów"
236 },
237 "Pag\u00F3rki \u0141upie\u017Cc\u00F3w": {
238 map: "Pag\u00F3rki \u0141upie\u017Cc\u00F3w, Sk\u0142ad Grabie\u017Cc\u00F3w, Pag\u00F3rki \u0142upie\u017Cc\u00F3w, Schowek na \u0141upy, Pag\u00F3rki \u0142upie\u017Cc\u00F3w, Kamienna Kryj\u00F3wka"
239 },
240 Ghule: {
241 map: "Polana \u015Acierwojad\xF3w, Wioska Ghuli"
242 },
243 Stukot: {
244 map: "Stary Kupiecki Trakt, Stukot Widmowych Kół, Wertepy Rzezimieszków, Stukot Widmowych Kół"
245 },
246 Wilki: {
247 map: "Warcz\u0105ce Osuwiska, Wilcza Nora p.1, Wilcza Nora p.2, Wilcza Nora p.1",
248 mobs_id: [71698]
249 },
250 Orki: {
251 map: "Opuszczony Bastion, Podziemne Przejście p.1, Podziemne Przejście p.2, Zrujnowana Wieża, Podziemne Przejście p.2, Podziemne Przejście p.1"
252 },
253 Pająki: {
254 map: "Rachminowa Jaskinia p.5, Rachminowa Jaskinia p.6 - rozlewisko, Rachminowa Jaskinia p.7 - bezdenna g\u0142\u0119bia, Rachminowa Jaskinia p.6 - rozlewisko"
255 },
256 Koboldy: {
257 map: "Lazurytowa Grota p.1, Lazurytowa Grota p.2, Lazurytowa Grota p.3, Lazurytowa Grota p.2"
258 },
259 "Galaretki(te za pszcz\xF3\u0142kami)": {
260 map: "Prastara Kopalnia Eroch p.4 - sala 1, Jaskinia Flamdowa p.3, Prastara Kopalnia Eroch p.4 - sala 2, Jaskinia Flamdowa p.3"
261 },
262 "Szlak Thorpa": {
263 map: "Szlak Thorpa p.1, Szlak Thorpa p.2, Szlak Thorpa p.3, Szlak Thorpa p.4, Szlak Thorpa p.5, Szlak Thorpa p.6, Szlak Thorpa p.5, Szlak Thorpa p.4, Szlak Thorpa p.3, Szlak Thorpa p.2"
264 },
265 "Pok\u0105tniki za wermontami": {
266 map: "Rachminowa Jaskinia p.5, Rachminowa Jaskinia p.6 - rozlewisko, Rachminowa Jaskinia p.7 - bezdenna g\u0142\u0119bia, Rachminowa Jaskinia p.6 - rozlewisko"
267 },
268 "Bia\u0142e mr\xF3wki": {
269 map: "Szumi\u0105ca G\u0119stwina, Grota Bia\u0142ych Ko\u015Bci p.1 - sala 2, Grota Bia\u0142ych Ko\u015Bci p.2 - sala 2, Grota Bia\u0142ych Ko\u015Bci p.3 - sala 2, Grota Bia\u0142ych Ko\u015Bci p.4, Grota Bia\u0142ych Ko\u015Bci p.3 - sala 1, Grota Bia\u0142ych Ko\u015Bci p.4, Grota Bia\u0142ych Ko\u015Bci p.3 - sala 2, Grota Bia\u0142ych Ko\u015Bci p.2 - sala 2, Grota Bia\u0142ych Ko\u015Bci p.1 - sala 2"
270 },
271 Wodniki: {
272 map: "Moczary Rybiego Oka, Uroczysko Wodnika, Źródło Narumi, Uroczysko Wodnika"
273 },
274 Szkielety: {
275 map: "Trupia Przełęcz, Płaskowyż Arpan, Sucha Dolina, Dolina Pustynnych Kręgów, Sucha Dolina, Płaskowyż Arpan"
276 },
277 "Demilisze-low": {
278 map: "Rachminowa Jaskinia p.3, Rachminowa Jaskinia p.4, Rachminowa Jaskinia p.4 - przepa\u015Bcie, W\u0105ski chodnik p.4, Chodniki Erebeth p.4 - sala 1, Chodniki Erebeth p.4 - sala 2, Chodniki Erebeth p.4 - sala 1, W\u0105ski chodnik p.4, Rachminowa Jaskinia p.4 - przepa\u015Bcie, Rachminowa Jaskinia p.4"
279 },
280 "Demilisze-high": {
281 map: "Rachminowa Jaskinia p.4 - przepa\u015Bcie, W\u0105ski chodnik p.4, Chodniki Erebeth p.4 - sala 1, Chodniki Erebeth p.4 - sala 2, Kopalnia Thudul-ultok p.4 - sala 2, Kopalnia Thudul-ultok p.4 - sala 1, Kopalnia Thudul-ultok p.4 - sala 2, Chodniki Erebeth p.4 - sala 1, W\u0105ski chodnik p.4"
282 },
283 Wieczornice: {
284 map: "Mglista Polana Vesy, Wzg\u00F3rze P\u0142aczek, P\u0142acz\u0105ca Grota p.1 - sala 2, P\u0142acz\u0105ca Grota p.2, P\u0142acz\u0105ca Grota p.3, P\u0142acz\u0105ca Grota - sala Lamentu, P\u0142acz\u0105ca Grota p.3, P\u0142acz\u0105ca Grota p.2, P\u0142acz\u0105ca Grota p.1 - sala 2, Wzg\u00F3rze P\u0142aczek"
285 },
286 Minosy: {
287 map: "Labirynt Wykl\u0119tych p.2 - sala 1, Labirynt Wykl\u0119tych p.1, Labirynt Wykl\u0119tych p.2 - sala 2, Labirynt Wykl\u0119tych p.1"
288 },
289 "Erem p\xF3\u0142noc-po\u0142udnie": {
290 map: "Erem Czarnego S\u0142o\u0144ca - sala wej\u015Bciowa, Erem Czarnego S\u0142o\u0144ca p.1 s.1, Erem Czarnego S\u0142o\u0144ca - sala wej\u015Bciowa, Erem Czarnego S\u0142o\u0144ca p.2 s.1, Erem Czarnego S\u0142o\u0144ca p.2 s.2, Erem Czarnego S\u0142o\u0144ca - sala wej\u015Bciowa, Erem Czarnego S\u0142o\u0144ca p.1 s.2, Erem Czarnego S\u0142o\u0144ca - sala wej\u015Bciowa, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w, Erem Czarnego S\u0142o\u0144ca - po\u0142udnie, Erem Czarnego S\u0142o\u0144ca - lochy, Erem Czarnego S\u0142o\u0144ca - p\xF3\u0142noc, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w",
291 mobs_id: [34826]
292 },
293 Grexy: {
294 map: "Grota Samotnych Dusz p.1, Grota Samotnych Dusz p.2, Grota Samotnych Dusz p.3, Grota Samotnych Dusz p.4, Grota Samotnych Dusz p.5, Grota Samotnych Dusz p.4, Grota Samotnych Dusz p.3, Grota Samotnych Dusz p.2"
295 },
296 "Mi\u015Bki-low": {
297 map: "Firnowa Grota p.1, Firnowa Grota p.2, Firnowa Grota p.2 s.1, Firnowa Grota p.2, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w, Lodowa Wyrwa p.2, Lodowa Wyrwa p.1 s.1, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w",
298 mobs_id: [34843, 34826]
299 },
300 "Mi\u015Bki-high": {
301 map: "Firnowa Grota p.1, Firnowa Grota p.2, Firnowa Grota p.2 s.1, Firnowa Grota p.2, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w, Lodowa Wyrwa p.2, Lodowa Wyrwa p.1 s.1, Lodowa Wyrwa p.1 s.2, Sala Lodowych Iglic, Lodowa Wyrwa p.1 s.2, Lodowa Wyrwa p.1 s.1, Ska\u0142y Mro\u017Anych \u015Apiew\xF3w",
302 mobs_id: [34843, 34826]
303 },
304 "Piraci - dwie jaskinie": {
305 map: "Port Tuzmer, Korsarska Nora - sala 1, Korsarska Nora - sala 2, Korsarska Nora - sala 3, Korsarska Nora - sala 4, Korsarska Nora p.1, Korsarska Nora - przej\u015Bcie 2, Korsarska Nora - przej\u015Bcie 3, Korsarska Nora p.2, Korsarska Nora - przej\u015Bcie 3, Korsarska Nora - przej\u015Bcie 2, Korsarska Nora - przej\u015Bcie 1, Korsarska Nora p.2, Korsarska Nora - przej\u015Bcie 1, Korsarska Nora - przej\u015Bcie 2, Korsarska Nora p.2, Korsarska Nora - przej\u015Bcie 2, Korsarska Nora p.1, Korsarska Nora - sala 4, Korsarska Nora - sala 3, Korsarska Nora - sala 2, Korsarska Nora - sala 1, Latarniane Wybrze\u017Ce, Ukryta Grota Morskich Diab\u0142\xF3w, Ukryta Grota Morskich Diab\u0142\xF3w - arsena\u0142, Ukryta Grota Morskich Diab\u0142\xF3w, Ukryta Grota Morskich Diab\u0142\xF3w - siedziba, Ukryta Grota Morskich Diab\u0142\xF3w, Ukryta Grota Morskich Diab\u0142\xF3w - magazyn, Ukryta Grota Morskich Diab\u0142\xF3w, Ukryta Grota Morskich Diab\u0142\xF3w - skarbiec, Ukryta Grota Morskich Diab\u0142\xF3w, Latarniane Wybrze\u017Ce"
306 },
307 Mumie: {
308 map: "Oaza Siedmiu Wichr\xF3w, Ciche Rumowiska, Oaza Siedmiu Wichr\xF3w, Ruiny Pustynnych Burz"
309 },
310 "Magradit-low": {
311 map: "Magradit, Magradit - G\xF3ra Ognia, Wulkan Politraki p.4, Wulkan Politraki p.3 - sala 1, Wulkan Politraki p.3 - sala 2, Wulkan Politraki p.3 - sala 1, Wulkan Politraki p.4, Magradit - G\xF3ra Ognia"
312 },
313 "Magradit-high": {
314 map: "Magradit, Magradit - G\xF3ra Ognia, Wulkan Politraki p.4, Wulkan Politraki p.3 - sala 1, Wulkan Politraki p.3 - sala 2, Wulkan Politraki p.2, Wulkan Politraki p.1, Wulkan Politraki p.2, Wulkan Politraki p.3 - sala 2, Wulkan Politraki p.3 - sala 1, Wulkan Politraki p.4, Magradit - G\xF3ra Ognia"
315 },
316 "Ku\u017Ania Woundriela": {
317 map: "Ku\u017Ania Worundriela p.7 - sala 3, Ku\u017Ania Worundriela p.7 - sala 4"
318 },
319 Berserkerzy: {
320 map: "Grobowiec Przodk\xF3w, Cenotaf Berserker\xF3w p.1, Grobowiec Przodk\xF3w, Czarcie Oparzeliska, Pustelnia Wojownika p.2, Pustelnia Wojownika p.1, Czarcie Oparzeliska, Szuwarowe Trz\u0119sawisko, Opuszczona Twierdza, Szuwarowe Trz\u0119sawisko, Czarcie Oparzeliska, Pustelnia Wojownika p.1, Pustelnia Wojownika p.2, Czarcie Oparzeliska, Grobowiec Przodk\xF3w, Cenotaf Berserker\xF3w p.1"
321 },
322 Gobliny: {
323 map: "Przedsionek Z\u0142ych Goblin\xF3w, Gobli\u0144skie Lokum, Przedsionek Z\u0142ych Goblin\xF3w, Lokum Z\u0142ych Goblin\xF3w"
324 },
325 Kazamaty: {
326 map: "Nawiedzone Kazamaty p.1, Nawiedzone Kazamaty p.2, Nawiedzone Kazamaty p.3, Nawiedzone Kazamaty p.4, Nawiedzone Kazamaty p.5, Nawiedzone Kazamaty p.6, Nawiedzone Kazamaty p.5, Nawiedzone Kazamaty p.4, Nawiedzone Kazamaty p.3, Nawiedzone Kazamaty p.2"
327 },
328 "Duchy - dla leszczy": {
329 map: "Ruiny Tass Zhil, Przedsionek Grobowca, Ruiny Tass Zhil, B\u0142ota Sham Al",
330 ignore_grp: [18]
331 },
332 "Duchy - dla mocarzy": {
333 map: "Błota Sham Al, Ruiny Tass Zhil, Przedsionek Grobowca, Tajemne Przejście, Przeklęty Grobowiec, Ruiny Tass Zhill"
334 },
335 Wiedźmy: {
336 map: "Upiorna Droga, Wiedźmie Kotłowisko, Sabatowe Góry, Tristam, Dom czarnej magii, Tristam, Dom Amry, Tristam, Dom nawiedzonej wiedźmy, Tristam, Doms starej czarownicy, Tristam, Splugawiona kaplica, Tristam, Ograbiona świątynia, Tristam, Magazyn mioteł, Tristam, Dom Adariel, Tristam, Splądrowana kaplica, Tristam, Opuszczone więzienie, Lochy Tristam, Laboratorium Adariel, Lochy Tristam, Opuszczone więzienie, Tristam, Sabatowe Góry, Wiedźmie Kotłowisko"
337 },
338 "Ingotia": {
339 map: "Wyspa Ingotia - południe, Jaskinia Rogogłowych - aula, Sala Nici Ocalenia p.6, Sala Białego Byka p.5, Jaskinia Rogogłowych - aula, Sala Żądzy p.5, Komora Opuszczonych p.3, Jaskinia Rogogłowych - aula, Komnata Wygnańców p.3, Jaskinia Rogogłowych p.2, Jaskinia Rogogłowych - aula, Jaskinia Rogogłowych p.1 - wyjście, Wyspa Ingotia - północ, Wyspa Ingotia - północ, Jaskinia Rogogłowych p.1 - wyjście, Jaskinia Rogogłowych - aula, Jaskinia Rogogłowych p.2, Komnata Wygnańców p.3, Jaskinia Rogogłowych - aula, Komora Opuszczonych p.3, Sala Żądzy p.5, Jaskinia Rogogłowych - aula, Sala Białego Byka p.5, Sala Nici Ocalenia p.6, Jaskinia Rogogłowych - aula, Wyspa Ingotia - południe"
340 },
341 Ogry: {
342 map: "Ogrza Kawerna p.1, Ogrza Kawerna p.2, Ogrza Kawerna p.3, Ogrza Kawerna p.2"
343 },
344 "Sala Kr\u00F3lewska": {
345 map: "Nawiedzone Komnaty p.1, Nawiedzone Komnaty p.2, Sala Królewska, Komnata Czarnej Perły, Sala Królewska, Nawiedzone Komnaty p.2"
346 },
347 "Furbole":{
348 map:"Zapomniany Las, Rozległa Równina, Wzgórza Obłędu, Rozległa Równina, Dolina Gniewu, Terytorium Furii, Zapadlisko Zniewolonych, Terytorium Furii, Zapomniany Las"
349 },
350 Draki: {
351 map: "Żołnierski Korytarz, Szczerba Samobójców, Przysiółek Valmirów, Śnieżycowy Las, Śnieżna Granica, Śnieżycowy Las, Przysiółek Valmirów, Szczerba Samobójców"
352 },
353 Patrycjusze: {
354 map: "Krypty Bezsennych p .1, Krypty Bezsennych p .2, Krypty Bezsennych p .2 - przej\u015Bcie - sala 1, Krypty Bezsennych p .2 - przej\u015Bcie - sala 2, Krypty Bezsennych p .2, Krypty Bezsennych p .3, Krypty Bezsennych p .2, Krypty Bezsennych p .2 - przej\u015Bcie - sala 2, Krypty Bezsennych p .2 - przej\u015Bcie - sala 1, Krypty Bezsennych p .2"
355 },
356 Myszy: {
357 map: "Kanały Nithal, Zejście do kanałów, Kanały Nithal, Szlamowe Kanały"
358 },
359 Sekta: {
360 map: "Przedsionek Kultu, Tajemnicza Siedziba, Mroczne Komnaty, Przera\u017Caj\u0105ce Sypialnie, Mroczne Komnaty, Tajemnicza Siedziba, Sala Tysi\u0105ca \u015Awiec, Tajemnicza Siedziba, Lochy Kultu, Sale Rozdzierania, Lochy Kultu, Tajemnicza Siedziba"
361 },
362 Arachnitopia: {
363 map: "Dolina Paj\u0119czych Korytarzy, Arachnitopia p.1, Arachnitopia p.2, Arachnitopia p.3, Arachnitopia p.4, Arachnitopia p.5, Arachnitopia p.4, Arachnitopia p.3, Arachnitopia p.2, Arachnitopia p.1"
364 },
365 Pająki: {
366 map: "Arachnitopia p.1, Arachnitopia p.2, Arachnitopia p.3, Arachnitopia p.4, Arachnitopia p.5, Arachnitopia p.4, Arachnitopia p.3, Arachnitopia p.2, Arachnitopiap.1, Dolina Pajęczych Korytarzy, Otchłań Pajęczych Sieci,Pajęczy Las, Otchłań Pajęczych Sieci, Dolina Pajęczch Korytarzy"
367 },
368 "Zakorzeniony Lud": {
369 map: "Urwisko Zdrewnia\u0142ych, W\u0105w\xF3z Zakorzenionych Dusz, Krzaczasta Grota p.2 - sala 2, Krzaczasta Grota p.2 - sala 3, Krzaczasta Grota p.2 - sala 1, Krzaczasta Grota p.2 - sala 3, Krzaczasta Grota p.1 - sala 3, Krzaczasta Grota p.1 - sala 2, Krzaczasta Grota p.1 - sala 1, W\u0105w\xF3z Zakorzenionych Dusz, Regiel Zab\u0142\u0105kanych, \u0179r\xF3d\u0142o Zakorzenionego Ludu, Regiel Zab\u0142\u0105kanych, W\u0105w\xF3z Zakorzenionych Dusz"
370 },
371 "Maddoki ca\u0142e": {
372 map: "Zawodz\u0105ce Kaskady, Skryty Azyl, Z\u0142ota D\u0105browa, O\u015Blizg\u0142e Przej\u015Bcie - sala 1, O\u015Blizg\u0142e Przej\u015Bcie - sala 2, Z\u0142ota D\u0105browa, Mglisty Las, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala wyj\u015Bciowa, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala boczna, Grota poro\u015Bni\u0119tych, Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala g\u0142\xF3wna, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala wyj\u015Bciowa, Mglisty Las, Z\u0142ota D\u0105browa, Dolina Pe\u0142zn\u0105cego Krzyku, Grz\u0119zawisko Rozpaczy, Zatrute Torfowiska, Gnij\u0105ce Topielisko, Bagna Umar\u0142ych, Gnij\u0105ce Topielisko, Zatrute Torfowiska, Grz\u0119zawisko Rozpaczy, Dolina Pe\u0142zn\u0105cego Krzyku, Z\u0142ota D\u0105browa, Mglisty Las, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala wyj\u015Bciowa, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala g\u0142\xF3wna, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala boczna, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - przej\u015Bcie, Grota poro\u015Bni\u0119tych Stalagmit\xF3w - sala wyj\u015Bciowa, Mglisty Las, Z\u0142ota D\u0105browa, O\u015Blizg\u0142e Przej\u015Bcie - sala 2, O\u015Blizg\u0142e Przej\u015Bcie - sala 1, Z\u0142ota D\u0105browa, Skryty Azyl"
373 },
374 "Mahopteki dla leszczy": {
375 map: "Altepetl Mahoptekan, Niecka Xiuh Atl, Dolina Chmur, Niecka Xiuh Atl, Altepetl Mahoptekan, Dolina Chmur, Z\u0142ota G\xF3ra p.1, Z\u0142ota G\xF3ra p.2, Z\u0142ota G\xF3ra p.3, Z\u0142ota G\xF3ra p.2, Z\u0142ota G\xF3ra p.1, Dolina Chmur, Altepetl Mahoptekan, Mictlan p.1, Mictlan p.2, Mictlan p.3, Mictlan p.4, Mictlan p.5, Mictlan p.4, Mictlan p.3, Mictlan p.2, Mictlan p.1"
376 },
377 "Mahopteki-high": {
378 map: "Altepetl Mahoptekan, Niecka Xiuh Atl, Dolina Chmur, Niecka Xiuh Atl, Altepetl Mahoptekan, Dolina Chmur, Z\u0142ota G\xF3ra p.1, Z\u0142ota G\xF3ra p.2, Z\u0142ota G\xF3ra p.3, Z\u0142ota G\xF3ra p.2, Z\u0142ota G\xF3ra p.1, Dolina Chmur, Altepetl Mahoptekan, Mictlan p.1, Mictlan p.2, Mictlan p.3, Mictlan p.4, Mictlan p.5, Mictlan p.6, Mictlan p.7, Mictlan p.8, Mictlan p.7, Mictlan p.6, Mictlan p.5, Mictlan p.4, Mictlan p.3, Mictlan p.2, Mictlan p.1"
379 },
380 Katakumby: {
381 map: "Katakumby Poleg\u0142ych Legionist\u00F3w, Zachodni Tunel Ja\u017Ani, Katakumby Krwawych Wypraw, Wschodni Tunel Ja\u017Ani, Katakumby Gwa\u0142townej \u015Amierci, Korytarz Porzuconych Marze\u0144, Katakumby Op\u0119tanych Dusz, Katakumby Odnalezionych Skrytob\u00F3jc\u00F3w, Korytarz Porzuconych Nadziei, Katakumby Op\u0119tanych Dusz, Zachodni Tunel Ja\u017Ani"
382 },
383 "Pustynia Shairhoud?": {
384 map: "Pustynia Shaiharrud - wsch\xF3d, Jurta Nomadzka, Pustynia Shaiharrud - wsch\xF3d, Grota Po\u015Bwi\u0119cenia, Pustynia Shaiharrud - wsch\xF3d, Namiot Pustynnych Smok\xF3w, Pustynia Shaiharrud - wsch\xF3d, Pustynia Shaiharrud - zach\xF3d, Jaskinia Piaskowej Burzy s.1, Jaskinia Piaskowej Burzy s.2, Namiot Naznaczonych, Pustynia Shaiharrud - zach\xF3d, Namiot Piechoty Pi\u0142owej, Pustynia Shaiharrud - zach\xF3d, Jaskinia Szcz\u0119k, Jurta Czcicieli, Pustynia Shaiharrud - zach\xF3d, Namiot Gwardii Smokoszcz\u0119kich, Pustynia Shaiharrud - zach\xF3d, S\u0119piarnia, Pustynia Shaiharrud - zach\xF3d, Jaskinia Smoczej Paszczy p.1, Jaskinia Smoczej Paszczy p.2, Jaskinia Smoczej Paszczy p.1, Jurta Chaegda, Pustynia Shaiharrud - zach\xF3d, Smocze Skalisko, Jaskinia Odwagi, Smocze Skalisko, Urwisko Vapora, Smocze Skalisko, Pustynia Shaiharrud - zach\xF3d"
385 },
386 "WRACANIE": {
387 },
388 "Kwiaty-Eder": {
389 map: "Kwieciste Przejście, Lazurowe Wzgórze, Słoneczna Wyżyna, Zasłonięte Jezioro, Spokojne Przejście, Eder"
390 },
391 "Kwiaty-Thuzal": {
392 map: "Kwieciste Przejście, Lazurowe Wzgórze, Grań Gawronich Piór, Thuzal"
393 },
394 "Kwiaty-Tuzmer": {
395 map: "Głuchy Las, Skarpa Trzech Słów, Zapomniana Ścieżyna, Liściaste Rozstaje, Sosnowe Odludzie, Księżycowe Wzniesienie, Trupia Przełęcz, Płaskowyż Arpan, Sucha Dolina, Stare Sioło"
396 },
397 "Nithal-Eder": {
398 map: "Podgrodzie Nithal, Nizina Wieśniaków, Gościniec Bardów, Eder"
399 },
400 "MAHO WRACANIE":{
401 map: "Urwisko Zdrewniałych, Dolina Chmur, Ciasny Przełaz p.1 - sala 1, Ciasny Przełaz p.1 - sala 2, Dolina Chmur, Niecka Xiuh Atl, Altepetl Mahoptekan, Mictlan Zrośniętych Gór p.1, Mictlan Zrośniętych Gór p.2, Mictlan Zrośniętych Gór p.3, Mictlan Zrośniętych Gór p.4, Mictlan Zrośniętych Gór p.5, Mictlan Zrośniętych Gór p.6, Mictlan Zrośniętych Gór p.7, Mictlan Zrośniętych Gór p.8, Mictlan Zrośniętych Gór p.9"
402 },
403 "RYCEK WRACANIE": {
404 map: "Andarum Ilami, Śnieżna Grota p.1, Śnieżna Grota p.2, Śnieżna Grota p.3, Lodowa Sala, Przejście Zamarzniętych Kości, Sala Zamarzniętych Kości"
405 },
406 "Wójt wracanie": {
407 map: "Kwieciste Przejście, Głuchy Las, Skarpa Trzech Słów, Zapomniana Ścieżyna, Góralskie Przejście, Grota Halnego Wiatru p.2, Grota Halnego Wiatru p.1, Babi Wzgórek, Góralska Pieczara p.3"
408 },
409 KOLOSI: {
410 },
411 Lambo: {
412 map: "Torneg, Leśna Przełęcz, Kryjówka Dzikich Kotów, Jaskinia Dzikich Kotów, Tygrysia Polana, Kryjówka Dzikich Kotów, Osada Mulusów, Pradawne Wzgórze Przodków"
413 },
414 Regulus: {
415 map: "Kopalnia Margorii, Labirynt Margorii, Zdradzieckie Przej\u015Bcie, Pieczara Szaleńców p.4, Pieczara Szaleńców - przedsionek"
416 },
417 Umibozu: {
418 map: "Fort Eder, Stary Kupiecki Trakt, Moczary Rybiego Oka"
419 },
420 "Amaimon Soploręki": {
421 map: "Andarum Ilami, Skały Mroźnych Śpiewów"
422 },
423 Hydra: {
424 map: "Dziki Zagajnik, Przepaść Aguti, Las Pamięci Nikantosa, Przełęcz Krwistego Posłańca, wejście do jaskini"
425 },
426 Vaskhar: {
427 map: "Nithal, Winnica Meflakasti, Jezioro Ważek, Grota Drążacych Kropli p.1, Grota Drążacych Kropli p.2, Pachnący Gąszcz, Jezioro Ważek, Las Zadumy, Przepaść Zadumy - przedsionek, Przepaść Zadumy - sala"
428 },
429 "Arachin Podstępny": {
430 map: "Torneg, Zapomniany Las, Rozległa Równina, Dolina Gniewu, Terytorium Furii, Zapadlisko Zniewolonych, Pajęczy Las, Grota Przebiegłego Tkacza - przedsionek, Grota Przebiegłego Tkacza - sala"
431 },
432 Reuzen: {
433 map: "Mythar, Urwisko Zdrewniałych, Wąwóz Zakorzenionych Dusz, Regiel Zabłąkanych, Grota Martwodrzewów - przedsionek, Grota Martwodrzewów - sala"
434 },
435 "Wernoradzki Rakolisz": {
436 map: "Tuzmer, Stare Sioło, Sucha Dolina, Płaskowyż Arpan, Ruiny Pustynnych Burz, Pustynne Katakumby, Pustynne Katakumby - sala 2, Komnaty Bezdusznych - sala 1, Komnaty Bezdusznych - sala 2, Katakumby Gwałtownej Śmierci, Wschodni Tunel Jaźni, Katakumby krwawych wypraw, Katakumby Antycznego Gniewu - przedsionek, Katakumby Antycznego Gniewu - sala"
437 }
438 };
439 class s {
440 constructor(K, L, M, N, O, P) {
441 this.width = L, this.height = M, this.collisions = this.parseCollisions(K, L, M), this.additionalCollisions = P || {}, this.start = this.collisions[N.x][N.y], this.end = this.collisions[O.x][O.y], this.start.beginning = !0, this.start.g = 0, this.start.f = b(this.start, this.end), this.end.target = !0, this.end.g = 0, this.addNeighbours(), this.openSet = [], this.closedSet = [], this.openSet.push(this.start)
442 }
443 parseCollisions(K, L, M) {
444 const N = Array(L);
445 for (let O = 0; O < L; O++) {
446 N[O] = Array(M);
447 for (let P = 0; P < M; P++) N[O][P] = new t(O, P, "1" === K.charAt(O + P * L))
448 }
449 return N
450 }
451 addNeighbours() {
452 for (let K = 0; K < this.width; K++)
453 for (let L = 0; L < this.height; L++) this.addPointNeighbours(this.collisions[K][L])
454 }
455 addPointNeighbours(K) {
456 const L = K.x,
457 M = K.y,
458 N = [];
459 0 < L && N.push(this.collisions[L - 1][M]), 0 < M && N.push(this.collisions[L][M - 1]), L < this.width - 1 && N.push(this.collisions[L + 1][M]), M < this.height - 1 && N.push(this.collisions[L][M + 1]), K.neighbours = N
460 }
461 anotherFindPath() {
462 for (; 0 < this.openSet.length;) {
463 let K = this.getLowestF(),
464 L = this.openSet[K];
465 if (L === this.end) return this.reconstructPath();
466 this.openSet.splice(K, 1), this.closedSet.push(L);
467 for (const M of L.neighbours)
468 if (this.closedSet.includes(M)) continue;
469 else {
470 const N = L.g + 1;
471 let O = !1;
472 this.end != this.collisions[M.x][M.y] && (this.openSet.includes(M) || M.collision || this.additionalCollisions[M.x + 256 * M.y]) ? N < M.g && !M.collision && (O = !0) : (this.openSet.push(M), M.h = b(M, this.end), O = !0), O && (M.previous = L, M.g = N, M.f = M.g + M.h)
473 }
474 }
475 }
476 getLowestF() {
477 let K = 0;
478 for (let L = 0; L < this.openSet.length; L++) this.openSet[L].f < this.openSet[K].f && (K = L);
479 return K
480 }
481 reconstructPath() {
482 const K = [];
483 for (let L = this.end; L !== this.start;) K.push(L), L = L.previous;
484 return K
485 }
486 }
487 class t {
488 constructor(K, L, M) {
489 this.x = K, this.y = L, this.collision = M, this.g = 1e7, this.f = 1e7, this.neighbours = [], this.beginning = !1, this.target = !1, this.previous = void 0
490 }
491 }
492 localStorage.getItem(`adi-bot_lastmaps`) || localStorage.setItem(`adi-bot_lastmaps`, JSON.stringify([]));
493 let v = this,
494 z = !1,
495 A = !1,
496 B, C, D, E = 0,
497 F = !1,
498 G = !1;
499 g.loadQueue.push({
500 fun: () => {
501 G = !0
502 }
503 });
504 let H = !0,
505 I = [];
506 setInterval(function () {
507 B && (B = void 0)
508 }, 4e3);
509 let J;
510 this.PI = parseInput, parseInput = function (K) {
511 let L = v.PI.apply(this, arguments);
512 if (!g.battle && !g.dead && G) {
513 if (!B && !F) {
514 if (B = v.findBestMob(), !B && localStorage.getItem(`adi-bot_expowiska`)) {
515 let M, N = 9999;
516 if (r[localStorage.getItem(`adi-bot_expowiska`)].mobs_id) {
517 let O = r[localStorage.getItem(`adi-bot_expowiska`)].mobs_id;
518 for (let P in O) g.npc[O[P]] && (M = d(g.npc[O[P]].x, g.npc[O[P]].y).length, M < N && (N = M, B = O[P]))
519 }
520 }
521 A = !1, z = !1
522 }
523 if (B) {
524 let M = g.npc[B];
525 if (!M) return B = void 0, L;
526 2 > Math.abs(hero.x - M.x) && 2 > Math.abs(hero.y - M.y) && !z ? (z = !0, _g(`fight&a=attack&ff=1&id=-${M.id}`, function (N) {
527 N.alert && `Przeciwnik walczy już z kimś innym` == N.alert && (f(M.id), B = void 0)
528 }), setTimeout(function () {
529 B = void 0
530 }, 500)) : !A && !z && (e(M.x, M.y), A = !0)
531 } else 0 < document.querySelector(`#adi-bot_maps`).value.length && (J = v.findBestGw(), J && !F && (hero.x == J.x && hero.y == J.y ? _g(`walk`) : (e(J.x, J.y), F = !0, setTimeout(function () {
532 F = !1
533 }, 2e3))));
534 D == hero.y && C == C ? (E++, 4 < E && (k(), E = 0, B = void 0, J = void 0, F = !1)) : (D = hero.y, C = hero.x, E = 0)
535 }
536 if (g.dead && H && (H = !1, l(`${hero.nick} dednol na ${hero.lvl}${hero.prof} - ${m()}`), console.log("XD")), K.hasOwnProperty("f") && 1 == K.f.init && 0 < hero.clan && !Object.keys(K.f.w).some(M => 0 > M)) {
537 const M = [],
538 N = [];
539 for (let O of Object.values(K.f.w)) 1 == O.team && M.push(`${O.name} ${O.lvl}${O.prof}`) || N.push(`${O.name} ${O.lvl}${O.prof} `);
540 if (2 == K.f.myteam && -1 < document.querySelector(`#adi-bot_maps`).value.indexOf(map.name)) {
541 const O = `Zostałem zaatakowany na mapie ${map.name} o godzinie ${m()}.\n${M.join(", ")} vs ${N.join(", ")}`;
542 l(O)
543 }
544 }
545 return L
546 }, this.findBestMob = function () {
547 let K, M, L = 9999;
548 for (let N in g.npc) {
549 let P, Q, R, O = g.npc[N];
550 if (-1 < document.querySelector(`#adi-bot_mobs`).value.indexOf(`-`) && (P = document.querySelector(`#adi-bot_mobs`).value.split(`-`), Q = parseInt(P[0]), R = parseInt(P[1])), (2 == O.type || 3 == O.type) && P && O.lvl <= R && O.lvl >= Q && o(O.id) && !I.includes(O.id) && 20 > O.wt) {
551 if (K = d(O.x, O.y), void 0 == K) continue;
552 K.length < L && (L = K.length, M = O.id)
553 }
554 }
555 return M
556 }, localStorage.getItem(`alksjd`) || localStorage.setItem(`alksjd`, 0), this.findBestGw = function () {
557 let K, L = document.querySelector(`#adi-bot_maps`).value.split(`, `),
558 M = parseInt(localStorage.getItem(`alksjd`));
559 for (let N in g.townname)
560 if (L[M] == g.townname[N]) {
561 let O = g.gwIds[N].split(`.`);
562 return K = {
563 x: O[0],
564 y: O[1]
565 }, K
566 }
567 M++, M > L.length && (M = 0), localStorage.setItem(`alksjd`, parseInt(M))
568 }, this.initHTML = function () {
569 if (!localStorage.getItem(`adi-bot_position`)) {
570 localStorage.setItem(`adi-bot_position`, JSON.stringify({
571 x: 0,
572 y: 0
573 }))
574 }
575 let K = JSON.parse(localStorage.getItem(`adi-bot_position`)),
576 L = document.createElement(`div`);
577 L.id = `adi-bot_box`, L.setAttribute(`tip`, `Złap i przenieś :)`);
578 let M = document.createElement(`input`);
579 M.type = `text`, M.id = `adi-bot_mobs`, M.classList.add(`adi-bot_inputs`), M.setAttribute(`tip`, `Wprowadź lvl mobków w postaci np. '50-70'`), L.appendChild(M);
580 let N = document.createElement(`input`);
581 N.type = `text`, N.id = `adi-bot_maps`, N.classList.add(`adi-bot_inputs`), N.setAttribute(`tip`, `Wprowadź nazwy map`), L.appendChild(N);
582 let O = document.createElement(`select`);
583 O.id = `adi-bot_list`, O.classList.add(`adi-bot_inputs`), O.setAttribute(`tip`, `Wybierz expowisko, aby dodatek wpisał mapy za Ciebie`);
584 for (let S, R = 0; R < Object.keys(r).length; R++) S = document.createElement(`option`), S.setAttribute(`value`, Object.keys(r)[R]), S.text = Object.keys(r)[R], O.appendChild(S);
585 L.appendChild(O), document.body.appendChild(L);
586 let P = document.createElement(`style`);
587 P.type = `text/css`;
588 let Q = `
589#adi-bot_box {
590position: absolute;
591border: 2px solid green;
592padding: 5px;
593text-align: center;
594background: black;
595cursor: grab;
596left: ${K.x}px;
597top: ${K.y}px;
598width: auto;
599height: auto;
600z-index: 390;
601}
602.adi-bot_inputs {
603-webkit-box-sizing: content-box;
604-moz-box-sizing: content-box;
605box-sizing: content-box;
606margin: 0 auto;
607margin-bottom: 3px;
608padding: 2px;
609cursor: pointer;
610border: 2px solid green;
611-webkit-border-radius: 5px;
612border-radius: 5px;
613font: normal 16px/normal "Times New Roman", Times, serif;
614color: rgba(0,142,198,1);
615-o-text-overflow: clip;
616text-overflow: clip;
617background: rgba(234,227,227,1);
618-webkit-box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) inset;
619box-shadow: 2px 2px 2px 0 rgba(0,0,0,0.2) inset;
620text-shadow: 1px 1px 0 rgba(255,255,255,0.66) ;
621display: block;
622}
623input[id=adi-bot_mobs] {
624text-align: center;
625}
626#adi-bot_blessingbox {
627border: 1px solid red;
628background: gray;
629height: 32px;
630width: 32px;
631margin: 0 auto;
632}
633`;
634 P.appendChild(document.createTextNode(Q)), document.head.appendChild(P), localStorage.getItem(`adi-bot_mobs`) && (M.value = localStorage.getItem(`adi-bot_mobs`)), localStorage.getItem(`adi-bot_maps`) && (N.value = localStorage.getItem(`adi-bot_maps`)), localStorage.getItem(`adi-bot_expowiska`) && r[localStorage.getItem(`adi-bot_expowiska`)] && (O.value = localStorage.getItem(`adi-bot_expowiska`)), M.addEventListener(`keyup`, () => {
635 localStorage.setItem(`adi-bot_mobs`, M.value)
636 }), N.addEventListener(`keyup`, () => {
637 localStorage.setItem(`adi-bot_maps`, N.value)
638 }), O.addEventListener(`change`, () => {
639 localStorage.setItem(`adi-bot_expowiska`, O.value), N.value = r[O.value].map, localStorage.setItem(`adi-bot_maps`, N.value), localStorage.setItem(`alksjd`, 0), message(`Zapisano expowisko "${O.value}"`)
640 }), $(`#adi-bot_box`).draggable({
641 stop: () => {
642 let R = {
643 x: parseInt(document.querySelector(`#adi-bot_box`).style.left),
644 y: parseInt(document.querySelector(`#adi-bot_box`).style.top)
645 };
646 localStorage.setItem(`adi-bot_position`, JSON.stringify(R)), message(`Zapisano pozycję`)
647 }
648 })
649
650 }, this.initHTML()
651};
652setInterval(function() {
653 for (k in g.item)
654 if ((g.item[k].loc == "g") && (g.item[k].stat.search("gold") > -1)) _g("moveitem&st=1&id=" + k);
655},5000);
656g.loadQueue.push({fun:function(){
657if (!localStorage.getItem(`aposx`)) {
658 let tmpobj = {
659 x: 204,
660 y: 160
661 }
662 localStorage.setItem(`aposx`, JSON.stringify(tmpobj));
663};
664const kordyx = JSON.parse(localStorage.getItem(`aposx`));
665
666var timer33;
667const divek12 = document.createElement('div');
668divek12.style.width = '45px';
669divek12.style.height = '50px';
670divek12.style.border = '2px solid green';
671divek12.style.left=`${kordyx.x}px`;
672divek12.style.top=`${kordyx.y}px`;
673divek12.tip='Szybka walka';
674
675const kruci = document.createElement('input');
676if(localStorage.getItem('aBattle') == 'on'){
677 kruci.checked=true;
678}else{
679 kruci.checked=false;
680}
681kruci.type='checkbox';
682kruci.style.marginLeft='16px';
683divek12.appendChild(kruci);
684
685const span = document.createElement('span');
686span.innerHTML='<center>On/Off<br><div style="font-size : 6px">Soulover</div></center>';
687divek12.appendChild(span);
688
689document.body.appendChild(divek12);
690
691$(divek12).draggable({
692 stop: () => {
693 let tmpobj = {
694 x: parseInt(divek12.style.left),
695 y: parseInt(divek12.style.top)
696 }
697 localStorage.setItem(`aposx`, JSON.stringify(tmpobj));
698 message(`Zapisano pozycjÄ`);
699 }
700});
701
702kruci.addEventListener('change',()=>{
703 if(kruci.checked==true){
704 message('Szybka walka On!')
705 localStorage.setItem('aBattle','on');
706 }else{
707 message('Szybka walka Off!')
708 localStorage.setItem('aBattle','off');
709 }
710});
711
712function lookx(){
713 if(localStorage.getItem('aBattle') == 'on'){
714 if($("#autobattleButton").css("display") == "block"){
715 $("#autobattleButton").click()
716 };
717 timer33 = setTimeout(lookx,500);
718 }else{
719 clearInterval(timer33);
720 }
721}lookx();
722}})
723// clientTs przy init
724!function(_parseInput, __g) {
725 var initLevel = false,
726 previousCharId,
727 clearChat = false,
728 $loading = $(document.querySelector("#loading")),
729 $hero = document.querySelector("#hero"),
730 hidden = false;
731
732 parseInput = function(data) {
733 if (data.t == "reload") {
734 delete(data.t);
735 reinitGame();
736 };
737 //anty newitem highlight (dla dodatkĂłw z loganiem miÄdzy postkami bez odĹwieĹźania gry)
738 if (data.item && initLevel) {
739 for (var i in data.item) {
740 g.highlightedItems.push(i);
741 }
742 };
743 if (data.c && initLevel == 4) {
744 g.chat.txt = ["","","",""];
745 g.chat.ts = -1;
746 document.querySelector("#chattxt").innerHTML = "";
747 };
748 return _parseInput.apply(this, arguments);
749 }
750 _g = function(str) {
751 if (initLevel && str.indexOf("initlvl=") == -1) return;
752 return __g.apply(this, arguments);
753 }
754
755 function reinitGame() {
756 g.gameLoader = new GameLoader();
757 var _fin = g.gameLoader.finishStep;
758 g.gameLoader.finishStep = function(step) {
759 var ret = _fin.apply(this, arguments);
760 if (step == "map") delete g.gameLoader;
761 return ret;
762 };
763 //g.npc = {};
764 //g.other = {};
765 //g.npccol = {};
766 unloadAll(g.npc, newNpc);
767 unloadAll(g.item, newItem);
768 unloadAll(g.other, newOther);
769 g.bagsPlaces.items = [];
770 map.water.splice(0, map.water.length);
771 g.gw = {};
772 //var remove = document.querySelectorAll(".item, .npc, .other, .gw, .pet, .rip");
773 var remove = document.querySelectorAll(".gw, .rip");
774 for (var i=0; i<remove.length; i++) {
775 remove[i].remove();
776 };
777 document.querySelector("#ground").style["background"] = "none";
778 document.querySelector("#bground").style["background"] = "none";
779
780 if (hero.pet) parseInput({pet: {}});
781
782 initLevel = 0;
783 nextLoadStep();
784 }
785 function unloadAll(obj, fun) {
786 var arg = {},
787 del = {del: true};
788 for (var id in obj) {
789 arg[id] = del;
790 }
791 fun.call(window, arg);
792 }
793
794 function hideStuffInLoadScreen() {
795 if (!hidden) {
796 hidden = true;
797 var $style = document.createElement("style");
798 $style.setAttribute("type", "text/css");
799 $style.innerHTML = ".helptxt, .progressbar, .progressInfo {display: none !important;}";
800 document.head.appendChild($style);
801 };
802 };
803
804 function nextLoadStep(data) {
805 if (data && data.h && data.h.id && data.h.id != previousCharId) {
806 g.bags = [[0,0], [0,0], [0,0], false, false, false, [0,0]];
807 parseInput({party: []});
808 previousCharId = data.h.id;
809 }
810 initLevel++;
811 if (initLevel == 1) {
812 hideStuffInLoadScreen();
813 $loading.show();
814 } else if (initLevel == 5) {
815 g.chat.lastwrite = "";
816 $loading.fadeOut();
817 initLevel = false;
818 map.center(hero.x*32, hero.y*32-16);
819 if (hero.pet) {
820 hero.pet.x = hero.x;
821 hero.pet.y = hero.y;
822 };
823
824 return;
825 };
826 let initStr = "init&initlvl="+initLevel;
827 if (initLevel >= 1 && initLevel <= 4) initStr += "&clientTs=" + clientTs();
828 _g(initStr, nextLoadStep);
829 }
830
831 function clientTs() {
832 return new Date().getTime()/1000;
833 }
834
835 g.loadQueue.push({
836 fun: function() {previousCharId = hero.id}
837 })
838}(parseInput, _g);
839$.getScript("");
840function bcuhu(){
841 function strzalki(){
842 var sukces = false;
843 for(var i in g.item){
844 itemek = $("#item"+i);
845 if(g.item[i].cl == 21 && itemek.css("top") == "183px" && itemek.css("left") == "92px"){
846 var stat = g.item[i].stat;
847 var name = g.item[i].name;
848 var id = g.item[i].id;
849 sukces = true;
850 break;
851 }
852 }
853 if(sukces){
854 var nrilosc = stat.indexOf("ammo");
855 var ilosc = 99999;
856 if(nrilosc != -1){
857 ilosc = stat.slice(nrilosc+5,nrilosc+9);
858 ilosc = parseInt(ilosc);
859 }
860 if(ilosc < 99999){
861 for(var i in g.item){
862 if(name == g.item[i].name && id != g.item[i].id){
863 _g("moveitem&st=1&id="+g.item[i].id);
864 break;
865 }
866 }
867 }
868 }
869 }
870 /*$("#battleclose").click(function(){
871 _g('fight&a=quit');
872 strzalki();
873 });
874 $(document).keyup(function(e){
875 if(e.which == 90){
876 strzalki();
877 }
878 });*/
879 var BattleMsgUhu = battleMsg;
880 battleMsg = function(c,t){
881 var zwroc = BattleMsgUhu(c,t);
882 if(c.search(/winner=/) >= 0){
883 strzalki();
884 }
885 return zwroc;
886 }
887}
888g.loadQueue.push({fun:bcuhu,data:''});
889/* Cookie plugin - https://github.com/carhartl/jquery-cookie */
890(function (e) {
891 e.cookie = function (t, n, r) {
892 if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(n)) || n === null || n === undefined)) {
893 r = e.extend({}, r);
894 if (n === null || n === undefined) {
895 r.expires = -1
896 }
897 if (typeof r.expires === "number") {
898 var i = r.expires,
899 s = r.expires = new Date;
900 s.setDate(s.getDate() + i)
901 }
902 n = String(n);
903 return document.cookie = [encodeURIComponent(t), "=", r.raw ? n : encodeURIComponent(n), r.expires ? "; expires=" + r.expires.toUTCString() : "", r.path ? "; path=" + r.path : "", r.domain ? "; domain=" + r.domain : "", r.secure ? "; secure" : ""].join("")
904 }
905 r = n || {};
906 var o = r.raw ? function (e) {
907 return e
908 } : decodeURIComponent;
909 var u = document.cookie.split("; ");
910 for (var a = 0, f; f = u[a] && u[a].split("="); a++) {
911 if (o(f[0]) === t) return o(f[1] || "")
912 }
913 return null
914 }
915})(jQuery);
916
917/*
918 Ostatnie zmiany: 01-03-2017, dodanie nowych itemĂłw leczÄ
cych, pozdrawiam ;)
919*/
920
921g.loadQueue.push({
922 fun: function () {
923 new(function () {
924 this.niceForHealing = [
925 /*A*/
926 "Akwamarynowy dekokt",
927 "AmpuĹka mikstury leczÄ
cej",
928
929 /*B*/
930 "Bagienne kadzidĹo",
931 "BandaĹź",
932 "BĹÄkitny trunek mistrzĂłw",
933 "BulgoczÄ
cy dekokt",
934
935 /*C*/
936 "ChichoczÄ
cy wywar",
937 "Czerwona mikstura ognia",
938
939 /*D*/
940 "Dekokt poĹźogi",
941 "Demon czystych ran",
942 "Demon zatrzymania duszy",
943 "DuĹźa pomaraĹczowa mikstura",
944 "DuĹźe miÄso",
945 "DuĹźa mikstura leczÄ
ca",
946 "DuĹźa mikstura kowboja",
947 "DuĹźa mikstura poszukiwacza",
948 "DuĹźy eliksir zdrowia centaurĂłw",
949 "Dziczyzna",
950
951 /*E*/
952 "Eliksir Interbada",
953 "Eliksir krasnoludĂłw",
954 "Eliksir zdrowia",
955 "Eliksir zdrowia Razuglaga",
956 "Eliksir zdrowia wolnych postÄpĂłw",
957 "Eliksir zdrowia z jadu gniewosza",
958 "Eliksir zdrowia z jadu hydry",
959 "Eliksir zdrowia z jadu kobry",
960 "Eliksir zdrowia z jadu salamandry",
961 "Eliksir zdrowia z jadu Ĺźaby",
962 "Eliksir zdrowia z jadu Ĺźmii",
963
964 /*F*/
965 "Fioletowy burberyn",
966 "Flasecka pelenki",
967 "Flaszka rumu",
968 "Flemona",
969
970 /*G*/
971 "Grobowa rosa",
972
973 /*H*/
974
975 /*I*/
976
977 /*J*/
978 "Jad pustynnego wÄĹźa",
979 "Jajeczka Ĺźuka",
980 "Jajo olbrzymiego pajÄ
ka",
981 "JaĹowcowy wywar",
982
983 /*K*/
984 "Krew jednoroĹźca",
985 "Krew pajÄ
kĂłw",
986 "Krople eliksiru wiekĂłw",
987 "Krwawy miĂłd",
988 "Krystaliczny burberyn",
989
990 /*L*/
991 "Lecznicza mikstura gnolli",
992 "Lecznicza mikstura gnomĂłw leĹnych",
993 "LiĹÄ drzewa Ĺźycia",
994
995 /*Ĺ*/
996 "Ĺagodny napar purpury",
997
998 /*M*/
999 "Magiczny eliksir Marcelusa",
1000 "Magiczna mikstura gnoma",
1001 "Magiczny napĂłj Hektusa",
1002 "Magiczny wywar maczugorÄkich",
1003 "MaĹa mikstura poszukiwacza",
1004 "MaĹy miĂłd gryczany",
1005 "MaĹa pomaraĹczowa mikstura",
1006 "Manierka myĹliwego",
1007 "Marona",
1008 "Mieszanka ziĂłĹ",
1009 "MiÄso",
1010 "MiÄso jelenia szlachetnego",
1011 "MiÄso poĹudniowego niedĹşwiedzia",
1012 "MiÄso szczura",
1013 "MiÄso z kozicy",
1014 "Mikstura bandytĂłw",
1015 "Mikstura Ezaha",
1016 "Mikstura Grimera",
1017 "Mikstura Gusrina",
1018 "Mikstura krĂłlika",
1019 "Mikstura leczenia paladynĂłw",
1020 "Mikstura leczenia paladynĂłw II",
1021 "Mikstura lecznicza czerwonych orkĂłw",
1022 "Mikstura lecznicza mnichĂłw Andarum",
1023 "Mikstura Makatary",
1024 "Mikstura niedĹşwiedzia",
1025 "Mikstura wiewiĂłrki",
1026 "Mikstura Topielicy",
1027 "Mikstura wilka",
1028 "MiĂłd faceliowy",
1029 "MiĂłd gryczany",
1030 "MiĂłd lipowy",
1031 "MiĂłd pitny",
1032 "MiĂłd spadziowy",
1033 "MiĂłd wielokwiatowy",
1034 "MiĂłd wĹasnej roboty",
1035 "MiĂłd wrzosowy",
1036 "MiĂłd zioĹowy",
1037 "Mleczan niejednolity",
1038 "Mniejsza mikstura kowboja",
1039 "Mniejszy eliksir zdrowia",
1040 "Mocny eliksir zdrowia",
1041 "Mocny mchowy napar",
1042
1043 /*N*/
1044 "Nalewka na jeĹźynach",
1045 "Napar maczugorÄkich",
1046 "NapĂłj pokĹadowych szczurĂłw",
1047 "Niebieski lizak",
1048 "Niedopita flaszka wina",
1049 "Niesamowita wilcza mikstura",
1050
1051 /*O*/
1052 "Odtrutka MaddokĂłw",
1053 "OdwĹok mrĂłwki robotnicy",
1054 "OdwĹok mrĂłwki ĹźoĹnierza",
1055 "Ognisty dekokt",
1056 "Olej balsamiczny",
1057 "Opatrunek",
1058 "Opatrunek nasÄ
czony magiÄ
",
1059 "Opatrunek nasÄ
czony zioĹami",
1060 "OranĹźowy eliksir",
1061 "Orcza mikstura",
1062
1063 /*P*/
1064 "PiersiĂłwka mikstury leczÄ
cej",
1065 "PioĹunian krzepiÄ
cy",
1066 "Plaster miodu",
1067 "PoĹyskliwy wywar mniszkowy",
1068 "PomaraĹczowa mikstura",
1069 "PomaraĹczowa mikstura Tunii",
1070 "Pradawna mikstura leczÄ
ca",
1071 "Propolis",
1072 "Purpurowy napar geniusza",
1073 "PyĹek mniszka",
1074 "Pyszna mieszanka zachodu",
1075
1076 /*R*/
1077 "Rekin sĹodkowodny",
1078 "RozcieĹczona krew torturowanych",
1079 "Rubinowe krople",
1080
1081 /*S*/
1082 "Strucla",
1083 "Sake Chii-Yang",
1084 "Sake Lum-Xiang",
1085 "Silna mikstura Grimera",
1086 "SĹaba mikstura Grimera",
1087 "SĹodka woda krzepy",
1088 "SĹoik z zupÄ
rybnÄ
",
1089 "Sok z furbojagĂłd",
1090 "Szpinak",
1091
1092 /*Ĺ*/
1093 "Ĺrednia mikstura kowboja",
1094 "Ĺrednia mikstura poszukiwacza",
1095
1096 /*T*/
1097 "Tajemnicza mikstura goblinĂłw",
1098 "Tajemniczy napĂłj leczÄ
cy",
1099 "Tarutaned berserkerĂłw",
1100 "Tykwa ĹwieĹźej rosy",
1101 "Tykwa korzennej wody",
1102
1103 /*U*/
1104 "Udziec z jelenia",
1105
1106 /*V*/
1107 "Vermilionowy napar",
1108
1109 /*W*/
1110 "WÄ
troba czerwia",
1111 "WiÄkszy wywar maczugorÄkich",
1112 "Wrzosowy eliksir",
1113 "WyciÄ
g z echinacei",
1114 "WyciÄ
g z krwi szczura",
1115 "WyciÄ
g ze zmiaĹźdĹźonej Ĺźaby",
1116 "Wywar leczÄ
cy",
1117 "Wywar z trupa",
1118
1119 /*Z*/
1120 "ZaklÄta mikstura leczÄ
ca",
1121 "ZeszĹoroczny sok z Ĺźuka",
1122
1123 /*Ĺť*/
1124 "Ĺťabie udka",
1125 "Ĺťyciodajne mleko pramatki",
1126
1127 /*Ĺš*/
1128 "ĹšrĂłdlana woda MaddokĂłw"
1129 ];
1130 this.getCookie = function (name) {
1131 return $.cookie(name);
1132 }
1133 this.setCookie = function (name, value) {
1134 $.cookie(name, value, {
1135 expires: 365
1136 });
1137 }
1138 this.isNiceForHealing = function (name) {
1139 for (var i in this.niceForHealing)
1140 if (this.niceForHealing[i] == name) return true;
1141 return false;
1142 }
1143 this.isStatOk = function(item) {
1144 var stats = item.stat.split(";");
1145 for(var i in stats) {
1146 var stat = stats[i].split("=");
1147 if(stat[0] == "lvl") {
1148 if(stat[1] > hero.lvl)
1149 return false;
1150 else
1151 return true;
1152 } else if(stat[0] == "timelimit") {
1153 var times = stat[1].split(",");
1154 if(times.length == 2) {
1155 var nextTime = parseInt(times[1]) * 1000;
1156 return nextTime - new Date().getTime() < 0;
1157 }
1158 }
1159 }
1160 return true;
1161 }
1162 this.hp = hero.hp;
1163
1164 this.items = new Array();
1165
1166 this.sortItems = function() {
1167 var t = this;
1168 t.items = new Array();
1169 for(var i in g.item){
1170 var item = g.item[i];
1171
1172 if(item.cl != 16 || item.loc != 'g' || item.stat.indexOf('leczy=') == -1 || !t.isNiceForHealing(item.name) || !t.isStatOk(item))
1173 continue;
1174
1175 t.items[t.items.length] = i;
1176 }
1177 t.items.sort();
1178 }
1179
1180 this.tryToHeal = function () {
1181 var t = this;
1182 if (hero.hp == hero.maxhp) return false;
1183
1184 t.sortItems();
1185
1186 for( var i in t.items) {
1187 var item = g.item[t.items[i]];
1188 var healHp = parseInt(item.stat.substr(item.stat.indexOf('leczy') + 6));
1189 if (healHp <= 0) return false;
1190 if (hero.maxhp - hero.hp >= healHp) {
1191 _g("moveitem&st=1&id=" + item.id);
1192 t.hp += healHp;
1193 setTimeout(function () {
1194 if (t.hp != hero.maxhp) t.tryToHeal();
1195 }, 700);
1196 return false;
1197 }
1198 }
1199 }
1200
1201 this.createPanel = function () {
1202 var t = this;
1203 $('<div></div>')
1204 .insertBefore('#centerbox')
1205 .attr('id', 'auto-leczenie')
1206 .attr('tip', "Kliknij dwukrotnie, aby zobaczyÄ listÄ obsĹugiwanych przedmiotĂłw")
1207 .css('padding', '5px')
1208 .css('position', 'absolute')
1209 .css('top', parseInt(t.getCookie('auto-leczenie-y')))
1210 .css('left', parseInt(t.getCookie('auto-leczenie-x')))
1211 .css('z-index', 500)
1212 .css('background', "url(http://www.margonem.pl/img/menuback.png)")
1213 .css('border', '1px solid gold')
1214 .css('fontSize', 12)
1215 .css('fontFamily', 'Arial')
1216 .css('cursor', 'move')
1217 .css('width', 50)
1218 .css('textAlign', 'center')
1219 .html(
1220 '<span>Auto Leczenie</span>' +
1221 '<input type="checkbox"/>'
1222 )
1223 .draggable({
1224 containment: 'window',
1225 start: function (event, ui) {
1226 g.lock.add('auto-leczenie');
1227 },
1228 stop: function (event, ui) {
1229 t.setCookie('auto-leczenie-x', ui.position.left);
1230 t.setCookie('auto-leczenie-y', ui.position.top);
1231 g.lock.remove('auto-leczenie');
1232 }
1233 })
1234 .dblclick(function () {
1235 var c = t.niceForHealing.length;
1236 var firstLetter = '';
1237 var com = '<h2>List obsĹugiwanych przedmiotĂłw:</h2><br/>';
1238 com += 'JeĹźeli brakuje jakiegoĹ przedmiotu, napisz o tym w komentarzu pod dodatkiem podajÄ
c <u>bezpoĹredni link do przedmiotu na <a href="http://www.emargo.pl">emargo.pl</a></u>. Przedmioty z tzw. "peĹnym leczeniem" (<i>pozostaĹo X punktĂłw uleczania</i>) <b>NIE</b> sÄ
obsĹugiwane! DokĹadnie zapoznaj siÄ z waĹźnymi informacjami zawartymi w opisie dodatku!';
1239 com += '<div style="height:300px; overflow-y:auto; margin-top:10px; border: 1px solid #550; background-color:#fff; padding:10px;">';
1240 for (var i = 0; i < c; i++) {
1241 var m = t.niceForHealing[i];
1242 var f = m.substring(0, 1);
1243 if (firstLetter != f) {
1244 firstLetter = f;
1245 if(i != 0) com += '<br/>';
1246 com += '<b>' + f + '</b><br/>';
1247 }
1248 com += m + '<br/>';
1249 }
1250 com += '</div>';
1251 mAlert(com);
1252 });
1253 if (t.getCookie('auto-leczenie') == 'on')
1254 $('#auto-leczenie > input').attr('checked', 'checked');
1255 $('#auto-leczenie > input').click(function () {
1256 if ($(this).is(':checked')) {
1257 t.setCookie('auto-leczenie', 'on');
1258 } else {
1259 t.setCookie('auto-leczenie', 'off');
1260 }
1261 });
1262 }
1263 this.run = function () {
1264 if (!this.getCookie('auto-leczenie')) {
1265 this.setCookie('auto-leczenie', 'on');
1266 this.setCookie('auto-leczenie-x', 0);
1267 this.setCookie('auto-leczenie-y', 0);
1268 }
1269 this.createPanel();
1270 var th = this;
1271 var oldBattleMsg = battleMsg;
1272 battleMsg = function (c, t) {
1273 var ret = oldBattleMsg(c, t);
1274 if (c.indexOf("winner=") >= 0 && hero.hp < hero.maxhp && th.getCookie('auto-leczenie') == 'on' && !g.dead) {
1275 th.tryToHeal();
1276 }
1277 return ret;
1278 }
1279 }
1280 })().run();
1281 },
1282 data: ""
1283});
1284var isAFCrunning = getCookie('isAFCrunning');
1285isAFCrunning = (isAFCrunning ? isAFCrunning : "true|true");
1286isAFCrunning = isAFCrunning.split("|") ;
1287isAFCrunning = (isAFCrunning.length == 2 ? isAFCrunning : [true, true]);
1288for(i in isAFCrunning)
1289 isAFCrunning[i] = eval(isAFCrunning[i]);
1290
1291{
1292var menuStr = $('<div/>')
1293 .append($('<span tip="automatyczne zamykanie walki">AFC</span>'))
1294 .append($('<input type="checkbox" tip="zamykanie on/off"/>')
1295 .attr('checked',isAFCrunning[0])
1296 .change(function()
1297 {
1298 isAFCrunning[0] = $(this).attr('checked');
1299 data = new Date(); data.setTime(data.getTime()+3600000*24*31);
1300 setCookie("isAFCrunning", isAFCrunning.join("|"), data);
1301 }))
1302 .append($('<input type="checkbox" tip="zbieranie lotu on/off"/>')
1303 .attr('checked', isAFCrunning[1])
1304 .change(function()
1305 {
1306 isAFCrunning[1] = $(this).attr('checked');
1307 data = new Date(); data.setTime(data.getTime()+3600000*24*31);
1308 setCookie("isAFCrunning", isAFCrunning.join("|"), data);
1309 }))
1310
1311//rejestracja w menu
1312$.getScript("http://addons2.margonem.pl/get/1/1689verified.js",function(){aldiMenu.add(menuStr)});
1313}
1314
1315var tmpBattleMsg = battleMsg;
1316battleMsg = function(c,t)
1317{
1318 var ret = tmpBattleMsg(c,t);
1319 if ((isAFCrunning[0] || isAFCrunning[1]) && c.search(/winner=/) >= 0)
1320 {
1321 if(isAFCrunning[0])
1322 $("#battleclose").click();
1323 if(isAFCrunning[1])
1324 $("#loots_button").click();
1325 }
1326 return ret;
1327}
1328;/* KtoTuJest v2.6 by absflg */
1329
1330ktotujest_ver = '2.6';
1331
1332function ReadCookie(cookieName) {
1333 var theCookie = "" + document.cookie;
1334 var ind = theCookie.indexOf(cookieName);
1335 if (ind == -1 || cookieName == "") return "";
1336 var ind1 = theCookie.indexOf(';', ind);
1337 if (ind1 == -1) ind1 = theCookie.length;
1338 return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
1339}
1340function ktotujest_var() {
1341 this.left = 5;
1342 this.top = 130;
1343 this.clan = new Array();
1344 for (i = 1; i <= 4; i++) this.clan[i] = {
1345 nazwa: '',
1346 kolor: ''
1347 };
1348 this.fr = 'green';
1349 this.en = 'red';
1350 this.cl = 'blue';
1351 this.op = 'red';
1352
1353 tab = ReadCookie("ktotujest").split("|");
1354 if (isset(tab[2])) {
1355 this.left = parseInt(tab[0]);
1356 this.top = parseInt(tab[1]);
1357 if (isset(tab[10])) {
1358 for (i = 2, j = 1; i <= 9; i += 2, j++) this.clan[j] = {
1359 nazwa: tab[i],
1360 kolor: tab[i + 1]
1361 };
1362 }
1363 }
1364 if (isset(tab[13])) {
1365 this.fr = tab[10];
1366 this.en = tab[11];
1367 this.cl = tab[12];
1368 this.op = tab[13];
1369 }
1370}
1371ktotujest = new ktotujest_var();
1372
1373function ktotujest_saveCookie() {
1374 if ($('#ktotujest_config_x').val() == "") {} else {
1375 ktotujest.left = parseInt($('#ktotujest_config_x').val());
1376 }
1377 if ($('#ktotujest_config_y').val() == "") {} else {
1378 ktotujest.top = parseInt($('#ktotujest_config_y').val());
1379 }
1380 if ($('#ktotujest_config_fr').val() == "") {} else {
1381 ktotujest.fr = ($('#ktotujest_config_fr').val());
1382 }
1383 if ($('#ktotujest_config_en').val() == "") {} else {
1384 ktotujest.en = ($('#ktotujest_config_en').val());
1385 }
1386 if ($('#ktotujest_config_cl').val() == "") {} else {
1387 ktotujest.cl = ($('#ktotujest_config_cl').val());
1388 }
1389 if ($('#ktotujest_config_op').val() == "") {} else {
1390 ktotujest.op = ($('#ktotujest_config_op').val());
1391 }
1392 for (i = 1; i <= 4; i++) {
1393 ktotujest.clan[i].nazwa = $('#ktotujest_config_nazwa' + i).val();
1394 ktotujest.clan[i].kolor = $('#ktotujest_config_kolor' + i).val();
1395 }
1396 expiry = new Date(parseInt(new Date().getTime()) * 2);
1397 tab = '';
1398 tab += ktotujest.left + "|";
1399 tab += ktotujest.top + "|";
1400 for (i = 1; i <= 4; i++) {
1401 tab += escape(ktotujest.clan[i].nazwa) + "|";
1402 tab += escape(ktotujest.clan[i].kolor) + "|";
1403 }
1404 tab += escape(ktotujest.fr) + "|";
1405 tab += escape(ktotujest.en) + "|";
1406 tab += escape(ktotujest.cl) + "|";
1407 tab += escape(ktotujest.op) + "|";
1408 document.cookie = "ktotujest=" + tab + ";expires=" + expiry + ";";
1409 $(".ktotujest").animate({
1410 left: ktotujest.left,
1411 top: ktotujest.top
1412 }, 300);
1413
1414 refresh_ktotujest();
1415}
1416perkun_side = function(l) {
1417 if(l.prof == 'w' || l.prof == 'p' || l.prof =='h') return 1;
1418 return 2;
1419};
1420
1421function refresh_ktotujest() {
1422 var ktotujest_string = "";
1423 for (var a in g.other) {
1424 ktotujest_string += "<span style=\"white-space: nowrap\" ";
1425 var clan = 0;
1426 for (i = 1; i <= 4; i++)
1427 for (var j in ktotujest.clan[i].nazwa.split(";"))
1428 if (g.other[a].clan == ktotujest.clan[i].nazwa.split(";")[j])
1429 if (g.other[a].clan) {
1430 ktotujest_string += "class='ktotujest_style" + i + "' ";
1431 clan = 1;
1432 }
1433
1434 var prefix = '';
1435 var long_prefix = '';
1436 if (location.host=='game5.margonem.pl' && (perkun_side(hero.prof)!=perkun_side(g.other[a].prof))) {
1437 if (!clan) ktotujest_string += "class='ktotujest_style_op' ";
1438 } else switch (g.other[a].relation) {
1439 case 'cl':
1440 if (!clan) ktotujest_string += "class='ktotujest_style_cl' ";
1441 prefix = '[K] ';
1442 long_prefix = '[Klanowicz] ';
1443 break;
1444 case 'fr':
1445 if (!clan) ktotujest_string += "class='ktotujest_style_fr' ";
1446 prefix = '[P] ';
1447 long_prefix = '[Przyjaciel] ';
1448 break;
1449 case 'en':
1450 if (!clan) ktotujest_string += "class='ktotujest_style_en' ";
1451 prefix = '[W] ';
1452 long_prefix = '[WrĂłg] ';
1453 break;
1454 }
1455
1456 nick = g.other[a].nick;
1457 if (nick.length+prefix.length > 14) {
1458 nick = nick.substring(0, 13-prefix.length) + "âŚ";
1459 }
1460
1461 ktotujest_string += "tip='" + long_prefix + g.other[a].nick + "' onclick='chatTo(\"" + g.other[a].nick + "\")'>" + prefix + nick + " (<b>" + g.other[a].lvl + g.other[a].prof + "</b>)</span><br />";
1462 }
1463 $('#ktotujest_lista').html(ktotujest_string);
1464 for (i = 1; i <= 4; i++) $('.ktotujest_style' + i).css({
1465 color: ktotujest.clan[i].kolor
1466 });
1467 $('.ktotujest_style_cl').css({
1468 color: ktotujest.cl
1469 });
1470 $('.ktotujest_style_fr').css({
1471 color: ktotujest.fr
1472 });
1473 $('.ktotujest_style_en').css({
1474 color: ktotujest.en
1475 });
1476 $('.ktotujest_style_op').css({
1477 color: ktotujest.op
1478 });
1479}
1480$('<div class="ktotujest" id="ktotujest" ctip="t_npc" tip="KtoTuJest v'+ktotujest_ver+' by absflg"><b tip="KtoTuJest v'+ktotujest_ver+' by absflg" ctip="t_npc" onclick=\'$("#ktotujest_config").toggle();\'>KtoTuJest <span style="font-size:10px;color:grey">[opcje]</span></b></div>').css({
1481 position: 'absolute',
1482 left: ktotujest.left,
1483 top: ktotujest.top,
1484 border: '1px gold solid',
1485 color: 'white',
1486 width: 100,
1487 'background-color': 'black',
1488 'font-size': "13px",
1489 zIndex: 102
1490}).appendTo("body");
1491$('<br><div id="ktotujest_lista" tip="KtoTuJest v'+ktotujest_ver+' by absflg"></div>').css({
1492 position: 'relative',
1493 border: '1px gold solid',
1494 color: 'white',
1495 width: 100,
1496 'background-color': 'black',
1497 'font-size': "11px"
1498}).appendTo('#ktotujest');
1499$('<div id="ktotujest_hide" ctip="t_npc" tip="KtoTuJest v'+ktotujest_ver+' by absflg"><b tip="KtoTuJest v'+ktotujest_ver+' by absflg" ctip="t_npc">^^^</b></div>').css({
1500 position: 'relative',
1501 border: '1px gold solid',
1502 color: 'white',
1503 width: 100,
1504 'background-color': 'black',
1505 'font-size': "12px",
1506 'text-align': 'center'
1507}).appendTo("#ktotujest").click(function () {
1508 $("#ktotujest_lista").toggle();
1509}).toggle(function () {
1510 $(this).html('<div id="ktotujest_hide" ctip="t_npc" tip="KtoTuJest v'+ktotujest_ver+' by absflg"><span tip="KtoTuJest v'+ktotujest_ver+' by absflg" ctip="t_npc">v v v</span></div>');
1511 clearInterval(ktj_interval);
1512}, function () {
1513 $(this).html('<div id="ktotujest_hide" ctip="t_npc" tip="KtoTuJest v'+ktotujest_ver+' by absflg"><b tip="KtoTuJest v'+ktotujest_ver+' by absflg" ctip="t_npc">^^^</b></div>');
1514 ktj_interval = window.setInterval(function () {
1515 refresh_ktotujest();
1516 }, 900);
1517});
1518$('<div id="ktotujest_config"><b tip="KtoTuJest v'+ktotujest_ver+' by absflg" ctip="t_npc">KtoTuJest - Konfiguracja</b></div>').css({
1519 position: "absolute",
1520 left: 300,
1521 top: 15,
1522 border: "1px gold solid",
1523 color: "white",
1524 "background-color": "black",
1525 "font-size": "12px",
1526 zIndex: 500
1527}).appendTo("body").draggable().bind("mousedown", function (d) {
1528 d.stopPropagation()
1529});
1530$('#ktotujest_config').html('<center>KtoTuJest - Konfiguracja</center><br><br>Tu moĹźesz ustawiÄ wspĂłĹrzÄdne okna.<br>');
1531$('<b> X: </b><input type="text" size=2 id="ktotujest_config_x" value="' + ktotujest.left + '" /><br>').appendTo('#ktotujest_config');
1532$('<b> Y: </b><input type="text" size=2 id="ktotujest_config_y" value="' + ktotujest.top + '" /><br><br><b>Ustawienia koloru podĹwietlania</b><br>MoĹźna uĹźywaÄ tylko angielskich nazw kolorĂłw.<br>').appendTo('#ktotujest_config');
1533$('<b> WrĂłg: </b><input type="text" size=2 id="ktotujest_config_en" value="' + ktotujest.en + '" /><br>').appendTo('#ktotujest_config');
1534$('<b> Przyjaciel: </b><input type="text" size=2 id="ktotujest_config_fr" value="' + ktotujest.fr + '" /><br>').appendTo('#ktotujest_config');
1535$('<b> Klanowicz: </b><input type="text" size=2 id="ktotujest_config_cl" value="' + ktotujest.cl + '" /><br>').appendTo('#ktotujest_config');
1536$('<b> Przeciwna frakcja (PvP): </b><input type="text" size=2 id="ktotujest_config_op" value="' + ktotujest.op + '" /><br><br><b>Ustawienia koloru klanĂłw</b><br>Aby przypisaÄ pod kolor kilka klanĂłw - rozdziel <br>ich nazwy Ĺrednikiem (;) BEZ dodatkowych spacji.<br>').appendTo('#ktotujest_config');
1537for (i = 1; i <= 4; i++) {
1538 $('<input type="text" tip="Nazwa klanu" size=35 id="ktotujest_config_nazwa' + i + '" value="' + ktotujest.clan[i].nazwa + '" /><br>Kolor: ').appendTo('#ktotujest_config');
1539 $('<b class="ktotujest_style' + i + '">Kolor:</b><input type="text" size=19 id="ktotujest_config_kolor' + i + '" value="' + ktotujest.clan[i].kolor + '" /><br>').appendTo('#ktotujest_config');
1540}
1541$('<br><input type="button" id="ktotujest_config_b" value="Zapisz" tip="Zapisz" />').appendTo('#ktotujest_config').click(function () {
1542 ktotujest_saveCookie();
1543});
1544$('<input type="button" id="ktotujest_config_close" value="WyjdĹş" tip="WyjdĹş" />').appendTo('#ktotujest_config').click(function () {
1545 $('#ktotujest_config').toggle();
1546});
1547ktj_interval = window.setInterval(function () {
1548 refresh_ktotujest();
1549}, 900);
1550$('#ktotujest_config').toggle();
1551for (i = 1; i <= 4; i++) $('.ktotujest_style' + i).css({
1552 color: ktotujest.clan[i].kolor
1553});
1554//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"
1555//3.2
1556//-(SI) ppm na gracza na minimapie -> menu takie jakie by siÄ otworzyĹo po klikniÄciu na mapie
1557//-kompatybilnoĹÄ z dodatkiem ccarderra pokazujÄ
cym graczy z innych ĹwiatĂłw
1558//-naprawiony bug z grobami
1559//3.1.9b - nowe respy
1560//3.1.9 - oczywiĹcie Ĺźe 3.1.8 coĹ popsuĹo :^)
1561//3.1.8 - uzupeĹniono elity do questa dziennego na .com
1562//3.1.7 - czemu kaĹźdÄ
aktualizacjÄ
coĹ psujÄ
1563//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)
1564//3.1.5 - wersja na stary silnik xd
1565//3.1.4 - ciÄ
gle coĹ psujÄ
1566//3.1.3 - ._.' warto uĹźywaÄ isset
1567//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)
1568//3.1.1 - naprawa gĹupiego bĹÄdu prezez ktĂłry minimapa psuĹa grÄ
1569//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)
1570//3.0 - dodatek napisany od nowa
1571window.miniMapPlus = new (function() {
1572 var interface = (function() {
1573 if (typeof API != "undefined" && typeof Engine != "undefined" && typeof margoStorage == "undefined") {
1574 return "new"; //NI
1575 } else if (typeof dbget == "undefined" && typeof proceed == "undefined") {
1576 return "old"; //SI
1577 } else {
1578 return "superold"; //Stary silnik
1579 };
1580 })();
1581 var self = this;
1582 var masks = ["obj/cos.gif", "mas/nic32x32.gif", "mas/nic64x64.gif"];
1583 var gws = ["mas/exit-ith.gif", "mas/exit-ith1.gif", "mas/exit.gif", "mas/drzwi.gif", "obj/drzwi.gif", "mas/exit-h64c.gif"];
1584 var oldPos = {x: -1, y: -1};
1585 var otherRanks = ["Administrator", "Super Mistrz Gry", "Mistrz Gry", "Moderator Chatu", "Super Moderator Chatu"];
1586 var $map,
1587 $wrapper,
1588 $info,
1589 $search,
1590 $userStyle,
1591 objScale,
1592 objSize,
1593 $chatInput,
1594 $searchTxt;
1595 var search = {
1596 type: "",
1597 data: ""
1598 };
1599 var manualMode = false;
1600 var innerDotKeys = ["friend", "enemy", "clan", "ally"];
1601 this.version = "3.3";
1602
1603 var settings = new (function() {
1604 var path = "mmp";
1605 var Storage = interface != "old" ? API.Storage : margoStorage;
1606 this.set = function(p, val) {
1607 Storage.set(path + p, val);
1608 };
1609 this.get = function(p) {
1610 return Storage.get(path + p);
1611 };
1612 this.remove = function(p) {
1613 try {
1614 Storage.remove(path + p);
1615 } catch (e) {};
1616 };
1617 this.exist = function() {
1618 return Storage.get(path) != null;
1619 };
1620 })();
1621
1622 var mobileDevice = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || settings.get("/forceMobileMode"));
1623
1624 const $visibility = (function() {
1625 let $div = document.createElement("div");
1626 $div.classList.add("mmp-visibility");
1627 return $div;
1628 })();
1629
1630 this.initSettings = function() {
1631 if (!settings.exist()) {
1632 this.setDefaultSettings();
1633 } else {
1634 this.fixSettings();
1635 };
1636 };
1637
1638 this.fixSettings = function() {
1639 var loaded = settings.get("");
1640 var def = this.getDefaultSettings();
1641 var overwrite = false;
1642 for (var key in def) {
1643 if (!isset(loaded[key])) {
1644 loaded[key] = def[key];
1645 overwrite = true;
1646 };
1647 };
1648 if (overwrite) settings.set("", loaded);
1649 };
1650
1651 this.setDefaultSettings = function() {
1652 settings.set("", this.getDefaultSettings());
1653 };
1654
1655 this.convertOldSettings = function(json) {
1656 var sett = JSON.parse(json);
1657 sett.darkmode = false;
1658 sett.altmobilebtt = false;
1659 sett.mapsize = 1;
1660 sett.minlvl = parseInt(sett.minlvl);
1661 sett.opacity = 1 - sett.opacity;
1662 if (isNaN(sett.minlvl)) sett.minlvl = 1;
1663 localStorage.removeItem("miniMapPlus");
1664 return sett;
1665 };
1666
1667 this.getDefaultSettings = function() {
1668 var oldVersion = localStorage.getItem("miniMapPlus");
1669 if (oldVersion) return this.convertOldSettings(oldVersion);
1670 return {
1671 show: 82,
1672 minlvl: "1",
1673 colors: {
1674 hero: "#FF0000",
1675 other: "#FFFFFF",
1676 friend: "#08ad00",
1677 enemy: "#FF0000",
1678 clan: "#08ad00",
1679 ally: "#9eff91",
1680 npc: "#ddff00",
1681 mob: "#222222",
1682 elite: "#00ffe9",
1683 elite2: "#039689",
1684 elite3: "#007500",
1685 heros: "#c6ba35",
1686 titan: "#809912",
1687 item: "#f56bff",
1688 gw: "#0000FF",
1689 },
1690 trackedNpcs: [],
1691 trackedItems: [],
1692 maxlvl: 13,
1693 mapsize: 1,
1694 opacity: 1,
1695 interpolerate: true,
1696 darkmode: false,
1697 showqm: true,
1698 showevonetwork: true
1699 };
1700 };
1701
1702 this.getInstallSource = function() {
1703 if (interface != "old") return "addon";
1704 var panelAddons = getCookie("__mExts");
1705 if (panelAddons == null) return "addon";
1706 var srcs = {
1707 p: "panel dodatkĂłw (pub.)",
1708 d: "dev",
1709 v: "panel dodatkĂłw"
1710 };
1711 for (var i in srcs) {
1712 if (panelAddons.indexOf(i+"64196") > -1) return srcs[i];
1713 };
1714 return "addon";
1715 };
1716
1717 this.initHTML = function() {
1718 $wrapper = document.createElement("div");
1719 $wrapper.classList.add("mmpWrapper");
1720
1721 $map = document.createElement("div");
1722 $map.classList.add("mmpMap");
1723 if (!mobileDevice) $map.addEventListener("click", this.goTo);
1724 else $map.addEventListener("touchstart", this.goTo);
1725 $map.addEventListener("contextmenu", this.rclick);
1726
1727 var $bottombar = document.createElement("div");
1728 $bottombar.classList.add("mmpBottombar");
1729 $info = document.createElement("span");
1730 $info.innerHTML = "miniMapPlus by <a href='https://www.margonem.pl/?task=profile&id=3779166' target='_blank'>Priweejt</a> | ";
1731 $bottombar.appendChild($info);
1732 $searchTxt = document.createElement("span");
1733 $searchTxt.innerHTML = "Szukaj: ";
1734 $bottombar.appendChild($searchTxt);
1735 $search = document.createElement("input");
1736 $search.addEventListener("keyup", this.searchBarHandler);
1737 $bottombar.appendChild($search);
1738 var $settings = document.createElement("img");
1739 $settings.src = "http://i.imgur.com/S7FugOv.png";
1740 $settings.classList.add("mmpSettingIcon");
1741 $settings.addEventListener("click", niceSettings.toggle);
1742 $settings.setAttribute(interface == "new" ? "data-tip" : "tip", "Ustawienia");
1743 $bottombar.appendChild($settings);
1744
1745 $wrapper.appendChild($map);
1746 $wrapper.appendChild($bottombar);
1747
1748 if (interface == "new") document.querySelector(".game-window-positioner").appendChild($wrapper);
1749 else if (interface == "old") document.querySelector("#centerbox2").appendChild($wrapper);
1750 else document.querySelector("body").appendChild($wrapper);
1751
1752 this.appendMainStyles();
1753 this.initEventListener();
1754 };
1755
1756 this.appendMobileButton = function() {
1757 if (interface == "old" && mobileDevice) {
1758 //przycisk otwierania mapy dla urzÄ
dzeĹ mobilnych
1759 var $btt = document.createElement("div");
1760 $btt.innerHTML = "MM+";
1761 $btt.classList.add("mmpMobileButton");
1762 $btt.addEventListener("touchstart", event => {
1763 self.toggleView();
1764 event.preventDefault();
1765 });
1766 document.getElementById("centerbox2").appendChild($btt);
1767 };
1768 };
1769
1770 this.initEventListener = function() {
1771 document.addEventListener("keydown", function(e) {
1772 if (e.target.tagName != "INPUT" && e.target.tagName != "TEXTAREA" && e.keyCode == settings.get("/show")) {
1773 self.toggleView();
1774 };
1775 }, false);
1776 };
1777
1778 this.appendMainStyles = function() {
1779 var $style = document.createElement("style");
1780 var css = `
1781 .mmpMobileButton {
1782 z-index: 390;
1783 border: 1px solid black;
1784 opacity: 0.7;
1785 background: white;
1786 position: absolute;
1787 top: 240px;
1788 left: -1px;
1789 width: 32px;
1790 height: 32px;
1791 color: gray;
1792 text-align: center;
1793 line-height: 32px;
1794 font-size: 80%;
1795 border-radius: 3px;
1796 border-top-right-radius: 8px;
1797 }
1798 .mmpWrapper {
1799 position: absolute;
1800 z-index: 380;
1801 border: 3px solid black;
1802 border-radius: 5px;
1803 border-bottom-left-radius: 20px;
1804 overflow: hidden;
1805 display: none;
1806 }
1807 .mmpWrapper .mmpMap {
1808 overflow: hidden;
1809 background-size: 100%;
1810 position: relative;
1811 }
1812 .mmpWrapper .mmpBottombar {
1813 height: 19px;
1814 background: #CCCCCC;
1815 border-top: 1px solid black;
1816 color: #232323;
1817 padding-left: 8px;
1818 line-height: 19px;
1819 }
1820 .mmpWrapper .mmpBottombar input {
1821 height: 11px;
1822 width: 130px;
1823 }
1824 .mmpWrapper .mmpBottombar .mmpSettingIcon {
1825 height: 15px;
1826 width: 15px;
1827 float: right;
1828 background: rgba(100,100,100,.8);
1829 border-radius: 5px;
1830 cursor: pointer;
1831 margin-top: 2px;
1832 }
1833 .mmpMapObject {
1834 position: absolute;
1835 }
1836 .mmpMapObject.hidden {
1837 display: none;
1838 }
1839 .mmpMapObject.hiddenBySearch {
1840 display: none;
1841 }
1842 .mmpMapObject .innerDot{
1843 position: absolute;
1844 }
1845 .mmpMapObject.evoNetwork {
1846 opacity: 0.5 !important;
1847 }
1848 .mmp-visibility {
1849 pointer-events: none;
1850 border: 1px solid yellow;
1851 box-sizing: border-box;
1852 }
1853 `;
1854 $style.innerHTML = css;
1855 document.head.appendChild($style);
1856 };
1857
1858 this.onSettingsUpdate = function() {
1859 self.appendUserStyles();
1860 self.objectMgr.manageDisplay();
1861 self.resetQtrack();
1862 message("<span style='color:white;'>Zapisano</span>");
1863 };
1864
1865 this.appendUserStyles = function() {
1866 if (!$userStyle) {
1867 $userStyle = document.createElement("style");
1868 document.head.appendChild($userStyle);
1869 };
1870 $userStyle.innerHTML = this.generateUserCss();
1871 };
1872
1873 this.generateUserCss = function() {
1874 var css = "";
1875 var colors = settings.get("/colors");
1876 for (var name in colors) {
1877 css += this.getSingleCssLine(name, colors[name]);
1878 };
1879 css += ".mmpWrapper { opacity: "+settings.get("/opacity")+"; }\n"
1880 if (settings.get("/interpolerate")) css += ".mmpMapObject { transition: all .5s ease-in-out; }\n";
1881 if (settings.get("/darkmode")) {
1882 css += ".mmpWrapper .mmpBottombar { background: #222222; color: #CCCCCC; }\n";
1883 css += ".mmpWrapper .mmpBottombar input {background: black; border: 1px solid #333333; color: white;}\n";
1884 css += ".mmpWrapper .mmpBottombar a {color: #009c9c;}\n"
1885 css += ".mmpMobileButton {background: #222222; color: #CCCCCC;}\n"
1886 };
1887 if (settings.get("/altmobilebtt")) {
1888 css += ".mmpMobileButton { top: 470px; left: 665px; }\n";
1889 };
1890 if (!settings.get("/showqm")) {
1891 css += ".mmpQM { display: none; }\n";
1892 } else {
1893 css += ".mmpQM { display: block; position: absolute; top: -200%;}\n";
1894 };
1895 if (settings.get("/novisibility")) {
1896 css += ".mmp-visibility { display: none }";
1897 }
1898
1899 return css;
1900 };
1901
1902 this.getSingleCssLine = function(name, val) {
1903 if (innerDotKeys.indexOf(name) > -1) {
1904 return ".mmpMapObject .innerDot.mmp-"+name+" { background: "+val+";}\n";
1905 } else {
1906 return ".mmpMapObject.mmp-"+name+" { background: "+val+";}\n";
1907 };
1908 };
1909
1910 //functionality
1911 this.rclick = function(e) {
1912 if (interface != "old") return; //TODO: support other interfaces
1913 var tar = false
1914 if (e.target.classList.contains("mmp-other")) tar = e.target;
1915 else if (e.target.parentElement.classList.contains("mmp-other")) tar = e.target.parentElement; //for others with innerdot
1916 if (tar) {
1917 var obj = self.objectMgr.getByElem(tar);
1918 if (obj.d.evoNetwork) return;
1919 var id = obj.d.id;
1920 id = id.split("-")[1]; //id = OTHER-rid, where rid = char id of the other player
1921 var $other = document.querySelector("#other"+id);
1922 //hacky solution
1923 var sm = window.showMenu;
1924 var otherMenu = false;
1925 window.showMenu = function(e, menu) {
1926 otherMenu = menu;
1927 window.showMenu = sm;
1928 };
1929 $other.click();
1930 if (otherMenu) {
1931 for (var i in otherMenu) {
1932 //idk it doesn't hide automatically for whatever reason (I mean it does, but only after it has been clicked 2 times)
1933 otherMenu[i][1] += ";hideMenu();";
1934 };
1935 window.showMenu(e, otherMenu, true);
1936 };
1937 e.preventDefault();
1938 };
1939 };
1940
1941 this.goTo = function(e) {
1942 if (e.type == "touchstart") {
1943 var offsets = self.getOffsets(e.target);
1944 e.offsetX = e.touches[0].pageX - offsets[0];
1945 e.offsetY = e.touches[0].pageY - offsets[1];
1946 e.stopPropagation();
1947 };
1948
1949 var coords = self.getCoordsFromEvent(e);
1950 if (interface == "new") {
1951 Engine.hero.autoGoTo({x: coords.x, y: coords.y});
1952 } else if (interface == "old") {
1953 self.searchPath.call(window.hero, coords.x, coords.y);
1954 } else {
1955 self.oldMargoGoTo(coords.x, coords.y);
1956 };
1957 };
1958
1959 this.oldMargoGoTo = function(x, y) {
1960 //window,hero.setMousePos(x*32,y*32);
1961 window.hero.mx = x;
1962 window.hero.my = y;
1963 window.global.movebymouse = true;
1964 this.cancelMouseMovement = true;
1965 };
1966
1967 this.getCoordsFromEvent = function(e) {
1968 if (e.target == $map) {
1969 return {
1970 x: Math.round(e.offsetX/(objScale*32)),
1971 y: Math.round(e.offsetY/(objScale*32))
1972 };
1973 } else {
1974 var obj = this.objectMgr.getByElem(e.target);
1975 return {
1976 x: obj.d.x,
1977 y: obj.d.y
1978 };
1979 };
1980 };
1981
1982 this.getOffsets = function($el, offs) {
1983 var offsets = offs ? offs : [0,0];
1984 offsets[0] += $el.offsetLeft;
1985 offsets[1] += $el.offsetTop;
1986 if ($el.parentElement != null) {
1987 this.getOffsets($el.parentElement, offsets);
1988 };
1989 return offsets;
1990 };
1991
1992 this.searchBarHandler = function(e) {
1993 //keyup event handler
1994 var input = $search.value;
1995 var noSpace = input.replace(/ /g, "");
1996 self.objectMgr.resetSearch();
1997 if (/([0-9]+)-([0-9]+)/.test(noSpace)) {
1998 self.parseRangeSearch(noSpace);
1999 } else if (/([0-9]+),([0-9]+)/.test(noSpace)) {
2000 self.parseCoordSearch(noSpace);
2001 } else {
2002 self.parseStringSearch(input);
2003 };
2004 };
2005 this.parseRangeSearch = function(str) {
2006 var nums = str.split("-");
2007 this.objectMgr.filterByLvl(parseInt(nums[0]), parseInt(nums[1]));
2008 };
2009 this.parseCoordSearch = function(str) {
2010 var coords = str.split(",");
2011 this.objectMgr.createCoordMarker(parseInt(coords[0]), parseInt(coords[1]));
2012 };
2013 this.parseStringSearch = function(str) {
2014 this.objectMgr.filterByString(str);
2015 };
2016
2017 this.makeTip = function(data) {
2018 var tip = data.nocenter ? "" : "<center>";
2019 tip += data.txt+"<div style='text-align: center;color: gray'>("+data.x+","+data.y+")</div>";
2020 return tip + (data.nocenter ? "" : "</center>");
2021 };
2022
2023 this.toggleView = function() {
2024 $wrapper.style["display"] = $wrapper.style["display"] == "block" ? "none" : "block";
2025 };
2026
2027 this.initResponseParser = function() {
2028 if (interface == "new") {
2029 API.priw.emmiter.on("before-game-response", data => {
2030 if (!manualMode) this.parseInput(data);
2031 })
2032 } else if (interface == "old") {
2033 var _parseInput = parseInput;
2034 parseInput = function(data) {
2035 if (!manualMode) self.parseInput(data);
2036 return _parseInput.apply(this, arguments);
2037 };
2038 } else {
2039 API.emmiter.on("response", data => {
2040 if (!manualMode) self.parseInput(self.parseOldMargonemData(data));
2041 })
2042 };
2043 };
2044
2045 self.arr2obj = function(arr) {
2046 var ret = {};
2047 for (var i=0; i<arr.length; i++) {
2048 ret[arr[i].id] = arr[i];
2049 };
2050 return ret;
2051 };
2052
2053 self.parseOldMargonemData = function(data) {
2054 //data.gw2 = [];
2055 //data.townname = {};
2056 /*if (data.elements) {
2057 if (data.elements.npc) Object.assign(data.npc, this.arr2obj(data.elements.npc));
2058 if (data.elements.other) Object.assign(data.other, this.arr2obj(data.elements.other));
2059 }
2060 if (data.delete) {
2061 if (data.delete.npc) Object.assign(data.npc, this.arr2obj(data.delete.npc));
2062 if (data.delete.other) Object.assign(data.other, this.arr2obj(data.delete.other));
2063 }
2064 if (data.othermove) {
2065 Object.assign(data.other, this.arr2obj(data.othermove));
2066 console.log(data.othermove);
2067 };*/
2068 return data;
2069 };
2070
2071 this.enableManualMode = function() { //tryb w ktĂłrym ignoruje wszystkie dane z silnika gry; na potrzeby mojego dodatku klanowego
2072 manualMode = true;
2073 };
2074 this.disableManualMode = function() {
2075 manualMode = false;
2076 };
2077
2078 this.parseInput = function(data) {
2079 for (var i in data) {
2080 if (typeof this.eventHandlers[i] == "function") this.eventHandlers[i](data[i]);
2081 };
2082 if (data.townname) this.eventHandlers.gateways(data.gw2, data.townname);
2083 };
2084
2085 this.eventHandlers = {
2086 town: function(town) {
2087 self.loadMap(town);
2088 },
2089 npc: function(npc) {
2090 self.parseNpc(npc);
2091 },
2092 gateways: function(gws, townname) {
2093 self.parseGws(gws, townname);
2094 },
2095 other: function(others) {
2096 self.parseOther(others);
2097 },
2098 item: function(items) {
2099 self.parseItem(items);
2100 },
2101 rip: function(rip) {
2102 self.parseRip(rip);
2103 }
2104 };
2105
2106 this.resetQtrack = function() {
2107 qTrack.reset();
2108 var npc = settings.get("/trackedNpcs");
2109 for (var i=0; i<npc.length; i++) {
2110 qTrack.add({
2111 type: "NPC",
2112 name: npc[i]
2113 });
2114 };
2115 var item = settings.get("/trackedItems");
2116 for (i=0; i<item.length; i++) {
2117 qTrack.add({
2118 type: "ITEM",
2119 name: item[i]
2120 });
2121 };
2122 };
2123
2124 this.loadMap = function(town) {
2125 if (interface == "superold") town.file = town.img;
2126 this.resetQtrack();
2127 this.objectMgr.deleteAll();
2128 var mapsize = interface == "new" ? 700 : 440;
2129 mapsize = mapsize*settings.get("/mapsize");
2130 if (town.x > town.y) {
2131 var height = Math.floor(town.y/town.x * mapsize);
2132 var width = mapsize;
2133 } else {
2134 var width = Math.floor(town.x/town.y * mapsize);
2135 var height = mapsize;
2136 };
2137 objScale = width/(town.x*32);
2138 objSize = Math.round(objScale*32);
2139
2140 var left = 0;
2141 var top = 0;
2142 if (interface != "new") {
2143 top = -30;
2144 left = -144;
2145 };
2146
2147 Object.assign($wrapper.style, {
2148 //$map will stretch the $wrapper
2149 //width: width + "px",
2150 //height: (height+20) + "px",
2151 left: "calc(50% - "+(width/2 - left)+"px)",
2152 top: "calc(50% - "+(height/2 - top)+"px)"
2153 });
2154 Object.assign($map.style, {
2155 width: width + "px",
2156 height: height + "px",
2157 });
2158 if (width < 385) $info.style["display"] = "none";
2159 else $info.style["display"] = "inline-block";
2160 if (width < 210) $searchTxt.style["display"] = "none";
2161 else $searchTxt.style["display"] = "inline-block";
2162
2163 this.loadMapImg(town.file);
2164 if (interface != "superold") {
2165 this.addSpawnsToMap(herosDB, true, town.name, town.id);
2166 this.addSpawnsToMap(eliteDB, false, town.name, town.id);
2167 };
2168 this.updateVisibility(town.visibility, objScale);
2169 this.updateHero(true);
2170 };
2171
2172 this.updateVisibility = function(n, scale) {
2173 if (n) {
2174 let size = (n*2 + 1)*scale*32;
2175 Object.assign($visibility.style, {
2176 width: size + "px",
2177 height: size + "px",
2178 "margin-top": (size/-2) + "px",
2179 "margin-left": (size/-2) + "px",
2180 opacity: 1
2181 });
2182 } else {
2183 $visibility.style.opacity = 0;
2184 }
2185 }
2186
2187 this.loadMapImg = function(file) {
2188 $map.style["background-image"] = "";
2189 $map.style["background"] = "#444444";
2190 var miniMapImg = new Image();
2191 if (file.indexOf("http") == -1) {
2192 var mpath = interface == "old" ? g.mpath : "/obrazki/miasta/";
2193 miniMapImg.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + mpath + file;
2194 } else {
2195 miniMapImg.src = file;
2196 };
2197 miniMapImg.onload = function() {
2198 $map.style["background"] = "";
2199 $map.style["background-image"] = "url("+miniMapImg.src+")";
2200 };
2201 };
2202
2203 this.parseNpc = function(npcs) {
2204 for (var id in npcs) {
2205 var npc = npcs[id];
2206 if (!npc.del) {
2207 this.addNewNpcToMap(npc, id);
2208 } else {
2209 this.objectMgr.updateObject({
2210 id: "NPC-"+id,
2211 del: 1
2212 });
2213 if (npcTrack[id]) {
2214 qTrack.remove({
2215 type: "NPC",
2216 nick: npcTrack[id].nick
2217 });
2218 delete npcTrack[id];
2219 };
2220 };
2221 };
2222 };
2223 this.addNewNpcToMap = function(npc, id) {
2224 var {type, flash} = this.getNpcType(npc, id);
2225 if (type == undefined) return;
2226 var {tip, ctip} = this.getNpcTip(npc, type, flash);
2227 var data = {
2228 id: "NPC-"+id,
2229 type: type,
2230 flash: flash,
2231 tip: tip,
2232 ctip: ctip,
2233 x: npc.x,
2234 y: npc.y,
2235 qm: npc.qm || (npc.actions && npc.actions & 128)
2236 };
2237 if (type != "npc" && type != "gw" && type != "item") {
2238 data.lvl = npc.lvl;
2239 };
2240 this.objectMgr.updateObject(data)
2241 };
2242 this.getNpcTip = function(npc, type, important) {
2243 var tip = "";
2244 var mask = false;
2245 for (var i=0; i<masks.length; i++) {
2246 if (masks[i].indexOf(npc.icon) > -1) mask = true;
2247 };
2248 if (!mask) tip += "<img src='"+this.npcIconHTML(npc.icon)+"'>";
2249 var ctip = "t_npc";
2250 if (type == "gw") {
2251 ctip = false;
2252 tip = this.makeTip({
2253 txt: npc.nick + "<br>",
2254 x: npc.x,
2255 y: npc.y
2256 })
2257 } else if (type == "item") {
2258 ctip = "t_item";
2259 tip = this.makeTip({
2260 x: npc.x,
2261 y: npc.y,
2262 txt: tip + "<br>" + npc.nick
2263 })
2264 } else {
2265 tip = this.normalNpcTip(npc, type, important, tip);
2266 };
2267 return {
2268 tip: tip,
2269 ctip: ctip
2270 }
2271 };
2272 this.npcIconHTML = function(icon) {
2273 if (icon.indexOf("://") > -1 || icon.indexOf("obrazki/") > -1) return icon; //zapomniaĹem o kompatybilnoĹci z jednÄ
rzeczÄ
ktĂłrÄ
robiÄ xd
2274 else if (interface == "superold") return "http://oldmargonem.pl/obrazki/npc/"+icon;
2275 else return (interface == "old" ? g.opath : "/obrazki/")+"npc/"+icon;
2276 };
2277 this.oldNpcTip = function(npc, type, eve) {
2278 var icon = npc.icon;
2279 npc.icon = "kappa";
2280 if (type == "elite2" && !eve) {
2281 npc.wt = 30;
2282 };
2283
2284 if (!g.tips.npc) newNpc();
2285 var tip = g.tips.npc(npc);
2286
2287 if (type == "elite2") {
2288 if (!eve) {
2289 npc.wt = 20;
2290 tip = tip.replace("elita III", "elita II");
2291 } else {
2292 tip = tip.replace("elita", "specjalna elita");
2293 };
2294 };
2295 npc.icon = icon;
2296 return typeof tip == "string" ? tip : "";
2297 };
2298 this.newNpcTip = function(npc, type, eve) {
2299 var nick = "<div><strong>"+npc.nick+"</strong></div>";
2300 switch (type) {
2301 case "titan":
2302 var type = "<i>tytan</i>";
2303 break;
2304 case "heros":
2305 var type = "<i>heros</i>";
2306 break;
2307 case "elite3":
2308 var type = "<i>elita III</i>";
2309 break;
2310 case "elite2":
2311 if (eve) {
2312 var type = "<i>specjalna elita</i>";
2313 } else {
2314 var type = "<i>elita II</i>";
2315 }
2316 break;
2317 case "elite":
2318 var type = "<i>elita</i>";
2319 break;
2320 default:
2321 var type = "";
2322 break;
2323 };
2324 var lvl = npc.lvl ? npc.lvl + " lvl" : "";
2325 var grp = npc.grp ? " grp" : "";
2326 var lvlgrp = "<span>"+lvl+grp+"</span>";
2327 return nick + type + lvlgrp;
2328 };
2329 this.oldMargoNpcTip = function(npc, type, eve) {
2330 var nick = "<b style='color:orange;'>"+npc.nick+"</b>";
2331 switch (type) {
2332 case "titan":
2333 var type = "<i>tytan</i><br>";
2334 break;
2335 case "heros":
2336 var type = "<i>heros</i><br>";
2337 break;
2338 case "elite3":
2339 var type = "<i>elita III</i><br>";
2340 break;
2341 case "elite2":
2342 if (eve) {
2343 var type = "<i>specjalna elita</i><br>";
2344 } else {
2345 var type = "<i>elita II</i><br>";
2346 }
2347 break;
2348 case "elite":
2349 var type = "<i>elita</i><br>";
2350 break;
2351 default:
2352 var type = "";
2353 break;
2354 };
2355 var lvl = npc.lvl ? "Lvl: "+npc.lvl : "";
2356 var grp = npc.grp ? " grp" : "";
2357 var lvlgrp = "<span>"+lvl+grp+"</span>";
2358 return nick + type + lvlgrp;
2359 };
2360 this.normalNpcTip = function(npc, type, important, before) {
2361 if (interface == "old") {
2362 var tip = this.oldNpcTip(npc, type, important).replace("<span ></span><br>", "").replace("<span ></span>", "");
2363 } else if (interface == "new") {
2364 var tip = this.newNpcTip(npc, type, important);
2365 } else {
2366 var tip = this.oldMargoNpcTip(npc, type, important);
2367 };
2368 if (npc.lvl > 0) tip += "<br>";
2369 return this.makeTip({
2370 txt: before+tip,
2371 x: npc.x,
2372 y: npc.y
2373 });
2374 };
2375 var npcTrack = {};
2376 this.addNpcToTrack = function(npc, id, heros) {
2377 npcTrack[id] = npc;
2378 qTrack.add({
2379 type: "NPC",
2380 name: npc.nick
2381 });
2382 if (interface != "superold") this.checkForUnknownResp(npc, heros);
2383 };
2384 this.checkForUnknownResp = function(npc, heros) {
2385 var map = interface == "new" ? Engine.map.d : window.map;
2386 var db = heros ? herosDB : eliteDB;
2387 if (db[npc.nick] && db[npc.nick].spawns) {
2388 var spawns = db[npc.nick].spawns;
2389 if (spawns[map.name] || spawns[map.id]) {
2390 var spawnsOnMap = spawns[map.name] ? spawns[map.name] : spawns[map.id];
2391 if (spawns[map.name]) this.unknownMapId(map.name, map.id, heros);
2392 if (!this.coordsExistInSpawns(spawnsOnMap, npc.x, npc.y)) this.unknownResp(npc, map, heros);
2393 };
2394 };
2395 };
2396 this.coordsExistInSpawns = function(spawns, x, y) {
2397 for (var i=0; i<spawns.length; i++) {
2398 if (spawns[i][0] == x && spawns[i][1] == y) return true;
2399 };
2400 return false;
2401 };
2402 this.unknownResp = function(npc, map, heros) {
2403 var log = interface == "new" ? API.priw.console.log : window.log;
2404 log("<hr>"+(heros ? "Heros" : "Elita")+" znajduje siÄ na respie, ktĂłry nie jest w bazie danych minimapy.",1);
2405 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>");
2406 };
2407 this.unknownMapId = function(name, id, heros) {
2408 var log = interface == "new" ? API.priw.console.log : window.log;
2409 log("<hr>"+"Mapa, na ktĂłrej "+(heros ? "zrespiĹ siÄ heros" : "zrespiĹa siÄ elita")+", nie jest zapisana w bazie danych po ID.",1);
2410 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>");
2411 };
2412 this.getNpcType = function(npc, id) {
2413 if (npc.type == 2 || npc.type == 3) {
2414 var flash = false;
2415 if (npc.wt > 99) {
2416 //tytan
2417 var type = "titan";
2418 } else if (npc.wt > 79) {
2419 //heros
2420 var type = "heros";
2421 this.addNpcToTrack(npc, id, true);
2422 flash = true;
2423 } else if (eliteDB[npc.nick]) {
2424 //specjalna elita
2425 var type = "elite2";
2426 this.addNpcToTrack(npc, id, false);
2427 flash = true;
2428 } else if (npc.wt > 29) {
2429 //e3
2430 var type = "elite3";
2431 } else if (npc.wt > 19) {
2432 //e2
2433 var type = "elite2";
2434 } else if (npc.wt > 9) {
2435 //e
2436 var type = "elite";
2437 } else {
2438 //nub
2439 var type = "mob";
2440 };
2441 } else if (npc.type == 0 || npc.type == 5) {
2442 if (gws.indexOf(npc.icon) == -1) {
2443 var type = "npc";
2444 } else {
2445 var type = "gw";
2446 };
2447 } else if (_l() == "en" && npc.type == 7) {
2448 var type = "item";
2449 };
2450 return {
2451 type: type,
2452 flash: flash
2453 };
2454 };
2455
2456 this.initHeroUpdating = function() {
2457 if (interface != "new") {
2458 var _run = hero.run;
2459 hero.run = function() {
2460 self.updateHero();
2461 var ret = _run.apply(this, arguments);
2462 if (interface == "superold" && self.cancelMouseMovement) {
2463 self.cancelMouseMovement = false;
2464 window.global.movebymouse = false;
2465 }
2466 return ret;
2467 };
2468 } else if (interface == "new") {
2469 var _draw = Engine.map.draw;
2470 Engine.map.draw = function() {
2471 self.updateHero();
2472 return _draw.apply(this, arguments);
2473 };
2474 };
2475 };
2476
2477 this.updateHero = function(ignore) {
2478 qTrack.update();
2479 if (interface == "new") var hero = Engine.hero.d;
2480 else var hero = window.hero;
2481 if (!ignore && oldPos.x == hero.x && oldPos.y == hero.y) return;
2482 this.objectMgr.updateObject({
2483 id: "HERO",
2484 x: hero.x,
2485 y: hero.y,
2486 tip: "Moja postaÄ",
2487 type: "hero",
2488 children: [$visibility]
2489 });
2490 oldPos.x = hero.x;
2491 oldPos.y = hero.y;
2492 };
2493
2494 this.parseGws = function(gws, townname) {
2495 for (var i=0; i<gws.length; i+=5) {
2496 var tip = townname[gws[i]];
2497 if (gws[i+3]) {
2498 if (gws[i+3] == 2) {
2499 tip += interface != "superold" ? "<br>("+_t("require_key", null , "gtw")+")" : "<br>(wymaga klucza)";
2500 };
2501 };
2502 if (gws[i+4]) {
2503 var min = (parseInt(gws[i+4]) & 65535);
2504 var max = ((parseInt(gws[i+4]) >> 16) & 65535);
2505 tip += "<br>" + _t("gateway_availavle", null , "gtw");
2506 tip += min ? _t("from_lvl %lvl%", {"%lvl%": min }, "gtw") : "";
2507 tip += max >= 1000 ? "" : _t("to_lvl %lvl%", { "%lvl%": max }, "gtw") + _t("lvl_lvl", null , "gtw");
2508 };
2509 this.objectMgr.updateObject({
2510 tip: this.makeTip({
2511 txt: tip + "<br>",
2512 x: gws[i+1],
2513 y: gws[i+2]
2514 }),
2515 type: "gw",
2516 x: gws[i+1],
2517 y: gws[i+2],
2518 id: "GW-"+gws[i]+"-"+i
2519 });
2520 };
2521 };
2522
2523 this.parseOther = function(others) {
2524 for (var id in others) {
2525 var other = others[id];
2526 if (!other.del) {
2527 if ((interface != "new" && !g.other[id]) || (interface == "new" && !Engine.others.getById(id))) {
2528 if (interface != "superold" || other.nick) this.addNewOtherToMap(other, id); //dumb fix
2529 } else {
2530 this.updateOther(other, id);
2531 };
2532 } else {
2533 this.objectMgr.updateObject({
2534 id: "OTHER-"+id,
2535 del: 1
2536 });
2537 };
2538 }
2539 };
2540 this.updateOther = function(other, id) {
2541 var evoNetwork = this.checkIfOtherFromEvoNetwork(id);
2542 var data = {};
2543 var canLoadImgFromCache = !other.icon;
2544 var previousData = interface == "new" ? Engine.others.getById(id).d : g.other[id];
2545 var other = Object.assign({}, previousData, other);
2546 if (isset(other.x)) data.x = other.x;
2547 if (isset(other.y)) data.y = other.y;
2548 var {tip, ctip} = this.getOtherTip(other, evoNetwork);
2549 if (canLoadImgFromCache && this.otherImgCache[id]) {
2550 var img = this.otherImgCache[id];
2551 tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip;
2552 } else {
2553 this.loadOtherImg(other, id, tip);
2554 }
2555 data.tip = tip;
2556 data.ctip = ctip;
2557 data.id = "OTHER-"+id;
2558 this.objectMgr.updateObject(data);
2559 };
2560 this.otherImgCache = {};
2561 this.checkIfOtherFromEvoNetwork = function(id) {
2562 //rozpoznawanie postaci z innych ĹwiatĂłw dodawanych przez dodatek ccarederra
2563 return String(id).split("_")[1] == "wsync";
2564 };
2565 this.addNewOtherToMap = function(other, id) {
2566 var type;
2567 var evoNetwork = this.checkIfOtherFromEvoNetwork(id);
2568 if (evoNetwork && !settings.get("/showevonetwork")) return;
2569 switch (other.relation) {
2570 case "": //obcy
2571 type = "other";
2572 break;
2573 case "cl-fr": //sojusznik
2574 case "fr-fr": //fraction friend
2575 type = "ally";
2576 break;
2577 case "cl": //klanowicz
2578 type = "clan";
2579 break;
2580 case "fr": //znajomy
2581 type = "friend";
2582 break;
2583 case "en": //wrĂłg
2584 case "cl-en": //wrogi klan
2585 case "fr-en": //fraction enemy
2586 type = "enemy";
2587 break;
2588 default:
2589 type = "other";
2590 break;
2591 };
2592 if (evoNetwork) type = "evoNetwork";
2593 var {tip, ctip} = this.getOtherTip(other, evoNetwork);
2594 this.objectMgr.updateObject({
2595 tip: tip,
2596 ctip: ctip,
2597 type: "other",
2598 type2: type,
2599 x: other.x,
2600 y: other.y,
2601 id: "OTHER-"+id,
2602 evoNetwork: evoNetwork,
2603 click: function() {
2604 if (evoNetwork) return; //gdy ccarderr zrobi jakieĹ kanaĹy prywatne w swoim chacie to klikniÄcie gracza bÄdzie taki otwieraÄ
2605 if (interface != "old") {
2606 $chatInput.value = "@" + other.nick.replace(/ /g, "_") + " ";
2607 $chatInput.focus();
2608 if (interface == "superold") {
2609 //switch from eq to chat
2610 if (window.chat.style.display == "none") {
2611 var btt = document.querySelector("#eqbutton");
2612 btt.click();
2613 btt.style["background-position"] = "";
2614 };
2615 };
2616 } else if (interface == "old") {
2617 chatTo(other.nick);
2618 };
2619 }
2620 });
2621 this.loadOtherImg(other, id, tip);
2622 };
2623 this.loadOtherImg = function(other, id, tip) {
2624 var img = new Image();
2625 img.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + "/obrazki/postacie/"+other.icon;
2626 img.onload = function() {
2627 self.otherImgCache[id] = img;
2628 tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip;
2629 self.objectMgr.updateObject({
2630 tip: tip,
2631 id: "OTHER-"+id
2632 });
2633 };
2634 }
2635 this.getOtherTip = function(other, evoNetwork) {
2636 if (interface == "old") {
2637 var tip = this.oldOtherTip(other);
2638 } else if (interface == "new") {
2639 var tip = this.newOtherTip(other);
2640 } else {
2641 var tip = this.oldMargoOtherTip(other);
2642 };
2643 if (evoNetwork) {
2644 tip += "<i>PostaÄ z dodatku World Sync</i>";
2645 };
2646 return {
2647 tip: this.makeTip({
2648 txt: tip + (evoNetwork ? "" : "<br>"),
2649 x: other.x,
2650 y: other.y
2651 }),
2652 ctip: "t_other" + (other.relation != "" && interface != "new" ? " t_"+other.relation : "")
2653 };
2654 };
2655 this.oldOtherTip = function(other) {
2656 if (!g.tips.other) newOther({0:{}});newOther({0:{del:1}});
2657 var tip = g.tips.other(other);
2658 return tip.replace(/'/g, "'")
2659 };
2660 this.newOtherTip = function(other) {
2661 //pre-wrapper
2662 if (other.rights) {
2663 var rank;
2664 if (other.rights & 1) rank = 0;
2665 else if (other.rights & 16) rank = 1;
2666 else if (other.rights & 2) rank = 2;
2667 else if (other.rights & 4) rank = 4;
2668 else rank = 3;
2669 rank = "<div class='rank'>"+otherRanks[rank]+"</div>";
2670 } else {
2671 var rank = "";
2672 };
2673 var guest = isset(other.guest) ? "<div class='rank'>ZastÄpca</div>" : "";
2674 var preWrapper = rank + guest;
2675 //wrapper
2676 var nick = "<div class='nick'>" + other.nick + "</div>";
2677 var prof = "<div class='profs-icon "+other.prof+"'></div>";
2678 var bless = isset(other.ble) ? "<div class='bless'></div>" : "";
2679 var infoWrapper = "<div class='info-wrapper'>" + nick + bless + prof + "</div>";
2680 //post-wrapper
2681 var wanted = isset(other.wanted) ? "<div class='wanted'></div>" : "";
2682 var clan = (isset(other.clan) && other.clan.name != "") ? "<div class='clan-in-tip'>"+other.clan.name+"</div><div class='line'></div>" : "";
2683 var lvl = isset(other.lvl) ? "<div class='lvl'>"+other.lvl+" lvl</div>" : "";
2684 var mute = (other.attr & 1) ? "<div class='mute'></div>" : "";
2685 var postWrapper = wanted + clan + lvl + mute;
2686
2687 return preWrapper + infoWrapper + postWrapper;
2688 };
2689 this.oldMargoOtherTip = function(other) {
2690 var tip = "<b style='color:yellow'>"+other.nick+"</b>";
2691 if (other.clan) tip += "<span style='color:#fd9;'>["+g.clanname[other.clan]+"]</span><br>";
2692 tip += "Lvl: "+other.lvl+other.prof;
2693 return tip;
2694
2695 };
2696
2697 this.parseItem = function(items) {
2698 for (var id in items) {
2699 var item = items[id];
2700 if (item.loc == "m") {
2701 this.addNewItemToMap(item, id);
2702 } else {
2703 var previousData = interface == "new" ? Engine.items.getItemById(id) : g.item[id];
2704 if (interface == "new" && previousData) previousData = previousData.d;
2705 if (previousData && previousData.loc == "m") {
2706 this.objectMgr.updateObject({
2707 id: "ITEM-"+id,
2708 del: 1
2709 });
2710 };
2711 }
2712 }
2713 };
2714 this.addNewItemToMap = function(item, id) {
2715 var tip = this.getItemTip(item);
2716 this.objectMgr.updateObject({
2717 id: "ITEM-"+id,
2718 tip: tip,
2719 ctip: "t_item",
2720 x: item.x,
2721 y: item.y,
2722 type: "item"
2723 });
2724 };
2725 this.oldMargoItemTip = function(item) {
2726 return "<b>"+item.name+"</b>"+item.stats;
2727 };
2728 this.getItemTip = function(item) {
2729 var nocenter = true;
2730 var tip = interface == "new" ? MargoTipsParser.getTip(item) : (interface == "old" ? itemTip(item) : this.oldMargoItemTip(item));
2731 if (interface == "old" && tip.indexOf("tip-section") == -1) { //kompatybilnoĹÄ z moim dodatkiem na nowe tipy
2732 tip = "<img src='"+(interface == "superold" ? "http://oldmargonem.pl" : "") +"/obrazki/itemy/"+item.icon+"'>" + tip;
2733 nocenter = false;
2734 };
2735 return this.makeTip({
2736 txt: tip,
2737 x: item.x,
2738 y: item.y,
2739 nocenter: nocenter
2740 });
2741 };
2742 var ripCount = 0;
2743 this.parseRip = function(rips) {
2744 for (var i=0; i<rips.length; i+=8) {
2745 this.addNewRipToMap({
2746 nick: rips[i],
2747 lvl: rips[i+1],
2748 prof: rips[i+2],
2749 x: parseInt(rips[i+3]),
2750 y: parseInt(rips[i+4]),
2751 ts: parseInt(rips[i+5]),
2752 desc1: rips[i+6],
2753 desc2: rips[i+7]
2754 });
2755 ripCount++;
2756 };
2757 };
2758 this.addNewRipToMap = function(rip) {
2759 var isHerosRip = false;
2760 var timeToDisappear = 300 + rip.ts - unix_time();
2761 if (timeToDisappear <= 0) return;
2762 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>";
2763 this.objectMgr.updateObject({
2764 tip: this.makeTip({
2765 txt: tip,
2766 x: rip.x,
2767 y: rip.y
2768 }),
2769 type: "other",
2770 x: rip.x,
2771 y: rip.y,
2772 circle: true,
2773 border: true,
2774 id: "RIP-"+ripCount,
2775 ctip: "t_rip"
2776 });
2777 var id = "RIP-"+ripCount;
2778 var nick;
2779 if (nick = this.checkHerosRip(rip.desc1)) {
2780 qTrack.add({type: "COORDS", name: "GrĂłb gracza zabitego przez herosa "+nick+"<br>MoĹźliwe, Ĺźe heros tam stoi!", coords: [rip.x, rip.y] });
2781 isHerosRip = true;
2782 message("Na mapie znajduje siÄ grĂłb gracza zabitego przez herosa "+nick);
2783 };
2784 setTimeout(() => {
2785 self.objectMgr.updateObject({
2786 id: id,
2787 del: 1
2788 });
2789 if (isHerosRip) qTrack.remove({type: "COORDS", name: "GrĂłb gracza zabitego przez herosa "+nick+"<br>MoĹźliwe, Ĺźe heros tam stoi!"});
2790 }, timeToDisappear*1000);
2791 };
2792 this.checkHerosRip = function(desc) {
2793 for (var nick in herosDB) {
2794 var needle = nick + "(" + herosDB[nick].lvl + herosDB[nick].prof + ")";
2795 if (desc.indexOf(needle) > -1) {
2796 return nick;
2797 };
2798 };
2799 return false;
2800 };
2801
2802 this.objectMgr = new (function() {
2803 var self = this;
2804 var mgr = this;
2805 var objs = {};
2806 var flashables = [];
2807 function MapObject(data) {
2808 var self = this;
2809 this.d = data;
2810 var currentColor = settings.get("/colors")[this.d.type];
2811
2812 this.initHTML = function() {
2813 this.$ = document.createElement("div");
2814 this.$.classList.add("mmpMapObject", "mmp-"+data.type);
2815 if (innerDotKeys.indexOf(data.type2) != -1) {
2816 var $dot = document.createElement("div");
2817 $dot.classList.add("innerDot", "mmp-"+data.type2);
2818 Object.assign($dot.style, {
2819 left: objSize/4 + "px",
2820 top: objSize/4 + "px",
2821 width: objSize/2 + "px",
2822 height: objSize/2 + "px"
2823 });
2824 this.$.appendChild($dot);
2825 } else if (data.type2 == "evoNetwork") {
2826 this.$.classList.add("evoNetwork");
2827 };
2828 if (data.children) {
2829 // append extra children to the object
2830 for (let i=0; i<data.children.length; i++) {
2831 this.$.appendChild(data.children[i]);
2832 }
2833 }
2834 var left = data.x * objScale * 32;
2835 var top = data.y * objScale * 32;
2836 Object.assign(this.$.style, {
2837 top: top + "px",
2838 left: left + "px",
2839 width: objSize + "px",
2840 height: objSize + "px",
2841 opacity: "0"
2842 });
2843 setTimeout(() => this.$.style.opacity = "1.0", 1);
2844 if (interface != "new") {
2845 this.$.setAttribute("tip", data.tip);
2846 if (data.ctip) this.$.setAttribute("ctip", data.ctip);
2847 } else {
2848 this.$.setAttribute("data-tip", data.tip);
2849 if (data.ctip) this.$.setAttribute("data-tip-type", data.ctip);
2850 };
2851 if (data.circle) {
2852 this.$.style["border-radius"] = objScale*18 + "px";
2853 };
2854 if (data.border) {
2855 this.$.style["border"] = "1px solid black";
2856 };
2857 if (data.qm) {
2858 this.$.innerHTML = "<img class='mmpQM' width='"+objSize+"' height='"+objSize*2+"' src='http://jaruna.margonem.pl/img/quest-mark.gif'>";
2859 };
2860 $map.appendChild(this.$);
2861 };
2862
2863 this.invertColor = function() {
2864 var c = currentColor;
2865 var c1 = (255 - parseInt("0x"+c.substring(1,3))).toString(16);
2866 var c2 = (255 - parseInt("0x"+c.substring(3,5))).toString(16);
2867 var c3 = (255 - parseInt("0x"+c.substring(5,7))).toString(16);
2868 if (c1.length < 2) c1 = "0" + c1;
2869 if (c2.length < 2) c2 = "0" + c2;
2870 if (c3.length < 2) c3 = "0" + c3;
2871 currentColor = "#"+c1+c2+c3;
2872 this.$.style.background = currentColor;
2873 };
2874
2875 this.remove = function() {
2876 if (this.d.flash) flashables.splice(flashables.indexOf(this), 1);
2877 this.$.style["opacity"] = "0";
2878 if (settings.get("/interpolerate")) setTimeout(() => this.$.remove(), 500);
2879 else this.$.remove();
2880 };
2881
2882 this.update = function(data) {
2883 Object.assign(this.d, data);
2884 if (data.x) {
2885 this.$.style["left"] = data.x * objScale * 32 + "px";
2886 };
2887 if (data.y) {
2888 this.$.style["top"] = data.y * objScale * 32 + "px";
2889 };
2890 if (data.tip) {
2891 this.$.setAttribute(interface == "new" ? "data-tip" : "tip", data.tip);
2892 };
2893 if (data.invertColor) {
2894 this.invertColor();
2895 };
2896 };
2897
2898 this.initEventListener = function() {
2899 if (data.click) {
2900 var type = mobileDevice ? "touchstart" : "click";
2901 this.$.addEventListener(type, e => {
2902 data.click(e);
2903 e.stopPropagation();
2904 });
2905 };// else {
2906 //this.$.addEventListener("click", this.goTo);
2907 //}
2908 };
2909
2910 //this.goTo = function() {
2911 // if (newInterface) {
2912 // Engine.hero.autoGoTo({x :self.d.x, y: self.d.y});
2913 // } else {
2914 // self.searchPath.call(window.hero, self.d.x, self.d.y);
2915 // };
2916 //};
2917
2918 this.manageDisplay = function() {
2919 if (!this.d.flash && isset(this.d.lvl) && this.d.lvl < settings.get("/minlvl")) {
2920 this.$.classList.add("hidden");
2921 } else {
2922 this.$.classList.remove("hidden");
2923 };
2924 };
2925
2926 this.checkStringSearch = function(str) {
2927 if (this.d.tip.toLowerCase().indexOf(str) == -1 && this.d.type != "hero") {
2928 this.$.classList.add("hiddenBySearch");
2929 };
2930 };
2931
2932 this.checkRangeSearch = function(n1, n2) {
2933 if (isset(this.d.lvl)) {
2934 if (this.d.lvl < n1 || this.d.lvl > n2) {
2935 this.$.classList.add("hiddenBySearch");
2936 };
2937 };
2938 };
2939
2940 this.manageFilters = function() {
2941 if (search.type == "string" && search.data != "") {
2942 this.checkStringSearch(search.data);
2943 } else if (search.type == "lvl") {
2944 this.checkRangeSearch(search.data[0], search.data[1]);
2945 };
2946 };
2947
2948 this.init = function() {
2949 if (data.flash) flashables.push(this);
2950 this.initHTML();
2951 this.initEventListener();
2952 this.manageDisplay();
2953 this.manageFilters();
2954 };
2955 this.init();
2956 };
2957 this.getByElem = function($el) {
2958 for (var i in objs) {
2959 if (objs[i].$ == $el) return objs[i];
2960 };
2961 };
2962 this.deleteAll = function() {
2963 for (var i in objs) {
2964 objs[i].remove();
2965 delete objs[i];
2966 };
2967 };
2968 this.updateObject = function(data) {
2969 if (!objs[data.id] && !data.del) {
2970 if (!data.dontCreate) objs[data.id] = new MapObject(data);
2971 } else if (data.del) {
2972 if (objs[data.id]) {
2973 objs[data.id].remove();
2974 delete objs[data.id];
2975 };
2976 } else {
2977 objs[data.id].update(data);
2978 }
2979 };
2980 this.resetSearch = function() {
2981 this.removeCoordMarker();
2982 for (var id in objs) {
2983 objs[id].$.classList.remove("hiddenBySearch");
2984 };
2985 };
2986 this.filterByLvl = function(n1, n2) {
2987 search.type = "lvl",
2988 search.data = [n1, n2];
2989 for (var id in objs) {
2990 objs[id].checkRangeSearch(n1, n2);
2991 };
2992 };
2993 this.filterByString = function(str) {
2994 str = str.toLowerCase();
2995 search.type = "string",
2996 search.data = str;
2997 for (var id in objs) {
2998 objs[id].checkStringSearch(str);
2999 };
3000 };
3001 this.removeCoordMarker = function() {
3002 this.updateObject({
3003 id: "COORDS",
3004 del: 1
3005 });
3006 };
3007 this.createCoordMarker = function(x, y) {
3008 this.updateObject({
3009 id: "COORDS",
3010 x: x,
3011 y: y,
3012 tip: "koordy "+x+","+y,
3013 circle: true,
3014 type: "hero",
3015 flash: true
3016 })
3017 };
3018 this.manageDisplay = function() {
3019 for (var id in objs) {
3020 objs[id].manageDisplay();
3021 };
3022 };
3023 this.invertFlashables = function() {
3024 for (var i=0; i<flashables.length; i++) {
3025 flashables[i].update({
3026 invertColor: true
3027 });
3028 };
3029 };
3030 setInterval(this.invertFlashables, 500);
3031 })();
3032
3033 this.addSpawnsToMap = function(db, heros, map, mapId) {
3034 map = map.toLowerCase();
3035 var maxlvl = settings.get("/maxlvl");
3036 var hero = interface == "new" ? Engine.hero.d : window.hero;
3037 for (var i in db) {
3038 var mob = db[i];
3039 if (mob.ver && mob.ver != _l()) continue;
3040 var minlvl = Math.max(mob.lvl/2, mob.lvl-50);
3041 if ((maxlvl+mob.lvl >= hero.lvl && minlvl <= hero.lvl) || mob.lvl >= 242 || mob.lvl == -1) {
3042 for (var loc in mob.spawns) {
3043 if (loc.toLowerCase() == map || loc == mapId) {
3044 var spawns = mob.spawns[loc];
3045 for (var j=0; j<spawns.length; j++) {
3046 var x = spawns[j][0];
3047 var y = spawns[j][1];
3048 this.objectMgr.updateObject({
3049 id: "SPAWN-"+i+"-"+j,
3050 tip: this.makeTip({
3051 txt: "Resp " + (heros ? "herosa " : "elity ") + i,
3052 x: x,
3053 y: y
3054 }),
3055 x: x,
3056 y: y,
3057 type: heros ? "heros" : "elite2",
3058 circle: true
3059 });
3060 };
3061 };
3062 };
3063 };
3064 };
3065 };
3066
3067 this.init = function() {
3068 this.initSettings();
3069 this.initHTML();
3070 this.appendUserStyles();
3071 this.initResponseParser();
3072 this.initHeroUpdating();
3073 this.appendMobileButton();
3074 this.installationCounter.count();
3075 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)};
3076 $chatInput = interface == "new" ? document.querySelector("[data-section='chat'] .input-wrapper input") : (interface == "superold" ? document.querySelector("#chatIn") : null);
3077 };
3078
3079 //questtrack (fuzja kodu z wersji minimapy na SI i NI wiÄc wyglÄ
da jak wyglÄ
da)
3080 var qTrack = new (function() {
3081 var self = this;
3082 var hero = interface == "new" ? Engine.hero : window.hero;
3083 var $hero = interface == "old" ? $("#hero") : (interface == "superold" ? document.querySelector("#oHero") : null);
3084 var $canvas = interface == "new" ? $("#GAME_CANVAS") : null;
3085 if (interface == "new") {
3086 this.npcs = {};
3087 API.addCallbackToEvent("newNpc", function(npc) {
3088 if (npc) self.npcs[npc.d.id] = npc.d;
3089 });
3090 API.addCallbackToEvent("removeNpc", function(npc) {
3091 if (npc) delete self.npcs[npc.d.id];
3092 });
3093 };
3094 this.getOldMargoHeroPos = function() {
3095 return {
3096 left: $hero.offsetLeft,
3097 top: $hero.offsetTop
3098 };
3099 };
3100 this.getHeroPos = function() {
3101 if (interface == "old") return $hero.position();
3102 if (interface == "superold") return this.getOldMargoHeroPos();
3103 if (!Engine.map.size) return {x: 0, y: 0};
3104 var tilesX = $canvas.width()/32;
3105 var tilesY = $canvas.height()/32;
3106 var pos = {
3107 x: Engine.hero.rx,
3108 y: Engine.hero.ry
3109 };
3110 var actualPos = {};
3111 if (pos.x < tilesX/2) {
3112 actualPos.x = pos.x*32;
3113 } else if (Engine.map.size.x - pos.x < tilesX/2) {
3114 actualPos.x = (pos.x - (Engine.map.size.x - tilesX/2) + tilesX/2)*32;
3115 } else {
3116 actualPos.x = (tilesX/2)*32;
3117 };
3118 if (pos.y < tilesY/2) {
3119 actualPos.y = pos.y*32;
3120 } else if (Engine.map.size.y - pos.y < tilesY/2) {
3121 actualPos.y = (pos.y - (Engine.map.size.y - tilesY/2) + tilesY/2)*32;
3122 } else {
3123 actualPos.y = (tilesY/2)*32;
3124 };
3125 var canvasOffset = $canvas.offset();
3126 return {
3127 left: actualPos.x + canvasOffset.left,
3128 top: actualPos.y + canvasOffset.top
3129 };
3130 };
3131 this.update = function() {
3132 for (var i=0; i<this.arrows.length; i++) {
3133 this.drawArrow(this.arrows[i]);
3134 };
3135 };
3136 this.drawArrow = function(objective) {
3137 if (objective.type == "NPC") {
3138 var nameKey = "nick";
3139 var obj = interface == "new" ? this.npcs : g.npc;
3140 var item = false;
3141 } else if (objective.type == "ITEM") { //item
3142 var nameKey = "name";
3143 if (interface == "new") {
3144 var itemArr = Engine.items.fetchLocationItems("m");
3145 var obj = {};
3146 for (var i in itemArr) {
3147 var it = itemArr[i];
3148 if (it.id) obj[it.id] = it;
3149 else obj[it.hid] = it;
3150 };
3151 } else {
3152 var obj = g.item;
3153 };
3154 var item = true;
3155 } else if (objective.type == "COORDS") { //coords
3156 var coords = objective.coords;
3157 var size = [32, 32];
3158 var x = Math.abs(hero.rx-coords[0]);
3159 var y = Math.abs(hero.ry-coords[1]);
3160 var closest = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
3161 };
3162 if (objective.type != "COORDS") {
3163 var closest = Infinity;
3164 var coords = false;
3165 var size = false;
3166 for (var i in obj) {
3167 var entity = obj[i];
3168 if (entity[nameKey] == objective.name && (!item || entity.loc == "m")) {
3169 var x = Math.abs(hero.rx-entity.x);
3170 var y = Math.abs(hero.ry-entity.y);
3171 var dist = Math.sqrt(Math.pow(x,2) + Math.pow(y,2));
3172 if (dist < closest) {
3173 closest = dist;
3174 coords = [entity.x, entity.y];
3175 size = item ? [32,32] : [entity.fw, entity.fh];
3176 };
3177 };
3178 };
3179 };
3180 if (coords) {
3181 var cos = (coords[0] - hero.rx)/closest;
3182 var sin = (coords[1] - hero.ry)/closest;
3183 var heropos = this.getHeroPos();
3184 var top = 150*sin;
3185 var left = 150*cos;
3186 var opacity = 1;
3187 if (closest < 9) {
3188 top = top*Math.pow(closest/9, 1.8);
3189 left = left*Math.pow(closest/9, 1.8);
3190 opacity = Math.pow(closest/9, 2.1);
3191 };
3192 if (interface != "new") top+=20;
3193 left+= interface == "new" ? -12 : 4;
3194 if ((cos >= 0 && sin >= 0) || (cos >= 0 && sin <= 0)) {
3195 var angle = Math.asin(sin) * 180 / Math.PI;
3196 } else {
3197 var angle = 180+Math.asin(0-sin) * 180 / Math.PI;
3198 };
3199 objective.$.css({
3200 top: top + heropos.top,
3201 left: left + heropos.left,
3202 display: opacity > 0.09 ? "block" : "none",
3203 "-ms-transform": "rotate("+angle+"deg)",
3204 "-webkit-transform": "rotate("+angle+"deg)",
3205 transform: "rotate("+angle+"deg)",
3206 opacity: opacity
3207 });
3208 if (interface == "old") {
3209 objective.$highlight.css({
3210 left: coords[0]*32 - 11,
3211 top: coords[1]*32 + 14,
3212 display: "block",
3213 opacity: 1-opacity
3214 });
3215 };
3216 } else {
3217 objective.$.hide();
3218 if (interface == "old") objective.$highlight.hide();
3219 };
3220 };
3221 this.arrows = [];
3222 this.add = function(objective) {
3223 for (var i in this.arrows) {
3224 if (objective.type == this.arrows[i].type && objective.name == this.arrows[i].name) return;
3225 };
3226 objective.$ = this.arrowTemplate.clone().appendTo(interface == "old" ? "#centerbox" : (interface == "new" ? ".game-window-positioner" : "#oMap"));
3227 objective.$.attr(interface == "new" ? "data-tip" : "tip", objective.name);
3228 if (interface == "old") objective.$highlight = this.highlightTemplate.clone().appendTo(interface == "old" ? "#ground" : "#oMap");
3229 objective.index = this.arrows.push(objective) -1;
3230 objective.remove = function() {
3231 self.arrows.splice(this.index, 1);
3232 for (var i=this.index; i<self.arrows.length; i++) {
3233 self.arrows[i].index--;
3234 };
3235 this.$.remove();
3236 if (interface == "old") this.$highlight.remove();
3237 };
3238 this.update();
3239 };
3240 this.remove = function(objective) {
3241 for (var i=0; i<this.arrows.length; i++) {
3242 if (this.arrows[i].name == objective.name && this.arrows[i].type == objective.type) this.arrows[i].remove();
3243 };
3244 };
3245 this.reset = function() {
3246 while (this.arrows.length) {
3247 this.arrows[0].remove();
3248 };
3249 };
3250 this.arrowTemplate = $("<div>").css({
3251 background: "url(http://priweejt.ct8.pl/addons/img/qt-arrow-red.gif)",
3252 width: 24,
3253 height: 24,
3254 zIndex: 250,
3255 position: "absolute"
3256 });
3257 this.highlightTemplate = $("<div>").css({
3258 background: "url(/img/glow-blue.png)",
3259 position: "absolute",
3260 width: 52,
3261 height: 24,
3262 zIndex: 1
3263 });
3264 })();
3265
3266 this.installationCounter = new (function() {
3267 var self = this;
3268 var id = 87771;
3269
3270 this.count = function() {
3271 if (interface == "superold") return;
3272 if (!settings.get("/counted")) {
3273 //extManager.toggleLike(id, 'unlike')
3274 $.ajax({
3275 url: "/tools/addons.php?task=details&id="+id,
3276 type: "POST",
3277 data: {like: "unlike"}
3278 });
3279 settings.set("/counted", true);
3280 };
3281 };
3282 this.get = function(clb) {
3283 if (interface == "superold") return clb("<span tip='NiedostÄpne dla oldmargonem'>-</span>");
3284 $.ajax({
3285 url: "/tools/addons.php?task=details&id="+id,
3286 datatype: "json",
3287 success: function(r) {
3288 clb(-r.addon.points);
3289 }
3290 });
3291 };
3292 })();
3293
3294 //databases
3295 //porzuciĹem rÄczne edytowanie tego wiÄc w jednej linii jest bo tak wypluwa skrypt
3296 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]]}}};
3297 var eliteDB = {
3298 //elity do dziennego questa w margonem.com
3299 "Masked Blaise": {
3300 lvl: -1,
3301 ver: "en",
3302 //spawns: {196:[[8,5]]} w sumie to ich na caĹÄ
mapÄ Ĺaduje wiÄc bez sensu
3303 },
3304 "Cula Joshua": {
3305 lvl: -1,
3306 ver: "en",
3307 spawns: {}
3308 },
3309 "Mola Nito": {
3310 lvl: -1,
3311 ver: "en",
3312 spawns: {}
3313 },
3314 "Toto Acirfa": {
3315 lvl: -1,
3316 ver: "en",
3317 spawns: {}
3318 },
3319 "Masked Roman": {
3320 lvl: -1,
3321 ver: "en",
3322 spawns: {}
3323 },
3324 "Possessed Fissit": {
3325 lvl: -1,
3326 ver: "en",
3327 spawns: {}
3328 },
3329 "Soda": {
3330 lvl: -1,
3331 ver: "en",
3332 spawns: {}
3333 },
3334 "Molybdenum Matityahu": {
3335 lvl: -1,
3336 ver: "en",
3337 spawns: {}
3338 },
3339 "Hummopapa": {
3340 lvl: -1,
3341 ver: "en",
3342 spawns: {}
3343 },
3344 "Shponder":{
3345 lvl: -1,
3346 ver:"en",
3347 spawns:{}
3348 },
3349 "Mobile Jeecus":{
3350 lvl: -1,
3351 ver:"en",
3352 spawns:{}
3353 }
3354 };
3355
3356 this.getHerosDB = function() {
3357 return herosDB;
3358 };
3359
3360 var niceSettings = new (function(options) {
3361 var self = this;
3362 var {get, set, data, header, onSave} = options;
3363 var panels = {};
3364 var $currentPanel = false;
3365 var $activeLPanelEntry;
3366 var $rpanel;
3367 var $wrapper;
3368 var shown = false;
3369 this.toggle = function() {
3370 var lock = interface == "new" ? Engine.lock : (interface == "old" ? g.lock : null);
3371 if (shown) {
3372 if (lock) lock.remove("ns-"+header);
3373 else global.dontmove = false;
3374 $wrapper.style["display"] = "none";
3375 } else {
3376 if (lock) lock.add("ns-"+header);
3377 else global.dontmove = true;
3378 $wrapper.style["display"] = "block";
3379 };
3380 shown = !shown;
3381 };
3382 this.initHTML = function() {
3383 $wrapper = document.createElement("div");
3384 $wrapper.classList.add("ns-wrapper");
3385 document.body.appendChild($wrapper);
3386
3387 var $header = document.createElement("div");
3388 $header.innerHTML = header + " - ustawienia";
3389 $header.classList.add("ns-header");
3390 $wrapper.appendChild($header);
3391
3392 var $close = document.createElement("div");
3393 $close.innerHTML = "X";
3394 $close.classList.add("ns-close");
3395 $close.addEventListener("click", this.toggle);
3396 $wrapper.appendChild($close);
3397
3398 var $panels = document.createElement("div");
3399 $panels.classList.add("ns-panels");
3400 $wrapper.appendChild($panels);
3401
3402 var $lpanel = document.createElement("div");
3403 $lpanel.addEventListener("click", this.lPanelClick);
3404 $lpanel.classList.add("ns-lpanel");
3405 $panels.appendChild($lpanel);
3406
3407 $rpanel = document.createElement("div");
3408 $rpanel.classList.add("ns-rpanel");
3409 $rpanel.addEventListener("click", this.globalRpanelHandler);
3410 $panels.appendChild($rpanel);
3411
3412 $lpanel.innerHTML = this.generateLpanelHtml();
3413 this.genereteRpanels();
3414 };
3415 this.lPanelClick = function(e) {
3416 if (e.target.dataset["name"]) {
3417 self.togglePanel(e.target.dataset["name"]);
3418 if ($activeLPanelEntry) $activeLPanelEntry.classList.remove("active");
3419 $activeLPanelEntry = e.target;
3420 $activeLPanelEntry.classList.add("active");
3421 };
3422 };
3423 this.globalRpanelHandler = function(e) {
3424 var tar = e.target;
3425 if (tar.dataset["listbtt"]) {
3426 var key = tar.dataset["listbtt"];
3427 var $content = document.querySelector(".ns-list-content[data-list='"+key+"']");
3428 var $input = document.querySelector("input[data-list='"+key+"']");
3429 self.adddContentToList($content, $input);
3430 } else if (tar.dataset["listitem"]) {
3431 tar.remove();
3432 };
3433 };
3434 this.adddContentToList = function($content, $input) {
3435 var val = $input.value;
3436 if (val == "") return;
3437 $input.value = "";
3438 var items = this.getContentItems($content);
3439 if (items.indexOf(val) > -1) return
3440 var $div = document.createElement("div");
3441 $div.classList.add("ns-list-item");
3442 $div.dataset["listitem"] = "1";
3443 $div.innerText = val;
3444 $content.appendChild($div);
3445 };
3446 this.getContentItems = function($content) {
3447 var items = [];
3448 for (var i=0; i<$content.children.length; i++) {
3449 items.push($content.children[i].innerHTML);
3450 };
3451 return items;
3452 };
3453 this.togglePanel = function(name) {
3454 if ($currentPanel) $currentPanel.remove();
3455 $currentPanel = panels[name];
3456 $rpanel.appendChild($currentPanel);
3457 this.setAsyncPanelContent(name);
3458 };
3459 this.setAsyncPanelContent = function(name) {
3460 var entries = options.data[name];
3461 for (var i=0; i<entries.length; i++) {
3462 var entry = entries[i];
3463 if (entry.asyncid) {
3464 entry.fun(val => {
3465 var el = document.getElementById(entry.asyncid);
3466 if (el) el.innerHTML = val;
3467 });
3468 };
3469 };
3470 };
3471 this.genereteRpanels = function() {
3472 for (var name in data) {
3473 this.generateRpanel(name, data[name]);
3474 };
3475 };
3476 this.generateRpanel = function(name, content) {
3477 var $panel = document.createElement("div");
3478 panels[name] = $panel;
3479 var html = "";
3480 for (var i=0; i<content.length; i++) {
3481 html += this.generateRpanelEntryHtml(content[i]);
3482 };
3483 $panel.innerHTML = html;
3484 var $btt = document.createElement("div");
3485 $btt.innerHTML = "Zapisz";
3486 $btt.classList.add("ns-save-button");
3487 $btt.addEventListener("click", () => this.savePanel(name));
3488 $panel.appendChild($btt);
3489 };
3490 this.generateRpanelEntryHtml = function(entry) {
3491 var {type, special} = this.getEntryType(entry.type);
3492 if (!special) {
3493 var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+get(entry.key)+"'></input>";
3494 return this.getRpanelEntry(entry.name, input, entry.tip);
3495 } else {
3496 if (type == "range") {
3497 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>";
3498 return this.getRpanelEntry(entry.name, input, entry.tip);
3499 } else if (type == "checkbox") {
3500 var input = "<input data-key='"+entry.key+"' type='"+type+"' "+(get(entry.key) ? "checked" : "")+"></input>";
3501 return this.getRpanelEntry(entry.name, input, entry.tip);
3502 } else if (special == "char") {
3503 var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+String.fromCharCode(get(entry.key))+"' maxlength='1' style='width: 10px; text-align: center'></input>";
3504 return this.getRpanelEntry(entry.name, input, entry.tip);
3505 } else if (special == "noinput") {
3506 if (type != "async") {
3507 return this.getRpanelEntry(entry.t1, entry.t2, entry.tip);
3508 } else {
3509 var id = "NS-async-"+Math.random()*10;
3510 entry.asyncid = id;
3511 return this.getRpanelEntry(entry.t1, "<div id='"+id+"'>"+entry.placeholder+"</div>", entry.tip);
3512 };
3513 } else if (type == "list") {
3514 return this.generateListInput(entry);
3515 };
3516 };
3517 };
3518 this.generateListInput = function(entry) {
3519 var list = get(entry.key);
3520 var html;
3521 html = "<div class='ns-list-wrapper'>";
3522 html += "<div class='ns-list-header'>"+entry.name+"</div>";
3523 html += "<div class='ns-list-content' data-list='"+entry.key+"'>";
3524 for (var i=0; i<list.length; i++) {
3525 html += "<div class='ns-list-item' data-listitem='1'>"+list[i]+"</div>";
3526 };
3527 html += "</div>";
3528 html += "<div class='ns-list-bottombar'>";
3529 html += "<div class='ns-list-input'><input data-list='"+entry.key+"' type='text'></div>";
3530 html += "<div class='ns-list-addbtt' data-listbtt='"+entry.key+"'>+</div>";
3531 html += "</div>";
3532 html += "</div>";
3533 return html;
3534 };
3535 this.getRpanelEntry = function(txt, input, tip) {
3536 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>";
3537 };
3538 this.getEntryType = function(entrytype) {
3539 var special = false;
3540 switch (entrytype) {
3541 case "string":
3542 var type = "text";
3543 break;
3544 case "color":
3545 var type = "color";
3546 break;
3547 case "range":
3548 special = true;
3549 var type = "range";
3550 break;
3551 case "check":
3552 special = true;
3553 var type = "checkbox";
3554 break;
3555 case "char":
3556 special = "char";
3557 var type = "text";
3558 break;
3559 case "list":
3560 special = true;
3561 var type = "list";
3562 break;
3563 case "numstring":
3564 var type = "number";
3565 break;
3566 case "info-async":
3567 var type = "async";
3568 special = "noinput";
3569 break;
3570 default:
3571 special = "noinput";
3572 };
3573 return {
3574 type: type,
3575 special: special
3576 };
3577 }
3578 this.generateLpanelHtml = function() {
3579 var html = "";
3580 for (var name in data) {
3581 html += "<div class='ns-lpanel-entry' data-name='"+name+"'>"+name+"</div>";
3582 };
3583 return html;
3584 };
3585 this.savePanel = function(name) {
3586 var panel = data[name];
3587 for (var i=0; i<panel.length; i++) {
3588 this.savePanelEntry(panel[i]);
3589 };
3590 onSave();
3591 };
3592 this.savePanelEntry = function(entry) {
3593 var {type, special} = this.getEntryType(entry.type);
3594 if (!special) {
3595 var val = this.getEntryValue(entry.key);
3596 if (type == "number") {
3597 val = parseInt(val);
3598 if (isNaN(val)) return;
3599 };
3600 set(entry.key, val);
3601 } else {
3602 if (type == "range") {
3603 set(entry.key, this.getEntryValue(entry.key)/100);
3604 } else if (type == "checkbox") {
3605 set(entry.key, this.getCheckboxState(entry.key));
3606 } else if (special == "char") {
3607 var val = this.getEntryValue(entry.key).toUpperCase().charCodeAt(0);
3608 if (isNaN(val)) return;
3609 set(entry.key, val);
3610 } else if (type == "list") {
3611 var $content = document.querySelector(".ns-list-content[data-list='"+entry.key+"']");
3612 var items = this.getContentItems($content);
3613 set(entry.key, items);
3614 };
3615 };
3616 };
3617 this.getEntryValue = function(key) {
3618 return document.querySelector("input[data-key='"+key+"']").value;
3619 };
3620 this.getCheckboxState = function(key) {
3621 return document.querySelector("input[data-key='"+key+"']").checked;
3622 };
3623 this.initCss = function() {
3624 var css = `
3625 .ns-wrapper {
3626 width: 600px;
3627 height: 600px;
3628 background: rgba(0,0,0,.8);
3629 border: 2px solid #222222;
3630 border-radius: 20px;
3631 position: absolute;
3632 left: calc(50% - 300px);
3633 top: calc(50% - 300px);
3634 z-index: 500;
3635 color: white;
3636 display: none;
3637 ${interface == "superold" ? "transform: scale(0.8, 0.8);" : ""}
3638 }
3639 .ns-wrapper .ns-close {
3640 width: 30px;
3641 height: 30px;
3642 font-size: 20px;
3643 line-height: 30px;
3644 text-align: center;
3645 background: rgba(0,0,0,.6);
3646 transition: background .1s ease-in-out;
3647 position: absolute;
3648 right: 3px;
3649 top: 3px;
3650 cursor: pointer;
3651 }
3652 .ns-wrapper .ns-close:hover {
3653 background: rgba(0,0,0,.9);
3654 }
3655 .ns-wrapper .ns-header {
3656 border-bottom: 1px solid #333333;
3657 font-size: 26px;
3658 padding-left: 15px;
3659 color: white;
3660 height: 39px;
3661 line-height: 40px;
3662 background: rgba(50,50,50,.8);
3663 }
3664 .ns-wrapper .ns-panels {
3665 height: 560px;
3666 }
3667 .ns-wrapper .ns-panels .ns-lpanel {
3668 height: 560px;
3669 width: 200px;
3670 border-right: 1px solid #333333;
3671 float: left;
3672 }
3673 .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry {
3674 width: 75%;
3675 height: 30px;
3676 line-height: 30px;
3677 font-size: 19px;
3678 padding-left: 5px;
3679 background: linear-gradient(to right, rgba(100,100,100,0.45) , rgba(100,100,100,0));
3680 transition: all .15s ease-in-out;
3681 cursor: pointer;
3682 margin-bottom: 1px;
3683 }
3684 .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry.active {
3685 background: linear-gradient(to right, rgba(150,150,150,0.45) , rgba(150,150,150,0));
3686 width: 100%;
3687 padding-left: 13px;
3688 }
3689 .ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry:hover {
3690 width: 100%;
3691 padding-left: 13px;
3692 }
3693 .ns-wrapper .ns-panels .ns-rpanel {
3694 height: 560px;
3695 width: 390px;
3696 float: left;
3697 }
3698 .ns-wrapper .ns-panels .ns-rpanel .ns-rpanel-entry {
3699 height: 30px;
3700 margin: 3px;
3701 line-height: 30px;
3702 background: rgba(50,50,50,0.5);
3703 }
3704 .ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-left {
3705 float: left;
3706 height: 30px;
3707 width: 180px;
3708 padding-left: 6px;
3709 }
3710 .ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right {
3711 float: right;
3712 height: 30px;
3713 width: 180px;
3714 text-align: right;
3715 padding-right: 6px;
3716 }
3717 .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color'] {
3718 background: black;
3719 border: none;
3720 transition: background .15s ease-in-out;
3721 }
3722 .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color']:hover {
3723 background: #282828;
3724 }
3725 .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='text'], .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='number'] {
3726 background: rgba(0,0,0,0.8);
3727 border: 1px solid black;
3728 width: 80px;
3729 color: #CCCCCC;
3730 text-align: right;
3731 }
3732 .ns-rpanel .ns-save-button {
3733 position: absolute;
3734 bottom: 10px;
3735 right: 10px;
3736 height: 30px;
3737 width: 70px;
3738 font-size: 20px;
3739 line-height: 30px;
3740 text-align: center;
3741 border: 1px solid #333333;
3742 background: rgba(50,50,50,0.5);
3743 cursor: pointer;
3744 transition: background .1s ease-in-out;
3745 }
3746 .ns-rpanel .ns-save-button:hover {
3747 background: rgba(50,50,50,0.7);
3748 }
3749 .ns-list-wrapper {
3750 background: rgba(50,50,50,0.5);
3751 width: 350px;
3752 margin: 10px;
3753 border: 1px solid #333333;
3754 }
3755 .ns-list-wrapper .ns-list-header {
3756 text-align: center;
3757 height: 20px;
3758 font-size: 15px;
3759 line-height: 20px;
3760 }
3761 .ns-list-wrapper .ns-list-content {
3762 min-height: 80px;
3763 max-height: 1700px;
3764 overflow-y: auto;
3765 border-top: 1px solid #333333;
3766 border-bottom: 1px solid #333333;
3767 }
3768 .ns-list-wrapper .ns-list-content .ns-list-item {
3769 cursor: pointer;
3770 margin: 1px;
3771 background: rgba(50,50,50,0.4);
3772 text-align: center;
3773 height: 15px;
3774 line-height: 15px;
3775 font-size: 12px;
3776 }
3777 .ns-list-wrapper .ns-list-bottombar {
3778 height: 20px;
3779 }
3780 .ns-list-wrapper .ns-list-bottombar .ns-list-input {
3781 float: left;
3782 width: 270px;
3783 }
3784 .ns-list-wrapper .ns-list-bottombar .ns-list-input input {
3785 background: rgba(0,0,0,0.8);
3786 border: 1px solid black;
3787 color: #CCCCCC;
3788 width: 320px;
3789 }
3790 .ns-list-wrapper .ns-list-bottombar .ns-list-addbtt {
3791 width: 20px;
3792 float: right;
3793 text-align: center;
3794 line-height: 20px;
3795 background: rgba(50,50,50,0.6);
3796 cursor: pointer;
3797 }
3798 .ns-list-wrapper .ns-list-bottombar .ns-list-addbtt:hover {
3799 background: rgba(50,50,50,0.9);
3800 }
3801 `;
3802 var $style = document.createElement("style");
3803 $style.innerHTML = css;
3804 document.head.appendChild($style);
3805 };
3806 this.init = function() {
3807 this.initHTML();
3808 this.initCss();
3809 };
3810})({
3811 get: settings.get,
3812 set: settings.set,
3813 onSave: this.onSettingsUpdate,
3814 header: "miniMapPlus",
3815 data: {
3816 "Kolory": [
3817 {
3818 key: "/colors/hero",
3819 name: "Twoja postaÄ",
3820 type: "color"
3821 },
3822 {
3823 key: "/colors/other",
3824 name: "Inni gracze",
3825 type: "color"
3826 },
3827 {
3828 key: "/colors/friend",
3829 name: "Znajomi",
3830 type: "color"
3831 },
3832 {
3833 key: "/colors/enemy",
3834 name: "Wrogowie",
3835 type: "color"
3836 },
3837 {
3838 key: "/colors/clan",
3839 name: "Klanowicze",
3840 type: "color"
3841 },
3842 {
3843 key: "/colors/ally",
3844 name: "Sojusznicy",
3845 type: "color"
3846 },
3847 {
3848 key: "/colors/npc",
3849 name: "ZwykĹy NPC",
3850 type: "color"
3851 },
3852 {
3853 key: "/colors/mob",
3854 name: "ZwykĹy mob",
3855 type: "color"
3856 },
3857 {
3858 key: "/colors/elite",
3859 name: "Elita",
3860 type: "color"
3861 },
3862 {
3863 key: "/colors/elite2",
3864 name: "Elita II/eventowa",
3865 type: "color"
3866 },
3867 {
3868 key: "/colors/elite3",
3869 name: "Elita III",
3870 type: "color"
3871 },
3872 {
3873 key: "/colors/heros",
3874 name: "Heros",
3875 type: "color"
3876 },
3877 {
3878 key: "/colors/titan",
3879 name: "Tytan",
3880 type: "color"
3881 },
3882 {
3883 key: "/colors/item",
3884 name: "Przedmiot",
3885 type: "color"
3886 },
3887 {
3888 key: "/colors/gw",
3889 name: "PrzejĹcie",
3890 type: "color"
3891 }
3892 ],
3893 "WyglÄ
d mapy": [
3894 {
3895 key: "/mapsize",
3896 name: "Rozmiar mapy",
3897 type: "range",
3898 tip: "Zmiany widoczne po odĹwieĹźeniu gry",
3899 data: [0.6, 1.4]
3900 },
3901 {
3902 key: "/opacity",
3903 name: "WidocznoĹÄ mapy",
3904 type: "range",
3905 data: [0.5, 1]
3906 },
3907 {
3908 key: "/darkmode",
3909 name: "Motyw ciemny",
3910 type: "check"
3911 }
3912 ],
3913 "Tracking": [
3914 {
3915 type: "info",
3916 t1: "Co to jest?",
3917 t2: "",
3918 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."
3919 },
3920 {
3921 key: "/trackedNpcs",
3922 name: "Tracking NPC",
3923 type: "list"
3924 },
3925 {
3926 key: "/trackedItems",
3927 name: "Tracking itemĂłw",
3928 type: "list"
3929 }
3930
3931 ],
3932 "Inne": [
3933 {
3934 key: "/minlvl",
3935 name: "Min. lvl potworkĂłw",
3936 type: "numstring"
3937 },
3938 {
3939 key: "/maxlvl",
3940 name: "Max. przewaga",
3941 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.",
3942 type: "numstring"
3943 },
3944 {
3945 key: "/show",
3946 name: "Hotkey",
3947 type: "char"
3948 },
3949 {
3950 key: "/altmobilebtt",
3951 name: "PrzesuĹ przycisk mobilny",
3952 type: "check",
3953 tip: "Przesuwa przycisk widoczny na urzÄ
dzeniach mobilnych pomiÄdzy torby"
3954 },
3955 {
3956 key: "/interpolerate",
3957 name: "Animacje na mapie",
3958 type: "check"
3959 },
3960 {
3961 key: "/showqm",
3962 name: "Zaznaczaj questy",
3963 type: "check"
3964 },
3965 {
3966 key: "/novisibility",
3967 name: "Nie pokazuj \"mgĹy wojny\"",
3968 type: "check",
3969 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."
3970 }
3971 /*,
3972 {
3973 key: "/showevonetwork",
3974 name: "Pokazuj postacie z WSync",
3975 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.",
3976 type: "check"
3977 }*/
3978 ],
3979 "Informacje": [
3980 {
3981 type: "info",
3982 t1: "Wersja",
3983 t2: "v"+this.version+(interface == "new" ? " NI" : (interface == "old" ? " SI" : " OM"))
3984 },
3985 {
3986 type: "info",
3987 t1: "ĹšrĂłdĹo instalacji",
3988 t2: this.getInstallSource()
3989 },
3990 {
3991 type: "info-async",
3992 t1: "Licznik instalacji",
3993 placeholder: "wczytywanie...",
3994 tip: "Liczy od wersji 3.1 minimapy",
3995 fun: this.installationCounter.get
3996 }
3997 ]
3998 }
3999});
4000 this.init();
4001 niceSettings.init();
4002})();
4003log("UĹźywasz dodatku Super Sprzedawaca ver 1 by Godfryd 0");
4004
4005var sss = window.localStorage.getItem("SuperSprzedawca");
4006if (sss != null)
4007 opt_ss = parseInt(sss);
4008else
4009 opt_ss = 8191;
4010
4011function cfgupdatess() {
4012 for (var a = 1; a <= 13; a++) {
4013 $("#optss" + a).css("backgroundPosition", (opt_ss2 & (1 << (a - 1))) ? "0 -22px" : "0 0")
4014 }
4015 }
4016
4017function optclickss(a) {
4018 x = $(a.target).attr("opt");
4019 opt_ss2 ^= 1 << (x - 1);
4020 cfgupdatess();
4021}
4022
4023function configss_show() {
4024 opt_ss2 = opt_ss;
4025 cfgupdatess();
4026 $("#configss").absCenter().fadeIn();
4027}
4028
4029function configss_cancel() {
4030 $("#configss").fadeOut();
4031}
4032
4033function configss_save() {
4034 opt_ss = opt_ss2;
4035 try {
4036 window.localStorage.setItem("SuperSprzedawca", opt_ss);
4037 } catch (e) {
4038 if (e.name == "NS_ERROR_FILE_CORRUPTED")
4039 alert("WyglÄ
da na to, Ĺźe twoja przeglÄ
darka ma zepsuty localstorage. Przeinstaluj Firefoxa, albo zainstaluj nowsza wersjÄ byÄ moĹźe to rozwiÄ
Ĺźe problem.");
4040 }
4041 $("#configss").fadeOut();
4042}
4043
4044var oofff = 'style="background: url(img/checkbox.png) no-repeat scroll left top; background-position: 0px 0px; cursor: pointer; font: 12px Georgia, serif; height: 18px; margin-bottom: 2px; padding: 4px 30px 0;">';
4045
4046$("body").append('<div id="configss">');
4047$("#configss").css({
4048 "display" : "block",
4049 "width" : "400px",
4050 "height" : "400px",
4051 "position" : "absolute",
4052 "background" : "#040 url(img/conf-back.png) no-repeat bottom center",
4053 "display" : "none",
4054 "left" : "640px",
4055 "top" : "200px",
4056 "z-index" : "600"
4057});
4058
4059$('#configss').append('<div class="conf-title"></div>');
4060$('#configss').append('<div id="optionss_help">Zaznacz jakie rodzaje towarĂłw majÄ
byÄ NIE sprzedawane!</div>');
4061$('#optionss_help').css({
4062 "margin" : "5px 15px 5px"
4063});
4064$('#configss').append('<div id="cfg_optionsss"></div>');
4065
4066$('#cfg_optionsss').css({
4067 "margin" : "5px 15px 5px"
4068});
4069
4070$('#cfg_optionsss').append('<div opt="1" id="optss1" ' + oofff + ' Mikstury</div>');
4071$('#cfg_optionsss').append('<div opt="2" id="optss2" ' + oofff + ' Questowe</div>');
4072$('#cfg_optionsss').append('<div opt="3" id="optss3" ' + oofff + ' Konsumpcyjne</div>');
4073$('#cfg_optionsss').append('<div opt="4" id="optss4" ' + oofff + ' Klucze</div>');
4074$('#cfg_optionsss').append('<div opt="5" id="optss5" ' + oofff + ' Torby</div>');
4075$('#cfg_optionsss').append('<div opt="6" id="optss6" ' + oofff + ' ZĹoto</div>');
4076$('#cfg_optionsss').append('<div opt="7" id="optss7" ' + oofff + ' Ulepszenia</div>');
4077$('#cfg_optionsss').append('<div opt="8" id="optss8" ' + oofff + ' ZwiÄ
zany z wĹaĹcicielem</div>');
4078$('#cfg_optionsss').append('<div opt="9" id="optss9" ' + oofff + ' legendarny</div>');
4079$('#cfg_optionsss').append('<div opt="10" id="optss10" ' + oofff + ' heroiczny</div>');
4080$('#cfg_optionsss').append('<div opt="11" id="optss11" ' + oofff + ' unikat</div>');
4081$('#cfg_optionsss').append('<div opt="12" id="optss12" ' + oofff + ' ulepszony</div>');
4082$('#cfg_optionsss').append('<div opt="13" id="optss13" ' + oofff + ' StrzaĹy</div>');
4083
4084$('#configss').append('<center><button onclick="configss_save()" rollover="20" class="save" id="btn1" style="background: url(img/bw_save.png) repeat scroll 0 0; background-position: 0% 0%; border: medium none; height: 20px; margin 10px; width: 68px;"></button><button onclick="configss_cancel()" rollover="20" class="cancel" id="btn2" style="background: url(img/bw_cancel.png) repeat scroll 0 0; height: 20px; width: 68px; border: medium none; margin: 0px;"></button></center>');
4085
4086$("#cfg_optionsss DIV").click(optclickss);
4087
4088var shop_close_f = shop_close;
4089shop_close = function () {
4090 shop_close_f();
4091 $("#wybtorbe").text("Wybierz torbÄ do sprzedaĹźy:");
4092 $("#torba1").text("1");
4093 $("#torba2").text("2");
4094 $("#torba3").text("3");
4095}
4096
4097var shop_accept_f = shop_accept;
4098shop_accept = function () {
4099 shop_accept_f();
4100 $("#wybtorbe").text("Wybierz torbÄ do sprzedaĹźy:");
4101 $("#torba1").text("1");
4102 $("#torba2").text("2");
4103 $("#torba3").text("3");
4104}
4105
4106function sprzedaj(i) {
4107 var granice = [
4108 [-1, 166],
4109 [197, 364],
4110 [395, 562]];
4111 var nosell = [
4112 ["Mikstury"],
4113 ["Questowe"],
4114 ["Konsumpcyjne"],
4115 ["Klucze"],
4116 ["Torby"],
4117 ["ZĹoto"],
4118 ["Ulepszenia"],
4119 ["wiÄ
zany z wĹaĹcicielem"],
4120 ["legendarny"],
4121 ["heroiczny"],
4122 ["unikat"],
4123 ["ulepszony"],
4124 ["StrzaĹy"]]
4125 var ss;
4126
4127 var nosellakt = new Array()
4128 for (d in nosell)
4129 if (opt_ss & (1 << (d)))
4130 nosellakt.push(nosell[d]);
4131 for (k in g.item) {
4132 ss = true;
4133 for (d in nosellakt)
4134 if (g.item[k].tip.search(nosellakt[d]) > -1) {
4135 ss = false;
4136 break;
4137 }
4138 if (ss) {
4139 if ($("#item" + k).parent().attr('id') == "bag") {
4140 topp = parseInt($("#item" + k).css("top").slice(0, -2));
4141 if ((topp > granice[i][0]) && (topp < granice[i][1]))
4142 ($("#item" + k).click());
4143 }
4144 }
4145 }
4146}
4147
4148$('<div id="wybtorbe" tip="Prawym klawiszem wĹÄ
czasz okno konfiguracji"> Wybierz torbÄ do sprzedaĹźy: </div>').css({
4149 position : "absolute",
4150 left : 290,
4151 top : 120,
4152 color : "gold",
4153 width : 70,
4154 "font-size" : "11px"
4155}).appendTo('#shop');
4156
4157$("#wybtorbe").rightClick(configss_show);
4158
4159var SSstyl = {
4160 position : "absolute",
4161 left : 370,
4162 top : 120,
4163 border : "2px grey solid",
4164 color : "white",
4165 width : 20,
4166 "background-color" : "black",
4167 "font-size" : "20px",
4168 "text-align" : "center"
4169};
4170
4171$('<div id="torba1"> 1 </div>').css(SSstyl).click(function () {
4172 sprzedaj(0)
4173}).appendTo('#shop');
4174
4175SSstyl.left = 400,
4176$('<div id="torba2"> 2 </div>').css(SSstyl).click(function () {
4177 sprzedaj(1)
4178}).appendTo('#shop');
4179
4180SSstyl.left = 430,
4181$('<div id="torba3"> 3 </div>').css(SSstyl).click(function () {
4182 sprzedaj(2)
4183}).appendTo('#shop');
4184var d = new Date(); d.setTime(d.getTime() + 3600000 * 24 * 30);
4185if(getCookie('acceptGrp') == null) setCookie('acceptGrp','false',d);
4186
4187var acceptGrp = mAlert;
4188mAlert = function(a,c,d,b){
4189 acceptGrp(a,c,d,b);
4190 if(getCookie('acceptGrp') == 'true' && a.indexOf('Czy chcesz doĹÄ
czyÄ do druĹźyny gracza') != -1) $('#a_ok').click();
4191};
4192
4193g.loadQueue.push({fun: function () {
4194$('<div id="checkboxgrp">Automatyczne przyjmowanie zaproszeĹ do grupy</div>').appendTo('#cfg_options').click(function(){
4195if($('#checkboxgrp').attr('style') == 'background-position: 0px -22px'){
4196$('#checkboxgrp').attr('style', 'background-position: 0px 0px');
4197setCookie('acceptGrp','false',d)
4198}else{
4199$('#checkboxgrp').attr('style', 'background-position: 0px -22px');
4200setCookie('acceptGrp','true',d)
4201}
4202});
4203if(getCookie('acceptGrp') == 'true') $('#checkboxgrp').attr('style', 'background-position: 0px -22px');
4204else $('#checkboxgrp').attr('style', 'background-position: 0px 0px');
4205}, data: ''});
4206
4207$(document).keyup(function(e){
4208 if(e.which==75 && e.target.tagName!="TEXTAREA" && e.target.tagName!='INPUT'){
4209 for(n in g.other){
4210 if ((Math.abs(hero.x - g.other[n].x) <= 1 && Math.abs(hero.y - g.other[n].y) <= 1) && !isset(g.party[n])){
4211 _g("party&a=inv&id="+n)
4212 }
4213 }
4214 }
4215});
4216(()=>{const t=t=>new Promise(a=>setTimeout(a,t)),a=async()=>{"block"===document.getElementById("battle").style.display&&(await window._g("fight&a=f"),await t(2500),"block"!==document.getElementById("battle").style.display||window.g.dead||await window._g("fight&a=quit"),await t(500)),await t(100),a()};a()})();