/// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            this._shipyard = string.Equals("Shipyard", this.GetName());

            if (!this._shipyard)
            {
                this._shipyard = string.Equals("Shipyard2", this.GetName());
            }

            this._rowBoat = string.Equals("Rowboat", this.GetName());

            if (!this._rowBoat)
            {
                this._rowBoat = string.Equals("Rowboat2", this.GetName());
            }

            this._clanGate = string.Equals("ClanGate", this.GetName());

            this._upgradeLevelCount = this._row.GetBiggestArraySize();
            this._buildTime         = new int[this._row.GetBiggestArraySize()];

            for (int i = 0; i < this._upgradeLevelCount; i++)
            {
                this._buildTime[i] = 86400 * this.GetIntegerValue("BuildTimeD", i) +
                                     3600 * this.GetIntegerValue("BuildTimeH", i) +
                                     60 * this.GetIntegerValue("BuildTimeM", i) +
                                     this.GetIntegerValue("BuildTimeS", i);
            }

            this._buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0));
        }
Esempio n. 2
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            this._inShop            = !this.GetBooleanValue("NotInShop", 0);
            this._buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildingResource", 0));
        }
Esempio n. 3
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();
            this._clearResourceData = LogicDataTables.GetResourceByName(this.GetValue("ClearResource", 0));

            if (this._clearResourceData == null)
            {
                Debugger.Error("Clear resource is not defined for obstacle: " + this.GetName());
            }

            this._clearCost     = this.GetIntegerValue("ClearCost", 0);
            this._clearTimeSecs = this.GetIntegerValue("ClearTimeSeconds", 0);
            this._respawnWeight = this.GetIntegerValue("RespawnWeight", 0);

            string lootResourceName = this.GetValue("LootResource", 0);

            if (lootResourceName.Length <= 0)
            {
                this._respawnWeight = 0;
            }
            else
            {
                this._lootResourceData = LogicDataTables.GetResourceByName(lootResourceName);
                this._lootCount        = this.GetIntegerValue("LootCount", 0);
            }

            this._lootMultiplierVersion2 = this.GetIntegerValue("LootMultiplierForVersion2", 0);

            if (this._lootMultiplierVersion2 == 0)
            {
                this._lootMultiplierVersion2 = 1;
            }
        }
Esempio n. 4
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            string warRefResource = this.GetValue("WarRefResource", 0);

            if (warRefResource.Length > 0)
            {
                this._warResourceReferenceData = LogicDataTables.GetResourceByName(warRefResource);
            }
        }
Esempio n. 5
0
        /// <summary>
        ///     Gets the resource production loot percentage.
        /// </summary>
        public int GetResourceProductionLootPercentage(LogicResourceData data)
        {
            if (LogicDataTables.GetDarkElixirData() == data)
            {
                return(this._darkElixirProductionLootPercentage);
            }

            return(this._resourceProductionLootPercentage);
        }
        /// <summary>
        ///     Gets the storage loot percentage.
        /// </summary>
        public int GetStorageLootPercentage(LogicResourceData data)
        {
            if (LogicDataTables.GetDarkElixirData() == data)
            {
                return(this.DarkElixirStorageLootPercentage);
            }

            return(this.ResourceStorageLootPercentage);
        }
Esempio n. 7
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            int size = this._upgradeLevelCount = this._row.GetBiggestArraySize();

            this._upgradeLevelByTownHall = new int[size];
            this._upgradeTime            = new int[size];
            this._upgradeCost            = new int[size];
            this._trainingTime           = new int[size];
            this._trainingCost           = new int[size];
            this._laboratoryLevel        = new int[size];

            this._upgradeResourceData = new LogicResourceData[size];

            for (int i = 0; i < size; i++)
            {
                this._upgradeLevelByTownHall[i] = this.GetClampedIntegerValue("UpgradeLevelByTH", i);
                this._upgradeTime[i]            = 3600 * this.GetClampedIntegerValue("UpgradeTimeH", i) + 60 * this.GetClampedIntegerValue("UpgradeTimeM", i);
                this._upgradeCost[i]            = this.GetClampedIntegerValue("UpgradeCost", i);
                this._trainingTime[i]           = this.GetClampedIntegerValue("TrainingTime", i);
                this._trainingCost[i]           = this.GetClampedIntegerValue("TrainingCost", i);
                this._laboratoryLevel[i]        = this.GetClampedIntegerValue("LaboratoryLevel", i) - 1;

                this._upgradeResourceData[i] = LogicDataTables.GetResourceByName(this.GetClampedValue("UpgradeResource", i));

                if (this._upgradeResourceData[i] == null && this.GetCombatItemType() != 2)
                {
                    Debugger.Error("UpgradeResource is not defined for " + this.GetName());
                }
            }

            if (this.GetName().Equals("Barbarian2"))
            {
                if (this._trainingTime[0] == 0)
                {
                    this._trainingTime[0] = 30;
                }
            }

            this._trainingResourceData = LogicDataTables.GetResourceByName(this.GetValue("TrainingResource", 0));
            this._housingSpace         = this.GetIntegerValue("HousingSpace", 0);
            this._productionEnabled    = !this.GetBooleanValue("DisableProduction", 0);
            this._enabledByCalendar    = this.GetBooleanValue("EnabledByCalendar", 0);
            this._unitType             = this.GetIntegerValue("UnitOfType", 0);
            this._donateCost           = this.GetIntegerValue("DonateCost", 0);

            if (this._trainingResourceData == null && this.GetCombatItemType() != 2)
            {
                Debugger.Error("TrainingResource is not defined for " + this.GetName());
            }
        }
        /// <summary>
        ///     Gets the cart loot cap.
        /// </summary>
        public int GetCartLootCap(LogicResourceData data)
        {
            if (data == null || data.PremiumCurrency)
            {
                return(0);
            }

            if (LogicDataTables.GetDarkElixirData() == data)
            {
                return(this.CartLootCapDarkElixir);
            }

            return(this.CartLootCapResource);
        }
        /// <summary>
        ///     Gets the storage loot cap.
        /// </summary>
        public int GetStorageLootCap(LogicResourceData data)
        {
            if (data == null || data.PremiumCurrency)
            {
                return(0);
            }

            if (LogicDataTables.GetDarkElixirData() == data)
            {
                return(this.DarkElixirStorageLootCap);
            }

            return(this.ResourceStorageLootCap);
        }
Esempio n. 10
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            this._upgradeLevelCount = this._row.GetBiggestArraySize();
            this._buildingClass     = LogicDataTables.GetBuildingClassByName(this.BuildingClass);

            if (this._buildingClass == null)
            {
                Debugger.Error("Building class is not defined for " + this.GetName());
            }

            int longestArraySize = this._row.GetBiggestArraySize();

            this._buildResourceData              = new LogicResourceData[longestArraySize];
            this._altBuildResourceData           = new LogicResourceData[longestArraySize];
            this._storedResourceCounts           = new LogicArrayList <int> [longestArraySize];
            this._percentageStoredResourceCounts = new LogicArrayList <int> [longestArraySize];
            this._townHallLevel         = new int[longestArraySize];
            this._townHallVillage2Level = new int[longestArraySize];
            this._constructionTimes     = new int[longestArraySize];
            this._gearUpTime            = new int[longestArraySize];
            this._gearUpCost            = new int[longestArraySize];
            this._boostCost             = new int[longestArraySize];

            for (int i = 0; i < longestArraySize; i++)
            {
                this._gearUpCost[i]                     = this.GetClampedIntegerValue("GearUpCost", i);
                this._gearUpTime[i]                     = this.GetClampedIntegerValue("GearUpTime", i);
                this._boostCost[i]                      = this.GetClampedIntegerValue("BoostCost", i);
                this._buildResourceData[i]              = LogicDataTables.GetResourceByName(this.GetClampedValue("BuildResource", i));
                this._altBuildResourceData[i]           = LogicDataTables.GetResourceByName(this.GetClampedValue("AltBuildResource", i));
                this._townHallLevel[i]                  = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this._townHallVillage2Level[i]          = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel2", i) - 1, 0);
                this._storedResourceCounts[i]           = new LogicArrayList <int>();
                this._percentageStoredResourceCounts[i] = new LogicArrayList <int>();

                LogicDataTable table = LogicDataTables.GetTable(2);

                for (int j = 0; j < table.GetItemCount(); j++)
                {
                    this._storedResourceCounts[i].Add(this.GetIntegerValue("MaxStored" + table.GetItemAt(j).GetName(), i));
                    this._percentageStoredResourceCounts[i].Add(this.GetIntegerValue("PercentageStored" + table.GetItemAt(j).GetName(), i));
                }

                this._constructionTimes[i] = 86400 * this.GetIntegerValue("BuildTimeD", i) +
                                             3600 * this.GetIntegerValue("BuildTimeH", i) +
                                             60 * this.GetIntegerValue("BuildTimeM", i) +
                                             this.GetIntegerValue("BuildTimeS", i);
            }

            this._produceResourceData = LogicDataTables.GetResourceByName(this.GetValue("ProducesResource", 0));
            this._gearUpResourceData  = LogicDataTables.GetResourceByName(this.GetClampedValue("GearUpResource", 0));

            string heroType = this.GetValue("HeroType", 0);

            if (!string.IsNullOrEmpty(heroType))
            {
                this._heroData = LogicDataTables.GetHeroByName(heroType);
            }

            string wallBlockX = this.GetValue("WallBlockX", 0);

            if (wallBlockX.Length > 0)
            {
                this.LoadWallBlock(wallBlockX, out this._wallBlockX);
                this.LoadWallBlock(this.GetValue("WallBlockY", 0), out this._wallBlockY);
            }

            this._isClockTower      = this.GetName().Equals("Clock Tower");
            this._isFlamer          = this.GetName().Equals("Flamer");
            this._isBarrackVillage2 = this.GetName().Equals("Barrack2");
        }
