-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AIO client addon is not working with 1.12.x client #12
Comments
If you have issues with some part, post the error and the code and I may be able to help with it. |
Thanks for your fast answer :) But it seems the SendAddonMessage function has changed since 1.12 Right now, the KaevStats example does not work when triggered with the .para command. WorldSocket::SendAddonMessage - Message : ��{{1,"Kaev","ShowAttributes"}} But nothing seems to be received by the client. |
Try change 2560 to 255 here Line 261 in d06da5d
just to make sure its not affecting anything. Did you try printing right here to see if the message is even received at all? Line 1007 in d06da5d
What about here to see if the events are even registered? Line 1017 in d06da5d
The whisper type may indeed be a/the problem. It seems according to https://wowwiki-archive.fandom.com/wiki/API_SendAddonMessage it was introduced in 2.1, so it shouldn't yet exist in 1.12. Maybe should try experiment with some simple messages and try to send/receive them.
Seems mangoszero for example has a setting to enable/disable addon messages. Make sure its off: https://github.com/mangoszero/server/blob/e45aa74e0fa3a9677d90fc012b8161e1e9935742/src/game/WorldHandlers/ChatHandler.cpp#L119 |
To answer you, the OnAddonMessage event handler is registered, but not triggerred. So far, the issue seems to be related to varargs. function msgmt:Add(Name, ...)
assert(Name, "#1 Block must have name")
print( "msgmt:Add" )
print( Name ) -- Contains "AIO"
for i = 1, table.getn(arg) do
print( arg[i] )
-- arg[1] = "Init"
-- arg[2] = "1.74"
end
self.params[ table.getn(self.params) + 1 ] = {select('#', ... ), Name, ... } -- the ... operator in function call triggers a syntax error in 1.12 client
self.assemble = true
return self
end I'm not sure what this line does so I can't "fix" it. About config, AddonChannel is enabled in my cmangos config, should I disable it ? local AIO_MsgLen = (AIO_SERVER and 255 or 255) -1 - string.len(AIO_ServerPrefix) - string.len(AIO_ShortMsg) |
After further testing, and commenting out this line in msgmt:Add : self.params[ table.getn(self.params) + 1 ] = {select('#', ... ), Name, ... } I managed to retrieve the data in ONADDONMSG using -- A client side event handler
-- Passes the incoming message to AIO message handler if it is valid
local function ONADDONMSG(self, event, prefix, msg, Type, sender)
print("ONADDONMSG - named params")
print(self, event, prefix, msg, Type, sender)
print("ONADDONMSG - argX")
print(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
if prefix == AIO_ServerPrefix then
if event == "CHAT_MSG_ADDON" and sender == UnitName("player") then
-- Normal AIO message handling from addon messages
AIO_HandleIncomingMsg(msg, sender)
end
end
end It's not perfect, but I have most of the data sent by the server. Still, it's really weird to me how thoses values got in arg1, arg2 etc. EDIT : Okay, looks like |
Looks like its wow specific https://wowwiki-archive.fandom.com/wiki/Handling_events
The end of the 2.5.8 section describes how to use As an example, the following function AIO.Handle(name, handlername, ...)
assert(name ~= nil, "#1 expected not nil")
return AIO.Msg():Add(name, handlername, ...):Send()
end
AIO.Handle("name", "handler", "some", "args", 123) could be written with varargs as function AIO.Handle(name, handlername, ...)
assert(name ~= nil, "#1 expected not nil")
return AIO.Msg():Add(name, handlername, unpack(arg)):Send()
end
AIO.Handle("name", "handler", "some", "args", 123) or with tables as function AIO.Handle(args)
assert(args[1]~= nil, "#1 expected not nil")
return AIO.Msg():Add(args):Send()
end
AIO.Handle({"name", "handler", "some", "args", 123})
-- Or perhaps even the following, which is syntactic sugar
AIO.Handle{"name", "handler", "some", "args", 123} |
I managed to "fix" using your tips with Here's a Gist of the modified AIO.lua and smallfolk.lua so far. AIO : https://gist.github.com/TheSkullbot/642f174b8c576091edf63a19339f4e94 EDIT : I managed to make the serialization work by tweaking the smallfolk lib for 5.0 (I updated the gists) |
Any message type likely works ok. You can potentially hide messages from the chat window itself if they show up there. You may want to stick to the addon language though as that is not affected by some checks and is not affected by in game language, drunkenness etc modifiers. |
The WHISPER type is supported for SendAddonMessage from version 2.1, so I may try to use the regular WHISPER chat message. If it is, then we just need to check the LANG (not sure if we can send regular chat message in LANG_ADDON though) I'll keep you updated on the progress, and if a working solution is found :) |
Ok, so I had to go through the BATTLEGROUND channel instead of the WHISPER channel for SendAddonMessage client side. Now, I'm receiving the addon code from the server ! Line 719 being the one doing the concat of previous packages parts : -- Has all parts, process
if table.getn(data.parts) == data.parts.n then
local cat = tconcat(data.parts) -- Line 719
RemoveData(guid, messageId)
AIO_ParseBlocks(cat, player)
end |
Try to print the contents and types of everything in |
The issue was that So I tried with the basic Hello World example (with a tweak to display the message in the chat instead of print) I stopped here for today : |
Nice research into the issue, I was surprised that the 1.12.1 client was using 5.0 instead of 5.1 |
Can you submit what you did to the CMangos repo that I maintain. You can open up a new issue or a pull request. |
The 1.12.x client seems to be using some sort of 5.0 Lua subset (can't find the exact version).
Some language features in the client AIO addon are using lua 5.1 thus trigerring lua errors in the client.
So far :
Server-side, I'm using cmangos-classic and I had to make some modifications to Eluna for it to work with the latest revision, but maybe it should be another issue. I managed to make it work, so I might be able to provide a pull request for that.
The text was updated successfully, but these errors were encountered: