Page 1 of 1

King's Bounty: The Legend

Posted: Wed Mar 29, 2017 10:17 am
by STN
Credits: Recifense.

Here is my contribution for the King's Bounty: The Legend version 1.6b7. It contains infinite action points for troop moving in combat, Minimum Runes, gold and Leardership. There are also options to enable/disable them (enabled by default).


// King's Bounty. The Legend
// Game Version : 1.6b7
// Script Version: 1.0
// CE Version : 5.4
// Action points, God Mode, Runes, Leadership and gold
// 18-Oct-2008

[ENABLE]
alloc(MyCode,1024)

// Declaration session
label(_ActionPoints)
label(_TroopSize)
label(_TroopHP)
label(_MonResources)
label(_BackAP)
label(_BackTS)
label(_BackTH)
label(_BackMR)
label(_MonR0)
label(_MonR1)
label(_ExitAP)
label(_ExitTS)
label(_ExitTH)
label(_ExitMR)
label(iEnableAP)
label(iEnableTS)
label(iEnableTH)
label(iEnableMR)
label(aMoney)
label(aRune)
label(aLeader)
label(iEAX)
label(iMinimumLS)

registersymbol(MyCode)
registersymbol(iEnableAP)
registersymbol(iEnableTS)
registersymbol(iEnableTH)
registersymbol(iEnableMR)
registersymbol(iMinimumLS)

//=========================================
// Hacking Points
kb.exe+5c75f:
jmp _ActionPoints
nop
nop
_BackAP:

kb.exe+58627:
jmp _TroopSize
nop
_BackTS:

kb.exe+5861c:
jmp _TroopHP
_BackTH:

kb.exe+446c4:
jmp _MonResources
nop
nop
_BackMR:

MyCode:
//=========================================
// It does not let AP decrease during movement
_ActionPoints:
cmp dword ptr [iEnableAP],0 // Is it disabled?
je _ExitAP // Jump if true

cmp dword ptr [ecx+000001cc],1 // Player´s troop?
jne _ExitAP // Jump if false

mov eax,[ecx+28] // EAX = Original HP
add eax,#1000
mov [ecx+0c],eax // HP = Original HP + 1000

xor eax,eax // Make AP to decrease = 0

_ExitAP:
sub [ecx+14],eax // Original code
cmp dword ptr [ecx+14],00 // Original code
jmp _BackAP // Back to main code

//=========================================
// It does not let the troop size decrease during combat
_TroopSize:
cmp dword ptr [iEnableTS],0 // Is it disabled?
je _ExitTS // Jump if true

cmp dword ptr [ecx+000001cc],1 // Player´s troop?
jne _ExitTS // Jump if false

mov edx,[ecx+0000010c] // Troop Size = Original Size

_ExitTS:
mov [ecx+10],edx // Original code
mov eax,[ebx+18] // Original code
jmp _BackTS // Back to main code

//=========================================
// It does not let the troop HP decrease during combat
_TroopHP:
cmp dword ptr [iEnableTH],0 // Is it disabled?
je _ExitTH // Jump if true

cmp dword ptr [ecx+000001cc],1 // Player´s troop?
jne _ExitTH // Jump if false

mov edx,[ecx+28] // EDX = Original HP
add edx,#5000 // New HP = Original HP + 5000

_ExitTH:
mov [ecx+0c],edx // Original code
mov eax,[ebx] // Original code
jmp _BackTH // Back to main code

//=========================================
// It monitors Money and Runes
_MonResources:
mov [iEAX],eax

cmp dword ptr [iEnableMR],0 // Is it disabled?
je _ExitMR // Jump if true

mov ebp,[ecx+eax*4] // Original code
mov [esp+18],ebp // Original code

mov eax,[edi+04]
mov eax,[eax+14]
cmp eax,[aMoney]
jne _MonR0

mov eax,#50000
cmp eax,[ebp+08]
jle _ExitMR

mov [ebp+08],eax
jmp _ExitMR

_MonR0:
cmp eax,[aRune]
jne _MonR1

mov eax,#10
cmp eax,[ebp+08]
jle _ExitMR

mov [ebp+08],eax
jmp _ExitMR

_MonR1:
cmp eax,[aLeader]
jne _ExitMR

mov eax,[iMinimumLS]
cmp eax,[ebp+08]
jle _ExitMR

mov [ebp+08],eax

_ExitMR:
mov eax,[iEAX]
jmp _BackMR

//=========================================
// Variables
iEnableAP:
dd 1
iEnableTS:
dd 1
iEnableTH:
dd 1
iEnableMR:
dd 1
iMinimumLS:
dd #3000
aMoney:
db 'mone'
aRune:
db 'rune'
aLeader:
db 'lead'
iEAX:
dd 0

//=========================================
// Original Codes
[DISABLE]
kb.exe+5c75f:
sub [ecx+14],eax
cmp dword ptr [ecx+14],00

kb.exe+58627:
mov [ecx+10],edx
mov eax,[ebx+18]

kb.exe+5861c:
mov [ecx+0c],edx
mov eax,[ebx]

kb.exe+446c4:
mov ebp,[ecx+eax*4]
mov [esp+18],ebp

dealloc(MyCode)
unregistersymbol(MyCode)
unregistersymbol(iEnableAP)
unregistersymbol(iEnableTS)
unregistersymbol(iEnableTH)
unregistersymbol(iEnableMR)
unregistersymbol(iMinimumLS)


Cheers.

download/file.php?id=1044