Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Locales/Locales.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="enUS.lua"/>
</Ui>
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="enUS.lua"/>
</Ui>
16 changes: 8 additions & 8 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- SafeQueue Locale
-- https://www.curseforge.com/wow/addons/safequeue/localization

local L = LibStub("AceLocale-3.0"):NewLocale("SafeQueue", "enUS", true)

L["Queue popped after %s"] = true
L["Queue popped instantly!"] = true
L["SafeQueue expires in |cff%s%s|r"] = true
-- SafeQueue Locale
-- https://www.curseforge.com/wow/addons/safequeue/localization
local L = LibStub("AceLocale-3.0"):NewLocale("SafeQueue", "enUS", true)
L["Queue popped after %s"] = true
L["Queue popped instantly!"] = true
L["SafeQueue expires in |cff%s%s|r"] = true
Binary file added Media/Textures/ablogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/Textures/avlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/Textures/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/Textures/wsglogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
224 changes: 112 additions & 112 deletions SafeQueue.lua
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@

-- SafeQueue by Jordon

local SafeQueue = SafeQueue
local L = LibStub("AceLocale-3.0"):GetLocale("SafeQueue")

local CreateFrame = CreateFrame
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
local GetBattlefieldPortExpiration = GetBattlefieldPortExpiration
local GetBattlefieldStatus = GetBattlefieldStatus
local GetBattlefieldTimeWaited = GetBattlefieldTimeWaited
local GetMaxBattlefieldID = GetMaxBattlefieldID
local GetTime = GetTime
local PVPReadyDialog = PVPReadyDialog
local PVPReadyDialog_Display = PVPReadyDialog_Display
local SecondsToTime = SecondsToTime
local TOOLTIP_UPDATE_TIME = TOOLTIP_UPDATE_TIME
local WOW_PROJECT_ID = WOW_PROJECT_ID
local WOW_PROJECT_MAINLINE = WOW_PROJECT_MAINLINE
local format = format
local hooksecurefunc = hooksecurefunc

function SafeQueue:SetExpiresText()
local battlefieldId = self.battlefieldId
if (not battlefieldId) then return end
local secs = GetBattlefieldPortExpiration(battlefieldId)
if secs <= 0 then secs = 1 end
local color
if secs > 20 then
color = "20ff20"
elseif secs > 10 then
color = "ffff00"
else
color = "ff0000"
end
local text = L["SafeQueue expires in |cff%s%s|r"]:format(color, SecondsToTime(secs))
self.text:SetText(text)
if PVPReadyDialog then
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
-- retail: just show expiration
PVPReadyDialog.label:SetText(text)
elseif PVPReadyDialog.text and self.color and self.battleground then
text = format("\n%s\n\n|cff%s%s|r", text, self.color, self.battleground)
PVPReadyDialog.text:SetText(text)
end
end
end

function SafeQueue:Print(message)
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99SafeQueue|r: " .. message)
end

local update = CreateFrame("Frame")
update.timer = TOOLTIP_UPDATE_TIME
update:SetScript("OnUpdate", function(self, elapsed)
local battlefieldId = SafeQueue.battlefieldId
if (not battlefieldId) then return end
local timer = self.timer
timer = timer - elapsed
if timer <= 0 then
if GetBattlefieldStatus(battlefieldId) ~= "confirm" then
SafeQueue.battlefieldId = nil
if SafeQueue.HidePopup then SafeQueue:HidePopup() end
return
end
SafeQueue:SetExpiresText()
end
self.timer = timer
end)

function SafeQueue:UPDATE_BATTLEFIELD_STATUS()
local isConfirm = nil
for i = 1, GetMaxBattlefieldID() do
local status = GetBattlefieldStatus(i)
if status == "queued" then
self.queues[i] = self.queues[i] or GetTime() - (GetBattlefieldTimeWaited(i) / 1000)
elseif status == "confirm" then
if self.queues[i] then
local secs = GetTime() - self.queues[i]
local message
if secs < 1 then
message = L["Queue popped instantly!"]
else
message = L["Queue popped after %s"]:format(SecondsToTime(secs))
end
self:Print(message)
self.queues[i] = nil
end
isConfirm = true
else
self.queues[i] = nil
end
end
if (not isConfirm) then
self.battlefieldId = nil
if self.HidePopup then self:HidePopup() end
end
end

