Skip to content

Commit

Permalink
Fix battlefield player count, closes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Jul 21, 2017
1 parent 7b220b9 commit fd0b27d
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -670,24 +670,16 @@ do
end)
end

local GetBattlefieldScore, GetNumBattlefieldScores = GetBattlefieldScore, GetNumBattlefieldScores
----------------------------------
function Capping:UpdateCountText() -- roster counts
----------------------------------
if not AlwaysUpFrame2 then return end
local na, nh
for i = 1, GetNumBattlefieldScores(), 1 do
local _, _, _, _, _, ifaction = GetBattlefieldScore(i)
if ifaction == 0 then
nh = (nh or 0) + 1
elseif ifaction == 1 then
na = (na or 0) + 1
end
end
local _, _, _, _, numHorde = GetBattlefieldTeamInfo(0)
local _, _, _, _, numAlliance = GetBattlefieldTeamInfo(1)

ACountText = ACountText or self:CreateText(AlwaysUpFrame1, 10, "CENTER", AlwaysUpFrame1Icon, 3, 2, AlwaysUpFrame1Icon, -19, 16)
HCountText = HCountText or self:CreateText(AlwaysUpFrame2, 10, "CENTER", AlwaysUpFrame2Icon, 3, 2, AlwaysUpFrame2Icon, -19, 16)
ACountText:SetText(na or "")
HCountText:SetText(nh or "")
ACountText:SetText(numAlliance or "")
HCountText:SetText(numHorde or "")

local offset = ((not AlwaysUpFrame1Icon:GetTexture() or AlwaysUpFrame1Icon:GetTexture() == "") and 1) or 0
SetPoints(ACountText, "TOPLEFT", _G["AlwaysUpFrame"..(1 + offset).."Icon"], "TOPLEFT", 3, 2, "BOTTOMRIGHT", _G["AlwaysUpFrame"..(1 + offset).."Icon"], "BOTTOMRIGHT", -19, 16)
Expand Down

0 comments on commit fd0b27d

Please sign in to comment.