Пример #1
0
        public static void UpdatePlayerStatistics(Mobile pm)
        {
            AuthorStatistics ast;
            bool             newUser = false;

            if (ForumCore.PlayerStatistics.ContainsKey(pm.Serial.Value))
            {
                ast = ForumCore.GetAuthorStatistics(pm.Serial.Value);
            }
            else
            {
                ast     = new AuthorStatistics(pm.Serial.Value, pm.Name, DateTime.Now, 0);
                newUser = true;
            }

            ast.PostCount++;

            if (newUser)
            {
                if (!PlayerStatistics.ContainsKey(ast.Serial))
                {
                    PlayerStatistics.Add(ast.Serial, ast);
                }
            }
        }
Пример #2
0
        private static void WritePlayerStatistics(GenericWriter writer)
        {
            IDictionaryEnumerator myEnum = m_PlayerStatistics.GetEnumerator();

            ArrayList keyArray = new ArrayList();
            ArrayList astArray = new ArrayList();

            while (myEnum.MoveNext())
            {
                keyArray.Add(myEnum.Key);
                astArray.Add(myEnum.Value);
            }

            int count = keyArray.Count;

            writer.Write(( int )count);

            for (int i = 0; i < count; i++)
            {
                int key = ( int )keyArray[i];
                AuthorStatistics ast = ( AuthorStatistics )astArray[i];

                writer.Write(( int )key);
                ast.Serialize(writer);
            }
        }
Пример #3
0
        public string GetThreadInfo()
        {
            string post = "";

            for (int i = 0; i < m_Posts.Count; i++)
            {
                PostEntry pe = ( PostEntry )m_Posts[i];

                if (pe != null)
                {
                    AuthorStatistics ast;
                    if (ForumCore.PlayerStatistics.ContainsKey(pe.Serial))
                    {
                        ast = ForumCore.GetAuthorStatistics(pe.Serial);
                    }
                    else
                    {
                        ast = new AuthorStatistics(pe.Serial, pe.Author.Name, DateTime.Now, 0);
                        ForumCore.PlayerStatistics.Add(ast.Serial, ast);
                    }

                    post += String.Format("{0}<br>Posts: {1}, Join Date: {2}, {3}<br>----------------------------------------------------------<br><br>{4}<br><br>----------------------------------------------------------<br>{5}<br>----------------------------------------------------------<br>", pe.Author.Name, ast.PostCount, ast.JoinDate.ToShortDateString(), ast.RankTitle, pe.Post, ast.Signature);
                }
            }
            return(post);
        }
Пример #4
0
        public AccountListingGump(ArrayList list, int page) : base(0, 0)
        {
            m_Page          = page;
            m_List          = list;
            m_CurrentList   = new ArrayList();
            this.Closable   = false;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddLabel(32, 30, 0, @"Account Management");
            this.AddBackground(19, 22, 321, 65 + (list.Count * 25), 9200);
            this.AddButton(305, 29, 2708, 248, (int)Buttons.Close, GumpButtonType.Reply, 0);

            bool pages = (list.Count > 10);
            bool more  = false;

            int index = m_Page * 10;

            if (index < 0)
            {
                index = 0;
            }

            int maxcount = index + 10;
            int offset   = 0;

            for (int i = index; i < list.Count; i++)
            {
                if (i >= maxcount)
                {
                    more = true;
                    break;
                }
                AuthorStatistics ast = (AuthorStatistics)list[i];
                m_CurrentList.Add(ast);

                this.AddButton(30, (((22 * (i - index)) + 54) - offset), 4005, 4005, (i - (maxcount - (((m_Page + 1) * 10))) - index), GumpButtonType.Reply, 0);
                this.AddLabel(66, (((22 * (i - index)) + 54) - offset), 0, ast.Name);
            }

            if (pages)
            {
                if (more)
                {
                    this.AddButton(308, 57 + (list.Count * 25), 5541, 5541, (int)Buttons.Next, GumpButtonType.Reply, 0);
                }

                if (m_Page > 0)
                {
                    this.AddButton(288, 57 + (list.Count * 25), 5538, 5538, (int)Buttons.Previous, GumpButtonType.Reply, 0);
                }
            }
        }
