Skip to content

Commit

Permalink
Fixed an issue with LibOpenRaid
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jun 8, 2022
1 parent bba0d69 commit d08140c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE) then
end

local major = "LibOpenRaid-1.0"
local CONST_LIB_VERSION = 41
local CONST_LIB_VERSION = 43
LIB_OPEN_RAID_CAN_LOAD = false

--declae the library within the LibStub
Expand Down Expand Up @@ -104,6 +104,10 @@ LIB_OPEN_RAID_CAN_LOAD = false
local CONST_COOLDOWN_INDEX_DURATION = 4
local CONST_COOLDOWN_INDEX_UPDATETIME = 5

function openRaidLib.ShowDiagnosticErrors(value)
CONST_DIAGNOSTIC_ERRORS = value
end

--make the 'pri-nt' word be only used once, this makes easier to find lost debug pri-nts in the code
local sendChatMessage = function(...)
print(...)
Expand Down Expand Up @@ -169,24 +173,37 @@ LIB_OPEN_RAID_CAN_LOAD = false
local dataCompressed = LibDeflate:DecodeForWoWAddonChannel(data)
data = LibDeflate:DecompressDeflate(dataCompressed)

--some users are reporting errors where 'data is nil'. Making some sanitization
if (not data) then
openRaidLib.DiagnosticError("Invalid data from player:", sender, "data:", text)
return
elseif (type(data) ~= "string") then
openRaidLib.DiagnosticError("Invalid data from player:", sender, "data:", text, "data type is:", type(data))
return
end

--get the first byte of the data, it indicates what type of data was transmited
local dataTypePrefix = data:match("^.")
if (not dataTypePrefix) then
openRaidLib.DiagnosticError("Invalid dataTypePrefix from player:", sender, "data:", data, "dataTypePrefix:", dataTypePrefix)
return
elseif (openRaidLib.commPrefixDeprecated[dataTypePrefix]) then
openRaidLib.DiagnosticError("Invalid dataTypePrefix from player:", sender, "data:", data, "dataTypePrefix:", dataTypePrefix)
return
end

--if this is isn't a keystone data comm, check if the lib can receive comms
if (dataTypePrefix ~= CONST_COMM_KEYSTONE_DATA_PREFIX and dataTypePrefix ~= CONST_COMM_KEYSTONE_DATAREQUEST_PREFIX) then
if (not openRaidLib.IsCommAllowed()) then
openRaidLib.DiagnosticError("comm not allowed.")
return
end
end

--get the table with functions regitered for this type of data
local callbackTable = openRaidLib.commHandler.commCallback[dataTypePrefix]
if (not callbackTable) then
openRaidLib.DiagnosticError("Not callbackTable for dataTypePrefix:", dataTypePrefix, "from player:", sender, "data:", data)
return
end

Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

local version, build, date, tocversion = GetBuildInfo()

_detalhes.build_counter = 9822
_detalhes.alpha_build_counter = 9822 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 9823
_detalhes.alpha_build_counter = 9823 --if this is higher than the regular counter, use it instead
_detalhes.bcc_counter = 39
_detalhes.dont_open_news = true
_detalhes.game_version = version
Expand Down

0 comments on commit d08140c

Please sign in to comment.