Generate sitem parent sheets

merge/2021-11-19
kaetemi 4 years ago
parent e0e85d0100
commit 0115e0b745
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -0,0 +1,350 @@
import os
def loadTsv(filename):
table = []
with open(filename, "r") as f:
for l in f:
table += [ l.strip().split("\t") ]
return table;
sitemParents = loadTsv("sitem_parents.tsv")
sitemParsed = loadTsv("sitem_parsed.tsv")
shapeParsed = loadTsv("shape_parsed.tsv")
matchSitemShape = loadTsv("match_sitem_shape.tsv")
sitemTags = {}
sitemPath = "Y:\\ryzomcore4\\leveldesign\\game_element\\sitem"
parentTags = {}
for sitem in sitemParsed:
sitemTags[sitem[0]] = sitem[2:]
for sitem in sitemParents:
sitemTags[sitem[0]] = sitem[2:]
def generateParents():
for sitem in sitemParents:
name = sitem[0]
tags = sitem[2:]
strippedTags = tags[:]
if "parent" in strippedTags:
strippedTags.remove("parent")
if "shared" in strippedTags:
strippedTags.remove("shared")
if "unspecified" in strippedTags:
strippedTags.remove("unspecified")
if "generic" in strippedTags:
strippedTags.remove("generic")
if "base" in strippedTags:
strippedTags.remove("base")
if "melee" in strippedTags:
strippedTags.remove("melee")
if "ranged" in strippedTags:
strippedTags.remove("ranged")
parentTags[name] = strippedTags
displayName = " ".join(strippedTags)
family = "undefined" # item_family.typ
if "ammo" in tags:
family = "ammo"
elif "shield" in tags:
family = "shield"
elif "ranged" in tags:
family = "range weapon"
elif "melee" in tags:
family = "melee weapon"
elif "armor" in tags:
family = "armor"
origin = "common" # item_origine.typ
if "refugee" in tags:
origin = "refugee"
elif "tribe" in tags:
origin = "tribe"
elif "karavan" in tags:
origin = "karavan"
elif "kami" in tags:
origin = "kami"
elif "fyros" in tags:
origin = "fyros"
elif "matis" in tags:
origin = "matis"
elif "zorai" in tags:
origin = "zorai"
elif "tryker" in tags:
origin = "tryker"
dropOrSell = not "refugee" in tags
armorCategory = "unknown" # item_category.typ
if "heavy" in tags:
armorCategory = "Heavy"
elif "medium" in tags:
armorCategory = "medium"
elif "light" in tags:
armorCategory = "light"
elif "melee" in tags:
armorCategory = "hands"
elif "ranged" in tags:
armorCategory = "hands"
elif "magic" in tags:
armorCategory = "hands"
elif "refugee" in tags:
armorCategory = "light"
iconOverlay = ""
if "refugee" in tags:
iconOverlay = "pw_light.png"
elif "light" in tags:
iconOverlay = "pw_light.png"
elif "medium" in tags:
iconOverlay = "pw_medium.png"
elif "heavy" in tags:
iconOverlay = "pw_heavy.png"
neverHide = False
icon = ""
animSet = ""
itemType = "undefined" # item_type.typ
leftHandSlot = "Undefined" # item_slot_type.typ
rightHandSlot = "Undefined" # item_slot_type.typ
if "magic" in tags:
if "amplifier" in tags:
if "gloves" in tags:
itemType = "Magician Staff"
icon = "mg_glove.png"
neverHide = True
rightHandSlot = "Two Hands"
elif "melee" in tags:
if "one-handed" in tags:
animSet = "1H"
rightHandSlot = "Right Hand"
if "dagger" in tags:
itemType = "Dagger"
animSet = "Dagger"
icon = "mw_dagger.png"
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"
elif "axe" in tags:
itemType = "Axe"
icon = "mw_axe.png"
elif "spear" in tags:
itemType = "Spear"
icon = "mw_lance.png"
elif "staff" in tags:
itemType = "Staff"
icon = "mw_staff.png"
if "two-handed" in tags:
animSet = "2H"
rightHandSlot = "Two Hands"
if "sword" in tags:
itemType = "Two Hand Sword"
animSet = "2H Sword"
icon = "mw_2h_sword.png"
elif "axe" in tags:
itemType = "Two Hand Axe"
icon = "mw_2h_axe.png"
elif "pike" in tags:
itemType = "Pike"
animSet = "2H Lance"
icon = "mw_2h_lance.png"
elif "mace" in tags:
itemType = "Two Hand Mace"
icon = "mw_2h_mace.png"
elif "ranged" in tags:
if "autolauncher" in tags:
itemType = "Autolauch"
elif "bowrifle" in tags:
itemType = "Bowrifle"
elif "launcher" in tags:
itemType = "Launcher"
elif "pistol" in tags:
itemType = "Pistol"
elif "bowpistol" in tags:
itemType = "Bowpistol"
elif "rifle" in tags:
itemType = "Rifle"
elif "harpoon" in tags:
itemType = "Harpoon"
if "ammo" in tags and itemType != "undefined":
itemType += " ammo"
elif "shield" in tags:
leftHandSlot = "Left Hand"
animSet = "Shield"
if "buckler" in tags:
icon = "sh_buckler.png"
itemType = "Buckler"
elif "large" in tags:
icon = "sh_large_shield.png"
itemType = "Shield"
elif "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"
elif "gloves" in tags:
itemType += "gloves"
elif "pants" in tags:
itemType += "pants"
elif "sleeves" in tags:
itemType += "Sleeves"
elif "vest" in tags:
itemType += "vest"
elif "helmet" in tags and "heavy" in tags:
itemType += "helmet"
else:
itemType = "undefined"
damageType = "undefined" # item_damage_type.typ
if "piercing" in tags:
damageType = "Piercing"
elif "slashing" in tags:
damageType = "Slashing"
elif "blunt" in tags or "magic" in tags:
damageType = "Blunt"
# craftingTool = "None" # item_crafting_tool_type.typ
# if "armor" in tags:
# craftingTool = "ArmorTool"
folder = "_"
if "ammo" in tags:
folder = "ammo"
elif "ranged" in tags:
folder = "range_weapon"
elif "melee" in tags:
folder = "melee_weapon"
elif "armor" in tags:
folder = "armor"
elif "shield" in tags:
folder = "shield"
if "shared" in tags and not "melee" in tags:
malus = 0
bulk = 4 # TODO: Calibrate
equipTicks = 10 # TODO: Calibrate
if "one-handed" in tags:
malus += 0.01 # TODO: Calibrate
bulk += 2 # TODO: Calibrate
equipTicks += 10 # TODO: Calibrate
if "two-handed" in tags:
malus += 0.02 # TODO: Calibrate
bulk += 4 # TODO: Calibrate
equipTicks += 20 # TODO: Calibrate
if "medium" in tags:
malus += 0.01 # TODO: Calibrate
bulk += 2 # TODO: Calibrate
equipTicks += 10 # TODO: Calibrate
if "heavy" in tags:
malus += 0.02 # TODO: Calibrate
bulk += 4 # TODO: Calibrate
equipTicks += 20 # TODO: Calibrate
if "buckler" in tags:
malus += 0.01 # TODO: Calibrate
bulk += 2 # TODO: Calibrate
equipTicks += 10 # TODO: Calibrate
if "large" in tags:
malus += 0.02 # TODO: Calibrate
bulk += 4 # TODO: Calibrate
equipTicks += 20 # TODO: Calibrate
if "magic" in tags:
malus = 0
bulk += 2 # TODO: Calibrate
equipTicks += 10 # TODO: Calibrate
comments = "TODO: WearEquipmentMalus, Bulk, Time to Equip In Ticks"
dir = sitemPath + "\\" + folder + "\\_parent"
if not os.path.isdir(dir):
os.makedirs(dir)
path = dir + "\\" + name + ".sitem"
print(path)
with open(path, "w") as f:
f.write("<?xml version=\"1.0\"?>\n")
f.write("<FORM Revision=\"4.0\" State=\"modified\">\n")
f.write(" <STRUCT>\n")
f.write(" <STRUCT Name=\"basics\">\n")
f.write(" <ATOM Name=\"name\" Value=\"" + displayName + "\"/>\n")
if origin != "common":
f.write(" <ATOM Name=\"origin\" Value=\"" + origin + "\"/>\n")
if family != "undefined":
f.write(" <ATOM Name=\"family\" Value=\"" + family + "\"/>\n")
if not dropOrSell:
f.write(" <ATOM Name=\"Drop or Sell\" Value=\"false\"/>\n")
if itemType != "undefined":
f.write(" <ATOM Name=\"ItemType\" Value=\"" + itemType + "\"/>\n")
if "armor" not in tags or malus != 0:
f.write(" <STRUCT Name=\"EquipmentInfo\">\n")
if "armor" not in tags:
f.write(" <ARRAY Name=\"EquipmentSlots\">\n")
if leftHandSlot != "Undefined":
f.write(" <ATOM Name=\"left_hand\" Value=\"" + leftHandSlot + "\"/>\n")
if rightHandSlot != "Undefined":
f.write(" <ATOM Name=\"right hand\" Value=\"" + rightHandSlot + "\"/>\n")
f.write(" </ARRAY>\n")
if malus != 0:
f.write(" <ATOM Name=\"WearEquipmentMalus\" Value=\"" + str(malus) + "\"/>\n")
f.write(" </STRUCT>\n")
f.write(" <ATOM Name=\"Bulk\" Value=\"" + str(bulk) + "\"/>\n")
f.write(" <ATOM Name=\"Time to Equip In Ticks\" Value=\"" + str(equipTicks) + "\"/>\n")
f.write(" </STRUCT>\n")
if "melee" in tags and damageType != "undefined":
f.write(" <STRUCT Name=\"melee weapon\">\n")
if damageType != "undefined":
f.write(" <ATOM Name=\"damage type\" Value=\"" + damageType + "\">\n")
f.write(" </STRUCT>\n")
if "armor" in tags and armorCategory != "unknown":
f.write(" <STRUCT Name=\"armor\">\n")
f.write(" <ATOM Name=\"Armor category\" Value=\"" + armorCategory + "\"/>\n")
f.write(" </STRUCT>\n")
if "shield" in tags:
f.write(" <STRUCT Name=\"shield\">\n")
if "large" in tags:
f.write(" <ATOM Name=\"Category\" Value=\"large shield\"/>\n")
else:
f.write(" <ATOM Name=\"Category\" Value=\"small shield\"/>\n")
f.write(" </STRUCT>\n")
f.write(" <STRUCT Name=\"3d\">\n")
if icon != "":
f.write(" <ATOM Name=\"icon\" Value=\"" + icon + "\"/>\n")
if iconOverlay != "":
f.write(" <ATOM Name=\"icon overlay\" Value=\"" + iconOverlay + "\"/>\n")
if "armor" in tags:
f.write(" <ATOM Name=\"color\" Value=\"UserColor\"/>\n")
if animSet != "":
f.write(" <ATOM Name=\"anim_set\" Value=\"" + animSet + "\"/>\n")
if neverHide:
f.write(" <ATOM Name=\"never hide when equiped\" Value=\"true\"/>\n")
f.write(" </STRUCT>\n")
f.write(" </STRUCT>\n")
f.write("</FORM>\n")
f.flush()
def generateSitems():
for match in matchSitemShape:
name = match[0]
shapeMale = match[1]
shapeFemale = match[2]
tags = sitemTags[name]
# print(name)
# print(shapeMale)
# print(shapeFemale)
# print(tags)
generateParents()
generateSitems()

