Пример #1
0
        protected void Load(GenericReader reader)
        {
            int version = reader.ReadInt();

            c_Mobiles   = reader.ReadMobileList();
            c_Filter    = reader.ReadBool();
            c_Delay     = reader.ReadBool();
            c_Name      = reader.ReadString();
            c_Style     = (ChatStyle)reader.ReadInt();
            c_ToIrc     = reader.ReadBool();
            c_NewChars  = reader.ReadBool();
            c_ShowStaff = reader.ReadBool();
            c_Enabled   = reader.ReadBool();

            int    count = reader.ReadInt();
            Mobile m;

            for (int i = 0; i < count; ++i)
            {
                m = reader.ReadMobile();
                if (m != null)
                {
                    c_Colors[m] = reader.ReadInt();
                }
                else
                {
                    reader.ReadInt();
                }
            }

            c_Commands.Clear();
            count = reader.ReadInt();
            for (int i = 0; i < count; ++i)
            {
                c_Commands.Add(reader.ReadString());
            }

            foreach (string str in c_Commands)
            {
                AddCommand(str);
            }

            ArrayList list = new ArrayList();

            foreach (Mobile mob in c_Mobiles)
            {
                if (!list.Contains(mob))
                {
                    list.Add(mob);
                }
            }

            c_Mobiles = new ArrayList(list);
        }
Пример #2
0
 /// <summary>
 /// Packet Type: 1004. This packet is sent to the client to display an in-game message from the server or from
 /// another player. It can also be used to direct the client during login to the world or to the character
 /// creation screen. Generic messages can be found in the class below this one (ServerMessages class).
 /// </summary>
 /// <param name="message">The message text being sent in the packet to the player.</param>
 /// <param name="tone">The tone of the message (where it is displayed in the client).</param>
 /// <param name="color">The hue of the message (default is white).</param>
 public MsgTalk(string message, ChatTone tone, Color color)
     : base(0)
 {
     Hue       = color;
     Tone      = tone;
     Style     = ChatStyle.NORMAL;
     Recipient = ALLUSERS;
     Sender    = SYSTEM;
     Suffix    = "";
     Message   = message;
 }
Пример #3
0
 public static void SendThrottle(Players.Player player, localization.LocalizationHelper localizationHelper, string message, ChatColor color = ChatColor.white,
                                 ChatStyle style         = ChatStyle.normal,
                                 EChatSendOptions sender = EChatSendOptions.Default)
 {
     if (CanSendMesssage(player))
     {
         var messageBuilt = BuildMessage(message, player, localizationHelper, color, style);
         Chat.Send(player, messageBuilt, sender);
         _nextSendTime[player] = Time.SecondsSinceStartDouble + 10;
     }
 }
Пример #4
0
 public static void Send(Players.Player player, localization.LocalizationHelper localizationHelper,
                         string message,
                         ChatColor color         = ChatColor.white,
                         ChatStyle style         = ChatStyle.normal,
                         EChatSendOptions sender = EChatSendOptions.Default)
 {
     if (player.IsConnected())
     {
         var messageBuilt = BuildMessage(message, player, localizationHelper, color, style);
         Chat.Send(player, messageBuilt, sender);
     }
 }
Пример #5
0
 public static void Send(ColonyState colony,
                         localization.LocalizationHelper localizationHelper,
                         string message,
                         ChatColor color = ChatColor.white,
                         ChatStyle style = ChatStyle.normal, EChatSendOptions sender = EChatSendOptions.Default)
 {
     colony.ColonyRef.ForEachOwner(p => {
         if (p.IsConnected())
         {
             var messageBuilt = BuildMessage(colony.ColonyRef.Name + ": " + localizationHelper.LocalizeOrDefault(message, p), p, localizationHelper, color, style);
             Chat.Send(p, messageBuilt, sender);
         }
     });
 }
Пример #6
0
 public static void SendToAll(string message,
                              localization.LocalizationHelper localizationHelper,
                              ChatColor color         = ChatColor.white,
                              ChatStyle style         = ChatStyle.normal,
                              EChatSendOptions sender = EChatSendOptions.Default)
 {
     foreach (var p in Players.PlayerDatabase.Values)
     {
         if (p.IsConnected())
         {
             var messageBuilt = BuildMessage(message, p, localizationHelper, color, style);
             Chat.Send(p, messageBuilt, sender);
         }
     }
 }
