private bool IsDesignAllowed(DesignInfo designInfo)
 {
     if (DialogLoaFleetCompositor.IsShipClassAllowed(designInfo.GetRealShipClass()) && DialogLoaFleetCompositor.IsShipRoleAllowed(designInfo.Role) && !Kerberos.Sots.StarFleet.StarFleet.DesignIsSuulka(this._app, designInfo))
     {
         return(designInfo.isPrototyped);
     }
     return(false);
 }
Example #2
0
        public static void SyncCost(App game, string panel, DesignInfo design)
        {
            int    num = design.SavingsCost;
            int    playerProductionCost = design.GetPlayerProductionCost(game.GameDatabase, game.LocalPlayer.ID, true, new float?());
            string text1 = GameSession.CalculateShipUpkeepCost(game.AssetDatabase, design, 1f, false).ToString("N0");
            string text2 = string.Format("({0})", (object)GameSession.CalculateShipUpkeepCost(game.AssetDatabase, design, 1f, true).ToString("N0"));

            switch (design.Class)
            {
            case ShipClass.Cruiser:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierCR, game.LocalPlayer.ID));
                break;

            case ShipClass.Dreadnought:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierDN, game.LocalPlayer.ID));
                break;

            case ShipClass.Leviathan:
                num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierLV, game.LocalPlayer.ID));
                break;

            case ShipClass.Station:
                RealShipClasses?realShipClass = design.GetRealShipClass();
                if ((realShipClass.GetValueOrDefault() != RealShipClasses.Platform ? 0 : (realShipClass.HasValue ? 1 : 0)) != 0)
                {
                    num = (int)((double)design.SavingsCost * (double)game.GetStratModifier <float>(StratModifiers.PrototypeSavingsCostModifierPF, game.LocalPlayer.ID));
                    break;
                }
                break;
            }
            string text3 = design.SavingsCost.ToString("N0");
            string text4 = design.GetPlayerProductionCost(game.GameDatabase, game.LocalPlayer.ID, false, new float?()).ToString("N0");
            string text5 = num.ToString("N0");
            string text6 = playerProductionCost.ToString("N0");

            game.UI.SetText(game.UI.Path(panel, "gameShipSavCost"), text3);
            game.UI.SetText(game.UI.Path(panel, "gameShipConCost"), text4);
            game.UI.SetText(game.UI.Path(panel, "gameProtoSavCost"), text5);
            game.UI.SetText(game.UI.Path(panel, "gameProtoConCost"), text6);
            game.UI.SetText(game.UI.Path(panel, "gameShipUpkeepCost"), text1);
            game.UI.SetText(game.UI.Path(panel, "gameShipResUpkeepCost"), text2);
        }
