/// <summary> /// Called when all instances has been loaded for initialized members in instance. /// </summary> public override void CreateReferences() { base.CreateVillageReferences(); this._upgradeLevelCount = this._row.GetBiggestArraySize(); this._buildingClass = LogicDataTables.GetBuildingClassByName(this.BuildingClass); if (this._buildingClass == null) { Debugger.Error("Building class is not defined for " + this.GetName()); } int longestArraySize = this._row.GetBiggestArraySize(); this._buildResourceData = new LogicResourceData[longestArraySize]; this._altBuildResourceData = new LogicResourceData[longestArraySize]; this._storedResourceCounts = new LogicArrayList <int> [longestArraySize]; this._percentageStoredResourceCounts = new LogicArrayList <int> [longestArraySize]; this._townHallLevel = new int[longestArraySize]; this._townHallVillage2Level = new int[longestArraySize]; this._constructionTimes = new int[longestArraySize]; this._gearUpTime = new int[longestArraySize]; this._gearUpCost = new int[longestArraySize]; this._boostCost = new int[longestArraySize]; for (int i = 0; i < longestArraySize; i++) { this._gearUpCost[i] = this.GetClampedIntegerValue("GearUpCost", i); this._gearUpTime[i] = this.GetClampedIntegerValue("GearUpTime", i); this._boostCost[i] = this.GetClampedIntegerValue("BoostCost", i); this._buildResourceData[i] = LogicDataTables.GetResourceByName(this.GetClampedValue("BuildResource", i)); this._altBuildResourceData[i] = LogicDataTables.GetResourceByName(this.GetClampedValue("AltBuildResource", i)); this._townHallLevel[i] = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel", i) - 1, 0); this._townHallVillage2Level[i] = LogicMath.Max(this.GetClampedIntegerValue("TownHallLevel2", i) - 1, 0); this._storedResourceCounts[i] = new LogicArrayList <int>(); this._percentageStoredResourceCounts[i] = new LogicArrayList <int>(); LogicDataTable table = LogicDataTables.GetTable(2); for (int j = 0; j < table.GetItemCount(); j++) { this._storedResourceCounts[i].Add(this.GetIntegerValue("MaxStored" + table.GetItemAt(j).GetName(), i)); this._percentageStoredResourceCounts[i].Add(this.GetIntegerValue("PercentageStored" + table.GetItemAt(j).GetName(), i)); } this._constructionTimes[i] = 86400 * this.GetIntegerValue("BuildTimeD", i) + 3600 * this.GetIntegerValue("BuildTimeH", i) + 60 * this.GetIntegerValue("BuildTimeM", i) + this.GetIntegerValue("BuildTimeS", i); } this._produceResourceData = LogicDataTables.GetResourceByName(this.GetValue("ProducesResource", 0)); this._gearUpResourceData = LogicDataTables.GetResourceByName(this.GetClampedValue("GearUpResource", 0)); string heroType = this.GetValue("HeroType", 0); if (!string.IsNullOrEmpty(heroType)) { this._heroData = LogicDataTables.GetHeroByName(heroType); } string wallBlockX = this.GetValue("WallBlockX", 0); if (wallBlockX.Length > 0) { this.LoadWallBlock(wallBlockX, out this._wallBlockX); this.LoadWallBlock(this.GetValue("WallBlockY", 0), out this._wallBlockY); } this._isClockTower = this.GetName().Equals("Clock Tower"); this._isFlamer = this.GetName().Equals("Flamer"); this._isBarrackVillage2 = this.GetName().Equals("Barrack2"); }