Quantcast WoWInterface - View Single Post - arena frames in MoP
View Single Post
06-16-13, 04:29 AM   #13
Caellian
A Frostmaul Preserver
 
Caellian's Avatar
Join Date: May 2006
Posts: 281
Arena prep ghost frames working

Originally Posted by Dawn View Post
Even showing the default arena frames until the gate opens would be okay for me. This needs a solution, please, please, did i say... please?
Working arena prep ghost frames:

Code:
		local arenaprep = {}
		for i = 1, 5 do
			arenaprep[i] = CreateFrame("Frame", "oUF_Caellian_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(caelMedia.files.statusBarCb)

			arenaprep[i].Spec = oUF_Caellian.SetFontString(arenaprep[i].Health, oUF_Caellian.config.font, 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", pixelScale(-3), pixelScale(3))
			arenaprep[i].FrameBackdrop:SetPoint("BOTTOMRIGHT", pixelScale(3), pixelScale(-3))
			arenaprep[i].FrameBackdrop:SetFrameStrata("MEDIUM")
			arenaprep[i].FrameBackdrop:SetBackdrop(caelMedia.backdropTable)
			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)
	end
end)
__________________
if (sizeof(workload) > sizeof(brain_capacity)) { die('System Overload'); }
  Reply With Quote