Hello,
Concerning 1 thing, learn calling functions inside of WoW's process. That's not that hard and it gives you almost godlike powers. It will be probably good start for you to try calling function not via detour but via creating new thread in WoW's process, updating it's TLS and calling any function you need from it. Then looting will be much easier and better (confirming soul bound items).
Concerning 2 thing, I suppose wrong KEY_DOWN message sending to process or some kind of logic mistake (like fail distance checking or not taking Z axis into consideration at all). It's not known WoW bug
Just do some good logic and things will be fine. But first learn to call functions. So looting will go something like this:
Code:
private static void LootNPC(NpcObject npc)
{
ClickToMove(npc.XPosition, npc.YPosition, npc.ZPosition, 0, PushType.WalkTo);
WaitMovementEnds(player, intervalToCheck);
InteractUnit(npc.BaseAddress, MouseButton.Right);
Thread.Sleep(2000); //wait loot window to pop out or you can find if it is there by calling some lua
string lua = @"
cnt = GetNumLootItems()
if cnt == 0 then
CloseLoot()
else
for slot = 1, cnt do
LootSlot(slot)
ConfirmLootSlot(slot)
end
end";
LuaDoString(lua);
Thread.Sleep(2000); //same here, call some lua (check if loot window opened) to avoid waiting time
}
Though, with any kind of path finding and synchronization (so, without useless sleep time) things will go even better, or you'll need to implement lots of stable working logic, what is quite hard and it's double that hard if you are not able to call any function, until you can reverse almost any function.