New version OUF
status.lua
An error in syntax, an error at the job of values, strings: 21 and 53
masterlooter.lua
Not correctly fulfils a unit entirely.
If the same code to place in leader.lua:
Code:
local parent = debugstack():match[[\AddOns\(.-)\]]
local global = GetAddOnMetadata(parent, 'X-oUF')
assert(global, 'X-oUF needs to be defined in the parent add-on.')
local oUF = _G[global]
local Update = function(self, event)
if(UnitIsPartyLeader(self.unit)) then
self.Leader:Show()
else
self.Leader:Hide()
end
if self.MasterIcon then
local unit
local method, pid, rid = GetLootMethod()
if(method == 'master') then
if(pid) then
if(pid == 0) then
unit = 'player'
else
unit = 'party'..pid
end
elseif(rid) then
unit = 'raid'..rid
end
if(unit == self.unit) then
if (self.Leader:IsShown()) then
if (self.unit == 'player') then
self.MasterIcon:SetPoint(self.Leader:GetPoint(), self.Leader, 'TOPLEFT', 1, 0)
else
self.MasterIcon:SetPoint(self.Leader:GetPoint(), self.Leader, 'TOPRIGHT', -3, 0)
end
else
self.MasterIcon:SetPoint(self.Leader:GetPoint())
end
self.MasterIcon:Show()
elseif(self.MasterIcon:IsShown()) then
self.MasterIcon:Hide()
end
elseif(self.MasterIcon:IsShown()) then
self.MasterIcon:Hide()
end
end
end
local Enable = function(self)
local leader = self.Leader
if(leader) then
self:RegisterEvent("PARTY_LEADER_CHANGED", Update)
self:RegisterEvent("PARTY_MEMBERS_CHANGED", Update)
if(leader:IsObjectType"Texture" and not leader:GetTexture()) then
leader:SetTexture[[Interface\GroupFrame\UI-Group-LeaderIcon]]
end
local masterIcon = self.MasterIcon
if(masterIcon) then
if(masterIcon:IsObjectType"Texture" and not masterIcon:GetTexture()) then
masterIcon:SetTexture[[Interface\GroupFrame\UI-Group-MasterLooter]]
end
end
return true
end
end
local Disable = function(self)
local leader = self.Leader
if(leader) then
self:UnregisterEvent("PARTY_LEADER_CHANGED", Update)
self:UnregisterEvent("PARTY_MEMBERS_CHANGED", Update)
end
end
oUF:AddElement('Leader', Update, Enable, Disable)
that all works correctly.