Jump to content
Moopler
  • 0
idoarama

Request auto pet feed script

Question

6 answers to this question

Recommended Posts

  • 0
//Pet feeder v116.2

define(INSERT, 01520000)
define(HOME, 01470000)
define(PAGEUP, 01490000)
define(DEL, 01530000)
define(END, 014F0000)
define(PAGEDOWN, 01510000)

define(FeedFullness, #50)

[enable]
alloc(hook, 128)
Alloc(PressKey,128)
label(return)

PressKey:
mov esi,[01AA2E2C] //8B 15 ? ? ? ? 85 D2 74 23
mov ecx,[esi+A4]
push edx
push 00
call 013DAB90 //A1 ?? ?? ?? ?? 85 ?? 74 ?? 8D ?? ?? 8B ?? 8B ?? FF
ret

00AA25B9: // ? ? ? ? 00 00 ? ? ? ? ? ? ? ? E8 ? ? ? ? ? ? C8 ? ? ? ? ? ? ? 00 00 ? ? E8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? E8
jmp hook
nop
return:

hook:
mov [esi+000000D4],edx
cmp edx, 0
je return
cmp edx, FeedFullness
jg return
pushad
mov edx, HOME
call PressKey
popad
jmp return

[disable]
00AA25B9:
mov [esi+000000D4],edx

Presses HOME when Fullness is under 50.

Edited by DAVHEED
  • Like 1

Share this post


Link to post
  • 0
1 hour ago, DAVHEED said:

//Pet feeder v116.2

define(INSERT, 01520000)
define(HOME, 01470000)
define(PAGEUP, 01490000)
define(DEL, 01530000)
define(END, 014F0000)
define(PAGEDOWN, 01510000)

define(FeedFullness, #50)

[enable]
alloc(hook, 128)
Alloc(PressKey,128)
label(return)

PressKey:
mov esi,[01AA2E2C] //8B 15 ? ? ? ? 85 D2 74 23
mov ecx,[esi+A4]
push edx
push 00
call 013DAB90 //A1 ?? ?? ?? ?? 85 ?? 74 ?? 8D ?? ?? 8B ?? 8B ?? FF
ret

00AA25B9: // ? ? ? ? 00 00 ? ? ? ? ? ? ? ? E8 ? ? ? ? ? ? C8 ? ? ? ? ? ? ? 00 00 ? ? E8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? E8
jmp hook
nop
return:

hook:
mov [esi+000000D4],edx
cmp edx, 0
je return
cmp edx, FeedFullness
jg return
pushad
mov edx, HOME
call PressKey
popad
jmp return

[disable]
00AA25B9:
mov [esi+000000D4],edx

Presses HOME when Fullness is under 50.

 
// by Franc[e]sco




define(KEY_NORMAL,0)
define(KEY_EXTENDED,1)




// you can add more virtual key codes by getting them here
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
// for letters, the uppercase character is enough
define(VK_HOME,24)




// -----------------------------------------------------------------------------
// Settings




// the script will feed the pet when fullness drops below or equal to this value
// (don't forget to put # in front of the value to specify that it's decimal!)
define(FeedFullness,#70)




// the key to press to feed the pet
define(FoodKey,VK_HOME)




// KEY_NORMAL for most keys, KEY_EXTENDED for special keys like CTRL
// it shouldn't matter for simple keypresses
define(FoodKeyType,KEY_NORMAL)




// -----------------------------------------------------------------------------
// Addresses and offsets




// ? ? ? ? 00 00 ? ? ? ? ? ? ? ? E8 ? ? ? ? ? ? C8 ? ? ? ? ? ? ? 00 00 ? ? E8 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? E8
define(PetFullnessAddy,00AA25B9) // v116




// TSingleton<CWndMan>::ms_pInstance
// 8B 15 ? ? ? ? 85 D2 74 23
define(TSingleton_CWndMan___ms_pInstance,01AA2E2C) // v116   0058E2D0




// virtual void __thiscall CWndMan::OnKey(unsigned int lparam, unsigned int wparam)
// ? ? ? ? ? 85 ? 74 ? 8D ? ? 8B ? 8B ? FF ? C2 08 00
define(CWndMan__OnKey,013DAB90) // v116




[Enable]
alloc(PetFullnessHook,64)
alloc(PressKey,128)
label(DontFeed)




// PressKey flags and internal stuff
define(KEY_PRESS,0)
define(KEY_UP,1)
define(MAPVK_VK_TO_VSC,0)




// Pet fullness hook
PetFullnessAddy:
jmp PetFullnessHook
nop




PetFullnessHook:
mov [esi+000000D4],edx // original code 160.3
cmp edx,FeedFullness
jg DontFeed




push KEY_PRESS          // transition_state
push FoodKeyType // extended_flag
push FoodKey     // virtual_key
call PressKey




DontFeed:
jmp PetFullnessAddy+6




// void __stdcall PressKey(uint32_t virtual_key, uint32_t extended_flag, uint32_t transition_state)
PressKey:
push ebx // backup
push edx // backup
push esi // backup
push ecx // backup




mov edx, [esp+10+4] // edx = virtual keycode
mov esi, [esp+10+8] // esi = is extended keycode
mov ebx, [esp+10+C] // ebx = transition state flag
mov ecx, edx        // ecx = virtual keycode (will later contain the scancode)




// generate scancode with MapVirtualKeyA(virtual_key, MAPVK_VK_TO_VSC) << 16
// credits to Shadow and Waty
push MAPVK_VK_TO_VSC
push ecx
call MapVirtualKeyA
shl eax,#16
shl esi,#24 // extended flag
shl ebx,#31 // transition state
or eax, esi
or eax, ebx
mov ecx,eax




push ecx // lparam (keycode)
push edx // wparam (virtual keycode)
mov ecx,[TSingleton_CWndMan___ms_pInstance]
call CWndMan__OnKey




pop ecx // backup
pop esi // backup
pop edx // backup
pop ebx // backup
ret 000C




[Disable]
PetFullnessAddy:
mov [esi+000000D4],edx // original code 160.3




dealloc(PetFullnessHook)

dealloc(PressKey)

:wut:

Edited by Schnee

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×