Example #3
0
        public void SyncEnemySide(int playerid)
        {
            CombatData       combat  = this._app.Game.CombatData.GetCombat(this._app.GameDatabase, this._combatID, this._systemID, this._turn);
            PlayerCombatData player1 = combat.GetPlayer(this._app.LocalPlayer.ID);

            if (player1 == null)
            {
                this._app.UI.CloseDialog((Dialog)this, true);
            }
            else
            {
                foreach (PlanetWidget sideplanetWidget in this._EnemySideplanetWidgets)
                {
                    sideplanetWidget.Terminate();
                }
                this._EnemySideplanetWidgets.Clear();
                IEnumerable <PlayerInfo> playerInfos    = this._app.GameDatabase.GetPlayerInfos();
                StarSystemInfo           starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(combat.SystemID);
                App.Localize("@ADMIRAL_LOCATION_DEEP_SPACE");
                if (starSystemInfo != (StarSystemInfo)null)
                {
                    string name = starSystemInfo.Name;
                }
                int    val2_1 = 0;
                int    val2_2 = 0;
                float  val2_3 = 0.0f;
                float  val2_4 = 0.0f;
                double num1   = 0.0;
                double num2   = 0.0;
                float  num3   = 0.0f;
                int    num4   = 0;
                Dictionary <int, float> dictionary1 = new Dictionary <int, float>();
                PlayerInfo       player             = playerInfos.FirstOrDefault <PlayerInfo>((Func <PlayerInfo, bool>)(x => x.ID == playerid));
                PlayerCombatData player2            = combat.GetPlayer(player.ID);
                if (player2 != null)
                {
                    this._app.GameDatabase.GetDiplomacyInfo(player1.PlayerID, player.ID);
                    PlayerSetup playerSetup    = this._app.GameSetup.Players.FirstOrDefault <PlayerSetup>((Func <PlayerSetup, bool>)(x => x.databaseId == player.ID));
                    string      propertyValue1 = playerSetup == null || !(playerSetup.Name != "") || playerSetup.AI ? player.Name : playerSetup.Name;
                    this._app.UI.SetPropertyString(this._app.UI.Path("enemySide", "alliesAvatars", "name"), "text", propertyValue1);
                    this._app.UI.SetPropertyString(this._app.UI.Path("enemySide", "alliesAvatars", "playeravatar"), "texture", player.AvatarAssetPath);
                    this._app.UI.SetPropertyString(this._app.UI.Path("enemySide", "alliesAvatars", "badge"), "texture", player.BadgeAssetPath);
                    this._app.UI.SetPropertyColorNormalized(this._app.UI.Path("enemySide", "alliesAvatars", "primaryColor"), "color", player.PrimaryColor);
                    this._app.UI.SetPropertyColorNormalized(this._app.UI.Path("enemySide", "alliesAvatars", "secondaryColor"), "color", player.SecondaryColor);
                    this._app.UI.SetPropertyColorNormalized(this._app.UI.Path("enemySide", "empireColor"), "color", player.PrimaryColor);
                    this._app.UI.SetPropertyString(this._app.UI.Path("enemySide", "playerData", "playerName"), "text", propertyValue1);
                    List <ShipData>   shipData1   = player2.ShipData;
                    List <WeaponData> weaponData1 = player2.WeaponData;
                    List <PlanetData> planetData1 = player2.PlanetData;
                    int   count  = shipData1.Count;
                    int   val1_1 = 0;
                    float val1_2 = 0.0f;
                    float val1_3 = 0.0f;
                    Dictionary <int, string> dictionary2 = new Dictionary <int, string>();
                    int userItemId1 = 0;
                    this._app.UI.ClearItems(this._app.UI.Path("enemySide", "fleetDamage"));
                    foreach (ShipData shipData2 in shipData1)
                    {
                        val1_1 += shipData2.killCount;
                        val1_2 += shipData2.damageDealt;
                        val1_3 += shipData2.damageReceived;
                        num4   += shipData2.destroyed ? 1 : 0;
                        DesignInfo designInfo = this._app.GameDatabase.GetDesignInfo(shipData2.designID);
                        if (designInfo != null)
                        {
                            RealShipClasses?realShipClass = designInfo.GetRealShipClass();
                            if ((realShipClass.GetValueOrDefault() != RealShipClasses.AssaultShuttle ? 1 : (!realShipClass.HasValue ? 1 : 0)) != 0)
                            {
                                realShipClass = designInfo.GetRealShipClass();
                                if ((realShipClass.GetValueOrDefault() != RealShipClasses.Drone ? 1 : (!realShipClass.HasValue ? 1 : 0)) != 0)
                                {
                                    realShipClass = designInfo.GetRealShipClass();
                                    if ((realShipClass.GetValueOrDefault() != RealShipClasses.BoardingPod ? 1 : (!realShipClass.HasValue ? 1 : 0)) != 0 && this._app.Game.ScriptModules.MeteorShower.PlayerID != player.ID)
                                    {
                                        string propertyValue2 = "";
                                        if (shipData2.destroyed)
                                        {
                                            propertyValue2 = designInfo.Name + " class ship has been destroyed.";
                                        }
                                        else if ((double)shipData2.damageReceived > 0.0)
                                        {
                                            propertyValue2 = designInfo.Name + " class ship has been damaged.";
                                        }
                                        if (propertyValue2 != "")
                                        {
                                            this._app.UI.AddItem(this._app.UI.Path("enemySide", "fleetDamage"), "", userItemId1, "");
                                            this._app.UI.SetPropertyString(this._app.UI.Path(this._app.UI.GetItemGlobalID(this._app.UI.Path("enemySide", "fleetDamage"), "", userItemId1, ""), "name"), "text", propertyValue2);
                                            ++userItemId1;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    this._app.UI.SetPropertyString(this._app.UI.Path("enemySide", "playerData", "playerScore"), "text", (shipData1.Count - num4).ToString() + "/" + shipData1.Count.ToString());
                    this._app.UI.SetSliderRange(this._app.UI.Path("enemySide", "playerData", "assets"), 0, shipData1.Count);
                    this._app.UI.SetSliderValue(this._app.UI.Path("enemySide", "playerData", "assets"), shipData1.Count - num4);
                    foreach (WeaponData weaponData2 in weaponData1)
                    {
                        if (!dictionary1.ContainsKey(weaponData2.weaponID))
                        {
                            dictionary1.Add(weaponData2.weaponID, 0.0f);
                        }
                        Dictionary <int, float> dictionary3;
                        int weaponId;
                        (dictionary3 = dictionary1)[weaponId = weaponData2.weaponID] = dictionary3[weaponId] + weaponData2.damageDealt;
                    }
                    this._app.UI.ClearItems(this._app.UI.Path("enemySide", "weaponDamage"));
                    int    num5        = 0;
                    int    userItemId2 = 0;
                    string str         = null;
                    foreach (int key in dictionary1.Keys)
                    {
                        int weapon = key;
                        if (num5 == 5 || str == null)
                        {
                            this._app.UI.AddItem(this._app.UI.Path("enemySide", "weaponDamage"), "", userItemId2, "");
                            str = this._app.UI.GetItemGlobalID(this._app.UI.Path("enemySide", "weaponDamage"), "", userItemId2, "");
                            ++userItemId2;
                            num5 = 0;
                            for (int index = 0; index < 5; ++index)
                            {
                                this._app.UI.SetVisible(this._app.UI.Path(str, "weapon" + index.ToString()), false);
                            }
                        }
                        this._app.UI.SetPropertyString(this._app.UI.Path(str, "weapon" + num5.ToString(), "damageDealt"), "text", dictionary1[weapon].ToString("N0"));
                        LogicalWeapon logicalWeapon  = this._app.AssetDatabase.Weapons.First <LogicalWeapon>((Func <LogicalWeapon, bool>)(x => x.UniqueWeaponID == weapon));
                        string        iconSpriteName = logicalWeapon.IconSpriteName;
                        this._app.UI.SetPropertyString(this._app.UI.Path(str, "weapon" + num5.ToString(), "weaponIcon"), "sprite", iconSpriteName);
                        this._app.UI.SetPropertyString(this._app.UI.Path(str, "weapon" + num5.ToString()), "tooltip", logicalWeapon.WeaponName);
                        this._app.UI.SetVisible(this._app.UI.Path(str, "weapon" + num5.ToString()), true);
                        ++num5;
                    }
                    this._app.UI.ClearItems(this._app.UI.Path("enemySide", "planetDamage"));
                    foreach (PlanetData planetData2 in planetData1)
                    {
                        ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(planetData2.orbitalObjectID);
                        if (colonyInfoForPlanet != null)
                        {
                            num1 += planetData2.imperialDamage;
                            num2 += planetData2.civilianDamage.Sum <PopulationData>((Func <PopulationData, double>)(x => x.damage));
                            num3 += planetData2.infrastructureDamage;
                            this._app.UI.AddItem(this._app.UI.Path("enemySide", "planetDamage"), "", colonyInfoForPlanet.ID, "");
                            string            itemGlobalId       = this._app.UI.GetItemGlobalID(this._app.UI.Path("enemySide", "planetDamage"), "", colonyInfoForPlanet.ID, "");
                            OrbitalObjectInfo orbitalObjectInfo  = this._app.GameDatabase.GetOrbitalObjectInfo(colonyInfoForPlanet.OrbitalObjectID);
                            PlanetInfo        planetInfo         = this._app.GameDatabase.GetPlanetInfo(colonyInfoForPlanet.OrbitalObjectID);
                            Faction           faction            = this._app.AssetDatabase.GetFaction(this._app.GameDatabase.GetPlayerFactionID(colonyInfoForPlanet.PlayerID));
                            double            civilianPopulation = this._app.GameDatabase.GetCivilianPopulation(colonyInfoForPlanet.OrbitalObjectID, faction.ID, faction.HasSlaves());
                            float             num6 = planetInfo != null ? planetInfo.Infrastructure : 0.0f;
                            this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "planetName"), "text", orbitalObjectInfo != null ? orbitalObjectInfo.Name : "?");
                            this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "civslbl"), "text", civilianPopulation.ToString("N0"));
                            this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "implbl"), "text", colonyInfoForPlanet.ImperialPop.ToString("N0"));
                            this._app.UI.SetPropertyString(this._app.UI.Path(itemGlobalId, "infralbl"), "text", num6.ToString());
                            double num7 = civilianPopulation + planetData2.civilianDamage.Sum <PopulationData>((Func <PopulationData, double>)(x => x.damage));
                            this._app.UI.SetSliderRange(this._app.UI.Path(itemGlobalId, "civAmount"), 0, (int)num7);
                            this._app.UI.SetSliderValue(this._app.UI.Path(itemGlobalId, "civAmount"), (int)(num7 - planetData2.civilianDamage.Sum <PopulationData>((Func <PopulationData, double>)(x => x.damage))));
                            double num8 = colonyInfoForPlanet.ImperialPop + planetData2.imperialDamage;
                            this._app.UI.SetSliderRange(this._app.UI.Path(itemGlobalId, "impAmount"), 0, (int)num8);
                            this._app.UI.SetSliderValue(this._app.UI.Path(itemGlobalId, "impAmount"), (int)(num8 - planetData2.imperialDamage));
                            float num9 = num6 + planetData2.infrastructureDamage;
                            this._app.UI.SetSliderRange(this._app.UI.Path(itemGlobalId, "infraAmount"), 0, (int)(100.0 * (double)num9));
                            this._app.UI.SetSliderValue(this._app.UI.Path(itemGlobalId, "infraAmount"), (int)(100.0 * ((double)num9 - (double)planetData2.infrastructureDamage)));
                            if (planetInfo != null)
                            {
                                this._EnemySideplanetWidgets.Add(new PlanetWidget(this._app, itemGlobalId));
                                this._EnemySideplanetWidgets.Last <PlanetWidget>().Sync(planetInfo.ID, false, false);
                            }
                        }
                    }
                    Math.Max(count, val2_1);
                    Math.Max(val1_1, val2_2);
                    Math.Max(val1_2, val2_3);
                    Math.Max(val1_3, val2_4);
                }
                this._app.UI.AutoSizeContents(this._app.UI.Path(this.ID, "enemySide"));
            }
        }
