Rework alltalents to be more user friendlier
This commit is contained in:
@@ -90,72 +90,52 @@
|
||||
- name: alltalents
|
||||
regex: <TalentTrees>(!any)</TalentTrees>
|
||||
lua: |
|
||||
-- group by job, tier, identifier
|
||||
local talents = {}
|
||||
local numtalents = 0
|
||||
-- group by job
|
||||
local subtrees = {}
|
||||
local lines = strsplit(s1, "\n")
|
||||
local cookedlines = {}
|
||||
|
||||
local currentTier = 0
|
||||
local isInSubtree = false
|
||||
local currentjob = nil
|
||||
-- print(#lines)
|
||||
for i, line in pairs(lines) do
|
||||
if line:match("<TalentTree jobidentifier=\"(%w+)\"") then
|
||||
currentjob = line:match("<TalentTree jobidentifier=\"(%w+)\"")
|
||||
talents[currentjob] = talents[currentjob] or {}
|
||||
-- print(currentjob)
|
||||
currentTier = 0
|
||||
subtrees[currentjob] = subtrees[currentjob] or {}
|
||||
end
|
||||
if line:find("<TalentOptions") then
|
||||
currentTier = currentTier + 1
|
||||
talents[currentjob] = talents[currentjob] or {}
|
||||
talents[currentjob][currentTier] = talents[currentjob][currentTier] or {}
|
||||
if line:find("<SubTree") then
|
||||
isInSubtree = true
|
||||
end
|
||||
|
||||
local identifier = line:match("TalentOption identifier=\"(%w+)\"")
|
||||
-- print(identifier)
|
||||
if identifier then
|
||||
numtalents = numtalents + 1
|
||||
--print(currentjob, currentTier, identifier)
|
||||
talents[currentjob][currentTier][identifier] = true
|
||||
if line:find("</SubTree") then
|
||||
isInSubtree = false
|
||||
subtrees[currentjob][#subtrees[currentjob] + 1] = line
|
||||
end
|
||||
if isInSubtree then
|
||||
subtrees[currentjob][#subtrees[currentjob] + 1] = line
|
||||
else
|
||||
-- Filter out the "TalentOption" lines
|
||||
cookedlines[#cookedlines + 1] = line
|
||||
if not line:find("SubTree") then
|
||||
cookedlines[#cookedlines + 1] = line
|
||||
end
|
||||
end
|
||||
end
|
||||
--DumpTable(talents)
|
||||
|
||||
currentTier = 0
|
||||
currentjob = nil
|
||||
local alltalents = {}
|
||||
for lineidx, line in pairs(cookedlines) do
|
||||
for i, line in pairs(cookedlines) do
|
||||
alltalents[#alltalents + 1] = line
|
||||
if line:match("<TalentTree jobidentifier=\"(%w+)\"") then
|
||||
currentjob = line:match("<TalentTree jobidentifier=\"(%w+)\"")
|
||||
talents[currentjob] = talents[currentjob] or {}
|
||||
-- print(currentjob)
|
||||
currentTier = 0
|
||||
end
|
||||
if line:find("<TalentOptions") then currentTier = currentTier + 1 end
|
||||
alltalents[#alltalents + 1] = line
|
||||
|
||||
if currentTier > 0 and line:find("<TalentOptions") then
|
||||
local currentIndent = line:match("^%s*")
|
||||
for _, job in pairs(talents) do
|
||||
--print(currentTier, job[currentTier])
|
||||
if not job[currentTier] then
|
||||
print("no tier ??? at " .. currentTier .. " for " .. currentjob)
|
||||
end
|
||||
for talentid, _ in pairs(job[currentTier]) do
|
||||
-- print(talent)
|
||||
local talent = "<TalentOption identifier=\"" .. talentid .. "\" />"
|
||||
alltalents[#alltalents + 1] = currentIndent .. talent
|
||||
if currentjob then
|
||||
for job, subtree in pairs(subtrees) do
|
||||
alltalents[#alltalents + 1] = table.concat(subtree, "\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
s1 = table.concat(alltalents, "\n")
|
||||
files:
|
||||
- "**/TalentTrees.xml"
|
||||
- "Content/**/TalentTrees.xml"
|
||||
|
||||
- name: talenttrees
|
||||
regex: (<TalentOptions!any>!any</TalentOptions>)
|
||||
|
Reference in New Issue
Block a user