Пример #7
0
        public string Message;      // The text for the message, what is sent in the message.
        // Notes about the packet: The message id can be the client id, or the current hour * 100 + the current
        // minute ((now.Hour * 100) + now.Minute). The suffix can be the date an offline message was sent on.

        /// <summary>
        /// Packet Type: 1004. This packet is sent to the client to display an in-game message from the server or from
        /// another player. It can also be used to direct the client during login to the world or to the character
        /// creation screen. Generic messages can be found in the class below this one (ServerMessages class).
        /// </summary>
        /// <param name="receivedPacket">The received packet from the server's packet handler.</param>
        public MsgTalk(byte[] receivedPacket)
            : base(receivedPacket)
        {
            // Read in normal data values:
            Hue           = Color.FromArgb(ReadInt(4));
            Tone          = (ChatTone)ReadUShort(8);
            Style         = (ChatStyle)ReadUShort(10);
            Identity      = ReadUInt(12);
            RecipientMesh = ReadUInt(16);
            SenderMesh    = ReadUInt(20);

            // Read in strings:
            Sender    = ReadString(ReadByte(25), 26);
            Recipient = ReadString(ReadByte(26 + Sender.Length), 27 + Sender.Length);
            Suffix    = ReadString(ReadByte(27 + Sender.Length + Recipient.Length), 28 + Sender.Length + Recipient.Length);
            Message   = ReadString(ReadByte(28 + Sender.Length + Recipient.Length + Suffix.Length), 29 + Sender.Length + Recipient.Length + Suffix.Length);
        }
Пример #8
0
        public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params)
        {
            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oh, esqueceu-se de introduzir um ID!");
                return;
            }

            int Bubble = 0;

            if (!int.TryParse(Params[1].ToString(), out Bubble))
            {
                Session.SendWhisper("Por favor ultilize um número valido.");
                return;
            }

            if ((Bubble == 33) && !Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                Session.LogsNotif("Desculpe, apenas os membros da equipe podem usar essas falas", "command_notification");
                return;
            }

            ChatStyle Style = null;

            if (!CloudServer.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Bubble, out Style) || (Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight)))
            {
                Session.SendWhisper("Bem, você não pode usar esta fala por causa do seu cargo, sorry!");
                return;
            }

            User.LastBubble = Bubble;
            Session.GetHabbo().CustomBubbleId = Bubble;
            Session.SendWhisper("bolha estabelecida: " + Bubble);
            using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.runFastQuery("UPDATE `users` SET `bubble_id` = '" + Bubble + "' WHERE `id` = '" + Session.GetHabbo().Id + "' LIMIT 1");
            }
        }
Пример #9
0
        public void Execute(GameClient Session, Room Room, string[] Params)
        {
            var User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null)
            {
                return;
            }

            if (Params.Length == 1)
            {
                Session.SendWhisper("Oops, you forgot to enter a bubble ID!");
                return;
            }

            var Bubble = 0;

            if (!int.TryParse(Params[1], out Bubble))
            {
                Session.SendWhisper("Please enter a valid number.");
                return;
            }

            ChatStyle Style = null;

            if (!PlusEnvironment.GetGame().GetChatManager().GetChatStyles().TryGetStyle(Bubble, out Style) ||
                Style.RequiredRight.Length > 0 && !Session.GetHabbo().GetPermissions().HasRight(Style.RequiredRight))
            {
                Session.SendWhisper("Oops, you cannot use this bubble due to a rank requirement, sorry!");
                return;
            }

            User.LastBubble = Bubble;
            Session.GetHabbo().CustomBubbleId = Bubble;
            Session.SendWhisper("Bubble set to: " + Bubble);
        }
Пример #10
0
 public static void SendThrottle(Players.Player ply, string message, ChatColor color = ChatColor.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server)
 {
     if (CanSendMesssage(ply))
     {
         string messageBuilt = BuildMessage(message, color, style);
         Pipliz.Chatting.Chat.Send(ply, messageBuilt, sender);
         _nextSendTime[ply] = Time.SecondsSinceStartDouble + 10;
     }
 }