Пример #5
0
        public static AuthorStatistics GetAuthorStatistics(int index)
        {
            AuthorStatistics ast = new AuthorStatistics();

            if (m_PlayerStatistics.ContainsKey(( object)index))
            {
                return(( AuthorStatistics )m_PlayerStatistics[index]);
            }
            else
            {
                return(ast);
            }
        }
Пример #6
0
        public static void ViewForums_OnCommand(CommandEventArgs e)
        {
            Mobile pm = ( Mobile )e.Mobile;

            AuthorStatistics ast = ForumCore.GetAuthorStatistics(pm.Serial.Value);

            if (ast.Banned)
            {
                pm.SendMessage("You've been banned from the forum!");
                return;
            }

            m_Threads.Sort(new DateSort());
            pm.CloseGump(typeof(ForumGump));
            pm.SendGump(new ForumGump(pm, 0));
        }
Пример #7
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            AuthorStatistics ast = ForumCore.GetAuthorStatistics(from.Serial.Value);

            if (ast.Banned)
            {
                from.SendMessage("You have been banned from this forum!");
                return;
            }

            ForumCore.Threads.Sort(new DateSort());
            from.CloseGump(typeof(ForumGump));
            from.SendGump(new ForumGump(from, 0));
        }
Пример #8
0
        private static Hashtable ReadPlayerStatistics(GenericReader reader)
        {
            int count = reader.ReadInt();

            Hashtable ht = new Hashtable();

            for (int i = 0; i < count; i++)
            {
                int key = reader.ReadInt();
                AuthorStatistics ast = new AuthorStatistics();
                ast.Deserialize(reader);

                ht.Add(key, ast);
            }

            return(ht);
        }
Пример #9
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile pm = ( Mobile )sender.Mobile;

            if (pm == null)
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 11:
            {
                pm.CloseGump(typeof(AccountSearch));
                pm.SendGump(new AccountSearch());
                break;
            }

            case 12:
            {
                int page = m_Page + 1;
                pm.CloseGump(typeof(AccountListingGump));
                pm.SendGump(new AccountListingGump(m_List, page));
                break;
            }

            case 13:
            {
                int page = m_Page - 1;
                pm.CloseGump(typeof(AccountListingGump));
                pm.SendGump(new AccountListingGump(m_List, page));
                break;
            }

            default:
            {
                AuthorStatistics ast = (AuthorStatistics)m_CurrentList[info.ButtonID];
                pm.CloseGump(typeof(AccountManagementGump));
                pm.SendGump(new AccountManagementGump(ast));
                break;
            }
            }
        }
Пример #10
0
 public AccountManagementGump(AuthorStatistics ast) : base(0, 0)
 {
     m_Ast           = ast;
     this.Closable   = true;
     this.Disposable = true;
     this.Dragable   = true;
     this.Resizable  = false;
     this.AddPage(0);
     this.AddBackground(13, 17, 549, 174, 9200);
     this.AddLabel(32, 28, 0, @"Account Management - User: "******" - Rank: " + /*ast.RankTitle*/ "<NOT IMPLEMENTED>" + (ast.CustomRankAllowed ? " - Custom" : " - Not Custom"));
     this.AddLabel(66, 80, 0, @"Ban/Unban - Current: " + (ast.Banned ? "BANNED" : "ACTIVE"));
     this.AddLabel(66, 102, 0, @"Give Warning <NOT IMPLEMENTED>");
     this.AddLabel(66, 124, 0, @"Change Signature <NOT IMPLEMENTED>");
     this.AddLabel(66, 146, 0, @"Allow Custom Rank - Current: " + (ast.CustomRankAllowed ? "ALLOWED" : "NOT ALLOWED"));
     this.AddButton(29, 78, 4005, 4005, ( int )Buttons.BanButton, GumpButtonType.Reply, 0);
     this.AddButton(29, 146, 4005, 4005, ( int )Buttons.AllowCustomRank, GumpButtonType.Reply, 0);
     this.AddButton(29, 123, 4005, 4005, ( int )Buttons.ChangeSigButton, GumpButtonType.Reply, 0);
     this.AddButton(29, 100, 4005, 4005, ( int )Buttons.WarningButton, GumpButtonType.Reply, 0);
     this.AddLabel(32, 48, 0, @"Status: " + (ast.Banned ? " BANNED " : " ACTIVE ") + "Posts: " + ast.PostCount);
 }
Пример #11
0
        public static bool AuthorExists(out ArrayList list, string name)
        {
            IDictionaryEnumerator myEnum = m_PlayerStatistics.GetEnumerator();

            list = new ArrayList();

            bool found = false;

            while (myEnum.MoveNext())
            {
                AuthorStatistics ast = (AuthorStatistics)myEnum.Value;

                if (ast.Name.ToLower() == name.ToLower())
                {
                    found = true;
                    list.Add(ast);
                }
            }

            return(found);
        }
		public AccountManagementGump( AuthorStatistics ast ) : base( 0, 0 )
		{
            m_Ast = ast;
			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;
			this.AddPage(0);
			this.AddBackground(13, 17, 549, 174, 9200);
			this.AddLabel(32, 28, 0, @"Account Management - User: "******" - Rank: " + /*ast.RankTitle*/"<NOT IMPLEMENTED>" + ( ast.CustomRankAllowed ? " - Custom" : " - Not Custom" ) );
			this.AddLabel(66, 80, 0, @"Ban/Unban - Current: " + (ast.Banned ? "BANNED" : "ACTIVE") );
			this.AddLabel(66, 102, 0, @"Give Warning <NOT IMPLEMENTED>");
            this.AddLabel( 66, 124, 0, @"Change Signature <NOT IMPLEMENTED>" );
			this.AddLabel(66, 146, 0, @"Allow Custom Rank - Current: " + (ast.CustomRankAllowed ? "ALLOWED" : "NOT ALLOWED") );
            this.AddButton( 29, 78, 4005, 4005, ( int )Buttons.BanButton, GumpButtonType.Reply, 0 );
            this.AddButton( 29, 146, 4005, 4005, ( int )Buttons.AllowCustomRank, GumpButtonType.Reply, 0 );
            this.AddButton( 29, 123, 4005, 4005, ( int )Buttons.ChangeSigButton, GumpButtonType.Reply, 0 );
            this.AddButton( 29, 100, 4005, 4005, ( int )Buttons.WarningButton, GumpButtonType.Reply, 0 );
            this.AddLabel( 32, 48, 0, @"Status: " + ( ast.Banned ? " BANNED " : " ACTIVE " ) + "Posts: " + ast.PostCount );

		}
Пример #13
0
        public string GetThreadInfo()
        {
            string post = "";

            for (int i = 0; i < m_Posts.Count; i++)
            {
                PostEntry pe = ( PostEntry )m_Posts[i];

                if (pe != null)
                {
                    AuthorStatistics ast;
                    if (ForumCore.PlayerStatistics.ContainsKey(pe.Serial))
                    {
                        ast = ForumCore.GetAuthorStatistics(pe.Serial);
                    }
                    else
                    {
                        ast = new AuthorStatistics(pe.Serial, pe.Author.Name, DateTime.Now, 0);
                        ForumCore.PlayerStatistics.Add(ast.Serial, ast);
                    }

                    if (pe.Author == null)
                    {
                        post += String.Format("<center>{0}</center><br>{1}<br><br>________________________________________________________<br>", "[ Guest ]", pe.Post);
                    }
                    else if (ast.PostCount == 0)
                    {
                        post += String.Format("<center>[ {0} ]</center><br>{1}<br><br>________________________________________________________<br>", pe.Author.Name, pe.Post);
                    }
                    else
                    {
                        post += String.Format("<center>[ {0} - {1} Posts ]</center><br>{2}<br><br>________________________________________________________<br>", pe.Author.Name, ast.PostCount, pe.Post);
                    }
                }
            }
            return(post);
        }
