private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancel) { if (specialization.RotationType == Enums.RotationType.Party && _moveBehindTimer.IsReady) { if (ToolBox.StandBehindTargetCombat()) { _moveBehindTimer = new Timer(4000); } } else { if (IsTargetStunned() && !MovementManager.InMovement && Me.IsAlive && !Me.IsCast && ObjectManager.Target.IsAlive) { Vector3 position = ToolBox.BackofVector3(ObjectManager.Target.Position, ObjectManager.Target, 2.5f); MovementManager.Go(PathFinder.FindPath(position), false); while (MovementManager.InMovement && StatusChecker.BasicConditions() && IsTargetStunned()) { // Wait follow path Thread.Sleep(200); } } } }
private static void BuffRotation() { if (Me.ManaPercentage < HunterBeastMasterySettings.CurrentSetting.AspecofViper) { Extension.BuffSpell(AspecoftheViper); } if (!AspecoftheDragonhawk.KnownSpell && !AspecoftheCheetah.HaveBuff && (Me.ManaPercentage > 90 || !AspecoftheViper.KnownSpell)) { Extension.BuffSpell(AspecoftheHawk); } if (Me.ManaPercentage > 90 && !AspecoftheCheetah.HaveBuff) { Extension.BuffSpell(AspecoftheDragonhawk); } if (HunterBeastMasterySettings.CurrentSetting.Checkpet) { if (ObjectManager.Pet.IsAlive && ObjectManager.Pet.IsValid && ObjectManager.Pet.HealthPercent < HunterBeastMasterySettings.CurrentSetting.PetHealth) { if (PetHealTimer.IsReady) { Extension.PetSpell(MendPet); PetHealTimer = new Timer(1000 * 15); } } return; } }
// Approach spell target private void ApproachSpellTarget() { Timer limit = new Timer(10000); if (CurrentSpellTarget != null) { Logger.Log($"Approaching {CurrentSpellTarget.Name} to cast {CurrentSpell.Name} ({CurrentSpellTarget.GetDistance}/{CurrentSpell.MaxRange}"); MovementManager.Go(PathFinder.FindPath(CurrentSpellTarget.Position), false); Thread.Sleep(1000); while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !limit.IsReady && (CurrentSpellTarget.IsAlive || CurrentSpell.OnDeadTarget) && (CurrentSpellTarget.GetDistance > CurrentSpell.MaxRange - 2 || TraceLine.TraceLineGo(CurrentSpellTarget.Position))) { Thread.Sleep(100); } MovementManager.StopMoveNewThread(); } else if (CurrentSpellLocation != null) { Logger.Log($"Approaching {CurrentSpellLocation} to cast {CurrentSpell.Name}"); MovementManager.Go(PathFinder.FindPath(CurrentSpellLocation), false); Thread.Sleep(1000); while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !limit.IsReady && (CurrentSpellLocation.DistanceTo(ObjectManager.Me.Position) > CurrentSpell.MaxRange - 2)) { Thread.Sleep(100); } MovementManager.StopMoveNewThread(); } }
protected void StealthApproach() { Timer stealthApproachTimer = new Timer(7000); _isStealthApproching = true; if (ObjectManager.Me.IsAlive && ObjectManager.Target.IsAlive) { while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && (ObjectManager.Target.GetDistance > 2.5f || !Claw.IsSpellUsable) && (specialization.RotationType == Enums.RotationType.Party || ToolBox.GetClosestHostileFrom(ObjectManager.Target, 20f) == null) && Fight.InFight && !stealthApproachTimer.IsReady && Me.HaveBuff("Prowl")) { Vector3 position = ToolBox.BackofVector3(ObjectManager.Target.Position, ObjectManager.Target, 2.5f); MovementManager.MoveTo(position); Thread.Sleep(50); CastOpener(); } if (stealthApproachTimer.IsReady && ToolBox.Pull(cast, settings.AlwaysPull, new List <AIOSpell> { FaerieFireFeral, MoonfireRank1, Wrath })) { _combatMeleeTimer = new Timer(2000); return; } //ToolBox.CheckAutoAttack(Attack); _isStealthApproching = false; } }
private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancel) { if (specialization is FeralDPSParty && settings.PartyStandBehind && _moveBehindTimer.IsReady) { if (ToolBox.StandBehindTargetCombat()) { _moveBehindTimer = new Timer(4000); } } if (specialization is Feral && (ObjectManager.Target.HaveBuff("Pounce") || ObjectManager.Target.HaveBuff("Maim")) && !MovementManager.InMovement && Me.IsAlive && !Me.IsCast && ObjectManager.Target.IsAlive) { Vector3 position = ToolBox.BackofVector3(ObjectManager.Target.Position, ObjectManager.Target, 2.5f); MovementManager.Go(PathFinder.FindPath(position), false); while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && (ObjectManager.Target.HaveBuff("Pounce") || ObjectManager.Target.HaveBuff("Maim"))) { // Wait follow path Thread.Sleep(500); } } }
private void EventsWithArgsHandler(string id, List <string> args) { if (_behindTargetTimer.IsReady && args[11].Contains("You must be behind")) { _behindTargetTimer = new Timer(10000); } }
public void Initialize() { _isLaunched = true; var t = new Timer(15 * 1000); // check all 15 sec Logging.Write("[MemoryClean] Started."); while (_isLaunched && Products.IsStarted) { try { if (t.IsReady && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !Conditions.IsAttackedAndCannotIgnore) { Lua.LuaDoString("if gcinfo() > 270000 then RunMacroText('/reload') end"); // Change 270000 by max lua memory usage (in ko) t.Reset(); } } catch (Exception e) { Logging.WriteError("[MemoryClean]: " + e); } Thread.Sleep(150); } }
private void FightEventsOnOnFightStart(WoWUnit woWUnit, CancelEventArgs cancelable) { if (woWUnit.IsValid && woWUnit.IsAlive && !ObjectManager.Me.InCombat) { StanceLauncher(_pullStance); pullingTimer = new Timer(1100 * 2); } }
//FoodPart for Pet private static void Feed() { if (ObjectManager.Pet.IsAlive && PetFeedTimer.IsReady && Lua.LuaDoString <int>("happiness, damagePercentage, loyaltyRate = GetPetHappiness() return happiness", "") < 3) { FeedPet(); } PetFeedTimer = new Timer(1000 * 15); return; }
private static void Pull() { if (MyTarget.IsAttackable && Me.Target > 0 && ObjectManager.Pet.IsValid && PetPullTimer.IsReady) { Extension.Frameunlock(); Lua.LuaDoString("PetAttack();", false); PetPullTimer = new Timer(500); } }
private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancel) { if (specialization is EnhancementParty && settings.PartyStandBehind && _moveBehindTimer.IsReady) { if (ToolBox.StandBehindTargetCombat()) { _moveBehindTimer = new Timer(4000); } } }
private static void CombatRotation() { bool ffcheck = ObjectManager.Target.HaveBuff("Frost Fever"); bool bpcheck = ObjectManager.Target.HaveBuff("Blood Plague"); if (Extension.InterruptableUnit(5f) != null && MindFreeze.KnownSpell && MindFreeze.IsSpellUsable) { Logging.Write("Interrupt Target found"); ObjectManager.Me.FocusGuid = Extension.InterruptableUnit(5f).Guid; Logging.Write("Interrupt Target Set" + Extension.InterruptableUnit(5f).Guid); Extension.FightSpell(MindFreeze, true); } if (Extension.InterruptableUnit(20f) != null && Strangulate.KnownSpell && Strangulate.IsSpellUsable) { Logging.Write("Interrupt Target found"); ObjectManager.Me.FocusGuid = Extension.InterruptableUnit(20f).Guid; Logging.Write("Interrupt Target Set" + Extension.InterruptableUnit(20f).Guid); Extension.FightSpell(Strangulate, true); } if (ObjectManager.Target.IsElite) { Extension.FightSpell(MarkofBlood); } if (ObjectManager.Target.IsElite) { Extension.FightSpell(DancingRuneWeapon); } if (DeathKnightLevelSettings.CurrentSetting.DeathGrip && ObjectManager.Target.GetDistance > 10) { Extension.FightSpell(DeathGrip); } Extension.FightSpell(RuneStrike); if (!ffcheck && Extension.CanBleed(MyTarget)) { Extension.FightSpell(IcyTouch); } if (!bpcheck) { Extension.FightSpell(PlagueStrike); } if (ffcheck && bpcheck && Extension.GetAttackingUnits(10).Count() > 1 && Pestilencetimer.IsReady && Pestilence.IsSpellUsable && Pestilence.KnownSpell) { Pestilence.Launch(); Pestilencetimer = new Timer(7000); } UseBloodSkill(); Extension.FightSpell(DeathStrike); }
// Stops using wand and waits for its CD to be over private void StopWandWaitGCD(AIOSpell wandSpell) { CombatDebug("Stopping Wand and waiting for GCD"); wandSpell.Launch(); Timer limit = new Timer(1500); while (!CurrentSpell.IsSpellUsable && !limit.IsReady) { Thread.Sleep(50); } CombatDebug($"Waited for GCD after wand stop : {1500 - limit.TimeLeft()}"); }
public void StanceLauncher(Stance stance) { if (stance == Stance.Battle && !ObjectManager.Me.HaveBuff(BattleStanceSpell.Id) && BattleStanceSpell.KnownSpell) { BattleStanceSpell.Launch(); Logging.WriteDebug("WarriorHelper.StanceManager.BattleStance: "); spamTimer = new Timer(50); return; } else if (stance == Stance.Defensive && !ObjectManager.Me.HaveBuff(DefensiveStanceSpell.Id) && DefensiveStanceSpell.KnownSpell) { DefensiveStanceSpell.Launch(); Logging.WriteDebug("WarriorHelper.StanceManager.DefensiveStance: "); spamTimer = new Timer(50); return; } else if (stance == Stance.Berserker && !ObjectManager.Me.HaveBuff(BerserkerStanceSpell.Id) && BerserkerStanceSpell.KnownSpell) { BerserkerStanceSpell.Launch(); Logging.WriteDebug("WarriorHelper.StanceManager.BerserkerStance: "); spamTimer = new Timer(50); return; } }
private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancelable) { float minDistance = RangeManager.GetMeleeRangeWithTarget() + 3f; // Do we need to backup? if ((ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) && ObjectManager.Target.GetDistance < minDistance && Me.IsAlive && ObjectManager.Target.IsAlive && !cast.IsBackingUp && !Me.IsCast && !RangeManager.CurrentRangeIsMelee() && ObjectManager.Target.HealthPercent > 5 && !_isPolymorphing) { cast.IsBackingUp = true; Timer timer = new Timer(3000); // Using CTM if (settings.BackupUsingCTM) { Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 15f); MovementManager.Go(PathFinder.FindPath(position), false); Thread.Sleep(500); // Backup loop while (MovementManager.InMoveTo && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Target.GetDistance < minDistance && ObjectManager.Me.IsAlive && ObjectManager.Target.IsAlive && (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) && !timer.IsReady) { // Wait follow path Thread.Sleep(300); if (settings.BlinkWhenBackup) { cast.OnSelf(Blink); } } MovementManager.StopMove(); Thread.Sleep(500); } // Using Keyboard else { while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Me.IsAlive && ObjectManager.Target.IsAlive && ObjectManager.Target.GetDistance < minDistance && (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) && !timer.IsReady) { Move.Backward(Move.MoveAction.PressKey, 500); } } cast.IsBackingUp = false; } // Polymorph if (settings.UsePolymorph && ObjectManager.GetNumberAttackPlayer() > 1 && Polymorph.KnownSpell && !cast.IsBackingUp && !cast.IsApproachingTarget && specialization.RotationType != Enums.RotationType.Party && _polymorphableEnemyInThisFight) { WoWUnit myNearbyPolymorphed = null; // Detect if a polymorph cast has succeeded if (_polymorphedEnemy != null) { myNearbyPolymorphed = ObjectManager.GetObjectWoWUnit().Find(u => u.HaveBuff("Polymorph") && u.Guid == _polymorphedEnemy.Guid); } // If we don't have a polymorphed enemy if (myNearbyPolymorphed == null) { _polymorphedEnemy = null; _isPolymorphing = true; WoWUnit firstTarget = ObjectManager.Target; WoWUnit potentialPolymorphTarget = null; // Select our attackers one by one for potential polymorphs foreach (WoWUnit enemy in ObjectManager.GetUnitAttackPlayer()) { Interact.InteractGameObject(enemy.GetBaseAddress); if ((enemy.CreatureTypeTarget == "Beast" || enemy.CreatureTypeTarget == "Humanoid") && enemy.Guid != firstTarget.Guid) { potentialPolymorphTarget = enemy; break; } } if (potentialPolymorphTarget == null) { _polymorphableEnemyInThisFight = false; } // Polymorph cast if (potentialPolymorphTarget != null && _polymorphedEnemy == null && cast.OnFocusUnit(Polymorph, potentialPolymorphTarget)) { Usefuls.WaitIsCasting(); _polymorphedEnemy = potentialPolymorphTarget; } _isPolymorphing = false; } } }
private static void CombatRotation() { // Pet attack if (Fight.InFight && Me.Target > 0UL && ObjectManager.Target.IsAttackable && !ObjectManager.Pet.HaveBuff("Feed Pet Effect") && ObjectManager.Pet.Target != Me.Target) { Lua.LuaDoString("PetAttack();", false); } //Pethandle in Fight if (ObjectManager.Pet.HealthPercent < HunterLevelSettings.CurrentSetting.PetmendInFight && PetHealTimer.IsReady) { Extension.PetSpell(MendPet); PetHealTimer = new Timer(1000 * 15); return; } if (Extension.InterruptableUnit(20f) != null && Intimidation.KnownSpell && Intimidation.IsSpellUsable) { Logging.Write("Interrupt Target found"); ObjectManager.Me.Target = Extension.InterruptableUnit(20f).Guid; Logging.Write("Interrupt Target Set" + Extension.InterruptableUnit(20f).Guid); Extension.FightSpell(Intimidation); } if (ObjectManager.Target.IsElite || Extension.GetAttackingUnits(20).Count() > 1) { Extension.FightSpell(BestialWrath); } if (ObjectManager.Target.IsElite || Extension.GetAttackingUnits(20).Count() > 2) { Extension.BuffSpell(RapidFire); } //Ranged Attacks if (MyTarget.GetDistance >= 7) { Extension.FightSpell(HuntersMark); if (!Me.HaveBuff("Kill Command")) { Extension.FightSpell(KillCommand); } if (MyTarget.HealthPercent > 40) { Extension.FightSpell(SerpentSting); } Extension.FightSpell(ArcaneShot); if (MultiShotFeigndeath.IsReady && HunterLevelSettings.CurrentSetting.MultiS) { Extension.FightSpell(MultiShot); } Extension.FightSpell(SteadyShot, false, false, true); if (MyTarget.HealthPercent < 20) { Extension.FightSpell(KillShot); } if (Me.ManaPercentage < HunterLevelSettings.CurrentSetting.AspecofViper) { Extension.BuffSpell(AspecoftheViper); } if (Me.ManaPercentage > 30) { Extension.BuffSpell(AspecoftheDragonhawk); } if (!AspecoftheDragonhawk.KnownSpell && Me.ManaPercentage > 30) { Extension.BuffSpell(AspecoftheHawk); } } //Close Combat Attacks if (MyTarget.GetDistance <= 6) { Extension.FightSpell(RaptorStrike); if (!MyTarget.IsTargetingMe && ObjectManager.Pet.IsAlive && HunterLevelSettings.CurrentSetting.Dis) { Extension.BuffSpell(Disengage); } if (MyTarget.IsTargetingMe && ObjectManager.Pet.IsAlive) { Extension.BuffSpell(FeignDeath); Thread.Sleep(1500); MultiShotFeigndeath = new Timer(1000 * 5); return; } if (AspecoftheDragonhawk.KnownSpell) { Extension.BuffSpell(AspecoftheDragonhawk); } } }
private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancelable) { cast.IsBackingUp = false; float minDistance = RangeManager.GetMeleeRangeWithTarget() + settings.BackupDistance; // Do we need to backup? if (ObjectManager.Target.GetDistance < minDistance && !ObjectManager.Target.IsTargetingMe && !MovementManager.InMovement && Me.IsAlive && ObjectManager.Target.IsAlive && !ObjectManager.Pet.HaveBuff("Pacifying Dust") && !_canOnlyMelee && !cast.IsApproachingTarget && !ObjectManager.Pet.IsStunned && !Me.IsCast && settings.BackupFromMelee && (!RaptorStrikeOn() || ObjectManager.Target.GetDistance > RangeManager.GetMeleeRangeWithTarget())) { // Stop trying if we reached the max amount of attempts if (_backupAttempts >= settings.MaxBackupAttempts) { Logger.Log($"Backup failed after {_backupAttempts} attempts. Going in melee"); _canOnlyMelee = true; RangeManager.SetRangeToMelee(); return; } cast.IsBackingUp = true; Timer timer = new Timer(3000); // Using CTM if (settings.BackupUsingCTM) { Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 12f); MovementManager.Go(PathFinder.FindPath(position), false); Thread.Sleep(500); // Backup loop while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Me.IsAlive && !ObjectManager.Target.IsTargetingMe && ObjectManager.Target.GetDistance < minDistance && !timer.IsReady) { Thread.Sleep(100); } } // Using Keyboard else { while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Me.IsAlive && !ObjectManager.Target.IsTargetingMe && ObjectManager.Target.GetDistance < minDistance && !timer.IsReady) { Move.Backward(Move.MoveAction.PressKey, 500); } } _backupAttempts++; Logger.Log($"Backup attempt : {_backupAttempts}"); //Logger.Log($"FINAL We are {ObjectManager.Target.GetDistance}/{minDistance} away from target"); cast.IsBackingUp = false; if (RaptorStrikeOn()) { cast.OnTarget(RaptorStrike); } ReenableAutoshot(); } }
public bool AdvancedCast(AIOSpell spell, bool stopWandAndCast = true, bool onSelf = false, WoWUnit onUnitFocus = null, Vector3 location = null) { WoWUnit Me = ObjectManager.Me; float buffer = 600; if (IsApproachingTarget) { return(true); } CurrentSpell = spell; CurrentSpellLocation = location; CombatDebug("*----------- INTO PRE CAST FOR " + CurrentSpell.Name); if (!CurrentSpell.KnownSpell || IsBackingUp || Me.CastingTimeLeft > buffer || !CurrentSpell.IsForcedCooldownReady || Me.IsStunned) { return(false); } // Define target if (onUnitFocus != null) { CurrentSpellTarget = onUnitFocus; } else if (CurrentSpellLocation != null) { CurrentSpellTarget = null; } else if (onSelf) { CurrentSpellTarget = ObjectManager.Me; } else { if (CurrentSpell.MaxRange <= 0 && ObjectManager.Target.GetDistance > RangeManager.GetMeleeRangeWithTarget()) { return(false); } CurrentSpellTarget = ObjectManager.Target; } // Now that we know the target if (CurrentSpellLocation == null) { if (CurrentSpellTarget == null || CurrentSpellTarget.GetDistance > 100 || (CurrentSpellTarget.IsDead && !CurrentSpell.OnDeadTarget) || (CurrentSpell.MinRange > 0 && CurrentSpellTarget.GetDistance <= CurrentSpell.MinRange) || UnitImmunities.Contains(CurrentSpellTarget, CurrentSpell.Name) || (!CurrentSpellTarget.IsValid && !CurrentSpell.OnDeadTarget)) // double check this { return(false); } } CombatDebug("*----------- INTO CAST FOR " + CurrentSpell.Name); // CHECK COST if (CurrentSpell.PowerType == -2 && Me.Health < CurrentSpell.Cost) { CombatDebug($"{CurrentSpell.Name}: Not enough health {CurrentSpell.Cost}/{Me.Health}, SKIPPING"); return(false); } else if (CurrentSpell.PowerType == 0 && Me.Mana < CurrentSpell.Cost) { CombatDebug($"{CurrentSpell.Name}: Not enough mana {CurrentSpell.Cost}/{Me.Mana}, SKIPPING"); return(false); } else if (CurrentSpell.PowerType == 1 && Me.Rage < CurrentSpell.Cost) { CombatDebug($"{CurrentSpell.Name}: Not enough rage {CurrentSpell.Cost}/{Me.Rage}, SKIPPING"); return(false); } else if (CurrentSpell.PowerType == 2 && ObjectManager.Pet.Focus < CurrentSpell.Cost) { CombatDebug($"{CurrentSpell.Name}: Not enough pet focus {CurrentSpell.Cost}/{ObjectManager.Pet.Focus}, SKIPPING"); return(false); } else if (CurrentSpell.PowerType == 3 && Me.Energy < CurrentSpell.Cost) { CombatDebug($"{CurrentSpell.Name}: Not enough energy {CurrentSpell.Cost}/{Me.Energy}, SKIPPING"); return(false); } // DON'T CAST BECAUSE WANDING if (WandSpell != null && ToolBox.UsingWand() && !stopWandAndCast) { CombatDebug("Didn't cast because we were wanding"); return(false); } // COOLDOWN CHECKS float _spellCD = CurrentSpell.GetCurrentCooldown; CombatDebug($"Cooldown is {_spellCD}"); if (_spellCD >= 500) { CombatDebug("Didn't cast because cd is too long"); return(false); } // STOP WAND FOR CAST if (WandSpell != null && ToolBox.UsingWand() && stopWandAndCast) { StopWandWaitGCD(WandSpell); } // Wait for remaining Cooldown if (_spellCD > 0f && _spellCD < buffer) { CombatDebug($"{CurrentSpell.Name} is almost ready, waiting"); while (CurrentSpell.GetCurrentCooldown > 0 && CurrentSpell.GetCurrentCooldown < 500) { Thread.Sleep(50); } Thread.Sleep(50); // safety } if (!CurrentSpell.IsSpellUsable) { CombatDebug("Didn't cast because spell somehow not usable"); return(false); } bool stopMove = CurrentSpell.CastTime > 0 || CurrentSpell.IsChannel; if (CurrentSpellLocation != null || CurrentSpellTarget.Guid != Me.Guid) { Vector3 spellPosition = CurrentSpellLocation != null ? CurrentSpellLocation : CurrentSpellTarget.Position; if (CurrentSpell.MaxRange > 0 && spellPosition.DistanceTo(Me.Position) > CurrentSpell.MaxRange || TraceLine.TraceLineGo(spellPosition)) { if (Me.HaveBuff("Spirit of Redemption")) { return(false); } Logger.LogFight($"Target not in range/sight, recycling {CurrentSpell.Name}"); if (Fight.InFight) { IsApproachingTarget = true; } else { ApproachSpellTarget(); } return(true); } } if (onUnitFocus != null) { ObjectManager.Me.FocusGuid = CurrentSpellTarget.Guid; } string unit = onUnitFocus != null ? "focus" : "target"; unit = onSelf || CurrentSpellLocation != null ? "player" : unit; // Wait for remaining cast in case of buffer while (Me.CastingTimeLeft > 0) { Thread.Sleep(25); } if (stopMove) { MovementManager.StopMoveNewThread(); } if (CombatLogON) { string rankString = CurrentSpell.Rank > 0 ? $"(Rank {CurrentSpell.Rank})" : ""; string target = CurrentSpellLocation != null?CurrentSpellLocation.ToString() : CurrentSpellTarget.Name; Logger.Log($"[Spell] Casting {CurrentSpell.Name.Replace("()", "")} {rankString} on {target}"); } CurrentSpell.Launch(stopMove, false, true, unit); if (CurrentSpell.IsClickOnTerrain) { ClickOnTerrain.Pulse(CurrentSpellLocation); } Thread.Sleep(50); ToolBox.ClearCursor(); // Wait for channel to end if (CurrentSpell.IsChannel) { CombatDebug($"{CurrentSpell.Name} is channel, wait cast"); while (ToolBox.GetChannelTimeLeft("player") < 0) { Thread.Sleep(50); } CurrentSpell.StartForcedCooldown(); return(true); } // Wait for instant cast GCD if (CurrentSpell.CastTime <= 0) { CurrentSpell.StartForcedCooldown(); Timer gcdLimit = new Timer(1500); CombatDebug($"{CurrentSpell.Name} is instant, wait GCD"); while (DefaultBaseSpell.GetCurrentCooldown > buffer && !gcdLimit.IsReady) { Thread.Sleep(50); } if (gcdLimit.IsReady) { Logger.LogError("We had to resort to timer wait (GCD)"); } return(true); } if (CurrentSpell.CastTime > 0) { // Wait for cast to end buffer = CurrentSpell.PreventDoubleCast ? 0 : buffer; CombatDebug($"{CurrentSpell.Name} is normal, wait until {buffer} left"); while (Me.CastingTimeLeft > buffer) { if (CurrentSpell.IsResurrectionSpell && CurrentSpellTarget.IsAlive) { Lua.RunMacroText("/stopcasting"); } Thread.Sleep(50); } CurrentSpell.StartForcedCooldown(); } return(true); }
/// <summary> /// Creates a new instance of the <see cref="WoWSpell"/> class. /// </summary> /// <param name="spellNameEnglish">The spell name.</param> /// <param name="cooldownTimer">The cooldown time.</param> public WoWSpell(string spellNameEnglish, double cooldownTimer) : base(spellNameEnglish) { // Set timer this._timer = new Timer(cooldownTimer); }