Esempio n. 1
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)); }
        }
Esempio 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.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)); }
        }
Esempio n. 3
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)); }
        }