Ejemplo n.º 1
0
        public override void OnResponse(Mobile from, string text)
        {
            text = text.Trim();
            if (text.Length > 0 && m_From != null && m_To != null)
            {
                FriendSystem.Tell(m_From, m_To, text);
            }

            from.SendGump(new FriendListGump(m_From));
        }
Ejemplo n.º 2
0
        private static void FTell_OnCommand(CommandEventArgs e)
        {
            string args       = e.ArgString;
            Mobile from       = e.Mobile;
            int    spaceindex = args.IndexOf(' ');

            if (spaceindex != -1)
            {
                string name = args.Substring(0, spaceindex);
                string text = args.Substring(spaceindex + 1);

                if (name.Length < 2)
                {
                    from.SendMessage(133, "That name is too short. You need to specify at least 2 characters.");
                    return;
                }

                name = name.Replace('_', ' ');

                ArrayList friends = FriendSystem.GetFriendList(from).MutualFriends;
                int       sentto  = 0;
                foreach (Mobile friend in friends)
                {
                    string friendname = friend.Name;
                    //if ( friend.Name.ToLower() == name.ToLower() && friend.NetState != null )
                    if (name.Length <= friendname.Length && name.ToLower() == friendname.Substring(0, name.Length).ToLower() && friend.NetState != null)
                    {
                        FriendSystem.Tell(from, friend, text);
                        sentto++;
                    }
                }
                if (sentto == 0)
                {
                    from.SendMessage(133, "No friend named {0} is online.", name);
                }
            }
            else
            {
                from.SendMessage(133, "Invalid format. Try something like \"[FTell My_Best_Friend Hello!\".");
            }
        }