Esempio n. 11
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            for (int i = 0; i < this.GetArraySize("Dependencies"); i++)
            {
                LogicMissionData dependency = LogicDataTables.GetMissionByName(this.GetValue("Dependencies", i));

                if (dependency != null)
                {
                    this._missionDependencies.Add(dependency);
                }
            }

            this._action               = this.GetValue("Action", 0);
            this._deprecated           = this.GetBooleanValue("Deprecated", 0);
            this._missionCategory      = this.GetIntegerValue("MissionCategory", 0);
            this._fixVillageObjectData = LogicDataTables.GetVillageObjectByName(this.GetValue("FixVillageObject", 0));

            if (this._fixVillageObjectData != null)
            {
                this._buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0);
                this._missionType        = 13;
            }

            if (string.Equals(this._action, "travel"))
            {
                this._missionType = 14;
            }
            else if (string.Equals(this._action, "upgrade2"))
            {
                this._characterData = LogicDataTables.GetCharacterByName(this.GetValue("Character", 0));
                this._missionType   = 17;
            }
            else if (string.Equals(this._action, "duel"))
            {
                this._attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0));
                this._missionType   = 18;
            }
            else if (string.Equals(this._action, "duel_end"))
            {
                this._attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0));
                this._missionType   = 19;
            }
            else if (string.Equals(this._action, "duel_end2"))
            {
                this._missionType = 20;
            }
            else if (string.Equals(this._action, "show_builder_menu"))
            {
                this._missionType = 21;
            }

            this._buildBuildingData = LogicDataTables.GetBuildingByName(this.GetValue("BuildBuilding", 0));

            if (this._buildBuildingData != null)
            {
                this._buildBuildingCount = this.GetIntegerValue("BuildBuildingCount", 0);
                this._buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0) - 1;
                this._missionType        = string.Equals(this._action, "unlock") ? 15 : 5;

                if (this._buildBuildingCount < 0)
                {
                    Debugger.Error("missions.csv: BuildBuildingCount is invalid!");
                }
            }
            else
            {
                if (this._missionType == -1)
                {
                    this._openAchievements = this.GetBooleanValue("OpenAchievements", 0);

                    if (this._openAchievements)
                    {
                        this._missionType = 7;
                    }
                    else
                    {
                        this._defendNpcData = LogicDataTables.GetNpcByName(this.GetValue("DefendNPC", 0));

                        if (this._defendNpcData != null)
                        {
                            this._missionType = 1;
                        }
                        else
                        {
                            this._attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0));

                            if (this._attackNpcData != null)
                            {
                                this._missionType = 2;
                                this._showMap     = this.GetBooleanValue("ShowMap", 0);
                            }
                            else
                            {
                                this._changeName = this.GetBooleanValue("ChangeName", 0);

                                if (this._changeName)
                                {
                                    this._missionType = 6;
                                }
                                else
                                {
                                    this._trainTroopCount = this.GetIntegerValue("TrainTroops", 0);

                                    if (this._trainTroopCount > 0)
                                    {
                                        this._missionType = 4;
                                    }
                                    else
                                    {
                                        this._switchSides = this.GetBooleanValue("SwitchSides", 0);

                                        if (this._switchSides)
                                        {
                                            this._missionType = 8;
                                        }
                                        else
                                        {
                                            this._showWarBase = this.GetBooleanValue("ShowWarBase", 0);

                                            if (this._showWarBase)
                                            {
                                                this._missionType = 9;
                                            }
                                            else
                                            {
                                                this._openInfo = this.GetBooleanValue("OpenInfo", 0);

                                                if (this._openInfo)
                                                {
                                                    this._missionType = 11;
                                                }
                                                else
                                                {
                                                    this._showDonate = this.GetBooleanValue("ShowDonate", 0);

                                                    if (this._showDonate)
                                                    {
                                                        this._missionType = 10;
                                                    }
                                                    else
                                                    {
                                                        this._showStates = this.GetBooleanValue("WarStates", 0);

                                                        if (this._showStates)
                                                        {
                                                            this._missionType = 12;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            this._villagers = this.GetIntegerValue("Villagers", 0);

            if (this._villagers > 0)
            {
                this._missionType = 16;
            }

            this._forceCamera = this.GetBooleanValue("ForceCamera", 0);

            if (this._missionType == -1)
            {
                Debugger.Error(string.Format("missions.csv: invalid mission ({0})", this.GetName()));
            }

            this._rewardResourceData  = LogicDataTables.GetResourceByName(this.GetValue("RewardResource", 0));
            this._rewardResourceCount = this.GetIntegerValue("RewardResourceCount", 0);

            if (this._rewardResourceData != null)
            {
                if (this._rewardResourceCount != 0)
                {
                    if (this._rewardResourceCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardResourceCount is negative!");

                        this._rewardResourceData  = null;
                        this._rewardResourceCount = 0;
                    }
                }
                else
                {
                    this._rewardResourceData = null;
                }
            }
            else if (this._rewardResourceCount != 0)
            {
                Debugger.Warning("missions.csv: RewardResourceCount defined but RewardResource is not!");
                this._rewardResourceCount = 0;
            }

            this._customData = this.GetIntegerValue("CustomData", 0);
            this._rewardXp   = this.GetIntegerValue("RewardXP", 0);

            if (this._rewardXp < 0)
            {
                Debugger.Warning("missions.csv: RewardXP is negative!");
                this._rewardXp = 0;
            }

            this._rewardCharacterData  = LogicDataTables.GetCharacterByName(this.GetValue("RewardTroop", 0));
            this._rewardCharacterCount = this.GetIntegerValue("RewardTroopCount", 0);

            if (this._rewardCharacterData != null)
            {
                if (this._rewardCharacterCount != 0)
                {
                    if (this._rewardCharacterCount < 0)
                    {
                        Debugger.Error("missions.csv: RewardTroopCount is negative!");

                        this._rewardCharacterData  = null;
                        this._rewardCharacterCount = 0;
                    }
                }
                else
                {
                    this._rewardCharacterData = null;
                }
            }
            else if (this._rewardCharacterCount != 0)
            {
                Debugger.Warning("missions.csv: RewardTroopCount defined but RewardTroop is not!");
                this._rewardCharacterCount = 0;
            }

            this._delay        = this.GetIntegerValue("Delay", 0);
            this._villageType  = this.GetIntegerValue("VillageType", 0);
            this._firstStep    = this.GetBooleanValue("FirstStep", 0);
            this._tutorialText = this.GetValue("TutorialText", 0);

            if (this._tutorialText.Length > 0)
            {
                // BLABLABLA
            }
        }
Esempio n. 12
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            base.CreateVillageReferences();

            this._width  = this.GetIntegerValue("Width", 0);
            this._height = this.GetIntegerValue("Height", 0);

            this._upgradeLevelCount = this._row.GetBiggestArraySize();

            this._buildCost         = new int[this._upgradeLevelCount];
            this._rearmCost         = new int[this._upgradeLevelCount];
            this._townHallLevel     = new int[this._upgradeLevelCount];
            this._strenghtWeight    = new int[this._upgradeLevelCount];
            this._damage            = new int[this._upgradeLevelCount];
            this._damageRadius      = new int[this._upgradeLevelCount];
            this._ejectHousingLimit = new int[this._upgradeLevelCount];
            this._numSpawns         = new int[this._upgradeLevelCount];
            this._constructionTimes = new int[this._upgradeLevelCount];

            for (int i = 0; i < this._upgradeLevelCount; i++)
            {
                this._buildCost[i]         = this.GetClampedIntegerValue("BuildCost", i);
                this._rearmCost[i]         = this.GetClampedIntegerValue("RearmCost", i);
                this._townHallLevel[i]     = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this._strenghtWeight[i]    = this.GetClampedIntegerValue("StrengthWeight", i);
                this._damage[i]            = LogicMath.Min(this.GetClampedIntegerValue("Damage", i), 1000);
                this._damageRadius[i]      = (this.GetClampedIntegerValue("DamageRadius", i) << 9) / 100;
                this._ejectHousingLimit[i] = this.GetIntegerValue("EjectHousingLimit", i);
                this._numSpawns[i]         = this.GetClampedIntegerValue("NumSpawns", i);
                this._constructionTimes[i] = 86400 * this.GetIntegerValue("BuildTimeD", i) +
                                             3600 * this.GetIntegerValue("BuildTimeH", i) +
                                             60 * this.GetIntegerValue("BuildTimeM", i) +
                                             this.GetIntegerValue("BuildTimeS", i);
            }

            this._preferredTargetData      = LogicDataTables.GetCharacterByName(this.GetValue("PreferredTarget", 0));
            this._preferredTargetDamageMod = this.GetIntegerValue("PreferredTargetDamageMod", 0);

            if (this._preferredTargetDamageMod == 0)
            {
                this._preferredTargetDamageMod = 100;
            }

            this._buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0));

            if (this._buildResourceData == null)
            {
                Debugger.Error("build resource is not defined for trap: " + this.GetName());
            }

            this._ejectVictims               = this.GetBooleanValue("EjectVictims", 0);
            this._actionFrame                = 1000 * this.GetIntegerValue("ActionFrame", 0) / 24;
            this._pushback                   = this.GetIntegerValue("Pushback", 0);
            this._doNotScalePushByDamage     = this.GetBooleanValue("DoNotScalePushByDamage", 0);
            this._effectData                 = LogicDataTables.GetEffectByName(this.GetValue("Effect", 0));
            this._effect2Data                = LogicDataTables.GetEffectByName(this.GetValue("Effect2", 0));
            this._effectBrokenData           = LogicDataTables.GetEffectByName(this.GetValue("EffectBroken", 0));
            this._damageEffectData           = LogicDataTables.GetEffectByName(this.GetValue("DamageEffect", 0));
            this._pickUpEffectData           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0));
            this._placingEffectData          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0));
            this._appearEffectData           = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0));
            this._toggleAttackModeEffectData = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0));
            this._triggerRadius              = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this._directionCount             = this.GetIntegerValue("DirectionCount", 0);
            this._spell                  = LogicDataTables.GetSpellByName(this.GetValue("Spell", 0));
            this._airTrigger             = this.GetBooleanValue("AirTrigger", 0);
            this._groundTrigger          = this.GetBooleanValue("GroundTrigger", 0);
            this._healerTrigger          = this.GetBooleanValue("HealerTrigger", 0);
            this._speedMod               = this.GetIntegerValue("SpeedMod", 0);
            this._damageMod              = this.GetIntegerValue("DamageMod", 0);
            this._durationMS             = this.GetIntegerValue("DurationMS", 0);
            this._hitDelayMS             = this.GetIntegerValue("HitDelayMS", 0);
            this._hitCount               = this.GetIntegerValue("HitCnt", 0);
            this._minTriggerHousingLimit = this.GetIntegerValue("MinTriggerHousingLimit", 0);
            this._spawnedCharGroundData  = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharGround", 0));
            this._spawnedCharAirData     = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharAir", 0));
            this._timeBetweenSpawnsMS    = this.GetIntegerValue("TimeBetweenSpawnsMs", 0);
            this._spawnInitialDelayMS    = this.GetIntegerValue("SpawnInitialDelayMs", 0);
            this._throwDistance          = this.GetIntegerValue("ThrowDistance", 0);
            this._hasAltMode             = this.GetBooleanValue("HasAltMode", 0);
            this._enableByCalendar       = this.GetBooleanValue("EnabledByCalendar", 0);

            if (this._enableByCalendar)
            {
                if (this._upgradeLevelCount > 1)
                {
                    Debugger.Error("Temporary traps should not have upgrade levels!");
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        ///     Gets the resource diamond cost.
        /// </summary>
        public int GetResourceDiamondCost(int count, LogicResourceData data)
        {
            if (LogicDataTables.GetDarkElixirData() != data)
            {
                int resourceDiamondCost100;
                int resourceDiamondCost1000;
                int resourceDiamondCost10000;
                int resourceDiamondCost100000;
                int resourceDiamondCost1000000;
                int resourceDiamondCost10000000;

                if (data.GetVillageType() == 1)
                {
                    resourceDiamondCost100      = this._village2ResourceDiamondCost100;
                    resourceDiamondCost1000     = this._village2ResourceDiamondCost1000;
                    resourceDiamondCost10000    = this._village2ResourceDiamondCost10000;
                    resourceDiamondCost100000   = this._village2resourceDiamondCost100000;
                    resourceDiamondCost1000000  = this._village2resourceDiamondCost1000000;
                    resourceDiamondCost10000000 = this._village2ResourceDiamondCost10000000;
                }
                else
                {
                    resourceDiamondCost100      = this._resourceDiamondCost100;
                    resourceDiamondCost1000     = this._resourceDiamondCost1000;
                    resourceDiamondCost10000    = this._resourceDiamondCost10000;
                    resourceDiamondCost100000   = this._resourceDiamondCost100000;
                    resourceDiamondCost1000000  = this._resourceDiamondCost1000000;
                    resourceDiamondCost10000000 = this._resourceDiamondCost10000000;
                }

                if (count >= 1)
                {
                    if (count >= 100)
                    {
                        if (count >= 1000)
                        {
                            if (count >= 10000)
                            {
                                if (count >= 100000)
                                {
                                    if (count >= 1000000)
                                    {
                                        return(resourceDiamondCost1000000 + ((resourceDiamondCost10000000 - resourceDiamondCost1000000) * (count / 1000 - 1000) + 4500) / 9000);
                                    }

                                    return(resourceDiamondCost100000 + ((resourceDiamondCost1000000 - resourceDiamondCost100000) * (count / 100 - 1000) + 4500) / 9000);
                                }

                                return(resourceDiamondCost10000 + ((resourceDiamondCost100000 - resourceDiamondCost10000) * (count / 10 - 1000) + 4500) / 9000);
                            }

                            return(resourceDiamondCost1000 + ((resourceDiamondCost10000 - resourceDiamondCost1000) * (count - 1000) + 4500) / 9000);
                        }

                        return(resourceDiamondCost100 + ((resourceDiamondCost1000 - resourceDiamondCost100) * (count - 100) + 450) / 900);
                    }

                    return(resourceDiamondCost100);
                }

                return(0);
            }
            else
            {
                return(this.GetDarkElixirDiamondCost(count));
            }
        }
Esempio n. 14
0
        /// <summary>
        ///     Creates references.
        /// </summary>
        public void CreateReferences()
        {
            this._speedUpDiamondCostPerMin          = this.GetIntValue("SPEED_UP_DIAMOND_COST_1_MIN");
            this._speedUpDiamondCostPerHour         = this.GetIntValue("SPEED_UP_DIAMOND_COST_1_HOUR");
            this._speedUpDiamondCostPerDay          = this.GetIntValue("SPEED_UP_DIAMOND_COST_24_HOURS");
            this._speedUpDiamondCostPerWeek         = this.GetIntValue("SPEED_UP_DIAMOND_COST_1_WEEK");
            this._speedUpDiamondCostPerMinVillage2  = this.GetIntValue("VILLAGE2_SPEED_UP_DIAMOND_COST_1_MIN");
            this._speedUpDiamondCostPerHourVillage2 = this.GetIntValue("VILLAGE2_SPEED_UP_DIAMOND_COST_1_HOUR");
            this._speedUpDiamondCostPerDayVillage2  = this.GetIntValue("VILLAGE2_SPEED_UP_DIAMOND_COST_24_HOURS");
            this._speedUpDiamondCostPerWeekVillage2 = this.GetIntValue("VILLAGE2_SPEED_UP_DIAMOND_COST_1_WEEK");

            this._resourceDiamondCost100              = this.GetIntValue("RESOURCE_DIAMOND_COST_100");
            this._resourceDiamondCost1000             = this.GetIntValue("RESOURCE_DIAMOND_COST_1000");
            this._resourceDiamondCost10000            = this.GetIntValue("RESOURCE_DIAMOND_COST_10000");
            this._resourceDiamondCost100000           = this.GetIntValue("RESOURCE_DIAMOND_COST_100000");
            this._resourceDiamondCost1000000          = this.GetIntValue("RESOURCE_DIAMOND_COST_1000000");
            this._resourceDiamondCost10000000         = this.GetIntValue("RESOURCE_DIAMOND_COST_10000000");
            this._village2ResourceDiamondCost100      = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_100");
            this._village2ResourceDiamondCost1000     = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_1000");
            this._village2ResourceDiamondCost10000    = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_10000");
            this._village2resourceDiamondCost100000   = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_100000");
            this._village2resourceDiamondCost1000000  = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_1000000");
            this._village2ResourceDiamondCost10000000 = this.GetIntValue("VILLAGE2_RESOURCE_DIAMOND_COST_10000000");
            this._darkElixirDiamondCost1              = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_1");
            this._darkElixirDiamondCost10             = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_10");
            this._darkElixirDiamondCost100            = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_100");
            this._darkElixirDiamondCost1000           = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_1000");
            this._darkElixirDiamondCost10000          = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_10000");
            this._darkElixirDiamondCost100000         = this.GetIntValue("DARK_ELIXIR_DIAMOND_COST_100000");

            this._startingDiamonds                            = this.GetIntValue("STARTING_DIAMONDS");
            this._startingGold                                = this.GetIntValue("STARTING_GOLD");
            this._startingElixir                              = this.GetIntValue("STARTING_ELIXIR");
            this._startingGold2                               = this.GetIntValue("STARTING_GOLD2");
            this._startingElixir2                             = this.GetIntValue("STARTING_ELIXIR2");
            this._liveReplayFrequencySecs                     = this.GetIntValue("LIVE_REPLAY_UPDATE_FREQUENCY_SECONDS");
            this._challengeBaseSaveCooldown                   = this.GetIntValue("CHALLENGE_BASE_SAVE_COOLDOWN");
            this._allianceCreateCost                          = this.GetIntValue("ALLIANCE_CREATE_COST");
            this._clockTowerBoostCooldownSecs                 = 60 * this.GetIntValue("CLOCK_TOWER_BOOST_COOLDOWN_MINS");
            this._clampLongTimeStampsToDays                   = this.GetIntValue("CLAMP_LONG_TIME_STAMPS_TO_DAYS");
            this._workerCostSecondBuildCost                   = this.GetIntValue("WORKER_COST_2ND");
            this._workerCostThirdBuildCost                    = this.GetIntValue("WORKER_COST_3RD");
            this._workerCostFourthBuildCost                   = this.GetIntValue("WORKER_COST_4TH");
            this._workerCostFifthBuildCost                    = this.GetIntValue("WORKER_COST_5TH");
            this._challengeBaseCooldownEnabledOnTh            = this.GetIntValue("CHALLENGE_BASE_COOLDOWN_ENABLED_ON_TH");
            this._obstacleRespawnSecs                         = this.GetIntValue("OBSTACLE_RESPAWN_SECONDS");
            this._obstacleMaxCount                            = this.GetIntValue("OBSTACLE_COUNT_MAX");
            this._resourceProductionLootPercentage            = this.GetIntValue("RESOURCE_PRODUCTION_LOOT_PERCENTAGE");
            this._darkElixirProductionLootPercentage          = this.GetIntValue("RESOURCE_PRODUCTION_LOOT_PERCENTAGE_DARK_ELIXIR");
            this._village2MinTownHallLevelForDestructObstacle = this.GetIntValue("VILLAGE2_DO_NOT_ALLOW_CLEAR_OBSTACLE_TH");
            this._attackVillage2PreparationLengthSecs         = this.GetIntValue("ATTACK_PREPARATION_LENGTH_VILLAGE2_SEC");
            this._attackPreparationLengthSecs                 = this.GetIntValue("ATTACK_PREPARATION_LENGTH_SEC");
            this._attackLengthSecs                            = this.GetIntValue("ATTACK_LENGTH_SEC");
            this._village2StartUnitLevel                      = this.GetIntValue("VILLAGE2_START_UNIT_LEVEL");
            this._resourceProductionBoostSecs                 = 60 * this.GetIntValue("RESOURCE_PRODUCTION_BOOST_MINS");
            this._barracksBoostSecs                           = 60 * this.GetIntValue("BARRACKS_BOOST_MINS");
            this._spellFactoryBoostSecs                       = 60 * this.GetIntValue("SPELL_FACTORY_BOOST_MINS");
            this._troopTrainingSpeedUpCostTutorial            = this.GetIntValue("TROOP_TRAINING_SPEED_UP_COST_TUTORIAL");
            this._newTrainingBoostBarracksCost                = this.GetIntValue("NEW_TRAINING_BOOST_BARRACKS_COST");
            this._newTrainingBoostLaboratoryCost              = this.GetIntValue("NEW_TRAINING_BOOST_LABORATORY_COST");
            this._personalBreakLimitSeconds                   = this.GetIntValue("PERSONAL_BREAK_LIMIT_SECONDS");

            this._clockTowerBoostMultiplier          = this.GetIntValue("CLOCK_TOWER_BOOST_MULTIPLIER");
            this._resourceProductionBoostMultiplier  = this.GetIntValue("RESOURCE_PRODUCTION_BOOST_MULTIPLIER");
            this._spellTrainingCostMultiplier        = this.GetIntValue("SPELL_TRAINING_COST_MULTIPLIER");
            this._spellSpeedUpCostMultiplier         = this.GetIntValue("SPELL_SPEED_UP_COST_MULTIPLIER");
            this._heroHealthSpeedUpCostMultipler     = this.GetIntValue("HERO_HEALTH_SPEED_UP_COST_MULTIPLIER");
            this._troopRequestSpeedUpCostMultiplier  = this.GetIntValue("TROOP_REQUEST_SPEED_UP_COST_MULTIPLIER");
            this._troopTrainingCostMultiplier        = this.GetIntValue("TROOP_TRAINING_COST_MULTIPLIER");
            this._speedUpBoostCooldownCostMultiplier = this.GetIntValue("SPEEDUP_BOOST_COOLDOWN_COST_MULTIPLIER");
            this._clockTowerSpeedUpMultiplier        = this.GetIntValue("CHALLENGE_BASE_COOLDOWN_ENABLED_ON_TH");
            this._barracksBoostMultiplier            = this.GetIntValue("BARRACKS_BOOST_MULTIPLIER");
            this._barracksBoostNewMultiplier         = this.GetIntValue("BARRACKS_BOOST_MULTIPLIER_NEW");
            this._spellFactoryBoostNewMultiplier     = this.GetIntValue("SPELL_FACTORY_BOOST_MULTIPLIER_NEW");
            this._spellFactoryBoostMultiplier        = this.GetIntValue("SPELL_FACTORY_BOOST_MULTIPLIER");
            this._heroRestBoostMultiplier            = this.GetIntValue("HERO_REST_BOOST_MULTIPLIER");
            this._buildCancelMultiplier = this.GetIntValue("BUILD_CANCEL_MULTIPLIER");
            this._trainCancelMultiplier = this.GetIntValue("TRAIN_CANCEL_MULTIPLIER");
            this._spellCancelMultiplier = this.GetIntValue("SPELL_CANCEL_MULTIPLIER");

            this._useNewPathFinder             = this.GetBoolValue("USE_NEW_PATH_FINDER");
            this._useTroopWalksOutFromTraining = this.GetBoolValue("USE_TROOP_WALKS_OUT_FROM_TRAINING");
            this._useVillageObjects            = this.GetBoolValue("USE_VILLAGE_OBJECTS");
            this._moreAccurateTime             = this.GetBoolValue("MORE_ACCURATE_TIME");
            this._useNewTraining                        = this.GetBoolValue("USE_NEW_TRAINING");
            this._dragInTraining                        = this.GetBoolValue("DRAG_IN_TRAINING");
            this._dragInTrainingFix                     = this.GetBoolValue("DRAG_IN_TRAINING_FIX");
            this._dragInTrainingFix2                    = this.GetBoolValue("DRAG_IN_TRAINING_FIX2");
            this._revertBrokenWarLayouts                = this.GetBoolValue("REVERT_BROKEN_WAR_LAYOUTS");
            this._liveReplayEnabled                     = this.GetBoolValue("LIVE_REPLAY_ENABLED");
            this._removeRevengeWhenBattleIsLoaded       = this.GetBoolValue("REMOVE_REVENGE_WHEN_BATTLE_IS_LOADED");
            this._completeConstructionOnlyHome          = this.GetBoolValue("COMPLETE_CONSTRUCTIONS_ONLY_HOME");
            this._useNewSpeedUpCalculation              = this.GetBoolValue("USE_NEW_SPEEDUP_CALCULATION");
            this._clampBuildingTimes                    = this.GetBoolValue("CLAMP_BUILDING_TIMES");
            this._stopBoostPauseWhenBoostTimeZeroOnLoad = this.GetBoolValue("STOP_BOOST_PAUSE_WHEN_BOOST_TIME_ZERO_ON_LOAD");
            this._fixMergeOldBarrackBoostPausing        = this.GetBoolValue("FIX_MERGE_OLD_BARRACK_BOOST_PAUSING");
            this._saveVillageObjects                    = this.GetBoolValue("SAVE_VILLAGE_OBJECTS");
            this._workerForZeroBuildingTime             = this.GetBoolValue("WORKER_FOR_ZERO_BUILD_TIME");
            this._adjustEndSubtickUseCurrentTime        = this.GetBoolValue("ADJUST_END_SUBTICK_USE_CURRENT_TIME");
            this._collectAllResourcesAtOnce             = this.GetBoolValue("COLLECT_ALL_RESOURCES_AT_ONCE");
            this._useSwapBuildings                      = this.GetBoolValue("USE_SWAP_BUILDINGS");
            this._treasurySizeBasedOnTawnHall           = this.GetBoolValue("TREASURY_SIZE_BASED_ON_TH");
            this._startInLastUsedVillage                = this.GetBoolValue("START_IN_LAST_USED_VILLAGE");
            this._useTeslaTriggerCommand                = this.GetBoolValue("USE_TESLA_TRIGGER_CMD");
            this._useTrapTriggerCommand                 = this.GetBoolValue("USE_TRAP_TRIGGER_CMD");
            this._validateTroopUpgradeLevels            = this.GetBoolValue("VALIDATE_TROOP_UPGRADE_LEVELS");
            this._allowCancelBuildingConstruction       = this.GetBoolValue("ALLOW_CANCEL_BUILDING_CONSTRUCTION");
            this._village2TrainingOnlyUseRegularStorage = this.GetBoolValue("V2_TRAINING_ONLY_USE_REGULAR_STORAGE");
            this._enableTroopDeletion                   = this.GetBoolValue("ENABLE_TROOP_DELETION");

            this._allianceCreateResourceData = LogicDataTables.GetResourceByName(this.GetGlobalData("ALLIANCE_CREATE_RESOURCE").TextValue);

            LogicGlobalData village2TroopHousingBuildCostData = this.GetGlobalData("TROOP_HOUSING_V2_COST");

            this._village2TroopHousingBuildCost = new int[village2TroopHousingBuildCostData.GetNumberArraySize()];

            for (int i = 0; i < this._village2TroopHousingBuildCost.Length; i++)
            {
                this._village2TroopHousingBuildCost[i] = village2TroopHousingBuildCostData.GetNumberArray(i);
            }

            LogicGlobalData village2TroopHousingBuildTimeSecsData = this.GetGlobalData("TROOP_HOUSING_V2_BUILD_TIME_SECONDS");

            this._village2TroopHousingBuildTimeSecs = new int[village2TroopHousingBuildTimeSecsData.GetNumberArraySize()];

            for (int i = 0; i < this._village2TroopHousingBuildTimeSecs.Length; i++)
            {
                this._village2TroopHousingBuildTimeSecs[i] = village2TroopHousingBuildTimeSecsData.GetNumberArray(i);
            }

            LogicGlobalData lootMultiplierByTownHallDifferenceObject = this.GetGlobalData("LOOT_MULTIPLIER_BY_TH_DIFF");

            this._lootMultiplierByTownHallDifference = new int[lootMultiplierByTownHallDifferenceObject.GetNumberArraySize()];

            for (int i = 0; i < this._lootMultiplierByTownHallDifference.Length; i++)
            {
                this._lootMultiplierByTownHallDifference[i] = lootMultiplierByTownHallDifferenceObject.GetNumberArray(i);
            }

            LogicGlobalData barrackReduceTrainingDivisorObject = this.GetGlobalData("BARRACK_REDUCE_TRAINING_DIVISOR");

            this._barrackReduceTrainingDivisor = new int[barrackReduceTrainingDivisorObject.GetNumberArraySize()];

            for (int i = 0; i < this._barrackReduceTrainingDivisor.Length; i++)
            {
                this._barrackReduceTrainingDivisor[i] = barrackReduceTrainingDivisorObject.GetNumberArray(i);
            }

            LogicGlobalData darkBarrackReduceTrainingDivisorObject = this.GetGlobalData("DARK_BARRACK_REDUCE_TRAINING_DIVISOR");

            this._darkBarrackReduceTrainingDivisor = new int[darkBarrackReduceTrainingDivisorObject.GetNumberArraySize()];

            for (int i = 0; i < this._darkBarrackReduceTrainingDivisor.Length; i++)
            {
                this._darkBarrackReduceTrainingDivisor[i] = darkBarrackReduceTrainingDivisorObject.GetNumberArray(i);
            }

            LogicGlobalData clockTowerBoostObject = this.GetGlobalData("CLOCK_TOWER_BOOST_MINS");

            this._clockTowerBoostSecs = new int[clockTowerBoostObject.GetNumberArraySize()];

            for (int i = 0; i < this._clockTowerBoostSecs.Length; i++)
            {
                this._clockTowerBoostSecs[i] = clockTowerBoostObject.GetNumberArray(i);
            }
        }
Esempio n. 15
0
        /// <summary>
        ///     Called when all instances has been loaded for initialized members in instance.
        /// </summary>
        public override void CreateReferences()
        {
            this._villageType   = this.GetIntegerValue("UIGroup", 0);
            this._diamondReward = this.GetIntegerValue("DiamondReward", 0);
            this._expReward     = this.GetIntegerValue("ExpReward", 0);
            this._actionCount   = this.GetIntegerValue("ActionCount", 0);
            this._level         = this.GetIntegerValue("Level", 0);
            this._levelCount    = this.GetIntegerValue("LevelCount", 0);

            this._completedTID = this.GetValue("CompetedTID", 0);
            this._showValue    = this.GetBooleanValue("ShowValue", 0);
            this._androidId    = this.GetValue("AndroidID", 0);

            if (this._actionCount == 0)
            {
                Debugger.Error("Achievement has invalid ActionCount 0");
            }

            string action = this.GetValue("Action", 0);

            switch (action)
            {
            case "npc_stars":
                this._actionType = 0;
                break;

            case "upgrade":
                this._actionType   = 1;
                this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0));

                if (this._buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for upgrade achievement");
                }

                break;

            case "victory_points":
                this._actionType = 2;
                break;

            case "unit_unlock":
                this._actionType    = 3;
                this._characterData = LogicDataTables.GetCharacterByName(this.GetValue("ActionData", 0));

                if (this._characterData == null)
                {
                    Debugger.Error("LogicCharacterData - Character data is NULL for unit_unlock achievement");
                }

                break;

            case "clear_obstacles":
                this._actionType = 4;
                break;

            case "donate_units":
                this._actionType = 5;
                break;

            case "loot":
                this._actionType   = 6;
                this._resourceData = LogicDataTables.GetResourceByName(this.GetValue("ActionData", 0));

                if (this._resourceData == null)
                {
                    Debugger.Error("LogicAchievementData - Resource data is NULL for loot achievement");
                }

                break;

            case "destroy":
                this._actionType   = 9;
                this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0));

                if (this._buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for destroy achievement");
                }

                break;

            case "win_pvp_attack":
                this._actionType = 10;
                break;

            case "win_pvp_defense":
                this._actionType = 11;
                break;

            case "league":
                this._actionType = 12;
                break;

            case "war_stars":
                this._actionType = 13;
                break;

            case "war_loot":
                this._actionType = 14;
                break;

            case "donate_spells":
                this._actionType = 15;
                break;

            case "account_bound":
                this._actionType = 16;
                break;

            case "vs_battle_trophies":
                this._actionType = 17;
                break;

            case "gear_up":
                this._actionType = 18;
                break;

            case "repair_building":
                this._actionType   = 19;
                this._buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0));

                if (this._buildingData == null)
                {
                    Debugger.Error("LogicAchievementData - Building data is NULL for repair_building achievement");
                }

                break;

            default:
                Debugger.Error(string.Format("Unknown Action in achievements {0}", action));
                break;
            }

            this._achievementLevel = new LogicArrayList <LogicAchievementData>();

            String         achievementName = this.GetName().Substring(0, this.GetName().Length - 1);
            LogicDataTable table           = LogicDataTables.GetTable(22);

            for (int i = 0; i < table.GetItemCount(); i++)
            {
                LogicAchievementData achievementData = (LogicAchievementData)table.GetItemAt(i);

                if (achievementData.GetName().Contains(achievementName))
                {
                    if (achievementData.GetName().Substring(0, achievementData.GetName().Length - 1).Equals(achievementName))
                    {
                        this._achievementLevel.Add(achievementData);
                    }
                }
            }

            Debugger.DoAssert(this._achievementLevel.Count == this._levelCount, string.Format("Expected same amount of achievements named {0}X to be same as LevelCount={1} for {2}.",
                                                                                              achievementName,
                                                                                              this._levelCount,
                                                                                              this.GetName()));
        }
