Exemple #1
0
 public void GetResponse(Response Response)
 {
     Response.AppendRawInt32(GetRoom().OwnerId);
     Response.AppendChar(2);
     Response.AppendRawInt32(RoomId);
     Response.AppendChar(2);
     Response.AppendStringWithBreak(BrickEngine.GetUserReactor().GetUsername(GetRoom().OwnerId));
     Response.AppendInt32(CategoryId);
     Response.AppendStringWithBreak(Name);
     Response.AppendStringWithBreak(Description);
     Response.AppendStringWithBreak(Started.ToShortTimeString());
     Response.AppendInt32(Tags.Count);
     Tags.ToList().ForEach(Response.AppendStringWithBreak);
 }
Exemple #2
0
        public void Drop()
        {
            Response EndResponse = new Response(370);
            EndResponse.AppendRawInt32(-1);
            EndResponse.AppendChar(2);
            GetRoom().GetRoomEngine().BroadcastResponse(EndResponse);

            GetRoom().Event = null;

            BrickEngine.GetProgressReactor().GetCollector().Finialize(this);
        }
Exemple #3
0
        public void GetResponse(Response Response, int UserId)
        {
            Response.AppendInt32(-1);
            Response.AppendInt32(BrickEngine.GetStreamHandler().GetPrimairStreamIndexer(StreamType));

            Response.AppendRawInt32(HabboId);
            Response.AppendChar(2);

            Response.AppendStringWithBreak(GetUsername());
            Response.AppendStringWithBreak(GetGender().ToLower());

            if (StreamType.Equals(StreamType.AchievedAchievement))
            {
                Response.AppendStringWithBreak("http://www.habbo.com/habbo-imaging/badge/" + AchievedItem.ToString() + ".png");
            }
            else
            {
                Response.AppendStringWithBreak(BrickEngine.GetConfigureFile().CallStringKey("site.link") + "/habbo-imaging/avatar/" + GetLook() + ".gif");
            }

            Response.AppendInt32(BrickEngine.GetConvertor().ObjectToInt32(RunningTime.TotalMinutes));

            if (StreamType.Equals(StreamType.MadeFriends))
            {
                Response.AppendInt32(BrickEngine.GetStreamHandler().GetFriendState(UserId, AchievedItemId));
            }
            else
            {
                Response.AppendInt32(BrickEngine.GetStreamHandler().GetSecondairStreamIndexer(StreamType));
            }

            Response.AppendBoolean(true);
            Response.AppendBoolean(true);

            if (StreamType.Equals(StreamType.RatedRoom) || StreamType.Equals(StreamType.MadeFriends))
            {
                Response.AppendRawInt32(AchievedItemId);
                Response.AppendChar(2);

                if (StreamType.Equals(StreamType.MadeFriends))
                {
                    Response.AppendStringWithBreak(BrickEngine.GetUserReactor().GetUsername(AchievedItemId));
                }
                else
                {
                    Response.AppendStringWithBreak(AchievedItem.ToString());
                }
            }
            else
            {
                Response.AppendStringWithBreak(AchievedItem.ToString());
            }
        }
        public Response GetEventRoomsResponse(int Category)
        {
            Response Response = new Response(451);
            Response.AppendInt32(12);
            Response.AppendRawInt32(Category);
            Response.AppendChar(2);

            var List = BrickEngine.GetRoomReactor().GetEventRooms(Category);

            Response.AppendInt32(List.Count);

            foreach (VirtualRoom Room in List)
            {
                Room.GetNavigatorResponse(Response, true);
            }

            return Response;
        }
        public void GetSecondairResponse(Client Client)
        {
            Response PasteLink = new Response(166);
            PasteLink.AppendStringWithBreak("/client/private/" + Id + "/id");
            Client.SendResponse(PasteLink);

            Response ModelParams = new Response(69);
            ModelParams.AppendStringWithBreak(ModelParam.ToLower());
            ModelParams.AppendInt32(Id);
            Client.SendResponse(ModelParams);

            Response Environment = new Response();

            if (!Wallpaper.Equals("0.0"))
            {
                Environment.Initialize(46);
                Environment.AppendStringWithBreak("wallpaper");
                Environment.AppendStringWithBreak(Wallpaper);
            }

            if (!Floor.Equals("0.0"))
            {
                Environment.Initialize(46);
                Environment.AppendStringWithBreak("floor");
                Environment.AppendStringWithBreak(Floor);
            }

            Environment.Initialize(46);
            Environment.AppendStringWithBreak("landscape");
            Environment.AppendStringWithBreak(Landscape);

            Environment.Initialize(345);

            if (GetRoomEngine().HasRights(Client.GetUser().HabboId, RightsType.Founder) || Client.GetUser().VotedRooms.Contains(Id))
            {
                Environment.AppendInt32(Rating);
            }
            else
            {
                Environment.AppendInt32(-1);
            }

            Environment.Initialize(370);

            if (Event != null)
            {
                Event.GetResponse(Environment);
            }
            else
            {
                Environment.AppendRawInt32(-1);
                Environment.AppendChar(2);
            }

            Client.SendResponse(Environment);
        }
