public int GetRequiredTownHallLevel(int index) { if (index != 0 || LogicDataTables.GetTownHallLevelCount() < 1) { return(this.m_townHallLevel[index]); } for (int i = 0; i < LogicDataTables.GetTownHallLevelCount(); i++) { LogicTownhallLevelData townHallLevel = LogicDataTables.GetTownHallLevel(i); if (townHallLevel.GetUnlockedBuildingCount(this) > 0) { return(i); } } return(this.m_townHallLevel[index]); }