Exemple #1
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            string Query = StringCharFilter.Escape(Packet.PopString().Replace("%", ""));

            if (Query.Length < 1 || Query.Length > 100)
            {
                return;
            }

            List <SearchResult> Friends     = new List <SearchResult>();
            List <SearchResult> OthersUsers = new List <SearchResult>();

            List <SearchResult> Results = SearchResultFactory.GetSearchResult(Query);

            foreach (SearchResult Result in Results.ToList())
            {
                if (Session.GetHabbo().GetMessenger().FriendshipExists(Result.UserId))
                {
                    Friends.Add(Result);
                }
                else
                {
                    OthersUsers.Add(Result);
                }
            }

            Session.SendMessage(new HabboSearchResultComposer(Friends, OthersUsers));
        }
Exemple #2
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null || session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            string query = StringCharFilter.Escape(packet.PopString().Replace("%", ""));

            if (query.Length < 1 || query.Length > 100)
            {
                return;
            }

            List <SearchResult> friends     = new List <SearchResult>();
            List <SearchResult> othersUsers = new List <SearchResult>();

            List <SearchResult> results = SearchResultFactory.GetSearchResult(query);

            foreach (SearchResult result in results.ToList())
            {
                if (session.GetHabbo().GetMessenger().FriendshipExists(result.UserId))
                {
                    friends.Add(result);
                }
                else
                {
                    othersUsers.Add(result);
                }
            }

            session.SendPacket(new HabboSearchResultComposer(friends, othersUsers));
        }
Exemple #3
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session.GetHabbo().TimeMuted > 0)
            {
                session.SendNotification("Oops, you're currently muted - you cannot send room invitations.");
                return;
            }

            var amount = packet.PopInt();

            if (amount > 500)
            {
                return; // don't send at all
            }

            var targets = new List <int>();

            for (var i = 0; i < amount; i++)
            {
                var uid = packet.PopInt();
                if (i < 100) // limit to 100 people, keep looping until we fulfil the request though
                {
                    targets.Add(uid);
                }
            }

            var message = StringCharFilter.Escape(packet.PopString());

            if (message.Length > 121)
            {
                message = message.Substring(0, 121);
            }

            foreach (var userId in targets)
            {
                if (!session.GetHabbo().GetMessenger().FriendshipExists(userId))
                {
                    continue;
                }

                var client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(userId);
                if (client?.GetHabbo() == null || client.GetHabbo().AllowMessengerInvites || client.GetHabbo().AllowConsoleMessages == false)
                {
                    continue;
                }

                client.SendPacket(new RoomInviteComposer(session.GetHabbo().Id, message));
            }

            using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `chatlogs_console_invitations` (`user_id`,`message`,`timestamp`) VALUES (@userId, @message, UNIX_TIMESTAMP())");
                dbClient.AddParameter("userId", session.GetHabbo().Id);
                dbClient.AddParameter("message", message);
                dbClient.RunQuery();
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendNotification("Oops, you're currently muted - you cannot send room invitations.");
                return;
            }

            int Amount = Packet.PopInt();

            if (Amount > 500)
            {
                return; // don't send at all
            }
            List <int> Targets = new List <int>();

            for (int i = 0; i < Amount; i++)
            {
                int uid = Packet.PopInt();
                if (i < 100) // limit to 100 people, keep looping until we fulfil the request though
                {
                    Targets.Add(uid);
                }
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 121)
            {
                Message = Message.Substring(0, 121);
            }

            foreach (int UserId in Targets)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(UserId))
                {
                    continue;
                }

                GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().AllowMessengerInvites == true || Client.GetHabbo().AllowConsoleMessages == false)
                {
                    continue;
                }

                Client.SendPacket(new RoomInviteComposer(Session.GetHabbo().Id, Message));
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `chatlogs_console_invitations` (`user_id`,`message`,`timestamp`) VALUES (@userId, @message, UNIX_TIMESTAMP())");
                dbClient.AddParameter("userId", Session.GetHabbo().Id);
                dbClient.AddParameter("message", Message);
                dbClient.RunQuery();
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (NeonEnvironment.GetGame().GetModerationManager().UserHasTickets(Session.GetHabbo().Id))
            {
                ModerationTicket PendingTicket = NeonEnvironment.GetGame().GetModerationManager().GetTicketBySenderId(Session.GetHabbo().Id);
                if (PendingTicket != null)
                {
                    Session.SendMessage(new CallForHelpPendingCallsComposer(PendingTicket));
                    return;
                }
            }

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

            string Message        = StringCharFilter.Escape(Packet.PopString().Trim());
            int    Category       = Packet.PopInt();
            int    ReportedUserId = Packet.PopInt();
            int    Type           = Packet.PopInt();

            Habbo ReportedUser = NeonEnvironment.GetHabboById(ReportedUserId);

            if (ReportedUser == null)
            {
                return;
            }

            int Messagecount = Packet.PopInt();

            for (int i = 0; i < Messagecount; i++)
            {
                Packet.PopInt();
                Chats.Add(Packet.PopString());
            }

            ModerationTicket Ticket = new ModerationTicket(1, Type, Category, UnixTimestamp.GetNow(), 1, Session.GetHabbo(), ReportedUser, Message, Session.GetHabbo().CurrentRoom, Chats);

            if (!NeonEnvironment.GetGame().GetModerationManager().TryAddTicket(Ticket))
            {
                return;
            }

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.RunQuery("UPDATE `user_info` SET `cfhs` = `cfhs` + '1' WHERE `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            NeonEnvironment.GetGame().GetClientManager().ModAlert("A new support ticket has been submitted!");
            NeonEnvironment.GetGame().GetClientManager().SendMessage(new ModeratorSupportTicketComposer(Session.GetHabbo().Id, Ticket), "mod_tool");
        }
