dooooooduo

GPXax

Nov 4th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name    Full
  3. // @namespace   Gpxplus Hack V2.3
  4. // @include  http://gpx.plus/stats/*
  5. // @version  1
  6. // @grant    unsafeWindow
  7. // ==/UserScript==
  8. var Tools = {
  9.     ajax: function(request, page, log, data, queueobj, callback, error) {
  10.         if (typeof data == 'object') data.currentPage = page;
  11.         $.ajax({
  12.             url: 'http://gpx.plus/AJAX/' + request,
  13.             data: data,
  14.             success: function(i) {
  15.                 if (i.userData) Vars.userData = i.userData;
  16.                 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) {
  17.                     $(".notification, .notification-text").empty();
  18.                     for (var a in i.notifications)
  19.                         if ("bar" != a) {
  20.                             var r = i.notifications[a];
  21.                             $("#notification-" + a).html(r.total === !0 ? " " : r.total), $("#notification-" + a + "-text").html(r.text)
  22.                         }
  23.                 }
  24.                 if (i.success === 'false') {
  25.                     Tools.writeLog(log, !1);
  26.                     return;
  27.                 }
  28.                 Gpxplus.responseCheck.perform(i);
  29.                 Tools.writeLog(log);
  30.                 if (i.notifications && i.notifications.mobile) Vars.mobileAvailable = !0;
  31.                 if (typeof callback == 'function') callback(i);
  32.                 if (queueobj.queue) queueobj.queue.dequeue();
  33.             },
  34.             timeout: 10000,
  35.             error: function() {
  36.                 Tools.writeLog(log, !1);
  37.                 if (typeof error == 'function') error();
  38.                 if (queueobj.queue) queueobj.queue.dequeue();
  39.             }
  40.         });
  41.     },
  42.     locate: function() {
  43.         navigator.geolocation.getCurrentPosition(function(pos) {
  44.             Vars.location = pos.coords;
  45.         });
  46.     },
  47.     writeLog: function(act, failed) {
  48.         if (act.length > 10) {
  49.             $('#panel-log').val((new Date()).toLocaleString() + ': ' + act + $('#panel-log').val());
  50.             return;
  51.         }
  52.         var failed = (typeof failed != 'undefined') ? !0 : !1;
  53.         if (act === 'feeder' || act === 'mobile' || act === 'defog' || act === 'chest' || act === 'pphitem') {
  54.             if (failed) $('#' + act + '-timeout').html(parseInt($('#' + act + '-timeout').html()) + 1);
  55.             else $('#' + act + '-succeed').html(parseInt($('#' + act + '-succeed').html()) + 1);
  56.         }
  57.     },
  58.     dequeue: function(obj, method) {
  59.         if (typeof obj == 'object' && obj.queue) {
  60.             if (typeof method != 'undefined' && method === 'func') {
  61.                 return function() {
  62.                     obj.queue.dequeue();
  63.                 };
  64.             }
  65.             obj.queue.dequeue();
  66.             return !1;
  67.         }
  68.     },
  69.     random: function(min, max) {
  70.         return Math.floor(Math.random() * (max - min + 1)) + min;
  71.     }
  72. };
  73. var Vars = {};
  74. var Gpxplus = {
  75.     __modeProperBerry: !1,
  76.     __modeShelter: 'egg',
  77.     __modeShelterSpecific: !1,
  78.     __listShelter: '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,',
  79.     __listShelterPrio: '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,',
  80.     __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',
  81.     __numPartySpace: 1,
  82.     __hatchItemPP: !1,
  83.     __defogPP: !1,
  84.     counter: {},
  85.     init: function() {
  86.         if ($('#gpxplus-hack').length < 1) {
  87.             $('body').prepend('<table id="gpxplus-hack" style="width:100%;border-bottom:1px solid #999;margin-bottom:50px;verto">' +
  88.                 '<tr><td style="border-right:1px solid #999;width:40%;padding:10px" rowspan="2"><b>LOG</b><br>' +
  89.                 'Feeder: <span id="feeder-succeed">0</span> / <span id="feeder-timeout">0</span> / <span id="feeder-queue">0</span><br>' +
  90.                 'Mobile Walker: <span id="mobile-succeed">0</span> / <span id="mobile-timeout">0</span><br>' +
  91.                 'Defog passpower: <span id="defog-succeed">0</span> / <span id="defog-timeout">0</span><br>' +
  92.                 'Hatch-item passpower: <span id="pphitem-succeed">0</span> / <span id="pphitem-timeout">0</span><br>' +
  93.                 'Pages refreshed: <span id="chest-succeed">0</span> / <span id="chest-timeout">0</span><br>' +
  94.                 '<textarea id="panel-log" rows="10" style="width:100%" disabled></textarea></td>' +
  95.                 '<td style="padding:10px;border-bottom:1px solid #999;height:50px"><b>PARTY</b><br><br><div id="party-image"></div></td></tr>' +
  96.                 '<tr><td style="padding:10px"><b>PANEL</b><br>' +
  97.                 '孵蛋蛋 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'party\', !0)"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'party\')"><br>' +
  98.                 '点蛋蛋 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'feeder\', \'random\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'feeder\')"> (点击Stop后需要等队列点击完毕才会停止)<br>' +
  99.                 '刷宝箱 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'chest\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'chest\')"><br>' +
  100.                 '孤儿院 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'shelter\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'shelter\')"><br>' +
  101.                 '实验室 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'lab\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'lab\')"><br>' +
  102.                 '电话机 <input type="button" value="Start" onclick="Gpxplus.startFeature(\'mobileWalker\')"> <input type="button" value="Stop" onclick="Gpxplus.stopFeature(\'mobileWalker\')"><br>' +
  103.                 '</table>');
  104.         }
  105.     },
  106.     feeder: {
  107.         timer: 10000,
  108.         fname: [],
  109.         queue: $('<div></div>'),
  110.         start: function(opt) {
  111.             var options = {
  112.                 'online': 'Are currently online',
  113.                 'random': 'Ordered randomly'
  114.             };
  115.             var feeder = this;
  116.             var interacts = opt.substr(0, 12);
  117.             Gpxplus.counter.feeder = setInterval(function() {
  118.                 if (feeder.queue.queue().length > 0) return;
  119.                 Tools.ajax('page', 'users', 'feeder-set', {
  120.                     list: interacts === 'interactions' ? interacts : opt,
  121.                     count: 1000,
  122.                     page: 'users',
  123.                     stat: 0,
  124.                     achievement: 0,
  125.                     list_type: '',
  126.                     sort: '',
  127.                     interacts: interacts === 'interactions' ? opt.substring(13) : '',
  128.                     p: 1
  129.                 }, {}, function(i) {
  130.                     $(i.html).find('.pIcons').each(function(i, v) {
  131.                         feeder.fname.push($(v).data('fname'));
  132.                     });
  133.                     if (feeder.fname.length > 0) Tools.writeLog(feeder.fname.length + ' Pokemon/eggs detected.\n');
  134.                     feeder.process();
  135.                 });
  136.             }, feeder.timer);
  137.  
  138.         },
  139.         process: function() {
  140.             var feeder = this;
  141.             if (feeder.fname.length > 0) {
  142.                 Tools.ajax('feeder', 'info', 'NONE', {
  143.                     fnames: feeder.fname.splice(0, 20)
  144.                 }, {}, function(i) {
  145.                     $.each(i.html, function(name, value) {
  146.                         feeder.queue.queue(function() {
  147.                             var flavorText = $('#infoInteract em u', value);
  148.                             var data = {
  149.                                 fname: name,
  150.                                 do_interact: 'Yes',
  151.                                 page: 'info',
  152.                                 type: 'feeder'
  153.                             };
  154.                             if ($('#infoInteract div', value).length > 0 && !$('#infoInteract div', value).html().match(/egg/))
  155.                                 data.berry = (Gpxplus.__modeProperBerry && flavorText.length > 0) ? {
  156.                                     sour: 1,
  157.                                     spicy: 2,
  158.                                     dry: 3,
  159.                                     sweet: 4,
  160.                                     bitter: 5
  161.                                 }[flavorText.html().match(/(.+)\sberry/)[1]] : 3;
  162.                             Tools.ajax('page', 'info', 'feeder', data, feeder);
  163.                             $('#feeder-queue').html(feeder.queue.queue().length - 1);
  164.                         });
  165.                     });
  166.                     if (feeder.fname.length > 0) feeder.process();
  167.                 });
  168.             }
  169.         }
  170.     },
  171.     responseCheck: {
  172.         queue: $('<div></div>'),
  173.         perform: function(i) {
  174.             var check = this;
  175.             var queuelength = typeof check.queue.queue() !== 'undefined' ? check.queue.queue().length : 0;
  176.             /* Clear the fog */
  177.             if (i.notifications) {
  178.                 if (Gpxplus.__defogPP && i.notifications.bar.weather.total === 'foggy' && !i.notifications.bar.power) {
  179.                     Tools.ajax('PassPower', 'shop', 'defog', {
  180.                         power: 2,
  181.                         tier: 3,
  182.                     }, check);
  183.                 } else if (Gpxplus.__hatchItemPP && !i.notifications.bar.power) {
  184.                     Tools.ajax('PassPower', 'shop', 'pphitem', {
  185.                         power: 5,
  186.                         tier: 3,
  187.                     }, check);
  188.                 }
  189.             }
  190.             /* Obtain the chest */
  191.             if (i.topNotifications && $('[class*=SpriteChest], .SpriteOldman, .SpriteSalesman, .SpriteTinyEgg', i.topNotifications).length > 0) {
  192.                 Tools.ajax('TopSpecial', 'main', 'chest', {
  193.                     check: !0
  194.                 }, check, function(i) {
  195.                     if (!i.msg) return;
  196.                     var msg = i.msg.match(/You obtained a (.+?)\!/);
  197.                     Tools.writeLog(msg && msg[1] ? 'Obtaned a ' + msg[1] + ' from a chest\n' : i.msg + '\n');
  198.                 });
  199.             }
  200.         }
  201.     },
  202.     mobileWalker: {
  203.         timer: 60000,
  204.         queue: $('<div></div>'),
  205.         start: function() {
  206.             var locidx = getCookie('locidx'),
  207.                 mobile = this;
  208.             if (locidx === '') {
  209.                 locidx = '0';
  210.                 setCookie('locidx', locidx, 2222222);
  211.             }
  212.             var x = [
  213.                 ['-49.9', '168.75'],
  214.                 ['70.9', '-160.3125']
  215.             ];
  216.             Gpxplus.counter.mobileWalker = setInterval(function() {
  217.                 if (!Vars.mobileAvailable) return;
  218.                 Tools.locate();
  219.                 Tools.ajax('MobileWalker', 'main', 'mobile', {
  220.                     /*longitude: Vars.location.longitude,
  221.                     latitude: Vars.location.latitude, */
  222.                     latitude: x[locidx][0],
  223.                     longitude: x[locidx][1],
  224.                     poketch: 'mobile'
  225.                 }, {}, function(i) {
  226.                     Vars.mobileAvailable = !1;
  227.                     if (i.success == true) {
  228.                         setCookie('locidx', -~-locidx, 2222222);
  229.                     }
  230.                 });
  231.             }, this.timer);
  232.         }
  233.     },
  234.     shelter: {
  235.         timer: 2000,
  236.         queue: $('<div></div>'),
  237.         start: function() {
  238.             var shelter = this;
  239.             Gpxplus.counter.shelter = setInterval(function() {
  240.                 if (shelter.queue.queue().length > 0) return;
  241.                 var navto = (Gpxplus.__modeShelter === 'egg') ? 'eggs' : 'safari';
  242.                 Tools.ajax('page', 'shelter', '', {
  243.                     tab: navto,
  244.                     disabled: 1,
  245.                     ajax: 'page',
  246.                     page: 'shelter',
  247.                     shelter: navto,
  248.                 }, shelter, function(i) {
  249.                     if (i.html) {
  250.                         $('.shelter img', i.html).each(function() {
  251.                             var pokemon = $(this);
  252.                             if (Vars.userData.pokesLimit.party - Vars.userData.pokes.party - Gpxplus.__numPartySpace <= 0 ||
  253.                                 !Gpxplus.__listShelterPrio.match(((Gpxplus.__modeShelter === 'egg') ? pokemon.data('tooltip').match(/(.+)\sEgg/)[1] : pokemon.data('name')) + ',') ||
  254.                                 Gpxplus.__modeShelterSpecific && !Gpxplus.__listShelter.match(((Gpxplus.__modeShelter === 'egg') ? pokemon.data('tooltip').match(/(.+)\sEgg/)[1] : pokemon.data('name')) + ',')) return;
  255.                             Vars.userData.pokes.party++;
  256.                             Tools.ajax('ShelterClaim', 'shelter', 'shelter', {
  257.                                 fname: pokemon.data('fname'),
  258.                                 hash: pokemon.data('hash')
  259.                             }, shelter, function(i) {
  260.                                 if (i.success) Tools.writeLog('Claimed - ' + pokemon.data('tooltip') + '\n');
  261.                             });
  262.                         });
  263.                     }
  264.                 });
  265.             }, this.timer);
  266.         }
  267.     },
  268.     party: {
  269.         timer: 10000,
  270.         queue: $('<div></div>'),
  271.         start: function(hatch) {
  272.             Gpxplus.counter.party = setInterval(function() {
  273.                 var fnames = [],
  274.                     data = {},
  275.                     boxRemain = {},
  276.                     check = this;
  277.                 Tools.ajax('page', 'main', '', {
  278.                     page: 'main'
  279.                 }, {}, function(res) {
  280.                     var images = '';
  281.                     $('#UserParty .PartyPokeImg', res.html).each(function() {
  282.                         images += '<img src="' + $(this).attr('src') + '?' + (new Date().getTime()) + '"> ';
  283.                     });
  284.                     $('#party-image').html(images);
  285.                     if (!hatch) return;
  286.                     for (var j = 0; j < 2; j++) {
  287.                         fnames = [], data = {};
  288.                         var boxes = $('#UserParty .button.toggleButton.pSelect.pSelectMove', res.html).eq(0);
  289.                         for (var i = 2;; i++) {
  290.                             var box = boxes.data('' + i);
  291.                             if (!box) break;
  292.                             if (box.match(/THROW/)) boxRemain[boxes.data('keys')[i]] = parseInt(box.match(/THROW\s\[(\d+?)\]/)[1]);
  293.                         }
  294.                         $('#UserParty > ' + (j === 0 ? 'li.pHatch:not(.pFlameOrb)' : 'li.pMovePC'), res.html).each(function() {
  295.                             for (i in boxRemain) {
  296.                                 var fname = $(this).data('fname');
  297.                                 if (boxRemain[i] < 1) continue;
  298.                                 if (!data[fname]) {
  299.                                     data[fname] = i;
  300.                                     fnames.push(fname);
  301.                                     boxRemain[i]--;
  302.                                 }
  303.                             }
  304.                         });
  305.                         if (fnames.length > 0) {
  306.                             (function(j) {
  307.                                 Tools.ajax('PokeOptions', 'main', '', {
  308.                                     option: (j === 0 ? 'hatch' : 'move'),
  309.                                     fname: fnames,
  310.                                     poketch: '',
  311.                                     data: data
  312.                                 }, check, function(i) {
  313.                                     var time = (new Date()).toLocaleString();
  314.                                     if (j === 0 && i.messages) Tools.writeLog(i.messages.join('\n' + time + ': ') + '\n');
  315.                                     else if (j === 1) Tools.writeLog('Moved leftovers ' + fnames.join(',') + ' to PC.\n');
  316.                                 });
  317.                             })(j);
  318.                         }
  319.                     }
  320.                 });
  321.             }, this.timer);
  322.         }
  323.     },
  324.     lab: {
  325.         timer: 5000,
  326.         queue: $('<div></div>'),
  327.         start: function() {
  328.             var lab = this;
  329.             Gpxplus.counter.lab = setInterval(function() {
  330.                 Tools.ajax('page', 'lab', '', {
  331.                     page: 'lab'
  332.                 }, lab, function(i) {
  333.                     if (!i.html || Vars.userData.pokesLimit.party - Vars.userData.pokes.party < 1) return;
  334.                     var eggs = {},
  335.                         hashes = {};
  336.                     $('[data-fname].show3D', i.html).each(function() {
  337.                         var fname = $(this).data('fname'),
  338.                             hash = $(this).data('hash');
  339.                         eggs[fname] = $(this).find('.col5a.highlightHovera img').attr('src');
  340.                         hashes[fname] = hash;
  341.                     });
  342.                     if (eggs) {
  343.                         $.ajax({
  344.                             url: 'http://www.pokeuniv.com/bbs/toolbox/Gpxplus-lab-server.php',
  345.                             data: {
  346.                                 file: eggs
  347.                             },
  348.                             timeout: 10000,
  349.                             success: function(i) {
  350.                                 if (i.mystery) console.log(i.mystery);
  351.                                 for (j in i.code) {
  352.                                     if (!Gpxplus.__listLab.match(new RegExp(i.code[j])) /*&& i.code[j] != 'Mystery'*/ ) continue;
  353.                                     //console.log(j);
  354.                                     //console.log(eggs[j] + ': ' + hashes[j]);
  355.                                     Tools.ajax('ClaimEgg', 'lab', '', {
  356.                                         hash: hashes[j],
  357.                                         fname: j
  358.                                     }, lab, function(k) {
  359.                                         Tools.writeLog(k.success ? 'Found an egg - ' + j + ' from lab\n' : 'Attempted to obtain ' + j + ' from lab but failed!' + (k.error ? ' (' + k.error + ')' : '') + '\n');
  360.                                     });
  361.                                     break;
  362.                                 }
  363.                                 lab.queue.dequeue();
  364.                             },
  365.                             error: function() {
  366.                                 lab.queue.dequeue();
  367.                             }
  368.                         });
  369.                     }
  370.                 });
  371.             }, lab.timer);
  372.         },
  373.         stop: function() {
  374.             clearInterval(Gpxplus.counter.lab);
  375.         }
  376.     },
  377.     chest: {
  378.         timer: 5000,
  379.         queue: $('<div></div>'),
  380.         pages: ['main', 'explore', 'trinkets', 'battles', 'users', 'dex', 'shop'],
  381.         start: function() {
  382.             var chest = this;
  383.             Gpxplus.counter.chest = setInterval(function() {
  384.                 if (chest.queue.queue().length) return;
  385.                 chest.queue.queue(function() {
  386.                     $.ajax({
  387.                         url: 'http://gpx.plus/' + chest.pages[Tools.random(0, 6)],
  388.                         dataType: 'html',
  389.                         success: function() {
  390.                             Tools.writeLog('chest');
  391.                             chest.queue.dequeue();
  392.                         },
  393.                         error: function() {
  394.                             Tools.writeLog('chest', !1);
  395.                             chest.queue.dequeue();
  396.                         }
  397.                     });
  398.                 });
  399.             }, chest.timer);
  400.         }
  401.     },
  402.     stopFeature: function(feature) {
  403.         if (this.counter[feature]) {
  404.             Tools.writeLog('~Feature - ' + feature + ' stopped!\n');
  405.             clearInterval(this.counter[feature]);
  406.             this.counter[feature] = null;
  407.         }
  408.     },
  409.     startFeature: function(feature, opt) {
  410.         if (!this.counter[feature] && this[feature]) {
  411.             if (this[feature].queue) this[feature].queue.clearQueue();
  412.             Tools.writeLog('~Feature - ' + feature + ' initiated!\n');
  413.             this[feature].start(opt);
  414.         }
  415.     }
  416. };
  417.  
  418. if (typeof unsafeWindow !== 'undefined') unsafeWindow.Gpxplus = Gpxplus, unsafeWindow.Vars = Vars, unsafeWindow.Tools = Tools;
  419.  
  420. Gpxplus.init();
  421. /*
  422. Gpxplus.mobileWalker.init();
  423. Gpxplus.feeder.init(confirm('Online feeder?') ? 'today' : 'random', 1000);
  424. //Gpxplus.feeder.init('interactions/return', 1000);
  425. Gpxplus.party.start(!0);
  426. Gpxplus.shelter.start();
  427. Gpxplus.lab.start();
  428. Gpxplus.chest.start();*/
Advertisement
Add Comment
Please, Sign In to add comment