Esempio n. 1
0
        public Response GetButtonData()
        {
            Response Response = new Response(126);
            Response.AppendBoolean(true);
            Response.AppendBoolean(false);
            Response.AppendBoolean(false);
            Response.AppendInt32(-1);
            Response.AppendChar(2);
            Response.AppendInt32(GetButtonTreeAmount(-1));

            var SortedFirst = from pag in PagesForTree(-1)
                              orderby pag.OrderId ascending
                              select pag;

            foreach (ShopPage Page in SortedFirst)
            {
                Page.GetButtonData(Response);

                var SortedLast = from pag in PagesForTree(Page.Id)
                                 orderby pag.OrderId ascending
                                 select pag;

                foreach (ShopPage TreePage in SortedLast)
                {
                    TreePage.GetButtonData(Response);
                }
            }

            return Response;
        }
Esempio n. 2
0
 private void GetEcotronInfo(Client Client, Request Request)
 {
     Response Response = new Response(507);
     Response.AppendInt32(BrickEngine.GetEcotronReactor().GetTimerTime(Client.GetUser().HabboId));
     Response.AppendInt32(BrickEngine.GetEcotronReactor().GetTimeToWait(Client.GetUser().HabboId));
     Client.SendResponse(Response);
 }
Esempio n. 3
0
        public void ActivateEffect(Client Client, Effect Effect)
        {
            if (Effect.RemainingTime == 0)
            {
                return;
            }

            Effect.Excecute();

            if (Client != null)
            {
                Response Response = new Response(462);
                Response.AppendInt32(Effect.EffectId);
                Response.AppendInt32(Effect.EffectLength);
                Client.SendResponse(Response);
            }

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("UPDATE user_effects SET activated = @dt WHERE id = @effectid LIMIT 1");
                Reactor.AddParam("dt", Effect.Activated);
                Reactor.AddParam("effectid", Effect.Id);
                Reactor.ExcuteQuery();
            }
        }
Esempio n. 4
0
 public void GetInternalResponse(Response Response)
 {
     Response.AppendInt32(Id);
     Response.AppendBoolean(MemberType == Items.MemberType.VIP);
     Response.AppendInt32(MemberdaysNeed);
     Response.AppendBoolean(true);
 }
Esempio n. 5
0
 public void GetButtonData(Response Response)
 {
     Response.AppendBoolean(true); // always true
     Response.AppendUInt32(IconPaint);
     Response.AppendUInt32(IconId);
     Response.AppendInt32(Id);
     Response.AppendStringWithBreak(Name);
     Response.AppendInt32(BrickEngine.GetShopReactor().GetButtonTreeAmount(Id));
 }
Esempio n. 6
0
 public void GetResponse(Client Client, Response Response)
 {
     Response.AppendInt32(Id);
     Response.AppendBoolean((Client.GetUser().CurrentQuest.Equals(Id)) ? true : false);
     Response.AppendStringWithBreak(FilterAction);
     Response.AppendStringWithBreak(FilterParam);
     Response.AppendInt32(PixelReward);
     Response.AppendStringWithBreak(FilterReAction);
     Response.AppendInt32((Client.GetUser().CurrentQuest.Equals(Id)) ? Client.GetUser().CurrentQuestProgress : 0);
     Response.AppendInt32(ActionAmount);
 }
Esempio n. 7
0
        private void ChatWithFriend(Client Client, Request Request)
        {
            int FriendId = Request.PopWiredInt32();

            if (!BrickEngine.GetMessengerHandler().HasFriend(Client.GetUser().HabboId, FriendId))
            {
                return;
            }

            BrickEmulator.HabboHotel.Users.Handlers.Messenger.Friend Friend = BrickEngine.GetMessengerHandler().GetFriend(Client.GetUser().HabboId, FriendId);

            if (Friend == null)
            {
                Response Respose = new Response(261);
                Respose.AppendInt32(6);
                Respose.AppendInt32(FriendId);
                Client.SendResponse(Respose);
                return;
            }

            if (Client.GetUser().Muted)
            {
                Response Respose = new Response(261);
                Respose.AppendInt32(4);
                Respose.AppendInt32(FriendId);
                Client.SendResponse(Respose);
                return;
            }

            if (Friend.IsAlive)
            {
                if (Friend.GetClient().GetUser().Muted)
                {
                    Response Respose = new Response(261);
                    Respose.AppendInt32(3);
                    Respose.AppendInt32(FriendId);
                    Client.SendResponse(Respose);
                }

                Response Response = new Response(134);
                Response.AppendInt32(Client.GetUser().HabboId);
                Response.AppendStringWithBreak(BrickEngine.CleanString(Request.PopFixedString()));

                Friend.GetClient().SendResponse(Response);
            }
            else
            {
                Response Respose = new Response(261);
                Respose.AppendInt32(5);
                Respose.AppendInt32(FriendId);
                Client.SendResponse(Respose);
            }
        }
