public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Boolean Status = Packet.PopBoolean();

            Session.GetHabbo().AllowMessengerInvites = Status;
            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `ignore_invites` = @MessengerInvites WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                dbClient.AddParameter("MessengerInvites", QuasarEnvironment.BoolToEnum(Status));
                dbClient.RunQuery();
            }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowMimic = !Session.GetHabbo().AllowMimic;
            Session.SendWhisper("You're " + (Session.GetHabbo().AllowMimic == true ? "now" : "no longer") + " able to be mimiced.");

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_mimic` = @AllowMimic WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowMimic", QuasarEnvironment.BoolToEnum(Session.GetHabbo().AllowMimic));
                dbClient.RunQuery();
            }
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            bool FocusPreference = Packet.PopBoolean();

            Session.GetHabbo().FocusPreference = FocusPreference;
            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `focus_preference` = @focusPreference WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                dbClient.AddParameter("focusPreference", QuasarEnvironment.BoolToEnum(FocusPreference));
                dbClient.RunQuery();
            }
        }
예제 #4
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowEvents = !Session.GetHabbo().AllowEvents;
            Session.SendWhisper("Ahora " + (Session.GetHabbo().AllowEvents == true ? "permites" : "no permites") + " las alertas de eventos en el hotel, si quieres volver a recibirlas, realiza el comando nuevamente.");


            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_events` = @AllowEvents WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowEvents", QuasarEnvironment.BoolToEnum(Session.GetHabbo().AllowEvents));
                dbClient.RunQuery();
            }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            Session.GetHabbo().AllowGifts = !Session.GetHabbo().AllowGifts;
            Session.SendWhisper("Je " + (Session.GetHabbo().AllowGifts ? "ontvangt nu weer" : "ontvangt nu geen") +
                                " cadeaus.");


            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `allow_gifts` = @AllowGifts WHERE `id` = '" + Session.GetHabbo().Id + "'");
                dbClient.AddParameter("AllowGifts", QuasarEnvironment.BoolToEnum(Session.GetHabbo().AllowGifts));
                dbClient.RunQuery();
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int    BotId      = Packet.PopInt();
            int    ActionId   = Packet.PopInt();
            string DataString = Packet.PopString();

            if (ActionId < 1 || ActionId > 5)
            {
                return;
            }

            RoomUser Bot = null;

            if (!Room.GetRoomUserManager().TryGetBot(BotId, out Bot))
            {
                return;
            }

            if ((Bot.BotData.ownerID != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("bot_edit_any_override")))
            {
                return;
            }

            RoomBot RoomBot = Bot.BotData;

            if (RoomBot == null)
            {
                return;
            }

            /* 1 = Copy looks
             * 2 = Setup Speech
             * 3 = Relax
             * 4 = Dance
             * 5 = Change Name
             */

            switch (ActionId)
            {
                #region Copy Looks (1)
            case 1:
            {
                ServerPacket UserChangeComposer = new ServerPacket(ServerPacketHeader.UserChangeMessageComposer);
                UserChangeComposer.WriteInteger(Bot.VirtualId);
                UserChangeComposer.WriteString(Session.GetHabbo().Look);
                UserChangeComposer.WriteString(Session.GetHabbo().Gender);
                UserChangeComposer.WriteString(Bot.BotData.Motto);
                UserChangeComposer.WriteInteger(0);
                Room.SendMessage(UserChangeComposer);

                //Change the defaults
                Bot.BotData.Look   = Session.GetHabbo().Look;
                Bot.BotData.Gender = Session.GetHabbo().Gender;

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `look` = @look, `gender` = '" + Session.GetHabbo().Gender + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("look", Session.GetHabbo().Look);
                    dbClient.RunQuery();
                }

                //Room.SendMessage(new UserChangeComposer(BotUser.GetClient(), true));
                break;
            }
                #endregion

                #region Setup Speech (2)
            case 2:
            {
                string[] ConfigData = DataString.Split(new string[]
                    {
                        ";#;"
                    }, StringSplitOptions.None);

                string[] SpeechData = ConfigData[0].Split(new char[]
                    {
                        '\r',
                        '\n'
                    }, StringSplitOptions.RemoveEmptyEntries);

                string AutomaticChat    = Convert.ToString(ConfigData[1]);
                string SpeakingInterval = Convert.ToString(ConfigData[2]);
                string MixChat          = Convert.ToString(ConfigData[3]);

                if (String.IsNullOrEmpty(SpeakingInterval) || Convert.ToInt32(SpeakingInterval) <= 0 || Convert.ToInt32(SpeakingInterval) < 7)
                {
                    SpeakingInterval = "7";
                }

                RoomBot.AutomaticChat    = Convert.ToBoolean(AutomaticChat);
                RoomBot.SpeakingInterval = Convert.ToInt32(SpeakingInterval);
                RoomBot.MixSentences     = Convert.ToBoolean(MixChat);

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                { dbClient.RunQuery("DELETE FROM `bots_speech` WHERE `bot_id` = '" + Bot.BotData.Id + "'"); }

                #region Save Data - TODO: MAKE METHODS FOR THIS.
                for (int i = 0; i <= SpeechData.Length - 1; i++)
                {
                    using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("INSERT INTO `bots_speech` (`bot_id`, `text`) VALUES (@id, @data)");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("data", SpeechData[i]);
                        dbClient.RunQuery();

                        dbClient.SetQuery("UPDATE `bots` SET `automatic_chat` = @AutomaticChat, `speaking_interval` = @SpeakingInterval, `mix_sentences` = @MixChat WHERE `id` = @id LIMIT 1");
                        dbClient.AddParameter("id", BotId);
                        dbClient.AddParameter("AutomaticChat", AutomaticChat.ToLower());
                        dbClient.AddParameter("SpeakingInterval", Convert.ToInt32(SpeakingInterval));
                        dbClient.AddParameter("MixChat", QuasarEnvironment.BoolToEnum(Convert.ToBoolean(MixChat)));
                        dbClient.RunQuery();
                    }
                }
                #endregion

                #region Handle Speech
                RoomBot.RandomSpeech.Clear();
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT `text` FROM `bots_speech` WHERE `bot_id` = @id");
                    dbClient.AddParameter("id", BotId);

                    DataTable BotSpeech = dbClient.getTable();

                    List <RandomSpeech> Speeches = new List <RandomSpeech>();
                    foreach (DataRow Speech in BotSpeech.Rows)
                    {
                        RoomBot.RandomSpeech.Add(new RandomSpeech(Convert.ToString(Speech["text"]), BotId));
                    }
                }
                #endregion

                break;
            }
                #endregion

                #region Relax (3)
            case 3:
            {
                if (Bot.BotData.WalkingMode == "stand")
                {
                    Bot.BotData.WalkingMode = "freeroam";
                }
                else
                {
                    Bot.BotData.WalkingMode = "stand";
                }

                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `bots` SET `walk_mode` = '" + Bot.BotData.WalkingMode + "' WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                }
                break;
            }
                #endregion

                #region Dance (4)
            case 4:
            {
                if (Bot.BotData.DanceId > 0)
                {
                    Bot.BotData.DanceId = 0;
                }
                else
                {
                    Random RandomDance = new Random();
                    Bot.BotData.DanceId = RandomDance.Next(1, 4);
                }

                Room.SendMessage(new DanceComposer(Bot, Bot.BotData.DanceId));
                break;
            }
                #endregion

                #region Change Name (5)
            case 5:
            {
                if (DataString.Length == 0)
                {
                    Session.SendWhisper("Oeps! Je bent vergeten een geldig naam in te vullen.");
                    return;
                }
                else if (DataString.Length >= 16)
                {
                    Session.SendWhisper("Oeps! Je naam is te lang.");
                    return;
                }

                if (DataString.Contains("<img src") || DataString.Contains("<font ") || DataString.Contains("</font>") || DataString.Contains("</a>") || DataString.Contains("<i>"))
                {
                    Session.SendWhisper("Scripten is niet toegestaan. Lmao :-)!");
                    return;
                }

                Bot.BotData.Name = DataString;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `name` = @name WHERE `id` = '" + Bot.BotData.Id + "' LIMIT 1");
                    dbClient.AddParameter("name", DataString);
                    dbClient.RunQuery();
                }
                Room.SendMessage(new UsersComposer(Bot));
                break;
            }
                #endregion
            }
        }
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            if (Params.Length == 1)
            {
                Session.SendWhisper("Oeps! Je bent vergeten een functie in te voeren. (:lijst)", 34);
                return;
            }

            if (!Room.CheckRights(Session, true))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren.", 34);
                return;
            }

            string Option = Params[1];

            switch (Option)
            {
            case "lijst":
            {
                StringBuilder List = new StringBuilder("");
                List.AppendLine("Lijst met kamer functies:");
                List.AppendLine("-------------------------");
                List.AppendLine("Huisdieren: " + (Room.PetMorphsAllowed == true ? "aan" : "uit"));
                List.AppendLine("Pull: " + (Room.PullEnabled == true ? "aan" : "uit"));
                List.AppendLine("Push: " + (Room.PushEnabled == true ? "aan" : "uit"));
                List.AppendLine("Super Pull: " + (Room.SPullEnabled == true ? "aan" : "uit"));
                List.AppendLine("Super Push: " + (Room.SPushEnabled == true ? "aan" : "uit"));
                List.AppendLine("Respect: " + (Room.RespectNotificationsEnabled == true ? "aan" : "uit"));
                List.AppendLine("Effects: " + (Room.EnablesEnabled == true ? "aan" : "uit"));
                Session.SendNotification(List.ToString());
                break;
            }

            case "push":
            {
                Room.PushEnabled = !Room.PushEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `push_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PushEnabled", QuasarEnvironment.BoolToEnum(Room.PushEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.PushEnabled == true ? "weer andere Habbis duwen!" : "niet meer andere Habbis duwen!"), 34);
                break;
            }

            case "spush":
            {
                Room.SPushEnabled = !Room.SPushEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `spush_enabled` = @PushEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PushEnabled", QuasarEnvironment.BoolToEnum(Room.SPushEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.SPushEnabled == true ? "weer andere Habbis super duwen!" : "niet meer andere Habbis super duwen!"), 34);
                break;
            }

            case "spull":
            {
                Room.SPullEnabled = !Room.SPullEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `spull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PullEnabled", QuasarEnvironment.BoolToEnum(Room.SPullEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.SPullEnabled == true ? "weer andere Habbis super trekken!" : "niet meer andere Habbis super trekken!"), 34);
                break;
            }

            case "pull":
            {
                Room.PullEnabled = !Room.PullEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `pull_enabled` = @PullEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PullEnabled", QuasarEnvironment.BoolToEnum(Room.PullEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.PullEnabled == true ? "weer andere Habbis trekken!" : "niet meer andere Habbis trekken!"), 34);
                break;
            }

            case "enable":
            case "effecten":
            {
                Room.EnablesEnabled = !Room.EnablesEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `enables_enabled` = @EnablesEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("EnablesEnabled", QuasarEnvironment.BoolToEnum(Room.EnablesEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.EnablesEnabled == true ? "weer effecten gebruiken!" : "geen effecten meer gebruiken!"), 34);
                break;
            }


            case "respect":
            {
                Room.RespectNotificationsEnabled = !Room.RespectNotificationsEnabled;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `respect_notifications_enabled` = @RespectNotificationsEnabled WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("RespectNotificationsEnabled", QuasarEnvironment.BoolToEnum(Room.RespectNotificationsEnabled));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.RespectNotificationsEnabled == true ? "weer andere Habbis respecteren!" : "niet meer andere Habbis respecteren!"), 34);
                break;
            }

            case "dieren":
            case "huisdieren":
            {
                Room.PetMorphsAllowed = !Room.PetMorphsAllowed;
                using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `rooms` SET `pet_morphs_allowed` = @PetMorphsAllowed WHERE `id` = '" + Room.Id + "' LIMIT 1");
                    dbClient.AddParameter("PetMorphsAllowed", QuasarEnvironment.BoolToEnum(Room.PetMorphsAllowed));
                    dbClient.RunQuery();
                }

                Session.SendWhisper("Habbis kunnen nu " + (Room.PetMorphsAllowed == true ? "weer veranderen in een huisdier!" : "niet meer veranderen in een huisdier!"), 34);

                if (!Room.PetMorphsAllowed)
                {
                    foreach (RoomUser User in Room.GetRoomUserManager().GetRoomUsers())
                    {
                        if (User == null || User.GetClient() == null || User.GetClient().GetHabbo() == null)
                        {
                            continue;
                        }

                        User.GetClient().SendWhisper("De kamer eigenaar heeft deze actie voor de kamer uitgezet.", 34);
                        if (User.GetClient().GetHabbo().PetId > 0)
                        {
                            //Tell the user what is going on.
                            User.GetClient().SendWhisper("Oeps! Je kan deze actie hier niet uitvoeren.", 34);

                            //Change the users Pet Id.
                            User.GetClient().GetHabbo().PetId = 0;

                            //Quickly remove the old user instance.
                            Room.SendMessage(new UserRemoveComposer(User.VirtualId));

                            //Add the new one, they won't even notice a thing!!11 8-)
                            Room.SendMessage(new UsersComposer(User));
                        }
                    }
                }
                break;
            }
            }
        }
        public void UpdatePreset(int Preset, string Color, int Intensity, bool BgOnly, bool Hax = false)
        {
            if (!IsValidColor(Color) || !IsValidIntensity(Intensity) && !Hax)
            {
                return;
            }

            string Pr;

            switch (Preset)
            {
            case 3:

                Pr = "three";
                break;

            case 2:

                Pr = "two";
                break;

            case 1:
            default:

                Pr = "one";
                break;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE room_items_moodlight SET preset_" + Pr + " = '@color," + Intensity + "," + QuasarEnvironment.BoolToEnum(BgOnly) + "' WHERE item_id = '" + ItemId + "' LIMIT 1");
                dbClient.AddParameter("color", Color);
                dbClient.RunQuery();
            }

            GetPreset(Preset).ColorCode      = Color;
            GetPreset(Preset).ColorIntensity = Intensity;
            GetPreset(Preset).BackgroundOnly = BgOnly;
        }