Jump to content

Skygirl779

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Skygirl779

  1. 7 hours ago, reapler said:

    This should gonna do its work:

    
        public void Target(ulong guid)
        {
            wManager.Wow.Helpers.Lua.RunMacroText("/target "+wManager.Wow.ObjectManager.ObjectManager.GetObjectByGuid(guid)?.Name+"");
        }

    Edit: i reconsider my answer, this may not be a ideal solution.

     

    If you gonna look at the interact function in WRobot, you'll notice it's a direct function call via asm.

    So another solution would be to overwrite the guid from the local player's focus and target it via lua:

    
        public void Target(WoWObject obj)
        {
            var tmp = ObjectManager.Me.FocusGuid;
            ObjectManager.Me.FocusGuid = obj.Guid;
            Lua.RunMacroText("/target focus");
            ObjectManager.Me.FocusGuid = tmp;
        }
    
        public void Target(ulong guid)
        {
            var tmp = ObjectManager.Me.FocusGuid;
            ObjectManager.Me.FocusGuid = guid;
            Lua.RunMacroText("/target focus");
            ObjectManager.Me.FocusGuid = tmp;
        }

    Usage:

    
            var firstOrDefault = ObjectManager.GetObjectWoWUnit().OrderBy(i => i.GetDistance).FirstOrDefault();
            if (firstOrDefault != null)
                Target(firstOrDefault.Guid);

     

    Thank you very much! The focus target is a working solution for me.

    That said, it's not perfect; is there an API that allows me to safely call WoW functions from wRobot? I have the necessary technical knowledge, I just don't know how to get wRobot to execute asm in WoW's main thread.

×
×
  • Create New...