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.

GetWoWUnitHostile for PVP

Featured Replies

ObjectManager.GetWoWUnitHostile is useful function in many cases. To select lowest HP enemy, to multi dot, etc. But useless in pvp, because returns List<WoWUnit> objects with WoWPlayer exclusion (there is woWObject.Type==WoWObjectType.Unit condition inside this function). So, proper GetWoWUnitHostile is:

public static List<WoWUnit> GetWoWPlayerHostile() {
  List<WoWUnit> result = new List<WoWUnit>();
  try {
    foreach (WoWObject woWObject in ObjectManager.ObjectList) {
      if (!woWObject.IsValid || woWObject.IsInvisible) continue;
      WoWUnit o;
      switch (woWObject.Type) {
      //case WoWObjectType.Unit:
      //  o = new WoWUnit(woWObject.GetBaseAddress);
      //  break;
      case WoWObjectType.Player:
        o = new WoWPlayer(woWObject.GetBaseAddress);
        break;
      default: continue;
      }
      if (woWObject.IsInvisible) continue;
      if (o.Reaction <= Reaction.Unfriendly && !o.IsDead) {
        result.Add(o);
      }
    }
  } catch (Exception arg) {
    Logging.WriteError("GetWoWPlayerHostile error " + arg, true);
  }
  return result;
}

public static List<WoWUnit> GetWoWUnitHostile() {
  List<WoWUnit> enemies = GetWoWPlayerHostile();
  if (enemies.Count == 0)
    enemies = ObjectManager.GetWoWUnitHostile();
  return enemies;
}

This function selects enemy players first, and if nothing found, selects hostile units.

I left some commented code in GetWoWPlayerHostile so you can see my 1st variant - 1 list with players and units together. But i think final variant is better for PVP and even for all cases

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.