コード例 #1
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());

            if (User == null || User.IsBot)
            {
                return;
            }
            ServerPacket packet = new ServerPacket(228);
            packet.AppendUInt(User.GetClient().GetHabbo().Id);
            packet.AppendInt32(User.GetClient().GetHabbo().GetBadgeComponent().EquippedCount);

            foreach (Badge Badge in User.GetClient().GetHabbo().GetBadgeComponent().BadgeList)
            {
                if (Badge.Slot <= 0)
                {
                    continue;
                }

                packet.AppendInt32(Badge.Slot);
                packet.AppendStringWithBreak(Badge.Code);
            }

            Session.SendPacket(packet);
        }
コード例 #2
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Session.GetHabbo().GetBadgeComponent().ResetSlots();

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = '0' WHERE user_id = '" + Session.GetHabbo().Id + "'");
            }

            while (Packet.RemainingLength > 0)
            {
                int Slot = Packet.PopWiredInt32();
                string Badge = Packet.PopFixedString();

                if (Badge.Length == 0)
                {
                    continue;
                }

                if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Badge) || Slot < 1 || Slot > 5)
                {
                    // zomg haxx0r
                    return;
                }

                Session.GetHabbo().GetBadgeComponent().GetBadge(Badge).Slot = Slot;

                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("slotid", Slot);
                    dbClient.AddParamWithValue("badge", Badge);
                    dbClient.AddParamWithValue("userid", Session.GetHabbo().Id);
                    dbClient.ExecuteQuery("UPDATE user_badges SET badge_slot = @slotid WHERE badge_id = @badge AND user_id = @userid LIMIT 1");
                }
            }

            ServerPacket Message = new ServerPacket(228);
            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendInt32(Session.GetHabbo().GetBadgeComponent().EquippedCount);

            foreach (Badge Badge in Session.GetHabbo().GetBadgeComponent().BadgeList)
            {
                if (Badge.Slot <= 0)
                {
                    continue;
                }

                Message.AppendInt32(Badge.Slot);
                Message.AppendStringWithBreak(Badge.Code);
            }

            if (Session.GetHabbo().InRoom && UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
            {
                UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(Message);
            }
            else
            {
                Session.SendPacket(Message);
            }
        }
コード例 #3
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            ServerPacket packet = new ServerPacket(267);
            packet.AppendBoolean(Session.GetHabbo().HasFuse("fuse_use_wardrobe"));

            if (Session.GetHabbo().HasFuse("fuse_use_wardrobe"))
            {
                DataTable WardrobeData = null;

                using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("userid", Session.GetHabbo().Id);
                    WardrobeData = dbClient.ReadDataTable("SELECT * FROM user_wardrobe WHERE user_id = @userid");
                }

                if (WardrobeData == null)
                {
                    packet.AppendInt32(0);
                }
                else
                {
                    packet.AppendInt32(WardrobeData.Rows.Count);

                    foreach (DataRow Row in WardrobeData.Rows)
                    {
                        packet.AppendUInt((uint)Row["slot_id"]);
                        packet.AppendStringWithBreak((string)Row["look"]);
                        packet.AppendStringWithBreak((string)Row["gender"]);
                    }
                }
            }
            Session.SendPacket(packet);
        }
コード例 #4
0
ファイル: RoomIcon.cs プロジェクト: habb0/uberEmu-stabilized
        public void Serialize(ServerPacket Message)
        {
            Message.AppendInt32(BackgroundImage);
            Message.AppendInt32(ForegroundImage);
            Message.AppendInt32(Items.Count);

            foreach (KeyValuePair<int, int> Item in Items)
            {
                Message.AppendInt32(Item.Key);
                Message.AppendInt32(Item.Value);
            }
        }
コード例 #5
0
        public void AddEffect(int EffectId, int Duration)
        {
            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("INSERT INTO user_effects (user_id,effect_id,total_duration,is_activated,activated_stamp) VALUES ('" + UserId + "','" + EffectId + "','" + Duration + "','0','0')");
            }

            Effects.Add(new AvatarEffect(EffectId, Duration, false, 0));

            ServerPacket packet = new ServerPacket(461);
            packet.AppendInt32(EffectId);
            packet.AppendInt32(Duration);
            GetClient().SendPacket(packet);
        }