Exemple #6
0
 public void GetUserParams(Client Client, Request Request)
 {
     Response Response = new Response(5);
     Response.AppendRawInt32(Client.GetUser().HabboId);
     Response.AppendChar(2);
     Response.AppendStringWithBreak(Client.GetUser().Username);
     Response.AppendStringWithBreak(Client.GetUser().Look);
     Response.AppendStringWithBreak(Client.GetUser().Gender.ToUpper());
     Response.AppendStringWithBreak(Client.GetUser().Motto);
     Response.AppendStringWithBreak("");
     Response.AppendBoolean(true);
     Response.AppendInt32(Client.GetUser().RespectGained);
     Response.AppendInt32(Client.GetUser().RespectLeft);
     Response.AppendInt32(Client.GetUser().RespectLeftPets);
     Response.AppendBoolean(Client.GetUser().EnabledFriendStream); // StartFriendStreamAuto <3
     Client.SendResponse(Response);
 }
 public Response GetAchievedResponse(int HabboId, Boolean Achievement, string Info)
 {
     Response Response = new Response(833);
     Response.AppendRawInt32(HabboId);
     Response.AppendChar(2);
     Response.AppendBoolean(Achievement);
     Response.AppendStringWithBreak(Info);
     return Response;
 }
Exemple #8
0
        public Response GetTriggerResponse()
        {
            Response Response = new Response();

            if (GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.Initialize(88);
                Response.AppendRawInt32(Id);
                Response.AppendChar(2);
                Response.AppendStringWithBreak(ExtraData);
            }
            else
            {
                Response.Initialize(85);
                GetRoomResponse(Response);
            }

            return Response;
        }
Exemple #9
0
        public void GetRoomResponse(Response Response)
        {
            if (GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.AppendInt32(Id);
            }
            else
            {
                Response.AppendRawInt32(Id);
                Response.AppendChar(2);
            }

            Response.AppendInt32(GetBaseItem().SpriteId);

            if (GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.AppendInt32(Point.X);
                Response.AppendInt32(Point.Y);
                Response.AppendInt32(Rotation);
                Response.AppendStringWithBreak(Point.Z.ToString().Replace(',', '.'));
                Response.AppendBoolean(false);
            }
            else
            {
                Response.AppendStringWithBreak(WallPoint);
            }

            Response.AppendStringWithBreak(ExtraData); // if Sticky (split(' '));

            if (GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.AppendInt32(-1);
            }

            Response.AppendBoolean(false); // Enable Button (Use);
        }
        public void RemovePet(int PetId)
        {
            VirtualRoomUser User = GetUserByPetId(PetId);

            if (User == null)
            {
                return;
            }

            int VirtualId = User.VirtualId;

            lock (RoomPets)
            {
                RoomPets.Remove(VirtualId);
            }

            Response LeaveMessage = new Response(29);
            LeaveMessage.AppendRawInt32(VirtualId);
            BroadcastResponse(LeaveMessage);

            BrickEngine.GetPetReactor().GetPetInfo(PetId).X = -1;
            BrickEngine.GetPetReactor().GetPetInfo(PetId).Y = -1;

            BrickEngine.GetProgressReactor().GetCollector().Finialize(User);
        }
        public void HandleIncomingItemPickUp(Item Item, VirtualRoomUser User)
        {
            // Handling Messages (FIRST, to avoid laggys)
            Response Response = new Response();

            if (Item.GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.Initialize(94);
            }
            else
            {
                Response.Initialize(84);
            }

            Response.AppendRawInt32(Item.Id);
            Response.AppendChar(2);
            Response.AppendBoolean(false);

            BroadcastResponse(Response);

            Item.GetTrigger().OnRemove(Item, User);

            if (Item.GetBaseItem().ExternalType.ToLower().Equals("default"))
            {
                Item.ExtraData = "0";

                // Update Info & MySQL
                using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
                {
                    Reactor.SetQuery("UPDATE items SET room_id = '0', extra_data = '0',point_wall = '' WHERE id = @itemid LIMIT 1");
                    Reactor.AddParam("itemid", Item.Id);
                    Reactor.ExcuteQuery();
                }
            }
            else
            {
                // Update Info & MySQL
                using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
                {
                    Reactor.SetQuery("UPDATE items SET room_id = '0', point_wall = '' WHERE id = @itemid LIMIT 1");
                    Reactor.AddParam("itemid", Item.Id);
                    Reactor.ExcuteQuery();
                }
            }
        }
        public void HandleIncomingItemPickUp(Item Item, iPoint OldPlace, iPoint NewPlace, int OldRotation, int Rotation, VirtualRoomUser User)
        {
            // Handling Messages (FIRST, to avoid laggys)
            Response Response = new Response();

            if (Item.GetBaseItem().InternalType.ToLower().Equals("s"))
            {
                Response.Initialize(94);
            }
            else
            {
                Response.Initialize(84);
            }

            Response.AppendRawInt32(Item.Id);
            Response.AppendChar(2);
            Response.AppendBoolean(false);

            BroadcastResponse(Response);

            GenerateMatrix();

            UpdateUsersOnPoint(OldPlace);

            foreach (iPoint Point in BrickEngine.GetItemReactor().GetAffectedPoints(OldPlace, Item.GetBaseItem().LengthY, Item.GetBaseItem().LengthX, OldRotation))
            {
                UpdateUsersOnPoint(Point);
            }

            Item.GetTrigger().OnRemove(Item, User);

            if (Item.GetBaseItem().ExternalType.ToLower().Equals("default"))
            {
                Item.ExtraData = "0";

                // Update Info & MySQL
                using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
                {
                    Reactor.SetQuery("UPDATE items SET room_id = '0', extra_data = '0', point_x = @x, point_y = @y, point_z = @z, rotation = @rot WHERE id = @itemid LIMIT 1");
                    Reactor.AddParam("itemid", Item.Id);
                    Reactor.AddParam("x", NewPlace.X);
                    Reactor.AddParam("y", NewPlace.Y);
                    Reactor.AddParam("z", NewPlace.Z.ToString().Replace(',', '.'));
                    Reactor.AddParam("rot", Rotation);
                    Reactor.ExcuteQuery();
                }
            }
            else
            {
                // Update Info & MySQL
                using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
                {
                    Reactor.SetQuery("UPDATE items SET room_id = '0', point_x = @x, point_y = @y, point_z = @z, rotation = @rot WHERE id = @itemid LIMIT 1");
                    Reactor.AddParam("itemid", Item.Id);
                    Reactor.AddParam("x", NewPlace.X);
                    Reactor.AddParam("y", NewPlace.Y);
                    Reactor.AddParam("z", NewPlace.Z.ToString().Replace(',', '.'));
                    Reactor.AddParam("rot", Rotation);
                    Reactor.ExcuteQuery();
                }
            }
        }