private static void GroupIncludeTargetsFilter(List <WoWObject> incomingUnits, HashSet <WoWObject> outgoingUnits) { WoWPartyMember.GroupRole myRole = GetGroupRoleAssigned(Me); if (myRole != WoWPartyMember.GroupRole.Tank) { foreach (var unit in incomingUnits.Select(obj => obj.ToUnit())) { if (unit.Combat && unit.GotTarget && unit.CurrentTarget.IsTargetingMyPartyMember) { continue; } outgoingUnits.Add(unit); } } else { if (!Me.Combat) { return; } foreach (var unit in incomingUnits.Select(obj => obj.ToUnit())) { if (unit.IsAlive && (unit.DistanceSqr > 30 * 30 || !unit.InLineOfSpellSight)) { continue; } outgoingUnits.Add(unit); } } }
public static WoWPartyMember.GroupRole GetGroupRoleAssigned(WoWPartyMember pm) { WoWPartyMember.GroupRole role = WoWPartyMember.GroupRole.None; if (pm != null) { role = (WoWPartyMember.GroupRole)((int)pm.Role & ROLEMASK); } return(role); }
public static WoWPartyMember.GroupRole GetGroupRoleAssigned(WoWPartyMember pm) { WoWPartyMember.GroupRole role = WoWPartyMember.GroupRole.None; if (pm != null && IsInGroup) { const int ROLEMASK = (int)WoWPartyMember.GroupRole.None | (int)WoWPartyMember.GroupRole.Tank | (int)WoWPartyMember.GroupRole.Healer | (int)WoWPartyMember.GroupRole.Damage; role = (WoWPartyMember.GroupRole)((int)pm.Role & ROLEMASK); } return(role); }
public static WoWPartyMember.GroupRole GetGroupRoleAssigned(WoWPlayer p) { WoWPartyMember.GroupRole role = WoWPartyMember.GroupRole.None; if (p != null && IsInGroup) { // GroupMemberInfos.FirstOrDefault(t => t.Guid == p.Guid); WoWPartyMember pm = new WoWPartyMember(p.Guid, true); if (pm != null) { role = GetGroupRoleAssigned(pm); } } return(role); }
/// <summary> /// Helper function to resurrenct a dead ally. /// </summary> private static async Task <bool> ResurrectDeadAlly(WoWPartyMember.GroupRole role) { var theDead = StyxWoW.Me.GroupInfo.RaidMembers .Where(o => o.Role == role && o.Dead && o.ToPlayer().Distance <= 30.0 ) .OrderBy(o => o.ToPlayer().Distance); if (role == WoWPartyMember.GroupRole.Tank && (!theDead.Any())) { // check on main/assist tanks just in case. theDead = StyxWoW.Me.GroupInfo.RaidMembers .Where(o => (o.IsMainTank || o.IsMainAssist || (int)o.Role == 50 || (int)o.Role == 51) && o.Dead && o.ToPlayer().Distance <= 30.0 ) .OrderBy(o => o.ToPlayer().Distance); } if (!theDead.Any()) { return(false); } var first = theDead.FirstOrDefault(); if (first == null) { return(false); } var deadPlayer = first.ToPlayer(); deadPlayer.Target(); if (!await Abilities.Cast <RebirthAbility>(deadPlayer)) { return(false); } Log.Gui(string.Format("Resurrected dead ally: {0} [{1}] (Role: {2}) [G: {3}]]", deadPlayer.SafeName, GuidToUnitId(deadPlayer.Guid), (int)role == 50 ? "LFR Tank" : role.ToString(), Me.GroupInfo.NumRaidMembers)); return(true); }
/// <summary> /// Helper function to heal a nearby ally. /// </summary> private async Task <bool> HealMyAlly <T>(WoWUnit ally, WoWPartyMember.GroupRole role, double minHealth) where T : IAbility { if (ally.HealthPercent < minHealth && ally.HealthPercent > 1.0) { var cachedHealth = ally.HealthPercent; // Will need to work on this a little, since coroutine does not happen immediately, // we may try and heal someone who's already dead by the time the coroutine kicks off if (await Abilities.Cast <T>(ally)) { Log.Diagnostics(string.Format("Healed the most hurt ally: {0} (Role: {1}) @ {2:0.##}% health [G: {3} R: {4}]", ally.SafeName, (int)role == 50 || (int)role == 51 ? "LFR Tank" : role.ToString(), cachedHealth, Me.GroupInfo.NumRaidMembers, LastKnownRejuvenatedAllies.Count)); return(true); } } return(false); }
public static WoWPartyMember.GroupRole GetGroupRoleAssigned(WoWPlayer p) { WoWPartyMember.GroupRole role = WoWPartyMember.GroupRole.None; if (p != null && IsInGroup) { if (p.IsMe) { role = (WoWPartyMember.GroupRole)((int)Me.Role & ROLEMASK); } else { WoWPartyMember pm = GroupMemberInfos.FirstOrDefault(t => t.Guid == p.Guid); if (pm != null) { role = GetGroupRoleAssigned(pm); } } } return(role); }
private static WoWContext _DetermineCurrentWoWContext() { if (!StyxWoW.IsInGame) { return(WoWContext.None); } if (ForcedContext != WoWContext.None) { if (_lastContext != ForcedContext) { Logger.Write(LogColor.Hilite, "Context: forcing use of {0} behaviors", ForcedContext); } return(ForcedContext); } Map map = StyxWoW.Me.CurrentMap; if (map.IsBattleground || map.IsArena) { if (_lastContext != WoWContext.Battlegrounds) { Logger.Write(LogColor.Hilite, "Context: using {0} behaviors since in battleground/arena", WoWContext.Battlegrounds); } return(WoWContext.Battlegrounds); } if (Me.IsInGroup()) { if (Me.IsInInstance) { if (_lastContext != WoWContext.Instances) { Logger.Write(LogColor.Hilite, "Context: using {0} behaviors since in group inside an Instance", WoWContext.Instances); } return(WoWContext.Instances); } const int ZONE_ASHRAN = 6941; const int ZONE_WINTERGRASP = 4197; if (Me.ZoneId == ZONE_ASHRAN || Me.ZoneId == ZONE_WINTERGRASP) { if (_lastContext != WoWContext.Battlegrounds) { Logger.Write(LogColor.Hilite, "Context: using {0} behaviors since in group in Zone: {1} #{2}", WoWContext.Battlegrounds, Me.RealZoneText, Me.ZoneId); } return(WoWContext.Battlegrounds); } // if (Group.Tanks.Any() || Group.Healers.Any()) const WoWPartyMember.GroupRole hasGroupRoleMask = WoWPartyMember.GroupRole.Healer | WoWPartyMember.GroupRole.Tank | WoWPartyMember.GroupRole.Damage; if ((Me.Role & hasGroupRoleMask) != WoWPartyMember.GroupRole.None) { if (_lastContext != WoWContext.Instances) { Logger.Write(LogColor.Hilite, "Context: using {0} behaviors since in group as {1}", WoWContext.Instances, Me.Role & hasGroupRoleMask); } return(WoWContext.Instances); } if (_lastContext != WoWContext.Normal) { Logger.Write(LogColor.Hilite, "Context: no Role assigned (Tank/Healer/Damage), so using Normal (SOLO) behaviors"); } return(WoWContext.Normal); } if (_lastContext != WoWContext.Normal) { Logger.Write(LogColor.Hilite, "Context: using Normal (SOLO) behaviors since not in group"); } return(WoWContext.Normal); }