Exemple #6
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            string newMotto = StringCharFilter.Escape(Packet.PopString());

            if (newMotto == Session.GetHabbo().Motto)
            {
                return;
            }
            if (newMotto.Length > 38)
            {
                newMotto = newMotto.Substring(0, 38);
            }

            if (Session.Antipub(newMotto, "<MOTTO>"))
            {
                return;
            }

            if (!Session.GetHabbo().HasFuse("word_filter_override"))
            {
                newMotto = ButterflyEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(newMotto);
            }

            Session.GetHabbo().Motto = newMotto;
            using (IQueryAdapter queryreactor = ButterflyEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                queryreactor.SetQuery("UPDATE users SET motto = @motto WHERE id = '" + Session.GetHabbo().Id + "'");
                queryreactor.AddParameter("motto", newMotto);
                queryreactor.RunQuery();
            }
            ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_MOTTO, 0);
            if (Session.GetHabbo().InRoom)
            {
                Room currentRoom = Session.GetHabbo().CurrentRoom;
                if (currentRoom == null)
                {
                    return;
                }
                RoomUser roomUserByHabbo = currentRoom.GetRoomUserManager().GetRoomUserByHabboId(Session.GetHabbo().Id);
                if (roomUserByHabbo == null)
                {
                    return;
                }

                if (roomUserByHabbo.transformation || roomUserByHabbo.IsSpectator)
                {
                    return;
                }

                currentRoom.SendPacket(new UserChangeComposer(roomUserByHabbo, false));
            }
            ButterflyEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Motto", 1);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (ButterflyEnvironment.GetGame().GetModerationTool().UsersHasPendingTicket(Session.GetHabbo().Id))
            {
                return;
            }
            string Message      = StringCharFilter.Escape(Packet.PopString());
            int    TicketType   = Packet.PopInt();
            int    ReporterId   = Packet.PopInt();
            int    RoomId       = Packet.PopInt();
            int    RepporteurId = Packet.PopInt();

            ButterflyEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, TicketType, ReporterId, Message);
            ButterflyEnvironment.GetGame().GetModerationTool().ApplySanction(Session, ReporterId);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().GetMessenger() == null)
            {
                return;
            }

            string SearchPseudo = StringCharFilter.Escape(Packet.PopString());

            if (SearchPseudo.Length < 1 || SearchPseudo.Length > 100)
            {
                return;
            }
            Session.SendPacket(Session.GetHabbo().GetMessenger().PerformSearch(SearchPseudo));
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            if (Session.GetHabbo().Rank > 8 && !Session.GetHabbo().StaffOk)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            if (Message.Contains("&#1º;") || Message.Contains("&#1º") || Message.Contains("&#"))
            {
                Session.SendMessage(new MassEventComposer("habbopages/spammer.txt")); return;
            }

            if (!NeonEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out ChatStyle Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.UnIdle();

            if (NeonEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Room.CheckRights(Session, false) && Room.muteSignalEnabled == true)
            {
                Session.SendWhisper("La sala está silenciada, no puedes hablar en ella hasta tanto el dueño o alguien con permisos en ella lo permita.", 34);
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oops, usted se encuentra silenciad@", 34);
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSays, Session.GetHabbo(), Message))
            {
                return;
            }
            else if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSaysCommand, Session.GetHabbo(), Message.ToLower()))
            {
                return;
            }
            else if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                if (User.IncrementAndCheckFlood(out int MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            Room.GetFilter().CheckMessage(Message);

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && NeonEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            if (Session.GetHabbo().LastMessage == Message)
            {
                Session.GetHabbo().LastMessageCount++;
                if (Session.GetHabbo().LastMessageCount > 3)
                {
                    NeonEnvironment.GetGame().GetClientManager().RepeatAlert(new RoomInviteComposer(int.MinValue, "Repeat: " + Session.GetHabbo().Username + " / Frase: " + Message + " / Veces: " + Session.GetHabbo().LastMessageCount + "."));
                    Session.GetHabbo().LastMessageCount = 0;
                }
            }

            NeonEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                NeonEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out string word))
            {
                Session.GetHabbo().BannedPhraseCount++;

                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.SendWhisper("¡Has mencionado una palabra no apta para el hotel! Aviso " + Session.GetHabbo().BannedPhraseCount + "/10", 34);

                    DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
                    dtDateTime = dtDateTime.AddSeconds(NeonEnvironment.GetUnixTimestamp()).ToLocalTime();

                    NeonEnvironment.GetGame().GetClientManager().StaffAlert1(new RoomInviteComposer(int.MinValue, "Spammer: " + Session.GetHabbo().Username + " / Frase: " + Message + " / Palabra: " + word.ToUpper() + " / Fase: " + Session.GetHabbo().BannedPhraseCount + " / 10."));
                    NeonEnvironment.GetGame().GetClientManager().StaffAlert2(new RoomNotificationComposer("Alerta de publicista:",
                                                                                                          "<b><font color=\"#B40404\">Por favor, recuerda investigar bien antes de recurrir a una sanción.</font></b><br><br>Palabra: <b>" + word.ToUpper() + "</b>.<br><br><b>Frase:</b><br><i>" + Message +
                                                                                                          "</i>.<br><br><b>Tipo:</b><br>Chat de sala.\r\n" + "<b>Usuario: " + Session.GetHabbo().Username + "</b><br><b>Secuencia:</b> " + Session.GetHabbo().BannedPhraseCount + "/10.", "foto", "Investigar", "event:navigator/goto/" +
                                                                                                          Session.GetHabbo().CurrentRoomId));

                    if (Session.GetHabbo().BannedPhraseCount >= 10)
                    {
                        NeonEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("commandsupdated", "El usuario " + Session.GetHabbo().Username + " ha sido baneado de manera automática por el sistema.", ""));

                        NeonEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer Spam con la Frase (" + word + ")", (NeonEnvironment.GetUnixTimestamp() + 78892200));
                        Session.Disconnect();
                        return;
                    }
                    return;
                }

                Session.SendMessage(new ChatComposer(User.VirtualId, "Mensaje inapropiado.", 0, Colour));
                return;
            }

            if (Session.GetHabbo().MultiWhisper)
            {
                Session.SendMessage(new WhisperComposer(User.VirtualId, "@blue@ [MULTI] " + Message, 0, User.LastBubble));
                List <RoomUser> MultiW = Session.GetHabbo().MultiWhispers;
                if (MultiW.Count > 0)
                {
                    foreach (RoomUser user in MultiW)
                    {
                        if (user != null)
                        {
                            if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers)
                            {
                                user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "@blue@ [MULTI] " + Message, 0, User.LastBubble));
                            }
                        }
                    }
                }
                return;
            }

            //if (Session.GetHabbo().IsBeingAsked == true && Message.ToLower().Contains("s"))
            //{
            //    Session.GetHabbo().SecureTradeEnabled = true;
            //    Session.GetHabbo().IsBeingAsked = false;
            //    Session.SendMessage(new WiredSmartAlertComposer("Acabas de activar el modo seguro de tradeo para dados."));
            //}
            //else if (Session.GetHabbo().IsBeingAsked == true && !Message.ToLower().Contains("s"))
            //{
            //    Session.GetHabbo().SecureTradeEnabled = false;
            //    Session.GetHabbo().IsBeingAsked = false;
            //    Session.SendMessage(new WiredSmartAlertComposer("Has dejado el tradeo en modo normal."));
            //}

            Session.GetHabbo().LastMessage = Message;

            NeonEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
            User.OnChat(User.LastBubble, Message, false);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int    PageId      = Packet.PopInt();
            int    ItemId      = Packet.PopInt();
            string Data        = Packet.PopString();
            string GiftUser    = StringCharFilter.Escape(Packet.PopString());
            string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' '));
            int    SpriteId    = Packet.PopInt();
            int    Ribbon      = Packet.PopInt();
            int    Colour      = Packet.PopInt();
            bool   dnow        = Packet.PopBoolean();

            if (QuasarEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1")
            {
                Session.SendNotification("Het sturen van cadeau's is tijdelijk uitgeschakeld door het Hotel Management.");
                return;
            }

            /*if (QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0)
             * {
             *  PageId = QuasarEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId];
             *
             *  CatalogPage P = null;
             *  if (!QuasarEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P))
             *      PageId = 0;
             * }*/

            CatalogPage Page = null;

            if (!QuasarEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page))
            {
                return;
            }

            if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank)  /*|| (Page.MinimumVIP > Session.GetHabbo().VIPRank && Session.GetHabbo().Rank == 1))*/
            {
                return;
            }

            CatalogItem Item = null;

            if (!Page.Items.TryGetValue(ItemId, out Item))
            {
                if (Page.ItemOffers.ContainsKey(ItemId))
                {
                    Item = (CatalogItem)Page.ItemOffers[ItemId];
                    if (Item == null)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (!ItemUtility.CanGiftItem(Item))
            {
                return;
            }

            ItemData PresentData = null;

            if (!QuasarEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT)
            {
                return;
            }

            if (Session.GetHabbo().Credits < Item.CostCredits)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false));
                return;
            }

            if (Session.GetHabbo().Duckets < Item.CostPixels)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true));
                return;
            }

            Habbo Habbo = QuasarEnvironment.GetHabboByUsername(GiftUser);

            if (Habbo == null)
            {
                Session.SendMessage(new GiftWrappingErrorComposer());
                return;
            }

            if (!Habbo.AllowGifts)
            {
                Session.SendNotification("Oeps! Je kan geen cadeau's sturen naar deze Habbis.");
                return;
            }

            if (Session.GetHabbo().Rank < 4)
            {
                if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 10.0)
                {
                    Session.SendNotification("Oeps! Wacht minstens 10 seconden tussen het kopen van cadeau's.");
                    return;
                }
            }


            if (Session.GetHabbo().SessionGiftBlocked)
            {
                return;
            }


            string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour;

            int NewItemId = 0;

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", ED);
                NewItemId = Convert.ToInt32(dbClient.InsertQuery());

                string ItemExtraData = null;
                switch (Item.Data.InteractionType)
                {
                case InteractionType.NONE:
                    ItemExtraData = "";
                    break;


                    #region Pet handling

                case InteractionType.pet0:      // Hond
                case InteractionType.pet1:      // Kat
                case InteractionType.pet2:      // Krokodillen
                case InteractionType.pet3:      // Terriers
                case InteractionType.pet4:      // Beren
                case InteractionType.pet5:      // Varkens
                case InteractionType.pet6:      // Leeuwen
                case InteractionType.pet7:      // Neushoorns
                case InteractionType.pet8:      // Spinnen
                case InteractionType.pet9:      // Schildpadden
                case InteractionType.pet10:     // Kuikens
                case InteractionType.pet11:     // Kikkers
                case InteractionType.pet12:     // Draken
                case InteractionType.pet13:     // Slenderman
                case InteractionType.pet14:     // Apen
                case InteractionType.pet15:     // Paarden
                case InteractionType.pet16:     // Monsterplanten
                case InteractionType.pet17:     // Konijnen
                case InteractionType.pet18:     // Evil Konijnen
                case InteractionType.pet19:     // Depressieve Konijnen
                case InteractionType.pet20:     // Liefdes Konijnen
                case InteractionType.pet21:     // Witte Duiven
                case InteractionType.pet22:     // Zwarte Duiven
                case InteractionType.pet23:     // Rode Aap
                case InteractionType.pet24:     // Baby Beertjes
                case InteractionType.pet25:     // Baby Terriers
                case InteractionType.pet26:     // Kabouters
                case InteractionType.pet27:     // Baby's
                case InteractionType.pet28:     // Baby Beertjes
                case InteractionType.pet29:     // Baby Terriers
                case InteractionType.pet30:     // Kabouters
                case InteractionType.pet31:     // Oempa Loempa's
                case InteractionType.pet32:     // Stenen
                case InteractionType.pet33:     // Pterodactylussen
                case InteractionType.pet34:     // Velociraptors
                case InteractionType.pet35:     // Wolven
                case InteractionType.pet36:     // Monster Konijnen
                case InteractionType.pet37:     // Pickachu
                case InteractionType.pet38:     // Pinguins
                case InteractionType.pet39:     // Mario
                case InteractionType.pet40:     // Olifanten
                case InteractionType.pet41:     // Alien Konijnen
                case InteractionType.pet42:     // Gouden Konijnen
                case InteractionType.pet43:     // Roze Mewtwo
                case InteractionType.pet44:     // Entei
                case InteractionType.pet45:     // Blauwe Mewtwo
                case InteractionType.pet46:     // Cavia
                case InteractionType.pet47:     // Uil
                case InteractionType.pet48:     // Goude Mewtwo
                case InteractionType.pet49:     // Eend
                case InteractionType.pet50:     // Baby Bruin
                case InteractionType.pet51:     // Baby Wit
                case InteractionType.pet52:     // Dino
                case InteractionType.pet53:     // Yoshi
                case InteractionType.pet54:     // Koe
                case InteractionType.pet55:     // Pokémon: Gengar
                case InteractionType.pet56:     // Pokémon: Gengar
                case InteractionType.pet57:     // Pokémon: Gengar
                case InteractionType.pet58:     // Pokémon: Gengar
                case InteractionType.pet59:     // Pokémon: Gengar
                case InteractionType.pet60:     // Pokémon: Gengar
                case InteractionType.pet61:     // Pokémon: Gengar
                case InteractionType.pet62:     // Pokémon: Gengar
                case InteractionType.pet63:     // Pokémon: Gengar
                case InteractionType.pet64:     // Pokémon: Gengar
                case InteractionType.pet65:     // Pokémon: Gengar
                case InteractionType.pet66:     // Pokémon: Gengar
                case InteractionType.pet67:     // Pokémon: Gengar
                case InteractionType.pet68:     // Pokémon: Gengar
                case InteractionType.pet69:     // Pokémon: Gengar
                case InteractionType.pet70:     // Pokémon: Gengar
                    try
                    {
                        string[] Bits    = Data.Split('\n');
                        string   PetName = Bits[0];
                        string   Race    = Bits[1];
                        string   Color   = Bits[2];

                        int.Parse(Race);     // to trigger any possible errors

                        if (PetUtility.CheckPetName(PetName))
                        {
                            return;
                        }

                        if (Race.Length > 2)
                        {
                            return;
                        }

                        if (Color.Length != 6)
                        {
                            return;
                        }

                        QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1);
                    }
                    catch
                    {
                        return;
                    }

                    break;

                    #endregion

                case InteractionType.FLOOR:
                case InteractionType.WALLPAPER:
                case InteractionType.LANDSCAPE:

                    Double Number = 0;
                    try
                    {
                        if (string.IsNullOrEmpty(Data))
                        {
                            Number = 0;
                        }
                        else
                        {
                            Number = Double.Parse(Data, QuasarEnvironment.CultureInfo);
                        }
                    }
                    catch
                    {
                    }

                    ItemExtraData = Number.ToString().Replace(',', '.');
                    break;     // maintain extra data // todo: validate

                case InteractionType.POSTIT:
                    ItemExtraData = "FFFF33";
                    break;

                case InteractionType.MOODLIGHT:
                    ItemExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.TROPHY:
                    ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data;
                    break;

                case InteractionType.MANNEQUIN:
                    ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Maniqui";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data))
                    {
                        Session.SendMessage(new BroadcastMessageAlertComposer("Oeps! Je kan deze badge niet in een vitrine zetteno omdat je deze badge niet in je bezit hebt."));
                        return;
                    }

                    ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                    break;

                default:
                    ItemExtraData = Data;
                    break;
                }

                //Insert the present, forever.
                dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData));
                dbClient.RunQuery();

                //Here we're clearing up a record, this is dumb, but okay.
                dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;");
            }


            Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0);
            if (GiveItem != null)
            {
                GameClient Receiver = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id);
                if (Receiver != null)
                {
                    if (Receiver.GetHabbo().Rank <= 5)
                    {
                        Session.SendMessage(new RoomCustomizedAlertComposer("Je hebt een cadeau ontvangen van " + Session.GetHabbo().Username + "."));
                    }
                    {
                        Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);
                        Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1));
                        Receiver.SendMessage(new PurchaseOKComposer());
                        Receiver.SendMessage(new FurniListAddComposer(GiveItem));
                        Receiver.SendMessage(new FurniListUpdateComposer());
                    }
                }
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1);
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1);
                QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS);
                Session.SendMessage(new RoomCustomizedAlertComposer("Je cadeau is ingepakt en verzonden!"));
            }

            Session.SendMessage(new PurchaseOKComposer(Item, PresentData));

            if (Item.CostCredits > 0)
            {
                Session.GetHabbo().Credits -= Item.CostCredits;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            if (Item.CostPixels > 0)
            {
                Session.GetHabbo().Duckets -= Item.CostPixels;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            }

            Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
        }