コード例 #6
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || Session.GetHabbo().DailyRespectPoints <= 0)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());

            if (User == null || User.GetClient().GetHabbo().Id == Session.GetHabbo().Id || User.IsBot)
            {
                return;
            }

            Session.GetHabbo().DailyRespectPoints--;
            User.GetClient().GetHabbo().Respect++;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE users SET respect = respect + 1 WHERE id = '" + User.GetClient().GetHabbo().Id + "' LIMIT 1");
                dbClient.ExecuteQuery("UPDATE users SET daily_respect_points = daily_respect_points - 1 WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            // FxkqUzYP_
            ServerPacket Message = new ServerPacket(440);
            Message.AppendUInt(User.GetClient().GetHabbo().Id);
            Message.AppendInt32(User.GetClient().GetHabbo().Respect);
            Room.SendMessage(Message);
        }
コード例 #7
0
 public void parse(GameClient Session, ClientPacket Packet)
 {
     ServerPacket packet = new ServerPacket(611);
     packet.AppendBoolean(true);
     packet.AppendInt32(99999);
     Session.SendPacket(packet);
 }
コード例 #8
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            uint Id = Packet.PopWiredUInt();

            RoomData Data = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData(Id);

            if (Data == null || Session.GetHabbo().FavoriteRooms.Count >= 30 || Session.GetHabbo().FavoriteRooms.Contains(Id) || Data.Type == "public")
            {
                ServerPacket packet = new ServerPacket(33);
                packet.AppendInt32(-9001);
                Session.SendPacket(packet);

                return;
            }

            ServerPacket _packet = new ServerPacket(459);
            _packet.AppendUInt(Id);
            _packet.AppendBoolean(true);
            Session.SendPacket(_packet);

            Session.GetHabbo().FavoriteRooms.Add(Id);

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("INSERT INTO user_favorites (user_id,room_id) VALUES ('" + Session.GetHabbo().Id + "','" + Id + "')");
            }
        }
コード例 #9
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserByHabbo(Packet.PopWiredUInt());

            if (User == null || User.IsBot)
            {
                return;
            }

            ServerPacket packet = new ServerPacket(350);
            packet.AppendUInt(User.GetClient().GetHabbo().Id);
            packet.AppendInt32(User.GetClient().GetHabbo().Tags.Count);

            foreach (string Tag in User.GetClient().GetHabbo().Tags)
            {
                packet.AppendStringWithBreak(Tag);
            }

            Session.SendPacket(packet);
        }
コード例 #10
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().MutantPenalty)
            {
                Session.SendNotif("Because of a penalty or restriction on your account, you are not allowed to change your look.");
                return;
            }

            string Gender = Packet.PopFixedString().ToUpper();
            string Look = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());

            if (!AntiMutant.ValidateLook(Look, Gender))
            {
                return;
            }

            Session.GetHabbo().Look = Look;
            Session.GetHabbo().Gender = Gender.ToLower();

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("look", Look);
                dbClient.AddParamWithValue("gender", Gender);
                dbClient.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 1, 1);

            ServerPacket packet = new ServerPacket(266);
            packet.AppendInt32(-1);
            packet.AppendStringWithBreak(Session.GetHabbo().Look);
            packet.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
            packet.AppendStringWithBreak(Session.GetHabbo().Motto);
            Session.SendPacket(packet);

            if (Session.GetHabbo().InRoom)
            {
                Room Room = Session.GetHabbo().CurrentRoom;

                if (Room == null)
                {
                    return;
                }

                RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User == null)
                {
                    return;
                }

                ServerPacket RoomUpdate = new ServerPacket(266);
                RoomUpdate.AppendInt32(User.VirtualId);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto);
                Room.SendMessage(RoomUpdate);
            }
        }
コード例 #11
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            ServerPacket packet = new ServerPacket(512);
            packet.AppendBoolean(false); // true = show error with number below
            packet.AppendInt32(99999);
            Session.SendPacket(packet);

            // todo: room limit
        }
コード例 #12
0
ファイル: RoomEvent.cs プロジェクト: habb0/uberEmu-stabilized
        public ServerPacket Serialize(GameClient Session)
        {
            ServerPacket Message = new ServerPacket(370);
            Message.AppendStringWithBreak(Session.GetHabbo().Id + "");
            Message.AppendStringWithBreak(Session.GetHabbo().Username);
            Message.AppendStringWithBreak(RoomId + "");
            Message.AppendInt32(Category);
            Message.AppendStringWithBreak(Name);
            Message.AppendStringWithBreak(Description);
            Message.AppendStringWithBreak(StartTime);
            Message.AppendInt32(Tags.Count);

            foreach (string Tag in Tags)
            {
                Message.AppendStringWithBreak(Tag);
            }

            return Message;
        }