Esempio n. 16
0
        /// <summary>
        ///     Initializes this instance.
        /// </summary>
        public static void Initialize()
        {
            LogicDataTables._dataTables = new LogicDataTable[44];

            LogicDataTables.Load("logic/buildings.csv", 0);
            LogicDataTables.Load("logic/locales.csv", 1);
            LogicDataTables.Load("logic/resources.csv", 2);
            LogicDataTables.Load("logic/characters.csv", 3);
            // LogicDataTables.Load("csv/animations.csv", 4);
            LogicDataTables.Load("logic/projectiles.csv", 5);
            LogicDataTables.Load("logic/building_classes.csv", 6);
            LogicDataTables.Load("logic/obstacles.csv", 7);
            LogicDataTables.Load("logic/effects.csv", 8);
            LogicDataTables.Load("csv/particle_emitters.csv", 9);
            LogicDataTables.Load("logic/experience_levels.csv", 10);
            LogicDataTables.Load("logic/traps.csv", 11);
            LogicDataTables.Load("logic/alliance_badges.csv", 12);
            LogicDataTables.Load("logic/globals.csv", 13);
            LogicDataTables.Load("logic/townhall_levels.csv", 14);
            LogicDataTables.Load("logic/alliance_portal.csv", 15);
            LogicDataTables.Load("logic/npcs.csv", 16);
            LogicDataTables.Load("logic/decos.csv", 17);
            LogicDataTables.Load("csv/resource_packs.csv", 18);
            LogicDataTables.Load("logic/shields.csv", 19);
            LogicDataTables.Load("logic/missions.csv", 20);
            LogicDataTables.Load("csv/billing_packages.csv", 21);
            LogicDataTables.Load("logic/achievements.csv", 22);
            // LogicDataTables.Load("csv/credits.csv", 23);
            // LogicDataTables.Load("csv/faq.csv", 24);
            LogicDataTables.Load("logic/spells.csv", 25);
            LogicDataTables.Load("csv/hints.csv", 26);
            LogicDataTables.Load("logic/heroes.csv", 27);
            LogicDataTables.Load("logic/leagues.csv", 28);
            LogicDataTables.Load("csv/news.csv", 29);
            LogicDataTables.Load("logic/war.csv", 30);
            LogicDataTables.Load("logic/regions.csv", 31);
            LogicDataTables.Load("csv/client_globals.csv", 32);
            LogicDataTables.Load("logic/alliance_badge_layers.csv", 33);
            LogicDataTables.Load("logic/alliance_levels.csv", 34);
            // LogicDataTables.Load("csv/helpshift.csv", 35);
            LogicDataTables.Load("logic/variables.csv", 36);
            LogicDataTables.Load("logic/gem_bundles.csv", 37);
            LogicDataTables.Load("logic/village_objects.csv", 38);
            LogicDataTables.Load("logic/calendar_event_functions.csv", 39);
            LogicDataTables.Load("csv/boombox.csv", 40);
            LogicDataTables.Load("csv/event_entries.csv", 41);
            LogicDataTables.Load("csv/deeplinks.csv", 42);
            LogicDataTables.Load("logic/leagues2.csv", 43);

            LogicDataTables._globals       = new LogicGlobals();
            LogicDataTables._clientGlobals = new LogicClientGlobals();

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

            LogicDataTable buildingDataTable = LogicDataTables._dataTables[0];

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

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

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

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

            LogicDataTables._bowData                = LogicDataTables.GetBuildingByName("Bow");
            LogicDataTables._darkTowerData          = LogicDataTables.GetBuildingByName("Dark Tower");
            LogicDataTables._ancientArtilleryData   = LogicDataTables.GetBuildingByName("Ancient Artillery");
            LogicDataTables._workerData             = LogicDataTables.GetBuildingByName("Worker Building");
            LogicDataTables._laboratoryVillage2Data = LogicDataTables.GetBuildingByName("Laboratory2");
            LogicDataTables._diamondsData           = LogicDataTables.GetResourceByName("Diamonds");
            LogicDataTables._goldData               = LogicDataTables.GetResourceByName("Gold");
            LogicDataTables._elixirData             = LogicDataTables.GetResourceByName("Elixir");
            LogicDataTables._darkElixirData         = LogicDataTables.GetResourceByName("DarkElixir");
            LogicDataTables._gold2Data              = LogicDataTables.GetResourceByName("Gold2");
            LogicDataTables._elixir2Data            = LogicDataTables.GetResourceByName("Elixir2");
            LogicDataTables._warGoldData            = LogicDataTables.GetResourceByName("WarGold");
            LogicDataTables._warElixirData          = LogicDataTables.GetResourceByName("WarElixir");
            LogicDataTables._warDarkElixirData      = LogicDataTables.GetResourceByName("WarDarkElixir");
            LogicDataTables._skeletonData           = LogicDataTables.GetCharacterByName("Skeleton");
            LogicDataTables._ballonSkeletonData     = LogicDataTables.GetCharacterByName("Balloon Skeleton");

            LogicDataTables._globals.CreateReferences();
            LogicDataTables._clientGlobals.CreateReferences();
        }
Esempio n. 17
0
        /// <summary>
        ///     Creates a new data item.
        /// </summary>
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this._tableIndex)
            {
            case 0:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case 1:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case 2:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case 3:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case 5:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case 6:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case 7:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case 8:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case 9:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case 10:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case 11:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case 12:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case 13:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 14:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case 15:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case 16:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case 17:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case 18:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case 19:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case 20:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case 21:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case 22:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case 23:
            {
                data = new LogicFaqData(row, this);
                break;
            }

            case 25:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case 26:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case 27:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case 28:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case 29:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case 30:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case 31:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case 32:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case 33:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case 34:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case 36:
            {
                data = new LogicVariableData(row, this);
                break;
            }

            case 37:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case 38:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case 39:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case 40:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case 41:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case 42:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case 43:
            {
                data = new LogicLeague2Data(row, this);
                break;
            }

            default:
            {
                Debugger.Error("Invalid data table id: " + this._tableIndex);
                break;
            }
            }

            return(data);
        }