Exemplo n.º 1
0
        public ServerMessage Handle(T handler)
        {
            ServerMessage message = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486, r63cOutgoing.ReceiveWhisper);

            message.AppendInt32(handler.SenderVirtualID);

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

            if (TextUtilies.ContainsLink(handler.Message))
            {
                string message_ = "";
                foreach (string word in handler.Message.Split(' '))
                {
                    if (TextUtilies.ValidURL(word))
                    {
                        links.Add(word);

                        message_ += " {" + (links.Count - 1) + "}";
                    }
                    else
                    {
                        message_ += " " + word;
                    }
                }

                message.AppendString(message_);
            }
            else
            {
                message.AppendString(handler.Message);
            }

            message.AppendInt32(RoomUnit.GetGesture(handler.Message));
            message.AppendInt32(handler.ChatColor);
            message.AppendInt32(links.Count);
            for (int i = 0; i < links.Count; i++)
            {
                string link = links[i];

                message.AppendString("/redirect.php?url=" + link); //link
                message.AppendString(link);                        //msg shown
                message.AppendBoolean(true);                       //trusted, can be clicked and opened, unused
            }
            message.AppendInt32(-1);
            return(message);
        }
Exemplo n.º 2
0
        public override void Speak(string message, bool shout, int bubble = 0)
        {
            ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);

            if (shout)
            {
                Message.Init(r63aOutgoing.Shout);
            }
            else
            {
                Message.Init(r63aOutgoing.Say);
            }
            Message.AppendInt32(this.VirtualID);
            Message.AppendString(message);
            Message.AppendInt32(RoomUnit.GetGesture(message));
            Message.AppendInt32(0); //links count
            Message.AppendInt32(0); //unknown
            this.Room.SendToAll(Message);
        }
Exemplo n.º 3
0
        public ServerMessage Handle(ValueHolder valueHolder = null)
        {
            string message = valueHolder.GetValue <string>("Message");

            ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.PRODUCTION_201601012205_226667486);

            Message.Init(r63cOutgoing.Shout);
            Message.AppendInt32(valueHolder.GetValue <int>("VirtualID"));
            Dictionary <int, string> links = new Dictionary <int, string>();

            if (message.Contains("http://") || message.Contains("www.") || message.Contains("https://"))
            {
                string[] words = message.Split(' ');
                message = "";

                foreach (string word in words)
                {
                    if (TextUtilies.ValidURL(word))
                    {
                        int index = links.Count;
                        links.Add(index, word);

                        message += " {" + index + "}";
                    }
                    else
                    {
                        message += " " + word;
                    }
                }
            }
            Message.AppendString(message);
            Message.AppendInt32(RoomUnit.GetGesture(message.ToLower()));
            Message.AppendInt32(valueHolder.GetValueOrDefault <int>("Bubble"));
            Message.AppendInt32(links.Count); //links count
            foreach (KeyValuePair <int, string> link in links)
            {
                Message.AppendString("/redirect.php?url=" + link.Value);
                Message.AppendString(link.Value);
                Message.AppendBoolean(true); //trushed, can link be opened
            }
            Message.AppendInt32(-1);         //unknown
            return(Message);
        }
