Originally Posted by
DarkLinux
Looks at mouse over interact...
Hmm...So I tried to look at the now restricted function InteractUnit in the wow api. Hex Rays has it shown like this:
Code:
signed int __cdecl Script_InteractUnit(int a1)
{
signed int result; // eax@2
char *v2; // esi@3
__int64 v3; // qax@4
int v4; // eax@5
int v5; // [sp+Ch] [bp-4h]@0
if ( lua_isstring(a1, 1) )
{
v2 = (char *)lua_tolstring(a1, 1, 0);
if ( strcasecmp(v2, "mouseover") )
{
v4 = FrameScript::GetParamValue(a1, 2, 0);
LODWORD(v3) = CGGameUI::ClosestObjectMatch(v2, 1, 0, v4, COERCE_INT(3.4028235e38), 0);
}
else
{
v3 = qword_AD5648;
}
if ( dword_9366B4 )
{
CGGameUI::ShowBlockedActionFeedback(0, 0);
result = 0;
}
else
{
if ( sub_4D7480(v3) )
{
lua_pushnumber(a1, 1.0);
result = 1;
}
else
{
lua_pushnil(a1);
result = 1;
}
}
}
else
{
luaL_error(a1, "Usage: InteractUnit(unitToken[, exactMatch])", v5);
result = 0;
}
return result;
}
I note that the first check is to see whether or not we are interacting with mouseover and if so to load the closest object match. The next check on dword_9366B4 leads me to believe the code is checking to see if normal code is trying to call this function since it is restricted aside from blizzard code. If not it calls the function sub_4D7480 on the object and if it returns true it will push the value of 1 as success. Looking at the function sub_4D7480 I get this:
Code:
void *__cdecl sub_4D7480(__int64 a1)
{
__int64 v1; // qax@1
void *v2; // eax@1
void *result; // eax@2
void *v4; // esi@4
int v5; // eax@6
LODWORD(v1) = ClntObjMgrGetActivePlayer();
v2 = ClntObjMgrObjectPtr(v1, TYPEMASK_PLAYER);
if ( !v2 || *((_BYTE *)v2 + 4105) & 0x40 )
{
result = (void *)1;
}
else
{
result = ClntObjMgrObjectPtr(a1, TYPEMASK_OBJECT);
v4 = result;
if ( result )
{
if ( *(_WORD *)(*((_DWORD *)result + 3) + 16) != 9
|| (v5 = *((_DWORD *)result + 583)) == 0
|| !(*(_DWORD *)(v5 + 12) & 0x20000000) )
CGGameUI::Target(a1);
(*(void (__thiscall **)(void *))(*(_DWORD *)v4 + 180))(v4);
result = (void *)1;
}
}
return result;
}
After studying this mess for quite awhile I couldn't seem to make heads or tails of an actual distance check on the "thing" that is being interacted with. Sorry to request so much spoonfeeding, but my reversing skills aren't quite up to par.