Beispiel #1
0
 public FleetManagement()
 {
     this.Fleet         = (FleetInfo)null;
     this.MissionTime   = (MissionEstimate)null;
     this.Score         = 0;
     this.FleetStrength = 0;
 }
        protected override void OnPrepare(GameState prev, object[] stateParams)
        {
            base.OnPrepare(prev, stateParams);
            this._targetSystemID   = (int)stateParams[0];
            this._selectedPlanetID = (int)stateParams[1];
            this._sim             = (GameSession)stateParams[2];
            this._selectedFleetID = (int)stateParams[3];
            this._designsToBuild  = (List <int>)stateParams[4];
            this._stationType     = (StationType)stateParams[5];
            this._missionEstimate = (MissionEstimate)stateParams[6];
            this._useDirectRoute  = (bool)stateParams[7];
            this._rebase          = (int?)stateParams[8];
            this._crits           = new GameObjectSet(this.App);
            this._dummies         = new GameObjectSet(this.App);
            DesignInfo di = DesignLab.CreateStationDesignInfo(this.App.AssetDatabase, this.App.GameDatabase, this.App.LocalPlayer.ID, this._stationType, 1, false);
            StarSystemDummyOccupant systemDummyOccupant = new StarSystemDummyOccupant(this.App, this.App.AssetDatabase.ShipSections.First <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x => x.FileName == di.DesignSections[0].FilePath)).ModelName, this._stationType);

            this._dummies.Add((IGameObject)systemDummyOccupant);
            this._starsystem.PostObjectAddObjects((IGameObject)systemDummyOccupant);
            this._manager = new StationPlacement(this.App, this.App.LocalPlayer.Faction.Name == "zuul");
            this._manager.PostSetProp("SetStarSystem", (IGameObject)this._starsystem);
            this._manager.PostSetProp("SetPlacementStamp", (IGameObject)systemDummyOccupant);
            this._manager.PostSetProp("SetMissionType", (object)this._stationType.ToFlags());
            this.App.UI.LoadScreen("StationPlacement");
        }
        protected override void OnRefreshMissionDetails(MissionEstimate estimate)
        {
            string empty = string.Empty;
            string hint  = this.CanConfirm ? App.Localize("@RELOCATIONMISSION_HINT") : App.Localize("@UI_RELOCATION_INSUFFICIENT_SUPPORT");

            this.AddMissionTime(2, App.Localize("@MISSIONWIDGET_RELOCATION_TIME"), estimate.TurnsToTarget, hint);
        }
Beispiel #4
0
        protected override void OnRefreshMissionDetails(MissionEstimate estimate)
        {
            this.AddCommonMissionTimes(estimate);
            string hint1 = App.Localize("@MISSIONWIDGET_TOOLTIP_COLONIZATION_TIME");

            this.AddMissionTime(2, App.Localize("@MISSIONWIDGET_COLONIZATION_TIME"), estimate.TurnsAtTarget, hint1);
            string hint2 = App.Localize("@COLONIZEMISSION_HINT");

            this.AddMissionTime(6, App.Localize("@MISSIONWIDGET_SUPPORT_TIME"), estimate.TurnsColonySupport, hint2);
            this.AddMissionCost(estimate);
            int num = estimate.TurnsTillPhase1Completion;

            if (num < 1)
            {
                num = 1;
            }
            string str = num == 1 ? App.Localize("@UI_GENERAL_TURN") : App.Localize("@UI_GENERAL_TURNS");

            this.AddMissionNote(string.Format(App.Localize("@MISSIONWIDGET_PHASE_ONE"), (object)num, (object)str));
            if (!this._fleetCentric)
            {
                return;
            }
            FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
        }
        protected override void OnRefreshMissionDetails(MissionEstimate estimate)
        {
            this.AddCommonMissionTimes(estimate);
            string hint = App.Localize("@UI_STRIKE_OVERLAY_MISSION_HINT");

            this.AddMissionTime(2, App.Localize("@UI_STRIKE_TIME"), estimate.TurnsAtTarget, hint);
            this.AddMissionCost(estimate);
        }
