CreateCharacterScreen showing and assigning body_id

5 replies [Last post]
JasDonor
Posts: 111

Please excuse my ignorance of C#... In the following lines of code, where could I assign the body_id when creating a character? Would I need to first load something into the namespace?

 
       void ClickButton_CreateCharacter(object sender, MouseButtonEventArgs e)
        {
            var name = _txtName.Text;
 
            if (!GameData.UserName.IsValid(name))
            {
                SetError("Invalid character name.");
                return;
            }
 
            _btnCreateCharacter.IsEnabled = false;
            using (var pw = ClientPacket.CreateNewAccountCharacter(name))
            {
                _sockets.Send(pw, ClientMessageType.System);
            }
        }

Ultimately the Create Character Screen will give the player the ability to choose their character image. Any ideas from those more experienced with C# and NetGore is appreciated.

Posts: 1691

Things get a little tough because you have to tell the server you want to use a different body_id. The steps involved will be:

  1. Make CreateNewAccountCharacter message include the BodyID
  2. When server reads the BodyID for CreateNewAccountCharacter, make sure it is valid, and handle when it is invalid
  3. After character is created in the server, execute a custom query to update `body_id` for table `character` (simple enough, just takes a little boiler-plate code - see how other queries are done)
JasDonor
Posts: 111

Thanks for giving me somewhere to start. Smile

Posts: 1691

If you write a few pages on the wiki, I'll write out a tutorial on the wiki on how to do this. Smile

JasDonor
Posts: 111

Sure, but it's my first time doing wiki stuff. My edits may seem a little old-schoolish. Wink

Posts: 1691

No problem. Content is what matters. Smile