Beispiel #1
0
        public static void GetInstantSpecialAttackReward(string rewardString, ref RewardComponentTag rct)
        {
            IDataController dataController = Service.Get <IDataController>();

            string[]            array    = RewardUtils.ParsePairedStrings(rewardString, ':');
            string              uid      = array[0];
            SpecialAttackTypeVO optional = dataController.GetOptional <SpecialAttackTypeVO>(uid);

            if (optional != null)
            {
                rct.RewardName           = LangUtils.GetStarshipDisplayName(optional);
                rct.Quantity             = Service.Get <Lang>().Get("LABEL_REWARD_UPGRADE", new object[0]);
                rct.RewardAssetName      = optional.AssetName;
                rct.RewardGeometryConfig = optional;
                rct.Type = RewardType.Troop;
            }
        }
Beispiel #2
0
        public static void GetInstantTroopReward(string rewardString, ref RewardComponentTag rct)
        {
            StaticDataController staticDataController = Service.StaticDataController;

            string[]    array    = RewardUtils.ParsePairedStrings(rewardString, ':');
            string      uid      = array[0];
            TroopTypeVO optional = staticDataController.GetOptional <TroopTypeVO>(uid);

            if (optional != null)
            {
                rct.RewardName           = LangUtils.GetTroopDisplayName(optional);
                rct.Quantity             = Service.Lang.Get("LABEL_REWARD_UPGRADE", new object[0]);
                rct.RewardAssetName      = optional.AssetName;
                rct.RewardGeometryConfig = optional;
                rct.Type = RewardType.Troop;
            }
        }
Beispiel #3
0
        public static void GetBuildingReward(string buildindId, ref RewardComponentTag rct)
        {
            IDataController dataController = Service.Get <IDataController>();
            BuildingTypeVO  buildingTypeVO = dataController.Get <BuildingTypeVO>(buildindId);

            if (buildingTypeVO.LinkedUnit != null)
            {
                TroopTypeVO troopTypeVO = Service.Get <ChampionController>().FindChampionTypeIfPlatform(buildingTypeVO);
                rct.RewardName           = LangUtils.GetTroopDisplayName(troopTypeVO);
                rct.RewardAssetName      = troopTypeVO.AssetName;
                rct.RewardGeometryConfig = troopTypeVO;
                rct.Type = RewardType.Troop;
                return;
            }
            rct.RewardName           = LangUtils.GetBuildingDisplayName(buildingTypeVO);
            rct.RewardAssetName      = buildingTypeVO.AssetName;
            rct.RewardGeometryConfig = buildingTypeVO;
            rct.Type = RewardType.Building;
        }
Beispiel #4
0
        public static List <RewardComponentTag> GetRewardComponents(RewardVO rewardVO)
        {
            List <RewardComponentTag> list           = new List <RewardComponentTag>();
            IDataController           dataController = Service.Get <IDataController>();
            Dictionary <string, int>  dictionary     = GameUtils.ListToMap(rewardVO.TroopRewards);

            foreach (string current in dictionary.Keys)
            {
                RewardComponentTag item        = default(RewardComponentTag);
                TroopTypeVO        troopTypeVO = dataController.Get <TroopTypeVO>(current);
                item.RewardName = LangUtils.GetTroopDisplayName(troopTypeVO);
                item.Quantity   = Service.Get <Lang>().Get("TROOP_MULTIPLIER", new object[]
                {
                    dictionary[current]
                });
                item.RewardAssetName      = troopTypeVO.AssetName;
                item.RewardGeometryConfig = troopTypeVO;
                item.Type = RewardType.Troop;
                list.Add(item);
            }
            dictionary = GameUtils.ListToMap(rewardVO.HeroRewards);
            foreach (string current2 in dictionary.Keys)
            {
                RewardComponentTag item2        = default(RewardComponentTag);
                TroopTypeVO        troopTypeVO2 = dataController.Get <TroopTypeVO>(current2);
                item2.RewardName = LangUtils.GetTroopDisplayName(troopTypeVO2);
                item2.Quantity   = Service.Get <Lang>().Get("TROOP_MULTIPLIER", new object[]
                {
                    dictionary[current2]
                });
                item2.RewardAssetName      = troopTypeVO2.AssetName;
                item2.RewardGeometryConfig = troopTypeVO2;
                item2.Type = RewardType.Troop;
                list.Add(item2);
            }
            dictionary = GameUtils.ListToMap(rewardVO.SpecialAttackRewards);
            foreach (string current3 in dictionary.Keys)
            {
                RewardComponentTag  item3 = default(RewardComponentTag);
                SpecialAttackTypeVO specialAttackTypeVO = dataController.Get <SpecialAttackTypeVO>(current3);
                item3.RewardName = LangUtils.GetStarshipDisplayName(specialAttackTypeVO);
                item3.Quantity   = Service.Get <Lang>().Get("TROOP_MULTIPLIER", new object[]
                {
                    dictionary[current3]
                });
                item3.RewardAssetName      = specialAttackTypeVO.AssetName;
                item3.RewardGeometryConfig = specialAttackTypeVO;
                item3.Type = RewardType.Troop;
                list.Add(item3);
            }
            dictionary = GameUtils.ListToMap(rewardVO.CurrencyRewards);
            foreach (string current4 in dictionary.Keys)
            {
                RewardComponentTag item4 = default(RewardComponentTag);
                item4.RewardName = Service.Get <Lang>().Get(current4.ToUpper(), new object[0]);
                int num = dictionary[current4];
                item4.Quantity = Service.Get <Lang>().ThousandsSeparated(num);
                int num2 = 0;
                int num3 = 0;
                if (current4 == "credits")
                {
                    num2 = GameConstants.CREDITS_3_THRESHOLD;
                    num3 = GameConstants.CREDITS_2_THRESHOLD;
                }
                else if (current4 == "materials")
                {
                    num2 = GameConstants.MATERIALS_3_THRESHOLD;
                    num3 = GameConstants.MATERIALS_2_THRESHOLD;
                }
                else if (current4 == "contraband")
                {
                    num2 = GameConstants.CONTRABAND_3_THRESHOLD;
                    num3 = GameConstants.CONTRABAND_2_THRESHOLD;
                }
                else if (current4 == "crystals")
                {
                    num2 = GameConstants.CRYSTALS_3_THRESHOLD;
                    num3 = GameConstants.CRYSTALS_2_THRESHOLD;
                }
                if (num >= num2)
                {
                    item4.RewardAssetName = current4 + 3;
                }
                else if (num >= num3)
                {
                    item4.RewardAssetName = current4 + 2;
                }
                else
                {
                    item4.RewardAssetName = current4 + 1;
                }
                item4.RewardGeometryConfig = dataController.Get <CurrencyIconVO>(item4.RewardAssetName);
                item4.Type = RewardType.Currency;
                list.Add(item4);
            }
            if (rewardVO.HeroUnlocks != null)
            {
                int i    = 0;
                int num4 = rewardVO.HeroUnlocks.Length;
                while (i < num4)
                {
                    RewardComponentTag item5        = default(RewardComponentTag);
                    TroopTypeVO        troopTypeVO3 = dataController.Get <TroopTypeVO>(rewardVO.HeroUnlocks[i]);
                    item5.RewardName           = LangUtils.GetTroopDisplayName(troopTypeVO3);
                    item5.Quantity             = Service.Get <Lang>().Get("LABEL_REWARD_UNLOCKED", new object[0]);
                    item5.RewardAssetName      = troopTypeVO3.AssetName;
                    item5.RewardGeometryConfig = troopTypeVO3;
                    item5.Type = RewardType.Troop;
                    list.Add(item5);
                    i++;
                }
            }
            if (rewardVO.TroopUnlocks != null)
            {
                int j    = 0;
                int num5 = rewardVO.TroopUnlocks.Length;
                while (j < num5)
                {
                    RewardComponentTag item6        = default(RewardComponentTag);
                    TroopTypeVO        troopTypeVO4 = dataController.Get <TroopTypeVO>(rewardVO.TroopUnlocks[j]);
                    item6.RewardName           = LangUtils.GetTroopDisplayName(troopTypeVO4);
                    item6.Quantity             = Service.Get <Lang>().Get("LABEL_REWARD_UNLOCKED", new object[0]);
                    item6.RewardAssetName      = troopTypeVO4.AssetName;
                    item6.RewardGeometryConfig = troopTypeVO4;
                    item6.Type = RewardType.Troop;
                    list.Add(item6);
                    j++;
                }
            }
            if (rewardVO.SpecialAttackUnlocks != null)
            {
                int k    = 0;
                int num6 = rewardVO.SpecialAttackUnlocks.Length;
                while (k < num6)
                {
                    RewardComponentTag  item7 = default(RewardComponentTag);
                    SpecialAttackTypeVO specialAttackTypeVO2 = dataController.Get <SpecialAttackTypeVO>(rewardVO.SpecialAttackUnlocks[k]);
                    item7.RewardName           = LangUtils.GetStarshipDisplayName(specialAttackTypeVO2);
                    item7.Quantity             = Service.Get <Lang>().Get("LABEL_REWARD_UNLOCKED", new object[0]);
                    item7.RewardAssetName      = specialAttackTypeVO2.AssetName;
                    item7.RewardGeometryConfig = specialAttackTypeVO2;
                    item7.Type = RewardType.Troop;
                    list.Add(item7);
                    k++;
                }
            }
            if (rewardVO.BuildingUnlocks != null)
            {
                int l    = 0;
                int num7 = rewardVO.BuildingUnlocks.Length;
                while (l < num7)
                {
                    RewardComponentTag item8          = default(RewardComponentTag);
                    BuildingTypeVO     buildingTypeVO = dataController.Get <BuildingTypeVO>(rewardVO.BuildingUnlocks[l]);
                    item8.RewardName           = LangUtils.GetBuildingDisplayName(buildingTypeVO);
                    item8.Quantity             = Service.Get <Lang>().Get("LABEL_REWARD_UNLOCKED", new object[0]);
                    item8.RewardAssetName      = buildingTypeVO.AssetName;
                    item8.RewardGeometryConfig = buildingTypeVO;
                    item8.Type = RewardType.Building;
                    list.Add(item8);
                    l++;
                }
            }
            if (!string.IsNullOrEmpty(rewardVO.DroidRewards))
            {
                RewardComponentTag item9        = default(RewardComponentTag);
                TroopTypeVO        troopTypeVO5 = dataController.Get <TroopTypeVO>("troopWorkerDroid");
                item9.RewardName           = LangUtils.GetTroopDisplayName(troopTypeVO5);
                item9.Quantity             = rewardVO.DroidRewards;
                item9.RewardAssetName      = troopTypeVO5.AssetName;
                item9.RewardGeometryConfig = troopTypeVO5;
                item9.Type = RewardType.BuilderDroid;
                list.Add(item9);
            }
            dictionary = GameUtils.ListToMap(rewardVO.BuildingInstantRewards);
            foreach (string current5 in dictionary.Keys)
            {
                RewardComponentTag item10 = default(RewardComponentTag);
                RewardUtils.GetBuildingReward(current5, ref item10);
                item10.Quantity = Service.Get <Lang>().Get("TROOP_MULTIPLIER", new object[]
                {
                    dictionary[current5]
                });
                list.Add(item10);
            }
            if (rewardVO.BuildingInstantUpgrades != null)
            {
                int m    = 0;
                int num8 = rewardVO.BuildingInstantUpgrades.Length;
                while (m < num8)
                {
                    RewardComponentTag item11 = default(RewardComponentTag);
                    string[]           array  = RewardUtils.ParsePairedStrings(rewardVO.BuildingInstantUpgrades[m], ':');
                    RewardUtils.GetBuildingReward(array[0], ref item11);
                    item11.Quantity = Service.Get <Lang>().Get("LABEL_REWARD_UPGRADE", new object[0]);
                    list.Add(item11);
                    m++;
                }
            }
            if (rewardVO.HeroResearchInstantUpgrades != null)
            {
                int n    = 0;
                int num9 = rewardVO.HeroResearchInstantUpgrades.Length;
                while (n < num9)
                {
                    RewardComponentTag item12 = default(RewardComponentTag);
                    RewardUtils.GetInstantTroopReward(rewardVO.HeroResearchInstantUpgrades[n], ref item12);
                    list.Add(item12);
                    n++;
                }
            }
            if (rewardVO.TroopResearchInstantUpgrades != null)
            {
                int num10 = 0;
                int num11 = rewardVO.TroopResearchInstantUpgrades.Length;
                while (num10 < num11)
                {
                    RewardComponentTag item13 = default(RewardComponentTag);
                    RewardUtils.GetInstantTroopReward(rewardVO.TroopResearchInstantUpgrades[num10], ref item13);
                    list.Add(item13);
                    num10++;
                }
            }
            if (rewardVO.SpecAttackResearchInstantUpgrades != null)
            {
                int num12 = 0;
                int num13 = rewardVO.SpecAttackResearchInstantUpgrades.Length;
                while (num12 < num13)
                {
                    RewardComponentTag item14 = default(RewardComponentTag);
                    RewardUtils.GetInstantSpecialAttackReward(rewardVO.SpecAttackResearchInstantUpgrades[num12], ref item14);
                    list.Add(item14);
                    num12++;
                }
            }
            return(list);
        }