diff --git a/media/lua/client/TOC_OverridenFunctions.lua b/media/lua/client/TOC_OverridenFunctions.lua index 13f7f3c..3ff974f 100644 --- a/media/lua/client/TOC_OverridenFunctions.lua +++ b/media/lua/client/TOC_OverridenFunctions.lua @@ -72,17 +72,14 @@ function ISInventoryPane:onMouseDoubleClick(x, y) local item_to_check = self.items[self.mouseOverOption] local player_inventory = getPlayerInventory(self.player).inventory ------------------------------------------------------------------------------------ - -- TODO THIS IS DISABLED ONLY FOR TEST!!!!! REMEMBER TO RESTORE IT ------------------------------------------------------------------------------------ - -- if instanceof(item_to_check, "InventoryItem") then - -- og_ISInventoryPaneOnMouseDoubleClick(self, x, y) - -- elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then - -- --print("TOC: Can't double click this item") - -- else - -- end + if instanceof(item_to_check, "InventoryItem") then + og_ISInventoryPaneOnMouseDoubleClick(self, x, y) + elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then + --print("TOC: Can't double click this item") + + end og_ISInventoryPaneOnMouseDoubleClick(self, x, y) @@ -96,17 +93,12 @@ function ISInventoryPane.getActualItems(items) local ret = og_ISInventoryPaneGetActualItems(items) -- This is gonna be slower than just overriding the function but hey it's more compatible ------------------------------------------------------------------------------------ - -- TODO THIS IS DISABLED ONLY FOR TEST!!!!! REMEMBER TO RESTORE IT ------------------------------------------------------------------------------------ - - - -- for i = 1, #ret do - -- local item_full_type = ret[i]:getFullType() - -- if string.find(item_full_type, "Amputation_") or string.find(item_full_type, "Prost_") then - -- table.remove(ret, i) - -- end - -- end + for i = 1, #ret do + local item_full_type = ret[i]:getFullType() + if string.find(item_full_type, "Amputation_") or string.find(item_full_type, "Prost_") then + table.remove(ret, i) + end + end return ret end diff --git a/media/lua/client/TOC_ProsthesisHandler.lua b/media/lua/client/TOC_ProsthesisHandler.lua index 5489ba2..d5dc025 100644 --- a/media/lua/client/TOC_ProsthesisHandler.lua +++ b/media/lua/client/TOC_ProsthesisHandler.lua @@ -32,6 +32,8 @@ function GenerateEquippedProsthesis(prosthesis_item, limb) -- TODO Durability should be decided from the clothing item xml. Same thing for disassembling stuff -- TODO some stuff should be defined by the limb, like -10 if forearm in speed +-- -- when we equip a prosthesis, we're gonna pass these parameters to the newly generated clothing item +-- -- when we unequip it, we regen the normal item with the parameters from the clothing item local durability = 0 local speed = 0 @@ -80,10 +82,6 @@ end -- -- Set mod data for item with durability and all that crap --- -- when we equip a prosthesis, we're gonna pass these parameters to the newly generated clothing item - --- -- when we unequip it, we regen the normal item with the parameters from the clothing item - -- end diff --git a/python_helpers/main.py b/python_helpers/main.py index 2da21dc..566c62c 100644 --- a/python_helpers/main.py +++ b/python_helpers/main.py @@ -1,8 +1,10 @@ import lxml.etree as gfg import pandas as pd +import numpy as np +import openpyxl -def generate_clothing_item(model, texture_choices, guid = None): +def generate_clothing_item(name, part, model, texture_choices, guid = None): root = gfg.Element("clothingItem") m_MaleModel = gfg.Element("m_MaleModel") @@ -23,21 +25,24 @@ def generate_clothing_item(model, texture_choices, guid = None): m_Static = gfg.Element("m_Static") m_Static.text = "false" + root.append(m_Static) m_AllowRandomTint = gfg.Element("m_AllowRandomTint") m_AllowRandomTint.text = "false" + root.append(m_AllowRandomTint) # TODO Defined by the amount of textures that we're gonna pass for tex in texture_choices: - textureChoices = gfg.Element("textureChoices") textureChoices.text = tex + root.append(textureChoices) tree = gfg.ElementTree(root) - with open("Test_Name.xml", "wb") as file: - tree.write(file, encoding='utf-8', xml_declaration=True, pretty_print=True ) + path = r'output_clothing/Prost_' + part + "_" + name + ".xml" + with open(path, "wb") as file: + tree.write(file, encoding='utf-8', xml_declaration=True, pretty_print=True ) def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip): # TODO Simple txt, so strings should be fine. @@ -65,8 +70,6 @@ def generate_recipe(recipe_name, recipe_items, result_name, time, skill_required 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") @@ -97,10 +100,39 @@ def generate_item(item_name, weight, item_type, display_category, display_name, file.close() ########################################################################################### +def read_table(file_name: str, table_name: str) -> pd.DataFrame: + wb = openpyxl.load_workbook(file_name, read_only= False, data_only = True) # openpyxl does not have table info if read_only is True; data_only means any functions will pull the last saved value instead of the formula + for sheetname in wb.sheetnames: # pulls as strings + sheet = wb[sheetname] # get the sheet object instead of string + if table_name in sheet.tables: # tables are stored within sheets, not within the workbook, although table names are unique in a workbook + tbl = sheet.tables[table_name] # get table object instead of string + tbl_range = tbl.ref #something like 'C4:F9' + break # we've got our table, bail from for-loop + data = sheet[tbl_range] # returns a tuple that contains rows, where each row is a tuple containing cells + content = [[cell.value for cell in row] for row in data] # loop through those row/cell tuples + header = content[0] # first row is column headers + rest = content[1:] # every row that isn't the first is data + df = pd.DataFrame(rest, columns = header) + wb.close() + return df + +########################################################################################### + +excel_path = r'python_helpers/modules_prost.xlsx' +df_base = read_table(excel_path, "BaseTable") +df_top = read_table(excel_path, "TopTable") + +for base_row in df_base.iterrows(): + for top_row in df_top.iterrows(): + base_name = base_row[1][0] + top_name = top_row[1][0] + + current_name = base_name + "_" + top_name + generate_clothing_item(current_name, "LowerArm", "test", {"test1", "test2"}, "123") + + -forearm_data = pd.read_excel('modules_prost.xlsx', sheet_name = "Forearm") -data = pd.DataFrame(excel_data, columns) @@ -118,7 +150,7 @@ time = 10 skill_required = ["Carpentry", "4"] tooltip = "tooltip_test" -generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip) +#generate_recipe(recipe_name, recipe_items, result_name, time, skill_required, tooltip) item_name = "Ass Ass Ass" @@ -129,4 +161,4 @@ 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 +#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 diff --git a/python_helpers/modules_prost.xlsx b/python_helpers/modules_prost.xlsx index 27265b1..f0e7b33 100644 Binary files a/python_helpers/modules_prost.xlsx and b/python_helpers/modules_prost.xlsx differ