Quantcast WoWInterface - View Single Post - Moving a frame depending on spec
View Single Post
08-20-18, 04:32 PM   #3
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
You can make that handle future classes better:
Code:
local party = CreateFrame('Frame')
party:SetScript('OnEvent', function(self, event)
    self:UnregisterEvent(event)

    local function UpdatePosition(self)
        local _, _, _, _, role = GetSpecializationInfo(GetSpecialization())
        self:ClearAllPoints()
        self:SetPoint(unpack(cfg.group[role ~= 'HEALER' and "position" or "healposition"]))
    end
    UpdatePosition(self)

    self:SetScript('OnEvent', UpdatePosition)
    self:RegisterUnitEvent('PLAYER_SPECIALIZATION_CHANGED', 'player')
end)
party:RegisterEvent('PLAYER_ENTERING_WORLD')

Last edited by Vrul : 08-20-18 at 04:38 PM. Reason: Missing closing square bracket
  Reply With Quote