Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GetUnitAttackPlayer overload

Featured Replies

What exactly does ObjectManager.GetUnitAttackPlayer(List<WoWUnit>); method does? Simple one is obvious: rets list of attacking our player mobs, but whats about that list passing into? Im seeking a way to handle sort of "tanking" profile, and want to get mobs which are not aggroed by me, but someone from party to get them off from other party members. I thought this method is a key, casted Party to WoWUnit list, and getting empty list after call after return in any cases, even when party member got aggro.

Hello @Ke1ka, i had also problems to getting a list from party, so i made a similar method to acquire a general list from objectmanager:

If a hostile npc doesn't target the tank (not tested):

    public static List<WoWUnit> GetNoAggroUnits(float range)
    {
        WoWLocalPlayer me = ObjectManager.Me;
        List<WoWUnit> u = new List<WoWUnit>();
        Parallel.ForEach(ObjectManager.GetWoWUnitHostile(), delegate(WoWUnit unit)
        {
            if (unit.Target != me.Guid
            && unit.Target != 0
            && unit.InCombat
            && unit.IsAlive
            && unit.GetDistance < range
            && !TraceLine.TraceLineGo(unit.Position, me.Position)) //slow part
            {
                u.Add(unit);
            }
        });
        return u.OrderBy(i => i.TargetObject.HealthPercent).ToList();//first object in the returned list will contain the target with the lowest health
    }

You could also do something like this:

    public static List<WoWUnit> GetNoAggroUnitsExplicit(float range)
    {
        WoWLocalPlayer me = ObjectManager.Me;
        var u = new List<WoWUnit>();
        var p = ObjectManager.GetObjectWoWPlayer().Where(woWPlayer => woWPlayer.PlayerFaction == me.PlayerFaction && woWPlayer.IsAlive).Select(i => i.Guid);
        Parallel.ForEach(ObjectManager.GetWoWUnitHostile(), delegate (WoWUnit unit)
        {
            if (p.Contains(unit.Target)
            && unit.Target != 0
            && unit.InCombat
            && unit.IsAlive
            && unit.GetDistance < range
            && !TraceLine.TraceLineGo(unit.Position, me.Position)) //slow part
            {
                u.Add(unit);
            }
        });
        return u.OrderBy(i => i.TargetObject.HealthPercent).ToList();
    }

But i don't think that's necessary, except you would use a party / raid list as "p" (which didn't worked for me last time).

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.