Пример #11
0
        protected void Load(GenericReader reader)
        {
            int version = reader.ReadInt();

            c_Mobiles = reader.ReadMobileList();
            c_Filter = reader.ReadBool();
            c_Delay = reader.ReadBool();
            c_Name = reader.ReadString();
            c_Style = (ChatStyle)reader.ReadInt();
            c_ToIrc = reader.ReadBool();
            c_NewChars = reader.ReadBool();
            c_ShowStaff = reader.ReadBool();
            c_Enabled = reader.ReadBool();

            int count = reader.ReadInt();
            Mobile m;
            for (int i = 0; i < count; ++i)
            {
                m = reader.ReadMobile();
                if (m != null)
                    c_Colors[m] = reader.ReadInt();
                else
                    reader.ReadInt();
            }

            c_Commands.Clear();
            count = reader.ReadInt();
            for (int i = 0; i < count; ++i)
                c_Commands.Add(reader.ReadString());

            foreach (string str in c_Commands)
                AddCommand(str);

            ArrayList list = new ArrayList();
            foreach(Mobile mob in c_Mobiles)
                if (!list.Contains(mob))
                    list.Add(mob);

            c_Mobiles = new ArrayList(list);
        }
Пример #12
0
        //--//ȠoChat//--//
        //--//User1@1234~18-55-01-19-06-2018~What?//--//
        //--//18-55-01> ( User1 ) What? Visible//--//
        //--//1234 + 19-06-2018 Hidden//--//
        public string ReadChat(string address, ChatStyle style)
        {
            _readedtext = "";
            try
            {
                WebClient client   = new WebClient();
                string    rawReply = client.DownloadString(address);

                replies = rawReply.Replace("\r\n", "▪").Split('▪');
                bool   noComment = false;
                string newreply  = "";
                string token     = "";
                foreach (string reply in replies)
                {
                    newreply = reply;

                    //Comment Filter
                    foreach (char r in newreply)
                    {
                        noComment = r == '#' ? false : true;
                        break;
                    }

                    //Filter
                    int nextint = 0;
                    int currint = 0;
                    foreach (char r in newreply)
                    {
                        currint++;
                        nextint--;
                        if (r == '@')
                        {
                            token    = newreply.Substring(currint, 4);
                            newreply = newreply.Remove(currint - 1, 5);
                            nextint  = 8;
                        }
                        if (nextint == 0)
                        {
                            newreply = newreply.Remove(currint - 1, 11);
                        }
                    }
                    if (noComment == true)
                    {
                        string[] replywords = newreply.Replace("-", ":").Split('~');
                        //ALL
                        string originreplyALL = replywords[1] + "> ( " + replywords[0] + "#" + token + " ) " + replywords[2];
                        //IRC
                        string originreplyIRC = replywords[1] + "> ( " + replywords[0] + " ) " + replywords[2];
                        //Modern
                        string originreply = replywords[0] + "> " + replywords[2];
                        if (style == ChatStyle.ALL)
                        {
                            _readedtext += "\r\n" + originreplyALL;
                        }
                        else if (style == ChatStyle.IRC)
                        {
                            _readedtext += "\r\n" + originreplyIRC;
                        }
                        else
                        {
                            _readedtext += "\r\n" + originreply;
                        }
                    }
                    //throw new OutOfMemoryException();
                }
                return(_readedtext);
            }
            catch (Exception ex)
            {
                msgBox.main.Text = ex.ToString();
                msgBox.Title     = ex.Message;
                msgBox.Show();
                return("Error! New request in few seconds...");
                //throw ex;
            }
        }
Пример #13
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

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

            string Params  = Packet.PopString();
            string ToUser  = Params.Split(' ')[0];
            string Message = Params.Substring(ToUser.Length + 1);
            int    Colour  = Packet.PopInt();

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

            if (User == null)
            {
                return;
            }

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);

            if (User2 == null)
            {
                return;
            }

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

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

            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 (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (!User2.GetClient().GetHabbo().ReceiveWhispers&& !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
            {
                Session.SendWhisper("Oops, this user has their whispers disabled!");
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Plus.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, "<Whisper to " + ToUser + ">: " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            Room.AddChatlog(Session.GetHabbo().Id, "<Whisper to " + ToUser + ">: " + Message);

            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 WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                return;
            }


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

            User.UnIdle();
            User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));

            if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                {
                    User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                }
            }

            List <RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(2);

            if (ToNotify.Count > 0)
            {
                foreach (RoomUser user in ToNotify)
                {
                    if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                    {
                        if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers)
                        {
                            user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Whisper to " + ToUser + "] " + Message, 0, User.LastBubble));
                        }
                    }
                }
            }
        }
