Add an alltalents patch

This commit is contained in:
2025-03-28 16:19:21 +01:00
parent 0febda0c6b
commit 38771b643e

View File

@@ -9,7 +9,7 @@
slotsperrow = slotsperrow + 1
end
files:
- '**/*.xml'
- "**/*.xml"
- name: containerscontainable
regex: (?-s)Containable!anyitems="([^"]+)"
@@ -21,7 +21,7 @@
end
local gurantee = {"ammobox", "deepdiving", "smallitem", "mediumitem", "largeitem"}
local has = {}
local items = strsplit(s1, ",")
for i, item in pairs(items) do
for _, g in pairs(gurantee) do
@@ -30,55 +30,132 @@
end
end
end
for _, g in pairs(gurantee) do
if not has[g] then
s1 = s1 .. "," .. g
end
end
files:
- '**/*.xml'
- "**/*.xml"
- name: excludeditems
regex: <Containable!any(\s?excludeditems="[^"]+")
lua: |
s1 = ""
files:
- '**/*.xml'
- "**/*.xml"
- name: upgrade
regex: (?:maxforce|capacity|maxrechargespeed|overloadvoltage|healthmultiplier|maxhealth|fabricationspeed|deconstructionspeed|rotationspeedlowskill|offsetonselectedmultiplier|range|maxpoweroutput|meltdowndelay|maxflow|fixdurationlowskill|skillrequirementmultiplier)="\+?!num%?"
lua: |
*2
files:
- '**/UpgradeModules.xml'
- "**/UpgradeModules.xml"
- name: upgradetooltip
regex: 'increaseontooltip="(?<increaseontooltip>!num)"'
lua: |
increaseontooltip=increaseontooltip*2
files:
- '**/UpgradeModules.xml'
- "**/UpgradeModules.xml"
- name: missionreward
regex: 'reward="!num'
lua: |
*4
files:
- '**/Missions.xml'
- "**/Missions.xml"
- name: maxstacksize
regex: 'maxstacksize="!num'
lua: |
*2
files:
- '**/*.xml'
- "**/*.xml"
- name: lightrange
regex: '(?-s)LightComponent!anyrange="(!num)"'
lua: |
*4
files:
- '**/*.xml'
- "**/*.xml"
- name: toolrange
regex: (?-s)RepairTool!anyrange="!num"
lua: |
*4
files:
- "**/*.xml"
- name: alltalents
regex: <TalentTrees>(!any)</TalentTrees>
lua: |
-- group by job, tier, identifier
local talents = {}
local numtalents = 0
local lines = strsplit(s1, "\n")
local cookedlines = {}
local currentTier = 0
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
end
if line:find("<TalentOptions") then
currentTier = currentTier + 1
talents[currentjob] = talents[currentjob] or {}
talents[currentjob][currentTier] = talents[currentjob][currentTier] or {}
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
else
-- Filter out the "TalentOption" lines
cookedlines[#cookedlines + 1] = line
end
end
--DumpTable(talents)
currentTier = 0
currentjob = nil
local alltalents = {}
for lineidx, line in pairs(cookedlines) do
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
end
end
end
end
s1 = table.concat(alltalents, "\n")
files:
- "**/TalentTrees.xml"
- name: talenttrees
regex: (<TalentOptions!any>!any</TalentOptions>)
@@ -104,11 +181,4 @@
local optionsElement = optionsElement:gsub("<TalentOptions", "<TalentOptions maxchosentalents=\"" .. talentOptions .. "\"")
replacement = s1:gsub(lines[1], optionsElement)
files:
- '**/TalentTrees.xml'
- name: toolrange
regex: (?-s)RepairTool!anyrange="!num"
lua: |
*4
files:
- '**/*.xml'
- "**/TalentTrees.xml"