Example #4
0
        private Budget(
            GameDatabase gamedb,
            AssetDatabase assetdb,
            GameSession game,
            PlayerInfo playerInfo,
            FactionInfo playerFactionInfo,
            double maxDriveSpeed,
            double incomeFromTrade,
            SpendingCaps spendingCaps,
            IEnumerable <ColonyInfo> colonyInfos,
            Dictionary <int, PlanetInfo> planetInfos,
            Dictionary <int, OrbitalObjectInfo> orbitalObjectInfos,
            Dictionary <int, StarSystemInfo> starSystemInfos,
            HashSet <int> starSystemsWithGates,
            IEnumerable <StationInfo> stationInfos,
            IEnumerable <DesignInfo> reserveShipDesignInfos,
            IEnumerable <DesignInfo> shipDesignInfos,
            IEnumerable <DesignInfo> eliteShipDesignInfos,
            IEnumerable <DesignInfo> additionalShipDesignInfos)
        {
            this.CurrentSavings  = playerInfo.Savings;
            this.SavingsInterest = playerFactionInfo.Name != "loa" ? GameSession.CalculateSavingsInterest(game, playerInfo) : 0.0;
            this.DebtInterest    = playerFactionInfo.Name != "loa" ? GameSession.CalculateDebtInterest(game, playerInfo) : 0.0;
            this.TradeRevenue    = incomeFromTrade;
            this.TaxRevenue      = colonyInfos.Sum <ColonyInfo>((Func <ColonyInfo, double>)(x => Colony.GetTaxRevenue(game.App, playerInfo, x)));
            float num1 = gamedb.GetNameValue <float>("EconomicEfficiency") / 100f;

            this.TradeRevenue *= (double)num1;
            this.TradeRevenue *= (double)game.GameDatabase.GetStratModifierFloatToApply(StratModifiers.TradeRevenue, playerInfo.ID);
            this.TaxRevenue   *= (double)num1;
            Player playerObject1 = game.GetPlayerObject(playerInfo.ID);

            if (playerObject1 == null || !playerObject1.IsAI())
            {
                this.CurrentStationUpkeepExpenses = GameSession.CalculateStationUpkeepCosts(gamedb, assetdb, stationInfos);
                this.CurrentShipUpkeepExpenses    = GameSession.CalculateFleetUpkeepCosts(assetdb, reserveShipDesignInfos, shipDesignInfos, eliteShipDesignInfos);
                this.AdditionalUpkeepExpenses     = GameSession.CalculateShipUpkeepCosts(assetdb, additionalShipDesignInfos, 1f, false);
            }
            this.ColonySupportExpenses = colonyInfos.Sum <ColonyInfo>((Func <ColonyInfo, double>)(x =>
            {
                OrbitalObjectInfo orbitalObjectInfo = orbitalObjectInfos[x.OrbitalObjectID];
                PlanetInfo planetInfo         = planetInfos[x.OrbitalObjectID];
                StarSystemInfo starSystemInfo = starSystemInfos[orbitalObjectInfo.StarSystemID];
                return(Colony.GetColonySupportCost(gamedb, assetdb, playerInfo, playerFactionInfo, orbitalObjectInfos[x.OrbitalObjectID], planetInfos[x.OrbitalObjectID], starSystemInfos[orbitalObjectInfos[x.OrbitalObjectID].StarSystemID], orbitalObjectInfos, planetInfos, starSystemInfos, starSystemsWithGates.Contains(orbitalObjectInfos[x.OrbitalObjectID].StarSystemID), maxDriveSpeed));
            }));
            this.IORevenue = 0.0;
            List <int> list1         = gamedb.GetPlayerColonySystemIDs(playerInfo.ID).ToList <int>();
            int        num2          = list1.Where <int>((Func <int, bool>)(x => gamedb.GetStarSystemInfo(x).IsOpen)).Count <int>();
            Player     playerObject2 = game.GetPlayerObject(playerInfo.ID);
            float      num3          = 0.0f;

            foreach (int num4 in list1)
            {
                List <BuildOrderInfo> list2 = gamedb.GetBuildOrdersForSystem(num4).ToList <BuildOrderInfo>();
                float num5 = 0.0f;
                foreach (ColonyInfo colony in gamedb.GetColonyInfosForSystem(num4).ToList <ColonyInfo>())
                {
                    if (colony.PlayerID == playerInfo.ID)
                    {
                        num5 += Colony.GetConstructionPoints(game, colony);
                    }
                }
                float num6 = num5 * game.GetStationBuildModifierForSystem(num4, playerInfo.ID);
                foreach (BuildOrderInfo buildOrderInfo in list2)
                {
                    DesignInfo designInfo = gamedb.GetDesignInfo(buildOrderInfo.DesignID);
                    if (designInfo.PlayerID == playerInfo.ID)
                    {
                        int num7 = designInfo.SavingsCost;
                        if (designInfo.IsLoaCube())
                        {
                            num7 = buildOrderInfo.LoaCubes * assetdb.LoaCostPerCube;
                        }
                        int   num8 = buildOrderInfo.ProductionTarget - buildOrderInfo.Progress;
                        float num9 = 0.0f;
                        if (!designInfo.isPrototyped)
                        {
                            num9 = (float)(int)((double)num6 * ((double)gamedb.GetStratModifierFloatToApply(StratModifiers.PrototypeTimeModifier, playerInfo.ID) - 1.0));
                            switch (designInfo.Class)
                            {
                            case ShipClass.Cruiser:
                                num7 = (int)((double)designInfo.SavingsCost * (double)gamedb.GetStratModifierFloatToApply(StratModifiers.PrototypeSavingsCostModifierCR, playerInfo.ID));
                                break;

                            case ShipClass.Dreadnought:
                                num7 = (int)((double)designInfo.SavingsCost * (double)gamedb.GetStratModifierFloatToApply(StratModifiers.PrototypeSavingsCostModifierDN, playerInfo.ID));
                                break;

                            case ShipClass.Leviathan:
                                num7 = (int)((double)designInfo.SavingsCost * (double)gamedb.GetStratModifierFloatToApply(StratModifiers.PrototypeSavingsCostModifierLV, playerInfo.ID));
                                break;

                            case ShipClass.Station:
                                RealShipClasses?realShipClass = designInfo.GetRealShipClass();
                                if ((realShipClass.GetValueOrDefault() != RealShipClasses.Platform ? 0 : (realShipClass.HasValue ? 1 : 0)) != 0)
                                {
                                    num7 = (int)((double)designInfo.SavingsCost * (double)gamedb.GetStratModifierFloatToApply(StratModifiers.PrototypeSavingsCostModifierPF, playerInfo.ID));
                                    break;
                                }
                                break;
                            }
                        }
                        if (playerInfo.isStandardPlayer && playerObject2.IsAI() && playerObject2.Faction.Name == "loa")
                        {
                            num7 = (int)((double)num7 * 1.0);
                        }
                        if ((double)num8 <= (double)num6 - (double)num9)
                        {
                            num3 += (float)num7;
                            num6 -= (float)num8;
                        }
                        this.TotalBuildShipCosts += (double)num7;
                    }
                }
                this.IORevenue += (double)num6;
            }
            this.IORevenue            *= (double)game.GameDatabase.GetStratModifierFloatToApply(StratModifiers.IORevenue, playerInfo.ID);
            this.PendingBuildShipsCost = (double)num3;
            foreach (MissionInfo missionInfo in game.GameDatabase.GetMissionInfos().Where <MissionInfo>((Func <MissionInfo, bool>)(x => x.Type == MissionType.CONSTRUCT_STN)))
            {
                FleetInfo fleetInfo = game.GameDatabase.GetFleetInfo(missionInfo.FleetID);
                if (fleetInfo.PlayerID == playerInfo.ID)
                {
                    MissionEstimate missionEstimate = Kerberos.Sots.StarFleet.StarFleet.GetMissionEstimate(game, missionInfo.Type, (StationType)missionInfo.StationType.Value, fleetInfo.ID, missionInfo.TargetSystemID, missionInfo.TargetOrbitalObjectID, (List <int>)null, 1, false, new float?(), new float?());
                    this.TotalBuildStationsCost += (double)missionEstimate.ConstructionCost;
                    if (missionEstimate.TotalTurns - 1 - missionEstimate.TurnsToReturn <= 1)
                    {
                        this.PendingBuildStationsCost += (double)missionEstimate.ConstructionCost;
                    }
                }
            }
            foreach (MissionInfo missionInfo in game.GameDatabase.GetMissionInfos().Where <MissionInfo>((Func <MissionInfo, bool>)(x =>
            {
                if (x.Type == MissionType.UPGRADE_STN)
                {
                    return(x.Duration > 0);
                }
                return(false);
            })))
            {
                FleetInfo fleetInfo = game.GameDatabase.GetFleetInfo(missionInfo.FleetID);
                if (game.GameDatabase.GetStationInfo(missionInfo.TargetOrbitalObjectID) != null && fleetInfo.PlayerID == playerInfo.ID && game.GameDatabase.GetWaypointsByMissionID(missionInfo.ID).First <WaypointInfo>().Type != WaypointType.ReturnHome)
                {
                    StationInfo stationInfo = game.GameDatabase.GetStationInfo(missionInfo.TargetOrbitalObjectID);
                    if (stationInfo.DesignInfo.StationLevel + 1 <= 5)
                    {
                        MissionEstimate missionEstimate   = Kerberos.Sots.StarFleet.StarFleet.GetMissionEstimate(game, missionInfo.Type, stationInfo.DesignInfo.StationType, fleetInfo.ID, missionInfo.TargetSystemID, missionInfo.TargetOrbitalObjectID, (List <int>)null, stationInfo.DesignInfo.StationLevel + 1, false, new float?(), new float?());
                        DesignInfo      stationDesignInfo = DesignLab.CreateStationDesignInfo(game.AssetDatabase, game.GameDatabase, fleetInfo.PlayerID, stationInfo.DesignInfo.StationType, stationInfo.DesignInfo.StationLevel + 1, false);
                        this.TotalBuildStationsCost += (double)stationDesignInfo.SavingsCost;
                        if (missionEstimate.TotalTurns - 1 - missionEstimate.TurnsToReturn <= 1)
                        {
                            this.PendingBuildStationsCost += (double)stationDesignInfo.SavingsCost;
                        }
                    }
                }
            }
            foreach (StationInfo stationInfo in game.GameDatabase.GetStationInfosByPlayerID(playerInfo.ID))
            {
                List <DesignModuleInfo> queuedModules = game.GameDatabase.GetQueuedStationModules(stationInfo.DesignInfo.DesignSections[0]).ToList <DesignModuleInfo>();
                if (queuedModules.Count > 0)
                {
                    LogicalModule logicalModule1 = game.AssetDatabase.Modules.First <LogicalModule>((Func <LogicalModule, bool>)(x => x.ModulePath == game.GameDatabase.GetModuleAsset(queuedModules.First <DesignModuleInfo>().ModuleID)));
                    if (logicalModule1 != null)
                    {
                        this.PendingStationsModulesCost += (double)logicalModule1.SavingsCost;
                    }
                    foreach (DesignModuleInfo designModuleInfo in queuedModules)
                    {
                        DesignModuleInfo dmi            = designModuleInfo;
                        LogicalModule    logicalModule2 = game.AssetDatabase.Modules.First <LogicalModule>((Func <LogicalModule, bool>)(x => x.ModulePath == game.GameDatabase.GetModuleAsset(dmi.ModuleID)));
                        if (logicalModule2 != null)
                        {
                            this.TotalStationsModulesCost += (double)logicalModule2.SavingsCost;
                        }
                    }
                }
            }
            this.TotalRevenue     = this.TradeRevenue + this.TaxRevenue + this.IORevenue + this.SavingsInterest;
            this.RequiredSecurity = (int)Math.Ceiling(((double)num2 / (double)list1.Count != 0.0 ? ((double)assetdb.BaseCorruptionRate + 0.0199999995529652 * ((double)playerInfo.RateImmigration * 10.0)) / (2.0 * (double)playerInfo.RateGovernmentResearch) : 0.0) * 100.0);
            if (playerFactionInfo.Name == "loa")
            {
                this.RequiredSecurity = 0;
            }
            this.CorruptionExpenses = this.TotalRevenue * (double)Math.Max(0.0f, (float)(((double)assetdb.BaseCorruptionRate + 0.0199999995529652 * ((double)playerInfo.RateImmigration * 10.0) - 2.0 * ((double)playerInfo.RateGovernmentResearch * (double)playerInfo.RateGovernmentSecurity)) * ((double)num2 / (double)list1.Count)));
            if (playerFactionInfo.Name == "loa")
            {
                this.CorruptionExpenses = 0.0;
            }
            this.UpkeepExpenses              = this.CurrentShipUpkeepExpenses + this.CurrentStationUpkeepExpenses + this.AdditionalUpkeepExpenses;
            this.TotalExpenses               = this.UpkeepExpenses + this.ColonySupportExpenses + this.DebtInterest + this.CorruptionExpenses;
            this.OperatingBudget             = this.TotalRevenue - this.TotalExpenses;
            this.DisposableIncome            = Math.Max(this.OperatingBudget, 0.0);
            this.NetSavingsLoss              = Math.Max(-this.OperatingBudget, 0.0) + this.PendingBuildShipsCost + this.PendingBuildStationsCost + this.PendingStationsModulesCost;
            this.RequestedGovernmentSpending = this.DisposableIncome * (double)playerInfo.RateGovernmentResearch;
            SpendingPool pool = new SpendingPool();

            this.ResearchSpending            = new ResearchSpending(playerInfo, this.DisposableIncome - this.RequestedGovernmentSpending, pool, spendingCaps);
            this.SecuritySpending            = new SecuritySpending(playerInfo, this.RequestedGovernmentSpending * (double)playerInfo.RateGovernmentSecurity, pool, spendingCaps);
            this.StimulusSpending            = new StimulusSpending(playerInfo, this.RequestedGovernmentSpending * (double)playerInfo.RateGovernmentStimulus, pool, spendingCaps);
            this.ProjectedGovernmentSpending = this.SecuritySpending.ProjectedTotal + this.StimulusSpending.ProjectedTotal;
            this.UnspentIncome    = pool.Excess;
            this.NetSavingsIncome = this.DisposableIncome - this.ResearchSpending.RequestedTotal - this.SecuritySpending.RequestedTotal - this.StimulusSpending.RequestedTotal + this.UnspentIncome;
            this.ProjectedSavings = this.CurrentSavings + this.NetSavingsIncome - this.NetSavingsLoss;
        }