Пример #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 (!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);
        }
Пример #15
0
        public static void sendToAllBut(Players.Player n, string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server)
        {
            string messageBuilt = buildMessage(message, colour, style);

            Pipliz.Chatting.Chat.SendToAllBut(n, messageBuilt, sender);
        }
Пример #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;
            }

            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);
            }
        }
Пример #17
0
        public static void sendAllSilent(string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server)
        {
            ChatSenderType type         = ChatSenderType.Server;
            string         messageBuilt = buildMessage(message, colour, style);


            using (ByteBuilder byteBuilder = ByteBuilder.Get())
            {
                byteBuilder.Write((ushort)ClientMessageType.Chat);
                byteBuilder.Write((byte)type);
                byteBuilder.Write(messageBuilt);
                Players.SendToAll(byteBuilder.ToArray(), NetworkMessageReliability.ReliableWithBuffering);
            }
        }
Пример #18
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);
                    }
                }
            }
        }
Пример #19
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.GetHabbo().Rank > 3 && !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;
            }

            ChatStyle Style = null;

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

            User.UnIdle();

            if (RavenEnvironment.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.");
                return;
            }

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

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

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

            Room.GetFilter().CheckMessage(Message);

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

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

            RavenEnvironment.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") &&
                RavenEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out 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");

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

                    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));

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

                        RavenEnvironment.GetGame().GetModerationManager().BanUser("System", HabboHotel.Moderation.ModerationBanType.USERNAME, Session.GetHabbo().Username, "Baneado por hacer Spam con la Frase (" + word + ")", (RavenEnvironment.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;

            RavenEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Session, QuestType.SOCIAL_CHAT);
            User.OnChat(User.LastBubble, Message, false);
        }
Пример #20
0
        public static void sendSilent(Players.Player player, string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server)
        {
            ChatSenderType type = ChatSenderType.Server;

            if (!(player.ID == NetworkID.Server))
            {
                string messageBuilt = buildMessage(message, colour, style);

                using (ByteBuilder byteBuilder = ByteBuilder.Get())
                {
                    byteBuilder.Write((ushort)ClientMessageType.Chat);
                    byteBuilder.Write((byte)type);
                    byteBuilder.Write(messageBuilt);
                    NetworkWrapper.Send(byteBuilder.ToArray(), player, NetworkMessageReliability.ReliableWithBuffering);
                }
            }
            //send(player, message, colour, style, sender);
        }
Пример #21
0
        public void Parse(GameClient session, ClientPacket packet)
        {
            if (session == null || session.GetHabbo() == null || !session.GetHabbo().InRoom)
            {
                return;
            }

            var room = session.GetHabbo().CurrentRoom;

            if (room == null)
            {
                return;
            }

            var user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);

            if (user == null)
            {
                return;
            }

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

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

            var 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.SendPacket(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.SendPacket(new FloodControlComposer(muteTime));
                    return;
                }
            }

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

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

            if (PlusEnvironment.GetGame().GetChatManager().GetFilter().CheckBannedWords(message))
            {
                session.GetHabbo().BannedPhraseCount++;
                if (session.GetHabbo().BannedPhraseCount >= Convert.ToInt32(PlusEnvironment.GetSettingsManager().TryGetValue("room.chat.filter.banned_phrases.chances")))
                {
                    PlusEnvironment.GetGame().GetModerationManager().BanUser("System", ModerationBanType.Username, session.GetHabbo().Username,
                                                                             "Spamming banned phrases (" + message + ")", PlusEnvironment.GetUnixTimestamp() + 78892200);
                    session.Disconnect();
                    return;
                }

                session.SendPacket(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.SocialChat);

            user.OnChat(user.LastBubble, message, false);
        }
Пример #22
0
 public static void SendThrottle(ColonyState colony, localization.LocalizationHelper localizationHelper, string message, ChatColor color = ChatColor.white,
                                 ChatStyle style         = ChatStyle.normal,
                                 EChatSendOptions sender = EChatSendOptions.Default)
 {
     colony.ColonyRef.ForEachOwner(o => SendThrottle(o, localizationHelper, message, color, style, sender));
 }
Пример #23
0
        public static void SendToAll(string message, ChatColor color = ChatColor.white, ChatStyle style = ChatStyle.normal, Pipliz.Chatting.ChatSenderType sender = Pipliz.Chatting.ChatSenderType.Server)
        {
            string messageBuilt = BuildMessage(message, color, style);

            Pipliz.Chatting.Chat.SendToAll(messageBuilt, sender);
        }
