Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Upload your cheat tables here (No requests)
Elcano
What is cheating?
What is cheating?
Posts: 1
Joined: Mon Aug 15, 2022 3:09 pm
Reputation: 1

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by Elcano »

yazz wrote:
Tue Aug 09, 2022 11:20 pm

Code: Select all

{
===========================================
 Game Title    : Total War - Warhammer 2
 Game Version  : 1.12.1 (20163) (The Silence & The Fury)
 Game Sponsor  : Myself (Game+DLCs) (with Patreon's fund)
 Process Name  : Warhammer2.exe
 Relevant Info : 64bits/TBS/RTS
 Script Version: 8.4 (LJ)
 CE Version    : 7.4
 Release date  : 02-May-2022
 Author        : Recifense
 History:
 29-Sep-2017: First Release
 30-Sep-2017: Trying to Fix Construction + Minimum Food (s2.0)
 01-Oct-2017: Added "Rites Cooldown in 1 turn" and fix "CanActAgain" (s3.0)
 03-Oct-2017: Included Arks in Pop Surplus (s3.1)
 10-Oct-2017: God Mode for Auto-Resolve battles and Troop Quick Level Up (s3.2)
 26-Oct-2017: Release for version 1.1.0-4871
 28-Oct-2017: Porting of AMBER features from Warhammer TW (s3.3)
 04-Nov-2017: Release for version 1.1.0-5003 beta
 09-Nov-2017: Release for version 1.1.1-5078
 14-Dec-2017: Release for version 1.2.0-5568
 23-Jan-2018: Release for version 1.3.0-6014 (Rise of the Tomb kings)
 24-Jan-2018: Added two more features releated to spell durng combat (s5.0)
 25-Jan-2018: Include spells related to the army (s5.1)
 30-Jan-2018: Minimum Slave per Settlement (Dark Elves) (s5.2)
 14-Feb-2018: Release for version 1.3.1-6213 + Min Pop Surplus = 30 (s5.3)
 31-May-2018: Release for version 1.4.0-7243
 20-Jun-2018: Release for version 1.4.0-7312 Beta (CE68)(s5.4)
 21-Jun-2018: Release for version 1.4.1-7450
 30-Jun-2018: Include "Ever fresh units (Full Vigour)" (CE67)(s5.5)
 10-Nov-2018: Release for version 1.5.0-8774 (s6.0)
 11-Nov-2018: Fix for unlimited spell + can Search Treasure again  (s6.1)
 16-Dec-2018: Release for version 1.5.1-9184 Beta (s6.2)
 22-Jan-2019: Release for version 1.5.1-9466 Beta (s6.3)
 18-Apr-2019: Release for version 1.6.0-10563 (s6.4)
 20-Apr-2019: Skaven Warpstorm and Warp-Fuel + Lizards Sacrificial Offerings (s6.5)
 16-May-2019: Release for version 1.6.1-10846 (s6.6)
 12-Sep-2019: Release for version 1.7.0-11694 + Feature (Old Ones) (s6.7)(CE70)
 17-Sep-2019: Release for version 1.7.1-11765 (s6.8)
 23-Sep-2019: Changed the hacking method to long jumps (s7.0)
 16-Oct-2019: Release for version 1.7.2-12104 (s7.1)
 14-Dec-2019: Release for version 1.8.0-13017 (s7.2)
 15-Dec-2019: Fix for crashing during RTS battle (s7.3)
 18-Dec-2019: Release for version 1.8.1-13089 (s7.4)
 13-Jan-2020: Release for version 1.8.2-13152 (s7.5)
 28-Feb-2020: Release for version 1.8.3-13831 (s7.6)
 25-May-2020: Release for version 1.9.0-15159 (s7.7) Preliminary
 26-May-2020: Fix for Rites/Influence (s7.8)
 29-May-2020: Release for version 1.9.1-15282 + New feature (s7.9)
 13-Jun-2020: Release for version 1.9.2-15323 (beta)(s7.10)
 18-Jun-2020: Release for version 1.9.2-15501 (beta2)(s7.11)
 13-Jul-2020: Release for version 1.9.2-15685 (beta3) + Fix for Amber (event)(s7.12)
 05-Dec-2020: Release for version 1.10.0-16858 (s7.13)
 07-Jan-2021: Release for version 1.10.1-16966 (s7.14)
 08-Feb-2021: Release for version 1.10.2-17427 (s7.15)
 20-Mar-2021: Release for version 1.11.0-18012 (s7.16)
 22-Apr-2021: Release for version 1.11.1-18231 (s7.17)
 29-Apr-2021: Fix for Rites (s7.18)
 15-Jul-2021: Release for version 1.12.0-18858 (s7.19P) Preliminary
 16-Jul-2021: Release for version 1.12.0-18858 (s8.0) + Minimum Dread
 22-Jul-2021: Fix for Spell Cooldown (s8.1)
 08-Sep-2021: Release for version 1.21.1-19098 (s8.2)
 03-Nov-2021: Release for version 1.21.1-19592 (s8.3)
 02-May-2022: Release for version 1.21.1-20163 (s8.4)
 Features:
 - God Mode  (RTS)
 - Full Ammo (RTS)
 - Minimum Leadership (GM) (RTS)
 - Fast Recover of Winds of Magic (RTS)
 - Unlimited use of limited spells  (RTS) (s5.0) new
 - Spell Quick Cooldown (RTS)             (s5.0) new
 - Ever fresh units  (RTS)                (s5.5) new
 - Minimum Treasure
 - Minimum Influence
 - Minimum Food (Skaven)
 - Unlimited Action Points
 - Recover Troop Size/Hero HP
 - Research in 1 turn
 - Recruitment in 1 turn
 - Construction in 1 turn
 - Rites Cooldown in 1 turn
 - Minimum Public Order
 - Minimum Pop Surplus (including Arks) (s3.1)
 - Level almost complete (sel hero XP)
 - Hero can Act Again
   - Included Search for Treasure    (s6.1)
 - God Mode for Auto-resolve battles (s3.2)
 - Troops Quick Level Up             (s3.2)
 - Minimum Amber Per Settlement      (s3.3)
 - Minimum Event Total Amber         (s3.3)
 - Minimum Slaves Per Settlement     (s5.2) (for Dark Elves) (Pending)
 - Minimum Special Resources:        (s6.5)
   - Nukes and Warps (Skaven)
   - Sacrificial Offerings (Lizards)
 - Minimum Old Ones                  (s6.7) (for Nakai the Wanderer)
 - Minimum Scraps                    (s7.9) (for Grom the Paunch)
 - Minimum Dread                     (s8.0) (new) (for Taurox the Brass Bull)
 - Some Pointers
===========================================
}


//=========================================
// Checking CE version
{$lua}
  if(getCEVersion() < 7.0) then
    ShowMessage('Warning. CE version should be 7.0 or above')
  end
{$asm}

//=========================================
// Checking Selected Process
{$lua}
  if(process == nil) then
    ShowMessage('No process was selected')
  elseif (string.upper(process) ~= string.upper("Warhammer2.exe")) then
    ShowMessage('Warning. Expected Process = Warhammer2.exe')
  end
{$asm}

//=========================================
{$lua}
--  monoAA_USEMONO(process,false)
  if waitForPDB then --this way older CE versions are unaffected (by Dark Byte)
    waitForPDB()
  end
{$asm}

//=========================================
// Definitions
define(LUDO,"Warhammer2.exe")
define(GDMD,warhammer2.exe+2098B00) //20==#====#==#=#===
define(MOTA,warhammer2.exe+23BB27E) //20==#====#====#===
define(GDM2,warhammer2.exe+217FD00) //20==#====#==#=#===
define(MOTU,warhammer2.exe+22A10DD) //20==#====#==#=#=== 2 1
define(MOWM,warhammer2.exe+2018023) //20==#=============
define(MOSU,Warhammer2.exe+02024250) //20==#=========PPPP (s5.0)
define(MSCD,warhammer2.exe+1E0CC2C) //20==#====#====#=== (s5.0)
define(CSCD,Warhammer2.exe+020108F0)
define(MSU2,warhammer2.exe+2010F70) //20==PPPPPPPPPPX=== (s5.1)
define(MSC2,warhammer2.exe+1E0C8C8) //20==#=========#=== (s5.1)
define(MOUS,warhammer2.exe+219F29C) //20==#====#==#=#=== (s5.5)
//-- 10
define(MOHP,warhammer2.exe+29ACADA) //20==#=======#=#===
//define(MOAP,Warhammer2.exe+1C7A9AF0) //20==#=============
define(MAP2,warhammer2.exe+14A693A) //20==#====##=#=====
define(MAP3,warhammer2.exe+1A35730) //20==#=============
//define(MAP4,Warhammer2.exe+1CC56DB3) //20==#=============
define(MORP,warhammer2.exe+18937B6) //20==X====##===#===
define(MOTR,warhammer2.exe+1A87826) //20==#=============
define(COTR,Warhammer2.exe+01A86F80)
define(JOTR,Warhammer2.exe+01A8736D)
define(MOCP,warhammer2.exe+1BD8170) //20==#=========#===
//define(MOPO,Warhammer2.exe+1CCFAAE1) //20==X=============
define(MOPS,warhammer2.exe+2AB109E) //20==#=======#=#===
//-- 20
define(MPS2,warhammer2.exe+180949C) //20==#=========#=== (s3.1)
define(MOSH,warhammer2.exe+28194DC) //20==#=======#=#===
define(MOPF,warhammer2.exe+295DD48) //20==#=======#=====
//define(MORC,Warhammer2.exe+1CCA90E6) //20==X====X=#======
//define(MRC2,Warhammer2.exe+1CCA91E8) //20==X====X=#======
define(GMTB,warhammer2.exe+1465C08) //20==X====#==#=#=== (s3.2)
define(MOPA,warhammer2.exe+D0E8B2) //20==#============= (s3.3)

define(MSPS,Warhammer2.exe+00b0d0e2) //20PPPPPPPPPPPPPPPP (s5.2)
define(CSPS,Warhammer2.exe+00afabd0)

define(RPAS,Warhammer2.exe+0882141B) //20==#=========PPPP (s3.3)
define(RPAE,Warhammer2.exe+095C17BC) //20==#===#===#PPPPP (s3.3)

//=========================================
// Constants used in the script (that can be changed)
define(ctCE67,(float)7.0)
define(ctMMON,#70000)  // Minimum Money
define(ctMINF,#70)     // Minimum Influence
define(ctMFOO,#80)     // Minimum Food
define(ctMSSR,#12)     // Minimum Skaven Special Resources
define(ctMLSR,#500)    // Minimum Lizard Special Resource
define(ctMAPS,(float)5.0)  // OK
define(ctMAPE,(float)20.0) // OK

//=========================================
[ENABLE]
//=========================================
//LuaCall(CheckVersion())
//=========================================
// Check if script is compatible to this game version
// If false the script will not be loaded

assert(GDMD,44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1 44 89 41 04 8B 01)
assert(MOTA,45 85 C0 74 07 41 8D 48 FF 89 0C 38 84 D2 0F 84 ?? ?? 00 00 85 C9)
assert(GDM2,40 55 56 41 54 41 56 48 8D 6C 24 D8 48 81 EC 28 01 00 00 48 8B F1 4C 8B F2 48 8B 89 E0 02)
assert(MOTU,F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00 48 85 C9 74 ?? E8 ??)
assert(MOWM,F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08 76 ?? F3 0F 11 4F 08 49 83)
//assert(MOSU,48 8B 46 10 83 78 28 00 7C 03 FF 4E 30 0F 57 F6 48 85 ED ?? ?? 48)   //P
assert(MSCD,48 8B 95 90 3B 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MSU2,48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C C3 CC ?? ?? ?? ?? ?? ?? ??)
assert(MSC2,48 8B 95 E0 02 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MOUS,03 C3 48 8B 5C 24 78 01 87 EC 06 00 00 48 8B CF E8 ?? ?? ?? ?? 4C)
//-- 10
assert(MOHP,48 8B 8A 88 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)
//assert(MOAP,44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1 41 39 D0 41 0F 47 C1)
assert(MAP2,41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00 49 8B 46 70 48 85 C0 ??)
assert(MAP3,44 8B 49 2C 45 33 C0 41 8B C1 2B C2 41 3B D1 44 0F 46 C0 44 89 41 2C)
//assert(MAP4,29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30 01 73 30 48 8B 74 24 38 48)
assert(MORP,44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE 0F 83 ?? ?? ?? ?? 44 89 4A 0C)
assert(MOTR,E8 ?? ?? ?? ?? 85 C0 78 ?? 03 43 50 48 83 C4 20 5B C3 B8 FF FF FF)
assert(MOCP,FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0 C3 ?? ?? ?? ?? ?? ?? ?? ?? ??)
//assert(MOPO,41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01 ?? ?? 49 8B 0E 48 81 C1 A8 00)
//--19
assert(MOPS,44 8B BA 8C 03 00 00 48 8D B2 80 03 00 00 48 8B DA 4C 8B E1 48 8B CE B2 01)
assert(MPS2,48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08 C3 ?? ?? ?? ?? ?? ?? ??)
assert(MOSH,45 8B A6 54 02 00 00 44 8B F8 44 2B FB 44 2B E3 48 8B 0D ?? ?? ??)
assert(MOPF,48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58 8B 40 20 48 83 C4 40 5F C3)
//assert(MORC,FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10 44 39 73 18 77 ?? 44 88)
//assert(MRC2,FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08 48 83 C3 10 48 39 FB 75 ??)
assert(GMTB,48 8B 81 80 00 00 00 4C 8B F2 48 8B F1 80 B8 88 01 00 00 00 ?? ??)
assert(MOPA,F3 41 0F 10 48 18 0F 57 C0 0F 2F C8 76 ?? F3 0F 58 0D ?? ?? ?? ??)

//assert(MSU2,48 8b 4e 10 83 79 28 00 7c 03 ff 4e 30 0f 57 ff 48 85 db ?? ?? 80) //??
//assert(MSPS,48 85 c0 74 0b 8b 50 08 48 8b c8 e8 ?? ?? ?? ?? 48 8b 5c 24 30 48) //??

//=========================================
alloc(MyCode,8000,$process)
//=========================================
alloc(SMSCD,18,$process)
registersymbol(SMSCD)
SMSCD:
readmem(MSCD,18)
//=========================================
alloc(SMSC2,18,$process)
registersymbol(SMSC2)
SMSC2:
readmem(MSC2,18)
//=========================================
alloc(SMOTR,12,$process)
registersymbol(SMOTR)
SMOTR:
readmem(MOTR,12)
//=========================================
alloc(SMSPS,16,$process)
registersymbol(SMSPS)
SMSPS:
readmem(MSPS,16)
//=========================================
// Declaration section
label(_GodMode)
label(_BackGMD)
label(_MonTroopAmmo)
label(_BackMTA)
label(_GodMode2)
label(_BackGM2)
label(_MonTroopUnits)
label(_BackMTU)
label(_MonWindsOfMagic)
label(_BackMWM)
label(_MonSpellUse)
label(_BackMSU)
label(_MonSpellCooldown)
label(_BackMSC)
label(_MonSpellUse2)
label(_BackSU2)
label(_MonSpellCooldown2)
label(_BackSC2)
label(_MonUnitStress)
label(_BackMUS)

label(_MonHumanPlayer)
label(_BackMHP)
label(_MonActionPoints)
//label(_BackMAP)
label(_MonActionPoints2)
label(_BackAP2)
label(_MonActionPoints3)
label(_BackAP3)
label(_MonActionPoints4)
//label(_BackAP4)
label(_MonResearchProg)
label(_BackMRP)
label(_MonTroopRecruit)
label(_BackMTR)
label(_MonConstProg)
label(_BackMCP)
label(_MonPublicOrder)
//label(_BackMPO)
label(_MonPopSurplus)
label(_BackMPS)
label(_MonPopSurplus2)
label(_BackPS2)
label(_MonSelHero)
label(_BackMSH)
label(_MonPlayerFood)
label(_BackMPF)
label(_MonRitesCD)
//label(_BackMRC)
label(_MonRitesCD2)
//label(_BackRC2)
label(_GodModeTBS)
label(_BackGMT)
label(_MonPlayerAmber)
label(_BackMPA)
label(_MonSlavesPerSettlement)
label(_BackMSS)

label(iEnableGMD)
label(iEnableMTA)
label(iEnableMTL)
label(iEnableMWM)
label(iEnableMMT)
label(iEnableMAP)
label(iEnableMTS)
label(iEnableMRP)
label(iEnableMTR)
label(iEnableMCP)
label(iEnableMPO)
label(iEnableMPS)
label(iEnableMXP)
label(iEnableHAA)
label(iEnableMPI)
label(iEnableMPF)
label(iEnableMRC)
label(iEnableGMT)
label(iEnableMTX)
label(iEnablePAE)
label(iEnablePAS)
label(iEnableMSU)
label(iEnableMSC)
label(iEnableMSS)
label(iEnableMUS)
label(iEnableSSR)
label(iEnableLSR)
label(iEnableMOO)
label(iEnableSCR)
label(iEnableDRE)

label(pPlayer)
label(pLord)
label(pHero)
label(pUnit)
label(pDebug)
label(pCommon)
label(pFood)
label(lRBX)
label(aLast)

//=========================================
// Registering Symbols
registersymbol(MyCode)
registersymbol(iEnableGMD)
registersymbol(iEnableMTA)
registersymbol(iEnableMTL)
registersymbol(iEnableMWM)
registersymbol(iEnableMMT)
registersymbol(iEnableMAP)
registersymbol(iEnableMTS)
registersymbol(iEnableMRP)
registersymbol(iEnableMTR)
registersymbol(iEnableMCP)
registersymbol(iEnableMPO)
registersymbol(iEnableMPS)
registersymbol(iEnableMXP)
registersymbol(iEnableHAA)
registersymbol(iEnableMPI)
registersymbol(iEnableMPF)
registersymbol(iEnableMRC)
registersymbol(iEnableGMT)
registersymbol(iEnableMTX)
registersymbol(iEnablePAE)
registersymbol(iEnablePAS)
registersymbol(iEnableMSU)
registersymbol(iEnableMSC)
registersymbol(iEnableMSS)
registersymbol(iEnableMUS)
registersymbol(iEnableSSR)
registersymbol(iEnableLSR)
registersymbol(iEnableMOO)
registersymbol(iEnableSCR)
registersymbol(iEnableDRE)

registersymbol(pPlayer)
registersymbol(pLord)
registersymbol(pHero)
registersymbol(pUnit)
registersymbol(pDebug)
registersymbol(pCommon)
registersymbol(pFood)
registersymbol(aLast)

//=========================================
MyCode:
//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop/Hero)
// RAX is safe
_GodMode:
 mov dword ptr [aLast],'_GMD'

 mov rax,_BackGMD
 mov [pBack+00],rax

 mov [pDebug],rbx

 cmp dword ptr [iEnableGMD],0
 je _ExitGMD                       // Jump if feature is disabled

 lea rax,[rcx-00000B0C]
 cmp rax,rbx
 jne _ExitGMD

 mov rax,[rbx+000002E8]
 test rax,rax
 jz _ExitGMD

 cmp byte ptr [rax+00003B60],00
 jne _ExitGMD

 mov eax,[rcx]
 mov [rcx+04],eax

 xor edx,edx

_ExitGMD:
 mov r8d,[rcx+04]                  // Original code
 xor r9d,r9d                       // Original code
 sub r8d,edx                       // Original code
 cmp edx,[rcx+04]                  // Original code
 cmova r8d,r9d                     // Original code

 jmp [pBack+00]                    // Back to main code

//========================================= LJ 1120 #
// RTS - After decreasing Ammo
_MonTroopAmmo:
 mov dword ptr [aLast],'_MTA'

 mov rcx,_BackMTA
 mov [pBack+08],rcx

 mov ecx,r8d                       // recover ECX

 test r8d,r8d                      // Original code
 jz _MonTA00

 cmp dword ptr [iEnableMTA],0
 je _ExitMTA                       // Jump if feature is disabled

 cmp byte ptr [rdi+00003B60],00
 jne _ExitMTA

 inc ecx
 mov r8d,ecx

_ExitMTA:
 lea ecx,[r8-01]                   // Original code
 mov [rax+rdi],ecx                 // Original code

_MonTA00:
 jmp [pBack+08]                    // Back to main code

//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop)
// RAX is safe
_GodMode2:
 mov dword ptr [aLast],'_GM2'

 mov rax,_BackGM2
 mov [pBack+10],rax

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 mov rax,[rcx+000002E8]
 test rax,rax
 jz _ExitGM2

 cmp byte ptr [rax+00003B60],00
 jne _ExitGM2

 mov eax,[rcx+00000B0C]
 mov [rcx+00000B10],eax

 ret
//==
_ExitGM2:
 push rbp                          // Original code
 push rsi                          // Original code
 push r12                          // Original code
 push r14                          // Original code
 lea rbp,[rsp-28]                  // Original code

 jmp [pBack+10]                    // Back to main code

//========================================= LJ 1120 #
// RTS - All the time during battle
_MonTroopUnits:
 mov dword ptr [aLast],'_MTU'

 mov rcx,_BackMTU
 mov [pBack+18],rcx

 push rax
 push rbx
 push rdx

 mov rdx,rax

 mov rcx,[rdx+000002E8]
 test rcx,rcx
 jz _ExitMTU

 cmp dword ptr [rcx+70],55555555

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMTU

 mov rax,[rcx+70]
 mov [pCommon],rax

 cmp dword ptr [iEnableGMD],0
 je _MonTU00                       // Jump if feature is disabled

 mov eax,#110
 mov ebx,[rcx+000037AC]
 cmp ebx,eax
 cmovs ebx,eax
 mov [rcx+000037AC],ebx

 mov [rcx+000039E8],ebx
 mov [rcx+000039EC],ebx

_MonTU00:
 cmp dword ptr [iEnableGMD],0
 je _ExitMTU                       // Jump if feature is disabled

 cmp dword ptr [rdx+00000B10],0
 je _ExitMTU

 mov eax,#671000
 mov [rdx+00000B0C],eax
 mov [rdx+00000B10],eax

_ExitMTU:
 pop rdx
 pop rbx
 pop rax

 movss [rbp+000000A0],xmm0         // Original code
 mov rcx,[rax+000002E8]            // Original code (get pTroop)

 jmp [pBack+18]                    // Back to main code

//========================================= LJ 190 *
// RTS - When increasing value
// RCX is safe
_MonWindsOfMagic:
 mov dword ptr [aLast],'_MWM'

 mov rcx,_BackMWM
 mov [pBack+20],rcx

 addss xmm0,[rdi+08]               // Original code (inc cWoM)

 cmp dword ptr [iEnableMWM],0
 je _ExitMWM                       // Jump if feature is disabled

 mov rcx,[rdi]
 cmp rcx,[pCommon]
 jne _ExitMWM

 movss xmm0,xmm1

_ExitMWM:
 comiss xmm0,xmm1                  // Original code
 movss [rdi+08],xmm0               // Original code

 jmp [pBack+20]                    // Back to main code

//========================================= LJ 1110 P
// RTS - when activating a spell (troop)
_MonSpellUse:
 mov dword ptr [aLast],'_MSU'

 mov rax,_BackMSU
 mov [pBack+28],rax

 test rbp,rbp
 jz _ExitMSU

 mov rax,[rsi+10]
 cmp dword ptr [rax+28],00
 jle _ExitMSU

 cmp dword ptr [iEnableMSU],0
 je _ExitMSU                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B68],00    // s7.2 #
 jne _ExitMSU

 cmp dword ptr [rsi+30],01
 js _ExitMSU

 inc dword ptr [rsi+30]

_ExitMSU:
 mov rax,[rsi+10]                  // Original code
 cmp dword ptr [rax+28],00         // Original code
 jl _EMSU00

 dec [rsi+30]                      // Original code

_EMSU00:
 jmp [pBack+28]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (troop)
// RAX if safe
_MonSpellCooldown:
 mov dword ptr [aLast],'_MSC'

 mov rdx,_BackMSC
 mov [pBack+30],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+00003B90]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitMSC                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B60],00
 jne _ExitMSC

 mov ebx,[rsi+1C]

 sub ebx,eax

 cmp ebx,#50
 js _MonSC00

 mov ebx,#50

_MonSC00:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitMSC:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+30]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when activating a spell (army)
_MonSpellUse2:
 mov dword ptr [aLast],'_SU2'

 mov rax,_BackSU2
 mov [pBack+38],rax

 cmp rbp,[pCommon]
 jne _ExitSU2

 mov rax,[rcx+08]
 cmp dword ptr [rax+2C],00
 jle _ExitSU2

 cmp dword ptr [iEnableMSU],0
 je _ExitSU2                       // Jump if feature is disabled

 cmp dword ptr [rax+2C],01
 js _ExitSU2

 inc dword ptr [rax+2C]

_ExitSU2:
 mov rax,[rcx+08]                  // Original code
 cmp dword ptr [rax+2C],00         // Original code
 jl _ESU200                        // Original code

 dec dword ptr [rax+2C]            // Original code

_ESU200:
 jmp [pBack+38]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (army)
_MonSpellCooldown2:
 mov dword ptr [aLast],'_SC2'

 mov rdx,_BackSC2
 mov [pBack+40],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+000002E0]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitSC2                       // Jump if feature is disabled

 cmp rbp,[pCommon]
 jne _ExitSC2

 mov ebx,[rsi+1C]
 sub ebx,eax

 cmp ebx,#50
 js _MonSC20

 mov ebx,#50

_MonSC20:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitSC2:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+40]                    // Back to main code

//========================================= LJ 1120 # (Chariots)
// RTS - All the time during battle
// RCX is safe
_MonUnitStress:
 mov dword ptr [aLast],'_MUS'

 mov rcx,_BackMUS
 mov [pBack+48],rcx

 add eax,ebx                       // Original code
 mov rbx,[rsp+78]                  // Original code

 mov rcx,[rdi+000002E8]
 test rcx,rcx
 jz _ExitMUS

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMUS

 cmp dword ptr [iEnableGMD],0
 je _MonUS00                       // Jump if feature is disabled

 cmp dword ptr [rdi+00000B10],0
 je _MonUS00

 mov ecx,#671000
 mov [rdi+00000B0C],ecx
 mov [rdi+00000B10],ecx

_MonUS00:
 cmp dword ptr [iEnableMUS],0
 je _ExitMUS                       // Jump if feature is disabled

 mov [rdi+000006EC],00

 test eax,eax
 js _ExitMUS

 mov eax,#-100

_ExitMUS:
 add [rdi+000006EC],eax            // Original code (upd Stress)

 jmp [pBack+48]                    // Back to main code

//========================================= ok
//------------------------------TBS --------------------------------------
//========================================= LJ 1120 #
// TBS - All the time at main game screen
_MonHumanPlayer:
 mov dword ptr [aLast],'_MHP'

 mov rcx,_BackMHP
 mov [pBack+50],rcx

 mov rcx,[rdx+00000188]            // Original code (get pPlayer)

 mov [pPlayer],rcx
 mov rax,[rcx+00000C20]
 mov [pWay],rax
 mov rax,[rcx+00001D90]
 mov [pRites],rax

 cmp dword ptr [iEnableMMT],0
 je _MonHP00                       // Jump if feature is disabled

 mov eax,ctMMON
 cmp [rcx+00000BF0],eax
 jns _MonHP00

 mov [rcx+00000BF0],eax

_MonHP00:
 cmp dword ptr [iEnableMPI],0
 je _ExitMHP                       // Jump if feature is disabled

 cmp [rcx+00000ED0],0
 je _ExitMHP

 mov eax,ctMINF
 cmp [rcx+00000ED0],eax
 jns _ExitMHP

 mov [rcx+00000ED0],eax

_ExitMHP:
 add rcx,000002D0                  // Original code

 jmp [pBack+50]                    // Back to main code

//========================================= LJ 190 *
// TBS - WHen troop is moving (MP, TS, HHP)
// RAX is safe
_MonActionPoints:
 mov dword ptr [aLast],'_MAP'

 //mov rax,_BackMAP
 mov [pBack+58],rax

 mov rax,[rcx+78]
 cmp rax,[pPlayer]
 jne _ExitMAP

 cmp dword ptr [iEnableMAP],0
 je _MonAP00                       // Jump if feature is disabled

 xor edx,edx

_MonAP00:
 cmp dword ptr [iEnableMTS],0
 je _ExitMAP                       // Jump if feature is disabled

 mov eax,[rcx+0000008c]
 mov [rcx+00000088],eax

_ExitMAP:
 mov r8d,[rcx+000000A8]            // Original code (get AP)
 xor eax,eax                       // Original code
 mov r9d,r8d                       // Original code
 sub r9d,edx                       // Original code

 jmp [pBack+58]                    // Back to main code

//========================================= LJ 1110 *
// TBS - When Army is selected (MP, TS, HHP)
_MonActionPoints2:
 mov dword ptr [aLast],'_MA2'

 mov rax,_BackAP2
 mov [pBack+60],rax

 mov rax,[r14+78]
 cmp rax,[pPlayer]
 jne _ExitAP2

 cmp dword ptr [r14+000001b0],0
 je _MonAP2Z

 mov [pLord],r14

_MonAP2Z:
 cmp dword ptr [iEnableMAP],0
 je _MonAP20                       // Jump if feature is disabled

 mov eax,#3661
 cmp eax,[r14+000000A8]
 js _MonAP20

 mov [r14+000000A8],eax

_MonAP20:
 cmp dword ptr [iEnableMTS],0
 je _ExitAP2                       // Jump if feature is disabled

 mov eax,[r14+0000008C]
 mov [r14+00000088],eax

_ExitAP2:
 mov eax,[r14+000000A8]            // Original code (get AP)
 mov [r15+000000EC],eax            // Original code

 jmp [pBack+60]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Hero is moving
// RAX is safe
_MonActionPoints3:
 mov dword ptr [aLast],'_MA3'

 mov rax,_BackAP3
 mov [pBack+68],rax

 cmp dword ptr [iEnableMAP],0
 je _ExitAP3                       // Jump if feature is disabled

 mov rax,[rcx+00000360]
 test rax,rax
 jz _ExitAP3

 mov rax,[rax+10]
 cmp rax,[pPlayer]
 jne _ExitAP3

 mov eax,[rcx+28]
 mov [rcx+2c],eax

 xor edx,edx

 mov [rcx+30],edx

_ExitAP3:
 mov r9d,[rcx+2C]                  // Original code (get AP)
 xor r8d,r8d                       // Original code
 mov eax,r9d                       // Original code
 sub eax,edx                       // Original code

 jmp [pBack+68]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Lord is moving (in the army)
// RDI is safe
_MonActionPoints4:
 mov dword ptr [aLast],'_MA4'

 //mov rdi,_BackAP4
 mov [pBack+70],rdi

 mov rdi,[rbx+00000360]
 test rdi,rdi
 jz _ExitAP4

 mov rdi,[rdi+10]
 cmp rdi,[pPlayer]
 jne _ExitAP4

 mov [pHero],rbx                   // It is, in fact, a Lord

 cmp dword ptr [iEnableMAP],0
 je _ExitAP4                       // Jump if feature is disabled

 mov eax,[rbx+28]

 xor rsi,rsi
 mov [rbx+30],esi

_ExitAP4:
 sub esi,eax                       // Original code
 mov [rbx+2C],eax                  // Original code (upd AP)
 cmovs esi,ebp                     // Original code
 mov rbp,[rsp+30]                  // Original code

 jmp [pBack+70]                    // Back to main code

//========================================= LJ 1120 *
// TBS - During Turn Changing
// RAX is safe
_MonResearchProg:
 mov dword ptr [aLast],'_MRP'

 mov rax,_BackMRP
 mov [pBack+78],rax

 mov r9d,[rdx+0C]                  // Original code
 add r9d,r8d                       // Original code

 cmp dword ptr [iEnableMRP],0
 je _ExitMRP                       // Jump if feature is disabled

 mov rax,[rsi+20]
 cmp rax,[pPlayer]
 jne _ExitMRP

 mov r9d,[rcx+5C]

_ExitMRP:
 cmp r9d,[rcx+5C]                  // Original code (chk if finished)
 mov rcx,rsi                       // Original code

 jmp [pBack+78]                    // Back to main code

//========================================= LJ 190 *
// TBS - When looking at the Army (When recruiting)
// RAX is safe
_MonTroopRecruit:
 mov dword ptr [aLast],'_MTR'

 mov rax,_BackMTR
 mov [pBack+80],rax

 mov rax,COTR
 call rax                          // Original code

 test eax,eax                      // Original code
 js _EMTR00

 push rcx

 cmp dword ptr [iEnableMTR],0
 je _ExitMTR                       // Jump if feature is disabled

 mov rcx,[rbx+38]
 test rcx,rcx
 jz _ExitMTR

 mov rcx,[rcx+70]
 cmp rcx,[pPlayer]
 jne _ExitMTR

 mov dword ptr [rbx+50],0

_ExitMTR:
 pop rcx

 add eax,[rbx+50]                  // Original code (get #turns)

 jmp [pBack+80]                    // Back to main code

_EMTR00:
 mov rbx,JOTR
 jmp rbx

//========================================= LJ 1120 #
// TBS - During Turn Changing
_MonConstProg:
 mov dword ptr [aLast],'_MCP'

 mov rax,_BackMCP
 mov [pBack+88],rax

 inc [rcx+0C]                      // Original code (upd prog)

 cmp dword ptr [rcx+10],1
 je _ExitMCP

 cmp dword ptr [iEnableMCP],0
 je _ExitMCP                       // Jump if feature is disabled

 cmp r14,[pPlayer]
 jne _ExitMCP

 mov eax,[rcx+10]
 mov [rcx+0C],eax

_ExitMCP:
 mov eax,[rcx+0C]                  // Original code
 cmp eax,[rcx+10]                  // Original code
 setae al                          // Original code

 jmp [pBack+88]                    // Back to main code

//========================================= LJ 190 X
// TBS - During Turn Changing
_MonPublicOrder:
 mov dword ptr [aLast],'_MPO'

 //mov rcx,_BackMPO
 mov [pBack+90],rcx

 cmp dword ptr [iEnableMPO],0
 je _ExitMPO                       // Jump if feature is disabled

 cmp r15,[pPlayer]
 jne _ExitMPO
{
 xor edx,edx

 mov ebx,[r14+30]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+30],ebx
 mov ebx,[r14+34]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+34],ebx
 mov ebx,[r14+38]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+38],ebx
 mov ebx,[r14+3c]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+3c],ebx
}

 mov ecx,[r14+3C]
 add ecx,eax
 cmp ecx,#68
 jns _ExitMPO

 mov ecx,[r14+3C]
 mov eax,#68
 sub eax,ecx                       // Val to be added

_ExitMPO:
 mov ecx,[r14+3C]                  // Original code
 mov [rbx+0C],ecx                  // Original code (upd PO)
 cmp dword ptr [r14+4C],01         // Original code

 jmp [pBack+90]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When looking at the Province
_MonPopSurplus:
 mov dword ptr [aLast],'_MPS'

 mov rsi,_BackMPS
 mov [pBack+98],rsi

 cmp dword ptr [iEnableMPS],0
 je _ExitMPS                       // Jump if feature is disabled

 mov rsi,[rdx+000000d0]
 test rsi,rsi
 jz _ExitMPS

 mov rsi,[rsi+10]
 cmp rsi,[pPlayer]
 jne _ExitMPS

 mov esi,#30

 cmp esi,[rdx+00000388]
 js _ExitMPS

 mov [rdx+00000388],esi

_ExitMPS:
 mov r15d,[rdx+0000038C]           // Original code (Get Growth)
 lea rsi,[rdx+00000380]            // Original code

 jmp [pBack+98]                    // Back to main code

//========================================= LJ 190 *
// TBS - On ARK selection
_MonPopSurplus2:
 mov dword ptr [aLast],'_PS2'

 mov rcx,_BackPS2
 mov [pBack+00A0],rcx

 cmp dword ptr [iEnableMPS],0
 je _ExitPS2                       // Jump if feature is disabled

 mov rcx,[rax+00000140]
 test rcx,rcx
 jz _ExitPS2

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitPS2

 mov rcx,[rax+00000618]
 mov rcx,[rcx+18]

 cmp dword ptr [rcx+08],#32
 jns _ExitPS2

 mov dword ptr [rcx+08],#32

_ExitPS2:
 mov rcx,[rax+00000618]            // Original code (Get ppPopSp)
 mov rax,[rcx+18]                  // Original code
 mov eax,[rax+08]                  // Original code

 jmp [pBack+00A0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - When a hero/Lord is selected
// RCX is safe
_MonSelHero:
 mov dword ptr [aLast],'_MSH'

 mov r15,_BackMSH
 mov [pBack+00A8],r15

 mov r12,[r14]
 test r12,r12
 jz _ExitMSH

 mov [pHero],r12

 mov rcx,[r12+00000360]
 test rcx,rcx
 jz _ExitMSH

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitMSH

 cmp dword ptr [iEnableMAP],0
 je _MonSH00                       // Jump if feature is disabled

 mov esi,[r12+28]
 mov [r12+2c],esi

_MonSH00:
 cmp dword ptr [iEnableHAA],0
 je _MonSH01                       // Jump if feature is disabled

 mov byte ptr [r12+00000940],00    // (s3.0)
 mov byte ptr [r12+00000948],00

 mov byte ptr [r12+00000E28],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E29],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E2A],00    // SearchedTreasure (s6.1)

_MonSH01:
 cmp dword ptr [iEnableMXP],0
 je _ExitMSH                       // Jump if feature is disabled

 lea rcx,[rax-64]
 cmp ecx,[r14+00000254]
 js _ExitMSH

 mov [r14+00000254],ecx

_ExitMSH:
 mov r12d,[r14+00000254]           // Original code (Get XP)
 mov r15d,eax                      // Original code
 sub r15d,ebx                      // Original code

 jmp [pBack+00A8]                  // Back to main code

//========================================= LJ 1110 *
// TBS - All the time at main game screen (Skaven/Lizards)
_MonPlayerFood:
 mov dword ptr [aLast],'_MPF'

 mov rax,_BackMPF
 mov [pBack+00B0],rax

 mov rax,[rdi+08]                  // Original code

 mov rbx,[rax+08]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+18]
 cmp rbx,[pPlayer]
 jne _ExitMPF

 mov rbx,[rax]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+08]
 test rbx,rbx
 jz _ExitMPF

 mov ebx,[rbx+04]
 cmp ebx,'en_f'
 jne _MonPF00

 mov [pFood],rax

 cmp dword ptr [iEnableMPF],0
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMFOO
 jmp _MonPF0X
//--
_MonPF00:
 cmp ebx,'reac'
 je _MonPF01

 cmp ebx,'nuke'
 jne _MonPF02

_MonPF01:
 cmp dword ptr [iEnableSSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMSSR
 jmp _MonPF0X
//--
_MonPF02:
 cmp ebx,'sacr'
 jne _MonPF03

 cmp dword ptr [iEnableLSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMLSR
 jmp _MonPF0X
//--
_MonPF03:
 cmp ebx,'old_'
 jne _MonPF04

 cmp dword ptr [iEnableMOO],0      // s7.1
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF04:
 cmp ebx,'salv'
 jne _MonPF05

 cmp dword ptr [iEnableSCR],0      // s7.9 (Scrap)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF05:
 cmp ebx,'drea'
 jne _MonPF06

 cmp dword ptr [iEnableDRE],0      // s7.19 (Dread)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#3700
 jmp _MonPF0X
//--
_MonPF06:
 jmp _ExitMPF
//--
_MonPF0X:
 cmp [rax+20],ebx
 jns _ExitMPF

 mov [rax+20],ebx

_ExitMPF:
 mov rbx,[rsp+50]                  // Original code
 mov rsi,[rsp+58]                  // Original code

 jmp [pBack+00B0]                  // Back to main code

//========================================= LJ 1104 *
// TBS - During turn changing
_MonRitesCD:
 mov dword ptr [aLast],'_MRC'

// mov rax,_BackMRC
 mov [pBack+00B8],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,r8d                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitMRC

 cmp dword ptr [iEnableMRC],0
 je _ExitMRC                       // Jump if feature is disabled

 test eax,eax
 js _ExitMRC

 xor eax,eax

_ExitMRC:
 mov [rbx+10],eax                  // Original code

 jmp [pBack+00B8]                  // Back to main code

//========================================= LJ 1111 *
// TBS - During turn changing
_MonRitesCD2:
 mov dword ptr [aLast],'_RC2'

// mov rax,_BackRC2
 mov [pBack+00C0],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,edx                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitRC2

 cmp dword ptr [iEnableMRC],0
 je _ExitRC2                       // Jump if feature is disabled

 test eax,eax
 js _ExitRC2

 xor eax,eax

_ExitRC2:
 mov [rbx+08],eax                  // Original code

 jmp [pBack+00C0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - God Mode for Autobattle and Troop XP
_GodModeTBS:
 mov r14,_BackGMT
 mov [pBack+00C8],r14

 cmp dword ptr [iEnableGMT],0
 je _GodMT01                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 je _GodMT00

// mov dword ptr [rdx+58],00
// mov dword ptr [rdx+6c],00
// mov dword ptr [rdx+000000A4],00
 jmp _ExitGMT
//--
_GodMT00:
 mov r14d,[rdx+50]
 mov [rdx+58],r14d

 mov r14d,[rdx+64]
 mov [rdx+6c],r14d

 mov byte ptr [rdx+7C],01
 mov byte ptr [rdx+7E],00

_GodMT01:
 cmp dword ptr [iEnableMTX],0
 je _ExitGMT                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 jne _ExitGMT

 cmp dword ptr [rdx+0000009C],00
 je _ExitGMT

 cmp byte ptr [rcx+000000C8],09
 jns _ExitGMT

 mov r14d,#30000
 cmp [rdx+0000009C],r14d
 jns _ExitGMT

 mov [rdx+0000009C],r14d

_ExitGMT:
 mov rax,[rcx+00000080]            // Original code
 mov r14,rdx                       // Original code
 mov rsi,rcx                       // Original code

 jmp [pBack+00C8]                  // Back to main code

//========================================= LJ 190 X
// TBS - Keep human player's AMBER at minimum (per Settlement / per Event)
// RAX is safe
_MonPlayerAmber:
 mov dword ptr [aLast],'_MPA'

 mov rax,_BackMPA
 mov [pBack+00D0],rax

 mov ax,[r8+08]
 cmp ax,00eb
 je _MonPA00

 cmp ax,00ec
 jne _ExitMPA

 mov rax,RPAE
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAE],0
 je _ExitMPA                       // Jump if feature is disabled

// mov rax,[rbp+60]
// test rax,rax
// jz _ExitMPA

// mov rax,[rax+00000188]

 mov eax,[r8+18]           // for debugging

 cmp rbx,[pPlayer]         // [RSP+18]=Player as well
 jne _ExitMPA

 mov eax,ctMAPE
 jmp _MonPA01
//==
_MonPA00:
 mov rax,RPAS
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAS],0
 je _ExitMPA                       // Jump if feature is disabled

 mov rax,[rbp+60]
 test rax,rax
 jz _ExitMPA

 mov rax,[rax+00000188]
 cmp rax,[pPlayer]
 jne _ExitMPA

 mov eax,ctMAPS

_MonPA01:
 cmp [r8+18],eax
 jns _ExitMPA

 mov [r8+18],eax
 mov [r8+1c],eax

_ExitMPA:
 movss xmm1,[r8+18]                // Original code (get value)
 xorps xmm0,xmm0                   // Original code
 comiss xmm1,xmm0                  // Original code

 jmp [pBack+00D0]                  // Back to main code

//========================================= LJ ok
// TBS - Keep human player's Slaves per Settlement at minimum (for Dark Elves)
_MonSlavesPerSettlement:
 mov dword ptr [aLast],'_MSS'

 mov rdx,_BackMSS
 mov [pBack+00D8],rdx

 test rax,rax                      // Original code
 je _EMSS00                        // Original code

 movsd [qXMM0],xmm0
 movsd [qXMM1],xmm1

 cmp r15,[pPlayer]
 jne _ExitMSS

 cmp dword ptr [iEnableMSS],0
 je _ExitMSS                       // Jump if feature is disabled

 movsd xmm0,[qMinimum]
 cvtsi2sd xmm1,[rax+0c]
 mulsd xmm0,xmm1
 cvtsi2sd xmm1,[rax+08]
 maxsd xmm0,xmm1
 cvtsd2si ecx,xmm0
 mov [rax+08],ecx

_ExitMSS:
 movsd xmm0,[qXMM0]
 movsd xmm1,[qXMM1]

 mov edx,[rax+08]                  // Original code (get value)
 mov rcx,rax                       // Original code
 mov rbx,CSPS                      // RBX is safe
 call rbx                          // Original code

_EMSS00:
 jmp [pBack+00D8]                  // Back to main code

qMinimum:
 dq (double)0.20

//=========================================
align 10,'='
//=========================================
 db '===============================>'
 db 'CE7.4 Script by Recifense 220502'
//=========================================
// Variables
iEnableGMD:
 dq 0
iEnableMTA:
 dq 0
iEnableMTL:
 dq 0
iEnableMWM:
 dq 0
iEnableMMT:
 dq 0
iEnableMAP:
 dq 0
iEnableMTS:
 dq 0
iEnableMRP:
 dq 0
iEnableMTR:
 dq 0
iEnableMCP:
 dq 0
iEnableMPO:
 dq 0
iEnableMPS:
 dq 0
iEnableMXP:
 dq 0
iEnableHAA:
 dq 0
iEnableMPI:
 dq 0
iEnableMPF:
 dq 0
iEnableMRC:
 dq 0
iEnableGMT:
 dq 0
iEnableMTX:
 dq 0
iEnablePAE:
 dq 0
iEnablePAS:
 dq 0
iEnableMSU:
 dq 0
iEnableMSC:
 dq 0
iEnableMSS:
 dq 0
iEnableMUS:
 dq 0
iEnableSSR:
 dq 0
iEnableLSR:
 dq 0
iEnableMOO:
 dq 0
iEnableSCR:
 dq 0
iEnableDRE:
 dq 0
pPlayer:
 dq MyCode
pWay:
 dq MyCode
pRites:
 dq MyCode
pFood:
 dq 0
pLord:
 dq 0
pHero:
 dq 0
pUnit:
 dq 0
pDebug:
 dq 0
pCommon:
 dq MyCode
lRBX:
 dq 0
qXMM0:
 dq 0
qXMM1:
 dq 0
pRBX:
 dq 0
pBack:
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
aLast:
 db 'CE70'
iSize:
 dd iSize-MyCode

//=========================================
// Hacking Points
GDMD:
 mov rax,_GodMode
 jmp rax
 nop
 nop
 nop
 nop
 nop
_BackGMD:

MOTA:
 mov rcx,_MonTroopAmmo
 jmp rcx
_BackMTA:

GDM2:
 mov rax,_GodMode2
 jmp rax
_BackGM2:

MOTU:
 mov rcx,_MonTroopUnits
 jmp rcx
 nop
 nop
 nop
_BackMTU:

MOWM:
 mov rcx,_MonWindsOfMagic
 jmp rcx
 nop
_BackMWM:

MOSU:
// mov rax,_MonSpellUse
// jmp rax
// nop
_BackMSU:

MSCD:
 mov rdx,_MonSpellCooldown
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop
_BackMSC:

MSU2:
 mov rax,_MonSpellUse2
 jmp rax
 nop
_BackSU2:

MSC2:
 mov rdx,_MonSpellCooldown2
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop
_BackSC2:

MOUS:
 mov rcx,_MonUnitStress
 jmp rcx
 nop
_BackMUS:

// ---------------------- TBS
MOHP:
 mov rcx,_MonHumanPlayer
 jmp rcx
 nop
 nop
_BackMHP:

{MOAP:
 mov rax,_MonActionPoints
 jmp rax
 nop
 nop
 nop
_BackMAP:
}
MAP2:
 mov rax,_MonActionPoints2
 jmp rax
 nop
 nop
_BackAP2:

MAP3:
 mov rax,_MonActionPoints3
 jmp rax
_BackAP3:

{MAP4:
 mov rdi,_MonActionPoints4
 jmp rdi
 nop
_BackAP4:
}
MORP:
 mov rax,_MonResearchProg
 jmp rax
 nop
 nop
_BackMRP:

MOTR:
 mov rax,_MonTroopRecruit
 jmp rax
_BackMTR:

MOCP:
 mov rax,_MonConstProg
 jmp rax
_BackMCP:
{
MOPO:
 mov rcx,_MonPublicOrder
 jmp rcx
_BackMPO:
}
MOPS:
 mov rsi,_MonPopSurplus
 jmp rsi
 nop
 nop
_BackMPS:

MPS2:
 mov rcx,_MonPopSurplus2
 jmp rcx
 nop
 nop
_BackPS2:

MOSH:
 mov r15,_MonSelHero
 jmp r15
_BackMSH:

MOPF:
 mov rax,_MonPlayerFood
 jmp rax
 nop
 nop
_BackMPF:
{
MORC:
 mov rax,_MonRitesCD
 jmp rax
 nop
 nop
_BackMRC:

MRC2:
 mov rax,_MonRitesCD2
 jmp rax
 nop
_BackRC2:
}
GMTB:
 mov r14,_GodModeTBS
 jmp r14
_BackGMT:

MOPA:
 mov rax,_MonPlayerAmber
 jmp rax
_BackMPA:

MSPS:
{
 mov rdx,_MonSlavesPerSettlement
 jmp rdx
 nop
 nop
 nop
 nop
}
_BackMSS:

//=========================================
// Script for Restoring Original Codes
[DISABLE]
GDMD:
 db 44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1

MOTA:
 db 45 85 C0 74 07 41 8D 48 FF 89 0C 38

GDM2:
 db 40 55 56 41 54 41 56 48 8D 6C 24 D8

MOTU:
 db F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00

MOWM:
 db F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08

//MOSU:
// db 48 8B 46 10 83 78 28 00 7C 03 FF 4E 30

MSCD:
readmem(SMSCD,18)

MSU2:
 db 48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C

MSC2:
readmem(SMSC2,18)

MOUS:
 db 03 C3 48 8B 5C 24 78 01 87 EC 06 00 00

// ---------------------- TBS
MOHP:
 db 48 8b 8a 88 01 00 00 48 81 c1 d0 02 00 00

//MOAP:
 //db 44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1

MAP2:
 db 41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00

MAP3:
 db 44 8B 49 2C 45 33 C0 41 8B C1 2B C2

//MAP4:
 //db 29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30

MORP:
 db 44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE

MOTR:
readmem(SMOTR,12)

MOCP:
 db FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0

//MOPO:
 //db 41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01

MOPS:
 db 44 8b ba 8c 03 00 00 48 8d b2 80 03 00 00

MPS2:
 db 48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08

MOSH:
 db 45 8B A6 54 02 00 00 44 8B F8 44 2B FB

MOPF:
 db 48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58

//MORC:
 //db FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10

//MRC2:
 //db FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08

GMTB:
 db 48 8B 81 80 00 00 00 4C 8B F2 48 8B F1

MOPA:
 db F3 41 0F 10 48 18 0F 57 C0 0F 2F C8

//MSPS:
//readmem(SMSPS,16)

//=========================================
// Unregistering Symbols
unregistersymbol(MyCode)
unregistersymbol(iEnableGMD)
unregistersymbol(iEnableMTA)
unregistersymbol(iEnableMTL)
unregistersymbol(iEnableMWM)
unregistersymbol(iEnableMMT)
unregistersymbol(iEnableMAP)
unregistersymbol(iEnableMTS)
unregistersymbol(iEnableMRP)
unregistersymbol(iEnableMTR)
unregistersymbol(iEnableMCP)
unregistersymbol(iEnableMPO)
unregistersymbol(iEnableMPS)
unregistersymbol(iEnableMXP)
unregistersymbol(iEnableHAA)
unregistersymbol(iEnableMPI)
unregistersymbol(iEnableMPF)
unregistersymbol(iEnableMRC)
unregistersymbol(iEnableGMT)
unregistersymbol(iEnableMTX)
unregistersymbol(iEnablePAE)
unregistersymbol(iEnablePAS)
unregistersymbol(iEnableMSU)
unregistersymbol(iEnableMSC)
unregistersymbol(iEnableMSS)
unregistersymbol(iEnableMUS)
unregistersymbol(iEnableSSR)
unregistersymbol(iEnableLSR)
unregistersymbol(iEnableMOO)
unregistersymbol(iEnableSCR)
unregistersymbol(iEnableDRE)

unregistersymbol(pPlayer)
unregistersymbol(pLord)
unregistersymbol(pHero)
unregistersymbol(pUnit)
unregistersymbol(pDebug)
unregistersymbol(pCommon)
unregistersymbol(pFood)
unregistersymbol(aLast)

unregistersymbol(SMSCD)
unregistersymbol(SMSC2)
unregistersymbol(SMOTR)
unregistersymbol(SMSPS)

//=========================================
dealloc(MyCode)
dealloc(SMSCD)
dealloc(SMSC2)
dealloc(SMOTR)
dealloc(SMSPS)
//============= Scripts End ===============

// ****************************************
// NOTES
// ****************************************
{
}
this is more stable then the previous code, and note that the active chearts are only turn base cheat
Doesn't work at all, CE reports a mistake. Line 116 '&lt;' instead of '>'.
Now the mistake doesn't appear, but I cannot activate the script.

How to use this cheat table?
  1. Install Cheat Engine
  2. Double-click the .CT file in order to open it.
  3. Click the PC icon in Cheat Engine in order to select the game process.
  4. Keep the list.
  5. Activate the trainer options by checking boxes or setting values from 0 to 1

cordi
What is cheating?
What is cheating?
Posts: 1
Joined: Mon Aug 15, 2022 6:43 pm
Reputation: 0

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by cordi »

It works, but you have to try with saving-loading the game all the time. But worst of all it crashes the game constantly, so it's pretty useless.

yazz
Novice Cheater
Novice Cheater
Posts: 15
Joined: Fri Jul 22, 2022 7:32 pm
Reputation: 5

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by yazz »

Code: Select all

{
===========================================
 Game Title    : Total War - Warhammer 2
 Game Version  : 1.12.1 (20163) (The Silence & The Fury)
 Game Sponsor  : Myself (Game+DLCs) (with Patreon's fund)
 Process Name  : Warhammer2.exe
 Relevant Info : 64bits/TBS/RTS
 Script Version: 8.4 (LJ)
 CE Version    : 7.4
 Release date  : 02-May-2022
 Author        : Recifense
 History:
 29-Sep-2017: First Release
 30-Sep-2017: Trying to Fix Construction + Minimum Food (s2.0)
 01-Oct-2017: Added "Rites Cooldown in 1 turn" and fix "CanActAgain" (s3.0)
 03-Oct-2017: Included Arks in Pop Surplus (s3.1)
 10-Oct-2017: God Mode for Auto-Resolve battles and Troop Quick Level Up (s3.2)
 26-Oct-2017: Release for version 1.1.0-4871
 28-Oct-2017: Porting of AMBER features from Warhammer TW (s3.3)
 04-Nov-2017: Release for version 1.1.0-5003 beta
 09-Nov-2017: Release for version 1.1.1-5078
 14-Dec-2017: Release for version 1.2.0-5568
 23-Jan-2018: Release for version 1.3.0-6014 (Rise of the Tomb kings)
 24-Jan-2018: Added two more features releated to spell durng combat (s5.0)
 25-Jan-2018: Include spells related to the army (s5.1)
 30-Jan-2018: Minimum Slave per Settlement (Dark Elves) (s5.2)
 14-Feb-2018: Release for version 1.3.1-6213 + Min Pop Surplus = 30 (s5.3)
 31-May-2018: Release for version 1.4.0-7243
 20-Jun-2018: Release for version 1.4.0-7312 Beta (CE68)(s5.4)
 21-Jun-2018: Release for version 1.4.1-7450
 30-Jun-2018: Include "Ever fresh units (Full Vigour)" (CE67)(s5.5)
 10-Nov-2018: Release for version 1.5.0-8774 (s6.0)
 11-Nov-2018: Fix for unlimited spell + can Search Treasure again  (s6.1)
 16-Dec-2018: Release for version 1.5.1-9184 Beta (s6.2)
 22-Jan-2019: Release for version 1.5.1-9466 Beta (s6.3)
 18-Apr-2019: Release for version 1.6.0-10563 (s6.4)
 20-Apr-2019: Skaven Warpstorm and Warp-Fuel + Lizards Sacrificial Offerings (s6.5)
 16-May-2019: Release for version 1.6.1-10846 (s6.6)
 12-Sep-2019: Release for version 1.7.0-11694 + Feature (Old Ones) (s6.7)(CE70)
 17-Sep-2019: Release for version 1.7.1-11765 (s6.8)
 23-Sep-2019: Changed the hacking method to long jumps (s7.0)
 16-Oct-2019: Release for version 1.7.2-12104 (s7.1)
 14-Dec-2019: Release for version 1.8.0-13017 (s7.2)
 15-Dec-2019: Fix for crashing during RTS battle (s7.3)
 18-Dec-2019: Release for version 1.8.1-13089 (s7.4)
 13-Jan-2020: Release for version 1.8.2-13152 (s7.5)
 28-Feb-2020: Release for version 1.8.3-13831 (s7.6)
 25-May-2020: Release for version 1.9.0-15159 (s7.7) Preliminary
 26-May-2020: Fix for Rites/Influence (s7.8)
 29-May-2020: Release for version 1.9.1-15282 + New feature (s7.9)
 13-Jun-2020: Release for version 1.9.2-15323 (beta)(s7.10)
 18-Jun-2020: Release for version 1.9.2-15501 (beta2)(s7.11)
 13-Jul-2020: Release for version 1.9.2-15685 (beta3) + Fix for Amber (event)(s7.12)
 05-Dec-2020: Release for version 1.10.0-16858 (s7.13)
 07-Jan-2021: Release for version 1.10.1-16966 (s7.14)
 08-Feb-2021: Release for version 1.10.2-17427 (s7.15)
 20-Mar-2021: Release for version 1.11.0-18012 (s7.16)
 22-Apr-2021: Release for version 1.11.1-18231 (s7.17)
 29-Apr-2021: Fix for Rites (s7.18)
 15-Jul-2021: Release for version 1.12.0-18858 (s7.19P) Preliminary
 16-Jul-2021: Release for version 1.12.0-18858 (s8.0) + Minimum Dread
 22-Jul-2021: Fix for Spell Cooldown (s8.1)
 08-Sep-2021: Release for version 1.21.1-19098 (s8.2)
 03-Nov-2021: Release for version 1.21.1-19592 (s8.3)
 02-May-2022: Release for version 1.21.1-20163 (s8.4)
 Features:
 - God Mode  (RTS)
 - Full Ammo (RTS)
 - Minimum Leadership (GM) (RTS)
 - Fast Recover of Winds of Magic (RTS)
 - Unlimited use of limited spells  (RTS) (s5.0) new
 - Spell Quick Cooldown (RTS)             (s5.0) new
 - Ever fresh units  (RTS)                (s5.5) new
 - Minimum Treasure
 - Minimum Influence
 - Minimum Food (Skaven)
 - Unlimited Action Points
 - Recover Troop Size/Hero HP
 - Research in 1 turn
 - Recruitment in 1 turn
 - Construction in 1 turn
 - Rites Cooldown in 1 turn
 - Minimum Public Order
 - Minimum Pop Surplus (including Arks) (s3.1)
 - Level almost complete (sel hero XP)
 - Hero can Act Again
   - Included Search for Treasure    (s6.1)
 - God Mode for Auto-resolve battles (s3.2)
 - Troops Quick Level Up             (s3.2)
 - Minimum Amber Per Settlement      (s3.3)
 - Minimum Event Total Amber         (s3.3)
 - Minimum Slaves Per Settlement     (s5.2) (for Dark Elves) (Pending)
 - Minimum Special Resources:        (s6.5)
   - Nukes and Warps (Skaven)
   - Sacrificial Offerings (Lizards)
 - Minimum Old Ones                  (s6.7) (for Nakai the Wanderer)
 - Minimum Scraps                    (s7.9) (for Grom the Paunch)
 - Minimum Dread                     (s8.0) (new) (for Taurox the Brass Bull)
 - Some Pointers
===========================================
}


//=========================================
// Checking CE version
{$lua}
  if(getCEVersion() < 7.0) then
    ShowMessage('Warning. CE version should be 7.0 or above')
  end
{$asm}

//=========================================
// Checking Selected Process
{$lua}
  if(process == nil) then
    ShowMessage('No process was selected')
  elseif (string.upper(process) ~= string.upper("Warhammer2.exe")) then
    ShowMessage('Warning. Expected Process = Warhammer2.exe')
  end
{$asm}

//=========================================
{$lua}
--  monoAA_USEMONO(process,false)
  if waitForPDB then --this way older CE versions are unaffected (by Dark Byte)
    waitForPDB()
  end
{$asm}

//=========================================
// Definitions
define(LUDO,"Warhammer2.exe")
define(GDMD,warhammer2.exe+2098B00) //20==#====#==#=#===
define(MOTA,warhammer2.exe+23BB27E) //20==#====#====#===
define(GDM2,warhammer2.exe+217FD00) //20==#====#==#=#===
define(MOTU,warhammer2.exe+22A10DD) //20==#====#==#=#=== 2 1
define(MOWM,warhammer2.exe+2018023) //20==#=============
define(MOSU,Warhammer2.exe+02024250) //20==#=========PPPP (s5.0)
define(MSCD,warhammer2.exe+1E0CC2C) //20==#====#====#=== (s5.0)
define(CSCD,Warhammer2.exe+020108F0)
define(MSU2,warhammer2.exe+2010F70) //20==PPPPPPPPPPX=== (s5.1)
define(MSC2,warhammer2.exe+1E0C8C8) //20==#=========#=== (s5.1)
define(MOUS,warhammer2.exe+219F29C) //20==#====#==#=#=== (s5.5)
//-- 10
define(MOHP,warhammer2.exe+29ACADA) //20==#=======#=#===
define(MOAP,warhammer2.exe+1BE1CF60) //20==#=============
define(MAP2,warhammer2.exe+14A693A) //20==#====##=#=====
define(MAP3,warhammer2.exe+1A35730) //20==#=============
//define(MAP4,Warhammer2.exe+1CC56DB3) //20==#=============
define(MORP,warhammer2.exe+18937B6) //20==X====##===#===
define(MOTR,warhammer2.exe+1A87826) //20==#=============
define(COTR,Warhammer2.exe+01A86F80)
define(JOTR,Warhammer2.exe+01A8736D)
define(MOCP,warhammer2.exe+1BD8170) //20==#=========#===
//define(MOPO,Warhammer2.exe+1CCFAAE1) //20==X=============
define(MOPS,warhammer2.exe+2AB109E) //20==#=======#=#===
//-- 20
define(MPS2,warhammer2.exe+180949C) //20==#=========#=== (s3.1)
define(MOSH,warhammer2.exe+28194DC) //20==#=======#=#===
define(MOPF,warhammer2.exe+295DD48) //20==#=======#=====
//define(MORC,Warhammer2.exe+1CCA90E6) //20==X====X=#======
//define(MRC2,Warhammer2.exe+1CCA91E8) //20==X====X=#======
define(GMTB,warhammer2.exe+1465C08) //20==X====#==#=#=== (s3.2)
define(MOPA,warhammer2.exe+D0E8B2) //20==#============= (s3.3)

define(MSPS,Warhammer2.exe+00b0d0e2) //20PPPPPPPPPPPPPPPP (s5.2)
define(CSPS,Warhammer2.exe+00afabd0)

define(RPAS,Warhammer2.exe+0882141B) //20==#=========PPPP (s3.3)
define(RPAE,Warhammer2.exe+095C17BC) //20==#===#===#PPPPP (s3.3)

//=========================================
// Constants used in the script (that can be changed)
define(ctCE67,(float)7.0)
define(ctMMON,#70000)  // Minimum Money
define(ctMINF,#70)     // Minimum Influence
define(ctMFOO,#80)     // Minimum Food
define(ctMSSR,#12)     // Minimum Skaven Special Resources
define(ctMLSR,#500)    // Minimum Lizard Special Resource
define(ctMAPS,(float)5.0)  // OK
define(ctMAPE,(float)20.0) // OK

//=========================================
[ENABLE]
//=========================================
//LuaCall(CheckVersion())
//=========================================
// Check if script is compatible to this game version
// If false the script will not be loaded

assert(GDMD,44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1 44 89 41 04 8B 01)
assert(MOTA,45 85 C0 74 07 41 8D 48 FF 89 0C 38 84 D2 0F 84 ?? ?? 00 00 85 C9)
assert(GDM2,40 55 56 41 54 41 56 48 8D 6C 24 D8 48 81 EC 28 01 00 00 48 8B F1 4C 8B F2 48 8B 89 E0 02)
assert(MOTU,F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00 48 85 C9 74 ?? E8 ??)
assert(MOWM,F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08 76 ?? F3 0F 11 4F 08 49 83)
//assert(MOSU,48 8B 46 10 83 78 28 00 7C 03 FF 4E 30 0F 57 F6 48 85 ED ?? ?? 48)   //P
assert(MSCD,48 8B 95 90 3B 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MSU2,48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C C3 CC ?? ?? ?? ?? ?? ?? ??)
assert(MSC2,48 8B 95 E0 02 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MOUS,03 C3 48 8B 5C 24 78 01 87 EC 06 00 00 48 8B CF E8 ?? ?? ?? ?? 4C)
//-- 10
assert(MOHP,48 8B 8A 88 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)
assert(MOAP,44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1 41 39 D0 41 0F 47 C1)
assert(MAP2,41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00 49 8B 46 70 48 85 C0 ??)
assert(MAP3,44 8B 49 2C 45 33 C0 41 8B C1 2B C2 41 3B D1 44 0F 46 C0 44 89 41 2C)
//assert(MAP4,29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30 01 73 30 48 8B 74 24 38 48)
assert(MORP,44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE 0F 83 ?? ?? ?? ?? 44 89 4A 0C)
assert(MOTR,E8 ?? ?? ?? ?? 85 C0 78 ?? 03 43 50 48 83 C4 20 5B C3 B8 FF FF FF)
assert(MOCP,FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0 C3 ?? ?? ?? ?? ?? ?? ?? ?? ??)
//assert(MOPO,41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01 ?? ?? 49 8B 0E 48 81 C1 A8 00)
//--19
assert(MOPS,44 8B BA 8C 03 00 00 48 8D B2 80 03 00 00 48 8B DA 4C 8B E1 48 8B CE B2 01)
assert(MPS2,48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08 C3 ?? ?? ?? ?? ?? ?? ??)
assert(MOSH,45 8B A6 54 02 00 00 44 8B F8 44 2B FB 44 2B E3 48 8B 0D ?? ?? ??)
assert(MOPF,48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58 8B 40 20 48 83 C4 40 5F C3)
//assert(MORC,FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10 44 39 73 18 77 ?? 44 88)
//assert(MRC2,FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08 48 83 C3 10 48 39 FB 75 ??)
assert(GMTB,48 8B 81 80 00 00 00 4C 8B F2 48 8B F1 80 B8 88 01 00 00 00 ?? ??)
assert(MOPA,F3 41 0F 10 48 18 0F 57 C0 0F 2F C8 76 ?? F3 0F 58 0D ?? ?? ?? ??)

//assert(MSU2,48 8b 4e 10 83 79 28 00 7c 03 ff 4e 30 0f 57 ff 48 85 db ?? ?? 80) //??
//assert(MSPS,48 85 c0 74 0b 8b 50 08 48 8b c8 e8 ?? ?? ?? ?? 48 8b 5c 24 30 48) //??

//=========================================
alloc(MyCode,8000,$process)
//=========================================
alloc(SMSCD,18,$process)
registersymbol(SMSCD)
SMSCD:
readmem(MSCD,18)
//=========================================
alloc(SMSC2,18,$process)
registersymbol(SMSC2)
SMSC2:
readmem(MSC2,18)
//=========================================
alloc(SMOTR,12,$process)
registersymbol(SMOTR)
SMOTR:
readmem(MOTR,12)
//=========================================
alloc(SMSPS,16,$process)
registersymbol(SMSPS)
SMSPS:
readmem(MSPS,16)
//=========================================
// Declaration section
//label(_GodMode)
label(_BackGMD)
//label(_MonTroopAmmo)
label(_BackMTA)
//label(_GodMode2)
label(_BackGM2)
//label(_MonTroopUnits)
label(_BackMTU)
//label(_MonWindsOfMagic)
label(_BackMWM)
//label(_MonSpellUse)
label(_BackMSU)
//label(_MonSpellCooldown)
label(_BackMSC)
//label(_MonSpellUse2)
label(_BackSU2)
//label(_MonSpellCooldown2)
label(_BackSC2)
//label(_MonUnitStress)
label(_BackMUS)

label(_MonHumanPlayer)
label(_BackMHP)
label(_MonActionPoints)
label(_BackMAP)
label(_MonActionPoints2)
label(_BackAP2)
label(_MonActionPoints3)
label(_BackAP3)
label(_MonActionPoints4)
//label(_BackAP4)
label(_MonResearchProg)
label(_BackMRP)
label(_MonTroopRecruit)
label(_BackMTR)
label(_MonConstProg)
label(_BackMCP)
label(_MonPublicOrder)
//label(_BackMPO)
label(_MonPopSurplus)
label(_BackMPS)
label(_MonPopSurplus2)
label(_BackPS2)
label(_MonSelHero)
label(_BackMSH)
label(_MonPlayerFood)
label(_BackMPF)
label(_MonRitesCD)
//label(_BackMRC)
label(_MonRitesCD2)
//label(_BackRC2)
label(_GodModeTBS)
label(_BackGMT)
label(_MonPlayerAmber)
label(_BackMPA)
label(_MonSlavesPerSettlement)
label(_BackMSS)

label(iEnableGMD)
label(iEnableMTA)
label(iEnableMTL)
label(iEnableMWM)
label(iEnableMMT)
label(iEnableMAP)
label(iEnableMTS)
label(iEnableMRP)
label(iEnableMTR)
label(iEnableMCP)
label(iEnableMPO)
label(iEnableMPS)
label(iEnableMXP)
label(iEnableHAA)
label(iEnableMPI)
label(iEnableMPF)
label(iEnableMRC)
label(iEnableGMT)
label(iEnableMTX)
label(iEnablePAE)
label(iEnablePAS)
label(iEnableMSU)
label(iEnableMSC)
label(iEnableMSS)
label(iEnableMUS)
label(iEnableSSR)
label(iEnableLSR)
label(iEnableMOO)
label(iEnableSCR)
label(iEnableDRE)

label(pPlayer)
label(pLord)
label(pHero)
label(pUnit)
label(pDebug)
label(pCommon)
label(pFood)
label(lRBX)
label(aLast)

//=========================================
// Registering Symbols
registersymbol(MyCode)
registersymbol(iEnableGMD)
registersymbol(iEnableMTA)
registersymbol(iEnableMTL)
registersymbol(iEnableMWM)
registersymbol(iEnableMMT)
registersymbol(iEnableMAP)
registersymbol(iEnableMTS)
registersymbol(iEnableMRP)
registersymbol(iEnableMTR)
registersymbol(iEnableMCP)
registersymbol(iEnableMPO)
registersymbol(iEnableMPS)
registersymbol(iEnableMXP)
registersymbol(iEnableHAA)
registersymbol(iEnableMPI)
registersymbol(iEnableMPF)
registersymbol(iEnableMRC)
registersymbol(iEnableGMT)
registersymbol(iEnableMTX)
registersymbol(iEnablePAE)
registersymbol(iEnablePAS)
registersymbol(iEnableMSU)
registersymbol(iEnableMSC)
registersymbol(iEnableMSS)
registersymbol(iEnableMUS)
registersymbol(iEnableSSR)
registersymbol(iEnableLSR)
registersymbol(iEnableMOO)
registersymbol(iEnableSCR)
registersymbol(iEnableDRE)

registersymbol(pPlayer)
registersymbol(pLord)
registersymbol(pHero)
registersymbol(pUnit)
registersymbol(pDebug)
registersymbol(pCommon)
registersymbol(pFood)
registersymbol(aLast)

//=========================================
MyCode:
//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop/Hero)
// RAX is safe
{_GodMode:
 mov dword ptr [aLast],'_GMD'

 mov rax,_BackGMD
 mov [pBack+00],rax

 mov [pDebug],rbx

 cmp dword ptr [iEnableGMD],0
 je _ExitGMD                       // Jump if feature is disabled

 lea rax,[rcx-00000B0C]
 cmp rax,rbx
 jne _ExitGMD

 mov rax,[rbx+000002E8]
 test rax,rax
 jz _ExitGMD

 cmp byte ptr [rax+00003B60],00
 jne _ExitGMD

 mov eax,[rcx]
 mov [rcx+04],eax

 xor edx,edx

_ExitGMD:
 mov r8d,[rcx+04]                  // Original code
 xor r9d,r9d                       // Original code
 sub r8d,edx                       // Original code
 cmp edx,[rcx+04]                  // Original code
 cmova r8d,r9d                     // Original code

 jmp [pBack+00]                    // Back to main code

//========================================= LJ 1120 #
// RTS - After decreasing Ammo
_MonTroopAmmo:
 mov dword ptr [aLast],'_MTA'

 mov rcx,_BackMTA
 mov [pBack+08],rcx

 mov ecx,r8d                       // recover ECX

 test r8d,r8d                      // Original code
 jz _MonTA00

 cmp dword ptr [iEnableMTA],0
 je _ExitMTA                       // Jump if feature is disabled

 cmp byte ptr [rdi+00003B60],00
 jne _ExitMTA

 inc ecx
 mov r8d,ecx

_ExitMTA:
 lea ecx,[r8-01]                   // Original code
 mov [rax+rdi],ecx                 // Original code

_MonTA00:
 jmp [pBack+08]                    // Back to main code

//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop)
// RAX is safe
_GodMode2:
 mov dword ptr [aLast],'_GM2'

 mov rax,_BackGM2
 mov [pBack+10],rax

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 mov rax,[rcx+000002E8]
 test rax,rax
 jz _ExitGM2

 cmp byte ptr [rax+00003B60],00
 jne _ExitGM2

 mov eax,[rcx+00000B0C]
 mov [rcx+00000B10],eax

 ret
//==
_ExitGM2:
 push rbp                          // Original code
 push rsi                          // Original code
 push r12                          // Original code
 push r14                          // Original code
 lea rbp,[rsp-28]                  // Original code

 jmp [pBack+10]                    // Back to main code

//========================================= LJ 1120 #
// RTS - All the time during battle
_MonTroopUnits:
 mov dword ptr [aLast],'_MTU'

 mov rcx,_BackMTU
 mov [pBack+18],rcx

 push rax
 push rbx
 push rdx

 mov rdx,rax

 mov rcx,[rdx+000002E8]
 test rcx,rcx
 jz _ExitMTU

 cmp dword ptr [rcx+70],55555555

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMTU

 mov rax,[rcx+70]
 mov [pCommon],rax

 cmp dword ptr [iEnableGMD],0
 je _MonTU00                       // Jump if feature is disabled

 mov eax,#110
 mov ebx,[rcx+000037AC]
 cmp ebx,eax
 cmovs ebx,eax
 mov [rcx+000037AC],ebx

 mov [rcx+000039E8],ebx
 mov [rcx+000039EC],ebx

_MonTU00:
 cmp dword ptr [iEnableGMD],0
 je _ExitMTU                       // Jump if feature is disabled

 cmp dword ptr [rdx+00000B10],0
 je _ExitMTU

 mov eax,#671000
 mov [rdx+00000B0C],eax
 mov [rdx+00000B10],eax

_ExitMTU:
 pop rdx
 pop rbx
 pop rax

 movss [rbp+000000A0],xmm0         // Original code
 mov rcx,[rax+000002E8]            // Original code (get pTroop)

 jmp [pBack+18]                    // Back to main code

//========================================= LJ 190 *
// RTS - When increasing value
// RCX is safe
_MonWindsOfMagic:
 mov dword ptr [aLast],'_MWM'

 mov rcx,_BackMWM
 mov [pBack+20],rcx

 addss xmm0,[rdi+08]               // Original code (inc cWoM)

 cmp dword ptr [iEnableMWM],0
 je _ExitMWM                       // Jump if feature is disabled

 mov rcx,[rdi]
 cmp rcx,[pCommon]
 jne _ExitMWM

 movss xmm0,xmm1

_ExitMWM:
 comiss xmm0,xmm1                  // Original code
 movss [rdi+08],xmm0               // Original code

 jmp [pBack+20]                    // Back to main code

//========================================= LJ 1110 P
// RTS - when activating a spell (troop)
_MonSpellUse:
 mov dword ptr [aLast],'_MSU'

 mov rax,_BackMSU
 mov [pBack+28],rax

 test rbp,rbp
 jz _ExitMSU

 mov rax,[rsi+10]
 cmp dword ptr [rax+28],00
 jle _ExitMSU

 cmp dword ptr [iEnableMSU],0
 je _ExitMSU                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B68],00    // s7.2 #
 jne _ExitMSU

 cmp dword ptr [rsi+30],01
 js _ExitMSU

 inc dword ptr [rsi+30]

_ExitMSU:
 mov rax,[rsi+10]                  // Original code
 cmp dword ptr [rax+28],00         // Original code
 jl _EMSU00

 dec [rsi+30]                      // Original code

_EMSU00:
 jmp [pBack+28]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (troop)
// RAX if safe
_MonSpellCooldown:
 mov dword ptr [aLast],'_MSC'

 mov rdx,_BackMSC
 mov [pBack+30],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+00003B90]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitMSC                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B60],00
 jne _ExitMSC

 mov ebx,[rsi+1C]

 sub ebx,eax

 cmp ebx,#50
 js _MonSC00

 mov ebx,#50

_MonSC00:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitMSC:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+30]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when activating a spell (army)
_MonSpellUse2:
 mov dword ptr [aLast],'_SU2'

 mov rax,_BackSU2
 mov [pBack+38],rax

 cmp rbp,[pCommon]
 jne _ExitSU2

 mov rax,[rcx+08]
 cmp dword ptr [rax+2C],00
 jle _ExitSU2

 cmp dword ptr [iEnableMSU],0
 je _ExitSU2                       // Jump if feature is disabled

 cmp dword ptr [rax+2C],01
 js _ExitSU2

 inc dword ptr [rax+2C]

_ExitSU2:
 mov rax,[rcx+08]                  // Original code
 cmp dword ptr [rax+2C],00         // Original code
 jl _ESU200                        // Original code

 dec dword ptr [rax+2C]            // Original code

_ESU200:
 jmp [pBack+38]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (army)
_MonSpellCooldown2:
 mov dword ptr [aLast],'_SC2'

 mov rdx,_BackSC2
 mov [pBack+40],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+000002E0]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitSC2                       // Jump if feature is disabled

 cmp rbp,[pCommon]
 jne _ExitSC2

 mov ebx,[rsi+1C]
 sub ebx,eax

 cmp ebx,#50
 js _MonSC20

 mov ebx,#50

_MonSC20:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitSC2:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+40]                    // Back to main code

//========================================= LJ 1120 # (Chariots)
// RTS - All the time during battle
// RCX is safe
_MonUnitStress:
 mov dword ptr [aLast],'_MUS'

 mov rcx,_BackMUS
 mov [pBack+48],rcx

 add eax,ebx                       // Original code
 mov rbx,[rsp+78]                  // Original code

 mov rcx,[rdi+000002E8]
 test rcx,rcx
 jz _ExitMUS

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMUS

 cmp dword ptr [iEnableGMD],0
 je _MonUS00                       // Jump if feature is disabled

 cmp dword ptr [rdi+00000B10],0
 je _MonUS00

 mov ecx,#671000
 mov [rdi+00000B0C],ecx
 mov [rdi+00000B10],ecx

_MonUS00:
 cmp dword ptr [iEnableMUS],0
 je _ExitMUS                       // Jump if feature is disabled

 mov [rdi+000006EC],00

 test eax,eax
 js _ExitMUS

 mov eax,#-100

_ExitMUS:
 add [rdi+000006EC],eax            // Original code (upd Stress)

 jmp [pBack+48]                    // Back to main code
}
//========================================= ok
//------------------------------TBS --------------------------------------
//========================================= LJ 1120 #
// TBS - All the time at main game screen
_MonHumanPlayer:
 mov dword ptr [aLast],'_MHP'

 mov rcx,_BackMHP
 mov [pBack+50],rcx

 mov rcx,[rdx+00000188]            // Original code (get pPlayer)

 mov [pPlayer],rcx
 mov rax,[rcx+00000C20]
 mov [pWay],rax
 mov rax,[rcx+00001D90]
 mov [pRites],rax

 cmp dword ptr [iEnableMMT],0
 je _MonHP00                       // Jump if feature is disabled

 mov eax,ctMMON
 cmp [rcx+00000BF0],eax
 jns _MonHP00

 mov [rcx+00000BF0],eax

_MonHP00:
 cmp dword ptr [iEnableMPI],0
 je _ExitMHP                       // Jump if feature is disabled

 cmp [rcx+00000ED0],0
 je _ExitMHP

 mov eax,ctMINF
 cmp [rcx+00000ED0],eax
 jns _ExitMHP

 mov [rcx+00000ED0],eax

_ExitMHP:
 add rcx,000002D0                  // Original code

 jmp [pBack+50]                    // Back to main code

//========================================= LJ 190 *
// TBS - WHen troop is moving (MP, TS, HHP)
// RAX is safe
_MonActionPoints:
 mov dword ptr [aLast],'_MAP'

 mov rax,_BackMAP
 mov [pBack+58],rax

 mov rax,[rcx+78]
 cmp rax,[pPlayer]
 jne _ExitMAP

 cmp dword ptr [iEnableMAP],0
 je _MonAP00                       // Jump if feature is disabled

 xor edx,edx

_MonAP00:
 cmp dword ptr [iEnableMTS],0
 je _ExitMAP                       // Jump if feature is disabled

 mov eax,[rcx+0000008c]
 mov [rcx+00000088],eax

_ExitMAP:
 mov r8d,[rcx+000000A8]            // Original code (get AP)
 xor eax,eax                       // Original code
 mov r9d,r8d                       // Original code
 sub r9d,edx                       // Original code

 jmp [pBack+58]                    // Back to main code

//========================================= LJ 1110 *
// TBS - When Army is selected (MP, TS, HHP)
_MonActionPoints2:
 mov dword ptr [aLast],'_MA2'

 mov rax,_BackAP2
 mov [pBack+60],rax

 mov rax,[r14+78]
 cmp rax,[pPlayer]
 jne _ExitAP2

 cmp dword ptr [r14+000001b0],0
 je _MonAP2Z

 mov [pLord],r14

_MonAP2Z:
 cmp dword ptr [iEnableMAP],0
 je _MonAP20                       // Jump if feature is disabled

 mov eax,#3661
 cmp eax,[r14+000000A8]
 js _MonAP20

 mov [r14+000000A8],eax

_MonAP20:
 cmp dword ptr [iEnableMTS],0
 je _ExitAP2                       // Jump if feature is disabled

 mov eax,[r14+0000008C]
 mov [r14+00000088],eax

_ExitAP2:
 mov eax,[r14+000000A8]            // Original code (get AP)
 mov [r15+000000EC],eax            // Original code

 jmp [pBack+60]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Hero is moving
// RAX is safe
_MonActionPoints3:
 mov dword ptr [aLast],'_MA3'

 mov rax,_BackAP3
 mov [pBack+68],rax

 cmp dword ptr [iEnableMAP],0
 je _ExitAP3                       // Jump if feature is disabled

 mov rax,[rcx+00000360]
 test rax,rax
 jz _ExitAP3

 mov rax,[rax+10]
 cmp rax,[pPlayer]
 jne _ExitAP3

 mov eax,[rcx+28]
 mov [rcx+2c],eax

 xor edx,edx

 mov [rcx+30],edx

_ExitAP3:
 mov r9d,[rcx+2C]                  // Original code (get AP)
 xor r8d,r8d                       // Original code
 mov eax,r9d                       // Original code
 sub eax,edx                       // Original code

 jmp [pBack+68]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Lord is moving (in the army)
// RDI is safe
_MonActionPoints4:
 mov dword ptr [aLast],'_MA4'

 //mov rdi,_BackAP4
 mov [pBack+70],rdi

 mov rdi,[rbx+00000360]
 test rdi,rdi
 jz _ExitAP4

 mov rdi,[rdi+10]
 cmp rdi,[pPlayer]
 jne _ExitAP4

 mov [pHero],rbx                   // It is, in fact, a Lord

 cmp dword ptr [iEnableMAP],0
 je _ExitAP4                       // Jump if feature is disabled

 mov eax,[rbx+28]

 xor rsi,rsi
 mov [rbx+30],esi

_ExitAP4:
 sub esi,eax                       // Original code
 mov [rbx+2C],eax                  // Original code (upd AP)
 cmovs esi,ebp                     // Original code
 mov rbp,[rsp+30]                  // Original code

 jmp [pBack+70]                    // Back to main code

//========================================= LJ 1120 *
// TBS - During Turn Changing
// RAX is safe
_MonResearchProg:
 mov dword ptr [aLast],'_MRP'

 mov rax,_BackMRP
 mov [pBack+78],rax

 mov r9d,[rdx+0C]                  // Original code
 add r9d,r8d                       // Original code

 cmp dword ptr [iEnableMRP],0
 je _ExitMRP                       // Jump if feature is disabled

 mov rax,[rsi+20]
 cmp rax,[pPlayer]
 jne _ExitMRP

 mov r9d,[rcx+5C]

_ExitMRP:
 cmp r9d,[rcx+5C]                  // Original code (chk if finished)
 mov rcx,rsi                       // Original code

 jmp [pBack+78]                    // Back to main code

//========================================= LJ 190 *
// TBS - When looking at the Army (When recruiting)
// RAX is safe
_MonTroopRecruit:
 mov dword ptr [aLast],'_MTR'

 mov rax,_BackMTR
 mov [pBack+80],rax

 mov rax,COTR
 call rax                          // Original code

 test eax,eax                      // Original code
 js _EMTR00

 push rcx

 cmp dword ptr [iEnableMTR],0
 je _ExitMTR                       // Jump if feature is disabled

 mov rcx,[rbx+38]
 test rcx,rcx
 jz _ExitMTR

 mov rcx,[rcx+70]
 cmp rcx,[pPlayer]
 jne _ExitMTR

 mov dword ptr [rbx+50],0

_ExitMTR:
 pop rcx

 add eax,[rbx+50]                  // Original code (get #turns)

 jmp [pBack+80]                    // Back to main code

_EMTR00:
 mov rbx,JOTR
 jmp rbx

//========================================= LJ 1120 #
// TBS - During Turn Changing
_MonConstProg:
 mov dword ptr [aLast],'_MCP'

 mov rax,_BackMCP
 mov [pBack+88],rax

 inc [rcx+0C]                      // Original code (upd prog)

 cmp dword ptr [rcx+10],1
 je _ExitMCP

 cmp dword ptr [iEnableMCP],0
 je _ExitMCP                       // Jump if feature is disabled

 cmp r14,[pPlayer]
 jne _ExitMCP

 mov eax,[rcx+10]
 mov [rcx+0C],eax

_ExitMCP:
 mov eax,[rcx+0C]                  // Original code
 cmp eax,[rcx+10]                  // Original code
 setae al                          // Original code

 jmp [pBack+88]                    // Back to main code

//========================================= LJ 190 X
// TBS - During Turn Changing
_MonPublicOrder:
 mov dword ptr [aLast],'_MPO'

 //mov rcx,_BackMPO
 mov [pBack+90],rcx

 cmp dword ptr [iEnableMPO],0
 je _ExitMPO                       // Jump if feature is disabled

 cmp r15,[pPlayer]
 jne _ExitMPO
{
 xor edx,edx

 mov ebx,[r14+30]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+30],ebx
 mov ebx,[r14+34]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+34],ebx
 mov ebx,[r14+38]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+38],ebx
 mov ebx,[r14+3c]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+3c],ebx
}

 mov ecx,[r14+3C]
 add ecx,eax
 cmp ecx,#68
 jns _ExitMPO

 mov ecx,[r14+3C]
 mov eax,#68
 sub eax,ecx                       // Val to be added

