コード例 #1
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
        public static bool IsArmoryFull(CurrentPlayer currentPlayer)
        {
            int currentActiveEquipmentCapacity = ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory);
            int maxCapacity = currentPlayer.ActiveArmory.MaxCapacity;

            return(currentActiveEquipmentCapacity >= maxCapacity);
        }
コード例 #2
0
 private static bool ConditionMet(string condition)
 {
     if (string.IsNullOrEmpty(condition))
     {
         return(false);
     }
     if (condition != null)
     {
         if (condition == "ownsArmory")
         {
             return(ArmoryUtils.PlayerHasArmory());
         }
         if (condition == "hasAvailableEquipment")
         {
             return(CrateUtils.PlayerHasEquipmentAvailable());
         }
     }
     if (condition.StartsWith("hq"))
     {
         string value = condition.Substring("hq".Length);
         int    level = Convert.ToInt32(value);
         return(CrateUtils.PlayerHasAtLeastHqLevel(level));
     }
     return(false);
 }
コード例 #3
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
        public static List <string> GetValidEquipment(CurrentPlayer player, IDataController dc, string planetId)
        {
            List <string> list      = null;
            List <string> equipment = player.ActiveArmory.Equipment;

            if (equipment != null)
            {
                int i     = 0;
                int count = equipment.Count;
                while (i < count)
                {
                    EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]);
                    if (ArmoryUtils.IsEquipmentValidForPlanet(equipmentVO, planetId))
                    {
                        if (list == null)
                        {
                            list = new List <string>();
                        }
                        list.Add(equipmentVO.Uid);
                    }
                    i++;
                }
            }
            return(list);
        }
コード例 #4
0
        public static bool HasReachedMaxEquipmentShards(CurrentPlayer player, EquipmentUpgradeCatalog catalog, string equipmentID)
        {
            int         level    = player.UnlockedLevels.Equipment.GetLevel(equipmentID);
            EquipmentVO maxLevel = catalog.GetMaxLevel(equipmentID);
            int         num      = (maxLevel == null) ? 0 : maxLevel.Lvl;

            if (level >= num)
            {
                return(true);
            }
            int numEquipmentShardsToReachLevel = ArmoryUtils.GetNumEquipmentShardsToReachLevel(catalog, equipmentID, level, num);

            return(player.Shards.ContainsKey(equipmentID) && player.Shards[equipmentID] >= numEquipmentShardsToReachLevel);
        }
コード例 #5
0
        private static bool PlayerHasEquipmentAvailable()
        {
            CurrentPlayer           currentPlayer           = Service.CurrentPlayer;
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog;

            foreach (string current in equipmentUpgradeCatalog.AllUpgradeGroups())
            {
                if (!ArmoryUtils.HasReachedMaxEquipmentShards(currentPlayer, equipmentUpgradeCatalog, current))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #6
0
        private static int SortByRequirementsMet(SortableEquipment a, SortableEquipment b)
        {
            bool flag  = ArmoryUtils.IsBuildingRequirementMet(a.Equipment);
            bool flag2 = ArmoryUtils.IsBuildingRequirementMet(b.Equipment);

            if (flag && !flag2)
            {
                return(-1);
            }
            if (flag2 && !flag)
            {
                return(1);
            }
            return(0);
        }
コード例 #7
0
        private static int SortByCurrentPlanet(SortableEquipment a, SortableEquipment b)
        {
            bool flag  = ArmoryUtils.IsEquipmentOnValidPlanet(a.Player, a.Equipment);
            bool flag2 = ArmoryUtils.IsEquipmentOnValidPlanet(b.Player, b.Equipment);

            if (flag && !flag2)
            {
                return(-1);
            }
            if (flag2 && !flag)
            {
                return(1);
            }
            return(0);
        }
コード例 #8
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
        public static int GetShardsRequiredForNextUpgrade(CurrentPlayer currentPlayer, EquipmentUpgradeCatalog equipmentCatalog, EquipmentVO equipmentVO)
        {
            if (!ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentVO))
            {
                EquipmentVO minLevel = equipmentCatalog.GetMinLevel(equipmentVO.EquipmentID);
                return(minLevel.UpgradeShards);
            }
            EquipmentVO nextLevel = equipmentCatalog.GetNextLevel(equipmentVO);

            if (nextLevel == null)
            {
                return(-1);
            }
            return(nextLevel.UpgradeShards);
        }
コード例 #9
0
        public static void HandleCrateSupplyRewardClicked(CrateSupplyVO crateSupply)
        {
            IDataController dataController = Service.Get <IDataController>();
            DeployableShardUnlockController deployableShardUnlockController = Service.Get <DeployableShardUnlockController>();
            IDeployableVO deployableVO = null;
            EquipmentVO   equipmentVO  = null;

            switch (crateSupply.Type)
            {
            case SupplyType.Shard:
                equipmentVO = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid);
                break;

            case SupplyType.Troop:
            case SupplyType.Hero:
                deployableVO = dataController.Get <TroopTypeVO>(crateSupply.RewardUid);
                break;

            case SupplyType.SpecialAttack:
                deployableVO = dataController.Get <SpecialAttackTypeVO>(crateSupply.RewardUid);
                break;

            case SupplyType.ShardTroop:
            case SupplyType.ShardSpecialAttack:
            {
                ShardVO shard = dataController.Get <ShardVO>(crateSupply.RewardUid);
                deployableVO = deployableShardUnlockController.GetDeployableVOFromShard(shard);
                break;
            }
            }
            Entity availableTroopResearchLab = Service.Get <BuildingLookupController>().GetAvailableTroopResearchLab();

            if (deployableVO != null)
            {
                Service.Get <EventManager>().SendEvent(EventId.LootTableUnitInfoTapped, deployableVO.Uid);
                TroopUpgradeTag      troopUpgradeTag     = new TroopUpgradeTag(deployableVO, true);
                bool                 showUpgradeControls = !string.IsNullOrEmpty(troopUpgradeTag.Troop.UpgradeShardUid);
                DeployableInfoScreen screen = new DeployableInfoScreen(troopUpgradeTag, null, showUpgradeControls, availableTroopResearchLab);
                Service.Get <ScreenController>().AddScreen(screen);
                return;
            }
            if (equipmentVO != null)
            {
                EquipmentInfoScreen screen2 = new EquipmentInfoScreen(equipmentVO, null, availableTroopResearchLab, true);
                Service.Get <ScreenController>().AddScreen(screen2);
            }
        }
コード例 #10
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke15(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsEquipmentOwned((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1]))));
 }
コード例 #11
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsBuildingRequirementMet((EquipmentVO)GCHandledObjects.GCHandleToObject(*args))));
 }
コード例 #12
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke11(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsAtMaxLevel((EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1]))));
 }
コード例 #13
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke10(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsArmoryFull((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args))));
 }
コード例 #14
0
ファイル: LangUtils.cs プロジェクト: Hengle/swc-decompiled
        public static string GetEquipmentDisplayNameById(string equipmentId)
        {
            EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(equipmentId);

            return(LangUtils.GetEquipmentDisplayName(currentEquipmentDataByID));
        }
コード例 #15
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
        public static EquipmentVO GetCurrentEquipmentDataByID(string equipmentId)
        {
            int level = Service.Get <CurrentPlayer>().UnlockedLevels.Equipment.GetLevel(equipmentId);

            return(ArmoryUtils.GetEquipmentDataByID(equipmentId, level));
        }
コード例 #16
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke4(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetShardsRequiredForNextUpgrade((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(args[1]), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[2]))));
 }
コード例 #17
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke3(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetEquipmentDataByID(Marshal.PtrToStringUni(*(IntPtr *)args), *(int *)(args + 1))));
 }
コード例 #18
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetCurrentActiveEquipmentCapacity((ActiveArmory)GCHandledObjects.GCHandleToObject(*args))));
 }
コード例 #19
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
        public static bool IsArmoryEmpty(CurrentPlayer currentPlayer)
        {
            int currentActiveEquipmentCapacity = ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory);

            return(currentActiveEquipmentCapacity == 0);
        }
コード例 #20
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke16(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsEquipmentValidForPlanet((EquipmentVO)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)))));
 }
コード例 #21
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke6(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.HasEnoughCapacityToActivateEquipment((ActiveArmory)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1]))));
 }
コード例 #22
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke17(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.PlayerHasArmory()));
 }
コード例 #23
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke7(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.HasReachedMaxEquipmentShards((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(args[1]), Marshal.PtrToStringUni(*(IntPtr *)(args + 2)))));
 }
コード例 #24
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public static bool HasEnoughCapacityToActivateEquipment(ActiveArmory armory, EquipmentVO equipment)
 {
     return(ArmoryUtils.GetCurrentActiveEquipmentCapacity(armory) + equipment.Size <= armory.MaxCapacity);
 }
コード例 #25
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke8(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsAnyEquipmentActive((ActiveArmory)GCHandledObjects.GCHandleToObject(*args))));
 }
コード例 #26
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public unsafe static long $Invoke5(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetValidEquipment((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (IDataController)GCHandledObjects.GCHandleToObject(args[1]), Marshal.PtrToStringUni(*(IntPtr *)(args + 2)))));
 }
コード例 #27
0
ファイル: ArmoryUtils.cs プロジェクト: Hengle/swc-decompiled
 public static bool IsAnyEquipmentActive(ActiveArmory armory)
 {
     return(ArmoryUtils.GetCurrentActiveEquipmentCapacity(armory) > 0);
 }