Trinitycore: [8.x - master] Addon communication protocol - SendAddonMessage problem

Created on 9 Jan 2019  路  10Comments  路  Source: TrinityCore/TrinityCore

Description:
The client-server communication seems not working with addons

Current behaviour:
No informations are sended/received by players with the same addon.

Expected behaviour:
Informations should be sended and received, and addon should update profil of others players.

Steps to reproduce the problem:

  1. Download an addon with this kind of protocol, like TotalRP3 v 1.5.0
  2. Install addons in client folder, launch 2 games for 2 characters connected ingame
  3. clicking/being close to another character should send/receive informations to/from him but doesn't work.

Branch(es):
master

TC rev. hash/commit:
https://github.com/TrinityCore/TrinityCore/commit/5620eb9463a8d6cf59851306b92a8c644acd512d

Operating system:
Windows 10 64 bits

Ok, so i know that this seems an addon problem, but i've checked the SendAddonMessage in addons for BFA, it is the same parameters in function.

If i'm not very clear about this issue, here are 2 issues related to the same problem (but fixed since) :
https://github.com/TrinityCore/TrinityCore/issues/14949
https://github.com/TrinityCore/TrinityCore/issues/19490

this problem is back in 8.0 now

BTW, i've seen this commit by Shauren : https://github.com/TrinityCore/TrinityCore/commit/ee682544d027c1e33dcade592422a2d5b5e57ddb#diff-837bf337034c2e2b821314e771c2ee61

Chat addon packets is modified in this commit, is the addon communication working on master branch or it's still on developpement, or everything is ok for now ?

I've also tried to activate the Addons logfile, but nothing appears in it.

Thanks for your help.

Branch-master

Most helpful comment

I honestly don't think this is the problem.
Addon have actually 2 types of RegisterEvent :

Internal:RegisterEvent("CHAT_MSG_ADDON")
Internal:RegisterEvent("CHAT_MSG_ADDON_LOGGED")

Using the /eventtrace on live realms with the same Addon, i got both of events in the journal.

Trying on TrinityCore, i got only the CHAT_MSG_ADDON, maybe the logged one isn't handled yet ?

All 10 comments

If you could tell me which lua functions fail that would make my job a lot easier
I did some barebones testing with /run scripts and /eventtrace, both C_ChatInfo.SendAddonMessage and C_ChatInfo.SendAddonMessageLogged made it to target client (seen in /eventtrace)

Ok, i'm gonna investigate and give you a feedback as fast as i can

I've tried many thing, and this it what i've figured :

By activating lua errors, i got addon error on a Deserializing function
This addon works like this on communication : Get data => Serialize data => Send serialized data to other player by AddonMessage => Deserialize data => Update sender player profil.

I think, the problem is located when the player get the serialized data and can't deserialize it (So it's not a problem about Sending addons info, it work)

For me, the serialized data is not the same from the sender to the receiver, probably some encoding problem ?

Another elements, i've used print in ChatHandler, on CHAT_MSG_WHISPER for checking what happened in Console.
I don't know if using this line : printf("ADDON MESSAGE : %s", text.c_str());, is conserving accented characters or not ?

(As french i have accentued characters in name/addon informations fields)
This is what the exchange between the 2 players and server look like :

https://ghostbin.com/paste/r3r7w

It appears, some addon_msg do not encounter deserializing problem, i can't figure which.

I've also edited the addon for printing what the serializing data from the sender is.
There is the difference with addon msg in chat (first) and the line from the print in console (second) :

02{["data"]={[1]="characteristics",[2]={["CL"]="Pr锚tresse",["RA"]="Humaine",["FN"]="Side",["LN"]="Bitch",["MI"]={},["PS"]={},["IC"]="Achievement_Character_Human_Female",["v"]=2,},},["modulePrefix"]="SI",}

000CC500100106{["data"]=3D{[1]=3D"characteristics",[2]=3D{["CL"]=3D"Pr鈹溌瑃resse",["RA"]=3D"Humaine",["PS"]=3D{},["LN"]=3D"Bitch",["MI"]=3D{},["FN"]=3D"Side",["IC"]=3D"Achievement_Character_Human_Female",["v"]=3D2,},},["modulePrefix"]=3D"SI",}

First characters aren't important in my opinion, it's messageToken.

Main difference except accents, is a lot of "3D", the 3D character from hexadecimal to decimal is a "=" character, but it's very strange that there are both "3D" and "=" characters in the console.

I hope this can help you

printf is ascii only, it wont work properly with utf8 text

Ok, i'm gonna try with the size of the data then

This is what i get with size of data instead of text :

https://ghostbin.com/paste/vqzmz

As you can see, the size aren't the same, i try many times and it's always the same values, sometimes the order change (because the addon can randomly send information A before information B), but sames values.

Size are different, if you take the 4 higher values of both you get : 241 237 218 and 211 for the console and 206 205 201 and 199 for the addon.

Another proof, the 3 last of both are : 110 110 113 and 84 84 and 87, same diff between numbers, and you can find same scheme in the bin.

Now i'm gonna try, addon serializer data size and addon deserializer data size, to be sure.

https://cdn.discordapp.com/attachments/427082484472348704/532712932891688960/unknown.png

This is what happened, in the order, from the top to the bottom
Blue and green are datas sending/received with the same size of datas.
orange and yellow are datas sending/received no matching, values are different, received datas are more large than the sended datas.

Now i'm pretty sure there is problem with some data passing through the server, especially the datas containing accentued names.

What do you think ? i can search a little bit more, but at this point, i'm pretty sure this is the problem.

This is the final proof, i've printed (partially) all sended/received datas
https://i.imgur.com/2ywr5vP.png

Accents aren't the problem, the problem is "2D" after each "=" character

I honestly don't think this is the problem.
Addon have actually 2 types of RegisterEvent :

Internal:RegisterEvent("CHAT_MSG_ADDON")
Internal:RegisterEvent("CHAT_MSG_ADDON_LOGGED")

Using the /eventtrace on live realms with the same Addon, i got both of events in the journal.

Trying on TrinityCore, i got only the CHAT_MSG_ADDON, maybe the logged one isn't handled yet ?

Oh, ok then, sorry for saying complete bullshit :/

Thanks a lot Shauren, and Hoxton22 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Teppic1 picture Teppic1  路  3Comments

chilito picture chilito  路  3Comments

Blasphemous picture Blasphemous  路  3Comments

cbcs picture cbcs  路  3Comments

Rushor picture Rushor  路  3Comments