Esempio n. 1
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_stealEffect   = LogicDataTables.GetEffectByName(this.GetValue("StealEffect", 0), this);
            this.m_collectEffect = LogicDataTables.GetEffectByName(this.GetValue("CollectEffect", 0), this);

            this.m_resourceIconExportName = this.GetValue("ResourceIconExportName", 0);
            this.m_stealLimitMid          = this.GetIntegerValue("StealLimitMid", 0);
            this.m_stealEffectMid         = LogicDataTables.GetEffectByName(this.GetValue("StealEffectMid", 0), this);
            this.m_stealLimitBig          = this.GetIntegerValue("StealLimitBig", 0);
            this.m_stealEffectBig         = LogicDataTables.GetEffectByName(this.GetValue("StealEffectBig", 0), this);
            this.m_premiumCurrency        = this.GetBooleanValue("PremiumCurrency", 0);
            this.m_hudInstanceName        = this.GetValue("HudInstanceName", 0);
            this.m_capFullTID             = this.GetValue("CapFullTID", 0);
            this.m_textRed              = this.GetIntegerValue("TextRed", 0);
            this.m_textGreen            = this.GetIntegerValue("TextGreen", 0);
            this.m_textBlue             = this.GetIntegerValue("TextBlue", 0);
            this.m_bundleIconExportName = this.GetValue("BundleIconExportName", 0);
            this.m_villageType          = this.GetIntegerValue("VillageType", 0);

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

            string warRefResource = this.GetValue("WarRefResource", 0);

            if (warRefResource.Length > 0)
            {
                this.m_warResourceReferenceData = LogicDataTables.GetResourceByName(warRefResource, this);
            }
        }
Esempio n. 2
0
        public static void DeInit()
        {
            if (LogicDataTables.m_tables != null)
            {
                for (int i = 0; i < LogicDataTables.m_tables.Length; i++)
                {
                    if (LogicDataTables.m_tables[i] != null)
                    {
                        LogicDataTables.m_tables[i].Destruct();
                        LogicDataTables.m_tables[i] = null;
                    }
                }

                LogicDataTables.m_skeletonData        = null;
                LogicDataTables.m_balloonSkeletonData = null;

                LogicDataTables.m_diamondsData         = null;
                LogicDataTables.m_goldData             = null;
                LogicDataTables.m_elixirData           = null;
                LogicDataTables.m_darkElixirData       = null;
                LogicDataTables.m_gold2Data            = null;
                LogicDataTables.m_elixir2Data          = null;
                LogicDataTables.m_warGoldData          = null;
                LogicDataTables.m_warElixirData        = null;
                LogicDataTables.m_warDarkElixirData    = null;
                LogicDataTables.m_townHallData         = null;
                LogicDataTables.m_townHallVillage2Data = null;
                LogicDataTables.m_allianceCastleData   = null;
                LogicDataTables.m_bowData                = null;
                LogicDataTables.m_darkTowerData          = null;
                LogicDataTables.m_ancientArtilleryData   = null;
                LogicDataTables.m_workerData             = null;
                LogicDataTables.m_laboratoryVillage2Data = null;
            }
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_resourceData       = LogicDataTables.GetResourceByName(this.GetValue("Resource", 0), this);
            this.m_capacityPercentage = this.GetIntegerValue("CapacityPercentage", 0);
        }
        public int GetStorageLootPercentage(LogicResourceData data)
        {
            if (LogicDataTables.GetDarkElixirData() == data)
            {
                return(this.m_darkElixirStorageLootPercentage);
            }

            return(this.m_resourceStorageLootPercentage);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_disabled           = this.GetBooleanValue("Disabled", 0);
            this.m_tileX100           = this.GetIntegerValue("TileX100", 0);
            this.m_tileY100           = this.GetIntegerValue("TileY100", 0);
            this.m_requiredTH         = this.GetIntegerValue("RequiredTH", 0);
            this.m_automaticUpgrades  = this.GetBooleanValue("AutomaticUpgrades", 0);
            this.m_requiresBuilder    = this.GetBooleanValue("RequiresBuilder", 0);
            this.m_pickUpEffect       = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_animX              = this.GetIntegerValue("AnimX", 0);
            this.m_animY              = this.GetIntegerValue("AnimY", 0);
            this.m_animID             = this.GetIntegerValue("AnimID", 0);
            this.m_animDir            = this.GetIntegerValue("AnimDir", 0);
            this.m_animVisibilityOdds = this.GetIntegerValue("AnimVisibilityOdds", 0);
            this.m_hasInfoScreen      = this.GetBooleanValue("HasInfoScreen", 0);
            this.m_unitHousing        = this.GetIntegerValue("UnitHousing", 0);
            this.m_housesUnits        = this.GetBooleanValue("HousesUnits", 0);
            this.m_allianceBuilding   = this.GetBooleanValue("AllianceBuilding", 0);


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

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

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

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

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

            this.m_upgradeLevelCount     = this.m_row.GetBiggestArraySize();
            this.m_buildCost             = new int[this.m_row.GetBiggestArraySize()];
            this.m_buildTime             = new int[this.m_row.GetBiggestArraySize()];
            this.m_requiredTownHallLevel = new int[this.m_row.GetBiggestArraySize()];

            for (int i = 0; i < this.m_upgradeLevelCount; i++)
            {
                this.m_requiredTownHallLevel[i] = this.GetClampedIntegerValue("RequiredTownHall", i);
                this.m_buildCost[i]             = this.GetClampedIntegerValue("BuildCost", i);
                this.m_buildTime[i]             = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                                  3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                                  60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                                  this.GetClampedIntegerValue("BuildTimeS", i);
            }

            this.m_buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0), this);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            int size = this.m_upgradeLevelCount = this.m_row.GetBiggestArraySize();

            this.m_upgradeLevelByTownHall = new int[size];
            this.m_upgradeTime            = new int[size];
            this.m_upgradeCost            = new int[size];
            this.m_trainingTime           = new int[size];
            this.m_trainingCost           = new int[size];
            this.m_laboratoryLevel        = new int[size];

            this.m_upgradeResourceData = new LogicResourceData[size];

            for (int i = 0; i < size; i++)
            {
                this.m_upgradeLevelByTownHall[i] = this.GetClampedIntegerValue("UpgradeLevelByTH", i);
                this.m_upgradeTime[i]            = 3600 * this.GetClampedIntegerValue("UpgradeTimeH", i) + 60 * this.GetClampedIntegerValue("UpgradeTimeM", i);
                this.m_upgradeCost[i]            = this.GetClampedIntegerValue("UpgradeCost", i);
                this.m_trainingTime[i]           = this.GetClampedIntegerValue("TrainingTime", i);
                this.m_trainingCost[i]           = this.GetClampedIntegerValue("TrainingCost", i);
                this.m_laboratoryLevel[i]        = this.GetClampedIntegerValue("LaboratoryLevel", i) - 1;

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

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

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

            this.m_trainingResourceData = LogicDataTables.GetResourceByName(this.GetValue("TrainingResource", 0), this);
            this.m_housingSpace         = this.GetIntegerValue("HousingSpace", 0);
            this.m_productionEnabled    = !this.GetBooleanValue("DisableProduction", 0);
            this.m_enableByCalendar     = this.GetBooleanValue("EnabledByCalendar", 0);
            this.m_unitType             = this.GetIntegerValue("UnitOfType", 0);
            this.m_donateCost           = this.GetIntegerValue("DonateCost", 0);

            if (this.m_trainingResourceData == null && this.GetCombatItemType() != LogicCombatItemData.COMBAT_ITEM_TYPE_HERO)
            {
                Debugger.Error("TrainingResource is not defined for " + this.GetName());
            }
        }
        public int GetCartLootReengagement(LogicResourceData data)
        {
            if (data != null && !data.IsPremiumCurrency() && data.GetWarResourceReferenceData() == null && data.GetVillageType() != 1)
            {
                if (LogicDataTables.GetDarkElixirData() == data)
                {
                    return(this.m_cartLootReengagementDarkElixir);
                }

                return(this.m_cartLootReengagementResource);
            }

            return(0);
        }
        public int GetCartLootCap(LogicResourceData data)
        {
            if (data != null && !data.IsPremiumCurrency())
            {
                if (LogicDataTables.GetDarkElixirData() == data)
                {
                    return(this.m_cartLootCapDarkElixir);
                }

                return(this.m_cartLootCapResource);
            }

            return(0);
        }
        public int GetStorageLootCap(LogicResourceData data)
        {
            if (data != null && !data.IsPremiumCurrency())
            {
                if (LogicDataTables.GetDarkElixirData() == data)
                {
                    return(this.m_darkElixirStorageLootCap);
                }

                return(this.m_resourceStorageLootCap);
            }

            return(0);
        }
Esempio n. 10
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_width            = this.GetIntegerValue("Width", 0);
            this.m_height           = this.GetIntegerValue("Height", 0);
            this.m_maxCount         = this.GetIntegerValue("MaxCount", 0);
            this.m_inShop           = !this.GetBooleanValue("NotInShop", 0);
            this.m_buildCost        = this.GetIntegerValue("BuildCost", 0);
            this.m_requiredExpLevel = this.GetIntegerValue("RequiredExpLevel", 0);
            this.m_passable         = this.GetBooleanValue("DecoPath", 0);

            this.m_buildResourceData = LogicDataTables.GetResourceByName(this.GetValue("BuildResource", 0), this);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_upgradeLevelCount = this.m_row.GetBiggestArraySize();
            this.m_buildingClass     = LogicDataTables.GetBuildingClassByName(this.GetValue("BuildingClass", 0), this);

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

            this.m_secondaryTargetingClass = LogicDataTables.GetBuildingClassByName(this.GetValue("SecondaryTargetingClass", 0), this);
            this.m_shopBuildingClass       = LogicDataTables.GetBuildingClassByName(this.GetValue("ShopBuildingClass", 0), this);

            if (this.m_shopBuildingClass == null)
            {
                this.m_shopBuildingClass = this.m_buildingClass;
            }

            this.m_exportNameNpc          = this.GetValue("ExportNameNpc", 0);
            this.m_exportNameConstruction = this.GetValue("ExportNameConstruction", 0);
            this.m_exportNameLocked       = this.GetValue("ExportNameLocked", 0);
            this.m_width               = this.GetIntegerValue("Width", 0);
            this.m_height              = this.GetIntegerValue("Height", 0);
            this.m_lootOnDestruction   = this.GetBooleanValue("LootOnDestruction", 0);
            this.m_bunker              = this.GetBooleanValue("Bunker", 0);
            this.m_village2Housing     = this.GetIntegerValue("Village2Housing", 0);
            this.m_upgradesUnits       = this.GetBooleanValue("UpgradesUnits", 0);
            this.m_producesUnitsOfType = this.GetIntegerValue("ProducesUnitsOfType", 0);
            this.m_freeBoost           = this.GetBooleanValue("FreeBoost", 0);
            this.m_randomHitPosition   = this.GetBooleanValue("RandomHitPosition", 0);
            this.m_chainAttackDistance = this.GetIntegerValue("ChainAttackDistance", 0);
            this.m_buildingW           = this.GetIntegerValue("BuildingW", 0);
            this.m_buildingH           = this.GetIntegerValue("BuildingH", 0);

            if (this.m_buildingW == 0)
            {
                this.m_buildingW = this.m_width;
            }

            if (this.m_buildingH == 0)
            {
                this.m_buildingH = this.m_height;
            }

            this.m_baseGfx                = this.GetIntegerValue("BaseGfx", 0);
            this.m_loadAmmoEffect         = LogicDataTables.GetEffectByName(this.GetValue("LoadAmmoEffect", 0), this);
            this.m_noAmmoEffect           = LogicDataTables.GetEffectByName(this.GetValue("NoAmmoEffect", 0), this);
            this.m_toggleAttackModeEffect = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0), this);
            this.m_pickUpEffect           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_placingEffect          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0), this);
            this.m_canNotSellLast         = this.GetBooleanValue("CanNotSellLast", 0);
            this.m_locked            = this.GetBooleanValue("Locked", 0);
            this.m_startingHomeCount = this.GetIntegerValue("StartingHomeCount", 0);
            this.m_hidden            = this.GetBooleanValue("Hidden", 0);
            this.m_triggerRadius     = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this.m_appearEffect      = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0), this);
            this.m_forgesSpells      = this.GetBooleanValue("ForgesSpells", 0);
            this.m_forgesMiniSpells  = this.GetBooleanValue("ForgesMiniSpells", 0);
            this.m_isHeroBarrack     = this.GetBooleanValue("IsHeroBarrack", 0);
            this.m_aimRotateStep     = this.GetIntegerValue("AimRotateStep", 0);
            this.m_turnSpeed         = this.GetIntegerValue("TurnSpeed", 0);

            if (this.m_turnSpeed == 0)
            {
                this.m_turnSpeed = 500;
            }

            this.m_needsAim            = this.GetBooleanValue("NeedsAim", 0);
            this.m_exportNameBeamStart = this.GetValue("ExportNameBeamStart", 0);
            this.m_exportNameBeamEnd   = this.GetValue("ExportNameBeamEnd", 0);
            this.m_shareHeroCombatData = this.GetBooleanValue("ShareHeroCombatData", 0);
            this.m_dieDamageRadius     = (this.GetIntegerValue("DieDamageRadius", 0) << 9) / 100;
            this.m_dieDamageEffect     = LogicDataTables.GetEffectByName(this.GetValue("DieDamageEffect", 0), this);
            this.m_dieDamageDelay      = this.GetIntegerValue("DieDamageDelay", 0);

            if (this.m_dieDamageDelay > 4000)
            {
                Debugger.Warning("m_dieDamageDelay too big");
                this.m_dieDamageDelay = 4000;
            }

            this.m_isRed    = this.GetBooleanValue("IsRed", 0);
            this.m_redMul   = this.GetIntegerValue("RedMul", 0);
            this.m_greenMul = this.GetIntegerValue("GreenMul", 0);
            this.m_blueMul  = this.GetIntegerValue("BlueMul", 0);
            this.m_redAdd   = this.GetIntegerValue("RedAdd", 0);
            this.m_greenAdd = this.GetIntegerValue("GreenAdd", 0);
            this.m_blueAdd  = this.GetIntegerValue("BlueAdd", 0);

            this.m_selfAsAoeCenter        = this.GetBooleanValue("SelfAsAoeCenter", 0);
            this.m_newTargetAttackDelay   = this.GetIntegerValue("NewTargetAttackDelay", 0);
            this.m_gearUpLevelRequirement = this.GetIntegerValue("GearUpLevelRequirement", 0);
            this.m_bunker = this.GetBooleanValue("Bunker", 0);

            int longestArraySize = this.m_row.GetBiggestArraySize();

            this.m_buildResourceData              = new LogicResourceData[longestArraySize];
            this.m_altBuildResourceData           = new LogicResourceData[longestArraySize];
            this.m_storedResourceCounts           = new LogicArrayList <int> [longestArraySize];
            this.m_percentageStoredResourceCounts = new LogicArrayList <int> [longestArraySize];
            this.m_ammoResourceData       = new LogicResourceData[longestArraySize];
            this.m_attackItemData         = new LogicArrayList <LogicAttackerItemData>(longestArraySize);
            this.m_defenceTroopCharacter  = new LogicCharacterData[longestArraySize];
            this.m_defenceTroopCharacter2 = new LogicCharacterData[longestArraySize];

            this.m_buildCost             = new int[longestArraySize];
            this.m_ammoCost              = new int[longestArraySize];
            this.m_townHallLevel         = new int[longestArraySize];
            this.m_townHallVillage2Level = new int[longestArraySize];
            this.m_constructionTimes     = new int[longestArraySize];
            this.m_gearUpTime            = new int[longestArraySize];
            this.m_gearUpCost            = new int[longestArraySize];
            this.m_boostCost             = new int[longestArraySize];
            this.m_housingSpace          = new int[longestArraySize];
            this.m_housingSpaceAlt       = new int[longestArraySize];
            this.m_resourcePer100Hours   = new int[longestArraySize];
            this.m_resourceMax           = new int[longestArraySize];
            this.m_resourceIconLimit     = new int[longestArraySize];
            this.m_hitpoints             = new int[longestArraySize];
            this.m_regenTime             = new int[longestArraySize];
            this.m_amountCanBeUpgraded   = new int[longestArraySize];
            this.m_unitProduction        = new int[longestArraySize];
            this.m_strengthWeight        = new int[longestArraySize];
            this.m_destructionXP         = new int[longestArraySize];
            this.m_defenceTroopCount     = new int[longestArraySize];
            this.m_defenceTroopLevel     = new int[longestArraySize];
            this.m_dieDamage             = new int[longestArraySize];
            this.m_wallBlockX            = new int[0];
            this.m_wallBlockY            = new int[0];

            for (int i = 0; i < longestArraySize; i++)
            {
                LogicAttackerItemData itemData = new LogicAttackerItemData();
                itemData.CreateReferences(this.m_row, this, i);
                this.m_attackItemData.Add(itemData);

                this.m_dieDamage[i]                      = this.GetClampedIntegerValue("DieDamage", i);
                this.m_buildCost[i]                      = this.GetClampedIntegerValue("BuildCost", i);
                this.m_housingSpace[i]                   = this.GetClampedIntegerValue("HousingSpace", i);
                this.m_housingSpaceAlt[i]                = this.GetClampedIntegerValue("HousingSpaceAlt", i);
                this.m_unitProduction[i]                 = this.GetClampedIntegerValue("UnitProduction", i);
                this.m_gearUpCost[i]                     = this.GetClampedIntegerValue("GearUpCost", i);
                this.m_boostCost[i]                      = this.GetClampedIntegerValue("BoostCost", i);
                this.m_resourcePer100Hours[i]            = this.GetClampedIntegerValue("ResourcePer100Hours", i);
                this.m_resourceMax[i]                    = this.GetClampedIntegerValue("ResourceMax", i);
                this.m_resourceIconLimit[i]              = this.GetClampedIntegerValue("ResourceIconLimit", i);
                this.m_hitpoints[i]                      = this.GetClampedIntegerValue("Hitpoints", i);
                this.m_regenTime[i]                      = this.GetClampedIntegerValue("RegenTime", i);
                this.m_amountCanBeUpgraded[i]            = this.GetClampedIntegerValue("AmountCanBeUpgraded", i);
                this.m_buildResourceData[i]              = LogicDataTables.GetResourceByName(this.GetClampedValue("BuildResource", i), this);
                this.m_altBuildResourceData[i]           = LogicDataTables.GetResourceByName(this.GetClampedValue("AltBuildResource", i), this);
                this.m_townHallLevel[i]                  = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this.m_townHallVillage2Level[i]          = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel2", i) - 1, 0);
                this.m_storedResourceCounts[i]           = new LogicArrayList <int>();
                this.m_percentageStoredResourceCounts[i] = new LogicArrayList <int>();

                LogicDataTable table = LogicDataTables.GetTable(LogicDataType.RESOURCE);

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

                this.m_gearUpTime[i]        = 60 * this.GetClampedIntegerValue("GearUpTime", i);
                this.m_constructionTimes[i] = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                              3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                              60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                              this.GetIntegerValue("BuildTimeS", i);
                this.m_destructionXP[i]    = this.GetClampedIntegerValue("DestructionXP", i);
                this.m_ammoResourceData[i] = LogicDataTables.GetResourceByName(this.GetClampedValue("AmmoResource", i), this);
                this.m_ammoCost[i]         = this.GetClampedIntegerValue("AmmoCost", i);
                this.m_strengthWeight[i]   = this.GetClampedIntegerValue("StrengthWeight", i);

                string defenceTroopCharacter = this.GetClampedValue("DefenceTroopCharacter", i);

                if (defenceTroopCharacter.Length > 0)
                {
                    this.m_defenceTroopCharacter[i] = LogicDataTables.GetCharacterByName(defenceTroopCharacter, this);
                }

                string defenceTroopCharacter2 = this.GetClampedValue("DefenceTroopCharacter2", i);

                if (defenceTroopCharacter2.Length > 0)
                {
                    this.m_defenceTroopCharacter2[i] = LogicDataTables.GetCharacterByName(defenceTroopCharacter2, this);
                }

                this.m_defenceTroopCount[i] = this.GetIntegerValue("DefenceTroopCount", i);
                this.m_defenceTroopLevel[i] = this.GetIntegerValue("DefenceTroopLevel", i);

                if (i > 0 && this.m_housingSpace[i] < this.m_housingSpace[i - 1])
                {
                    Debugger.Error("Building " + this.GetName() + " unit storage space decreases by upgrade level!");
                }
                if (this.m_gearUpCost[i] > 0 && this.m_gearUpTime[i] <= 0 || this.m_gearUpCost[i] <= 0 && this.m_gearUpTime[i] > 0)
                {
                    Debugger.Error("invalid gear up settings. gear up time and cost must be set for levels where available");
                }
            }

            this.m_areaOfEffectSpellData            = LogicDataTables.GetSpellByName(this.GetValue("AOESpell", 0), this);
            this.m_alternativeAreaOfEffectSpellData = LogicDataTables.GetSpellByName(this.GetValue("AOESpellAlternate", 0), this);
            this.m_produceResourceData = LogicDataTables.GetResourceByName(this.GetValue("ProducesResource", 0), this);
            this.m_gearUpResourceData  = LogicDataTables.GetResourceByName(this.GetValue("GearUpResource", 0), this);

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

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

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

            if (wallBlockX.Length > 0)
            {
                this.LoadWallBlock(wallBlockX, out this.m_wallBlockX);
                this.LoadWallBlock(this.GetValue("WallBlockY", 0), out this.m_wallBlockY);

                if (this.m_wallBlockX.Length != this.m_wallBlockY.Length)
                {
                    Debugger.Error("LogicBuildingData: Error parsing wall offsets");
                }

                if (this.m_wallBlockX.Length > 10)
                {
                    Debugger.Error("LogicBuildingData: Too many wall blocks");
                }
            }

            string gearUpBuilding = this.GetValue("GearUpBuilding", 0);

            if (gearUpBuilding.Length > 0)
            {
                this.m_gearUpBuildingData = LogicDataTables.GetBuildingByName(gearUpBuilding, this);
            }

            this.m_isClockTower      = this.GetName().Equals("Clock Tower");
            this.m_isFlamer          = this.GetName().Equals("Flamer");
            this.m_isBarrackVillage2 = this.GetName().Equals("Barrack2");
        }
