Exemplo n.º 1
0
class BuriedTreasure:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def BuriedTreasure(self, username):
        self.functions.createTaskData('BuriedTreasure', username)
        if time.time() - float(
                self.functions.lastRun('BuriedTreasure', username)) >= 86400:
            resp = self.neo.get('pirates/buriedtreasure/buriedtreasure.phtml?',
                                'https://thedailyneopets.com/dailies')
            if not self.functions.contains(
                    resp.text,
                    'Your account must be at least <b>24</b> hours old to play'
            ):
                if not self.functions.contains(resp.text,
                                               'you have to wait another'):
                    x, y = random.randint(25, 450), random.randint(45, 460)
                    resp = self.neo.get(
                        'pirates/buriedtreasure/buriedtreasure.phtml?%s,%s' %
                        (x, y),
                        'http://www.neopets.com/pirates/buriedtreasure/buriedtreasure.phtml?'
                    )
                    gamePrize = self.functions.getBetween(
                        resp.text, '<b><center>', '</center></b>')
                    self.functions.log('Buried Treasure: %s' % gamePrize)
            else:
                self.functions.log(
                    'Buried Treasure: Your account is too young to play')
            self.functions.updateLastRun('BuriedTreasure', username)
Exemplo n.º 2
0
class Trudy:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Trudy(self, username):
        self.functions.createTaskData('Trudy', username)
        if time.time() - float(self.functions.lastRun('Trudy',
                                                      username)) >= 86400:
            resp = self.neo.get('trudys_surprise.phtml?delevent=yes',
                                'https://www.jellyneo.net/?go=dailies')
            if self.functions.contains(resp.text, '&slt=1'):
                result = self.functions.getBetween(resp.text, 'phtml?id=',
                                                   '" name="')
                resp = self.neo.get('trudydaily/slotgame.phtml?id=%s' % result,
                                    resp.url)
                results = self.functions.getBetween(resp.text, '\'key\': \'',
                                                    '\'};')
                resp = self.neo.post(
                    'trudydaily/ajax/claimprize.php', {
                        'action': 'getslotstate',
                        'key': results
                    },
                    'http://www.neopets.com/trudydaily/slotgame.phtml?id=%s' %
                    result)
                resp = self.neo.post('trudydaily/ajax/claimprize.php',
                                     {'action': 'beginroll'}, resp.url)
                self.neo.post('trudydaily/ajax/claimprize.php',
                              {'action': 'prizeclaimed'}, resp.url)
                self.functions.log('Trudy\'s Surprise: Done')
                self.functions.updateLastRun('Trudy', username)
            else:
                self.functions.log('Trudy\'s Surprise: Already done today')
Exemplo n.º 3
0
class KacheekSeek:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def KacheekSeek(self, username):
        self.functions.createTaskData('Kacheek', username)
        if time.time() - float(self.functions.lastRun('Kacheek',
                                                      username)) >= 86400:
            seek = True
            findingPlaces = [1, 2, 3, 4, 5]
            resp = self.neo.get('games/hidenseek.phtml',
                                'https://thedailyneopets.com/dailies')
            self.neo.get('games/hidenseek/0.phtml?xfn=', resp.url)
            while seek:
                random.shuffle(findingPlaces)
                for data in findingPlaces:
                    resp = self.neo.get(
                        'games/process_hideandseek.phtml?p=%s&game=0' % data,
                        'http://www.neopets.com/games/hidenseek/0.phtml?xfn=')
                    if self.functions.contains(resp.text,
                                               'Oh... you found me'):
                        gamePrize = self.functions.getBetween(
                            resp.text, 'You win <b>', '</b> Neopoints!!!')
                        self.functions.log('Kacheek Seek: Won %s NP!' %
                                           gamePrize)
                        break
                    if self.functions.contains(resp.text, 'Im SO BORED'):
                        self.functions.log(
                            'Kacheek Seek: Pet is bored, stopped')
                        self.functions.updateLastRun('Kacheek', username)
                        seek = False
                        break
Exemplo n.º 4
0
class FruitMachine:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def FruitMachine(self, username):
        self.functions.createTaskData('FruitMachine', username)
        if time.time() - float(self.functions.lastRun('FruitMachine',
                                                      username)) >= 86400:
            resp = self.neo.get('desert/fruit/index.phtml',
                                'https://thedailyneopets.com/dailies')
            if not self.functions.contains(
                    resp.text, 'Please come back tomorrow and try again'):
                result = self.functions.getBetween(resp.text,
                                                   'name="ck" value="', '">')
                resp = self.neo.post(
                    'desert/fruit/index.phtml', {
                        'spin': '1',
                        'ck': result
                    }, 'http://www.neopets.com/desert/fruit/index.phtml')
                if self.functions.contains(
                        resp.text, 'Sorry, this is not a winning spin'):
                    self.functions.log('Fruit Machine: Done')
                else:
                    self.functions.log('Fruit Machine: You won!')
            self.functions.updateLastRun('FruitMachine', username)
