/// <summary>
        /// Volta para a tela de login
        /// </summary>
        public static void BackToLogin()
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_LoginServer_BackToLogin);
            NetworkSocket.SendData(NetworkSocketEnum.LoginServer, buffer);
        }
Пример #2
0
        public static void RequestPreLoad()
        {
            var buffer = NetworkSocket.CreateMessage(4);

            buffer.Write((int)PacketList.Client_WorldServer_RequestPreLoad);
            NetworkSocket.SendData(NetworkSocketEnum.WorldServer, buffer);
        }
Пример #3
0
        /// <summary>
        /// Envia o hexid para o game server.
        /// </summary>
        public static void GameServerHexID()
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_GameServer_SendPlayerHexID);
            buffer.Write(Configuration.HexID);
            NetworkSocket.SendData(NetworkSocketEnum.GameServer, buffer, NetDeliveryMethod.Unreliable);
        }
Пример #4
0
        /// <summary>
        /// Envia o movimento do personagem.
        /// </summary>
        /// <param name="dir"></param>
        public static void PlayerMove(EngineCharacter.Direction dir)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_GameServer_PlayerMove);
            buffer.Write((byte)dir);
            NetworkSocket.SendData(NetworkSocketEnum.GameServer, buffer, NetDeliveryMethod.Unreliable);
        }
Пример #5
0
        public static void StartGame(byte slot)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_WorldServer_EnterInGame);
            buffer.Write(slot);
            NetworkSocket.SendData(NetworkSocketEnum.WorldServer, buffer);
        }
Пример #6
0
        public static void DeleteCharacter(byte slot)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_WorldServer_DeleteCharacter);
            buffer.Write(slot);
            NetworkSocket.SendData(NetworkSocketEnum.WorldServer, buffer);
        }
        /// <summary>
        /// Envia o id do servidor para conexão
        /// </summary>
        /// <param name="index"></param>
        public static void ConnectWorldServer(int index)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_LoginServer_WorldServerConnect);
            buffer.Write(index);
            NetworkSocket.SendData(NetworkSocketEnum.LoginServer, buffer);
        }
Пример #8
0
        /// <summary>
        /// Envia o HexID
        /// </summary>
        public static void WorldServerHexID()
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_WorldServer_SendPlayerHexID);
            buffer.Write(Configuration.HexID);

            NetworkSocket.SendData(NetworkSocketEnum.WorldServer, buffer);
        }
Пример #9
0
        public static void RequestPing()
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Ping);

            NetworkSocket.SendData(NetworkSocketEnum.GameServer, buffer, NetDeliveryMethod.Unreliable);
            Common.Configuration.PingStart = Environment.TickCount;
        }
        /// <summary>
        /// Envia o nome de usuário e senha
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public static void Login(string username, string password)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_LoginServer_Login);
            buffer.Write(Configuration.GAME_VERSION);
            buffer.Write(Configuration.ClientSerial);
            buffer.Write(username);
            buffer.Write(password);
            NetworkSocket.SendData(NetworkSocketEnum.LoginServer, buffer);
        }
Пример #11
0
        public static void CreateCharacter(byte gender, int classe, byte slot, int sprite, string name)
        {
            var buffer = NetworkSocket.CreateMessage();

            buffer.Write((int)PacketList.Client_WorldServer_CreateCharacter);
            buffer.Write(name);
            buffer.Write(slot);
            buffer.Write(classe);
            buffer.Write(gender);
            buffer.Write(sprite);
            NetworkSocket.SendData(NetworkSocketEnum.WorldServer, buffer);
        }
Пример #12
0
 /// <summary>
 /// Recebe os dados do game server.
 /// </summary>
 /// <param name="data"></param>
 public static void GameServerData(NetIncomingMessage data)
 {
     Configuration.HexID = data.ReadString();
     Configuration.IPAddress[(int)NetworkSocketEnum.GameServer] = new IPAddress(data.ReadString(), data.ReadInt32());
     NetworkSocket.Disconnect(NetworkSocketEnum.GameServer);
 }
Пример #13
0
        public static void Show(PacketList packet, int value = 0)
        {
            switch (packet)
            {
            case PacketList.Disconnect:
                Configuration.Disconnected = true;
                EngineMessageBox.Enabled   = true;
                EngineMessageBox.Show("Desconectado");

                NetworkSocket.Disconnect(NetworkSocketEnum.LoginServer);
                NetworkSocket.Disconnect(NetworkSocketEnum.WorldServer);
                NetworkSocket.Disconnect(NetworkSocketEnum.GameServer);
                break;

            case PacketList.LoginServer_Client_AccountDisabled:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Email não verificado");
                break;

            case PacketList.LoginServer_Client_InvalidNamePass:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Nome ou senha incorretos");
                break;

            case PacketList.LoginServer_Client_Maintenance:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Servidor em manutenção");
                break;

            case PacketList.Error:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Ocorreu um erro");
                break;

            case PacketList.LoginServer_Client_AccountBanned:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Este usuário está banido");
                break;

            case PacketList.LoginServer_Client_AlreadyLoggedIn:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Este usuário já está conectado");
                break;

            case PacketList.AcceptedConnection:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Visible = false;
                break;

            case PacketList.CantConnectNow:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Você não pode conectar-se no momento");
                break;

            case PacketList.InvalidVersion:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Versão invalida");
                break;

            case PacketList.WorldServer_Client_CharacterDeleted:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Personagem deletado");
                break;

            case PacketList.WorldServer_Client_CharNameInUse:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Nome já está em uso");
                break;

            case PacketList.WorldServer_Client_CharacterCreationDisabled:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Criação de personagens desativado");
                break;

            case PacketList.WorldServer_Client_CharacterDeleteDisabled:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Exclusão de personagens desativado");
                break;

            case PacketList.WorldServer_Client_InvalidLevelToDelete:
                EngineMessageBox.Enabled = true;
                EngineMessageBox.Show("Limite de level para exclusão 1 ~ 50");
                break;
            }
        }