/// <summary> /// gets a PartyBuff mask representing all categories of buffs missing /// </summary> /// <param name="unit">WoWUnit to check for missing buffs</param> /// <returns>PartyBuff mask representing all buffs that are missing</returns> public static PartyBuffType GetMissingPartyBuffs(this WoWUnit unit) { PartyBuffType buffMask = PartyBuffType.All; PartyBuffType buffs = GetPartyBuffs(unit); buffs = (~buffs) & buffMask; return(buffs); }
/// <summary> /// gets a PartyBuff mask representing all categories of buffs missing /// </summary> /// <param name="unit">WoWUnit to check for missing buffs</param> /// <returns>PartyBuff mask representing all buffs that are missing</returns> public static PartyBuffType GetMissingPartyBuffs(this WoWUnit unit) { PartyBuffType buffMask = PartyBuffType.Stats | PartyBuffType.Stamina | PartyBuffType.AttackPower | PartyBuffType.SpellPower | PartyBuffType.Haste | PartyBuffType.SpellHaste | PartyBuffType.Crit | PartyBuffType.Mastery; PartyBuffType buffs = GetPartyBuffs(unit); buffs = (~buffs) & buffMask; return(buffs); }
/// <summary> /// gets a PartyBuff mask representing all categories of buffs present /// </summary> /// <param name="unit">WoWUnit to check for buffs</param> /// <returns>PartyBuff mask representing all buffs founds</returns> public static PartyBuffType GetPartyBuffs(this WoWUnit unit) { PartyBuffType buffs = PartyBuffType.None; foreach (var a in unit.GetAllAuras()) { PartyBuffType bc = GetPartyBuffForSpell(a.Name); buffs |= bc; } return(buffs); }
/// <summary> /// check a WoWUnit for a particular PartyBuff enum /// </summary> /// <param name="unit">unit to check for buff</param> /// <param name="cat">buff to check for. may be a mask of multiple buffs if any will do, such as PartyBuff.Stats + PartyBuff.Mastery</param> /// <returns>true if any buff matching the mask in 'cat' is found, otherwise false</returns> public static bool HasPartyBuff(this WoWUnit unit, PartyBuffType cat) { foreach (var a in unit.GetAllAuras()) { PartyBuffType bc = GetPartyBuffForSpell(a.Name); if ((bc & cat) != PartyBuffType.None) { return(true); } } return(false); }
/// <summary> /// check a WoWUnit for a particular PartyBuff enum /// </summary> /// <param name="unit">unit to check for buff</param> /// <param name="cat">buff to check for. may be a mask of multiple buffs if any will do, such as PartyBuff.Stats + PartyBuff.Mastery</param> /// <returns>true if any buff matching the mask in 'cat' is found, otherwise false</returns> public static bool HasPartyBuff(this WoWUnit unit, PartyBuffType cat) { foreach (var a in unit.GetAllAuras()) { PartyBuffType bc = GetPartyBuffForSpell(a.Name); if ((bc & cat) != PartyBuffType.None) return true; } return false; }
public PartyBuffEntry( string n, PartyBuffType t) { Name = n; Type = t; }
public PartyBuffEntry(string n, PartyBuffType t) { Name = n; Type = t; }
/// <summary> /// checks group members in range if they have a buff providing the benefits /// that this spell does, and if not casts the buff upon them. understands /// similar buffs such as Blessing of Kings being same as Mark of the Wild. /// if not in a group, will treat Me as a group of one. /// Will not buff if Mounted unless during prep phase of a battleground /// </summary> /// <param name="name">spell name of buff</param> /// <param name="requirements">requirements delegate that must be true for cast to occur</param> /// <param name="myMutexBuffs">list of your buffs which are mutually exclusive to 'name'. For example, BuffGroup("Blessing of Kings", ret => true, "Blessing of Might") </param> /// <returns></returns> public static Composite BuffGroup(string name, SimpleBooleanDelegate requirements, params string[] myMutexBuffs) { return(new Decorator( ret => IsItTimeToBuff() && SpellManager.HasSpell(name) && (!StyxWoW.Me.Mounted || !PVP.IsPrepPhase), new Sequence( new DecoratorContinue( req => myMutexBuffs != null && myMutexBuffs.Count() > 0 && Unit.GroupMembers.Any(u => u.HasAnyOfMyAuras(myMutexBuffs) && u.Distance < Spell.ActualMaxRange(name, u)), new ActionAlwaysFail() ), new PrioritySelector( ctx => Unit.GroupMembers .FirstOrDefault(m => { if (!m.IsAlive || m.DistanceSqr > 30 * 30) { return false; } PartyBuffType missing = m.GetMissingPartyBuffs(); PartyBuffType bufftyp = GetPartyBuffForSpell(name); if (PartyBuffType.None == (missing & bufftyp)) { return false; } if (!Spell.CanCastHack(name, m)) { return false; } if (!requirements(ctx)) { return false; } Logger.WriteDiagnostic("BuffGroup: casting '{0}' since {1} missing {2}", name, m.SafeName(), missing & bufftyp ); if (SingularSettings.Debug) { Logger.WriteDebug("BuffGroup: === {0} has ===", m.SafeName()); foreach (var a in m.GetAllAuras()) { Logger.WriteDebug("BuffGroup: {0}{1}", a.CreatorGuid == StyxWoW.Me.Guid ? "*" : " ", a.Name ); } } return true; }), BuffUnit(name, ctx => (WoWUnit)ctx, req => true) ) ) )); }