public int Add(string name, object value, string format)
        {
            ReportItem item = new ReportItem();

            item.Values.Add(name);
            item.Values.Add(value == null ? "" : value.ToString(), format);

            return this.Add(item);
        }
Exemple #2
0
        public static Report CompileFactionLeaderboard()
        {
            Report report = new Report( "Faction Leaderboard", "60%" );

            report.Columns.Add( "28%", "center", "Name" );
            report.Columns.Add( "28%", "center", "Faction" );
            report.Columns.Add( "28%", "center", "Office" );
            report.Columns.Add( "16%", "center", "Kill Points" );

            ArrayList list = new ArrayList();

            List<Faction> factions = Faction.Factions;

            for ( int i = 0; i < factions.Count; ++i )
            {
                Faction faction = factions[i];

                list.AddRange( faction.Members );
            }

            list.Sort();
            list.Reverse();

            for ( int i = 0; i < list.Count && i < 15; ++i )
            {
                PlayerState pl = (PlayerState)list[i];

                string office;

                if ( pl.Faction.Commander == pl.Mobile )
                    office = "Commanding Lord";
                else if ( pl.Finance != null )
                    office = String.Format( "{0} Finance Minister", pl.Finance.Definition.FriendlyName );
                else if ( pl.Sheriff != null )
                    office = String.Format( "{0} Sheriff", pl.Sheriff.Definition.FriendlyName );
                else
                    office = "";

                ReportItem item = new ReportItem();

                item.Values.Add( pl.Mobile.Name );
                item.Values.Add( pl.Faction.Definition.FriendlyName );
                item.Values.Add( office );
                item.Values.Add( pl.KillPoints.ToString(), "N0" );

                report.Items.Add( item );
            }

            return report;
        }
		public static Report CompileFactionTownReport()
		{
			Report report = new Report( "Faction Towns", "80%" );

			report.Columns.Add( "20%", "center", "Name" );
			report.Columns.Add( "20%", "center", "Owner" );
			report.Columns.Add( "17%", "center", "Sheriff" );
			report.Columns.Add( "17%", "center", "Finance Minister" );
			report.Columns.Add( "13%", "center", "Silver" );
			report.Columns.Add( "13%", "center", "Prices" );

			TownCollection towns = Town.Towns;

			for ( int i = 0; i < towns.Count; ++i )
			{
				Town town = towns[i];

				string prices = "Normal";

				if ( town.Tax < 0 )
					prices = town.Tax.ToString() + "%";
				else if ( town.Tax > 0 )
					prices = "+" + town.Tax.ToString() + "%";

				ReportItem item = new ReportItem();

				item.Values.Add( town.Definition.FriendlyName );
				item.Values.Add( town.Owner == null ? "Neutral" : town.Owner.Definition.FriendlyName );
				item.Values.Add( town.Sheriff == null ? "" : town.Sheriff.Name );
				item.Values.Add( town.Finance == null ? "" : town.Finance.Name );
				item.Values.Add( town.Silver.ToString(), "N0" );
				item.Values.Add( prices );

				report.Items.Add( item );
			}

			return report;
		}
		public static Report CompileSigilReport()
		{
			Report report = new Report( "Faction Town Sigils", "50%" );

			report.Columns.Add( "35%", "center", "Town" );
			report.Columns.Add( "35%", "center", "Controller" );
			report.Columns.Add( "30%", "center", "Capturable" );

			SigilCollection sigils = Sigil.Sigils;

			for ( int i = 0; i < sigils.Count; ++i )
			{
				Sigil sigil = sigils[i];

				string controller = "Unknown";

				Mobile mob = sigil.RootParent as Mobile;

				if ( mob != null )
				{
					Faction faction = Faction.Find( mob );

					if ( faction != null )
						controller = faction.Definition.FriendlyName;
				}
				else if ( sigil.LastMonolith != null && sigil.LastMonolith.Faction != null )
				{
					controller = sigil.LastMonolith.Faction.Definition.FriendlyName;
				}

				ReportItem item = new ReportItem();

				item.Values.Add( sigil.Town == null ? "" : sigil.Town.Definition.FriendlyName );
				item.Values.Add( controller );
				item.Values.Add( sigil.IsPurifying ? "No" : "Yes" );

				report.Items.Add( item );
			}

			return report;
		}
		public static Report CompileFactionReport()
		{
			Report report = new Report( "Faction Statistics", "80%" );

			report.Columns.Add( "20%", "center", "Name" );
			report.Columns.Add( "20%", "center", "Commander" );
			report.Columns.Add( "15%", "center", "Members" );
			report.Columns.Add( "15%", "center", "Merchants" );
			report.Columns.Add( "15%", "center", "Kill Points" );
			report.Columns.Add( "15%", "center", "Silver" );

			FactionCollection factions = Faction.Factions;

			for ( int i = 0; i < factions.Count; ++i )
			{
				Faction faction = factions[i];
				PlayerStateCollection members = faction.Members;

				int totalKillPoints = 0;
				int totalMerchants = 0;

				for ( int j = 0; j < members.Count; ++j )
				{
					totalKillPoints += members[j].KillPoints;

					if ( members[j].MerchantTitle != MerchantTitle.None )
						++totalMerchants;
				}

				ReportItem item = new ReportItem();

				item.Values.Add( faction.Definition.FriendlyName );
				item.Values.Add( faction.Commander == null ? "" : faction.Commander.Name );
				item.Values.Add( faction.Members.Count.ToString(), "N0" );
				item.Values.Add( totalMerchants.ToString(), "N0" );
				item.Values.Add( totalKillPoints.ToString(), "N0" );
				item.Values.Add( faction.Silver.ToString(), "N0" );

				report.Items.Add( item );
			}

			return report;
		}
