Problem 1 :) menu

User Tag List

Thread: Problem 1 :)

Results 1 to 2 of 2
  1. #1
    kajko's Avatar Member
    Reputation
    4
    Join Date
    Oct 2009
    Posts
    48
    Thanks G/R
    3/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem 1 :)

    Hi all,

    I have found some C# code and adapted it to C++. It will tell you target reaction to you, hostile, friendly, etc...


    Reaction WOWFactionInterpreter::FindReactionFromFactions(UINT localFaction, UINT mobFaction)
    {
    Reaction reaction = Unknown;

    UINT32 startIndex = m_wowBase->GetRebaseUINT32(m_wowBase->m_wowOffsets.FACTION_START_INDEX);
    UINT32 totalFactions = m_wowBase->GetRebaseUINT32(m_wowBase->m_wowOffsets.FACTION_TOTAL);
    UINT32 factionStartPoint = m_wowBase->GetRebaseUINT32(m_wowBase->m_wowOffsets.FACTION_POINTER);

    UINT32 localHash = 0;
    UINT32 mobHash = 0;

    if (localFaction >= startIndex && localFaction < totalFactions)
    {
    if (mobFaction >= startIndex && mobFaction < totalFactions)
    {
    localHash = factionStartPoint + ((localFaction - startIndex) * 4);
    mobHash = factionStartPoint + ((mobFaction - startIndex) * 4);
    }
    }

    if (localHash != 0 && mobHash != 0)
    reaction = CompareFactionHash(localHash, mobHash);

    return reaction;
    }

    bool WOWFactionInterpreter::TestBits(UINT32 lBitAddr, UINT32 rBitAddr)
    {
    UINT32 lBitParam = m_wowBase->GetUINT32(lBitAddr);
    UINT32 rBitParam = m_wowBase->GetUINT32(rBitAddr);

    if ((lBitParam & rBitParam) != 0) return true;

    return false;
    }

    bool WOWFactionInterpreter::HashCompare(UINT32 hashIndex, UINT32 hashCompare, char* localBitHash, UINT32 mobHashCheck)
    {
    const int HASH_INDEX_INC = 4;

    hashCompare = *( (UINT32*) &localBitHash[hashIndex] );

    for (int i = 0; i < 4; i++)
    {
    if (hashCompare == mobHashCheck)
    return true;

    hashIndex += HASH_INDEX_INC;
    hashCompare = *( (UINT32*) &localBitHash[hashIndex] );

    if (hashCompare == 0)
    break;
    }

    return false;
    }

    Reaction WOWFactionInterpreter::CompareFactionHash(UINT32 hash1, UINT32 hash2)
    {
    UINT32 localHashCheck = 0;
    UINT32 mobHashCheck = 0;

    UINT32 hashCompare = 0;

    char localBitHash[100];
    m_wowBase->m_wowMem.ReadBytes( hash1, localBitHash, 64);

    char mobBitHash[100];
    m_wowBase->m_wowMem.ReadBytes( hash2, mobBitHash, 64);

    localHashCheck = *( (UINT32*) &localBitHash[0x04] );
    mobHashCheck = *( (UINT32*) &mobBitHash[0x04] );


    if( TestBits( *( (UINT32*) &localBitHash[0x00] ) + m_wowBase->m_wowOffsets.HOSTILE_OFFSET_1, *( (UINT32*) &mobBitHash[0x00] ) + m_wowBase->m_wowOffsets.HOSTILE_OFFSET_2) )
    return Hostile;

    if (HashCompare(0x18, hashCompare, localBitHash, mobHashCheck))
    return Hostile;


    if( TestBits( *( (UINT32*) &localBitHash[0x00] ) + m_wowBase->m_wowOffsets.FRIENDLY_OFFSET_1, *( (UINT32*) &mobBitHash[0x00] ) + m_wowBase->m_wowOffsets.FRIENDLY_OFFSET_2) )
    return Friendly;

    if (HashCompare(0x28, hashCompare, localBitHash, mobHashCheck))
    return Friendly;


    return Neutral;
    }

    The problem I have is this: the code will tell me is target friendly or hostile, but not neutral (like kodo in barens, for example). All neutral (yellow) mobs are reported as friendly.
    Question is how do I get it to report yellow as neutral, if any1 knows ?

    Kajko

    Problem 1 :)
  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)
    I just wanted to point you to the following Lua function, if you reverse it it might help you out.

    reaction = UnitReaction("unit", "otherUnit");

    reaction = integer - the level of the reaction of unit towards otherUnit - this is a number between 1 and 8. If the reaction is unknown then nil is returned.

    1. Exceptionally hostile
    2. Very Hostile
    3. Hostile
    4. Neutral
    5. Friendly
    6. Very Friendly
    7. Exceptionally friendly
    8. Exalted

Similar Threads

  1. Problem with CE.
    By Eldretch in forum World of Warcraft General
    Replies: 1
    Last Post: 08-08-2006, 06:49 PM
  2. realm list problem
    By robtuner in forum World of Warcraft General
    Replies: 2
    Last Post: 07-21-2006, 09:08 AM
  3. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
  4. wow emu problem
    By bezike in forum World of Warcraft General
    Replies: 0
    Last Post: 07-09-2006, 04:45 PM
  5. Site problems
    By Shanaar in forum Community Chat
    Replies: 10
    Last Post: 05-14-2006, 01:15 AM
All times are GMT -5. The time now is 03:03 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