This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] [LUA] [QUESTION] how send message to the server ...  (Read 13765 times)

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
[SOLVED] [LUA] [QUESTION] how send message to the server ...
« on: December 06, 2012, 11:13:03 pm »
Hi everyone,
I try to communicate with a server trinity from the character selection page. For more information, files and designs treatments selection page are located in the folder GlueXML. I tried to include files on the processing of messages in the folder FrameXML but without success.
If someone could help me find a method or trick to communicate from the character selection page, I thank in advance.

PS:
Google translate is my friend.



Bonsoir tout le monde,
Je cherche à communiquer avec un serveur trinity à partir de la page de sélection du personnage. Pour information, les fichiers de créations et de traitements de la page de sélection sont situées dans le dossier GlueXML. J'ai tenté d'y inclure les fichiers relatif au traitement des messages du dossier framexml mais sans succès.
Si quelqu'un pouvait m'aider à trouver une méthode ou une astuce pour communiquer à partir de la page de sélection du personnage, je l'en remercie par avance.

PS:
Google translate est mon ami.

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #1 on: December 06, 2012, 11:33:33 pm »
The only way I can think of would be to make use of Account Messaging. The only way to communicate with clients before they get in game is through existing packets that contain strings - then you can search for strings and react upon them.

When the AccountMessage header is sent, if it contains a string like "[SMSG]..." then react differently. This can be coded in the Lua GlueXML files. Account messages are checked for on character selection & realm selection, however you can rewrite the code so that the functions are called at a different point or do not show until a certain point if they contain a certain string.

More information about account messages can be found here: viewtopic.php?f=12&t=2058
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #2 on: December 07, 2012, 11:16:34 am »
Thank you for your reply, I'll watch it.

Merci pour votre reponse, je vais regarder ça.

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #3 on: December 08, 2012, 12:19:33 pm »


I made this addon which allows securiser a little access to your server, it communicates with the server responds with SendChatMessage him on the same principle. But I can not find the same kind of communication on the character selection page. If someone could get an idea on the subject to guide me.


J'ai fait cet addon qui permet de securiser un peu l'acces au serveur, il communique avec le serveur avec SendChatMessage qui lui repond sur le meme principe. Mais je n'arrive pas à trouver le même genre de communication sur la page de selection du personnage. Si quelqu'un pouvait avoir une idée sur le sujet pour m'orienter .

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #4 on: December 08, 2012, 12:36:22 pm »
Quote from: "noc"
Sorry but :

"Your account does not have permission to post links ..."

also ... no images ...

You know what? I'm a bad boy ... niak niak niak ...
sinon c'est chez...3W.servimg point com/image_preview.php?i=147&u=11238463 si le coeur vous en dit.

I made this addon which allows securiser a little access to your server, it communicates with the server responds with SendChatMessage him on the same principle. But I can not find the same kind of communication on the character selection page. If someone could get an idea on the subject to guide me.


J'ai fait cet addon qui permet de securiser un peu l'acces au serveur, il communique avec le serveur avec SendChatMessage qui lui repond sur le meme principe. Mais je n'arrive pas à trouver le même genre de communication sur la page de selection du personnage. Si quelqu'un pouvait avoir une idée sur le sujet pour m'orienter .

Yes, once in game you can use SendChatMessage but hide these from the players if they contain a certain string. You are changing how you react depending on which string was retrieved.

The same applies outside of game - you need to find a string that is sent to the server and to the client. The server sends account messages to the player, and the player sends strings to the server (character name, etc).
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #5 on: December 08, 2012, 02:54:04 pm »
Thank you for your answers.
Yes, I understand the principle. From the login page, but also with the character selection page there are exchanges between the client and the server. But I failed to understand how the client sending the information to the server.

