SafeQueue

SafeQueue

1M Downloads

Update for classic, feel free to review the code, im new to lua

1broccoli opened this issue ยท 2 comments

commented

Updated image to appear on bg popups to match the bg, how retail does, added minimap button to unlock a moveable test frame that can be locked and unlocked. This position adjusts the main popup position. saved variables added. disable locking/unlocking/moving test frame when in combat, test frame should not overwrite active bg frames. Many print chat messages to inform the user. Enjoy @jordonwow :( you removed me as a contributor.

.toc
# Added Saved Variables
## SavedVariables: SafeQueueDB

#Added New Libs
**Libs\AceHook-3.0\AceHook-3.0.lua

.toc
\AddOns\SafeQueue\Libs
^AceHook-3.0
^LibDBIcon-1.0
SafeQueue.xml

\AddOns\SafeQueue\Media\Textures
avlogo.png
ablogo.png
wsglogo.png
safequeue.png

SOD+ERA+Classic.
Image

Image

AB I was testing something just observe the texture

Image

this is how retails looks:

Image

commented

Image

doesn't take up much memory

commented
local alteracValleyInfo = GetMapInfo(1459)
local warsongGulchInfo = GetMapInfo(1460)
local arathiBasinInfo = GetMapInfo(1461)

local ALTERAC_VALLEY = alteracValleyInfo and alteracValleyInfo.name or "Alterac Valley"
local WARSONG_GULCH = warsongGulchInfo and warsongGulchInfo.name or "Warsong Gulch"
local ARATHI_BASIN = arathiBasinInfo and arathiBasinInfo.name or "Arathi Basin"

-- Textures for the battlegrounds
local battlegroundTextures = {
    ["Warsong Gulch"] = "Interface\\AddOns\\SafeQueue\\Media\\Textures\\wsglogo.png",
    ["Alterac Valley"] = "Interface\\AddOns\\SafeQueue\\Media\\Textures\\avlogo.png",
    ["Arathi Basin"] = "Interface\\AddOns\\SafeQueue\\Media\\Textures\\ablogo.png",
}

function SafeQueue:SetBackground(battleground)
    if not self.BattlegroundTexture then
        print("BattlegroundTexture is nil!")
        return
    end

    local texturePath = battlegroundTextures[battleground]
    if texturePath then
        self.BattlegroundTexture:SetTexture(texturePath)
        self.BattlegroundTexture:SetTexCoord(0, 1, 0, 1)
        self.BattlegroundTexture:SetSize(300, 115) -- Match popup template dimensions
        self.BattlegroundTexture:SetDrawLayer("BACKGROUND") -- Ensure texture is rendered below the popup
        self.BattlegroundTexture:SetAlpha(0.7) -- Set alpha 
        self.BattlegroundTexture:Show()
    else
        print("No texture found for:", battleground)
        self.BattlegroundTexture:Hide()
    end
end


SafeQueue:SetScript("OnShow", function(self)
    if (not self.battlefieldId) then return end
    if InCombatLockdown() then
        self.showPending = true
        self:RegisterEvent("PLAYER_REGEN_ENABLED")
        return
    end

    local status, battleground = GetBattlefieldStatus(self.battlefieldId)

    if status ~= "confirm" then return end

    self:HideBlizzardPopup()

    self.showPending = nil
    self.hidePending = nil

    **self:SetBackground(battleground)** -- Ensure the background is set when the popup is shown
    self:SetExpiresText()
    self.SubText:SetText(format("|cff%s%s|r", self.color, battleground))
    local color = self.color and self.color.rgb
    if color then self.SubText:SetTextColor(color.r, color.g, color.b) end

    self:SetMacroText()
end)