from retail

This commit is contained in:
NoM0Re
2025-01-25 23:37:36 +01:00
parent 4a326118da
commit 667a2f3f50
34 changed files with 788 additions and 242 deletions
+170
View File
@@ -1533,6 +1533,176 @@ function Private.Modernize(data, oldSnapshot)
end
end
if data.internalVersion < 76 then
local function removeHoles(t)
local keys = {}
for key in pairs(t) do
table.insert(keys, key)
end
if #keys ~= #t then
table.sort(keys)
local newTable = {}
for i, key in ipairs(keys) do
newTable[i] = t[key]
end
return newTable
else
return t
end
end
local trigger_migration = {
["Spell Cast Succeeded"] = {
"spellId",
},
["Unit Characteristics"] = {
"level",
},
["Power"] = {
"power",
"percentpower",
"deficit",
"maxpower",
},
["Combat Log"] = {
"spellId",
"spellName",
},
["Health"] = {
"health",
"percenthealth",
"deficit",
"maxhealth",
},
["Location"] = {
"zone",
"subzone",
},
["Threat Situation"] = {
"threatpct",
"rawthreatpct",
"threatvalue",
},
["Character Stats"] = {
"strength",
"agility",
"stamina",
"intellect",
"spirit",
"attackpower",
"spellpower",
"rangedattackpower",
"criticalrating",
"criticalpercent",
"hitrating",
"hitpercent",
"hasterating",
"hastepercent",
"expertiserating",
"expertisebonus",
"armorpenrating",
"armorpenpercent",
"spellpenpercent",
"resiliencerating",
"resiliencepercent",
"expertisebonus",
"expertiserating",
"resistancefire",
"resistancenature",
"resistancefrost",
"resistanceshadow",
"resistancearcane",
"movespeedpercent",
"dodgerating",
"dodgepercent",
"parryrating",
"parrypercent",
"blockpercent",
"blockvalue",
"armorrating",
"armorpercent",
},
["Cast"] = {
"spellNames",
"spellIds",
},
}
for _, triggerData in ipairs(data.triggers) do
local trigger = triggerData.trigger
local fieldsToMigrate = trigger_migration[trigger.event]
if fieldsToMigrate then
for _, field in ipairs(fieldsToMigrate) do
if type(trigger[field]) == "table" then
trigger[field] = removeHoles(trigger[field])
end
end
end
end
end
--[[if data.internalVersion < 77 then
-- fix data broken by wago export
local triggerFix = {
talent = {
multi = true
},
herotalent = {
multi = true
},
form = {
multi = true
},
specId = {
multi = true
},
actualSpec = true,
arena_spec = true
}
local loadFix = {
talent = {
multi = true
},
talent2 = {
multi = true
},
talent3 = {
multi = true
},
herotalent = {
multi = true
},
class_and_spec = {
multi = true
}
}
local function fixData(data, fields)
for k, v in pairs(fields) do
if v == true and type(data[k]) == "table" then
-- fix field k
local tofix = {}
for key in pairs(data[k]) do
if type(key) == "string" then
table.insert(tofix, key)
end
end
for _, oldkey in ipairs(tofix) do
local newkey = tonumber(oldkey)
if newkey then
data[k][newkey] = data[k][oldkey]
end
data[k][oldkey] = nil
end
elseif type(v) == "table" and type(data[k]) == "table" then
-- recurse
fixData(data[k], fields[k])
end
end
end
for _, triggerData in ipairs(data.triggers) do
fixData(triggerData.trigger, triggerFix)
end
fixData(data.load, loadFix)
end]]
data.internalVersion = max(data.internalVersion or 0, WeakAuras.InternalVersion())
end