Commit 9f10e5c3 authored by Simpy's avatar Simpy 🐹

12.15

parents 9f8d9aea cf513e13
## Interface: 90002
## Author: Elv, Simpy
## Version: 12.14
## Version: 12.15
## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
......@@ -82,6 +82,8 @@ local function Update(self, event, unit)
element:PreUpdate()
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
if(phaseReason) then
element:Show()
......
......@@ -69,6 +69,7 @@ local _, ns = ...
local oUF = ns.oUF
local Private = oUF.Private
local xpcall = Private.xpcall
local unitExists = Private.unitExists
-- ElvUI block
......@@ -735,8 +736,10 @@ end
local function registerEvent(fontstr, event)
if(not events[event]) then events[event] = {} end
eventFrame:RegisterEvent(event)
local isOK = xpcall(eventFrame.RegisterEvent, eventFrame, event)
if(isOK) then
tinsert(events[event], fontstr)
end
end
local function registerEvents(fontstr, tagstr)
......@@ -753,14 +756,20 @@ end
local function unregisterEvents(fontstr)
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(#data == 1) then
eventFrame:UnregisterEvent(event)
end
tremove(data, i)
tremove(data, index)
else
index = index + 1
end
tagfsstr = data[index]
end
end
end
......@@ -910,10 +919,16 @@ local function Untag(self, fs)
unregisterEvents(fs)
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
tremove(timers, i)
tremove(timers, index)
else
index = index + 1
end
fontstr = timers[index]
end
end
......
......@@ -4,6 +4,7 @@ local Private = oUF.Private
local argcheck = Private.argcheck
local error = Private.error
local validateEvent = Private.validateEvent
local validateUnit = Private.validateUnit
local frame_metatable = Private.frame_metatable
......@@ -104,8 +105,8 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
argcheck(func, 3, 'function')
local curev = self[event]
local kind = type(curev)
if(curev) then
local kind = type(curev)
if(kind == 'function' and curev ~= func) then
self[event] = setmetatable({curev, func}, event_metatable)
elseif(kind == 'table') then
......@@ -119,11 +120,12 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
if(unitless or self.__eventless) then
-- re-register the event in case we have mixed registration
registerEvent(self, event)
if(self.unitEvents) then
self.unitEvents[event] = nil
end
end
else
elseif(validateEvent(event)) then
self[event] = func
if(not self:GetScript('OnEvent')) then
......@@ -135,6 +137,7 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
else
self.unitEvents = self.unitEvents or {}
self.unitEvents[event] = true
-- UpdateUnits will take care of unit event registration for header
-- units in case we don't have a valid unit yet
local unit1, unit2 = self.unit
......
......@@ -61,3 +61,20 @@ function Private.unitSelectionType(unit, considerHostile)
return selectionTypes[UnitSelectionType(unit, true)]
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)
if nameplate.RaisedElement:IsShown() then
nameplate.RaisedElement:Hide()
end
nameplate.previousType = nil -- dont get the plate stuck for next unit
else
if not nameplate.RaisedElement:IsShown() then
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