Originally Posted by Phanx
PvP is a different frame, a different event, and possibly a different duration, but the general idea should be the same.
|
so for the PvP I was able to create this:
Code:
local PROPOSAL_DURATION = 90
local PVPTimerFrame = CreateFrame("Frame", nil, PVPReadyDialog)
PVPTimerFrame:SetPoint("TOP", PVPReadyDialog, "BOTTOM", -1, 20)
PVPTimerFrame:SetWidth(300)
PVPTimerFrame:SetHeight(35)
PVPTimerFrame:SetBackdrop({
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]],
edgeFile = [[Interface\AddOns\nExtras\Media\UI-DialogBox-Border.blp]],
edgeSize = 25, insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
PVPTimerFrame:SetBackdropColor(0, 0, 0, 1)
local text = PVPTimerFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
text:SetPoint("CENTER")
local t = PROPOSAL_DURATION
PVPTimerFrame:SetScript("OnUpdate", function(self, elapsed)
t = t - elapsed
text:SetText(floor(t + 0.5).."s left to Enter Battleground.")
end)
PVPTimerFrame:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
PVPTimerFrame:SetScript("OnEvent", function(self, event)
if event == "UPDATE_BATTLEFIELD_STATUS" then
t = PROPOSAL_DURATION
self:Show()
else
self:Hide()
end
end)
Which inturn gave me this:
But the time keeps reseting, I don't think I have the correct event. There are like 6 of them but in the event doc page the other ones are for like World PvP not battlegrounds.
Thanks for any help.
Coke