コード例 #13
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            RoomItem Present = Room.GetItem(Packet.PopWiredUInt());

            if (Present == null)
            {
                return;
            }

            DataRow Data = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                Data = dbClient.ReadDataRow("SELECT base_id,amount,extra_data FROM user_presents WHERE item_id = '" + Present.Id + "' LIMIT 1");
            }

            if (Data == null)
            {
                return;
            }

            Item BaseItem = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Data["base_id"]);

            if (BaseItem == null)
            {
                return;
            }

            Room.RemoveFurniture(Session, Present.Id);

            ServerPacket packet = new ServerPacket(219);
            packet.AppendUInt(Present.Id);
            Session.SendPacket(packet);

            packet = new ServerPacket(129);
            packet.AppendStringWithBreak(BaseItem.Type);
            packet.AppendInt32(BaseItem.SpriteId);
            packet.AppendStringWithBreak(BaseItem.Name);
            Session.SendPacket(packet);

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("DELETE FROM user_presents WHERE item_id = '" + Present.Id + "' LIMIT 1");
            }

            UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, BaseItem, (int)Data["amount"], (string)Data["extra_data"]);
        }
コード例 #14
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().LoadingRoom <= 0)
            {
                return;
            }

            ServerPacket packet = new ServerPacket(297);
            packet.AppendInt32(0);
            Session.SendPacket(packet);
        }
コード例 #15
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            User.Unidle();

            int _danceId = Packet.PopWiredInt32();

            if (_danceId < 0 || _danceId > 4 || (!Session.GetHabbo().HasFuse("fuse_use_club_dance") && _danceId > 1))
            {
                _danceId = 0;
            }

            if (_danceId > 0 && User.CarryItemID > 0)
            {
                User.CarryItem(0);
            }

            User.DanceId = _danceId;

            ServerPacket DanceMessageEventMessage = new ServerPacket(480);
            DanceMessageEventMessage.AppendInt32(User.VirtualId);
            DanceMessageEventMessage.AppendInt32(_danceId);
            Room.SendMessage(DanceMessageEventMessage);
        }
コード例 #16
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            string Motto = UberEnvironment.FilterInjectionChars(Packet.PopFixedString());

            if (Motto == Session.GetHabbo().Motto) // Prevents spam?
            {
                return;
            }

            Session.GetHabbo().Motto = Motto;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("motto", Motto);
                dbClient.ExecuteQuery("UPDATE users SET motto = @motto WHERE id = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            ServerPacket packet = new ServerPacket(484);
            packet.AppendInt32(-1);
            packet.AppendStringWithBreak(Session.GetHabbo().Motto);
            Session.SendPacket(packet);
            if (Session.GetHabbo().InRoom)
            {
                Room Room = Session.GetHabbo().CurrentRoom;

                if (Room == null)
                {
                    return;
                }

                RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id);

                if (User == null)
                {
                    return;
                }

                ServerPacket RoomUpdate = new ServerPacket(266);
                RoomUpdate.AppendInt32(User.VirtualId);
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Look); // Need this to reload User or they will be invisible
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower()); // Need this to reload User or they will be invisible
                RoomUpdate.AppendStringWithBreak(Session.GetHabbo().Motto); // Update The User Motto
                Room.SendMessage(RoomUpdate);
            }
        }
