Beispiel #1
0
def create_patcher_file(description: LayoutDescription,
                        players_config: PlayersConfiguration,
                        cosmetic_patches: CosmeticPatches,
                        ) -> dict:
    """

    :param description:
    :param players_config:
    :param cosmetic_patches:
    :return:
    """
    preset = description.permalink.get_preset(players_config.player_index)
    patcher_config = preset.patcher_configuration
    layout = preset.layout_configuration
    patches = description.all_patches[players_config.player_index]
    rng = Random(description.permalink.as_str)

    game = data_reader.decode_data(layout.game_data)
    useless_target = PickupTarget(pickup_creator.create_useless_pickup(game.resource_database),
                                  players_config.player_index)

    result = {}
    _add_header_data_to_result(description, result)

    # Add Spawn Point
    result["spawn_point"] = _create_spawn_point_field(patches, game.resource_database)

    result["starting_popup"] = _create_starting_popup(layout, game.resource_database, patches.starting_items)

    # Add the pickups
    if description.permalink.player_count == 1:
        if cosmetic_patches.disable_hud_popup:
            memo_data = _simplified_memo_data()
        else:
            memo_data = default_prime2_memo_data()
        creator = PickupCreatorSolo(rng, memo_data)
    else:
        creator = PickupCreatorMulti(rng, players_config.player_names)

    result["pickups"] = _create_pickup_list(patches,
                                            useless_target, _TOTAL_PICKUP_COUNT,
                                            rng,
                                            patcher_config.pickup_model_style,
                                            patcher_config.pickup_model_data_source,
                                            creator=creator,
                                            )

    # Add the elevators
    result["elevators"] = _create_elevators_field(patches, game)

    # Add translators
    result["translator_gates"] = _create_translator_gates_field(patches.translator_gates)

    # Scan hints
    result["string_patches"] = _create_string_patches(layout.hints, game, description.all_patches, players_config, rng)

    # TODO: if we're starting at ship, needs to collect 9 sky temple keys and want item loss,
    # we should disable hive_chamber_b_post_state
    result["specific_patches"] = {
        "hive_chamber_b_post_state": True,
        "intro_in_post_state": True,
        "warp_to_start": patcher_config.warp_to_start,
        "speed_up_credits": cosmetic_patches.speed_up_credits,
        "disable_hud_popup": cosmetic_patches.disable_hud_popup,
        "pickup_map_icons": cosmetic_patches.pickup_markers,
        "full_map_at_start": cosmetic_patches.open_map,
        "dark_world_varia_suit_damage": patcher_config.varia_suit_damage,
        "dark_world_dark_suit_damage": patcher_config.dark_suit_damage,
    }

    result["logbook_patches"] = [
        {"asset_id": 25, "connections": [81, 166, 195], },
        {"asset_id": 38, "connections": [4, 33, 120, 251, 364], },
        {"asset_id": 60, "connections": [38, 74, 154, 196], },
        {"asset_id": 74, "connections": [59, 75, 82, 102, 260], },
        {"asset_id": 81, "connections": [148, 151, 156], },
        {"asset_id": 119, "connections": [60, 254, 326], },
        {"asset_id": 124, "connections": [35, 152, 355], },
        {"asset_id": 129, "connections": [29, 118, 367], },
        {"asset_id": 154, "connections": [169, 200, 228, 243, 312, 342], },
        {"asset_id": 166, "connections": [45, 303, 317], },
        {"asset_id": 194, "connections": [1, 6], },
        {"asset_id": 195, "connections": [159, 221, 231], },
        {"asset_id": 196, "connections": [17, 19, 23, 162, 183, 379], },
        {"asset_id": 233, "connections": [58, 191, 373], },
        {"asset_id": 241, "connections": [223, 284], },
        {"asset_id": 254, "connections": [129, 233, 319], },
        {"asset_id": 318, "connections": [119, 216, 277, 343], },
        {"asset_id": 319, "connections": [52, 289, 329], },
        {"asset_id": 326, "connections": [124, 194, 241, 327], },
        {"asset_id": 327, "connections": [46, 275], },
    ]

    _apply_translator_gate_patches(result["specific_patches"], layout.elevators)

    return result
Beispiel #2
0
def create_patcher_file(
    description: LayoutDescription,
    cosmetic_patches: CosmeticPatches,
) -> dict:
    """

    :param description:
    :param cosmetic_patches:
    :return:
    """
    patcher_config = description.permalink.patcher_configuration
    layout = description.permalink.layout_configuration
    patches = description.patches
    rng = Random(description.permalink.as_str)

    game = data_reader.decode_data(layout.game_data)
    useless_pickup = pickup_creator.create_useless_pickup(
        game.resource_database)

    result = {}
    _add_header_data_to_result(description, result)

    # Add Spawn Point
    result["spawn_point"] = _create_spawn_point_field(patches,
                                                      game.resource_database)

    result["starting_popup"] = _create_starting_popup(layout,
                                                      game.resource_database,
                                                      patches.starting_items)

    # Add the pickups
    if cosmetic_patches.disable_hud_popup:
        memo_data = None
    else:
        memo_data = default_prime2_memo_data()

    result["pickups"] = _create_pickup_list(
        patches,
        useless_pickup,
        _TOTAL_PICKUP_COUNT,
        rng,
        patcher_config.pickup_model_style,
        patcher_config.pickup_model_data_source,
        memo_data,
    )

    # Add the elevators
    result["elevators"] = _create_elevators_field(patches, game)

    # Add translators
    result["translator_gates"] = _create_translator_gates_field(
        patches.translator_gates)

    # Scan hints
    result["string_patches"] = _create_string_patches(layout.hints, game,
                                                      patches, rng)

    # TODO: if we're starting at ship, needs to collect 8 sky temple keys and want item loss,
    # we should disable hive_chamber_b_post_state
    result["specific_patches"] = {
        "hive_chamber_b_post_state": True,
        "intro_in_post_state": True,
        "warp_to_start": patcher_config.warp_to_start,
        "speed_up_credits": cosmetic_patches.speed_up_credits,
        "disable_hud_popup": cosmetic_patches.disable_hud_popup,
        "pickup_map_icons": cosmetic_patches.pickup_markers,
        "full_map_at_start": cosmetic_patches.open_map,
        "dark_world_varia_suit_damage": patcher_config.varia_suit_damage,
        "dark_world_dark_suit_damage": patcher_config.dark_suit_damage,
    }

    _apply_translator_gate_patches(result["specific_patches"],
                                   layout.elevators)

    return result