Ejemplo n.º 1
0
        private void Friend()
        {
            if (Data.GetData(c_Target).ByRequest&& !Data.GetData(Owner).Friends.Contains(c_Target))
            {
                if (!TrackSpam.LogSpam(Owner, "Request " + c_Target.Name, TimeSpan.FromHours(Data.RequestSpam)))
                {
                    TimeSpan ts  = TrackSpam.NextAllowedIn(Owner, "Request " + c_Target.Name, TimeSpan.FromHours(Data.RequestSpam));
                    string   txt = (ts.Days != 0 ? ts.Days + " " + General.Local(170) + " " : "") + (ts.Hours != 0 ? ts.Hours + " " + General.Local(171) + " " : "") + (ts.Minutes != 0 ? ts.Minutes + " " + General.Local(172) + " " : "");

                    Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(96) + " " + txt);
                    NewGump();
                    return;
                }

                Data.GetData(c_Target).AddMessage(new Message(Owner, General.Local(84), General.Local(85), MsgType.Invite));

                Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(86) + " " + c_Target.Name);

                NewGump();

                return;
            }

            if (Data.GetData(Owner).Friends.Contains(c_Target))
            {
                Data.GetData(Owner).RemoveFriend(c_Target);
            }
            else
            {
                Data.GetData(Owner).AddFriend(c_Target);
            }

            NewGump();
        }
Ejemplo n.º 2
0
        private void Friend(object o)
        {
            Mobile m = o as Mobile;

            if (m == null)
            {
                return;
            }

            if (Data.GetData(m).ByRequest&& !Data.GetData(Current).Friends.Contains(m))
            {
                if (!TrackSpam.LogSpam(Current, "Request " + m.RawName, TimeSpan.FromHours(Data.RequestSpam)))
                {
                    TimeSpan ts  = TrackSpam.NextAllowedIn(Current, "Request " + m.RawName, TimeSpan.FromHours(Data.RequestSpam));
                    string   txt = (ts.Days != 0 ? ts.Days + " " + General.Local(170) + " " : "") + (ts.Hours != 0 ? ts.Hours + " " + General.Local(171) + " " : "") + (ts.Minutes != 0 ? ts.Minutes + " " + General.Local(172) + " " : "");

                    Owner.SendMessage(Data.GetData(Current).SystemC, General.Local(96) + " " + txt);
                    NewGump();
                    return;
                }

                Data.GetData(m).AddMessage(new Message(Current, General.Local(84), General.Local(85), MsgType.Invite));

                Owner.SendMessage(Data.GetData(Current).SystemC, General.Local(86) + " " + m.RawName);

                NewGump();
                return;
            }

            if (Data.GetData(Current).Friends.Contains(m))
            {
                Data.GetData(Current).RemoveFriend(m);
            }
            else
            {
                Data.GetData(Current).AddFriend(m);
            }

            NewGump();
        }
Ejemplo n.º 3
0
        private void Send()
        {
            if (Data.GetData(Owner).Recording == null)
            {
                Save();
            }

            if (c_Text.Trim() == "")
            {
                Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(66));
                NewGump();
                return;
            }

            if (c_Subject.Trim() == "")
            {
                c_Subject = "No subject";
            }

            if (!TrackSpam.LogSpam(Owner, "Message", TimeSpan.FromSeconds(Data.MsgSpam)))
            {
                Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(97));
                NewGump();
                return;
            }

            if (Data.GetData(Owner).Recording == this)
            {
                Data.GetData(Owner).Recording = null;
            }

            if (Data.FilterMsg)
            {
                c_Text    = Filter.FilterText(Owner, c_Text, false);
                c_Subject = Filter.FilterText(Owner, c_Subject, false);
            }

            if (c_MsgType == MsgType.System)
            {
                foreach (Data data in Data.Datas.Values)
                {
                    data.AddMessage(new Message(Owner, c_Subject, c_Text, MsgType.System));
                    General.PmNotify(data.Mobile);
                }
            }
            else if (c_MsgType == MsgType.Staff)
            {
                foreach (Data data in Data.Datas.Values)
                {
                    if (data.Mobile.AccessLevel != AccessLevel.Player)
                    {
                        data.AddMessage(new Message(Owner, c_Subject, c_Text, MsgType.Staff));
                        General.PmNotify(data.Mobile);
                    }
                }
            }
            else
            {
                Data.GetData(c_To).AddMessage(new Message(Owner, c_Subject, c_Text, MsgType.Normal));
                General.PmNotify(c_To);

                Owner.SendMessage(Data.GetData(Owner).SystemC, General.Local(67) + " " + c_To.RawName);
                if (Data.GetData(c_To).Status != OnlineStatus.Online)
                {
                    Owner.SendMessage(Data.GetData(Owner).SystemC, c_To.RawName + ": " + Data.GetData(c_To).AwayMsg);
                }
            }

            if (Data.LogPms)
            {
                Logging.LogPm(String.Format(DateTime.Now + " <Mail> {0} to {1}: {2}", Owner.RawName, (c_To == null ? "All" : c_To.RawName), c_Text));
            }

            foreach (Data data in Data.Datas.Values)
            {
                if (data.Mobile.AccessLevel >= c_From.AccessLevel && ((data.GlobalM && !data.GIgnores.Contains(c_From)) || data.GListens.Contains(c_From)))
                {
                    data.Mobile.SendMessage(data.GlobalMC, String.Format("(Global) <Mail> {0} to {1}: {2}", Owner.RawName, (c_To == null ? "All" : c_To.RawName), c_Text));
                }
            }
        }
Ejemplo n.º 4
0
        public virtual void OnChat(Mobile m, string msg, bool spam)
        {
            if (msg == null || msg == "")
            {
                if (!CanChat(m, false))
                {
                    General.List(m, 0);
                    return;
                }

                if (c_Mobiles.Contains(m))
                {
                    Data.GetData(m).CurrentChannel = this;
                }

                General.List(m, 1);
                return;
            }

            if (!CanChat(m, true))
            {
                return;
            }

            if (c_Filter)
            {
                msg = Chat3.Filter.FilterText(m, msg);
            }

            if (!CanChat(m, false))
            {
                return;
            }

            if (!c_Mobiles.Contains(m))
            {
                m.SendMessage(Data.GetData(m).SystemC, General.Local(34));
                return;
            }

            if (c_Delay && !TrackSpam.LogSpam(m, "Chat", TimeSpan.FromSeconds(Data.ChatSpam)))
            {
                if (spam)
                {
                    m.SendMessage(Data.GetData(m).SystemC, General.Local(97));
                }
                Timer.DelayCall(TimeSpan.FromSeconds(4), new TimerStateCallback(OnChat), new object[] { m, msg });
                return;
            }

            AddHistory(m, msg);
            UpdateHistory(m);
            Events.InvokeChat(new ChatEventArgs(m, this, msg));

            if (Data.LogChat)
            {
                Logging.LogChat(String.Format(DateTime.Now + " <{0}{1}> {2}: {3}", c_Name, (c_Style == ChatStyle.Regional && m.Region != null ? "-" + m.Region.Name : ""), m.Name, msg));
            }

            Data.TotalChats++;
            Data.GetData(m).Karma++;

            Broadcast(m, msg);

            if (c_ToIrc && IrcConnection.Connection.Connected)
            {
                IrcConnection.Connection.SendUserMessage(m, "(" + c_Name + ") " + msg);
            }
        }