예제 #1
0
        // Controlador
        public static void Controller(Client client, P_211 rcv)
        {
            if (!Regex.IsMatch(rcv.Name, @"^[A-Za-z0-9-]{4,12}$"))
            {
                client.Close("Nome inválido!");
            }
            else if (rcv.Slot < 0 || rcv.Slot > 3)
            {
                client.Close( );
            }
            else if (!Regex.IsMatch(rcv.Password, @"^[A-Za-z0-9]{4,10}$"))
            {
                client.Close( );
            }
            else
            {
                // Retorna character da conta
                ref Character character = ref client.Account.Characters [rcv.Slot];

                // Verifica se está vaziu
                if (character == null)
                {
                    client.Close( );
                }
                else
                {
                    // Envia os pacotes de apagar personagem
                    client.Send(P_112.New(client));
                    client.Send(P_101.New($"Personagem [{rcv.Name}] deletado!"));
                }
            }
예제 #2
0
        public SCharList CharList;          // 12 a 855	= 844

        // Construtores
        public static P_112 New(Client client)
        {
            P_112 tmp = new P_112 {
                Header   = SHeader.New(0x112, Marshal.SizeOf <P_112> ( ), client.ClientId),
                CharList = SCharList.New(client)
            };

            return(tmp);
        }
예제 #3
0
        // Controlador
        public static void Controller(Client client, P_211 rcv)
        {
            if (!Regex.IsMatch(rcv.Name, @"^[A-Za-z0-9-]{4,12}$"))
            {
                client.Close("Nome inválido!");
            }
            else if (rcv.Slot < 0 || rcv.Slot > 3)
            {
                client.Close();
            }
            else if (!Regex.IsMatch(rcv.Password, @"^[A-Za-z0-9]{4,10}$"))
            {
                client.Close();
            }
            else
            {
                Character character = client.Account.Characters[rcv.Slot];

                // Verifica se está vaziu
                if (character == null)
                {
                    client.Close();
                }
                else if (client.Account.Numeric.Equals(rcv.Password))
                {
                    if (UserMobDAO.DeleteCharFile(character))
                    {
                        client.Character = null;
                        client.Account.Characters[rcv.Slot] = null;

                        UserAccountDAO.CreateOrUpdateAccount(client.Account);

                        // Envia os pacotes de apagar personagem
                        client.Send(P_112.New(client));
                        client.Send(P_101.New($"Personagem [{rcv.Name}] deletado!"));
                    }
                    else
                    {
                        client.Send(P_101.New($"Erro ao deletar o personagem [{rcv.Name}]!"));
                    }
                }
                else
                {
                    client.Send(P_101.New($"Senha numérica invalida!"));
                }
            }
        }