@ -6,7 +6,7 @@ scheme = {
{
"i": "item",
"b": "brick",
"_c": "parent craftable",
"_c": "parent shared",
"_g": "parent generic",
},
{

@ -1,19 +1,19 @@
_c_ah _c_ah parent craftable unspecified heavy armor
_c_al _c_al parent craftable unspecified light armor
_c_am _c_am parent craftable unspecified medium armor
_c_ar _c_ar parent craftable unspecified refugee armor
_c_m1bm _c_m1bm parent craftable unspecified melee one-handed blunt mace
_c_m1pd _c_m1pd parent craftable unspecified melee one-handed piercing dagger
_c_m1ps _c_m1ps parent craftable unspecified melee one-handed piercing spear
_c_m1sa _c_m1sa parent craftable unspecified melee one-handed slashing axe
_c_m1ss _c_m1ss parent craftable unspecified melee one-handed slashing sword
_c_m2bm _c_m2bm parent craftable unspecified melee two-handed blunt mace
_c_m2ms _c_m2ms parent craftable unspecified melee two-handed magic amplifier gloves
_c_m2pp _c_m2pp parent craftable unspecified melee two-handed piercing pike
_c_m2sa _c_m2sa parent craftable unspecified melee two-handed slashing axe
_c_m2ss _c_m2ss parent craftable unspecified melee two-handed slashing sword
_c_sb _c_sb parent craftable unspecified buckler shield
_c_ss _c_ss parent craftable unspecified large shield
_c_ah _c_ah parent shared unspecified heavy armor
_c_al _c_al parent shared unspecified light armor
_c_am _c_am parent shared unspecified medium armor
_c_ar _c_ar parent shared unspecified refugee armor
_c_m1bm _c_m1bm parent shared unspecified melee one-handed blunt mace
_c_m1pd _c_m1pd parent shared unspecified melee one-handed piercing dagger
_c_m1ps _c_m1ps parent shared unspecified melee one-handed piercing spear
_c_m1sa _c_m1sa parent shared unspecified melee one-handed slashing axe
_c_m1ss _c_m1ss parent shared unspecified melee one-handed slashing sword
_c_m2bm _c_m2bm parent shared unspecified melee two-handed blunt mace
_c_m2ms _c_m2ms parent shared unspecified melee two-handed magic amplifier gloves
_c_m2pp _c_m2pp parent shared unspecified melee two-handed piercing pike
_c_m2sa _c_m2sa parent shared unspecified melee two-handed slashing axe
_c_m2ss _c_m2ss parent shared unspecified melee two-handed slashing sword
_c_sb _c_sb parent shared unspecified buckler shield
_c_ss _c_ss parent shared unspecified large shield
_gfa_c _gfa_c parent generic fyros caster armor base
_gfa_h _gfa_h parent generic fyros heavy armor base
_gfa_l _gfa_l parent generic fyros light armor base
@ -30,3 +30,15 @@ _gza_c _gza_c parent generic zorai caster armor base
_gza_h _gza_h parent generic zorai heavy armor base
_gza_l _gza_l parent generic zorai light armor base
_gza_m _gza_m parent generic zorai medium armor base
_gca_c _gca_c parent generic common caster armor base
_gca_h _gca_h parent generic common heavy armor base
_gca_l _gca_l parent generic common light armor base
_gca_m _gca_m parent generic common medium armor base
_gkara_c _gkara_c parent generic karavan caster armor base
_gkara_h _gkara_h parent generic karavan heavy armor base
_gkara_l _gkara_l parent generic karavan light armor base
_gkara_m _gkara_m parent generic karavan medium armor base
_gkama_c _gkama_c parent generic kami caster armor base
_gkama_h _gkama_h parent generic kami heavy armor base
_gkama_l _gkama_l parent generic kami light armor base
_gkama_m _gkama_m parent generic kami medium armor base

Can't render this file because it has a wrong number of fields in line 5.

@ -30,3 +30,15 @@ _gza_c.sitem
_gza_h.sitem
_gza_l.sitem
_gza_m.sitem
_gca_c.sitem
_gca_h.sitem
_gca_l.sitem
_gca_m.sitem
_gkara_c.sitem
_gkara_h.sitem
_gkara_l.sitem
_gkara_m.sitem
_gkama_c.sitem
_gkama_h.sitem
_gkama_l.sitem
_gkama_m.sitem

Loading…
Cancel
Save