Esempio n. 12
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);
        }
        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();
        }
Esempio n. 14
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_width  = this.GetIntegerValue("Width", 0);
            this.m_height = this.GetIntegerValue("Height", 0);

            this.m_upgradeLevelCount = this.m_row.GetBiggestArraySize();

            this.m_buildCost         = new int[this.m_upgradeLevelCount];
            this.m_rearmCost         = new int[this.m_upgradeLevelCount];
            this.m_townHallLevel     = new int[this.m_upgradeLevelCount];
            this.m_strenghtWeight    = new int[this.m_upgradeLevelCount];
            this.m_damage            = new int[this.m_upgradeLevelCount];
            this.m_damageRadius      = new int[this.m_upgradeLevelCount];
            this.m_ejectHousingLimit = new int[this.m_upgradeLevelCount];
            this.m_numSpawns         = new int[this.m_upgradeLevelCount];
            this.m_constructionTimes = new int[this.m_upgradeLevelCount];

            this.m_projectileData = new LogicProjectileData[this.m_upgradeLevelCount];

            for (int i = 0; i < this.m_upgradeLevelCount; i++)
            {
                this.m_buildCost[i]         = this.GetClampedIntegerValue("BuildCost", i);
                this.m_rearmCost[i]         = this.GetClampedIntegerValue("RearmCost", i);
                this.m_townHallLevel[i]     = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0);
                this.m_strenghtWeight[i]    = this.GetClampedIntegerValue("StrengthWeight", i);
                this.m_damage[i]            = LogicGamePlayUtil.DPSToSingleHit(this.GetClampedIntegerValue("Damage", i), 1000);
                this.m_damageRadius[i]      = (this.GetClampedIntegerValue("DamageRadius", i) << 9) / 100;
                this.m_ejectHousingLimit[i] = this.GetIntegerValue("EjectHousingLimit", i);
                this.m_numSpawns[i]         = this.GetClampedIntegerValue("NumSpawns", i);
                this.m_constructionTimes[i] = 86400 * this.GetClampedIntegerValue("BuildTimeD", i) +
                                              3600 * this.GetClampedIntegerValue("BuildTimeH", i) +
                                              60 * this.GetClampedIntegerValue("BuildTimeM", i) +
                                              this.GetClampedIntegerValue("BuildTimeS", i);
                this.m_projectileData[i] = LogicDataTables.GetProjectileByName(this.GetValue("Projectile", i), this);
            }

            this.m_preferredTargetData      = LogicDataTables.GetCharacterByName(this.GetValue("PreferredTarget", 0), this);
            this.m_preferredTargetDamageMod = this.GetIntegerValue("PreferredTargetDamageMod", 0);

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

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

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

            this.m_ejectVictims               = this.GetBooleanValue("EjectVictims", 0);
            this.m_actionFrame                = 1000 * this.GetIntegerValue("ActionFrame", 0) / 24;
            this.m_pushback                   = this.GetIntegerValue("Pushback", 0);
            this.m_doNotScalePushByDamage     = this.GetBooleanValue("DoNotScalePushByDamage", 0);
            this.m_effectData                 = LogicDataTables.GetEffectByName(this.GetValue("Effect", 0), this);
            this.m_effect2Data                = LogicDataTables.GetEffectByName(this.GetValue("Effect2", 0), this);
            this.m_effectBrokenData           = LogicDataTables.GetEffectByName(this.GetValue("EffectBroken", 0), this);
            this.m_damageEffectData           = LogicDataTables.GetEffectByName(this.GetValue("DamageEffect", 0), this);
            this.m_pickUpEffectData           = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_placingEffectData          = LogicDataTables.GetEffectByName(this.GetValue("PlacingEffect", 0), this);
            this.m_appearEffectData           = LogicDataTables.GetEffectByName(this.GetValue("AppearEffect", 0), this);
            this.m_toggleAttackModeEffectData = LogicDataTables.GetEffectByName(this.GetValue("ToggleAttackModeEffect", 0), this);
            this.m_triggerRadius              = (this.GetIntegerValue("TriggerRadius", 0) << 9) / 100;
            this.m_directionCount             = this.GetIntegerValue("DirectionCount", 0);
            this.m_spell                  = LogicDataTables.GetSpellByName(this.GetValue("Spell", 0), this);
            this.m_airTrigger             = this.GetBooleanValue("AirTrigger", 0);
            this.m_groundTrigger          = this.GetBooleanValue("GroundTrigger", 0);
            this.m_healerTrigger          = this.GetBooleanValue("HealerTrigger", 0);
            this.m_speedMod               = this.GetIntegerValue("SpeedMod", 0);
            this.m_damageMod              = this.GetIntegerValue("DamageMod", 0);
            this.m_durationMS             = this.GetIntegerValue("DurationMS", 0);
            this.m_hitDelayMS             = this.GetIntegerValue("HitDelayMS", 0);
            this.m_hitCount               = this.GetIntegerValue("HitCnt", 0);
            this.m_minTriggerHousingLimit = this.GetIntegerValue("MinTriggerHousingLimit", 0);
            this.m_spawnedCharGroundData  = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharGround", 0), this);
            this.m_spawnedCharAirData     = LogicDataTables.GetCharacterByName(this.GetValue("SpawnedCharAir", 0), this);
            this.m_timeBetweenSpawnsMS    = this.GetIntegerValue("TimeBetweenSpawnsMs", 0);
            this.m_spawnInitialDelayMS    = this.GetIntegerValue("SpawnInitialDelayMs", 0);
            this.m_throwDistance          = this.GetIntegerValue("ThrowDistance", 0);
            this.m_hasAltMode             = this.GetBooleanValue("HasAltMode", 0);
            this.m_enableByCalendar       = this.GetBooleanValue("EnabledByCalendar", 0);

            if (this.m_enableByCalendar)
            {
                if (this.m_upgradeLevelCount > 1)
                {
                    Debugger.Error("Temporary traps should not have upgrade levels!");
                }
            }
        }
