From 68eb9149dfae75ed57bcd891499eeb9c40942c78 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 28 Jun 2021 18:25:28 +0800 Subject: [PATCH] Generate armor sitem sheets --- .../extract_r2_required/generate_sitem.py | 214 +++++++++++++++++- .../extract_r2_required/match_sitem_shape.tsv | 6 +- .../scheme_sitem_parser.py | 16 +- .../extract_r2_required/sitem_parsed.tsv | 2 +- .../sitem_shape_matcher.py | 2 + 5 files changed, 222 insertions(+), 18 deletions(-) diff --git a/ryzom/tools/extract_r2_required/generate_sitem.py b/ryzom/tools/extract_r2_required/generate_sitem.py index f5188bba2..59dc3f209 100644 --- a/ryzom/tools/extract_r2_required/generate_sitem.py +++ b/ryzom/tools/extract_r2_required/generate_sitem.py @@ -43,7 +43,8 @@ def generateParents(): strippedTags.remove("melee") if "ranged" in strippedTags: strippedTags.remove("ranged") - parentTags[name] = strippedTags + if "shared" in tags: + parentTags[name] = strippedTags displayName = " ".join(strippedTags) family = "undefined" # item_family.typ @@ -125,11 +126,11 @@ def generateParents(): itemType = "Dagger" animSet = "Dagger" icon = "mw_dagger.png" + leftHandSlot = "Left Hand" elif "sword" in tags: itemType = "Sword" animSet = "1H Sword" icon = "mw_sword.png" - leftHandSlot = "Left Hand" elif "mace" in tags: itemType = "Mace" icon = "mw_mace.png" @@ -154,7 +155,7 @@ def generateParents(): icon = "mw_2h_axe.png" elif "pike" in tags: itemType = "Pike" - animSet = "2H Lance" + animSet = "2HLance" icon = "mw_2h_lance.png" elif "mace" in tags: itemType = "Two Hand Mace" @@ -291,10 +292,10 @@ def generateParents(): f.write(" \n") if "armor" not in tags: f.write(" \n") - if leftHandSlot != "Undefined": - f.write(" \n") if rightHandSlot != "Undefined": - f.write(" \n") + f.write(" \n") + if leftHandSlot != "Undefined": + f.write(" \n") f.write(" \n") if malus != 0: f.write(" \n") @@ -333,6 +334,18 @@ def generateParents(): f.write(" \n") f.write("\n") f.flush() + # elif "generic" in tags: + # dir = sitemPath + "\\" + folder + "\\_parent\\" + origin + # if not os.path.isdir(dir): + # os.makedirs(dir) + # path = dir + "\\" + name + ".sitem" + # + # print(path) + # with open(path, "w") as f: + # f.write("\n") + # f.write("
\n") + # f.write("
\n") + # f.flush() def generateSitems(): for match in matchSitemShape: @@ -340,10 +353,199 @@ def generateSitems(): shapeMale = match[1] shapeFemale = match[2] tags = sitemTags[name] + strippedTags = tags[:] + + if "item" in strippedTags: + strippedTags.remove("item") + if "crafted" in strippedTags: + strippedTags.remove("crafted") + if "hands" in strippedTags: + strippedTags.remove("hands") + if "light" in strippedTags and "caster" in strippedTags: + strippedTags.remove("light") + if "hq" in strippedTags: + strippedTags.remove("hq") + #strippedTags = [ "high quality" ] + strippedTags + if "mq" in strippedTags: + strippedTags.remove("mq") + #strippedTags = [ "medium quality" ] + strippedTags + if "armor" in strippedTags: + strippedTags.remove("armor") + if "melee" in strippedTags: + strippedTags.remove("melee") + if "ranged" in strippedTags: + strippedTags.remove("ranged") + displayName = " ".join(strippedTags) + + origin = "common" # item_origine.typ + iconBackground = "" + if "refugee" in tags: + origin = "refugee" + iconBackground = "bk_generic.png" + elif "tribe" in tags: + origin = "tribe" + iconBackground = "bk_generic.png" + elif "karavan" in tags: + origin = "karavan" + iconBackground = "bk_karavan.png" + elif "kami" in tags: + origin = "kami" + iconBackground = "bk_kami.png" + elif "fyros" in tags: + origin = "fyros" + iconBackground = "bk_fyros.png" + elif "matis" in tags: + origin = "matis" + iconBackground = "bk_matis.png" + elif "zorai" in tags: + origin = "zorai" + iconBackground = "bk_zorai.png" + elif "tryker" in tags: + origin = "tryker" + iconBackground = "bk_tryker.png" + elif "common" in tags: + origin = "common" + iconBackground = "bk_generic.png" + + mapVariant = "Default" + if "mq" in tags: + mapVariant = "Medium Quality" + elif "hq" in tags: + mapVariant = "High Quality" + + itemType = "undefined" + armorSlot = "Undefined" # item_slot_type.typ + icon = "" + if "armor" in tags: + if "refugee" in tags: + itemType = "Light " + elif "light" in tags: + itemType = "Light " + elif "medium" in tags: + itemType = "Medium " + elif "heavy" in tags: + itemType = "Heavy " + if "boots" in tags: + itemType += "boots" + armorSlot = "Feet" + icon = "ar_botte.png" + elif "gloves" in tags: + itemType += "gloves" + armorSlot = "Hands" + icon = "ar_hand.png" + elif "pants" in tags: + itemType += "pants" + armorSlot = "Legs" + icon = "ar_pantabotte.png" + elif "sleeves" in tags: + itemType += "Sleeves" + armorSlot = "Arms" + icon = "ar_armpad.png" + elif "vest" in tags: + itemType += "vest" + armorSlot = "Chest" + icon = "ar_gilet.png" + elif "helmet" in tags and "heavy" in tags: + itemType += "helmet" + armorSlot = "Head" + icon = "ar_helmet.png" + else: + itemType = "undefined" + + color = "" + if "red" in tags: + color = "Red" + elif "black" in tags: + color = "Black" + elif "beige" in tags: + color = "Beige" + elif "green" in tags: + color = "Green" + elif "turquoise" in tags: + color = "Turquoise" + elif "blue" in tags: + color = "Blue" + elif "violet" in tags: + color = "Violet" + elif "white" in tags: + color = "White" + + subfolder = origin + print tags + if "underwear" in tags: + subfolder = "underwear" + + folder = "_unspecified" + if "ammo" in tags: + folder = "ammo\\" + subfolder + elif "ranged" in tags: + folder = "range_weapon\\" + subfolder + elif "melee" in tags: + folder = "melee_weapon\\" + subfolder + elif "armor" in tags: + print shapeMale + folder = "armor\\" + subfolder + if "caster01" in shapeMale or "caster" in tags: + folder += "\\caster_armor" + elif ("civil01" in shapeMale or ("underwear" in shapeMale and not "underwear" in tags)) and "light" in tags: + folder += "\\light_armor" + elif "armor00" in shapeMale and "medium" in tags: + folder += "\\medium_armor" + elif ("armor01" in shapeMale or "casque01" in shapeMale) and "heavy" in tags: + folder += "\\heavy_armor" + elif "shield" in tags: + folder = "shield\\" + subfolder + + dir = sitemPath + "\\" + folder + if not os.path.isdir(dir): + os.makedirs(dir) + path = dir + "\\" + name + ".sitem" + # print(name) # print(shapeMale) # print(shapeFemale) # print(tags) + + if not "armor" in tags: + continue + + if "armor" in tags and "caster" in tags and not "pants" in tags: + continue # Only include caster pants + + print(path) + with open(path, "w") as f: + f.write("\n") + f.write("
\n") + # f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write(" \n") + if itemType != "undefined": + f.write(" \n") + if armorSlot != "Undefined": + f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write(" \n") + # f.write(" \n") # TODO: extract sbrick ids + f.write(" \n") + f.write(" \n") + f.write(" \n") + if shapeFemale != shapeMale: + f.write(" \n") + if mapVariant != "Default": + f.write(" \n") + if icon != "": + f.write(" \n") + if iconBackground != "": + f.write(" \n") + if color != "": + f.write(" \n") + f.write(" \n") + f.write(" \n") + f.write("\n") + f.flush() generateParents() generateSitems() diff --git a/ryzom/tools/extract_r2_required/match_sitem_shape.tsv b/ryzom/tools/extract_r2_required/match_sitem_shape.tsv index fc594caee..38426e688 100644 --- a/ryzom/tools/extract_r2_required/match_sitem_shape.tsv +++ b/ryzom/tools/extract_r2_required/match_sitem_shape.tsv @@ -2,7 +2,7 @@ iccm1bm ge_wea_masse1m ge_wea_masse1m common melee one-handed blunt mace iccm1pd ge_wea_dague ge_wea_dague common melee one-handed piercing dagger iccm1sa ge_wea_hache1m ge_wea_hache1m common melee one-handed slashing axe iccm1ss ge_wea_epee1m ge_wea_epee1m common melee one-handed slashing sword -icfacb_3 fy_hom_caster01_civil01_bottes fy_hof_caster01_bottes_civil fyros light caster armor boots +icfacb_3 fy_hom_civil01_bottes fy_hof_civil01_bottes fyros light armor boots icfacp fy_hom_caster01_pantabottes fy_hof_caster01_pantabottes fyros light caster armor pants icfacp_2 fy_hom_caster01_pantabottes fy_hof_caster01_pantabottes fyros light caster armor pants icfacp_3 fy_hom_caster01_pantabottes fy_hof_caster01_pantabottes fyros light caster armor pants @@ -92,7 +92,7 @@ icfsb_3 fy_wea_petit_bouclier fy_wea_petit_bouclier fyros buckler shield icfss fy_wea_grand_bouclier fy_wea_grand_bouclier fyros large shield icfss_2 fy_wea_grand_bouclier fy_wea_grand_bouclier fyros large shield icfss_3 fy_wea_grand_bouclier fy_wea_grand_bouclier fyros large shield -icmacb_3 ma_hom_caster01_bottes_civil01 ma_hof_caster01_bottes_civil01 matis light caster armor boots +icmacb_3 ma_hom_civil01_bottes ma_hof_civil01_bottes matis light armor boots icmacp ma_hom_caster01_pantabottes ma_hof_caster01_pantabottes matis light caster armor pants icmacp_2 ma_hom_caster01_pantabottes ma_hof_caster01_pantabottes matis light caster armor pants icmacp_3 ma_hom_caster01_pantabottes ma_hof_caster01_pantabottes matis light caster armor pants @@ -183,7 +183,7 @@ icmss ma_wea_grand_bouclier ma_wea_grand_bouclier matis large shield icmss_2 ma_wea_grand_bouclier ma_wea_grand_bouclier matis large shield icmss_3 ma_wea_grand_bouclier ma_wea_grand_bouclier matis large shield icravr tr_hom_refugee_gilet tr_hof_refugee_gilet refugee armor vest -ictacb_3 tr_hom_caster01_bottes_civil01 tr_hof_caster01_bottes_civil01 tryker light caster armor boots +ictacb_3 tr_hom_civil01_bottes tr_hof_civil01_bottes tryker light armor boots ictacp tr_hom_caster01_pantabottes tr_hof_caster01_pantabottes tryker light caster armor pants ictacp_2 tr_hom_caster01_pantabottes tr_hof_caster01_pantabottes tryker light caster armor pants ictacp_3 tr_hom_caster01_pantabottes tr_hof_caster01_pantabottes tryker light caster armor pants diff --git a/ryzom/tools/extract_r2_required/scheme_sitem_parser.py b/ryzom/tools/extract_r2_required/scheme_sitem_parser.py index 076a97779..eb55ad03c 100644 --- a/ryzom/tools/extract_r2_required/scheme_sitem_parser.py +++ b/ryzom/tools/extract_r2_required/scheme_sitem_parser.py @@ -130,14 +130,14 @@ scheme = { "h": "helmet", }, { - "a": "color0", - "e": "color1", - "g": "color2", - "r": "color3", - "t": "color4", - "u": "color5", - "v": "color6", - "w": "color7", + "a": "black", + "e": "beige", + "g": "green", + "r": "red", + "t": "turquoise", + "u": "blue", + "v": "violet", + "w": "white", }, {}, {}, diff --git a/ryzom/tools/extract_r2_required/sitem_parsed.tsv b/ryzom/tools/extract_r2_required/sitem_parsed.tsv index 4958b6f2e..a959e1148 100644 --- a/ryzom/tools/extract_r2_required/sitem_parsed.tsv +++ b/ryzom/tools/extract_r2_required/sitem_parsed.tsv @@ -182,7 +182,7 @@ icmsb_3 icmsb_3 item crafted matis buckler shield hq icmss icmss item crafted matis large shield icmss_2 icmss_2 item crafted matis large shield mq icmss_3 icmss_3 item crafted matis large shield hq -icravr icravr item crafted refugee armor vest color3 +icravr icravr item crafted refugee armor vest red ictacb_3 ictacb_3 item crafted tryker light caster armor boots hq ictacp ictacp item crafted tryker light caster armor pants ictacp_2 ictacp_2 item crafted tryker light caster armor pants mq diff --git a/ryzom/tools/extract_r2_required/sitem_shape_matcher.py b/ryzom/tools/extract_r2_required/sitem_shape_matcher.py index a35ba46a8..504a50621 100644 --- a/ryzom/tools/extract_r2_required/sitem_shape_matcher.py +++ b/ryzom/tools/extract_r2_required/sitem_shape_matcher.py @@ -15,6 +15,8 @@ def findMatch(name, sitem): bestMatching = "" bestMatchingTags = [] bestUnmatchingTags = [] + if "caster" in sitem and not "pants" in sitem and "light" in sitem: + sitem.remove("caster") for shape in shapeParsed: matches = 0 unmatches = 0