Commit 9f10e5c3 authored by Simpy's avatar Simpy 🐹

12.15

parents 9f8d9aea cf513e13
## Interface: 90002 ## Interface: 90002
## Author: Elv, Simpy ## Author: Elv, Simpy
## Version: 12.14 ## Version: 12.15
## Title: |cff1784d1ElvUI|r ## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft. ## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB ## SavedVariables: ElvDB, ElvPrivateDB
......
...@@ -82,6 +82,8 @@ local function Update(self, event, unit) ...@@ -82,6 +82,8 @@ local function Update(self, event, unit)
element:PreUpdate() element:PreUpdate()
end end
-- BUG: UnitPhaseReason returns wrong data for friendly NPCs in phased scenarios like WM or Chromie Time
-- https://github.com/Stanzilla/WoWUIBugs/issues/49
local phaseReason = UnitIsPlayer(unit) and UnitIsConnected(unit) and UnitPhaseReason(unit) or nil local phaseReason = UnitIsPlayer(unit) and UnitIsConnected(unit) and UnitPhaseReason(unit) or nil
if(phaseReason) then if(phaseReason) then
element:Show() element:Show()
......
...@@ -69,6 +69,7 @@ local _, ns = ... ...@@ -69,6 +69,7 @@ local _, ns = ...
local oUF = ns.oUF local oUF = ns.oUF
local Private = oUF.Private local Private = oUF.Private
local xpcall = Private.xpcall
local unitExists = Private.unitExists local unitExists = Private.unitExists
-- ElvUI block -- ElvUI block
...@@ -735,8 +736,10 @@ end ...@@ -735,8 +736,10 @@ end
local function registerEvent(fontstr, event) local function registerEvent(fontstr, event)
if(not events[event]) then events[event] = {} end if(not events[event]) then events[event] = {} end
eventFrame:RegisterEvent(event) local isOK = xpcall(eventFrame.RegisterEvent, eventFrame, event)
tinsert(events[event], fontstr) if(isOK) then
tinsert(events[event], fontstr)
end
end end
local function registerEvents(fontstr, tagstr) local function registerEvents(fontstr, tagstr)
...@@ -753,14 +756,20 @@ end ...@@ -753,14 +756,20 @@ end
local function unregisterEvents(fontstr) local function unregisterEvents(fontstr)
for event, data in next, events do for event, data in next, events do
for i, tagfsstr in next, data do local index = 1
local tagfsstr = data[index]
while tagfsstr do
if(tagfsstr == fontstr) then if(tagfsstr == fontstr) then
if(#data == 1) then if(#data == 1) then
eventFrame:UnregisterEvent(event) eventFrame:UnregisterEvent(event)
end end
tremove(data, i) tremove(data, index)
else
index = index + 1
end end
tagfsstr = data[index]
end end
end end
end end
...@@ -910,10 +919,16 @@ local function Untag(self, fs) ...@@ -910,10 +919,16 @@ local function Untag(self, fs)
unregisterEvents(fs) unregisterEvents(fs)
for _, timers in next, eventlessUnits do for _, timers in next, eventlessUnits do
for i, fontstr in next, timers do local index = 1
local fontstr = timers[index]
while fontstr do
if(fs == fontstr) then if(fs == fontstr) then
tremove(timers, i) tremove(timers, index)
else
index = index + 1
end end
fontstr = timers[index]
end end
end end
......
...@@ -4,6 +4,7 @@ local Private = oUF.Private ...@@ -4,6 +4,7 @@ local Private = oUF.Private
local argcheck = Private.argcheck local argcheck = Private.argcheck
local error = Private.error local error = Private.error
local validateEvent = Private.validateEvent
local validateUnit = Private.validateUnit local validateUnit = Private.validateUnit
local frame_metatable = Private.frame_metatable local frame_metatable = Private.frame_metatable
...@@ -104,8 +105,8 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless) ...@@ -104,8 +105,8 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
argcheck(func, 3, 'function') argcheck(func, 3, 'function')
local curev = self[event] local curev = self[event]
local kind = type(curev)
if(curev) then if(curev) then
local kind = type(curev)
if(kind == 'function' and curev ~= func) then if(kind == 'function' and curev ~= func) then
self[event] = setmetatable({curev, func}, event_metatable) self[event] = setmetatable({curev, func}, event_metatable)
elseif(kind == 'table') then elseif(kind == 'table') then
...@@ -119,11 +120,12 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless) ...@@ -119,11 +120,12 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
if(unitless or self.__eventless) then if(unitless or self.__eventless) then
-- re-register the event in case we have mixed registration -- re-register the event in case we have mixed registration
registerEvent(self, event) registerEvent(self, event)
if(self.unitEvents) then if(self.unitEvents) then
self.unitEvents[event] = nil self.unitEvents[event] = nil
end end
end end
else elseif(validateEvent(event)) then
self[event] = func self[event] = func
if(not self:GetScript('OnEvent')) then if(not self:GetScript('OnEvent')) then
...@@ -135,6 +137,7 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless) ...@@ -135,6 +137,7 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
else else
self.unitEvents = self.unitEvents or {} self.unitEvents = self.unitEvents or {}
self.unitEvents[event] = true self.unitEvents[event] = true
-- UpdateUnits will take care of unit event registration for header -- UpdateUnits will take care of unit event registration for header
-- units in case we don't have a valid unit yet -- units in case we don't have a valid unit yet
local unit1, unit2 = self.unit local unit1, unit2 = self.unit
......
...@@ -61,3 +61,20 @@ function Private.unitSelectionType(unit, considerHostile) ...@@ -61,3 +61,20 @@ function Private.unitSelectionType(unit, considerHostile)
return selectionTypes[UnitSelectionType(unit, true)] return selectionTypes[UnitSelectionType(unit, true)]
end end
end end
local function errorHandler(...)
return geterrorhandler()(...)
end
function Private.xpcall(func, ...)
return xpcall(func, errorHandler, ...)
end
function Private.validateEvent(event)
local isOK = xpcall(validator.RegisterEvent, errorHandler, validator, event)
if(isOK) then
validator:UnregisterEvent(event)
end
return isOK
end
...@@ -671,6 +671,8 @@ function NP:NamePlateCallBack(nameplate, event, unit) ...@@ -671,6 +671,8 @@ function NP:NamePlateCallBack(nameplate, event, unit)
if nameplate.RaisedElement:IsShown() then if nameplate.RaisedElement:IsShown() then
nameplate.RaisedElement:Hide() nameplate.RaisedElement:Hide()
end end
nameplate.previousType = nil -- dont get the plate stuck for next unit
else else
if not nameplate.RaisedElement:IsShown() then if not nameplate.RaisedElement:IsShown() then
nameplate.RaisedElement:Show() nameplate.RaisedElement:Show()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment