Advertisement
rossy__

FFX Ghost Encounter Finder (no seed info included)

Jun 6th, 2021
1,140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.69 KB | None | 0 0
  1. seeds = []
  2. tidusrng = [125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, 139, 140, 140, 141, 141]
  3. auronrng = [260, 261, 262, 263, 264, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 291, 292, 293, 294]
  4. initialseed = ""
  5. seedsbase1 = [2100005341, 1700015771, 247163863, 891644838, 1352476256, 1563244181, 1528068162, 511705468, 1739927914, 398147329, 1278224951, 20980264, 1178761637, 802909981, 1130639188, 1599606659, 952700148, -898770777, -1097979074, -2013480859, -338768120, -625456464, -2049746478, -550389733, -5384772, -128808769, -1756029551, 1379661854, 904938180, -1209494558, -1676357703, -1287910319, 1653802906, 393811311, -824919740, 1837641861, 946029195, 1248183957, -1684075875, -2108396259, -681826312, 1003979812, 1607786269, -585334321, 1285195346, 1997056081, -106688232, 1881479866, 476193932, 307456100, 1290745818, 162507240, -213809065, -1135977230, -1272305475, 1484222417, -1559875058, 1407627502, 1206176750, -1537348094, 638891383, 581678511, 1164589165, -1436620514, 1412081670, -1538191350, -284976976, 706005400]
  6. seedsbase2 = [10259, 24563, 11177, 56952, 46197, 49826, 27077, 1257, 44164, 56565, 31009, 46618, 64397, 46089, 58119, 13090, 19496, 47700, 21163, 16247, 574, 18658, 60495, 42058, 40532, 13649, 8049, 25369, 9373, 48949, 23157, 32735, 29605, 44013, 16623, 15090, 43767, 51346, 28485, 39192, 40085, 32893, 41400, 1267, 15436, 33645, 37189, 58137, 16264, 59665, 53663, 11528, 37584, 18427, 59827, 49457, 22922, 24212, 62787, 56241, 55318, 9625, 57622, 7580, 56469, 49208, 41671, 36458]
  7.  
  8. def s32(n):
  9.     n = n & 0xffffffff
  10.     return (n ^ 0x80000000) - 0x80000000
  11.  
  12. def checkforghostencounter(seed):
  13.     if seed % 13 == 8:
  14.         return True
  15.     else:
  16.         return False
  17.  
  18. def tohex(val, nbits):
  19.     return hex((val + (1 << nbits)) % (1 << nbits))
  20.  
  21. def rngroll(index):
  22.     temp = s32(s32(seeds[index]) * s32(seedsbase1[index]) ^ seedsbase2[index])
  23.     temp = temp
  24.     temp = s32((temp >> 0x10) + (temp << 0x10))
  25.     seeds[index] = temp
  26.     temp = temp & 0x7fffffff
  27.     return temp
  28.  
  29. with open('./FFX10minuteSeeds.csv') as f:
  30.     lines = f.readlines()
  31.  
  32. print(len(lines))
  33.  
  34. Auron1 = int(input("Auron attack 1 damage: "))
  35.  
  36. if Auron1 > 294:
  37.     Auron1 /= 2
  38.  
  39. Tidus1 = int(input("Tidus attack 1 damage: "))
  40.  
  41. if Tidus1 > 141:
  42.     Tidus1 /= 2
  43.  
  44. Auron2 = int(input("Auron attack 2 damage: "))
  45.  
  46. if Auron2 > 294:
  47.     Auron2 /= 2
  48.  
  49. Tidus2 = int(input("Tidus attack 2 damage: "))
  50.  
  51. if Tidus2 > 141:
  52.     Tidus2 /= 2
  53.    
  54. Auron3 = int(input("Auron attack 3 damage: "))
  55.  
  56. if Auron3 > 294:
  57.     Auron3 /= 2
  58.  
  59. Tidus3 = int(input("Tidus attack 3 damage: "))
  60.  
  61. if Tidus3 > 141:
  62.     Tidus3 /= 2
  63.  
  64. searchline = str(int(Auron1)) + "," + str(int(Tidus1)) + "," + str(int(Auron2)) + "," + str(int(Tidus2)) + "," + str(int(Auron3)) + "," + str(int(Tidus3))
  65. print(searchline)
  66.  
  67. for line in lines:
  68.     #print(line[8:-1])
  69.     if searchline in line:
  70.         initialseed = int(line[0:8], 16)
  71.         print("Initial seed:", initialseed, "(", s32(initialseed), ")")
  72.  
  73. if initialseed == "":
  74.     print("Initial seed could not be found, exiting.")
  75.     exit()
  76.  
  77. initialseed = s32(initialseed)
  78.  
  79. #seeds rng array setup based on initial seed
  80. for i in range(68):
  81.     temp = (s32(initialseed) * s32(0x5d588b65)) + 0x3c35
  82.     temp = s32(temp)
  83.     temp = s32((temp >> 0x10) + (temp << 0x10))
  84.     initialseed = temp
  85.     temp = temp & 0x7fffffff
  86.     seeds.append(temp)
  87.  
  88. print(seeds)
  89. #seeds[1] = 10000
  90.  
  91. #print(seeds)
  92.  
  93. for _ in range(57):
  94.     rngroll(1)
  95.  
  96. for i in range(500):
  97.     roll = rngroll(1)
  98.     #input(roll)
  99.     if checkforghostencounter(roll):
  100.         print("Ghost encounter on random encounter", i + 1, "/ every encounter counted:", i + 1 + 57)
  101.     rngroll(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement