Code:
#include "WoW.h"
#include "WoW_AutoFish.h"
int (*GetNumLootItems)() = ( int (*)() )0x004CCFD0;
void (__stdcall *LootItem)(int) = ( void (__stdcall*) (int Index) )0x005D1280;
void CastSpellByID( int spellid )
{
__asm
{
PUSH 0
PUSH 0
PUSH 0
PUSH spellid
MOV EAX, 0x006DBEF0
CALL EAX
ADD ESP, 10
}
}
void CAutoFish::Initialize()
{
m_State = FISH_DONELOOTING;
m_bEnabled = false;
gWoW.GetRenderer()->AddRenderCallback( CAutoFish::RenderCallback );
m_hThreadHandle = CreateThread( NULL, NULL, (LPTHREAD_START_ROUTINE)FishLoop, NULL, NULL, NULL );
}
void FishLoop()
{
static bool bDoOnce = true;
while(1)
{
if ( bDoOnce )
{
gWoW.GetOffset( "s_curMgr" );
_asm MOV ECX, DWORD PTR FS:[0x2C] // Hackish way to store the objMgr into our TLS so WoW's functions
_asm MOV ESI, DWORD PTR DS:[ECX] // Can use it
_asm MOV DWORD PTR SS:[ESI+8], EAX
bDoOnce = false;
}
if ( gAutoFish.IsEnabled() )
{
CGameObject* pGameObj = (CGameObject*)gWoW.GetObjectFromName( "Fishing Bobber" );
if ( pGameObj == NULL && gAutoFish.GetState() == FISH_DONELOOTING ) // No bobber, lets cast one then!
{
gAutoFish.SetState(FISH_CASTING);
// Cast Line
CastSpellByID(7620);
} else if ( pGameObj && gAutoFish.GetState() != FISH_LOOTING )
{
CFishingBobber* pBobber = (CFishingBobber*)pGameObj->pGameObjectInfo;
if ( pBobber->CanUseItem() && pBobber->GotBite() ) // We have a bobber. Can we use this? Does it have a bite?
{
gAutoFish.SetState(FISH_LOOTING);
gWoW.GetConsole().AddLine( "Got a bite!", 255, 255, 255, 255 );
// Use Bobber
pBobber->UseItem();
Sleep(1000);
int NumLootItems = GetNumLootItems();
if ( NumLootItems == 0 )
{
// Fish got away, bastard!
// Add to stats
gAutoFish.m_Stats.iFishGotAway++;
} else
{
for( int i = 0; i < NumLootItems; i++ )
{
gWoW.GetConsole().AddLine( "Looting slot", 255, 255, 255, 255 );
LootItem( i );
gAutoFish.m_Stats.iFishCaught++; // This needs to be += The amount of fish in that loot slot, but ++ will suffice for now
}
gWoW.GetConsole().AddLine( "Finished Looting", 255, 255, 255, 255 );
}
gAutoFish.SetState(FISH_DONELOOTING);
}
}
}
Sleep(1);
}
ExitThread( 0 );
}
void CAutoFish::Render( IDirect3DDevice9* pDevice )
{
// TODO: Make sure the bobber belongs to use, maybe check if its usable?
if ( GetAsyncKeyState( VK_MBUTTON ) &1 )
m_bEnabled = !m_bEnabled;
CRenderer* pRenderer = gWoW.GetRenderer();
pRenderer->DrawText( 150, 150, 255, 255, 255, 255, "Fish Stats:" );
pRenderer->DrawText( 150, 160, 255, 255, 255, 255, "Caught : %i", m_Stats.iFishCaught );
pRenderer->DrawText( 150, 170, 255, 255, 255, 255, "Got Away: %i", m_Stats.iFishGotAway );
}
void CAutoFish::RenderCallback( IDirect3DDevice9* pDevice )
{
gAutoFish.Render( pDevice );
}
Code:
#pragma once
void FishLoop();
enum eFishStates
{
FISH_CASTING,
FISH_WAITINGFORBITE,
FISH_LOOTING,
FISH_DONELOOTING
};
struct fishStats
{
int iFishCaught;
int iFishGotAway;
};
class CAutoFish
{
public:
void Initialize();
void Render( IDirect3DDevice9* pDevice );
bool IsEnabled() { return m_bEnabled; }
eFishStates GetState() { return m_State; }
void SetState( eFishStates State ) { m_State = State; }
static void RenderCallback( IDirect3DDevice9* pDevice );
fishStats m_Stats;
private:
eFishStates m_State;
bool m_bEnabled;
HANDLE m_hThreadHandle;
};
extern CAutoFish gAutoFish;
Code:
[14:52:35]: Logging started at 2008-02-22
[14:52:35]: 0x006E03D0 -> CastSpellById
[14:52:35]: 0x004CFD90 -> LootItem
[14:52:35]: 0x00C60F7C -> LootPtr
int GetNumLootableItems()
{
DWORD dwPointer = FindPattern->dwList[ "LootPtr" ].Get();
DWORD dwEax = 0x0, dwEcx = 0x2, dwEdx = dwPointer + 0x20, dwEsi = 0x4;
while( dwEsi )
{
if( *(DWORD*)( dwEdx - 0x20 ) > 0x0 )//possible lootable item list ? ( entry size: 0x20 )
dwEax = dwEcx - 0x1;
if( *(DWORD*)( dwEdx ) > 0 )
dwEax = dwEcx;
if( *(DWORD*)( dwEdx + 0x20 ) > 0x0 )
dwEax = dwEcx + 0x1;
if( *(DWORD*)( dwEdx + 0x40 ) > 0x0 )
dwEax = dwEcx + 0x2;
dwEcx += 0x4;
dwEdx += 0x80;
dwEsi--;
}
return dwEax;
so nun meine frage, wer kann damit etwas hier anfangen
Kenn mich da leider noch nicht so aus...






