SHARE
TWEET

Untitled

a guest Dec 15th, 2015 373 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def xdrng(seed,j):
  2.   k = 0
  3.   while (k <= j):
  4.     newseed = seed
  5.     seed = (0x000043FD*(seed&0xFFFF)+((0x00000003*(seed&0xFFFF)+0x000043FD*int(seed/0x10000))&0xFFFF)*0x10000+0x00269EC3)&(0xFFFFFFFF) #formula
  6.     k += 1
  7.   return seed
  8.  
  9.  
  10.  
  11. 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 ']
  12.  
  13.  
  14. def genlist(seed):
  15.     m = 0
  16.     ms = []
  17.     genlistout = str(seed >> 30)
  18.     F = seed >> 30
  19.     checker = [0,0,0,0]
  20.     backseed = seed
  21.     advance = 8
  22.     while m < 35:
  23.      
  24.       backseed = xdrngr(backseed,0)
  25.       genlistout = str(backseed >> 30) + "|" + genlistout
  26. ##      if m == 4:
  27. ##        ais = genlistout[5] + genlistout[3] + genlistout[1]
  28. ##        advance = 3
  29. ##        for i in range(0,len(ais)):
  30. ##          if ais[i] == "0" and i < 3:
  31. ##            advance = i
  32. ##            
  33. ##          
  34. ##        advance = advance+5
  35.            
  36.       if m == advance-1:
  37.         F = backseed >> 30
  38.         ms = []
  39.         checker = [0,0,0,0]
  40.         genlistout = " M: " + genlistout
  41.       G = backseed >> 30
  42.       if ms == [] and G == F:
  43.         if m >= 8:
  44.           if "XXX" not in genlistout:
  45.             genlistout = "XXX" + genlistout
  46.       if G != 0:
  47.         if checker[G] != 1:
  48.           checker[G] = 1
  49.       if checker == [0,1,1,1]:
  50.         checker = [0,0,0,0]
  51.         ms.append(m)
  52.       m += 1
  53.     return genlistout
  54.    
  55.  
  56.  
  57. def rngcheck(rng1,rng2,rng3,rng4,rng5,rng6,rng7,rng8,rng9,rng10,rng11,rng12,i,seed,thresh):
  58.     rng2 = rng2 + 0x80000000
  59.     if rng2 > 0xFFFFFFFF:
  60.         rng2 = rng2 - 0x100000000
  61.     rng1 = str(hex(rng1))[2:]
  62.     rng1 = rng1.replace("L","")
  63.     rng2 = str(hex(rng2))[2:]
  64.     rng2 = rng2.replace("L","")
  65.     rng3 = str(hex(rng3))[2:]
  66.     rng3 = rng3.replace("L","")
  67.     rng4 = str(hex(rng4))[2:]
  68.     rng4 = rng4.replace("L","")
  69.     rng5 = str(hex(rng5))[2:]
  70.     rng5 = rng5.replace("L","")
  71.     rng6 = str(hex(rng6))[2:]
  72.     rng6 = rng6.replace("L","")
  73.     #rng7 = str(hex(rng7))[2:]
  74.     #rng7 = rng7.replace("L","")
  75.     rng8 = str(hex(rng8))[2:]
  76.     rng8 = rng8.replace("L","")
  77.     #rng9 = str(hex(rng9))[2:]
  78.     #rng9 = rng9.replace("L","")
  79.     rng10 = str(hex(rng10))[2:]
  80.     rng10 = rng10.replace("L","")
  81.     rng11 = str(hex(rng11))[2:]
  82.     rng11 = rng11.replace("L","")
  83.     rng12 = str(hex(rng12))[2:]
  84.     rng12 = rng12.replace("L","")
  85.  
  86.     while len(rng1) < 8:
  87.         rng1 = "0" + rng1
  88.     while len(rng2) < 8:
  89.         rng2 = "0" + rng2
  90.     while len(rng3) < 8:
  91.         rng3 = "0" + rng3
  92.     while len(rng4) < 8:
  93.         rng4 = "0" + rng4    
  94.     while len(rng5) < 8:
  95.         rng5 = "0" + rng5
  96.     while len(rng6) < 8:
  97.         rng6 = "0" + rng6
  98.     #while len(rng7) < 8:
  99.     #    rng7 = "0" + rng7
  100.     while len(rng8) < 8:
  101.         rng8 = "0" + rng8
  102.     #while len(rng9) < 8:
  103.         #rng9 = "0" + rng9
  104.     while len(rng10) < 8:
  105.         rng10 = "0" + rng10
  106.     while len(rng11) < 8:
  107.         rng11 = "0" + rng11
  108.     while len(rng12) < 8:
  109.         rng12 = "0" + rng12
  110.     ivs = [rng7,rng8,rng9,rng10,rng11,rng12]
  111.     IVs = [0,0,0,0,0,0]
  112.     SID = str(int(rng1[0:4],16))
  113.     PID = rng2[0:4] + rng3[0:4]
  114.     XDPID = rng4[0:4] + rng5[0:4]
  115.     XDIV = rng1[0:4]
  116.     for j in range(0,len(ivs)):
  117.         IVs[j] = iv(ivs[j])
  118.  
  119.    
  120.     if (IVs[3] + IVs[5] + IVs[2] + IVs[1] + IVs[0]) > thresh or (IVs[0] + IVs[2] + IVs[3] + IVs[4] + IVs[5]) > thresh:
  121.         nature = natures[int(PID,16)%25]
  122.         if nature in ['Adamant','Jolly  ','Modest ','Hasty  ','Naive  ','Calm   ','Impish ','Bold   ','Careful','Timid  ','Mild   ','Rash   ']:
  123.           XDIV = xdivs(XDIV)
  124.           genlistout = genlist(seed)
  125.           genlistend = genlistout[-7:]
  126.           advance = 3
  127.           #print genlistend
  128.           if genlistend[0] == "0":
  129.             advance = 7
  130.           if genlistend[2] == "0" and advance == 3:
  131.             advance = 5
  132.           if genlistend[4] == "0" and advance == 3:
  133.             advance = 3
  134.           if genlistend[6] == "0" and advance == 3:
  135.             advance = 3
  136.           mm = genlistout.index('M')
  137.           genlistout = genlistout[:mm+advance] + "T" + genlistout[mm+advance:]
  138.           genlistout = genlistout[2:]
  139.           #print advance
  140.           print "_______________________________________________________________________________"
  141.           print str(hex(seed))[:-1] + " " + PID +" " + nature + " " +str(IVs[0]) + "/"+str(IVs[1]) + "/"+str(IVs[2]) + "/"+str(IVs[4]) + "/"+str(IVs[5]) + "/"+str(IVs[3]) + " "  + "F: " + str(i+1) + " SID: " + SID + " " + XDPID
  142.           print "Probable generation pattern:                                     " + XDIV
  143.           print genlistout
  144.           print "_______________________________________________________________________________"
  145.          
  146. def xdrngr(seed,j):
  147.   k = 0
  148.   while (k <= j):
  149.     seedr = (0x00003155*(seed&0xFFFF)+((0x0000B9B3*(seed&0xFFFF)+0x00003155*int(seed/0x10000))&0xFFFF)*0x10000+0xA170F641)&(0xFFFFFFFF) #formula
  150.     seed = seedr
  151.     k += 1
  152.   return seedr
  153.        
  154.  
  155.  
  156. def iv(rng):
  157.     rng = rng[0:4]
  158.     rng = bin(int(rng,16))[2:]
  159.  
  160.     while len(rng) < 16:
  161.         rng = '0' + rng
  162.    # if rng == "0":
  163.     #  rng = rng[1:]
  164.     #  rng = "1" + rng
  165.     #else:
  166.     #  rng = rng[1:]
  167.    #   rng = "0" + rng
  168.     iv1 = (int(rng[-5:],2))
  169.     iv1 = int(rng,2) >> 11
  170.     return iv1
  171.  
  172. def xdivs(rng):
  173.   rng = bin(int(rng,16))[2:]
  174.   while len(rng) < 16:
  175.     rng = '0'+rng
  176.  
  177.   xdiv = str(int(rng[11:16],2)) + "/" + str(int(rng[6:11],2)) + "/" + str(int(rng[1:6],2))
  178.   return xdiv
  179.  
  180. def __main__(seed,frame,desir,thresh):
  181.  
  182.   i = 0
  183.   while i <  int(frame,10):
  184.        
  185.              
  186.       div = int(desir,10)
  187.       rng7 = xdrng(seed,6)
  188.       rng7 = str(hex(rng7))[2:]
  189.       rng7 = rng7.replace("L","")
  190.       rng9 = xdrng(seed,8)
  191.       rng9 = str(hex(rng9))[2:]
  192.       rng9 = rng9.replace("L","")
  193.       while len(rng7) < 8:
  194.         rng7 = '0' + rng7
  195.       while len(rng9) < 8:
  196.         rng9 = '0' + rng9
  197.        
  198.       testiv = iv(rng7)
  199.       if testiv >= div or div == 32:
  200.         testiv = iv(rng9)
  201.         if testiv >=div or div == 32:
  202.          
  203.           rng1 = xdrng(seed,0) #sid
  204.           rng2 = xdrng(rng1,0) #pidu
  205.           rng3 = xdrng(rng2,0) #pl
  206.           rng4 = xdrng(rng3,0) #spe
  207.           rng5 = xdrng(rng4,0) #spa
  208.           rng6 = xdrng(rng5,0) #spd
  209.           #rng7 = xdrng(seed,6)
  210.           rng8 = xdrng(seed,7) #spa
  211.           #rng9 = xdrng(seed,8)
  212.           rng10 = xdrng(seed,9)
  213.           rng11 = xdrng(rng10,0)
  214.           rng12 = xdrng(rng11,0)#spd
  215.        
  216.          
  217.           rngcheck(rng1,rng2,rng3,rng4,rng5,rng6,rng7,rng8,rng9,rng10,rng11,rng12,i,seed,thresh)
  218.           seed = rng1
  219.           i = i + 1
  220.         else:
  221.           i = i + 1
  222.           seed = xdrng(seed,0)
  223.       else:
  224.         i = i + 1
  225.         seed = xdrng(seed,0)
  226.  
  227.        
  228. again = "y"
  229. seed = raw_input('Seed = ')
  230. frame = raw_input('Frame = ')
  231. desir = raw_input('IV = ')
  232. seed = int(seed,16)
  233. thresh = int(raw_input("thresh = "))
  234. while again == "y":
  235.   __main__(seed,frame,desir,thresh)
  236.   again = raw_input("again y/n? ")
  237.   if again == "y":
  238.     seed = raw_input('Seed = ')
  239.     seed = int(seed,16)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top