Skip to content

Commit d51f9d0

Browse files
committed
add function to disable a few things in midnight
1 parent bd8c483 commit d51f9d0

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

EventHandler.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ end)
1919

2020
function MPT:ToggleEventRegister(On)
2121
if On then
22-
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
23-
f:RegisterEvent("UNIT_THREAT_LIST_UPDATE")
24-
f:RegisterEvent("PLAYER_REGEN_ENABLED")
25-
f:RegisterEvent("PLAYER_DEAD")
2622
if not self.Timer then
2723
self.Timer = C_Timer.NewTimer(self.UpdateRate, function()
2824
self.Timer = nil
2925
self:EventHandler("FRAME_UPDATE")
3026
end)
3127
end
28+
if self:IsMidnight() then return end
29+
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
30+
f:RegisterEvent("UNIT_THREAT_LIST_UPDATE")
31+
f:RegisterEvent("PLAYER_REGEN_ENABLED")
32+
f:RegisterEvent("PLAYER_DEAD")
3233
else
33-
if GetRestrictedActionStatus then return end -- disable for midnight. Edit this later when I know how the API works
34+
if self:IsMidnight() then return end
3435
f:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
3536
f:UnregisterEvent("UNIT_THREAT_LIST_UPDATE")
3637
f:UnregisterEvent("PLAYER_REGEN_ENABLED")
@@ -137,7 +138,7 @@ function MPT:EventHandler(e, ...) -- internal checks whether the event comes fro
137138
end
138139
self:CreateMiniMapButton()
139140
elseif e == "COMBAT_LOG_EVENT_UNFILTERED" and C_ChallengeMode.IsChallengeModeActive() then
140-
if GetRestrictedActionStatus then return end -- disable for midnight. Edit this later when I know how the API works
141+
if self:IsMidnight() then return end
141142
local _, se, _, _, _, _, _, destGUID, destName = CombatLogGetCurrentEventInfo()
142143
if (se == "UNIT_DIED" or se == "UNIT_DESTROYED" or se == "UNIT_DISSIPATES") and destGUID then
143144
if self.CurrentPull and self.CurrentPull[destGUID] then
@@ -153,7 +154,7 @@ function MPT:EventHandler(e, ...) -- internal checks whether the event comes fro
153154
end
154155
end
155156
elseif e == "UNIT_THREAT_LIST_UPDATE" and C_ChallengeMode.IsChallengeModeActive() and InCombatLockdown() then
156-
if GetRestrictedActionStatus then return end -- disable for midnight. Edit this later when I know how the API works
157+
if self:IsMidnight() then return end
157158
local unit = ...
158159
if unit and UnitExists(unit) then
159160
local guid = UnitGUID(unit)
@@ -170,7 +171,7 @@ function MPT:EventHandler(e, ...) -- internal checks whether the event comes fro
170171
end
171172
end
172173
elseif (e == "PLAYER_REGEN_ENABLED" or e == "PLAYER_DEAD") and C_ChallengeMode.IsChallengeModeActive() then
173-
if GetRestrictedActionStatus then return end -- disable for midnight. Edit this later when I know how the API works
174+
if self:IsMidnight() then return end
174175
for k, _ in pairs(self.CurrentPull or {}) do
175176
self.CurrentPull[k] = nil
176177
end

Functions.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,8 @@ function MPT:Profiling(key, start)
327327
print("MPT: "..color.."The profiling for "..key.." took "..duration.." ms.|r")
328328
self.ProfilingTimes[key] = nil
329329
end
330+
end
331+
332+
function MPT:IsMidnight()
333+
return select(4, GetBuildInfo()) >= 120000
330334
end

0 commit comments

Comments
 (0)