Ejemplo n.º 1
0
        private static void OnPm(CommandEventArgs e)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

                if (!CanPm(info, true))
                {
                    return;
                }

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Messages);
                }
                else
                {
                    string name = e.GetString(0);
                    string text = "";

                    if (e.Arguments.Length > 1)
                    {
                        text = e.ArgString.Substring(name.Length + 1, e.ArgString.Length - name.Length - 1);
                    }

                    ArrayList list = GetPmCanidates(info, name);

                    if (list.Count > 10)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Too many name search results, please be more specific.");
                    }
                    else if (list.Count == 0)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "No name containing '{0}' was found.", name);
                    }
                    else if (list.Count == 1)
                    {
                        PmGump.SendTo(info.Mobile, (Mobile)list[0], text);
                    }
                    else
                    {
                        Hashtable table = new Hashtable();
                        foreach (Mobile m in list)
                        {
                            table.Add(new object[3] {
                                e.Mobile, m, text
                            }, m.Name);
                        }

                        ChoiceGump.SendTo(info.Mobile, "", 200, new TimerStateCallback(ChoiceCallback), table);
                    }
                }
            }catch { Errors.Report(String.Format("Pm-> OnPm-> |{0}|", e.Mobile)); }
        }
Ejemplo n.º 2
0
        private static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

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

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Guild);
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && info.Mobile.Guild == ci.Mobile.Guild && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                        else if (ChatInfo.AllianceChat && CanChat(ci) && ((Guild)info.Mobile.Guild).Allies.Contains(ci.Mobile.Guild) && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                        else if (ci.GlobalGuild)
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                    }
                }
            }catch { Errors.Report(String.Format("GuildChat-> OnChat-> |{0}|", e.Mobile)); }
        }
Ejemplo n.º 3
0
        private static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

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

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Faction);
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && SameFaction(info.Mobile, ci.Mobile) && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString);
                        }
                        else if (ci.GlobalFaction)
                        {
                            ci.Mobile.SendMessage(ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString);
                        }
                    }
                }
            }catch { Errors.Report(String.Format("FactionChat-> OnChat-> |{0}|", e.Mobile)); }
        }
Ejemplo n.º 4
0
        public static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

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

                if (e.ArgString == null || e.ArgString == "" || ChatInfo.NoPublic)
                {
                    ListGump.SendTo(e.Mobile, Listing.Public);
                }
                else if (ChatInfo.Regional && (e.Mobile.Region == null || e.Mobile.Region.Name == ""))
                {
                    e.Mobile.SendMessage(info.SystemColor, "You are not in a region.");
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    string text = Filter.FilterText(e.Mobile, e.ArgString);
                    if (text == "")
                    {
                        return;
                    }

                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile == null || ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && !ci.Ignoring(info.Mobile))
                        {
                            if (ci.Mobile.AccessLevel == AccessLevel.Player &&
                                ChatInfo.Regional &&
                                info.Mobile.Region != ci.Mobile.Region)
                            {
                                continue;
                            }

                            ci.Mobile.SendMessage(e.Mobile.AccessLevel == AccessLevel.Player ? ci.PublicColor : info.StaffColor, "<{0}> {1}: {2}", ChatInfo.Regional ? e.Mobile.Region.Name : "Public", e.Mobile.Name, text);
                        }
                    }

                    if (ChatInfo.PublicPlusIRC)
                    {
                        IrcConnection.Connection.SendUserMessage(e.Mobile, e.ArgString);
                    }
                }
            }catch { Errors.Report(String.Format("PublicChat-> OnChat-> |{0}|", e.Mobile)); }
        }