public SpendingCaps(GameDatabase db, PlayerInfo playerInfo, BudgetProjection projection) { int researchingTechId = db.GetPlayerResearchingTechID(playerInfo.ID); int feasibilityStudyTechId = db.GetPlayerFeasibilityStudyTechId(playerInfo.ID); bool flag = researchingTechId != 0 || feasibilityStudyTechId != 0; if (projection == BudgetProjection.Actual) { this.StimulusMining = 0.0; this.StimulusColonization = 0.0; this.StimulusTrade = double.MaxValue; this.SecurityOperations = double.MaxValue; this.SecurityIntelligence = double.MaxValue; this.SecurityCounterIntelligence = double.MaxValue; this.ResearchCurrentProject = flag ? double.MaxValue : 0.0; this.ResearchSpecialProject = 0.0; this.ResearchSalvageResearch = 0.0; } else { this.StimulusMining = double.MaxValue; this.StimulusColonization = double.MaxValue; this.StimulusTrade = double.MaxValue; this.SecurityOperations = double.MaxValue; this.SecurityIntelligence = double.MaxValue; this.SecurityCounterIntelligence = double.MaxValue; this.ResearchCurrentProject = double.MaxValue; this.ResearchSpecialProject = double.MaxValue; this.ResearchSalvageResearch = double.MaxValue; } }
public static Budget GenerateBudget( GameSession sim, PlayerInfo playerInfo, IEnumerable <DesignInfo> additionalShipDesignInfos, BudgetProjection budgetProjection) { FactionInfo factionInfo = sim.GameDatabase.GetFactionInfo(playerInfo.FactionID); double driveSpeedForPlayer = (double)sim.GameDatabase.FindCurrentDriveSpeedForPlayer(playerInfo.ID); double playerIncomeFromTrade = sim.GetPlayerIncomeFromTrade(playerInfo.ID); SpendingCaps spendingCaps = new SpendingCaps(sim.GameDatabase, playerInfo, budgetProjection); List <StationInfo> list1 = sim.GameDatabase.GetStationInfosByPlayerID(playerInfo.ID).ToList <StationInfo>(); List <ColonyInfo> list2 = sim.GameDatabase.GetPlayerColoniesByPlayerId(playerInfo.ID).ToList <ColonyInfo>(); foreach (TreatyInfo treatyInfo in sim.GameDatabase.GetTreatyInfos().ToList <TreatyInfo>().Where <TreatyInfo>((Func <TreatyInfo, bool>)(x => { if (x.Type == TreatyType.Protectorate) { return(x.InitiatingPlayerId == playerInfo.ID); } return(false); })).ToList <TreatyInfo>()) { if (treatyInfo.Active) { list2.AddRange(sim.GameDatabase.GetPlayerColoniesByPlayerId(treatyInfo.ReceivingPlayerId)); } } Dictionary <int, PlanetInfo> infoMapForColonies1 = Colony.GetPlanetInfoMapForColonies(sim.GameDatabase, (IEnumerable <ColonyInfo>)list2); Dictionary <int, OrbitalObjectInfo> infoMapForColonies2 = Colony.GetOrbitalObjectInfoMapForColonies(sim.GameDatabase, (IEnumerable <ColonyInfo>)list2); Dictionary <int, StarSystemInfo> forOrbitalObjects = Colony.GetStarSystemInfoMapForOrbitalObjects(sim.GameDatabase, (IEnumerable <OrbitalObjectInfo>)infoMapForColonies2.Values); HashSet <int> systemsWithGates = GameSession.GetStarSystemsWithGates(sim.GameDatabase, playerInfo.ID, (IEnumerable <int>)forOrbitalObjects.Keys); List <FleetInfo> list3 = sim.GameDatabase.GetFleetInfosByPlayerID(playerInfo.ID, FleetType.FL_ALL).ToList <FleetInfo>(); List <FleetInfo> eliteFleetInfos = list3.Where <FleetInfo>((Func <FleetInfo, bool>)(x => sim.GameDatabase.GetAdmiralTraits(x.AdmiralID).Contains <AdmiralInfo.TraitType>(AdmiralInfo.TraitType.Elite))).ToList <FleetInfo>(); if (eliteFleetInfos.Count > 0) { list3.RemoveAll((Predicate <FleetInfo>)(x => eliteFleetInfos.Contains(x))); } List <DesignInfo> designInfoList1 = GameSession.MergeShipDesignInfos(sim.GameDatabase, (IEnumerable <FleetInfo>)list3, false); List <DesignInfo> designInfoList2 = GameSession.MergeShipDesignInfos(sim.GameDatabase, (IEnumerable <FleetInfo>)eliteFleetInfos, false); List <DesignInfo> designInfoList3 = GameSession.MergeShipDesignInfos(sim.GameDatabase, (IEnumerable <FleetInfo>)list3, true); return(new Budget(sim.GameDatabase, sim.AssetDatabase, sim, playerInfo, factionInfo, driveSpeedForPlayer, playerIncomeFromTrade, spendingCaps, (IEnumerable <ColonyInfo>)list2, infoMapForColonies1, infoMapForColonies2, forOrbitalObjects, systemsWithGates, (IEnumerable <StationInfo>)list1, (IEnumerable <DesignInfo>)designInfoList3, (IEnumerable <DesignInfo>)designInfoList1, (IEnumerable <DesignInfo>)designInfoList2, additionalShipDesignInfos)); }