Beispiel #1
0
        public ArenaGump(Mobile from, ArenasMoongate gate) : base(50, 50)
        {
            m_From   = from;
            m_Gate   = gate;
            m_Arenas = Arena.Arenas;

            AddPage(0);

            var height = 12 + 20 + m_Arenas.Count * 31 + 24 + 12;

            AddBackground(0, 0, 499 + 40, height, 0x2436);

            var list = m_Arenas;

            for (var i = 1; i < list.Count; i += 2)
            {
                AddImageTiled(12, 32 + i * 31, 475 + 40, 30, 0x2430);
            }

            AddAlphaRegion(10, 10, 479 + 40, height - 20);

            AddColumnHeader(35, null);
            AddColumnHeader(115, "Arena");
            AddColumnHeader(325, "Participants");
            AddColumnHeader(40, "Obs");

            AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
            AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2);

            for (var i = 0; i < list.Count; ++i)
            {
                var ar = list[i];

                var x = 12;
                var y = 32 + i * 31;

                var color = ar.Players.Count > 0 ? 0xCCFFCC : 0xCCCCCC;

                AddRadio(x + 3, y + 1, 9727, 9730, false, i);
                x += 35;

                AddBorderedText(x + 5, y + 5, 115 - 5, ar.Name ?? "(no name)", color, 0);
                x += 115;

                var sb = new StringBuilder();

                if (ar.Players.Count > 0)
                {
                    var ladder = Ladder.Instance;

                    if (ladder == null)
                    {
                        continue;
                    }

                    LadderEntry p1 = null, p2 = null, p3 = null, p4 = null;

                    for (var j = 0; j < ar.Players.Count; ++j)
                    {
                        var mob = ar.Players[j];
                        var c   = ladder.Find(mob);

                        if (p1 == null || c.Index < p1.Index)
                        {
                            p4 = p3;
                            p3 = p2;
                            p2 = p1;
                            p1 = c;
                        }
                        else if (p2 == null || c.Index < p2.Index)
                        {
                            p4 = p3;
                            p3 = p2;
                            p2 = c;
                        }
                        else if (p3 == null || c.Index < p3.Index)
                        {
                            p4 = p3;
                            p3 = c;
                        }
                        else if (p4 == null || c.Index < p4.Index)
                        {
                            p4 = c;
                        }
                    }

                    Append(sb, p1);
                    Append(sb, p2);
                    Append(sb, p3);
                    Append(sb, p4);

                    if (ar.Players.Count > 4)
                    {
                        sb.Append(", ...");
                    }
                }
                else
                {
                    sb.Append("Empty");
                }

                AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0);
                x += 325;

                AddBorderedText(x, y + 5, 40, Center(ar.Spectators.ToString()), color, 0);
            }
        }
Beispiel #2
0
		public ArenaGump( Mobile from, ArenasMoongate gate ) : base( 50, 50 )
		{
			m_From = from;
			m_Gate = gate;
			m_Arenas = Arena.Arenas;

			AddPage( 0 );

			int height = 12 + 20 + (m_Arenas.Count * 31) + 24 + 12;

			AddBackground( 0, 0, 499+40, height, 0x2436 );

			List<Arena> list = m_Arenas;

			for ( int i = 1; i < list.Count; i += 2 )
				AddImageTiled( 12, 32 + (i * 31), 475+40, 30, 0x2430 );

			AddAlphaRegion( 10, 10, 479+40, height - 20 );

			AddColumnHeader(  35, null );
			AddColumnHeader( 115, "Arena" );
			AddColumnHeader( 325, "Participants" );
			AddColumnHeader(  40, "Obs" );

			AddButton( 499+40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0 );
			AddButton( 499+40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0 );

			for ( int i = 0; i < list.Count; ++i )
			{
				Arena ar = list[i];

				string name = ar.Name;

				if ( name == null )
					name = "(no name)";

				int x = 12;
				int y = 32 + (i * 31);

				int color = ( ar.Players.Count > 0 ? 0xCCFFCC : 0xCCCCCC );

				AddRadio( x + 3, y + 1, 9727, 9730, false, i );
				x += 35;

				AddBorderedText( x + 5, y + 5, 115 - 5, name, color, 0 );
				x += 115;

				StringBuilder sb = new StringBuilder();

				if ( ar.Players.Count > 0 )
				{
					Ladder ladder = Ladder.Instance;

					if ( ladder == null )
						continue;

					LadderEntry p1 = null, p2 = null, p3 = null, p4 = null;

					for ( int j = 0; j < ar.Players.Count; ++j )
					{
						Mobile mob = (Mobile)ar.Players[j];
						LadderEntry c = ladder.Find( mob );

						if ( p1 == null || c.Index < p1.Index )
						{
							p4 = p3;
							p3 = p2;
							p2 = p1;
							p1 = c;
						}
						else if ( p2 == null || c.Index < p2.Index )
						{
							p4 = p3;
							p3 = p2;
							p2 = c;
						}
						else if ( p3 == null || c.Index < p3.Index )
						{
							p4 = p3;
							p3 = c;
						}
						else if ( p4 == null || c.Index < p4.Index )
						{
							p4 = c;
						}
					}

					Append( sb, p1 );
					Append( sb, p2 );
					Append( sb, p3 );
					Append( sb, p4 );

					if ( ar.Players.Count > 4 )
						sb.Append( ", ..." );
				}
				else
				{
					sb.Append( "Empty" );
				}

				AddBorderedText( x + 5, y + 5, 325 - 5, sb.ToString(), color, 0 );
				x += 325;

				AddBorderedText( x, y + 5, 40, Center( ar.Spectators.ToString() ), color, 0 );
			}
		}