Exemplo n.º 5
0
class CoconutShy:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def CoconutShy(self, username):
        self.functions.createTaskData('CoconutShy', username)
        if time.time() - float(self.functions.lastRun('CoconutShy',
                                                      username)) >= 86400:
            resp = self.neo.get('halloween/coconutshy.phtml',
                                'https://thedailyneopets.com/dailies')
            if self.functions.contains(resp.text, 'Come back tomorrow'):
                self.functions.updateLastRun('CoconutShy', username)
                return
            ref = self.functions.getBetween(
                resp.text,
                'new SWFObject(\'http://images.neopets.com/halloween/', '\',')
            for _ in range(20):
                resp = self.neo.post(
                    'halloween/process_cocoshy.phtml?coconut=1&r=%s' %
                    random.randint(20000, 99999),
                    {'onData': '[type Function]'}, ref)
                result = self.functions.getBetween(resp.text, '&error=', '%21')
                if self.functions.contains(resp.text, '%2C'):
                    self.functions.log(
                        'Coconut Shy: %s' %
                        result.replace('+', ' ').replace('%2C', ''))
                else:
                    self.functions.log('Coconut Shy: %s' %
                                       result.replace('+', ' '))
            self.functions.updateLastRun('CoconutShy', username)
Exemplo n.º 6
0
class PoogleRace:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def PoogleRace(self, username):
        raceTimes = ['59', '14', '29', '44']
        betTimes = ['11', '26', '41', '56']
        now = datetime.now()
        current_time = now.strftime("%M")
        self.functions.createTaskData('PoogleRace', username)
        if time.time() - float(self.functions.lastRun('PoogleRace',
                                                      username)) >= 3600:
            for data in betTimes:
                if current_time == data:
                    resp = self.neo.get('faerieland/poogleracing/start.phtml')
                    winner = resp.text[-1]
                    resp = self.neo.post(
                        'faerieland/process_pooglebetting.phtml', {
                            'poogle': winner,
                            'bet': '300',
                            'obj_info_id': '0'
                        },
                        'http://www.neopets.com/faerieland/pooglebetting.phtml'
                    )
                    if self.functions.contains(resp.url, 'thanks'):
                        self.functions.log(
                            'Poogle Race: Placed a bet on poogle #%s' % winner)
                        self.functions.updateLastRun('PoogleRace', username)
        self.functions.createTaskData('PoogleRaceFinish', username)
        if time.time() - float(
                self.functions.lastRun('PoogleRaceFinish', username)) >= 3600:
            for data in raceTimes:
                if current_time == data:
                    resp = self.neo.get('faerieland/poogleracing.phtml')
                    if self.functions.contains(
                            resp.text,
                            'Please come back when the race starts!!!'):
                        time.sleep(60)
                        self.neo.post(
                            'faerieland/poogleracing.phtml?type=viewrace',
                            {'rand': random.randint(1, 999)},
                            'http://www.neopets.com/faerieland/poogleracing.phtml'
                        )
                        time.sleep(random.randint(5, 10))
                        resp = self.neo.post(
                            'faerieland/poogleracing.phtml',
                            {'type': 'collect'},
                            'http://www.neopets.com/faerieland/poogleracing.phtml?type=viewrace'
                        )
                        result = self.functions.getBetween(
                            resp.text, 'You win <b>', '</b> NP back')
                        self.functions.log('Poogle Race: You won %sNP!' %
                                           result)
                        self.functions.updateLastRun('PoogleRaceFinish',
                                                     username)
Exemplo n.º 7
0
class RichSlorg:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def RichSlorg(self, username):
        self.functions.createTaskData('RichSlorg', username)
        if time.time() - float(self.functions.lastRun('RichSlorg', username)) >= 86400:
            self.neo.get('shop_of_offers.phtml?slorg_payout=yes', 'https://thedailyneopets.com/dailies')
            self.functions.log('Rich Slorg: Done')
            self.functions.updateLastRun('RichSlorg', username)
Exemplo n.º 8
0
class Shrine:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Shrine(self, username):
        self.functions.createTaskData('Shrine', username)
        if time.time() - float(self.functions.lastRun('Shrine', username)) >= 46800:
            resp = self.neo.post('desert/shrine.phtml', {'type': 'approach'}, 'http://www.neopets.com/desert/shrine.phtml')
            if not self.functions.contains(resp.text, 'Maybe you should wait'):
                self.functions.log('Coltzans Shrine: Done')
            self.functions.updateLastRun('Shrine', username)
Exemplo n.º 9
0
class Jelly:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Jelly(self, username):
        self.functions.createTaskData('Jelly', username)
        if time.time() - float(self.functions.lastRun('Jelly', username)) >= 86400:
            resp = self.neo.post('jelly/jelly.phtml', {'type': 'get_jelly'}, 'http://www.neopets.com/jelly/jelly.phtml')
            if self.functions.contains(resp.text, 'You take some <b>'):
                result = self.functions.getBetween(resp.text, 'some <b>', '</b>!!!')
                self.functions.log('Giant Jelly: Grabbed %s' % result)
            self.functions.updateLastRun('Jelly', username)
Exemplo n.º 10
0
class Obsidian:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Obsidian(self, username):
        self.functions.createTaskData('Obsidian', username)
        if time.time() - float(self.functions.lastRun('Obsidian',
                                                      username)) >= 86400:
            resp = self.neo.get('magma/quarry.phtml',
                                'https://thedailyneopets.com/dailies')
            if self.functions.contains(resp.text, 'Shiny Obsidian'):
                self.functions.log('Obsidian Quarry: Received Shiny Obsidian')
            self.functions.updateLastRun('Obsidian', username)