Exemple #6
0
        private static Report CompileTop15()
        {
            Report report = new Report("Top 15 Duelists", "80%");

            report.Columns.Add("6%", "center", "Rank");
            report.Columns.Add("6%", "center", "Level");
            report.Columns.Add("6%", "center", "Guild");
            report.Columns.Add("70%", "left", "Name");
            report.Columns.Add("6%", "center", "Wins");
            report.Columns.Add("6%", "center", "Losses");

            Ladder ladder = Ladder.Instance;

            if (ladder != null)
            {
                ArrayList entries = ladder.ToArrayList();

                for (int i = 0; i < entries.Count && i < 15; ++i)
                {
                    LadderEntry entry = (LadderEntry)entries[i];
                    int level = Ladder.GetLevel(entry.Experience);
                    string guild = "";

                    if (entry.Mobile.Guild != null)
                        guild = entry.Mobile.Guild.Abbreviation;

                    ReportItem item = new ReportItem();

                    item.Values.Add(LadderGump.Rank(entry.Index + 1));
                    item.Values.Add(level.ToString(), "N0");
                    item.Values.Add(guild);
                    item.Values.Add(entry.Mobile.Name);
                    item.Values.Add(entry.Wins.ToString(), "N0");
                    item.Values.Add(entry.Losses.ToString(), "N0");

                    report.Items.Add(item);
                }
            }

            return report;
        }
 /// <summary>
 /// Retrieve the index a specified Server.Engines.Reports.ReportItem instance is in this collection.
 /// </summary>
 /// <param name="value">Server.Engines.Reports.ReportItem instance to find.</param>
 /// <returns>The zero-based index of the specified Server.Engines.Reports.ReportItem instance. If the object is not found, the return value is -1.</returns>
 public int IndexOf(ReportItem value)
 {
     return List.IndexOf(value);
 }
 /// <summary>
 /// Removes a specified Server.Engines.Reports.ReportItem instance from this collection.
 /// </summary>
 /// <param name="value">The Server.Engines.Reports.ReportItem instance to remove.</param>
 public void Remove(ReportItem value)
 {
     List.Remove(value);
 }
 /// <summary>
 /// Append a Server.Engines.Reports.ReportItem entry to this collection.
 /// </summary>
 /// <param name="value">Server.Engines.Reports.ReportItem instance.</param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(ReportItem value)
 {
     return List.Add(value);
 }
 /// <summary>
 /// Determines whether a specified Server.Engines.Reports.ReportItem instance is in this collection.
 /// </summary>
 /// <param name="value">Server.Engines.Reports.ReportItem instance to search for.</param>
 /// <returns>True if the Server.Engines.Reports.ReportItem instance is in the collection; otherwise false.</returns>
 public bool Contains(ReportItem value)
 {
     return List.Contains(value);
 }
 /// <summary>
 /// Advances the enumerator to the next queue of the enumeration, if one is currently available.
 /// </summary>
 /// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns>
 public bool MoveNext()
 {
     if ((_index 
                 < (_collection.Count - 1)))
     {
         _index = (_index + 1);
         _currentElement = _collection[_index];
         return true;
     }
     _index = _collection.Count;
     return false;
 }
 /// <summary>
 /// Reset the cursor, so it points to the beginning of the enumerator.
 /// </summary>
 public void Reset()
 {
     _index = -1;
     _currentElement = null;
 }
 /// <summary>
 /// Insert a Server.Engines.Reports.ReportItem instance into this collection at a specified index.
 /// </summary>
 /// <param name="index">Zero-based index.</param>
 /// <param name="value">The Server.Engines.Reports.ReportItem instance to insert.</param>
 public void Insert(int index, ReportItem value)
 {
     List.Insert(index, value);
 }