Esempio n. 15
0
        public LogicData CreateItem(CSVRow row)
        {
            LogicData data = null;

            switch (this.m_tableIndex)
            {
            case LogicDataType.BUILDING:
            {
                data = new LogicBuildingData(row, this);
                break;
            }

            case LogicDataType.LOCALE:
            {
                data = new LogicLocaleData(row, this);
                break;
            }

            case LogicDataType.RESOURCE:
            {
                data = new LogicResourceData(row, this);
                break;
            }

            case LogicDataType.CHARACTER:
            {
                data = new LogicCharacterData(row, this);
                break;
            }

            case LogicDataType.ANIMATION:
            {
                data = new LogicAnimationData(row, this);
                break;
            }

            case LogicDataType.PROJECTILE:
            {
                data = new LogicProjectileData(row, this);
                break;
            }

            case LogicDataType.BUILDING_CLASS:
            {
                data = new LogicBuildingClassData(row, this);
                break;
            }

            case LogicDataType.OBSTACLE:
            {
                data = new LogicObstacleData(row, this);
                break;
            }

            case LogicDataType.EFFECT:
            {
                data = new LogicEffectData(row, this);
                break;
            }

            case LogicDataType.PARTICLE_EMITTER:
            {
                data = new LogicParticleEmitterData(row, this);
                break;
            }

            case LogicDataType.EXPERIENCE_LEVEL:
            {
                data = new LogicExperienceLevelData(row, this);
                break;
            }

            case LogicDataType.TRAP:
            {
                data = new LogicTrapData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE:
            {
                data = new LogicAllianceBadgeData(row, this);
                break;
            }

            case LogicDataType.GLOBAL:
            case LogicDataType.CLIENT_GLOBAL:
            {
                data = new LogicGlobalData(row, this);
                break;
            }

            case LogicDataType.TOWNHALL_LEVEL:
            {
                data = new LogicTownhallLevelData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_PORTAL:
            {
                data = new LogicAlliancePortalData(row, this);
                break;
            }

            case LogicDataType.NPC:
            {
                data = new LogicNpcData(row, this);
                break;
            }

            case LogicDataType.DECO:
            {
                data = new LogicDecoData(row, this);
                break;
            }

            case LogicDataType.RESOURCE_PACK:
            {
                data = new LogicResourcePackData(row, this);
                break;
            }

            case LogicDataType.SHIELD:
            {
                data = new LogicShieldData(row, this);
                break;
            }

            case LogicDataType.MISSION:
            {
                data = new LogicMissionData(row, this);
                break;
            }

            case LogicDataType.BILLING_PACKAGE:
            {
                data = new LogicBillingPackageData(row, this);
                break;
            }

            case LogicDataType.ACHIEVEMENT:
            {
                data = new LogicAchievementData(row, this);
                break;
            }

            case LogicDataType.SPELL:
            {
                data = new LogicSpellData(row, this);
                break;
            }

            case LogicDataType.HINT:
            {
                data = new LogicHintData(row, this);
                break;
            }

            case LogicDataType.HERO:
            {
                data = new LogicHeroData(row, this);
                break;
            }

            case LogicDataType.LEAGUE:
            {
                data = new LogicLeagueData(row, this);
                break;
            }

            case LogicDataType.NEWS:
            {
                data = new LogicNewsData(row, this);
                break;
            }

            case LogicDataType.WAR:
            {
                data = new LogicWarData(row, this);
                break;
            }

            case LogicDataType.REGION:
            {
                data = new LogicRegionData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_BADGE_LAYER:
            {
                data = new LogicAllianceBadgeLayerData(row, this);
                break;
            }

            case LogicDataType.ALLIANCE_LEVEL:
            {
                data = new LogicAllianceLevelData(row, this);
                break;
            }

            case LogicDataType.HELPSHIFT:
            {
                data = new LogicHelpshiftData(row, this);
                break;
            }

            case LogicDataType.CREDIT:
            case LogicDataType.FAQ:
            case LogicDataType.VARIABLE:
            {
                data = new LogicData(row, this);
                break;
            }

            case LogicDataType.GEM_BUNDLE:
            {
                data = new LogicGemBundleData(row, this);
                break;
            }

            case LogicDataType.VILLAGE_OBJECT:
            {
                data = new LogicVillageObjectData(row, this);
                break;
            }

            case LogicDataType.CALENDAR_EVENT_FUNCTION:
            {
                data = new LogicCalendarEventFunctionData(row, this);
                break;
            }

            case LogicDataType.BOOMBOX:
            {
                data = new LogicBoomboxData(row, this);
                break;
            }

            case LogicDataType.EVENT_ENTRY:
            {
                data = new LogicEventEntryData(row, this);
                break;
            }

            case LogicDataType.DEEPLINK:
            {
                data = new LogicDeeplinkData(row, this);
                break;
            }

            case LogicDataType.LEAGUE_VILLAGE2:
            {
                data = new LogicLeagueVillage2Data(row, this);
                break;
            }

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

            return(data);
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_villageType     = this.GetIntegerValue("UIGroup", 0);
            this.m_diamondReward   = this.GetIntegerValue("DiamondReward", 0);
            this.m_expReward       = this.GetIntegerValue("ExpReward", 0);
            this.m_actionCount     = this.GetIntegerValue("ActionCount", 0);
            this.m_actionDataLevel = this.GetIntegerValue("ActionDataLevel", 0);
            this.m_level           = this.GetIntegerValue("Level", 0);
            this.m_levelCount      = this.GetIntegerValue("LevelCount", 0);
            this.m_uiPriority      = this.GetIntegerValue("UIPriority", 0);

            this.m_completedTID = this.GetValue("CompletedTID", 0);
            this.m_showValue    = this.GetBooleanValue("ShowValue", 0);
            this.m_androidId    = this.GetValue("AndroidID", 0);

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

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

            switch (action)
            {
            case "npc_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_NPC_STARS;
                break;

            case "upgrade":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_UPGRADE;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

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

                break;

            case "victory_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VICTORY_POINTS;
                break;

            case "unit_unlock":
                this.m_actionType    = LogicAchievementData.ACTION_TYPE_UNIT_UNLOCK;
                this.m_characterData = LogicDataTables.GetCharacterByName(this.GetValue("ActionData", 0), this);

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

                break;

            case "clear_obstacles":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLEAR_OBSTACLES;
                break;

            case "donate_units":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_UNITS;
                break;

            case "loot":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_LOOT;
                this.m_resourceData = LogicDataTables.GetResourceByName(this.GetValue("ActionData", 0), this);

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

                break;

            case "destroy":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_DESTROY;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

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

                break;

            case "win_pvp_attack":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_ATTACK;
                break;

            case "win_pvp_defense":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WIN_PVP_DEFENSE;
                break;

            case "league":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE;
                break;

            case "war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_STARS;
                break;

            case "war_loot":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_WAR_LOOT;
                break;

            case "donate_spells":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SPELLS;
                break;

            case "account_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACCOUNT_BOUND;
                break;

            case "vs_battle_trophies":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_VERSUS_BATTLE_TROPHIES;
                break;

            case "gear_up":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_GEAR_UP;
                break;

            case "repair_building":
                this.m_actionType   = LogicAchievementData.ACTION_TYPE_REPAIR_BUILDING;
                this.m_buildingData = LogicDataTables.GetBuildingByName(this.GetValue("ActionData", 0), this);

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

                break;

            case "clan_games_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_CLAN_GAMES_POINTS;
                break;

            case "dragon_slayer":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DRAGON_SLAYER;
                break;

            case "league_war_stars":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_LEAGUE_WAR_STARS;
                break;

            case "scid_bound":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SUPERCELLID_BOUND;
                break;

            case "season_challenge_points":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_SEASON_CHALLENGE_POINTS;
                break;

            case "activate_super_licence":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_ACTIVATE_SUPER_LICENCE;
                break;

            case "donate_sieges":
                this.m_actionType = LogicAchievementData.ACTION_TYPE_DONATE_SIEGES;
                break;

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

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

            string         achievementName = this.GetName().Substring(0, this.GetName().Length - 1);
            LogicDataTable table           = LogicDataTables.GetTable(LogicDataType.ACHIEVEMENT);

            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.m_achievementLevel.Add(achievementData);
                    }
                }
            }

            Debugger.DoAssert(this.m_achievementLevel.Size() == this.m_levelCount, string.Format(
                                  "Expected same amount of achievements named {0}X to be same as LevelCount={1} for {2}.",
                                  achievementName,
                                  this.m_levelCount,
                                  this.GetName()));
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

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

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

            this.m_action               = this.GetValue("Action", 0);
            this.m_deprecated           = this.GetBooleanValue("Deprecated", 0);
            this.m_missionCategory      = this.GetIntegerValue("MissionCategory", 0);
            this.m_fixVillageObjectData = LogicDataTables.GetVillageObjectByName(this.GetValue("FixVillageObject", 0), this);

            if (this.m_fixVillageObjectData != null)
            {
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0);
                this.m_missionType        = 13;
            }

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

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

            if (this.m_buildBuildingData != null)
            {
                this.m_buildBuildingCount = this.GetIntegerValue("BuildBuildingCount", 0);
                this.m_buildBuildingLevel = this.GetIntegerValue("BuildBuildingLevel", 0) - 1;
                this.m_missionType        = string.Equals(this.m_action, "unlock") ? 15 : 5;

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

                    if (this.m_openAchievements)
                    {
                        this.m_missionType = 7;
                    }
                    else
                    {
                        this.m_defendNpcData = LogicDataTables.GetNpcByName(this.GetValue("DefendNPC", 0), this);

                        if (this.m_defendNpcData != null)
                        {
                            this.m_missionType = 1;
                        }
                        else
                        {
                            this.m_attackNpcData = LogicDataTables.GetNpcByName(this.GetValue("AttackNPC", 0), this);

                            if (this.m_attackNpcData != null)
                            {
                                this.m_missionType = 2;
                                this.m_showMap     = this.GetBooleanValue("ShowMap", 0);
                            }
                            else
                            {
                                this.m_changeName = this.GetBooleanValue("ChangeName", 0);

                                if (this.m_changeName)
                                {
                                    this.m_missionType = 6;
                                }
                                else
                                {
                                    this.m_trainTroopCount = this.GetIntegerValue("TrainTroops", 0);

                                    if (this.m_trainTroopCount > 0)
                                    {
                                        this.m_missionType = 4;
                                    }
                                    else
                                    {
                                        this.m_switchSides = this.GetBooleanValue("SwitchSides", 0);

                                        if (this.m_switchSides)
                                        {
                                            this.m_missionType = 8;
                                        }
                                        else
                                        {
                                            this.m_showWarBase = this.GetBooleanValue("ShowWarBase", 0);

                                            if (this.m_showWarBase)
                                            {
                                                this.m_missionType = 9;
                                            }
                                            else
                                            {
                                                this.m_openInfo = this.GetBooleanValue("OpenInfo", 0);

                                                if (this.m_openInfo)
                                                {
                                                    this.m_missionType = 11;
                                                }
                                                else
                                                {
                                                    this.m_showDonate = this.GetBooleanValue("ShowDonate", 0);

                                                    if (this.m_showDonate)
                                                    {
                                                        this.m_missionType = 10;
                                                    }
                                                    else
                                                    {
                                                        this.m_showStates = this.GetBooleanValue("WarStates", 0);

                                                        if (this.m_showStates)
                                                        {
                                                            this.m_missionType = 12;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

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

            if (this.m_villagers > 0)
            {
                this.m_missionType = 16;
            }

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

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

            this.m_rewardResourceData  = LogicDataTables.GetResourceByName(this.GetValue("RewardResource", 0), this);
            this.m_rewardResourceCount = this.GetIntegerValue("RewardResourceCount", 0);

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

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

            this.m_customData = this.GetIntegerValue("CustomData", 0);
            this.m_rewardXp   = this.GetIntegerValue("RewardXP", 0);

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

            this.m_rewardCharacterData  = LogicDataTables.GetCharacterByName(this.GetValue("RewardTroop", 0), this);
            this.m_rewardCharacterCount = this.GetIntegerValue("RewardTroopCount", 0);

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

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

            this.m_delay        = this.GetIntegerValue("Delay", 0);
            this.m_villageType  = this.GetIntegerValue("VillageType", 0);
            this.m_firstStep    = this.GetBooleanValue("FirstStep", 0);
            this.m_tutorialText = this.GetValue("TutorialText", 0);

            if (this.m_tutorialText.Length > 0)
            {
                // BLABLABLA
            }
        }
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_exportName              = this.GetValue("ExportName", 0);
            this.m_exportNameBase          = this.GetValue("ExportNameBase", 0);
            this.m_width                   = this.GetIntegerValue("Width", 0);
            this.m_height                  = this.GetIntegerValue("Height", 0);
            this.m_passable                = this.GetBooleanValue("Passable", 0);
            this.m_clearEffect             = LogicDataTables.GetEffectByName(this.GetValue("ClearEffect", 0), this);
            this.m_pickUpEffect            = LogicDataTables.GetEffectByName(this.GetValue("PickUpEffect", 0), this);
            this.m_isTombstone             = this.GetBooleanValue("IsTombstone", 0);
            this.m_tombGroup               = this.GetIntegerValue("TombGroup", 0);
            this.m_appearancePeriodHours   = this.GetIntegerValue("AppearancePeriodHours", 0);
            this.m_minRespawnTimeHours     = this.GetIntegerValue("MinRespawnTimeHours", 0);
            this.m_lootDefensePercentage   = this.GetIntegerValue("LootDefensePercentage", 0);
            this.m_redMul                  = this.GetIntegerValue("RedMul", 0);
            this.m_greenMul                = this.GetIntegerValue("GreenMul", 0);
            this.m_blueMul                 = this.GetIntegerValue("BlueMul", 0);
            this.m_redAdd                  = this.GetIntegerValue("RedAdd", 0);
            this.m_greenAdd                = this.GetIntegerValue("GreenAdd", 0);
            this.m_blueAdd                 = this.GetIntegerValue("BlueAdd", 0);
            this.m_lightsOn                = this.GetBooleanValue("LightsOn", 0);
            this.m_village2RespawnCount    = this.GetIntegerValue("Village2RespawnCount", 0);
            this.m_variationCount          = this.GetIntegerValue("VariationCount", 0);
            this.m_tallGrass               = this.GetBooleanValue("TallGrass", 0);
            this.m_tallGrassSpawnPoint     = this.GetBooleanValue("TallGrassSpawnPoint", 0);
            this.m_lootHighlightPercentage = this.GetIntegerValue("LootHighlightPercentage", 0);
            this.m_highlightExportName     = this.GetValue("HighlightExportName", 0);

            this.m_clearResourceData = LogicDataTables.GetResourceByName(this.GetValue("ClearResource", 0), this);

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

            this.m_clearCost     = this.GetIntegerValue("ClearCost", 0);
            this.m_clearTimeSecs = this.GetIntegerValue("ClearTimeSeconds", 0);
            this.m_respawnWeight = this.GetIntegerValue("RespawnWeight", 0);

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

            if (lootResourceName.Length <= 0)
            {
                this.m_respawnWeight = 0;
            }
            else
            {
                this.m_lootResourceData = LogicDataTables.GetResourceByName(lootResourceName, this);
                this.m_lootCount        = this.GetIntegerValue("LootCount", 0);
            }

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

            if (this.m_lootMultiplierVersion2 == 0)
            {
                this.m_lootMultiplierVersion2 = 1;
            }

            string spawnObstacle = this.GetValue("SpawnObstacle", 0);

            if (spawnObstacle.Length > 0)
            {
                this.m_spawnObstacle        = LogicDataTables.GetObstacleByName(spawnObstacle, this);
                this.m_spawnRadius          = this.GetIntegerValue("SpawnRadius", 0);
                this.m_spawnIntervalSeconds = this.GetIntegerValue("SpawnIntervalSeconds", 0);
                this.m_spawnCount           = this.GetIntegerValue("SpawnCount", 0);
                this.m_maxSpawned           = this.GetIntegerValue("MaxSpawned", 0);
                this.m_maxLifetimeSpawns    = this.GetIntegerValue("MaxLifetimeSpawns", 0);
            }
        }