Exemplo n.º 11
0
class Snowager:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Snowager(self, username):
        self.functions.createTaskData('Snowager', username)
        if time.time() - float(self.functions.lastRun('Snowager',
                                                      username)) >= 10800:
            resp = self.neo.get(
                'winter/snowager2.phtml',
                'http://www.neopets.com/winter/snowager.phtml')
            if not self.functions.contains(
                    resp.text, 'You dont want to try and enter again'):
                if self.functions.contains(resp.text, 'icy blast at you'):
                    if self.functions.contains(resp.text,
                                               'You are now eligible to use'):
                        self.functions.log(
                            'Snowager: Blasted - Received Avatar')
                    else:
                        self.functions.log('Snowager: Blasted')
                else:
                    self.functions.log('Snowager: Done')
            else:
                self.functions.log('Snowager: It\'s too soon to visit')
            self.functions.updateLastRun('Snowager', username)
Exemplo n.º 12
0
class Stocks:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Stocks(self, username):
        self.functions.createTaskData('Stocks', username)
        if time.time() - float(self.functions.lastRun('Stocks',
                                                      username)) >= 86400:
            resp = self.neo.get(
                'stockmarket.phtml?type=list&full=true',
                'http://www.neopets.com/stockmarket.phtml?type=buy')
            data = 15
            tryAgain = 15
            for _ in range(3):
                stock = list(
                    set(
                        re.findall(r'<b>(\w+?) %s [-\+]\d+?<\/b>' % data,
                                   resp.text)))
                if not stock:
                    tryAgain += 1
                    self.functions.log(
                        'Stock Buyer: No stocks for %s found, trying %s..' %
                        (data, tryAgain))
                    data += 1
                if stock:
                    resp = self.neo.get(
                        'stockmarket.phtml?type=buy',
                        'http://www.neopets.com/stockmarket.phtml?type=list&full=true'
                    )
                    stockHash = self.functions.getBetween(
                        resp.text, '&_ref_ck=', '\';')
                    resp = self.neo.post(
                        'process_stockmarket.phtml', {
                            '_ref_ck': stockHash,
                            'type': 'buy',
                            'ticker_symbol': stock[0],
                            'amount_shares': '1000'
                        }, 'http://www.neopets.com/stockmarket.phtml?type=buy')
                    if self.functions.contains(resp.text,
                                               'purchase limit of 1000'):
                        self.functions.log(
                            'Stock Buyer: You can\'t buy more than 1000 shares per day'
                        )
                    elif self.functions.contains(resp.text,
                                                 'You cannot afford'):
                        self.functions.log(
                            'Stock Buyer: You don\'t have enough neopoints')
                    elif not self.functions.contains(resp.text,
                                                     'purchase limit of 1000'):
                        if not self.functions.contains(resp.text,
                                                       'You cannot afford'):
                            self.functions.log(
                                'Stock Buyer: Purchased 1000 shares of %s for %s'
                                % (stock[0], data))
                    break
            self.functions.updateLastRun('Stocks', username)
Exemplo n.º 13
0
class Lottery:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Lottery(self, username):
        self.functions.createTaskData('Lottery', username)
        if time.time() - float(self.functions.lastRun('Lottery',
                                                      username)) >= 86400:
            self.neo.get('games/lottery.phtml',
                         'https://thedailyneopets.com/dailies')
            for _ in range(20):
                nums = [x for x in range(1, 31)]
                random.shuffle(nums)
                resp = self.neo.post(
                    'games/process_lottery.phtml', {
                        'one': nums[0],
                        'two': nums[1],
                        'three': nums[2],
                        'four': nums[3],
                        'five': nums[4],
                        'six': nums[5]
                    }, 'http://www.neopets.com/games/lottery.phtml')
                if self.functions.contains(resp.text,
                                           'you cannot buy any more'):
                    self.functions.log(
                        'Lottery: You can\'t buy anymore tickets')
                    break
                self.functions.log(
                    'Lottery: Purchased ticket - %s, %s, %s, %s, %s, %s' %
                    (nums[0], nums[1], nums[2], nums[3], nums[4], nums[5]))
            self.functions.log('Lottery: Done')
            self.functions.updateLastRun('Lottery', username)
Exemplo n.º 14
0
class SDB:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def deposit(self):
        arr = 1
        resp = self.neo.get('quickstock.phtml')
        items = "<TD align=\"left\">"
        results = resp.text.count(items)
        if results:
            item_ids = re.findall('value="(.*)"><TD', resp.text)
            data = {}
            data['buyitem'] = 0
            for item in item_ids:
                data['id_arr[%s]' % arr] = item
                data['radio_arr[%s]' % arr] = 'deposit'
                arr += 1
            data['checkall'] = 'on'
            self.neo.post('process_quickstock.phtml', data,
                          'http://www.neopets.com/quickstock.phtml')
            self.functions.log('SDB: Sent %s items to your SDB' % results)
