Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SafeQueue by Jordon
- local queueTime
- local queue = 0
- local button2 = StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].button2
- local remaining = 0
- local function SafeQueue_Print(msg)
- DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99SafeQueue|r: " .. msg)
- end
- local function SafeQueue_Timer()
- local secs = GetBattlefieldPortExpiration(queue)
- if secs > 0 then
- local p = StaticPopup_Visible("CONFIRM_BATTLEFIELD_ENTRY")
- print(p)
- if p then
- local color
- if remaining ~= secs then
- remaining = secs
- if secs > 20 then
- color = "f20ff20"
- elseif secs > 10 then
- color = "fffff00"
- else
- color = "fff0000"
- end
- local str=string.gsub(_G[p .. "Text"]:GetText(), ".+\n", "У вас есть |cf"..color.. SecondsToTime(secs) .. "|r, чтобы вступить в битву\n")
- _G[p .. "Text"]:SetText(str)
- print(str)
- end
- end
- end
- end
- local function SafeQueue_Update()
- local queued
- for i=1, 11 do
- local status, _, _, _, _, _, registeredMatch = GetBattlefieldStatus(i)
- if registeredMatch == 1 then
- if status == "queued" then
- queued = true
- if not queueTime then
- queueTime = GetTime()
- end
- elseif status == "confirm" then
- if queueTime then
- queueTime = nil
- end
- remaining = 0
- queue = i
- end
- break
- end
- end
- if not queued and queueTime then queueTime = nil end
- end
- frame = CreateFrame("Frame", nil, UIParent)
- frame:SetScript("OnEvent", SafeQueue_Update)
- frame:SetScript("OnUpdate", SafeQueue_Timer)
- frame:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
- StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].button2 = nil
- StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"].hideOnEscape = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement