示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }