private UpgradeModel UpgradeTaxHouse(int Level) { var upgradeModel = new UpgradeModel(); upgradeModel.index = 11; upgradeModel.Cost_Iron = 150; upgradeModel.Cost_Wheat = 150; upgradeModel.Cost_Meat = 150; upgradeModel.Cost_Wood = 150; upgradeModel.Gain_Exp = 3 * Level + Settings.Point_Karma * 2 + Settings.CultureRate * 10; upgradeModel.Gain_Culture = 10 * Level; upgradeModel.Gain_Karma = 0; upgradeModel.Gain_Economy = (Populations.TraderPop * Level) + 15 / 2 * Settings.TraderRate; upgradeModel.Gain_Military = 3 * Level; upgradeModel.Gain_AgressivePop = 4 * Level; upgradeModel.Gain_CulturalPop = 2 * Level; upgradeModel.Gain_TraderPop = 6 * Level; upgradeModel.Gain_NaturalAttack = 4 * Level; upgradeModel.Gain_NaturalDef = 2 * Level; upgradeModel.Gain_TownGOLD_perHour = 5 + Level * (Settings.TraderRate) + Populations.TraderPop * Level; upgradeModel.Gain_TownIRON_perHour = 0; upgradeModel.Gain_TownMeat_perHour = 0; upgradeModel.Gain_TownWHEAT_perHour = 0; upgradeModel.Gain_TownWOOD_perHour = 0; upgradeModel.Buildtime = Level * 2; return(upgradeModel); }
public async void SelectedUpgrade(UpgradeModel SelectedBuilding) { Town = _context.Towns.LastOrDefault(x => x.UserId == Player.Id); Settings = _context.UserGameSettings.LastOrDefault(x => x.UserId == Player.Id); Populations = _context.Population.LastOrDefault(x => x.TownId == Town.TownId); #region SelectBuild switch (SelectedBuilding.index) { case 0: Buildings.TownCenter++; break; case 1: Buildings.CityWall++; break; case 2: Buildings.TechnologyCamp++; break; case 3: Buildings.TradeHouse++; break; case 4: Buildings.Warehouse++; break; case 5: Buildings.Temple++; break; case 6: Buildings.Barracks++; break; case 7: Buildings.Farm++; break; case 8: Buildings.MeatCamp++; break; case 9: Buildings.Mine++; break; case 10: Buildings.WoodCutterHut++; break; case 11: Buildings.TaxHouse++; break; } #endregion #region Upgraded Settings.Point_Culture += SelectedBuilding.Gain_Culture; Settings.Point_Economy += SelectedBuilding.Gain_Economy; Settings.Point_Military += SelectedBuilding.Gain_Military; Settings.Point_Exp += SelectedBuilding.Gain_Exp; Settings.Point_Karma += SelectedBuilding.Gain_Karma; Settings.NaturalAttack += SelectedBuilding.Gain_NaturalAttack; Settings.NaturalDef += SelectedBuilding.Gain_NaturalDef; Town.TownWOOD_perHour = SelectedBuilding.Gain_TownWOOD_perHour; Town.TownGOLD_perHour = SelectedBuilding.Gain_TownGOLD_perHour; Town.TownIRON_perHour = SelectedBuilding.Gain_TownIRON_perHour; Town.TownMeat_perHour = SelectedBuilding.Gain_TownMeat_perHour; Town.TownWHEAT_perHour += SelectedBuilding.Gain_TownWHEAT_perHour; Populations.TraderPop += SelectedBuilding.Gain_TraderPop; Populations.AggressivePop += SelectedBuilding.Gain_AgressivePop; Populations.CulturalPop += SelectedBuilding.Gain_CulturalPop; #endregion await _context.SaveChangesAsync(); }