Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function on(){
- $('#tutorial').hide();
- MBob = {};
- MBob.bestxy = 9999;
- MBob.run = 1;
- MBob.id = 0;
- MBob.blok = "";
- MBob.xxxx = 0;
- MBob.blokuj = 1;
- MBob.checker = 0;
- MBob.checker2 = 0;
- MBob.interv1 = "";
- MBob.interv2 = "";
- MBob.interv3 = "";
- mAlert = function(a, c, d, b) {};
- g.lock.add = function(i) {};
- $('<div id="MBob_config">').css({
- position: "absolute",
- left: -208,
- top: -7,
- width: 199,
- height: 549,
- border: "1px gold solid",
- color: "white",
- "background-color": "black",
- "font-size": "13px",
- }).appendTo("#centerbox2");
- MBob_config.innerHTML = '<center><input id="MBob_nazpotwor" placeholder="Nazwy potworów">';
- MBob_config.innerHTML = MBob_config.innerHTML + '<br/><br/><center><input id="MBob_healerhp" placeholder="%HP<Healer" type="number">';
- MBob_config.innerHTML = MBob_config.innerHTML + '<br/><br/><center><button onclick="MBob.start1()">Start</button>';
- MBob_config.innerHTML = MBob_config.innerHTML + '<br/><center><button onclick="MBob.stop1()">Stop</button>';
- MBob.heal = function() {
- for (var i in g.item) {
- if (g.item[i].cl == 16 && hero.hp <= hero.maxhp * Number(MBob_healerhp.value) / 100 && MBob_healerhp.value != "") {
- $("#item" + i).dblclick();
- }
- }
- };
- MBob.rel = function() {
- var sukces = false;
- for (var i in g.item) {
- itemek = $("#item" + i);
- if (g.item[i].cl == 21 && itemek.css("top") == "183px" && itemek.css("left") == "92px") {
- var stat = g.item[i].stat;
- var name = g.item[i].name;
- var id = g.item[i].id;
- sukces = true;
- break;
- }
- }
- if (sukces) {
- var nrilosc = stat.indexOf("ammo");
- var ilosc = 51;
- if (nrilosc != -1) {
- ilosc = stat.slice(nrilosc + 5, nrilosc + 9);
- ilosc = parseInt(ilosc);
- }
- if (ilosc < 50) {
- for (var i in g.item) {
- if (name == g.item[i].name && id != g.item[i].id) {
- _g("moveitem&st=1&id=" + g.item[i].id);
- break;
- }
- }
- }
- }
- };
- hero.MBobgo = function(y, w) {
- var x = [],
- t = (hero.opt & 128) ? 8 : 20;
- var l = Math.max(0, Math.min(y, this.x) - t),
- h = Math.min(map.x - 1, Math.max(y, this.x) + t);
- var v = Math.max(0, Math.min(w, this.y) - t),
- u = Math.min(map.y - 1, Math.max(w, this.y) + t);
- for (var q = l - 1; q <= h + 1; q++) {
- x[q] = [];
- for (var p = v - 1; p <= u + 1; p++) {
- x[q][p] = (q >= l && q <= h && p >= v && p <= u && !isset(g.npccol[q + p * 256]) && (!map.col || map.col.charAt(q + p * map.x) == "0")) ? -1 : -2
- }
- }
- x[this.x][this.y] = 0;
- b = -1;
- road = [];
- var s = {
- x: -1,
- y: -1,
- dist: 599
- };
- for (var r = 1; r < h - l + u - v + 3; r++) {
- for (var q = l; q <= h; q++) {
- for (var p = v; p <= u; p++) {
- if (x[q][p] == -1 && ((x[q][p - 1] == r - 1) || (x[q][p + 1] == r - 1) || (x[q - 1][p] == r - 1) || (x[q + 1][p] == r - 1))) {
- x[q][p] = r
- }
- if (x[y][w] > 0) {
- q = h + 1;
- break
- }
- s.dist2 = Math.abs(y - q) + Math.abs(w - p);
- if ((x[q][p] == r) && (s.dist2 < s.dist)) {
- s.x = q;
- s.y = p;
- s.dist = s.dist2
- }
- }
- }
- }
- s.hdist = Math.abs(y - hero.x) + Math.abs(w - hero.y);
- if (x[y][w] > 0 || s.dist < s.hdist) {
- if (x[y][w] < 0) {
- if (y > s.x) {
- b = 2
- } else {
- if (y < s.x) {
- b = 1
- } else {
- if (w > s.y) {
- b = 0
- } else {
- if (w < s.y) {
- b = 3
- }
- }
- }
- }
- y = s.x;
- w = s.y;
- }
- road[0] = {
- x: y,
- y: w
- };
- for (var o = x[y][w] - 1, n = y, m = w; o > 0; o--) {
- if (x[n][m - 1] == o) {
- m--
- } else {
- if (x[n][m + 1] == o) {
- m++
- } else {
- if (x[n - 1][m] == o) {
- n--
- } else {
- if (x[n + 1][m] == o) {
- n++
- } else {
- o = 0
- }
- }
- }
- }
- if (o) {
- road[x[y][w] - o] = {
- x: n,
- y: m
- }
- }
- }
- }
- if (road.length > 1 && g.playerCatcher.follow == null) {
- $("#target").stop().css({
- left: y * 32,
- top: w * 32,
- display: "block",
- opacity: 1
- }).fadeOut(1000)
- }
- };
- var tmpBattleMsg = battleMsg;
- battleMsg = function(c, t) {
- MBob.run = 0;
- var ret = tmpBattleMsg(c, t);
- if (c.search(/winner=/) >= 0) {
- _g("fight&a=quit");
- $('#loots_button').click();
- MBob.drop();
- MBob.rel();
- MBob.heal();
- MBob.run = 0;
- }
- return ret;
- };
- MBob.func1 = function() {
- if (MBob.run == 0) {
- hero.nextx = '';
- hero.nexty = '';
- MBob.bestxy = 9999;
- for (var i in g.npc) {
- if (MBob_nazpotwor.value.search(g.npc[i].nick) != -1 && MBob.blok.search(i) == -1 && (g.npc[i].type == 2 || g.npc[i].type == 3)) {
- x1 = Math.pow(Math.abs(hero.x - g.npc[i].x), 2);
- y1 = Math.pow(Math.abs(hero.y - g.npc[i].y), 2);
- MBob.bestxy1 = Math.sqrt(x1) + Math.sqrt(y1);
- if (MBob.bestxy1 < MBob.bestxy) {
- MBob.bestxy = MBob.bestxy1;
- hero.nextx = g.npc[i].x;
- hero.nexty = g.npc[i].y;
- MBob.id = i;
- MBob.run = 1;
- MBob.blokuj = 0;
- };
- };
- };
- if (hero.nextx != '' && hero.nexty != '') {
- g.stop = false;
- hero.MBobgo(hero.nextx, hero.nexty);
- }
- }
- };
- MBob.func2 = function() {
- if (road.length == 0 && MBob.blokuj == 0) {
- if ((Math.abs(hero.rx - g.npc[MBob.id].x) <= 1 && Math.abs(hero.ry - g.npc[MBob.id].y) <= 1) && (g.npc[MBob.id].type == 2 || g.npc[MBob.id].type == 3)) {
- MBob.blokuj = 1;
- _g("fight&a=attack&ff=1&id=-" + MBob.id);
- } else {
- if (MBob.checker2 == 2){
- MBob.blokuj = 1;
- MBob.blok = MBob.blok + "|" + MBob.id;
- MBob.run = 0;
- MBob.checker2 = 0;
- } else if(MBob.checker2 != 2){
- MBob.checker2++;
- }
- }
- }
- };
- MBob.func3 = function() {
- if (road.length == 0) {
- if (MBob.checker < 60) {
- MBob.checker++;
- } else if (MBob.checker >= 60) {
- MBob.run = 0;
- MBob.checker = 0;
- }
- } else {
- MBob.checker = 0;
- }
- };
- MBob.start1 = function() {
- MBob.interv1 = setInterval(MBob.func1, 400);
- MBob.interv2 = setInterval(MBob.func2, 300);
- MBob.interv3 = setInterval(MBob.func3, 50);
- };
- MBob.stop1 = function() {
- MBob.interv1 = setInterval(MBob.func1, 400);
- MBob.interv2 = setInterval(MBob.func2, 300);
- MBob.interv3 = setInterval(MBob.func3, 50);
- };
- setInterval(function() {
- MBob.blok = "";
- }, 30000)
- setInterval(function() {
- location.reload();
- }, 60000)
- document.getElementById("MBob_nazpotwor").value = "Południowy niedźwiedź szary";
- MBob.start1();
- }
- window.onload = function(){
- on();
- }
- (function (e) {
- e.cookie = function (t, n, r) {
- if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(n)) || n === null || n === undefined)) {
- r = e.extend({}, r);
- if (n === null || n === undefined) {
- r.expires = -1
- }
- if (typeof r.expires === "number") {
- var i = r.expires,
- s = r.expires = new Date;
- s.setDate(s.getDate() + i)
- }
- n = String(n);
- 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("")
- }
- r = n || {};
- var o = r.raw ? function (e) {
- return e
- } : decodeURIComponent;
- var u = document.cookie.split("; ");
- for (var a = 0, f; f = u[a] && u[a].split("="); a++) {
- if (o(f[0]) === t) return o(f[1] || "")
- }
- return null
- }
- })(jQuery);
- /*
- Ostatnie zmiany: 01-03-2017, dodanie nowych itemów leczą?cych, pozdrawiam ;)
- */
- g.loadQueue.push({
- fun: function () {
- new(function () {
- this.niceForHealing = [
- "Duża pomarańczowa mikstura",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- ""
- ];
- this.getCookie = function (name) {
- return $.cookie(name);
- }
- this.setCookie = function (name, value) {
- $.cookie(name, value, {
- expires: 365
- });
- }
- this.isNiceForHealing = function (name) {
- for (var i in this.niceForHealing)
- if (this.niceForHealing[i] == name) return true;
- return false;
- }
- this.isStatOk = function(item) {
- var stats = item.stat.split(";");
- for(var i in stats) {
- var stat = stats[i].split("=");
- if(stat[0] == "lvl") {
- if(stat[1] > hero.lvl)
- return false;
- else
- return true;
- } else if(stat[0] == "timelimit") {
- var times = stat[1].split(",");
- if(times.length == 2) {
- var nextTime = parseInt(times[1]) * 1000;
- return nextTime - new Date().getTime() < 0;
- }
- }
- }
- return true;
- }
- this.hp = hero.hp;
- this.items = new Array();
- this.sortItems = function() {
- var t = this;
- t.items = new Array();
- for(var i in g.item){
- var item = g.item[i];
- if(item.cl != 16 || item.loc != 'g' || item.stat.indexOf('leczy=') == -1 || !t.isNiceForHealing(item.name) || !t.isStatOk(item))
- continue;
- t.items[t.items.length] = i;
- }
- t.items.sort();
- }
- this.tryToHeal = function () {
- var t = this;
- if (hero.hp == hero.maxhp) return false;
- t.sortItems();
- for( var i in t.items) {
- var item = g.item[t.items[i]];
- var healHp = parseInt(item.stat.substr(item.stat.indexOf('leczy') + 6));
- if (healHp <= 0) return false;
- if (hero.maxhp - hero.hp >= healHp) {
- _g("moveitem&st=1&id=" + item.id);
- t.hp += healHp;
- setTimeout(function () {
- if (t.hp != hero.maxhp) t.tryToHeal();
- }, 700);
- return false;
- }
- }
- }
- this.createPanel = function () {
- var t = this;
- $('<div></div>')
- .insertBefore('#centerbox')
- .attr('id', 'auto-leczenie')
- .attr('tip', "Kliknij dwukrotnie, aby zobaczyą? listą? obsł?ugiwanych przedmiotów")
- .css('padding', '5px')
- .css('position', 'absolute')
- .css('top', parseInt(t.getCookie('auto-leczenie-y')))
- .css('left', parseInt(t.getCookie('auto-leczenie-x')))
- .css('z-index', 500)
- .css('background', "url(http://www.margonem.pl/img/menuback.png)")
- .css('border', '1px solid gold')
- .css('fontSize', 12)
- .css('fontFamily', 'Arial')
- .css('cursor', 'move')
- .css('width', 50)
- .css('textAlign', 'center')
- .html(
- '<span>Auto Leczenie</span>' +
- '<input type="checkbox"/>'
- )
- .draggable({
- containment: 'window',
- start: function (event, ui) {
- g.lock.add('auto-leczenie');
- },
- stop: function (event, ui) {
- t.setCookie('auto-leczenie-x', ui.position.left);
- t.setCookie('auto-leczenie-y', ui.position.top);
- g.lock.remove('auto-leczenie');
- }
- })
- .dblclick(function () {
- var c = t.niceForHealing.length;
- var firstLetter = '';
- var com = '<h2>List obsł?ugiwanych przedmiotów:</h2><br/>';
- 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!';
- com += '<div style="height:300px; overflow-y:auto; margin-top:10px; border: 1px solid #550; background-color:#fff; padding:10px;">';
- for (var i = 0; i < c; i++) {
- var m = t.niceForHealing[i];
- var f = m.substring(0, 1);
- if (firstLetter != f) {
- firstLetter = f;
- if(i != 0) com += '<br/>';
- com += '<b>' + f + '</b><br/>';
- }
- com += m + '<br/>';
- }
- com += '</div>';
- mAlert(com);
- });
- if (t.getCookie('auto-leczenie') == 'on')
- $('#auto-leczenie > input').attr('checked', 'checked');
- $('#auto-leczenie > input').click(function () {
- if ($(this).is(':checked')) {
- t.setCookie('auto-leczenie', 'on');
- } else {
- t.setCookie('auto-leczenie', 'off');
- }
- });
- }
- this.run = function () {
- if (!this.getCookie('auto-leczenie')) {
- this.setCookie('auto-leczenie', 'on');
- this.setCookie('auto-leczenie-x', 0);
- this.setCookie('auto-leczenie-y', 0);
- }
- this.createPanel();
- var th = this;
- var oldBattleMsg = battleMsg;
- battleMsg = function (c, t) {
- var ret = oldBattleMsg(c, t);
- if (c.indexOf("winner=") >= 0 && hero.hp < hero.maxhp && th.getCookie('auto-leczenie') == 'on' && !g.dead) {
- th.tryToHeal();
- }
- return ret;
- }
- }
- })().run();
- },
- data: ""
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement