public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(6)
                .AppendString(Balance.ToString());
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(2);
                foreach (string fuseRight in FuseRights)
                {
                    InternalOutgoingMessage.AppendString(fuseRight);
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(12)
                .AppendInt32(UnknownA)
                .AppendInt32(UnknownB)
                .AppendInt32(UnknownC)
                .AppendInt32(Categories.Count() - 1);     // -1 because the default category doesn't count

                foreach (Category category in Categories.Where(category => category.ID != 0))
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                }

                InternalOutgoingMessage
                .AppendInt32(Friends.Count());

                foreach (Friend friend in Friends)
                {
                    foreach (Category category in friend.GetCategories())
                    {
                        InternalOutgoingMessage
                        .AppendInt32(friend.Befriendable.GetID())
                        .AppendString(friend.Befriendable.GetDisplayName())
                        .AppendBoolean(true)     // TODO: Find out what this does.
                        .AppendBoolean(friend.Befriendable.IsLoggedIn())
                        .AppendBoolean(friend.Befriendable.IsStalkable())
                        .AppendString(friend.Befriendable.GetFigure().ToString())
                        .AppendInt32(category.ID)
                        .AppendString(friend.Befriendable.GetMotto())
                        .AppendString(friend.Befriendable.GetLastAccess().ToString());
                    }
                }

                InternalOutgoingMessage
                .AppendInt32(MaximumFriends)
                .AppendBoolean(false);     // TODO: Find out what this does.
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(221)
                .AppendInt32(Categories.Count);

                foreach (Category category in Categories)
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                    continue;
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(435)
                .AppendInt32(_friends.Count);

                foreach (IBefriendable friend in _friends)
                {
                    InternalOutgoingMessage.
                    AppendInt32(friend.GetID()).
                    AppendString(friend.GetDisplayName()).
                    AppendString(friend.GetMotto()).
                    AppendBoolean(friend.IsLoggedIn()).
                    AppendBoolean((friend.GetRoom() != null) &&
                                  friend.GetInstanceVariable("Messenger.StalkBlock") == null).
                    AppendString("").
                    AppendBoolean(true).
                    AppendString(friend.GetFigure().ToString()).
                    AppendString(friend.GetLastAccess().ToString());
                }

                InternalOutgoingMessage
                .AppendInt32(_strangers.Count);

                foreach (IBefriendable stranger in _strangers)
                {
                    InternalOutgoingMessage.
                    AppendInt32(stranger.GetID()).
                    AppendString(stranger.GetDisplayName()).
                    AppendString(stranger.GetMotto()).
                    AppendBoolean(stranger.IsLoggedIn()).
                    AppendBoolean((stranger.GetRoom() != null) &&
                                  stranger.GetInstanceVariable("Messenger.StalkBlock") == null).
                    AppendString("").
                    AppendBoolean(false).
                    AppendString(stranger.GetFigure().ToString()).
                    AppendString(stranger.GetLastAccess().ToString());
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(13)
                .AppendInt32(Categories.Count - 1);     // -1 because the default category doesn't count.
                foreach (Category category in Categories.Where(category => category.ID != 0))
                {
                    InternalOutgoingMessage
                    .AppendInt32(category.ID)
                    .AppendString(category.Name);
                }

                InternalOutgoingMessage
                .AppendInt32(FriendUpdates.Count);

                foreach (MessengerFriendEventArgs friendUpdate in FriendUpdates)
                {
                    Friend friend = friendUpdate.Friend;

                    InternalOutgoingMessage
                    .AppendInt32((int)friendUpdate.Type)
                    .AppendInt32(friend.Befriendable.GetID());

                    if (friendUpdate.Type != FriendUpdateType.Removed)
                    {
                        InternalOutgoingMessage
                        .AppendString(friend.Befriendable.GetDisplayName())
                        .AppendBoolean(false)     // TODO: Find out what this does.
                        .AppendBoolean(friend.Befriendable.IsLoggedIn())
                        .AppendBoolean(friend.Befriendable.IsStalkable())
                        .AppendString(friend.Befriendable.GetFigure().ToString())
                        .AppendInt32(friendUpdate.Category.ID)
                        .AppendString(friend.Befriendable.GetMotto())
                        .AppendString(friend.Befriendable.GetLastAccess().ToString());
                    }
                }
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(5)
                .AppendString(HabboID.ToString())
                .AppendString(Username)     // TODO: Should this be display name?
                .AppendString(Figure.ToString())
                .AppendString(Figure.GetGenderChar().ToString())
                .AppendString(Motto)
                .AppendString(UnknownA)
                .AppendInt32(12)     // TODO: Find out what this does.
                .AppendString(Figure.GetFormattedSwimFigure())
                .AppendBoolean(false)
                .AppendBoolean(true);
            }

            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(351)
                .AppendInt32(RoomListings.Count);


                foreach (GuestRoomListing roomListing in RoomListings)
                {
                    InternalOutgoingMessage
                    .AppendInt32(roomListing.ID)
                    .AppendString(roomListing.Name)
                    .AppendString(roomListing.Owner.GetDisplayName());

                    switch (roomListing.LockMode)
                    {
                    case RoomLock.Open:
                        InternalOutgoingMessage.AppendString("open");
                        break;

                    case RoomLock.Password:
                        InternalOutgoingMessage.AppendString("password");
                        break;

                    case RoomLock.Doorbell:
                        InternalOutgoingMessage.AppendString("closed");
                        break;
                    }

                    InternalOutgoingMessage
                    .AppendInt32(roomListing.Population)
                    .AppendInt32(roomListing.Capacity)
                    .AppendString(roomListing.Description);
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Beispiel #9
0
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(0);
                // TODO: Finish this.
                // (What does packet 57 (@y) do?

                //// if (dTable.Rows.Count > 0)
                //// {
                ////     StringBuilder Rooms = new StringBuilder();
                ////     foreach (DataRow dRow in dTable.Rows)
                ////         Rooms.Append(Encoding.encodeVL64(Convert.ToInt32(dRow["id"])) + Convert.ToString(dRow["name"]) + Convert.ToChar(2) + _Username + Convert.ToChar(2) + roomManager.getRoomState(Convert.ToInt32(dRow["state"])) + Convert.ToChar(2) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_now"])) + Encoding.encodeVL64(Convert.ToInt32(dRow["visitors_max"])) + Convert.ToString(dRow["description"]) + Convert.ToChar(2));
                ////     sendData("@P" + Encoding.encodeVL64(dTable.Rows.Count) + Rooms.ToString());
                //// }
                //// else
                //// {
                ////     sendData("@y" + _Username);
                //// }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }
Beispiel #10
0
        internal void PAGE_Send(HttpListenerContext Context)
        {
            if (Context.Request.IsLocal)
            {
                string Header = Context.Request.QueryString["header"];
                string Data = Context.Request.QueryString["data"];
                string SConnectionID = Context.Request.QueryString["connection"];

                uint HeaderID = 0;
                uint ConnectionID = 0;

                if (!uint.TryParse(Header, out HeaderID))
                    goto Done;
                if (!uint.TryParse(SConnectionID, out ConnectionID))
                    goto Done;

                Habbo Habbo = CoreManager.GetCore().GetConnectionManager().GetConnection(ConnectionID).GetHabbo();

                InternalOutgoingMessage Message = new InternalOutgoingMessage(HeaderID);
                Message.Append(Data);
                Habbo.SendMessage(Message);

            Done:
                Context.Response.Redirect("sendform");
                Context.Response.Close();
            }
        }
        public override OutgoingMessage Send(IMessageable target)
        {
            if (InternalOutgoingMessage.ID == 0)
            {
                InternalOutgoingMessage.Initialize(220)
                .AppendBoolean(ExcludeFullRooms)
                .AppendInt32(ID)
                .AppendInt32(IsPublicCategory ? 0 : 2)
                .AppendString(Name)
                .AppendInt32(UnknownA)
                .AppendInt32(UnknownB)
                .AppendInt32(ParentID);

                if (!IsPublicCategory)
                {
                    InternalOutgoingMessage
                    .AppendInt32(
                        Listings
                        .Where(listing => listing is GuestRoomListing)
                        .Count());
                }

                foreach (Listing listing in Listings)
                {
                    if (listing is Category)
                    {
                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendBoolean(false)
                        .AppendString(listing.Name)
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        .AppendInt32(ID);
                        continue;
                    }

                    if (listing is GuestRoomListing)
                    {
                        GuestRoomListing specificListing = listing as GuestRoomListing;

                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendString(listing.Name)
                        .AppendString(specificListing.Owner.GetDisplayName());

                        switch (specificListing.LockMode)
                        {
                        case RoomLock.Open:
                        {
                            InternalOutgoingMessage.AppendString("open");
                            break;
                        }

                        case RoomLock.Password:
                        {
                            InternalOutgoingMessage.AppendString("password");
                            break;
                        }

                        case RoomLock.Doorbell:
                        {
                            InternalOutgoingMessage.AppendString("closed");
                            break;
                        }
                        }
                        InternalOutgoingMessage
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        .AppendString(specificListing.Description);
                        continue;
                    }


                    if (listing is PublicRoomListing)
                    {
                        PublicRoomListing specificListing = listing as PublicRoomListing;

                        InternalOutgoingMessage
                        .AppendInt32(listing.ID)
                        .AppendBoolean(true)
                        .AppendString(listing.Name)
                        .AppendInt32(listing.Population)
                        .AppendInt32(listing.Capacity)
                        // Possible category ID needed here?
                        .AppendString(specificListing.Description)
                        .AppendInt32(listing.ID)
                        .AppendInt32(UnknownA)
                        .AppendString(specificListing.ClientFiles)
                        .AppendInt32(UnknownB)
                        .AppendInt32(UnknownC);
                        continue;
                    }
                }
            }
            target.SendMessage(InternalOutgoingMessage);
            return(this);
        }