public static bool CanChat( ChatInfo info, bool action )
        {
            if ( !ChatInfo.AllowFaction )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "Faction chat is not enabled." );

                return false;
            }

            if ( !IsInFaction( info.Mobile ) )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are not in a faction." );

                return false;
            }

            if ( info.Banned )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are banned from chat." );

                return false;
            }

            return true;
        }
Exemple #2
1
        public static bool CanPm( ChatInfo source, ChatInfo target )
        {
            if ( source == target )
                return false;

            if ( source.Mobile.AccessLevel > target.Mobile.AccessLevel )
                return true;

            if ( target.PmDisabled && source.Mobile.AccessLevel == AccessLevel.Player )
                return false;

            if ( !ChatInfo.ShowStaff
            && source.Mobile.AccessLevel == AccessLevel.Player
            && target.Mobile.AccessLevel > AccessLevel.Player )
                return false;

            if ( source.PmFriends || target.PmFriends )
            {
                if ( !source.Friends.Contains( target.Mobile ) )
                    return false;
                if ( !target.Friends.Contains( source.Mobile ) )
                    return false;
            }

            if ( !CanPm( target ) || !CanPm( source ) )
                return false;

            if ( source.Ignoring( target.Mobile )
            || target.Ignoring( source.Mobile ) )
                return false;

            return true;
        }
 public OptionsGump( Mobile m )
     : base(m, 100, 100)
 {
     m.CloseGump( typeof( OptionsGump ) );
     c_Info = ChatInfo.GetInfo( m );
     NewGump();
 }
        public ProfileGump( Mobile m, Mobile target )
            : base(m, 100, 100)
        {
            c_Target = target;
            c_Info = ChatInfo.GetInfo( Owner );

            NewGump();
        }
Exemple #5
0
        public static bool CanReply( ChatInfo source, ChatInfo target )
        {
            if ( target.Mobile.AccessLevel > source.Mobile.AccessLevel )
                return true;

            if ( !CanPm( source, target ) )
                return false;

            return true;
        }
Exemple #6
0
        public ListGump( Mobile m, Listing listing )
            : base(m, 100, 100)
        {
            c_Info = ChatInfo.GetInfo( m );
            c_Listing = listing;

            c_List = new ArrayList();
            c_Mailbox = true;

            NewGump();
        }
Exemple #7
0
        public static bool CanChat( ChatInfo info, bool action )
        {
            if ( info.Mobile.Guild == null )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are not in a guild." );

                return false;
            }

            if ( info.Banned )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are banned from chat." );

                return false;
            }

            return true;
        }
Exemple #8
0
        public static bool CanChat( ChatInfo info, bool action )
        {
            if ( info.Banned )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are banned from chat." );

                return false;
            }

            if ( info.PublicDisabled )
            {
                if ( action )
                {
                    OptionsGump.SendTo( info.Mobile );
                    info.Mobile.SendMessage( info.SystemColor, "You must first enable public chat." );
                }

                return false;
            }

            return true;
        }
Exemple #9
0
        public static bool CanPm( ChatInfo info, bool action )
        {
            if ( info.Banned )
            {
                if ( action )
                    info.Mobile.SendMessage( info.SystemColor, "You are banned from chat." );

                return false;
            }

            if ( info.PmDisabled && info.Mobile.AccessLevel == AccessLevel.Player )
            {
                if ( action )
                {
                    OptionsGump.SendTo( info.Mobile );
                    info.Mobile.SendMessage( info.SystemColor, "You must first enable private messages." );
                }

                return false;
            }

            return true;
        }
Exemple #10
0
 public static bool CanChat( ChatInfo info )
 {
     return CanChat( info, false );
 }
Exemple #11
0
        private string Color( ChatInfo info )
        {
            if ( info.Mobile.NetState == null
            || info.PublicDisabled
            || ( info.Hidden && info.Mobile.AccessLevel > Owner.AccessLevel ) )
                return HTML.Gray;
            if ( info.Banned )
                return HTML.Red;
            if ( c_Info.Ignoring( info.Mobile ) )
                return HTML.AshRed;
            if ( c_Info.GlobalIgnoring( info.Mobile ) )
                return HTML.DarkGray;
            if ( info.Mobile.AccessLevel != AccessLevel.Player )
                return HTML.Blue;
            if ( Owner.Guild != null && Owner.Guild == info.Mobile.Guild )
                return HTML.Green;
            if ( FactionChat.SameFaction( Owner, info.Mobile ) )
                return HTML.Purple;

            return HTML.White;
        }
