What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Focus cast - searched with no luck

Nightskine

Member
Joined
Oct 30, 2010
Messages
150
Reaction score
1
Hi all,

I'm trying to cast spells on my focus target but am not having any luck.

I searched the forums and found this code but I couldnt get it to work for me.

Code:
public WoWUnit GetFocus
        {
            get
            {
                string name = Lua.GetReturnVal("return GetUnitName(\"" + "focus" + "\");",0);
                WoW units = ObjectManager.GetObjectsOfType(true, true).First((unit) => unit.Name == name && name != null && name != string.Empty && name.ToLower() != "nil");
                if (units != null)
                {
                    return units;
                }
                return null;
          }
        }

What i need is a code to return WoWPlayer as who ever my focus target is and null if i have no target so I could later call them by WoWPlayer p = GetFocus();

I appreciate any help since I've been stumped with this for quite a while now.

Thanks,

NightS
 
Code:
SpellManager.Cast("ImbaStrike", StyxWoW.Me.FocusedUnit);
 
i don't see anything like StyxWoW.Me.FocusedUnit in references, there is only SetFocus()

I'm using that:
Code:
private WoWUnit FocusTarget
{
    get
    {
    return ObjectManager.GetObjectByGuid<WoWUnit>( 
        ulong.Parse(
            Lua.GetReturnValues("return UnitGUID(\"focus\")")[0].Replace("0x", ""),
            System.Globalization.NumberStyles.HexNumber));
    }
}

Step by step:
1. Get unit's GUID from Lua (string representing hexadecimal number),
2. Cut the "0x",
3. Convert to ulong,
4. Get object by GUID,
 
latest hb release should have Me.FocusedUnit and Me.FocusedUnitGuid
 
Back
Top