Example #1
0
        void c_ClientCreateCharacterInfo(object sender, ClientCharacterCreateInfoEventArgs e)
        {
            if (ClientCreateCharacterInfo != null)
            {
                ClientCreateCharacterInfo(sender, e);
            }

            Client    c  = (Client)sender;
            Character cc = e.CreateCharacterDetails;

            int characterID = -1;

            if (characterManager.CreateCharacter(cc.Name, cc.Class, c.AccountID, ref characterID))
            {
                // needs checks for name if its in use, if success return with playerid and sends it with this packet
                byte[] bufferCreateCharacter = PacketManager.SendCreateCharacter(CharCreationState.Success, characterID);
                c.Send(bufferCreateCharacter);

                // if it success creating character, needs to load new list and send it to client
                Character[] charList = characterManager.GetAllCharactersByAccountId(c.AccountID);

                byte[] bufferCharacterList = PacketManager.SendCharacterList(charList);
                c.Send(bufferCharacterList);
            }
            else
            {
                byte[] bufferCreateCharacter = PacketManager.SendCreateCharacter(CharCreationState.NameInUse, characterID);
                c.Send(bufferCreateCharacter);
            }
        }
Example #2
0
        void c_ClientCreateCharacterInfo(object sender, ClientCharacterCreateInfoEventArgs e)
        {
            if (ClientCreateCharacterInfo != null)
                ClientCreateCharacterInfo(sender, e);

            Client c = (Client)sender;
            Character cc = e.CreateCharacterDetails;

            int characterID = -1;
            if (characterManager.CreateCharacter(cc.Name, cc.Class, c.AccountID, ref characterID))
            {
                // needs checks for name if its in use, if success return with playerid and sends it with this packet
                byte[] bufferCreateCharacter = PacketManager.SendCreateCharacter(CharCreationState.Success, characterID);
                c.Send(bufferCreateCharacter);

                // if it success creating character, needs to load new list and send it to client
                Character[] charList = characterManager.GetAllCharactersByAccountId(c.AccountID);

                byte[] bufferCharacterList = PacketManager.SendCharacterList(charList);
                c.Send(bufferCharacterList);
            }
            else
            {
                byte[] bufferCreateCharacter = PacketManager.SendCreateCharacter(CharCreationState.NameInUse, characterID);
                c.Send(bufferCreateCharacter);
            }
        }