Exemplo n.º 15
0
class DiceaRoo:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def DiceaRoo(self, username):
        self.functions.createTaskData('DiceaRoo', username)
        if time.time() - float(self.functions.lastRun('DiceaRoo',
                                                      username)) >= 86400:
            resp = self.neo.get('games/dicearoo.phtml')
            gameHash = self.functions.getBetween(resp.text, 'ck\' value=\'',
                                                 '\'>')
            resp = self.neo.post('games/play_dicearoo.phtml', {
                'raah': 'init',
                '_ref_ck': gameHash
            }, resp.url)
            resp = self.neo.post('games/play_dicearoo.phtml', {
                'type': 'start',
                'raah': 'init',
                '_ref_ck': gameHash
            }, resp.url)
            while True:
                if self.functions.contains(resp.text, 'Im SO BORED of'):
                    self.functions.log('Dice-a-Roo AP: Pet is bored')
                    break
                if self.functions.contains(resp.text,
                                           'Oh dear, that means Game Over'):
                    resp = self.neo.post('games/dicearoo.phtml', None,
                                         resp.url)
                    resp = self.neo.post('games/play_dicearoo.phtml', {
                        'raah': 'init',
                        '_ref_ck': gameHash
                    }, resp.url)
                    resp = self.neo.post('games/play_dicearoo.phtml', {
                        'type': 'start',
                        'raah': 'init',
                        '_ref_ck': gameHash
                    }, resp.url)
                if not self.functions.contains(
                        resp.text, 'Oh dear, that means Game Over'):
                    resp = self.neo.post('games/play_dicearoo.phtml', {
                        'raah': 'continue',
                        '_ref_ck': gameHash
                    }, resp.url)
                if self.functions.contains(resp.text, 'Im SO BORED of'):
                    self.functions.log('Dice-a-Roo AP: Pet is bored')
                    break
                GameDice = self.functions.getBetween(resp.text, '<br><b>',
                                                     ' Dice-A-Roo</b>')
                gameResult = self.functions.getBetween(
                    resp.text, '</td></tr><tr><td align=center><i>',
                    '</i>').replace('<B>', '').replace('</B>', '').replace(
                        '<b>', '').replace('</b>', '').replace('  ',
                                                               ' ').strip()
                self.functions.log('Dice-a-Roo AP [%s Dice]: %s' %
                                   (GameDice, gameResult))
            self.functions.updateLastRun('DiceaRoo', username)
Exemplo n.º 16
0
class SnowballAB:
    def __init__(self, neo):
        self.neo = neo
        self.sdb = SDB(self.neo)
        self.functions = Functions()
        self.BuyDelay = None
        self.getSettings()

    def getSettings(self):
        self.BuyDelay = int(
            self.functions.getSettings('BuyDelay').split(':')[1].strip())

    def SnowballAB(self, username):
        self.functions.createTaskData('SnowballAB', username)
        if self.BuyDelay < 1800:
            self.BuyDelay = 1800
        if time.time() - float(self.functions.lastRun(
                'SnowballAB', username)) >= self.BuyDelay:
            resp = self.neo.get('faerieland/springs.phtml')
            currentNp = self.functions.getNp(resp.text)
            if currentNp >= 25:
                resp = self.neo.post(
                    'faerieland/springs.phtml', {'type': 'purchase'},
                    'http://www.neopets.com/faerieland/springs.phtml')
                if self.functions.contains(resp.text,
                                           'buy one item every 30 minutes'):
                    self.functions.log(
                        'Snowball AB: Can\'t Buy A Snowball Yet!')
                else:
                    self.neo.get(
                        'faerieland/process_springs.phtml?obj_info_id=8429',
                        'http://www.neopets.com/faerieland/springs.phtml')
                    self.functions.log(
                        'Snowball AB: Purchased x1 Sticky Snowball!')
                    self.sdb.deposit()
            else:
                self.functions.log(
                    'Snowball AB: You don\'t have enough neopoints to buy a snowball!'
                )
            self.functions.updateLastRun('SnowballAB', username)
