Example #1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (Session.GetHabbo().Rank == 2 && Session.GetHabbo().GetPermissions().HasRight("ambassador"))
            {
                Session.SendNotification("Esta ação do Embaixador está atualmente desativada.");
                return;
            }

            if (!Room.CheckRights(Session) && Room.WhoCanKick != 2 && Room.Group == null)
            {
                return;
            }

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

            House House;

            if (!Room.TryGetHouse(out House))
            {
                Session.SendWhisper("Você não está dentro de um apartamento!", 1);
                return;
            }

            if (House.OwnerId != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                Session.SendWhisper("Você não é o proprietário do apartamento!", 1);
                return;
            }

            int      UserId = Packet.PopInt();
            RoomUser User   = Room.GetRoomUserManager().GetRoomUserByHabbo(UserId);

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

            //Cannot kick owner or moderators.
            if (Room.CheckRights(User.GetClient(), true) || User.GetClient().GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                return;
            }

            Room.GetRoomUserManager().RemoveUserFromRoom(User.GetClient(), true, true);
            //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_SelfModKickSeen", 1);
        }
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (session == null || session.Habbo == null || !session.Habbo.GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    userId  = packet.PopInt();
            string message = packet.PopString();
            double days    = packet.PopInt() / 1440.0;

            packet.PopString(); //unk1
            packet.PopString(); //unk2

            double length = PlusEnvironment.GetUnixTimestamp() + days * 86400;

            Habbo habbo = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (habbo.GetPermissions().HasRight("mod_trade_lock") && !session.Habbo.GetPermissions().HasRight("mod_trade_lock_any"))
            {
                session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher.");
                return;
            }

            if (days < 1)
            {
                days = 1;
            }

            if (days > 365)
            {
                days = 365;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + habbo.Id + "' LIMIT 1");
            }

            if (habbo.GetClient() != null)
            {
                habbo.TradingLockExpiry = length;
                habbo.GetClient().SendNotification("You have been trade banned for " + days + " day(s)!\r\rReason:\r\r" + message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();


            double Length = (CloudServer.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = CloudServer.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro em encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Ops, você não pode bloquear outro usuário avaliado em 5 ou superior.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("Suas trocas foram proibidas! " + Days + " día(s)!\r\rRazão:\r\r" + Message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (RavenEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = RavenEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocurrio un error mientras se realizaba la busqueda de este usuario enla DB");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Oops,No puede bloquear el trade a este usuario");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("Usted no puede tradear por  " + Days + " dia(s)!\r\rRazon:\r\r" + Message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Oops, you cannot trade lock another user ranked 5 or higher.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!\r\rReason:\r\r" + Message);
            }
        }
Example #6
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (QuasarEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker kan niet worden gevonden.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze gebruiker een ruil blokkering op te leggen.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("Je hebt een ruilban voor " + Days + " dag(en)!\r\rReden:\r\r" + Message);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Days     = (Packet.PopInt() / 1440);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            double Length = (PlusEnvironment.GetUnixTimestamp() + (Days * 86400));

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_trade_lock") && !Session.GetHabbo().GetPermissions().HasRight("mod_trade_lock_any"))
            {
                Session.SendWhisper("Opa, você não pode fazer uma troca com outro usuário com Rank 5 ou mais.");
                return;
            }

            if (Days < 1)
            {
                Days = 1;
            }

            if (Days > 365)
            {
                Days = 365;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `trading_locked` = '" + Length + "', `trading_locks_count` = `trading_locks_count` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TradingLockExpiry = Length;
                Habbo.GetClient().SendNotification("You have been trade banned for " + Days + " day(s)!\r\rReason:\r\r" + Message);
            }
        }
Example #8
0
        public RentableSpaceComposer(Item Item, HabboHotel.GameClients.GameClient Session) : base(ServerPacketHeader.RentableSpaceMessageComposer)
        {
            int Cost = GetCost(Item);

            if (Item != null)
            {
                var RentableSpaceData = Item.RentableSpaceData;

                if (RentableSpaceData != null)
                {
                    base.WriteBoolean(RentableSpaceData.Enabled);
                    base.WriteInteger(0);
                    base.WriteInteger(-1); // nothing??
                    base.WriteString(PlusEnvironment.GetHabboById(RentableSpaceData.OwnerId).Username);
                    base.WriteInteger(RentableSpaceData.TimeLeft);
                    base.WriteInteger(Cost); // Rentable Space Cost

                    var House = PlusEnvironment.GetGame().GetHouseManager().GetHouseBySignItem(Item);

                    if (House != null)
                    {
                        if (House.OwnerId == Session.GetHabbo().Id)
                        {
                            if (!House.ForSale)
                            {
                                Session.SendWhisper("Olá, " + Session.GetHabbo().Username + "! Se você gostaria de vender sua casa, use o comando ':vender [quantidade]' e clique em 'Vender'!");
                                return;
                            }
                            else
                            {
                                Session.SendWhisper("Olá, " + Session.GetHabbo().Username + "! Sua casa já está à venda por R$" + House.Cost + "! Use o comando ':vender [quantidade]' para mudar o preço da casa!");
                                return;
                            }
                        }
                    }
                }
                else
                {
                    WriteNullData();
                }
            }
            else
            {
                WriteNullData();
            }
        }
Example #9
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            int BotId = Packet.PopInt();

            if (BotId == 0)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser BotUser = null;

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

            if (Session.GetHabbo().Id != BotUser.BotData.ownerID && !Session.GetHabbo().GetPermissions().HasRight("bot_place_any_override"))
            {
                Session.SendWhisper("Você só pode pegar seus próprios bots!");
                return;
            }

            if (BotUser.GetBotRoleplay() == null)
            {
                using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("UPDATE `bots` SET `room_id` = '0' WHERE `id` = @id LIMIT 1");
                    dbClient.AddParameter("id", BotId);
                    dbClient.RunQuery();
                }

                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                Room.GetRoomUserManager().RemoveBot(BotUser.VirtualId, false);
            }
            else
            {
                Room.GetGameMap().RemoveUserFromMap(BotUser, new System.Drawing.Point(BotUser.X, BotUser.Y));

                Session.GetHabbo().GetInventoryComponent().TryAddBot(new Bot(Convert.ToInt32(BotUser.BotData.Id), Convert.ToInt32(BotUser.BotData.ownerID), BotUser.BotData.Name, BotUser.BotData.Motto, BotUser.BotData.Look, BotUser.BotData.Gender));
                Session.SendMessage(new BotInventoryComposer(Session.GetHabbo().GetInventoryComponent().GetBots()));
                RoleplayBotManager.EjectDeployedBot(BotUser, Room, true);
            }
        }
Example #10
0
        public void Parse(HabboHotel.GameClients.GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null || !session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int userId = packet.PopInt();

            packet.PopString(); //message
            double length = packet.PopInt() * 60;

            packet.PopString(); //unk1
            packet.PopString(); //unk2

            Habbo habbo = PlusEnvironment.GetHabboById(userId);

            if (habbo == null)
            {
                session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (habbo.GetPermissions().HasRight("mod_mute") && !session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                session.SendWhisper("Oops, you cannot mute that user.");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + length + "' WHERE `id` = '" + habbo.Id + "' LIMIT 1");
            }

            if (habbo.GetClient() != null)
            {
                habbo.TimeMuted = length;
                habbo.GetClient().SendNotification("You have been muted by a moderator for " + length + " seconds!");
            }
        }
Example #11
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            int userId = Packet.PopInt();

            if (userId == 0 || userId == Session.GetHabbo().Id)
            {
                return;
            }

            string message = Packet.PopString();

            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendWhisper("Opa, você foi silenciado por 15 segundos, você não pode enviar mensagens durante este período.");
                return;
            }

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(message, out word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.GetHabbo().TimeMuted = 25;
                    Session.SendNotification("Você foi silênciado, aparentemente divulgo um hotel! aviso: " + Session.GetHabbo().BannedPhraseCount + "/3");
                    CloudServer.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgadores!",
                                                                                                     "Atenção você mencionaou a palavra <b>" + word.ToUpper() + "</b><br><br><b>Frase:</b><br><i>" + message +
                                                                                                     "</i>.<br><br><b>Tipo</b><br>Spam em chat.\r\n" + "- Este usuario: <b>" +
                                                                                                     Session.GetHabbo().Username + "</b>", NotificationSettings.NOTIFICATION_FILTER_IMG, "", ""));
                }
                if (Session.GetHabbo().BannedPhraseCount >= 5)
                {
                    CloudServer.GetGame().GetModerationManager().BanUser("Protocolo", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Banido por fazer spam com frases (" + message + ")", (CloudServer.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                return;
            }

            Session.GetHabbo().GetMessenger().SendInstantMessage(userId, message);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Length   = (Packet.PopInt() * 60);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            Habbo Habbo = RavenEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocurrio un error mientras se realiza la busqueda de este usuario en la DB");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Oops, No puede silenciar a este usuario");
                return;
            }

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TimeMuted = Length;
                Habbo.GetClient().SendNotification("Usted ha sido silenciado por tener un mal comportamiento en el Hotel. Cómportese para evitar futuras sanciones");
                //Habbo.GetClient().SendNotification("usted ha sido silenciado por un moderador por  " + Length + " segundos!");
            }
        }
