public List <LegionHero> GetHeroes(LegionDatabase Database) { this.Process(); List <LegionHero> Builders = new List <LegionHero>(); if (HeroName != null) { for (int i = 0; i < HeroName.Count; ++i) { // Create hero LegionHero Hero = new LegionHero(); // Set details Hero.HeroName = HeroName[i]; Hero.DotaHeroOverride = DotaHeroOverride[i]; Hero.LegionUnitPrefix = LegionUnitPrefix[i]; Hero.BaseSpawnAbility = BaseSpawnAbility[i]; Hero.SellUnitAbility = SellUnitAbility[i]; // Add unit to list Builders.Add(Hero); } } return(Builders); }
public List<LegionHero> GetHeroes(LegionDatabase Database) { this.Process(); List<LegionHero> Builders = new List<LegionHero>(); if (HeroName != null) { for (int i = 0; i < HeroName.Count; ++i) { // Create hero LegionHero Hero = new LegionHero(); // Set details Hero.HeroName = HeroName[i]; Hero.DotaHeroOverride = DotaHeroOverride[i]; Hero.LegionUnitPrefix = LegionUnitPrefix[i]; Hero.BaseSpawnAbility = BaseSpawnAbility[i]; Hero.SellUnitAbility = SellUnitAbility[i]; // Add unit to list Builders.Add(Hero); } } return Builders; }
public List <LegionAbility> GetAbilities(LegionDatabase Database) { // Process abilities data this.Process(); List <LegionAbility> Abilities = new List <LegionAbility>(); if (AbilityID != null) { for (int i = 0; i < AbilityID.Count; ++i) { // Build ability data LegionAbility Ability = new LegionAbility(); Ability.AbilityID = AbilityID[i]; Ability.AbilityFile = AbilityFile[i]; Ability.AbilityValues = AbilityValues[i]; Ability.AbilityUnitAI = AbilityUnitAI[i]; Ability.AbilityTexture = AbilityTexture[i]; // Add ability Abilities.Add(Ability); } } return(Abilities); }
public List <LocalizedLanguage> GetLanguages(LegionDatabase Database) { this.Process(); List <LocalizedLanguage> Languages = new List <LocalizedLanguage>(); // Generate language parents for (int i = 0; i < LANGUAGES.Length; ++i) { LocalizedLanguage Lang = new LocalizedLanguage(); Lang.LanguageId = LANGUAGES[i]; Lang.Keys = new List <string>(); Lang.Values = new List <string>(); Languages.Add(Lang); } // Generate localized languages for (int i = 0; i < LANGUAGES.Length; ++i) { LocalizedLanguage Lang = new LocalizedLanguage(); Lang.LanguageId = LANGUAGES[i]; Lang.ParentDataTable = this; Lang.Keys = Keys ?? new List <string>(); Lang.Values = English ?? new List <string>(); Languages.Add(Lang); } return(Languages); }
public List<LegionAbility> GetAbilities(LegionDatabase Database) { // Process abilities data this.Process(); List<LegionAbility> Abilities = new List<LegionAbility>(); if (AbilityID != null) { for (int i = 0; i < AbilityID.Count; ++i) { // Build ability data LegionAbility Ability = new LegionAbility(); Ability.AbilityID = AbilityID[i]; Ability.AbilityFile = AbilityFile[i]; Ability.AbilityValues = AbilityValues[i]; Ability.AbilityUnitAI = AbilityUnitAI[i]; Ability.AbilityTexture = AbilityTexture[i]; // Add ability Abilities.Add(Ability); } } return Abilities; }
public List<LocalizedLanguage> GetLanguages(LegionDatabase Database) { this.Process(); List<LocalizedLanguage> Languages = new List<LocalizedLanguage>(); // Generate language parents for (int i = 0; i < LANGUAGES.Length; ++i) { LocalizedLanguage Lang = new LocalizedLanguage(); Lang.LanguageId = LANGUAGES[i]; Lang.Keys = new List<string>(); Lang.Values = new List<string>(); Languages.Add(Lang); } // Generate localized languages for (int i = 0; i < LANGUAGES.Length; ++i) { LocalizedLanguage Lang = new LocalizedLanguage(); Lang.LanguageId = LANGUAGES[i]; Lang.ParentDataTable = this; Lang.Keys = Keys ?? new List<string>(); Lang.Values = English ?? new List<string>(); Languages.Add(Lang); } return Languages; }
public LegionDatabase Load() { if (File.Exists(SAVE_PATH)) { TextReader Reader = new StreamReader(SAVE_PATH, Encoding.UTF8); string JsonData = Reader.ReadToEnd(); Reader.Close(); LegionDatabase Database = JsonConvert.DeserializeObject <LegionDatabase>(JsonData); return(Database); } return(null); }
protected void GenerateHeroesFile(LegionDatabase Database) { // Load hero data template file string HeroTemplateFile = LoadTemplateFile(HERO_TEMPLATE_FILE); // Generate hero data List<string> GeneratedHeroData = GenerateDataForList<LegionHero>(HeroTemplateFile, Database.LegionHeroes, "Hero"); // Build heroes data and output string HeroesBuildFile = GenerateBuildFile(CUSTOM_HEROES_TEMPLATE_FILE, GeneratedHeroData, "{Heroes}"); SaveDataToFile(CUSTOM_HEROES_OUTPUT_FILE, HeroesBuildFile); }
protected void GenerateAbilitiesFile(LegionDatabase Database) { // Load ability templates string SummonAbilityTemplate = LoadTemplateFile(SPAWN_UNIT_TEMPLATE); string UpgradeAbilityTemplate = LoadTemplateFile(UPGRADE_UNIT_TEMPLATE); // Generate data from each unit List<string> SummonAbilities = GenerateDataForList<LegionUnit>(SummonAbilityTemplate, GetSummonableUnits(Database), "Unit"); List<string> UpgradeAbilities = GenerateDataForList<LegionUnit>(UpgradeAbilityTemplate, GetUpgradeUnits(Database), "Unit"); // Generate data for unit abilities List<string> UnitAbilities = new List<string>(); foreach (LegionUnit Unit in Database.GetUnits()) { foreach (LegionAbility Ability in Unit.LegionAbilities) { string AbilityFilePath = string.Format(UNIT_ABILITIES_TEMPLATE, Ability.AbilityFile); string AbilityTemplate = LoadTemplateFile(AbilityFilePath); AbilityTemplate = ProcessTemplate<LegionUnit>(AbilityTemplate, Unit, "Unit"); AbilityTemplate = ProcessTemplate<LegionAbility>(AbilityTemplate, Ability, "Ability"); UnitAbilities.Add(AbilityTemplate); } } // Merge all data List<string> GeneratedAbilitiesData = new List<string>(); GeneratedAbilitiesData = GeneratedAbilitiesData.Concat(SummonAbilities).ToList(); GeneratedAbilitiesData = GeneratedAbilitiesData.Concat(UpgradeAbilities).ToList(); GeneratedAbilitiesData = GeneratedAbilitiesData.Concat(UnitAbilities).ToList(); // Generate sell abilities for all heroes foreach(LegionHero Hero in Database.GetHeroes()) { string SellUnitTemplate = LoadTemplateFile(SELL_UNIT_ABILITY_TEMPLATE); SellUnitTemplate = ProcessTemplate<LegionHero>(SellUnitTemplate, Hero, "Hero"); GeneratedAbilitiesData.Add(SellUnitTemplate); } // Add external data foreach (string ExternalPath in EXTERNAL_ABILITIES) { string UnitData = LoadTemplateFile(ExternalPath); GeneratedAbilitiesData.Add(UnitData); } // Generate file and save string AbilityBuildFile = GenerateBuildFile(CUSTOM_ABILITIES_FILE, GeneratedAbilitiesData, "{Abilities}"); SaveDataToFile(CUSTOM_ABILITIES_OUTPUT, AbilityBuildFile); }
public override void Generate(LegionDatabase Database) { // Units data string UnitTemplateFile = LoadTemplateFile(UNIT_TEMPLATE_FILE); List<string> GeneratedUnitData = GenerateDataForList<LegionUnit>(UnitTemplateFile, Database.LegionUnits, "Unit"); // Add data from external unit files foreach (string ExternalPath in EXTERNAL_UNITS) { string UnitData = LoadTemplateFile(ExternalPath); GeneratedUnitData.Add(UnitData); } // Generate file and save string UnitBuildFile = GenerateBuildFile(UNIT_OUTPUT_TEMPLATE, GeneratedUnitData, "{Units}"); SaveDataToFile(UNIT_OUTPUT, UnitBuildFile); }
protected void GenerateHeroList(LegionDatabase Database) { // Load hero list template string HeroListTemplateFile = LoadTemplateFile(HERO_LIST_TEMPLATE_FILE); // Build hero list string HeroList = HeroListTemplateFile; StringBuilder HeroListBuilder = new StringBuilder(); foreach (LegionHero Hero in Database.LegionHeroes) { string HeroListItem = string.Format(Constants.HERO_LIST_HERO_KV, Hero.DotaHeroOverride, Constants.MAX_SINGLE_HERO); HeroListBuilder.AppendLine(HeroListItem); } HeroList = HeroList.Replace("{Heroes}", HeroListBuilder.ToString()); // Save hero list to file SaveDataToFile(HERO_LIST_OUTPUT_FILE, HeroList); }
public override void Generate(LegionDatabase Database) { DictionaryUtils.ClearMissingKeys(); LanguageTemplateFile = LoadTemplateFile(TEMPLATE_FILE); // Process languages foreach (var Language in LocalizationDataTable.LANGUAGES) { GenerateLocalizationFile(Language, Database); } // Export missing keys list if (DictionaryUtils.GetMissingsKeys().Count > 0) { StringBuilder Builder = new StringBuilder(); Builder.AppendLine(MISSING_KEYS_HEADER); foreach (object Key in DictionaryUtils.GetMissingsKeys()) { Builder.AppendLine(Key.ToString()); } SaveDataToFile(MISSING_KEYS_FILE, Builder.ToString()); } }
public void Setup() { ActiveDatabase = this; }
protected void GenerateSummonAbilitiesLua(LegionDatabase Database) { // Load template string AbilityTemplateFile = LoadTemplateFile(SPAWN_UNIT_LUA_TEMPLATE); // Generate for all summonable units foreach (LegionUnit Unit in GetSummonableUnits(Database)) { // Process template string UnitTemplate = AbilityTemplateFile; UnitTemplate = ProcessTemplate<LegionUnit>(UnitTemplate, Unit, "Unit"); // Save unit lua string OutputFile = string.Format(LUA_SPAWN_ABILITY_OUTPUT, Unit.SummonAbility); SaveDataToFile(OutputFile, UnitTemplate); } }
void GenerateLocalizationFile(string Language, LegionDatabase Database) { Console.WriteLine("Generating language: " + Language); Dictionary<string, string> LocalizedList = new Dictionary<string, string>(); // Build tokens for file StringBuilder TokenBuilder = new StringBuilder(); foreach(var DataTable in Database.LocalizationDataTables) { var Flags = BindingFlags.Instance | BindingFlags.Public; var Fields = DataTable.GetType().GetFields(Flags).ToList(); var LanguageList = (List<string>) Fields.First(x => x.Name == Language).GetValue(DataTable); for(int i = 0; i < DataTable.Keys.Count; ++i) { string LocalizedLine = LanguageList[i].EscapeCharacters(); string Token = string.Format(TOKEN_LINE, DataTable.Keys[i], LocalizedLine); TokenBuilder.AppendLine(Token); LocalizedList.Add(DataTable.Keys[i], LocalizedLine); } } // Build localizations for units foreach(var Unit in Database.LegionUnits) { string UnitName = LocalizedList.Get(Unit.UnitName); string UnitDesc = LocalizedList.Get(string.Format(ABILITY_DESC, Unit.UnitName)); string UnitValue = ""; string TooltipId = ""; // Add unit name and description TokenBuilder.AppendLine(string.Format(TOKEN_LINE, Unit.ID, UnitName)); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, string.Format(ABILITY_DESC, Unit.ID), UnitDesc)); // Add summon ability tooltips if (Unit.IsBaseUnit()) { TooltipId = Unit.SummonAbility; UnitValue = LocalizedList.Get(SUMMON_UNIT_LOCALIZATION); UnitValue = string.Format(UnitValue, UnitName); } else if (Unit.IsUpgradeUnit()) { TooltipId = Unit.UpgradeAbility; UnitValue = LocalizedList.Get(UPGRADE_UNIT_LOCALIZATION); UnitValue = string.Format(UnitValue, UnitName); } // Add ability name and description string AbilityName = string.Format(ABILITY_TOOLTIP, TooltipId); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, AbilityName, UnitValue)); string AbilityDesc = string.Format(ABILITY_DESC_TOOLTIP, TooltipId); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, AbilityDesc, UnitDesc)); // Add currency tooltips string GoldTooltip = string.Format(GOLD_COST_TOOLTIP[0], TooltipId); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, GoldTooltip, LocalizedList.Get(GOLD_COST_TOOLTIP[1]))); string GemsTooltip = string.Format(GEMS_COST_TOOLTIP[0], TooltipId); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, GemsTooltip, LocalizedList.Get(GEMS_COST_TOOLTIP[1]))); string FoodTooltip = string.Format(FOOD_COST_TOOLTIP[0], TooltipId); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, FoodTooltip, LocalizedList.Get(FOOD_COST_TOOLTIP[1]))); // Unit Ability foreach (LegionAbility Ability in Unit.LegionAbilities) { // Build ability ID localizations // id, id_Description, id_Note0, etc. List<string> Keys = LocalizedList.Keys.Where(x => x.Contains(Ability.AbilityID)).ToList(); foreach (string Key in Keys) { string AbilityKey = Key.Replace(Ability.AbilityID, Ability.ID); string UnitAbilityKey = string.Format(ABILITY_TOOLTIP, AbilityKey); TokenBuilder.AppendLine(string.Format(TOKEN_LINE, UnitAbilityKey, LocalizedList.Get(Key))); } // Build ability modifier localizations foreach(string Modifier in Ability.Modifiers) { string ModifierKey = string.Format(ABILITY_MODIFIER_TOOLTIP, Modifier); LocalizedList.Get(Modifier); } } } // Generate file contents string FileContents = LanguageTemplateFile; FileContents = FileContents.Replace("{Language}", Language); FileContents = FileContents.Replace("{Tokens}", TokenBuilder.ToString()); // Write file string OutputPath = string.Format(OUTPUT_FILE, Language.ToLower()); SaveDataToFile(OutputPath, FileContents, Encoding.Unicode); }
public override void Generate(LegionDatabase Database) { GenerateAbilitiesFile(Database); GenerateSummonAbilitiesLua(Database); GenerateUpgradeAbilitiesLua(Database); }
protected List<LegionUnit> GetUpgradeUnits(LegionDatabase Database) { List<LegionUnit> UpgradeUnits = new List<LegionUnit>(); foreach (LegionUnit Unit in Database.LegionUnits) { if (Unit.IsUpgradeUnit()) { UpgradeUnits.Add(Unit); } } return UpgradeUnits; }
protected List<LegionUnit> GetSummonableUnits(LegionDatabase Database) { List<LegionUnit> SummonableUnits = new List<LegionUnit>(); foreach (LegionUnit Unit in Database.LegionUnits) { if (Unit.IsBaseUnit()) { SummonableUnits.Add(Unit); } } return SummonableUnits; }
protected void GenerateUpgradeAbilitiesLua(LegionDatabase Database) { // Load template string AbilityTemplateFile = LoadTemplateFile(UPGRADE_UNIT_LUA_TEMPLATE); // Generate for all unit upgrades foreach (LegionUnit Unit in GetUpgradeUnits(Database)) { // Process template string UnitTemplate = AbilityTemplateFile; UnitTemplate = ProcessTemplate<LegionUnit>(UnitTemplate, Unit, "Unit"); // Save unit lua string OutputFile = string.Format(LUA_UPGRADE_ABILITY_OUTPUT, Unit.UpgradeAbility); SaveDataToFile(OutputFile, UnitTemplate); } }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { Database = Database.Load() ?? Database; }
public Main() { InitializeComponent(); Database = new LegionDatabase(); Database = Database.Load() ?? Database; Database.Setup(); DotaDatabase = new DotaData(); DotaDatabase.Load(); // Localization Tab LocalizationTab = new SpreadsheetDataDisplayTab<LocalizedLanguage, LocalizationDataTable>(); LocalizationTab.DataTreeView = spreadsheetDisplayLocalization.treeData; LocalizationTab.SourcesTreeView = spreadsheetDisplayLocalization.treeDataSources; LocalizationTab.AddSourceButton = spreadsheetDisplayLocalization.buttonAddSpreadsheet; LocalizationTab.UpdateButton = spreadsheetDisplayLocalization.buttonUpdateSpreadsheets; LocalizationTab.RebuildButton = spreadsheetDisplayLocalization.buttonRebuildTrees; LocalizationTab.SpreadsheetIDTextBox = spreadsheetDisplayLocalization.textSpreadsheetId; LocalizationTab.TabIDTextBox = spreadsheetDisplayLocalization.textTabId; LocalizationTab.DataView = spreadsheetDisplayLocalization.dataGridInfo; LocalizationTab.AddSourceFunc = Database.AddNewLocalizationSheet; LocalizationTab.RemoveSourceFunc = Database.RemoveLocalizationSheet; LocalizationTab.GetDataFunc = Database.GetLocalizationLanguages; LocalizationTab.GetSourcesFunc = Database.GetLocalizationSheets; LocalizationTab.OnPreRebuildFunc = Database.RebuildLanguageCache; LocalizationTab.Setup(Database); LocalizationTab.Rebuild(); // Units Tab UnitsTab = new SpreadsheetDataDisplayTab<LegionUnit, UnitDataTable>(); UnitsTab.DataTreeView = spreadsheetDisplayUnits.treeData; UnitsTab.SourcesTreeView = spreadsheetDisplayUnits.treeDataSources; UnitsTab.AddSourceButton = spreadsheetDisplayUnits.buttonAddSpreadsheet; UnitsTab.UpdateButton = spreadsheetDisplayUnits.buttonUpdateSpreadsheets; UnitsTab.RebuildButton = spreadsheetDisplayUnits.buttonRebuildTrees; UnitsTab.SpreadsheetIDTextBox = spreadsheetDisplayUnits.textSpreadsheetId; UnitsTab.TabIDTextBox = spreadsheetDisplayUnits.textTabId; UnitsTab.DataView = spreadsheetDisplayUnits.dataGridInfo; UnitsTab.AddSourceFunc = Database.AddNewUnitSheet; UnitsTab.RemoveSourceFunc = Database.RemoveUnitSheet; UnitsTab.GetDataFunc = Database.GetUnits; UnitsTab.GetSourcesFunc = Database.GetUnitSheets; UnitsTab.OnPreRebuildFunc = Database.RebuildUnitCache; UnitsTab.Setup(Database); UnitsTab.Rebuild(); // Heroes Tab HeroesTab = new SpreadsheetDataDisplayTab<LegionHero, HeroDataTable>(); HeroesTab.DataTreeView = spreadsheetDisplayHeroes.treeData; HeroesTab.SourcesTreeView = spreadsheetDisplayHeroes.treeDataSources; HeroesTab.AddSourceButton = spreadsheetDisplayHeroes.buttonAddSpreadsheet; HeroesTab.UpdateButton = spreadsheetDisplayHeroes.buttonUpdateSpreadsheets; HeroesTab.RebuildButton = spreadsheetDisplayHeroes.buttonRebuildTrees; HeroesTab.SpreadsheetIDTextBox = spreadsheetDisplayHeroes.textSpreadsheetId; HeroesTab.TabIDTextBox = spreadsheetDisplayHeroes.textTabId; HeroesTab.DataView = spreadsheetDisplayHeroes.dataGridInfo; HeroesTab.AddSourceFunc = Database.AddNewHeroSheet; HeroesTab.RemoveSourceFunc = Database.RemoveHeroSheet; HeroesTab.GetDataFunc = Database.GetHeroes; HeroesTab.GetSourcesFunc = Database.GetHeroSheets; HeroesTab.OnPreRebuildFunc = Database.RebuildHeroCache; HeroesTab.Setup(Database); HeroesTab.Rebuild(); // Abilities Tab AbilitiesTab = new SpreadsheetDataDisplayTab<LegionAbility, AbilityDataTable>(); AbilitiesTab.DataTreeView = spreadsheetDisplayAbilities.treeData; AbilitiesTab.SourcesTreeView = spreadsheetDisplayAbilities.treeDataSources; AbilitiesTab.AddSourceButton = spreadsheetDisplayAbilities.buttonAddSpreadsheet; AbilitiesTab.UpdateButton = spreadsheetDisplayAbilities.buttonUpdateSpreadsheets; AbilitiesTab.RebuildButton = spreadsheetDisplayAbilities.buttonRebuildTrees; AbilitiesTab.SpreadsheetIDTextBox = spreadsheetDisplayAbilities.textSpreadsheetId; AbilitiesTab.TabIDTextBox = spreadsheetDisplayAbilities.textTabId; AbilitiesTab.DataView = spreadsheetDisplayAbilities.dataGridInfo; AbilitiesTab.AddSourceFunc = Database.AddNewAbilitySheet; AbilitiesTab.RemoveSourceFunc = Database.RemoveAbilitySheet; AbilitiesTab.GetDataFunc = Database.GetAbilities; AbilitiesTab.GetSourcesFunc = Database.GetAbilitySheets; AbilitiesTab.OnPreRebuildFunc = Database.RebuildAbilityCache; AbilitiesTab.Setup(Database); AbilitiesTab.Rebuild(); }
public void Setup() { ActiveDatabase = this; }
public List<LegionUnit> GetUnits(LegionDatabase Database) { this.Process(); List<LegionUnit> Units = new List<LegionUnit>(); if (UnitName != null) { for (int i = 0; i < UnitName.Count; ++i) { // Create unit LegionUnit Unit = Database.GetUnit(UnitName[i]) ?? new LegionUnit(); // Check if unit is an upgrade from a previous one if(!string.IsNullOrWhiteSpace(UpgradesFrom[i])) { foreach(LegionUnit PrevUnit in Units) { if(PrevUnit.UnitName == UpgradesFrom[i]) { Unit = PrevUnit.Clone(); } } } // Set unit details Unit.UnitName = UnitName[i]; Unit.UpgradesFrom = UpgradesFrom[i]; Unit.GoldCost = GoldCost[i]; Unit.GemsCost = GemsCost[i]; Unit.FoodCost = FoodCost[i]; Unit.Income = Income[i]; Unit.LevelRequired = LevelRequired[i]; Unit.Cooldown = Cooldown[i]; Unit.MoveSpeed = MoveSpeed[i]; Unit.TurnSpeed = TurnSpeed[i]; Unit.Health = Health[i]; Unit.HealthRegen = HealthRegen[i]; Unit.Mana = Mana[i]; Unit.ManaRegen = ManaRegen[i]; Unit.DamageType = DamageType[i]; Unit.DamageMin = DamageMin[i]; Unit.DamageMax = DamageMax[i]; Unit.AttackRate = AttackRate[i]; Unit.AttackCapability = AttackCapability[i]; Unit.AttackRange = AttackRange[i]; Unit.ProjectileModel = ProjectileModel[i]; Unit.ProjectileSpeed = ProjectileSpeed[i]; Unit.ArmourType = ArmourType[i]; Unit.Armour = Armour[i]; Unit.MagicResist = MagicResist[i]; Unit.AbilityKey = AbilityKey[i]; Unit.Bounty = Bounty[i]; Unit.UnitModel = UnitModel[i]; Unit.ModelScale = ModelScale[i]; Unit.SpawnIcon = SpawnIcon[i]; Unit.SpawnEffectAOE = SpawnEffectAOE[i]; Unit.WearablesList = WearablesList[i]; Unit.UnitAI = UnitAI?[i] ?? ""; // Add unit to list Units.Add(Unit); } } return Units; }
public override void Generate(LegionDatabase Database) { GenerateHeroList(Database); GenerateHeroesFile(Database); }
public List <LegionUnit> GetUnits(LegionDatabase Database) { this.Process(); List <LegionUnit> Units = new List <LegionUnit>(); if (UnitName != null) { for (int i = 0; i < UnitName.Count; ++i) { // Create unit LegionUnit Unit = Database.GetUnit(UnitName[i]) ?? new LegionUnit(); // Check if unit is an upgrade from a previous one if (!string.IsNullOrWhiteSpace(UpgradesFrom[i])) { foreach (LegionUnit PrevUnit in Units) { if (PrevUnit.UnitName == UpgradesFrom[i]) { Unit = PrevUnit.Clone(); } } } // Set unit details Unit.UnitName = UnitName[i]; Unit.UpgradesFrom = UpgradesFrom[i]; Unit.GoldCost = GoldCost[i]; Unit.GemsCost = GemsCost[i]; Unit.FoodCost = FoodCost[i]; Unit.Income = Income[i]; Unit.LevelRequired = LevelRequired[i]; Unit.Cooldown = Cooldown[i]; Unit.MoveSpeed = MoveSpeed[i]; Unit.TurnSpeed = TurnSpeed[i]; Unit.Health = Health[i]; Unit.HealthRegen = HealthRegen[i]; Unit.Mana = Mana[i]; Unit.ManaRegen = ManaRegen[i]; Unit.DamageType = DamageType[i]; Unit.DamageMin = DamageMin[i]; Unit.DamageMax = DamageMax[i]; Unit.AttackRate = AttackRate[i]; Unit.AttackCapability = AttackCapability[i]; Unit.AttackRange = AttackRange[i]; Unit.ProjectileModel = ProjectileModel[i]; Unit.ProjectileSpeed = ProjectileSpeed[i]; Unit.ArmourType = ArmourType[i]; Unit.Armour = Armour[i]; Unit.MagicResist = MagicResist[i]; Unit.AbilityKey = AbilityKey[i]; Unit.Bounty = Bounty[i]; Unit.UnitModel = UnitModel[i]; Unit.ModelScale = ModelScale[i]; Unit.SpawnIcon = SpawnIcon[i]; Unit.SpawnEffectAOE = SpawnEffectAOE[i]; Unit.WearablesList = WearablesList[i]; Unit.UnitAI = UnitAI?[i] ?? ""; // Add unit to list Units.Add(Unit); } } return(Units); }