Exemplo n.º 17
0
class Cheat:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Cheat(self, username):
        self.functions.createTaskData('Cheat', username)
        if time.time() - float(self.functions.lastRun('Cheat',
                                                      username)) >= 86400:
            cardVal = 1
            resp = self.neo.get('games/cheat/index.phtml')
            resp = self.neo.post('games/cheat/cheat.phtml', None, resp.url)
            while True:
                if self.functions.contains(resp.text, ' of cheating!'):
                    currentPlayed = self.functions.getBetween(
                        resp.text, ' played ', ' ')
                    if currentPlayed == '4':
                        cheater = self.functions.getBetween(
                            resp.text, '"CheatYes" VALUE="', '"><BR>')
                        resp = self.neo.post('games/cheat/cheat.phtml',
                                             {'CheatYes': cheater}, resp.url)
                        if self.functions.contains(resp.text,
                                                   'NOT CHEATING!!!'):
                            cheater = self.functions.getBetween(
                                resp.text, '<BR>but ', ' was <b>NOT')
                            self.functions.log(
                                'Accused %s of cheating, %s was not cheating' %
                                (cheater, cheater))
                        resp = self.neo.post('games/cheat/cheat.phtml', None,
                                             resp.url)
                    else:
                        notCheating = self.functions.getBetween(
                            resp.text, '"CheatNo" VALUE="', '">')
                        resp = self.neo.post('games/cheat/cheat.phtml',
                                             {'CheatNo': notCheating},
                                             resp.url)
                        resp = self.neo.post('games/cheat/cheat.phtml', None,
                                             resp.url)
                if self.functions.contains(resp.text,
                                           'You have won this round'):
                    if self.functions.contains(
                            resp.text, 'You have beaten the hardest level'):
                        self.functions.log(
                            'Cheat AP: You won the hardest stage')
                        resp = self.neo.post('games/cheat/cheat.phtml',
                                             {'x_reset': '1'}, resp.url)
                        self.functions.updateLastRun('Cheat', username)
                        break
                    self.functions.log('Cheat AP: You won the round')
                    resp = self.neo.post('games/cheat/cheat.phtml',
                                         {'x_continue': '1'}, resp.url)
                    resp = self.neo.post('games/cheat/cheat.phtml', None,
                                         resp.url)
                elif self.functions.contains(resp.text,
                                             'You will have to defeat'):
                    resp = self.neo.post('games/cheat/cheat.phtml',
                                         {'x_continue': '1'}, resp.url)
                    resp = self.neo.post('games/cheat/cheat.phtml', None,
                                         resp.url)
                if self.functions.contains(resp.text, 'Select Card Value'):
                    ourCards = re.findall(r'games/cards/(.*?)_', resp.text)
                    mostCommon = max(set(ourCards), key=ourCards.count)
                    ourValues = re.findall(
                        rf'<img src=\'http://images.neopets.com/games/cards/{mostCommon}(.*?)\' height=90 width=70',
                        resp.text)
                    das = self.functions.getBetween(resp.text,
                                                    'das1.value = \'', '\';')
                    if int(mostCommon) == 14:
                        cardData = {
                            'jk_pc1': '',
                            'jk_pc2': '',
                            'jk_pc3': '',
                            'jk_pc4': '',
                            'das1': das,
                            'x_claim': '1'
                        }
                    else:
                        cardData = {
                            'jk_pc1': '',
                            'jk_pc2': '',
                            'jk_pc3': '',
                            'jk_pc4': '',
                            'das1': das,
                            'x_claim': mostCommon
                        }
                    for data in ourValues:
                        cardData['jk_pc%s' %
                                 cardVal] = self.functions.getBetween(
                                     data, 'name=\'', '"')
                        cardVal += 1
                    cardVal = 1
                    resp = self.neo.post('games/cheat/cheat.phtml', cardData,
                                         resp.url)
                    if int(mostCommon) > 10:
                        curCard = None
                        if mostCommon == '11':
                            curCard = 'Jack'
                        elif mostCommon == '12':
                            curCard = 'Queen'
                        elif mostCommon == '13':
                            curCard = 'King'
                        elif mostCommon == '14':
                            curCard = 'Ace'
                        self.functions.log(
                            'Cheat AP: Played %s x%s' %
                            (curCard, ourCards.count(mostCommon)))
                    else:
                        self.functions.log(
                            'Cheat AP: Played %s x%s' %
                            (mostCommon, ourCards.count(mostCommon)))
                    resp = self.neo.post('games/cheat/cheat.phtml', None,
                                         resp.url)
Exemplo n.º 18
0
class Gormball:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def Gormball(self, username):
        self.functions.createTaskData('Gormball', username)
        if time.time() - float(self.functions.lastRun('Gormball',
                                                      username)) >= 86400:
            resp = self.neo.get('space/gormball.phtml')
            gameHash = self.functions.getBetween(resp.text, '\'xcn\' value=\'',
                                                 '\'>')
            resp = self.neo.post('space/gormball2.phtml', {
                'xcn': gameHash,
                'player_backed': random.randint(1, 8)
            }, resp.url)
            while True:
                if self.functions.contains(resp.text, 'Im SO BORED of'):
                    self.functions.log('Gormball AP: Pet is bored')
                    break
                lastCharacter = self.functions.getBetween(
                    resp.text, '_character\' value=\'', '\'>')
                pageCount = self.functions.getBetween(resp.text,
                                                      '_count\' value=', '><')
                if lastCharacter == 'You':
                    resp = self.neo.post(
                        'space/gormball2.phtml', {
                            'type': 'moveon',
                            'page_count': pageCount,
                            'xcn': gameHash,
                            'turns_waited': '1',
                            'last_character': lastCharacter
                        }, resp.url)
                    if self.functions.contains(
                            resp.text,
                            '<b>You are the last remaining character!!! You have won!!!</b>'
                    ):
                        self.functions.log('Gormball AP: You Won!')
                        resp = self.neo.get('space/gormball.phtml', resp.url)
                        resp = self.neo.post(
                            'space/gormball2.phtml', {
                                'xcn': gameHash,
                                'player_backed': random.randint(1, 8)
                            }, resp.url)
                elif lastCharacter != 'You':
                    resp = self.neo.post(
                        'space/gormball2.phtml', {
                            'type': 'moveon',
                            'page_count': pageCount,
                            'xcn': gameHash,
                            'last_character': lastCharacter
                        }, resp.url)
                    if self.functions.contains(
                            resp.text,
                            '<b>You are the last remaining character!!! You have won!!!</b>'
                    ):
                        self.functions.log('Gormball AP: You Won!')
                        resp = self.neo.get('space/gormball.phtml', resp.url)
                        resp = self.neo.post(
                            'space/gormball2.phtml', {
                                'xcn': gameHash,
                                'player_backed': random.randint(1, 8)
                            }, resp.url)
                if self.functions.contains(resp.text,
                                           'Oh dear, you are out of the game'):
                    scoredPoints = self.functions.getBetween(
                        resp.text, 'You scored <b>', '</b> points!')
                    self.functions.log(
                        'Gormball AP: Game Over - You scored %s points' %
                        scoredPoints)
                    resp = self.neo.get('space/gormball.phtml', resp.url)
                    resp = self.neo.post('space/gormball2.phtml', {
                        'xcn': gameHash,
                        'player_backed': random.randint(1, 8)
                    }, resp.url)
                if self.functions.contains(resp.text,
                                           'The Gormball explodes on '):
                    gormballExplodes = self.functions.getBetween(
                        resp.text, 'The Gormball explodes on ', '!!!</b>')
                    self.functions.log(
                        'Gormball AP: The Gormball explodes on %s' %
                        gormballExplodes)
                    pageCount = self.functions.getBetween(
                        resp.text, '_count\' value=', '><')
                    resp = self.neo.post('space/gormball2.phtml', {
                        'xcn': gameHash,
                        'type': 'moveon',
                        'page_count': pageCount
                    }, resp.url)
                if self.functions.contains(resp.text, 'Im SO BORED of'):
                    self.functions.log('Gormball AP: Pet is bored')
                    break
            self.functions.updateLastRun('Gormball', username)
