View Single Post
06-16-13, 05:01 PM   #14
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Thanks, figured it out when you updated your layout a couple of days ago. Not quite sure why it didn't work before, but works fine now.

Code:
		local arenaprep = {}
		for i = 1, 5 do
			arenaprep[i] = CreateFrame("Frame", "oUF_Ghost_ArenaPrep"..i, UIParent)
			arenaprep[i]:SetAllPoints(_G["oUF_Arena"..i])

			arenaprep[i].Health = CreateFrame("StatusBar", nil, arenaprep[i])
			arenaprep[i].Health:SetAllPoints()
			arenaprep[i].Health:SetStatusBarTexture(cfg.HPtex)

			arenaprep[i].Spec = SetFontStringAP(arenaprep[i].Health, cfg.RaidFont, 9)
			arenaprep[i].Spec:SetPoint("CENTER")

			arenaprep[i].FrameBackdrop = CreateFrame("Frame", nil, arenaprep[i])
			arenaprep[i].FrameBackdrop:SetFrameLevel(arenaprep[i]:GetFrameLevel() - 1)
			arenaprep[i].FrameBackdrop:SetPoint("TOPLEFT", -1,1)
			arenaprep[i].FrameBackdrop:SetPoint("BOTTOMRIGHT", 1,-1)
			arenaprep[i].FrameBackdrop:SetFrameStrata("MEDIUM")
			arenaprep[i].FrameBackdrop:SetBackdrop(backdrop)
			arenaprep[i].FrameBackdrop:SetBackdropColor(0, 0, 0, 0)
			arenaprep[i].FrameBackdrop:SetBackdropBorderColor(0, 0, 0)

			arenaprep[i]:Hide()
		end

		local arenaprepupdate = CreateFrame("Frame", nil, UIParent)
		arenaprepupdate:RegisterEvent("PLAYER_LOGIN")
		arenaprepupdate:RegisterEvent("PLAYER_ENTERING_WORLD")
		arenaprepupdate:RegisterEvent("ARENA_OPPONENT_UPDATE")
		arenaprepupdate:RegisterEvent("ARENA_PREP_OPPONENT_SPECIALIZATIONS")
		arenaprepupdate:SetScript("OnEvent", function(self, event)
			if event == "PLAYER_LOGIN" then
				for i = 1, 5 do
					arenaprep[i]:SetAllPoints(_G["oUF_Arena"..i])
				end
			elseif event == "ARENA_OPPONENT_UPDATE" then
				for i = 1, 5 do
					arenaprep[i]:Hide()
				end
			else
				local numOpps = GetNumArenaOpponentSpecs()

				if numOpps > 0 then
					for i = 1, 5 do
						local frame = arenaprep[i]

						if i <= numOpps then
							local opponentSpec = GetArenaOpponentSpec(i)
							local _, spec, class = nil, "UNKNOWN", "UNKNOWN"

							if opponentSpec and opponentSpec > 0 then
								_, spec, _, _, _, _, class = GetSpecializationInfoByID(opponentSpec)
							end

							frame.Health:SetStatusBarColor(0.17, 0.17, 0.24)

							if class and spec then
								local color = RAID_CLASS_COLORS[class]

								if color then
									frame.Spec:SetFormattedText("|cff%02x%02x%02x%s|r", color.r * 255, color.g * 255, color.b * 255, LOCALIZED_CLASS_NAMES_MALE[class].."  -  "..spec)
								else
									frame.Spec:SetText(spec.."  -  "..LOCALIZED_CLASS_NAMES_MALE[class])
								end

								frame:Show()
							end
						else
							frame:Hide()
						end
					end
				else
					for i = 1, 5 do
						arenaprep[i]:Hide()
					end
				end
			end
		end)
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote