private bool HandleDeadPartymembers() { if (!Spells.ContainsKey(resurrectionSpell)) { Spells.Add(resurrectionSpell, CharacterManager.SpellBook.GetSpellByName(resurrectionSpell)); } if (Spells[resurrectionSpell] != null && !CooldownManager.IsSpellOnCooldown(resurrectionSpell) && Spells[resurrectionSpell].Costs < ObjectManager.Player.Mana) { IEnumerable <WowPlayer> players = ObjectManager.WowObjects.OfType <WowPlayer>(); List <WowPlayer> groupPlayers = players.Where(e => e.IsDead && e.Health == 0 && ObjectManager.PartymemberGuids.Contains(e.Guid)).ToList(); if (groupPlayers.Count > 0) { HookManager.TargetGuid(groupPlayers.First().Guid); HookManager.CastSpell(resurrectionSpell); CooldownManager.SetSpellCooldown(resurrectionSpell, (int)HookManager.GetSpellCooldown(resurrectionSpell)); return(true); } } return(false); }
internal bool CastSpellIfPossible(string spellName, ulong guid, bool needsResource = false, int currentResourceAmount = 0) { if (!PrepareCast(spellName)) { return(false); } WowUnit target = null; if (guid != 0) { target = WowInterface.ObjectManager.GetWowObjectByGuid <WowUnit>(guid); if (target == null) { return(false); } } if (currentResourceAmount == 0) { currentResourceAmount = WowInterface.ObjectManager.Player.Class switch { WowClass.Deathknight => WowInterface.ObjectManager.Player.Runeenergy, WowClass.Rogue => WowInterface.ObjectManager.Player.Energy, WowClass.Warrior => WowInterface.ObjectManager.Player.Rage, _ => WowInterface.ObjectManager.Player.Mana, }; } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsResource || Spells[spellName].Costs < currentResourceAmount) && (target == null || IsInRange(Spells[spellName], target.Position))) { if (guid != 0 && WowInterface.ObjectManager.TargetGuid != guid) { WowInterface.HookManager.TargetGuid(guid); } CastSpell(spellName); return(true); } return(false); }
private bool CastSpellIfPossible(string spellName, bool needsMana = false) { if (!Spells.ContainsKey(spellName)) { Spells.Add(spellName, CharacterManager.SpellBook.GetSpellByName(spellName)); } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsMana || Spells[spellName].Costs < ObjectManager.Player.Mana)) { HookManager.CastSpell(spellName); CooldownManager.SetSpellCooldown(spellName, (int)HookManager.GetSpellCooldown(spellName)); return(true); } return(false); }
private bool CastSpellIfPossible(string spellName, bool needsEnergy = false, bool needsCombopoints = false, int requiredCombopoints = 1) { if (!Spells.ContainsKey(spellName)) { Spells.Add(spellName, CharacterManager.SpellBook.GetSpellByName(spellName)); } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsEnergy || Spells[spellName].Costs < ObjectManager.Player.Energy) && (!needsCombopoints || ObjectManager.Player.ComboPoints >= requiredCombopoints)) { HookManager.CastSpell(spellName); CooldownManager.SetSpellCooldown(spellName, (int)HookManager.GetSpellCooldown(spellName)); return(true); } return(false); }
private bool CastSpellIfPossible(string spellName, bool needsRuneenergy = false, bool needsBloodrune = false, bool needsFrostrune = false, bool needsUnholyrune = false) { if (!Spells.ContainsKey(spellName)) { Spells.Add(spellName, CharacterManager.SpellBook.GetSpellByName(spellName)); } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsRuneenergy || Spells[spellName].Costs < ObjectManager.Player.Runeenergy) && (!needsBloodrune || (HookManager.IsRuneReady(0) || HookManager.IsRuneReady(1))) && (!needsFrostrune || (HookManager.IsRuneReady(2) || HookManager.IsRuneReady(3))) && (!needsUnholyrune || (HookManager.IsRuneReady(4) || HookManager.IsRuneReady(5)))) { HookManager.CastSpell(spellName); CooldownManager.SetSpellCooldown(spellName, (int)HookManager.GetSpellCooldown(spellName)); return(true); } return(false); }
internal bool HandleDeadPartymembers(string SpellName) { if (!Spells.ContainsKey(SpellName)) { Spells.Add(SpellName, WowInterface.CharacterManager.SpellBook.GetSpellByName(SpellName)); } if (Spells[SpellName] != null && !CooldownManager.IsSpellOnCooldown(SpellName) && Spells[SpellName].Costs < WowInterface.ObjectManager.Player.Mana) { IEnumerable <WowPlayer> players = WowInterface.ObjectManager.WowObjects.OfType <WowPlayer>(); List <WowPlayer> groupPlayers = players.Where(e => e.IsDead && e.Health == 0 && WowInterface.ObjectManager.PartymemberGuids.Contains(e.Guid)).ToList(); if (groupPlayers.Count > 0) { WowPlayer player = groupPlayers.FirstOrDefault(e => RessurrectionTargets.ContainsKey(e.Name) ? RessurrectionTargets[e.Name] < DateTime.Now : true); if (player != null) { if (!RessurrectionTargets.ContainsKey(player.Name)) { RessurrectionTargets.Add(player.Name, DateTime.Now + TimeSpan.FromSeconds(2)); return(false); } if (RessurrectionTargets[player.Name] < DateTime.Now) { return(CastSpellIfPossible(SpellName, player.Guid, true)); } } return(true); } } return(false); }
internal bool CastSpellIfPossibleDk(string spellName, ulong guid, bool needsRuneenergy = false, bool needsBloodrune = false, bool needsFrostrune = false, bool needsUnholyrune = false) { if (!PrepareCast(spellName)) { return(false); } WowUnit target = null; if (guid != 0) { target = WowInterface.ObjectManager.GetWowObjectByGuid <WowUnit>(guid); if (target == null) { return(false); } } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsRuneenergy || Spells[spellName].Costs < WowInterface.ObjectManager.Player.Runeenergy) && (!needsBloodrune || (WowInterface.HookManager.IsRuneReady(0) || WowInterface.HookManager.IsRuneReady(1))) && (!needsFrostrune || (WowInterface.HookManager.IsRuneReady(2) || WowInterface.HookManager.IsRuneReady(3))) && (!needsUnholyrune || (WowInterface.HookManager.IsRuneReady(4) || WowInterface.HookManager.IsRuneReady(5))) && (target == null || IsInRange(Spells[spellName], target.Position))) { if (guid != 0 && WowInterface.ObjectManager.Target.Guid != guid) { WowInterface.HookManager.TargetGuid(guid); } CastSpell(spellName); return(true); } return(false); }
internal bool CastSpellIfPossibleRogue(string spellName, ulong guid, bool needsEnergy = false, bool needsCombopoints = false, int requiredCombopoints = 1) { if (!PrepareCast(spellName)) { return(false); } WowUnit target = null; if (guid != 0) { target = WowInterface.ObjectManager.GetWowObjectByGuid <WowUnit>(guid); if (target == null) { return(false); } } if (Spells[spellName] != null && !CooldownManager.IsSpellOnCooldown(spellName) && (!needsEnergy || Spells[spellName].Costs < WowInterface.ObjectManager.Player.Energy) && (!needsCombopoints || WowInterface.ObjectManager.Player.ComboPoints >= requiredCombopoints) && (target == null || IsInRange(Spells[spellName], target.Position))) { if (guid != 0 && WowInterface.ObjectManager.TargetGuid != guid) { WowInterface.HookManager.TargetGuid(guid); } CastSpell(spellName); return(true); } return(false); }
public override void Execute() { base.Execute(); if (WowInterface.ObjectManager.Player.IsCasting) { return; } if (SelectTarget(out WowUnit target)) { if (WowInterface.ObjectManager.Player.ManaPercentage <= 25.0 && TryCastSpell(evocationSpell, 0, true)) { return; } if (CooldownManager.IsSpellOnCooldown(summonWaterElementalSpell) && CooldownManager.IsSpellOnCooldown(icyVeinsSpell)) { TryCastSpell(coldSnapSpell, 0); } if (WowInterface.CharacterManager.SpellBook.IsSpellKnown(freezeSpell)) { TryCastAoeSpell(freezeSpell, target.Guid); } var nearbyTargets = WowInterface.ObjectManager.GetEnemiesInCombatWithUs <WowUnit>(WowInterface.ObjectManager.Player.Position, 64.0); if (nearbyTargets.Count(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position) <= 9.0) == 1 && TryCastSpell(frostNovaSpell, 0, true)) { return; } if (DateTime.Now.Subtract(LastSheep).TotalMilliseconds >= 3000.0) { if (nearbyTargets.Count() > 1 && !nearbyTargets.Any(e => e.Auras.Any(aura => aura.Name == polymorphSpell))) { var targetInDistance = nearbyTargets .Where(e => e.Guid != WowInterface.ObjectManager.TargetGuid) .OrderBy(e => e.Position.GetDistance(WowInterface.ObjectManager.Player.Position)) .FirstOrDefault(); WowInterface.HookManager.WowTargetGuid(targetInDistance.Guid); if (TryCastSpell(polymorphSpell, targetInDistance.Guid, true)) { WowInterface.HookManager.WowTargetGuid(target.Guid); LastSheep = DateTime.Now; return; } } } if (WowInterface.ObjectManager.Target.Position.GetDistance(WowInterface.ObjectManager.Player.Position) <= 4.0) { // TODO: Logic to check if the target blink location is dangerous if (!TryCastSpell(blinkSpell, 0, true)) { } else { // TODO: Go away somehow if the enemy is freezed? return; } } if (WowInterface.ObjectManager.Target.Position.GetDistance(WowInterface.ObjectManager.Player.Position) <= 4.0 && WowInterface.ObjectManager.Player.HealthPercentage <= 50.0 && CooldownManager.IsSpellOnCooldown(blinkSpell) && TryCastSpell(iceBlockSpell, 0, true)) { return; } if (TryCastSpell(summonWaterElementalSpell, target.Guid, true)) { return; } if (TryCastSpell(deepFreezeSpell, target.Guid, true)) { return; } TryCastSpell(icyVeinsSpell, 0, true); TryCastSpell(berserkingSpell, 0, true); if (TryCastSpell(frostBoltSpell, target.Guid, true)) { return; } TryCastSpell(fireballSpell, target.Guid, true); } }