Exemple #12
0
        private static ArrayList GetPmCanidates( ChatInfo info, string name )
        {
            ArrayList list = new ArrayList();

            try{

            foreach( ChatInfo l_info in ChatInfo.ChatInfos.Values )
                if ( l_info.Mobile.Name.ToLower().IndexOf( name.ToLower() ) != -1
                && CanPm( info, l_info ) )
                    list.Add( l_info.Mobile );

            }catch{ Errors.Report( String.Format( "Pm-> GetPmCanidates-> |{0}|", info.Mobile ) ); }

            return list;
        }
Exemple #13
0
        private static void OnLoad()
        {
            try{

            if ( !File.Exists( Path.Combine( "Saves/Chat/", "Chat.bin" ) ) )
                return;

            using ( FileStream bin = new FileStream( Path.Combine( "Saves/Chat/", "Chat.bin" ), FileMode.Open, FileAccess.Read, FileShare.Read ) )
            {
                GenericReader reader = new BinaryFileReader( new BinaryReader( bin ) );

                int version = reader.ReadInt();

                if ( version >= 12 )
                    s_PublicPlusIRC = reader.ReadBool();

                if ( version >= 11 )
                    s_FilterPenalty = (FilterPenalty)reader.ReadInt();

                if ( version >= 10 )
                    s_AllianceChat = reader.ReadBool();

                if ( version >= 9 )
                    s_AllowFaction = reader.ReadBool();

                if ( version >= 8 )
                    s_GuildMenuAccess = reader.ReadBool();

                if ( version >= 7 )
                    s_MaxPmHistory = reader.ReadInt();

                if ( version >= 6 )
                    s_IrcAutoReconnect = reader.ReadBool();

                if ( version >= 5 )
                    s_IrcMaxAttempts = reader.ReadInt();

                if ( version >= 4 )
                    s_IrcAutoConnect = reader.ReadBool();

                if ( version >= 3 )
                    s_IrcStaffColor = (IrcColor)reader.ReadInt();

                if ( version >= 2 )
                    s_IrcNick = reader.ReadString();

                if ( version >= 1 )
                {
                    s_IrcEnabled = reader.ReadBool();
                    s_IrcServer = reader.ReadString();
                    s_IrcRoom = reader.ReadString();
                    s_IrcPort = reader.ReadInt();
                }

                if ( version >= 0 )
                {
                    int count = reader.ReadInt();

                    for( int i = 0; i < count; ++i )
                        s_Filters.Add( reader.ReadString() );

                    s_SpamLimiter = reader.ReadDouble();
                    s_FilterBanLength = reader.ReadDouble();

                    if ( version < 11 )
                        reader.ReadBool(); // FilterBan removed

                    s_ShowLocation = reader.ReadBool();
                    s_ShowStaff = reader.ReadBool();
                    s_PublicStyle = (PublicStyle)reader.ReadInt();

                    count = reader.ReadInt();
                    ChatInfo info;

                    for( int i = 0; i < count; ++i )
                    {
                        info = new ChatInfo( reader.ReadMobile() );
                        if ( !info.Load( reader ) )
                            return;
                    }
                }

                reader.End();
            }

            if ( s_IrcAutoConnect )
                IrcConnection.Connection.Connect();

            }catch{ Errors.Report( "ChatInfo-> OnLoad" ); }
        }