Exemple #11
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null)
            {
                return;
            }

            // Run a quick check to see if we have any existing tickets.
            if (PlusEnvironment.GetGame().GetModerationManager().UserHasTickets(session.GetHabbo().Id))
            {
                ModerationTicket pendingTicket = PlusEnvironment.GetGame().GetModerationManager().GetTicketBySenderId(session.GetHabbo().Id);
                if (pendingTicket != null)
                {
                    session.SendPacket(new CallForHelpPendingCallsComposer(pendingTicket));
                    return;
                }
            }

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

            string message        = StringCharFilter.Escape(packet.PopString().Trim());
            int    category       = packet.PopInt();
            int    reportedUserId = packet.PopInt();
            int    type           = packet.PopInt();// Unsure on what this actually is.

            Habbo reportedUser = PlusEnvironment.GetHabboById(reportedUserId);

            if (reportedUser == null)
            {
                // User doesn't exist.
                return;
            }

            int messagecount = packet.PopInt();

            for (int i = 0; i < messagecount; i++)
            {
                packet.PopInt();
                chats.Add(packet.PopString());
            }

            ModerationTicket ticket = new ModerationTicket(1, type, category, UnixTimestamp.GetNow(), 1, session.GetHabbo(), reportedUser, message, session.GetHabbo().CurrentRoom, chats);

            if (!PlusEnvironment.GetGame().GetModerationManager().TryAddTicket(ticket))
            {
                return;
            }

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                // TODO: Come back to this.

                /*dbClient.SetQuery("INSERT INTO `moderation_tickets` (`score`,`type`,`status`,`sender_id`,`reported_id`,`moderator_id`,`message`,`room_id`,`room_name`,`timestamp`) VALUES (1, '" + Category + "', 'open', '" + Session.GetHabbo().Id + "', '" + ReportedUserId + "', '0', @message, '0', '', '" + PlusEnvironment.GetUnixTimestamp() + "')");
                 * dbClient.AddParameter("message", Message);
                 * dbClient.RunQuery();*/

                dbClient.RunQuery("UPDATE `user_info` SET `cfhs` = `cfhs` + '1' WHERE `user_id` = '" + session.GetHabbo().Id + "' LIMIT 1");
            }

            PlusEnvironment.GetGame().GetClientManager().ModAlert("A new support ticket has been submitted!");
            PlusEnvironment.GetGame().GetClientManager().SendPacket(new ModeratorSupportTicketComposer(session.GetHabbo().Id, ticket), "mod_tool");
        }
Exemple #12
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!QuasarEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.UnIdle();

            if (QuasarEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendMessage(new RoomCustomizedAlertComposer("Deze kamer heeft een spraakverbod."));
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (Room.GetWired().TriggerEvent(HabboHotel.Items.Wired.WiredBoxType.TriggerUserSays, Session.GetHabbo(), Message))
            {
                return;
            }
            else if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }


            if (Message.StartsWith(":", StringComparison.CurrentCulture))
            {
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ExploreCommand", 1);
            }



            if (Message.StartsWith(":", StringComparison.CurrentCulture) && QuasarEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            QuasarEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));
            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word))
            {
                Session.SendMessage(new RoomCustomizedAlertComposer("Het woord '" + word + "' is verboden."));
                QuasarEnvironment.GetGame().GetClientManager().StaffAlert(RoomNotificationComposer.SendBubble("bubble_filter", "Filter bericht\n\nHabbis: " + Session.GetHabbo().Username + "\nWoord: " + word + "\nType: Chat (kamer)", ""));
                return;
            }
            QuasarEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.OnChat(User.LastBubble, Message, false);

            if (Message.Length > 20)
            {
                QuasarEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_ChatSpeeches", 1);
            }
        }
Exemple #13
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabboId(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            if (Room.RpRoom)
            {
                RolePlayer Rp = User.Roleplayer;
                if (Rp != null && Rp.Dead)
                {
                    return;
                }
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!ButterflyEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().HasFuse(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.Unidle();

            if (Session.GetHabbo().Rank < 5U && Room.RoomMuted && !User.IsOwner() && !Session.GetHabbo().CurrentRoom.CheckRights(Session))
            {
                User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("room.muted", Session.Langue));
                return;
            }

            if (Room.GetJanken().PlayerStarted(User))
            {
                if (!Room.GetJanken().PickChoix(User, Message))
                {
                    User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("janken.choice", Session.Langue));
                }

                return;
            }
            if (Room.UserIsMuted(Session.GetHabbo().Id))
            {
                if (!Room.HasMuteExpired(Session.GetHabbo().Id))
                {
                    User.GetClient().SendNotification(ButterflyEnvironment.GetLanguageManager().TryGetValue("user.muted", Session.Langue));
                    return;
                }
                else
                {
                    Room.RemoveMute(Session.GetHabbo().Id);
                }
            }

            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().spamFloodTime;

            if (timeSpan.TotalSeconds > (double)Session.GetHabbo().spamProtectionTime&& Session.GetHabbo().spamEnable)
            {
                User.FloodCount = 0;
                Session.GetHabbo().spamEnable = false;
            }
            else if (timeSpan.TotalSeconds > 4.0)
            {
                User.FloodCount = 0;
            }

            if (timeSpan.TotalSeconds < (double)Session.GetHabbo().spamProtectionTime&& Session.GetHabbo().spamEnable)
            {
                int i = Session.GetHabbo().spamProtectionTime - timeSpan.Seconds;
                User.GetClient().SendPacket(new FloodControlComposer(i));
                return;
            }
            else if (timeSpan.TotalSeconds < 4.0 && User.FloodCount > 5 && !Session.GetHabbo().HasFuse("fuse_mod"))
            {
                Session.GetHabbo().spamProtectionTime = (Room.RpRoom) ? 5 : 30;
                Session.GetHabbo().spamEnable         = true;

                User.GetClient().SendPacket(new FloodControlComposer(Session.GetHabbo().spamProtectionTime - timeSpan.Seconds));

                return;
            }
            else if (Message.Length > 40 && Message == User.LastMessage && User.LastMessageCount == 1)
            {
                User.LastMessageCount = 0;
                User.LastMessage      = "";

                Session.GetHabbo().spamProtectionTime = (Room.RpRoom) ? 5 : 30;
                Session.GetHabbo().spamEnable         = true;
                User.GetClient().SendPacket(new FloodControlComposer(Session.GetHabbo().spamProtectionTime - timeSpan.Seconds));
                return;
            }
            else
            {
                if (Message == User.LastMessage && Message.Length > 40)
                {
                    User.LastMessageCount++;
                }

                User.LastMessage = Message;

                Session.GetHabbo().spamFloodTime = DateTime.Now;
                User.FloodCount++;

                if (Session != null)
                {
                    if (Message.StartsWith("@red@") || Message.StartsWith("@rouge@"))
                    {
                        User.ChatTextColor = "@red@";
                    }
                    if (Message.StartsWith("@cyan@"))
                    {
                        User.ChatTextColor = "@cyan@";
                    }
                    if (Message.StartsWith("@blue@") || Message.StartsWith("@bleu@"))
                    {
                        User.ChatTextColor = "@blue@";
                    }
                    if (Message.StartsWith("@green@") || Message.StartsWith("@vert@"))
                    {
                        User.ChatTextColor = "@green@";
                    }
                    if (Message.StartsWith("@purple@") || Message.StartsWith("@violet@"))
                    {
                        User.ChatTextColor = "@purple@";
                    }
                    if (Message.StartsWith("@black@") || Message.StartsWith("@noir@"))
                    {
                        User.ChatTextColor = "";
                    }
                }

                if (Message.StartsWith(":", StringComparison.CurrentCulture) && ButterflyEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, User, Room, Message))
                {
                    Room.GetChatMessageManager().AddMessage(Session.GetHabbo().Id, Session.GetHabbo().Username, Room.Id, string.Format("{0} a utiliser la commande {1}", Session.GetHabbo().Username, Message));
                    return;
                }

                if (Session != null && !User.IsBot)
                {
                    if (Session.Antipub(Message, "<TCHAT>", Room.Id))
                    {
                        return;
                    }

                    ButterflyEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT, 0);
                    Session.GetHabbo().GetChatMessageManager().AddMessage(Session.GetHabbo().Id, Session.GetHabbo().Username, Room.Id, Message);
                    Room.GetChatMessageManager().AddMessage(Session.GetHabbo().Id, Session.GetHabbo().Username, Room.Id, Message);

                    if (User.transfbot)
                    {
                        Colour = 2;
                    }
                }
            }

            if (!Session.GetHabbo().HasFuse("word_filter_override"))
            {
                Message = ButterflyEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }

            if (Room.AllowsShous(User, Message))
            {
                User.SendWhisperChat(Message, false);
                return;
            }
            Room.OnUserSay(User, Message, false);

            if (User.IsSpectator)
            {
                return;
            }

            if (!string.IsNullOrEmpty(User.ChatTextColor))
            {
                Message = User.ChatTextColor + " " + Message;
            }

            User.OnChat(Message, Colour, false);
        }
