Hi everyone reading this post!
I'm a WoWaholic. Since I've got some free time I've decided to write a simple bot, even try (besides I was banned for using HB it is very interesting for me)
For a couple weeks of my researches I have a working skeleton, it can move, see objects around, cast spells etc and I admire it!)
Thank you all for information and samples that was given on this forum!
But It's time for a question. All my attempts to interact with objects/units have failed. I've spent two days trying to get out and understood I need help.
I tried two different ways (wow 7.1.5 current ver):
1) using CGPlayer_C__ClickToMove with ClickTypes: 0x5 (Interact with NPC) and 0x7 (Interact with Object) and 128bit integer GUID
For movement it is working perfect (so offsets are correct) but does nothing when I assume it to interact. I was trying to interact with neutral NPC like inkeepers or repair.
my code for CTM:
Code:
private void CTM(Single x, Single y, Single z, UInt128 guid, Int32 clickType, Single precision)
{
var coordinatesCodecave = _wowHook.Memory.AllocateMemory(0x4 * 3);
var guidCodecave = _wowHook.Memory.AllocateMemory(0x10);
var precisionCodecave = _wowHook.Memory.AllocateMemory(0x4);
_wowHook.Memory.WriteBytes(guidCodecave, guid.ToByteArray());
_wowHook.Memory.WriteBytes(precisionCodecave, BitConverter.GetBytes(precision));
_wowHook.Memory.WriteBytes(coordinatesCodecave, BitConverter.GetBytes(x));
_wowHook.Memory.WriteBytes(coordinatesCodecave + 0x4, BitConverter.GetBytes(y));
_wowHook.Memory.WriteBytes(coordinatesCodecave + 0x8, BitConverter.GetBytes(z));
string[] asm = new[]
{
"call " +
(_wowHook.Process.BaseOffset() + (uint) Offsets.ClntObjMgrGetActivePlayerObj),
"test eax, eax",
"je @out",
"push " + precisionCodecave,
"push " + coordinatesCodecave,
"push " + guidCodecave,
"push " + clickType,
"mov ecx, eax",
"call " + (_wowHook.Process.BaseOffset() + (uint) Offsets.CGUnit_C__InitializeTrackingState),
"@out:",
"retn"
};
_wowHook.InjectAndExecute(asm);
_wowHook.Memory.FreeMemory(coordinatesCodecave);
_wowHook.Memory.FreeMemory(guidCodecave);
_wowHook.Memory.FreeMemory(precisionCodecave);
}
}
for NPC interact call like
Code:
CTM(target.Position.X, target.Position.Y, target.Position.Z, target.Guid, 0x5, 0.5f);
2) using CGUnit_C__Interact with GUID (current offset 0x53102, newer worked for me, toon doesn't interact, but WOW internal function triggers for sure (attached IDA for debugging) )
Code:
public void Interact(WoWUnit unit)
{
var guidCodecave = _wowHook.Memory.AllocateMemory(0x10);
_wowHook.Memory.WriteBytes(guidCodecave, unit.Guid.ToByteArray());
string[] asm = new[]
{
"call " +
(_wowHook.Process.BaseOffset() + (uint) Offsets.ClntObjMgrGetActivePlayerObj),
"test eax, eax",
"je @out",
"push " + guidCodecave,
"mov ecx, eax",
"call " + (_wowHook.Process.BaseOffset() + (uint) Offsets.CGUnit_C__Interact),
"@out:",
"retn"
};
_wowHook.InjectAndExecute(asm);
_wowHook.Memory.FreeMemory(guidCodecave);
}
May be there is some trick I don't know about to make Interaction working.
Thank you in advance!