dooooooduo

GPXaX V3

Jul 11th, 2016 (edited)
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name    Full
  3. // @namespace   Gpxplus Hack V3
  4. // @include  https://gpx.plus/stats/*
  5. // @version  1
  6. // @grant    unsafeWindow
  7. // ==/UserScript==
  8.  
  9. var Tools = {
  10.     ajax: function(request, page, log, data, queueobj, callback, error) {
  11.         if (typeof data == 'object') data.currentPage = page;
  12.         $.ajax({
  13.             url: 'https://gpx.plus/AJAX/' + request,
  14.             data: data,
  15.             success: function(i) {
  16.                 if (queueobj.queue) queueobj.queue.dequeue();
  17.                 if (i.userData) Vars.userData = i.userData;
  18.                 if (i.userCard && $("#headerUser").length && $("#headerUser").html() != i.userCard && $("#headerUser").html(i.userCard), i.topNotifications && $("#topNotifications").length && $("#topNotifications").html() != $(i.topNotifications).html() && $("#topNotifications").replaceWith(i.topNotifications), i.headerTime && $("#headerTime").length && $("#headerTime").replaceWith(i.headerTime), "object" == typeof i.notifications) {
  19.                     $(".notification, .notification-text").empty();
  20.                     for (var a in i.notifications)
  21.                         if ("bar" != a) {
  22.                             var r = i.notifications[a];
  23.                             $("#notification-" + a).html(r.total === true ? " " : r.total), $("#notification-" + a + "-text").html(r.text)
  24.                         }
  25.                 }
  26.                 if (i.success === 'false') {
  27.                     Tools.writeLog(log, false);
  28.                     return;
  29.                 }
  30.                 if(i.notifications) {
  31.                     Vars.notifications = i.notifications;
  32.                 }
  33.                 Gpxplus.responseCheck.perform(i);
  34.                 Tools.writeLog(log);
  35.                 if (i.notifications && i.notifications.mobile) Vars.mobileAvailable = true;
  36.                 if (typeof callback == 'function') callback(i);
  37.             },
  38.             timeout: 10000,
  39.             error: function() {
  40.                 Tools.writeLog(log, false);
  41.                 if (typeof error == 'function') error();
  42.                 if (queueobj.queue) queueobj.queue.dequeue();
  43.             }
  44.         });
  45.     },
  46.     locate: function() {
  47.         navigator.geolocation.getCurrentPosition(function(pos) {
  48.             Vars.location = pos.coords;
  49.         });
  50.     },
  51.     writeLog: function(act, failed) {
  52.         if (act.length > 10) {
  53.             $('#panel-log').val((new Date()).toLocaleString() + ': ' + act + $('#panel-log').val());
  54.             return;
  55.         }
  56.         var failed = typeof failed != 'undefined';
  57.         if (act === 'feeder' || act === 'mobile' || act === 'defog' || act === 'chest' || act === 'pphitem') {
  58.             if (failed) $('#' + act + '-timeout').html(parseInt($('#' + act + '-timeout').html()) + 1);
  59.             else $('#' + act + '-succeed').html(parseInt($('#' + act + '-succeed').html()) + 1);
  60.         }
  61.     },
  62.     dequeue: function(obj, method) {
  63.         if (typeof obj == 'object' && obj.queue) {
  64.             if (typeof method != 'undefined' && method === 'func') {
  65.                 return function() {
  66.                     obj.queue.dequeue();
  67.                 };
  68.             }
  69.             obj.queue.dequeue();
  70.             return false;
  71.         }
  72.     },
  73.     random: function(min, max) {
  74.         return Math.floor(Math.random() * (max - min + 1)) + min;
  75.     }
  76. };
  77. var Vars = {};
  78. var Gpxplus = {
  79.     __modeProperBerry: false,
  80.     __modeShelter: 'egg',
  81.     __modeShelterSpecific: true,
  82.     __listWalkerIgnore: 'Doduo,Spinda,Slakoth,Rattata,Dratini,Gastly,Korechu,Latios,Groudon,Chingling,Weedle,Pidgey,Spearow,Bidoof,Popplio,',
  83.     __listShelter: 'Pidgey,Popplio,Burmy (Ground),Weedle,Spearow,Honedge,Korechu,Spinda,Doduo,Bidofo,Chingling,Mystery,Unown,Articuno,Zapdos,Moltres,Mewtwo,Mew,Raikou,Entei,Suicune,Lugia,Ho-Oh,Celebi,Regirock,Regice,Registeel,Latias,Latios,Kyogre,Groudon,Rayquaza,Jirachi,Deoxys,Uxie,Mesprit,Azelf,Dialga,Palkia,Heatran,Regigigas,Giratina,Cresselia,Manaphy,Darkrai,Shaymin,Arceus,Victini,Cobalion,Terrakion,Virizion,Tornadus,Thundurus,Reshiram,Zekrom,Landorus,Kyurem,Keldeo,Meloetta,Genesect,Xerneas,Yveltal,Zygarde,Diancie,Volcanion,Tapu Lele,Tapu Bulu,Tapu Fini,Cosmog,Solgaleo,Lunala,Nihilego,Buzzwole,Pheromosa,Xurkitree,Celesteela,Kartana,Guzzlord,Necrozma,Magearna,Marshadow,Poipole,Stakataka,Blacephalon,Zeraora,Meltan,Zacian,Zamazenta,Eternatus,Kubfu,Zarude,Regieleki,Regidrago,Glastrier,Calyrex,',
  84.     __listShelterPrio: 'Bidofo,Mystery,Unown,Articuno,Zapdos,Moltres,Mewtwo,Mew,Raikou,Entei,Suicune,Lugia,Ho-Oh,Celebi,Regirock,Regice,Registeel,Latias,Latios,Kyogre,Groudon,Rayquaza,Jirachi,Deoxys,Uxie,Mesprit,Azelf,Dialga,Palkia,Heatran,Regigigas,Giratina,Cresselia,Manaphy,Darkrai,Shaymin,Arceus,Victini,Cobalion,Terrakion,Virizion,Tornadus,Thundurus,Reshiram,Zekrom,Landorus,Kyurem,Keldeo,Meloetta,Genesect,Xerneas,Yveltal,Zygarde,Diancie,Volcanion,Tapu Lele,Tapu Bulu,Tapu Fini,Cosmog,Solgaleo,Lunala,Nihilego,Buzzwole,Pheromosa,Xurkitree,Celesteela,Kartana,Guzzlord,Necrozma,Magearna,Marshadow,Poipole,Stakataka,Blacephalon,Zeraora,Meltan,Zacian,Zamazenta,Eternatus,Kubfu,Zarude,Regieleki,Regidrago,Glastrier,Calyrex,',
  85.     __listLab: '4178-y9~hR+,3324-YvAEbT,3399-m6XQNc,3285-ChnT8I,3279-9tBm7W,4044-N9Qtuu,4211-OGHrO9,3725-ZuA3rd,3146-vLj7Tx,2959-R0FzDg,2593-App409,3398-1sSdDh',
  86.     __numPartySpace: 1,
  87.     __hatchItemPP: false,
  88.     __defogPP: false,
  89.     __labSource: 'http://127.0.0.1/bbs/toolbox/Gpxplus-lab-server.php',
  90.     counter: {},
  91.     init: function() {
  92.         if ($('#gpxplus-hack').length < 1) {
  93.             $('body').prepend('<table id="gpxplus-hack" style="width:100%;border-bottom:1px solid #999;margin-bottom:50px;verto">' +
  94.                 '<tr><td style="border-right:1px solid #999;width:40%;padding:10px" rowspan="2"><b>LOG</b><br>' +
  95.                 'Feeder: <span id="feeder-succeed">0</span> / <span id="feeder-timeout">0</span> / <span id="feeder-queue">0</span><br>' +
  96.                 'Mobile Walker: <span id="mobile-succeed">0</span> / <span id="mobile-timeout">0</span><br>' +
  97.                 'Poke Walker: <span id="walker-succeed">0</span> / <span id="walker-timeout">0</span><br>' +
  98.                 'Defog passpower: <span id="defog-succeed">0</span> / <span id="defog-timeout">0</span><br>' +
  99.                 'Hatch-item passpower: <span id="pphitem-succeed">0</span> / <span id="pphitem-timeout">0</span><br>' +
  100.                 'Pages refreshed: <span id="chest-succeed">0</span> / <span id="chest-timeout">0</span><br>' +
  101.                 '<textarea id="panel-log" rows="10" style="width:100%" disabled></textarea></td>' +
  102.                 '<td style="padding:10px;border-bottom:1px solid #999;height:50px"><b>PARTY</b><br><br><div id="party-image"></div></td></tr>' +
  103.                 '<tr><td style="padding:10px"><b>PANEL</b><br>' +
  104.                 '孵蛋蛋 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'party\', true)"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'party\')"><br>' +
  105.                 '点蛋蛋 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'feeder\', \'random\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'feeder\')"> (点击Stop后需要等队列点击完毕才会停止)<br>' +
  106.                 '刷宝箱 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'chest\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'chest\')"><br>' +
  107.                 '孤儿院 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'shelter\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'shelter\')"><br>' +
  108.                 '实验室 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'lab\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'lab\')"><br>' +
  109.                 '电话机 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'mobileWalker\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'mobileWalker\')"><br>' +
  110.                 '走路路 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'walker\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'walker\')"><br>' +
  111.                 '</table>');
  112.         }
  113.     },
  114.     feeder: {
  115.         timer: 10000,
  116.         fname: [],
  117.         queue: $('<div></div>'),
  118.         start: function(opt) {
  119.             var options = {
  120.                 'online': 'Are currently online',
  121.                 'random': 'Ordered randomly'
  122.             };
  123.             var feeder = this;
  124.             var interacts = opt.substr(0, 12);
  125.             Gpxplus.counter.feeder = setInterval(function() {
  126.                 if (feeder.queue.queue().length > 0) return;
  127.                 Tools.ajax('page', 'users', 'feeder-set', {
  128.                     list: interacts === 'interactions' ? interacts : opt,
  129.                     count: 1000,
  130.                     page: 'users',
  131.                     stat: 0,
  132.                     achievement: 0,
  133.                     list_type: '',
  134.                     sort: '',
  135.                     interacts: interacts === 'interactions' ? opt.substring(13) : '',
  136.                     p: 1
  137.                 }, {}, function(i) {
  138.                     $(i.html).find('.pIcons').each(function(i, v) {
  139.                         feeder.fname.push($(v).data('fname'));
  140.                     });
  141.                     if (feeder.fname.length > 0) Tools.writeLog(feeder.fname.length + ' Pokemon/eggs detected.\n');
  142.                     feeder.process();
  143.                 });
  144.             }, feeder.timer);
  145.  
  146.         },
  147.         process: function() {
  148.             var feeder = this;
  149.             if (feeder.fname.length > 0) {
  150.                 Tools.ajax('feeder', 'info', 'NONE', {
  151.                     fnames: feeder.fname.splice(0, 20)
  152.                 }, {}, function(i) {
  153.                     $.each(i.html, function(name, value) {
  154.                         feeder.queue.queue(function() {
  155.                             var flavorText = $('#infoInteract em u', value);
  156.                             var data = {
  157.                                 fname: name,
  158.                                 do_interact: 'Yes',
  159.                                 page: 'info',
  160.                                 type: 'feeder'
  161.                             };
  162.                             if ($('#infoInteract div', value).length > 0 && !$('#infoInteract div', value).html().match(/egg/))
  163.                                 data.berry = (Gpxplus.__modeProperBerry && i.notifications.bar.weather.total !== 'foggy' && flavorText.length > 0) ? {
  164.                                     sour: 1,
  165.                                     spicy: 2,
  166.                                     dry: 3,
  167.                                     sweet: 4,
  168.                                     bitter: 5
  169.                                 }[flavorText.html().match(/(.+)\sberry/)[1]] : 3;
  170.                             Tools.ajax('page', 'info', 'feeder', data, feeder);
  171.                             $('#feeder-queue').html(feeder.queue.queue().length - 1);
  172.                         });
  173.                     });
  174.                     if (feeder.fname.length > 0) feeder.process();
  175.                 });
  176.             }
  177.         }
  178.     },
  179.     responseCheck: {
  180.         queue: $('<div></div>'),
  181.         chestGet: false,
  182.         perform: function(i) {
  183.             var check = this;
  184.             var queuelength = typeof check.queue.queue() !== 'undefined' ? check.queue.queue().length : 0;
  185.             /* Clear the fog */
  186.             if (i.notifications) {
  187.                 if (Gpxplus.__defogPP && i.notifications.bar.weather.total === 'foggy' && !i.notifications.bar.power) {
  188.                     Tools.ajax('PassPower', 'shop', 'defog', {
  189.                         power: 2,
  190.                         tier: 3,
  191.                     }, check);
  192.                 } else if (Gpxplus.__hatchItemPP && !i.notifications.bar.power) {
  193.                     Tools.ajax('PassPower', 'shop', 'pphitem', {
  194.                         power: 5,
  195.                         tier: 3,
  196.                     }, check);
  197.                 }
  198.             }
  199.             /* Obtain the chest */
  200.             if (!Gpxplus.responseCheck.chestGet && i.topNotifications && $('[class*=SpriteChest], .SpriteOldman, .SpriteSalesman, .SpriteTinyEgg, .SpriteStrangePortal, .SpritePrankster', i.topNotifications).length > 0) {
  201.                 Gpxplus.responseCheck.chestGet = true;
  202.                 Tools.ajax('TopSpecial', 'main', 'chest', {
  203.                     check: true
  204.                 }, check, function(i) {
  205.                     Gpxplus.responseCheck.chestGet = false;
  206.                     if (!i.msg) return;
  207.                     var msg = i.msg.match(/You obtained a (.+?)\!/);
  208.                     Tools.writeLog(msg && msg[1] ? 'Obtaned a ' + msg[1] + ' from a chest\n' : i.msg + '\n');
  209.                 });
  210.             }
  211.         }
  212.     },
  213.     mobileWalker: {
  214.         timer: 60000,
  215.         queue: $('<div></div>'),
  216.         start: function() {
  217.             var locidx = getCookie('locidx'),
  218.                 mobile = this;
  219.             if (locidx === '') {
  220.                 locidx = '0';
  221.                 setCookie('locidx', locidx, 2222222);
  222.             }
  223.             var x = [
  224.                 ['-49.9', '168.75'],
  225.                 ['70.9', '-160.3125']
  226.             ];
  227.             Gpxplus.counter.mobileWalker = setInterval(function() {
  228.                 if (!Vars.mobileAvailable) return;
  229.                 Tools.locate();
  230.                 Tools.ajax('MobileWalker', 'main', 'mobile', {
  231.                     //longitude: Vars.location.longitude,
  232.                     //latitude: Vars.location.latitude,
  233.                     latitude: x[locidx][0],
  234.                     longitude: x[locidx][1],
  235.                     poketch: 'mobile'
  236.                 }, {}, function(i) {
  237.                     Vars.mobileAvailable = false;
  238.                     if (i.success == true) {
  239.                         setCookie('locidx', -~-locidx, 2222222);
  240.                     }
  241.                 });
  242.             }, this.timer);
  243.         }
  244.     },
  245.     shelter: {
  246.         timer: 2000,
  247.         queue: $('<div></div>'),
  248.         start: function() {
  249.             var shelter = this;
  250.             Gpxplus.counter.shelter = setInterval(function() {
  251.                 if (shelter.queue.queue().length > 0) return;
  252.                 var navto = (Gpxplus.__modeShelter === 'egg') ? 'eggs' : 'safari';
  253.                 Tools.ajax('page', 'shelter', '', {
  254.                     tab: navto,
  255.                     disabled: 1,
  256.                     ajax: 'page',
  257.                     page: 'shelter',
  258.                     shelter: navto,
  259.                 }, shelter, function(i) {
  260.                     if (i.html) {
  261.                         $('.shelter img', i.html).each(function() {
  262.                             var pokemon = $(this);
  263.                             var remaining = Vars.userData.pokesLimit.party - Vars.userData.pokes.party;
  264.                             var prioMatched = Gpxplus.__listShelterPrio.match(((Gpxplus.__modeShelter === 'egg') ? pokemon.data('tooltip').match(/(.+)\sEgg/)[1] : pokemon.data('name')) + ',');
  265.                             var matched = Gpxplus.__listShelter.match(((Gpxplus.__modeShelter === 'egg') ? pokemon.data('tooltip').match(/(.+)\sEgg/)[1] : pokemon.data('name')) + ',');
  266.                             if (prioMatched && remaining > 0 ||
  267.                                 remaining - Gpxplus.__numPartySpace > 0 &&
  268.                                     (!Gpxplus.__modeShelterSpecific || Gpxplus.__modeShelterSpecific && matched)) {
  269.                                 Vars.userData.pokes.party++;
  270.                                 Tools.ajax('ShelterClaim', 'shelter', 'shelter', {
  271.                                     fname: pokemon.data('fname'),
  272.                                     hash: pokemon.data('hash')
  273.                                 }, shelter, function(i) {
  274.                                     if (i.success) Tools.writeLog('Claimed - ' + pokemon.data('tooltip') + '\n');
  275.                                 });
  276.                             }
  277.                         });
  278.                     }
  279.                 });
  280.             }, this.timer);
  281.         }
  282.     },
  283.     party: {
  284.         timer: 10000,
  285.         queue: $('<div></div>'),
  286.         start: function(hatch) {
  287.             Gpxplus.counter.party = setInterval(function() {
  288.                 var fnames = [],
  289.                     data = {},
  290.                     boxRemain = {},
  291.                     check = this;
  292.                 Tools.ajax('page', 'main', '', {
  293.                     page: 'main'
  294.                 }, {}, function(res) {
  295.                     var images = '';
  296.                     $('#UserParty .PartyPokeImg', res.html).each(function() {
  297.                         images += '<img src="' + $(this).attr('src') + '?' + (new Date().getTime()) + '"> ';
  298.                     });
  299.                     $('#party-image').html(images);
  300.                     if (!hatch) return;
  301.                     for (var j = 0; j < 2; j++) {
  302.                         fnames = [], data = {};
  303.                         var boxes = $('#UserParty .button.toggleButton.pSelect.pSelectMove', res.html).eq(0);
  304.                         for (var i = 2;; i++) {
  305.                             var box = boxes.data('' + i);
  306.                             if (!box) break;
  307.                             if (box.match(/THROW/)) boxRemain[boxes.data('keys')[i]] = parseInt(box.match(/THROW\s\[(\d+?)\]/)[1]);
  308.                         }
  309.                         $('#UserParty > ' + (j === 0 ? 'li.pHatch:not(.pFlameOrb)' : 'li.pMovePC'), res.html).each(function() {
  310.                             for (i in boxRemain) {
  311.                                 var fname = $(this).data('fname');
  312.                                 if (boxRemain[i] < 1) continue;
  313.                                 if (!data[fname]) {
  314.                                     data[fname] = i;
  315.                                     fnames.push(fname);
  316.                                     boxRemain[i]--;
  317.                                 }
  318.                             }
  319.                         });
  320.                         if (fnames.length > 0) {
  321.                             (function(j) {
  322.                                 Tools.ajax('PokeOptions', 'main', '', {
  323.                                     option: (j === 0 ? 'hatch' : 'move'),
  324.                                     fname: fnames,
  325.                                     poketch: '',
  326.                                     data: data
  327.                                 }, check, function(i) {
  328.                                     var time = (new Date()).toLocaleString();
  329.                                     if (j === 0 && i.messages) Tools.writeLog(i.messages.join('\n' + time + ': ') + '\n');
  330.                                     else if (j === 1) Tools.writeLog('Moved leftovers ' + fnames.join(',') + ' to PC.\n');
  331.                                 });
  332.                             })(j);
  333.                         }
  334.                     }
  335.                 });
  336.             }, this.timer);
  337.         }
  338.     },
  339.     lab: {
  340.         timer: 5000,
  341.         queue: $('<div></div>'),
  342.         start: function() {
  343.             var lab = this;
  344.             Gpxplus.counter.lab = setInterval(function() {
  345.                 Tools.ajax('page', 'lab', '', {
  346.                     page: 'lab'
  347.                 }, lab, function(i) {
  348.                     if (!i.html || Vars.userData.pokesLimit.party - Vars.userData.pokes.party < 1) return;
  349.                     var eggs = {},
  350.                         hashes = {};
  351.                     $('[data-fname].show3D', i.html).each(function() {
  352.                         var fname = $(this).data('fname'),
  353.                             hash = $(this).data('hash');
  354.                         eggs[fname] = $(this).find('.col5a.highlightHovera img').attr('src');
  355.                         hashes[fname] = hash;
  356.                     });
  357.                     if (eggs) {
  358.                         $.ajax({
  359.                             url: Gpxplus.__labSource,
  360.                             data: {
  361.                                 file: eggs
  362.                             },
  363.                             timeout: 10000,
  364.                             success: function(i) {
  365.                                 if (i.mystery) console.log(i.mystery);
  366.                                 for (j in i.code) {
  367.                                     if (!Gpxplus.__listLab.match(new RegExp(i.code[j])) /*&& i.code[j] != 'Mystery'*/ ) continue;
  368.                                     //console.log(j);
  369.                                     //console.log(eggs[j] + ': ' + hashes[j]);
  370.                                     Tools.ajax('ClaimEgg', 'lab', '', {
  371.                                         hash: hashes[j],
  372.                                         fname: j
  373.                                     }, lab, function(k) {
  374.                                         Tools.writeLog(k.success ? 'Found an egg - ' + j + ' from lab\n' : 'Attempted to obtain ' + j + ' from lab but failed!' + (k.error ? ' (' + k.error + ')' : '') + '\n');
  375.                                     });
  376.                                     break;
  377.                                 }
  378.                                 lab.queue.dequeue();
  379.                             },
  380.                             error: function() {
  381.                                 lab.queue.dequeue();
  382.                             }
  383.                         });
  384.                     }
  385.                 });
  386.             }, lab.timer);
  387.         },
  388.         stop: function() {
  389.             clearInterval(Gpxplus.counter.lab);
  390.         }
  391.     },
  392.     chest: {
  393.         timer: 5000,
  394.         queue: $('<div></div>'),
  395.         pages: ['main', 'explore', 'trinkets', 'battles', 'users', 'dex', 'shop'],
  396.         start: function() {
  397.             var chest = this;
  398.             Gpxplus.counter.chest = setInterval(function() {
  399.                 if (chest.queue.queue().length) return;
  400.                 chest.queue.queue(function() {
  401.                     $.ajax({
  402.                         url: 'https://gpx.plus/' + chest.pages[Tools.random(0, 6)],
  403.                         dataType: 'html',
  404.                         success: function() {
  405.                             Tools.writeLog('chest');
  406.                             chest.queue.dequeue();
  407.                         },
  408.                         error: function() {
  409.                             Tools.writeLog('chest', false);
  410.                             chest.queue.dequeue();
  411.                         }
  412.                     });
  413.                 });
  414.             }, chest.timer);
  415.         }
  416.     },
  417.     walker: {
  418.         timer: 10000,
  419.         queue: $('<div></div>'),
  420.         start: function() {
  421.             var walker = this;
  422.             Gpxplus.counter.walker = setInterval(function() {
  423.                 if(walker.queue.queue().length) return;
  424.                 Tools.ajax('poketch', 'main', 'walker', {
  425.                     app: 'walker'
  426.                 }, {}, function(i) {
  427.                     var t = i.notifications;
  428.                     var fname = $(i.html).find('.PartyPoke.pMovePC').data('fname');
  429.                     $.ajax({
  430.                         url: 'https://gpx.plus/pc',
  431.                         dataType: 'text',
  432.                         success: function(html) {
  433.                             var boxes = [], withdrawed = false;
  434.                             $(html).find('[data-box]').each(function(i, b) {
  435.                                 b = $(b);
  436.                                 boxes[b.data('box')] = {
  437.                                     pokemon: parseInt(b.find('.pc_box_pokes > span').length),
  438.                                     name: b.find('.pc_box_name > span').html()
  439.                                 };
  440.                             });
  441.  
  442.                             if(t.walker && t.walker.total == 100 && fname) {
  443.                                 for(i in boxes) {
  444.                                     if(!boxes[i].name.match(/PENDING/) || boxes[i].pokemon >= 24) continue;
  445.                                     walker.queue.queue(function() {
  446.                                         Tools.ajax('PokeOptions', 'main', 'walker', {
  447.                                             option: 'move',
  448.                                             fname: fname,
  449.                                             poketch: 'walker',
  450.                                             data: 'box_' + i
  451.                                         }, walker, function() {
  452.                                             Tools.writeLog('Moved walker pokemon ' + fname + ' to box ' + i + '.\n');
  453.                                         });
  454.                                         withdrawed = true;
  455.                                     });
  456.                                     break;
  457.                                 }
  458.                             }
  459.  
  460.                             if(!t.walker || withdrawed) {
  461.                                 var pokes = false;
  462.                                 eval(html.match(/var pokes.+?}}/im)[0]);
  463.                                 if(pokes) {
  464.                                     var new_pokes = {};
  465.                                     $.each(pokes, function(f, p) {
  466.                                         if(!p.poke_id || !p.level || p.level >= 100 || p.loc !== 'PC') return;
  467.                                         new_pokes[f] = p;
  468.                                     });
  469.                                     var sortedIds = Object.keys(new_pokes).sort(function(k1, k2) {
  470.                                         return new_pokes[k1].poke_id - new_pokes[k2].poke_id;
  471.                                     });
  472.                                     $.each(sortedIds, function(i, f) {
  473.                                         var p = new_pokes[f];
  474.                                         if(!p.level || p.level >= 100 || p.loc !== 'PC' || Gpxplus.__listWalkerIgnore.indexOf(p.name) !== -1) return;
  475.                                         walker.queue.queue(function() {
  476.                                             Tools.ajax('PokeOptions', 'main', 'walker', {
  477.                                                 option: 'move',
  478.                                                 fname: f,
  479.                                                 poketch: 'walker',
  480.                                                 data: 'walker'
  481.                                             }, walker, function(i) {
  482.                                                 Tools.writeLog('Moved box pokemon ' + f + ' to walker.\n');
  483.                                             });
  484.                                         });
  485.                                         return false;
  486.                                     });
  487.                                 }
  488.                             }
  489.                            
  490.                             Tools.writeLog('walker');
  491.                         },
  492.                         error: function() {
  493.                             Tools.writeLog('walker', false);
  494.                         }
  495.                     });
  496.                 });
  497.             }, walker.timer);
  498.         }
  499.     },
  500.     stopFeature: function(feature) {
  501.         if (this.counter[feature]) {
  502.             Tools.writeLog('~Feature - ' + feature + ' stopped!\n');
  503.             clearInterval(this.counter[feature]);
  504.             this.counter[feature] = null;
  505.         }
  506.     },
  507.     startFeature: function(feature, opt) {
  508.         if (!this.counter[feature] && this[feature]) {
  509.             if (this[feature].queue) this[feature].queue.clearQueue();
  510.             Tools.writeLog('~Feature - ' + feature + ' initiated!\n');
  511.             this[feature].start(opt);
  512.         }
  513.     }
  514. };
  515.  
  516. if (typeof unsafeWindow !== 'undefined') unsafeWindow.Gpxplus = Gpxplus, unsafeWindow.Vars = Vars, unsafeWindow.Tools = Tools;
  517.  
  518. Gpxplus.init();
  519. /*
  520. Gpxplus.mobileWalker.init();
  521. Gpxplus.feeder.init(confirm('Online feeder?') ? 'today' : 'random', 1000);
  522. //Gpxplus.feeder.init('interactions/return', 1000);
  523. Gpxplus.party.start(true);
  524. Gpxplus.shelter.start();
  525. Gpxplus.lab.start();
  526. Gpxplus.chest.start();*/
Add Comment
Please, Sign In to add comment