diff --git a/DBM-PvP/PvPGeneral.lua b/DBM-PvP/PvPGeneral.lua index ac746c6..6a6a2b9 100644 --- a/DBM-PvP/PvPGeneral.lua +++ b/DBM-PvP/PvPGeneral.lua @@ -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", @@ -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 @@ -182,6 +203,7 @@ function mod:SubscribeAssault(mapID, objectsCount) subscribedMapID = mapID objectivesStore = {} numObjectives = objectsCount + update_gametime() end function mod:UnsubscribeAssault() @@ -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 diff --git a/DBM-PvP/localization.en.lua b/DBM-PvP/localization.en.lua index eeedf8a..3a072ff 100644 --- a/DBM-PvP/localization.en.lua +++ b/DBM-PvP/localization.en.lua @@ -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({