public int GetMaxSpellForgeLevel() { int result = 0; List <Component> components = m_vComponents[3]; if (components.Count > 0) { foreach (UnitProductionComponent c in components) { if (c.IsSpellForge()) { Building b = (Building)c.GetParent(); if (!b.IsConstructing() || b.IsUpgrading()) { int level = b.GetUpgradeLevel(); if (level > result) { result = level; } } } } } return(result); }
public int GetMaxTrainCount() { Building b = (Building)GetParent(); BuildingData bd = b.GetBuildingData(); return(bd.GetUnitProduction(b.GetUpgradeLevel())); }
public bool CanStartUpgrading(CombatItemData cid) { bool result = false; if (m_vCurrentlyUpgradedUnit == null) { Building b = (Building)GetParent(); ClientAvatar ca = GetParent().GetLevel().GetHomeOwnerAvatar(); ComponentManager cm = GetParent().GetLevel().GetComponentManager(); int maxProductionBuildingLevel; if (cid.GetCombatItemType() == 1) { maxProductionBuildingLevel = cm.GetMaxSpellForgeLevel(); } else { maxProductionBuildingLevel = cm.GetMaxBarrackLevel(); } if (ca.GetUnitUpgradeLevel(cid) < cid.GetUpgradeLevelCount() - 1) { if (maxProductionBuildingLevel >= cid.GetRequiredProductionHouseLevel() - 1) { result = (b.GetUpgradeLevel() >= (cid.GetRequiredLaboratoryLevel(ca.GetUnitUpgradeLevel(cid) + 1)) - 1); } } } return(result); }
public int GetMaxTrainCount() { Building parent = (Building)GetParent(); return(parent.GetBuildingData().GetUnitProduction(parent.GetUpgradeLevel())); }