Пример #1
0
        public float GetContractTimeReductionMultiplierForPerks(IUpgradeableVO deployableVO, List <string> perkIds)
        {
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            BuildingTypeVO           minBuildingRequirement   = buildingLookupController.GetMinBuildingRequirement(deployableVO);
            List <string>            perkEffectIds            = this.GetPerkEffectIds(perkIds);

            return(ContractTimePerkUtils.GetTimeReductionMultiplier(minBuildingRequirement, perkEffectIds));
        }
Пример #2
0
 private bool IsEquipmentUnlockedByRequirement(EquipmentVO vo, ref BuildingTypeVO req)
 {
     if (vo != null && !string.IsNullOrEmpty(vo.BuildingRequirement))
     {
         BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
         req = buildingLookupController.GetEquipmentUnlockRequirement(vo);
         return(req == null || buildingLookupController.HasConstructedBuilding(req));
     }
     return(true);
 }
Пример #3
0
 private bool IsSpecialAttackUnlockedByRequirement(SpecialAttackTypeVO vo, ref BuildingTypeVO req)
 {
     if (vo != null && !string.IsNullOrEmpty(vo.BuildingRequirement))
     {
         BuildingLookupController buildingLookupController = Service.BuildingLookupController;
         req = buildingLookupController.GetStarshipUnlockRequirement(vo);
         return(req == null || buildingLookupController.HasConstructedBuilding(req));
     }
     return(true);
 }
Пример #4
0
        private void CreateScoutHolo()
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            Entity availableScoutTower = buildingLookupController.GetAvailableScoutTower();

            if (availableScoutTower != null && this.AreRaidsAccessible() && this.IsRaidAvailable())
            {
                CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>();
                RaidVO        raidVO        = Service.Get <IDataController>().Get <RaidVO>(currentPlayer.CurrentRaidId);
                this.scoutHolo = new BuildingHoloEffect(availableScoutTower);
                this.scoutHolo.CreateGenericHolo(raidVO.BuildingHoloAssetName, "locator_fx");
            }
        }
Пример #5
0
        public void PrepareAndPurchaseNewBuilding(BuildingTypeVO buildingType)
        {
            this.buildingMover.EnsureLoweredLiftedBuilding();
            this.EnsureDeselectSelectedBuilding();
            GameStateMachine gameStateMachine = Service.Get <GameStateMachine>();

            if (!(gameStateMachine.CurrentState is EditBaseState))
            {
                gameStateMachine.SetState(new EditBaseState(false));
            }
            int stampableQuantity = 0;

            if (buildingType.Type == BuildingType.Wall)
            {
                BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
                int buildingMaxPurchaseQuantity = buildingLookupController.GetBuildingMaxPurchaseQuantity(buildingType, 0);
                int buildingPurchasedQuantity   = buildingLookupController.GetBuildingPurchasedQuantity(buildingType);
                stampableQuantity = buildingMaxPurchaseQuantity - buildingPurchasedQuantity;
            }
            this.StartPurchaseBuilding(buildingType, stampableQuantity);
        }
Пример #6
0
        private bool IsBuildingUnlockedByRequirement(BuildingTypeVO vo, int buildOrUpgrade, ref BuildingTypeVO req)
        {
            bool flag = true;

            if (buildOrUpgrade == 0)
            {
                vo = Service.Get <BuildingUpgradeCatalog>().GetMinLevel(vo);
            }
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            IDataController          dataController           = Service.Get <IDataController>();

            if (!string.IsNullOrEmpty(vo.BuildingRequirement))
            {
                req  = dataController.Get <BuildingTypeVO>(vo.BuildingRequirement);
                flag = buildingLookupController.HasConstructedBuilding(req);
            }
            if (flag && !string.IsNullOrEmpty(vo.BuildingRequirement2))
            {
                req  = dataController.Get <BuildingTypeVO>(vo.BuildingRequirement2);
                flag = buildingLookupController.HasConstructedBuilding(req);
            }
            return(flag);
        }
Пример #7
0
        public void HandleUnableToCollect(CurrencyType currencyType)
        {
            BuildingLookupController buildingLookupController = Service.Get <BuildingLookupController>();
            IDataController          dataController           = Service.Get <IDataController>();
            CurrentPlayer            currentPlayer            = Service.Get <CurrentPlayer>();
            BuildingTypeVO           buildingTypeVO           = null;

            foreach (BuildingTypeVO current in dataController.GetAll <BuildingTypeVO>())
            {
                if (current.Faction == currentPlayer.Faction && current.Type == BuildingType.Storage && current.Currency == currencyType)
                {
                    buildingTypeVO = current;
                    break;
                }
            }
            int num = 0;

            if (buildingTypeVO != null)
            {
                num = buildingLookupController.GetBuildingMaxPurchaseQuantity(buildingTypeVO, 0);
            }
            int num2           = 0;
            int num3           = 0;
            int highestLevelHQ = buildingLookupController.GetHighestLevelHQ();

            for (StorageNode storageNode = buildingLookupController.StorageNodeList.Head; storageNode != null; storageNode = storageNode.Next)
            {
                if (storageNode.BuildingComp.BuildingType.Currency == currencyType)
                {
                    num2++;
                    if (storageNode.BuildingComp.BuildingType.Lvl == highestLevelHQ)
                    {
                        num3++;
                    }
                }
            }
            bool   flag         = num2 < num;
            string instructions = string.Empty;

            switch (currencyType)
            {
            case CurrencyType.Credits:
                if (flag)
                {
                    instructions = Service.Get <Lang>().Get("BUILD_MORE_CREDIT_STORAGE", new object[0]);
                }
                else if (num3 == num2)
                {
                    instructions = Service.Get <Lang>().Get("FULL_CREDIT_STORAGE", new object[0]);
                }
                else
                {
                    instructions = Service.Get <Lang>().Get("UPGRADE_CREDIT_STORAGE", new object[0]);
                }
                break;

            case CurrencyType.Materials:
                if (flag)
                {
                    instructions = Service.Get <Lang>().Get("BUILD_MORE_MATERIAL_STORAGE", new object[0]);
                }
                else if (num3 == num2)
                {
                    instructions = Service.Get <Lang>().Get("FULL_MATERIAL_STORAGE", new object[0]);
                }
                else
                {
                    instructions = Service.Get <Lang>().Get("UPGRADE_MATERIAL_STORAGE", new object[0]);
                }
                break;

            case CurrencyType.Contraband:
                if (flag)
                {
                    instructions = Service.Get <Lang>().Get("BUILD_MORE_CONTRABAND_STORAGE", new object[0]);
                }
                else if (num3 == num2)
                {
                    instructions = Service.Get <Lang>().Get("FULL_CONTRABAND_STORAGE", new object[0]);
                }
                else
                {
                    instructions = Service.Get <Lang>().Get("UPGRADE_CONTRABAND_STORAGE", new object[0]);
                }
                break;
            }
            Service.Get <UXController>().MiscElementsManager.ShowPlayerInstructions(instructions);
        }