Exemplo n.º 19
0
class ShapeShifter(threading.Thread):
    def __init__(self, neo):
        threading.Thread.__init__(self)
        self.neo = neo
        self.x = 0
        self.y = 0
        self.input = ''
        self.numberOfShapes = 0
        self.functions = Functions()

    def getBetween(self, data, first, last):
        start = data.find(first)
        end = data.find(last, start + len(first))
        if start == -1 or end == -1:
            return -1
        else:
            return data[start + len(first):end]

    def getBetweenAll(self, data, first, last):
        list = []
        while data.find(first) != -1 and data.find(
                last,
                data.find(first) + len(first)) != 1:
            start = data.find(first)
            end = data.find(last, start + len(first))
            list.append(data[start + len(first):end])
            data = data[end + len(last):]
        return list

    def restartGame(self):
        for _ in range(20):
            self.neo.get(
                'medieval/process_shapeshifter.phtml?type=action&posx=2&posy=3',
                'http://www.neopets.com/medieval/shapeshifter.phtml')

    def ShapeShifter(self, username):
        self.functions.createTaskData('ShapeShifter', username)
        if time.time() - float(self.functions.lastRun('ShapeShifter',
                                                      username)) >= 86400:
            play = True
            while play:
                resp = self.neo.post(
                    'medieval/process_shapeshifter.phtml', {'type': 'init'},
                    'http://www.neopets.com/medieval/shapeshifter_index.phtml')
                resp = self.neo.get('medieval/shapeshifter.phtml')
                level = self.getLevel(resp.text)
                self.functions.log('Shape Shifter: Working on level %s' %
                                   level)
                self.parseData(resp.text)
                solver = solvePuzzle(self.input)
                solver.run()
                if vars.output == None or vars.output[0] == '':
                    self.functions.log(
                        'Shape Shifter: Unable to solve the puzzle, getting a new puzzle..'
                    )
                    self.restartGame()
                    self.ShapeShifter(username)
                else:
                    self.functions.log('Shape Shifter: Found the solution!')
                    output = vars.output
                if output[1]:
                    movelist = [(0, 0)] * self.numberOfShapes
                else:
                    movelist = eval(output[0])
                for move in movelist:
                    resp = self.neo.get(
                        'medieval/process_shapeshifter.phtml?type=action&posx=%s&posy=%s'
                        % (move[0], move[1]), resp.url)
                    self.functions.log(
                        'Shape Shifter: Placing a piece at position %s, %s' %
                        (move[0], move[1]))
                    if self.functions.contains(resp.text, 'You Won!'):
                        self.functions.log('Shape Shifter: You won!')
                        self.numberOfShapes = 0
                        self.input = ''
                        self.y = 0
                        self.x = 0
                    if self.functions.contains(
                            resp.text,
                            'You\'ve reached your max neopoints on this game for today!'
                    ):
                        self.functions.log(
                            'Shape Shifter: You\'ve reached the daily limit')
                        play = False
                        break
            self.functions.updateLastRun('ShapeShifter', username)

    def getLevel(self, data):
        return int(
            self.getBetween(data, '<b><big>LEVEL ', '</big></b></center>'))

    def sendInput(self, data):
        self.input += str(data) + ' '

    def processData(self, data):
        n = 0
        l = -1
        shape = self.getBetweenAll(data, "<tr>", "</tr>")
        for i in range(len(shape)):
            shape[i] = self.getBetweenAll(shape[i], "<td", "/td>")
            for j in range(len(shape[i])):
                if "<img" in shape[i][j]:
                    shape[i][j] = 1
                    n += 1
                else:
                    shape[i][j] = 0
            if l == -1:
                l = len(shape[i])
            elif l != len(shape[i]):
                self.functions.log("Shape Shifter: Shape Error")
            elif len(shape[i]) > self.x:
                self.functions.log("Shape Shifter: Shape Error")
        if len(shape) > self.y:
            self.functions.log("Shape Shifter: Shape Error")
        self.sendInput(n)
        for y in range(len(shape)):
            for x in range(len(shape[y])):
                if shape[y][x]:
                    self.sendInput(x + (y * self.x))

    def parseData(self, data):
        self.x = int(self.getBetween(data, 'gX = ', ';'))
        self.sendInput(self.x)
        self.y = int(self.getBetween(data, 'gY = ', ';'))
        self.sendInput(self.y)
        l = {}
        t = self.getBetween(data, "<table border=1 bordercolor='gray'>",
                            "</table>")
        t = self.getBetweenAll(t, "<td valign=top>", "</td>")
        for i in range(len(t) - 1, 0, -1):
            if "arrow" in t[i]:
                del t[i]
        for i in range(len(t)):
            tt = self.getBetween(
                t[i], "http://images.neopets.com/medieval/shapeshifter/", "_")
            if "GOAL" in t[i]:
                goal = i
            if tt != -1 and tt not in l:
                l[tt] = i
        bt = self.getBetween(data, "function mouseAction", "}")
        bt = self.getBetweenAll(bt, '] = "', '"')
        for i in range(len(bt)):
            self.sendInput(l[bt[i]])
        self.sendInput(goal)
        shapeDataList = self.getBetween(data, "ACTIVE SHAPE",
                                        "<center><b><big>")
        shapeDataList = self.getBetween(shapeDataList, "<table", "/table><br>")
        shapeDataList = [self.getBetween(shapeDataList, "<table", "/table>")]
        if "LAST SHAPE" not in data:
            ts = self.getBetween(data, "NEXT SHAPE", "<p")
            if "NEXT SHAPES" in data:
                ts = ts[ts.find("<table") + 1:]
            ts = self.getBetweenAll(ts, "<table", "/table>")
            shapeDataList.extend(ts)
        self.numberOfShapes = len(shapeDataList)
        self.sendInput(len(shapeDataList))
        for data in shapeDataList:
            self.processData(data)
        pass