Пример #14
0
        public string GetThreadInfo()
        {
            string post = "";
            for( int i = 0; i < m_Posts.Count; i++ )
            {
                PostEntry pe = ( PostEntry )m_Posts[i];

                if( pe != null )
                {
                    AuthorStatistics ast;
                    if( ForumCore.PlayerStatistics.ContainsKey( pe.Serial ) )
                        ast = ForumCore.GetAuthorStatistics( pe.Serial );
                    else
                    {
                        ast = new AuthorStatistics( pe.Serial, pe.Author.Name, DateTime.Now, 0 );
                        ForumCore.PlayerStatistics.Add( ast.Serial, ast );
                    }

                    post += String.Format( "{0}<br>Posts: {1}, Join Date: {2}, {3}<br>----------------------------------------------------------<br><br>{4}<br><br>----------------------------------------------------------<br>{5}<br>----------------------------------------------------------<br>", pe.Author.Name, ast.PostCount, ast.JoinDate.ToShortDateString(), ast.RankTitle, pe.Post, ast.Signature );
                }
            }
            return post;
        }
Пример #15
0
        public string GetThreadInfo()
        {
            string post = "";
            for( int i = 0; i < m_Posts.Count; i++ )
            {
                PostEntry pe = ( PostEntry )m_Posts[i];

                if( pe != null )
                {
                    AuthorStatistics ast;
                    if( ForumCore.PlayerStatistics.ContainsKey( pe.Serial ) )
                        ast = ForumCore.GetAuthorStatistics( pe.Serial );
                    else
                    {
                        ast = new AuthorStatistics( pe.Serial, pe.Author.Name, DateTime.Now, 0 );
                        ForumCore.PlayerStatistics.Add( ast.Serial, ast );
                    }
                    
                    if( pe.Author == null )
                    	post += String.Format( "<center>{0}</center><br>{1}<br><br>________________________________________________________<br>", "[ Guest ]", pe.Post );
                    else if ( ast.PostCount == 0 )
                    	post += String.Format( "<center>[ {0} ]</center><br>{1}<br><br>________________________________________________________<br>", pe.Author.Name, pe.Post );
                    else
                    	post += String.Format( "<center>[ {0} - {1} Posts ]</center><br>{2}<br><br>________________________________________________________<br>", pe.Author.Name, ast.PostCount, pe.Post );
                }
            }
            return post;
        }
Пример #16
0
		private static Hashtable ReadPlayerStatistics( GenericReader reader )
		{
			int count = reader.ReadInt();

			Hashtable ht = new Hashtable();

			for( int i = 0; i < count; i++ )
			{
				int key = reader.ReadInt();
				AuthorStatistics ast = new AuthorStatistics();
				ast.Deserialize( reader );

				ht.Add( key, ast );
			}

			return ht;
		}
Пример #17
0
		public static AuthorStatistics GetAuthorStatistics( int index )
		{
			AuthorStatistics ast = new AuthorStatistics();
			
			if( m_PlayerStatistics.ContainsKey( ( object)index ) )
				return ( AuthorStatistics )m_PlayerStatistics[index];
			else
				return ast;
		}
Пример #18
0
		public static void UpdatePlayerStatistics( Mobile pm )
		{
			AuthorStatistics ast;
			bool newUser = false;

			if( ForumCore.PlayerStatistics.ContainsKey( pm.Serial.Value ) )
			{

				ast = ForumCore.GetAuthorStatistics( pm.Serial.Value );
			}
			else
			{
				ast = new AuthorStatistics( pm.Serial.Value, pm.Name, DateTime.Now, 0 );
				newUser = true;
			}

			ast.PostCount++;

			if( newUser )
			{
				if( !PlayerStatistics.ContainsKey( ast.Serial ) )
					PlayerStatistics.Add( ast.Serial, ast );
			}
		}