public static bool CanWeCheckAutoCastForAnyOfThese(params string[] spells) { if (!StyxWoW.Me.GotAlivePet) { return(false); } if (spells == null || !spells.Any()) { return(false); } if (StyxWoW.Me.PetSpells == null) { return(false); } HashSet <string> taunt = new HashSet <string>(spells); WoWPetSpell ps = StyxWoW.Me.PetSpells.FirstOrDefault(s => s.Spell != null && taunt.Contains(s.Spell.Name)); if (ps == null) { return(false); } bool allowed; bool active = PetManager.IsAutoCast(ps, out allowed); if (!allowed) { return(false); } return(true); }
private static bool HandleAutoCastForSpell(string spellName) { WoWPetSpell ps = StyxWoW.Me.PetSpells.FirstOrDefault(s => s.ToString() == spellName); // Disable pet growl in instances but enable it outside. if (ps == null) { Logger.WriteDebug("PetManager: '{0}' is NOT an ability known by this Pet", spellName); } else { bool allowed; bool active = PetManager.IsAutoCast(ps, out allowed); if (!allowed) { Logger.Write(LogColor.Hilite, "PetManager: '{0}' is NOT an auto-cast ability for this Pet", spellName); } else { if (SingularRoutine.CurrentWoWContext == WoWContext.Instances) { if (!active) { Logger.Write(LogColor.Hilite, "PetManager: '{0}' Auto-Cast Already Disabled", spellName); } else { Logger.Write(LogColor.Hilite, "PetManager: Disabling '{0}' Auto-Cast", spellName); Lua.DoString("DisableSpellAutocast(GetSpellInfo(" + ps.Spell.Id + "))"); } } else { if (active) { Logger.Write(LogColor.Hilite, "PetManager: '{0}' Auto-Cast Already Enabled", spellName); } else { Logger.Write(LogColor.Hilite, "PetManager: Enabling '{0}' Auto-Cast", spellName); Lua.DoString("EnableSpellAutocast(GetSpellInfo(" + ps.Spell.Id + "))"); } } return(true); } } return(false); }