Fixed an issue with LibOpenRaid

This commit is contained in:
Tercio Jose
2022-06-08 14:34:11 -03:00
parent bba0d69bf6
commit d08140c849
2 changed files with 20 additions and 3 deletions
+18 -1
View File
@@ -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
@@ -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(...)
@@ -169,17 +173,29 @@ 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
@@ -187,6 +203,7 @@ LIB_OPEN_RAID_CAN_LOAD = false
--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
+2 -2
View File
@@ -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