Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Cookie plugin - https://github.com/carhartl/jquery-cookie */
- (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 itemow leczacych, pozdrawiam ;)
- */
- g.loadQueue.push({
- fun: function () {
- new(function () {
- this.niceForHealing = [
- /*A*/
- "Ash's Hardness",
- "Adventurer's Soup",
- "Aristocratic Medicament",
- "Aloe Essence",
- "Amethyst Mixture",
- /*B*/
- "Brown Ant Abdomen",
- "Bottle of Hooch",
- "Brown Soldier Ant Abdomen",
- "Beetle Eggs",
- "Brigand Elixir",
- "Bottle of Sweet Vodka",
- "Beekeepers' Honey",
- "Boar's Meat Stew",
- "Balsam Oil",
- "Beech's Reliability",
- "Blue Liquor of Masters",
- "Beginner's Medicine",
- "Billy's Wine",
- "Birch's Firmness",
- "Bog Incense",
- "Bitter Orange Liqueur",
- "Bear Potion",
- "Bottle of Rum",
- "Beginner's Potion",
- /*C*/
- "Cadaver Brew",
- "Chokeberry Syrup",
- "Cookie with a Penguin",
- "Caterpillar Larvae",
- "Christmas Tincture",
- "Chapel's Interior Coolness",
- "Crocodile Skin Mixture",
- "Cinnabar Mixture",
- "Chrysoprase Mixture",
- "Can of Dried Crickets",
- "Champagne Cocktail",
- /*D*/
- "Dwarven Elixir",
- "Deck Rat Potion",
- "Demon of Soul-binding",
- "Demon of Clean Wounds",
- "Delicious Western Mix",
- "Deity's Serenity",
- "Dumortierite Mixture",
- "Demonic Plasma Distillate",
- /*E*/
- "Elixir of Life",
- "Elixir of Ogre Health",
- /*F*/
- "Footman's Warming Elixir",
- "Furboberry Juice",
- "Flemona",
- "Funny Smelling Potion",
- /*G*/
- "Gnoll Healing Mixture",
- "Greater Elixir of Life",
- "Greater Macehand Brew",
- "Giant Spider Egg",
- "Glace Cookie",
- "Gingerbread Star of 2017",
- "Gingerbread Xmas Tree of 2017",
- "Green Fairy",
- "Grenadine",
- /*H*/
- "Heather Elixir",
- "Honeycomb",
- "Heros's Ale",
- "Huckleberry Potion",
- "Heterogenous Milk Acid",
- "Blood Mead",
- /*I*/
- "Immoderantiam",
- "Imperial Soldier's Wine",
- "Invigorating Wormwood Potion",
- "Interbad's Elixir",
- /*J*/
- "Juniper Brew",
- /*K*/
- /*L*/
- "Large Orange Mixture",
- "Life-giving Archimother's Milk",
- "Linden's Mildness",
- "Lesser Elixir of Life",
- /*M*/
- "Mysterious Healing Potion",
- "Macehand Magic Brew",
- "Maggot Liver",
- "Mild Purple Infusion",
- "Mysterious Goblin Mixture",
- "Maddok Spring Water",
- "Maddok Tongue",
- "Marona",
- "Maddok Antivenin",
- /*N*/
- /*O*/
- "Oak's Durability",
- /*P*/
- "Paladin Healing Potion",
- "Paladin Healing Potion II",
- "Potion of Vitality",
- "Potent Moss Brew",
- "Propolis",
- "Pirate Rum",
- "Purple Burberine",
- "Potion of Eagerness",
- "Potion of Vigor",
- "Purple Blood",
- "Prickly Pear's Sap",
- /*R*/
- "Ruby Drops",
- "Rabbit Potion",
- "Razuglag's Healing Elixir",
- "Rat Itching",
- /*S*/
- "Sweet Brawnwater",
- "Sweetwater Shark",
- "Soldier's Brew",
- "Stolen Elixir",
- "Slimy Brew",
- "Sparkling Dandelion Brew",
- "Seaweed Jelly",
- "Southern Bear Meat",
- "Squirrel Potion",
- /*T*/
- "Tarutaned of the Berserkers",
- "Thin Blood of the Tortured",
- "Traveler's Small Potion",
- "Traveler's Medium Potion",
- "Traveler's Large Potion",
- "Traveler's Safe Haven",
- "Tea with Ginger",
- /*U*/
- /*V*/
- /*W*/
- "Wolf Potion",
- /*Z*/
- ];
- 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 zobaczyc listeobslugiwanych przedmiotow")
- .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 obslugiwanych przedmiotow:</h2><br/>';
- com += 'Jeseli brakuje jakiegos przedmiotu, napisz o tym w komentarzu pod dodatkiem podajac <u>bezposredni link do przedmiotu na <a href="http://www.emargo.pl">emargo.pl</a></u>. Przedmioty z tzw. "pelnym leczeniem" (<i>pozostalo X punktow uleczania</i>) <b>NIE</b> sa obslugiwane! Dokladnie zapoznaj sie z waznymi 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