_ExitMPO:
 mov ecx,[r14+3C]                  // Original code
 mov [rbx+0C],ecx                  // Original code (upd PO)
 cmp dword ptr [r14+4C],01         // Original code

 jmp [pBack+90]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When looking at the Province
_MonPopSurplus:
 mov dword ptr [aLast],'_MPS'

 mov rsi,_BackMPS
 mov [pBack+98],rsi

 cmp dword ptr [iEnableMPS],0
 je _ExitMPS                       // Jump if feature is disabled

 mov rsi,[rdx+000000d0]
 test rsi,rsi
 jz _ExitMPS

 mov rsi,[rsi+10]
 cmp rsi,[pPlayer]
 jne _ExitMPS

 mov esi,#30

 cmp esi,[rdx+00000388]
 js _ExitMPS

 mov [rdx+00000388],esi

_ExitMPS:
 mov r15d,[rdx+0000038C]           // Original code (Get Growth)
 lea rsi,[rdx+00000380]            // Original code

 jmp [pBack+98]                    // Back to main code

//========================================= LJ 190 *
// TBS - On ARK selection
_MonPopSurplus2:
 mov dword ptr [aLast],'_PS2'

 mov rcx,_BackPS2
 mov [pBack+00A0],rcx

 cmp dword ptr [iEnableMPS],0
 je _ExitPS2                       // Jump if feature is disabled

 mov rcx,[rax+00000140]
 test rcx,rcx
 jz _ExitPS2

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitPS2

 mov rcx,[rax+00000618]
 mov rcx,[rcx+18]

 cmp dword ptr [rcx+08],#32
 jns _ExitPS2

 mov dword ptr [rcx+08],#32

_ExitPS2:
 mov rcx,[rax+00000618]            // Original code (Get ppPopSp)
 mov rax,[rcx+18]                  // Original code
 mov eax,[rax+08]                  // Original code

 jmp [pBack+00A0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - When a hero/Lord is selected
// RCX is safe
_MonSelHero:
 mov dword ptr [aLast],'_MSH'

 mov r15,_BackMSH
 mov [pBack+00A8],r15

 mov r12,[r14]
 test r12,r12
 jz _ExitMSH

 mov [pHero],r12

 mov rcx,[r12+00000360]
 test rcx,rcx
 jz _ExitMSH

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitMSH

 cmp dword ptr [iEnableMAP],0
 je _MonSH00                       // Jump if feature is disabled

 mov esi,[r12+28]
 mov [r12+2c],esi

_MonSH00:
 cmp dword ptr [iEnableHAA],0
 je _MonSH01                       // Jump if feature is disabled

 mov byte ptr [r12+00000940],00    // (s3.0)
 mov byte ptr [r12+00000948],00

 mov byte ptr [r12+00000E28],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E29],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E2A],00    // SearchedTreasure (s6.1)

_MonSH01:
 cmp dword ptr [iEnableMXP],0
 je _ExitMSH                       // Jump if feature is disabled

 lea rcx,[rax-64]
 cmp ecx,[r14+00000254]
 js _ExitMSH

 mov [r14+00000254],ecx

_ExitMSH:
 mov r12d,[r14+00000254]           // Original code (Get XP)
 mov r15d,eax                      // Original code
 sub r15d,ebx                      // Original code

 jmp [pBack+00A8]                  // Back to main code

//========================================= LJ 1110 *
// TBS - All the time at main game screen (Skaven/Lizards)
_MonPlayerFood:
 mov dword ptr [aLast],'_MPF'

 mov rax,_BackMPF
 mov [pBack+00B0],rax

 mov rax,[rdi+08]                  // Original code

 mov rbx,[rax+08]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+18]
 cmp rbx,[pPlayer]
 jne _ExitMPF

 mov rbx,[rax]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+08]
 test rbx,rbx
 jz _ExitMPF

 mov ebx,[rbx+04]
 cmp ebx,'en_f'
 jne _MonPF00

 mov [pFood],rax

 cmp dword ptr [iEnableMPF],0
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMFOO
 jmp _MonPF0X
//--
_MonPF00:
 cmp ebx,'reac'
 je _MonPF01

 cmp ebx,'nuke'
 jne _MonPF02

_MonPF01:
 cmp dword ptr [iEnableSSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMSSR
 jmp _MonPF0X
//--
_MonPF02:
 cmp ebx,'sacr'
 jne _MonPF03

 cmp dword ptr [iEnableLSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMLSR
 jmp _MonPF0X
//--
_MonPF03:
 cmp ebx,'old_'
 jne _MonPF04

 cmp dword ptr [iEnableMOO],0      // s7.1
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF04:
 cmp ebx,'salv'
 jne _MonPF05

 cmp dword ptr [iEnableSCR],0      // s7.9 (Scrap)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF05:
 cmp ebx,'drea'
 jne _MonPF06

 cmp dword ptr [iEnableDRE],0      // s7.19 (Dread)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#3700
 jmp _MonPF0X
//--
_MonPF06:
 jmp _ExitMPF
//--
_MonPF0X:
 cmp [rax+20],ebx
 jns _ExitMPF

 mov [rax+20],ebx

_ExitMPF:
 mov rbx,[rsp+50]                  // Original code
 mov rsi,[rsp+58]                  // Original code

 jmp [pBack+00B0]                  // Back to main code

//========================================= LJ 1104 *
// TBS - During turn changing
_MonRitesCD:
 mov dword ptr [aLast],'_MRC'

// mov rax,_BackMRC
 mov [pBack+00B8],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,r8d                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitMRC

 cmp dword ptr [iEnableMRC],0
 je _ExitMRC                       // Jump if feature is disabled

 test eax,eax
 js _ExitMRC

 xor eax,eax

_ExitMRC:
 mov [rbx+10],eax                  // Original code

 jmp [pBack+00B8]                  // Back to main code

//========================================= LJ 1111 *
// TBS - During turn changing
_MonRitesCD2:
 mov dword ptr [aLast],'_RC2'

// mov rax,_BackRC2
 mov [pBack+00C0],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,edx                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitRC2

 cmp dword ptr [iEnableMRC],0
 je _ExitRC2                       // Jump if feature is disabled

 test eax,eax
 js _ExitRC2

 xor eax,eax

_ExitRC2:
 mov [rbx+08],eax                  // Original code

 jmp [pBack+00C0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - God Mode for Autobattle and Troop XP
_GodModeTBS:
 mov r14,_BackGMT
 mov [pBack+00C8],r14

 cmp dword ptr [iEnableGMT],0
 je _GodMT01                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 je _GodMT00

// mov dword ptr [rdx+58],00
// mov dword ptr [rdx+6c],00
// mov dword ptr [rdx+000000A4],00
 jmp _ExitGMT
//--
_GodMT00:
 mov r14d,[rdx+50]
 mov [rdx+58],r14d

 mov r14d,[rdx+64]
 mov [rdx+6c],r14d

 mov byte ptr [rdx+7C],01
 mov byte ptr [rdx+7E],00

_GodMT01:
 cmp dword ptr [iEnableMTX],0
 je _ExitGMT                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 jne _ExitGMT

 cmp dword ptr [rdx+0000009C],00
 je _ExitGMT

 cmp byte ptr [rcx+000000C8],09
 jns _ExitGMT

 mov r14d,#30000
 cmp [rdx+0000009C],r14d
 jns _ExitGMT

 mov [rdx+0000009C],r14d

_ExitGMT:
 mov rax,[rcx+00000080]            // Original code
 mov r14,rdx                       // Original code
 mov rsi,rcx                       // Original code

 jmp [pBack+00C8]                  // Back to main code

//========================================= LJ 190 X
// TBS - Keep human player's AMBER at minimum (per Settlement / per Event)
// RAX is safe
_MonPlayerAmber:
 mov dword ptr [aLast],'_MPA'

 mov rax,_BackMPA
 mov [pBack+00D0],rax

 mov ax,[r8+08]
 cmp ax,00eb
 je _MonPA00

 cmp ax,00ec
 jne _ExitMPA

 mov rax,RPAE
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAE],0
 je _ExitMPA                       // Jump if feature is disabled

// mov rax,[rbp+60]
// test rax,rax
// jz _ExitMPA

// mov rax,[rax+00000188]

 mov eax,[r8+18]           // for debugging

 cmp rbx,[pPlayer]         // [RSP+18]=Player as well
 jne _ExitMPA

 mov eax,ctMAPE
 jmp _MonPA01
//==
_MonPA00:
 mov rax,RPAS
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAS],0
 je _ExitMPA                       // Jump if feature is disabled

 mov rax,[rbp+60]
 test rax,rax
 jz _ExitMPA

 mov rax,[rax+00000188]
 cmp rax,[pPlayer]
 jne _ExitMPA

 mov eax,ctMAPS

_MonPA01:
 cmp [r8+18],eax
 jns _ExitMPA

 mov [r8+18],eax
 mov [r8+1c],eax

_ExitMPA:
 movss xmm1,[r8+18]                // Original code (get value)
 xorps xmm0,xmm0                   // Original code
 comiss xmm1,xmm0                  // Original code

 jmp [pBack+00D0]                  // Back to main code

//========================================= LJ ok
// TBS - Keep human player's Slaves per Settlement at minimum (for Dark Elves)
_MonSlavesPerSettlement:
 mov dword ptr [aLast],'_MSS'

 mov rdx,_BackMSS
 mov [pBack+00D8],rdx

 test rax,rax                      // Original code
 je _EMSS00                        // Original code

 movsd [qXMM0],xmm0
 movsd [qXMM1],xmm1

 cmp r15,[pPlayer]
 jne _ExitMSS

 cmp dword ptr [iEnableMSS],0
 je _ExitMSS                       // Jump if feature is disabled

 movsd xmm0,[qMinimum]
 cvtsi2sd xmm1,[rax+0c]
 mulsd xmm0,xmm1
 cvtsi2sd xmm1,[rax+08]
 maxsd xmm0,xmm1
 cvtsd2si ecx,xmm0
 mov [rax+08],ecx

_ExitMSS:
 movsd xmm0,[qXMM0]
 movsd xmm1,[qXMM1]

 mov edx,[rax+08]                  // Original code (get value)
 mov rcx,rax                       // Original code
 mov rbx,CSPS                      // RBX is safe
 call rbx                          // Original code

_EMSS00:
 jmp [pBack+00D8]                  // Back to main code

qMinimum:
 dq (double)0.20

//=========================================
align 10,'='
//=========================================
 db '===============================>'
 db 'CE7.4 Script by Recifense 220502'
//=========================================
// Variables
iEnableGMD:
 dq 0
iEnableMTA:
 dq 0
iEnableMTL:
 dq 0
iEnableMWM:
 dq 0
iEnableMMT:
 dq 0
iEnableMAP:
 dq 0
iEnableMTS:
 dq 0
iEnableMRP:
 dq 0
iEnableMTR:
 dq 0
iEnableMCP:
 dq 0
iEnableMPO:
 dq 0
iEnableMPS:
 dq 0
iEnableMXP:
 dq 0
iEnableHAA:
 dq 0
iEnableMPI:
 dq 0
iEnableMPF:
 dq 0
iEnableMRC:
 dq 0
iEnableGMT:
 dq 0
iEnableMTX:
 dq 0
iEnablePAE:
 dq 0
iEnablePAS:
 dq 0
iEnableMSU:
 dq 0
iEnableMSC:
 dq 0
iEnableMSS:
 dq 0
iEnableMUS:
 dq 0
iEnableSSR:
 dq 0
iEnableLSR:
 dq 0
iEnableMOO:
 dq 0
iEnableSCR:
 dq 0
iEnableDRE:
 dq 0
pPlayer:
 dq MyCode
pWay:
 dq MyCode
pRites:
 dq MyCode
pFood:
 dq 0
pLord:
 dq 0
pHero:
 dq 0
pUnit:
 dq 0
pDebug:
 dq 0
pCommon:
 dq MyCode
lRBX:
 dq 0
qXMM0:
 dq 0
qXMM1:
 dq 0
pRBX:
 dq 0
pBack:
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
aLast:
 db 'CE70'
iSize:
 dd iSize-MyCode

//=========================================
// Hacking Points
{GDMD:
 mov rax,_GodMode
 jmp rax
 nop
 nop
 nop
 nop
 nop}
_BackGMD:

{MOTA:
 mov rcx,_MonTroopAmmo
 jmp rcx}
_BackMTA:

{GDM2:
 mov rax,_GodMode2
 jmp rax}
_BackGM2:

{MOTU:
 mov rcx,_MonTroopUnits
 jmp rcx
 nop
 nop
 nop}
_BackMTU:

{MOWM:
 mov rcx,_MonWindsOfMagic
 jmp rcx
 nop}
_BackMWM:

MOSU:
// mov rax,_MonSpellUse
// jmp rax
// nop
_BackMSU:

{MSCD:
 mov rdx,_MonSpellCooldown
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackMSC:

{MSU2:
 mov rax,_MonSpellUse2
 jmp rax
 nop}
_BackSU2:

{MSC2:
 mov rdx,_MonSpellCooldown2
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackSC2:

{MOUS:
 mov rcx,_MonUnitStress
 jmp rcx
 nop}
_BackMUS:

// ---------------------- TBS
MOHP:
 mov rcx,_MonHumanPlayer
 jmp rcx
 nop
 nop
_BackMHP:

MOAP:
 mov rax,_MonActionPoints
 jmp rax
 nop
 nop
 nop
_BackMAP:

MAP2:
 mov rax,_MonActionPoints2
 jmp rax
 nop
 nop
_BackAP2:

MAP3:
 mov rax,_MonActionPoints3
 jmp rax
_BackAP3:

{MAP4:
 mov rdi,_MonActionPoints4
 jmp rdi
 nop
_BackAP4:
}
MORP:
 mov rax,_MonResearchProg
 jmp rax
 nop
 nop
_BackMRP:

MOTR:
 mov rax,_MonTroopRecruit
 jmp rax
_BackMTR:

MOCP:
 mov rax,_MonConstProg
 jmp rax
_BackMCP:
{
MOPO:
 mov rcx,_MonPublicOrder
 jmp rcx
_BackMPO:
}
MOPS:
 mov rsi,_MonPopSurplus
 jmp rsi
 nop
 nop
_BackMPS:

MPS2:
 mov rcx,_MonPopSurplus2
 jmp rcx
 nop
 nop
_BackPS2:

MOSH:
 mov r15,_MonSelHero
 jmp r15
_BackMSH:

MOPF:
 mov rax,_MonPlayerFood
 jmp rax
 nop
 nop
_BackMPF:
{
MORC:
 mov rax,_MonRitesCD
 jmp rax
 nop
 nop
_BackMRC:

MRC2:
 mov rax,_MonRitesCD2
 jmp rax
 nop
_BackRC2:
}
GMTB:
 mov r14,_GodModeTBS
 jmp r14
_BackGMT:

MOPA:
 mov rax,_MonPlayerAmber
 jmp rax
_BackMPA:

MSPS:
{
 mov rdx,_MonSlavesPerSettlement
 jmp rdx
 nop
 nop
 nop
 nop
}
_BackMSS:

//=========================================
// Script for Restoring Original Codes
[DISABLE]
GDMD:
 db 44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1

MOTA:
 db 45 85 C0 74 07 41 8D 48 FF 89 0C 38

GDM2:
 db 40 55 56 41 54 41 56 48 8D 6C 24 D8

MOTU:
 db F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00

MOWM:
 db F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08

//MOSU:
// db 48 8B 46 10 83 78 28 00 7C 03 FF 4E 30

MSCD:
readmem(SMSCD,18)

MSU2:
 db 48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C

MSC2:
readmem(SMSC2,18)

MOUS:
 db 03 C3 48 8B 5C 24 78 01 87 EC 06 00 00

// ---------------------- TBS
MOHP:
 db 48 8b 8a 88 01 00 00 48 81 c1 d0 02 00 00

MOAP:
 db 44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1

MAP2:
 db 41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00

MAP3:
 db 44 8B 49 2C 45 33 C0 41 8B C1 2B C2

//MAP4:
 //db 29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30

MORP:
 db 44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE

MOTR:
readmem(SMOTR,12)

MOCP:
 db FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0

//MOPO:
 //db 41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01

MOPS:
 db 44 8b ba 8c 03 00 00 48 8d b2 80 03 00 00

MPS2:
 db 48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08

MOSH:
 db 45 8B A6 54 02 00 00 44 8B F8 44 2B FB

MOPF:
 db 48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58

//MORC:
 //db FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10

//MRC2:
 //db FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08

GMTB:
 db 48 8B 81 80 00 00 00 4C 8B F2 48 8B F1

MOPA:
 db F3 41 0F 10 48 18 0F 57 C0 0F 2F C8

//MSPS:
//readmem(SMSPS,16)

//=========================================
// Unregistering Symbols
unregistersymbol(MyCode)
unregistersymbol(iEnableGMD)
unregistersymbol(iEnableMTA)
unregistersymbol(iEnableMTL)
unregistersymbol(iEnableMWM)
unregistersymbol(iEnableMMT)
unregistersymbol(iEnableMAP)
unregistersymbol(iEnableMTS)
unregistersymbol(iEnableMRP)
unregistersymbol(iEnableMTR)
unregistersymbol(iEnableMCP)
unregistersymbol(iEnableMPO)
unregistersymbol(iEnableMPS)
unregistersymbol(iEnableMXP)
unregistersymbol(iEnableHAA)
unregistersymbol(iEnableMPI)
unregistersymbol(iEnableMPF)
unregistersymbol(iEnableMRC)
unregistersymbol(iEnableGMT)
unregistersymbol(iEnableMTX)
unregistersymbol(iEnablePAE)
unregistersymbol(iEnablePAS)
unregistersymbol(iEnableMSU)
unregistersymbol(iEnableMSC)
unregistersymbol(iEnableMSS)
unregistersymbol(iEnableMUS)
unregistersymbol(iEnableSSR)
unregistersymbol(iEnableLSR)
unregistersymbol(iEnableMOO)
unregistersymbol(iEnableSCR)
unregistersymbol(iEnableDRE)

unregistersymbol(pPlayer)
unregistersymbol(pLord)
unregistersymbol(pHero)
unregistersymbol(pUnit)
unregistersymbol(pDebug)
unregistersymbol(pCommon)
unregistersymbol(pFood)
unregistersymbol(aLast)

unregistersymbol(SMSCD)
unregistersymbol(SMSC2)
unregistersymbol(SMOTR)
unregistersymbol(SMSPS)

//=========================================
dealloc(MyCode)
dealloc(SMSCD)
dealloc(SMSC2)
dealloc(SMOTR)
dealloc(SMSPS)
//============= Scripts End ===============

// ****************************************
// NOTES
// ****************************************
{
}
well try this, and also your error doesn't seem logical unless either the code you change someting or didn't select a process

TheDistur6edGuy
Novice Cheater
Novice Cheater
Posts: 17
Joined: Fri Oct 02, 2020 12:39 am
Reputation: 45

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by TheDistur6edGuy »

yazz wrote:
Thu Aug 18, 2022 3:02 pm

Code: Select all

{
===========================================
 Game Title    : Total War - Warhammer 2
 Game Version  : 1.12.1 (20163) (The Silence & The Fury)
 Game Sponsor  : Myself (Game+DLCs) (with Patreon's fund)
 Process Name  : Warhammer2.exe
 Relevant Info : 64bits/TBS/RTS
 Script Version: 8.4 (LJ)
 CE Version    : 7.4
 Release date  : 02-May-2022
 Author        : Recifense
 History:
 29-Sep-2017: First Release
 30-Sep-2017: Trying to Fix Construction + Minimum Food (s2.0)
 01-Oct-2017: Added "Rites Cooldown in 1 turn" and fix "CanActAgain" (s3.0)
 03-Oct-2017: Included Arks in Pop Surplus (s3.1)
 10-Oct-2017: God Mode for Auto-Resolve battles and Troop Quick Level Up (s3.2)
 26-Oct-2017: Release for version 1.1.0-4871
 28-Oct-2017: Porting of AMBER features from Warhammer TW (s3.3)
 04-Nov-2017: Release for version 1.1.0-5003 beta
 09-Nov-2017: Release for version 1.1.1-5078
 14-Dec-2017: Release for version 1.2.0-5568
 23-Jan-2018: Release for version 1.3.0-6014 (Rise of the Tomb kings)
 24-Jan-2018: Added two more features releated to spell durng combat (s5.0)
 25-Jan-2018: Include spells related to the army (s5.1)
 30-Jan-2018: Minimum Slave per Settlement (Dark Elves) (s5.2)
 14-Feb-2018: Release for version 1.3.1-6213 + Min Pop Surplus = 30 (s5.3)
 31-May-2018: Release for version 1.4.0-7243
 20-Jun-2018: Release for version 1.4.0-7312 Beta (CE68)(s5.4)
 21-Jun-2018: Release for version 1.4.1-7450
 30-Jun-2018: Include "Ever fresh units (Full Vigour)" (CE67)(s5.5)
 10-Nov-2018: Release for version 1.5.0-8774 (s6.0)
 11-Nov-2018: Fix for unlimited spell + can Search Treasure again  (s6.1)
 16-Dec-2018: Release for version 1.5.1-9184 Beta (s6.2)
 22-Jan-2019: Release for version 1.5.1-9466 Beta (s6.3)
 18-Apr-2019: Release for version 1.6.0-10563 (s6.4)
 20-Apr-2019: Skaven Warpstorm and Warp-Fuel + Lizards Sacrificial Offerings (s6.5)
 16-May-2019: Release for version 1.6.1-10846 (s6.6)
 12-Sep-2019: Release for version 1.7.0-11694 + Feature (Old Ones) (s6.7)(CE70)
 17-Sep-2019: Release for version 1.7.1-11765 (s6.8)
 23-Sep-2019: Changed the hacking method to long jumps (s7.0)
 16-Oct-2019: Release for version 1.7.2-12104 (s7.1)
 14-Dec-2019: Release for version 1.8.0-13017 (s7.2)
 15-Dec-2019: Fix for crashing during RTS battle (s7.3)
 18-Dec-2019: Release for version 1.8.1-13089 (s7.4)
 13-Jan-2020: Release for version 1.8.2-13152 (s7.5)
 28-Feb-2020: Release for version 1.8.3-13831 (s7.6)
 25-May-2020: Release for version 1.9.0-15159 (s7.7) Preliminary
 26-May-2020: Fix for Rites/Influence (s7.8)
 29-May-2020: Release for version 1.9.1-15282 + New feature (s7.9)
 13-Jun-2020: Release for version 1.9.2-15323 (beta)(s7.10)
 18-Jun-2020: Release for version 1.9.2-15501 (beta2)(s7.11)
 13-Jul-2020: Release for version 1.9.2-15685 (beta3) + Fix for Amber (event)(s7.12)
 05-Dec-2020: Release for version 1.10.0-16858 (s7.13)
 07-Jan-2021: Release for version 1.10.1-16966 (s7.14)
 08-Feb-2021: Release for version 1.10.2-17427 (s7.15)
 20-Mar-2021: Release for version 1.11.0-18012 (s7.16)
 22-Apr-2021: Release for version 1.11.1-18231 (s7.17)
 29-Apr-2021: Fix for Rites (s7.18)
 15-Jul-2021: Release for version 1.12.0-18858 (s7.19P) Preliminary
 16-Jul-2021: Release for version 1.12.0-18858 (s8.0) + Minimum Dread
 22-Jul-2021: Fix for Spell Cooldown (s8.1)
 08-Sep-2021: Release for version 1.21.1-19098 (s8.2)
 03-Nov-2021: Release for version 1.21.1-19592 (s8.3)
 02-May-2022: Release for version 1.21.1-20163 (s8.4)
 Features:
 - God Mode  (RTS)
 - Full Ammo (RTS)
 - Minimum Leadership (GM) (RTS)
 - Fast Recover of Winds of Magic (RTS)
 - Unlimited use of limited spells  (RTS) (s5.0) new
 - Spell Quick Cooldown (RTS)             (s5.0) new
 - Ever fresh units  (RTS)                (s5.5) new
 - Minimum Treasure
 - Minimum Influence
 - Minimum Food (Skaven)
 - Unlimited Action Points
 - Recover Troop Size/Hero HP
 - Research in 1 turn
 - Recruitment in 1 turn
 - Construction in 1 turn
 - Rites Cooldown in 1 turn
 - Minimum Public Order
 - Minimum Pop Surplus (including Arks) (s3.1)
 - Level almost complete (sel hero XP)
 - Hero can Act Again
   - Included Search for Treasure    (s6.1)
 - God Mode for Auto-resolve battles (s3.2)
 - Troops Quick Level Up             (s3.2)
 - Minimum Amber Per Settlement      (s3.3)
 - Minimum Event Total Amber         (s3.3)
 - Minimum Slaves Per Settlement     (s5.2) (for Dark Elves) (Pending)
 - Minimum Special Resources:        (s6.5)
   - Nukes and Warps (Skaven)
   - Sacrificial Offerings (Lizards)
 - Minimum Old Ones                  (s6.7) (for Nakai the Wanderer)
 - Minimum Scraps                    (s7.9) (for Grom the Paunch)
 - Minimum Dread                     (s8.0) (new) (for Taurox the Brass Bull)
 - Some Pointers
===========================================
}


//=========================================
// Checking CE version
{$lua}
  if(getCEVersion() < 7.0) then
    ShowMessage('Warning. CE version should be 7.0 or above')
  end
{$asm}

//=========================================
// Checking Selected Process
{$lua}
  if(process == nil) then
    ShowMessage('No process was selected')
  elseif (string.upper(process) ~= string.upper("Warhammer2.exe")) then
    ShowMessage('Warning. Expected Process = Warhammer2.exe')
  end
{$asm}

//=========================================
{$lua}
--  monoAA_USEMONO(process,false)
  if waitForPDB then --this way older CE versions are unaffected (by Dark Byte)
    waitForPDB()
  end
{$asm}

//=========================================
// Definitions
define(LUDO,"Warhammer2.exe")
define(GDMD,warhammer2.exe+2098B00) //20==#====#==#=#===
define(MOTA,warhammer2.exe+23BB27E) //20==#====#====#===
define(GDM2,warhammer2.exe+217FD00) //20==#====#==#=#===
define(MOTU,warhammer2.exe+22A10DD) //20==#====#==#=#=== 2 1
define(MOWM,warhammer2.exe+2018023) //20==#=============
define(MOSU,Warhammer2.exe+02024250) //20==#=========PPPP (s5.0)
define(MSCD,warhammer2.exe+1E0CC2C) //20==#====#====#=== (s5.0)
define(CSCD,Warhammer2.exe+020108F0)
define(MSU2,warhammer2.exe+2010F70) //20==PPPPPPPPPPX=== (s5.1)
define(MSC2,warhammer2.exe+1E0C8C8) //20==#=========#=== (s5.1)
define(MOUS,warhammer2.exe+219F29C) //20==#====#==#=#=== (s5.5)
//-- 10
define(MOHP,warhammer2.exe+29ACADA) //20==#=======#=#===
define(MOAP,warhammer2.exe+1BE1CF60) //20==#=============
define(MAP2,warhammer2.exe+14A693A) //20==#====##=#=====
define(MAP3,warhammer2.exe+1A35730) //20==#=============
//define(MAP4,Warhammer2.exe+1CC56DB3) //20==#=============
define(MORP,warhammer2.exe+18937B6) //20==X====##===#===
define(MOTR,warhammer2.exe+1A87826) //20==#=============
define(COTR,Warhammer2.exe+01A86F80)
define(JOTR,Warhammer2.exe+01A8736D)
define(MOCP,warhammer2.exe+1BD8170) //20==#=========#===
//define(MOPO,Warhammer2.exe+1CCFAAE1) //20==X=============
define(MOPS,warhammer2.exe+2AB109E) //20==#=======#=#===
//-- 20
define(MPS2,warhammer2.exe+180949C) //20==#=========#=== (s3.1)
define(MOSH,warhammer2.exe+28194DC) //20==#=======#=#===
define(MOPF,warhammer2.exe+295DD48) //20==#=======#=====
//define(MORC,Warhammer2.exe+1CCA90E6) //20==X====X=#======
//define(MRC2,Warhammer2.exe+1CCA91E8) //20==X====X=#======
define(GMTB,warhammer2.exe+1465C08) //20==X====#==#=#=== (s3.2)
define(MOPA,warhammer2.exe+D0E8B2) //20==#============= (s3.3)

define(MSPS,Warhammer2.exe+00b0d0e2) //20PPPPPPPPPPPPPPPP (s5.2)
define(CSPS,Warhammer2.exe+00afabd0)

define(RPAS,Warhammer2.exe+0882141B) //20==#=========PPPP (s3.3)
define(RPAE,Warhammer2.exe+095C17BC) //20==#===#===#PPPPP (s3.3)

//=========================================
// Constants used in the script (that can be changed)
define(ctCE67,(float)7.0)
define(ctMMON,#70000)  // Minimum Money
define(ctMINF,#70)     // Minimum Influence
define(ctMFOO,#80)     // Minimum Food
define(ctMSSR,#12)     // Minimum Skaven Special Resources
define(ctMLSR,#500)    // Minimum Lizard Special Resource
define(ctMAPS,(float)5.0)  // OK
define(ctMAPE,(float)20.0) // OK

//=========================================
[ENABLE]
//=========================================
//LuaCall(CheckVersion())
//=========================================
// Check if script is compatible to this game version
// If false the script will not be loaded

assert(GDMD,44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1 44 89 41 04 8B 01)
assert(MOTA,45 85 C0 74 07 41 8D 48 FF 89 0C 38 84 D2 0F 84 ?? ?? 00 00 85 C9)
assert(GDM2,40 55 56 41 54 41 56 48 8D 6C 24 D8 48 81 EC 28 01 00 00 48 8B F1 4C 8B F2 48 8B 89 E0 02)
assert(MOTU,F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00 48 85 C9 74 ?? E8 ??)
assert(MOWM,F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08 76 ?? F3 0F 11 4F 08 49 83)
//assert(MOSU,48 8B 46 10 83 78 28 00 7C 03 FF 4E 30 0F 57 F6 48 85 ED ?? ?? 48)   //P
assert(MSCD,48 8B 95 90 3B 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MSU2,48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C C3 CC ?? ?? ?? ?? ?? ?? ??)
assert(MSC2,48 8B 95 E0 02 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MOUS,03 C3 48 8B 5C 24 78 01 87 EC 06 00 00 48 8B CF E8 ?? ?? ?? ?? 4C)
//-- 10
assert(MOHP,48 8B 8A 88 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)
assert(MOAP,44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1 41 39 D0 41 0F 47 C1)
assert(MAP2,41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00 49 8B 46 70 48 85 C0 ??)
assert(MAP3,44 8B 49 2C 45 33 C0 41 8B C1 2B C2 41 3B D1 44 0F 46 C0 44 89 41 2C)
//assert(MAP4,29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30 01 73 30 48 8B 74 24 38 48)
assert(MORP,44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE 0F 83 ?? ?? ?? ?? 44 89 4A 0C)
assert(MOTR,E8 ?? ?? ?? ?? 85 C0 78 ?? 03 43 50 48 83 C4 20 5B C3 B8 FF FF FF)
assert(MOCP,FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0 C3 ?? ?? ?? ?? ?? ?? ?? ?? ??)
//assert(MOPO,41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01 ?? ?? 49 8B 0E 48 81 C1 A8 00)
//--19
assert(MOPS,44 8B BA 8C 03 00 00 48 8D B2 80 03 00 00 48 8B DA 4C 8B E1 48 8B CE B2 01)
assert(MPS2,48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08 C3 ?? ?? ?? ?? ?? ?? ??)
assert(MOSH,45 8B A6 54 02 00 00 44 8B F8 44 2B FB 44 2B E3 48 8B 0D ?? ?? ??)
assert(MOPF,48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58 8B 40 20 48 83 C4 40 5F C3)
//assert(MORC,FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10 44 39 73 18 77 ?? 44 88)
//assert(MRC2,FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08 48 83 C3 10 48 39 FB 75 ??)
assert(GMTB,48 8B 81 80 00 00 00 4C 8B F2 48 8B F1 80 B8 88 01 00 00 00 ?? ??)
assert(MOPA,F3 41 0F 10 48 18 0F 57 C0 0F 2F C8 76 ?? F3 0F 58 0D ?? ?? ?? ??)

//assert(MSU2,48 8b 4e 10 83 79 28 00 7c 03 ff 4e 30 0f 57 ff 48 85 db ?? ?? 80) //??
//assert(MSPS,48 85 c0 74 0b 8b 50 08 48 8b c8 e8 ?? ?? ?? ?? 48 8b 5c 24 30 48) //??

//=========================================
alloc(MyCode,8000,$process)
//=========================================
alloc(SMSCD,18,$process)
registersymbol(SMSCD)
SMSCD:
readmem(MSCD,18)
//=========================================
alloc(SMSC2,18,$process)
registersymbol(SMSC2)
SMSC2:
readmem(MSC2,18)
//=========================================
alloc(SMOTR,12,$process)
registersymbol(SMOTR)
SMOTR:
readmem(MOTR,12)
//=========================================
alloc(SMSPS,16,$process)
registersymbol(SMSPS)
SMSPS:
readmem(MSPS,16)
//=========================================
// Declaration section
//label(_GodMode)
label(_BackGMD)
//label(_MonTroopAmmo)
label(_BackMTA)
//label(_GodMode2)
label(_BackGM2)
//label(_MonTroopUnits)
label(_BackMTU)
//label(_MonWindsOfMagic)
label(_BackMWM)
//label(_MonSpellUse)
label(_BackMSU)
//label(_MonSpellCooldown)
label(_BackMSC)
//label(_MonSpellUse2)
label(_BackSU2)
//label(_MonSpellCooldown2)
label(_BackSC2)
//label(_MonUnitStress)
label(_BackMUS)

label(_MonHumanPlayer)
label(_BackMHP)
label(_MonActionPoints)
label(_BackMAP)
label(_MonActionPoints2)
label(_BackAP2)
label(_MonActionPoints3)
label(_BackAP3)
label(_MonActionPoints4)
//label(_BackAP4)
label(_MonResearchProg)
label(_BackMRP)
label(_MonTroopRecruit)
label(_BackMTR)
label(_MonConstProg)
label(_BackMCP)
label(_MonPublicOrder)
//label(_BackMPO)
label(_MonPopSurplus)
label(_BackMPS)
label(_MonPopSurplus2)
label(_BackPS2)
label(_MonSelHero)
label(_BackMSH)
label(_MonPlayerFood)
label(_BackMPF)
label(_MonRitesCD)
//label(_BackMRC)
label(_MonRitesCD2)
//label(_BackRC2)
label(_GodModeTBS)
label(_BackGMT)
label(_MonPlayerAmber)
label(_BackMPA)
label(_MonSlavesPerSettlement)
label(_BackMSS)

label(iEnableGMD)
label(iEnableMTA)
label(iEnableMTL)
label(iEnableMWM)
label(iEnableMMT)
label(iEnableMAP)
label(iEnableMTS)
label(iEnableMRP)
label(iEnableMTR)
label(iEnableMCP)
label(iEnableMPO)
label(iEnableMPS)
label(iEnableMXP)
label(iEnableHAA)
label(iEnableMPI)
label(iEnableMPF)
label(iEnableMRC)
label(iEnableGMT)
label(iEnableMTX)
label(iEnablePAE)
label(iEnablePAS)
label(iEnableMSU)
label(iEnableMSC)
label(iEnableMSS)
label(iEnableMUS)
label(iEnableSSR)
label(iEnableLSR)
label(iEnableMOO)
label(iEnableSCR)
label(iEnableDRE)

label(pPlayer)
label(pLord)
label(pHero)
label(pUnit)
label(pDebug)
label(pCommon)
label(pFood)
label(lRBX)
label(aLast)

//=========================================
// Registering Symbols
registersymbol(MyCode)
registersymbol(iEnableGMD)
registersymbol(iEnableMTA)
registersymbol(iEnableMTL)
registersymbol(iEnableMWM)
registersymbol(iEnableMMT)
registersymbol(iEnableMAP)
registersymbol(iEnableMTS)
registersymbol(iEnableMRP)
registersymbol(iEnableMTR)
registersymbol(iEnableMCP)
registersymbol(iEnableMPO)
registersymbol(iEnableMPS)
registersymbol(iEnableMXP)
registersymbol(iEnableHAA)
registersymbol(iEnableMPI)
registersymbol(iEnableMPF)
registersymbol(iEnableMRC)
registersymbol(iEnableGMT)
registersymbol(iEnableMTX)
registersymbol(iEnablePAE)
registersymbol(iEnablePAS)
registersymbol(iEnableMSU)
registersymbol(iEnableMSC)
registersymbol(iEnableMSS)
registersymbol(iEnableMUS)
registersymbol(iEnableSSR)
registersymbol(iEnableLSR)
registersymbol(iEnableMOO)
registersymbol(iEnableSCR)
registersymbol(iEnableDRE)

registersymbol(pPlayer)
registersymbol(pLord)
registersymbol(pHero)
registersymbol(pUnit)
registersymbol(pDebug)
registersymbol(pCommon)
registersymbol(pFood)
registersymbol(aLast)

//=========================================
MyCode:
//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop/Hero)
// RAX is safe
{_GodMode:
 mov dword ptr [aLast],'_GMD'

 mov rax,_BackGMD
 mov [pBack+00],rax

 mov [pDebug],rbx

 cmp dword ptr [iEnableGMD],0
 je _ExitGMD                       // Jump if feature is disabled

 lea rax,[rcx-00000B0C]
 cmp rax,rbx
 jne _ExitGMD

 mov rax,[rbx+000002E8]
 test rax,rax
 jz _ExitGMD

 cmp byte ptr [rax+00003B60],00
 jne _ExitGMD

 mov eax,[rcx]
 mov [rcx+04],eax

 xor edx,edx

_ExitGMD:
 mov r8d,[rcx+04]                  // Original code
 xor r9d,r9d                       // Original code
 sub r8d,edx                       // Original code
 cmp edx,[rcx+04]                  // Original code
 cmova r8d,r9d                     // Original code

 jmp [pBack+00]                    // Back to main code

//========================================= LJ 1120 #
// RTS - After decreasing Ammo
_MonTroopAmmo:
 mov dword ptr [aLast],'_MTA'

 mov rcx,_BackMTA
 mov [pBack+08],rcx

 mov ecx,r8d                       // recover ECX

 test r8d,r8d                      // Original code
 jz _MonTA00

 cmp dword ptr [iEnableMTA],0
 je _ExitMTA                       // Jump if feature is disabled

 cmp byte ptr [rdi+00003B60],00
 jne _ExitMTA

 inc ecx
 mov r8d,ecx

_ExitMTA:
 lea ecx,[r8-01]                   // Original code
 mov [rax+rdi],ecx                 // Original code

_MonTA00:
 jmp [pBack+08]                    // Back to main code

//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop)
// RAX is safe
_GodMode2:
 mov dword ptr [aLast],'_GM2'

 mov rax,_BackGM2
 mov [pBack+10],rax

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 mov rax,[rcx+000002E8]
 test rax,rax
 jz _ExitGM2

 cmp byte ptr [rax+00003B60],00
 jne _ExitGM2

 mov eax,[rcx+00000B0C]
 mov [rcx+00000B10],eax

 ret
//==
_ExitGM2:
 push rbp                          // Original code
 push rsi                          // Original code
 push r12                          // Original code
 push r14                          // Original code
 lea rbp,[rsp-28]                  // Original code

 jmp [pBack+10]                    // Back to main code

//========================================= LJ 1120 #
// RTS - All the time during battle
_MonTroopUnits:
 mov dword ptr [aLast],'_MTU'

 mov rcx,_BackMTU
 mov [pBack+18],rcx

 push rax
 push rbx
 push rdx

 mov rdx,rax

 mov rcx,[rdx+000002E8]
 test rcx,rcx
 jz _ExitMTU

 cmp dword ptr [rcx+70],55555555

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMTU

 mov rax,[rcx+70]
 mov [pCommon],rax

 cmp dword ptr [iEnableGMD],0
 je _MonTU00                       // Jump if feature is disabled

 mov eax,#110
 mov ebx,[rcx+000037AC]
 cmp ebx,eax
 cmovs ebx,eax
 mov [rcx+000037AC],ebx

 mov [rcx+000039E8],ebx
 mov [rcx+000039EC],ebx

_MonTU00:
 cmp dword ptr [iEnableGMD],0
 je _ExitMTU                       // Jump if feature is disabled

 cmp dword ptr [rdx+00000B10],0
 je _ExitMTU

 mov eax,#671000
 mov [rdx+00000B0C],eax
 mov [rdx+00000B10],eax

_ExitMTU:
 pop rdx
 pop rbx
 pop rax

 movss [rbp+000000A0],xmm0         // Original code
 mov rcx,[rax+000002E8]            // Original code (get pTroop)

 jmp [pBack+18]                    // Back to main code

//========================================= LJ 190 *
// RTS - When increasing value
// RCX is safe
_MonWindsOfMagic:
 mov dword ptr [aLast],'_MWM'

 mov rcx,_BackMWM
 mov [pBack+20],rcx

 addss xmm0,[rdi+08]               // Original code (inc cWoM)

 cmp dword ptr [iEnableMWM],0
 je _ExitMWM                       // Jump if feature is disabled

 mov rcx,[rdi]
 cmp rcx,[pCommon]
 jne _ExitMWM

 movss xmm0,xmm1

_ExitMWM:
 comiss xmm0,xmm1                  // Original code
 movss [rdi+08],xmm0               // Original code

 jmp [pBack+20]                    // Back to main code

//========================================= LJ 1110 P
// RTS - when activating a spell (troop)
_MonSpellUse:
 mov dword ptr [aLast],'_MSU'

 mov rax,_BackMSU
 mov [pBack+28],rax

 test rbp,rbp
 jz _ExitMSU

 mov rax,[rsi+10]
 cmp dword ptr [rax+28],00
 jle _ExitMSU

 cmp dword ptr [iEnableMSU],0
 je _ExitMSU                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B68],00    // s7.2 #
 jne _ExitMSU

 cmp dword ptr [rsi+30],01
 js _ExitMSU

 inc dword ptr [rsi+30]

_ExitMSU:
 mov rax,[rsi+10]                  // Original code
 cmp dword ptr [rax+28],00         // Original code
 jl _EMSU00

 dec [rsi+30]                      // Original code

_EMSU00:
 jmp [pBack+28]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (troop)
// RAX if safe
_MonSpellCooldown:
 mov dword ptr [aLast],'_MSC'

 mov rdx,_BackMSC
 mov [pBack+30],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+00003B90]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitMSC                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B60],00
 jne _ExitMSC

 mov ebx,[rsi+1C]

 sub ebx,eax

 cmp ebx,#50
 js _MonSC00

 mov ebx,#50

_MonSC00:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitMSC:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+30]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when activating a spell (army)
_MonSpellUse2:
 mov dword ptr [aLast],'_SU2'

 mov rax,_BackSU2
 mov [pBack+38],rax

 cmp rbp,[pCommon]
 jne _ExitSU2

 mov rax,[rcx+08]
 cmp dword ptr [rax+2C],00
 jle _ExitSU2

 cmp dword ptr [iEnableMSU],0
 je _ExitSU2                       // Jump if feature is disabled

 cmp dword ptr [rax+2C],01
 js _ExitSU2

 inc dword ptr [rax+2C]

_ExitSU2:
 mov rax,[rcx+08]                  // Original code
 cmp dword ptr [rax+2C],00         // Original code
 jl _ESU200                        // Original code

 dec dword ptr [rax+2C]            // Original code

_ESU200:
 jmp [pBack+38]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (army)
_MonSpellCooldown2:
 mov dword ptr [aLast],'_SC2'

 mov rdx,_BackSC2
 mov [pBack+40],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+000002E0]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitSC2                       // Jump if feature is disabled

 cmp rbp,[pCommon]
 jne _ExitSC2

 mov ebx,[rsi+1C]
 sub ebx,eax

 cmp ebx,#50
 js _MonSC20

 mov ebx,#50

_MonSC20:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitSC2:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+40]                    // Back to main code

//========================================= LJ 1120 # (Chariots)
// RTS - All the time during battle
// RCX is safe
_MonUnitStress:
 mov dword ptr [aLast],'_MUS'

 mov rcx,_BackMUS
 mov [pBack+48],rcx

 add eax,ebx                       // Original code
 mov rbx,[rsp+78]                  // Original code

 mov rcx,[rdi+000002E8]
 test rcx,rcx
 jz _ExitMUS

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMUS

 cmp dword ptr [iEnableGMD],0
 je _MonUS00                       // Jump if feature is disabled

 cmp dword ptr [rdi+00000B10],0
 je _MonUS00

 mov ecx,#671000
 mov [rdi+00000B0C],ecx
 mov [rdi+00000B10],ecx

_MonUS00:
 cmp dword ptr [iEnableMUS],0
 je _ExitMUS                       // Jump if feature is disabled

 mov [rdi+000006EC],00

 test eax,eax
 js _ExitMUS

 mov eax,#-100

_ExitMUS:
 add [rdi+000006EC],eax            // Original code (upd Stress)

 jmp [pBack+48]                    // Back to main code
}
//========================================= ok
//------------------------------TBS --------------------------------------
//========================================= LJ 1120 #
// TBS - All the time at main game screen
_MonHumanPlayer:
 mov dword ptr [aLast],'_MHP'

 mov rcx,_BackMHP
 mov [pBack+50],rcx

 mov rcx,[rdx+00000188]            // Original code (get pPlayer)

 mov [pPlayer],rcx
 mov rax,[rcx+00000C20]
 mov [pWay],rax
 mov rax,[rcx+00001D90]
 mov [pRites],rax

 cmp dword ptr [iEnableMMT],0
 je _MonHP00                       // Jump if feature is disabled

 mov eax,ctMMON
 cmp [rcx+00000BF0],eax
 jns _MonHP00

 mov [rcx+00000BF0],eax

_MonHP00:
 cmp dword ptr [iEnableMPI],0
 je _ExitMHP                       // Jump if feature is disabled

 cmp [rcx+00000ED0],0
 je _ExitMHP

 mov eax,ctMINF
 cmp [rcx+00000ED0],eax
 jns _ExitMHP

 mov [rcx+00000ED0],eax

_ExitMHP:
 add rcx,000002D0                  // Original code

 jmp [pBack+50]                    // Back to main code

//========================================= LJ 190 *
// TBS - WHen troop is moving (MP, TS, HHP)
// RAX is safe
_MonActionPoints:
 mov dword ptr [aLast],'_MAP'

 mov rax,_BackMAP
 mov [pBack+58],rax

 mov rax,[rcx+78]
 cmp rax,[pPlayer]
 jne _ExitMAP

 cmp dword ptr [iEnableMAP],0
 je _MonAP00                       // Jump if feature is disabled

 xor edx,edx

_MonAP00:
 cmp dword ptr [iEnableMTS],0
 je _ExitMAP                       // Jump if feature is disabled

 mov eax,[rcx+0000008c]
 mov [rcx+00000088],eax

_ExitMAP:
 mov r8d,[rcx+000000A8]            // Original code (get AP)
 xor eax,eax                       // Original code
 mov r9d,r8d                       // Original code
 sub r9d,edx                       // Original code

 jmp [pBack+58]                    // Back to main code

//========================================= LJ 1110 *
// TBS - When Army is selected (MP, TS, HHP)
_MonActionPoints2:
 mov dword ptr [aLast],'_MA2'

 mov rax,_BackAP2
 mov [pBack+60],rax

 mov rax,[r14+78]
 cmp rax,[pPlayer]
 jne _ExitAP2

 cmp dword ptr [r14+000001b0],0
 je _MonAP2Z

 mov [pLord],r14

_MonAP2Z:
 cmp dword ptr [iEnableMAP],0
 je _MonAP20                       // Jump if feature is disabled

 mov eax,#3661
 cmp eax,[r14+000000A8]
 js _MonAP20

 mov [r14+000000A8],eax

_MonAP20:
 cmp dword ptr [iEnableMTS],0
 je _ExitAP2                       // Jump if feature is disabled

 mov eax,[r14+0000008C]
 mov [r14+00000088],eax

_ExitAP2:
 mov eax,[r14+000000A8]            // Original code (get AP)
 mov [r15+000000EC],eax            // Original code

 jmp [pBack+60]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Hero is moving
// RAX is safe
_MonActionPoints3:
 mov dword ptr [aLast],'_MA3'

 mov rax,_BackAP3
 mov [pBack+68],rax

 cmp dword ptr [iEnableMAP],0
 je _ExitAP3                       // Jump if feature is disabled

 mov rax,[rcx+00000360]
 test rax,rax
 jz _ExitAP3

 mov rax,[rax+10]
 cmp rax,[pPlayer]
 jne _ExitAP3

 mov eax,[rcx+28]
 mov [rcx+2c],eax

 xor edx,edx

 mov [rcx+30],edx

_ExitAP3:
 mov r9d,[rcx+2C]                  // Original code (get AP)
 xor r8d,r8d                       // Original code
 mov eax,r9d                       // Original code
 sub eax,edx                       // Original code

 jmp [pBack+68]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Lord is moving (in the army)
// RDI is safe
_MonActionPoints4:
 mov dword ptr [aLast],'_MA4'

 //mov rdi,_BackAP4
 mov [pBack+70],rdi

 mov rdi,[rbx+00000360]
 test rdi,rdi
 jz _ExitAP4

 mov rdi,[rdi+10]
 cmp rdi,[pPlayer]
 jne _ExitAP4

 mov [pHero],rbx                   // It is, in fact, a Lord

 cmp dword ptr [iEnableMAP],0
 je _ExitAP4                       // Jump if feature is disabled

 mov eax,[rbx+28]

 xor rsi,rsi
 mov [rbx+30],esi

_ExitAP4:
 sub esi,eax                       // Original code
 mov [rbx+2C],eax                  // Original code (upd AP)
 cmovs esi,ebp                     // Original code
 mov rbp,[rsp+30]                  // Original code

 jmp [pBack+70]                    // Back to main code

//========================================= LJ 1120 *
// TBS - During Turn Changing
// RAX is safe
_MonResearchProg:
 mov dword ptr [aLast],'_MRP'

 mov rax,_BackMRP
 mov [pBack+78],rax

 mov r9d,[rdx+0C]                  // Original code
 add r9d,r8d                       // Original code

 cmp dword ptr [iEnableMRP],0
 je _ExitMRP                       // Jump if feature is disabled

 mov rax,[rsi+20]
 cmp rax,[pPlayer]
 jne _ExitMRP

 mov r9d,[rcx+5C]

_ExitMRP:
 cmp r9d,[rcx+5C]                  // Original code (chk if finished)
 mov rcx,rsi                       // Original code

 jmp [pBack+78]                    // Back to main code

//========================================= LJ 190 *
// TBS - When looking at the Army (When recruiting)
// RAX is safe
_MonTroopRecruit:
 mov dword ptr [aLast],'_MTR'

 mov rax,_BackMTR
 mov [pBack+80],rax

 mov rax,COTR
 call rax                          // Original code

 test eax,eax                      // Original code
 js _EMTR00

 push rcx

 cmp dword ptr [iEnableMTR],0
 je _ExitMTR                       // Jump if feature is disabled

 mov rcx,[rbx+38]
 test rcx,rcx
 jz _ExitMTR

 mov rcx,[rcx+70]
 cmp rcx,[pPlayer]
 jne _ExitMTR

 mov dword ptr [rbx+50],0

_ExitMTR:
 pop rcx

 add eax,[rbx+50]                  // Original code (get #turns)

 jmp [pBack+80]                    // Back to main code

_EMTR00:
 mov rbx,JOTR
 jmp rbx

//========================================= LJ 1120 #
// TBS - During Turn Changing
_MonConstProg:
 mov dword ptr [aLast],'_MCP'

 mov rax,_BackMCP
 mov [pBack+88],rax

 inc [rcx+0C]                      // Original code (upd prog)

 cmp dword ptr [rcx+10],1
 je _ExitMCP

 cmp dword ptr [iEnableMCP],0
 je _ExitMCP                       // Jump if feature is disabled

 cmp r14,[pPlayer]
 jne _ExitMCP

 mov eax,[rcx+10]
 mov [rcx+0C],eax

_ExitMCP:
 mov eax,[rcx+0C]                  // Original code
 cmp eax,[rcx+10]                  // Original code
 setae al                          // Original code

 jmp [pBack+88]                    // Back to main code

//========================================= LJ 190 X
// TBS - During Turn Changing
_MonPublicOrder:
 mov dword ptr [aLast],'_MPO'

 //mov rcx,_BackMPO
 mov [pBack+90],rcx

 cmp dword ptr [iEnableMPO],0
 je _ExitMPO                       // Jump if feature is disabled

 cmp r15,[pPlayer]
 jne _ExitMPO
{
 xor edx,edx

 mov ebx,[r14+30]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+30],ebx
 mov ebx,[r14+34]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+34],ebx
 mov ebx,[r14+38]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+38],ebx
 mov ebx,[r14+3c]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+3c],ebx
}

 mov ecx,[r14+3C]
 add ecx,eax
 cmp ecx,#68
 jns _ExitMPO

 mov ecx,[r14+3C]
 mov eax,#68
 sub eax,ecx                       // Val to be added

