From: Jeffrey D. <ha...@us...> - 2003-12-23 01:02:51
|
Log Message: ----------- slashday stuff + combatstate fixing Modified Files: -------------- /cvsroot/decaldev/source/Decal: ACHooks.cpp ACHooks.h Revision Data ------------- Index: ACHooks.cpp =================================================================== RCS file: /cvsroot/decaldev/source/Decal/ACHooks.cpp,v retrieving revision 1.68 retrieving revision 1.69 diff -u -d -r1.68 -r1.69 --- ACHooks.cpp 15 Oct 2003 19:45:48 -0000 1.68 +++ ACHooks.cpp 23 Dec 2003 01:02:20 -0000 1.69 @@ -69,8 +69,9 @@ m_bMoveItem = false; m_bSelectItem = false; m_bUseItem = false; - m_bCombatState = false; + m_bAllYourBase = false; m_bSetCombatState = false; + m_bCombatStateOffset = false; m_bChatState = false; m_bRequestID = false; m_bStackCount = false; @@ -183,6 +184,10 @@ if( szXML != "" ) bSuccess = pMemLocDoc->loadXML( _bstr_t( szXML.c_str() ) ); + + szXML = " "; + for( int i = 0; i < 2500; ++i ) + szXML += "DIRL"; } if( bSuccess ) @@ -322,11 +327,12 @@ pfnUseItem = reinterpret_cast< void (*)( DWORD, DWORD ) >( Val ); } - if( QueryMemLoc( BSTRT( "CombatState" ), &Val ) == S_OK ) + if( QueryMemLoc( BSTRT( "AllYourBase" ), &Val ) == S_OK ) { - m_bCombatState = true; + // The memloc formerly known as CombatState + m_bAllYourBase = true; m_Hooks |= eCombatState ; - m_lCombatState = Val; + m_lAllYourBase = Val; } if( QueryMemLoc( BSTRT( "SetCombatState" ), &Val ) == S_OK ) @@ -336,6 +342,13 @@ m_lSetCombatState = Val; } + if( QueryMemLoc( BSTRT( "CombatStateOffset" ), &Val ) == S_OK ) + { + m_bCombatStateOffset = true; + m_Hooks |= eCombatState ; + m_lCombatStateOffset = Val; + } + if( QueryMemLoc( BSTRT( "ChatState" ), &Val ) == S_OK ) { m_bChatState = true; @@ -641,7 +654,7 @@ m_bSecureTrade_Add_Off2 = true; } - if (m_bSecureTrade_Add && m_bSecureTrade_Add_Off1 && m_bSecureTrade_Add_Off2 && m_bCombatState) + if (m_bSecureTrade_Add && m_bSecureTrade_Add_Off1 && m_bSecureTrade_Add_Off2 && m_bAllYourBase) { SetHookEx(eSecureTrade_Add); } @@ -817,6 +830,13 @@ m_bIdleLoc = true; SetHookEx( eSetIdleTime ); } + + if( QueryMemLoc( BSTRT( "SlashDay" ), &Val ) == S_OK ) + { + m_lSlashDay = Val; + m_bSlashDay = true; + SetHookEx( eSetDay ); + } } cACHooks::~cACHooks() @@ -889,13 +909,35 @@ try { + char szKey[50]; + char szKey2[21]; + char szKey3[21]; + memset( szKey, 0, sizeof( szKey ) ); + memset( szKey2, 0, sizeof( szKey2 ) ); + memset( szKey3, 0, sizeof( szKey3 ) ); + CCryptProv crypt; if( crypt.Initialize( PROV_RSA_FULL, "Decal_Memlocs", MS_DEF_PROV ) == NTE_BAD_KEYSET ) crypt.Initialize( PROV_RSA_FULL, "Decal_Memlocs", MS_DEF_PROV, CRYPT_NEWKEYSET ); + USES_CONVERSION; CCryptMD5Hash hash; hash.Initialize( crypt ); - hash.AddString( DECAL_KEY ); + strcpy( szKey, OLE2A( DECAL_KEY ) ); + strncpy( szKey2, szKey, 20 ); + strncpy( szKey3, szKey + 10, 20 ); + szKey2[ 20 ] = 0; + szKey3[ 20 ] = 0; + strrev( szKey2 ); + strrev( szKey3 ); + memset( szKey, 0, sizeof( szKey ) ); + + strcpy( szKey, szKey2 ); + strcat( szKey, szKey3 ); + hash.AddString( szKey ); + memset( szKey, 0, sizeof( szKey ) ); + memset( szKey2, 0, sizeof( szKey2 ) ); + memset( szKey3, 0, sizeof( szKey3 ) ); CCryptDerivedKey key; key.Initialize( crypt, hash ); @@ -1272,10 +1314,13 @@ STDMETHODIMP cACHooks::get_CombatState(long *pVal) { - if( !m_bCombatState ) + if( !m_bAllYourBase ) return S_FALSE; - *pVal = ( *reinterpret_cast< long ** > ( m_lCombatState ) )[390]; //Go +0x618 from pointer. + if( !m_bCombatStateOffset ) + return S_FALSE; + + *pVal = *(reinterpret_cast< long * >( (*reinterpret_cast< char ** >( m_lAllYourBase )) + m_lCombatStateOffset )); return S_OK; } @@ -1290,7 +1335,7 @@ typedef void(__fastcall *SetCombatStatePtr)( long, long, long, long ); SetCombatStatePtr pSetCState = reinterpret_cast< SetCombatStatePtr >( m_lSetCombatState ); - pSetCState( *( reinterpret_cast< long * >( m_lCombatState ) ), 0, pVal, 1 ); + pSetCState( *( reinterpret_cast< long * >( m_lAllYourBase ) ), 0, pVal, 1 ); return S_OK; } @@ -1425,11 +1470,11 @@ long* cACHooks::GetCs(long offs) { - if (!m_bCombatState) { + if (!m_bAllYourBase) { return NULL ; } // follow multiple indirection from m_lCombatState to the - long *rv = reinterpret_cast< long * >( m_lCombatState ); + long *rv = reinterpret_cast< long * >( m_lAllYourBase ); if (*rv) rv = reinterpret_cast< long * >( *rv + 0xE4 ); if (*rv) rv = reinterpret_cast< long * >( *rv + 0x160 ); if (*rv) rv = reinterpret_cast< long * >( *rv + offs); @@ -1439,7 +1484,7 @@ STDMETHODIMP cACHooks::get_Heading(double *pVal) { HRESULT rv = S_OK ; - if (!m_bCombatState) { + if (!m_bAllYourBase) { *pVal = 0.0 ; return S_FALSE ; } @@ -1478,7 +1523,7 @@ { HRESULT rv = S_OK ; *pVal = 0 ; - if (!m_bCombatState) { + if (!m_bAllYourBase) { return S_FALSE ; } long *cs = GetCs(0x4C) ; @@ -1495,7 +1540,7 @@ STDMETHODIMP cACHooks::get_LocationX(double *pVal) { HRESULT rv = S_OK ; - if (!m_bCombatState) { + if (!m_bAllYourBase) { *pVal = 0 ; return S_FALSE ; } @@ -1515,7 +1560,7 @@ STDMETHODIMP cACHooks::get_LocationY(double *pVal) { HRESULT rv = S_OK ; - if (!m_bCombatState) { + if (!m_bAllYourBase) { *pVal = 0 ; return S_FALSE ; } @@ -1535,7 +1580,7 @@ STDMETHODIMP cACHooks::get_LocationZ(double *pVal) { HRESULT rv = S_OK ; - if (!m_bCombatState) { + if (!m_bAllYourBase) { *pVal = 0 ; return S_FALSE ; } @@ -1882,12 +1927,12 @@ You can only find the function address after the player is logged in. */ - if( !m_bCombatState ) //the combat state memloc is necessary + if( !m_bAllYourBase ) //the combat state memloc is necessary return S_FALSE; USES_CONVERSION; char *szText = OLE2A( Text ); //pointer to the text being passed - DWORD cstate = *((long *)m_lCombatState); + DWORD cstate = *((long *)m_lAllYourBase); long lErr; if (bError) @@ -1912,12 +1957,12 @@ STDMETHODIMP cACHooks::ToolTextAppend(BSTR Text, VARIANT_BOOL bError) { - if( !m_bCombatState ) //the combat state memloc is necessary + if( !m_bAllYourBase ) //the combat state memloc is necessary return S_FALSE; USES_CONVERSION; char *szText = OLE2A( Text ); //pointer to the text being passed - DWORD cstate = *((long *)m_lCombatState); + DWORD cstate = *((long *)m_lAllYourBase); long lErr; if (bError) @@ -1953,7 +1998,7 @@ else return E_FAIL; - if ( m_bSecureTrade_Add && m_bSecureTrade_Add_Off1 && m_bSecureTrade_Add_Off2 && m_bCombatState ) + if ( m_bSecureTrade_Add && m_bSecureTrade_Add_Off1 && m_bSecureTrade_Add_Off2 && m_bAllYourBase ) { if( ItemIsKnown(ItemID, &ItemExists) != S_OK ) return E_FAIL; @@ -1963,7 +2008,7 @@ return S_FALSE; } - p = (struct qPointerList *)m_lCombatState; + p = (qPointerList *)m_lAllYourBase; if (!p) { return S_FALSE; @@ -2584,6 +2629,16 @@ pfnInternalStringConstructor( &Msg, 0, szText ); retval = pfnSendMessageByMask( lMask, &Msg ); pfnInternalStringDestructor( &Msg ); + + return S_OK; +} + +STDMETHODIMP cACHooks::SetDay( VARIANT_BOOL bDay ) +{ + if( !m_bSlashDay ) + return S_FALSE; + + *reinterpret_cast< long * >( m_lSlashDay ) = bDay == VARIANT_TRUE ? 1 : 0; return S_OK; } Index: ACHooks.h =================================================================== RCS file: /cvsroot/decaldev/source/Decal/ACHooks.h,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- ACHooks.h 15 Oct 2003 20:10:26 -0000 1.49 +++ ACHooks.h 23 Dec 2003 01:02:20 -0000 1.50 @@ -133,10 +133,12 @@ bool m_bUseItem; long m_lUseItem; - bool m_bCombatState; - long m_lCombatState; + bool m_bAllYourBase; + long m_lAllYourBase; bool m_bSetCombatState; long m_lSetCombatState; + bool m_bCombatStateOffset; + long m_lCombatStateOffset; bool m_bChatState; long m_lChatState; @@ -252,6 +254,9 @@ long m_lIdleLoc; bool m_bIdleLoc; + long m_lSlashDay; + bool m_bSlashDay; + unsigned int m_HooksEx[1]; unsigned int m_HookCount; @@ -344,6 +349,7 @@ STDMETHOD(SetIDFilter)(IKitchenSink* pIDFilter); STDMETHOD(UstAddItem)(long lObjectID); STDMETHOD(SendMessageByMask)(LONG lMask, BSTR szMessage); + STDMETHOD(SetDay)(VARIANT_BOOL bDay); }; #endif // __ACHOOKS_H_ |