Beispiel #6
0
        public static void ReRefreshMissionDetails(App game, MissionEstimate estimate)
        {
            OverlayMission.AddCommonMissionTimes(game, estimate);
            string hint = App.Localize("@MISSIONWIDGET_TOOLTIP_UPGRADE_TIME");

            OverlayMission.AddMissionTime(game, 2, App.Localize("@MISSIONWIDGET_CONSTRUCTION_TIME"), estimate.TurnsAtTarget, hint);
            OverlayMission.AddMissionCost(game, estimate);
        }
        protected override void OnRefreshMissionDetails(MissionEstimate estimate)
        {
            this.AddCommonMissionTimes(estimate);
            string hint = "NPG MISSION";

            this.AddMissionTime(2, App.Localize("DEPLOY NPG MISSION"), estimate.TurnsAtTarget, hint);
            this.AddMissionCost(estimate);
            this.UpdateCanConfirmMission();
        }
Beispiel #8
0
        protected override void RefreshMissionDetails(StationType type = StationType.INVALID_TYPE, int stationLevel = 1)
        {
            if (this.TargetSystem == 0)
            {
                return;
            }
            string missionDetailsTitle = this.GetMissionDetailsTitle();

            if (this._selectedReaction != null && this._selectedReaction.Reaction != null && this._selectedReaction.TargetFleet.HasValue)
            {
                int systemId = this._selectedReaction.Reaction.fleetsInRange.FirstOrDefault <FleetInfo>((Func <FleetInfo, bool>)(x => x.ID == this._selectedReaction.TargetFleet.Value)).SystemID;
                this.App.UI.ClearItems("gameMissionTimes");
                this.App.UI.ClearItems("gameMissionNotes");
                MissionEstimate missionEstimate = Kerberos.Sots.StarFleet.StarFleet.GetMissionEstimate(this.App.Game, MissionType.REACTION, type, this._selectedReaction.Reaction.fleet.ID, systemId, this.SelectedPlanet, this.GetDesignsToBuild(), stationLevel, false, new float?(), new float?());
                if (missionEstimate != null)
                {
                    this._missionEstimate = missionEstimate;
                }
                missionDetailsTitle += string.Format(App.Localize("@UI_MISSION_ETA_TURNS"), (object)this._missionEstimate.TurnsToTarget);
                this.OnRefreshMissionDetails(this._missionEstimate);
                this.App.UI.AutoSizeContents("gameMissionDetails");
            }
            this.App.UI.SetText(this.App.UI.Path(this.ID, "gameMissionTitle"), missionDetailsTitle);
        }
 protected override void OnRefreshMissionDetails(MissionEstimate estimate)
 {
     this.AddCommonMissionTimes(estimate);
     this.AddMissionCost(estimate);
     FleetUI.SyncPlanetListControl(this.App.Game, this.App.UI.Path(this.ID, "overlayPlanetList"), this.GetMissionTargetPlanets());
 }
Beispiel #10
0
 protected override void OnRefreshMissionDetails(MissionEstimate estimate)
 {
 }
		protected override void OnRefreshMissionDetails(MissionEstimate estimate)
		{
			this.AddCommonMissionTimes(estimate);
			this.AddMissionCost(estimate);
		}
Beispiel #12
0
 protected override void OnRefreshMissionDetails(MissionEstimate estimate)
 {
     OverlayUpgradeMission.ReRefreshMissionDetails(this.App, estimate);
 }
Beispiel #13
0
 protected override void OnRefreshMissionDetails(MissionEstimate estimate)
 {
     OverlayConstructionMission.ReRefreshMissionDetails(this._app, estimate);
 }
Beispiel #14
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;
        }