コード例 #17
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            uint ItemId = Packet.PopWiredUInt();
            DataRow Row = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                Row = dbClient.ReadDataRow("SELECT * FROM catalog_marketplace_offers WHERE offer_id = '" + ItemId + "' LIMIT 1");
            }

            if (Row == null || (string)Row["state"] != "1" || (double)Row["timestamp"] <= UberEnvironment.GetGame().GetCatalog().GetMarketplace().FormatTimestamp())
            {
                Session.SendNotif("Sorry, this offer has expired.");
                return;
            }

            Item Item = UberEnvironment.GetGame().GetItemManager().GetItem((uint)Row["item_id"]);

            if (Item == null)
            {
                return;
            }

            if ((int)Row["total_price"] >= 1)
            {
                Session.GetHabbo().Credits -= (int)Row["total_price"];
                Session.GetHabbo().UpdateCreditsBalance(true);
            }

            UberEnvironment.GetGame().GetCatalog().DeliverItems(Session, Item, 1, (string)Row["extra_data"]);

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE catalog_marketplace_offers SET state = '2' WHERE offer_id = '" + ItemId + "' LIMIT 1");
            }

            ServerPacket packet = new ServerPacket(67);
            packet.AppendUInt(Item.ItemId);
            packet.AppendStringWithBreak(Item.Name);
            packet.AppendInt32(0);
            packet.AppendInt32(0);
            packet.AppendInt32(1);
            packet.AppendStringWithBreak(Item.Type.ToLower());
            packet.AppendInt32(Item.SpriteId);
            packet.AppendStringWithBreak("");
            packet.AppendInt32(1);
            packet.AppendInt32(-1);
            packet.AppendStringWithBreak("");
            Session.SendPacket(packet);

            Session.SendPacket(UberEnvironment.GetGame().GetCatalog().GetMarketplace().SerializeOffers(-1, -1, "", 1));
        }
コード例 #18
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }
            foreach (var _user in Room.UserList)
            {
                if (_user.IsBot && _user.BotData.AiType == "guide")
                {
                    ServerPacket packet = new ServerPacket(33);
                    packet.AppendInt32(4009);
                    Session.SendPacket(packet);
                }
            }

            if (Session.GetHabbo().CalledGuideBot)
            {
                ServerPacket packet = new ServerPacket(33);
                packet.AppendInt32(4010);
                Session.SendPacket(packet);
                return;
            }

            RoomUser NewUser = Room.DeployBot(UberEnvironment.GetGame().GetBotManager().GetBot(55));
            NewUser.SetPos(Room.Model.DoorX, Room.Model.DoorY, Room.Model.DoorZ);
            NewUser.UpdateNeeded = true;

            RoomUser RoomOwner = Room.GetRoomUserByHabbo(Room.Owner);

            if (RoomOwner != null)
            {
                NewUser.MoveTo(RoomOwner.Coordinate);
                NewUser.SetRot(Rotation.Calculate(NewUser.X, NewUser.Y, RoomOwner.X, RoomOwner.Y));
            }

            UberEnvironment.GetGame().GetAchievementManager().UnlockAchievement(Session, 6, 1);
            Session.GetHabbo().CalledGuideBot = true;
        }
コード例 #19
0
ファイル: UserItem.cs プロジェクト: habb0/uberEmu-stabilized
        public void Serialize(ServerPacket Message, Boolean Inventory)
        {
            Message.AppendUInt(Id);
            Message.AppendInt32(0);
            Message.AppendStringWithBreak(GetBaseItem().Type.ToUpper());
            Message.AppendUInt(Id);
            Message.AppendInt32(GetBaseItem().SpriteId);

            if (GetBaseItem().Name.Contains("a2"))
            {
                Message.AppendInt32(3);
            }
            else if (GetBaseItem().Name.Contains("wallpaper"))
            {
                Message.AppendInt32(2);
            }
            else if (GetBaseItem().Name.Contains("landscape"))
            {
                Message.AppendInt32(4);
            }
            else
            {
                Message.AppendInt32(0);
            }

            Message.AppendStringWithBreak(ExtraData);
            Message.AppendBoolean(GetBaseItem().AllowRecycle);
            Message.AppendBoolean(GetBaseItem().AllowTrade);
            Message.AppendBoolean(GetBaseItem().AllowInventoryStack);
            Message.AppendBoolean(UberEnvironment.GetGame().GetCatalog().GetMarketplace().CanSellItem(this));
            Message.AppendInt32(-1);

            if (GetBaseItem().Type.ToLower() == "s")
            {
                Message.AppendStringWithBreak("");
                Message.AppendInt32(-1);
            }
        }
コード例 #20
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            ServerPacket Message = new ServerPacket(361);
            Message.AppendInt32(User.VirtualId);
            Message.AppendBoolean(true);
            Room.SendMessage(Message);
        }