Exemple #14
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!RocketEmulador.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.UnIdle();

            if (RocketEmulador.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }
            if (RocketEmulador.GetGame().GetChatManager().GetFilter().IsFiltered(Message))
            {
                RocketEmulador.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgação !",
                                                                                                    "O Usuário: <b>" + Session.GetHabbo().Username + "<br>" +

                                                                                                    "<br></b> Está divulgando uma palavra que foi bloqueada" + "<br>" +

                                                                                                    "<br><b>A palavra usada foi:</b><br>" +
                                                                                                    "<br>" + "<b>" + "<font color =\"#FF0000\">" + Message + "</font>" + "</b><br>" +
                                                                                                    "<br>Para ir a la sala, clique em \"Ir a Sala \"</b>",
                                                                                                    "filter", "Ir a Sala", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
                Session.GetHabbo().GetClient().SendMessage(new WhisperComposer(User.VirtualId, "A seguinte palavra foi bloqueada em nosso hotel:" + " " + Message, 0, 34));
                Message = null;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Opa, você atualmente está silenciado.", 34);
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && RocketEmulador.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            RocketEmulador.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (RocketEmulador.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
            {
                Session.GetHabbo().BannedPhraseCount++;

                if (Session.GetHabbo().BannedPhraseCount >= RocketGame.BannedPhrasesAmount)
                {
                    RocketEmulador.GetGame().GetModerationManager().BanUser("RocketEmulador", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (RocketEmulador.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }

                Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = RocketEmulador.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }


            RocketEmulador.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.OnChat(User.LastBubble, Message, false);
        }
Exemple #15
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!BiosEmuThiago.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (BiosEmuThiago.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Room.CheckRights(Session, false) && Room.muteSignalEnabled == true)
            {
                Session.SendWhisper("O quarto esta silenciado, você não pode falar sobre isso até que o proprietário ou alguém com permissões permita.");
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Bem, agora você está silenciado.");
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            BiosEmuThiago.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && BiosEmuThiago.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            BiosEmuThiago.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            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)
                {
                    User.MoveTo(Room.GetGameMap().Model.DoorX, Room.GetGameMap().Model.DoorY);
                    Session.GetHabbo().TimeMuted = 25;
                    Session.SendNotification("Você foi silenciad@ um moderador vai ver seu caso, aparentemente, você nomeou um hotel! <b>Aviso: " + Session.GetHabbo().BannedPhraseCount + "/5</b>");
                    BiosEmuThiago.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgador:",
                                                                                                       "Atenção mencionou a palavra <b>" + word.ToUpper() + "</b> na frase <i>" + Message +
                                                                                                       "</i> dentro de uma sala\r\n" + "- Este usuario: <b>" +
                                                                                                       Session.GetHabbo().Username + "</b>", NotificationSettings.NOTIFICATION_FILTER_IMG, "Ir a Sala", "event:navigator/goto/" +
                                                                                                       Session.GetHabbo().CurrentRoomId));
                }
                if (Session.GetHabbo().BannedPhraseCount >= 5)
                {
                    BiosEmuThiago.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Banido por spam (" + Message + ")", (BiosEmuThiago.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                Session.SendMessage(new ShoutComposer(User.VirtualId, "Palavra Inapropriada", 0, Colour));
                return;
            }
            BiosEmuThiago.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.UnIdle();
            User.OnChat(User.LastBubble, Message, true);
        }
Exemple #16
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            if (!CloudServer.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out ChatStyle Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.UnIdle();

            if (CloudServer.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Ops, você está mutado!");
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                if (User.IncrementAndCheckFlood(out int MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && CloudServer.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            CloudServer.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out string word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    User.MoveTo(Room.GetGameMap().Model.DoorX, Room.GetGameMap().Model.DoorY);
                    Session.GetHabbo().TimeMuted = 25;
                    Session.SendNotification("Você está mutado, peça a um moderador para rever seu caso! <b>Aviso: " + Session.GetHabbo().BannedPhraseCount + "/5</b>");
                    CloudServer.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgação:",
                                                                                                     "Atenção você mencionou a palavra <b>" + word.ToUpper() + "</b> na frase <i>" + Message +
                                                                                                     "</i> dentro de um quarto\r\n" + "- Este usuario: <b>" +
                                                                                                     Session.GetHabbo().Username + "</b>", NotificationSettings.NOTIFICATION_FILTER_IMG, "Ir ao quarto", "event:navigator/goto/" +
                                                                                                     Session.GetHabbo().CurrentRoomId));
                }
                if (Session.GetHabbo().BannedPhraseCount >= 5)
                {
                    CloudServer.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "banido por spam (" + Message + ")", (CloudServer.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }

                Session.SendMessage(new ChatComposer(User.VirtualId, "Mensagem inapropiado", 0, Colour));
                return;
            }


            CloudServer.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.OnChat(User.LastBubble, Message, false);
        }
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendNotification("Bem, agora você está mudo: Você não pode mudar a sua missão.");
                return;
            }

            if ((DateTime.Now - Session.GetHabbo().LastMottoUpdateTime).TotalSeconds <= 2.0)
            {
                Session.GetHabbo().MottoUpdateWarnings += 1;
                if (Session.GetHabbo().MottoUpdateWarnings >= 25)
                {
                    Session.GetHabbo().SessionMottoBlocked = true;
                }
                return;
            }

            if (Session.GetHabbo().SessionMottoBlocked)
            {
                return;
            }

            Session.GetHabbo().LastMottoUpdateTime = DateTime.Now;

            string newMotto = StringCharFilter.Escape(Packet.PopString().Trim());

            if (newMotto.Length > 38)
            {
                newMotto = newMotto.Substring(0, 38);
            }

            if (newMotto == Session.GetHabbo().Motto)
            {
                return;
            }

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                newMotto = BiosEmuThiago.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(newMotto, out word) ? "Spam" : newMotto;
            }

            Session.GetHabbo().Motto = newMotto;

            using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `motto` = @motto WHERE `id` = @userId LIMIT 1");
                dbClient.AddParameter("userId", Session.GetHabbo().Id);
                dbClient.AddParameter("motto", newMotto);
                dbClient.RunQuery();
            }

            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 troca sua missão."));
                        return;
                    }
                }
            }

            BiosEmuThiago.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_MOTTO);
            BiosEmuThiago.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Motto", 1);

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

                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (User == null || User.GetClient() == null)
                {
                    return;
                }

                Room.SendMessage(new UserChangeComposer(User, false));
            }
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendNotification("Oops, estas muteado - No puedes enviar invitaciones a salas");
                return;
            }

            int Amount = Packet.PopInt();

            if (Amount > 500)
            {
                return; // don't send at all
            }
            List <int> Targets = new List <int>();

            for (int i = 0; i < Amount; i++)
            {
                int uid = Packet.PopInt();
                if (i < 100) // limit to 100 people, keep looping until we fulfil the request though
                {
                    Targets.Add(uid);
                }
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 121)
            {
                Message = Message.Substring(0, 121);
            }

            if (Message.Contains("&#1º;") || Message.Contains("&#1º") || Message.Contains("&#"))
            {
                Session.SendMessage(new MassEventComposer("habbopages/spammer.txt")); return;
            }

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    Session.GetHabbo().TimeMuted = 25;
                    Session.SendNotification("¡Has sido silenciad@ mientras un moderador revisa tu caso, al parecer nombraste un hotel! Aviso " + Session.GetHabbo().BannedPhraseCount + "/3");
                    RavenEnvironment.GetGame().GetClientManager().StaffAlert1(new RoomInviteComposer(int.MinValue, "Spammer: " + Session.GetHabbo().Username + " / Frase: " + Message + " / Palabra: " + word.ToUpper() + " / Fase: " + Session.GetHabbo().BannedPhraseCount + " / 10."));
                    RavenEnvironment.GetGame().GetClientManager().StaffAlert2(new RoomNotificationComposer("Alerta de publicista:",
                                                                                                           "<b><font color=\"#B40404\">Por favor, recuerda investigar bien antes de recurrir a una sanción.</font></b><br><br>Palabra: <b>" + word.ToUpper() + "</b>.<br><br><b>Frase:</b><br><i>" + Message +
                                                                                                           "</i>.<br><br><b>Tipo:</b><br>Chat de sala.\r\n" + "<b>Usuario: " + Session.GetHabbo().Username + "</b><br><b>Secuencia:</b> " + Session.GetHabbo().BannedPhraseCount + "/ 10.", "foto", "Investigar", "event:navigator/goto/" +
                                                                                                           Session.GetHabbo().CurrentRoomId));
                    return;
                }
                if (Session.GetHabbo().BannedPhraseCount >= 10)
                {
                    RavenEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer Spam con la Frase (" + Message + ")", (RavenEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }
                return;
            }

            foreach (int UserId in Targets)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(UserId))
                {
                    continue;
                }

                GameClient Client = RavenEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().AllowMessengerInvites == true || Client.GetHabbo().AllowConsoleMessages == false)
                {
                    continue;
                }

                Client.SendMessage(new RoomInviteComposer(Session.GetHabbo().Id, Message));
                Client.SendMessage(RoomNotificationComposer.SendBubble("eventoxx", "" + Session.GetHabbo().Username + " te invita a un nuevo evento en su sala. Su mensaje es " + Message + ".", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
            }

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `chatlogs_console_invitations` (`user_id`,`message`,`timestamp`) VALUES ('" + Session.GetHabbo().Id + "', @message, UNIX_TIMESTAMP())");
                dbClient.AddParameter("message", Message);
                dbClient.RunQuery();
            }
        }
Exemple #19
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().FloodTime;

            if (timeSpan.Seconds > 4)
            {
                Session.GetHabbo().FloodCount = 0;
            }
            if (timeSpan.Seconds < 4 && Session.GetHabbo().FloodCount > 5 && Session.GetHabbo().Rank < 5U)
            {
                return;
            }

            Session.GetHabbo().FloodTime = DateTime.Now;
            Session.GetHabbo().FloodCount++;

            int InviteCount = Packet.PopInt();

            if (InviteCount > 200)
            {
                return;
            }

            List <int> Targets = new List <int>();

            for (int i = 0; i < InviteCount; ++i)
            {
                int Id = Packet.PopInt();
                if (i < 100)
                {
                    Targets.Add(Id);
                }
            }

            string TextMessage = StringCharFilter.Escape(Packet.PopString());

            if (TextMessage.Length > 121)
            {
                TextMessage = TextMessage.Substring(0, 121);
            }

            if (Session.Antipub(TextMessage, "<RM>"))
            {
                return;
            }
            if (Session.GetHabbo().IgnoreAll)
            {
                return;
            }

            ServerPacket Message = new ServerPacket(ServerPacketHeader.RoomInviteMessageComposer);

            Message.WriteInteger(Session.GetHabbo().Id);
            Message.WriteString(TextMessage);

            foreach (int UserId in Targets)
            {
                if (Session.GetHabbo().GetMessenger().FriendshipExists(UserId))
                {
                    GameClient clientByUserId = ButterflyEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                    if (clientByUserId == null)
                    {
                        break;
                    }
                    if (clientByUserId.GetHabbo().GetMessenger().FriendshipExists(Session.GetHabbo().Id))
                    {
                        clientByUserId.SendPacket(Message);
                    }
                }
            }
        }