_ExitMPO:
 mov ecx,[r14+3C]                  // Original code
 mov [rbx+0C],ecx                  // Original code (upd PO)
 cmp dword ptr [r14+4C],01         // Original code

 jmp [pBack+90]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When looking at the Province
_MonPopSurplus:
 mov dword ptr [aLast],'_MPS'

 mov rsi,_BackMPS
 mov [pBack+98],rsi

 cmp dword ptr [iEnableMPS],0
 je _ExitMPS                       // Jump if feature is disabled

 mov rsi,[rdx+000000d0]
 test rsi,rsi
 jz _ExitMPS

 mov rsi,[rsi+10]
 cmp rsi,[pPlayer]
 jne _ExitMPS

 mov esi,#30

 cmp esi,[rdx+00000388]
 js _ExitMPS

 mov [rdx+00000388],esi

_ExitMPS:
 mov r15d,[rdx+0000038C]           // Original code (Get Growth)
 lea rsi,[rdx+00000380]            // Original code

 jmp [pBack+98]                    // Back to main code

//========================================= LJ 190 *
// TBS - On ARK selection
_MonPopSurplus2:
 mov dword ptr [aLast],'_PS2'

 mov rcx,_BackPS2
 mov [pBack+00A0],rcx

 cmp dword ptr [iEnableMPS],0
 je _ExitPS2                       // Jump if feature is disabled

 mov rcx,[rax+00000140]
 test rcx,rcx
 jz _ExitPS2

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitPS2

 mov rcx,[rax+00000618]
 mov rcx,[rcx+18]

 cmp dword ptr [rcx+08],#32
 jns _ExitPS2

 mov dword ptr [rcx+08],#32

_ExitPS2:
 mov rcx,[rax+00000618]            // Original code (Get ppPopSp)
 mov rax,[rcx+18]                  // Original code
 mov eax,[rax+08]                  // Original code

 jmp [pBack+00A0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - When a hero/Lord is selected
// RCX is safe
_MonSelHero:
 mov dword ptr [aLast],'_MSH'

 mov r15,_BackMSH
 mov [pBack+00A8],r15

 mov r12,[r14]
 test r12,r12
 jz _ExitMSH

 mov [pHero],r12

 mov rcx,[r12+00000360]
 test rcx,rcx
 jz _ExitMSH

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitMSH

 cmp dword ptr [iEnableMAP],0
 je _MonSH00                       // Jump if feature is disabled

 mov esi,[r12+28]
 mov [r12+2c],esi

_MonSH00:
 cmp dword ptr [iEnableHAA],0
 je _MonSH01                       // Jump if feature is disabled

 mov byte ptr [r12+00000940],00    // (s3.0)
 mov byte ptr [r12+00000948],00

 mov byte ptr [r12+00000E28],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E29],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E2A],00    // SearchedTreasure (s6.1)

_MonSH01:
 cmp dword ptr [iEnableMXP],0
 je _ExitMSH                       // Jump if feature is disabled

 lea rcx,[rax-64]
 cmp ecx,[r14+00000254]
 js _ExitMSH

 mov [r14+00000254],ecx

_ExitMSH:
 mov r12d,[r14+00000254]           // Original code (Get XP)
 mov r15d,eax                      // Original code
 sub r15d,ebx                      // Original code

 jmp [pBack+00A8]                  // Back to main code

//========================================= LJ 1110 *
// TBS - All the time at main game screen (Skaven/Lizards)
_MonPlayerFood:
 mov dword ptr [aLast],'_MPF'

 mov rax,_BackMPF
 mov [pBack+00B0],rax

 mov rax,[rdi+08]                  // Original code

 mov rbx,[rax+08]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+18]
 cmp rbx,[pPlayer]
 jne _ExitMPF

 mov rbx,[rax]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+08]
 test rbx,rbx
 jz _ExitMPF

 mov ebx,[rbx+04]
 cmp ebx,'en_f'
 jne _MonPF00

 mov [pFood],rax

 cmp dword ptr [iEnableMPF],0
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMFOO
 jmp _MonPF0X
//--
_MonPF00:
 cmp ebx,'reac'
 je _MonPF01

 cmp ebx,'nuke'
 jne _MonPF02

_MonPF01:
 cmp dword ptr [iEnableSSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMSSR
 jmp _MonPF0X
//--
_MonPF02:
 cmp ebx,'sacr'
 jne _MonPF03

 cmp dword ptr [iEnableLSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMLSR
 jmp _MonPF0X
//--
_MonPF03:
 cmp ebx,'old_'
 jne _MonPF04

 cmp dword ptr [iEnableMOO],0      // s7.1
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF04:
 cmp ebx,'salv'
 jne _MonPF05

 cmp dword ptr [iEnableSCR],0      // s7.9 (Scrap)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF05:
 cmp ebx,'drea'
 jne _MonPF06

 cmp dword ptr [iEnableDRE],0      // s7.19 (Dread)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#3700
 jmp _MonPF0X
//--
_MonPF06:
 jmp _ExitMPF
//--
_MonPF0X:
 cmp [rax+20],ebx
 jns _ExitMPF

 mov [rax+20],ebx

_ExitMPF:
 mov rbx,[rsp+50]                  // Original code
 mov rsi,[rsp+58]                  // Original code

 jmp [pBack+00B0]                  // Back to main code

//========================================= LJ 1104 *
// TBS - During turn changing
_MonRitesCD:
 mov dword ptr [aLast],'_MRC'

// mov rax,_BackMRC
 mov [pBack+00B8],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,r8d                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitMRC

 cmp dword ptr [iEnableMRC],0
 je _ExitMRC                       // Jump if feature is disabled

 test eax,eax
 js _ExitMRC

 xor eax,eax

_ExitMRC:
 mov [rbx+10],eax                  // Original code

 jmp [pBack+00B8]                  // Back to main code

//========================================= LJ 1111 *
// TBS - During turn changing
_MonRitesCD2:
 mov dword ptr [aLast],'_RC2'

// mov rax,_BackRC2
 mov [pBack+00C0],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,edx                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitRC2

 cmp dword ptr [iEnableMRC],0
 je _ExitRC2                       // Jump if feature is disabled

 test eax,eax
 js _ExitRC2

 xor eax,eax

_ExitRC2:
 mov [rbx+08],eax                  // Original code

 jmp [pBack+00C0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - God Mode for Autobattle and Troop XP
_GodModeTBS:
 mov r14,_BackGMT
 mov [pBack+00C8],r14

 cmp dword ptr [iEnableGMT],0
 je _GodMT01                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 je _GodMT00

// mov dword ptr [rdx+58],00
// mov dword ptr [rdx+6c],00
// mov dword ptr [rdx+000000A4],00
 jmp _ExitGMT
//--
_GodMT00:
 mov r14d,[rdx+50]
 mov [rdx+58],r14d

 mov r14d,[rdx+64]
 mov [rdx+6c],r14d

 mov byte ptr [rdx+7C],01
 mov byte ptr [rdx+7E],00

_GodMT01:
 cmp dword ptr [iEnableMTX],0
 je _ExitGMT                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 jne _ExitGMT

 cmp dword ptr [rdx+0000009C],00
 je _ExitGMT

 cmp byte ptr [rcx+000000C8],09
 jns _ExitGMT

 mov r14d,#30000
 cmp [rdx+0000009C],r14d
 jns _ExitGMT

 mov [rdx+0000009C],r14d

_ExitGMT:
 mov rax,[rcx+00000080]            // Original code
 mov r14,rdx                       // Original code
 mov rsi,rcx                       // Original code

 jmp [pBack+00C8]                  // Back to main code

//========================================= LJ 190 X
// TBS - Keep human player's AMBER at minimum (per Settlement / per Event)
// RAX is safe
_MonPlayerAmber:
 mov dword ptr [aLast],'_MPA'

 mov rax,_BackMPA
 mov [pBack+00D0],rax

 mov ax,[r8+08]
 cmp ax,00eb
 je _MonPA00

 cmp ax,00ec
 jne _ExitMPA

 mov rax,RPAE
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAE],0
 je _ExitMPA                       // Jump if feature is disabled

// mov rax,[rbp+60]
// test rax,rax
// jz _ExitMPA

// mov rax,[rax+00000188]

 mov eax,[r8+18]           // for debugging

 cmp rbx,[pPlayer]         // [RSP+18]=Player as well
 jne _ExitMPA

 mov eax,ctMAPE
 jmp _MonPA01
//==
_MonPA00:
 mov rax,RPAS
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAS],0
 je _ExitMPA                       // Jump if feature is disabled

 mov rax,[rbp+60]
 test rax,rax
 jz _ExitMPA

 mov rax,[rax+00000188]
 cmp rax,[pPlayer]
 jne _ExitMPA

 mov eax,ctMAPS

_MonPA01:
 cmp [r8+18],eax
 jns _ExitMPA

 mov [r8+18],eax
 mov [r8+1c],eax

_ExitMPA:
 movss xmm1,[r8+18]                // Original code (get value)
 xorps xmm0,xmm0                   // Original code
 comiss xmm1,xmm0                  // Original code

 jmp [pBack+00D0]                  // Back to main code

//========================================= LJ ok
// TBS - Keep human player's Slaves per Settlement at minimum (for Dark Elves)
_MonSlavesPerSettlement:
 mov dword ptr [aLast],'_MSS'

 mov rdx,_BackMSS
 mov [pBack+00D8],rdx

 test rax,rax                      // Original code
 je _EMSS00                        // Original code

 movsd [qXMM0],xmm0
 movsd [qXMM1],xmm1

 cmp r15,[pPlayer]
 jne _ExitMSS

 cmp dword ptr [iEnableMSS],0
 je _ExitMSS                       // Jump if feature is disabled

 movsd xmm0,[qMinimum]
 cvtsi2sd xmm1,[rax+0c]
 mulsd xmm0,xmm1
 cvtsi2sd xmm1,[rax+08]
 maxsd xmm0,xmm1
 cvtsd2si ecx,xmm0
 mov [rax+08],ecx

_ExitMSS:
 movsd xmm0,[qXMM0]
 movsd xmm1,[qXMM1]

 mov edx,[rax+08]                  // Original code (get value)
 mov rcx,rax                       // Original code
 mov rbx,CSPS                      // RBX is safe
 call rbx                          // Original code

_EMSS00:
 jmp [pBack+00D8]                  // Back to main code

qMinimum:
 dq (double)0.20

//=========================================
align 10,'='
//=========================================
 db '===============================>'
 db 'CE7.4 Script by Recifense 220502'
//=========================================
// Variables
iEnableGMD:
 dq 0
iEnableMTA:
 dq 0
iEnableMTL:
 dq 0
iEnableMWM:
 dq 0
iEnableMMT:
 dq 0
iEnableMAP:
 dq 0
iEnableMTS:
 dq 0
iEnableMRP:
 dq 0
iEnableMTR:
 dq 0
iEnableMCP:
 dq 0
iEnableMPO:
 dq 0
iEnableMPS:
 dq 0
iEnableMXP:
 dq 0
iEnableHAA:
 dq 0
iEnableMPI:
 dq 0
iEnableMPF:
 dq 0
iEnableMRC:
 dq 0
iEnableGMT:
 dq 0
iEnableMTX:
 dq 0
iEnablePAE:
 dq 0
iEnablePAS:
 dq 0
iEnableMSU:
 dq 0
iEnableMSC:
 dq 0
iEnableMSS:
 dq 0
iEnableMUS:
 dq 0
iEnableSSR:
 dq 0
iEnableLSR:
 dq 0
iEnableMOO:
 dq 0
iEnableSCR:
 dq 0
iEnableDRE:
 dq 0
pPlayer:
 dq MyCode
pWay:
 dq MyCode
pRites:
 dq MyCode
pFood:
 dq 0
pLord:
 dq 0
pHero:
 dq 0
pUnit:
 dq 0
pDebug:
 dq 0
pCommon:
 dq MyCode
lRBX:
 dq 0
qXMM0:
 dq 0
qXMM1:
 dq 0
pRBX:
 dq 0
pBack:
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
aLast:
 db 'CE70'
iSize:
 dd iSize-MyCode

//=========================================
// Hacking Points
{GDMD:
 mov rax,_GodMode
 jmp rax
 nop
 nop
 nop
 nop
 nop}
_BackGMD:

{MOTA:
 mov rcx,_MonTroopAmmo
 jmp rcx}
_BackMTA:

{GDM2:
 mov rax,_GodMode2
 jmp rax}
_BackGM2:

{MOTU:
 mov rcx,_MonTroopUnits
 jmp rcx
 nop
 nop
 nop}
_BackMTU:

{MOWM:
 mov rcx,_MonWindsOfMagic
 jmp rcx
 nop}
_BackMWM:

MOSU:
// mov rax,_MonSpellUse
// jmp rax
// nop
_BackMSU:

{MSCD:
 mov rdx,_MonSpellCooldown
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackMSC:

{MSU2:
 mov rax,_MonSpellUse2
 jmp rax
 nop}
_BackSU2:

{MSC2:
 mov rdx,_MonSpellCooldown2
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackSC2:

{MOUS:
 mov rcx,_MonUnitStress
 jmp rcx
 nop}
_BackMUS:

// ---------------------- TBS
MOHP:
 mov rcx,_MonHumanPlayer
 jmp rcx
 nop
 nop
_BackMHP:

MOAP:
 mov rax,_MonActionPoints
 jmp rax
 nop
 nop
 nop
_BackMAP:

MAP2:
 mov rax,_MonActionPoints2
 jmp rax
 nop
 nop
_BackAP2:

MAP3:
 mov rax,_MonActionPoints3
 jmp rax
_BackAP3:

{MAP4:
 mov rdi,_MonActionPoints4
 jmp rdi
 nop
_BackAP4:
}
MORP:
 mov rax,_MonResearchProg
 jmp rax
 nop
 nop
_BackMRP:

MOTR:
 mov rax,_MonTroopRecruit
 jmp rax
_BackMTR:

MOCP:
 mov rax,_MonConstProg
 jmp rax
_BackMCP:
{
MOPO:
 mov rcx,_MonPublicOrder
 jmp rcx
_BackMPO:
}
MOPS:
 mov rsi,_MonPopSurplus
 jmp rsi
 nop
 nop
_BackMPS:

MPS2:
 mov rcx,_MonPopSurplus2
 jmp rcx
 nop
 nop
_BackPS2:

MOSH:
 mov r15,_MonSelHero
 jmp r15
_BackMSH:

MOPF:
 mov rax,_MonPlayerFood
 jmp rax
 nop
 nop
_BackMPF:
{
MORC:
 mov rax,_MonRitesCD
 jmp rax
 nop
 nop
_BackMRC:

MRC2:
 mov rax,_MonRitesCD2
 jmp rax
 nop
_BackRC2:
}
GMTB:
 mov r14,_GodModeTBS
 jmp r14
_BackGMT:

MOPA:
 mov rax,_MonPlayerAmber
 jmp rax
_BackMPA:

MSPS:
{
 mov rdx,_MonSlavesPerSettlement
 jmp rdx
 nop
 nop
 nop
 nop
}
_BackMSS:

//=========================================
// Script for Restoring Original Codes
[DISABLE]
GDMD:
 db 44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1

MOTA:
 db 45 85 C0 74 07 41 8D 48 FF 89 0C 38

GDM2:
 db 40 55 56 41 54 41 56 48 8D 6C 24 D8

MOTU:
 db F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00

MOWM:
 db F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08

//MOSU:
// db 48 8B 46 10 83 78 28 00 7C 03 FF 4E 30

MSCD:
readmem(SMSCD,18)

MSU2:
 db 48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C

MSC2:
readmem(SMSC2,18)

MOUS:
 db 03 C3 48 8B 5C 24 78 01 87 EC 06 00 00

// ---------------------- TBS
MOHP:
 db 48 8b 8a 88 01 00 00 48 81 c1 d0 02 00 00

MOAP:
 db 44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1

MAP2:
 db 41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00

MAP3:
 db 44 8B 49 2C 45 33 C0 41 8B C1 2B C2

//MAP4:
 //db 29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30

MORP:
 db 44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE

MOTR:
readmem(SMOTR,12)

MOCP:
 db FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0

//MOPO:
 //db 41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01

MOPS:
 db 44 8b ba 8c 03 00 00 48 8d b2 80 03 00 00

MPS2:
 db 48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08

MOSH:
 db 45 8B A6 54 02 00 00 44 8B F8 44 2B FB

MOPF:
 db 48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58

//MORC:
 //db FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10

//MRC2:
 //db FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08

GMTB:
 db 48 8B 81 80 00 00 00 4C 8B F2 48 8B F1

MOPA:
 db F3 41 0F 10 48 18 0F 57 C0 0F 2F C8

//MSPS:
//readmem(SMSPS,16)

//=========================================
// Unregistering Symbols
unregistersymbol(MyCode)
unregistersymbol(iEnableGMD)
unregistersymbol(iEnableMTA)
unregistersymbol(iEnableMTL)
unregistersymbol(iEnableMWM)
unregistersymbol(iEnableMMT)
unregistersymbol(iEnableMAP)
unregistersymbol(iEnableMTS)
unregistersymbol(iEnableMRP)
unregistersymbol(iEnableMTR)
unregistersymbol(iEnableMCP)
unregistersymbol(iEnableMPO)
unregistersymbol(iEnableMPS)
unregistersymbol(iEnableMXP)
unregistersymbol(iEnableHAA)
unregistersymbol(iEnableMPI)
unregistersymbol(iEnableMPF)
unregistersymbol(iEnableMRC)
unregistersymbol(iEnableGMT)
unregistersymbol(iEnableMTX)
unregistersymbol(iEnablePAE)
unregistersymbol(iEnablePAS)
unregistersymbol(iEnableMSU)
unregistersymbol(iEnableMSC)
unregistersymbol(iEnableMSS)
unregistersymbol(iEnableMUS)
unregistersymbol(iEnableSSR)
unregistersymbol(iEnableLSR)
unregistersymbol(iEnableMOO)
unregistersymbol(iEnableSCR)
unregistersymbol(iEnableDRE)

unregistersymbol(pPlayer)
unregistersymbol(pLord)
unregistersymbol(pHero)
unregistersymbol(pUnit)
unregistersymbol(pDebug)
unregistersymbol(pCommon)
unregistersymbol(pFood)
unregistersymbol(aLast)

unregistersymbol(SMSCD)
unregistersymbol(SMSC2)
unregistersymbol(SMOTR)
unregistersymbol(SMSPS)

//=========================================
dealloc(MyCode)
dealloc(SMSCD)
dealloc(SMSC2)
dealloc(SMOTR)
dealloc(SMSPS)
//============= Scripts End ===============

// ****************************************
// NOTES
// ****************************************
{
}
well try this, and also your error doesn't seem logical unless either the code you change someting or didn't select a process
I tried to use the code/script you gave (I tried to insert it into the window that pops up when you hit "Ctrl+Alt+A"), and I got THIS error message:

"Error in line 202 (asser(warhammer2.exe+29ACADA,48 8B 8A 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)) :The bytes at warhammer2.exe+29ACADA are not what was expected"

Did I do something wrong or...?

CEuser1239
What is cheating?
What is cheating?
Posts: 2
Joined: Fri Jun 15, 2018 12:47 pm
Reputation: 5

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by CEuser1239 »

Current table in the OP doesn't work. Neither does the yazz code. Both just crash the game.

yazz
Novice Cheater
Novice Cheater
Posts: 15
Joined: Fri Jul 22, 2022 7:32 pm
Reputation: 5

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by yazz »

TheDistur6edGuy wrote:
Mon Aug 22, 2022 5:37 pm
yazz wrote:
Thu Aug 18, 2022 3:02 pm

Code: Select all

{
===========================================
 Game Title    : Total War - Warhammer 2
 Game Version  : 1.12.1 (20163) (The Silence & The Fury)
 Game Sponsor  : Myself (Game+DLCs) (with Patreon's fund)
 Process Name  : Warhammer2.exe
 Relevant Info : 64bits/TBS/RTS
 Script Version: 8.4 (LJ)
 CE Version    : 7.4
 Release date  : 02-May-2022
 Author        : Recifense
 History:
 29-Sep-2017: First Release
 30-Sep-2017: Trying to Fix Construction + Minimum Food (s2.0)
 01-Oct-2017: Added "Rites Cooldown in 1 turn" and fix "CanActAgain" (s3.0)
 03-Oct-2017: Included Arks in Pop Surplus (s3.1)
 10-Oct-2017: God Mode for Auto-Resolve battles and Troop Quick Level Up (s3.2)
 26-Oct-2017: Release for version 1.1.0-4871
 28-Oct-2017: Porting of AMBER features from Warhammer TW (s3.3)
 04-Nov-2017: Release for version 1.1.0-5003 beta
 09-Nov-2017: Release for version 1.1.1-5078
 14-Dec-2017: Release for version 1.2.0-5568
 23-Jan-2018: Release for version 1.3.0-6014 (Rise of the Tomb kings)
 24-Jan-2018: Added two more features releated to spell durng combat (s5.0)
 25-Jan-2018: Include spells related to the army (s5.1)
 30-Jan-2018: Minimum Slave per Settlement (Dark Elves) (s5.2)
 14-Feb-2018: Release for version 1.3.1-6213 + Min Pop Surplus = 30 (s5.3)
 31-May-2018: Release for version 1.4.0-7243
 20-Jun-2018: Release for version 1.4.0-7312 Beta (CE68)(s5.4)
 21-Jun-2018: Release for version 1.4.1-7450
 30-Jun-2018: Include "Ever fresh units (Full Vigour)" (CE67)(s5.5)
 10-Nov-2018: Release for version 1.5.0-8774 (s6.0)
 11-Nov-2018: Fix for unlimited spell + can Search Treasure again  (s6.1)
 16-Dec-2018: Release for version 1.5.1-9184 Beta (s6.2)
 22-Jan-2019: Release for version 1.5.1-9466 Beta (s6.3)
 18-Apr-2019: Release for version 1.6.0-10563 (s6.4)
 20-Apr-2019: Skaven Warpstorm and Warp-Fuel + Lizards Sacrificial Offerings (s6.5)
 16-May-2019: Release for version 1.6.1-10846 (s6.6)
 12-Sep-2019: Release for version 1.7.0-11694 + Feature (Old Ones) (s6.7)(CE70)
 17-Sep-2019: Release for version 1.7.1-11765 (s6.8)
 23-Sep-2019: Changed the hacking method to long jumps (s7.0)
 16-Oct-2019: Release for version 1.7.2-12104 (s7.1)
 14-Dec-2019: Release for version 1.8.0-13017 (s7.2)
 15-Dec-2019: Fix for crashing during RTS battle (s7.3)
 18-Dec-2019: Release for version 1.8.1-13089 (s7.4)
 13-Jan-2020: Release for version 1.8.2-13152 (s7.5)
 28-Feb-2020: Release for version 1.8.3-13831 (s7.6)
 25-May-2020: Release for version 1.9.0-15159 (s7.7) Preliminary
 26-May-2020: Fix for Rites/Influence (s7.8)
 29-May-2020: Release for version 1.9.1-15282 + New feature (s7.9)
 13-Jun-2020: Release for version 1.9.2-15323 (beta)(s7.10)
 18-Jun-2020: Release for version 1.9.2-15501 (beta2)(s7.11)
 13-Jul-2020: Release for version 1.9.2-15685 (beta3) + Fix for Amber (event)(s7.12)
 05-Dec-2020: Release for version 1.10.0-16858 (s7.13)
 07-Jan-2021: Release for version 1.10.1-16966 (s7.14)
 08-Feb-2021: Release for version 1.10.2-17427 (s7.15)
 20-Mar-2021: Release for version 1.11.0-18012 (s7.16)
 22-Apr-2021: Release for version 1.11.1-18231 (s7.17)
 29-Apr-2021: Fix for Rites (s7.18)
 15-Jul-2021: Release for version 1.12.0-18858 (s7.19P) Preliminary
 16-Jul-2021: Release for version 1.12.0-18858 (s8.0) + Minimum Dread
 22-Jul-2021: Fix for Spell Cooldown (s8.1)
 08-Sep-2021: Release for version 1.21.1-19098 (s8.2)
 03-Nov-2021: Release for version 1.21.1-19592 (s8.3)
 02-May-2022: Release for version 1.21.1-20163 (s8.4)
 Features:
 - God Mode  (RTS)
 - Full Ammo (RTS)
 - Minimum Leadership (GM) (RTS)
 - Fast Recover of Winds of Magic (RTS)
 - Unlimited use of limited spells  (RTS) (s5.0) new
 - Spell Quick Cooldown (RTS)             (s5.0) new
 - Ever fresh units  (RTS)                (s5.5) new
 - Minimum Treasure
 - Minimum Influence
 - Minimum Food (Skaven)
 - Unlimited Action Points
 - Recover Troop Size/Hero HP
 - Research in 1 turn
 - Recruitment in 1 turn
 - Construction in 1 turn
 - Rites Cooldown in 1 turn
 - Minimum Public Order
 - Minimum Pop Surplus (including Arks) (s3.1)
 - Level almost complete (sel hero XP)
 - Hero can Act Again
   - Included Search for Treasure    (s6.1)
 - God Mode for Auto-resolve battles (s3.2)
 - Troops Quick Level Up             (s3.2)
 - Minimum Amber Per Settlement      (s3.3)
 - Minimum Event Total Amber         (s3.3)
 - Minimum Slaves Per Settlement     (s5.2) (for Dark Elves) (Pending)
 - Minimum Special Resources:        (s6.5)
   - Nukes and Warps (Skaven)
   - Sacrificial Offerings (Lizards)
 - Minimum Old Ones                  (s6.7) (for Nakai the Wanderer)
 - Minimum Scraps                    (s7.9) (for Grom the Paunch)
 - Minimum Dread                     (s8.0) (new) (for Taurox the Brass Bull)
 - Some Pointers
===========================================
}


//=========================================
// Checking CE version
{$lua}
  if(getCEVersion() < 7.0) then
    ShowMessage('Warning. CE version should be 7.0 or above')
  end
{$asm}

//=========================================
// Checking Selected Process
{$lua}
  if(process == nil) then
    ShowMessage('No process was selected')
  elseif (string.upper(process) ~= string.upper("Warhammer2.exe")) then
    ShowMessage('Warning. Expected Process = Warhammer2.exe')
  end
{$asm}

//=========================================
{$lua}
--  monoAA_USEMONO(process,false)
  if waitForPDB then --this way older CE versions are unaffected (by Dark Byte)
    waitForPDB()
  end
{$asm}

//=========================================
// Definitions
define(LUDO,"Warhammer2.exe")
define(GDMD,warhammer2.exe+2098B00) //20==#====#==#=#===
define(MOTA,warhammer2.exe+23BB27E) //20==#====#====#===
define(GDM2,warhammer2.exe+217FD00) //20==#====#==#=#===
define(MOTU,warhammer2.exe+22A10DD) //20==#====#==#=#=== 2 1
define(MOWM,warhammer2.exe+2018023) //20==#=============
define(MOSU,Warhammer2.exe+02024250) //20==#=========PPPP (s5.0)
define(MSCD,warhammer2.exe+1E0CC2C) //20==#====#====#=== (s5.0)
define(CSCD,Warhammer2.exe+020108F0)
define(MSU2,warhammer2.exe+2010F70) //20==PPPPPPPPPPX=== (s5.1)
define(MSC2,warhammer2.exe+1E0C8C8) //20==#=========#=== (s5.1)
define(MOUS,warhammer2.exe+219F29C) //20==#====#==#=#=== (s5.5)
//-- 10
define(MOHP,warhammer2.exe+29ACADA) //20==#=======#=#===
define(MOAP,warhammer2.exe+1BE1CF60) //20==#=============
define(MAP2,warhammer2.exe+14A693A) //20==#====##=#=====
define(MAP3,warhammer2.exe+1A35730) //20==#=============
//define(MAP4,Warhammer2.exe+1CC56DB3) //20==#=============
define(MORP,warhammer2.exe+18937B6) //20==X====##===#===
define(MOTR,warhammer2.exe+1A87826) //20==#=============
define(COTR,Warhammer2.exe+01A86F80)
define(JOTR,Warhammer2.exe+01A8736D)
define(MOCP,warhammer2.exe+1BD8170) //20==#=========#===
//define(MOPO,Warhammer2.exe+1CCFAAE1) //20==X=============
define(MOPS,warhammer2.exe+2AB109E) //20==#=======#=#===
//-- 20
define(MPS2,warhammer2.exe+180949C) //20==#=========#=== (s3.1)
define(MOSH,warhammer2.exe+28194DC) //20==#=======#=#===
define(MOPF,warhammer2.exe+295DD48) //20==#=======#=====
//define(MORC,Warhammer2.exe+1CCA90E6) //20==X====X=#======
//define(MRC2,Warhammer2.exe+1CCA91E8) //20==X====X=#======
define(GMTB,warhammer2.exe+1465C08) //20==X====#==#=#=== (s3.2)
define(MOPA,warhammer2.exe+D0E8B2) //20==#============= (s3.3)

define(MSPS,Warhammer2.exe+00b0d0e2) //20PPPPPPPPPPPPPPPP (s5.2)
define(CSPS,Warhammer2.exe+00afabd0)

define(RPAS,Warhammer2.exe+0882141B) //20==#=========PPPP (s3.3)
define(RPAE,Warhammer2.exe+095C17BC) //20==#===#===#PPPPP (s3.3)

//=========================================
// Constants used in the script (that can be changed)
define(ctCE67,(float)7.0)
define(ctMMON,#70000)  // Minimum Money
define(ctMINF,#70)     // Minimum Influence
define(ctMFOO,#80)     // Minimum Food
define(ctMSSR,#12)     // Minimum Skaven Special Resources
define(ctMLSR,#500)    // Minimum Lizard Special Resource
define(ctMAPS,(float)5.0)  // OK
define(ctMAPE,(float)20.0) // OK

//=========================================
[ENABLE]
//=========================================
//LuaCall(CheckVersion())
//=========================================
// Check if script is compatible to this game version
// If false the script will not be loaded

assert(GDMD,44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1 44 89 41 04 8B 01)
assert(MOTA,45 85 C0 74 07 41 8D 48 FF 89 0C 38 84 D2 0F 84 ?? ?? 00 00 85 C9)
assert(GDM2,40 55 56 41 54 41 56 48 8D 6C 24 D8 48 81 EC 28 01 00 00 48 8B F1 4C 8B F2 48 8B 89 E0 02)
assert(MOTU,F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00 48 85 C9 74 ?? E8 ??)
assert(MOWM,F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08 76 ?? F3 0F 11 4F 08 49 83)
//assert(MOSU,48 8B 46 10 83 78 28 00 7C 03 FF 4E 30 0F 57 F6 48 85 ED ?? ?? 48)   //P
assert(MSCD,48 8B 95 90 3B 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MSU2,48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C C3 CC ?? ?? ?? ?? ?? ?? ??)
assert(MSC2,48 8B 95 E0 02 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MOUS,03 C3 48 8B 5C 24 78 01 87 EC 06 00 00 48 8B CF E8 ?? ?? ?? ?? 4C)
//-- 10
assert(MOHP,48 8B 8A 88 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)
assert(MOAP,44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1 41 39 D0 41 0F 47 C1)
assert(MAP2,41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00 49 8B 46 70 48 85 C0 ??)
assert(MAP3,44 8B 49 2C 45 33 C0 41 8B C1 2B C2 41 3B D1 44 0F 46 C0 44 89 41 2C)
//assert(MAP4,29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30 01 73 30 48 8B 74 24 38 48)
assert(MORP,44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE 0F 83 ?? ?? ?? ?? 44 89 4A 0C)
assert(MOTR,E8 ?? ?? ?? ?? 85 C0 78 ?? 03 43 50 48 83 C4 20 5B C3 B8 FF FF FF)
assert(MOCP,FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0 C3 ?? ?? ?? ?? ?? ?? ?? ?? ??)
//assert(MOPO,41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01 ?? ?? 49 8B 0E 48 81 C1 A8 00)
//--19
assert(MOPS,44 8B BA 8C 03 00 00 48 8D B2 80 03 00 00 48 8B DA 4C 8B E1 48 8B CE B2 01)
assert(MPS2,48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08 C3 ?? ?? ?? ?? ?? ?? ??)
assert(MOSH,45 8B A6 54 02 00 00 44 8B F8 44 2B FB 44 2B E3 48 8B 0D ?? ?? ??)
assert(MOPF,48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58 8B 40 20 48 83 C4 40 5F C3)
//assert(MORC,FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10 44 39 73 18 77 ?? 44 88)
//assert(MRC2,FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08 48 83 C3 10 48 39 FB 75 ??)
assert(GMTB,48 8B 81 80 00 00 00 4C 8B F2 48 8B F1 80 B8 88 01 00 00 00 ?? ??)
assert(MOPA,F3 41 0F 10 48 18 0F 57 C0 0F 2F C8 76 ?? F3 0F 58 0D ?? ?? ?? ??)

//assert(MSU2,48 8b 4e 10 83 79 28 00 7c 03 ff 4e 30 0f 57 ff 48 85 db ?? ?? 80) //??
//assert(MSPS,48 85 c0 74 0b 8b 50 08 48 8b c8 e8 ?? ?? ?? ?? 48 8b 5c 24 30 48) //??

//=========================================
alloc(MyCode,8000,$process)
//=========================================
alloc(SMSCD,18,$process)
registersymbol(SMSCD)
SMSCD:
readmem(MSCD,18)
//=========================================
alloc(SMSC2,18,$process)
registersymbol(SMSC2)
SMSC2:
readmem(MSC2,18)
//=========================================
alloc(SMOTR,12,$process)
registersymbol(SMOTR)
SMOTR:
readmem(MOTR,12)
//=========================================
alloc(SMSPS,16,$process)
registersymbol(SMSPS)
SMSPS:
readmem(MSPS,16)
//=========================================
// Declaration section
//label(_GodMode)
label(_BackGMD)
//label(_MonTroopAmmo)
label(_BackMTA)
//label(_GodMode2)
label(_BackGM2)
//label(_MonTroopUnits)
label(_BackMTU)
//label(_MonWindsOfMagic)
label(_BackMWM)
//label(_MonSpellUse)
label(_BackMSU)
//label(_MonSpellCooldown)
label(_BackMSC)
//label(_MonSpellUse2)
label(_BackSU2)
//label(_MonSpellCooldown2)
label(_BackSC2)
//label(_MonUnitStress)
label(_BackMUS)

label(_MonHumanPlayer)
label(_BackMHP)
label(_MonActionPoints)
label(_BackMAP)
label(_MonActionPoints2)
label(_BackAP2)
label(_MonActionPoints3)
label(_BackAP3)
label(_MonActionPoints4)
//label(_BackAP4)
label(_MonResearchProg)
label(_BackMRP)
label(_MonTroopRecruit)
label(_BackMTR)
label(_MonConstProg)
label(_BackMCP)
label(_MonPublicOrder)
//label(_BackMPO)
label(_MonPopSurplus)
label(_BackMPS)
label(_MonPopSurplus2)
label(_BackPS2)
label(_MonSelHero)
label(_BackMSH)
label(_MonPlayerFood)
label(_BackMPF)
label(_MonRitesCD)
//label(_BackMRC)
label(_MonRitesCD2)
//label(_BackRC2)
label(_GodModeTBS)
label(_BackGMT)
label(_MonPlayerAmber)
label(_BackMPA)
label(_MonSlavesPerSettlement)
label(_BackMSS)

label(iEnableGMD)
label(iEnableMTA)
label(iEnableMTL)
label(iEnableMWM)
label(iEnableMMT)
label(iEnableMAP)
label(iEnableMTS)
label(iEnableMRP)
label(iEnableMTR)
label(iEnableMCP)
label(iEnableMPO)
label(iEnableMPS)
label(iEnableMXP)
label(iEnableHAA)
label(iEnableMPI)
label(iEnableMPF)
label(iEnableMRC)
label(iEnableGMT)
label(iEnableMTX)
label(iEnablePAE)
label(iEnablePAS)
label(iEnableMSU)
label(iEnableMSC)
label(iEnableMSS)
label(iEnableMUS)
label(iEnableSSR)
label(iEnableLSR)
label(iEnableMOO)
label(iEnableSCR)
label(iEnableDRE)

label(pPlayer)
label(pLord)
label(pHero)
label(pUnit)
label(pDebug)
label(pCommon)
label(pFood)
label(lRBX)
label(aLast)

//=========================================
// Registering Symbols
registersymbol(MyCode)
registersymbol(iEnableGMD)
registersymbol(iEnableMTA)
registersymbol(iEnableMTL)
registersymbol(iEnableMWM)
registersymbol(iEnableMMT)
registersymbol(iEnableMAP)
registersymbol(iEnableMTS)
registersymbol(iEnableMRP)
registersymbol(iEnableMTR)
registersymbol(iEnableMCP)
registersymbol(iEnableMPO)
registersymbol(iEnableMPS)
registersymbol(iEnableMXP)
registersymbol(iEnableHAA)
registersymbol(iEnableMPI)
registersymbol(iEnableMPF)
registersymbol(iEnableMRC)
registersymbol(iEnableGMT)
registersymbol(iEnableMTX)
registersymbol(iEnablePAE)
registersymbol(iEnablePAS)
registersymbol(iEnableMSU)
registersymbol(iEnableMSC)
registersymbol(iEnableMSS)
registersymbol(iEnableMUS)
registersymbol(iEnableSSR)
registersymbol(iEnableLSR)
registersymbol(iEnableMOO)
registersymbol(iEnableSCR)
registersymbol(iEnableDRE)

registersymbol(pPlayer)
registersymbol(pLord)
registersymbol(pHero)
registersymbol(pUnit)
registersymbol(pDebug)
registersymbol(pCommon)
registersymbol(pFood)
registersymbol(aLast)

//=========================================
MyCode:
//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop/Hero)
// RAX is safe
{_GodMode:
 mov dword ptr [aLast],'_GMD'

 mov rax,_BackGMD
 mov [pBack+00],rax

 mov [pDebug],rbx

 cmp dword ptr [iEnableGMD],0
 je _ExitGMD                       // Jump if feature is disabled

 lea rax,[rcx-00000B0C]
 cmp rax,rbx
 jne _ExitGMD

 mov rax,[rbx+000002E8]
 test rax,rax
 jz _ExitGMD

 cmp byte ptr [rax+00003B60],00
 jne _ExitGMD

 mov eax,[rcx]
 mov [rcx+04],eax

 xor edx,edx

_ExitGMD:
 mov r8d,[rcx+04]                  // Original code
 xor r9d,r9d                       // Original code
 sub r8d,edx                       // Original code
 cmp edx,[rcx+04]                  // Original code
 cmova r8d,r9d                     // Original code

 jmp [pBack+00]                    // Back to main code

//========================================= LJ 1120 #
// RTS - After decreasing Ammo
_MonTroopAmmo:
 mov dword ptr [aLast],'_MTA'

 mov rcx,_BackMTA
 mov [pBack+08],rcx

 mov ecx,r8d                       // recover ECX

 test r8d,r8d                      // Original code
 jz _MonTA00

 cmp dword ptr [iEnableMTA],0
 je _ExitMTA                       // Jump if feature is disabled

 cmp byte ptr [rdi+00003B60],00
 jne _ExitMTA

 inc ecx
 mov r8d,ecx

_ExitMTA:
 lea ecx,[r8-01]                   // Original code
 mov [rax+rdi],ecx                 // Original code

_MonTA00:
 jmp [pBack+08]                    // Back to main code

//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop)
// RAX is safe
_GodMode2:
 mov dword ptr [aLast],'_GM2'

 mov rax,_BackGM2
 mov [pBack+10],rax

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 mov rax,[rcx+000002E8]
 test rax,rax
 jz _ExitGM2

 cmp byte ptr [rax+00003B60],00
 jne _ExitGM2

 mov eax,[rcx+00000B0C]
 mov [rcx+00000B10],eax

 ret
//==
_ExitGM2:
 push rbp                          // Original code
 push rsi                          // Original code
 push r12                          // Original code
 push r14                          // Original code
 lea rbp,[rsp-28]                  // Original code

 jmp [pBack+10]                    // Back to main code

//========================================= LJ 1120 #
// RTS - All the time during battle
_MonTroopUnits:
 mov dword ptr [aLast],'_MTU'

 mov rcx,_BackMTU
 mov [pBack+18],rcx

 push rax
 push rbx
 push rdx

 mov rdx,rax

 mov rcx,[rdx+000002E8]
 test rcx,rcx
 jz _ExitMTU

 cmp dword ptr [rcx+70],55555555

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMTU

 mov rax,[rcx+70]
 mov [pCommon],rax

 cmp dword ptr [iEnableGMD],0
 je _MonTU00                       // Jump if feature is disabled

 mov eax,#110
 mov ebx,[rcx+000037AC]
 cmp ebx,eax
 cmovs ebx,eax
 mov [rcx+000037AC],ebx

 mov [rcx+000039E8],ebx
 mov [rcx+000039EC],ebx

_MonTU00:
 cmp dword ptr [iEnableGMD],0
 je _ExitMTU                       // Jump if feature is disabled

 cmp dword ptr [rdx+00000B10],0
 je _ExitMTU

 mov eax,#671000
 mov [rdx+00000B0C],eax
 mov [rdx+00000B10],eax

_ExitMTU:
 pop rdx
 pop rbx
 pop rax

 movss [rbp+000000A0],xmm0         // Original code
 mov rcx,[rax+000002E8]            // Original code (get pTroop)

 jmp [pBack+18]                    // Back to main code

//========================================= LJ 190 *
// RTS - When increasing value
// RCX is safe
_MonWindsOfMagic:
 mov dword ptr [aLast],'_MWM'

 mov rcx,_BackMWM
 mov [pBack+20],rcx

 addss xmm0,[rdi+08]               // Original code (inc cWoM)

 cmp dword ptr [iEnableMWM],0
 je _ExitMWM                       // Jump if feature is disabled

 mov rcx,[rdi]
 cmp rcx,[pCommon]
 jne _ExitMWM

 movss xmm0,xmm1

_ExitMWM:
 comiss xmm0,xmm1                  // Original code
 movss [rdi+08],xmm0               // Original code

 jmp [pBack+20]                    // Back to main code

//========================================= LJ 1110 P
// RTS - when activating a spell (troop)
_MonSpellUse:
 mov dword ptr [aLast],'_MSU'

 mov rax,_BackMSU
 mov [pBack+28],rax

 test rbp,rbp
 jz _ExitMSU

 mov rax,[rsi+10]
 cmp dword ptr [rax+28],00
 jle _ExitMSU

 cmp dword ptr [iEnableMSU],0
 je _ExitMSU                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B68],00    // s7.2 #
 jne _ExitMSU

 cmp dword ptr [rsi+30],01
 js _ExitMSU

 inc dword ptr [rsi+30]

_ExitMSU:
 mov rax,[rsi+10]                  // Original code
 cmp dword ptr [rax+28],00         // Original code
 jl _EMSU00

 dec [rsi+30]                      // Original code

_EMSU00:
 jmp [pBack+28]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (troop)
// RAX if safe
_MonSpellCooldown:
 mov dword ptr [aLast],'_MSC'

 mov rdx,_BackMSC
 mov [pBack+30],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+00003B90]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitMSC                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B60],00
 jne _ExitMSC

 mov ebx,[rsi+1C]

 sub ebx,eax

 cmp ebx,#50
 js _MonSC00

 mov ebx,#50

_MonSC00:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitMSC:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+30]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when activating a spell (army)
_MonSpellUse2:
 mov dword ptr [aLast],'_SU2'

 mov rax,_BackSU2
 mov [pBack+38],rax

 cmp rbp,[pCommon]
 jne _ExitSU2

 mov rax,[rcx+08]
 cmp dword ptr [rax+2C],00
 jle _ExitSU2

 cmp dword ptr [iEnableMSU],0
 je _ExitSU2                       // Jump if feature is disabled

 cmp dword ptr [rax+2C],01
 js _ExitSU2

 inc dword ptr [rax+2C]

_ExitSU2:
 mov rax,[rcx+08]                  // Original code
 cmp dword ptr [rax+2C],00         // Original code
 jl _ESU200                        // Original code

 dec dword ptr [rax+2C]            // Original code

_ESU200:
 jmp [pBack+38]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (army)
_MonSpellCooldown2:
 mov dword ptr [aLast],'_SC2'

 mov rdx,_BackSC2
 mov [pBack+40],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+000002E0]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitSC2                       // Jump if feature is disabled

 cmp rbp,[pCommon]
 jne _ExitSC2

 mov ebx,[rsi+1C]
 sub ebx,eax

 cmp ebx,#50
 js _MonSC20

 mov ebx,#50

_MonSC20:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitSC2:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+40]                    // Back to main code

//========================================= LJ 1120 # (Chariots)
// RTS - All the time during battle
// RCX is safe
_MonUnitStress:
 mov dword ptr [aLast],'_MUS'

 mov rcx,_BackMUS
 mov [pBack+48],rcx

 add eax,ebx                       // Original code
 mov rbx,[rsp+78]                  // Original code

 mov rcx,[rdi+000002E8]
 test rcx,rcx
 jz _ExitMUS

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMUS

 cmp dword ptr [iEnableGMD],0
 je _MonUS00                       // Jump if feature is disabled

 cmp dword ptr [rdi+00000B10],0
 je _MonUS00

 mov ecx,#671000
 mov [rdi+00000B0C],ecx
 mov [rdi+00000B10],ecx

_MonUS00:
 cmp dword ptr [iEnableMUS],0
 je _ExitMUS                       // Jump if feature is disabled

 mov [rdi+000006EC],00

 test eax,eax
 js _ExitMUS

 mov eax,#-100

_ExitMUS:
 add [rdi+000006EC],eax            // Original code (upd Stress)

 jmp [pBack+48]                    // Back to main code
}
//========================================= ok
//------------------------------TBS --------------------------------------
//========================================= LJ 1120 #
// TBS - All the time at main game screen
_MonHumanPlayer:
 mov dword ptr [aLast],'_MHP'

 mov rcx,_BackMHP
 mov [pBack+50],rcx

 mov rcx,[rdx+00000188]            // Original code (get pPlayer)

 mov [pPlayer],rcx
 mov rax,[rcx+00000C20]
 mov [pWay],rax
 mov rax,[rcx+00001D90]
 mov [pRites],rax

 cmp dword ptr [iEnableMMT],0
 je _MonHP00                       // Jump if feature is disabled

 mov eax,ctMMON
 cmp [rcx+00000BF0],eax
 jns _MonHP00

 mov [rcx+00000BF0],eax

_MonHP00:
 cmp dword ptr [iEnableMPI],0
 je _ExitMHP                       // Jump if feature is disabled

 cmp [rcx+00000ED0],0
 je _ExitMHP

 mov eax,ctMINF
 cmp [rcx+00000ED0],eax
 jns _ExitMHP

 mov [rcx+00000ED0],eax

_ExitMHP:
 add rcx,000002D0                  // Original code

 jmp [pBack+50]                    // Back to main code

//========================================= LJ 190 *
// TBS - WHen troop is moving (MP, TS, HHP)
// RAX is safe
_MonActionPoints:
 mov dword ptr [aLast],'_MAP'

 mov rax,_BackMAP
 mov [pBack+58],rax

 mov rax,[rcx+78]
 cmp rax,[pPlayer]
 jne _ExitMAP

 cmp dword ptr [iEnableMAP],0
 je _MonAP00                       // Jump if feature is disabled

 xor edx,edx

_MonAP00:
 cmp dword ptr [iEnableMTS],0
 je _ExitMAP                       // Jump if feature is disabled

 mov eax,[rcx+0000008c]
 mov [rcx+00000088],eax

_ExitMAP:
 mov r8d,[rcx+000000A8]            // Original code (get AP)
 xor eax,eax                       // Original code
 mov r9d,r8d                       // Original code
 sub r9d,edx                       // Original code

 jmp [pBack+58]                    // Back to main code

//========================================= LJ 1110 *
// TBS - When Army is selected (MP, TS, HHP)
_MonActionPoints2:
 mov dword ptr [aLast],'_MA2'

 mov rax,_BackAP2
 mov [pBack+60],rax

 mov rax,[r14+78]
 cmp rax,[pPlayer]
 jne _ExitAP2

 cmp dword ptr [r14+000001b0],0
 je _MonAP2Z

 mov [pLord],r14

_MonAP2Z:
 cmp dword ptr [iEnableMAP],0
 je _MonAP20                       // Jump if feature is disabled

 mov eax,#3661
 cmp eax,[r14+000000A8]
 js _MonAP20

 mov [r14+000000A8],eax

_MonAP20:
 cmp dword ptr [iEnableMTS],0
 je _ExitAP2                       // Jump if feature is disabled

 mov eax,[r14+0000008C]
 mov [r14+00000088],eax

_ExitAP2:
 mov eax,[r14+000000A8]            // Original code (get AP)
 mov [r15+000000EC],eax            // Original code

 jmp [pBack+60]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Hero is moving
// RAX is safe
_MonActionPoints3:
 mov dword ptr [aLast],'_MA3'

 mov rax,_BackAP3
 mov [pBack+68],rax

 cmp dword ptr [iEnableMAP],0
 je _ExitAP3                       // Jump if feature is disabled

 mov rax,[rcx+00000360]
 test rax,rax
 jz _ExitAP3

 mov rax,[rax+10]
 cmp rax,[pPlayer]
 jne _ExitAP3

 mov eax,[rcx+28]
 mov [rcx+2c],eax

 xor edx,edx

 mov [rcx+30],edx

_ExitAP3:
 mov r9d,[rcx+2C]                  // Original code (get AP)
 xor r8d,r8d                       // Original code
 mov eax,r9d                       // Original code
 sub eax,edx                       // Original code

 jmp [pBack+68]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Lord is moving (in the army)
// RDI is safe
_MonActionPoints4:
 mov dword ptr [aLast],'_MA4'

 //mov rdi,_BackAP4
 mov [pBack+70],rdi

 mov rdi,[rbx+00000360]
 test rdi,rdi
 jz _ExitAP4

 mov rdi,[rdi+10]
 cmp rdi,[pPlayer]
 jne _ExitAP4

 mov [pHero],rbx                   // It is, in fact, a Lord

 cmp dword ptr [iEnableMAP],0
 je _ExitAP4                       // Jump if feature is disabled

 mov eax,[rbx+28]

 xor rsi,rsi
 mov [rbx+30],esi

_ExitAP4:
 sub esi,eax                       // Original code
 mov [rbx+2C],eax                  // Original code (upd AP)
 cmovs esi,ebp                     // Original code
 mov rbp,[rsp+30]                  // Original code

 jmp [pBack+70]                    // Back to main code

//========================================= LJ 1120 *
// TBS - During Turn Changing
// RAX is safe
_MonResearchProg:
 mov dword ptr [aLast],'_MRP'

 mov rax,_BackMRP
 mov [pBack+78],rax

 mov r9d,[rdx+0C]                  // Original code
 add r9d,r8d                       // Original code

 cmp dword ptr [iEnableMRP],0
 je _ExitMRP                       // Jump if feature is disabled

 mov rax,[rsi+20]
 cmp rax,[pPlayer]
 jne _ExitMRP

 mov r9d,[rcx+5C]

_ExitMRP:
 cmp r9d,[rcx+5C]                  // Original code (chk if finished)
 mov rcx,rsi                       // Original code

 jmp [pBack+78]                    // Back to main code

//========================================= LJ 190 *
// TBS - When looking at the Army (When recruiting)
// RAX is safe
_MonTroopRecruit:
 mov dword ptr [aLast],'_MTR'

 mov rax,_BackMTR
 mov [pBack+80],rax

 mov rax,COTR
 call rax                          // Original code

 test eax,eax                      // Original code
 js _EMTR00

 push rcx

 cmp dword ptr [iEnableMTR],0
 je _ExitMTR                       // Jump if feature is disabled

 mov rcx,[rbx+38]
 test rcx,rcx
 jz _ExitMTR

 mov rcx,[rcx+70]
 cmp rcx,[pPlayer]
 jne _ExitMTR

 mov dword ptr [rbx+50],0

_ExitMTR:
 pop rcx

 add eax,[rbx+50]                  // Original code (get #turns)

 jmp [pBack+80]                    // Back to main code

_EMTR00:
 mov rbx,JOTR
 jmp rbx

//========================================= LJ 1120 #
// TBS - During Turn Changing
_MonConstProg:
 mov dword ptr [aLast],'_MCP'

 mov rax,_BackMCP
 mov [pBack+88],rax

 inc [rcx+0C]                      // Original code (upd prog)

 cmp dword ptr [rcx+10],1
 je _ExitMCP

 cmp dword ptr [iEnableMCP],0
 je _ExitMCP                       // Jump if feature is disabled

 cmp r14,[pPlayer]
 jne _ExitMCP

 mov eax,[rcx+10]
 mov [rcx+0C],eax

_ExitMCP:
 mov eax,[rcx+0C]                  // Original code
 cmp eax,[rcx+10]                  // Original code
 setae al                          // Original code

 jmp [pBack+88]                    // Back to main code

//========================================= LJ 190 X
// TBS - During Turn Changing
_MonPublicOrder:
 mov dword ptr [aLast],'_MPO'

 //mov rcx,_BackMPO
 mov [pBack+90],rcx

 cmp dword ptr [iEnableMPO],0
 je _ExitMPO                       // Jump if feature is disabled

 cmp r15,[pPlayer]
 jne _ExitMPO
{
 xor edx,edx

 mov ebx,[r14+30]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+30],ebx
 mov ebx,[r14+34]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+34],ebx
 mov ebx,[r14+38]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+38],ebx
 mov ebx,[r14+3c]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+3c],ebx
}

 mov ecx,[r14+3C]
 add ecx,eax
 cmp ecx,#68
 jns _ExitMPO

 mov ecx,[r14+3C]
 mov eax,#68
 sub eax,ecx                       // Val to be added