コード例 #21
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            ServerPacket packet = new ServerPacket(506);
            packet.AppendInt32(5);

            for (uint i = 5; i >= 1; i--)
            {
                packet.AppendUInt(i);

                if (i <= 1)
                {
                    packet.AppendInt32(0);
                }
                else if (i == 2)
                {
                    packet.AppendInt32(4);
                }
                else if (i == 3)
                {
                    packet.AppendInt32(40);
                }
                else if (i == 4)
                {
                    packet.AppendInt32(200);
                }
                else if (i >= 5)
                {
                    packet.AppendInt32(2000);
                }

                List<EcotronReward> Rewards = UberEnvironment.GetGame().GetCatalog().GetEcotronRewardsForLevel(i);

                packet.AppendInt32(Rewards.Count);

                foreach (EcotronReward Reward in Rewards)
                {
                    packet.AppendStringWithBreak(Reward.GetBaseItem().Type.ToLower());
                    packet.AppendUInt(Reward.DisplayId);
                }
            }

            Session.SendPacket(packet);
        }
コード例 #22
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null)
            {
                return;
            }

            uint Id = Packet.PopWiredUInt();

            if (Session.GetHabbo().MutedUsers.Contains(Id))
            {
                return;
            }

            Session.GetHabbo().MutedUsers.Add(Id);

            ServerPacket packet = new ServerPacket(419);
            packet.AppendInt32(1);
            Session.SendPacket(packet);
        }
コード例 #23
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || Session.GetHabbo().RatedRooms.Contains(Room.RoomId) || Room.CheckRights(Session, true))
            {
                return;
            }

            int Rating = Packet.PopWiredInt32();

            switch (Rating)
            {
                case -1:

                    Room.Score--;
                    break;

                case 1:

                    Room.Score++;
                    break;

                default:

                    return;
            }

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                dbClient.ExecuteQuery("UPDATE rooms SET score = '" + Room.Score + "' WHERE id = '" + Room.RoomId + "' LIMIT 1");
            }

            Session.GetHabbo().RatedRooms.Add(Room.RoomId);

            ServerPacket packet = new ServerPacket(345);
            packet.AppendInt32(Room.Score);
            Session.SendPacket(packet);
        }
コード例 #24
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            ServerPacket packet = new ServerPacket(465);
            packet.AppendUInt(Room.RoomId);
            packet.AppendStringWithBreak(Room.Name);
            packet.AppendStringWithBreak(Room.Description);
            packet.AppendInt32(Room.State);
            packet.AppendInt32(Room.Category);
            packet.AppendInt32(Room.UsersMax);
            packet.AppendInt32(25);
            packet.AppendInt32(Room.TagCount);

            foreach (string Tag in Room.Tags)
            {
                packet.AppendStringWithBreak(Tag);
            }

            packet.AppendInt32(Room.UsersWithRights.Count); // users /w rights count

            foreach (uint UserId in Room.UsersWithRights)
            {
                packet.AppendUInt(UserId);
                packet.AppendStringWithBreak(UberEnvironment.GetGame().GetClientManager().GetNameById(UserId));
            }

            packet.AppendInt32(Room.UsersWithRights.Count); // users /w rights count

            packet.AppendBoolean(Room.AllowPets); // allows pets in room - pet system lacking, so always off
            packet.AppendBoolean(Room.AllowPetsEating); // allows pets to eat your food - pet system lacking, so always off
            packet.AppendBoolean(Room.AllowWalkthrough);
            packet.AppendBoolean(Room.Hidewall);

            Session.SendPacket(packet);
        }
コード例 #25
0
        public void parse(GameClient Session, ClientPacket Packet)
        {
            string SubscriptionId = Packet.PopFixedString();

            ServerPacket packet = new ServerPacket(7);
            packet.AppendStringWithBreak(SubscriptionId.ToLower());

            if (Session.GetHabbo().GetSubscriptionManager().HasSubscription(SubscriptionId))
            {
                Double Expire = Session.GetHabbo().GetSubscriptionManager().GetSubscription(SubscriptionId).ExpireTime;
                Double TimeLeft = Expire - UberEnvironment.GetUnixTimestamp();
                int TotalDaysLeft = (int)Math.Ceiling(TimeLeft / 86400);
                int MonthsLeft = TotalDaysLeft / 31;

                if (MonthsLeft >= 1) MonthsLeft--;

                packet.AppendInt32(TotalDaysLeft - (MonthsLeft * 31));
                packet.AppendBoolean(true);
                packet.AppendInt32(MonthsLeft);
                packet.AppendInt32(1);
                packet.AppendInt32(1);

                if (Session.GetHabbo().HasFuse("fuse_use_vip_outfits"))
                {
                    packet.AppendInt32(2);
                }
                else
                {
                    packet.AppendInt32(1);
                }
            }
            else
            {
                for (int i = 0; i < 3; i++)
                {
                    packet.AppendInt32(0);
                }
            }

            Session.SendPacket(packet);
        }
        public void parse(GameClient Session, ClientPacket Packet)
        {
            Room Room = UberEnvironment.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (Room == null || !Room.CheckRights(Session, true))
            {
                return;
            }

            Boolean Allow = true;
            int ErrorCode = 0;

            if (Room.State != 0)
            {
                Allow = false;
                ErrorCode = 3;
            }

            ServerPacket packet = new ServerPacket(367);
            packet.AppendBoolean(Allow);
            packet.AppendInt32(ErrorCode);
            Session.SendPacket(packet);
        }