Exemple #20
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (Room.UserIsMuted(Session.GetHabbo().Id))
            {
                if (!Room.HasMuteExpired(Session.GetHabbo().Id))
                {
                    return;
                }
                else
                {
                    Room.RemoveMute(Session.GetHabbo().Id);
                }
            }

            string Params = StringCharFilter.Escape(Packet.PopString());

            if (string.IsNullOrEmpty(Params) || Params.Length > 100 || !Params.Contains(" "))
            {
                return;
            }

            string ToUser = Params.Split(new char[1] {
                ' '
            })[0];

            if (ToUser.Length + 1 > Params.Length)
            {
                return;
            }

            string Message = Params.Substring(ToUser.Length + 1);
            int    Color   = Packet.PopInt();

            ChatStyle Style = null;

            if (!ButterflyEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Color, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().HasFuse(Style.RequiredRight)))
            {
                Color = 0;
            }

            if (Session.Antipub(Message, "<MP>"))
            {
                return;
            }

            if (!Session.GetHabbo().HasFuse("word_filter_override"))
            {
                Message = ButterflyEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }

            RoomUser User  = Room.GetRoomUserManager().GetRoomUserByHabboId(Session.GetHabbo().Id);
            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);

            if (User == null || User2 == null || User2.GetClient() == null || User2.GetClient().GetHabbo() == null)
            {
                return;
            }
            if (User.IsSpectator || User2.IsSpectator)
            {
                return;
            }

            TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().spamFloodTime;

            if (timeSpan.TotalSeconds > (double)Session.GetHabbo().spamProtectionTime&& Session.GetHabbo().spamEnable)
            {
                User.FloodCount = 0;
                Session.GetHabbo().spamEnable = false;
            }
            else if (timeSpan.TotalSeconds > 4.0)
            {
                User.FloodCount = 0;
            }

            if (timeSpan.TotalSeconds < (double)Session.GetHabbo().spamProtectionTime&& Session.GetHabbo().spamEnable)
            {
                int i = Session.GetHabbo().spamProtectionTime - timeSpan.Seconds;
                User.GetClient().SendPacket(new FloodControlComposer(i));
                return;
            }
            else if (timeSpan.TotalSeconds < 4.0 && User.FloodCount > 5 && !Session.GetHabbo().HasFuse("fuse_mod"))
            {
                Session.GetHabbo().spamProtectionTime = (Room.RpRoom) ? 5 : 30;
                Session.GetHabbo().spamEnable         = true;

                User.GetClient().SendPacket(new FloodControlComposer(Session.GetHabbo().spamProtectionTime - timeSpan.Seconds));

                return;
            }
            else if (Message.Length > 40 && Message == User.LastMessage && User.LastMessageCount == 1)
            {
                User.LastMessageCount = 0;
                User.LastMessage      = "";

                Session.GetHabbo().spamProtectionTime = (Room.RpRoom) ? 5 : 30;
                Session.GetHabbo().spamEnable         = true;
                User.GetClient().SendPacket(new FloodControlComposer(Session.GetHabbo().spamProtectionTime - timeSpan.Seconds));
                return;
            }
            else
            {
                if (Message == User.LastMessage && Message.Length > 40)
                {
                    User.LastMessageCount++;
                }

                User.LastMessage = Message;

                Session.GetHabbo().spamFloodTime = DateTime.Now;
                User.FloodCount++;

                if (Message.StartsWith("@red@"))
                {
                    User.ChatTextColor = "@red@";
                }
                if (Message.StartsWith("@cyan@"))
                {
                    User.ChatTextColor = "@cyan@";
                }
                if (Message.StartsWith("@blue@"))
                {
                    User.ChatTextColor = "@blue@";
                }
                if (Message.StartsWith("@green@"))
                {
                    User.ChatTextColor = "@green@";
                }
                if (Message.StartsWith("@purple@"))
                {
                    User.ChatTextColor = "@purple@";
                }
                if (Message.StartsWith("@black@"))
                {
                    User.ChatTextColor = "";
                }

                if (!string.IsNullOrEmpty(User.ChatTextColor))
                {
                    Message = User.ChatTextColor + " " + Message;
                }


                ServerPacket Message1 = new ServerPacket(ServerPacketHeader.WhisperMessageComposer);
                Message1.WriteInteger(User.VirtualId);
                Message1.WriteString(Message);
                Message1.WriteInteger(RoomUser.GetSpeechEmotion(Message));
                Message1.WriteInteger(Color);
                Message1.WriteInteger(0);
                Message1.WriteInteger(-1);
                User.GetClient().SendPacket(Message1);

                User.Unidle();

                if (!User2.IsBot && (User2.UserId != User.UserId && !User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id)) && !Session.GetHabbo().IgnoreAll)
                {
                    User2.GetClient().SendPacket(Message1);
                    if (User.GetUsername() != "Jason" && User2.GetUsername() != "Jason")
                    {
                        Session.GetHabbo().GetChatMessageManager().AddMessage(User.UserId, User.GetUsername(), User.RoomId, ButterflyEnvironment.GetLanguageManager().TryGetValue("moderation.whisper", Session.Langue) + ToUser + ": " + Message);
                        Room.GetChatMessageManager().AddMessage(User.UserId, User.GetUsername(), User.RoomId, ButterflyEnvironment.GetLanguageManager().TryGetValue("moderation.whisper", Session.Langue) + ToUser + ": " + Message);
                    }
                }

                if (User.GetUsername() == "Jason" || User2.GetUsername() == "Jason")
                {
                    return;
                }

                List <RoomUser> roomUserByRank = Room.GetRoomUserManager().GetStaffRoomUser();
                if (roomUserByRank.Count <= 0)
                {
                    return;
                }

                ServerPacket Message2 = new ServerPacket(ServerPacketHeader.WhisperMessageComposer);
                Message2.WriteInteger(User.VirtualId);
                Message2.WriteString(ButterflyEnvironment.GetLanguageManager().TryGetValue("moderation.whisper", Session.Langue) + ToUser + ": " + Message);
                Message2.WriteInteger(RoomUser.GetSpeechEmotion(Message));
                Message2.WriteInteger(Color);
                Message2.WriteInteger(0);
                Message2.WriteInteger(-1);
                foreach (RoomUser roomUser in roomUserByRank)
                {
                    if (roomUser != null && User2 != null && roomUser.HabboId != User2.HabboId && (roomUser.HabboId != User.HabboId && roomUser.GetClient() != null) && roomUser.GetClient().GetHabbo().ViewMurmur)
                    {
                        roomUser.GetClient().SendPacket(Message2);
                    }
                }
            }
        }
