diff --git a/ryzom/tools/extract_r2_required/brick_families.tsv b/ryzom/tools/extract_r2_required/brick_families.tsv new file mode 100644 index 000000000..940d673c0 --- /dev/null +++ b/ryzom/tools/extract_r2_required/brick_families.tsv @@ -0,0 +1,225 @@ +BC crafted +BCP power +BCPA * +BCF fyros +BCFM melee +BCFME * +BCFMEA * +BCFR ranged +BCFRE * +BCFREA * +BCFP ammo +BCFPE * +BCFPEA * +BCFA armor +BCFAE * +BCFAEA light +BCFAEB medium +BCFAEC heavy +BCFAED caster +BCFS shield +BCFSE * +BCFSEA * +BCFJ jewelry +BCFJE * +BCFJEA * +BCC common +BCCM melee +BCCME * +BCCMEA * +BCCR ranged +BCCRE * +BCCREA * +BCCP ammo +BCCPE * +BCCPEA * +BCCA armor +BCCAE * +BCCAEA light +BCCAEB medium +BCCAEC heavy +BCCAED caster +BCCS shield +BCCSE * +BCCSEA * +BCCJ jewelry +BCCJE * +BCCJEA * +BCB tribe +BCBM melee +BCBME * +BCBMEA * +BCBR ranged +BCBRE * +BCBREA * +BCBP ammo +BCBPE * +BCBPEA * +BCBA armor +BCBAE * +BCBAEA light +BCBAEB medium +BCBAEC heavy +BCBAED caster +BCBS shield +BCBSE * +BCBSEA * +BCBJ jewelry +BCBJE * +BCBJEA * +BCF fyros +BCFM melee +BCFME * +BCFMEA * +BCFR ranged +BCFRE * +BCFREA * +BCFP ammo +BCFPE * +BCFPEA * +BCFA armor +BCFAE * +BCFAEA light +BCFAEB medium +BCFAEC heavy +BCFAED caster +BCFS shield +BCFSE * +BCFSEA * +BCFJ jewelry +BCFJE * +BCFJEA * +BCM matis +BCMM melee +BCMME * +BCMMEA * +BCMR ranged +BCMRE * +BCMREA * +BCMP ammo +BCMPE * +BCMPEA * +BCMA armor +BCMAE * +BCMAEA light +BCMAEB medium +BCMAEC heavy +BCMAED caster +BCMS shield +BCMSE * +BCMSEA * +BCMJ jewelry +BCMJE * +BCMJEA * +BCT tryker +BCTM melee +BCTME * +BCTMEA * +BCTR ranged +BCTRE * +BCTREA * +BCTP ammo +BCTPE * +BCTPEA * +BCTA armor +BCTAE * +BCTAEA light +BCTAEB medium +BCTAEC heavy +BCTAED caster +BCTS shield +BCTSE * +BCTSEA * +BCTJ jewelry +BCTJE * +BCTJEA * +BCZ zorai +BCZM melee +BCZME * +BCZMEA * +BCZR ranged +BCZRE * +BCZREA * +BCZP ammo +BCZPE * +BCZPEA * +BCZA armor +BCZAE * +BCZAEA light +BCZAEB medium +BCZAEC heavy +BCZAED caster +BCZS shield +BCZSE * +BCZSEA * +BCZJ jewelry +BCZJE * +BCZJEA * +BCR refugee +BCRM melee +BCRME * +BCRMEA * +BCRR ranged +BCRRE * +BCRREA * +BCRP ammo +BCRPE * +BCRPEA * +BCRA armor +BCRAE * +BCRAEA light +BCRAEB medium +BCRAEC heavy +BCRAED caster +BCRS shield +BCRSE * +BCRSEA * +BCRJ jewelry +BCRJE * +BCRJEA * +BCK kami karavan +BCKA * +BCKAM kami +BCKAMM melee +BCKAMME * +BCKAMMEA * +BCKAMR ranged +BCKAMRE * +BCKAMREA * +BCKAMP ammo +BCKAMPE * +BCKAMPEA * +BCKAMA armor +BCKAMAE * +BCKAMAEA light +BCKAMAEB medium +BCKAMAEC heavy +BCKAMAED caster +BCKAMS shield +BCKAMSE * +BCKAMSEA * +BCKAMJ jewelry +BCKAMJE * +BCKAMJEA * +BCKAR karavan +BCKARM melee +BCKARME * +BCKARMEA * +BCKARR ranged +BCKARRE * +BCKARREA * +BCKARP ammo +BCKARPE * +BCKARPEA * +BCKARA armor +BCKARAE * +BCKARAEA light +BCKARAEB medium +BCKARAEC heavy +BCKARAED caster +BCKARS shield +BCKARSE * +BCKARSEA * +BCKARJ jewelry +BCKARJE * +BCKARJEA * diff --git a/ryzom/tools/extract_r2_required/generate_sitem.py b/ryzom/tools/extract_r2_required/generate_sitem.py index 74c8a03ba..46f3180b3 100644 --- a/ryzom/tools/extract_r2_required/generate_sitem.py +++ b/ryzom/tools/extract_r2_required/generate_sitem.py @@ -8,11 +8,131 @@ def loadTsv(filename): table += [ l.strip().split("\t") ] return table; +# brick family +# BC brick craft +# BCB tribe +# BCBM melee +# BCBME effect (item) +# BCBMEA * +# BCBR ranged +# BCBREA * +# BCCA armor +# BCCAEA light +# BCCAEB medium +# BCCAEC heavy +# BCCAED caster +# BCCP ammo +# BCCPEA * +# BCCS shield +# BCCSEA * +# BCFJ jewelry +# BCFJC craft +# BCFJE effect (item) +# BCFJEA * + +# also generate its sphrase under sphrase\craft\melee_weapon etc, +# name add 'a' to the start, containing just sbrick and castable false + +# brick skill +# SC skill craft (LearnRequiresOneOfSkills "SC 0") +# SCJ jewelry +# SCJR ring +# SCJRAEM * +# SCAMBEM skill craft armor medium boots +# SCAMGEM skill craft armor medium gloves +# SCAMPEM skill craft armor medium pants +# SCAMSEM skill craft armor medium sleeves +# SCAMVEM skill craft armor medium vest +# SCAH heavy +# SCAL light (and caster) + + sitemParents = loadTsv("sitem_parents.tsv") sitemParsed = loadTsv("sitem_parsed.tsv") shapeParsed = loadTsv("shape_parsed.tsv") matchSitemShape = loadTsv("match_sitem_shape.tsv") +skills = loadTsv("skills.tsv") +skillTree = { "S": { "tags": [ "*" ], "entries": {} } } + +brickFamilies = loadTsv("brick_families.tsv") +brickFamilyTree = { "B": { "tags": [ "*" ], "entries": {} } } + +def buildTagTree(tree, table): + for entry in table: + e = filter(None, entry) + name = e[0] + print(name) + tags = e[1:] + nb = 0 + branch = tree + if len(tags) > 0: + for c in name: + nb += 1 + if nb >= len(name): + break + branch = branch[c]["entries"] + branch[name[-1]] = { "tags": tags, "entries": {} } + print(tree) + +buildTagTree(skillTree, skills) +buildTagTree(brickFamilyTree, brickFamilies) + +def findTreeEntry(tree, tags): + res = "" + branch = tree + while True: + ok = False + if len(branch) == 0: + break + for entry in branch: + #print(entry) + for tag in branch[entry]["tags"]: + if tag != "*" and tag in tags: + ok = True + break + if ok: + res += entry + branch = branch[entry]["entries"] + break + if not ok: + for entry in branch: + #print(entry) + #print(branch[entry]["tags"]) + for tag in branch[entry]["tags"]: + if tag == "*": + ok = True + break + if ok: + res += entry + branch = branch[entry]["entries"] + break + if not ok: + break + return res + +def findSkill(tags): + t = tags[:] + if "ammo" in t and "ranged" in t: + t.remove("ranged") + if "magic" in t and "two-handed" in t: + t.remove("two-handed") + res = findTreeEntry(skillTree, t) + if len(res) == 7: + return res + print("Skill: " + res + ", tags: ") + print(tags) + return "" + +def findBrickFamily(tags): + t = tags[:] + if "ammo" in t and "ranged" in t: + t.remove("ranged") + if "caster" in t and "light" in t: + t.remove("light") + res = findTreeEntry(brickFamilyTree, t) + return res + sitemTags = {} sitemPath = "Y:\\ryzomcore4\\leveldesign\\game_element\\sitem" @@ -347,6 +467,18 @@ def generateParents(): # f.write("\n") # f.flush() +def findSitemParent(tags): + for parent in parentTags: + pt = parentTags[parent] + all = len(pt) > 0 + for tag in pt: + if not tag in tags: + all = False + break + if all: + return parent + return None + def generateSitems(): for match in matchSitemShape: name = match[0] @@ -471,7 +603,7 @@ def generateSitems(): color = "White" subfolder = origin - print tags + ###print tags if "underwear" in tags: subfolder = "underwear" @@ -483,7 +615,7 @@ def generateSitems(): elif "melee" in tags: folder = "melee_weapon\\" + subfolder elif "armor" in tags: - print shapeMale + ###print shapeMale folder = "armor\\" + subfolder if "caster01" in shapeMale or "caster" in tags: folder += "\\caster_armor" @@ -514,11 +646,16 @@ def generateSitems(): if "armor" in tags and "refugee" in tags: continue # No need to generate these for now + parent = findSitemParent(tags) + if not parent: + print("No parent for sitem: " + name + ", tags: " + tags) + print(path) with open(path, "w") as f: f.write("\n") f.write("
\n") f.flush() - - # TODO: Find the best parent sheet - # TODO: Extract the sbrick identifiers - # TODO: Generate the sbrick + + # TODO: Load the sbrick family index table + # TODO: Generate the sbrick + + skill = findSkill(tags) + if "magic" in tags: + print("TODO: Double check magic") + print(skill) + print(tags) + + brickFamily = findBrickFamily(tags) + print(brickFamily) generateParents() generateSitems() diff --git a/ryzom/tools/extract_r2_required/skills.tsv b/ryzom/tools/extract_r2_required/skills.tsv new file mode 100644 index 000000000..3b872d7b0 --- /dev/null +++ b/ryzom/tools/extract_r2_required/skills.tsv @@ -0,0 +1,225 @@ +SC crafted +SCA armor +SCAH heavy +SCAHB boots +SCAHBE * +SCAHBEM * +SCAHG gloves +SCAHGE * +SCAHGEM * +SCAHH helmet +SCAHHE * +SCAHHEM * +SCAHP pants +SCAHPE * +SCAHPEM * +SCAHS sleeves +SCAHSE * +SCAHSEM * +SCAHV vest +SCAHVE * +SCAHVEM * +SCAL light +SCALB boots +SCALBE * +SCALBEM * +SCALG gloves +SCALGE * +SCALGEM * +SCALP pants +SCALPE * +SCALPEM * +SCALS sleeves +SCALSE * +SCALSEM * +SCALV vest +SCALVE * +SCALVEM * +SCAM medium +SCAMB boots +SCAMBE * +SCAMBEM * +SCAMG gloves +SCAMGE * +SCAMGEM * +SCAMP pants +SCAMPE * +SCAMPEM * +SCAMS sleeves +SCAMSE * +SCAMSEM * +SCAMV vest +SCAMVE * +SCAMVEM * +SCAS shield +SCASB buckler +SCASBE * +SCASBEM * +SCASS large +SCASSE * +SCASSEM * +SCJ jewelry +SCJA anklet +SCJAA * +SCJAAE * +SCJAAEM * +SCJB bracelet +SCJBA * +SCJBAE * +SCJBAEM * +SCJD diadem +SCJDA * +SCJDAE * +SCJDAEM * +SCJE earring +SCJEA * +SCJEAE * +SCJEAEM * +SCJP pendant +SCJPA * +SCJPAE * +SCJPAEM * +SCJR ring +SCJRA * +SCJRAE * +SCJRAEM * +SCM melee magic +SCM1 one-handed +SCM1A axe +SCM1AE * +SCM1AEM * +SCM1D dagger +SCM1DE * +SCM1DEM * +SCM1M mace +SCM1ME * +SCM1MEM * +SCM1P spear +SCM1PE * +SCM1PEM * +SCM1S sword +SCM1SE * +SCM1SEM * +SCM1T staff +SCM1TE * +SCM1TEM * +SCM2 two-handed +SCM2A axe +SCM2AE * +SCM2AEM * +SCM2M mace +SCM2ME * +SCM2MEM * +SCM2P pike +SCM2PE * +SCM2PEM * +SCM2S sword +SCM2SE * +SCM2SEM * +SCMC amplifier +SCMCA gloves +SCMCAE * +SCMCAEM * +SCR ranged +SCR1 one-handed +SCR1P * +SCR1PE * +SCR1PEM * +SCR2 two-handed +SCR2A autolauncher +SCR2AE * +SCR2AEM * +SCR2L launcher +SCR2LE * +SCR2LEM * +SCR2R rifle bowrifle +SCR2RE * +SCR2REM * +SF +SFM +SFM1 +SFM1B +SFM1BM +SFM1BMM +SFM1BS +SFM1BSM +SFM1P +SFM1PS +SFM1PSM +SFM1S +SFM1SA +SFM1SAM +SFM1SS +SFM1SSM +SFM2 +SFM2B +SFM2BM +SFM2BMM +SFM2P +SFM2PP +SFM2PPM +SFM2S +SFM2SA +SFM2SAM +SFM2SS +SFM2SSM +SFMC +SFMCA +SFMCAD +SFMCADM +SFMCAH +SFMCAHM +SFR +SFR1 +SFR1A +SFR1AP +SFR1APM +SFR2 +SFR2A +SFR2AA +SFR2AAM +SFR2AL +SFR2ALM +SFR2AR +SFR2ARM +SH +SHF +SHFD +SHFDA +SHFDAE +SHFDAEM +SHFF +SHFFA +SHFFAE +SHFFAEM +SHFJ +SHFJA +SHFJAE +SHFJAEM +SHFL +SHFLA +SHFLAE +SHFLAEM +SHFP +SHFPA +SHFPAE +SHFPAEM +SM +SMD +SMDA +SMDAA +SMDAAE +SMDAAEM +SMDH +SMDHA +SMDHAE +SMDHAEM +SMO +SMOA +SMOAA +SMOAAE +SMOAAEM +SMOE +SMOEA +SMOEAE +SMOEAEM