_ExitMPO:
 mov ecx,[r14+3C]                  // Original code
 mov [rbx+0C],ecx                  // Original code (upd PO)
 cmp dword ptr [r14+4C],01         // Original code

 jmp [pBack+90]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When looking at the Province
_MonPopSurplus:
 mov dword ptr [aLast],'_MPS'

 mov rsi,_BackMPS
 mov [pBack+98],rsi

 cmp dword ptr [iEnableMPS],0
 je _ExitMPS                       // Jump if feature is disabled

 mov rsi,[rdx+000000d0]
 test rsi,rsi
 jz _ExitMPS

 mov rsi,[rsi+10]
 cmp rsi,[pPlayer]
 jne _ExitMPS

 mov esi,#30

 cmp esi,[rdx+00000388]
 js _ExitMPS

 mov [rdx+00000388],esi

_ExitMPS:
 mov r15d,[rdx+0000038C]           // Original code (Get Growth)
 lea rsi,[rdx+00000380]            // Original code

 jmp [pBack+98]                    // Back to main code

//========================================= LJ 190 *
// TBS - On ARK selection
_MonPopSurplus2:
 mov dword ptr [aLast],'_PS2'

 mov rcx,_BackPS2
 mov [pBack+00A0],rcx

 cmp dword ptr [iEnableMPS],0
 je _ExitPS2                       // Jump if feature is disabled

 mov rcx,[rax+00000140]
 test rcx,rcx
 jz _ExitPS2

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitPS2

 mov rcx,[rax+00000618]
 mov rcx,[rcx+18]

 cmp dword ptr [rcx+08],#32
 jns _ExitPS2

 mov dword ptr [rcx+08],#32

_ExitPS2:
 mov rcx,[rax+00000618]            // Original code (Get ppPopSp)
 mov rax,[rcx+18]                  // Original code
 mov eax,[rax+08]                  // Original code

 jmp [pBack+00A0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - When a hero/Lord is selected
// RCX is safe
_MonSelHero:
 mov dword ptr [aLast],'_MSH'

 mov r15,_BackMSH
 mov [pBack+00A8],r15

 mov r12,[r14]
 test r12,r12
 jz _ExitMSH

 mov [pHero],r12

 mov rcx,[r12+00000360]
 test rcx,rcx
 jz _ExitMSH

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitMSH

 cmp dword ptr [iEnableMAP],0
 je _MonSH00                       // Jump if feature is disabled

 mov esi,[r12+28]
 mov [r12+2c],esi

_MonSH00:
 cmp dword ptr [iEnableHAA],0
 je _MonSH01                       // Jump if feature is disabled

 mov byte ptr [r12+00000940],00    // (s3.0)
 mov byte ptr [r12+00000948],00

 mov byte ptr [r12+00000E28],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E29],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E2A],00    // SearchedTreasure (s6.1)

_MonSH01:
 cmp dword ptr [iEnableMXP],0
 je _ExitMSH                       // Jump if feature is disabled

 lea rcx,[rax-64]
 cmp ecx,[r14+00000254]
 js _ExitMSH

 mov [r14+00000254],ecx

_ExitMSH:
 mov r12d,[r14+00000254]           // Original code (Get XP)
 mov r15d,eax                      // Original code
 sub r15d,ebx                      // Original code

 jmp [pBack+00A8]                  // Back to main code

//========================================= LJ 1110 *
// TBS - All the time at main game screen (Skaven/Lizards)
_MonPlayerFood:
 mov dword ptr [aLast],'_MPF'

 mov rax,_BackMPF
 mov [pBack+00B0],rax

 mov rax,[rdi+08]                  // Original code

 mov rbx,[rax+08]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+18]
 cmp rbx,[pPlayer]
 jne _ExitMPF

 mov rbx,[rax]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+08]
 test rbx,rbx
 jz _ExitMPF

 mov ebx,[rbx+04]
 cmp ebx,'en_f'
 jne _MonPF00

 mov [pFood],rax

 cmp dword ptr [iEnableMPF],0
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMFOO
 jmp _MonPF0X
//--
_MonPF00:
 cmp ebx,'reac'
 je _MonPF01

 cmp ebx,'nuke'
 jne _MonPF02

