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.

WoWPlayer.Attackable returns wrong values?

Featured Replies

Hi guys, Im trying to make pvp stuff for my own use with the bot

Ive noticed for example when I try to loop objectmanager to get Players arround me (not npc/units, real players). unit.Attackable should return true in duel for example or in arenas. but na it is not returning true, so I guess is wrong return value. Which would be the sense if adding Attackable extension if its same as checking faction or enemy. they are not enemies, we both same faction, but we are rivals sometimes like in arena, crossfaction bg or duels. so attackable should adapt to any situation that the unit become attackable imo.

Thanks

  • Author
7 hours ago, Droidz said:

Hi,

use lua 


Lua.LuaDoString<bool>("return UnitCanAttack('player', 'target')")

 

Hi @Droidz I already did that, the issue is that I actually need to control enemies Around me, not my particular target. I need to search all wow players around me and then filter them by ally and enemy. Target by wow api works good (a bit slow but works as intended). The thing is I need this to be able to check for Every Objectmanager unit that I find by memory reading, I cannot target each one of them, I need to get this value from the nontarget unit like I get IsPartyMember, IsAlive, etc...

Thanks

WoWPlayer player1 = ...;
bool canAttack = false;
var f = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid;
wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = player1.Guid;
if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == player1.Guid)
    canAttack = Lua.LuaDoString<bool>("return UnitCanAttack('player', 'focus')");
wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = f;
Logging.WriteDebug("Can attack = " + canAttack + " > " + player1);

try code like (no tested)

  • Author
11 minutes ago, Droidz said:

WoWPlayer player1 = ...;
bool canAttack = false;
var f = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid;
wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = player1.Guid;
if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == player1.Guid)
    canAttack = Lua.LuaDoString<bool>("return UnitCanAttack('player', 'focus')");
wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = f;
Logging.WriteDebug("Can attack = " + canAttack + " > " + player1);

try code like (no tested)

makes sense, i apreciate you take the time 
this code is an alternative to work with 2 units, target and focus, I like it. but, is there any way to work with more than 2 units at once?

like anyway to loop thru all units around localplayer and store them into friend and enemy list using similar method?
loop each one, focus each one and check?
something like localplayer range 40, each tick, focus all them quick and determine who is friend and who is enemy?

var playersAttackable = new List<wManager.Wow.ObjectManager.WoWPlayer>();
foreach (var player in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWPlayer())
{
    bool canAttack = false;
    var f = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid;
    wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = player.Guid;
    if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == player.Guid)
        canAttack = Lua.LuaDoString<bool>("return UnitCanAttack('player', 'focus')");
    wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = f;
    if (canAttack)
        playersAttackable.Add(player);
    Logging.WriteDebug("Can attack = " + canAttack + " > " + player); 
}

You can change focus several time

  • Author
15 hours ago, Droidz said:

var playersAttackable = new List<wManager.Wow.ObjectManager.WoWPlayer>();
foreach (var player in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWPlayer())
{
    bool canAttack = false;
    var f = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid;
    wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = player.Guid;
    if (wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid == player.Guid)
        canAttack = Lua.LuaDoString<bool>("return UnitCanAttack('player', 'focus')");
    wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = f;
    if (canAttack)
        playersAttackable.Add(player);
    Logging.WriteDebug("Can attack = " + canAttack + " > " + player); 
}

You can change focus several time

Thanks you alot, this is extremly useful

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.