Пример #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;
            }

            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);
            }
        }
Пример #25
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

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

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

            if (Session.LoggingOut)
            {
                return;
            }

            string[] Params = Packet.PopString().Split(' ');

            if (Params.Length < 2)
            {
                return;
            }

            string ToUser  = Params[0];
            string Message = CommandManager.MergeParams(Params, 1);

            int Colour = Packet.PopInt();

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

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

            if (User == null)
            {
                return;
            }

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);

            if (User2 == null)
            {
                return;
            }

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

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

            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 (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (!User2.GetClient().GetHabbo().ReceiveWhispers&& !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
            {
                Session.SendWhisper("Opa, este usuário desativou os sussurros!", 1);
                return;
            }

            PlusEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Plus.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, "<Sussurro para " + ToUser + ">: " + 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("Perigo!", "Por favor, abstenha de anunciar outros sites que não são endossados, 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ê ficou mudo!", "Desculpe, mas você foi automaticamente mutado 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 cidadão já recebeu uma advertência " + Phrase + ".", Messages);
                        return;
                    }

                    return;
                }
            }

            if (Session.GetRoleplay() != null)
            {
                if (!Session.GetRoleplay().IsWorking)
                {
                    User.UnIdle();
                }
            }
            else
            {
                User.UnIdle();
            }

            User.SendNameColourPacket();
            if (Session.GetRoleplay() != null)
            {
                if (User.GetClient().GetRoleplay().IsWorking&& HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide"))
                {
                    if (User.GetClient().GetHabbo().Translating)
                    {
                        string LG1 = User.GetClient().GetHabbo().FromLanguage.ToLower();
                        string LG2 = User.GetClient().GetHabbo().ToLanguage.ToLower();

                        User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", 0, 37));
                    }
                    else
                    {
                        User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, 37));
                    }
                }
                else
                {
                    if (User.GetClient().GetHabbo().Translating)
                    {
                        string LG1 = User.GetClient().GetHabbo().FromLanguage.ToLower();
                        string LG2 = User.GetClient().GetHabbo().ToLanguage.ToLower();

                        User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", 0, User.LastBubble));
                    }
                    else
                    {
                        User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                    }
                }
            }
            else
            {
                if (User.GetClient().GetHabbo().Translating)
                {
                    string LG1 = User.GetClient().GetHabbo().FromLanguage.ToLower();
                    string LG2 = User.GetClient().GetHabbo().ToLanguage.ToLower();

                    User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", 0, User.LastBubble));
                }
                else
                {
                    User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                }
            }

            if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                {
                    if (User.GetClient().GetHabbo().Translating)
                    {
                        string LG1 = User.GetClient().GetHabbo().FromLanguage.ToLower();
                        string LG2 = User.GetClient().GetHabbo().ToLanguage.ToLower();

                        User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", 0, User.LastBubble));
                    }
                    else
                    {
                        User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                    }
                }
            }

            List <RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserBySpecialRights();

            if (ToNotify.Count > 0)
            {
                foreach (RoomUser user in ToNotify)
                {
                    if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                    {
                        if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers)
                        {
                            if (User.GetClient().GetHabbo().Translating)
                            {
                                string LG1 = User.GetClient().GetHabbo().FromLanguage.ToLower();
                                string LG2 = User.GetClient().GetHabbo().ToLanguage.ToLower();

                                user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Sussurro para " + ToUser + "] " + PlusEnvironment.TranslateText(Message, LG1 + "|" + LG2) + " [" + LG1.ToUpper() + " -> " + LG2.ToUpper() + "]", 0, User.LastBubble));
                            }
                            else
                            {
                                user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Sussurro para " + ToUser + "] " + Message, 0, User.LastBubble));
                            }
                        }
                    }
                }
            }
            User.SendNamePacket();
        }
Пример #26
0
        public static string buildMessage(string message, ChatColour colour = ChatColour.white, ChatStyle style = ChatStyle.normal)
        {
            string colorPrefix = "<color=" + colour.ToString() + ">";
            string colorSuffix = "</color>";
            string stylePrefix, styleSuffix;

            switch (style)
            {
            case ChatStyle.bold:
                stylePrefix = "<b>";
                styleSuffix = "</b>";
                break;

            case ChatStyle.bolditalic:
                stylePrefix = "<b><i>";
                styleSuffix = "</i></b>";
                break;

            case ChatStyle.italic:
                stylePrefix = "<i>";
                styleSuffix = "</i>";
                break;

            default:
                stylePrefix = "";
                styleSuffix = "";
                break;
            }

            return(stylePrefix + colorPrefix + message + colorSuffix + styleSuffix);
        }
