WoWInterface - View Single Post - Moving a frame depending on spec
View Single Post
08-20-18, 02:35 PM   #1
A Molten Giant
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 579
Moving a frame depending on spec

So trying to set the position of my raid frames depending on whether the character is a healing spec or not since I like the raid frames under my character when I heal, but not any other time.
I figured using an event would work and while it does I can only seem to watch "PLAYER_ENTERING_WORLD" and while I see the other events fire they don't set the frame position unless I reload the UI.

I can't seem to find a working example either, but that might be me being lazy.

Lua Code:
  1. frame:SetScript("OnEvent", function(self, event, unit)
  3.   if (playerClass == "PRIEST" and GetSpecialization() == 1) then
  4.     frame:SetPoint(unpack(cfg.group.healposition))
  5.   elseif (playerClass == "PRIEST" and GetSpecialization() == 2) then
  6.     frame:SetPoint(unpack(cfg.group.healposition))
  7.   elseif (playerClass == "PALADIN" and GetSpecialization() == 1) then
  8.     frame:SetPoint(unpack(cfg.group.healposition))
  9.   elseif (playerClass == "DRUID" and GetSpecialization() == 4) then
  10.     frame:SetPoint(unpack(cfg.group.healposition))
  11.   elseif (playerClass == "MONK" and GetSpecialization() == 2) then
  12.     frame:SetPoint(unpack(cfg.group.healposition))
  13.   elseif (playerClass == "SHAMAN" and GetSpecialization() == 3) then
  14.     frame:SetPoint(unpack(cfg.group.healposition))
  15.   else
  16.     frame:SetPoint(unpack(cfg.group.position))
  17.   end
  18. end
  19. end)
  20. frame:RegisterEvent("PLAYER_TALENT_UPDATE")
  21. frame:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
  22. frame:RegisterEvent("PLAYER_ENTERING_WORLD")

Complete Source Code

It is an oUF layout I'm working on, but I figured this was more of a general problem and not an oUF problem
Tweets Facebook YouTube Website
  Reply With Quote