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
def format_other_item(data): # Integers format_as_type( data, as_int, "stack", "hha_base", "sell", "material_sort", "material_name_sort", "material_seasonality_sort", ) # Booleans format_as_type(data, as_bool, "is_fence", "edible", "unlocked") coalesce_fields_as_object_list( data, 3, "availability", ("from", "availability{}"), ("note", "availability{}_note") ) coalesce_fields_as_object_list( data, 1, "buy", ("price", "buy{}_price"), ("currency", "buy{}_currency") ) format_coalesced_object_list(data, as_int, "buy", "price") return data
def format_recipe(data): # Correct some datatypes # Integers format_as_type(data, as_int, "serial_id", "recipes_to_unlock") # This can't be included in the format_as_type because of \/ that condition data["sell"] = int("0" + data["sell"]) if data["sell"] != "NA" else 0 # Change the material# and material#_num columns to be one materials column coalesce_fields_as_object_list( data, 6, "materials", ("name", "material{}"), ("count", "material{}_num") ) format_coalesced_object_list(data, as_int, "materials", "count") coalesce_fields_as_object_list( data, 2, "availability", ("from", "diy_availability{}"), ("note", "diy_availability{}_note") ) # Do the same for buy#_price and buy#_currency columns 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
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
def format_tool(data): # Integers format_as_type(data, as_int, "sell", "custom_kits", "hha_base") # Booleans format_as_type(data, as_bool, "customizable", "unlocked") 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
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
def format_photo(data): # Integers format_as_type(data, as_int, "hha_base", "sell", "custom_kits") # Booleans format_as_type(data, as_bool, "customizable", "interactable", "unlocked") 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_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