Beispiel #3
0
        public ArenaGump(Mobile from, ArenasMoongate gate)
            : base(50, 50)
        {
            this.m_From   = from;
            this.m_Gate   = gate;
            this.m_Arenas = Arena.Arenas;

            this.AddPage(0);

            int height = 12 + 20 + (this.m_Arenas.Count * 31) + 24 + 12;

            this.AddBackground(0, 0, 499 + 40, height, 0x2436);

            List <Arena> list = this.m_Arenas;

            for (int i = 1; i < list.Count; i += 2)
            {
                this.AddImageTiled(12, 32 + (i * 31), 475 + 40, 30, 0x2430);
            }

            this.AddAlphaRegion(10, 10, 479 + 40, height - 20);

            this.AddColumnHeader(35, null);
            this.AddColumnHeader(115, "Arena");
            this.AddColumnHeader(325, "Participants");
            this.AddColumnHeader(40, "Obs");

            this.AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
            this.AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);

            for (int i = 0; i < list.Count; ++i)
            {
                Arena ar = list[i];

                string name = ar.Name;

                if (name == null)
                {
                    name = "(no name)";
                }

                int x = 12;
                int y = 32 + (i * 31);

                int color = (ar.Players.Count > 0 ? 0xCCFFCC : 0xCCCCCC);

                this.AddRadio(x + 3, y + 1, 9727, 9730, false, i);
                x += 35;

                this.AddBorderedText(x + 5, y + 5, 115 - 5, name, color, 0);
                x += 115;

                StringBuilder sb = new StringBuilder();

                if (ar.Players.Count > 0)
                {
                    Ladder ladder = Ladder.Instance;

                    if (ladder == null)
                    {
                        continue;
                    }

                    LadderEntry p1 = null, p2 = null, p3 = null, p4 = null;

                    for (int j = 0; j < ar.Players.Count; ++j)
                    {
                        Mobile      mob = (Mobile)ar.Players[j];
                        LadderEntry c   = ladder.Find(mob);

                        if (p1 == null || c.Index < p1.Index)
                        {
                            p4 = p3;
                            p3 = p2;
                            p2 = p1;
                            p1 = c;
                        }
                        else if (p2 == null || c.Index < p2.Index)
                        {
                            p4 = p3;
                            p3 = p2;
                            p2 = c;
                        }
                        else if (p3 == null || c.Index < p3.Index)
                        {
                            p4 = p3;
                            p3 = c;
                        }
                        else if (p4 == null || c.Index < p4.Index)
                        {
                            p4 = c;
                        }
                    }

                    this.Append(sb, p1);
                    this.Append(sb, p2);
                    this.Append(sb, p3);
                    this.Append(sb, p4);

                    if (ar.Players.Count > 4)
                    {
                        sb.Append(", ...");
                    }
                }
                else
                {
                    sb.Append("Empty");
                }

                this.AddBorderedText(x + 5, y + 5, 325 - 5, sb.ToString(), color, 0);
                x += 325;

                this.AddBorderedText(x, y + 5, 40, this.Center(ar.Spectators.ToString()), color, 0);
            }
        }