add DummyPRDFrame, multiple Prototype Load Functions, Fix queued function in loginQueue, Refactor unit check and awesome detection

This commit is contained in:
NoM0Re
2024-12-29 13:28:40 +01:00
parent bbd4e59b48
commit afa66ff265
12 changed files with 285 additions and 60 deletions
+2 -2
View File
@@ -1817,7 +1817,7 @@ frame:RegisterEvent("PLAYER_TARGET_CHANGED")
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
frame:RegisterEvent("RAID_ROSTER_UPDATE")
frame:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
end
@@ -3294,7 +3294,7 @@ function BuffTrigger.InitMultiAura()
multiAuraFrame:RegisterEvent("UNIT_AURA")
multiAuraFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
multiAuraFrame:RegisterEvent("PLAYER_FOCUS_CHANGED")
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
multiAuraFrame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
multiAuraFrame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
end
+13 -13
View File
@@ -669,16 +669,16 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
if optionsEvent then
if Private.multiUnitUnits[data.trigger.unit] then
arg1 = next(Private.multiUnitUnits[data.trigger.unit])
elseif data.trigger.unit:sub(1, 9) == "nameplate" then
elseif data.trigger.unit == "nameplate" then
arg1 = next(C_NamePlate.GetNamePlates())
else
arg1 = data.trigger.unit
end
elseif event == "FRAME_UPDATE" and not (Private.multiUnitUnits[data.trigger.unit] or data.trigger.unit:sub(1, 9) == "nameplate") then
elseif event == "FRAME_UPDATE" and (not Private.multiUnitUnits[data.trigger.unit] or data.trigger.unit ~= "nameplate") then
arg1 = data.trigger.unit
end
if arg1 then
if Private.multiUnitUnits[data.trigger.unit] or data.trigger.unit:sub(1, 9) == "nameplate" then
if Private.multiUnitUnits[data.trigger.unit] or data.trigger.unit == "nameplate" then
unitForUnitTrigger = arg1
cloneIdForUnitTrigger = arg1
else
@@ -792,7 +792,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
end
end
if updateTriggerState and watched_trigger_events[id] and watched_trigger_events[id][triggernum] then
-- if this trigger's udpates are requested to be sent into one of the Aura's custom triggers
-- if this trigger's updates are requested to be sent into one of the Aura's custom triggers
Private.AddToWatchedTriggerDelay(id, triggernum)
end
return updateTriggerState;
@@ -1061,7 +1061,7 @@ frame.unitFrames = {};
WeakAuras.frames["WeakAuras Generic Trigger Frame"] = frame;
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
genericTriggerRegisteredEvents["PLAYER_ENTERING_WORLD"] = true;
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
genericTriggerRegisteredEvents["NAME_PLATE_UNIT_ADDED"] = true;
@@ -2610,7 +2610,7 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT");
watchUnitChange:RegisterEvent("PARTY_MEMBERS_CHANGED");
watchUnitChange:RegisterEvent("RAID_ROSTER_UPDATE");
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
watchUnitChange:RegisterEvent("NAME_PLATE_UNIT_ADDED")
watchUnitChange:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
end
@@ -2631,7 +2631,7 @@ function WeakAuras.WatchUnitChange(unit)
local newMarker = GetRaidTargetIndex(unit) or 0
if marker ~= newMarker then
watchUnitChange.raidmark[unit] = newMarker
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
@@ -2663,7 +2663,7 @@ function WeakAuras.WatchUnitChange(unit)
local newReaction = WeakAuras.GetPlayerReaction(unit)
if oldReaction ~= newReaction then
watchUnitChange.nameplateFaction[unit] = newReaction
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
@@ -2674,7 +2674,7 @@ function WeakAuras.WatchUnitChange(unit)
local oldRaidRole = watchUnitChange.unitRaidRole[unit]
local newRaidRole = WeakAuras.UnitRaidRole(unit)
if oldRaidRole ~= newRaidRole then
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_" .. unit, unit)
@@ -2693,7 +2693,7 @@ function WeakAuras.WatchUnitChange(unit)
or newMarker ~= watchUnitChange.raidmark[unit]
or event == "PLAYER_ENTERING_WORLD"
then
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
@@ -2705,7 +2705,7 @@ function WeakAuras.WatchUnitChange(unit)
local newReaction = WeakAuras.GetPlayerReaction(unit)
if oldReaction ~= newReaction then
watchUnitChange.nameplateFaction[unit] = newReaction
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
@@ -3337,7 +3337,7 @@ do
end
-- Nameplate Target
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
do
local nameplateTargetFrame = nil
local nameplateTargets = {}
@@ -3615,7 +3615,7 @@ do
local function doCastScan(firetime, unit)
scheduled_scans[unit][firetime] = nil;
if string.match(unit, "^nameplate%d+$") then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("CAST_REMAINING_CHECK_nameplate", unit);
else
WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit);
+4 -1
View File
@@ -16,7 +16,10 @@ WeakAuras.versionString = versionStringFromToc
WeakAuras.buildTime = buildTime
WeakAuras.newFeatureString = "|TInterface\\OptionsFrame\\UI-OptionsFrame-NewFeatureIcon:0|t"
WeakAuras.BuildInfo = select(4, GetBuildInfo())
WeakAuras.isAwesomeEnabled = isAwesomeEnabled
function WeakAuras.isAwesomeEnabled()
return isAwesomeEnabled
end
function WeakAuras.IsClassic()
return false
+1 -1
View File
@@ -288,7 +288,7 @@ function Private.Modernize(data)
-- Version 18 was a migration for stance/form trigger, but deleted later because of migration issue
-- Version 19 were introduced in July 2019 in BfA
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
if data.internalVersion < 19 then
if data.triggers then
for triggerId, triggerData in ipairs(data.triggers) do
+57 -6
View File
@@ -1100,15 +1100,13 @@ local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
if (triggerUnit == "multi") then
-- Handled by normal events"
elseif triggerUnit == "pet" then
WeakAuras.WatchForPetDeath();
tinsert(t, "PET_UPDATE")
elseif (triggerUnit == "nameplate") then
if not WeakAuras.isAwesomeEnabled then return end
tinsert(t, "UNIT_CHANGED_nameplate")
local nameplates = C_NamePlate.GetNamePlates()
if nameplates then
for i, v in pairs(nameplates) do
if v then
for i, unitData in pairs(nameplates) do
if unitData then
WeakAuras.WatchUnitChange("nameplate" .. i)
end
end
@@ -1130,6 +1128,38 @@ local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
end
end
local function AddWatchedUnits(triggerUnit, includePets)
if (triggerUnit == nil) then
return
end
if (triggerUnit == "multi") then
-- Handled by normal events"
elseif triggerUnit == "pet" then
WeakAuras.WatchForPetDeath();
elseif (triggerUnit == "nameplate") then
local nameplates = C_NamePlate.GetNamePlates()
if nameplates then
for i, unitData in pairs(nameplates) do
if unitData then
WeakAuras.WatchUnitChange("nameplate" .. i)
end
end
end
else
if Private.multiUnitUnits[triggerUnit] then
local isPet
for unit in pairs(Private.multiUnitUnits[triggerUnit]) do
isPet = WeakAuras.UnitIsPet(unit)
if (includePets ~= nil and isPet) or (includePets ~= "PetsOnly" and not isPet) then
WeakAuras.WatchUnitChange(unit)
end
end
else
WeakAuras.WatchUnitChange(triggerUnit)
end
end
end
local function AddUnitRoleChangeInternalEvents(triggerUnit, t)
if (triggerUnit == nil) then
return
@@ -1314,6 +1344,9 @@ Private.event_prototypes = {
end
return result
end,
loadFunc = function(trigger)
AddWatchedUnits(trigger.unit, nil)
end,
force_events = unitHelperFunctions.UnitChangedForceEvents,
name = L["Unit Characteristics"],
init = function(trigger)
@@ -1718,6 +1751,10 @@ Private.event_prototypes = {
end
return result
end,
loadFunc = function(trigger)
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddWatchedUnits(trigger.unit, includePets)
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
name = L["Health"],
init = function(trigger)
@@ -2023,6 +2060,10 @@ Private.event_prototypes = {
end
return result
end,
loadFunc = function(trigger)
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddWatchedUnits(trigger.unit, includePets)
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
name = L["Power"],
init = function(trigger)
@@ -5522,6 +5563,12 @@ Private.event_prototypes = {
end
return result
end,
loadFunc = function(trigger)
local unit = trigger.threatUnit
if unit and unit ~= "none" then
AddWatchedUnits(unit)
end
end,
force_events = "UNIT_THREAT_LIST_UPDATE",
name = L["Threat Situation"],
init = function(trigger)
@@ -5689,9 +5736,11 @@ Private.event_prototypes = {
if trigger.use_showLatency and trigger.unit == "player" then
WeakAuras.WatchForCastLatency()
end
if trigger.unit == "nameplate" and WeakAuras.isAwesomeEnabled and trigger.use_onUpdateUnitTarget then
if trigger.unit == "nameplate" and trigger.use_onUpdateUnitTarget then
WeakAuras.WatchForNameplateTargetChange()
end
local includePets = trigger.use_includePets == true and trigger.includePets or nil
AddWatchedUnits(trigger.unit, includePets)
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
canHaveDuration = "timed",
@@ -6600,10 +6649,12 @@ Private.event_prototypes = {
if (trigger.use_ismoving ~= nil) then
WeakAuras.WatchPlayerMoveSpeed();
end
if (trigger.use_mounted ~= nil) then
WeakAuras.WatchForMounts();
end
if (trigger.use_HasPet ~= nil) then
AddWatchedUnits("pet")
end
end,
init = function(trigger)
return "";
+6 -6
View File
@@ -373,12 +373,12 @@ local anchorers = {
found = true
end
end
--if not found and WeakAuras.IsOptionsOpen() and regionData.region.state then
-- Private.ensurePRDFrame()
-- Private.personalRessourceDisplayFrame:anchorFrame(regionData.region.state.id, "NAMEPLATE")
-- frames[Private.personalRessourceDisplayFrame] = frames[Private.personalRessourceDisplayFrame] or {}
-- tinsert(frames[Private.personalRessourceDisplayFrame], regionData)
--end
if not found and WeakAuras.IsOptionsOpen() and regionData.region.state then
Private.ensurePRDFrame()
Private.personalRessourceDisplayFrame:anchorFrame(regionData.region.state.id, "NAMEPLATE")
frames[Private.personalRessourceDisplayFrame] = frames[Private.personalRessourceDisplayFrame] or {}
tinsert(frames[Private.personalRessourceDisplayFrame], regionData)
end
end
end
end,
+8 -8
View File
@@ -27,7 +27,7 @@ Private.glow_frame_types = {
UNITFRAME = L["Unit Frame"],
FRAMESELECTOR = L["Frame Selector"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.glow_frame_types.NAMEPLATE = L["Nameplate"]
end
@@ -783,7 +783,7 @@ Private.unit_types_bufftrigger_2 = {
member = L["Specific Unit"],
multi = L["Multi-target"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.unit_types_bufftrigger_2.nameplate = L["Nameplate"]
end
@@ -807,7 +807,7 @@ Private.actual_unit_types_cast = {
pet = L["Pet"],
member = L["Specific Unit"],
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.actual_unit_types_cast.nameplate = L["Nameplate"]
end
@@ -820,7 +820,7 @@ Private.threat_unit_types = {
member = L["Specific Unit"],
none = L["At Least One Enemy"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.threat_unit_types.nameplate = L["Nameplate"]
end
@@ -950,7 +950,7 @@ Private.anchor_frame_types = {
UNITFRAME = L["Unit Frames"],
CUSTOM = L["Custom"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.anchor_frame_types.NAMEPLATE = L["Nameplates"]
end
@@ -1965,7 +1965,7 @@ Private.classification_types = {
normal = L["Normal"],
trivial = L["Trivial (Low Level)"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.classification_types.minus = L["Minus (Small Nameplate)"]
end
@@ -2679,7 +2679,7 @@ Private.multiUnitId = {
["partypetsonly"] = true,
["raid"] = true,
}
--if WeakAuras.isAwesomeEnabled then
--if WeakAuras.isAwesomeEnabled() then
-- Private.multiUnitId["nameplate"] = true
--end
@@ -2690,7 +2690,7 @@ Private.multiUnitUnits = {
["party"] = {},
["raid"] = {}
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
Private.multiUnitUnits["nameplate"] = {}
end
+180 -13
View File
@@ -1697,6 +1697,10 @@ function WeakAuras.Delete(data)
Private.DeleteAuraEnvironment(id)
triggerState[id] = nil;
if (Private.personalRessourceDisplayFrame) then
Private.personalRessourceDisplayFrame:delete(id);
end
if (Private.mouseFrame) then
Private.mouseFrame:delete(id);
end
@@ -1789,6 +1793,10 @@ function WeakAuras.Rename(data, newid)
end
end
if (Private.personalRessourceDisplayFrame) then
Private.personalRessourceDisplayFrame:rename(oldid, newid);
end
if (Private.mouseFrame) then
Private.mouseFrame:rename(oldid, newid);
end
@@ -2941,7 +2949,7 @@ function Private.HandleGlowAction(actions, region)
if actions.glow_action
and (
(
(actions.glow_frame_type == "UNITFRAME" or (actions.glow_frame_type == "NAMEPLATE" and WeakAuras.isAwesomeEnabled))
(actions.glow_frame_type == "UNITFRAME" or (actions.glow_frame_type == "NAMEPLATE" and WeakAuras.isAwesomeEnabled()))
and region.state.unit
)
or (actions.glow_frame_type == "FRAMESELECTOR" and actions.glow_frame)
@@ -2961,7 +2969,7 @@ function Private.HandleGlowAction(actions, region)
elseif actions.glow_frame_type == "UNITFRAME" and region.state.unit then
glow_frame = WeakAuras.GetUnitFrame(region.state.unit)
elseif actions.glow_frame_type == "NAMEPLATE" and region.state.unit then
glow_frame = WeakAuras.isAwesomeEnabled and WeakAuras.GetNamePlateForUnit(region.state.unit) or nil
glow_frame = WeakAuras.isAwesomeEnabled() and WeakAuras.GetNamePlateForUnit(region.state.unit) or nil
end
if glow_frame then
@@ -4468,6 +4476,159 @@ local function ensureMouseFrame()
Private.mouseFrame = mouseFrame;
end
local personalRessourceDisplayFrame;
function Private.ensurePRDFrame()
if (personalRessourceDisplayFrame) then
return;
end
personalRessourceDisplayFrame = CreateFrame("Frame", "WeakAurasAttachToPRD", UIParent);
personalRessourceDisplayFrame:Hide();
personalRessourceDisplayFrame.attachedVisibleFrames = {};
-- force an early frame draw; otherwise this frame won't be drawn until the next frame,
-- and any attached auras won't have a valid rect
personalRessourceDisplayFrame:SetPoint("CENTER", UIParent, "CENTER");
personalRessourceDisplayFrame:SetSize(16, 16)
personalRessourceDisplayFrame:GetSize()
Private.personalRessourceDisplayFrame = personalRessourceDisplayFrame;
local moverFrame = CreateFrame("Frame", "WeakAurasPRDMoverFrame", personalRessourceDisplayFrame);
personalRessourceDisplayFrame.moverFrame = moverFrame;
moverFrame:SetPoint("TOPLEFT", personalRessourceDisplayFrame, "TOPLEFT", -2, 2);
moverFrame:SetPoint("BOTTOMRIGHT", personalRessourceDisplayFrame, "BOTTOMRIGHT", 2, -2);
moverFrame:SetFrameStrata("FULLSCREEN"); -- above settings dialog
moverFrame:EnableMouse(true)
moverFrame:SetScript("OnMouseDown", function()
personalRessourceDisplayFrame:SetMovable(true);
personalRessourceDisplayFrame:StartMoving()
end);
moverFrame:SetScript("OnMouseUp", function()
personalRessourceDisplayFrame:StopMovingOrSizing();
personalRessourceDisplayFrame:SetMovable(false);
local xOffset = personalRessourceDisplayFrame:GetRight();
local yOffset = personalRessourceDisplayFrame:GetTop();
db.personalRessourceDisplayFrame = db.personalRessourceDisplayFrame or {};
local scale = UIParent:GetEffectiveScale() / personalRessourceDisplayFrame:GetEffectiveScale();
db.personalRessourceDisplayFrame.xOffset = xOffset / scale - GetScreenWidth();
db.personalRessourceDisplayFrame.yOffset = yOffset / scale - GetScreenHeight();
end);
moverFrame:Hide();
local texture = moverFrame:CreateTexture(nil, "BACKGROUND");
personalRessourceDisplayFrame.texture = texture;
texture:SetAllPoints(moverFrame);
texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrame");
local label = moverFrame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight")
label:SetPoint("CENTER", moverFrame, "CENTER");
label:SetText("WeakAuras Anchor");
personalRessourceDisplayFrame.OptionsOpened = function()
personalRessourceDisplayFrame:ClearAllPoints();
personalRessourceDisplayFrame:Show()
local xOffset, yOffset;
if (db.personalRessourceDisplayFrame) then
xOffset = db.personalRessourceDisplayFrame.xOffset;
yOffset = db.personalRessourceDisplayFrame.yOffset;
end
-- Calculate size of self nameplate
local prdWidth = 156.65118520899; -- Default Size
local prdHeight = 39.162796302247; -- Default Size
if KuiNameplates and KuiNameplates.db and KuiNameplates.db.profile then
prdWidth = KuiNameplates.db.profile.width or prdWidth;
prdHeight = KuiNameplates.db.profile.hheight or prdHeight;
personalRessourceDisplayFrame.texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\PRDFrameKui");
else
if ElvUI and ElvUI[1]
and ElvUI[1].private
and ElvUI[1].private.nameplates
and ElvUI[1].private.nameplates.enable then
local plateSize = ElvUI and ElvUI[1] and ElvUI[1].db and ElvUI[1].db.nameplates and ElvUI[1].db.nameplates.plateSize
prdWidth = plateSize.enemyWidth or prdWidth;
prdHeight = plateSize.enemyHeight or prdHeight;
elseif TidyPlatesThreat
and TidyPlatesThreat.db
and TidyPlatesThreat.db.profile
and TidyPlatesThreat.db.profile.nameplate
and TidyPlatesThreat.db.profile.nameplate.scale
and TidyPlatesThreat.db.profile.nameplate.scale.Normal then
local scaleNormal = TidyPlatesThreat.db.profile.nameplate.scale.Normal
prdWidth = scaleNormal and scaleNormal * prdWidth or prdWidth
prdHeight = scaleNormal and scaleNormal * prdHeight or prdHeight
end
end
if (not xOffset or not yOffset) then
local optionsFrame = WeakAuras.OptionsFrame();
yOffset = optionsFrame:GetBottom() + prdHeight - GetScreenHeight();
xOffset = xPositionNextToOptions() + prdWidth / 2 - GetScreenWidth();
end
personalRessourceDisplayFrame:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", xOffset, yOffset);
personalRessourceDisplayFrame:SetPoint("BOTTOMLEFT", UIParent, "TOPRIGHT", xOffset - prdWidth, yOffset - prdHeight);
end
personalRessourceDisplayFrame.OptionsClosed = function()
personalRessourceDisplayFrame:Hide();
personalRessourceDisplayFrame.texture:Hide();
personalRessourceDisplayFrame.moverFrame:Hide();
wipe(personalRessourceDisplayFrame.attachedVisibleFrames);
end
personalRessourceDisplayFrame.collapse = function(self, id)
self.attachedVisibleFrames[id] = nil;
self:updateVisible();
end
personalRessourceDisplayFrame.rename = function(self, oldid, newid)
self.attachedVisibleFrames[newid] = self.attachedVisibleFrames[oldid];
self.attachedVisibleFrames[oldid] = nil;
self:updateVisible();
end
personalRessourceDisplayFrame.delete = function(self, id)
self.attachedVisibleFrames[id] = nil;
self:updateVisible();
end
personalRessourceDisplayFrame.anchorFrame = function(self, id, anchorFrameType)
if (anchorFrameType == "NAMEPLATE") then
self.attachedVisibleFrames[id] = true;
else
self.attachedVisibleFrames[id] = nil;
end
self:updateVisible();
end
personalRessourceDisplayFrame.updateVisible = function(self)
if (not WeakAuras.IsOptionsOpen()) then
return;
end
if (next(self.attachedVisibleFrames)) then
personalRessourceDisplayFrame.texture:Show();
personalRessourceDisplayFrame.moverFrame:Show();
personalRessourceDisplayFrame:Show();
else
personalRessourceDisplayFrame.texture:Hide();
personalRessourceDisplayFrame.moverFrame:Hide();
personalRessourceDisplayFrame:Hide();
end
end
if (WeakAuras.IsOptionsOpen()) then
personalRessourceDisplayFrame.OptionsOpened();
else
personalRessourceDisplayFrame.OptionsClosed();
end
Private.personalRessourceDisplayFrame = personalRessourceDisplayFrame
end
local postPonedAnchors = {};
local anchorTimer
@@ -4506,6 +4667,10 @@ local function GetAnchorFrame(data, region, parent)
local anchorFrameFrame = data.anchorFrameFrame
if not id then return end
if (personalRessourceDisplayFrame) then
personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType);
end
if (mouseFrame) then
mouseFrame:anchorFrame(id, anchorFrameType);
end
@@ -4526,15 +4691,15 @@ local function GetAnchorFrame(data, region, parent)
local frame = unit and WeakAuras.GetNamePlateForUnit(unit)
if frame then return frame end
end
--if WeakAuras.IsOptionsOpen() then
--Private.ensurePRDFrame()
--personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType)
--return personalRessourceDisplayFrame
--end
if WeakAuras.IsOptionsOpen() then
Private.ensurePRDFrame()
personalRessourceDisplayFrame:anchorFrame(id, anchorFrameType)
return personalRessourceDisplayFrame
end
end
if (anchorFrameType == "UNITFRAME") then
local unit = region.state.unit
local unit = region.state and region.state.unit
if unit then
local frame = WeakAuras.GetUnitFrame(unit) or WeakAuras.HiddenFrames
if frame then
@@ -4590,14 +4755,16 @@ end
local anchorFrameDeferred = {}
function Private.AnchorFrame(data, region, parent)
function Private.AnchorFrame(data, region, parent, force)
if data.anchorFrameType == "CUSTOM"
and (data.regionType == "group" or data.regionType == "dynamicgroup")
and not WeakAuras.IsLoginFinished()
and not anchorFrameDeferred[data.id]
and not force
then
loginQueue[#loginQueue + 1] = {Private.AnchorFrame, {data, region, parent}}
anchorFrameDeferred[data.id] = true
if not anchorFrameDeferred[data.id] then
loginQueue[#loginQueue + 1] = {Private.AnchorFrame, {data, region, parent, true}}
anchorFrameDeferred[data.id] = true
end
else
local anchorParent = GetAnchorFrame(data, region, parent);
if not anchorParent then return end
@@ -4779,7 +4946,7 @@ do
end
function WeakAuras.UntrackableUnit(unit)
return not (trackableUnits[unit] or string.match(unit, "^nameplate%d+$"))
return not (trackableUnits[unit] or unit:find("^nameplate%d+$"))
end
end
+6 -6
View File
@@ -802,7 +802,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Filter by Nameplate Type"],
order = 69.1,
hidden = function() return
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate"))
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))
end
},
hostility = {
@@ -818,7 +818,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
order = 69.3,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate") and not trigger.useHostility) end
hidden = function() return not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate") and not trigger.useHostility) end
},
useNpcId = {
@@ -827,14 +827,14 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Filter by Npc ID"],
order = 69.31,
hidden = function() return
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate"))
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))
end
},
npcId = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Npc ID"],
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate" and trigger.useNpcId) end,
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate" and trigger.useNpcId) end,
order = 69.32,
desc = L["Supports multiple entries, separated by commas"]
},
@@ -843,7 +843,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
order = 69.33,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate" and not trigger.useNpcId) end
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate" and not trigger.useNpcId) end
},
ignoreSelf = {
@@ -851,7 +851,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Ignore Self"],
order = 69.35,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or (WeakAuras.isAwesomeEnabled and trigger.unit == "nameplate"))) end
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))) end
},
ignoreDead = {
+2 -2
View File
@@ -117,7 +117,7 @@ local function GetCustomTriggerOptions(data, triggernum)
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not (OptionsPrivate.Private.baseUnitId[unit] and OptionsPrivate.Private.multiUnitId[unit]) and not string.find(unit, "^nameplate%d+$") then
if not (OptionsPrivate.Private.baseUnitId[unit] and OptionsPrivate.Private.multiUnitId[unit]) and not unit:find("^nameplate%d+$") then
return "|cFFFF0000"..L["Unit %s is not a valid unit for RegisterUnitEvent"]:format(unit)
end
elseif trueEvent == "TRIGGER" then
@@ -157,7 +157,7 @@ local function GetCustomTriggerOptions(data, triggernum)
end
elseif trueEvent:match("^UNIT_") then
local unit = string.lower(i)
if not (OptionsPrivate.Private.baseUnitId[unit] or string.find(unit, "^nameplate%d+$")) then
if not (OptionsPrivate.Private.baseUnitId[unit] or unit:find("^nameplate%d+$")) then
return false
end
elseif trueEvent == "TRIGGER" then
@@ -193,6 +193,10 @@ function OptionsPrivate.CreateFrame()
if OptionsPrivate.Private.mouseFrame then
OptionsPrivate.Private.mouseFrame:OptionsClosed()
end
if OptionsPrivate.Private.personalRessourceDisplayFrame then
OptionsPrivate.Private.personalRessourceDisplayFrame:OptionsClosed()
end
end)
local width, height
@@ -484,7 +488,7 @@ function OptionsPrivate.CreateFrame()
addFooter(L["Documentation"], [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/WeakAuras/WeakAuras2/wiki",
L["Check out our wiki for a large collection of examples and snippets."])
if not WeakAuras.isAwesomeEnabled then
if not WeakAuras.isAwesomeEnabled() then
addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk",
L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"])
end
@@ -147,7 +147,7 @@ local function createOptions(id, data)
["UNITFRAME"] = L["Unit Frames"],
["CUSTOM"] = L["Custom Frames"]
}
if WeakAuras.isAwesomeEnabled then
if WeakAuras.isAwesomeEnabled() then
v["NAMEPLATE"] = L["Nameplates"]
end
return v