Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 KB | None | 0 0
  1. import urllib2
  2. import cookielib
  3. import thread
  4. import re
  5. import os
  6. import webbrowser
  7. import sys
  8. import time
  9. import socket
  10. import threading
  11. from multiprocessing.dummy import Pool as ThreadPool
  12. #--------------------SETTINGS-----------
  13. username = '' #update
  14. password = '' #update
  15. server = "sigil" #update
  16. prefix = 'http://'+server+'.outwar.com/'
  17. mobnames = ["Fire Crusader", "Shadow Crusader", "Kinetic Crusader", "Arcane Crusader", "Holy Crusader"] ####exact names of mobs to attack, case sensitive
  18. numruns = 2 #number of runs to do on each char
  19. skills = ['3008', '3024', '3007', '17'] # id of skill to cast
  20. chars = [] # leave blank
  21. rg_sess = '' # leave blank
  22. 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]
  23. if server.lower() == 'sigil':
  24. serverid = '1'
  25. else:
  26. serverid = '2'
  27. #---------------Globals-----------
  28. rage = ""
  29. exp = ""
  30. lvl = ""
  31. curroom = ""
  32. north = ""
  33. east = ""
  34. west = ""
  35. south = ""
  36. totgold = 0
  37. totexp = 0
  38. totdrops = []
  39. #------------------Cookie-Jar----------
  40. socket.setdefaulttimeout(30.0)
  41.  
  42. cj = cookielib.CookieJar()
  43. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  44. opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]
  45.  
  46. #------------------anti-lag-opener---------
  47. def alo(url):
  48. lagsafe = 1
  49. while lagsafe == 1:
  50. try:
  51. site = opener.open(url)
  52. lagsafe = 0
  53. except IOError:
  54. pass
  55. except Exception:
  56. pass
  57. return site
  58.  
  59. def alo2(url, pData):
  60. lagsafe = 1
  61. while lagsafe == 1:
  62. try:
  63. site = opener.open(url, pData)
  64. lagsafe = 0
  65. except IOError:
  66. pass
  67. except Exception:
  68. pass
  69. return site
  70. #---------THREADER OLD-------------
  71. def multithread( threadName, delay):
  72. try:
  73.  
  74. attacker = alo("http://"+server+".outwar.com/somethingelse.php?attackid="+attacklink[y]+"&userspawn=")
  75.  
  76. except:
  77. pass
  78. #--------THREADER NEW--------------
  79. #Threader
  80. class ThreadClass(threading.Thread):
  81. def __init__(self, link, myself):
  82. self.link = link
  83. self.myself = myself
  84. threading.Thread.__init__(self)
  85. def run(self):
  86. global totgold, totexp, totdrops
  87. gained = []
  88. attacker = alo("http://"+server+".outwar.com/somethingelse.php?"+self.link+"&serverid=%s&rg_sess_id=%s&suid=%s" % (serverid, rg_sess, self.myself)).read()
  89. time.sleep(1)
  90. try:
  91. attname = attacker.split('/characters/')[1].split('</a')[0].split('">')[1]
  92. except IndexError:
  93. attname = ''
  94. if 'gold!' in attacker:
  95. gold = attacker.split(' gold!')[0].split('gained ')[-1]
  96. gained.append(gold + " gold ")
  97. totgold += int(gold)
  98. if 'experience!' in attacker:
  99. experi = attacker.split(' experience!')[0].split('gained ')[-1]
  100. gained.append(' '+experi + " experience!")
  101. totexp += int(experi)
  102. else:
  103. pass
  104. if 'win: found' in attacker.lower():
  105. found = attacker.split('WIN: Found ')[1].split('</b')[0]
  106. msg( attname+ " found "+found)
  107. totdrops.append(attname+ ': '+found)
  108. else:
  109. pass
  110.  
  111. time.sleep(0.1)
  112. if len(gained) > 1:
  113. msg(attname + " gained " + '&'.join(gained))
  114. elif len(gained) == 1:
  115. msg(attname + " gained " + ''.join(gained))
  116. else:
  117. msg(attname + " gained nothing.")
  118. return
  119.  
  120. #---------------Message with Time-------------
  121. def msg(out):
  122. thetime = time.strftime("[%H:%M:%S]", time.localtime(time.time()))
  123. message = thetime + " " + out
  124. print message
  125. return message
  126.  
  127. #--------------------LOGIN-----------
  128. def login():
  129. loginrpg = alo2("http://"+server+".outwar.com/myaccount.php","login_username="+username+"&login_password="+password).read()
  130. msg("Starting Run")
  131. def owLogin():
  132. global rg_sess
  133. if len(rg_sess) == 0:
  134. loginrpg = alo2("http://%s.outwar.com/myaccount.php" % server, "login_username=%s&login_password=%s"%(username, password)).read()
  135. rg_sess = loginrpg.split('&rg_sess_id=')[1].split('">')[0]
  136. #---------------STATS---------------
  137. def stats():
  138. global rage, exp, lvl
  139. stats = alo("http://"+server+".outwar.com/userstats.php").read()
  140. splits = stats.split(":")
  141. for x in range(4):
  142. splits[x] = re.findall('"(.*?)"', splits[x])
  143. lvl = splits[1][0]
  144. exp = splits[3][0]
  145. rage = splits[2][0]
  146.  
  147. #--------------WORLD------------
  148. def worldmove(nextroom, curroom, suid):
  149. global world
  150. 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()
  151. #--------------Room Settings------------
  152. def room(x):
  153. global nextroom, prevroom
  154. nextroom = str(rooms[x])
  155. curroom = str(rooms[x-1])
  156. #msg(suid)
  157. #msg("nextroom = "+nextroom+" | curroom = "+curroom)
  158. def attack(world, mobname):
  159. attacklink = []
  160.  
  161. mobinfo = world.split('size=')
  162. for x in mobinfo:
  163. if mobname.lower() in x.lower():
  164. x = x.split('\\"><img')[0].split('.php?')[1]
  165. attacklink.append(x)
  166. elif mobname not in x:
  167. pass
  168. return attacklink
  169. def attacking():
  170. for y in range(len(attacklink)):
  171. link = attacklink[y]
  172. #thread.start_new_thread( multithread, ("Attack", 0, ) )
  173. #t = ThreadClass(link)
  174. #t.start()
  175. def chargrab():
  176. global chars
  177. page = alo(prefix+'myaccount.php?ac_serverid='+serverid).read().lower().split('trustee access')[0].split('characters on this server')[-1].split('20px')
  178. for m in page:
  179. if 'suid=' in m:
  180. chars.append(m.split('suid=')[1].split('&server')[0])
  181. else:
  182. pass
  183.  
  184. def skill(suid, skill):
  185. cast = alo2(prefix+"cast_skills.php?C=4&suid="+suid, "castskillid="+skill+"&serverid=%s&rg_sess_id=%s&cast=Cast+Skill" % (serverid, rg_sess))
  186. print 'Now casting ' +skill+ ' on '+suid
  187. def teleport(suid):
  188. tele = alo(prefix+'world.php?room=91&suid='+suid+'&serverid='+serverid+"&rg_sess_id=%s" % rg_sess)
  189. print 'Now teleporting on '+suid
  190. #-----------Program----------------
  191. def thisFunc(b):
  192. xvr = 0
  193. while xvr <= numruns:
  194. owLogin()
  195. for v in skills:
  196. skill(b,v)
  197. teleport(b)
  198. for x in range(len(rooms)):
  199. room(x)
  200. worldmove(nextroom, curroom, b)
  201. worldy = alo(prefix+'ajax_changeroomb.php?suid='+b+"&serverid=%s&rg_sess_id=%s" % (serverid, rg_sess)).read()
  202. for elk in mobnames:
  203. attacklink = attack(worldy, elk)
  204. for y in range(len(attacklink)):
  205. t = ThreadClass(attacklink[y], b)
  206. t.start()
  207. time.sleep(0.5)
  208. xvr += 1
  209. time.sleep(3)
  210. return
  211.  
  212. owLogin()
  213. stats()
  214. chargrab()
  215. #xvr = 0
  216.  
  217. ##while xvr <= numruns:
  218. ## for me in chars[0:5]:
  219. ## thisFunc(me)
  220. ## xvr += 1
  221. ## time.sleep(3)
  222. threadsss = []
  223. for me in chars[0:5]: ### set up indexing to only att with specific chars, otherwise att with whole rga
  224. g = threading.Thread(target=thisFunc, args=(me,))
  225. threadsss.append(g)
  226. g.start()
  227. #g.join()
  228. print 'Exp gained: '+str(totexp)
  229. print "Gold gained "+str(totgold)
  230. print "Drops: "+', '.join(totdrops)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement