private void StartNextBooster() { if (base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1)) { return; } DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>(); bool flag = base.Empire.GetAgency <DepartmentOfForeignAffairs>().IsInWarWithSomeone(); bool flag2 = agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel1") == DepartmentOfScience.ConstructibleElement.State.Researched || agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel2") == DepartmentOfScience.ConstructibleElement.State.Researched; if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") <= 16f || flag2 || flag) { if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") >= 23f && !flag2) { return; } for (int i = 0; i < this.departmentOfEducation.VaultCount; i++) { BoosterDefinition boosterDefinition = this.departmentOfEducation.VaultItems[i].Constructible as BoosterDefinition; if (boosterDefinition != null && boosterDefinition.Name == "BoosterScience") { OrderBuyoutAndActivateBooster order = new OrderBuyoutAndActivateBooster(base.Empire.Index, boosterDefinition.Name, this.departmentOfEducation.VaultItems[i].GUID, false); Ticket ticket; base.Empire.PlayerControllers.AI.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.BuyoutAndActivateBooster_TicketRaised)); return; } } } }
private SynchronousJobState SynchronousJob_StartBooster() { SynchronousJobState result; if (this.boosterDefinitionWrappers == null || base.AIEntity == null || base.AIEntity.AIPlayer == null) { result = SynchronousJobState.Failure; } else { DepartmentOfScience agency = base.AIEntity.Empire.GetAgency <DepartmentOfScience>(); bool flag = agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel1") == DepartmentOfScience.ConstructibleElement.State.Researched || agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel2") == DepartmentOfScience.ConstructibleElement.State.Researched; for (int i = this.boosterDefinitionWrappers.Count - 1; i >= 0; i--) { CityBoosterNeeds cityBoosterNeeds = null; if (this.boosterDefinitionWrappers[i] != null && base.AIEntity.AIPlayer.Blackboard.TryGetMessage <CityBoosterNeeds>(this.boosterDefinitionWrappers[i].CurrentMessageId, out cityBoosterNeeds) && cityBoosterNeeds.AvailabilityState == CityBoosterNeeds.CityBoosterState.Available) { StaticString x = this.boosterDefinitionWrappers[i].BoosterDefinitionName; if (x == "BoosterIndustry" || x == "FlamesIndustryBooster") { if (this.aiEntityCity.City.SimulationObject.Children.Exists((SimulationObject C) => C.Tags.Contains("BoosterDecreaseCityProduction4"))) { goto IL_275; } } if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") <= 16f || flag || x == "BoosterFood" || x == "BoosterCadavers") { if (cityBoosterNeeds.BoosterGuid.IsValid && this.departmentOfEducation[cityBoosterNeeds.BoosterGuid] != null && this.departmentOfEducation[cityBoosterNeeds.BoosterGuid].Constructible != null) { x = this.departmentOfEducation[cityBoosterNeeds.BoosterGuid].Constructible.Name; } OrderBuyoutAndActivateBooster orderBuyoutAndActivateBooster = new OrderBuyoutAndActivateBooster(base.AIEntity.Empire.Index, x, cityBoosterNeeds.BoosterGuid, false); orderBuyoutAndActivateBooster.TargetGUID = this.aiEntityCity.City.GUID; base.AIEntity.Empire.PlayerControllers.AI.PostOrder(orderBuyoutAndActivateBooster); this.boosterDefinitionWrappers[i].CurrentMessageId = 0UL; cityBoosterNeeds.BoosterGuid = 0UL; cityBoosterNeeds.AvailabilityState = CityBoosterNeeds.CityBoosterState.Success; base.AIEntity.AIPlayer.Blackboard.CancelMessage(cityBoosterNeeds); } } IL_275 :; } result = SynchronousJobState.Success; } return(result); }
public override void RefreshContent() { base.RefreshContent(); base.Empire.Refresh(false); DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>(); DepartmentOfTheTreasury agency2 = base.Empire.GetAgency <DepartmentOfTheTreasury>(); this.ComputeCurrentEraNumber(); this.CurrentEraNumber.Text = AgeUtils.ToRoman(this.currentEraNumber); this.ResearchErasTable.RefreshChildrenIList <ResearchEraFrame.TechnologyEra>(this.eras, this.refreshEraDelegate, true, false); Construction construction = agency.ResearchQueue.Peek(); bool flag = construction != null; float quantity; if (flag) { quantity = DepartmentOfTheTreasury.GetProductionCostWithBonus(base.Empire.SimulationObject, construction.ConstructibleElement, DepartmentOfTheTreasury.Resources.EmpireResearch); } else { quantity = agency.GetResearchPropertyValue(SimulationProperties.TechnologyCost); } this.TechnologyCostValue.Text = GuiFormater.FormatQuantity(quantity, SimulationProperties.EmpireResearch, 1); float quantity2; agency2.TryGetNetResourceValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpireResearch, out quantity2, false); this.EmpireOutputValue.Text = GuiFormater.FormatQuantity(quantity2, SimulationProperties.EmpireResearch, 0); if (flag) { float num = agency2.ComputeConstructionProgress(base.Empire, construction); this.ResearchProgress.Text = Mathf.RoundToInt(num * 100f).ToString() + "%"; int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction); num2 = Mathf.Max(num2, 1); if (num2 == 2147483647) { this.ResearchTurns.Text = GuiFormater.Infinite.ToString(); } else { this.ResearchTurns.Text = num2.ToString(); } TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition != null) { this.TechnologyName.Text = DepartmentOfScience.GetTechnologyTitle(technologyDefinition); this.TechnologyImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, GuiPanel.IconSize.Small); } DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.TechnologyName.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } else { this.TechnologyName.Text = "%ResearchNoneTitle"; this.TechnologyImage.Image = null; this.ResearchProgress.Text = "%ResearchVoidSymbol"; this.ResearchTurns.Text = "%ResearchVoidSymbol"; if (this.TechnologyName.AgeTransform.AgeTooltip != null) { this.TechnologyName.AgeTransform.AgeTooltip.Class = string.Empty; this.TechnologyName.AgeTransform.AgeTooltip.Content = string.Empty; this.TechnologyName.AgeTransform.AgeTooltip.ClientData = null; } if (this.TechnologyImage.AgeTransform.AgeTooltip != null) { this.TechnologyImage.AgeTransform.AgeTooltip.Class = string.Empty; this.TechnologyImage.AgeTransform.AgeTooltip.Content = string.Empty; this.TechnologyImage.AgeTransform.AgeTooltip.ClientData = null; } } IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1)) { this.TechnologyStatsGroup.Visible = false; this.ResearchBuyoutButton.AgeTransform.Visible = true; this.ResearchCompletionGroup.Visible = false; this.RefreshBuyout(this.ResearchBuyoutButton); return; } this.TechnologyStatsGroup.Visible = true; this.ResearchBuyoutButton.AgeTransform.Visible = false; this.ResearchCompletionGroup.Visible = true; }