Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import cookielib
- import thread
- import re
- import os
- import webbrowser
- import sys
- import time
- import socket
- import threading
- from multiprocessing.dummy import Pool as ThreadPool
- #--------------------SETTINGS-----------
- username = '' #update
- password = '' #update
- server = "sigil" #update
- prefix = 'http://'+server+'.outwar.com/'
- mobnames = ["Fire Crusader", "Shadow Crusader", "Kinetic Crusader", "Arcane Crusader", "Holy Crusader"] ####exact names of mobs to attack, case sensitive
- numruns = 2 #number of runs to do on each char
- skills = ['3008', '3024', '3007', '17'] # id of skill to cast
- chars = [] # leave blank
- rg_sess = '' # leave blank
- rooms = rooms = [91,92,93,98,99,100,101,110,101,102,103,104,2344,2345,3824,3825,3824,2345,2346,2347,2356,2355,2356,2347,2348,2349,2350,2351,2350,2349,97,96,95,94,93,98,99,100,101,105,106,107,112,113,112,107,2335,2336,2337,2338,2339,2340,2341,2342,2343,3624,3625,3626,3627,3628,3627,3625,3624,2343,2342,2341,2340,2339,2338,2337,2336,2335,107,106,105,101,110]
- if server.lower() == 'sigil':
- serverid = '1'
- else:
- serverid = '2'
- #---------------Globals-----------
- rage = ""
- exp = ""
- lvl = ""
- curroom = ""
- north = ""
- east = ""
- west = ""
- south = ""
- totgold = 0
- totexp = 0
- totdrops = []
- #------------------Cookie-Jar----------
- socket.setdefaulttimeout(30.0)
- 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')]
- #------------------anti-lag-opener---------
- def alo(url):
- lagsafe = 1
- while lagsafe == 1:
- try:
- site = opener.open(url)
- lagsafe = 0
- except IOError:
- pass
- except Exception:
- pass
- return site
- def alo2(url, pData):
- lagsafe = 1
- while lagsafe == 1:
- try:
- site = opener.open(url, pData)
- lagsafe = 0
- except IOError:
- pass
- except Exception:
- pass
- return site
- #---------THREADER OLD-------------
- def multithread( threadName, delay):
- try:
- attacker = alo("http://"+server+".outwar.com/somethingelse.php?attackid="+attacklink[y]+"&userspawn=")
- except:
- pass
- #--------THREADER NEW--------------
- #Threader
- class ThreadClass(threading.Thread):
- def __init__(self, link, myself):
- self.link = link
- self.myself = myself
- threading.Thread.__init__(self)
- def run(self):
- global totgold, totexp, totdrops
- gained = []
- attacker = alo("http://"+server+".outwar.com/somethingelse.php?"+self.link+"&serverid=%s&rg_sess_id=%s&suid=%s" % (serverid, rg_sess, self.myself)).read()
- time.sleep(1)
- try:
- attname = attacker.split('/characters/')[1].split('</a')[0].split('">')[1]
- except IndexError:
- attname = ''
- if 'gold!' in attacker:
- gold = attacker.split(' gold!')[0].split('gained ')[-1]
- gained.append(gold + " gold ")
- totgold += int(gold)
- if 'experience!' in attacker:
- experi = attacker.split(' experience!')[0].split('gained ')[-1]
- gained.append(' '+experi + " experience!")
- totexp += int(experi)
- else:
- pass
- if 'win: found' in attacker.lower():
- found = attacker.split('WIN: Found ')[1].split('</b')[0]
- msg( attname+ " found "+found)
- totdrops.append(attname+ ': '+found)
- else:
- pass
- time.sleep(0.1)
- if len(gained) > 1:
- msg(attname + " gained " + '&'.join(gained))
- elif len(gained) == 1:
- msg(attname + " gained " + ''.join(gained))
- else:
- msg(attname + " gained nothing.")
- return
- #---------------Message with Time-------------
- def msg(out):
- thetime = time.strftime("[%H:%M:%S]", time.localtime(time.time()))
- message = thetime + " " + out
- print message
- return message
- #--------------------LOGIN-----------
- def login():
- loginrpg = alo2("http://"+server+".outwar.com/myaccount.php","login_username="+username+"&login_password="+password).read()
- msg("Starting Run")
- def owLogin():
- global rg_sess
- if len(rg_sess) == 0:
- loginrpg = alo2("http://%s.outwar.com/myaccount.php" % server, "login_username=%s&login_password=%s"%(username, password)).read()
- rg_sess = loginrpg.split('&rg_sess_id=')[1].split('">')[0]
- #---------------STATS---------------
- def stats():
- global rage, exp, lvl
- stats = alo("http://"+server+".outwar.com/userstats.php").read()
- splits = stats.split(":")
- for x in range(4):
- splits[x] = re.findall('"(.*?)"', splits[x])
- lvl = splits[1][0]
- exp = splits[3][0]
- rage = splits[2][0]
- #--------------WORLD------------
- def worldmove(nextroom, curroom, suid):
- global world
- world = alo("http://"+server+".outwar.com/ajax_changeroomb.php?suid="+suid+"&room="+nextroom+"&lastroom="+curroom+"&serverid=%s&rg_sess_id=%s" % (serverid, rg_sess)).read()
- #--------------Room Settings------------
- def room(x):
- global nextroom, prevroom
- nextroom = str(rooms[x])
- curroom = str(rooms[x-1])
- #msg(suid)
- #msg("nextroom = "+nextroom+" | curroom = "+curroom)
- def attack(world, mobname):
- attacklink = []
- mobinfo = world.split('size=')
- for x in mobinfo:
- if mobname.lower() in x.lower():
- x = x.split('\\"><img')[0].split('.php?')[1]
- attacklink.append(x)
- elif mobname not in x:
- pass
- return attacklink
- def attacking():
- for y in range(len(attacklink)):
- link = attacklink[y]
- #thread.start_new_thread( multithread, ("Attack", 0, ) )
- #t = ThreadClass(link)
- #t.start()
- def chargrab():
- global chars
- page = alo(prefix+'myaccount.php?ac_serverid='+serverid).read().lower().split('trustee access')[0].split('characters on this server')[-1].split('20px')
- for m in page:
- if 'suid=' in m:
- chars.append(m.split('suid=')[1].split('&server')[0])
- else:
- pass
- def skill(suid, skill):
- cast = alo2(prefix+"cast_skills.php?C=4&suid="+suid, "castskillid="+skill+"&serverid=%s&rg_sess_id=%s&cast=Cast+Skill" % (serverid, rg_sess))
- print 'Now casting ' +skill+ ' on '+suid
- def teleport(suid):
- tele = alo(prefix+'world.php?room=91&suid='+suid+'&serverid='+serverid+"&rg_sess_id=%s" % rg_sess)
- print 'Now teleporting on '+suid
- #-----------Program----------------
- def thisFunc(b):
- xvr = 0
- while xvr <= numruns:
- owLogin()
- for v in skills:
- skill(b,v)
- teleport(b)
- for x in range(len(rooms)):
- room(x)
- worldmove(nextroom, curroom, b)
- worldy = alo(prefix+'ajax_changeroomb.php?suid='+b+"&serverid=%s&rg_sess_id=%s" % (serverid, rg_sess)).read()
- for elk in mobnames:
- attacklink = attack(worldy, elk)
- for y in range(len(attacklink)):
- t = ThreadClass(attacklink[y], b)
- t.start()
- time.sleep(0.5)
- xvr += 1
- time.sleep(3)
- return
- owLogin()
- stats()
- chargrab()
- #xvr = 0
- ##while xvr <= numruns:
- ## for me in chars[0:5]:
- ## thisFunc(me)
- ## xvr += 1
- ## time.sleep(3)
- threadsss = []
- for me in chars[0:5]: ### set up indexing to only att with specific chars, otherwise att with whole rga
- g = threading.Thread(target=thisFunc, args=(me,))
- threadsss.append(g)
- g.start()
- #g.join()
- print 'Exp gained: '+str(totexp)
- print "Gold gained "+str(totgold)
- print "Drops: "+', '.join(totdrops)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement