Beispiel #1
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            GameClient TargetClient = RavenEnvironment.GetGame().GetClientManager().GetClientByUsername(session.GetHabbo().CurrentRoom.OwnerName);

            if (!session.GetHabbo().GetPermissions().HasRight("room.staff_picks.management"))
            {
                return;
            }

            Room room = null;

            if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(packet.PopInt(), out room))
            {
                return;
            }

            StaffPick staffPick = null;

            if (!RavenEnvironment.GetGame().GetNavigator().TryGetStaffPickedRoom(room.Id, out staffPick))
            {
                if (RavenEnvironment.GetGame().GetNavigator().TryAddStaffPickedRoom(room.Id))
                {
                    using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("INSERT INTO `navigator_staff_picks` (`room_id`,`image`) VALUES (@roomId, null)");
                        dbClient.AddParameter("roomId", room.Id);
                        dbClient.RunQuery();
                    }
                    if (TargetClient != null)
                    {
                        RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetClient, "ACH_Spr", 1, false);
                    }
                }
            }

            else
            {
                if (RavenEnvironment.GetGame().GetNavigator().TryRemoveStaffPickedRoom(room.Id))
                {
                    using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("DELETE FROM `navigator_staff_picks` WHERE `room_id` = @roomId LIMIT 1");
                        dbClient.AddParameter("roomId", room.Id);
                        dbClient.RunQuery();
                    }
                }
            }

            room.SendMessage(new RoomSettingsSavedComposer(room.RoomId));
            room.SendMessage(new RoomInfoUpdatedComposer(room.RoomId));
        }
        public GetGuestRoomResultComposer(GameClient Session, RoomData Data, Boolean isLoading, Boolean checkEntry)
            : base(ServerPacketHeader.GetGuestRoomResultMessageComposer)
        {
            WriteBoolean(isLoading);
            WriteInteger(Data.Id);
            WriteString(Data.Name);
            WriteInteger(Data.OwnerId);
            WriteString(Data.OwnerName);
            WriteInteger(RoomAccessUtility.GetRoomAccessPacketNum(Data.Access));
            WriteInteger(Data.UsersNow);
            WriteInteger(Data.UsersMax);
            WriteString(Data.Description);
            WriteInteger(Data.TradeSettings);
            WriteInteger(Data.Score);
            WriteInteger(0);            //Top rated room rank.
            WriteInteger(Data.Category);

            WriteInteger(Data.Tags.Count);
            foreach (string Tag in Data.Tags)
            {
                WriteString(Tag);
            }

            if (Data.Group != null && Data.Promotion != null)
            {
                WriteInteger(62);                //What?

                WriteInteger(Data.Group == null ? 0 : Data.Group.Id);
                WriteString(Data.Group == null ? "" : Data.Group.Name);
                WriteString(Data.Group == null ? "" : Data.Group.Badge);

                WriteString(Data.Promotion != null ? Data.Promotion.Name : "");
                WriteString(Data.Promotion != null ? Data.Promotion.Description : "");
                WriteInteger(Data.Promotion != null ? Data.Promotion.MinutesLeft : 0);
            }
            else if (Data.Group != null && Data.Promotion == null)
            {
                WriteInteger(58);                //What?
                WriteInteger(Data.Group == null ? 0 : Data.Group.Id);
                WriteString(Data.Group == null ? "" : Data.Group.Name);
                WriteString(Data.Group == null ? "" : Data.Group.Badge);
            }
            else if (Data.Group == null && Data.Promotion != null)
            {
                WriteInteger(60);                //What?
                WriteString(Data.Promotion != null ? Data.Promotion.Name : "");
                WriteString(Data.Promotion != null ? Data.Promotion.Description : "");
                WriteInteger(Data.Promotion != null ? Data.Promotion.MinutesLeft : 0);
            }
            else
            {
                WriteInteger(56);                //What?
            }


            WriteBoolean(checkEntry);
            StaffPick staffPick = null;

            if (!CloudServer.GetGame().GetNavigator().TryGetStaffPickedRoom(Data.Id, out staffPick))
            {
                WriteBoolean(false);
            }
            else
            {
                WriteBoolean(true);
            }
            WriteBoolean(false);
            WriteBoolean(false);

            WriteInteger(Data.WhoCanMute);
            WriteInteger(Data.WhoCanKick);
            WriteInteger(Data.WhoCanBan);

            WriteBoolean(Session.GetHabbo().GetPermissions().HasRight("mod_tool") || Data.OwnerName == Session.GetHabbo().Username);            //Room muting.
            WriteInteger(Data.chatMode);
            WriteInteger(Data.chatSize);
            WriteInteger(Data.chatSpeed);
            WriteInteger(Data.extraFlood);            //Hearing distance
            WriteInteger(Data.chatDistance);          //Flood!!
        }