Game object interact distance menu

User Tag List

Results 1 to 8 of 8
  1. #1
    ~Unknown~'s Avatar Contributor
    Reputation
    193
    Join Date
    Jan 2009
    Posts
    211
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Game object interact distance

    I searched this form for any information about this but didn't anything all that helpful aside from ways to interact with objects. My question is do game objects (ie Flag in WSG) have some property that will let the client know how close you need to be to interact with said object. Currently, I'm only using memory reads/writes but will probably use an Endscene hook eventually so all solutions are welcome.


    Thanks.

    Game object interact distance
  2. #2
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Looks at mouse over interact...

  3. #3
    ~Unknown~'s Avatar Contributor
    Reputation
    193
    Join Date
    Jan 2009
    Posts
    211
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by DarkLinux View Post
    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.

  4. #4
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey, was porting parts of my debugger to x64 and figured i would trace it for you quick ;p

    the conditional jump at 0x59EF1D (400000 imagebase) is taken if you are not within range, and not taken otherwise. so check the scalar single float comparison above it
    Last edited by sitnspinlock; 03-14-2012 at 07:14 PM.

  5. #5
    ~Unknown~'s Avatar Contributor
    Reputation
    193
    Join Date
    Jan 2009
    Posts
    211
    Thanks G/R
    0/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by everdox View Post
    hey, was porting parts of my debugger to x64 and figured i would trace it for you quick ;p

    the conditional jump at 0x59EF1D (400000 imagebase) is taken if you are not within range, and not taken otherwise. so check the scalar single float comparison above it
    Heh, I got all excited when someone posted another "hint" to my problem. Then I came to this beast:



    Needless to say, I really hope you didn't actually have use that section in any shape or form for your application or perhaps there's some way you smarter people work with it. Anyway thanks for the good laugh.

  6. #6
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The lower part just multiplies the vector (v25, v26, v27) with the inverse matrix of v35 and compares the result vector to a bounding box given by v46 - v51.
    Seems that v43 is sth related to the interaction distance.
    Could be horribly wrong because I didn't ever mess with WoW's matrix system.

  7. #7
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's stored in the game object sub obj base class (fishing bobber, goober, fishing pools etc. they all inherit from this). Hint: Reverse the huge switch in the CGGameObject_C ctor.
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  8. #8
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    forcing that function to return without checking has some interesting side effects ;p

    probably works for flags too. didn't check. but you could probably snipe it from across the map


Similar Threads

  1. How To: Add Game Objects anywhere, everywhere!
    By CSOM in forum WoW EMU Guides & Tutorials
    Replies: 5
    Last Post: 09-05-2024, 04:07 AM
  2. Game Object Distance Help!
    By kaji95 in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 06-30-2009, 11:48 AM
  3. Game Object View distance? :S
    By Eponyx in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 05-24-2008, 02:24 PM
  4. How do I keep game objects forever. PLZ HELP!
    By chocodog in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 10-01-2007, 09:20 PM
  5. Custom Game objects
    By Possum in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 09-27-2007, 10:53 PM
All times are GMT -5. The time now is 06:19 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search