Ow guides n tricks

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Ow guides n tricks

Macros ow guides etc

Most active topics

Latest topics

» Badlands macro
Underling buffer EmptySun Jan 10, 2016 4:58 pm by Admin

» Trading wow stuff for ow stuff
Underling buffer EmptyTue Dec 08, 2015 11:26 pm by Admin

» Gold pot buyer
Underling buffer EmptyTue Dec 08, 2015 10:28 pm by Admin

» Underling buffer
Underling buffer EmptyTue Dec 08, 2015 10:25 pm by Admin

» Woz transfer python made by c0d3r
Underling buffer EmptyWed May 07, 2014 11:59 am by Admin

» Edcaa mob lists
Underling buffer EmptyMon Apr 07, 2014 5:33 pm by Admin

» Bookmark login
Underling buffer EmptySun Jan 12, 2014 5:08 pm by Admin

» Py Kix Potion quest items transfer
Underling buffer EmptyMon Sep 09, 2013 7:17 pm by Admin

» py edited version God arj
Underling buffer EmptyThu Mar 21, 2013 3:28 pm by Admin

Poll


    Underling buffer

    avatar
    Admin
    Admin


    Posts : 39
    Join date : 2011-11-18

    Underling buffer Empty Underling buffer

    Post  Admin Tue Dec 08, 2015 10:25 pm

    Code:
    import threading
    import time
    import urllib2
    import cookielib
    import os
    import sys
    import re
    import datetime
    from Queue import Queue

    cj = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
    opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]

    rg_sess_id = ""
    username = "username"
    password = "pasword"
    SERVER = "1"

    chars = []

    #anti-lag-opener
    def alo(url):
        lagsafe = 1
        while lagsafe == 1:
            try:
                site = opener.open(url)
                lagsafe = 0
            except IOError:
                print "URLError: Site not loading. Retrying..."
        return site

    def alo2(url, urla):
        lagsafe = 1
        while lagsafe == 1:
            try:
                site = opener.open(url, urla)
                lagsafe = 0
            except IOError:
                print "URLError: Site not loading. Retrying..."
        return site


    def msg(out):
        thetime = time.strftime("[%H:%M:%S]", time.localtime(time.time()))
        message = thetime + " " + out
        print message
        return message

    def getCharName(src):
        charName = ""
        try:
            charName = src.split('" selected>')[1].split('</option>')[0]
        except:
            msg("Could not retrieve character name.")

        return charName


    def loadTrustees(src):
        #myaccount_trust_remove.php?trustee=13333337&ac_serverid=1
        msg("Loading trustees")
        try:
            exp = re.compile('remove.php\?trustee=([0-9]+)&ac_serverid=')
            tmpTrustees = re.findall(exp, src)
            global chars
            chars = tmpTrustees
            msg(str(len(tmpTrustees)) + " found on this RGA")
        except IndexError:
            msg("No trustees found on this RGA")
        

    class castBuff(threading.Thread):
        def __init__(self, char):
            self.char = char
            self.result = None
            self.casted = False
            threading.Thread.__init__(self)

        def getResult(self):
            return self.result

        def getCasted():
            return self.casted
            
        def run(self):
            cID = self.char
            cast = alo("http://sigil.outwar.com/underlingtrust.php?suid="+cID+"&serverid=1&claim=1").read()
            if "You do not have permission to activate ling buff." in cast:
                msg("You do not have permission to activate ling buff on " + cID)
            elif "claimed from underlings!" in cast:
                msg("Ling buff casted on " + getCharName(cast))
            else:
                msg("Character has no trustees or is already casted")
                
            self.result = cast
            

    def startCasting(chars):
        def producer(q, chars):
            for i in range(len(chars)):
                thread = castBuff(chars[i])
                thread.start()
                q.put(thread, True)
     
        finished = []
        def consumer(q, total_chars):
            while len(finished) < total_chars:
                thread = q.get(True)
                thread.join()
                finished.append(thread.getResult())
     
        q = Queue(5)
        prod_thread = threading.Thread(target=producer, args=(q, chars,))
        cons_thread = threading.Thread(target=consumer, args=(q, len(chars),))
        prod_thread.start()
        cons_thread.start()
        prod_thread.join()
        cons_thread.join()

        msg("Finished casting ling buffs")
        return finished



    loginrga = alo2("http://"+SERVER+".outwar.com/myaccount.php", "login_username="+username+"&login_password="+password).read()
    login = alo("http://sigil.outwar.com/accounts.php?ac_serverid=1&rg_sess_id="+rg_sess_id).read()
    msg("Logged in")
    loadTrustees(login)
    z = startCasting(chars)


      Current date/time is Fri Apr 19, 2024 6:56 am