Пример #27
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Bem, atualmente voce esta  mutado.");
                return;
            }

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

            string Params  = Packet.PopString();
            string ToUser  = Params.Split(' ')[0];
            string Message = Params.Substring(ToUser.Length + 1);
            int    Colour  = Packet.PopInt();

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

            if (User == null)
            {
                return;
            }

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);

            if (User2 == null)
            {
                return;
            }

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

            ChatStyle Style = null;

            if (!CloudServer.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 (!Session.GetHabbo().GetPermissions().HasRight("mod_tool"))
            {
                int MuteTime;
                if (User.IncrementAndCheckFlood(out MuteTime))
                {
                    Session.SendMessage(new FloodControlComposer(MuteTime));
                    return;
                }
            }

            if (!User2.GetClient().GetHabbo().ReceiveWhispers&& !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
            {
                Session.SendWhisper("Bem, este usuário desativou seus sussurros!");
                return;
            }

            CloudServer.GetGame().GetChatManager().GetLogs().StoreChatlog(new ChatlogEntry(Session.GetHabbo().Id, Room.Id, "<Susurra a " + ToUser + ">: " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                CloudServer.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word))
            {
                Session.GetHabbo().BannedPhraseCount++;
                if (Session.GetHabbo().BannedPhraseCount >= 1)
                {
                    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>");
                    CloudServer.GetGame().GetClientManager().StaffAlert(new RoomNotificationComposer("Alerta de divulgação:",
                                                                                                     "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 >= 3)
                {
                    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 WhisperComposer(User.VirtualId, "Palavra Inapropriada.", 0, User.LastBubble));
                return;
            }

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

            User.UnIdle();
            User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));

            if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                {
                    User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                }
            }

            List <RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(2);

            if (ToNotify.Count > 0)
            {
                foreach (RoomUser user in ToNotify)
                {
                    if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                    {
                        if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers)
                        {
                            user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Susurra a " + ToUser + "] " + Message, 0, User.LastBubble));
                        }
                    }
                }
            }
        }
Пример #28
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);
        }
Пример #29
0
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;

            if (Room == null)
            {
                return;
            }

            if (!Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Room.CheckMute(Session))
            {
                Session.SendWhisper("Oeps! Je hebt een spreekverbod.");
                return;
            }

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

            string Params  = Packet.PopString();
            string ToUser  = Params.Split(' ')[0];
            string Message = Params.Substring(ToUser.Length + 1);
            int    Colour  = Packet.PopInt();

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

            if (User == null)
            {
                return;
            }

            RoomUser User2 = Room.GetRoomUserManager().GetRoomUserByHabbo(ToUser);

            if (User2 == null)
            {
                return;
            }

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

            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.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 (!User2.GetClient().GetHabbo().ReceiveWhispers&& !Session.GetHabbo().GetPermissions().HasRight("room_whisper_override"))
            {
                Session.SendWhisper("Oeps! Je hebt niet de bevoegdheid om deze actie uit te voeren.");
                return;
            }

            QuasarEnvironment.GetGame().GetChatManager().GetLogs().StoreChatlog(new Quasar.HabboHotel.Rooms.Chat.Logs.ChatlogEntry(Session.GetHabbo().Id, Room.Id, ": " + Message, UnixTimestamp.GetNow(), Session.GetHabbo(), Room));

            Room.AddChatlog(Session.GetHabbo().Id, ": " + Message);

            string word;

            if (!Session.GetHabbo().GetPermissions().HasRight("word_filter_override") &&
                QuasarEnvironment.GetGame().GetChatManager().GetFilter().IsUnnaceptableWord(Message, out word))
            {
                Room _room = QuasarEnvironment.GetGame().GetRoomManager().LoadRoom(2);
                Session.GetHabbo().PrepareRoom(_room.Id, "2");
                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: Chatconsole", ""));
                return;
            }

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

            User.UnIdle();
            User.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));

            if (User2 != null && !User2.IsBot && User2.UserId != User.UserId)
            {
                if (!User2.GetClient().GetHabbo().MutedUsers.Contains(Session.GetHabbo().Id))
                {
                    User2.GetClient().SendMessage(new WhisperComposer(User.VirtualId, Message, 0, User.LastBubble));
                }
            }

            List <RoomUser> ToNotify = Room.GetRoomUserManager().GetRoomUserByRank(5);

            if (ToNotify.Count > 0)
            {
                foreach (RoomUser user in ToNotify)
                {
                    if (user != null && user.HabboId != User2.HabboId && user.HabboId != User.HabboId)
                    {
                        if (user.GetClient() != null && user.GetClient().GetHabbo() != null && !user.GetClient().GetHabbo().IgnorePublicWhispers)
                        {
                            user.GetClient().SendMessage(new WhisperComposer(User.VirtualId, "[Fluistert naar " + ToUser + "] " + Message, 0, User.LastBubble));
                        }
                    }
                }
            }
        }