Example #13
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Length   = (Packet.PopInt() * 60);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker kan niet worden gevonden.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze gebruiker een spreekverbod op te leggen.");
                return;
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TimeMuted = Length;
                //Habbo.GetClient().SendNotification("Usted ha sido silenciado por tener un mal comportamiento en Habbi Hotel. Cómportese para evitar futuras sanciones");
                Habbo.GetClient().SendNotification("Je hebt een spreekverbod  " + Length + " seconden!");
            }
        }
Example #14
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Length   = (Packet.PopInt() * 60);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("An error occoured whilst finding that user in the database.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Oops, you cannot mute that user.");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TimeMuted = Length;
                Habbo.GetClient().SendNotification("You have been muted by a moderator for " + Length + " seconds!");
            }
        }
Example #15
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_mute"))
            {
                return;
            }

            int    UserId   = Packet.PopInt();
            string Message  = Packet.PopString();
            double Length   = (Packet.PopInt() + 60 * 60);
            string Unknown1 = Packet.PopString();
            string Unknown2 = Packet.PopString();

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_mute") && !Session.GetHabbo().GetPermissions().HasRight("mod_mute_any"))
            {
                Session.SendWhisper("Opa, você não pode silenciar esse usuário.");
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `users` SET `time_muted` = '" + Length + "' WHERE `id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (Habbo.GetClient() != null)
            {
                Habbo.TimeMuted = Length;
                Habbo.GetClient().SendNotification("Você foi mutado por um moderador por " + Length + " segundos!");
            }
        }
Example #16
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int    RoomId = Packet.PopInt();
            string Name   = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());
            string Desc   = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Packet.PopString());

            RoomData Data = RocketEmulador.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Data == null)
            {
                return;
            }

            if (Data.OwnerId != Session.GetHabbo().Id)
            {
                return;//HAX
            }
            if (Data.Promotion == null)
            {
                Session.SendWhisper("Oops, it looks like there isn't a room promotion in this room?");
                return;
            }

            using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `room_promotions` SET `title` = @title, `description` = @desc WHERE `room_id` = " + RoomId + " LIMIT 1");
                dbClient.AddParameter("title", Name);
                dbClient.AddParameter("desc", Desc);
                dbClient.RunQuery();
            }

            Room Room;

            if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Convert.ToInt32(RoomId), out Room))
            {
                return;
            }

            Data.Promotion.Name        = Name;
            Data.Promotion.Description = Desc;
            Room.SendMessage(new RoomEventComposer(Data, Data.Promotion));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }



            int PetId = Packet.PopInt();

            RoomUser Pet = null;

            if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet))
            {
                //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?!
                RoomUser User = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId);
                if (User == null)
                {
                    return;
                }

                //Check some values first, please!
                if (User.GetClient() == null || User.GetClient().GetHabbo() == null)
                {
                    return;
                }

                //And boom! Let us send the training panel composer 8-).
                Session.SendWhisper("Talvez um dia, boo boo.");
                return;
            }

            //Continue as a regular pet..
            if (Pet.RoomId != Session.GetHabbo().CurrentRoomId || Pet.PetData == null)
            {
                return;
            }

            Session.SendMessage(new PetTrainingPanelComposer(Pet.PetData.PetId, Pet.PetData.Level));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            string item = Packet.PopString();

            var CraftingItem = CraftingManager.getRecipe(item);

            if (CraftingItem == null)
            {
                Session.SendWhisper("Esta receita não pôde ser encontrada! Notificar um desenvolvedor!", 1);
                return;
            }

            ICollection <Item> FloorItems = Session.GetHabbo().GetInventoryComponent().GetFloorItems();
            ICollection <Item> WallItems  = Session.GetHabbo().GetInventoryComponent().GetWallItems();

            Session.GetRoleplay().CraftingCheck = false;
            Session.SendMessage(new FurniListComposer(FloorItems.ToList(), WallItems, Session.GetRoleplay().CraftingCheck));

            Session.SendMessage(new CraftingRecipeMessageComposer(CraftingItem));

            Session.GetRoleplay().CraftingCheck = true;
            Session.SendMessage(new FurniListComposer(FloorItems.ToList(), WallItems, Session.GetRoleplay().CraftingCheck));
        }
Example #19
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom || Session.GetHabbo().GetStats() == null || Session.GetHabbo().GetStats().DailyPetRespectPoints == 0)
            {
                return;
            }

            Room Room;

            if (!RavenEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (ThisUser == null)
            {
                return;
            }

            int PetId = Packet.PopInt();

            RoomUser Pet = null;

            if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet))
            {
                RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId);
                if (TargetUser == null)
                {
                    return;
                }

                if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null)
                {
                    return;
                }

                if (TargetUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id)
                {
                    Session.SendWhisper("A ver vale que quieras Duckets, pero respetarte a tí mismo ya es pasarse, ¿no?");
                    return;
                }

                RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RespectGiven", 1);
                RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetUser.GetClient(), "ACH_RespectEarned", 1);

                Session.GetHabbo().GetStats().DailyPetRespectPoints  -= 1;
                Session.GetHabbo().GetStats().RespectGiven           += 1;
                TargetUser.GetClient().GetHabbo().GetStats().Respect += 1;

                ThisUser.CarryItemID = 999999999;
                ThisUser.CarryTimer  = 5;

                if (Room.RespectNotificationsEnabled)
                {
                    Room.SendMessage(new RespectPetNotificationMessageComposer(TargetUser.GetClient().GetHabbo(), TargetUser));
                }
                Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID));
                return;
            }

            if (Pet == null || Pet.PetData == null || Pet.RoomId != Session.GetHabbo().CurrentRoomId)
            {
                return;
            }

            Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1;
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetRespectGiver", 1, false);

            ThisUser.CarryItemID = 999999999;
            ThisUser.CarryTimer  = 5;
            Pet.PetData.OnRespect();
            Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID));

            if (RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(Pet.PetData.OwnerId) != null && Session.GetHabbo().Id != Pet.PetData.OwnerId)
            {
                RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(Pet.PetData.OwnerId), "ACH_PetRespectReceiver", 1);
            }
        }
Example #20
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Oops, este artículo no se establece como una prenda de vestir vendible");
                return;
            }

            if (Item.Data.ClothingId == 0)
            {
                Session.SendNotification("Oops, este item no tiene la configuracion como una ropa, por favor, reportalo!");
                return;
            }

            ClothingItem Clothing = null;

            if (!RavenEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Vaya.. no se ha podido encontrar esta parte de la ropa!");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingAllParts));
            Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendWhisper("Si por alguna razon no ve su nueva ropa, recarga el client y vuelve a ingresar!");
        }
Example #21
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int       GroupId   = Packet.PopInt();
            int       UserId    = Packet.PopInt();
            Group     Group     = null;
            GroupRank GroupRank = null;

            if (GroupId < 1000)
            {
                Group     = GroupManager.GetJob(GroupId);
                GroupRank = GroupManager.GetJobRank(GroupId, 1);
            }
            else
            {
                Group     = GroupManager.GetGang(GroupId);
                GroupRank = GroupManager.GetGangRank(GroupId, 1);
            }

            if (Group == null)
            {
                return;
            }

            bool IsAdmin = false;

            if (Group.IsAdmin(Session.GetHabbo().Id))
            {
                IsAdmin = true;
            }
            if (GroupId < 1000 && Session.GetHabbo().GetPermissions().HasRight("corporation_rights"))
            {
                IsAdmin = true;
            }

            bool IsOwner = false;

            if (Group.CreatorId == Session.GetHabbo().Id)
            {
                IsOwner = true;
            }
            if (GroupId < 1000 && Session.GetHabbo().GetPermissions().HasRight("roleplay_corp_manager"))
            {
                IsOwner = true;
            }

            if (!IsAdmin && !IsOwner)
            {
                return;
            }

            if (!Group.HasRequest(UserId))
            {
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendNotification("Opa, ocorreu um erro ao encontrar este usuário.");
                return;
            }

            Group.HandleRequest(UserId, false);

            Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo != null)
            {
                if (Group.Id < 1000)
                {
                    Session.SendWhisper("Sucesso, você rejeitou " + Habbo.Username + " de entrar na sua empresa '" + Group.Name + "'!", 1);
                }
                else
                {
                    Session.SendWhisper("Sucesso, você rejeitou '" + Habbo.Username + "' de entrar na sua gangue '" + Group.Name + "'!", 1);
                }
            }
            else
            {
                using (UserCache Member = PlusEnvironment.GetGame().GetCacheManager().GenerateUser(UserId))
                {
                    if (Group.Id < 1000)
                    {
                        Session.SendWhisper("Sucesso, você rejeitou " + Member.Username + " de entrar na sua empresa '" + Group.Name + "'!", 1);
                    }
                    else
                    {
                        Session.SendWhisper("Sucesso, você rejeitou '" + Member.Username + "' de entrar na sua gangue '" + Group.Name + "'!", 1);
                    }
                }
            }

            Session.SendMessage(new GroupInfoComposer(Group, Session));
            Session.SendMessage(new UnknownGroupComposer(Group.Id, UserId));

            if (Group.Id < 1000 && Habbo.GetClient() != null && Habbo.GetClient().GetRoomUser() != null)
            {
                if (Habbo.CurrentRoom != null && Habbo.CurrentRoom.TutorialEnabled)
                {
                    Habbo.SendComposerToCorrectUsers(new UsersComposer(Habbo.GetClient().GetRoomUser()));
                }
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom || Session.GetHabbo().GetStats() == null || Session.GetHabbo().GetStats().DailyPetRespectPoints == 0)
            {
                return;
            }

            Room Room;

            if (!QuasarEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            RoomUser ThisUser = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (ThisUser == null)
            {
                return;
            }

            int PetId = Packet.PopInt();

            RoomUser Pet = null;

            if (!Session.GetHabbo().CurrentRoom.GetRoomUserManager().TryGetPet(PetId, out Pet))
            {
                //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?!
                RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId);
                if (TargetUser == null)
                {
                    return;
                }

                //Check some values first, please!
                if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null)
                {
                    return;
                }

                if (TargetUser.GetClient().GetHabbo().Id == Session.GetHabbo().Id)
                {
                    Session.SendWhisper("Oeps! Je kan dit niet op jezelf gebruiken - Je bent een punt kwijt maar geen probleem, relog en ze worden weer aangevuld.");
                    return;
                }

                //And boom! Let us send some respect points.
                QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_RESPECT);
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RespectGiven", 1);
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(TargetUser.GetClient(), "ACH_RespectEarned", 1);

                //Take away from pet respect points, just in-case users abuse this..
                Session.GetHabbo().GetStats().DailyPetRespectPoints  -= 1;
                Session.GetHabbo().GetStats().RespectGiven           += 1;
                TargetUser.GetClient().GetHabbo().GetStats().Respect += 1;

                //Apply the effect.
                ThisUser.CarryItemID = 999999999;
                ThisUser.CarryTimer  = 5;

                //Send the magic out.
                if (Room.RespectNotificationsEnabled)
                {
                    Room.SendMessage(new RespectPetNotificationMessageComposer(TargetUser.GetClient().GetHabbo(), TargetUser));
                }
                Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID));
                return;
            }

            if (Pet == null || Pet.PetData == null || Pet.RoomId != Session.GetHabbo().CurrentRoomId)
            {
                return;
            }

            Session.GetHabbo().GetStats().DailyPetRespectPoints -= 1;
            QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetRespectGiver", 1, false);

            ThisUser.CarryItemID = 999999999;
            ThisUser.CarryTimer  = 5;
            Pet.PetData.OnRespect();
            Room.SendMessage(new CarryObjectComposer(ThisUser.VirtualId, ThisUser.CarryItemID));
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Oops, this item isn't set as a sellable clothing item!");
                return;
            }

            if (Item.Data.BehaviourData == 0)
            {
                Session.SendNotification("Oops, this item doesn't have a linking clothing configuration, please report it!");
                return;
            }

            ClothingItem Clothing = null;

            if (!PlusEnvironment.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.BehaviourData, out Clothing))
            {
                Session.SendNotification("Oops, we couldn't find this clothing part!");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendPacket(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingParts));
            Session.SendPacket(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendWhisper("If for some reason cannot see your new clothing, reload the hotel!");
        }
Example #24
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban"))
            {
                return;
            }

            int    UserId     = Packet.PopInt();
            string Message    = Packet.PopString();
            double Length     = (Packet.PopInt() * 3600) + PlusEnvironment.GetUnixTimestamp();
            string Unknown1   = Packet.PopString();
            string Unknown2   = Packet.PopString();
            bool   IPBan      = Packet.PopBoolean();
            bool   MachineBan = Packet.PopBoolean();

            if (MachineBan)
            {
                IPBan = false;
            }

            Habbo Habbo = PlusEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Ocorreu um erro ao encontrar esse usuário no banco de dados.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Opa, você não pode banir esse usuário.");
                return;
            }

            Message = (Message != null ? Message : "Sem razão específica, mas provavelmente fez merda.");

            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (IPBan == false && MachineBan == false)
            {
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
            }
            else if (IPBan == true)
            {
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
            }
            else if (MachineBan == true)
            {
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
                PlusEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length);
            }

            GameClient TargetClient = PlusEnvironment.GetGame().GetClientManager().GetClientByUsername(Habbo.Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect(true);
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().GetPermissions().HasRight("mod_soft_ban"))
            {
                return;
            }

            int    UserId     = Packet.PopInt();
            string Message    = Packet.PopString();
            double Length     = (Packet.PopInt() * 3600) + QuasarEnvironment.GetUnixTimestamp();
            string Unknown1   = Packet.PopString();
            string Unknown2   = Packet.PopString();
            bool   IPBan      = Packet.PopBoolean();
            bool   MachineBan = Packet.PopBoolean();

            if (MachineBan)
            {
                IPBan = false;
            }

            Habbo Habbo = QuasarEnvironment.GetHabboById(UserId);

            if (Habbo == null)
            {
                Session.SendWhisper("Oeps! Deze gebruiker besaat niet.");
                return;
            }

            if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any"))
            {
                Session.SendWhisper("Oeps! Je kunt deze actie niet op deze gebruiker uitvoeren.");
                return;
            }

            Message = (Message != null ? Message : "geen reden (nodig).");

            string Username = Habbo.Username;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1");
            }

            if (IPBan == false && MachineBan == false)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
            }
            else if (IPBan == true)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
            }
            else if (MachineBan == true)
            {
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, Habbo.Username, Message, Length);
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Message, Length);
                QuasarEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.MACHINE, Habbo.Username, Message, Length);
            }

            GameClient TargetClient = QuasarEnvironment.GetGame().GetClientManager().GetClientByUsername(Habbo.Username);

            if (TargetClient != null)
            {
                TargetClient.Disconnect();
            }
        }
Example #26
0
        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;
            }

            if (!Room.GetRoomUserManager().TryGetBot(BotId, out RoomUser 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 = NeonEnvironment.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 = NeonEnvironment.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++)
                {
                    SpeechData[i] = Regex.Replace(SpeechData[i], "<(.|\\n)*?>", string.Empty);
                    using (IQueryAdapter dbClient = NeonEnvironment.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", NeonEnvironment.BoolToEnum(Convert.ToBoolean(MixChat)));
                        dbClient.RunQuery();
                    }
                }
                #endregion

                #region Handle Speech
                RoomBot.RandomSpeech.Clear();
                using (IQueryAdapter dbClient = NeonEnvironment.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 = NeonEnvironment.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("Vamos, ponle algun nombre al bot");
                    return;
                }
                else if (DataString.Length >= 16)
                {
                    Session.SendWhisper("Vamos.. necesitas un nombre mas corto!");
                    return;
                }

                if (DataString.Contains("<img src") || DataString.Contains("<font ") || DataString.Contains("</font>") || DataString.Contains("</a>") || DataString.Contains("<i>"))
                {
                    Session.SendWhisper("¿Qué intentas, crack?", 34);
                    return;
                }

                Bot.BotData.Name = DataString;
                using (IQueryAdapter dbClient = NeonEnvironment.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 Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetInventoryComponent() == null)
            {
                return;
            }

            Room Room;

            if (!RocketEmulador.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room))
            {
                return;
            }

            int PetId = Packet.PopInt();

            RoomUser Pet = null;

            if (!Room.GetRoomUserManager().TryGetPet(PetId, out Pet))
            {
                //Check kick rights, just because it seems most appropriate.
                if ((!Room.CheckRights(Session) && Room.WhoCanKick != 2 && Room.Group == null) || (Room.Group != null && !Room.CheckRights(Session, false, true)))
                {
                    return;
                }

                //Okay so, we've established we have no pets in this room by this virtual Id, let us check out users, maybe they're creeping as a pet?!
                RoomUser TargetUser = Session.GetHabbo().CurrentRoom.GetRoomUserManager().GetRoomUserByHabbo(PetId);
                if (TargetUser == null)
                {
                    return;
                }

                //Check some values first, please!
                if (TargetUser.GetClient() == null || TargetUser.GetClient().GetHabbo() == null)
                {
                    return;
                }

                //Update the targets PetId.
                TargetUser.GetClient().GetHabbo().PetId = 0;

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

                //Add the new one, they won't even notice a thing!!11 8-)
                Room.SendMessage(new UsersComposer(TargetUser));
                return;
            }

            if (Session.GetHabbo().Id != Pet.PetData.OwnerId && !Room.CheckRights(Session, true, false))
            {
                Session.SendWhisper("You can only pickup your own pets, to kick a pet you must have room rights.");
                return;
            }

            if (Pet.RidingHorse)
            {
                RoomUser UserRiding = Room.GetRoomUserManager().GetRoomUserByVirtualId(Pet.HorseID);
                if (UserRiding != null)
                {
                    UserRiding.RidingHorse = false;
                    UserRiding.ApplyEffect(-1);
                    UserRiding.MoveTo(new Point(UserRiding.X + 1, UserRiding.Y + 1));
                }
                else
                {
                    Pet.RidingHorse = false;
                }
            }

            Pet.PetData.RoomId       = 0;
            Pet.PetData.PlacedInRoom = false;

            Pet pet = Pet.PetData;

            if (pet != null)
            {
                using (IQueryAdapter dbClient = RocketEmulador.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.RunQuery("UPDATE `bots` SET `room_id` = '0', `x` = '0', `Y` = '0', `Z` = '0' WHERE `id` = '" + pet.PetId + "' LIMIT 1");
                    dbClient.RunQuery("UPDATE `bots_petdata` SET `experience` = '" + pet.experience + "', `energy` = '" + pet.Energy + "', `nutrition` = '" + pet.Nutrition + "', `respect` = '" + pet.Respect + "' WHERE `id` = '" + pet.PetId + "' LIMIT 1");
                }
            }

            if (pet.OwnerId != Session.GetHabbo().Id)
            {
                GameClient Target = RocketEmulador.GetGame().GetClientManager().GetClientByUserID(pet.OwnerId);
                if (Target != null)
                {
                    Target.GetHabbo().GetInventoryComponent().TryAddPet(Pet.PetData);
                    Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false);

                    Target.SendMessage(new PetInventoryComposer(Target.GetHabbo().GetInventoryComponent().GetPets()));
                    return;
                }
            }

            Room.GetRoomUserManager().RemoveBot(Pet.VirtualId, false);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            int userId = Packet.PopInt();

            if (userId == 0 || userId == Session.GetHabbo().Id)
            {
                return;
            }

            string message = Packet.PopString();

            if (string.IsNullOrWhiteSpace(message))
            {
                return;
            }
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendWhisper("Opa, você foi silenciado por 15 segundos, você não pode enviar mensagens durante este período.");
                return;
            }

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(message, out word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.GetHabbo().TimeMuted = 25;
                    Session.SendNotification("Você foi silênciado, aparentemente divulgo um hotel! aviso: " + Session.GetHabbo().BannedPhraseCount + "/3");
                    BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgadores!",
                                                                                                       "Atenção você mencionaou a palavra <b>" + word.ToUpper() + "</b><br><br><b>Frase:</b><br><i>" + message +
                                                                                                       "</i>.<br><br><b>Tipo</b><br>Spam em chat.\r\n" + "- Este usuario: <b>" +
                                                                                                       Session.GetHabbo().Username + "</b>", NotificationSettings.NOTIFICATION_FILTER_IMG, "", ""));
                }
                if (Session.GetHabbo().BannedPhraseCount >= 5)
                {
                    BiosEmuThiago.GetGame().GetModerationManager().BanUser("Protocolo", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Banido por fazer spam com frases (" + message + ")", (BiosEmuThiago.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                return;
            }

            if (Session.GetHabbo().Rank > 0)
            {
                DataRow presothiago = null;
                using (var dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                {
                    dbClient.SetQuery("SELECT Presidio FROM users WHERE id = '" + Session.GetHabbo().Id + "'");
                    presothiago = dbClient.getRow();
                }

                if (Convert.ToBoolean(presothiago["Presidio"]) == true)
                {
                    if (Session.GetHabbo().Rank > 0)
                    {
                        string thiago = Session.GetHabbo().Look;
                        Session.SendMessage(new RoomNotificationComposer("police_announcement", "message", "Você esta preso e não pode enviar mensagens."));
                        return;
                    }
                }
            }

            Session.GetHabbo().GetMessenger().SendInstantMessage(userId, message);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            int ItemId = Packet.PopInt();

            Item Item = Room.GetRoomItemHandler().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Item.Data == null)
            {
                return;
            }

            if (Item.UserID != Session.GetHabbo().Id)
            {
                return;
            }

            if (Item.Data.InteractionType != InteractionType.PURCHASABLE_CLOTHING)
            {
                Session.SendNotification("Ops, deu ruim ae em, chama um staff!");
                return;
            }

            if (Item.Data.BehaviourData == 0)
            {
                Session.SendNotification("Ops, este artigo não tem nenhuma configurações de roupa, por favor informe!");
                return;
            }

            ClothingItem Clothing = null;

            if (!CloudServer.GetGame().GetCatalog().GetClothingManager().TryGetClothing(Item.Data.ClothingId, out Clothing))
            {
                Session.SendNotification("Ops! essa parte da roupa não foi encontrada!");
                return;
            }

            //Quickly delete it from the database.
            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @ItemId LIMIT 1");
                dbClient.AddParameter("ItemId", Item.Id);
                dbClient.RunQuery();
            }

            //Remove the item.
            Room.GetRoomItemHandler().RemoveFurniture(Session, Item.Id);

            Session.GetHabbo().GetClothing().AddClothing(Clothing.ClothingName, Clothing.PartIds);
            Session.SendMessage(new FigureSetIdsComposer(Session.GetHabbo().GetClothing().GetClothingParts));
            Session.SendMessage(new RoomNotificationComposer("figureset.redeemed.success"));
            Session.SendWhisper("Por algum motivo você não pode ver as suas roupas novas, tente novamente!");
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            if (!NeonEnvironment.GetGame().GetRoomManager().TryGetRoom(Session.GetHabbo().CurrentRoomId, out Room Room))
            {
                return;
            }

            string RawData = Packet.PopString();

            string[] Data = RawData.Split(' ');
            if (!int.TryParse(Data[0], out int ItemId))
            {
                return;
            }

            bool HasRights = false;

            if (Room.CheckRights(Session, false, true))
            {
                HasRights = true;
            }

            if (!HasRights)
            {
                Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_not_owner}"));
                return;
            }

            Item Item = Session.GetHabbo().GetInventoryComponent().GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            if (Room.ForSale)
            {
                Session.SendWhisper("No se puede editar la Sala mientras está a la venta.");
                Session.SendWhisper("Cancela la Venta de la Sala expulsando a todos escribe ':unload' (sin las '')");
                return;
            }

            if (Room.GetRoomItemHandler().GetWallAndFloor.Count() > NeonStaticGameSettings.RoomFurnitureLimit)
            {
                Session.SendNotification("no se puede tener mas de " + NeonStaticGameSettings.RoomFurnitureLimit + " furnis en una sala!");
                return;
            }
            else if (Item.GetBaseItem().ItemName.ToLower().Contains("cf") && Room.OwnerId != Session.GetHabbo().Id&& !Session.GetHabbo().GetPermissions().HasRight("room_item_place_exchange_anywhere"))
            {
                Session.SendNotification("No se puede colocar monedas canjeables en esta sala!");
                return;
            }

            //TODO: Make neat.
            switch (Item.GetBaseItem().InteractionType)
            {
                #region Interaction Types
            case InteractionType.MOODLIGHT:
            {
                MoodlightData moodData = Room.MoodlightData;
                if (moodData != null && Room.GetRoomItemHandler().GetItem(moodData.ItemId) != null)
                {
                    Session.SendNotification("Solo puedes tener un (1) regulador por sala!");
                    return;
                }
                break;
            }

            case InteractionType.TONER:
            {
                TonerData tonerData = Room.TonerData;
                if (tonerData != null && Room.GetRoomItemHandler().GetItem(tonerData.ItemId) != null)
                {
                    Session.SendNotification("Solo puedes tener un (1) pinta fondo por sala!");
                    return;
                }
                break;
            }

            case InteractionType.HOPPER:
            {
                if (Room.GetRoomItemHandler().HopperCount > 0)
                {
                    Session.SendNotification("Solo puedes tener un (1) SaltaSalas en esta habitacion!");
                    return;
                }
                break;
            }

            case InteractionType.TENT:
            case InteractionType.TENT_SMALL:
            {
                Room.AddTent(Item.Id);
                break;
            }
                #endregion
            }

            if (!Item.IsWallItem)
            {
                if (Data.Length < 4)
                {
                    return;
                }

                if (!int.TryParse(Data[1], out int X))
                {
                    return;
                }
                if (!int.TryParse(Data[2], out int Y))
                {
                    return;
                }
                if (!int.TryParse(Data[3], out int Rotation))
                {
                    return;
                }

                Item RoomItem = new Item(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, X, Y, 0, Rotation, Session.GetHabbo().Id, Item.GroupId, Item.LimitedNo, Item.LimitedTot, string.Empty, Room);
                if (Room.GetRoomItemHandler().SetFloorItem(Session, RoomItem, X, Y, Rotation, true, false, true))
                {
                    Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);

                    if (Session.GetHabbo().Id == Room.OwnerId)
                    {
                        NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RoomDecoFurniCount", 1, false);
                    }

                    if (RoomItem.IsWired)
                    {
                        try { Room.GetWired().LoadWiredBox(RoomItem); }
                        catch { Console.WriteLine(Item.GetBaseItem().InteractionType); }
                    }
                }
                else
                {
                    Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_item}"));
                    return;
                }
            }
            else if (Item.IsWallItem)
            {
                string[] CorrectedData = new string[Data.Length - 1];

                for (int i = 1; i < Data.Length; i++)
                {
                    CorrectedData[i - 1] = Data[i];
                }

                if (TrySetWallItem(Session.GetHabbo(), Item, CorrectedData, out string WallPos))
                {
                    try
                    {
                        Item RoomItem = new Item(Item.Id, Room.RoomId, Item.BaseItem, Item.ExtraData, 0, 0, 0, 0, Session.GetHabbo().Id, Item.GroupId, Item.LimitedNo, Item.LimitedTot, WallPos, Room);

                        if (Room.GetRoomItemHandler().SetWallItem(Session, RoomItem))
                        {
                            Session.GetHabbo().GetInventoryComponent().RemoveItem(ItemId);
                            if (Session.GetHabbo().Id == Room.OwnerId)
                            {
                                NeonEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_RoomDecoFurniCount", 1, false);
                            }
                        }
                    }
                    catch
                    {
                        Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_item}"));
                        return;
                    }
                }
                else
                {
                    Session.SendMessage(new RoomNotificationComposer("furni_placement_error", "message", "${room.error.cant_set_item}"));
                    return;
                }
            }
        }