Merci pour vos réponses.
Oui, j'ai bien compris le principe. A partir de la page de login mais aussi avec la page de selection du personnage il y a des échanges entre le client et le serveur. Mais je n'ai pas réussi à comprendre comment le client envoi ces informations au serveur.

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #6 on: December 08, 2012, 04:01:57 pm »
Quote from: "noc"
Thank you for your answers.
Yes, I understand the principle. From the login page, but also with the character selection page there are exchanges between the client and the server. But I failed to understand how the client sending the information to the server.

Merci pour vos réponses.
Oui, j'ai bien compris le principe. A partir de la page de login mais aussi avec la page de selection du personnage il y a des échanges entre le client et le serveur. Mais je n'ai pas réussi à comprendre comment le client envoi ces informations au serveur.

When you create a character, "CreateCharacter(CharacterCreateNameEdit:GetText());" is called.

You could call something like this:

CreateCharacter("SERVERMESSAGEdataONE");

So you are parsing your own string. You can then flag a global variable.

The server will receive the packet for this name, and return whether it is a valid character name or not. You modify it to return invalid character name when it receives this string, but also do whatever you wanted to do when you get that message from the client.

To stop the client showing the "Invalid Character Name" error message, check if the global variable is flagged when the error message is about to be displayed. If it is, do not show the error message and unflag the variable. This is handled in the GlueParent.lua (I think!).

This is just an example, there might be another place where it sends strings. :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #7 on: December 08, 2012, 05:42:49 pm »
A thousand thank you for this information. I will follow your instructions and work on CreateCharacter. Next episode ...

Mille merci pour ces informations. Je vais suivre vos indications et travailler sur le CreateCharacter. Suite au prochain épisode ...

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #8 on: December 10, 2012, 08:02:34 pm »
Hi,
Here are some news about the function CreateCharacter.
I changed the routine to intercept ObjectMgr :: CheckPlayerName name and retrieve the message. I then changed the file CharacterSelect but nothing works. Either the client crach when I validate my addon or the server receives the message after validation of the choice of character. It seems to me that the client processes the data itself I want because it prevents me transmètre special characters, names too long ... unless I have not picked the right server routines. The next episode ...

PS:
Google translate is my friend.

Bonsoir,
Voici quelques nouvelles concernant la fonction CreateCharacter.
J'ai modifié la routine ObjectMgr::CheckPlayerName pour intercepter le nom et en extraire le message. J'ai ensuite modifié le fichier CharacterSelect mais rien ne fonctionne. Soit le client crach quand je valide mon addon, soit le serveur recoit le message après la validation du choix du personnage. Il me semble que le client traite lui-même les données que je souhaite transmètre car il m'interdit les caractères spéciaux, les noms trop long ... à moins que je n'ai pas intercepté les bonnes routines du serveur. La suite au prochain épisode ...

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #9 on: December 10, 2012, 08:50:00 pm »
Quote from: "noc"
Hi,
Here are some news about the function CreateCharacter.
I changed the routine to intercept ObjectMgr :: CheckPlayerName name and retrieve the message. I then changed the file CharacterSelect but nothing works. Either the client crach when I validate my addon or the server receives the message after validation of the choice of character. It seems to me that the client processes the data itself I want because it prevents me transmètre special characters, names too long ... unless I have not picked the right server routines. The next episode ...

PS:
Google translate is my friend.

Bonsoir,
Voici quelques nouvelles concernant la fonction CreateCharacter.
J'ai modifié la routine ObjectMgr::CheckPlayerName pour intercepter le nom et en extraire le message. J'ai ensuite modifié le fichier CharacterSelect mais rien ne fonctionne. Soit le client crach quand je valide mon addon, soit le serveur recoit le message après la validation du choix du personnage. Il me semble que le client traite lui-même les données que je souhaite transmètre car il m'interdit les caractères spéciaux, les noms trop long ... à moins que je n'ai pas intercepté les bonnes routines du serveur. La suite au prochain épisode ...

If you can get it to a valid name, then the client will attempt to send it.

Only the server knows whether a character name has already been taken or not. This is where you can intercept it.

