public AllianceTechesOut(AllianceRoleDataModel userRole, Dictionary <TechType, ItemProgress> dbAllianceTeches) { CanUpgrade = userRole.SetTech; var techService = new BattleTeches(dbAllianceTeches); var teches = techService.GetTeches(false); teches.ForEach(i => { i.Value.Progress.Advanced = i.Value.GetPropertiesView(true); }); Teches = techService.ConvertToTechesOut(true); Teches.ForEach(i => { i.Value.CalcResultPrice(false); }); SetComplexButtonView(); }
private static void FixProgreses(UserMothershipDataModel mother, UserPremiumWorkModel userPremium) { #region Premium var pt = userPremium.TimeLineStatus; #endregion #region CalcResource var lastUpgradeProductionTime = mother.LastUpgradeProductionTime; var beforeResource = mother.Resources.CloneDeep(); var last = pt?.Status?.Last(); var curPrem = (last != null && (bool)last); // var motherExtatracionLevel = 1; var motherExtatracionLevel = 22; StorageResources.CalculateProductionResources(beforeResource, mother.ExtractionProportin, ref lastUpgradeProductionTime, motherExtatracionLevel, curPrem, ExtractionModule.BaseProportion.Ir, ExtractionModule.BaseProportion.Dm, ExtractionModule.GetPower, (res) => { StorageResourcesService.FixCurrentResources(res); } ); if (!mother.Resources.Equals(beforeResource)) { mother.Resources = beforeResource; } #region Laboratory if (mother.TechProgress.Select(i => i.Value).ToList().Any(i => i.IsProgress == true)) { var techService = new BattleTeches(mother.TechProgress); if (techService.CalculateTechProgreses(techService.GetTeches(false), userPremium)) { mother.TechProgress = techService.ConvertToDbTeches(); } } #endregion mother.LastUpgradeProductionTime = lastUpgradeProductionTime; #endregion if (mother.UnitProgress == null || !mother.UnitProgress.Any()) { if (mother.UnitProgress == null) { mother.UnitProgress = new Dictionary <UnitType, TurnedUnit>(); } return; } #region Calc UnitProgress const int shipyardLevel = 1; var pureTurn = mother.UnitProgress; var hangarUnits = mother.Hangar; bool unitInProgress; TurnedUnit.CalculateUserUnits(pt, ref pureTurn, out unitInProgress, ref hangarUnits, shipyardLevel, Unit.CalculateTrickyUnitTimeProduction, (unitType) => UnitHelper.GetBaseUnit(unitType).BasePrice.TimeProduction, Unit.CalculateTimeProduction); mother.UnitProgress = unitInProgress ? pureTurn : new Dictionary <UnitType, TurnedUnit>(); mother.Hangar = hangarUnits; #endregion }