Exemple #21
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int    PageId      = Packet.PopInt();
            int    ItemId      = Packet.PopInt();
            string Data        = Packet.PopString();
            string GiftUser    = StringCharFilter.Escape(Packet.PopString());
            string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' '));
            int    SpriteId    = Packet.PopInt();
            int    Ribbon      = Packet.PopInt();
            int    Colour      = Packet.PopInt();
            bool   dnow        = Packet.PopBoolean();

            if (PlusEnvironment.GetDBConfig().DBData["gifts_enabled"] != "1")
            {
                Session.SendNotification("Os gerentes do hotel desativou esta função!");
                return;
            }

            /*if (PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0)
             * {
             *  PageId = PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId];
             *
             *  CatalogPage P = null;
             *  if (!PlusEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P))
             *      PageId = 0;
             * }*/

            CatalogPage Page = null;

            if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page))
            {
                return;
            }

            if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1))
            {
                return;
            }

            CatalogItem Item = null;

            if (!Page.Items.TryGetValue(ItemId, out Item))
            {
                if (Page.ItemOffers.ContainsKey(ItemId))
                {
                    Item = (CatalogItem)Page.ItemOffers[ItemId];
                    if (Item == null)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (!ItemUtility.CanGiftItem(Item))
            {
                return;
            }

            ItemData PresentData = null;

            if (!PlusEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT)
            {
                return;
            }

            if (Session.GetHabbo().Credits < Item.CostCredits)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(true, false));
                return;
            }

            if (Session.GetHabbo().Duckets < Item.CostPixels)
            {
                Session.SendMessage(new PresentDeliverErrorMessageComposer(false, true));
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboByUsername(GiftUser);

            if (Habbo == null)
            {
                Session.SendMessage(new GiftWrappingErrorComposer());
                return;
            }

            if (!Habbo.AllowGifts)
            {
                Session.SendNotification("Opa, este usuário não permite que os presentes sejam enviados para ele!");
                return;
            }

            if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
            {
                Session.SendNotification("Você está comprando presentes muito rápido! Aguarde 15 segundos!");

                Session.GetHabbo().GiftPurchasingWarnings += 1;
                if (Session.GetHabbo().GiftPurchasingWarnings >= 25)
                {
                    Session.GetHabbo().SessionGiftBlocked = true;
                }
                return;
            }

            if (Session.GetHabbo().SessionGiftBlocked)
            {
                return;
            }


            string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour;

            int NewItemId = 0;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES ('" + PresentData.Id + "', '" + Habbo.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", ED);
                NewItemId = Convert.ToInt32(dbClient.InsertQuery());

                string ItemExtraData = null;
                switch (Item.Data.InteractionType)
                {
                case InteractionType.NONE:
                    ItemExtraData = "";
                    break;

                    #region Pet handling

                case InteractionType.pet0:
                case InteractionType.pet1:
                case InteractionType.pet2:
                case InteractionType.pet3:
                case InteractionType.pet4:
                case InteractionType.pet5:
                case InteractionType.pet6:
                case InteractionType.pet7:
                case InteractionType.pet8:
                case InteractionType.pet9:
                case InteractionType.pet10:
                case InteractionType.pet11:
                case InteractionType.pet12:
                case InteractionType.pet13:     //Caballo
                case InteractionType.pet14:
                case InteractionType.pet15:
                case InteractionType.pet16:     //Mascota agregada
                case InteractionType.pet17:     //Mascota agregada
                case InteractionType.pet18:     //Mascota agregada
                case InteractionType.pet19:     //Mascota agregada
                case InteractionType.pet20:     //Mascota agregada
                case InteractionType.pet21:     //Mascota agregada
                case InteractionType.pet22:     //Mascota agregada
                case InteractionType.pet28:
                case InteractionType.pet29:
                case InteractionType.pet30:

                    try
                    {
                        string[] Bits    = Data.Split('\n');
                        string   PetName = Bits[0];
                        string   Race    = Bits[1];
                        string   Color   = Bits[2];

                        int.Parse(Race);     // to trigger any possible errors

                        if (PetUtility.CheckPetName(PetName))
                        {
                            return;
                        }

                        if (Race.Length > 2)
                        {
                            return;
                        }

                        if (Color.Length != 6)
                        {
                            return;
                        }

                        //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1);
                    }
                    catch
                    {
                        return;
                    }

                    break;

                    #endregion

                case InteractionType.FLOOR:
                case InteractionType.WALLPAPER:
                case InteractionType.LANDSCAPE:

                    Double Number = 0;
                    try
                    {
                        if (string.IsNullOrEmpty(Data))
                        {
                            Number = 0;
                        }
                        else
                        {
                            Number = Double.Parse(Data, PlusEnvironment.CultureInfo);
                        }
                    }
                    catch
                    {
                    }

                    ItemExtraData = Number.ToString().Replace(',', '.');
                    break;     // maintain extra data // todo: validate

                case InteractionType.POSTIT:
                    ItemExtraData = "FFFF33";
                    break;

                case InteractionType.MOODLIGHT:
                    ItemExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.TROPHY:
                    ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data;
                    break;

                case InteractionType.MANNEQUIN:
                    ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Manequim padrão";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data))
                    {
                        Session.SendMessage(new BroadcastMessageAlertComposer("Opa, parece que você não possui este emblema."));
                        return;
                    }

                    ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                    break;

                default:
                    ItemExtraData = Data;
                    break;
                }

                //Insert the present, forever.
                dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES ('" + NewItemId + "', '" + Item.Data.Id + "', @extra_data)");
                dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData));
                dbClient.RunQuery();

                //Here we're clearing up a record, this is dumb, but okay.
                dbClient.RunQuery("DELETE FROM `items` WHERE `id` = " + NewItemId + " LIMIT 1;");
            }


            Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0);
            if (GiveItem != null)
            {
                GameClient Receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id);
                if (Receiver != null)
                {
                    Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);
                    Receiver.SendMessage(new FurniListNotificationComposer(GiveItem.Id, 1));
                    Receiver.SendMessage(new PurchaseOKComposer());
                    Receiver.SendMessage(new FurniListAddComposer(GiveItem));
                    Receiver.SendMessage(new FurniListUpdateComposer());
                }

                if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage))
                {
                    //PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1);
                    //if (Receiver != null)
                    //    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1);
                    //PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS);
                }
            }

            Session.SendMessage(new PurchaseOKComposer(Item, PresentData));

            if (Item.CostCredits > 0)
            {
                Session.GetHabbo().Credits -= Item.CostCredits;
                Session.SendMessage(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            if (Item.CostPixels > 0)
            {
                Session.GetHabbo().Duckets -= Item.CostPixels;
                Session.SendMessage(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            }

            Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            int    PageId      = Packet.PopInt();
            int    ItemId      = Packet.PopInt();
            string Data        = Packet.PopString();
            string GiftUser    = StringCharFilter.Escape(Packet.PopString());
            string GiftMessage = StringCharFilter.Escape(Packet.PopString().Replace(Convert.ToChar(5), ' '));
            int    SpriteId    = Packet.PopInt();
            int    Ribbon      = Packet.PopInt();
            int    Colour      = Packet.PopInt();
            bool   dnow        = Packet.PopBoolean();

            if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1")
            {
                Session.SendNotification("The hotel managers have disabled gifting");
                return;
            }

            /*if (PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers.ContainsKey(ItemId) && PageId < 0)
             * {
             *  PageId = PlusEnvironment.GetGame().GetCatalog().CatalogFlatOffers[ItemId];
             *
             *  CatalogPage P = null;
             *  if (!PlusEnvironment.GetGame().GetCatalog().Pages.TryGetValue(PageId, out P))
             *      PageId = 0;
             * }*/

            CatalogPage Page = null;

            if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(PageId, out Page))
            {
                return;
            }

            if (!Page.Enabled || !Page.Visible || Page.MinimumRank > Session.GetHabbo().Rank || (Page.MinimumVIP > Session.GetHabbo().VIPRank&& Session.GetHabbo().Rank == 1))
            {
                return;
            }

            CatalogItem Item = null;

            if (!Page.Items.TryGetValue(ItemId, out Item))
            {
                if (Page.ItemOffers.ContainsKey(ItemId))
                {
                    Item = (CatalogItem)Page.ItemOffers[ItemId];
                    if (Item == null)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (!ItemUtility.CanGiftItem(Item))
            {
                return;
            }

            ItemData PresentData = null;

            if (!PlusEnvironment.GetGame().GetItemManager().GetGift(SpriteId, out PresentData) || PresentData.InteractionType != InteractionType.GIFT)
            {
                return;
            }

            if (Session.GetHabbo().Credits < Item.CostCredits)
            {
                Session.SendPacket(new PresentDeliverErrorMessageComposer(true, false));
                return;
            }

            if (Session.GetHabbo().Duckets < Item.CostPixels)
            {
                Session.SendPacket(new PresentDeliverErrorMessageComposer(false, true));
                return;
            }

            Habbo Habbo = PlusEnvironment.GetHabboByUsername(GiftUser);

            if (Habbo == null)
            {
                Session.SendPacket(new GiftWrappingErrorComposer());
                return;
            }

            if (!Habbo.AllowGifts)
            {
                Session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!");
                return;
            }

            if ((DateTime.Now - Session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
            {
                Session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!");

                Session.GetHabbo().GiftPurchasingWarnings += 1;
                if (Session.GetHabbo().GiftPurchasingWarnings >= 25)
                {
                    Session.GetHabbo().SessionGiftBlocked = true;
                }
                return;
            }

            if (Session.GetHabbo().SessionGiftBlocked)
            {
                return;
            }


            string ED = GiftUser + Convert.ToChar(5) + GiftMessage + Convert.ToChar(5) + Session.GetHabbo().Id + Convert.ToChar(5) + Item.Data.Id + Convert.ToChar(5) + SpriteId + Convert.ToChar(5) + Ribbon + Convert.ToChar(5) + Colour;

            int NewItemId = 0;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)");
                dbClient.AddParameter("baseId", PresentData.Id);
                dbClient.AddParameter("habboId", Habbo.Id);
                dbClient.AddParameter("extra_data", ED);
                NewItemId = Convert.ToInt32(dbClient.InsertQuery());

                string ItemExtraData = null;
                switch (Item.Data.InteractionType)
                {
                case InteractionType.NONE:
                    ItemExtraData = "";
                    break;

                    #region Pet handling

                case InteractionType.PET:

                    try
                    {
                        string[] Bits    = Data.Split('\n');
                        string   PetName = Bits[0];
                        string   Race    = Bits[1];
                        string   Color   = Bits[2];

                        int.Parse(Race);     // to trigger any possible errors

                        if (PetUtility.CheckPetName(PetName))
                        {
                            return;
                        }

                        if (Race.Length > 2)
                        {
                            return;
                        }

                        if (Color.Length != 6)
                        {
                            return;
                        }

                        PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_PetLover", 1);
                    }
                    catch
                    {
                        return;
                    }

                    break;

                    #endregion

                case InteractionType.FLOOR:
                case InteractionType.WALLPAPER:
                case InteractionType.LANDSCAPE:

                    Double Number = 0;
                    try
                    {
                        if (string.IsNullOrEmpty(Data))
                        {
                            Number = 0;
                        }
                        else
                        {
                            Number = Double.Parse(Data, PlusEnvironment.CultureInfo);
                        }
                    }
                    catch
                    {
                    }

                    ItemExtraData = Number.ToString().Replace(',', '.');
                    break;     // maintain extra data // todo: validate

                case InteractionType.POSTIT:
                    ItemExtraData = "FFFF33";
                    break;

                case InteractionType.MOODLIGHT:
                    ItemExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.TROPHY:
                    ItemExtraData = Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + Data;
                    break;

                case InteractionType.MANNEQUIN:
                    ItemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!Session.GetHabbo().GetBadgeComponent().HasBadge(Data))
                    {
                        Session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge."));
                        return;
                    }

                    ItemExtraData = Data + Convert.ToChar(9) + Session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                    break;

                default:
                    ItemExtraData = Data;
                    break;
                }

                //Insert the present, forever.
                dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)");
                dbClient.AddParameter("itemId", NewItemId);
                dbClient.AddParameter("baseId", Item.Data.Id);
                dbClient.AddParameter("extra_data", (string.IsNullOrEmpty(ItemExtraData) ? "" : ItemExtraData));
                dbClient.RunQuery();

                //Here we're clearing up a record, this is dumb, but okay.
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1");
                dbClient.AddParameter("deleteId", NewItemId);
                dbClient.RunQuery();
            }


            Item GiveItem = ItemFactory.CreateGiftItem(PresentData, Habbo, ED, ED, NewItemId, 0, 0);
            if (GiveItem != null)
            {
                GameClient Receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Habbo.Id);
                if (Receiver != null)
                {
                    Receiver.GetHabbo().GetInventoryComponent().TryAddItem(GiveItem);
                    Receiver.SendPacket(new FurniListNotificationComposer(GiveItem.Id, 1));
                    Receiver.SendPacket(new PurchaseOKComposer());
                    Receiver.SendPacket(new FurniListAddComposer(GiveItem));
                    Receiver.SendPacket(new FurniListUpdateComposer());
                }

                if (Habbo.Id != Session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(GiftMessage))
                {
                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_GiftGiver", 1);
                    if (Receiver != null)
                    {
                        PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Receiver, "ACH_GiftReceiver", 1);
                    }
                    PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.GIFT_OTHERS);
                }
            }

            Session.SendPacket(new PurchaseOKComposer(Item, PresentData));

            if (Item.CostCredits > 0)
            {
                Session.GetHabbo().Credits -= Item.CostCredits;
                Session.SendPacket(new CreditBalanceComposer(Session.GetHabbo().Credits));
            }

            if (Item.CostPixels > 0)
            {
                Session.GetHabbo().Duckets -= Item.CostPixels;
                Session.SendPacket(new HabboActivityPointNotificationComposer(Session.GetHabbo().Duckets, Session.GetHabbo().Duckets));
            }

            Session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
        }
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session.Habbo.TimeMuted > 0)
            {
                session.SendNotification("Oops, you're currently muted - you cannot change your motto.");
                return;
            }

            if ((DateTime.Now - session.Habbo.LastMottoUpdateTime).TotalSeconds <= 2.0)
            {
                session.Habbo.MottoUpdateWarnings += 1;
                if (session.Habbo.MottoUpdateWarnings >= 25)
                {
                    session.Habbo.SessionMottoBlocked = true;
                }
                return;
            }

            if (session.Habbo.SessionMottoBlocked)
            {
                return;
            }

            session.Habbo.LastMottoUpdateTime = DateTime.Now;

            string newMotto = StringCharFilter.Escape(packet.PopString().Trim());

            if (newMotto.Length > 38)
            {
                newMotto = newMotto.Substring(0, 38);
            }

            if (newMotto == session.Habbo.Motto)
            {
                return;
            }

            if (!session.Habbo.GetPermissions().HasRight("word_filter_override"))
            {
                newMotto = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(newMotto);
            }

            session.Habbo.Motto = newMotto;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `motto` = @motto WHERE `id` = @userId LIMIT 1");
                dbClient.AddParameter("userId", session.Habbo.Id);
                dbClient.AddParameter("motto", newMotto);
                dbClient.RunQuery();
            }

            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.ProfileChangeMotto);
            _achievementManager.ProgressAchievement(session, "ACH_Motto", 1);

            if (session.Habbo.InRoom)
            {
                Room room = session.Habbo.CurrentRoom;
                if (room == null)
                {
                    return;
                }

                RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.Habbo.Id);
                if (user == null || user.GetClient() == null)
                {
                    return;
                }

                room.SendPacket(new UserChangeComposer(user, false));
            }
        }
