for game in games: data = Data(game) # Weapons if True: for baldef_name in sorted( data.get_all_by_type('WeaponBalanceDefinition')): # Don't process anything in the blacklist if baldef_name in blacklist[game]: continue baldef_struct = data.get_struct_by_full_object(baldef_name) try: partlist = data.get_struct_attr_obj_real( baldef_struct, 'RuntimePartListCollection') except KeyError: partlist = data.get_struct_attr_obj_real( baldef_struct, 'WeaponPartListCollection') # Only really interested in the Barrel, since I'm after red-text guns. for part_dict in partlist['BarrelPartData']['WeightedParts']: partdef = data.get_struct_attr_obj_real(part_dict, 'Part') prefixes = get_names(data, partdef, 'PrefixList') (names, customs) = get_names(data, partdef, 'TitleList', get_customs=True) if len(prefixes) == 0: prefix = '' elif len(prefixes) == 1: prefix = '{} '.format(prefixes[0])
names.extend(data.get_all_by_type('Behavior_FireBeam')) names.extend(data.get_all_by_type('MeleeDefinition')) names.extend(data.get_all_by_type('WillowDamageArea')) for cd_name in names: cd = data.get_struct_by_full_object(cd_name) if 'WillowGame.WillowDmgSource_Skill' in cd['DamageSource']: if cd['DamageTypeDefinition'] == 'None': print(' * {}'.format(cd_name)) else: found_types.add(cd['DamageTypeDefinition']) for exp_name in data.get_all_by_type('Behavior_Explode'): exp = data.get_struct_by_full_object(exp_name) if 'WillowGame.WillowDmgSource_Skill' in exp['DamageSource']: expdef = data.get_struct_attr_obj_real(exp, 'Definition') if expdef['DamageTypeDef'] == 'None': print(' * {}'.format(exp_name)) else: found_types.add(expdef['DamageTypeDef']) reported_skills = set() for skill_name in data.get_all_by_type('SkillDefinition'): skill = data.get_struct_by_full_object(skill_name) if 'DamageEvents' in skill and skill['DamageEvents'] != '' and skill['DamageEvents'] != 'None': for de in skill['DamageEvents']: for const in de['EventConstraints']: if 'WillowGame.WillowDmgSource_Skill' in const['DamageSourceConstraint']: if skill_name not in reported_skills: print(' * ({})'.format(skill_name)) reported_skills.add(skill_name)
else: data.append(self.phaselock_time) data.extend(self.fire.get_data()) data.extend(self.corrosive.get_data()) data.extend(self.shock.get_data()) data.extend(self.slag.get_data()) return data startvals = {} ret_list = [] shown_header = False writer = csv.writer(sys.stdout) for pawnbal_name in sorted(data.get_all_by_type('AIPawnBalanceDefinition')): pawnbal = data.get_struct_by_full_object(pawnbal_name) if 'PlayThroughs' in pawnbal: aipawn = data.get_struct_attr_obj_real(pawnbal, 'AIPawnArchetype') allegiance = Data.get_attr_obj(aipawn['Allegiance']) if allegiance not in friendly_allegiances: aiclass_name = Data.get_attr_obj(aipawn['AIClass']) aiclass = data.get_struct_attr_obj_real(aipawn, 'AIClass') # Loop through all playthroughs to gather stats pawn_stats = [] for (idx, pt) in enumerate(pawnbal['PlayThroughs']): display_name = get_display_name(pt['DisplayName']) pawn_stats.append(AttributeSet(display_name, pawnbal_name, idx+1, pawnbal, aiclass)) # Loop through playthroughs one more time to combine any playthroughs # which have identical data (this could probably be done in the # previous loop, but eh.) report_stats=[pawn_stats[0]]
import sys from ftexplorer.data import Data print('This is just used to compare some basic info between versions') print('of guns. Only prints out some real basic info, does not include') print('things like firing mode definitions, BPDs, etc...') print('') print(sys.argv[1]) print('-' * len(sys.argv[1])) print('') data = Data('BL2') bal = data.get_struct_by_full_object(sys.argv[1]) plc = data.get_struct_attr_obj_real(bal, 'RuntimePartListCollection') for parttype in [ 'Body', 'Grip', 'Barrel', 'Sight', 'Stock', 'Elemental', 'Accessory1' ]: part_list = [] for pd in plc['{}PartData'.format(parttype)]['WeightedParts']: part_list.append(' * {}'.format(pd['Part'].split("'")[1])) print('{}:'.format(parttype)) for part in sorted(part_list): print(part) print('') # Get barrel effects barrel = data.get_struct_attr_obj_real(