Exemplo n.º 4
0
        public override bool OnUse(GameClient session, string[] args)
        {
            if (session.GetHabbo().IsJonny)
            {
                try
                {
                    if (args.Length >= 2)
                    {
                        switch (args[1])
                        {
                        case "pickall":
                        {
                            GameClient target = null;
                            if (args.Length >= 3)
                            {
                                target = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(args[2]);
                            }

                            foreach (RoomItem item in target == null ? session.GetHabbo().GetRoomSession().GetRoom().RoomItemManager.GetFloorItems() : target.GetHabbo().GetRoomSession().GetRoom().RoomItemManager.GetFloorItems())
                            {
                                ServerMessage FloorItemRemoved = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                FloorItemRemoved.Init(r63aOutgoing.RemoveFloorItemFromRoom);
                                FloorItemRemoved.AppendString(item.ID.ToString());
                                FloorItemRemoved.AppendInt32(0);

                                if (target != null)
                                {
                                    target.SendMessage(FloorItemRemoved);
                                }
                                else
                                {
                                    session.GetHabbo().GetRoomSession().GetRoom().SendToAll(FloorItemRemoved);
                                }
                            }

                            foreach (RoomItem item in target == null ? session.GetHabbo().GetRoomSession().GetRoom().RoomItemManager.GetWallItems() : target.GetHabbo().GetRoomSession().GetRoom().RoomItemManager.GetFloorItems())
                            {
                                ServerMessage WallItemRemoved = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                WallItemRemoved.Init(r63aOutgoing.RemoveWallItemFromRoom);
                                WallItemRemoved.AppendString(item.ID.ToString());
                                WallItemRemoved.AppendInt32(0);

                                if (target != null)
                                {
                                    target.SendMessage(WallItemRemoved);
                                }
                                else
                                {
                                    session.GetHabbo().GetRoomSession().GetRoom().SendToAll(WallItemRemoved);
                                }
                            }
                        }
                        break;

                        case "say":
                        {
                            if (args.Length >= 5)
                            {
                                GameClient target = Skylight.GetGame().GetGameClientManager().GetGameClientByUsername(args[3]);
                                if (target != null)
                                {
                                    string        message = TextUtilies.MergeArrayToString(args, 4);
                                    ServerMessage Message = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                    Message.Init(r63aOutgoing.Say);
                                    Message.AppendInt32(target.GetHabbo().GetRoomSession().GetRoomUser().VirtualID);

                                    Dictionary <int, string> links = new Dictionary <int, string>();
                                    if (message.Contains("http://") || message.Contains("www.") || message.Contains("https://"))
                                    {
                                        string[] words = message.Split(' ');
                                        message = "";

                                        foreach (string word in words)
                                        {
                                            if (TextUtilies.ValidURL(word))
                                            {
                                                int index = links.Count;
                                                links.Add(index, word);

                                                message += " {" + index + "}";
                                            }
                                            else
                                            {
                                                message += " " + word;
                                            }
                                        }
                                    }
                                    Message.AppendString(message);
                                    Message.AppendInt32(RoomUnit.GetGesture(message.ToLower()));
                                    Message.AppendInt32(links.Count);         //links count
                                    foreach (KeyValuePair <int, string> link in links)
                                    {
                                        Message.AppendString("/redirect.php?url=" + link.Value);
                                        Message.AppendString(link.Value);
                                        Message.AppendBoolean(true); //trushed, can link be opened
                                    }
                                    Message.AppendInt32(0);          //unknown

                                    int amount = int.Parse(args[2]);
                                    for (int i = 0; i < amount; i++)
                                    {
                                        target.SendMessage(Message);
                                    }
                                }
                            }
                        }
                        break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    session.SendNotif(ex.ToString());
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        public void Handle(GameClient session, ClientMessage message)
        {
            Room room = session.GetHabbo().GetRoomSession().GetRoom();

            if (room != null)
            {
                if (!session.GetHabbo().GetRoomSession().GetRoom().RoomMute || session.GetHabbo().HasPermission("acc_ignore_roommute"))
                {
                    if (!session.GetHabbo().IsMuted())
                    {
                        session.GetHabbo().GetRoomSession().GetRoomUser().Unidle();

                        if (session.GetHabbo().GetRoomSession().GetRoomUser().CheckForFloor())
                        {
                            session.GetHabbo().GetRoomSession().GetRoomUser().FloodUser();
                        }
                        else
                        {
                            session.GetHabbo().LastRoomMessage = DateTime.Now;
                            session.GetHabbo().FloodCounter++;

                            string[] data     = message.PopFixedString().Split(new char[] { ' ' }, 2);
                            string   username = data[0];
                            string   message_ = data[1];
                            if (message_.Length > 300)
                            {
                                message_ = message_.Substring(0, 300);
                            }
                            message_ = TextUtilies.FilterString(message_);

                            RoomUnitUser user = room.RoomUserManager.GetUserByName(username);
                            if (user != null)
                            {
                                if (!session.GetHabbo().HasPermission("acc_nochatlog_whisper"))
                                {
                                    Skylight.GetGame().GetChatlogManager().LogRoomMessage(session, "Whisper" + (char)9 + user.Session.GetHabbo().ID + (char)9 + message_);
                                }

                                message_ = TextUtilies.CheckBlacklistedWords(message_);

                                ServerMessage message_2 = BasicUtilies.GetRevisionServerMessage(Revision.RELEASE63_35255_34886_201108111108);
                                message_2.Init(r63aOutgoing.Whisper);
                                message_2.AppendInt32(session.GetHabbo().GetRoomSession().GetRoomUser().VirtualID);

                                Dictionary <int, string> links = new Dictionary <int, string>();
                                if (message_.Contains("http://") || message_.Contains("www.") || message_.Contains("https://"))
                                {
                                    string[] words = message_.Split(' ');
                                    message_ = "";

                                    foreach (string word in words)
                                    {
                                        if (TextUtilies.ValidURL(word))
                                        {
                                            int index = links.Count;
                                            links.Add(index, word);

                                            message_ += " {" + index + "}";
                                        }
                                        else
                                        {
                                            message_ += " " + word;
                                        }
                                    }
                                }
                                message_2.AppendString(message_);
                                message_2.AppendInt32(RoomUnit.GetGesture(message_.ToLower())); //gesture
                                message_2.AppendInt32(links.Count);                             //links count
                                foreach (KeyValuePair <int, string> link in links)
                                {
                                    message_2.AppendString("/redirect.php?url=" + link.Value);
                                    message_2.AppendString(link.Value);
                                    message_2.AppendBoolean(true); //trushed, can link be opened
                                }
                                user.Session.SendMessage(message_2);
                                session.SendMessage(message_2);
                            }
                        }
                    }
                }
            }
        }