Exemple #24
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            if (Session.LoggingOut)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString(), false, Session);

            if (Message.Length > 150)
            {
                Message = Message.Substring(0, 150);
            }

            int Colour = Packet.PopInt();

            if (Colour != 0 && !User.GetClient().GetHabbo().GetPermissions().HasRight("use_any_bubble"))
            {
                Colour = 0;
            }

            ChatStyle Style = null;

            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Opa, atualmente você está mudo.", 1);
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
                {
                    return;
                }
                else if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.Equals("x"))
            {
                if (Session.GetRoleplay().LastCommand != "")
                {
                    Message = Session.GetRoleplay().LastCommand.ToString();
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Plus.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (!Session.GetHabbo().GetPermissions().HasRight("advertisement_filter_override"))
            {
                string Phrase = "";
                if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message, out Phrase))
                {
                    Session.GetHabbo().AdvertisingStrikes++;

                    if (Session.GetHabbo().AdvertisingStrikes < 2)
                    {
                        Session.SendMessage(new RoomNotificationComposer("Atenção!", "Por favor, evite de anunciar outros sites que não são permitidos, afiliados ou oferecidos pelo HabboRPG. Você ficará mudo se você fizer isso de novo!<br><br>Frase da lista Negra: '" + Phrase + "'", "frank10", "ok", "event:"));
                        return;
                    }

                    if (Session.GetHabbo().AdvertisingStrikes >= 2)
                    {
                        Session.GetHabbo().TimeMuted = 3600;

                        using (var dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery("UPDATE `users` SET `time_muted` = '3600' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                        }

                        Session.SendMessage(new RoomNotificationComposer("Você foi mutado!", "Desculpe, mas você foi automaticamente mutadod por divulgar '" + Phrase + "'.<br><br>A equipe de moderação foi notificada e ações serão tomadas dentro de sua conta", "frank10", "ok", "event:"));

                        List <string> Messages = new List <string>();
                        Messages.Add(Message);
                        PlusEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, 9, Session.GetHabbo().Id, "[Servidor] O civil já recebeu uma advertência " + Phrase + ".", Messages);
                        return;
                    }

                    return;
                }
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }

            if (Message.ToLower().Equals("o/"))
            {
                Room.SendMessage(new ActionComposer(User.VirtualId, 1));
                return;
            }

            if (Message.ToLower().Equals("_b"))
            {
                Room.SendMessage(new ActionComposer(User.VirtualId, 7));
                return;
            }

            User.UnIdle();

            if (Session.GetRoleplay() != null)
            {
                if (Session.GetRoleplay().IsWorking&& HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide"))
                {
                    User.OnChat(37, Message, true);
                }
                else if (Session.GetRoleplay().StaffOnDuty&& Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
                {
                    User.OnChat(23, Message, true);
                }
                else if (Session.GetRoleplay().AmbassadorOnDuty&& Session.GetHabbo().GetPermissions().HasRight("ambassador"))
                {
                    User.OnChat(37, Message, true);
                }

                // Roleplay
                else if (Session.GetRoleplay().CurHealth > 25 && Session.GetRoleplay().CurHealth <= 40 && !Session.GetRoleplay().IsDead)
                {
                    User.OnChat(5, Message, true);
                }
                else if (Session.GetRoleplay().CurHealth <= 25 && !Session.GetRoleplay().IsDead)
                {
                    User.OnChat(3, Message, true);
                }
                else if (Session.GetRoleplay().IsDead)
                {
                    User.OnChat(3, "[ " + Message + " ]", true);
                }
                else
                {
                    User.OnChat(User.LastBubble, Message, true);
                }
            }
            else
            {
                User.OnChat(User.LastBubble, Message, true);
            }
        }
Exemple #25
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null || !Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

            if (User == null)
            {
                return;
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 100)
            {
                Message = Message.Substring(0, 100);
            }

            int Colour = Packet.PopInt();

            ChatStyle Style = null;

            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Colour, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Colour = 0;
            }

            User.UnIdle();

            if (PlusEnvironment.GetUnixTimestamp() < Session.GetHabbo().FloodTime&& Session.GetHabbo().FloodTime != 0)
            {
                return;
            }

            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new MutedComposer(Session.GetHabbo().TimeMuted));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("room_ignore_mute") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oops, you're currently muted.");
                return;
            }

            User.LastBubble = Session.GetHabbo().CustomBubbleId == 0 ? Colour : Session.GetHabbo().CustomBubbleId;

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (Message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(Session, Message))
            {
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(Message))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= PlusStaticGameSettings.BannedPhrasesAmount)
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Spamming banned phrases (" + Message + ")", (PlusEnvironment.GetUnixTimestamp() + 78892200));
                    Session.Disconnect();
                    return;
                }

                Session.SendMessage(new ChatComposer(User.VirtualId, Message, 0, Colour));
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                Message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(Message);
            }


            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);

            User.OnChat(User.LastBubble, Message, false);
        }
Exemple #26
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.Habbo == null || !session.Habbo.InRoom)
            {
                return;
            }

            Room room = session.Habbo.CurrentRoom;

            if (room == null)
            {
                return;
            }

            RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.Habbo.Id);

            if (user == null)
            {
                return;
            }

            string message = StringCharFilter.Escape(packet.PopString());

            if (message.Length > 100)
            {
                message = message.Substring(0, 100);
            }

            int colour = packet.PopInt();

            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(colour, out ChatStyle style) || style.RequiredRight.Length > 0 && !session.Habbo.GetPermissions().HasRight(style.RequiredRight))
            {
                colour = 0;
            }

            user.LastBubble = session.Habbo.CustomBubbleId == 0 ? colour : session.Habbo.CustomBubbleId;

            if (PlusEnvironment.GetUnixTimestamp() < session.Habbo.FloodTime && session.Habbo.FloodTime != 0)
            {
                return;
            }

            if (session.Habbo.TimeMuted > 0)
            {
                session.SendPacket(new MutedComposer(session.Habbo.TimeMuted));
                return;
            }

            if (!session.Habbo.GetPermissions().HasRight("room_ignore_mute") && room.CheckMute(session))
            {
                session.SendWhisper("Oops, you're currently muted.");
                return;
            }

            if (!session.Habbo.GetPermissions().HasRight("mod_tool"))
            {
                if (user.IncrementAndCheckFlood(out int muteTime))
                {
                    session.SendPacket(new FloodControlComposer(muteTime));
                    return;
                }
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(session.Habbo.Id, room.Id, message, UnixTimestamp.GetNow(), session.Habbo, room));

            if (message.StartsWith(":", StringComparison.CurrentCulture) && PlusEnvironment.GetGame().GetChatManager().GetCommands().Parse(session, message))
            {
                return;
            }

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(message))
            {
                session.Habbo.BannedPhraseCount++;
                if (session.Habbo.BannedPhraseCount >= Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("room.chat.filter.banned_phrases.chances")))
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.Username, session.Habbo.Username, "Spamming banned phrases (" + message + ")", PlusEnvironment.GetUnixTimestamp() + 78892200);
                    session.Disconnect();
                    return;
                }
                session.SendPacket(new ShoutComposer(user.VirtualId, message, 0, colour));
                return;
            }

            if (!session.Habbo.GetPermissions().HasRight("word_filter_override"))
            {
                message = PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckMessage(message);
            }

            PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.SocialChat);

            user.UnIdle();
            user.OnChat(user.LastBubble, message, true);
        }
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            // Run a quick check to see if we have any existing tickets.
            if (CloudServer.GetGame().GetModerationManager().UserHasTickets(Session.GetHabbo().Id))
            {
                ModerationTicket PendingTicket = CloudServer.GetGame().GetModerationManager().GetTicketBySenderId(Session.GetHabbo().Id);
                if (PendingTicket != null)
                {
                    Session.SendMessage(new CallForHelpPendingCallsComposer(PendingTicket));
                    return;
                }
            }

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

            string Message        = StringCharFilter.Escape(Packet.PopString().Trim());
            int    Category       = Packet.PopInt();
            int    ReportedUserId = Packet.PopInt();
            int    Type           = Packet.PopInt();// Unsure on what this actually is.

            Habbo ReportedUser = CloudServer.GetHabboById(ReportedUserId);

            if (ReportedUser == null)
            {
                // User doesn't exist.
                return;
            }

            int Messagecount = Packet.PopInt();

            for (int i = 0; i < Messagecount; i++)
            {
                Packet.PopInt();
                Chats.Add(Packet.PopString());
            }

            ModerationTicket Ticket = new ModerationTicket(1, Type, Category, UnixTimestamp.GetNow(), 1, Session.GetHabbo(), ReportedUser, Message, Session.GetHabbo().CurrentRoom, Chats);

            if (!CloudServer.GetGame().GetModerationManager().TryAddTicket(Ticket))
            {
                return;
            }

            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                // TODO: Come back to this.

                /*dbClient.SetQuery("INSERT INTO `moderation_tickets` (`score`,`type`,`status`,`sender_id`,`reported_id`,`moderator_id`,`message`,`room_id`,`room_name`,`timestamp`) VALUES (1, '" + Category + "', 'open', '" + Session.GetHabbo().Id + "', '" + ReportedUserId + "', '0', @message, '0', '', '" + CloudServer.GetUnixTimestamp() + "')");
                 * dbClient.AddParameter("message", Message);
                 * dbClient.RunQuery();*/

                dbClient.runFastQuery("UPDATE `user_info` SET `cfhs` = `cfhs` + '1' WHERE `user_id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }

            CloudServer.GetGame().GetClientManager().ModAlert("Um novo ticket de suporte foi enviado!");
            CloudServer.GetGame().GetClientManager().SendMessage(new ModeratorSupportTicketComposer(Session.GetHabbo().Id, Ticket), "mod_tool");
        }
Exemple #28
0
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendMessage(new RoomCustomizedAlertComposer("Oeps! Je hebt een spreekverbod."));
                return;
            }

            int Amount = Packet.PopInt();

            if (Amount > 500)
            {
                return; // don't send at all
            }
            List <int> Targets = new List <int>();

            for (int i = 0; i < Amount; i++)
            {
                int uid = Packet.PopInt();
                if (i < 100) // limit to 100 people, keep looping until we fulfil the request though
                {
                    Targets.Add(uid);
                }
            }

            string Message = StringCharFilter.Escape(Packet.PopString());

            if (Message.Length > 121)
            {
                Message = Message.Substring(0, 121);
            }

            /*
             * string word;
             * if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
             *  QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word))
             * {
             *  Session.GetHabbo().BannedPhraseCount++;
             *  if (Session.GetHabbo().BannedPhraseCount >= 1)
             *  {
             *      Session.GetHabbo().TimeMuted = 25;
             *      Session.SendNotification("¡Has sido silenciad@ mientras un moderador revisa tu caso, al parecer nombraste un hotel! Aviso " + Session.GetHabbo().BannedPhraseCount + "/3");
             *      QuasarEnvironment.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de publicista:",
             *          "Atención, se ha mencionado la palabra <b>" + word.ToUpper() + "</b><br><br><b>Frase:</b><br><i>" + Message +
             *          "</i>.<br><br><b>Tipo</b><br>Spam por invitación en consola.\r\n" + "- Este usuario: <b>" +
             *          Session.GetHabbo().Username + "</b>", "zpam", "", ""));
             *  }
             *  if (Session.GetHabbo().BannedPhraseCount >= 3)
             *  {
             *      QuasarEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer Spam con la Frase (" + Message + ")", (QuasarEnvironment.GetUnixTimestamp() + 78892200));
             *      Session.Disconnect();
             *      return;
             *  }
             *  return;
             * }
             */

            foreach (int UserId in Targets)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(UserId))
                {
                    continue;
                }

                GameClient Client = QuasarEnvironment.GetGame().GetClientManager().GetClientByUserID(UserId);
                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().AllowMessengerInvites == true || Client.GetHabbo().AllowConsoleMessages == false)
                {
                    continue;
                }

                Client.SendMessage(new RoomInviteComposer(Session.GetHabbo().Id, Message));
                Client.SendMessage(RoomNotificationComposer.SendBubble("eventoxx", "" + Session.GetHabbo().Username + " heeft een invite gestuurd: " + Message + ".", "event:navigator/goto/" + Session.GetHabbo().CurrentRoomId));
            }

            using (IQueryAdapter dbClient = QuasarEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("INSERT INTO `chatlogs_console_invitations` (`user_id`,`message`,`timestamp`) VALUES ('" + Session.GetHabbo().Id + "', @message, UNIX_TIMESTAMP())");
                dbClient.AddParameter("message", Message);
                dbClient.RunQuery();
            }
        }
