Guest User

Untitled

a guest
Dec 2nd, 2014
2,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.75 KB | None | 0 0
  1. #!/usr/local/bin/python2.7
  2.  
  3. #Xd seed checker for specified Gender and nature locks. Supports 1, 2 and 2 with 1 set cases of shadowmons
  4.  
  5. import math #import math library
  6. import operator #import operators
  7. doagain = 1
  8. if doagain == "y":
  9. seed = int(raw_input('newseed: ', 16))
  10. else:
  11. nsmons = int(raw_input('number of nonshadows: '), 10) #number of non shadow mons
  12. naturelocks = []
  13. for p in range (0,nsmons):
  14. n = int(raw_input('naturelock' + ' ' + str(p+1) + ' '), 10)
  15. naturelocks.append(n)
  16. genderlocks = []
  17. for z in range (0, nsmons):
  18. g = int(raw_input('genderlock array: ' + ' ' + str(z+1) + ' '), 10) #user inputted array of genderlocks. 0 for female, 1 for male
  19. genderlocks.append(g)
  20. gthresh = []
  21. for y in range (0, nsmons):
  22. gt = int(raw_input('genderthresholds: ' + ' ' + str(y+1) + ' '), 10) #gender thresholds
  23. gthresh.append(gt)
  24. #128 for 50:50 etc, 256 + 0 for genderless,
  25. case = int(raw_input('case: '), 10) #which case? 1: 1 shadowmon, 2: 2 shadowmons, one set 3: 2 shadowmons, first one not set 4: check both 12 and 14 (set nonset)
  26. #rngr
  27. #reverse rng, runs the PRNG state backwards for j iterations
  28. def rngr(seed,j):
  29. k = 0
  30. while (k < j):
  31. seedr = (0x00003155*(seed%65536)+((0x0000B9B3*(seed%65536)+0x00003155*math.floor(seed/65536))%65536)*65536+0xA170F641)%(4294967296) #formula
  32. seed = seedr
  33. k += 1
  34. return seedr
  35.  
  36. #rng
  37. #forward rng, runs PRNG state forwards for j iterations
  38. def rng(seed,j):
  39. k = 0
  40. while (k <= j):
  41. newseed = seed
  42. seed = (0x000043FD*(seed%65536)+((0x00000003*(seed%65536)+0x000043FD*math.floor(seed/65536))%65536)*65536+0x00269EC3)%(4294967296) #formula
  43. k += 1
  44. return seed
  45.  
  46. #Nature lock PID
  47. #Finds the nature lock based on user inputted case (1 shadow mon, 2 shadowmons,
  48. # 2 shadowmons, 1 set, check both)
  49. def findpid(seed,case):
  50. seedint = seed
  51. if case == 1:
  52. casen = 3
  53. if case == 2:
  54. casen = 8
  55. if case == 3:
  56. casen = 10
  57. if case == 4:
  58. casen = 8
  59. if case == 5:
  60. casen = 10
  61. pseed = int(rngr(seed,casen)) #run backwards appropriate amount per case
  62. seedint = int(rng(pseed,0)) #get the prng state one infront of pseed
  63. print "pseed: " + str(hex(pseed))
  64. lockpid = int(((pseed >> 16)*0x10000 + (seedint>>16))) #calc PID formula
  65. naturelock = int(lockpid%25) #get pid nature
  66. return lockpid
  67.  
  68. #nature array 0 - 24
  69. def nature(naturelock):
  70. natures = ['hardy', 'lonely', 'brave', 'adamant', 'naughty', 'bold', 'docile', 'relaxed', 'impish', 'lax', 'timid', 'hasty', 'serious', 'jolly', 'naive', 'modest', 'mild', 'quiet', 'bashful', 'rash', 'calm', 'gentle', 'sassy', 'careful', 'quirky']
  71. return natures[naturelock]
  72.  
  73. def main():
  74. for i in range(0,1):
  75. seed = int(raw_input('newseed: '), 16)
  76. inputseed = seed
  77. #main loop, finds the nature lock based on case and then does a logic loop to decide whether that matches what you want, if not it will output what is wrong.
  78. seedr = seed
  79. lockpid = int(findpid(seed, case))
  80. naturelock = int(lockpid%25)
  81. #obtain nature, genderval, ability of PIDlock
  82. print "PID and nature lock: " + str(hex(lockpid)) + " " + nature(int(lockpid%25)) + " " + str(int(lockpid%2)) + " " + str(int(lockpid%256))
  83. print "hex seed: " + str(hex(seedr))
  84. print " "
  85. check(naturelock, lockpid, seed, case, inputseed)
  86.  
  87.  
  88. #check all of the conditions for a match, gender/nature
  89. def check(naturelock, lockpid, seed, case, inputseed):
  90. if naturelock == naturelocks[0]:
  91. if genderlocks[0] == 1:
  92. if int(lockpid%256) >= gthresh[0]:
  93. listgen(naturelocks, genderlocks, gthresh, nsmons, inputseed, case)
  94. else:
  95. print "gender does not match"
  96. else:
  97. if int(lockpid%256) < gthresh[0]:
  98. listgen(naturelocks, genderlocks, gthresh, nsmons, inputseed, case)
  99. else:
  100. print "gender does not match"
  101. if case ==4:
  102. case = 5
  103. lockpid = int(findpid(seed,case))
  104. naturelock = int(lockpid%25)
  105. seed = seed
  106. check(naturelock, lockpid, seed, case, inputseed)
  107. doagain = raw_input("input another base seed? y/n ")
  108. print doagain
  109. if doagain == "y":
  110. main()
  111. if doagain == "n":
  112. quit()
  113. else:
  114. print "naturelock doesnt match"
  115. if case == 4:
  116. case = 5
  117. lockpid = int(findpid(seed,case))
  118. naturelock = int(lockpid%25)
  119. seed = seed
  120. check(naturelock, lockpid, seed, case, inputseed)
  121. doagain = raw_input("input another base seed? y/n ")
  122. print doagain
  123. if doagain == "y":
  124. main()
  125. if doagain == "n":
  126. quit()
  127.  
  128. #main list maker, will output a list of all frame matches based on your target (base seed) on frame 401, it will out put as many lists as non shadow mons + the corresponding nature/gender
  129. def listgen(naturelocks, genderlocks, gthresh, nsmons, inputseed, case):
  130. print "-----------------"
  131. print " "
  132. seed = inputseed
  133. d = 0
  134. matchlist = []
  135. currentpid = 0
  136. currentnature = 0
  137. pseed = int(rngr(seed,400))
  138. pseed0 = pseed
  139. for s in range(0,nsmons):
  140. pseed = pseed0
  141. matchlist = []
  142. pidlist = []
  143. for r in range(1,600):
  144. seedint = int(rng(pseed,0))
  145. currentpid = int((int((pseed >> 16)*0x10000) + int((seedint>>16))))
  146. currentnature = int(currentpid%25)
  147. pseed = seedint
  148. if currentnature == naturelocks[s]:
  149. if genderlocks[s] == 1:
  150. if int(currentpid%256) >= gthresh[s]:
  151. matchlist.append(r-4)
  152. a = int(currentpid)
  153. b = '%x' % a
  154. pidlist.append(b)
  155. else:
  156. if int(currentpid%256) < gthresh[s]:
  157. matchlist.append(r-4)
  158. a = int(currentpid)
  159. b = '%x' % a
  160. pidlist.append(b)
  161. if genderlocks[s] == 0:
  162. gender = "female"
  163. if genderlocks[s] == 1:
  164. gender = "male"
  165. if gthresh[s] == 256:
  166. gender = "genderless"
  167. print str(nature(naturelocks[s])) + " " + gender
  168. for y in range (1,len(matchlist)):
  169. print str(matchlist[y]) + " " + str(pidlist[y])
  170. print " "
  171. if case == 1:
  172. print "target on frame 401, primary nature lock on 394"
  173. if case == 2:
  174. print "target on frame 401, primary nature lock on 389"
  175. if case == 3:
  176. print "target on frame 401, primary nature lock on 387"
  177. if case == 4:
  178. print "target on frame 401, primary naturelock 387, (14)"
  179. if case == 5:
  180. print "target on frame 401, primary naturelock on 389, (12)"
  181. print " "
  182. print "-------------------"
  183. print " "
  184. doagain = raw_input("input another base seed? y/n ")
  185. print doagain
  186. if doagain == "y":
  187. main()
  188. if doagain == "n":
  189. quit()
  190. return doagain
  191.  
  192. # Execute Script:
  193. if __name__ == "__main__":
  194. main()
Advertisement
Add Comment
Please, Sign In to add comment