Advertisement
Guest User

Untitled

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