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