Esempio n. 1
0
This doesn't actually work, btw.  As far as I can tell, it *should*
work, but no such luck.  My theory is that all the vehicle-blocking
stuff gets computed before the hotfix gets fired, so even though
the parameter looks updated with an `obj dump`, it doesn't actually
have an effect.  Just a theory, though.  Anyway, a command to diable
ALL blocking meshes, which actually works, is:

set Engine.BlockingMeshComponent bIsDisabled True

""")

data = Data('TPS')
levelname = 'Deadsurface_P'

print('Level hotfixes in {}'.format(levelname))
for (nodename, node) in data.get_level_package_nodes(levelname):
    for child in node.get_children_with_name('blockingmeshactor'):
        for meshchild in child.children.values():
            full_obj = '{}.{}.{}'.format(nodename, child.name, meshchild.name)
            structure = meshchild.get_structure()
            if 'ScalarParameterValues' in structure:
                block_player = False
                block_vehicle = False
                vehicle_idx = -1
                for (idx, param_value) in enumerate(
                        structure['ScalarParameterValues']):
                    if param_value['ParameterName'] == '"Players"':
                        if round(float(param_value['ParameterValue'])) == 1:
                            block_player = True
                    elif param_value['ParameterName'] == '"PlayerVehicles"':
                        vehicle_idx = idx
print(
    "WARNING: This doesn't... work?  It should, as far as I can tell, but it doesn't."
)
print(
    "It *does* disable everything BUT the specified popdef, but the other mixes just"
)
print("generate no enemies at all.  Hrmph.")

data = Data('BL2')
popdef_name = 'GD_Population_Midget.Balance.PawnBalance_MidgetShotgun'
aidef_name = 'GD_AI_DenDef.AIDenDef_Bandits'
level_name = 'SouthernShelf_P'

mixes = set()
for (package_name, package) in data.get_level_package_nodes(level_name):
    for child in package:
        if child.name.startswith('PopulationOpportunityDen'):
            mix_name = Data.get_struct_attr_obj(child.get_structure(),
                                                'PopulationDef')
            if mix_name:
                mixes.add(mix_name)

for mix_name in mixes:
    print("set {} AIDef WillowAIDenDefinition'{}'".format(
        mix_name, aidef_name))
    mix = data.get_struct_by_full_object(mix_name)
    for (aal_idx, aal) in enumerate(mix['ActorArchetypeList']):
        if aal_idx == 0:
            sf_name = Data.get_struct_attr_obj(aal, 'SpawnFactory')
            print("set {} PawnBalanceDefinition AIPawnBalanceDefinition'{}'".
Esempio n. 3
0
#!/usr/bin/env python
# vim: set expandtab tabstop=4 shiftwidth=4:

import sys
from ftexplorer.data import Data

data = Data('BL2')

locker_count = 0
for (name, node) in data.get_level_package_nodes('GaiusSanctuary_P'):
    for point in node.get_children_with_name(
            'willowpopulationopportunitypoint'):
        point_struct = point.get_structure()
        if 'Locker' in point_struct['PopulationDef']:
            locker_count += 1
            print('{}.{}'.format(name, point))
print('--')
print('Locker count: {}'.format(locker_count))
Esempio n. 4
0
import sys
from ftexplorer.data import Data

if len(sys.argv) != 2:
    print('Specify a PopulationDefinition')
    sys.exit(0)

popdef = sys.argv[1]

# This would actually probably be quicker to do a getall on the object types
# and then glean the level from there...

data = Data('TPS')
for name, package in data.get_levels():
    found = False
    for node_name, node in data.get_level_package_nodes(package):
        points = []
        points.extend(
            node.get_children_with_name('populationopportunitypoint_'))
        points.extend(
            node.get_children_with_name('willowpopulationopportunitypoint_'))
        for child in points:
            child_struct = child.get_structure()
            if popdef in child_struct['PopulationDef']:
                print('Found in {} ({})'.format(name, package))
                found = True
                break
        if found:
            break
print('(done)')
Esempio n. 5
0
                               (z - child_z)**2)
    rv = child_distance <= distance
    return (rv, '({:0.1f}, {:0.1f}, {:0.1f}) @ {:0.1f}'.format(
        child_x, child_y, child_z, child_distance))


types = [
    ('WillowPopulationOpportunityPoint_', 'Location', 'PopulationDef'),
    ('PopulationOpportunityPoint_', 'Location', 'PopulationDef'),
    ('InterpActor_', 'Location', 'ReplicatedMesh'),
    ('WillowInteractiveObject_', 'Location', 'InteractiveObjectDefinition'),
    # Eh, nothing useful to report on this one.
    #('StaticMeshActor_', 'Location', 'foo'),
]

for (package_name, data_type) in data.get_level_package_nodes(level_package):
    node = data.get_node_by_full_object(package_name)
    for child in node.children.values():
        for (type_prefix, loc_attr, report_attr) in types:
            if child.name.startswith(type_prefix):
                struct = child.get_structure()
                if loc_attr in struct:
                    (match, suffix) = is_close(struct[loc_attr]['X'],
                                               struct[loc_attr]['Y'],
                                               struct[loc_attr]['Z'])
                    if match:
                        print('{prefix}.{name} - {report} {suffix}'.format(
                            prefix=package_name,
                            name=child.name,
                            report=struct[report_attr],
                            suffix=suffix,