Interact with object/unit menu

User Tag List

Results 1 to 3 of 3
  1. #1
    derbenzin's Avatar Member
    Reputation
    10
    Join Date
    Feb 2016
    Posts
    5
    Thanks G/R
    6/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Interact with object/unit

    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!

    Interact with object/unit
  2. Thanks Corthezz (1 members gave Thanks to derbenzin for this useful post)
  3. #2
    squiggy's Avatar Active Member
    Reputation
    66
    Join Date
    Aug 2007
    Posts
    45
    Thanks G/R
    40/23
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi, I have only worked on 2.4.3 patch so i dont know how things differ on the current retail build and i havent got access to the binary atm. I will share what i know even if it might be obvious in case it may help you.

    ctm approach:

    Ive never used this for interaction but iirc when researching this approach for my own bot i read that this will only work if youre at a distance so the ctm would start moving and then interact when it arrived. If ive understood it correctly it will not work if your already at interaction distance, which is why i decided not to bother with it. Dont take this as fact though, it was well over half a year ago i read up on it but I believe there was something peculiar like that associated with the function.

    youre asm looks right to me although im not sure if the precision param should be a pointer.

    I think calling the interact function is the better approach but im not familiar with its workings on retail so im not gonna bother guessing whats wrong with it. Hope this answer wasnt completely useless to you, good luck
    Last edited by squiggy; 02-11-2017 at 09:05 AM.

  4. Thanks derbenzin, Corthezz (2 members gave Thanks to squiggy for this useful post)
  5. #3
    derbenzin's Avatar Member
    Reputation
    10
    Join Date
    Feb 2016
    Posts
    5
    Thanks G/R
    6/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've solved this problem. But it was real brainfu**ing!

    All functions work well, the mistake was in how I've handled GUID.
    I use GrayMagic for my project and when I've read on forum that GUID for now is UInt128 I just googled for UInt128 class and add to my project. That's all right but then I did the most stupid thing I could do:
    Code:
    UInt128 targetGUID = wowHook.Memory.Read<UInt128>((IntPtr)(wowHook.Process.BaseOffset() + (uint) 0xF0F0C8));
    and without any exception I've got the certain number considered to be a GUID, from my example:
    516025065173653023559145704441218816
    converted back to byte array it becomes:
    0087032000F03A20EF0E1F0000626300

    but the original one is:
    203AF0002003870000636200001F0EEF

    So I've tryed to interact with object using GUID that doesn't exist at all :/
    Solution: store GUID like byte[] and do conversion when it is needed. I appreciate any suggestions.

    Thank your for your time!
    Last edited by derbenzin; 02-11-2017 at 12:26 PM.

  6. Thanks Corthezz, squiggy, hybran (3 members gave Thanks to derbenzin for this useful post)

Similar Threads

  1. Replies: 4
    Last Post: 11-13-2016, 03:18 AM
  2. [Help Request] Interact with Object (CTM)
    By Mr.Zunz in forum WoW Memory Editing
    Replies: 7
    Last Post: 09-03-2009, 08:06 PM
  3. Interacting with object
    By miceiken in forum WoW Memory Editing
    Replies: 29
    Last Post: 06-05-2009, 08:51 AM
  4. interacting with diffrent things as zombie
    By whorkitty in forum World of Warcraft Exploration
    Replies: 10
    Last Post: 10-26-2008, 09:23 AM
  5. How to make horde interact with Alliance?
    By zlo in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 08-05-2008, 08:29 AM
All times are GMT -5. The time now is 02:28 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search