Skip to content

Commit

Permalink
Open Raid update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 19, 2024
1 parent a20c87f commit 9403ef1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end

local major = "LibOpenRaid-1.0"

local CONST_LIB_VERSION = 137
local CONST_LIB_VERSION = 138

if (LIB_OPEN_RAID_MAX_VERSION) then
if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then
Expand Down Expand Up @@ -585,10 +585,17 @@ end
registeredUniqueTimers = {}
}

local timersCanRunWithoutGroup = {
["mainControl"] = {
["updatePlayerData_Schedule"] = true
}
}

--run a scheduled function with its payload
local triggerScheduledTick = function(tickerObject)
local payload = tickerObject.payload
local callback = tickerObject.callback
local bCanRunWithoutGroup = tickerObject.bCanRunWithoutGroup

if (tickerObject.isUnique) then
local namespace = tickerObject.namespace
Expand All @@ -598,7 +605,9 @@ end

--check if the player is still in group
if (not openRaidLib.IsInGroup()) then
return
if (not bCanRunWithoutGroup) then
return
end
end

local result, errortext = xpcall(callback, geterrorhandler(), unpack(payload))
Expand All @@ -610,9 +619,10 @@ end
end

--create a new schedule
function openRaidLib.Schedules.NewTimer(time, callback, ...)
function openRaidLib.Schedules.NewTimer(time, callback, bCanRunWithoutGroup, ...)
local payload = {...}
local newTimer = C_Timer.NewTimer(time, triggerScheduledTick)
newTimer.bCanRunWithoutGroup = bCanRunWithoutGroup
newTimer.payload = payload
newTimer.callback = callback
--newTimer.stack = debugstack()
Expand All @@ -632,7 +642,9 @@ end
openRaidLib.Schedules.CancelUniqueTimer(namespace, scheduleName)
end

local newTimer = openRaidLib.Schedules.NewTimer(time, callback, ...)
local bCanRunWithoutGroup = timersCanRunWithoutGroup[namespace] and timersCanRunWithoutGroup[namespace][scheduleName]

local newTimer = openRaidLib.Schedules.NewTimer(time, callback, bCanRunWithoutGroup, ...)
newTimer.namespace = namespace
newTimer.scheduleName = scheduleName
--newTimer.stack = debugstack()
Expand Down

0 comments on commit 9403ef1

Please sign in to comment.