Пример #1
0
        public static void GetMailsResponse(WorldClient client, IEnumerable<MabiMail> mails)
        {
            var p = new MabiPacket(Op.GetMailsR, client.Character.Id);
            foreach (var mail in mails)
                p.Add(mail);
            p.PutLong(0);

            client.Send(p);
        }
Пример #2
0
        public static void SendMailResponse(WorldClient client, MabiMail mail)
        {
            var packet = new MabiPacket(Op.SendMailR, client.Character.Id);
            if (mail != null)
            {
                packet.PutByte(true);
                packet.Add(mail);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #3
0
        /// <summary>
        /// Sends positive response to login.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="account"></param>
        /// <param name="sessionKey"></param>
        /// <param name="servers"></param>
        public static void LoginResponse(LoginClient client, Account account, ulong sessionKey, IEnumerable<MabiServer> servers)
        {
            var packet = new MabiPacket(Op.LoginR, Id.Login);
            packet.PutByte((byte)LoginResult.Success);
            packet.PutString(account.Name);
            // [160XXX] Double account name
            {
                packet.PutString(account.Name);
            }
            packet.PutLong(sessionKey);
            packet.PutByte(0);

            // Servers
            // --------------------------------------------------------------
            packet.PutByte((byte)servers.Count());
            foreach (var server in servers)
                packet.Add(server);

            // Account Info
            // --------------------------------------------------------------
            packet.Add(account);

            client.Send(packet);
        }
Пример #4
0
        /// <summary>
        /// Sends account information. Response will be negative if account is null.
        /// </summary>
        /// <param name="client"></param>
        public static void AccountInfoRequestResponse(LoginClient client, Account account)
        {
            var packet = new MabiPacket(Op.AccountInfoRequestR, Id.Login);
            if (account != null)
            {
                packet.PutByte(true);
                packet.Add(account);
            }
            else
            {
                packet.PutByte(false);
            }

            client.Send(packet);
        }
Пример #5
0
        /// <summary>
        /// Sends server/channel status update to all connected clients,
        /// incl channels.
        /// </summary>
        public static void ChannelUpdate()
        {
            var packet = new MabiPacket(Op.ChannelStatus, Id.Login);
            packet.PutByte((byte)LoginServer.Instance.ServerList.Count);
            foreach (var server in LoginServer.Instance.ServerList.Values)
                packet.Add(server);

            LoginServer.Instance.Broadcast(packet);
        }