Exemple #14
0
        private void RenderReport(Report report, HtmlTextWriter html)
        {
            html.AddAttribute(HtmlAttr.Width, report.Width);
            html.AddAttribute(HtmlAttr.Cellpadding, "0");
            html.AddAttribute(HtmlAttr.Cellspacing, "0");
            html.AddAttribute(HtmlAttr.Border, "0");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Class, "tbl-border");
            html.RenderBeginTag(HtmlTag.Td);

            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Cellpadding, "4");
            html.AddAttribute(HtmlAttr.Cellspacing, "1");
            html.RenderBeginTag(HtmlTag.Table);

            html.RenderBeginTag(HtmlTag.Tr);
            html.AddAttribute(HtmlAttr.Colspan, "10");
            html.AddAttribute(HtmlAttr.Width, "100%");
            html.AddAttribute(HtmlAttr.Align, "center");
            html.AddAttribute(HtmlAttr.Class, "header");
            html.RenderBeginTag(HtmlTag.Td);
            html.Write(report.Name);
            html.RenderEndTag();
            html.RenderEndTag();

            bool isNamed = false;

            for (int i = 0; i < report.Columns.Count && !isNamed; ++i)
            {
                isNamed = (report.Columns[i].Name != null);
            }

            if (isNamed)
            {
                html.RenderBeginTag(HtmlTag.Tr);

                for (int i = 0; i < report.Columns.Count; ++i)
                {
                    ReportColumn column = report.Columns[i];

                    html.AddAttribute(HtmlAttr.Class, "header");
                    html.AddAttribute(HtmlAttr.Width, column.Width);
                    html.AddAttribute(HtmlAttr.Align, column.Align);
                    html.RenderBeginTag(HtmlTag.Td);

                    html.Write(column.Name);

                    html.RenderEndTag();
                }

                html.RenderEndTag();
            }

            for (int i = 0; i < report.Items.Count; ++i)
            {
                ReportItem item = report.Items[i];

                html.RenderBeginTag(HtmlTag.Tr);

                for (int j = 0; j < item.Values.Count; ++j)
                {
                    if (!isNamed && j == 0)
                    {
                        html.AddAttribute(HtmlAttr.Width, report.Columns[j].Width);
                    }

                    html.AddAttribute(HtmlAttr.Align, report.Columns[j].Align);
                    html.AddAttribute(HtmlAttr.Class, "entry");
                    html.RenderBeginTag(HtmlTag.Td);

                    if (item.Values[j].Format == null)
                    {
                        html.Write(item.Values[j].Value);
                    }
                    else
                    {
                        html.Write(int.Parse(item.Values[j].Value).ToString(item.Values[j].Format));
                    }

                    html.RenderEndTag();
                }

                html.RenderEndTag();
            }

            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
            html.RenderEndTag();
        }
Exemple #15
0
        private void RenderReport(Report report, XmlWriter html)
        {
            html.WriteStartElement("table");
            html.WriteAttributeString("width", report.Width);
            html.WriteAttributeString("cellpadding", "0");
            html.WriteAttributeString("cellspacing", "0");
            html.WriteAttributeString("border", "0");

            html.WriteStartElement("tr");
            html.WriteStartElement("td");
            html.WriteAttributeString("class", "tbl-border");

            html.WriteStartElement("table");
            html.WriteAttributeString("width", "100%");
            html.WriteAttributeString("cellpadding", "4");
            html.WriteAttributeString("cellspacing", "1");

            html.WriteStartElement("tr");
            html.WriteStartElement("td");
            html.WriteAttributeString("colspan", "10");
            html.WriteAttributeString("width", "100%");
            html.WriteAttributeString("align", "center");
            html.WriteAttributeString("class", "header");
            html.WriteValue(report.Name);
            html.WriteEndElement();
            html.WriteEndElement();

            bool isNamed = false;

            for (int i = 0; i < report.Columns.Count && !isNamed; ++i)
            {
                isNamed = (report.Columns[i].Name != null);
            }

            if (isNamed)
            {
                html.WriteStartElement("tr");

                for (int i = 0; i < report.Columns.Count; ++i)
                {
                    ReportColumn column = report.Columns[i];

                    html.WriteStartElement("td");
                    html.WriteAttributeString("class", "header");
                    html.WriteAttributeString("width", column.Width);
                    html.WriteAttributeString("align", column.Align);

                    html.WriteValue(column.Name);

                    html.WriteEndElement();
                }

                html.WriteEndElement();
            }

            for (int i = 0; i < report.Items.Count; ++i)
            {
                ReportItem item = report.Items[i];

                html.WriteStartElement("tr");

                for (int j = 0; j < item.Values.Count; ++j)
                {
                    html.WriteStartElement("td");
                    if (!isNamed && j == 0)
                    {
                        html.WriteAttributeString("width", report.Columns[j].Width);
                    }

                    html.WriteAttributeString("align", report.Columns[j].Align);
                    html.WriteAttributeString("class", "entry");

                    if (item.Values[j].Format == null)
                    {
                        html.WriteValue(item.Values[j].Value);
                    }
                    else
                    {
                        html.WriteValue(int.Parse(item.Values[j].Value).ToString(item.Values[j].Format));
                    }

                    html.WriteEndElement();
                }

                html.WriteEndElement();
            }

            html.WriteEndElement();
            html.WriteEndElement();
            html.WriteEndElement();
            html.WriteEndElement();
        }