if PVPReadyDialog_Display then
if PVPReadyDialog.label then PVPReadyDialog.label:SetWidth(250) end
hooksecurefunc("PVPReadyDialog_Display", function(self, i)
self = self or PVPReadyDialog
if self.hideButton then self.hideButton:Hide() end
if self.leaveButton then self.leaveButton:Hide() end
self.enterButton:ClearAllPoints()
self.enterButton:SetPoint("BOTTOM", self, "BOTTOM", 0, 25)
SafeQueue.battlefieldId = i
if SafeQueue.ShowPopup then SafeQueue:ShowPopup() end
SafeQueue:SetExpiresText()
end)
end
-- SafeQueue by Jordon
local SafeQueue = SafeQueue
local L = LibStub("AceLocale-3.0"):GetLocale("SafeQueue")
local CreateFrame = CreateFrame
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
local GetBattlefieldPortExpiration = GetBattlefieldPortExpiration
local GetBattlefieldStatus = GetBattlefieldStatus
local GetBattlefieldTimeWaited = GetBattlefieldTimeWaited
local GetMaxBattlefieldID = GetMaxBattlefieldID
local GetTime = GetTime
local PVPReadyDialog = PVPReadyDialog
local PVPReadyDialog_Display = PVPReadyDialog_Display
local SecondsToTime = SecondsToTime
local TOOLTIP_UPDATE_TIME = TOOLTIP_UPDATE_TIME
local WOW_PROJECT_ID = WOW_PROJECT_ID
local WOW_PROJECT_MAINLINE = WOW_PROJECT_MAINLINE
local format = format
local hooksecurefunc = hooksecurefunc
function SafeQueue:SetExpiresText()
local battlefieldId = self.battlefieldId
if (not battlefieldId) then return end
local secs = GetBattlefieldPortExpiration(battlefieldId)
if secs <= 0 then secs = 1 end
local color
if secs > 20 then
color = "20ff20"
elseif secs > 10 then
color = "ffff00"
else
color = "ff0000"
end
-- Corrected syntax for text formatting
local text = ("Expires in |cff%s%s|r"):format(color, SecondsToTime(secs))
self.text:SetText(text)
if PVPReadyDialog then
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
-- retail: just show expiration
PVPReadyDialog.label:SetText(text)
elseif PVPReadyDialog.text and self.color and self.battleground then
text = format("\n%s\n\n|cff%s%s|r", text, self.color, self.battleground)
PVPReadyDialog.text:SetText(text)
end
end
end
function SafeQueue:Print(message)
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99SafeQueue|r: " .. message)
end
local update = CreateFrame("Frame")
update.timer = TOOLTIP_UPDATE_TIME
update:SetScript("OnUpdate", function(self, elapsed)
local battlefieldId = SafeQueue.battlefieldId
if (not battlefieldId) then return end
local timer = self.timer
timer = timer - elapsed
if timer <= 0 then
if GetBattlefieldStatus(battlefieldId) ~= "confirm" then
SafeQueue.battlefieldId = nil
if SafeQueue.HidePopup then SafeQueue:HidePopup() end
return
end
SafeQueue:SetExpiresText()
end
self.timer = timer
end)
function SafeQueue:UPDATE_BATTLEFIELD_STATUS()
local isConfirm = nil
for i = 1, GetMaxBattlefieldID() do
local status = GetBattlefieldStatus(i)
if status == "queued" then
self.queues[i] = self.queues[i] or GetTime() - (GetBattlefieldTimeWaited(i) / 1000)
elseif status == "confirm" then
if self.queues[i] then
local secs = GetTime() - self.queues[i]
local message
if secs < 1 then
message = L["Queue popped instantly!"]
else
message = L["Queue popped after %s"]:format(SecondsToTime(secs))
end
self:Print(message)
self.queues[i] = nil
end
isConfirm = true
else
self.queues[i] = nil
end
end
if (not isConfirm) then
self.battlefieldId = nil
if self.HidePopup then self:HidePopup() end
end
end
if PVPReadyDialog_Display then
if PVPReadyDialog.label then PVPReadyDialog.label:SetWidth(250) end
hooksecurefunc("PVPReadyDialog_Display", function(self, i)
self = self or PVPReadyDialog
if self.hideButton then self.hideButton:Hide() end
if self.leaveButton then self.leaveButton:Hide() end
self.enterButton:ClearAllPoints()
self.enterButton:SetPoint("BOTTOM", self, "BOTTOM", 0, 25)
SafeQueue.battlefieldId = i
if SafeQueue.ShowPopup then SafeQueue:ShowPopup() end
SafeQueue:SetExpiresText()
end)
end
Loading