Esempio n. 8
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());
            }
        }
Esempio n. 9
0
        public void GetResponse(Response Response)
        {
            Response.AppendInt32(BackgroundId);
            Response.AppendInt32(ForegroundId);
            Response.AppendInt32(Items.Count);

            foreach (KeyValuePair<int, int> kvp in Items)
            {
                Response.AppendInt32(kvp.Key);
                Response.AppendInt32(kvp.Value);
            }
        }
Esempio n. 10
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);
 }
Esempio n. 11
0
 public void GetExternalResponse(Response Response)
 {
     Response.AppendInt32(Id);
     Response.AppendStringWithBreak(GetBaseItem().InternalName);
     Response.AppendBoolean(true);
     Response.AppendBoolean(false);
     Response.AppendBoolean(false);
     Response.AppendBoolean(true);
     Response.AppendStringWithBreak(GetBaseItem().InternalType.ToLower());
     Response.AppendInt32(GetBaseItem().SpriteId);
     Response.AppendChar(2);
     Response.AppendBoolean(true);
     Response.AppendInt32(-1);
     Response.AppendInt32((MemberType == Items.MemberType.VIP) ? 2 : 1);
 }
Esempio n. 12
0
        private void CreateRoom(Client Client, Request Request)
        {
            int Limit = BrickEngine.GetConfigureFile().CallIntKey("max.rooms.amount");
            int RoomAmount = BrickEngine.GetRoomReactor().GetMe(Client.GetUser().HabboId).Count;

            if (RoomAmount >= Limit)
            {
                Client.Notif("You're over the rooms limit, first delete a room before you create a new one.", false);
                return;
            }

            string RawName = Request.PopFixedString();
            string RawModel = Request.PopFixedString();

            int RoomId = -1;

            if ((RoomId = BrickEngine.GetRoomReactor().CreateRoom(Client, RawName, RawModel)) > 0)
            {
                Response Response = new Response(59);
                Response.AppendInt32(RoomId);
                Response.AppendStringWithBreak(BrickEngine.CleanString(RawName));
                Client.SendResponse(Response);
            }
            else
            {
                CheckRoomCreate(Client, null);
            }
        }
Esempio n. 13
0
        public Response GetFeaturedResponse()
        {
            try
            {
                Response Response = new Response(450);
                Response.AppendInt32(FeacturedItems.Count);

                foreach (FeacturedItem FeacturedItem in GetRoomsForCategory(-1))
                {
                    FeacturedItem.GetResponse(Response);

                    foreach (FeacturedItem Room in GetRoomsForCategory(FeacturedItem.Id))
                    {
                        Room.GetResponse(Response);
                    }
                }

                return Response;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return null;
            }
        }
Esempio n. 14
0
        public Response GetFavoriteRooms(Client Client)
        {
            Response Response = new Response(451);
            Response.AppendInt32(6);
            Response.AppendChar(2);

            var List = BrickEngine.GetRoomReactor().GetFavoriteRooms(Client);

            Response.AppendInt32(List.Count);

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

            return Response;
        }
Esempio n. 15
0
        public void GetResponse(Response Response)
        {
            StringBuilder PacketBuilder = new StringBuilder();
            Response.AppendInt32(ShopItemId);

            PacketBuilder.Append("HABBO_CLUB_");
            PacketBuilder.Append(MemberShipType.ToUpper());
            PacketBuilder.Append('_');
            PacketBuilder.Append(MonthsAmount);
            PacketBuilder.Append("_MONTH");

            if (MonthsAmount > 1)
            {
                PacketBuilder.Append('S');
            }

            Response.AppendStringWithBreak(PacketBuilder.ToString());
            Response.AppendInt32(BrickEngine.GetShopReactor().GetShopItem(ShopItemId).CreditsCost);
            Response.AppendBoolean(false);
            Response.AppendBoolean(MemberShipType == "VIP");
            Response.AppendInt32(MonthsAmount);
            Response.AppendInt32(MonthsAmount * 31);
            Response.AppendInt32(ExpireDate().Year);
            Response.AppendInt32(ExpireDate().Month);
            Response.AppendInt32(ExpireDate().Day);
        }
