Esempio n. 1
0
    private static void Register(byte Index, NetIncomingMessage Data)
    {
        // Lê os Data
        string User     = Data.ReadString().Trim();
        string Password = Data.ReadString();

        // Check if everything is okay
        if (User.Length < Game.Min_Character || User.Length > Game.Max_Character || Password.Length < Game.Min_Character || Password.Length > Game.Max_Character)
        {
            Sending.Alert(Index, "The User name and password must contain " + Game.Min_Character + " and " + Game.Max_Character + " characters.");
            return;
        }
        else if (File.Exists(Directories.Accounts.FullName + User + Directories.Format))
        {
            Sending.Alert(Index, "Already registered with this name.");
            return;
        }

        // Cria a conta
        Lists.Player[Index].User     = User;
        Lists.Player[Index].Password = Password;

        // Salva a conta
        Write.Player(Index);

        // Abre a janela de seleção de personagens
        Sending.Classes(Index);
        Sending.CreateCharacter(Index);
    }
Esempio n. 2
0
    private static void Character_Create(byte Index, NetIncomingMessage Data)
    {
        // Verifica se o Player já criou o máximo de personagens possíveis
        if (Player.EncontrarCharacter(Index, string.Empty) == 0)
        {
            Sending.Alert(Index, "You can only have " + Lists.Server_Data.Max_Characters + " characters.", false);
            return;
        }

        // Abre a janela de seleção de personagens
        Sending.Classes(Index);
        Sending.CreateCharacter(Index);
    }
Esempio n. 3
0
    private static void Connect(byte Index, NetIncomingMessage Data)
    {
        // Lê os Data
        string User     = Data.ReadString().Trim();
        string Password = Data.ReadString();

        // Check if everything is okay
        if (User.Length < Game.Min_Character || User.Length > Game.Max_Character || Password.Length < Game.Min_Character || Password.Length > Game.Max_Character)
        {
            Sending.Alert(Index, "The user name and password must contain " + Game.Min_Character + " and" + Game.Max_Character + " characters.");
            return;
        }
        if (!File.Exists(Directories.Accounts.FullName + User + Directories.Format))
        {
            Sending.Alert(Index, "This username is not registered.");
            return;
        }
        if (Player.MultipleAccounts(User))
        {
            Sending.Alert(Index, "There's already someone connected to that account.");
            return;
        }
        else if (Password != Read.Player_Password(User))
        {
            Sending.Alert(Index, "The password is incorrect.");
            return;
        }

        // Carrega os Data do Player
        Read.Player(Index, User);

        // Envia os Data das classes
        Sending.Classes(Index);

        // Se o Player não tiver nenhum Character então abrir o painel de criação de Character
        if (!Player.PossuiCharacters(Index))
        {
            Sending.CreateCharacter(Index);
            return;
        }

        // Abre a janela de seleção de personagens
        Sending.Characters(Index);
        Sending.Conectar(Index);
    }
Esempio n. 4
0
    public static void SetLocation(Situations Situação)
    {
        // Verifica se é possível se Connect ao servidor
        if (!Network.TryConnect())
        {
            MessageBox.Show("The server is currently unavailable.");
            return;
        }

        // Envia os Data
        switch (Situação)
        {
        case Situations.Connect: Sending.Connect(); break;

        case Situations.Register: Sending.Register(); break;

        case Situations.CreateCharacter: Sending.CreateCharacter(); break;
        }
    }