Advertisement
Guest User

Untitled

a guest
Mar 21st, 2013
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2. import datetime
  3. import urllib2
  4. import cookielib
  5. import os
  6. import sys
  7. import socket
  8. import re
  9. import threading
  10. socket.setdefaulttimeout(30.0)
  11.  
  12. cj = cookielib.CookieJar()
  13. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  14. opener.addheaders = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1 ID:20120614114901')]
  15.  
  16.  
  17. GOD_CHECK_TIME = 1 # The speed at which it rechecks for a raid in the room
  18. FORMER_ID = "" # Form account ID
  19. CAST_SIN = False # True or False to cast a SiN
  20. SIN_ID = "" # Optional if you set CAST_SIN to True
  21. rg_sess_id = "" # From typpo
  22.  
  23. chars = (["", "", "", ""])
  24. #global editables, dont touch these
  25. RAID_ID = ""
  26. RAID_NAME = ""
  27. _startTime = datetime.datetime.now()
  28. _finishTime = datetime.datetime.now()
  29.  
  30. #anti-lag-opener, alo=get alo2=post
  31. def alo(url):
  32. lagsafe = 1
  33. while lagsafe == 1:
  34. try:
  35. site = opener.open(url)
  36. lagsafe = 0
  37. except IOError:
  38. print "URLError: Site not loading. Retrying..."
  39. return site
  40.  
  41. def alo2(url, pData):
  42. lagsafe = 1
  43. while lagsafe == 1:
  44. try:
  45. site = opener.open(url, pData)
  46. lagsafe = 0
  47. except IOError:
  48. print "URLError: Site not loading. Retrying..."
  49. return site
  50.  
  51.  
  52. # Print a message with timestamp
  53. def msg(out):
  54. thetime = time.strftime("[%H:%M:%S]", time.localtime(time.time()))
  55. message = thetime + " " + out
  56. print message
  57. return message
  58.  
  59.  
  60. def getCharName(src):
  61. charName = "Unknown"
  62. try:
  63. charName = src.split('" selected>')[1].split('</option>')[0]
  64. except:
  65. msg("Could not retrieve character name.")
  66.  
  67. return charName
  68.  
  69. def iB(src, start, end):
  70. try:
  71. return src.split(start)[1].split(end)[0]
  72. except IndexError:
  73. msg("Could not retrieve the inbetween value.")
  74. return
  75.  
  76. def formRaid(formerID):
  77. one = 1
  78. while one == 1:
  79. try:
  80. global _startTime
  81. _startTime = datetime.datetime.now()
  82. srcworld = alo("http://sigil.outwar.com/ajax_changeroomb.php?suid=" + formerID + '&serverid=1').read()
  83.  
  84. if "009900" in srcworld:
  85.  
  86. raidLink = srcworld.split("formraid.php?target=")[1].split('\\">')[0]
  87. msg("***Raid spotted, forming raid.")
  88.  
  89. formpage = alo("http://sigil.outwar.com/formraid.php?target=" + raidLink).read()
  90. codeID = formpage.split('codeid" value="Join this Raid!">')[0]
  91.  
  92. Form = alo2("http://sigil.outwar.com/formraid.php?target=" + raidLink, "target=" + raidLink + "&codeid=" + codeID + "&formtime=3&submit=Launch!").read()
  93.  
  94. global RAID_ID, RAID_NAME
  95. RAID_ID = getRaidID(Form)
  96. RAID_NAME = getRaidName(Form)
  97.  
  98. msg("***" + RAID_NAME + " Formed.")
  99. one = 0
  100. return True
  101. else: raise IndexError
  102.  
  103. except IndexError:
  104. msg("God not spawned.")
  105. time.sleep(GOD_CHECK_TIME)
  106.  
  107.  
  108. def getRaidID(src):
  109. #raids = alo("http://sigil.outwar.com/crew_raidsforming.php")
  110. #srcraids = raids.read()
  111. try:
  112. return iB(src, "joinraid.php?raidid=", "&")
  113. except IndexError:
  114. msg("Couldn't retrieve raid ID")
  115. return False
  116.  
  117. def getRaidName(src):
  118. try:
  119. return iB(src, "<div ONMOUSEOVER=\"statspopup(event,'<b>", "</b>')\" ONMOUSEOUT=\"kill()\">")
  120. except IndexError:
  121. msg("Couldn't retrieve raid name")
  122. return False
  123.  
  124. def launchRaid(launchURL):
  125. x = 1
  126. while x == 1:
  127. try:
  128. launch = alo(launchURL).read()
  129. if "Your raid will launch shortly" in launch:
  130. msg("RAID LAUNCHED!")
  131. global _finishTime
  132. _finishTime = datetime.datetime.now()
  133. x = 0
  134. return True
  135. except IndexError:
  136. x = 1
  137. time.sleep(1)
  138.  
  139.  
  140. loginrpg = alo("http://sigil.outwar.com/myaccount.php?rg_sess_id=" + rg_sess_id + "&serverid=1&suid="+FORMER_ID)
  141. #loginrpg = alo2("http://sigil.outwar.com/myaccount.php", "login_username=" + username + "&login_password=" + password + "&serverid=1&suid="+FORMER_ID)
  142. msg("Logged in RGA\n")
  143.  
  144.  
  145. formRaid(FORMER_ID)
  146.  
  147. class ThreadClass(threading.Thread):
  148. def __init__(self, char):
  149. self.char = char
  150. threading.Thread.__init__(self)
  151.  
  152. def run(self):
  153. join = alo2('http://sigil.outwar.com/joinraid.php?raidid='+RAID_ID+'&suid='+self.char+'&serverid=1', "join=1").read()
  154. if "error" in join:
  155. x = 1
  156. while x == 1:
  157. join = alo2('http://sigil.outwar.com/joinraid.php?raidid='+RAID_ID+'&suid='+self.char+'&serverid=1', "join=1").read()
  158. if "Please click" in join:
  159. x = 0
  160.  
  161. time.sleep(0.2)
  162. msg("Joined character: " + getCharName(join))
  163.  
  164.  
  165. for i in range(len(chars)):
  166. t = ThreadClass(chars[i])
  167. t.start()
  168.  
  169. # Cast SiN
  170. if CAST_SIN == True:
  171. cast = alo2("http://sigil.outwar.com/cast_skills.php?C=5&suid="+SIN_ID, "castskillid=3015&cast=Cast+Skill").read()
  172. msg("Casted Strength in Numbers on " + getCharName(cast))
  173.  
  174. time.sleep(1)
  175. launchURL = 'http://sigil.outwar.com/joinraid.php?raidid=' + RAID_ID + '&suid=' + FORMER_ID + '&serverid=1&launchraid=yes&x=141&y=36'
  176. launchRaid(launchURL)
  177. tTime = _finishTime - _startTime
  178. msg("TOTAL RAID TIME: " + str(tTime.seconds) + " seconds.\n")
  179. time.sleep(200000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement