RETAIL   How to use  Spell_C_HandleTerrainClick menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    RETAIL How to use Spell_C_HandleTerrainClick

    Code:
    char __fastcall sub_140ED5A70(__int64 a1, __int64 a2)
    {
      __int64 v2; // rbx
      __int64 v3; // rax
    
      LOBYTE(a2) = 1;
      v2 = a1;
      if ( !(unsigned int)sub_140ED5AE0(a1, a2) )
        return sub_140ED5600(v2, v2 + 0x10, 0i64);
      if ( xmmword_142E9C530 != 0 )
      {
        v3 = sub_140F0E3E0(&xmmword_142E9C530);
        if ( v3 )
          sub_140EE0BB0(v3);
      }
      return 0;
    }

    I read the previous one and tried to pass the struct TerrainClick
    {
    uint64_t guid;
    Location pos;
    int32_t click_type;
    };

    Will crash directly

    RETAIL   How to use  Spell_C_HandleTerrainClick
  2. #2
    ChrisIsMe's Avatar Contributor
    Reputation
    164
    Join Date
    Apr 2017
    Posts
    210
    Thanks G/R
    67/100
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Use CGGameUI::OnTerrainClick, it's further up in the calls to this function you posted.

    GUID is mover GUID (think local player transports like an elevator) There's a dungeon in shadowlands that needs this to be set properly, necrotic wake I think.

    That function you have there looks like

    The struct looks right tho.

    ```
    struct ClickData
    {
    GUID mover;
    Vector3 location;
    unsigned int click_type;

    char ClickLocation();
    } __attribute__((packed));


    ```

    Else you see that the call is

    (__int64 a1, __int64 a2)

    (ClickData, ClickData.Location)


    Also make sure you're not calling CGPetInfo::HandleTerrainClick or CGPetInfo::HandleMoveTo,

    But `CGGameUI::OnTerrainClick` can do all of the clicks itself, PetMove, ClickSpell, Click to move

  3. #3
    Alisha's Avatar Member
    Reputation
    13
    Join Date
    Nov 2015
    Posts
    13
    Thanks G/R
    4/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ChrisIsMe View Post
    There's a dungeon in shadowlands that needs this to be set properly, necrotic wake I think.
    Yes, in this dungeon last 2 bosses located on the vehicle (all room is a vehicle).
    To calculate the position for ground cast properly you need to get Vehicle for LocalPlayer,
    then you get the matrix of the vehicle and transform LocalPlayer position:

    Code:
    Matrix4x4 m = vehicle.GetMatrix();
    var loc = LocalPlayer.Location;
    
    var     x = loc.X * m.M11 + loc.Y * m.M21 + loc.Z * m.M31 + m.M41;
    var     y = loc.X * m.M12 + loc.Y * m.M22 + loc.Z * m.M32 + m.M42;
    var     z = loc.X * m.M13 + loc.Y * m.M23 + loc.Z * m.M33 + m.M43;
    
    var result = new Vector3(x, y, z);
    for proper rotation you just need to add vehicle rotation to the player:
    Code:
    var rotation = Localplayer.Rotation + vehicle.Rotation;

  4. #4
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ChrisIsMe View Post
    Use CGGameUI::OnTerrainClick, it's further up in the calls to this function you posted.

    GUID is mover GUID (think local player transports like an elevator) There's a dungeon in shadowlands that needs this to be set properly, necrotic wake I think.

    That function you have there looks like

    The struct looks right tho.

    ```
    struct ClickData
    {
    GUID mover;
    Vector3 location;
    unsigned int click_type;

    char ClickLocation();
    } __attribute__((packed));


    ```

    Else you see that the call is

    (__int64 a1, __int64 a2)

    (ClickData, ClickData.Location)


    Also make sure you're not calling CGPetInfo::HandleTerrainClick or CGPetInfo::HandleMoveTo,

    But `CGGameUI::OnTerrainClick` can do all of the clicks itself, PetMove, ClickSpell, Click to move
    Thank you for your help. I will try to click outside the dungeon first. 36949 CGGameUI__OnTerrainClick Should be 0x14EB8A0
    Code:
      v2 = *(_DWORD *)(a1 + 0x1C);
      v3 = a1;
      if ( v2 == 4 || dword_142F58108 )
      {
        CGGameUI__ClearCursor(1i64);
        v2 = *(_DWORD *)(v3 + 0x1C);
      }
    {
    GUID mover; //0x0
    Vector3 location;//0x10 -0x14 -0x18
    unsigned int click_type;//0x1c
    }
    0x1C is clicktype
    Exactly clicktype 0x4 should be rightbutton click


    TerrainClick testData{ {0, 0}, ActivePlayer->GetObjectPosition(), 0x1 };
    func::OnTerrainClick(&testData);
    yes it worked THANKS

    Spell_C_HandleTerrainClick should work normally too. I forgot to assign a value to Location so crashed.
    Last edited by 34D; 01-06-2021 at 01:42 AM.

  5. #5
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Alisha View Post
    Yes, in this dungeon last 2 bosses located on the vehicle (all room is a vehicle).
    To calculate the position for ground cast properly you need to get Vehicle for LocalPlayer,
    then you get the matrix of the vehicle and transform LocalPlayer position:

    Code:
    Matrix4x4 m = vehicle.GetMatrix();
    var loc = LocalPlayer.Location;
    
    var     x = loc.X * m.M11 + loc.Y * m.M21 + loc.Z * m.M31 + m.M41;
    var     y = loc.X * m.M12 + loc.Y * m.M22 + loc.Z * m.M32 + m.M42;
    var     z = loc.X * m.M13 + loc.Y * m.M23 + loc.Z * m.M33 + m.M43;
    
    var result = new Vector3(x, y, z);
    for proper rotation you just need to add vehicle rotation to the player:
    Code:
    var rotation = Localplayer.Rotation + vehicle.Rotation;
    Does it mean to convert it to a relative position and then calculate the coordinates?

  6. Thanks fancy (1 members gave Thanks to 34D for this useful post)
  7. #6
    ChrisIsMe's Avatar Contributor
    Reputation
    164
    Join Date
    Apr 2017
    Posts
    210
    Thanks G/R
    67/100
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 34D View Post
    Does it mean to convert it to a relative position and then calculate the coordinates?
    I haven't seen a need for code with matrices, I just add the position of the Mover, and the Unit itself... Sometmes this is a few levels deep though, if a mover has a mover.

  8. #7
    Alisha's Avatar Member
    Reputation
    13
    Join Date
    Nov 2015
    Posts
    13
    Thanks G/R
    4/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 34D View Post
    Does it mean to convert it to a relative position and then calculate the coordinates?
    LocalPlayer position when on Vehicle will be relative to the vehicle, so it will be something like
    Code:
    new Vector3(0.5f, 0.7f, 0.3f)
    after you got the world matrix of the vehicle - it will hold data about the position of the Vehicle model within current real space coordinates.
    so you then calculate LocalPlayer real coordinate, using this matrix and your relative position on this vehicle.
    Last edited by Alisha; 01-06-2021 at 09:07 PM.

  9. #8
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Alisha View Post
    LocalPlayer position when on Vehicle will be relative to the vehicle, so it will be something like
    Code:
    new Vector3(0.5f, 0.7f, 0.3f)
    after you got the world matrix of the vehicle - it will be absolute coordinates of the Vehicle model transformed to current real space coordinates.
    so you then calculate LocalPlayer real coordinate, using this matrix and your relative position on this vehicle.
    thanks i'll try. by the way Is there a way to directly find localplayer's target ptr? not target guid.

  10. #9
    Alisha's Avatar Member
    Reputation
    13
    Join Date
    Nov 2015
    Posts
    13
    Thanks G/R
    4/7
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 34D View Post
    thanks i'll try. by the way Is there a way to directly find localplayer's target ptr? not target guid.
    from offset within LocalPlayer BaseAdress? No
    But after you got TargetGuid, you just get object from ObjectManager, something like:
    Code:
    private ConcurrentDictionary<WoWGuid, IWoWObject> _objects { get; } = new ConcurrentDictionary<WoWGuid, IWoWObject>();
    public IWoWObject GetObjectByGuid(WoWGuid guid)
    		{
    			_objects.TryGetValue(guid, out var value);
    			return value;
    		}
    I assume you would anyway have access to objects at this point
    Last edited by Alisha; 01-06-2021 at 09:14 PM.

  11. #10
    ChrisIsMe's Avatar Contributor
    Reputation
    164
    Join Date
    Apr 2017
    Posts
    210
    Thanks G/R
    67/100
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Alisha View Post
    from offset within LocalPlayer BaseAdress? No
    But after you got TargetGuid, you just get object from ObjectManager, something like:
    Code:
    private ConcurrentDictionary<WoWGuid, IWoWObject> _objects { get; } = new ConcurrentDictionary<WoWGuid, IWoWObject>();
    public IWoWObject GetObjectByGuid(WoWGuid guid)
    		{
    			_objects.TryGetValue(guid, out var value);
    			return value;
    		}
    I assume you would anyway have access to objects at this point
    Yup, and if you're using the hashmap object manager it should be pretty much O(n+n), the. game gets pointers to objects by GUID everywhere.

  12. #11
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohh, my current approach is to get the guid in lua and then use the obj manager of lua to convert the guid to the corresponding ptr and then transfer the ptr to c++ and click.
    I thought player baseptr + 0x1c40 was the target’s ptr

  13. #12
    34D's Avatar Member
    Reputation
    4
    Join Date
    May 2020
    Posts
    57
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Alisha View Post
    from offset within LocalPlayer BaseAdress? No
    But after you got TargetGuid, you just get object from ObjectManager, something like:
    Code:
    private ConcurrentDictionary<WoWGuid, IWoWObject> _objects { get; } = new ConcurrentDictionary<WoWGuid, IWoWObject>();
    public IWoWObject GetObjectByGuid(WoWGuid guid)
    		{
    			_objects.TryGetValue(guid, out var value);
    			return value;
    		}
    I assume you would anyway have access to objects at this point

    Hello. When I use HandleTerrainClick, I found that the AOE will be casted onto the Unit model head, maybe the height of the unit will be added.
    Of course, it will not be when using CTM.

    How to get UnitHeight and Z - UnitHeight is the correct floor height?

  14. #13
    hfc's Avatar Member
    Reputation
    1
    Join Date
    Feb 2021
    Posts
    8
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by 34D View Post
    Hello. When I use HandleTerrainClick, I found that the AOE will be casted onto the Unit model head, maybe the height of the unit will be added.
    Of course, it will not be when using CTM.

    How to get UnitHeight and Z - UnitHeight is the correct floor height?
    Hello.Could u plz tell me HandleTerrainClick offset of v37474 ?

  15. #14
    ostapus's Avatar Active Member
    Reputation
    58
    Join Date
    Nov 2008
    Posts
    176
    Thanks G/R
    2/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by hfc View Post
    Hello.Could u plz tell me HandleTerrainClick offset of v37474 ?
    00000001414EC550, rebased to 0000000140000000

    I wonder if anyone know how to properly call ClickToMove at 0x000000014109CD50 .... my attempts to call it with exactly same arguments which used by game itself - cause the crash.
    Last edited by ostapus; 02-23-2021 at 07:28 PM.

  16. #15
    _chase's Avatar Established Member
    Reputation
    95
    Join Date
    Dec 2019
    Posts
    58
    Thanks G/R
    17/49
    Trade Feedback
    0 (0%)
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ostapus View Post
    00000001414EC550, rebased to 0000000140000000

    I wonder if anyone know how to properly call ClickToMove at 0x000000014109CD50 .... my attempts to call it with exactly same arguments which used by game itself - cause the crash.
    I am working on classic, and I too have this same problem. Do you get a divide by zero error? I'm still learning about native reversing, but I'm under the assumption the crash might be due to checking the call stack.
    So it throws an error when not called from the game's actual address space. Thus why I can call the wrapper functions without an issue, but trying to directly call the function from my injected dll will flag the call stack check and crash.

Page 1 of 2 12 LastLast

Similar Threads

  1. GUIDE: HOW TO USE TORRENTS (Look inside)
    By Hounro in forum Community Chat
    Replies: 14
    Last Post: 01-22-2007, 09:04 PM
  2. How to use fish bot?
    By Pixo in forum World of Warcraft Guides
    Replies: 0
    Last Post: 01-04-2007, 07:01 PM
  3. Hunter Pets how to use them to gank lowbies
    By Demonicmaster in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 12-21-2006, 04:35 PM
  4. How To: use .rar files.
    By raamoz in forum World of Warcraft Guides
    Replies: 3
    Last Post: 11-06-2006, 02:51 PM
All times are GMT -5. The time now is 04:33 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