Esempio n. 16
0
        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;
        }
Esempio n. 17
0
        private void CheckRoomCreate(Client Client, Request Request)
        {
            int Limit = BrickEngine.GetConfigureFile().CallIntKey("max.rooms.amount");
            int RoomAmount = BrickEngine.GetRoomReactor().GetMe(Client.GetUser().HabboId).Count;

            Response Response = new Response(512);
            Response.AppendBoolean(RoomAmount >= Limit);
            Response.AppendInt32(Limit);
            Client.SendResponse(Response);
        }
Esempio n. 18
0
        public Response GetResponse()
        {
            Response Response = new Response(127);
            Response.AppendInt32(Id);
            Response.AppendStringWithBreak(Base);

            BrickEngine.GetShopReactor().SerializeShopData(Response, this);

            var Items = BrickEngine.GetShopReactor().GetItemsForPage(Id);

            Response.AppendInt32(Items.Count);

            foreach (ShopItem Item in Items)
            {
                Item.GetResponse(Response, false);
            }

            Response.AppendInt32(-1);

            return Response;
        }
Esempio n. 19
0
        private void GetEcotronRewards(Client Client, Request Request)
        {
            Response Response = new Response(506);
            Response.AppendInt32(5);

            for (int i = 5; i > 0; i--)
            {
                var Items = BrickEngine.GetEcotronReactor().GetRewardsForLevel(i);

                Response.AppendInt32(i);
                Response.AppendInt32(BrickEngine.GetEcotronReactor().GetChangeByLevel(i));
                Response.AppendInt32(Items.Count);

                foreach (EcotronReward Item in Items)
                {
                    Response.AppendStringWithBreak(Item.GetBaseItem().InternalType.ToLower());
                    Response.AppendInt32(Item.GetBaseItem().SpriteId);
                }
            }

            Client.SendResponse(Response);
        }
Esempio n. 20
0
        public void GetBadges(Client Client, Request Request)
        {
            var Badges = BrickEngine.GetBadgeHandler().GetBadgesForUser(Client.GetUser().HabboId);
            var Equiped = BrickEngine.GetBadgeHandler().GetEquipedBadges(Client.GetUser().HabboId);

            Response Response = new Response(229);
            Response.AppendInt32(Badges.Count);

            foreach (Badge Badge in Badges)
            {
                Response.AppendInt32(BrickEngine.GetBadgeHandler().GetIdForBadge(Badge.BadgeCode));
                Response.AppendStringWithBreak(Badge.BadgeCode);
            }

            Response.AppendInt32(Equiped.Count);

            foreach (Badge Badge in Equiped)
            {
                Response.AppendInt32(Badge.SlotId);
                Response.AppendStringWithBreak(Badge.BadgeCode);
            }

            Client.SendResponse(Response);
        }
Esempio n. 21
0
        public void GetFurniture(Client Client, Request Request)
        {
            var Items = BrickEngine.GetItemReactor().GetItemsForUser(Client.GetUser().HabboId);

            var FloorItems = new List<Item>();
            var WallItems = new List<Item>();

            foreach (Item Item in Items)
            {
                if (Item.GetBaseItem().InternalType.ToLower() == "s")
                {
                    FloorItems.Add(Item);
                }
                else if (Item.GetBaseItem().InternalType.ToLower() == "i")
                {
                    WallItems.Add(Item);
                }
            }

            Response FloorItemsResponse = new Response(140);
            FloorItemsResponse.AppendStringWithBreak("S");
            FloorItemsResponse.AppendBoolean(true);
            FloorItemsResponse.AppendBoolean(true);
            FloorItemsResponse.AppendInt32(FloorItems.Count);

            foreach (Item Item in FloorItems)
            {
                Item.GetInventoryResponse(FloorItemsResponse);
            }

            Client.SendResponse(FloorItemsResponse);

            Response WallItemsResponse = new Response(140);
            WallItemsResponse.AppendStringWithBreak("I");
            WallItemsResponse.AppendBoolean(true);
            WallItemsResponse.AppendBoolean(true);
            WallItemsResponse.AppendInt32(WallItems.Count);

            foreach (Item Item in WallItems)
            {
                Item.GetInventoryResponse(WallItemsResponse);
            }

            Client.SendResponse(WallItemsResponse);
        }