Пример #30
0
        public void SyncSettings()
        {
            Badge.Clear(badge);
            //Value from CheckBoxes saved to varable
            devMode = CheckBoxEDO.IsChecked == true ? true : false;

            //Change or Reload Theme
            ChangeTheme();

            //Developer Mode Features
            if (devMode)
            {
                titlebar.Text           = "Fliht Messenger --Version {version} --Debug";
                resizeShadow.Visibility = Visibility.Visible;
                resizeButton.Visibility = Visibility.Visible;
            }
            else
            {
                titlebar.Text           = "Fliht Messenger";
                resizeShadow.Visibility = Visibility.Collapsed;
                resizeButton.Visibility = Visibility.Collapsed;
            }

            //Setting Nickname
            if (NickBox.Text != "")
            {
                user.username  = NickBox.Text;
                user.usertoken = rand.Next(1853, 9364).ToString();
            }
            else
            {
                user.username  = "******" + rand.Next(1853, 9364);
                user.usertoken = rand.Next(1000, 9999).ToString();
            }

            //Address Checking
            try
            {
                if (AddressBox.Text != "")
                {
                    Uri addressUri = new Uri(AddressBox.Text);
                    address = addressUri.ToString();

                    AddressInfoBlock.Foreground = Brushes.Green;
                    AddressInfoBlock.Text       = "Address successfully changed!";
                }
                else
                {
                    AddressInfoBlock.Foreground = currentTheme == ThemeType.Dark ? Brushes.White : Brushes.Black;
                    AddressInfoBlock.Text       = "Server addres is empty. Default: \"http://127.0.0.1/Server\"";
                }
            }
            catch (UriFormatException)
            {
                AddressInfoBlock.Foreground = Brushes.Red;
                AddressInfoBlock.Text       = "Url Format Are wrong! ex. http(s)://example.com";
            }
            catch (Exception)
            {
                AddressInfoBlock.Text = "Unknown Error!";
            }

            //Chat Mode Changing
            currChatMode = MmTb.IsChecked == true ? ChatStyle.Modern : MiTb.IsChecked == true ? ChatStyle.IRC : ChatStyle.ALL;

            //Chat Reading Time Changing
            currentTimeSpan = RefreshTimeBox.SelectedItem != null?int.Parse(((ComboBoxItem)RefreshTimeBox.SelectedItem).Tag.ToString()) : 1600;

            InitCombobox(RefreshTimeBox.SelectedIndex);

            //Setting Address
            reader.ChangeAddress(address);
            sender.ChangeAddress(address);

            byte utheme = 0x0000;

            switch (currentTheme)
            {
            case ThemeType.Light:
                utheme = 0x0001;
                break;

            case ThemeType.Window:
                utheme = 0x0002;
                break;

            case ThemeType.Dark:
                utheme = 0x0003;
                break;

            case ThemeType.FlatDark:
                utheme = 0x0004;
                break;
            }

            //Saving Values
            byte[] savedBytes =
            {
                utheme,
                devMode ? (byte)0x0001 : (byte)0x0000,
                currChatMode == ChatStyle.Modern ? (byte)0x0000 : currChatMode == ChatStyle.IRC ? (byte)0x0001 : (byte)0x0002
            };
            File.WriteAllBytes(datafolder + "\\user.profile", savedBytes);
            File.WriteAllText(datafolder + "\\addresses.dat", Base64.Encode(address));
        }
Пример #31
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);
        }