コード例 #27
0
 public void parse(GameClient Session, ClientPacket Packet)
 {
     ServerPacket packet = new ServerPacket(5);
     packet.AppendStringWithBreak(Session.GetHabbo().Id.ToString());
     packet.AppendStringWithBreak(Session.GetHabbo().Username);
     packet.AppendStringWithBreak(Session.GetHabbo().Look);
     packet.AppendStringWithBreak(Session.GetHabbo().Gender.ToUpper());
     packet.AppendStringWithBreak(Session.GetHabbo().Motto);
     packet.AppendStringWithBreak(Session.GetHabbo().RealName);
     packet.AppendInt32(0);
     packet.AppendStringWithBreak("");
     packet.AppendInt32(0);
     packet.AppendInt32(0);
     packet.AppendInt32(Session.GetHabbo().Respect);
     packet.AppendInt32(Session.GetHabbo().DailyRespectPoints); // respect to give away
     packet.AppendInt32(Session.GetHabbo().DailyPetRespectPoints);
     Session.SendPacket(packet);
 }
コード例 #28
0
ファイル: Navigator.cs プロジェクト: habb0/uberEmu-stabilized
        public ServerPacket SerializeSearchResults(string SearchQuery)
        {
            DataTable Data = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                SearchQuery = UberEnvironment.FilterInjectionChars(SearchQuery.ToLower()).Trim();

                if (SearchQuery.Length > 0)
                {
                    dbClient.AddParamWithValue("query", SearchQuery + "%");
                    dbClient.AddParamWithValue("tags_query", "%" + SearchQuery + "%");
                    Data = dbClient.ReadDataTable("SELECT * FROM rooms WHERE caption LIKE @query AND roomtype = 'private' OR tags LIKE @tags_query AND roomtype = 'private' OR owner LIKE @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT 30");
                }
            }

            List<RoomData> Results = new List<RoomData>();

            if (Data != null)
            {
                foreach (DataRow Row in Data.Rows)
                {
                    RoomData RData = new RoomData();
                    RData.Fill(Row);
                    Results.Add(RData);
                }
            }

            ServerPacket Message = new ServerPacket(451);
            Message.AppendInt32(1);
            Message.AppendInt32(9);
            Message.AppendStringWithBreak(SearchQuery);
            Message.AppendInt32(Results.Count);

            foreach (RoomData Room in Results)
            {
                Room.Serialize(Message, false);
            }

            return Message;
        }