Esempio n. 22
0
 public void GetResponse(Response Response)
 {
     Response.AppendInt32(Id);
     Response.AppendInt32(State);
     Response.AppendInt32(CategoryId);
     Response.AppendInt32(ReportedCategoryId);
     Response.AppendInt32(0); // TimeStampInteger
     Response.AppendInt32(Priority);
     Response.AppendInt32(ReporterId);
     Response.AppendStringWithBreak(ReporterUsername);
     Response.AppendInt32(ModeratorId);
     Response.AppendStringWithBreak(ModeratorUsername);
     Response.AppendStringWithBreak(IssueMessage);
     Response.AppendInt32(RoomId);
     Response.AppendStringWithBreak(RoomName);
     Response.AppendInt32(0);
     Response.AppendStringWithBreak(string.Empty);
     Response.AppendInt32(RoomCategory);
     Response.AppendInt32(0);
 }
        public void GetChartResponse(Response Response, int SpriteId)
        {
            Response.AppendInt32(30);
            Response.AppendInt32(29);

            for (int i = -29; i < 0; i++)
            {
                Response.AppendInt32(i);

                if (GetDevelopmentDay(i, SpriteId).Count > 0)
                {
                    Response.AppendInt32(GetCreditsRequestAverageForDevelopment(GetDevelopmentDay(i, SpriteId)));
                    Response.AppendInt32(GetDevelopmentDay(i, SpriteId).Count);
                }
                else
                {
                    Response.AppendInt32(GetAveragePerItem(SpriteId));
                    Response.AppendInt32(GetOffersForSpriteId(SpriteId).Count);
                }
            }

            Response.AppendInt32(1);
            Response.AppendInt32(SpriteId);
        }
Esempio n. 24
0
        public void GetResponse(Client Client, Response Response)
        {
            var AchievedQuests = Client.GetUser().Quests;
            var CategoryQuests = BrickEngine.GetQuestReactor().OrderQuestsForCategory(Id);

            Response.AppendStringWithBreak(Name.ToLower());

            if (!AchievedQuests.ContainsKey(Id))
            {
                Response.AppendInt32(0);
            }
            else
            {
                Response.AppendInt32(AchievedQuests[Id]);
            }

            Response.AppendInt32(CategoryQuests.Count);

            Response.AppendInt32(0); // Pixels Type - Reward

            if (AchievedCategory(Client) || BrickEngine.GetQuestReactor().GetQuestForCategory(Client, Id) == null)
            {
                Response.AppendInt32(0);
                Response.AppendBoolean(false);
                Response.AppendChar(2);
                Response.AppendChar(2);
                Response.AppendInt32(0);
                Response.AppendChar(2);
                Response.AppendInt32(0);
                Response.AppendInt32(0);
            }
            else
            {
                BrickEngine.GetQuestReactor().GetQuestForCategory(Client, Id).GetResponse(Client, Response);
            }

            Response.AppendBoolean(false);
        }
Esempio n. 25
0
        public Response GetWardRobeResponse(int HabboId, int Max)
        {
            Response Response = new Response(267);
            Response.AppendBoolean(true);

            var Items = (from clothe in GetClothes(HabboId).Values.ToList() orderby clothe.SlotId ascending select clothe).ToList();

            Response.AppendInt32(Items.Count);

            int i = 0;

            foreach (Clothe Clothe in Items)
            {
                if (i < Max)
                {
                    Clothe.GetResponse(Response);
                    i++;
                }
            }

            return Response;
        }
Esempio n. 26
0
 private void HandleSessionDetails(Client Client, Request Request)
 {
     Response Response = new Response(257);
     Response.AppendInt32(9);
     Response.AppendBoolean(false);
     Response.AppendBoolean(false);
     Response.AppendBoolean(true);
     Response.AppendBoolean(true);
     Response.AppendInt32(3);
     Response.AppendBoolean(false);
     Response.AppendInt32(2);
     Response.AppendBoolean(false);
     Response.AppendInt32(4);
     Response.AppendBoolean(true);
     Response.AppendInt32(5);
     Response.AppendStringWithBreak("dd-MM-yyyy");
     Response.AppendInt32(7);
     Response.AppendBoolean(false);
     Response.AppendInt32(8);
     Response.AppendStringWithBreak("http://");
     Response.AppendInt32(9);
     Response.AppendBoolean(false);
     Client.SendResponse(Response);
 }
