From f824c761ce5e4c905fc9aeeec2968d79f067c218 Mon Sep 17 00:00:00 2001 From: Pao Date: Sat, 4 Feb 2023 02:59:08 +0100 Subject: [PATCH] Added gen for items and recipes --- Test_Name.xml | 6 --- python_helpers/main.py | 97 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 83 insertions(+), 20 deletions(-) delete mode 100644 Test_Name.xml diff --git a/Test_Name.xml b/Test_Name.xml deleted file mode 100644 index 568101f..0000000 --- a/Test_Name.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - TEST TEXT FROM SOMETHING - TEST TEXT FROM SOMETHING FEMALE - get guid - diff --git a/python_helpers/main.py b/python_helpers/main.py index 28f569d..5360261 100644 --- a/python_helpers/main.py +++ b/python_helpers/main.py @@ -1,19 +1,7 @@ import lxml.etree as gfg -# -# -# Prost_Left_Hand_MetalHand_Male -# Prost_Left_Hand_MetalHand_Female -# 2101af26-54b9-455b-abc0-7533ce37f84b -# false -# false -# false -# Prosthesis\metal_base -# - - -def create_single_xml(): +def generate_clothing_item(): root = gfg.Element("clothingItem") m_MaleModel = gfg.Element("m_MaleModel") @@ -45,4 +33,85 @@ def create_single_xml(): with open("Test_Name.xml", "wb") as file: tree.write(file, encoding='utf-8', xml_declaration=True, pretty_print=True ) -create_single_xml() \ No newline at end of file + +def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip): + # TODO Simple txt, so strings should be fine. + print("Generating recipe") + + root_element = f"recipe {recipe_name}\n" + root_element += "\t{\n" + + for item in recipe_items: + root_element += f"\t\t{item},\n" + + root_element += f"\n\n\t\tResult: {result_name},\n" + root_element += f"\t\tTime: {time:.2f},\n" + root_element += "\t\tNeedToBeLearn: true,\n" + root_element += "\t\tCanBeDoneFromFloor: false,\n" + root_element += "\t\tOnGiveXP: NoXP_OnGiveXP,\n" + root_element += f"\t\tSkillRequired: {skill_required[0]}={skill_required[1]},\n" + root_element += "\t\tCategory: Surgeon,\n" + root_element += f"\t\tTooltip: {tooltip},\n" + + root_element += "\t}" + + + with open("Test_recipe.txt", "wt") as file: + file.write(root_element) + file.close() + + + +def generate_item(item_name, weight, item_type, display_category, display_name, icon, tooltip, can_have_holes, clothing_item=None, body_location = None, blood_location = None): + # TODO This is a txt, so we're gonna use simple strings I guess + print("Generating item") + + root_element = f"item {item_name}\n" + root_element += "\t{\n" + + root_element += f"\t\tWeight = {weight},\n" + root_element += f"\t\tType = {item_type},\n" + root_element += f"\t\tDisplayCategory = {display_category},\n" + root_element += f"\t\tDisplayName = {display_name},\n" + + if item_type == "Clothing": + root_element += f"\t\tClothingItem = {clothing_item},\n" + root_element += f"\t\tBodyLocation = {body_location},\n" + root_element += f"\t\tBloodLocation = {blood_location},\n" + + root_element += f"\t\tIcon = {icon},\n" + root_element += f"\t\tTooltip = {tooltip},\n" + root_element += f"\t\tCanHaveHoles = {can_have_holes},\n" + + root_element += "\t}" + + + + with open("Test_Item.txt", "wt") as file: + file.write(root_element) + file.close() + + + +#generate_clothing_item() + + +recipe_name = "Test Recipe" +recipe_items = ["Ass", "Penis", "Shit=3"] +result_name = "Cum sock" +time = 10 +skill_required = ["Carpentry", "4"] +tooltip = "tooltip_test" + +generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip) + + +item_name = "Ass Ass Ass" +weight = 100 +item_type = "Clothing" +display_category = "Prosthesis" +display_name = "Ass cock" +clothing_item = "ClothingItemSomethingProst" +body_location = "TOC_ArmRightProsthesis" + +generate_item(item_name, weight, item_type, display_category, display_name, "test_icon", "test_tooltip", "false", clothing_item, body_location, "Hands") \ No newline at end of file