Succesfully reversing LUA functions menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Jokur's Avatar Sergeant
    Reputation
    17
    Join Date
    Dec 2011
    Posts
    59
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Succesfully reversing LUA functions

    Been looking at this for a couple days. Trying to determine the direction of 'Eclipse' arrow on a Druid Boomkin. The LUA function;

    Code:
    local direction = GetEclipseDirection()
    if direction == "moon" then
        DEFAULT_CHAT_FRAME:AddMessage("Cast Nature spells to move toward a Lunar eclipse!")
    elseif direction == "sun" then
        DEFAULT_CHAT_FRAME:AddMessage("Cast Arcane spells to move toward a Solar eclipse!")
    end
    Returns sun, moon or none correctly. But after finding the GetEcpliseDirection script via IDA, there is not any clear distinction of direction around its memory / offset address.

    I am sure someone has tried to do something similar.

    Any suggestions or help would be appreciated.

    J

    Succesfully reversing LUA functions
  2. #2
    Xelper's Avatar ★ Elder ★
    Reputation
    1024
    Join Date
    Mar 2007
    Posts
    860
    Thanks G/R
    0/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like it is calling CGUnit_C__HasAura to check for a spell aura, and based on if you have that aura it determines direction.
    Auras:
    http://www.wowhead.com/spell=67483
    http://www.wowhead.com/spell=67484

    IDA Pseudocode:
    Code:
    void *__cdecl Script_GetEclipseDirection(int a1)
    {
      void *result; // eax@1
      __int64 v2; // qax@1
    
    
      v2 = ClntObjMgrGetActivePlayer();
      result = ClntObjMgrObjectPtr(v2, TYPEMASK_PLAYER);
      if ( result )
      {
        if ( (unsigned __int8)CGUnit_C__HasAura(67483, 0, 0) )
        {
          lua_pushstring(a1, "sun");
          result = (void *)1;
        }
        else
        {
          if ( (unsigned __int8)CGUnit_C__HasAura(67484, 0, 0) )
          {
            lua_pushstring(a1, "moon");
            result = (void *)1;
          }
          else
          {
            lua_pushstring(a1, "none");
            result = (void *)1;
          }
        }
      }
      return result;
    }

    Last edited by Xelper; 04-25-2012 at 11:04 AM.

  3. #3
    Jokur's Avatar Sergeant
    Reputation
    17
    Join Date
    Dec 2011
    Posts
    59
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This was my first thought as well, but it has 1 problem. We can detect which aura we have (Solar or Lunar) without issue.

    But the direction of the eclipse pointer is misleading if you base it off of the aura.

    Example: You finish combat and the pointer is returning from Solar (which = 100 when the pointer is all the way to the right) and heading to Lunar (which is -100).

    You lose your aura around -20 to +20 but the direction of the arrow remains the same (if its heading to Lunar, you can NOT head back to Solar and vise versa).

    So when you re enter combat and within the -20 to +20 on the eclipse bar, all bets are off as far as trying to determine whether to lead of with Moon or Sun spells.

    Hopefully that makes sense ?

  4. #4
    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)
    Did you try some logging/debugging with those auras? http://wowhead.com/spell=67483 seems to be checked for the direction. Note that this is not the actual eclipse aura. I mean, the lua API cant possibly do the wrong thing :O

  5. #5
    TOM_RUS's Avatar Legendary
    Reputation
    914
    Join Date
    May 2008
    Posts
    699
    Thanks G/R
    0/52
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Bananenbrot View Post
    Did you try some logging/debugging with those auras? http://wowhead.com/spell=67483 seems to be checked for the direction. Note that this is not the actual eclipse aura. I mean, the lua API cant possibly do the wrong thing :O
    Blizzard uses a lot of hidden auras.

  6. #6
    Jokur's Avatar Sergeant
    Reputation
    17
    Join Date
    Dec 2011
    Posts
    59
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seems that without either of the auras, it is in flux (as if you just logged in and it has no direction). You can move it either way when it has not been activated yet. Once its committed to one side or the other, you will either have one or the other aura (until you log out).

    Thanks guys, this made a ton of sense;

    J

    EDIT - And to Tom's point, Yeah.. Tons..

    Succesfully reversing LUA functions-auras-png

    Thanks again for the help.
    Last edited by Jokur; 04-25-2012 at 01:26 PM.

Similar Threads

  1. Big List of Lua Functions
    By Lytle69 in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 10-15-2008, 03:02 AM
  2. LUA Function Thread
    By steveo123 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 10-13-2008, 08:54 AM
  3. [Guide] How to use local LUA function!
    By Dartignan in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 08-05-2008, 09:28 PM
  4. Replies: 22
    Last Post: 05-29-2008, 03:52 PM
  5. [Question] Lua functions
    By Lich King in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 04-10-2008, 07:39 PM
All times are GMT -5. The time now is 06:35 PM. 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