Esempio n. 27
0
        public Response GetUnlockResponse(Client Client)
        {
            int Level = GetNextLevel(Client);
            int OldLevel = (Level - 1);

            if (OldLevel <= 0)
            {
                OldLevel = 1;
            }

            string OldBadge = GetBadgeCode(OldLevel);
            string NewBadge = GetBadgeCode(Level);

            int OldBadgeId = BrickEngine.GetBadgeHandler().GetIdForBadge(OldBadge);
            int NewBadgeId = BrickEngine.GetBadgeHandler().GetIdForBadge(NewBadge);

            int ScoreReward = GetScoreReward(Level);
            int PixelReward = GetPixelReward(Level);

            Response Response = new Response(437);
            Response.AppendInt32(Id);
            Response.AppendInt32(Level);
            Response.AppendInt32(NewBadgeId);
            Response.AppendStringWithBreak(NewBadge);
            Response.AppendInt32(ScoreReward);
            Response.AppendInt32(PixelReward);
            Response.AppendBoolean(false);
            Response.AppendInt32(ExtraScore);
            Response.AppendInt32(OldBadgeId);
            Response.AppendStringWithBreak(OldBadge);
            Response.AppendStringWithBreak(Category.Name.ToLower());

            return Response;
        }
Esempio n. 28
0
        public void GetResponse(Response Response, Client Client)
        {
            int Next = GetNextLevel(Client);

            Response.AppendInt32(Id);
            Response.AppendInt32(Next);
            Response.AppendStringWithBreak(GetBadgeCode(Next));
            Response.AppendInt32(GetNeeded(Next));
            Response.AppendInt32(GetPixelReward(Next));
            Response.AppendBoolean(false);
            Response.AppendInt32(BrickEngine.GetAchievementReactor().GetGotAmount(Client, Id)); // GotAmount;
            Response.AppendBoolean(CompletedAchievement(Client));
            Response.AppendStringWithBreak(Category.Name.ToLower());
            Response.AppendInt32(MaxLevel);
        }
Esempio n. 29
0
        private void UpdateHomeRoom(Client Client, Request Request)
        {
            if (!Client.GetUser().IsInRoom)
            {
                return;
            }

            int RoomId = Request.PopWiredInt32();

            if (!Client.GetUser().GetRoom().GetRoomEngine().HasRights(Client.GetUser().HabboId, Rooms.RightsType.Founder))
            {
                // You can't use anothers room.
                return;
            }

            if (Client.GetUser().HomeRoomId == RoomId)
            {
                return;
            }

            Client.GetUser().HomeRoomId = RoomId;

            Response Response = new Response(455);
            Response.AppendInt32(RoomId);
            Client.SendResponse(Response);

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("UPDATE users SET home_room_id = @roomid WHERE id = @habboid LIMIT 1");
                Reactor.AddParam("roomid", RoomId);
                Reactor.AddParam("habboid", Client.GetUser().HabboId);
                Reactor.ExcuteQuery();
            }
        }
Esempio n. 30
0
        private void UpdateFavorite(Client Client, Request Request)
        {
            int RoomId = Request.PopWiredInt32();

            string Query = string.Empty;

            Response Response = new Response(459);
            Response.AppendInt32(RoomId);

            if (Client.GetUser().FavoriteRoomIds.Contains(RoomId))
            {
                Client.GetUser().FavoriteRoomIds.Remove(RoomId);

                Query = "DELETE FROM user_favorite_rooms WHERE user_id = @habboid AND room_id = @roomid LIMIT 1";

                Response.AppendBoolean(false);
            }
            else
            {
                Client.GetUser().FavoriteRoomIds.Add(RoomId);

                Query = "INSERT INTO user_favorite_rooms (user_id, room_id) VALUES (@habboid, @roomid)";

                Response.AppendBoolean(true);
            }

            Client.SendResponse(Response);

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery(Query);
                Reactor.AddParam("habboid", Client.GetUser().HabboId);
                Reactor.AddParam("roomid", RoomId);
                Reactor.ExcuteQuery();
            }
        }