_MonPF01:
 cmp dword ptr [iEnableSSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMSSR
 jmp _MonPF0X
//--
_MonPF02:
 cmp ebx,'sacr'
 jne _MonPF03

 cmp dword ptr [iEnableLSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMLSR
 jmp _MonPF0X
//--
_MonPF03:
 cmp ebx,'old_'
 jne _MonPF04

 cmp dword ptr [iEnableMOO],0      // s7.1
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF04:
 cmp ebx,'salv'
 jne _MonPF05

 cmp dword ptr [iEnableSCR],0      // s7.9 (Scrap)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF05:
 cmp ebx,'drea'
 jne _MonPF06

 cmp dword ptr [iEnableDRE],0      // s7.19 (Dread)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#3700
 jmp _MonPF0X
//--
_MonPF06:
 jmp _ExitMPF
//--
_MonPF0X:
 cmp [rax+20],ebx
 jns _ExitMPF

 mov [rax+20],ebx

_ExitMPF:
 mov rbx,[rsp+50]                  // Original code
 mov rsi,[rsp+58]                  // Original code

 jmp [pBack+00B0]                  // Back to main code

//========================================= LJ 1104 *
// TBS - During turn changing
_MonRitesCD:
 mov dword ptr [aLast],'_MRC'

// mov rax,_BackMRC
 mov [pBack+00B8],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,r8d                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitMRC

 cmp dword ptr [iEnableMRC],0
 je _ExitMRC                       // Jump if feature is disabled

 test eax,eax
 js _ExitMRC

 xor eax,eax

_ExitMRC:
 mov [rbx+10],eax                  // Original code

 jmp [pBack+00B8]                  // Back to main code

//========================================= LJ 1111 *
// TBS - During turn changing
_MonRitesCD2:
 mov dword ptr [aLast],'_RC2'

// mov rax,_BackRC2
 mov [pBack+00C0],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,edx                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitRC2

 cmp dword ptr [iEnableMRC],0
 je _ExitRC2                       // Jump if feature is disabled

 test eax,eax
 js _ExitRC2

 xor eax,eax

_ExitRC2:
 mov [rbx+08],eax                  // Original code

 jmp [pBack+00C0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - God Mode for Autobattle and Troop XP
_GodModeTBS:
 mov r14,_BackGMT
 mov [pBack+00C8],r14

 cmp dword ptr [iEnableGMT],0
 je _GodMT01                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 je _GodMT00

// mov dword ptr [rdx+58],00
// mov dword ptr [rdx+6c],00
// mov dword ptr [rdx+000000A4],00
 jmp _ExitGMT
//--
_GodMT00:
 mov r14d,[rdx+50]
 mov [rdx+58],r14d

 mov r14d,[rdx+64]
 mov [rdx+6c],r14d

 mov byte ptr [rdx+7C],01
 mov byte ptr [rdx+7E],00

_GodMT01:
 cmp dword ptr [iEnableMTX],0
 je _ExitGMT                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 jne _ExitGMT

 cmp dword ptr [rdx+0000009C],00
 je _ExitGMT

 cmp byte ptr [rcx+000000C8],09
 jns _ExitGMT

 mov r14d,#30000
 cmp [rdx+0000009C],r14d
 jns _ExitGMT

 mov [rdx+0000009C],r14d

_ExitGMT:
 mov rax,[rcx+00000080]            // Original code
 mov r14,rdx                       // Original code
 mov rsi,rcx                       // Original code

 jmp [pBack+00C8]                  // Back to main code

//========================================= LJ 190 X
// TBS - Keep human player's AMBER at minimum (per Settlement / per Event)
// RAX is safe
_MonPlayerAmber:
 mov dword ptr [aLast],'_MPA'

 mov rax,_BackMPA
 mov [pBack+00D0],rax

 mov ax,[r8+08]
 cmp ax,00eb
 je _MonPA00

 cmp ax,00ec
 jne _ExitMPA

 mov rax,RPAE
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAE],0
 je _ExitMPA                       // Jump if feature is disabled

// mov rax,[rbp+60]
// test rax,rax
// jz _ExitMPA

// mov rax,[rax+00000188]

 mov eax,[r8+18]           // for debugging

 cmp rbx,[pPlayer]         // [RSP+18]=Player as well
 jne _ExitMPA

 mov eax,ctMAPE
 jmp _MonPA01
//==
_MonPA00:
 mov rax,RPAS
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAS],0
 je _ExitMPA                       // Jump if feature is disabled

 mov rax,[rbp+60]
 test rax,rax
 jz _ExitMPA

 mov rax,[rax+00000188]
 cmp rax,[pPlayer]
 jne _ExitMPA

 mov eax,ctMAPS

_MonPA01:
 cmp [r8+18],eax
 jns _ExitMPA

 mov [r8+18],eax
 mov [r8+1c],eax

_ExitMPA:
 movss xmm1,[r8+18]                // Original code (get value)
 xorps xmm0,xmm0                   // Original code
 comiss xmm1,xmm0                  // Original code

 jmp [pBack+00D0]                  // Back to main code

//========================================= LJ ok
// TBS - Keep human player's Slaves per Settlement at minimum (for Dark Elves)
_MonSlavesPerSettlement:
 mov dword ptr [aLast],'_MSS'

 mov rdx,_BackMSS
 mov [pBack+00D8],rdx

 test rax,rax                      // Original code
 je _EMSS00                        // Original code

 movsd [qXMM0],xmm0
 movsd [qXMM1],xmm1

 cmp r15,[pPlayer]
 jne _ExitMSS

 cmp dword ptr [iEnableMSS],0
 je _ExitMSS                       // Jump if feature is disabled

 movsd xmm0,[qMinimum]
 cvtsi2sd xmm1,[rax+0c]
 mulsd xmm0,xmm1
 cvtsi2sd xmm1,[rax+08]
 maxsd xmm0,xmm1
 cvtsd2si ecx,xmm0
 mov [rax+08],ecx

_ExitMSS:
 movsd xmm0,[qXMM0]
 movsd xmm1,[qXMM1]

 mov edx,[rax+08]                  // Original code (get value)
 mov rcx,rax                       // Original code
 mov rbx,CSPS                      // RBX is safe
 call rbx                          // Original code

_EMSS00:
 jmp [pBack+00D8]                  // Back to main code

qMinimum:
 dq (double)0.20

//=========================================
align 10,'='
//=========================================
 db '===============================>'
 db 'CE7.4 Script by Recifense 220502'
//=========================================
// Variables
iEnableGMD:
 dq 0
iEnableMTA:
 dq 0
iEnableMTL:
 dq 0
iEnableMWM:
 dq 0
iEnableMMT:
 dq 0
iEnableMAP:
 dq 0
iEnableMTS:
 dq 0
iEnableMRP:
 dq 0
iEnableMTR:
 dq 0
iEnableMCP:
 dq 0
iEnableMPO:
 dq 0
iEnableMPS:
 dq 0
iEnableMXP:
 dq 0
iEnableHAA:
 dq 0
iEnableMPI:
 dq 0
iEnableMPF:
 dq 0
iEnableMRC:
 dq 0
iEnableGMT:
 dq 0
iEnableMTX:
 dq 0
iEnablePAE:
 dq 0
iEnablePAS:
 dq 0
iEnableMSU:
 dq 0
iEnableMSC:
 dq 0
iEnableMSS:
 dq 0
iEnableMUS:
 dq 0
iEnableSSR:
 dq 0
iEnableLSR:
 dq 0
iEnableMOO:
 dq 0
iEnableSCR:
 dq 0
iEnableDRE:
 dq 0
pPlayer:
 dq MyCode
pWay:
 dq MyCode
pRites:
 dq MyCode
pFood:
 dq 0
pLord:
 dq 0
pHero:
 dq 0
pUnit:
 dq 0
pDebug:
 dq 0
pCommon:
 dq MyCode
lRBX:
 dq 0
qXMM0:
 dq 0
qXMM1:
 dq 0
pRBX:
 dq 0
pBack:
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
aLast:
 db 'CE70'
iSize:
 dd iSize-MyCode

//=========================================
// Hacking Points
{GDMD:
 mov rax,_GodMode
 jmp rax
 nop
 nop
 nop
 nop
 nop}
_BackGMD:

{MOTA:
 mov rcx,_MonTroopAmmo
 jmp rcx}
_BackMTA:

{GDM2:
 mov rax,_GodMode2
 jmp rax}
_BackGM2:

{MOTU:
 mov rcx,_MonTroopUnits
 jmp rcx
 nop
 nop
 nop}
_BackMTU:

{MOWM:
 mov rcx,_MonWindsOfMagic
 jmp rcx
 nop}
_BackMWM:

MOSU:
// mov rax,_MonSpellUse
// jmp rax
// nop
_BackMSU:

{MSCD:
 mov rdx,_MonSpellCooldown
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackMSC:

{MSU2:
 mov rax,_MonSpellUse2
 jmp rax
 nop}
_BackSU2:

{MSC2:
 mov rdx,_MonSpellCooldown2
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop}
_BackSC2:

{MOUS:
 mov rcx,_MonUnitStress
 jmp rcx
 nop}
_BackMUS:

// ---------------------- TBS
MOHP:
 mov rcx,_MonHumanPlayer
 jmp rcx
 nop
 nop
_BackMHP:

MOAP:
 mov rax,_MonActionPoints
 jmp rax
 nop
 nop
 nop
_BackMAP:

MAP2:
 mov rax,_MonActionPoints2
 jmp rax
 nop
 nop
_BackAP2:

MAP3:
 mov rax,_MonActionPoints3
 jmp rax
_BackAP3:

{MAP4:
 mov rdi,_MonActionPoints4
 jmp rdi
 nop
_BackAP4:
}
MORP:
 mov rax,_MonResearchProg
 jmp rax
 nop
 nop
_BackMRP:

MOTR:
 mov rax,_MonTroopRecruit
 jmp rax
_BackMTR:

MOCP:
 mov rax,_MonConstProg
 jmp rax
_BackMCP:
{
MOPO:
 mov rcx,_MonPublicOrder
 jmp rcx
_BackMPO:
}
MOPS:
 mov rsi,_MonPopSurplus
 jmp rsi
 nop
 nop
_BackMPS:

MPS2:
 mov rcx,_MonPopSurplus2
 jmp rcx
 nop
 nop
_BackPS2:

MOSH:
 mov r15,_MonSelHero
 jmp r15
_BackMSH:

MOPF:
 mov rax,_MonPlayerFood
 jmp rax
 nop
 nop
_BackMPF:
{
MORC:
 mov rax,_MonRitesCD
 jmp rax
 nop
 nop
_BackMRC:

MRC2:
 mov rax,_MonRitesCD2
 jmp rax
 nop
_BackRC2:
}
GMTB:
 mov r14,_GodModeTBS
 jmp r14
_BackGMT:

MOPA:
 mov rax,_MonPlayerAmber
 jmp rax
_BackMPA:

MSPS:
{
 mov rdx,_MonSlavesPerSettlement
 jmp rdx
 nop
 nop
 nop
 nop
}
_BackMSS:

//=========================================
// Script for Restoring Original Codes
[DISABLE]
GDMD:
 db 44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1

MOTA:
 db 45 85 C0 74 07 41 8D 48 FF 89 0C 38

GDM2:
 db 40 55 56 41 54 41 56 48 8D 6C 24 D8

MOTU:
 db F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00

MOWM:
 db F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08

//MOSU:
// db 48 8B 46 10 83 78 28 00 7C 03 FF 4E 30

MSCD:
readmem(SMSCD,18)

MSU2:
 db 48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C

MSC2:
readmem(SMSC2,18)

MOUS:
 db 03 C3 48 8B 5C 24 78 01 87 EC 06 00 00

// ---------------------- TBS
MOHP:
 db 48 8b 8a 88 01 00 00 48 81 c1 d0 02 00 00

MOAP:
 db 44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1

MAP2:
 db 41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00

MAP3:
 db 44 8B 49 2C 45 33 C0 41 8B C1 2B C2

//MAP4:
 //db 29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30

MORP:
 db 44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE

MOTR:
readmem(SMOTR,12)

MOCP:
 db FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0

//MOPO:
 //db 41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01

MOPS:
 db 44 8b ba 8c 03 00 00 48 8d b2 80 03 00 00

MPS2:
 db 48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08

MOSH:
 db 45 8B A6 54 02 00 00 44 8B F8 44 2B FB

MOPF:
 db 48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58

//MORC:
 //db FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10

//MRC2:
 //db FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08

GMTB:
 db 48 8B 81 80 00 00 00 4C 8B F2 48 8B F1

MOPA:
 db F3 41 0F 10 48 18 0F 57 C0 0F 2F C8

//MSPS:
//readmem(SMSPS,16)

//=========================================
// Unregistering Symbols
unregistersymbol(MyCode)
unregistersymbol(iEnableGMD)
unregistersymbol(iEnableMTA)
unregistersymbol(iEnableMTL)
unregistersymbol(iEnableMWM)
unregistersymbol(iEnableMMT)
unregistersymbol(iEnableMAP)
unregistersymbol(iEnableMTS)
unregistersymbol(iEnableMRP)
unregistersymbol(iEnableMTR)
unregistersymbol(iEnableMCP)
unregistersymbol(iEnableMPO)
unregistersymbol(iEnableMPS)
unregistersymbol(iEnableMXP)
unregistersymbol(iEnableHAA)
unregistersymbol(iEnableMPI)
unregistersymbol(iEnableMPF)
unregistersymbol(iEnableMRC)
unregistersymbol(iEnableGMT)
unregistersymbol(iEnableMTX)
unregistersymbol(iEnablePAE)
unregistersymbol(iEnablePAS)
unregistersymbol(iEnableMSU)
unregistersymbol(iEnableMSC)
unregistersymbol(iEnableMSS)
unregistersymbol(iEnableMUS)
unregistersymbol(iEnableSSR)
unregistersymbol(iEnableLSR)
unregistersymbol(iEnableMOO)
unregistersymbol(iEnableSCR)
unregistersymbol(iEnableDRE)

unregistersymbol(pPlayer)
unregistersymbol(pLord)
unregistersymbol(pHero)
unregistersymbol(pUnit)
unregistersymbol(pDebug)
unregistersymbol(pCommon)
unregistersymbol(pFood)
unregistersymbol(aLast)

unregistersymbol(SMSCD)
unregistersymbol(SMSC2)
unregistersymbol(SMOTR)
unregistersymbol(SMSPS)

//=========================================
dealloc(MyCode)
dealloc(SMSCD)
dealloc(SMSC2)
dealloc(SMOTR)
dealloc(SMSPS)
//============= Scripts End ===============

// ****************************************
// NOTES
// ****************************************
{
}
well try this, and also your error doesn't seem logical unless either the code you change someting or didn't select a process
I tried to use the code/script you gave (I tried to insert it into the window that pops up when you hit "Ctrl+Alt+A"), and I got THIS error message:

"Error in line 202 (asser(warhammer2.exe+29ACADA,48 8B 8A 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)) :The bytes at warhammer2.exe+29ACADA are not what was expected"

Did I do something wrong or...?
well it could be because I use the epic version not the steam one. You could search for the bytes address with cheat engine and replace them with the correct one. by the way it works for me when I open cheat engine will the game starts to run.
Last edited by yazz on Wed Aug 24, 2022 8:38 pm, edited 1 time in total.

yazz
Novice Cheater
Novice Cheater
Posts: 15
Joined: Fri Jul 22, 2022 7:32 pm
Reputation: 5

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by yazz »

CEuser1239 wrote:
Tue Aug 23, 2022 8:30 am
Current table in the OP doesn't work. Neither does the yazz code. Both just crash the game.
I guess the problem is maybe because I use epic version

soibac
Novice Cheater
Novice Cheater
Posts: 22
Joined: Sat Mar 16, 2019 12:38 am
Reputation: 2

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by soibac »

Hello , can you update the table plz

VKX
Expert Cheater
Expert Cheater
Posts: 125
Joined: Sat Sep 15, 2018 1:29 pm
Reputation: 84

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by VKX »

Here is a update of Recifense's table for the current patch on Steam, v20236.

Warhammer2 - 001 - [v20236].CT
(97.38 KiB) Downloaded 1950 times

I haven't fully tested everything, but it seems to be working. The only thing disabled is the Wood Elf Amber option, due to significant game mechanic changes.

I haven't touched any of the notes in the table, so please excuse any incorrect version numbers in them.

If you like this table, go thank Recifense for originally making it, and/or subscribe to their Patreon.

IlyaAir11
What is cheating?
What is cheating?
Posts: 1
Joined: Mon Sep 05, 2022 7:00 pm
Reputation: 1

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by IlyaAir11 »

It works, if you launch table then game main menu just open. If you launch table then campaign already running, you will have a error: <Failure to attempt to memory...>

VKX
Expert Cheater
Expert Cheater
Posts: 125
Joined: Sat Sep 15, 2018 1:29 pm
Reputation: 84

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by VKX »

Yes, I encountered that bug too, but only rarely. It works if you try enabling the table again after waiting a minute or so.

Chinzu12033
What is cheating?
What is cheating?
Posts: 4
Joined: Tue Dec 28, 2021 12:18 pm
Reputation: 1

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by Chinzu12033 »

yazz wrote:
Tue Aug 09, 2022 11:20 pm

Code: Select all

{
===========================================
 Game Title    : Total War - Warhammer 2
 Game Version  : 1.12.1 (20163) (The Silence & The Fury)
 Game Sponsor  : Myself (Game+DLCs) (with Patreon's fund)
 Process Name  : Warhammer2.exe
 Relevant Info : 64bits/TBS/RTS
 Script Version: 8.4 (LJ)
 CE Version    : 7.4
 Release date  : 02-May-2022
 Author        : Recifense
 History:
 29-Sep-2017: First Release
 30-Sep-2017: Trying to Fix Construction + Minimum Food (s2.0)
 01-Oct-2017: Added "Rites Cooldown in 1 turn" and fix "CanActAgain" (s3.0)
 03-Oct-2017: Included Arks in Pop Surplus (s3.1)
 10-Oct-2017: God Mode for Auto-Resolve battles and Troop Quick Level Up (s3.2)
 26-Oct-2017: Release for version 1.1.0-4871
 28-Oct-2017: Porting of AMBER features from Warhammer TW (s3.3)
 04-Nov-2017: Release for version 1.1.0-5003 beta
 09-Nov-2017: Release for version 1.1.1-5078
 14-Dec-2017: Release for version 1.2.0-5568
 23-Jan-2018: Release for version 1.3.0-6014 (Rise of the Tomb kings)
 24-Jan-2018: Added two more features releated to spell durng combat (s5.0)
 25-Jan-2018: Include spells related to the army (s5.1)
 30-Jan-2018: Minimum Slave per Settlement (Dark Elves) (s5.2)
 14-Feb-2018: Release for version 1.3.1-6213 + Min Pop Surplus = 30 (s5.3)
 31-May-2018: Release for version 1.4.0-7243
 20-Jun-2018: Release for version 1.4.0-7312 Beta (CE68)(s5.4)
 21-Jun-2018: Release for version 1.4.1-7450
 30-Jun-2018: Include "Ever fresh units (Full Vigour)" (CE67)(s5.5)
 10-Nov-2018: Release for version 1.5.0-8774 (s6.0)
 11-Nov-2018: Fix for unlimited spell + can Search Treasure again  (s6.1)
 16-Dec-2018: Release for version 1.5.1-9184 Beta (s6.2)
 22-Jan-2019: Release for version 1.5.1-9466 Beta (s6.3)
 18-Apr-2019: Release for version 1.6.0-10563 (s6.4)
 20-Apr-2019: Skaven Warpstorm and Warp-Fuel + Lizards Sacrificial Offerings (s6.5)
 16-May-2019: Release for version 1.6.1-10846 (s6.6)
 12-Sep-2019: Release for version 1.7.0-11694 + Feature (Old Ones) (s6.7)(CE70)
 17-Sep-2019: Release for version 1.7.1-11765 (s6.8)
 23-Sep-2019: Changed the hacking method to long jumps (s7.0)
 16-Oct-2019: Release for version 1.7.2-12104 (s7.1)
 14-Dec-2019: Release for version 1.8.0-13017 (s7.2)
 15-Dec-2019: Fix for crashing during RTS battle (s7.3)
 18-Dec-2019: Release for version 1.8.1-13089 (s7.4)
 13-Jan-2020: Release for version 1.8.2-13152 (s7.5)
 28-Feb-2020: Release for version 1.8.3-13831 (s7.6)
 25-May-2020: Release for version 1.9.0-15159 (s7.7) Preliminary
 26-May-2020: Fix for Rites/Influence (s7.8)
 29-May-2020: Release for version 1.9.1-15282 + New feature (s7.9)
 13-Jun-2020: Release for version 1.9.2-15323 (beta)(s7.10)
 18-Jun-2020: Release for version 1.9.2-15501 (beta2)(s7.11)
 13-Jul-2020: Release for version 1.9.2-15685 (beta3) + Fix for Amber (event)(s7.12)
 05-Dec-2020: Release for version 1.10.0-16858 (s7.13)
 07-Jan-2021: Release for version 1.10.1-16966 (s7.14)
 08-Feb-2021: Release for version 1.10.2-17427 (s7.15)
 20-Mar-2021: Release for version 1.11.0-18012 (s7.16)
 22-Apr-2021: Release for version 1.11.1-18231 (s7.17)
 29-Apr-2021: Fix for Rites (s7.18)
 15-Jul-2021: Release for version 1.12.0-18858 (s7.19P) Preliminary
 16-Jul-2021: Release for version 1.12.0-18858 (s8.0) + Minimum Dread
 22-Jul-2021: Fix for Spell Cooldown (s8.1)
 08-Sep-2021: Release for version 1.21.1-19098 (s8.2)
 03-Nov-2021: Release for version 1.21.1-19592 (s8.3)
 02-May-2022: Release for version 1.21.1-20163 (s8.4)
 Features:
 - God Mode  (RTS)
 - Full Ammo (RTS)
 - Minimum Leadership (GM) (RTS)
 - Fast Recover of Winds of Magic (RTS)
 - Unlimited use of limited spells  (RTS) (s5.0) new
 - Spell Quick Cooldown (RTS)             (s5.0) new
 - Ever fresh units  (RTS)                (s5.5) new
 - Minimum Treasure
 - Minimum Influence
 - Minimum Food (Skaven)
 - Unlimited Action Points
 - Recover Troop Size/Hero HP
 - Research in 1 turn
 - Recruitment in 1 turn
 - Construction in 1 turn
 - Rites Cooldown in 1 turn
 - Minimum Public Order
 - Minimum Pop Surplus (including Arks) (s3.1)
 - Level almost complete (sel hero XP)
 - Hero can Act Again
   - Included Search for Treasure    (s6.1)
 - God Mode for Auto-resolve battles (s3.2)
 - Troops Quick Level Up             (s3.2)
 - Minimum Amber Per Settlement      (s3.3)
 - Minimum Event Total Amber         (s3.3)
 - Minimum Slaves Per Settlement     (s5.2) (for Dark Elves) (Pending)
 - Minimum Special Resources:        (s6.5)
   - Nukes and Warps (Skaven)
   - Sacrificial Offerings (Lizards)
 - Minimum Old Ones                  (s6.7) (for Nakai the Wanderer)
 - Minimum Scraps                    (s7.9) (for Grom the Paunch)
 - Minimum Dread                     (s8.0) (new) (for Taurox the Brass Bull)
 - Some Pointers
===========================================
}


//=========================================
// Checking CE version
{$lua}
  if(getCEVersion() < 7.0) then
    ShowMessage('Warning. CE version should be 7.0 or above')
  end
{$asm}

//=========================================
// Checking Selected Process
{$lua}
  if(process == nil) then
    ShowMessage('No process was selected')
  elseif (string.upper(process) ~= string.upper("Warhammer2.exe")) then
    ShowMessage('Warning. Expected Process = Warhammer2.exe')
  end
{$asm}

//=========================================
{$lua}
--  monoAA_USEMONO(process,false)
  if waitForPDB then --this way older CE versions are unaffected (by Dark Byte)
    waitForPDB()
  end
{$asm}

//=========================================
// Definitions
define(LUDO,"Warhammer2.exe")
define(GDMD,warhammer2.exe+2098B00) //20==#====#==#=#===
define(MOTA,warhammer2.exe+23BB27E) //20==#====#====#===
define(GDM2,warhammer2.exe+217FD00) //20==#====#==#=#===
define(MOTU,warhammer2.exe+22A10DD) //20==#====#==#=#=== 2 1
define(MOWM,warhammer2.exe+2018023) //20==#=============
define(MOSU,Warhammer2.exe+02024250) //20==#=========PPPP (s5.0)
define(MSCD,warhammer2.exe+1E0CC2C) //20==#====#====#=== (s5.0)
define(CSCD,Warhammer2.exe+020108F0)
define(MSU2,warhammer2.exe+2010F70) //20==PPPPPPPPPPX=== (s5.1)
define(MSC2,warhammer2.exe+1E0C8C8) //20==#=========#=== (s5.1)
define(MOUS,warhammer2.exe+219F29C) //20==#====#==#=#=== (s5.5)
//-- 10
define(MOHP,warhammer2.exe+29ACADA) //20==#=======#=#===
//define(MOAP,Warhammer2.exe+1C7A9AF0) //20==#=============
define(MAP2,warhammer2.exe+14A693A) //20==#====##=#=====
define(MAP3,warhammer2.exe+1A35730) //20==#=============
//define(MAP4,Warhammer2.exe+1CC56DB3) //20==#=============
define(MORP,warhammer2.exe+18937B6) //20==X====##===#===
define(MOTR,warhammer2.exe+1A87826) //20==#=============
define(COTR,Warhammer2.exe+01A86F80)
define(JOTR,Warhammer2.exe+01A8736D)
define(MOCP,warhammer2.exe+1BD8170) //20==#=========#===
//define(MOPO,Warhammer2.exe+1CCFAAE1) //20==X=============
define(MOPS,warhammer2.exe+2AB109E) //20==#=======#=#===
//-- 20
define(MPS2,warhammer2.exe+180949C) //20==#=========#=== (s3.1)
define(MOSH,warhammer2.exe+28194DC) //20==#=======#=#===
define(MOPF,warhammer2.exe+295DD48) //20==#=======#=====
//define(MORC,Warhammer2.exe+1CCA90E6) //20==X====X=#======
//define(MRC2,Warhammer2.exe+1CCA91E8) //20==X====X=#======
define(GMTB,warhammer2.exe+1465C08) //20==X====#==#=#=== (s3.2)
define(MOPA,warhammer2.exe+D0E8B2) //20==#============= (s3.3)

define(MSPS,Warhammer2.exe+00b0d0e2) //20PPPPPPPPPPPPPPPP (s5.2)
define(CSPS,Warhammer2.exe+00afabd0)

define(RPAS,Warhammer2.exe+0882141B) //20==#=========PPPP (s3.3)
define(RPAE,Warhammer2.exe+095C17BC) //20==#===#===#PPPPP (s3.3)

//=========================================
// Constants used in the script (that can be changed)
define(ctCE67,(float)7.0)
define(ctMMON,#70000)  // Minimum Money
define(ctMINF,#70)     // Minimum Influence
define(ctMFOO,#80)     // Minimum Food
define(ctMSSR,#12)     // Minimum Skaven Special Resources
define(ctMLSR,#500)    // Minimum Lizard Special Resource
define(ctMAPS,(float)5.0)  // OK
define(ctMAPE,(float)20.0) // OK

//=========================================
[ENABLE]
//=========================================
//LuaCall(CheckVersion())
//=========================================
// Check if script is compatible to this game version
// If false the script will not be loaded

assert(GDMD,44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1 44 89 41 04 8B 01)
assert(MOTA,45 85 C0 74 07 41 8D 48 FF 89 0C 38 84 D2 0F 84 ?? ?? 00 00 85 C9)
assert(GDM2,40 55 56 41 54 41 56 48 8D 6C 24 D8 48 81 EC 28 01 00 00 48 8B F1 4C 8B F2 48 8B 89 E0 02)
assert(MOTU,F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00 48 85 C9 74 ?? E8 ??)
assert(MOWM,F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08 76 ?? F3 0F 11 4F 08 49 83)
//assert(MOSU,48 8B 46 10 83 78 28 00 7C 03 FF 4E 30 0F 57 F6 48 85 ED ?? ?? 48)   //P
assert(MSCD,48 8B 95 90 3B 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MSU2,48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C C3 CC ?? ?? ?? ?? ?? ?? ??)
assert(MSC2,48 8B 95 E0 02 00 00 48 8B CE E8 ?? ?? ?? ?? 29 46 1C 83 7E 1C 00)
assert(MOUS,03 C3 48 8B 5C 24 78 01 87 EC 06 00 00 48 8B CF E8 ?? ?? ?? ?? 4C)
//-- 10
assert(MOHP,48 8B 8A 88 01 00 00 48 81 C1 D0 02 00 00 E8 ?? ?? ?? ?? 45 33 ED)
//assert(MOAP,44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1 41 39 D0 41 0F 47 C1)
assert(MAP2,41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00 49 8B 46 70 48 85 C0 ??)
assert(MAP3,44 8B 49 2C 45 33 C0 41 8B C1 2B C2 41 3B D1 44 0F 46 C0 44 89 41 2C)
//assert(MAP4,29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30 01 73 30 48 8B 74 24 38 48)
assert(MORP,44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE 0F 83 ?? ?? ?? ?? 44 89 4A 0C)
assert(MOTR,E8 ?? ?? ?? ?? 85 C0 78 ?? 03 43 50 48 83 C4 20 5B C3 B8 FF FF FF)
assert(MOCP,FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0 C3 ?? ?? ?? ?? ?? ?? ?? ?? ??)
//assert(MOPO,41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01 ?? ?? 49 8B 0E 48 81 C1 A8 00)
//--19
assert(MOPS,44 8B BA 8C 03 00 00 48 8D B2 80 03 00 00 48 8B DA 4C 8B E1 48 8B CE B2 01)
assert(MPS2,48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08 C3 ?? ?? ?? ?? ?? ?? ??)
assert(MOSH,45 8B A6 54 02 00 00 44 8B F8 44 2B FB 44 2B E3 48 8B 0D ?? ?? ??)
assert(MOPF,48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58 8B 40 20 48 83 C4 40 5F C3)
//assert(MORC,FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10 44 39 73 18 77 ?? 44 88)
//assert(MRC2,FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08 48 83 C3 10 48 39 FB 75 ??)
assert(GMTB,48 8B 81 80 00 00 00 4C 8B F2 48 8B F1 80 B8 88 01 00 00 00 ?? ??)
assert(MOPA,F3 41 0F 10 48 18 0F 57 C0 0F 2F C8 76 ?? F3 0F 58 0D ?? ?? ?? ??)

//assert(MSU2,48 8b 4e 10 83 79 28 00 7c 03 ff 4e 30 0f 57 ff 48 85 db ?? ?? 80) //??
//assert(MSPS,48 85 c0 74 0b 8b 50 08 48 8b c8 e8 ?? ?? ?? ?? 48 8b 5c 24 30 48) //??

//=========================================
alloc(MyCode,8000,$process)
//=========================================
alloc(SMSCD,18,$process)
registersymbol(SMSCD)
SMSCD:
readmem(MSCD,18)
//=========================================
alloc(SMSC2,18,$process)
registersymbol(SMSC2)
SMSC2:
readmem(MSC2,18)
//=========================================
alloc(SMOTR,12,$process)
registersymbol(SMOTR)
SMOTR:
readmem(MOTR,12)
//=========================================
alloc(SMSPS,16,$process)
registersymbol(SMSPS)
SMSPS:
readmem(MSPS,16)
//=========================================
// Declaration section
label(_GodMode)
label(_BackGMD)
label(_MonTroopAmmo)
label(_BackMTA)
label(_GodMode2)
label(_BackGM2)
label(_MonTroopUnits)
label(_BackMTU)
label(_MonWindsOfMagic)
label(_BackMWM)
label(_MonSpellUse)
label(_BackMSU)
label(_MonSpellCooldown)
label(_BackMSC)
label(_MonSpellUse2)
label(_BackSU2)
label(_MonSpellCooldown2)
label(_BackSC2)
label(_MonUnitStress)
label(_BackMUS)

label(_MonHumanPlayer)
label(_BackMHP)
label(_MonActionPoints)
//label(_BackMAP)
label(_MonActionPoints2)
label(_BackAP2)
label(_MonActionPoints3)
label(_BackAP3)
label(_MonActionPoints4)
//label(_BackAP4)
label(_MonResearchProg)
label(_BackMRP)
label(_MonTroopRecruit)
label(_BackMTR)
label(_MonConstProg)
label(_BackMCP)
label(_MonPublicOrder)
//label(_BackMPO)
label(_MonPopSurplus)
label(_BackMPS)
label(_MonPopSurplus2)
label(_BackPS2)
label(_MonSelHero)
label(_BackMSH)
label(_MonPlayerFood)
label(_BackMPF)
label(_MonRitesCD)
//label(_BackMRC)
label(_MonRitesCD2)
//label(_BackRC2)
label(_GodModeTBS)
label(_BackGMT)
label(_MonPlayerAmber)
label(_BackMPA)
label(_MonSlavesPerSettlement)
label(_BackMSS)

label(iEnableGMD)
label(iEnableMTA)
label(iEnableMTL)
label(iEnableMWM)
label(iEnableMMT)
label(iEnableMAP)
label(iEnableMTS)
label(iEnableMRP)
label(iEnableMTR)
label(iEnableMCP)
label(iEnableMPO)
label(iEnableMPS)
label(iEnableMXP)
label(iEnableHAA)
label(iEnableMPI)
label(iEnableMPF)
label(iEnableMRC)
label(iEnableGMT)
label(iEnableMTX)
label(iEnablePAE)
label(iEnablePAS)
label(iEnableMSU)
label(iEnableMSC)
label(iEnableMSS)
label(iEnableMUS)
label(iEnableSSR)
label(iEnableLSR)
label(iEnableMOO)
label(iEnableSCR)
label(iEnableDRE)

label(pPlayer)
label(pLord)
label(pHero)
label(pUnit)
label(pDebug)
label(pCommon)
label(pFood)
label(lRBX)
label(aLast)

//=========================================
// Registering Symbols
registersymbol(MyCode)
registersymbol(iEnableGMD)
registersymbol(iEnableMTA)
registersymbol(iEnableMTL)
registersymbol(iEnableMWM)
registersymbol(iEnableMMT)
registersymbol(iEnableMAP)
registersymbol(iEnableMTS)
registersymbol(iEnableMRP)
registersymbol(iEnableMTR)
registersymbol(iEnableMCP)
registersymbol(iEnableMPO)
registersymbol(iEnableMPS)
registersymbol(iEnableMXP)
registersymbol(iEnableHAA)
registersymbol(iEnableMPI)
registersymbol(iEnableMPF)
registersymbol(iEnableMRC)
registersymbol(iEnableGMT)
registersymbol(iEnableMTX)
registersymbol(iEnablePAE)
registersymbol(iEnablePAS)
registersymbol(iEnableMSU)
registersymbol(iEnableMSC)
registersymbol(iEnableMSS)
registersymbol(iEnableMUS)
registersymbol(iEnableSSR)
registersymbol(iEnableLSR)
registersymbol(iEnableMOO)
registersymbol(iEnableSCR)
registersymbol(iEnableDRE)

registersymbol(pPlayer)
registersymbol(pLord)
registersymbol(pHero)
registersymbol(pUnit)
registersymbol(pDebug)
registersymbol(pCommon)
registersymbol(pFood)
registersymbol(aLast)

//=========================================
MyCode:
//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop/Hero)
// RAX is safe
_GodMode:
 mov dword ptr [aLast],'_GMD'

 mov rax,_BackGMD
 mov [pBack+00],rax

 mov [pDebug],rbx

 cmp dword ptr [iEnableGMD],0
 je _ExitGMD                       // Jump if feature is disabled

 lea rax,[rcx-00000B0C]
 cmp rax,rbx
 jne _ExitGMD

 mov rax,[rbx+000002E8]
 test rax,rax
 jz _ExitGMD

 cmp byte ptr [rax+00003B60],00
 jne _ExitGMD

 mov eax,[rcx]
 mov [rcx+04],eax

 xor edx,edx

_ExitGMD:
 mov r8d,[rcx+04]                  // Original code
 xor r9d,r9d                       // Original code
 sub r8d,edx                       // Original code
 cmp edx,[rcx+04]                  // Original code
 cmova r8d,r9d                     // Original code

 jmp [pBack+00]                    // Back to main code

//========================================= LJ 1120 #
// RTS - After decreasing Ammo
_MonTroopAmmo:
 mov dword ptr [aLast],'_MTA'

 mov rcx,_BackMTA
 mov [pBack+08],rcx

 mov ecx,r8d                       // recover ECX

 test r8d,r8d                      // Original code
 jz _MonTA00

 cmp dword ptr [iEnableMTA],0
 je _ExitMTA                       // Jump if feature is disabled

 cmp byte ptr [rdi+00003B60],00
 jne _ExitMTA

 inc ecx
 mov r8d,ecx

_ExitMTA:
 lea ecx,[r8-01]                   // Original code
 mov [rax+rdi],ecx                 // Original code

_MonTA00:
 jmp [pBack+08]                    // Back to main code

//========================================= LJ 1120 #
// RTS - During Combat (HP)(Troop)
// RAX is safe
_GodMode2:
 mov dword ptr [aLast],'_GM2'

 mov rax,_BackGM2
 mov [pBack+10],rax

 cmp dword ptr [iEnableGMD],0
 je _ExitGM2                       // Jump if feature is disabled

 mov rax,[rcx+000002E8]
 test rax,rax
 jz _ExitGM2

 cmp byte ptr [rax+00003B60],00
 jne _ExitGM2

 mov eax,[rcx+00000B0C]
 mov [rcx+00000B10],eax

 ret
//==
_ExitGM2:
 push rbp                          // Original code
 push rsi                          // Original code
 push r12                          // Original code
 push r14                          // Original code
 lea rbp,[rsp-28]                  // Original code

 jmp [pBack+10]                    // Back to main code

//========================================= LJ 1120 #
// RTS - All the time during battle
_MonTroopUnits:
 mov dword ptr [aLast],'_MTU'

 mov rcx,_BackMTU
 mov [pBack+18],rcx

 push rax
 push rbx
 push rdx

 mov rdx,rax

 mov rcx,[rdx+000002E8]
 test rcx,rcx
 jz _ExitMTU

 cmp dword ptr [rcx+70],55555555

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMTU

 mov rax,[rcx+70]
 mov [pCommon],rax

 cmp dword ptr [iEnableGMD],0
 je _MonTU00                       // Jump if feature is disabled

 mov eax,#110
 mov ebx,[rcx+000037AC]
 cmp ebx,eax
 cmovs ebx,eax
 mov [rcx+000037AC],ebx

 mov [rcx+000039E8],ebx
 mov [rcx+000039EC],ebx

_MonTU00:
 cmp dword ptr [iEnableGMD],0
 je _ExitMTU                       // Jump if feature is disabled

 cmp dword ptr [rdx+00000B10],0
 je _ExitMTU

 mov eax,#671000
 mov [rdx+00000B0C],eax
 mov [rdx+00000B10],eax

_ExitMTU:
 pop rdx
 pop rbx
 pop rax

 movss [rbp+000000A0],xmm0         // Original code
 mov rcx,[rax+000002E8]            // Original code (get pTroop)

 jmp [pBack+18]                    // Back to main code

//========================================= LJ 190 *
// RTS - When increasing value
// RCX is safe
_MonWindsOfMagic:
 mov dword ptr [aLast],'_MWM'

 mov rcx,_BackMWM
 mov [pBack+20],rcx

 addss xmm0,[rdi+08]               // Original code (inc cWoM)

 cmp dword ptr [iEnableMWM],0
 je _ExitMWM                       // Jump if feature is disabled

 mov rcx,[rdi]
 cmp rcx,[pCommon]
 jne _ExitMWM

 movss xmm0,xmm1

_ExitMWM:
 comiss xmm0,xmm1                  // Original code
 movss [rdi+08],xmm0               // Original code

 jmp [pBack+20]                    // Back to main code

//========================================= LJ 1110 P
// RTS - when activating a spell (troop)
_MonSpellUse:
 mov dword ptr [aLast],'_MSU'

 mov rax,_BackMSU
 mov [pBack+28],rax

 test rbp,rbp
 jz _ExitMSU

 mov rax,[rsi+10]
 cmp dword ptr [rax+28],00
 jle _ExitMSU

 cmp dword ptr [iEnableMSU],0
 je _ExitMSU                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B68],00    // s7.2 #
 jne _ExitMSU

 cmp dword ptr [rsi+30],01
 js _ExitMSU

 inc dword ptr [rsi+30]

_ExitMSU:
 mov rax,[rsi+10]                  // Original code
 cmp dword ptr [rax+28],00         // Original code
 jl _EMSU00

 dec [rsi+30]                      // Original code

_EMSU00:
 jmp [pBack+28]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (troop)
// RAX if safe
_MonSpellCooldown:
 mov dword ptr [aLast],'_MSC'

 mov rdx,_BackMSC
 mov [pBack+30],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+00003B90]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitMSC                       // Jump if feature is disabled

 cmp byte ptr [rbp+00003B60],00
 jne _ExitMSC

 mov ebx,[rsi+1C]

 sub ebx,eax

 cmp ebx,#50
 js _MonSC00

 mov ebx,#50

_MonSC00:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitMSC:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+30]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when activating a spell (army)
_MonSpellUse2:
 mov dword ptr [aLast],'_SU2'

 mov rax,_BackSU2
 mov [pBack+38],rax

 cmp rbp,[pCommon]
 jne _ExitSU2

 mov rax,[rcx+08]
 cmp dword ptr [rax+2C],00
 jle _ExitSU2

 cmp dword ptr [iEnableMSU],0
 je _ExitSU2                       // Jump if feature is disabled

 cmp dword ptr [rax+2C],01
 js _ExitSU2

 inc dword ptr [rax+2C]

_ExitSU2:
 mov rax,[rcx+08]                  // Original code
 cmp dword ptr [rax+2C],00         // Original code
 jl _ESU200                        // Original code

 dec dword ptr [rax+2C]            // Original code

_ESU200:
 jmp [pBack+38]                    // Back to main code

//========================================= LJ 1120 *
// RTS - when a spell cooling down (army)
_MonSpellCooldown2:
 mov dword ptr [aLast],'_SC2'

 mov rdx,_BackSC2
 mov [pBack+40],rdx

 mov [pRBX],rbx

 mov rdx,[rbp+000002E0]            // Original code
 mov rcx,rsi                       // Original code
 mov rax,CSCD
 call rax                          // Original code

 cmp dword ptr [iEnableMSC],0
 je _ExitSC2                       // Jump if feature is disabled

 cmp rbp,[pCommon]
 jne _ExitSC2

 mov ebx,[rsi+1C]
 sub ebx,eax

 cmp ebx,#50
 js _MonSC20

 mov ebx,#50

_MonSC20:
 add ebx,eax
 mov [rsi+1C],ebx

_ExitSC2:
 mov rbx,[pRBX]

 sub [rsi+1C],eax                  // Original code

 jmp [pBack+40]                    // Back to main code

//========================================= LJ 1120 # (Chariots)
// RTS - All the time during battle
// RCX is safe
_MonUnitStress:
 mov dword ptr [aLast],'_MUS'

 mov rcx,_BackMUS
 mov [pBack+48],rcx

 add eax,ebx                       // Original code
 mov rbx,[rsp+78]                  // Original code

 mov rcx,[rdi+000002E8]
 test rcx,rcx
 jz _ExitMUS

 cmp byte ptr [rcx+00003B60],00
 jne _ExitMUS

 cmp dword ptr [iEnableGMD],0
 je _MonUS00                       // Jump if feature is disabled

 cmp dword ptr [rdi+00000B10],0
 je _MonUS00

 mov ecx,#671000
 mov [rdi+00000B0C],ecx
 mov [rdi+00000B10],ecx

_MonUS00:
 cmp dword ptr [iEnableMUS],0
 je _ExitMUS                       // Jump if feature is disabled

 mov [rdi+000006EC],00

 test eax,eax
 js _ExitMUS

 mov eax,#-100

_ExitMUS:
 add [rdi+000006EC],eax            // Original code (upd Stress)

 jmp [pBack+48]                    // Back to main code

//========================================= ok
//------------------------------TBS --------------------------------------
//========================================= LJ 1120 #
// TBS - All the time at main game screen
_MonHumanPlayer:
 mov dword ptr [aLast],'_MHP'

 mov rcx,_BackMHP
 mov [pBack+50],rcx

 mov rcx,[rdx+00000188]            // Original code (get pPlayer)

 mov [pPlayer],rcx
 mov rax,[rcx+00000C20]
 mov [pWay],rax
 mov rax,[rcx+00001D90]
 mov [pRites],rax

 cmp dword ptr [iEnableMMT],0
 je _MonHP00                       // Jump if feature is disabled

 mov eax,ctMMON
 cmp [rcx+00000BF0],eax
 jns _MonHP00

 mov [rcx+00000BF0],eax

_MonHP00:
 cmp dword ptr [iEnableMPI],0
 je _ExitMHP                       // Jump if feature is disabled

 cmp [rcx+00000ED0],0
 je _ExitMHP

 mov eax,ctMINF
 cmp [rcx+00000ED0],eax
 jns _ExitMHP

 mov [rcx+00000ED0],eax

_ExitMHP:
 add rcx,000002D0                  // Original code

 jmp [pBack+50]                    // Back to main code

//========================================= LJ 190 *
// TBS - WHen troop is moving (MP, TS, HHP)
// RAX is safe
_MonActionPoints:
 mov dword ptr [aLast],'_MAP'

 //mov rax,_BackMAP
 mov [pBack+58],rax

 mov rax,[rcx+78]
 cmp rax,[pPlayer]
 jne _ExitMAP

 cmp dword ptr [iEnableMAP],0
 je _MonAP00                       // Jump if feature is disabled

 xor edx,edx

_MonAP00:
 cmp dword ptr [iEnableMTS],0
 je _ExitMAP                       // Jump if feature is disabled

 mov eax,[rcx+0000008c]
 mov [rcx+00000088],eax

_ExitMAP:
 mov r8d,[rcx+000000A8]            // Original code (get AP)
 xor eax,eax                       // Original code
 mov r9d,r8d                       // Original code
 sub r9d,edx                       // Original code

 jmp [pBack+58]                    // Back to main code

//========================================= LJ 1110 *
// TBS - When Army is selected (MP, TS, HHP)
_MonActionPoints2:
 mov dword ptr [aLast],'_MA2'

 mov rax,_BackAP2
 mov [pBack+60],rax

 mov rax,[r14+78]
 cmp rax,[pPlayer]
 jne _ExitAP2

 cmp dword ptr [r14+000001b0],0
 je _MonAP2Z

 mov [pLord],r14

_MonAP2Z:
 cmp dword ptr [iEnableMAP],0
 je _MonAP20                       // Jump if feature is disabled

 mov eax,#3661
 cmp eax,[r14+000000A8]
 js _MonAP20

 mov [r14+000000A8],eax

_MonAP20:
 cmp dword ptr [iEnableMTS],0
 je _ExitAP2                       // Jump if feature is disabled

 mov eax,[r14+0000008C]
 mov [r14+00000088],eax

_ExitAP2:
 mov eax,[r14+000000A8]            // Original code (get AP)
 mov [r15+000000EC],eax            // Original code

 jmp [pBack+60]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Hero is moving
// RAX is safe
_MonActionPoints3:
 mov dword ptr [aLast],'_MA3'

 mov rax,_BackAP3
 mov [pBack+68],rax

 cmp dword ptr [iEnableMAP],0
 je _ExitAP3                       // Jump if feature is disabled

 mov rax,[rcx+00000360]
 test rax,rax
 jz _ExitAP3

 mov rax,[rax+10]
 cmp rax,[pPlayer]
 jne _ExitAP3

 mov eax,[rcx+28]
 mov [rcx+2c],eax

 xor edx,edx

 mov [rcx+30],edx

_ExitAP3:
 mov r9d,[rcx+2C]                  // Original code (get AP)
 xor r8d,r8d                       // Original code
 mov eax,r9d                       // Original code
 sub eax,edx                       // Original code

 jmp [pBack+68]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When Lord is moving (in the army)
// RDI is safe
_MonActionPoints4:
 mov dword ptr [aLast],'_MA4'

 //mov rdi,_BackAP4
 mov [pBack+70],rdi

 mov rdi,[rbx+00000360]
 test rdi,rdi
 jz _ExitAP4

 mov rdi,[rdi+10]
 cmp rdi,[pPlayer]
 jne _ExitAP4

 mov [pHero],rbx                   // It is, in fact, a Lord

 cmp dword ptr [iEnableMAP],0
 je _ExitAP4                       // Jump if feature is disabled

 mov eax,[rbx+28]

 xor rsi,rsi
 mov [rbx+30],esi

_ExitAP4:
 sub esi,eax                       // Original code
 mov [rbx+2C],eax                  // Original code (upd AP)
 cmovs esi,ebp                     // Original code
 mov rbp,[rsp+30]                  // Original code

 jmp [pBack+70]                    // Back to main code

//========================================= LJ 1120 *
// TBS - During Turn Changing
// RAX is safe
_MonResearchProg:
 mov dword ptr [aLast],'_MRP'

 mov rax,_BackMRP
 mov [pBack+78],rax

 mov r9d,[rdx+0C]                  // Original code
 add r9d,r8d                       // Original code

 cmp dword ptr [iEnableMRP],0
 je _ExitMRP                       // Jump if feature is disabled

 mov rax,[rsi+20]
 cmp rax,[pPlayer]
 jne _ExitMRP

 mov r9d,[rcx+5C]

_ExitMRP:
 cmp r9d,[rcx+5C]                  // Original code (chk if finished)
 mov rcx,rsi                       // Original code

 jmp [pBack+78]                    // Back to main code

//========================================= LJ 190 *
// TBS - When looking at the Army (When recruiting)
// RAX is safe
_MonTroopRecruit:
 mov dword ptr [aLast],'_MTR'

 mov rax,_BackMTR
 mov [pBack+80],rax

 mov rax,COTR
 call rax                          // Original code

 test eax,eax                      // Original code
 js _EMTR00

 push rcx

 cmp dword ptr [iEnableMTR],0
 je _ExitMTR                       // Jump if feature is disabled

 mov rcx,[rbx+38]
 test rcx,rcx
 jz _ExitMTR

 mov rcx,[rcx+70]
 cmp rcx,[pPlayer]
 jne _ExitMTR

 mov dword ptr [rbx+50],0

_ExitMTR:
 pop rcx

 add eax,[rbx+50]                  // Original code (get #turns)

 jmp [pBack+80]                    // Back to main code

_EMTR00:
 mov rbx,JOTR
 jmp rbx

//========================================= LJ 1120 #
// TBS - During Turn Changing
_MonConstProg:
 mov dword ptr [aLast],'_MCP'

 mov rax,_BackMCP
 mov [pBack+88],rax

 inc [rcx+0C]                      // Original code (upd prog)

 cmp dword ptr [rcx+10],1
 je _ExitMCP

 cmp dword ptr [iEnableMCP],0
 je _ExitMCP                       // Jump if feature is disabled

 cmp r14,[pPlayer]
 jne _ExitMCP

 mov eax,[rcx+10]
 mov [rcx+0C],eax

_ExitMCP:
 mov eax,[rcx+0C]                  // Original code
 cmp eax,[rcx+10]                  // Original code
 setae al                          // Original code

 jmp [pBack+88]                    // Back to main code

//========================================= LJ 190 X
// TBS - During Turn Changing
_MonPublicOrder:
 mov dword ptr [aLast],'_MPO'

 //mov rcx,_BackMPO
 mov [pBack+90],rcx

 cmp dword ptr [iEnableMPO],0
 je _ExitMPO                       // Jump if feature is disabled

 cmp r15,[pPlayer]
 jne _ExitMPO
{
 xor edx,edx

 mov ebx,[r14+30]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+30],ebx
 mov ebx,[r14+34]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+34],ebx
 mov ebx,[r14+38]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+38],ebx
 mov ebx,[r14+3c]
 test ebx,ebx
 cmovs ebx,edx
 mov [r14+3c],ebx
}

 mov ecx,[r14+3C]
 add ecx,eax
 cmp ecx,#68
 jns _ExitMPO

 mov ecx,[r14+3C]
 mov eax,#68
 sub eax,ecx                       // Val to be added

_ExitMPO:
 mov ecx,[r14+3C]                  // Original code
 mov [rbx+0C],ecx                  // Original code (upd PO)
 cmp dword ptr [r14+4C],01         // Original code

 jmp [pBack+90]                    // Back to main code

//========================================= LJ 1120 #
// TBS - When looking at the Province
_MonPopSurplus:
 mov dword ptr [aLast],'_MPS'

 mov rsi,_BackMPS
 mov [pBack+98],rsi

 cmp dword ptr [iEnableMPS],0
 je _ExitMPS                       // Jump if feature is disabled

 mov rsi,[rdx+000000d0]
 test rsi,rsi
 jz _ExitMPS

 mov rsi,[rsi+10]
 cmp rsi,[pPlayer]
 jne _ExitMPS

 mov esi,#30

 cmp esi,[rdx+00000388]
 js _ExitMPS

 mov [rdx+00000388],esi

_ExitMPS:
 mov r15d,[rdx+0000038C]           // Original code (Get Growth)
 lea rsi,[rdx+00000380]            // Original code

 jmp [pBack+98]                    // Back to main code

//========================================= LJ 190 *
// TBS - On ARK selection
_MonPopSurplus2:
 mov dword ptr [aLast],'_PS2'

 mov rcx,_BackPS2
 mov [pBack+00A0],rcx

 cmp dword ptr [iEnableMPS],0
 je _ExitPS2                       // Jump if feature is disabled

 mov rcx,[rax+00000140]
 test rcx,rcx
 jz _ExitPS2

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitPS2

 mov rcx,[rax+00000618]
 mov rcx,[rcx+18]

 cmp dword ptr [rcx+08],#32
 jns _ExitPS2

 mov dword ptr [rcx+08],#32

_ExitPS2:
 mov rcx,[rax+00000618]            // Original code (Get ppPopSp)
 mov rax,[rcx+18]                  // Original code
 mov eax,[rax+08]                  // Original code

 jmp [pBack+00A0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - When a hero/Lord is selected
// RCX is safe
_MonSelHero:
 mov dword ptr [aLast],'_MSH'

 mov r15,_BackMSH
 mov [pBack+00A8],r15

 mov r12,[r14]
 test r12,r12
 jz _ExitMSH

 mov [pHero],r12

 mov rcx,[r12+00000360]
 test rcx,rcx
 jz _ExitMSH

 mov rcx,[rcx+10]
 cmp rcx,[pPlayer]
 jne _ExitMSH

 cmp dword ptr [iEnableMAP],0
 je _MonSH00                       // Jump if feature is disabled

 mov esi,[r12+28]
 mov [r12+2c],esi

_MonSH00:
 cmp dword ptr [iEnableHAA],0
 je _MonSH01                       // Jump if feature is disabled

 mov byte ptr [r12+00000940],00    // (s3.0)
 mov byte ptr [r12+00000948],00

 mov byte ptr [r12+00000E28],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E29],00    // SearchedTreasure (s6.1)
 mov byte ptr [r12+00000E2A],00    // SearchedTreasure (s6.1)

_MonSH01:
 cmp dword ptr [iEnableMXP],0
 je _ExitMSH                       // Jump if feature is disabled

 lea rcx,[rax-64]
 cmp ecx,[r14+00000254]
 js _ExitMSH

 mov [r14+00000254],ecx

_ExitMSH:
 mov r12d,[r14+00000254]           // Original code (Get XP)
 mov r15d,eax                      // Original code
 sub r15d,ebx                      // Original code

 jmp [pBack+00A8]                  // Back to main code

//========================================= LJ 1110 *
// TBS - All the time at main game screen (Skaven/Lizards)
_MonPlayerFood:
 mov dword ptr [aLast],'_MPF'

 mov rax,_BackMPF
 mov [pBack+00B0],rax

 mov rax,[rdi+08]                  // Original code

 mov rbx,[rax+08]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+18]
 cmp rbx,[pPlayer]
 jne _ExitMPF

 mov rbx,[rax]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx]
 test rbx,rbx
 jz _ExitMPF

 mov rbx,[rbx+08]
 test rbx,rbx
 jz _ExitMPF

 mov ebx,[rbx+04]
 cmp ebx,'en_f'
 jne _MonPF00

 mov [pFood],rax

 cmp dword ptr [iEnableMPF],0
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMFOO
 jmp _MonPF0X