Exemple #29
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            int    pageId      = packet.PopInt();
            int    itemId      = packet.PopInt();
            string data        = packet.PopString();
            string giftUser    = StringCharFilter.Escape(packet.PopString());
            string giftMessage = StringCharFilter.Escape(packet.PopString().Replace(Convert.ToChar(5), ' '));
            int    spriteId    = packet.PopInt();
            int    ribbon      = packet.PopInt();
            int    colour      = packet.PopInt();

            packet.PopBoolean();

            if (PlusEnvironment.GetSettingsManager().TryGetValue("room.item.gifts.enabled") != "1")
            {
                session.SendNotification("The hotel managers have disabled gifting");
                return;
            }

            if (!PlusEnvironment.GetGame().GetCatalog().TryGetPage(pageId, out CatalogPage page))
            {
                return;
            }

            if (!page.Enabled || !page.Visible || page.MinimumRank > session.GetHabbo().Rank || page.MinimumVIP > session.GetHabbo().VIPRank&& session.GetHabbo().Rank == 1)
            {
                return;
            }

            if (!page.Items.TryGetValue(itemId, out CatalogItem item))
            {
                if (page.ItemOffers.ContainsKey(itemId))
                {
                    item = page.ItemOffers[itemId];
                    if (item == null)
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }

            if (!ItemUtility.CanGiftItem(item))
            {
                return;
            }

            if (!PlusEnvironment.GetGame().GetItemManager().GetGift(spriteId, out ItemData presentData) || presentData.InteractionType != InteractionType.GIFT)
            {
                return;
            }

            if (session.GetHabbo().Credits < item.CostCredits)
            {
                session.SendPacket(new PresentDeliverErrorMessageComposer(true, false));
                return;
            }

            if (session.GetHabbo().Duckets < item.CostPixels)
            {
                session.SendPacket(new PresentDeliverErrorMessageComposer(false, true));
                return;
            }

            Habbo habbo = PlusEnvironment.GetHabboByUsername(giftUser);

            if (habbo == null)
            {
                session.SendPacket(new GiftWrappingErrorComposer());
                return;
            }

            if (!habbo.AllowGifts)
            {
                session.SendNotification("Oops, this user doesn't allow gifts to be sent to them!");
                return;
            }

            if ((DateTime.Now - session.GetHabbo().LastGiftPurchaseTime).TotalSeconds <= 15.0)
            {
                session.SendNotification("You're purchasing gifts too fast! Please wait 15 seconds!");

                session.GetHabbo().GiftPurchasingWarnings += 1;
                if (session.GetHabbo().GiftPurchasingWarnings >= 25)
                {
                    session.GetHabbo().SessionGiftBlocked = true;
                }
                return;
            }

            if (session.GetHabbo().SessionGiftBlocked)
            {
                return;
            }


            string ed = giftUser + Convert.ToChar(5) + giftMessage + Convert.ToChar(5) + session.GetHabbo().Id + Convert.ToChar(5) + item.Data.Id + Convert.ToChar(5) + spriteId + Convert.ToChar(5) + ribbon + Convert.ToChar(5) + colour;

            int newItemId;

            using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                //Insert the dummy item.
                dbClient.SetQuery("INSERT INTO `items` (`base_item`,`user_id`,`extra_data`) VALUES (@baseId, @habboId, @extra_data)");
                dbClient.AddParameter("baseId", presentData.Id);
                dbClient.AddParameter("habboId", habbo.Id);
                dbClient.AddParameter("extra_data", ed);
                newItemId = Convert.ToInt32(dbClient.InsertQuery());

                string itemExtraData = null;
                switch (item.Data.InteractionType)
                {
                case InteractionType.NONE:
                    itemExtraData = "";
                    break;

                    #region Pet handling

                case InteractionType.PET:

                    try
                    {
                        string[] bits    = data.Split('\n');
                        string   petName = bits[0];
                        string   race    = bits[1];
                        string   color   = bits[2];

                        if (PetUtility.CheckPetName(petName))
                        {
                            return;
                        }

                        if (race.Length > 2)
                        {
                            return;
                        }

                        if (color.Length != 6)
                        {
                            return;
                        }

                        PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_PetLover", 1);
                    }
                    catch
                    {
                        return;
                    }

                    break;

                    #endregion

                case InteractionType.FLOOR:
                case InteractionType.WALLPAPER:
                case InteractionType.LANDSCAPE:

                    double number = 0;
                    try
                    {
                        number = string.IsNullOrEmpty(data) ? 0 : double.Parse(data, PlusEnvironment.CultureInfo);
                    }
                    catch
                    {
                        //ignored
                    }

                    itemExtraData = number.ToString(CultureInfo.CurrentCulture).Replace(',', '.');
                    break;     // maintain extra data // todo: validate

                case InteractionType.POSTIT:
                    itemExtraData = "FFFF33";
                    break;

                case InteractionType.MOODLIGHT:
                    itemExtraData = "1,1,1,#000000,255";
                    break;

                case InteractionType.TROPHY:
                    itemExtraData = session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + Convert.ToChar(9) + data;
                    break;

                case InteractionType.MANNEQUIN:
                    itemExtraData = "m" + Convert.ToChar(5) + ".ch-210-1321.lg-285-92" + Convert.ToChar(5) + "Default Mannequin";
                    break;

                case InteractionType.BADGE_DISPLAY:
                    if (!session.GetHabbo().GetBadgeComponent().HasBadge(data))
                    {
                        session.SendPacket(new BroadcastMessageAlertComposer("Oops, it appears that you do not own this badge."));
                        return;
                    }

                    itemExtraData = data + Convert.ToChar(9) + session.GetHabbo().Username + Convert.ToChar(9) + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year;
                    break;

                default:
                    itemExtraData = data;
                    break;
                }

                //Insert the present, forever.
                dbClient.SetQuery("INSERT INTO `user_presents` (`item_id`,`base_id`,`extra_data`) VALUES (@itemId, @baseId, @extra_data)");
                dbClient.AddParameter("itemId", newItemId);
                dbClient.AddParameter("baseId", item.Data.Id);
                dbClient.AddParameter("extra_data", string.IsNullOrEmpty(itemExtraData) ? "" : itemExtraData);
                dbClient.RunQuery();

                //Here we're clearing up a record, this is dumb, but okay.
                dbClient.SetQuery("DELETE FROM `items` WHERE `id` = @deleteId LIMIT 1");
                dbClient.AddParameter("deleteId", newItemId);
                dbClient.RunQuery();
            }


            Item giveItem = ItemFactory.CreateGiftItem(presentData, habbo, ed, ed, newItemId);
            if (giveItem != null)
            {
                GameClient receiver = PlusEnvironment.GetGame().GetClientManager().GetClientByUserId(habbo.Id);
                if (receiver != null)
                {
                    receiver.GetHabbo().GetInventoryComponent().TryAddItem(giveItem);
                    receiver.SendPacket(new FurniListNotificationComposer(giveItem.Id, 1));
                    receiver.SendPacket(new PurchaseOKComposer());
                    receiver.SendPacket(new FurniListAddComposer(giveItem));
                    receiver.SendPacket(new FurniListUpdateComposer());
                }

                if (habbo.Id != session.GetHabbo().Id&& !string.IsNullOrWhiteSpace(giftMessage))
                {
                    PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(session, "ACH_GiftGiver", 1);
                    if (receiver != null)
                    {
                        PlusEnvironment.GetGame().GetAchievementManager().ProgressAchievement(receiver, "ACH_GiftReceiver", 1);
                    }
                    PlusEnvironment.GetGame().GetQuestManager().ProgressUserQuest(session, QuestType.GiftOthers);
                }
            }

            session.SendPacket(new PurchaseOKComposer(item, presentData));

            if (item.CostCredits > 0)
            {
                session.GetHabbo().Credits -= item.CostCredits;
                session.SendPacket(new CreditBalanceComposer(session.GetHabbo().Credits));
            }

            if (item.CostPixels > 0)
            {
                session.GetHabbo().Duckets -= item.CostPixels;
                session.SendPacket(new HabboActivityPointNotificationComposer(session.GetHabbo().Duckets, session.GetHabbo().Duckets));
            }

            session.GetHabbo().LastGiftPurchaseTime = DateTime.Now;
        }
Exemple #30
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (Session.GetHabbo().TimeMuted > 0)
            {
                Session.SendNotification("Oops, usted esta silenciado - no puede cambiar la mision.");
                return;
            }

            if ((DateTime.Now - Session.GetHabbo().LastMottoUpdateTime).TotalSeconds <= 2.0)
            {
                Session.GetHabbo().MottoUpdateWarnings += 1;
                if (Session.GetHabbo().MottoUpdateWarnings >= 25)
                {
                    Session.GetHabbo().SessionMottoBlocked = true;
                }
                return;
            }

            if (Session.GetHabbo().SessionMottoBlocked)
            {
                return;
            }

            Session.GetHabbo().LastMottoUpdateTime = DateTime.Now;

            string newMotto = StringCharFilter.Escape(Packet.PopString().Trim());

            if (newMotto.Length > 38)
            {
                newMotto = newMotto.Substring(0, 38);
            }

            if (newMotto == Session.GetHabbo().Motto)
            {
                return;
            }

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override"))
            {
                newMotto = RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(newMotto, out word) ? "Spam" : newMotto;
            }

            Session.GetHabbo().Motto = newMotto;

            using (IQueryAdapter dbClient = RavenEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("UPDATE `users` SET `motto` = @motto WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
                dbClient.AddParameter("motto", newMotto);
                dbClient.RunQuery();
            }

            RavenEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_MOTTO);
            RavenEnvironment.GetGame().GetAchievementManager().ProgressAchievement(Session, "ACH_Motto", 1);

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

                RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (User == null || User.GetClient() == null)
                {
                    return;
                }

                Room.SendMessage(new UserChangeComposer(User, false));
            }
        }