Пример #1
0
        /// <summary>
        /// Gets the total resource space
        /// </summary>
        /// <remarks>This is the (warehouse - hiding place) * 3</remarks>
        public int GetTotalResourceRoom()
        {
            if (Buildings != null)
            {
                ReportBuilding warehouse = null, hide = null;
                if (Buildings.ContainsKey(BuildingTypes.Warehouse))
                {
                    warehouse = Buildings[BuildingTypes.Warehouse];
                }
                if (Buildings.ContainsKey(BuildingTypes.HidingPlace))
                {
                    hide = Buildings[BuildingTypes.HidingPlace];
                }

                if (warehouse != null)
                {
                    int room = warehouse.GetTotalProduction();
                    if (hide != null)
                    {
                        room -= hide.GetTotalProduction();
                    }
                    return(room * 3);
                }
            }
            return(0);
        }
Пример #2
0
        public string BbCodeStandard()
        {
            // players
            var str = new StringBuilder(200);

            PrintPlayers(str);

            if (_report.ReportDate.HasValue)
            {
                str.Append(Environment.NewLine);
                TimeSpan span = World.Default.Settings.ServerTime - _report.ReportDate.Value;
                if (span.TotalHours < 1)
                {
                    str.Append(string.Format("Date: {0}", _report.ReportDate.Value));
                }
                else
                {
                    str.Append(string.Format("Date: {0} ({1} hours ago)", _report.ReportDate.Value, Math.Round(span.TotalHours)));
                }
            }

            // resources
            if (_report.ReportOptions.ResourceDetails || true)
            {
                str.Append(PrintResources());
            }

            // Troops
            if (_report.ReportOptions.AttackingTroops)
            {
                str.Append(PrintTroops("Attacker:", _report.Attack, true));
            }
            if (_report.ReportOptions.DefendingTroops)
            {
                str.Append(PrintTroops("Defender:", _report.Defense, false));
            }

            // print free space
            if (_report.ReportOptions.People)
            {
                string space = Environment.NewLine + Resource.FaceBBCodeString;
                space += "[b]" + Report.GetTotalPeople(_report.Defense, TotalPeople.End).ToString("#,0") + "[/b]";
                if (_report.Buildings != null && _report.Buildings.Count > 2)
                {
                    int farmBuildings = _report.GetTotalPeopleInBuildings();

                    if (farmBuildings > 0)
                    {
                        space += string.Format(" + {0:#,0}", farmBuildings);
                    }

                    if (_report.Buildings.ContainsKey(BuildingTypes.Farm))
                    {
                        ReportBuilding farm      = _report.Buildings[BuildingTypes.Farm];
                        int            totalFarm = farm.GetTotalProduction();
                        //space += string.Format(" + {0:#,0}", farmBuildings);
                        space = string.Format("{1} ({0:#,0} free)", totalFarm - farmBuildings - Report.GetTotalPeople(_report.Defense, TotalPeople.End), space);
                    }
                }
                if (space.Length > 0)
                {
                    if (Report.GetTotalPeople(_report.Defense, TotalPeople.Start) == 0)
                    {
                        str.Append(Environment.NewLine + Environment.NewLine + "[b]Defender:[/b]");
                    }
                    str.Append(space);
                }
            }

            // Buildings
            if (_report.ReportOptions.Buildings)
            {
                str.Append(PrintBuildings("Buildings:", _report.Buildings));
            }

            return(str.ToString());
        }