//--
_MonPF00:
 cmp ebx,'reac'
 je _MonPF01

 cmp ebx,'nuke'
 jne _MonPF02

_MonPF01:
 cmp dword ptr [iEnableSSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMSSR
 jmp _MonPF0X
//--
_MonPF02:
 cmp ebx,'sacr'
 jne _MonPF03

 cmp dword ptr [iEnableLSR],0      // s6.5
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,ctMLSR
 jmp _MonPF0X
//--
_MonPF03:
 cmp ebx,'old_'
 jne _MonPF04

 cmp dword ptr [iEnableMOO],0      // s7.1
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF04:
 cmp ebx,'salv'
 jne _MonPF05

 cmp dword ptr [iEnableSCR],0      // s7.9 (Scrap)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#700
 jmp _MonPF0X
//--
_MonPF05:
 cmp ebx,'drea'
 jne _MonPF06

 cmp dword ptr [iEnableDRE],0      // s7.19 (Dread)
 je _ExitMPF                       // Jump if feature is disabled

 mov ebx,#3700
 jmp _MonPF0X
//--
_MonPF06:
 jmp _ExitMPF
//--
_MonPF0X:
 cmp [rax+20],ebx
 jns _ExitMPF

 mov [rax+20],ebx

_ExitMPF:
 mov rbx,[rsp+50]                  // Original code
 mov rsi,[rsp+58]                  // Original code

 jmp [pBack+00B0]                  // Back to main code

//========================================= LJ 1104 *
// TBS - During turn changing
_MonRitesCD:
 mov dword ptr [aLast],'_MRC'

// mov rax,_BackMRC
 mov [pBack+00B8],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,r8d                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitMRC

 cmp dword ptr [iEnableMRC],0
 je _ExitMRC                       // Jump if feature is disabled

 test eax,eax
 js _ExitMRC

 xor eax,eax

_ExitMRC:
 mov [rbx+10],eax                  // Original code

 jmp [pBack+00B8]                  // Back to main code

//========================================= LJ 1111 *
// TBS - During turn changing
_MonRitesCD2:
 mov dword ptr [aLast],'_RC2'

// mov rax,_BackRC2
 mov [pBack+00C0],rax

 dec ecx                           // Original code
 mov eax,r15d                      // Original code
 add ecx,edx                       // Original code
 cmovns eax,ecx                    // Original code

 cmp rbp,[pRites]
 jne _ExitRC2

 cmp dword ptr [iEnableMRC],0
 je _ExitRC2                       // Jump if feature is disabled

 test eax,eax
 js _ExitRC2

 xor eax,eax

_ExitRC2:
 mov [rbx+08],eax                  // Original code

 jmp [pBack+00C0]                  // Back to main code

//========================================= LJ 1120 *
// TBS - God Mode for Autobattle and Troop XP
_GodModeTBS:
 mov r14,_BackGMT
 mov [pBack+00C8],r14

 cmp dword ptr [iEnableGMT],0
 je _GodMT01                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 je _GodMT00

// mov dword ptr [rdx+58],00
// mov dword ptr [rdx+6c],00
// mov dword ptr [rdx+000000A4],00
 jmp _ExitGMT
//--
_GodMT00:
 mov r14d,[rdx+50]
 mov [rdx+58],r14d

 mov r14d,[rdx+64]
 mov [rdx+6c],r14d

 mov byte ptr [rdx+7C],01
 mov byte ptr [rdx+7E],00

_GodMT01:
 cmp dword ptr [iEnableMTX],0
 je _ExitGMT                       // Jump if feature is disabled

 mov r14,[rcx+78]
 cmp r14,[pPlayer]
 jne _ExitGMT

 cmp dword ptr [rdx+0000009C],00
 je _ExitGMT

 cmp byte ptr [rcx+000000C8],09
 jns _ExitGMT

 mov r14d,#30000
 cmp [rdx+0000009C],r14d
 jns _ExitGMT

 mov [rdx+0000009C],r14d

_ExitGMT:
 mov rax,[rcx+00000080]            // Original code
 mov r14,rdx                       // Original code
 mov rsi,rcx                       // Original code

 jmp [pBack+00C8]                  // Back to main code

//========================================= LJ 190 X
// TBS - Keep human player's AMBER at minimum (per Settlement / per Event)
// RAX is safe
_MonPlayerAmber:
 mov dword ptr [aLast],'_MPA'

 mov rax,_BackMPA
 mov [pBack+00D0],rax

 mov ax,[r8+08]
 cmp ax,00eb
 je _MonPA00

 cmp ax,00ec
 jne _ExitMPA

 mov rax,RPAE
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAE],0
 je _ExitMPA                       // Jump if feature is disabled

// mov rax,[rbp+60]
// test rax,rax
// jz _ExitMPA

// mov rax,[rax+00000188]

 mov eax,[r8+18]           // for debugging

 cmp rbx,[pPlayer]         // [RSP+18]=Player as well
 jne _ExitMPA

 mov eax,ctMAPE
 jmp _MonPA01
//==
_MonPA00:
 mov rax,RPAS
 cmp rax,[esp]
 jne _ExitMPA

 cmp dword ptr [iEnablePAS],0
 je _ExitMPA                       // Jump if feature is disabled

 mov rax,[rbp+60]
 test rax,rax
 jz _ExitMPA

 mov rax,[rax+00000188]
 cmp rax,[pPlayer]
 jne _ExitMPA

 mov eax,ctMAPS

_MonPA01:
 cmp [r8+18],eax
 jns _ExitMPA

 mov [r8+18],eax
 mov [r8+1c],eax

_ExitMPA:
 movss xmm1,[r8+18]                // Original code (get value)
 xorps xmm0,xmm0                   // Original code
 comiss xmm1,xmm0                  // Original code

 jmp [pBack+00D0]                  // Back to main code

//========================================= LJ ok
// TBS - Keep human player's Slaves per Settlement at minimum (for Dark Elves)
_MonSlavesPerSettlement:
 mov dword ptr [aLast],'_MSS'

 mov rdx,_BackMSS
 mov [pBack+00D8],rdx

 test rax,rax                      // Original code
 je _EMSS00                        // Original code

 movsd [qXMM0],xmm0
 movsd [qXMM1],xmm1

 cmp r15,[pPlayer]
 jne _ExitMSS

 cmp dword ptr [iEnableMSS],0
 je _ExitMSS                       // Jump if feature is disabled

 movsd xmm0,[qMinimum]
 cvtsi2sd xmm1,[rax+0c]
 mulsd xmm0,xmm1
 cvtsi2sd xmm1,[rax+08]
 maxsd xmm0,xmm1
 cvtsd2si ecx,xmm0
 mov [rax+08],ecx

_ExitMSS:
 movsd xmm0,[qXMM0]
 movsd xmm1,[qXMM1]

 mov edx,[rax+08]                  // Original code (get value)
 mov rcx,rax                       // Original code
 mov rbx,CSPS                      // RBX is safe
 call rbx                          // Original code

_EMSS00:
 jmp [pBack+00D8]                  // Back to main code

qMinimum:
 dq (double)0.20

//=========================================
align 10,'='
//=========================================
 db '===============================>'
 db 'CE7.4 Script by Recifense 220502'
//=========================================
// Variables
iEnableGMD:
 dq 0
iEnableMTA:
 dq 0
iEnableMTL:
 dq 0
iEnableMWM:
 dq 0
iEnableMMT:
 dq 0
iEnableMAP:
 dq 0
iEnableMTS:
 dq 0
iEnableMRP:
 dq 0
iEnableMTR:
 dq 0
iEnableMCP:
 dq 0
iEnableMPO:
 dq 0
iEnableMPS:
 dq 0
iEnableMXP:
 dq 0
iEnableHAA:
 dq 0
iEnableMPI:
 dq 0
iEnableMPF:
 dq 0
iEnableMRC:
 dq 0
iEnableGMT:
 dq 0
iEnableMTX:
 dq 0
iEnablePAE:
 dq 0
iEnablePAS:
 dq 0
iEnableMSU:
 dq 0
iEnableMSC:
 dq 0
iEnableMSS:
 dq 0
iEnableMUS:
 dq 0
iEnableSSR:
 dq 0
iEnableLSR:
 dq 0
iEnableMOO:
 dq 0
iEnableSCR:
 dq 0
iEnableDRE:
 dq 0
pPlayer:
 dq MyCode
pWay:
 dq MyCode
pRites:
 dq MyCode
pFood:
 dq 0
pLord:
 dq 0
pHero:
 dq 0
pUnit:
 dq 0
pDebug:
 dq 0
pCommon:
 dq MyCode
lRBX:
 dq 0
qXMM0:
 dq 0
qXMM1:
 dq 0
pRBX:
 dq 0
pBack:
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
 dq 0,0,0,0,0,0,0,0
aLast:
 db 'CE70'
iSize:
 dd iSize-MyCode

//=========================================
// Hacking Points
GDMD:
 mov rax,_GodMode
 jmp rax
 nop
 nop
 nop
 nop
 nop
_BackGMD:

MOTA:
 mov rcx,_MonTroopAmmo
 jmp rcx
_BackMTA:

GDM2:
 mov rax,_GodMode2
 jmp rax
_BackGM2:

MOTU:
 mov rcx,_MonTroopUnits
 jmp rcx
 nop
 nop
 nop
_BackMTU:

MOWM:
 mov rcx,_MonWindsOfMagic
 jmp rcx
 nop
_BackMWM:

MOSU:
// mov rax,_MonSpellUse
// jmp rax
// nop
_BackMSU:

MSCD:
 mov rdx,_MonSpellCooldown
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop
_BackMSC:

MSU2:
 mov rax,_MonSpellUse2
 jmp rax
 nop
_BackSU2:

MSC2:
 mov rdx,_MonSpellCooldown2
 jmp rdx
 nop
 nop
 nop
 nop
 nop
 nop
_BackSC2:

MOUS:
 mov rcx,_MonUnitStress
 jmp rcx
 nop
_BackMUS:

// ---------------------- TBS
MOHP:
 mov rcx,_MonHumanPlayer
 jmp rcx
 nop
 nop
_BackMHP:

{MOAP:
 mov rax,_MonActionPoints
 jmp rax
 nop
 nop
 nop
_BackMAP:
}
MAP2:
 mov rax,_MonActionPoints2
 jmp rax
 nop
 nop
_BackAP2:

MAP3:
 mov rax,_MonActionPoints3
 jmp rax
_BackAP3:

{MAP4:
 mov rdi,_MonActionPoints4
 jmp rdi
 nop
_BackAP4:
}
MORP:
 mov rax,_MonResearchProg
 jmp rax
 nop
 nop
_BackMRP:

MOTR:
 mov rax,_MonTroopRecruit
 jmp rax
_BackMTR:

MOCP:
 mov rax,_MonConstProg
 jmp rax
_BackMCP:
{
MOPO:
 mov rcx,_MonPublicOrder
 jmp rcx
_BackMPO:
}
MOPS:
 mov rsi,_MonPopSurplus
 jmp rsi
 nop
 nop
_BackMPS:

MPS2:
 mov rcx,_MonPopSurplus2
 jmp rcx
 nop
 nop
_BackPS2:

MOSH:
 mov r15,_MonSelHero
 jmp r15
_BackMSH:

MOPF:
 mov rax,_MonPlayerFood
 jmp rax
 nop
 nop
_BackMPF:
{
MORC:
 mov rax,_MonRitesCD
 jmp rax
 nop
 nop
_BackMRC:

MRC2:
 mov rax,_MonRitesCD2
 jmp rax
 nop
_BackRC2:
}
GMTB:
 mov r14,_GodModeTBS
 jmp r14
_BackGMT:

MOPA:
 mov rax,_MonPlayerAmber
 jmp rax
_BackMPA:

MSPS:
{
 mov rdx,_MonSlavesPerSettlement
 jmp rdx
 nop
 nop
 nop
 nop
}
_BackMSS:

//=========================================
// Script for Restoring Original Codes
[DISABLE]
GDMD:
 db 44 8B 41 04 45 33 C9 44 2B C2 3B 51 04 45 0F 47 C1

MOTA:
 db 45 85 C0 74 07 41 8D 48 FF 89 0C 38

GDM2:
 db 40 55 56 41 54 41 56 48 8D 6C 24 D8

MOTU:
 db F3 0F 11 85 A0 00 00 00 48 8B 88 E8 02 00 00

MOWM:
 db F3 0F 58 47 08 0F 2F C1 F3 0F 11 47 08

//MOSU:
// db 48 8B 46 10 83 78 28 00 7C 03 FF 4E 30

MSCD:
readmem(SMSCD,18)

MSU2:
 db 48 8B 41 08 83 78 2C 00 7C 03 FF 49 2C

MSC2:
readmem(SMSC2,18)

MOUS:
 db 03 C3 48 8B 5C 24 78 01 87 EC 06 00 00

// ---------------------- TBS
MOHP:
 db 48 8b 8a 88 01 00 00 48 81 c1 d0 02 00 00

//MOAP:
 //db 44 8B 81 A8 00 00 00 31 C0 45 89 C1 41 29 D1

MAP2:
 db 41 8B 86 A8 00 00 00 41 89 87 EC 00 00 00

MAP3:
 db 44 8B 49 2C 45 33 C0 41 8B C1 2B C2

//MAP4:
 //db 29 C6 89 43 2C 0F 48 F5 48 8B 6C 24 30

MORP:
 db 44 8B 4A 0C 45 03 C8 44 3B 49 5C 48 8B CE

MOTR:
readmem(SMOTR,12)

MOCP:
 db FF 41 0C 8B 41 0C 3B 41 10 0F 93 C0

//MOPO:
 //db 41 8B 4E 3C 89 4B 0C 41 83 7E 4C 01

MOPS:
 db 44 8b ba 8c 03 00 00 48 8d b2 80 03 00 00

MPS2:
 db 48 8B 88 18 06 00 00 48 8B 41 18 8B 40 08

MOSH:
 db 45 8B A6 54 02 00 00 44 8B F8 44 2B FB

MOPF:
 db 48 8B 47 08 48 8B 5C 24 50 48 8B 74 24 58

//MORC:
 //db FF C9 44 89 F8 44 01 C1 0F 49 C1 89 43 10

//MRC2:
 //db FF C9 44 89 F8 01 D1 0F 49 C1 89 43 08

GMTB:
 db 48 8B 81 80 00 00 00 4C 8B F2 48 8B F1

MOPA:
 db F3 41 0F 10 48 18 0F 57 C0 0F 2F C8

//MSPS:
//readmem(SMSPS,16)

//=========================================
// Unregistering Symbols
unregistersymbol(MyCode)
unregistersymbol(iEnableGMD)
unregistersymbol(iEnableMTA)
unregistersymbol(iEnableMTL)
unregistersymbol(iEnableMWM)
unregistersymbol(iEnableMMT)
unregistersymbol(iEnableMAP)
unregistersymbol(iEnableMTS)
unregistersymbol(iEnableMRP)
unregistersymbol(iEnableMTR)
unregistersymbol(iEnableMCP)
unregistersymbol(iEnableMPO)
unregistersymbol(iEnableMPS)
unregistersymbol(iEnableMXP)
unregistersymbol(iEnableHAA)
unregistersymbol(iEnableMPI)
unregistersymbol(iEnableMPF)
unregistersymbol(iEnableMRC)
unregistersymbol(iEnableGMT)
unregistersymbol(iEnableMTX)
unregistersymbol(iEnablePAE)
unregistersymbol(iEnablePAS)
unregistersymbol(iEnableMSU)
unregistersymbol(iEnableMSC)
unregistersymbol(iEnableMSS)
unregistersymbol(iEnableMUS)
unregistersymbol(iEnableSSR)
unregistersymbol(iEnableLSR)
unregistersymbol(iEnableMOO)
unregistersymbol(iEnableSCR)
unregistersymbol(iEnableDRE)

unregistersymbol(pPlayer)
unregistersymbol(pLord)
unregistersymbol(pHero)
unregistersymbol(pUnit)
unregistersymbol(pDebug)
unregistersymbol(pCommon)
unregistersymbol(pFood)
unregistersymbol(aLast)

unregistersymbol(SMSCD)
unregistersymbol(SMSC2)
unregistersymbol(SMOTR)
unregistersymbol(SMSPS)

//=========================================
dealloc(MyCode)
dealloc(SMSCD)
dealloc(SMSC2)
dealloc(SMOTR)
dealloc(SMSPS)
//============= Scripts End ===============

// ****************************************
// NOTES
// ****************************************
{
}
this is more stable then the previous code, and note that the active chearts are only turn base cheat
can you put a link for the said table? thank you

yazz
Novice Cheater
Novice Cheater
Posts: 15
Joined: Fri Jul 22, 2022 7:32 pm
Reputation: 5

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by yazz »

here it is
Attachments
warhammer2 fix try -3.CT
(96.86 KiB) Downloaded 1191 times

blert29
What is cheating?
What is cheating?
Posts: 1
Joined: Tue Dec 20, 2022 2:38 am
Reputation: 0

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by blert29 »

the last post by yazz in october mostly works except for recruit in one turn, is there a workaround/fix for that?

pkrampage
What is cheating?
What is cheating?
Posts: 1
Joined: Sat Jan 07, 2023 2:34 pm
Reputation: 0

Re: Total War Warhammer 2 v1.12.1-20163 (GM and More) 2022-May-22

Post by pkrampage »

Any update for lastest patch?

Thx in advance.

Post Reply

Who is online

Users browsing this forum: admantx, alex185, apsakee, Bing [Bot], jonaaa, Majestic-12 [Bot], miruss89, Send