Created
July 8, 2021 21:12
-
-
Save Grayfox96/8c082969f68fb86b91ff3b208753bf24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# needs ffxhd-raw-rng12-values.csv and ffxhd-raw-rng13-values.csv placed in the same folder to work | |
import csv | |
damage_rolls = {} | |
damage_rolls['auron'] = {} | |
damage_rolls['tidus'] = {} | |
damage_rolls['possible_rolls'] = {} | |
damage_rolls['possible_rolls']['tidus'] = (125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141) | |
damage_rolls['possible_rolls']['auron'] = (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) | |
# get damage rolls and check them | |
damage_rolls_input = input('Damage rolls (Auron1 Tidus1 A2 T2 A3 T3): ') | |
damage_rolls_input = damage_rolls_input.replace(',', ' ') | |
damage_rolls_input = damage_rolls_input.replace('-', ' ') | |
damage_rolls_input = damage_rolls_input.replace('/', ' ') | |
damage_rolls_input = damage_rolls_input.replace('\\', ' ') | |
damage_rolls['auron'][1], damage_rolls['tidus'][1], damage_rolls['auron'][2], damage_rolls['tidus'][2], damage_rolls['auron'][3], \ | |
damage_rolls['tidus'][3] = [int(roll) for roll in damage_rolls_input.split()] | |
for key, roll in damage_rolls['auron'].items(): | |
if roll not in damage_rolls['possible_rolls']['auron']: | |
if roll / 2 not in damage_rolls['possible_rolls']['auron']: | |
print(f'Invalid damage roll: {roll}') | |
else: | |
damage_rolls['auron'][key] = roll // 2 | |
for key, roll in damage_rolls['tidus'].items(): | |
if roll not in damage_rolls['possible_rolls']['tidus']: | |
if roll / 2 not in damage_rolls['possible_rolls']['tidus']: | |
print(f'Invalid damage roll: {roll}') | |
else: | |
damage_rolls['tidus'][key] = roll // 2 | |
# get rng12 and rng13 seeds | |
def get_current_seed(rng_file, damage_rolls_dict): | |
rng_file_reader = csv.reader(open(rng_file), delimiter=',') | |
line_count = 0 | |
for line in rng_file_reader: | |
if line_count == 0: | |
pass | |
else: | |
if all([damage_rolls['auron'][1] == int(line[0]), damage_rolls['auron'][2] == int(line[2]), damage_rolls['auron'][3] == int(line[4]), | |
damage_rolls['tidus'][1] == int(line[1]), damage_rolls['tidus'][2] == int(line[3]), damage_rolls['tidus'][3] == int(line[5])]): | |
return line, True, line_count | |
line_count += 1 | |
current_equipment_seed, seed_found, seed_number = get_current_seed('ffxhd-raw-rng12-values.csv', damage_rolls) | |
current_abilities_seed, seed_found, seed_number = get_current_seed('ffxhd-raw-rng13-values.csv', damage_rolls) | |
if seed_found: | |
print('Seed found!') | |
print(f'Seed number is {seed_number}') | |
else: | |
print('Seed not found!') | |
quit() | |
# not useful for now | |
def get_number_of_dropped_equipment(): | |
for i in range(8): | |
yield i | |
while True: | |
yield -1 | |
def get_rng_generator(seed_array): | |
# first 6 values of the array are the seed damage rolls | |
i = 6 | |
while True: | |
yield int(seed_array[i]) | |
i += 1 | |
def get_prize_struct(enemy): | |
enemy = enemy.lower() | |
if enemy == 'kimahri': | |
prize_struct_string = '64 00 03 00 04 00 00 00 FF 00 FF FF 49 20 49 20 00 00 00 00 02 02 00 00 49 20 49 20 00 00 00 00 04 04 00 00 00 20 00 20 01 01 00 20 01 08 01 03 10 0D 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 0B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 0B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 00 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 6B 80 03 01 96' | |
elif enemy == 'garuda': | |
prize_struct_string = '1E 00 08 00 0C 00 00 00 FF 00 FF FF 46 20 46 20 00 00 00 00 01 01 00 00 46 20 46 20 00 00 00 00 02 02 00 00 28 20 28 20 01 02 00 20 01 07 01 03 10 0E 00 00 47 80 47 80 62 80 62 80 62 80 62 80 62 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 00 00 47 80 47 80 66 80 66 80 66 80 66 80 66 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 0B 80 47 80 47 80 62 80 62 80 62 80 62 80 62 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 0B 80 47 80 47 80 62 80 62 80 62 80 62 80 62 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 00 00 47 80 47 80 62 80 62 80 62 80 62 80 62 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 00 00 47 80 47 80 66 80 66 80 66 80 66 80 66 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 00 00 47 80 47 80 62 80 62 80 62 80 62 80 62 80 00 00 49 80 49 80 49 80 49 80 49 80 49 80 49 80 00 01 2D' | |
elif enemy == 'dingo': | |
prize_struct_string = '10 00 02 00 04 00 00 00 FF 00 FF 0C 46 20 46 20 00 00 00 00 01 01 00 00 46 20 46 20 00 00 00 00 02 02 00 00 00 20 25 20 01 01 25 20 04 05 01 03 10 0D 00 00 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 00 00 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 0B 80 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 0B 80 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 00 00 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 00 00 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 00 00 26 80 2A 80 22 80 1E 80 7C 80 7C 80 7C 80 00 00 6E 80 6E 80 41 80 41 80 41 80 45 80 45 80 00 01 18' | |
elif enemy == 'sin fin': | |
prize_struct_string = '64 00 0A 00 0F 00 00 00 FF 00 FF FF 47 20 47 20 00 00 00 00 01 01 00 00 47 20 47 20 00 00 00 00 02 02 00 00 00 20 00 20 01 01 00 20 01 06 01 03 10 0D 00 00 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 00 00 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 0B 80 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 0B 80 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 00 00 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 00 00 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 00 00 22 80 22 80 22 80 22 80 22 80 22 80 22 80 00 00 27 80 27 80 23 80 23 80 2B 80 2B 80 1F 80 03 01 96' | |
elif enemy == 'echuilles': | |
prize_struct_string = '73 00 0C 00 12 00 00 00 FF 00 FF FF 49 20 49 20 00 00 00 00 02 02 00 00 49 20 49 20 00 00 00 00 04 04 00 00 00 20 00 20 01 01 00 20 01 06 01 03 10 0D 00 00 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 00 00 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 0B 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 0B 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 00 00 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 00 00 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 00 00 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 2A 80 00 00 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 2B 80 03 01 AC' | |
elif enemy == 'ragora': | |
prize_struct_string = '30 00 14 00 28 00 6A 30 FF 00 FF 10 47 20 47 20 00 00 00 00 01 01 00 00 47 20 47 20 00 00 00 00 02 02 00 00 0A 20 0F 20 01 01 0F 20 08 06 01 03 10 0D 00 00 3B 80 3B 80 3B 80 62 80 62 80 62 80 62 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 00 00 3B 80 3B 80 3B 80 66 80 66 80 66 80 66 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 0B 80 3B 80 3B 80 3B 80 62 80 62 80 62 80 62 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 0B 80 3B 80 3B 80 3B 80 62 80 62 80 62 80 62 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 00 00 3B 80 3B 80 3B 80 62 80 62 80 62 80 62 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 00 00 3B 80 3B 80 3B 80 66 80 66 80 66 80 66 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 00 00 3B 80 3B 80 3B 80 62 80 62 80 62 80 62 80 00 00 3D 80 3D 80 3D 80 3D 80 3D 80 72 80 72 80 00 01 48' | |
elif enemy == 'killer bee': | |
prize_struct_string = '17 00 09 00 12 00 00 00 FF 00 FF 0C 48 20 48 20 00 00 00 00 01 01 00 00 48 20 48 20 00 00 00 00 02 02 00 00 0A 20 2D 20 01 01 2D 20 01 06 01 03 10 0D 00 00 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 00 00 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 0B 80 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 0B 80 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 00 00 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 00 00 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 00 00 26 80 2A 80 22 80 1E 80 7E 80 7E 80 7E 80 00 00 76 80 76 80 3D 80 3D 80 3D 80 3D 80 3D 80 00 01 22' | |
elif enemy == 'yellow elemental': | |
prize_struct_string = '1B 00 09 00 12 00 00 00 FF 00 FF 0C 48 20 46 20 00 00 00 00 01 01 00 00 48 20 46 20 00 00 00 00 02 02 00 00 0B 20 31 20 01 01 31 20 02 06 01 03 10 0D 00 00 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 00 00 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 0B 80 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 0B 80 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 00 00 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 00 00 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 00 00 26 80 2A 80 26 80 1E 80 7E 80 7E 80 7E 80 00 00 6A 80 6A 80 4D 80 4D 80 4D 80 4D 80 4D 80 00 01 28' | |
elif enemy == 'machina': | |
prize_struct_string = '55 00 07 00 0A 00 00 00 FF 00 FF 0C 01 20 02 20 00 00 00 00 01 01 00 00 01 20 02 20 00 00 00 00 02 02 00 00 00 20 00 20 01 01 00 20 01 09 01 03 10 0D 00 00 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 00 00 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 0B 80 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 0B 80 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 00 00 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 00 00 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 00 00 26 80 26 80 22 80 22 80 2A 80 2A 80 1E 80 00 00 61 80 5E 80 5F 80 61 80 60 80 5F 80 5E 80 00 01 7F' | |
elif enemy == 'ghost': | |
prize_struct_string = '2A 03 AA 05 7F 08 6F 30 FF 00 FF 3C 47 20 47 20 00 00 00 00 01 01 00 00 47 20 47 20 00 00 00 00 02 02 00 00 06 20 32 20 02 01 07 20 26 0C 01 03 10 0D 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 0B 80 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 0B 80 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 07 BF' | |
# default to ghost | |
else: prize_struct_string = '2A 03 AA 05 7F 08 6F 30 FF 00 FF 3C 47 20 47 20 00 00 00 00 01 01 00 00 47 20 47 20 00 00 00 00 02 02 00 00 06 20 32 20 02 01 07 20 26 0C 01 03 10 0D 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 0B 80 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 0B 80 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 00 68 80 68 80 68 80 67 80 67 80 67 80 7D 80 00 00 1D 80 1D 80 1D 80 31 80 31 80 77 80 77 80 00 07 BF' | |
prize_struct = [int(value, 16) for value in prize_struct_string.split()] | |
return prize_struct | |
def create_dropped_equipment(killer_index, equipment_number_generator, rng_equipment, rng_ability, prize_struct, characters_enabled_string): | |
# get characters enabled | |
characters_enabled = [False, False, False, False, False, False, False] | |
characters_enabled_string = characters_enabled_string.lower() | |
for character in characters_enabled_string: | |
if character == 't': characters_enabled[0] = True | |
elif character == 'y': characters_enabled[1] = True | |
elif character == 'a': characters_enabled[2] = True | |
elif character == 'k': characters_enabled[3] = True | |
elif character == 'w': characters_enabled[4] = True | |
elif character == 'l': characters_enabled[5] = True | |
elif character == 'r': characters_enabled[6] = True | |
def is_party_member_enabled_function(character_id): | |
return characters_enabled[character_id] | |
def fix_out_of_bounds_value(value, lower_bound, higher_bound): | |
if value < lower_bound: | |
value = lower_bound | |
if value > higher_bound: | |
value = higher_bound | |
return value | |
equipment = {} | |
number_of_dropped_equipment = next(equipment_number_generator) | |
if number_of_dropped_equipment < 0: | |
return -1 | |
dropped_equipment_array_offset = number_of_dropped_equipment * 22 | |
base_dropped_equipment_address = 0 | |
equipment['address'] = base_dropped_equipment_address + 254 + dropped_equipment_array_offset | |
equipment['exists'] = 1 | |
# owner | |
# a weapon for kimahri or auron might roll rng13 one less time since piercing gets always added as the first ability | |
# so calculating both owner and equipment type is important | |
party_member_index_loop = 0 | |
equipment_owner_base = 0 | |
# get number of party members enabled | |
while party_member_index_loop < 7: | |
is_party_member_enabled = is_party_member_enabled_function(party_member_index_loop) | |
if is_party_member_enabled != 0: | |
equipment_owner_base += 1 | |
party_member_index_loop += 1 | |
if killer_index < 7: | |
equipment_owner_base += 3 | |
else: | |
killer_index = 0 | |
rng_equipment_owner = next(rng_equipment) | |
number_of_enabled_party_members = 0 | |
party_member_index_loop = 0 | |
# get equipment owner | |
while party_member_index_loop < 7: | |
is_party_member_enabled = is_party_member_enabled_function(party_member_index_loop) | |
if is_party_member_enabled != 0: | |
number_of_enabled_party_members += 1 | |
if (rng_equipment_owner % equipment_owner_base) < number_of_enabled_party_members: | |
killer_index = party_member_index_loop | |
break | |
party_member_index_loop += 1 | |
equipment['character_index'] = killer_index | |
# type | |
rng_weapon_or_armor = next(rng_equipment) | |
equipment_type = rng_weapon_or_armor & 1 | |
equipment['type'] = 'weapon' if (equipment_type) == 0 else 'armor' | |
# some misc values | |
equipment['0_if_equipped'] = 255 # 255 not equipped, 0 equipped | |
equipment['0x106'] = prize_struct[46] # ??? | |
equipment['base_weapon_damage'] = prize_struct[48] # base weapon damage, 16 or 18 | |
equipment['base_weapon_crit'] = prize_struct[47] # base weapon crit, 3-6-10 | |
# number of slots | |
rng_number_of_slots = next(rng_equipment) | |
number_of_slots_modifier = prize_struct[45] + (rng_number_of_slots & 7) - 4 | |
number_of_slots = fix_out_of_bounds_value(((number_of_slots_modifier + ((number_of_slots_modifier >> 31) & 3)) >> 2), 1, 4) | |
equipment['number_of_slots'] = number_of_slots | |
# number of abilities | |
rng_number_of_abilities = next(rng_equipment) | |
number_of_abilities_modifier = prize_struct[49] + (rng_number_of_abilities & 7) - 4 | |
number_of_auto_abilities = (number_of_abilities_modifier + ((number_of_abilities_modifier >> 31) & 7)) >> 3 | |
# PossibleAutoAbilitiesArrayAddress = (ushort *)(TargetPrizeStructAddress + 0x32 + ((uint)*(byte *)(NumberOfDroppedEquipment + 0x103 + SomeAddress) + (uint)*(byte *)(NumberOfDroppedEquipment + 0x102 + SomeAddress) * 2) * 16); | |
# weapon_or_armor = (uint)*(byte *)(NumberOfDroppedEquipment + 0x103 + SomeAddress) | |
# killer_index = (uint)*(byte *)(NumberOfDroppedEquipment + 0x102 + SomeAddress) | |
possible_auto_abilities_array_address = 50 + ((equipment_type + (killer_index * 2)) * 16) | |
# the first ability in the array is always 0 for armors, its either 0 or piercing (11) for weapons | |
piercing_auto_ability_value = prize_struct[possible_auto_abilities_array_address] | |
# if the first ability is piercing it always gets added, only the case for auron and kimahri weapons | |
if number_of_slots == 0 or piercing_auto_ability_value == 0: | |
number_of_abilities_added = 0 | |
else: | |
equipment['ability0'] = piercing_auto_ability_value | |
number_of_abilities_added = 1 | |
if number_of_auto_abilities > 0: | |
current_dropped_equipment_ability = number_of_abilities_added | |
while number_of_auto_abilities > 0: | |
# if all the slots are filled break | |
if number_of_abilities_added >= equipment['number_of_slots']: break | |
# get a random ability, picks from ability 1 to ability 7, ability 0 is always piercing if present | |
rng_ability_array_index = next(rng_ability) | |
ability_to_add = prize_struct[possible_auto_abilities_array_address + (((rng_ability_array_index % 7) + 1) * 2)] | |
add_ability = True | |
# this checks for duplicate abilities | |
if ability_to_add != 0: | |
number_of_checked_abilities = 0 | |
if number_of_abilities_added > 0: | |
current_equipment_slot = 0 | |
while number_of_abilities_added > number_of_checked_abilities: | |
ability_to_check = equipment[f'ability{current_equipment_slot}'] | |
if ability_to_check == ability_to_add: | |
add_ability = False | |
break | |
number_of_checked_abilities += 1 | |
current_equipment_slot += 1 | |
# if the ability is not a duplicate add it to the current slot and advance both slot count and ability count | |
if add_ability: | |
equipment[f'ability{current_dropped_equipment_ability}'] = ability_to_add | |
number_of_abilities_added += 1 | |
current_dropped_equipment_ability += 1 | |
# always decrements | |
number_of_auto_abilities -= 1 | |
if number_of_abilities_added < 4: | |
# null remaining ability slots, shouldnt be important, it never overwrites filled slots | |
pass | |
# delete not important values | |
del equipment['address'] | |
del equipment['exists'] | |
del equipment['0_if_equipped'] | |
del equipment['0x106'] | |
del equipment['base_weapon_damage'] | |
del equipment['base_weapon_crit'] | |
return equipment | |
rng_equipment = get_rng_generator(current_equipment_seed) | |
rng_ability = get_rng_generator(current_abilities_seed) | |
enemy = 'ghost' | |
characters_enabled_string = 'TYAKWLR' | |
killer_index = 12 | |
prize_struct = get_prize_struct(enemy) | |
for i in range(50): | |
# enemy = input('Enemy: dingo/ghost') | |
# characters_enabled = input('characters enabled (TYAKWLR):') | |
# killer_index = int(input('killer index, either a character or an aeon:')) | |
# prize_struct = get_prize_struct(enemy) | |
equipment_number_generator = get_number_of_dropped_equipment() | |
if i == 0: | |
print(f'{enemy=}, {killer_index=}, {characters_enabled_string=}') | |
equipment = create_dropped_equipment(killer_index, equipment_number_generator, rng_equipment, rng_ability, prize_struct, characters_enabled_string) | |
print(f'Drop number {i + 1}: {equipment}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment