diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index e8f0c5ddd5..4fbdae0ae0 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -522,13 +522,11 @@ - - diff --git a/OpenRA.Mods.Common/UtilityCommands/ActorStatsExport.cs b/OpenRA.Mods.Common/UtilityCommands/ActorStatsExport.cs deleted file mode 100644 index ab7368b82c..0000000000 --- a/OpenRA.Mods.Common/UtilityCommands/ActorStatsExport.cs +++ /dev/null @@ -1,100 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using OpenRA.Mods.Common.Traits; -using OpenRA.Mods.Common.Warheads; -using OpenRA.Traits; - -namespace OpenRA.Mods.Common.UtilityCommands -{ - public static class ActorStatsExport - { - public static DataTable GenerateTable() - { - var rules = Game.ModData.RulesetCache.Load(); - - var table = new DataTable(); - table.Columns.Add("Name", typeof(string)); - table.Columns.Add("Cost", typeof(int)); - table.Columns.Add("HitPoints", typeof(int)); - table.Columns.Add("Armor", typeof(string)); - table.Columns.Add("Damage /s", typeof(float)); - - var armorList = new List(); - foreach (var actorInfo in rules.Actors.Values) - { - var armor = actorInfo.Traits.GetOrDefault(); - if (armor != null) - if (!armorList.Contains(armor.Type)) - armorList.Add(armor.Type); - } - - armorList.Sort(); - foreach (var armorType in armorList) - table.Columns.Add("vs. " + armorType, typeof(float)); - - foreach (var actorInfo in rules.Actors.Values) - { - if (actorInfo.Name.StartsWith("^")) - continue; - - var buildable = actorInfo.Traits.GetOrDefault(); - if (buildable == null) - continue; - - var row = table.NewRow(); - var tooltip = actorInfo.Traits.GetOrDefault(); - row["Name"] = tooltip != null ? tooltip.Name : actorInfo.Name; - - var value = actorInfo.Traits.GetOrDefault(); - row["Cost"] = value != null ? value.Cost : 0; - - var health = actorInfo.Traits.GetOrDefault(); - row["HitPoints"] = health != null ? health.HP : 0; - - var armor = actorInfo.Traits.GetOrDefault(); - row["Armor"] = armor != null ? armor.Type : ""; - - var armaments = actorInfo.Traits.WithInterface(); - if (armaments.Any()) - { - var weapons = armaments.Select(a => rules.Weapons[a.Weapon.ToLowerInvariant()]); - foreach (var weapon in weapons) - { - var warhead = weapon.Warheads.FirstOrDefault(w => (w is DamageWarhead)) as DamageWarhead; - if (warhead != null) - { - var rateOfFire = weapon.ReloadDelay > 1 ? weapon.ReloadDelay : 1; - var burst = weapon.Burst; - var delay = weapon.BurstDelay; - var damage = warhead.Damage; - var damagePerSecond = (1000f / Game.Timestep) * (damage * burst) / (delay + burst * rateOfFire); - row["Damage /s"] = Math.Round(damagePerSecond, 1, MidpointRounding.AwayFromZero); - - foreach (var armorType in armorList) - { - var vs = warhead.Versus.ContainsKey(armorType) ? warhead.Versus[armorType] : 100; - row["vs. " + armorType] = Math.Round(damagePerSecond * vs / 100, 1, MidpointRounding.AwayFromZero); - } - } - } - } - - table.Rows.Add(row); - } - - return table; - } - } -} \ No newline at end of file diff --git a/OpenRA.Mods.Common/UtilityCommands/ExportCharacterSeparatedRules.cs b/OpenRA.Mods.Common/UtilityCommands/ExportCharacterSeparatedRules.cs deleted file mode 100644 index 27e0f59b05..0000000000 --- a/OpenRA.Mods.Common/UtilityCommands/ExportCharacterSeparatedRules.cs +++ /dev/null @@ -1,40 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.IO; - -namespace OpenRA.Mods.Common.UtilityCommands -{ - class ExportCharacterSeparatedRules : IUtilityCommand - { - public string Name { get { return "--generate-dps-table"; } } - - [Desc("Export the damage per second evaluation into a CSV file for inspection.")] - public void Run(ModData modData, string[] args) - { - Game.ModData = modData; - var table = ActorStatsExport.GenerateTable(); - var filename = "{0}-mod-dps.csv".F(Game.ModData.Manifest.Mod.Id); - - try - { - using (var outfile = new StreamWriter(filename)) - outfile.Write(table.ToCharacterSeparatedValues(";", true)); - Console.WriteLine("{0} has been saved.".F(filename)); - Console.WriteLine("Open as values separated by semicolon."); - } - catch (UnauthorizedAccessException e) - { - Console.WriteLine(e.Message); - } - } - } -}