Exemple #1
0
def format_variation(data):
    if "color1" in data:
        coalesce_fields_as_list(data, 2, "colors", "color{}")
        data["colors"] = set(data["colors"])
        data["colors"].discard("None")
        data["colors"] = list(data["colors"])
    return data
Exemple #2
0
def format_interior(data):
    # Integers
    format_as_type(data, as_int, "hha_base", "sell")

    # Booleans
    format_as_type(data, as_bool, "unlocked")

    if data["grid_size"]:
        grid_width, grid_length = data["grid_size"].split(
            "\u00d7"
        )  # \u00d7 is the multiplication sign, so 1.0x1.0 => [1.0,1.0]
        data["grid_width"] = float(grid_width)
        data["grid_length"] = float(grid_length)
    else:
        data["grid_width"] = ""
        data["grid_length"] = ""
    del data["grid_size"]

    coalesce_fields_as_list(data, 2, "themes", "theme{}")

    coalesce_fields_as_list(data, 2, "colors", "color{}")

    coalesce_fields_as_object_list(
        data, 2, "availability", ("from", "availability{}"), ("note", "availability{}_note")
    )

    coalesce_fields_as_object_list(
        data, 2, "buy", ("price", "buy{}_price"), ("currency", "buy{}_currency")
    )
    format_coalesced_object_list(data, as_int, "buy", "price")

    return data
Exemple #3
0
def format_fossil(data):
    format_as_type(data, as_bool, "interactable")
    format_as_type(data, as_int, "sell", "hha_base")
    format_as_type(data, as_float, "width", "length")

    coalesce_fields_as_list(data, 2, "colors", "color{}")
    data["colors"] = set(data["colors"])
    data["colors"].discard("None")
    data["colors"] = list(data["colors"])

    return data
Exemple #4
0
def format_furniture(data):
    # Integers
    format_as_type(
        data, as_int, "hha_base", "sell", "variation_total", "pattern_total", "custom_kits"
    )

    # Booleans
    format_as_type(data, as_bool, "customizable", "lucky", "door_decor", "unlocked")
    # if data['outdoor'] == '0':
    #     data['outdoor'] = False
    # elif data['outdoor'] == '1':
    #     data['outdoor'] = True
    # if data['sound'] == '0':
    #     data['sound'] = False
    # elif data['sound'] == '1':
    #     data['sound'] = True
    # if data['interactable'] == '0':
    #     data['interactable'] = False
    # elif data['interactable'] == '1':
    #     data['interactable'] = True
    # if data['animated'] == '0':
    #     data['animated'] = False
    # elif data['animated'] == '1':
    #     data['animated'] = True
    # if data['music'] == '0':
    #     data['music'] = False
    # elif data['music'] == '1':
    #     data['music'] = True
    # if data['lighting'] == '0':
    #     data['lighting'] = False
    # elif data['lighting'] == '1':
    #     data['lighting'] = True

    grid_width, grid_length = data["grid_size"].split(
        "\u00d7"
    )  # \u00d7 is the multiplication sign, so 1.0x1.0 => [1.0,1.0]
    data["grid_width"] = float(grid_width)
    data["grid_length"] = float(grid_length)
    del data["grid_size"]

    coalesce_fields_as_list(data, 2, "themes", "theme{}")

    coalesce_fields_as_list(data, 2, "functions", "function{}")

    coalesce_fields_as_object_list(
        data, 3, "availability", ("from", "availability{}"), ("note", "availability{}_note")
    )

    coalesce_fields_as_object_list(
        data, 2, "buy", ("price", "buy{}_price"), ("currency", "buy{}_currency")
    )
    format_coalesced_object_list(data, as_int, "buy", "price")

    return data
Exemple #5
0
def format_clothing(data):
    # Integers
    format_as_type(data, as_int, "sell", "variation_total")

    # Booleans
    format_as_type(data, as_bool, "vill_equip", "unlocked")

    # Turn label[1-5] into a list called label_themes
    coalesce_fields_as_list(data, 5, "label_themes", "label{}")

    coalesce_fields_as_list(data, 2, "styles", "style{}")

    coalesce_fields_as_object_list(
        data, 2, "availability", ("from", "availability{}"), ("note", "availability{}_note")
    )

    coalesce_fields_as_object_list(
        data, 2, "buy", ("price", "buy{}_price"), ("currency", "buy{}_currency")
    )
    format_coalesced_object_list(data, as_int, "buy", "price")

    return data