WoWInterface SVN LFGStatusIcon

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

LFGStatusIcon/core.lua
1,49 → 1,79
if not GetLFGQueueStats then return end -- 3.3 only
 
local NUM_DAMAGERS, update = 3, nil -- NUM_DAMAGERS is a private variable to Blizz :(
local update, indicator = nil, nil
update = function()
local hasData, leaderNeeds, tankNeeds, healerNeeds, dpsNeeds, _, _, _, _, _, _, _ = GetLFGQueueStats()
 
if not MiniMapLFGFrame.lfgindicators then -- setup indicators
local hasData, leaderNeeds, tankNeeds, healerNeeds, dpsNeeds, _, _, _, _, _, _, myWait, queuedTime = GetLFGQueueStats()
 
if not indicator then -- setup indicators
MiniMapLFGFrame.lfgindicators = CreateFrame("Frame", nil, MiniMapLFGFrame)
local temp = 180 / math.pi / (NUM_DAMAGERS + 2)
for i = 1, NUM_DAMAGERS + 2, 1 do
local t = MiniMapLFGFrame.lfgindicators:CreateTexture(nil, "OVERLAY")
indicator = MiniMapLFGFrame.lfgindicators
local temp = 180 / math.pi / 5
for i = 1, 5, 1 do
local t = indicator:CreateTexture(nil, "OVERLAY")
t:SetTexture("Interface\\AddOns\\LFGStatusIcon\\indicator.tga")
t:SetWidth(5)
t:SetHeight(5)
t:SetPoint("CENTER", MiniMapLFGFrame, "CENTER", 11 * math.cos((i - 1) * temp - 0.32), 11 * math.sin((i - 1) * temp - 0.32))
MiniMapLFGFrame.lfgindicators[i] = t
indicator[i] = t
end
end
if type(Capping) == "table" then
if not Capping.LFG_PROPOSAL_SHOW then
Capping:RegisterEvent("LFG_PROPOSAL_SHOW")
function Capping:LFG_PROPOSAL_SHOW()
self:StopBar(LOOKING_FOR_DUNGEON or "LFD")
self:StartBar(ENTER_DUNGEON or "Enter Dungeon", 40, 40, "Interface\\Icons\\Ability_TownWatch", "info2", true, true)
end
 
Capping:RegisterEvent("LFG_PROPOSAL_FAILED")
function Capping:LFG_PROPOSAL_FAILED()
self:StopBar(LOOKING_FOR_DUNGEON or "LFD")
self:StopBar(ENTER_DUNGEON or "Enter Dungeon")
end
end
if hasData and dpsNeeds then
if queuedTime then
indicator.startTime = queuedTime
elseif not indicator.startTime then
indicator.startTime = GetTime()
end
myWait = myWait or 1
Capping:StartBar(LOOKING_FOR_DUNGEON or "LFD", myWait, myWait - (GetTime() - indicator.startTime), "Interface\\Icons\\INV_Misc_Note_03", "info1", 120, true)
else
indicator.startTime = nil
Capping:StopBar(LOOKING_FOR_DUNGEON or "LFD")
end
end
if not hasData or not dpsNeeds then -- hide indicators if no data available
for i = 1, NUM_DAMAGERS + 2, 1 do
MiniMapLFGFrame.lfgindicators[i]:SetVertexColor(1, 1, 1, 0)
for i = 1, 5, 1 do
indicator[i]:SetVertexColor(1, 1, 1, 0)
end
return
end
 
for i = 1, NUM_DAMAGERS, 1 do
if i <= (NUM_DAMAGERS - dpsNeeds) then
MiniMapLFGFrame.lfgindicators[i]:SetVertexColor(1, 0, 0, 0.9)
for i = 1, 5, 1 do
if i <= (3 - dpsNeeds) then
indicator[i]:SetVertexColor(1, 0, 0, 0.9)
else
MiniMapLFGFrame.lfgindicators[i]:SetVertexColor(1, 0.9, 0.9, 0.5)
indicator[i]:SetVertexColor(1, 0.9, 0.9, 0.5)
end
end
if healerNeeds == 0 then
MiniMapLFGFrame.lfgindicators[NUM_DAMAGERS + 1]:SetVertexColor(0, 1, 0, 0.9)
indicator[4]:SetVertexColor(0, 1, 0, 0.9)
else
MiniMapLFGFrame.lfgindicators[NUM_DAMAGERS + 1]:SetVertexColor(0.9, 1, 0.9, 0.5)
indicator[4]:SetVertexColor(0.9, 1, 0.9, 0.5)
end
if tankNeeds == 0 then
MiniMapLFGFrame.lfgindicators[NUM_DAMAGERS + 2]:SetVertexColor(0, 0, 1, 0.9)
indicator[5]:SetVertexColor(0, 0, 1, 0.9)
else
MiniMapLFGFrame.lfgindicators[NUM_DAMAGERS + 2]:SetVertexColor(0.9, 0.9, 1, 0.5)
indicator[5]:SetVertexColor(0.9, 0.9, 1, 0.5)
end
end
 
hooksecurefunc("LFDSearchStatus_Update", update)
hooksecurefunc("LFG_UpdateFramesIfShown", update)
MiniMapLFGFrame:HookScript("OnShow", update)
if MiniMapLFGFrame:IsShown() then
update()
end
 
LFGStatusIcon/LFGStatusIcon.toc
8,4 → 8,6
## LoadManagers: AddonLoader
## X-LoadOn-Always: delayed
 
## OptionalDeps: Capping
 
core.lua