public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_enabled                       = this.GetBooleanValue("Disabled", 0) ^ true;
            this.m_existsApple                   = this.GetBooleanValue("ExistsApple", 0);
            this.m_existsAndroid                 = this.GetBooleanValue("ExistsAndroid", 0);
            this.m_existsKunlun                  = this.GetBooleanValue("ExistsKunlun", 0);
            this.m_existsBazaar                  = this.GetBooleanValue("ExistsBazaar", 0);
            this.m_existsTencent                 = this.GetBooleanValue("ExistsTencent", 0);
            this.m_shopItemExportName            = this.GetValue("ShopItemExportName", 0);
            this.m_shopItemInfoExportName        = this.GetValue("ShopItemInfoExportName", 0);
            this.m_shopItemBG                    = this.GetValue("ShopItemBG", 0);
            this.m_redPackage                    = this.GetBooleanValue("RED", 0);
            this.m_offeredByCalendar             = this.GetBooleanValue("OfferedByCalendar", 0);
            this.m_townHallLimitMin              = this.GetIntegerValue("TownhallLimitMin", 0);
            this.m_townHallLimitMax              = this.GetIntegerValue("TownhallLimitMax", 0);
            this.m_resourceAmountFromTownHallCSV = this.GetBooleanValue("ResourceAmountFromThCSV", 0);

            int arraySize = this.GetArraySize("Resources");

            this.m_resourceData  = new LogicArrayList <LogicResourceData>(arraySize);
            this.m_resourceCount = new LogicArrayList <int>(arraySize);

            for (int i = 0; i < arraySize; i++)
            {
                string resourceText = this.GetValue("Resources", i);

                if (resourceText.Length > 0)
                {
                    LogicResourceData data = LogicDataTables.GetResourceByName(resourceText, this);

                    if (data != null)
                    {
                        if (data.GetWarResourceReferenceData() != null)
                        {
                            Debugger.Error("Can't give WarResource as Resource in GemBundleData");
                        }

                        if (data.IsPremiumCurrency())
                        {
                            Debugger.Error("Can't give PremiumCurrency as Resource in GemBundleData");
                        }

                        this.m_resourceCount.Add(this.GetIntegerValue("ResourceAmounts", i));
                    }
                }
            }

            arraySize = this.GetArraySize("Buildings");

            this.m_buildingData   = new LogicArrayList <LogicData>(arraySize);
            this.m_buildingNumber = new LogicArrayList <int>(arraySize);
            this.m_buildingLevel  = new LogicArrayList <int>(arraySize);
            this.m_gemCost        = new LogicArrayList <int>(arraySize);

            for (int i = 0; i < arraySize; i++)
            {
                this.m_buildingNumber.Add(this.GetIntegerValue("BuildingNumber", i));
                this.m_buildingLevel.Add(this.GetIntegerValue("BuildingLevel", i));
                this.m_gemCost.Add(this.GetIntegerValue("GemCost", i));

                string buildingName = this.GetValue("Buildings", i);

                if (buildingName.Length > 0)
                {
                    LogicData data = null;

                    switch (this.GetValue("BuildingType", i))
                    {
                    case "building":
                        data = LogicDataTables.GetBuildingByName(buildingName, this);
                        break;

                    case "deco":
                        data = LogicDataTables.GetDecoByName(buildingName, this);
                        break;
                    }

                    if (data != null)
                    {
                        this.m_buildingData.Add(data);
                    }
                }
            }

            arraySize = this.GetArraySize("UnlocksTroop");

            this.m_unlockTroopData = new LogicArrayList <LogicCombatItemData>(arraySize);

            for (int i = 0; i < arraySize; i++)
            {
                string unlockTroopName = this.GetValue("UnlocksTroop", i);

                if (unlockTroopName.Length > 0)
                {
                    LogicCombatItemData data = null;

                    switch (this.GetValue("TroopType", i))
                    {
                    case "troop":
                        data = LogicDataTables.GetCharacterByName(unlockTroopName, this);
                        break;

                    case "spell":
                        data = LogicDataTables.GetSpellByName(unlockTroopName, this);
                        break;
                    }

                    if (data != null)
                    {
                        this.m_unlockTroopData.Add(data);
                    }
                }
            }

            this.m_billingPackageData = LogicDataTables.GetBillingPackageByName(this.GetValue("BillingPackage", 0), this);

            if (this.m_billingPackageData == null)
            {
                Debugger.Error("No billing package set!");
            }

            this.m_priority                              = this.GetIntegerValue("Priority", 0);
            this.m_frontPageItem                         = this.GetBooleanValue("FrontPageItem", 0);
            this.m_treasureItem                          = this.GetBooleanValue("TreasureItem", 0);
            this.m_valueForUI                            = this.GetIntegerValue("ValueForUI", 0);
            this.m_valueTID                              = this.GetValue("ValueTID", 0);
            this.m_timesCanBePurchased                   = this.GetIntegerValue("TimesCanBePurchased", 0);
            this.m_availableTimeMinutes                  = this.GetIntegerValue("AvailableTimeMinutes", 0);
            this.m_cooldownAfterPurchaseMinutes          = this.GetIntegerValue("CooldownAfterPurchaseMinutes", 0);
            this.m_shopFrontPageCooldownAfterPurchaseMin = this.GetIntegerValue("ShopFrontPageCooldownAfterPurchaseMin", 0);
            this.m_hideTimer                             = this.GetBooleanValue("HideTimer", 0);
            this.m_linkedPackageId                       = this.GetIntegerValue("LinkedPackageID", 0);
            this.m_alternativePackage                    = this.GetName().EndsWith("_ALT");
            this.m_giftGems                              = this.GetIntegerValue("GiftGems", 0);
            this.m_giftUsers                             = this.GetIntegerValue("GiftUsers", 0);

            string replacesBillingPackageName = this.GetValue("ReplacesBillingPackage", 0);

            if (replacesBillingPackageName.Length > 0)
            {
                this.m_replaceBillingPackageData = LogicDataTables.GetBillingPackageByName(replacesBillingPackageName, this);
            }

            if (this.m_giftGems > 0 != this.m_giftUsers > 0)
            {
                Debugger.Error("Gift values should both be ZERO or both be NON-ZERO");
            }

            if (!this.m_frontPageItem && this.m_shopFrontPageCooldownAfterPurchaseMin > 0)
            {
                Debugger.Error("FrontPageItem = FALSE => ShopFrontPageCooldownAfterPurchaseMin must be set 0");
            }

            this.m_villageType = this.GetIntegerValue("VillageType", 0);

            if (this.m_villageType != -1)
            {
                if ((uint)this.m_villageType > 1)
                {
                    Debugger.Error("invalid VillageType");
                }
            }

            if (this.m_enabled && this.m_availableTimeMinutes > 0)
            {
                Debugger.Warning("We should no longer use timed offers. Use chronos instead.");
            }

            if (this.m_offeredByCalendar)
            {
                Debugger.Warning("We no longer support enabling/disabling gem bundles thru chronos. Use chronos offers instead.");
                this.m_offeredByCalendar = false;
            }

            this.m_townHallResourceMultiplier = this.GetIntegerValue("THResourceMultiplier", 0);

            if (this.m_townHallResourceMultiplier <= 0)
            {
                this.m_townHallResourceMultiplier = 100;
            }

            this.m_deliverableBundle = this.CreateBundle();
        }