Exemplo n.º 20
0
class BankManager:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()

    def createBank(self):
        resp = self.neo.get('bank.phtml')
        currentNp = self.functions.getNp(resp.text)
        accountType = {
            0: 0,
            1000: 1,
            2500: 2,
            5000: 3,
            10000: 4,
            25000: 5,
            50000: 6,
            75000: 7,
            100000: 8,
            250000: 9,
            500000: 10,
            1000000: 11,
            2000000: 12,
            5000000: 13,
            7500000: 14,
            10000000: 15
        }
        available = {}
        for key, value in accountType.items():
            if currentNp > key:
                available[key] = value
        bankType = list(available.keys())[-1]
        resp = self.neo.post(
            'process_bank.phtml', {
                'type': 'new_account',
                'name': 'x',
                'add1': 'n',
                'employment': 'Chia Custodian',
                'salary': '10,000 NP and below',
                'account_type': str(available[bankType]),
                'initial_deposit': str(bankType)
            }, resp.url)
        if self.functions.contains(resp.text, 'Activation Code'):
            self.functions.log(
                'Bank Manager: Your account isn\'t activated, unable to create a bank account'
            )
        else:
            self.functions.log('Bank Manager: Created a bank account')

    def depositNp(self, np):
        resp = self.neo.get('bank.phtml')
        if self.functions.contains(
                resp.text,
                'I see you don\'t currently have an account with us.'):
            self.createBank()
        self.neo.post('process_bank.phtml', {
            'type': 'deposit',
            'amount': str(np)
        }, 'http://www.neopets.com/bank.phtml')
        self.functions.log('Bank Manager: Deposited %s NP!' % np)

    def withdrawNp(self, np, pin):
        resp = self.neo.get('bank.phtml')
        if self.functions.contains(
                resp.text,
                'I see you don\'t currently have an account with us.'):
            self.createBank()
        if self.functions.contains(resp.text, 'Enter your'):
            self.neo.post('process_bank.phtml', {
                'type': 'withdraw',
                'amount': str(np),
                'pin': str(pin)
            }, 'http://www.neopets.com/bank.phtml')
        else:
            self.neo.post('process_bank.phtml', {
                'type': 'withdraw',
                'amount': str(np)
            }, 'http://www.neopets.com/bank.phtml')
        self.functions.log('Bank Manager: Withdrew %s NP!' % np)

    def BankManager(self, username):
        self.functions.createTaskData('BankManager', username)
        if time.time() - float(self.functions.lastRun('BankManager',
                                                      username)) >= 86400:
            resp = self.neo.get('bank.phtml')
            if self.functions.contains(
                    resp.text,
                    'I see you don\'t currently have an account with us.'):
                self.createBank()
            if self.functions.contains(
                    resp.text,
                    'You have already collected your interest today'):
                self.functions.log(
                    'Bank Manager: You already collected your interest today')
            elif self.functions.contains(resp.text, 'Collect Interest ('):
                interest = self.functions.getBetween(resp.text,
                                                     'allow you to gain <b>',
                                                     ' NP</b> per ')
                resp = self.neo.post('process_bank.phtml',
                                     {'type': 'interest'}, resp.url)
                self.functions.log('Bank Manager: Collected %s NP interest' %
                                   interest)
            self.functions.updateLastRun('BankManager', username)
