/// <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); } }
/// <summary> /// Add HealableUnits that meet a criteria /// </summary> private static void Add() { try { if (Removing) { return; } Adding = true; switch (CLUSettings.Instance.SelectedHealingAquisition) { case HealingAquisitionMethod.Proximity: HealableUnitsByProximity(); break; case HealingAquisitionMethod.RaidParty: HealableUnitsByPartyorRaid(); break; } Adding = false; } catch (Exception ex) { CLULogger.DiagnosticLog("AddHealableUnits : {0}", ex); } }
/// <summary> /// Add HealableUnits to our List of HealableUnits for Party and Raid members /// </summary> public static void HealableUnitsByPartyorRaid() { try { var result = HealableUnits; listofHealableUnits.AddRange(result.Where(t => t != null).Select(t => t)); } catch (Exception ex) { CLULogger.DiagnosticLog("InitializeHealing HealableUnitsByPartyorRaid : {0}", ex); } }
/// <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); }