Ejemplo n.º 1
0
Archivo: Friend.cs Proyecto: habb0/IHI
        public void Serialize(OutgoingMessage Message)
        {
            if (Message.ID != 12)
                Message.AppendBoolean(false);                       // TODO: Find out what this does

            Message.AppendUInt32(this.fUser.GetID());               // User ID
            Message.AppendString(this.fUser.GetUsername());         // Username

            Message.AppendBoolean(false);                           // Not sure what this does
            Message.AppendBoolean(this.fUser.IsLoggedIn());         // Logged In
            Message.AppendBoolean(this.fUser.GetRoom() != null);    // In Room
            Message.AppendString(this.fUser.GetFigure());           // Figure
            Message.AppendUInt32(this.fLocalCategory);              // Category ID

            if (this.fUser.IsLoggedIn())
            {
                Message.AppendString(this.fUser.GetMotto());        // Motto
                Message.AppendString("");                           // Last Access (N/A)
            }
            else
            {
                Message.AppendString("Offline");                                // Motto ("Offline" in this case)
                Message.AppendString(this.fUser.GetLastAccess().ToString());    // Last Access
            }
        }
Ejemplo n.º 2
0
        public void SendMessage(OutgoingMessage message)
        {
            Core.GetStandardOut().PrintNotice(" [" + mID + "] <-- " + message.Header + message.GetContentString());

            SendData(message.GetBytes());
        }
Ejemplo n.º 3
0
 public void Serialize(OutgoingMessage Message)
 {
     Message.AppendUInt32(this.fID);
     Message.AppendString(this.fName);
 }
