- Added real time compile error while writing a custom script.

- Added protection on compiling a custom script to show in the window, an error text should be printed to chat window.
- Added events: COMM_EVENT_RECEIVED and COMM_EVENT_SENT.
- When options panel is not in the screen, the script will attempt to fix the position.
- While doing a sync on guild statistics, more information about the download is shown.
This commit is contained in:
Tercio
2018-02-09 11:33:02 -02:00
parent 521fee8ba7
commit 0b38e849bc
10 changed files with 211 additions and 88 deletions
+16 -2
View File
@@ -127,7 +127,7 @@
if (_detalhes.host_by) then
return
end
if (realm ~= _GetRealmName()) then
player = player .."-"..realm
end
@@ -403,15 +403,20 @@
_detalhes:Msg ("(debug) network received:", prefix, "length:",string.len (data))
end
--event
_detalhes:SendEvent ("COMM_EVENT_RECEIVED", nil, string.len (data), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
--print ("comm received", prefix, _detalhes.network.functions [prefix])
local func = _detalhes.network.functions [prefix]
if (func) then
--todo: this call should be safe
func (player, realm, dversion, arg6, arg7, arg8, arg9)
else
func = plugins_registred [prefix]
--print ("plugin comm?", func, player, realm, dversion, arg6, arg7, arg8, arg9)
if (func) then
--todo: this call should be safe
func (player, realm, dversion, arg6, arg7, arg8, arg9)
else
if (_detalhes.debug) then
@@ -420,9 +425,18 @@
end
end
end
_detalhes:RegisterComm ("DTLS", "CommReceived")
--> hook the send comm message so we can trigger events when sending data
--> this adds overhead, but easily catches all outgoing comm messages
hooksecurefunc (Details, "SendCommMessage", function (context, addonPrefix, serializedData, channel)
--unpack data
local prefix, player, realm, dversion, arg6, arg7, arg8, arg9 = _select (2, _detalhes:Deserialize (serializedData))
--send the event
_detalhes:SendEvent ("COMM_EVENT_SENT", nil, string.len (serializedData), prefix, player, realm, dversion, arg6, arg7, arg8, arg9)
end)
function _detalhes:RegisterPluginComm (prefix, func)
assert (type (prefix) == "string" and string.len (prefix) >= 2 and string.len (prefix) <= 4, "RegisterPluginComm expects a string with 2-4 characters on #1 argument.")
assert (type (func) == "function" or (type (func) == "string" and type (self [func]) == "function"), "RegisterPluginComm expects a function or function name on #2 argument.")