Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smallpatches #4793

Merged
merged 5 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3172,6 +3172,7 @@ Private.update_categories = {
"url",
"desc",
"version",
"semver"
},
default = true,
label = L["Meta Data"],
Expand Down
2 changes: 1 addition & 1 deletion WeakAurasOptions/AnimationOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ function OptionsPrivate.GetAnimationOptions(data)
softMax = 360,
bigStep = 3,
hidden = function()
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).Rotate)
return (data.animation.finish.type ~= "custom" or not OptionsPrivate.Private.EnsureRegion(id).SetAnimRotation)
end
},
finish_use_color = {
Expand Down
85 changes: 73 additions & 12 deletions WeakAurasOptions/OptionsFrames/Update.lua
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ local function BuildUidMap(data, children, type)
--- import, otherwise nil
--- @field matchedUid uid? for "update", the matched uid. Is from a different domain!
--- @field diff any for "update", the diff and the categories of that diff between the aura and its match
--- @field categories the categories
--- @field index number helpers that transport data between phase 1 and 2
--- @field total number helpers that transport data between phase 1 and 2
--- @field parentIsDynamicGroup boolean helpers that transport data between phase 1 and 2
Expand Down Expand Up @@ -1006,7 +1007,17 @@ local function SetCategories(globalCategories, categories)
end
end


local function OnlyMetaDataCategory(categories)
local metaData = false
for category in pairs(categories) do
if category == "metadata" then
metaData = true
else
return false
end
end
return metaData
end

local function GetCategories(diff, isRoot)
local categories = {}
Expand All @@ -1016,6 +1027,7 @@ local function GetCategories(diff, isRoot)
categories[category] = true
end
end

return categories
end

Expand Down Expand Up @@ -1057,11 +1069,22 @@ local function BuildDiffsHelper(uid, newUidMap, oldUidMap, matchInfo)
oldUidMap:SetDiff(matchedUid, diff, categories)
SetCategories(matchInfo.activeCategories, categories)

matchInfo.diffs[uid] = true
if isGroup then
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
matchInfo.categories[uid] = categories

if OnlyMetaDataCategory(categories) then
matchInfo.onlyMetaDataModified[uid] = true
if isGroup then
matchInfo.modifiedMetaDataGroupCount = matchInfo.modifiedMetaDataGroupCount + 1
else
matchInfo.modifiedMetaDataCount = matchInfo.modifiedMetaDataCount + 1
end
else
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
matchInfo.modified[uid] = true
if isGroup then
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
else
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
end
end
else
matchInfo.unmodified[uid] = true
Expand Down Expand Up @@ -1155,6 +1178,8 @@ end
local function hasChanges(matchInfo)
return matchInfo.modifiedCount > 0
or matchInfo.modifiedGroupCount > 0
or matchInfo.modifiedMetaDataCount > 0
or matchInfo.modifiedMetaDataGroupCount > 0
or matchInfo.addedCount > 0
or matchInfo.addedGroupCount > 0
or matchInfo.deletedCount > 0
Expand All @@ -1166,13 +1191,17 @@ local function BuildDiffs(newUidMap, oldUidMap)
local matchInfo = {
modifiedCount = 0,
modifiedGroupCount = 0,
modifiedMetaDataCount = 0,
modifiedMetaDataGroupCount = 0,
unmodifiedCount = 0,
unmodifiedGroupCount = 0,
addedCount = 0,
addedGroupCount = 0,
deletedCount = 0,
deletedGroupCount = 0,
diffs = {}, -- Contains diffs for new uids
modified = {}, -- Contains uids that were modified
onlyMetaDataModified = {}, -- Contains uids that are only metadata modified
categories = {}, -- Contains categories for uids
unmodified = {}, -- Contains new uids that had a empty diff
added = {}, -- Contains new uids that were added
deleted = {}, -- Contains old uids that were removed
Expand Down Expand Up @@ -1243,7 +1272,21 @@ local function MatchInfo(data, children, target)
return matchInfo
end

local function AddAuraList(container, uidMap, list, expandText)
local function CategoriesToDisplayText(categories)
local categoriesDisplayTexts = {}
for _, category in ipairs(OptionsPrivate.Private.update_categories) do
if categories[category.name] then
tinsert(categoriesDisplayTexts, category.label)
end
end
if #categoriesDisplayTexts > 0 then
return table.concat(categoriesDisplayTexts, ", ")
else
return nil
end
end

local function AddAuraList(container, uidMap, list, categories, expandText)
local expand = AceGUI:Create("WeakAurasExpand")
local collapsed = true
local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand"
Expand All @@ -1262,7 +1305,16 @@ local function AddAuraList(container, uidMap, list, expandText)

local sortedNames = {}
for uid in pairs(list) do
tinsert(sortedNames, uidMap:GetIdFor(uid))
if categories[uid] then
local categoriesText = CategoriesToDisplayText(categories[uid])
if categoriesText then
tinsert(sortedNames, L["%s (%s)"]:format(uidMap:GetIdFor(uid), categoriesText))
else
tinsert(sortedNames, uidMap:GetIdFor(uid))
end
else
tinsert(sortedNames, uidMap:GetIdFor(uid))
end
end
table.sort(sortedNames)

Expand Down Expand Up @@ -1369,13 +1421,22 @@ local methods = {
local matchInfoText = L["This is a modified version of your group: |cff9900FF%s|r"]:format(oldRootId)
matchInfoResult:SetText(matchInfoText)
if matchInfo.addedCount ~= 0 then
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, {},
L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
end
local modifiedCount = matchInfo.modifiedCount + matchInfo.modifiedGroupCount
if modifiedCount ~= 0 then
AddAuraList(self, matchInfo.oldUidMap, matchInfo.modified, matchInfo.categories,
L["%d |4aura:auras; modified"]:format(modifiedCount))
end
if matchInfo.modifiedCount ~= 0 then
AddAuraList(self, matchInfo.oldUidMap, matchInfo.diffs, L["%d |4aura:auras; modified"]:format(matchInfo.modifiedCount))
local onlyMetaDataModifiedCount = matchInfo.modifiedMetaDataCount + matchInfo.modifiedMetaDataGroupCount
if onlyMetaDataModifiedCount ~= 0 then
AddAuraList(self, matchInfo.oldUidMap, matchInfo.onlyMetaDataModified, {},
L["%d |4aura:auras; with meta data modified"]:format(onlyMetaDataModifiedCount))
end
if matchInfo.deletedCount ~= 0 then
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, {},
L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
end
else
matchInfoResult:SetText(L["This is a modified version of your aura, |cff9900FF%s.|r"]:format(oldRootId))
Expand Down
12 changes: 6 additions & 6 deletions WeakAurasTemplates/TriggerTemplatesData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2684,7 +2684,7 @@ templates.class.MAGE = {
{ spell = 45438, type = "buff", unit = "player", talent = 80181 }, -- Ice Block
{ spell = 80353, type = "buff", unit = "player" }, -- Time Warp
{ spell = 108839, type = "buff", unit = "player", talent = 80162 }, -- Ice Floes
{ spell = 110960, type = "buff", unit = "player", talent = 80152 }, -- Greater Invisibility
{ spell = 110960, type = "buff", unit = "player", talent = 115877 }, -- Greater Invisibility
{ spell = 116014, type = "buff", unit = "player", talent = 80171 }, -- Rune of Power
{ spell = 116267, type = "buff", unit = "player", talent = 80172 }, -- Incanter's Flow
{ spell = 205025, type = "buff", unit = "player", talent = 80208 }, -- Presence of Mind
Expand Down Expand Up @@ -2754,7 +2754,7 @@ templates.class.MAGE = {
{ spell = 80353, type = "ability", buff = true }, -- Time Warp
{ spell = 108839, type = "ability", charges = true, buff = true, talent = 80162 }, -- Ice Floes
{ spell = 108853, type = "ability", requiresTarget = true }, -- Fire Blast
{ spell = 110959, type = "ability", talent = 80152 }, -- Greater Invisibility
{ spell = 110959, type = "ability", talent = 115877 }, -- Greater Invisibility
{ spell = 113724, type = "ability", talent = 80144 }, -- Ring of Frost
{ spell = 114923, type = "ability", requiresTarget = true, talent = 80199 }, -- Nether Tempest
{ spell = 153561, type = "ability", talent = 80146 }, -- Meteor
Expand Down Expand Up @@ -2816,7 +2816,7 @@ templates.class.MAGE = {
{ spell = 48108, type = "buff", unit = "player" }, -- Hot Streak!
{ spell = 80353, type = "buff", unit = "player" }, -- Time Warp
{ spell = 108839, type = "buff", unit = "player", talent = 80162 }, -- Ice Floes
{ spell = 110960, type = "buff", unit = "player", talent = 80152 }, -- Greater Invisibility
{ spell = 110960, type = "buff", unit = "player", talent = 115877 }, -- Greater Invisibility
{ spell = 116014, type = "buff", unit = "player", talent = 80171 }, -- Rune of Power
{ spell = 116267, type = "buff", unit = "player", talent = 80172 }, -- Incanter's Flow
{ spell = 190319, type = "buff", unit = "player", talent = 80275 }, -- Combustion
Expand Down Expand Up @@ -2880,7 +2880,7 @@ templates.class.MAGE = {
{ spell = 80353, type = "ability", buff = true }, -- Time Warp
{ spell = 108839, type = "ability", charges = true, buff = true, talent = 80162 }, -- Ice Floes
{ spell = 108853, type = "ability", charges = true, requiresTarget = true, talent = 80282 }, -- Fire Blast
{ spell = 110959, type = "ability", talent = 80152 }, -- Greater Invisibility
{ spell = 110959, type = "ability", talent = 115877 }, -- Greater Invisibility
{ spell = 113724, type = "ability", talent = 80144 }, -- Ring of Frost
{ spell = 153561, type = "ability", talent = 80146 }, -- Meteor
{ spell = 157981, type = "ability", talent = 80160 }, -- Blast Wave
Expand Down Expand Up @@ -2932,7 +2932,7 @@ templates.class.MAGE = {
{ spell = 45438, type = "buff", unit = "player", talent = 80181 }, -- Ice Block
{ spell = 80353, type = "buff", unit = "player" }, -- Time Warp
{ spell = 108839, type = "buff", unit = "player", talent = 80162 }, -- Ice Floes
{ spell = 110960, type = "buff", unit = "player", talent = 80152 }, -- Greater Invisibility
{ spell = 110960, type = "buff", unit = "player", talent = 115877 }, -- Greater Invisibility
{ spell = 116014, type = "buff", unit = "player", talent = 80171 }, -- Rune of Power
{ spell = 116267, type = "buff", unit = "player", talent = 80172 }, -- Incanter's Flow
{ spell = 190446, type = "buff", unit = "player", talent = 80244 }, -- Brain Freeze
Expand Down Expand Up @@ -3003,7 +3003,7 @@ templates.class.MAGE = {
{ spell = 84714, type = "ability", talent = 80242 }, -- Frozen Orb
{ spell = 108839, type = "ability", charges = true, buff = true, talent = 80162 }, -- Ice Floes
{ spell = 108853, type = "ability", requiresTarget = true }, -- Fire Blast
{ spell = 110959, type = "ability", talent = 80152 }, -- Greater Invisibility
{ spell = 110959, type = "ability", talent = 115877 }, -- Greater Invisibility
{ spell = 113724, type = "ability", talent = 80144 }, -- Ring of Frost
{ spell = 135029, type = "ability" }, -- Water Jet
{ spell = 153561, type = "ability", talent = 80146 }, -- Meteor
Expand Down