/// <summary> /// Steals the object. /// </summary> /// <param name="unit">The unit.</param> /// <param name="type">The type.</param> private void StealObject(Obj_AI_Base unit, StealType type) { if (ObjectManager.Player.LSDistance(unit) > Config.Instance.miscMenu["DistanceLimit"].Cast <Slider>().CurrentValue) { return; } if (!unit.IsVisible && !Config.Instance.miscMenu["StealFOW"].Cast <CheckBox>().CurrentValue) { return; } //type.ToString() + x.Slot var spell = this.Spells.Where( x => x.IsReady() && x.IsInRange(unit) && (type == StealType.BuffSteal ? Config.Instance.buffMenu[type.ToString() + x.Slot].Cast <CheckBox>().CurrentValue : Config.Instance.objectiveMenu[type.ToString() + x.Slot].Cast <CheckBox>().CurrentValue) && x.GetMissileArrivalTime(unit) < Config.Instance.miscMenu["ETALimit"].Cast <Slider>().CurrentValue / 1000f).MaxOrDefault(x => ObjectManager.Player.LSGetSpellDamage(unit, x.Slot)); if (spell == null) { return; } var healthPred = HealthPrediction.GetPredictedHealth(unit, spell.GetMissileArrivalTime(unit)); if (spell.GetDamage(unit) >= healthPred) { spell.Cast(unit); } }
/// <summary> /// Steals the object. /// </summary> /// <param name="unit">The unit.</param> /// <param name="type">The type.</param> private void StealObject(Obj_AI_Base unit, StealType type) { if (ObjectManager.Player.Distance(unit) > Config.Instance["DistanceLimit"].GetValue<Slider>().Value) { return; } if (!unit.IsVisible && !Config.Instance["StealFOW"].IsActive()) { return; } var spell = this.Spells.Where( x => x.IsReady() && x.IsInRange(unit) && Config.Instance[type.ToString() + x.Slot].IsActive() && x.GetMissileArrivalTime(unit) < Config.Instance["ETALimit"].GetValue<Slider>().Value / 1000f).MaxOrDefault(x => ObjectManager.Player.GetSpellDamage(unit, x.Slot)); if (spell == null) { return; } var healthPred = HealthPrediction.GetPredictedHealth(unit, spell.GetMissileArrivalTime(unit)); if (spell.GetDamage(unit) >= healthPred) { spell.Cast(unit); } }