Hope this is helpful
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #10 on: December 10, 2012, 09:45:57 pm »
Thank you very much, I'm working on it already ... I try to identify all the routines that test the string name to understand what the server and the client.

PS:
Google translate is my friend.

Merci beaucoup, je travail déjà dessus ... J'essais d'identifier toutes les routines qui testent la chaine du nom pour comprendre ce que fait le serveur et le client.

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #11 on: December 12, 2012, 09:19:20 pm »
Hi everyone,

I do not know if it's me but it is not the trinity server which controls the validity of the names. All the landmarks that I placed no one answered when I tested validity. The only answer I had were given to me were after the client validation. Despite this, I still got to send information to the server crash without the client or server. Apart from the fact that the message must not exceed 12 characters or contain special characters and I have to adjust some details, I will say that the project is progressing slowly but it advance.
The next episode ...

PS:
Google translate is my friend.

Bonsoir tout le monde,

Je ne sais pas si c'est moi mais ce n'est pas le serveur trinity qui controle la validité des noms. De tout les repères que j'ai placé aucun n'a répondu lors de mes testes de validité. Les seules réponse que j'ai eu m'ont été données l'ont été aprés la validation du client. Malgré cela, je suis quand même arrivé à envoyer une information au serveur sans crash du client ou du serveur. A part le fait que le message ne doit pas dépasser 12 caractères ni contenir de caractères spéciaux et que je doive régler quelques détails, je dirai que le projet avance doucement mais il avance.
La suite au prochain épisode ...

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #12 on: December 12, 2012, 10:19:45 pm »
Code: [Select]
uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create)
{
    std::wstring wname;
    if (!Utf8toWStr(name, wname))
        return CHAR_NAME_INVALID_CHARACTER;

    if (wname.size() > MAX_PLAYER_NAME)
        return CHAR_NAME_TOO_LONG;

    uint32 minName = sWorld->getIntConfig(CONFIG_MIN_PLAYER_NAME);
    if (wname.size() < minName)
        return CHAR_NAME_TOO_SHORT;

    uint32 strictMask = sWorld->getIntConfig(CONFIG_STRICT_PLAYER_NAMES);
    if (!isValidString(wname, strictMask, false, create))
        return CHAR_NAME_MIXED_LANGUAGES;

    wstrToLower(wname);
    for (size_t i = 2; i < wname.size(); ++i)
        if (wname[i] == wname[i-1] && wname[i] == wname[i-2])
            return CHAR_NAME_THREE_CONSECUTIVE;

    return CHAR_NAME_SUCCESS;
}

Found here: https://github.com/TrinityCore/TrinityC ... ectMgr.cpp
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

noc

  • Registred Member
  • Wiki Incarnate
  • *****
  • Posts: 121
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #13 on: December 12, 2012, 11:54:11 pm »
Yes I know the routine. I've placed this in the first statement:
SLOG-> outString ("Texte du GluXML 1 ->% s <-" name.c_str ());

But during character creation, by voluntarily errors, nothing happens.
Parcontre, after customer acceptance, the server becomes talkative.
This is why I have concluded that managing customer errors character creation.

PS:
Google translate is my friend.

Oui je connais la routine. J'y ai placé ceci en première instruction :
sLog->outString("Texte du GluXML 1 ->%s<-",name.c_str());

Mais pendant la création du personnage, en faisant volontairement des erreurs, rien ne se passe.
Parcontre, aprés acceptation du client, le serveur devient bavard.
C'est pour cela que j'en ai conclut que le client gérait les erreurs de la création du personnage.

stoneharry

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 617
    • View Profile
Re: [LUA] [QUESTION] how send message to the server ...
« Reply #14 on: December 13, 2012, 12:00:00 am »
Hmmm.

If your still struggling at the weekend I'll experiment with this myself. Won't have any free time until Sunday. Good luck. :)
« Last Edit: January 01, 1970, 01:00:00 am by Admin »