Exemplo n.º 21
0
class Wheels:
    def __init__(self, neo):
        self.neo = neo
        self.functions = Functions()
        
    def wheelOfExcitement(self, username):
        self.functions.createTaskData('wheelOfExcitement', username)
        if time.time() - float(self.functions.lastRun('wheelOfExcitement', username)) >= 7200:
            resp = self.neo.get('faerieland/wheel.phtml')
            if self.functions.contains(resp.text, 'already spun this wheel'):
                self.functions.log('Wheel of Excitement: Already spun this wheel')
            if not self.functions.contains(resp.text, 'already spun this wheel'):
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '2', 'http://www.neopets.com/%s' % ref.strip())
                if self.functions.contains(resp.text, 'wheelofexcitement.gif'):
                    self.functions.log('Wheel of Excitement: Done, received the avatar')
                else:
                    self.functions.log('Wheel of Excitement: Done')
            self.functions.updateLastRun('wheelOfExcitement', username)
    
    def wheelOfMediocrity(self, username):
        self.functions.createTaskData('wheelOfMediocrity', username)
        if time.time() - float(self.functions.lastRun('wheelOfMediocrity', username)) >= 2400:
            resp = self.neo.get('prehistoric/mediocrity.phtml')
            if self.functions.contains(resp.text, 'Come back, uh, whenever'):
                self.functions.log('Wheel of Mediocrity: Already spun this wheel')
            if not self.functions.contains(resp.text, 'Come back, uh, whenever'):
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '3', 'http://www.neopets.com/%s' % ref.strip())
                if self.functions.contains(resp.text, 'mediocrity.gif'):
                    self.functions.log('Wheel of Mediocrity: Done, received the avatar')
                else:
                    self.functions.log('Wheel of Mediocrity: Done')
            self.functions.updateLastRun('wheelOfMediocrity', username)

    def wheelOfMisfortune(self, username):
        self.functions.createTaskData('wheelOfMisfortune', username)
        if time.time() - float(self.functions.lastRun('wheelOfMisfortune', username)) >= 7200:
            resp = self.neo.get('halloween/wheel/index.phtml')
            if self.functions.contains(resp.text, 'Come back later'):
                self.functions.log('Wheel of Misfortune: Already spun this wheel')
            if not self.functions.contains(resp.text, 'Come back later'):
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '4', 'http://www.neopets.com/%s' % ref.strip())
                self.functions.log('Wheel of Misfortune: Done')
            self.functions.updateLastRun('wheelOfMisfortune', username)

    def wheelOfKnowledge(self, username):
        self.functions.createTaskData('wheelOfKnowledge', username)
        if time.time() - float(self.functions.lastRun('wheelOfKnowledge', username)) >= 86400:
            resp = self.neo.get('medieval/knowledge.phtml')
            if self.functions.contains(resp.text, 'already spun this wheel'):
                self.functions.log('Wheel of Knowledge: Already spun this wheel')
            if not self.functions.contains(resp.text, 'already spun this wheel'):
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '1', 'http://www.neopets.com/%s' % ref.strip())
                if self.functions.contains(resp.text, 'brightvale.gif'):
                    self.functions.log('Wheel of Knowledge: Done, received the avatar')
                else:
                    self.functions.log('Wheel of Knowledge: Done')
            self.functions.updateLastRun('wheelOfKnowledge', username)

    def wheelOfExtravagance(self, username):
        self.functions.createTaskData('wheelOfExtravagance', username)
        if time.time() - float(self.functions.lastRun('wheelOfExtravagance', username)) >= 86400:
            resp = self.neo.get('desert/extravagance.phtml')
            if self.functions.contains(resp.text, 'already spun the wheel today'):
                self.functions.log('Wheel of Extravagance: Already spun this wheel')
            if not self.functions.contains(resp.text, 'already spun the wheel today'):
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '6', 'http://www.neopets.com/%s' % ref.strip())
                if self.functions.contains(resp.text, 'extravagance.gif'):
                    self.functions.log('Wheel of Extravagance: Done, received the avatar')
                else:
                    self.functions.log('Wheel of Extravagance: Done')
            self.functions.updateLastRun('wheelOfExtravagance', username)

    def wheelOfMonotony(self, username):
        self.functions.createTaskData('monotonystart', username)
        if time.time() - float(self.functions.lastRun('monotonystart', username)) >= 86400:
            self.functions.createTaskData('monotony1', username)
            if time.time() - float(self.functions.lastRun('monotony1', username)) >= 86400:
                resp = self.neo.get('prehistoric/monotony/monotony.phtml')
                if self.functions.contains(resp.text, 'already spun'):
                    self.functions.log('Wheel of Monotony: Already spun this wheel')
                if not self.functions.contains(resp.text, 'already spun'):
                    ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                    resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x1aWheelService.startMonotony\x00\x02/1\x00\x00\x00\x05\x0a\x00\x00\x00\x00', 'http://www.neopets.com/%s' % ref.strip())
                    self.functions.log('Wheel of Monotony: Started spinning the wheel, checking back in 2 hours')
                self.functions.updateLastRun('monotony1', username)
                self.functions.createTaskData('monotonycollect', username)
                self.functions.updateLastRun('monotonycollect', username)
            if time.time() - float(self.functions.lastRun('monotonycollect', username)) >= 7200:
                ref = self.functions.getBetween(resp.text, 'http://images.neopets.com/wheels', ', \'flash_')
                resp = self.neo.amf('http://www.neopets.com/amfphp/gateway.php', '\x00\x03\x00\x00\x00\x01\x00\x16WheelService.spinWheel\x00\x02/1\x00\x00\x00\t\n\x00\x00\x00\x01\x02\x00\x01%s' % '5', 'http://www.neopets.com/%s' % ref.strip())
                if self.functions.contains(resp.text, 'monotony.gif'):
                    self.functions.log('Wheel of Monotony: Done, received the avatar')
                else:
                    self.functions.log('Wheel of Monotony: Done')
                self.functions.updateLastRun('monotonystart', username)
                self.functions.updateLastRun('monotonycollect', username)