Exemplo n.º 1
0
        public static Chart CompileRaceChart()
        {
            PieChart chart = new PieChart("Race Distribution", "graphs_race_distrib", true);

            ChartItem humanItem = new ChartItem("Humans", 0);
            ChartItem elfItem   = new ChartItem("Elves", 0);
            ChartItem dwarfItem = new ChartItem("Dwarves", 0);
            ChartItem drowItem  = new ChartItem("Drow", 0);
            ChartItem orcItem   = new ChartItem("Orcs", 0);
            ChartItem gnomeItem = new ChartItem("Gnomes", 0);
            ChartItem gobItem   = new ChartItem("Goblins", 0);
            ChartItem frostItem = new ChartItem("Frostling", 0);


            foreach (Mobile mob in World.Mobiles.Values)
            {
                if (mob != null && mob is TeiravonMobile)
                {
                    TeiravonMobile tav  = mob as TeiravonMobile;
                    Account        acct = (Account)tav.Account;
                    if ((acct.LastLogin + TimeSpan.FromDays(30.0)) < DateTime.Now)
                    {
                        continue;
                    }

                    if (tav.IsHuman())
                    {
                        humanItem.Value++;
                    }
                    else if (tav.IsElf())
                    {
                        elfItem.Value++;
                    }
                    else if (tav.IsDwarf())
                    {
                        dwarfItem.Value++;
                    }
                    else if (tav.IsDrow())
                    {
                        drowItem.Value++;
                    }
                    else if (tav.IsOrc())
                    {
                        orcItem.Value++;
                    }
                    else if (tav.IsGnome())
                    {
                        gnomeItem.Value++;
                    }
                    else if (tav.IsGoblin())
                    {
                        gobItem.Value++;
                    }
                    else if (tav.IsFrostling())
                    {
                        frostItem.Value++;
                    }
                }
            }

            chart.Items.Add(humanItem);
            chart.Items.Add(elfItem);
            chart.Items.Add(dwarfItem);
            chart.Items.Add(drowItem);
            chart.Items.Add(orcItem);
            chart.Items.Add(gnomeItem);
            chart.Items.Add(gobItem);
            chart.Items.Add(frostItem);

            return(chart);
        }