コード例 #29
0
ファイル: Navigator.cs プロジェクト: habb0/uberEmu-stabilized
        public ServerPacket SerializeRoomListing(GameClient Session, int Mode)
        {
            ServerPacket Rooms = new ServerPacket(451);

            if (Mode >= -1)
            {
                Rooms.AppendInt32(Mode);
                Rooms.AppendInt32(1);
            }
            else if (Mode == -2)
            {
                Rooms.AppendInt32(0);
                Rooms.AppendInt32(2);
            }
            else if (Mode == -3)
            {
                Rooms.AppendInt32(0);
                Rooms.AppendInt32(5);
            }
            else if (Mode == -4)
            {
                Rooms.AppendInt32(0);
                Rooms.AppendInt32(3);
            }
            else if (Mode == -5)
            {
                Rooms.AppendInt32(0);
                Rooms.AppendInt32(4);
            }

            Rooms.AppendStringWithBreak("");

            DataTable Data = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                switch (Mode)
                {
                    case -5:

                        List<uint> FriendRooms = new List<uint>();
                        foreach (MessengerBuddy Buddy in Session.GetHabbo().GetMessenger().GetBuddies())
                        {
                            GameClient Client = UberEnvironment.GetGame().GetClientManager().GetClientByHabbo(Buddy.Id);

                            if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().CurrentRoomId <= 0)
                            {
                                continue;
                            }

                            FriendRooms.Add(Client.GetHabbo().CurrentRoomId);
                        }

                        StringBuilder _Query = new StringBuilder("SELECT * FROM rooms WHERE");

                        int _i = 0;

                        foreach (uint Room in FriendRooms)
                        {
                            if (_i > 0)
                            {
                                _Query.Append(" OR");
                            }

                            _Query.Append(" id = '" + Room + "'");

                            _i++;
                        }

                        _Query.Append(" ORDER BY users_now DESC LIMIT 40");

                        if (_i > 0)
                        {
                            Data = dbClient.ReadDataTable(_Query.ToString());
                        }
                        else
                        {
                            Data = null;
                        }

                        break;

                    case -4:

                        List<string> FriendsNames = new List<string>();

                        foreach (MessengerBuddy Buddy in Session.GetHabbo().GetMessenger().GetBuddies())
                        {
                            FriendsNames.Add(Buddy.Username);
                        }

                        StringBuilder Query = new StringBuilder("SELECT * FROM rooms WHERE");

                        int i = 0;

                        foreach (string Name in FriendsNames)
                        {
                            if (i > 0)
                            {
                                Query.Append(" OR");
                            }

                            Query.Append(" owner = '" + Name + "'");

                            i++;
                        }

                        Query.Append(" ORDER BY users_now DESC LIMIT 40");

                        if (i > 0)
                        {
                            Data = dbClient.ReadDataTable(Query.ToString());
                        }
                        else
                        {
                            Data = null;
                        }

                        break;

                    case -3:

                        Data = dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = '" + Session.GetHabbo().Username + "' ORDER BY id ASC");
                        break;

                    case -2:

                        Data = dbClient.ReadDataTable("SELECT * FROM rooms WHERE score > 0 AND roomtype = 'private' ORDER BY score DESC LIMIT 40");
                        break;

                    case -1:

                        Data = dbClient.ReadDataTable("SELECT * FROM rooms WHERE users_now > 0 AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40");
                        break;

                    default:

                        Data = dbClient.ReadDataTable("SELECT * FROM rooms WHERE category = '" + Mode + "' AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40");
                        break;
                }
            }

            if (Data == null)
            {
                Rooms.AppendInt32(0);
            }
            else
            {
                Rooms.AppendInt32(Data.Rows.Count);

                foreach (DataRow Row in Data.Rows)
                {
                    UberEnvironment.GetGame().GetRoomManager().GenerateRoomData((uint)Row["id"]).Serialize(Rooms, false);
                }
            }

            return Rooms;
        }
コード例 #30
0
ファイル: Navigator.cs プロジェクト: habb0/uberEmu-stabilized
        public ServerPacket SerializeRecentRooms(GameClient Session)
        {
            DataTable Data = null;

            using (DatabaseClient dbClient = UberEnvironment.GetDatabase().GetClient())
            {
                Data = dbClient.ReadDataTable("SELECT * FROM user_roomvisits ORDER BY entry_timestamp DESC LIMIT 50");
            }

            List<RoomData> ValidRecentRooms = new List<RoomData>();
            List<uint> RoomsListed = new List<uint>();

            if (Data != null)
            {
                foreach (DataRow Row in Data.Rows)
                {
                    RoomData rData = UberEnvironment.GetGame().GetRoomManager().GenerateRoomData((uint)Row["room_id"]);

                    if (rData == null || rData.IsPublicRoom || RoomsListed.Contains(rData.Id))
                    {
                        continue;
                    }

                    ValidRecentRooms.Add(rData);
                    RoomsListed.Add(rData.Id);
                }
            }

            ServerPacket Rooms = new ServerPacket(451);
            Rooms.AppendInt32(0);
            Rooms.AppendInt32(7);
            Rooms.AppendStringWithBreak("");
            Rooms.AppendInt32(ValidRecentRooms.Count);

            foreach (RoomData _Data in ValidRecentRooms)
            {
                _Data.Serialize(Rooms, false);
            }

            return Rooms;
        }