Skip to content

Commit

Permalink
Bring back default behavior of filling win timer based on BG start ti…
Browse files Browse the repository at this point in the history
…me (and if that can't be ready, BG enter time) that PVP mods had for a decade. If you'd rather have a full looking bar instead like rewrite did, just disable option.
  • Loading branch information
MysticalOS committed Mar 15, 2020
1 parent 2db23ec commit c726a7a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 23 additions & 1 deletion DBM-PvP/PvPGeneral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod:SetZone(DBM_DISABLE_ZONE_DETECTION)
--mod:AddBoolOption("ColorByClass", true)
mod:AddBoolOption("HideBossEmoteFrame", false)
mod:AddBoolOption("AutoSpirit", false)
mod:AddBoolOption("ShowRelativeGameTime", true)

mod:RegisterEvents(
"ZONE_CHANGED_NEW_AREA",
Expand Down Expand Up @@ -150,6 +151,26 @@ local function HideBasesToWin()
end
end

local get_gametime, update_gametime
do
local gametime = 0
function update_gametime()
gametime = time()
end
function get_gametime()
if mod.options.ShowRelativeGameTime then
local systime = GetBattlefieldInstanceRunTime()
if systime and systime > 0 then
return systime / 1000
else
return time() - gametime
end
else
return GetTime()
end
end
end

local subscribedMapID = 0
local prevAScore, prevHScore = 0, 0
local numObjectives, objectivesStore
Expand Down Expand Up @@ -182,6 +203,7 @@ function mod:SubscribeAssault(mapID, objectsCount)
subscribedMapID = mapID
objectivesStore = {}
numObjectives = objectsCount
update_gametime()
end

function mod:UnsubscribeAssault()
Expand Down Expand Up @@ -264,7 +286,7 @@ do
prevHScore = hordeScore
end
-- End debug
local gameTime = GetTime()
local gameTime = get_gametime()
local allyTime = math.min(maxScore, (maxScore - allianceScore) / resPerSec[allianceBases + 1])
local hordeTime = math.min(maxScore, (maxScore - hordeScore) / resPerSec[hordeBases + 1])
if allyTime == hordeTime then
Expand Down
3 changes: 2 additions & 1 deletion DBM-PvP/localization.en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ L:SetOptionLocalization({
TimerInvite = "Show battleground join timer",
TimerRemaining = "Show time remaining for match start and match end",
TimerShadow = "Show timer for Shadow Sight",
TimerWin = "Show win timer"
TimerWin = "Show win timer",
ShowRelativeGameTime= "Fill win timer relative to BG start time (If disabled, bar just always looks full)"
})

L:SetMiscLocalization({
Expand Down

0 comments on commit c726a7a

Please sign in to comment.