Exemple #14
0
        protected override void BuildGump()
        {
            try{
                Owner.CloseGump(typeof(ProfileGump));

                AddPage(0);

                ChatInfo otherInfo = ChatInfo.GetInfo(c_Target);

                AddBackground(0, 0, Width, Height, 0x13BE);

                AddButton(Width - 20, Height - 20, 0x5689, 0x5689, "Help", new TimerCallback(Help));

                AddPage(1);

                string text = Server.Misc.Titles.ComputeTitle(Owner, c_Target);

                if (c_Target.AccessLevel != AccessLevel.Player)
                {
                    text += "<BR>" + c_Target.AccessLevel;
                }
                else if (c_Target.Guild != null)
                {
                    text += "<BR>[" + c_Target.Guild.Abbreviation + "] " + c_Target.GuildTitle;
                }

                if (Owner.AccessLevel > c_Target.AccessLevel ||
                    (ChatInfo.ShowLocation && Owner.AccessLevel == c_Target.AccessLevel))
                {
                    if (c_Target.NetState != null)
                    {
                        text += "<BR>" + c_Target.Map.Name;

                        if (c_Target.Region != null && c_Target.Region.Name != "")
                        {
                            text += ", " + c_Target.Region.Name;
                        }
                    }
                }

                AddHtml(0, 10, Width, 65, HTML.White + "<CENTER>" + text, false, false);

                AddBackground(20, 65, Width - 40, 3, 0x13BE);

                int y = 90;
                int x = 40;

                if (c_Target.AccessLevel >= Owner.AccessLevel)
                {
                    x = Width / 2 - 35;
                }

                if (Pm.CanPm(c_Info, otherInfo))
                {
                    AddTemplateButton(x, y, 70, Template.RedSquare, "New Message", HTML.White + "<CENTER>Message", new TimerCallback(Message));
                }

                AddTemplateButton(x, y + 20, 70, Template.RedSquare, "Friend", HTML.White + (c_Info.Friends.Contains(c_Target) ? "<CENTER>Unfriend" : "<CENTER>Friend"), new TimerStateCallback(Friend), c_Info.Friends.Contains(c_Target));

                if (Owner.AccessLevel >= c_Target.AccessLevel)
                {
                    AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Ignore", HTML.White + (c_Info.Ignores.Contains(c_Target) ? "<CENTER>Unignore" : "<CENTER>Ignore"), new TimerStateCallback(Ignore), c_Info.Ignores.Contains(c_Target));
                }

                AddHtml(x - 10, y + 65, 70, 25, HTML.White + "Pm Sound:", false, false);
                AddImageTiled(x + 65, y + 65, 35, 21, 0xBBA);
                AddTextField(x + 65, y + 65, 35, 21, 0x480, 0, c_Info.GetSound(c_Target).ToString());
                AddButton(x + 100, y + 67, 0x15E1, 0x15E5, "Play Sound", new TimerCallback(PlaySound));
                AddButton(x + 55, y + 65, 0x983, 0x983, "Sound Up", new TimerCallback(SoundUp));
                AddButton(x + 55, y + 75, 0x985, 0x985, "Sound Down", new TimerCallback(SoundDown));

                if (Owner.AccessLevel > c_Target.AccessLevel)
                {
                    x = Width - 110;

                    if (c_Target.NetState != null)
                    {
                        AddTemplateButton(x, y, 70, Template.RedSquare, "Client", HTML.White + "<CENTER>Client", new TimerCallback(Client));
                        AddItem(x - 30, y + 3, 0x186A);

                        AddTemplateButton(x, y + 20, 70, Template.RedSquare, "Goto", HTML.White + "<CENTER>Goto", new TimerCallback(Goto));
                        AddItem(x - 30, y + 23, 0x186A);
                    }

                    if (c_Info.GlobalAccess)
                    {
                        AddTemplateButton(x, y + 60, 70, Template.RedSquare, "Global Ignore", HTML.White + (c_Info.GlobalIgnores.Contains(c_Target) ? "<CENTER>Global Unignore" : "<CENTER>Global Ignore"), new TimerStateCallback(IgnoreGlobal), c_Info.GlobalIgnores.Contains(c_Target));
                        AddItem(x - 30, y + 63, 0x186A);
                    }

                    if (c_Target.AccessLevel == AccessLevel.Player)
                    {
                        AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Ban", HTML.White + (otherInfo.Banned ? "<CENTER>Unban" : "<CENTER>Ban"), otherInfo.Banned ? new TimerCallback(Unban) : new TimerCallback(Ban));
                        AddItem(x - 30, y + 43, 0x186A);
                    }
                    else if (Owner.AccessLevel == AccessLevel.Administrator)
                    {
                        AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Global Priv", HTML.White + (otherInfo.GlobalAccess ? "<CENTER>Revoke Global" : "<CENTER>Give Global"), new TimerStateCallback(GlobalAccess), otherInfo.GlobalAccess);
                        AddItem(x - 30, y + 43, 0x186A);
                    }
                }

                AddButton(Width - 20, Height / 2 - 10, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2);

                AddPage(2);

                AddButton(0, Height / 2 - 10, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 1);

                AddHtml(0, 10, Width, 25, "<CENTER>" + HTML.White + c_Target.Name + "'s Profile", false, false);
                AddHtml(20, 30, Width - 40, Height - 50, c_Target.Profile, true, true);
            }catch { Errors.Report(String.Format("ProfileGump-> BuildGump-> |{0}|-> |{1}|", Owner, c_Target)); }
        }
 public static bool CanChat(ChatInfo info)
 {
     return(CanChat(info, false));
 }