Ejemplo n.º 4
0
Archivo: Friend.cs Proyecto: habb0/IHI
        internal byte[] GetRawUpdate()
        {
            OutgoingMessage Message = new OutgoingMessage();
            Message.AppendBoolean(true);                            // TODO: Find out what this does

            Message.AppendUInt32(this.fUser.GetID());               // User ID
            Message.AppendString(this.fUser.GetUsername());         // Username

            Message.AppendBoolean(true);                            // Not sure what this does
            Message.AppendBoolean(this.fUser.IsLoggedIn());         // Logged In
            Message.AppendBoolean(this.fUser.GetRoom() != null);    // In Room
            Message.AppendString(this.fUser.GetFigure());           // Figure
            Message.AppendUInt32(this.fLocalCategory);              // Category ID

            if (this.fUser.IsLoggedIn())
            {
                Message.AppendString(this.fUser.GetMotto());        // Motto
                Message.AppendString("");                           // Last Access (N/A)
            }
            else
            {
                Message.AppendString("Offline");                                // Motto ("Offline" in this case)
                Message.AppendString(this.fUser.GetLastAccess().ToString());    // Last Access
            }

            return Message.GetBytes();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Send the information for the given subscription. (Habbo Club)
        /// </summary>
        /// <param name="SubscriptionName">The type of subscription.</param>
        /// <param name="CurrentDay">The amount of days into the month.</param>
        /// <param name="ElapsedMonths">The amount of passed months.</param>
        /// <param name="PrepaidMonths">The amount of unused months.</param>
        /// <param name="IsActive">Is the subscription active?</param>
        public void Send_UserInfo(string SubscriptionName, byte CurrentDay, ushort ElapsedMonths, ushort PrepaidMonths, bool IsActive)
        {
            OutgoingMessage Message = new OutgoingMessage(7);
            Message.AppendString(SubscriptionName);
            Message.AppendInt32(CurrentDay);
            Message.AppendInt32(ElapsedMonths);
            Message.AppendInt32(PrepaidMonths);
            Message.AppendBoolean(IsActive);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Send data about a user.
        /// </summary>
        /// <param name="UserID">The user ID.</param>
        /// <param name="Username">The username.</param>
        /// <param name="Figure">The figure.</param>
        /// <param name="Gender">The gender.</param>
        /// <param name="Motto">The motto.</param>
        /// <param name="SwimFigure">The swim figure in string form.</param>
        public void Send_UserObject(uint UserID, string Username, string Figure, bool Gender, string Motto, string SwimFigure)
        {
            OutgoingMessage Message = new OutgoingMessage(5);

            Message.AppendUInt32(UserID);
            Message.AppendString(Username);
            Message.AppendString(Figure);
            Message.AppendString(Gender ? "M" : "F"); // True = Male, False = Female
            Message.AppendString(Motto);
            Message.AppendInt32(12); // TODO: Find out what this does.

            Message.Append(SwimFigure);
            Message.AppendBoolean(false);
            Message.AppendBoolean(true);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Send the initial messenger configuration and contents.
        /// </summary>
        /// <param name="A">Unsure</param>
        /// <param name="B">Unsure</param>
        /// <param name="C">Unsure</param>
        public void Send_MessengerInit(int A, int B, int C, Category[] Categories, Friend[] Friends, uint MaxFriends)
        {
            OutgoingMessage Message = new OutgoingMessage(12);
            Message.AppendInt32(A);     // Find out
            Message.AppendInt32(B);     // Find out
            Message.AppendInt32(C);     // Find out

            Message.AppendInt32(Categories.Length);

            for (int i = 0; i < Categories.Length; i++)
            {
                Message.AppendUInt32(Categories[i].GetID());
                Message.AppendString(Categories[i].GetName());
            }

            Message.AppendInt32(Friends.Length);

            for (int i = 0; i < Friends.Length; i++)
            {
                Message.AppendObject(Friends[i]);
            }

            Message.AppendUInt32(MaxFriends);
            Message.AppendBoolean(false);       // TODO: Find out
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Send the secret key.
        /// </summary>
        /// <param name="Key">The key to send.</param>
        public void Send_SecretKey(string Key)
        {
            OutgoingMessage Message = new OutgoingMessage(1);
            Message.AppendString(Key);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Encryption is not supported by IHI.
        /// This is part of the no encryption setting that always seemed to work.
        /// </summary>
        public void Send_InitCrypto(string Token, bool Status)
        {
            // HEADER: 227
            OutgoingMessage Message = new OutgoingMessage(227);
            Message.AppendString(Token);
            Message.AppendBoolean(Status);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Basic server -> client greeting.
        /// </summary>
        public void Send_Hello()
        {
            OutgoingMessage Message = new OutgoingMessage(0);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Categories">An array of all categories to show to the user.</param>
        /// <param name="Friends">An array of all friends to show to the user.</param>
        /// <param name="FriendUpdates">An array of all changes to the friends list to send to the user.</param>
        public void Send_FriendListUpdate(Category[] Categories, Friend[] Friends, FriendUpdate[] FriendUpdates)
        {
            OutgoingMessage Message = new OutgoingMessage(13);
            Message.AppendInt32(Categories.Length);

            for (int i = 0; i < Categories.Length; i++)
            {
                Message.AppendUInt32(Categories[i].GetID());
                Message.AppendString(Categories[i].GetName());
            }

            Message.AppendInt32(Friends.Length + FriendUpdates.Length);

            for (int i = 0; i < FriendUpdates.Length; i++)
            {
                Message.AppendObject(FriendUpdates[i]);
            }

            for (int i = 0; i < Friends.Length; i++)
            {
                Message.AppendObject(Friends[i]);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Send the user credit balance.
        /// </summary>
        /// <param name="Balance"></param>
        public void Send_CreditBalance(int Balance)
        {
            OutgoingMessage Message = new OutgoingMessage(6);
            Message.Append(Balance);

            this.fUser.GetConnection().SendMessage(Message);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Basic server -> client greeting.
        /// </summary>
        public void Send_Hello()
        {
            OutgoingMessage Message = new OutgoingMessage(0);

            this.fUser.GetConnection().SendMessage(Message);
        }