示例#2
0
        public static void CreateReferences()
        {
            LogicDataTables.m_tables[(int)LogicDataType.PARTICLE_EMITTER].CreateReferences();

            for (int i = 0; i < LogicDataTables.m_tables.Length; i++)
            {
                if ((LogicDataType)i != LogicDataType.PARTICLE_EMITTER)
                {
                    if (LogicDataTables.m_tables[i] != null)
                    {
                        LogicDataTables.m_tables[i].CreateReferences();
                    }
                }
            }

            for (int i = 0; i < LogicDataTables.m_tables.Length; i++)
            {
                if (LogicDataTables.m_tables[i] != null)
                {
                    LogicDataTables.m_tables[i].CreateReferences2();
                }
            }

            // LogicDataTables.m_animationTable.CreateReferences();

            LogicDataTable buildingDataTable = LogicDataTables.m_tables[(int)LogicDataType.BUILDING];

            for (int i = 0; i < buildingDataTable.GetItemCount(); i++)
            {
                LogicBuildingData buildingData = (LogicBuildingData)buildingDataTable.GetItemAt(i);

                if (buildingData.IsAllianceCastle())
                {
                    LogicDataTables.m_allianceCastleData = buildingData;
                }

                if (buildingData.IsTownHall() && LogicDataTables.m_townHallData == null)
                {
                    LogicDataTables.m_townHallData = buildingData;
                }

                if (buildingData.IsTownHallVillage2() && LogicDataTables.m_townHallVillage2Data == null)
                {
                    LogicDataTables.m_townHallVillage2Data = buildingData;
                }
            }

            LogicDataTables.m_bowData                = LogicDataTables.GetBuildingByName("Bow", null);
            LogicDataTables.m_darkTowerData          = LogicDataTables.GetBuildingByName("Dark Tower", null);
            LogicDataTables.m_ancientArtilleryData   = LogicDataTables.GetBuildingByName("Ancient Artillery", null);
            LogicDataTables.m_workerData             = LogicDataTables.GetBuildingByName("Worker Building", null);
            LogicDataTables.m_laboratoryVillage2Data = LogicDataTables.GetBuildingByName("Laboratory2", null);
            LogicDataTables.m_diamondsData           = LogicDataTables.GetResourceByName("Diamonds", null);
            LogicDataTables.m_goldData               = LogicDataTables.GetResourceByName("Gold", null);
            LogicDataTables.m_elixirData             = LogicDataTables.GetResourceByName("Elixir", null);
            LogicDataTables.m_darkElixirData         = LogicDataTables.GetResourceByName("DarkElixir", null);
            LogicDataTables.m_gold2Data              = LogicDataTables.GetResourceByName("Gold2", null);
            LogicDataTables.m_elixir2Data            = LogicDataTables.GetResourceByName("Elixir2", null);
            LogicDataTables.m_warGoldData            = LogicDataTables.GetResourceByName("WarGold", null);
            LogicDataTables.m_warElixirData          = LogicDataTables.GetResourceByName("WarElixir", null);
            LogicDataTables.m_warDarkElixirData      = LogicDataTables.GetResourceByName("WarDarkElixir", null);
            LogicDataTables.m_skeletonData           = LogicDataTables.GetCharacterByName("Skeleton", null);
            LogicDataTables.m_balloonSkeletonData    = LogicDataTables.GetCharacterByName("Balloon Skeleton", null);
        }