コード例 #1
0
        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()));
        }
コード例 #2
0
 public static int GetLevelCap()
 {
     return(LogicDataTables.GetTable(LogicDataType.EXPERIENCE_LEVEL).GetItemCount());
 }
コード例 #3
0
        public void CalculateHousingSpaceCap()
        {
            this.m_maxHousingSpace = 0;

            if (this.GetInstanceID() > 0)
            {
                this.m_table.GetItemAt(this.GetInstanceID() - 1); // Thx supercell for the crappy code.
            }

            LogicDataTable buildingTable  = LogicDataTables.GetTable(LogicDataType.BUILDING);
            int            dataTableCount = this.m_table.GetItemCount();

            if (dataTableCount > 0)
            {
                int unitHousingCostMultiplierForTotal         = LogicDataTables.GetGlobals().GetUnitHousingCostMultiplierForTotal();
                int spellHousingCostMultiplierForTotal        = LogicDataTables.GetGlobals().GetSpellHousingCostMultiplierForTotal();
                int heroHousingCostMultiplierForTotal         = LogicDataTables.GetGlobals().GetHeroHousingCostMultiplierForTotal();
                int allianceUnitHousingCostMultiplierForTotal = LogicDataTables.GetGlobals().GetAllianceUnitHousingCostMultiplierForTotal();

                int idx = 0;

                do
                {
                    LogicBuildingData buildingData = (LogicBuildingData)buildingTable.GetItemAt(idx);
                    int count = this.m_buildingCaps[idx];

                    if (count > 0)
                    {
                        int multiplier  = unitHousingCostMultiplierForTotal;
                        int maxUpgLevel = buildingData.GetMaxUpgradeLevelForTownHallLevel(this.GetInstanceID());

                        if (maxUpgLevel >= 0)
                        {
                            int housingSpace = buildingData.GetUnitStorageCapacity(maxUpgLevel);

                            if (!buildingData.IsAllianceCastle())
                            {
                                if (buildingData.IsForgesMiniSpells() || buildingData.IsForgesSpells())
                                {
                                    multiplier = spellHousingCostMultiplierForTotal;
                                }
                                else if (buildingData.IsHeroBarrack())
                                {
                                    housingSpace = buildingData.GetHeroData().GetHousingSpace();
                                    multiplier   = heroHousingCostMultiplierForTotal;
                                }
                            }
                            else
                            {
                                multiplier = allianceUnitHousingCostMultiplierForTotal;
                            }

                            if (housingSpace > 0)
                            {
                                this.m_maxHousingSpace += multiplier * count * housingSpace / 100;
                            }
                        }
                    }
                } while (++idx != dataTableCount);
            }
        }
コード例 #4
0
        public override void CreateReferences()
        {
            base.CreateReferences();

            this.m_buildingCaps       = new LogicArrayList <int>();
            this.m_buildingGearupCaps = new LogicArrayList <int>();
            this.m_trapCaps           = new LogicArrayList <int>();
            this.m_treasuryCaps       = new LogicArrayList <int>();

            LogicTownhallLevelData previousItem = null;

            if (this.GetInstanceID() > 0)
            {
                previousItem = (LogicTownhallLevelData)this.m_table.GetItemAt(this.GetInstanceID() - 1);
            }

            LogicDataTable buildingTable = LogicDataTables.GetTable(LogicDataType.BUILDING);

            for (int i = 0; i < buildingTable.GetItemCount(); i++)
            {
                LogicData item = buildingTable.GetItemAt(i);

                int cap    = this.GetIntegerValue(item.GetName(), 0);
                int gearup = this.GetIntegerValue(item.GetName() + "_gearup", 0);

                if (previousItem != null)
                {
                    if (cap == 0)
                    {
                        cap = previousItem.m_buildingCaps[i];
                    }

                    if (gearup == 0)
                    {
                        gearup = previousItem.m_buildingGearupCaps[i];
                    }
                }

                this.m_buildingCaps.Add(cap);
                this.m_buildingGearupCaps.Add(gearup);
            }

            LogicDataTable trapTable = LogicDataTables.GetTable(LogicDataType.TRAP);

            for (int i = 0; i < trapTable.GetItemCount(); i++)
            {
                int cap = this.GetIntegerValue(trapTable.GetItemAt(i).GetName(), 0);

                if (previousItem != null)
                {
                    if (cap == 0)
                    {
                        cap = previousItem.m_trapCaps[i];
                    }
                }

                this.m_trapCaps.Add(cap);
            }

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

            for (int i = 0; i < resourceTable.GetItemCount(); i++)
            {
                this.m_treasuryCaps.Add(this.GetIntegerValue("Treasury" + resourceTable.GetItemAt(i).GetName(), 0));
            }

            this.m_attackCost                      = this.GetIntegerValue("AttackCost", 0);
            this.m_attackCostVillage2              = this.GetIntegerValue("AttackCostVillage2", 0);
            this.m_resourceStorageLootPercentage   = this.GetIntegerValue("ResourceStorageLootPercentage", 0);
            this.m_darkElixirStorageLootPercentage = this.GetIntegerValue("DarkElixirStorageLootPercentage", 0);
            this.m_resourceStorageLootCap          = this.GetIntegerValue("ResourceStorageLootCap", 0);
            this.m_darkElixirStorageLootCap        = this.GetIntegerValue("DarkElixirStorageLootCap", 0);
            this.m_warPrizeResourceCap             = this.GetIntegerValue("WarPrizeResourceCap", 0);
            this.m_warPrizeDarkElixirCap           = this.GetIntegerValue("WarPrizeDarkElixirCap", 0);
            this.m_warPrizeAllianceExpCap          = this.GetIntegerValue("WarPrizeAllianceExpCap", 0);
            this.m_cartLootCapResource             = this.GetIntegerValue("CartLootCapResource", 0);
            this.m_cartLootReengagementResource    = this.GetIntegerValue("CartLootReengagementResource", 0);
            this.m_cartLootCapDarkElixir           = this.GetIntegerValue("CartLootCapDarkElixir", 0);
            this.m_cartLootReengagementDarkElixir  = this.GetIntegerValue("CartLootReengagementDarkElixir", 0);
            this.m_strengthMaxTroopTypes           = this.GetIntegerValue("StrengthMaxTroopTypes", 0);
            this.m_strengthMaxSpellTypes           = this.GetIntegerValue("StrengthMaxSpellTypes", 0);
            this.m_friendlyCost                    = this.GetIntegerValue("FriendlyCost", 0);
            this.m_packElixir                      = this.GetIntegerValue("PackElixir", 0);
            this.m_packGold             = this.GetIntegerValue("PackGold", 0);
            this.m_packDarkElixir       = this.GetIntegerValue("PackDarkElixir", 0);
            this.m_packGold2            = this.GetIntegerValue("PackGold2", 0);
            this.m_packElixir2          = this.GetIntegerValue("PackElixir2", 0);
            this.m_duelPrizeResourceCap = this.GetIntegerValue("DuelPrizeResourceCap", 0);
            this.m_changeTroopCost      = this.GetIntegerValue("ChangeTroopCost", 0);

            if ((uint)this.m_darkElixirStorageLootPercentage > 100 || (uint)this.m_darkElixirStorageLootPercentage > 100)
            {
                Debugger.Error("townhall_levels.csv: Invalid loot percentage!");
            }
        }
コード例 #5
0
        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");
        }