/// <summary> /// Checks to see the specified unit is not present in our current List of HealableUnits /// </summary> /// <param name="unit">the unit to check for</param> public static bool Contains(WoWUnit unit) { try { var grp = ListofHealableUnits.ToList(); return(grp.Any(n => n != null && (unit != null && n.ToUnit().Guid == unit.Guid))); } catch (Exception ex) { CLULogger.DiagnosticLog("Contains : {0}", ex); } return(false); }
/// <summary> /// Pulse /// </summary> public static void Pulse() { try { if (CLU.IsHealerRotationActive && StyxWoW.IsInGame) { Add(); Remove(); } } catch (Exception ex) { CLULogger.DiagnosticLog("HealableUnit Pulse : {0}", ex); } }
/// <summary> /// checks to see if the specified key has been pressed within wow. /// </summary> /// <param name="key">The key to check for (see Keyboardfunctions)</param> /// <returns>true if the player has pressed the key</returns> private static bool IsKeyDown(Keyboardfunctions key) { try { if (key == Keyboardfunctions.Nothing) { return(false); } var raw = Lua.GetReturnValues("if " + key.ToString("g") + "() then return 1 else return 0 end"); return(raw[0] == "1"); } catch { CLULogger.DiagnosticLog("Lua failed in IsKeyDown" + key.ToString("g")); return(false); } }
/// <summary> /// Filter for Healable Unit /// </summary> /// <param name="unit">the unit to check</param> /// <returns>returns true if the unit meets the requirements to be a HealableUnit</returns> public static bool Filter(WoWUnit unit) { try { if (unit != null && unit.IsMe) { return(true); // im always valid..bazinga :P } return(unit != null && (unit.IsValid && unit.ToPlayer().IsAlive&& !unit.ToPlayer().IsGhost&& unit.ToPlayer().IsPlayer&& unit.ToPlayer() != null && !unit.ToPlayer().IsFlying&& !unit.ToPlayer().OnTaxi&& unit.Distance2DSqr < 40 * 40)); } catch (Exception ex) { CLULogger.DiagnosticLog("Filter : {0}", ex); } return(false); }
private static void Logpartymatchs(string s, params object[] a) { CLULogger.DiagnosticLog(s, a); }
/// <summary> /// Finds units within range of each other that need healing /// </summary> /// <param name="minAverageHealth">Minimum Average health of the Party Members</param> /// <param name="maxAverageHealth">MaximumAverage health of the Party Members</param> /// <param name="maxDistanceBetweenPlayers">The maximum distance between other members from the targeted member</param> /// <param name="minUnits">Minumum units to be affected</param> /// <param name="label">A descriptive label for the clients GUI logging output</param> /// <returns>A Riad/Party member</returns> private Composite FindAreaHealSubroutine(int minAverageHealth, int maxAverageHealth, float maxDistanceBetweenPlayers, int minUnits, string label) { return(new Action(a => { var targetAreaPerformanceTimer = new Stopwatch(); // lets see if we can get some performance on this one. targetAreaPerformanceTimer.Start(); // lets see if we can get some performance on this one // copy List <HealableUnit> grp = HealableUnit.ListofHealableUnits.ToList(); // gtfo if there is no heal list. if (!grp.Any()) { HealableUnit.HealTarget = null; return RunStatus.Failure; } // setup a quick filter and exctract our players. RefineFilter refineFilter = x => x.ToUnit().Location.DistanceSqr(Me.Location) < 40 * 40 && ObjectManager.ObjectList.Any(y => y.Guid == x.ToUnit().Guid) && x.ToUnit().IsAlive&& !x.ToUnit().ToPlayer().IsGhost&& x.ToUnit().IsPlayer&& x.ToUnit().ToPlayer() != null && !x.ToUnit().IsFlying&& !x.ToUnit().OnTaxi; var players = grp.Where(x => refineFilter(x) && !x.Blacklisted && !x.ToUnit().HasAura("Deep Corruption")); // Nothing to heal. if (!players.Any()) { { HealableUnit.HealTarget = null; return RunStatus.Failure; } } HealableUnit best = null; int score = minUnits - 1; foreach (var player in players) { var hits = players.Where(p => p.Location.Distance2DSqr(player.Location) < maxDistanceBetweenPlayers * maxDistanceBetweenPlayers); if (hits.Any()) { var avgHealth = hits.Average(p => p.CurrentHealth * 100 / p.MaxHealth); var count = hits.Count(); if (avgHealth >= minAverageHealth && avgHealth < maxAverageHealth && count > score) { best = player; score = count; } } } if (best != null) { Logparty(label + " Time Taken: " + targetAreaPerformanceTimer.ElapsedMilliseconds + " ms", CLULogger.SafeName(best.ToUnit())); //best.ToUnit().Target(); HealableUnit.HealTarget = best; return RunStatus.Success; } HealableUnit.HealTarget = null; return RunStatus.Failure; })); }
/// <summary> /// Remove invalid healableunits. /// </summary> public static void Remove() { try { if (Adding) { return; } Removing = true; var grp = ListofHealableUnits.Where(n => !HealableUnit.Filter(n.ToUnit())).ToList(); foreach (var unit in grp.Where(unit => ListofHealableUnits.IndexOf(unit) != -1)) { ListofHealableUnits.RemoveAt(ListofHealableUnits.IndexOf(unit)); // remove CLULogger.TroubleshootLog(" Success Removed: {0} no longer a valid healableunit.", CLULogger.SafeName(unit.ToUnit())); } Removing = false; } catch (Exception ex) { CLULogger.DiagnosticLog("Remove : {0}", ex); } }
/* putting all the Keybind logic here */ // Sounds from http://www2.research.att.com/~ttsweb/tts/demo.php internal static void Pulse() { // KeybindUseCooldowns \\ if (IsKeyDown(CLUSettings.Instance.KeybindUseCooldowns)) { switch (CLUSettings.Instance.UseCooldowns) { case true: CLUSettings.Instance.UseCooldowns = !CLUSettings.Instance.UseCooldowns; CLULogger.Log(" UseCooldowns= {0}", CLUSettings.Instance.UseCooldowns); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\cooldownsdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.UseCooldowns = !CLUSettings.Instance.UseCooldowns; CLULogger.Log(" UseCooldowns= {0}", CLUSettings.Instance.UseCooldowns); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\cooldownsenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindClickExtraActionButton \\ if (IsKeyDown(CLUSettings.Instance.KeybindClickExtraActionButton)) { switch (CLUSettings.Instance.ClickExtraActionButton) { case true: CLUSettings.Instance.ClickExtraActionButton = !CLUSettings.Instance.ClickExtraActionButton; CLULogger.Log(" ClickExtraActionButton= {0}", CLUSettings.Instance.ClickExtraActionButton); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\dsextraactionbuttondisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.ClickExtraActionButton = !CLUSettings.Instance.ClickExtraActionButton; CLULogger.Log(" ClickExtraActionButton= {0}", CLUSettings.Instance.ClickExtraActionButton); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\dsextraactionbuttonenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindUseAoEAbilities \\ if (IsKeyDown(CLUSettings.Instance.KeybindUseAoEAbilities)) { switch (CLUSettings.Instance.UseAoEAbilities) { case true: CLUSettings.Instance.UseAoEAbilities = !CLUSettings.Instance.UseAoEAbilities; CLULogger.Log(" UseAoEAbilities= {0}", CLUSettings.Instance.UseAoEAbilities); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\aoeabilitiesdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.UseAoEAbilities = !CLUSettings.Instance.UseAoEAbilities; CLULogger.Log(" UseAoEAbilities= {0}", CLUSettings.Instance.UseAoEAbilities); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\aoeabilitiesenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindEnableRaidPartyBuffing \\ if (IsKeyDown(CLUSettings.Instance.KeybindEnableRaidPartyBuffing)) { switch (CLUSettings.Instance.EnableRaidPartyBuffing) { case true: CLUSettings.Instance.EnableRaidPartyBuffing = !CLUSettings.Instance.EnableRaidPartyBuffing; CLULogger.Log(" EnableRaidPartyBuffing= {0}", CLUSettings.Instance.EnableRaidPartyBuffing); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\raidandpartybuffingdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.EnableRaidPartyBuffing = !CLUSettings.Instance.EnableRaidPartyBuffing; CLULogger.Log(" EnableRaidPartyBuffing= {0}", CLUSettings.Instance.EnableRaidPartyBuffing); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\raidandpartybuffingenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindEnableInterupts \\ if (IsKeyDown(CLUSettings.Instance.KeybindEnableInterupts)) { switch (CLUSettings.Instance.EnableInterupts) { case true: CLUSettings.Instance.EnableInterupts = !CLUSettings.Instance.EnableInterupts; CLULogger.Log(" EnableInterupts= {0}", CLUSettings.Instance.EnableInterupts); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\interuptsdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.EnableInterupts = !CLUSettings.Instance.EnableInterupts; CLULogger.Log(" EnableInterupts= {0}", CLUSettings.Instance.EnableInterupts); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\interuptsenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindHealDefensiveManagement \\ if (IsKeyDown(CLUSettings.Instance.KeybindHealEnableSelfHealing)) { switch (CLUSettings.Instance.EnableSelfHealing) { case true: CLUSettings.Instance.EnableSelfHealing = !CLUSettings.Instance.EnableSelfHealing; CLULogger.Log(" EnableSelfHealing= {0}", CLUSettings.Instance.EnableSelfHealing); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\selfhealingdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.EnableSelfHealing = !CLUSettings.Instance.EnableSelfHealing; CLULogger.Log(" EnableSelfHealing= {0}", CLUSettings.Instance.EnableSelfHealing); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\selfhealingenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindEnableMultiDotting \\ if (IsKeyDown(CLUSettings.Instance.KeybindEnableMultiDotting)) { switch (CLUSettings.Instance.EnableMultiDotting) { case true: CLUSettings.Instance.EnableMultiDotting = !CLUSettings.Instance.EnableMultiDotting; CLULogger.Log(" EnableMultiDotting= {0}", CLUSettings.Instance.EnableMultiDotting); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\multidottingdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.EnableMultiDotting = !CLUSettings.Instance.EnableMultiDotting; CLULogger.Log(" EnableMultiDotting= {0}", CLUSettings.Instance.EnableMultiDotting); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\multidottingenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindPauseRotation \\ if (IsKeyDown(CLUSettings.Instance.KeybindPauseRotation)) { switch (CLUSettings.Instance.PauseRotation) { case true: CLUSettings.Instance.PauseRotation = !CLUSettings.Instance.PauseRotation; CLULogger.Log(" PauseRotation= {0}", CLUSettings.Instance.PauseRotation); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\rotationenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.PauseRotation = !CLUSettings.Instance.PauseRotation; CLULogger.Log(" PauseRotation= {0}", CLUSettings.Instance.PauseRotation); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\rotationpaused.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindChakraStanceSelection \\ if (IsKeyDown(CLUSettings.Instance.KeybindChakraStanceSelection)) { switch (CLUSettings.Instance.Priest.ChakraStanceSelection) { case ChakraStance.Sanctuary: CLUSettings.Instance.Priest.ChakraStanceSelection = ChakraStance.Serenity; CLULogger.Log(" ChakraStanceSelection= {0}", CLUSettings.Instance.Priest.ChakraStanceSelection); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\chakraserenity.wav"); SoundManager.SoundPlay(); } catch { } } break; case ChakraStance.Serenity: CLUSettings.Instance.Priest.ChakraStanceSelection = ChakraStance.Sanctuary; CLULogger.Log(" ChakraStanceSelection= {0}", CLUSettings.Instance.Priest.ChakraStanceSelection); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\chakrasanctuary.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindEnableMovement \\ if (IsKeyDown(CLUSettings.Instance.KeybindEnableMovement)) { switch (CLUSettings.Instance.EnableMovement) { case true: CLUSettings.Instance.EnableMovement = !CLUSettings.Instance.EnableMovement; CLULogger.Log(" EnableMovement= {0}", CLUSettings.Instance.EnableMovement); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\movementdisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.EnableMovement = !CLUSettings.Instance.EnableMovement; CLULogger.Log(" EnableMovement= {0}", CLUSettings.Instance.EnableMovement); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\movementenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } // KeybindEnableFists \\ if (IsKeyDown(CLUSettings.Instance.KeybindEnableFists)) { switch (CLUSettings.Instance.Monk.EnableFists) { case true: CLUSettings.Instance.Monk.EnableFists = !CLUSettings.Instance.Monk.EnableFists; CLULogger.Log(" EnableFists= {0}", CLUSettings.Instance.Monk.EnableFists); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\fistsoffurydisabled.wav"); SoundManager.SoundPlay(); } catch { } } break; case false: CLUSettings.Instance.Monk.EnableFists = !CLUSettings.Instance.Monk.EnableFists; CLULogger.Log(" EnableFists= {0}", CLUSettings.Instance.Monk.EnableFists); if (CLUSettings.Instance.EnableKeybindSounds) { try { SoundManager.LoadSoundFilePath(@"\Routines\CLU\Sound\fistsoffuryenabled.wav"); SoundManager.SoundPlay(); } catch { } } break; default: return; } } }
public static void Initialize() { // Check for LazyRaider and Disable movement if (BotBaseInUse("LazyRaider")) { CLUSettings.Instance.EnableMovement = false; CLUSettings.Instance.BurstOn = Burst.onBoss; CLULogger.Log(" [BotChecker] LazyRaider Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON BOSS SET*"); } // Check for Raid Bot and Disable movement if (BotBaseInUse("Tyrael")) { CLUSettings.Instance.EnableMovement = false; CLUSettings.Instance.BurstOn = Burst.onBoss; CLULogger.Log(" [BotChecker] Tyrael Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON BOSS SET*"); } // Check for Raid Bot and Disable movement if (BotBaseInUse("Raid Bot")) { CLUSettings.Instance.EnableMovement = false; CLUSettings.Instance.BurstOn = Burst.onBoss; CLULogger.Log(" [BotChecker] Raid Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON BOSS SET*"); } // Check for Combat Bot and Disable movement if (BotBaseInUse("Combat Bot")) { CLUSettings.Instance.EnableMovement = false; CLUSettings.Instance.BurstOn = Burst.onBoss; CLULogger.Log(" [BotChecker] Combat Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON BOSS SET*"); } // Check for BGBuddy and MultiDotting if (BotBaseInUse("BGBuddy")) { CLUSettings.Instance.EnableMultiDotting = false; CLUSettings.Instance.Rogue.UseTricksOfTheTrade = false; CLUSettings.Instance.Rogue.UseTricksOfTheTradeForce = false; CLUSettings.Instance.EnableMovement = true; CLUSettings.Instance.BurstOn = Burst.onBoss; CLULogger.Log(" [BotChecker] BGBuddy Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT ENABLED*"); CLULogger.Log(" [BotChecker] *MULTI-DOTTING DISABLED*"); CLULogger.Log(" [BotChecker] *TotT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON BOSS SET*"); } // Check for Questing if (BotBaseInUse("Questing")) { CLUSettings.Instance.EnableMultiDotting = false; CLUSettings.Instance.EnableMovement = true; CLUSettings.Instance.BurstOn = Burst.onMob; CLULogger.Log(" [BotChecker] Questing Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT ENABLED*"); CLULogger.Log(" [BotChecker] *MULTI-DOTTING DISABLED*"); CLULogger.Log(" [BotChecker] *TotT DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON MOB SET*"); CLULogger.Log(" [BotChecker] *BURST ON MOB COUNT = " + CLUSettings.Instance.BurstOnMobCount + "*"); } // Check for Grind Bot if (BotBaseInUse("Grind Bot")) { CLUSettings.Instance.EnableMultiDotting = false; CLUSettings.Instance.EnableMovement = true; CLUSettings.Instance.BurstOn = Burst.onMob; CLULogger.Log(" [BotChecker] Grind Bot Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT ENABLED*"); CLULogger.Log(" [BotChecker] *MULTI-DOTTING DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON MOB SET*"); CLULogger.Log(" [BotChecker] *BURST ON MOB COUNT = " + CLUSettings.Instance.BurstOnMobCount + "*"); } // Check for Gatherbuddy2 if (BotBaseInUse("Gatherbuddy2")) { CLUSettings.Instance.EnableMultiDotting = false; CLUSettings.Instance.EnableMovement = true; CLUSettings.Instance.BurstOn = Burst.onMob; CLULogger.Log(" [BotChecker] Gatherbuddy2 Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT ENABLED*"); CLULogger.Log(" [BotChecker] *MULTI-DOTTING DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON MOB SET*"); CLULogger.Log(" [BotChecker] *BURST ON MOB COUNT = " + CLUSettings.Instance.BurstOnMobCount + "*"); } // Check for ArchaeologyBuddy if (BotBaseInUse("ArchaeologyBuddy")) { CLUSettings.Instance.EnableMultiDotting = false; CLUSettings.Instance.EnableMovement = true; CLUSettings.Instance.BurstOn = Burst.onMob; CLULogger.Log(" [BotChecker] ArchaeologyBuddy Bot Detected."); CLULogger.Log(" [BotChecker] *MOVEMENT ENABLED*"); CLULogger.Log(" [BotChecker] *MULTI-DOTTING DISABLED*"); CLULogger.Log(" [BotChecker] *BURST ON MOB SET*"); CLULogger.Log(" [BotChecker] *BURST ON MOB COUNT = " + CLUSettings.Instance.BurstOnMobCount + "*"); } }