public override void Execute(Level level) { GameObject gameObjectById = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (gameObjectById == null || gameObjectById.ClassId != 0) { return; } HeroBaseComponent heroBaseComponent = ((ConstructionItem)gameObjectById).GetHeroBaseComponent(false); if (heroBaseComponent == null) { return; } heroBaseComponent.CancelUpgrade(); }
//00 00 02 13 1D CD 65 06 00 01 8B 0F public override void Execute(Level level) { GameObject go = level.GameObjectManager.GetGameObjectByID(m_vBuildingId); if (go != null) { if (go.ClassId == 0) { var b = (Building)go; HeroBaseComponent hbc = b.GetHeroBaseComponent(); if (hbc != null) { hbc.CancelUpgrade(); } } } }
internal override void Execute() { Level Level = this.Device.GameMode.Level; GameObject GameObject = Level.GameObjectManager.Filter.GetGameObjectById(this.BuildingId); if (GameObject != null) { if (GameObject is Building) { Building Building = (Building)GameObject; HeroBaseComponent HeroBaseComponent = Building.HeroBaseComponent; if (HeroBaseComponent != null) { if (!HeroBaseComponent.Upgrading) { Logging.Error(this.GetType(), $"Tried to cancel the upgrade of a hero which is not in upgrading with game ID {this.BuildingId}."); } else { HeroBaseComponent.CancelUpgrade(); } } else { Logging.Error(this.GetType(), "Unable to change hero mode. The HeroBaseComponent is null."); } } else { Logging.Error(this.GetType(), "Unable to change hero mode. The game object is not a building."); } } else { Logging.Error(this.GetType(), "Unable to change hero mode. The game object is null."); } }