diff --git a/WeakAuras/Modernize.lua b/WeakAuras/Modernize.lua index f1bd78f..c92d467 100644 --- a/WeakAuras/Modernize.lua +++ b/WeakAuras/Modernize.lua @@ -1196,6 +1196,7 @@ function Private.Modernize(data) end if data.internalVersion < 67 or data.internalVersion > WeakAuras.InternalVersion() then + local castMigrationNeeded = data.internalVersion < 67 data.internalVersion = WeakAuras.InternalVersion() local function migrateToTable(tab, field) local value = tab[field] @@ -1334,27 +1335,29 @@ function Private.Modernize(data) end end -- cast trigger move data from 'spell' & 'spellId' to 'spellIds' & 'spellNames' - if t.event == "Cast" and t.type == "unit" then - if t.spellId then - if t.useExactSpellId then - t.use_spellIds = t.use_spellId - t.spellIds = t.spellIds or {} - tinsert(t.spellIds, t.spellId) - else - t.use_spellNames = t.use_spellId - t.spellNames = t.spellNames or {} - tinsert(t.spellNames, t.spellId) + if castMigrationNeeded then -- Newer imports do not require cast migration + if t.event == "Cast" and t.type == "unit" then + if t.spellId then + if t.useExactSpellId then + t.use_spellIds = t.use_spellId + t.spellIds = t.spellIds or {} + tinsert(t.spellIds, t.spellId) + else + t.use_spellNames = t.use_spellId + t.spellNames = t.spellNames or {} + tinsert(t.spellNames, t.spellId) + end end + if t.use_spell and t.spell then + t.use_spellNames = true + t.spellNames = t.spellNames or {} + tinsert(t.spellNames, t.spell) + end + t.use_spellId = nil + t.spellId = nil + t.use_spell = nil + t.spell = nil end - if t.use_spell and t.spell then - t.use_spellNames = true - t.spellNames = t.spellNames or {} - tinsert(t.spellNames, t.spell) - end - t.use_spellId = nil - t.spellId = nil - t.use_spell = nil - t.spell = nil end end end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 0b9630d..baafcc5 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -2303,6 +2303,19 @@ local function removeSpellNames(data) end end +local function removeNameplateUnits(data) + for _, triggerData in ipairs(data.triggers) do + local trigger = triggerData.trigger + if trigger and trigger.type == "unit" then + if trigger.unit == "nameplate" then + trigger.unit = "target" + elseif trigger.threatUnit == "nameplate" then + trigger.threatUnit = "target" + end + end + end +end + local oldDataStub = { -- note: this is the minimal data stub which prevents false positives in diff upon reimporting an aura. -- pending a refactor of other code which adds unnecessary fields, it is possible to shrink it @@ -2499,6 +2512,9 @@ function WeakAuras.PreAdd(data) end validateUserConfig(data, data.authorOptions, data.config) removeSpellNames(data) + if not(WeakAuras.isAwesomeEnabled()) then + removeNameplateUnits(data) + end data.init_started = nil data.init_completed = nil data.expanded = nil