<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="42">
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"Compact Mode"</Description>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
--https://forum.cheatengine.org/viewtopic.php?t=570055
LuaCall(function cycleFullCompact(sender,force) local state = not(compactmenuitem.Caption == 'Compact View Mode'); if force~=nil then state = not force end; compactmenuitem.Caption = state and 'Compact View Mode' or 'Full View Mode'; getMainForm().Splitter1.Visible = state; getMainForm().Panel4.Visible    = state; getMainForm().Panel5.Visible    = state; end; function addCompactMenu() if compactmenualreadyexists then return end; local parent = getMainForm().Menu.Items; compactmenuitem = createMenuItem(parent); parent.add(compactmenuitem); compactmenuitem.Caption = 'Compact View Mode'; compactmenuitem.OnClick = cycleFullCompact; compactmenualreadyexists = 'yes'; end; addCompactMenu(); cycleFullCompact(nil,true))

[DISABLE]
LuaCall(cycleFullCompact(nil,false))

</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>1</ID>
      <Description>"Enable"</Description>
      <Options moHideChildren="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then
    return
end
if process == nil then
    ShowMessage("Process is not selected.")
elseif readInteger(process) == 0 then
    ShowMessage("Process cannot be opened.")
else
    if monopipe ~= nil and monopipe.ProcessID ~= getOpenedProcessID() then
        monopipe.destroy()
        monopipe = nil
    end
    if monopipe == nil then
        LaunchMonoDataCollector()
    end
end


{$asm}
define(ResourceManagerClearItemCountsProc, "ResourceManager.ClearItemCounts")
define(ResidenceUpdateFirewoodProc, "Residence.UpdateFirewood")
define(ResidenceUpdateWaterProc, "Residence.UpdateWater")
define(VillagerEatIfNecessaryProc, "Villager.EatIfNecessary")
define(ItemStorageRemoveItemsProc, "ItemStorage.RemoveItems")
define(Characterget_movementSpeedProc, "Character.get_movementSpeed")
define(ItemBundleUpdateNumberOfItemsProc, "ItemBundle.UpdateNumberOfItems")
define(ItemStorageUpdateItemInfoWithDegradeProc, "ItemStorage.UpdateItemInfoWithDegrade")
define(ReservableItemStorageGetItemCountOfAllUnneededItemsProc, "ReservableItemStorage.GetItemCountOfAllUnneededItems")

//Residence.UpdateFirewood   GameAssembly.dll+80E820
//GameAssembly.dll+80E9E4

//Residence.UpdateWater GameAssembly.dll+80EE42
//GameAssembly.dll+80EF60 (11E)

//Villager.EatIfNecessary
//GameAssembly.dll+5A64EF - 41 B8 01000000        - mov r8d,00000001

//Villager.CalculateToolWear   GameAssembly.dll+5A4CD0
//GameAssembly.dll+5A4E49


//ItemStorage.RemoveItems  GameAssembly.dll+938C74

registersymbol(ResourceManagerClearItemCountsProc)
registersymbol(ResidenceUpdateFirewoodProc)
registersymbol(ResidenceUpdateWaterProc)
registersymbol(VillagerEatIfNecessaryProc)
registersymbol(ItemStorageRemoveItemsProc)
registersymbol(Characterget_movementSpeedProc)
registersymbol(ItemBundleUpdateNumberOfItemsProc)
registersymbol(ItemStorageUpdateItemInfoWithDegradeProc)
registersymbol(ReservableItemStorageGetItemCountOfAllUnneededItemsProc)

[DISABLE]
{$lua}
if syntaxcheck then return end;if not syntaxcheck and monopipe then monopipe=nil,monopipe.Destroy()end

{$asm}
unregistersymbol(*)

</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>2</ID>
          <Description>"Enable twice: 1st: waiting for IL2CPP to complete, then re-enabling"</Description>
          <Color>8000FF</Color>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
        <CheatEntry>
          <ID>30</ID>
          <Description>"No residence consumes firewood"</Description>
          <Options moHideChildren="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-30
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

//aobscanmodule(INJECT_RESIDENCE_FIREWOOD_BURN_RATE,GameAssembly.dll,F3 0F 58 87 78 05 00 00) // should be unique
aobscanregion(INJECT_RESIDENCE_FIREWOOD_BURN_RATE,ResidenceUpdateFirewoodProc+280,ResidenceUpdateFirewoodProc+300,F3 0F 58 83 ?? ?? 00 00 F3 0F 11 83 ?? ?? 00 00 48 8B) // should be unique
alloc(newmem,$1000,INJECT_RESIDENCE_FIREWOOD_BURN_RATE)

alloc(INJECT_RESIDENCE_FIREWOOD_BURN_RATEo,8)

label(code)
label(return)


INJECT_RESIDENCE_FIREWOOD_BURN_RATEo:
  readmem(INJECT_RESIDENCE_FIREWOOD_BURN_RATE, 8)

newmem:


code:
  //addss xmm0,[rbx+00000590]
  jmp return

INJECT_RESIDENCE_FIREWOOD_BURN_RATE:
  jmp newmem
  nop 3
return:
registersymbol(INJECT_RESIDENCE_FIREWOOD_BURN_RATE)
registersymbol(INJECT_RESIDENCE_FIREWOOD_BURN_RATEo)

[DISABLE]

INJECT_RESIDENCE_FIREWOOD_BURN_RATE:
  //db F3 0F 10 83 94 05 00 00
  readmem(INJECT_RESIDENCE_FIREWOOD_BURN_RATEo, 8)

unregistersymbol(*)
unregistersymbol(INJECT_RESIDENCE_FIREWOOD_BURN_RATEo)
dealloc(newmem)
dealloc(INJECT_RESIDENCE_FIREWOOD_BURN_RATEo)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+BEE07F

GameAssembly.dll+BEE04D: 0F 28 74 24 50           - movaps xmm6,[rsp+50]
GameAssembly.dll+BEE052: 4C 8B 7C 24 60           - mov r15,[rsp+60]
GameAssembly.dll+BEE057: 48 8B BC 24 90 00 00 00  - mov rdi,[rsp+00000090]
GameAssembly.dll+BEE05F: 48 8B B4 24 88 00 00 00  - mov rsi,[rsp+00000088]
GameAssembly.dll+BEE067: 48 8B AC 24 80 00 00 00  - mov rbp,[rsp+00000080]
GameAssembly.dll+BEE06F: 48 83 C4 68              - add rsp,68
GameAssembly.dll+BEE073: 41 5E                    - pop r14
GameAssembly.dll+BEE075: 5B                       - pop rbx
GameAssembly.dll+BEE076: C3                       - ret
GameAssembly.dll+BEE077: F3 0F 10 83 94 05 00 00  - movss xmm0,[rbx+00000594]
// ---------- INJECTING HERE ----------
GameAssembly.dll+BEE07F: F3 0F 58 83 90 05 00 00  - addss xmm0,[rbx+00000590]
// ---------- DONE INJECTING  ----------
GameAssembly.dll+BEE087: F3 0F 11 83 94 05 00 00  - movss [rbx+00000594],xmm0
GameAssembly.dll+BEE08F: 48 8B 0D 12 21 DD 01     - mov rcx,[GameAssembly.dll+29C01A8]
GameAssembly.dll+BEE096: 44 39 B1 E0 00 00 00     - cmp [rcx+000000E0],r14d
GameAssembly.dll+BEE09D: 75 05                    - jne GameAssembly.dll+BEE0A4
GameAssembly.dll+BEE09F: E8 DC 56 6B FF           - call GameAssembly.dll+2A3780
GameAssembly.dll+BEE0A4: 44 38 35 39 FD F1 01     - cmp [GameAssembly.dll+2B0DDE4],r14l
GameAssembly.dll+BEE0AB: 75 13                    - jne GameAssembly.dll+BEE0C0
GameAssembly.dll+BEE0AD: 48 8D 0D F4 20 DD 01     - lea rcx,[GameAssembly.dll+29C01A8]
GameAssembly.dll+BEE0B4: E8 27 5F 66 FF           - call GameAssembly.mono_get_string_class+5710
GameAssembly.dll+BEE0B9: C6 05 24 FD F1 01 01     - mov byte ptr [GameAssembly.dll+2B0DDE4],01
}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>38</ID>
          <Description>"No residence consumes water "</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-05
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

//aobscanmodule(INJECT_RESIDENCE_WATER_USAGE_RATE,GameAssembly.dll,F3 0F 58 8F 80 05 00 00) // should be unique
aobscanmodule(INJECT_RESIDENCE_WATER_USAGE_RATE,GameAssembly.dll,F3 0F 58 8F ?? ?? 00 00 0F 2F 0D ?? ?? ?? ?? F3 0F 11 8F ?? ?? 00 00) // should be unique
alloc(newmem,$1000,INJECT_RESIDENCE_WATER_USAGE_RATE)

alloc(INJECT_RESIDENCE_WATER_USAGE_RATEo,8)

label(code)
label(return)


INJECT_RESIDENCE_WATER_USAGE_RATEo:
  readmem(INJECT_RESIDENCE_WATER_USAGE_RATE, 8)

newmem:

code:
  //addss xmm1,[rdi+00000598]
  jmp return

INJECT_RESIDENCE_WATER_USAGE_RATE:
  jmp newmem
  nop 3
return:
registersymbol(INJECT_RESIDENCE_WATER_USAGE_RATE)
registersymbol(INJECT_RESIDENCE_WATER_USAGE_RATEo)

[DISABLE]

INJECT_RESIDENCE_WATER_USAGE_RATE:
  //db F3 0F 58 8F 80 05 00 00
  readmem(INJECT_RESIDENCE_WATER_USAGE_RATEo, 8)

unregistersymbol(INJECT_RESIDENCE_WATER_USAGE_RATE)
unregistersymbol(INJECT_RESIDENCE_WATER_USAGE_RATEo)
dealloc(newmem)
dealloc(INJECT_RESIDENCE_WATER_USAGE_RATEo)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+BED845

GameAssembly.dll+BED815: 89 9F 9C 05 00 00        - mov [rdi+0000059C],ebx
GameAssembly.dll+BED81B: 4C 8B 7C 24 50           - mov r15,[rsp+50]
GameAssembly.dll+BED820: 4C 8B 74 24 58           - mov r14,[rsp+58]
GameAssembly.dll+BED825: 48 8B B4 24 80 00 00 00  - mov rsi,[rsp+00000080]
GameAssembly.dll+BED82D: 48 8B 6C 24 78           - mov rbp,[rsp+78]
GameAssembly.dll+BED832: 48 8B 5C 24 70           - mov rbx,[rsp+70]
GameAssembly.dll+BED837: 48 83 C4 60              - add rsp,60
GameAssembly.dll+BED83B: 5F                       - pop rdi
GameAssembly.dll+BED83C: C3                       - ret
GameAssembly.dll+BED83D: F3 0F 10 8F 9C 05 00 00  - movss xmm1,[rdi+0000059C]
// ---------- INJECTING HERE ----------
GameAssembly.dll+BED845: F3 0F 58 8F 98 05 00 00  - addss xmm1,[rdi+00000598]
// ---------- DONE INJECTING  ----------
GameAssembly.dll+BED84D: 0F 2F 0D 4C 37 B8 01     - comiss xmm1,[GameAssembly.dll+2770FA0]
GameAssembly.dll+BED854: F3 0F 11 8F 9C 05 00 00  - movss [rdi+0000059C],xmm1
GameAssembly.dll+BED85C: 72 BD                    - jb GameAssembly.dll+BED81B
GameAssembly.dll+BED85E: 0F 57 C0                 - xorps xmm0,xmm0
GameAssembly.dll+BED861: 8B C0                    - mov eax,eax
GameAssembly.dll+BED863: F2 48 0F 2A C0           - cvtsi2sd xmm0,rax
GameAssembly.dll+BED868: 66 0F 5A D0              - cvtpd2ps xmm2,xmm0
GameAssembly.dll+BED86C: 0F 57 C0                 - xorps xmm0,xmm0
GameAssembly.dll+BED86F: F3 0F 5D D1              - minss xmm2,xmm1
GameAssembly.dll+BED873: 0F 2F C2                 - comiss xmm0,xmm2
}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>36</ID>
          <Description>"Villagers consume no food"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-05
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_VILLAGER_NO_NEED_EAT,GameAssembly.dll,41 B8 01 00 00 00 48 8B D6 49) // should be unique
alloc(newmem,$1000,INJECT_VILLAGER_NO_NEED_EAT)

label(code)
label(return)

newmem:

code:
  mov r8d,00000001
  //
  xor r8d, r8d
  //
  jmp return

INJECT_VILLAGER_NO_NEED_EAT:
  jmp newmem
  nop
return:
registersymbol(INJECT_VILLAGER_NO_NEED_EAT)

[DISABLE]

INJECT_VILLAGER_NO_NEED_EAT:
  db 41 B8 01 00 00 00

unregistersymbol(INJECT_VILLAGER_NO_NEED_EAT)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+CE39D2

GameAssembly.dll+CE39A1: 0F 84 0A 01 00 00     - je GameAssembly.dll+CE3AB1
GameAssembly.dll+CE39A7: C6 44 24 42 00        - mov byte ptr [rsp+42],00
GameAssembly.dll+CE39AC: C6 44 24 41 00        - mov byte ptr [rsp+41],00
GameAssembly.dll+CE39B1: 4C 89 7C 24 38        - mov [rsp+38],r15
GameAssembly.dll+CE39B6: C6 44 24 30 00        - mov byte ptr [rsp+30],00
GameAssembly.dll+CE39BB: 48 8D 4C 24 41        - lea rcx,[rsp+41]
GameAssembly.dll+CE39C0: 48 89 4C 24 28        - mov [rsp+28],rcx
GameAssembly.dll+CE39C5: 48 8D 4C 24 42        - lea rcx,[rsp+42]
GameAssembly.dll+CE39CA: 48 89 4C 24 20        - mov [rsp+20],rcx
GameAssembly.dll+CE39CF: 4C 8B C8              - mov r9,rax
// ---------- INJECTING HERE ----------
GameAssembly.dll+CE39D2: 41 B8 01 00 00 00     - mov r8d,00000001
// ---------- DONE INJECTING  ----------
GameAssembly.dll+CE39D8: 48 8B D6              - mov rdx,rsi
GameAssembly.dll+CE39DB: 49 8B CE              - mov rcx,r14
GameAssembly.dll+CE39DE: E8 0D 2E A2 FF        - call ItemStorage.RemoveItems
GameAssembly.dll+CE39E3: 48 8B 8B D8 00 00 00  - mov rcx,[rbx+000000D8]
GameAssembly.dll+CE39EA: 48 85 C9              - test rcx,rcx
GameAssembly.dll+CE39ED: 0F 84 B3 00 00 00     - je GameAssembly.dll+CE3AA6
GameAssembly.dll+CE39F3: 45 33 C9              - xor r9d,r9d
GameAssembly.dll+CE39F6: 45 8D 41 01           - lea r8d,[r9+01]
GameAssembly.dll+CE39FA: 48 8B D6              - mov rdx,rsi
GameAssembly.dll+CE39FD: E8 FE AF 01 00        - call VillagerHealth.Eat
}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>131</ID>
          <Description>"No HP damage to building"</Description>
          <Options moHideChildren="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-16
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_SET_BUILDING_LIFE,GameAssembly.dll,F3 0F 11 77 48 48 8B) // should be unique
alloc(newmem,$1000,INJECT_SET_BUILDING_LIFE)

label(code)
label(return)

newmem:
//DamageableComponent.set_life
  cmp byte ptr [rdi+B8], 1 //_stationary
  jne code
  vmovss xmm15, [rdi+58] //&lt;baseMaxLife&gt;k__BackingField
  vucomiss xmm6, xmm15
  jae code
  vmovss xmm6, [rdi+58]


code:
  movss [rdi+48],xmm6
  jmp return

INJECT_SET_BUILDING_LIFE:
  jmp newmem
return:
registersymbol(INJECT_SET_BUILDING_LIFE)

[DISABLE]

INJECT_SET_BUILDING_LIFE:
  db F3 0F 11 77 48

unregistersymbol(INJECT_SET_BUILDING_LIFE)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+50F84A

GameAssembly.dll+50F820: 0F 2F F3              - comiss xmm6,xmm3
GameAssembly.dll+50F823: 76 08                 - jna GameAssembly.dll+50F82D
GameAssembly.dll+50F825: 0F 28 F3              - movaps xmm6,xmm3
GameAssembly.dll+50F828: EB 03                 - jmp GameAssembly.dll+50F82D
GameAssembly.dll+50F82A: 0F 57 F6              - xorps xmm6,xmm6
GameAssembly.dll+50F82D: F3 0F 10 47 48        - movss xmm0,[rdi+48]
GameAssembly.dll+50F832: F3 0F 5C C6           - subss xmm0,xmm6
GameAssembly.dll+50F836: 0F 54 05 93 29 26 02  - andps xmm0,[GameAssembly.dll+27721D0]
GameAssembly.dll+50F83D: 0F 2F 05 80 14 26 02  - comiss xmm0,[GameAssembly.dll+2770CC4]
GameAssembly.dll+50F844: 0F 82 77 01 00 00     - jb GameAssembly.dll+50F9C1
// ---------- INJECTING HERE ----------
GameAssembly.dll+50F84A: F3 0F 11 77 48        - movss [rdi+48],xmm6
// ---------- DONE INJECTING  ----------
GameAssembly.dll+50F84F: 48 8B CF              - mov rcx,rdi
GameAssembly.dll+50F852: 48 8B 15 B7 45 48 02  - mov rdx,[GameAssembly.dll+2993E10]
GameAssembly.dll+50F859: 48 89 5C 24 70        - mov [rsp+70],rbx
GameAssembly.dll+50F85E: E8 9D D1 B0 00        - call GameAssembly.dll+101CA00
GameAssembly.dll+50F863: 48 8B 0D 3E 09 4B 02  - mov rcx,[GameAssembly.dll+29C01A8]
GameAssembly.dll+50F86A: 48 8B D8              - mov rbx,rax
GameAssembly.dll+50F86D: 83 B9 E0 00 00 00 00  - cmp dword ptr [rcx+000000E0],00
GameAssembly.dll+50F874: 75 05                 - jne GameAssembly.dll+50F87B
GameAssembly.dll+50F876: E8 05 3F D9 FF        - call GameAssembly.dll+2A3780
GameAssembly.dll+50F87B: 80 3D 62 E5 5F 02 00  - cmp byte ptr [GameAssembly.dll+2B0DDE4],00
}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>151</ID>
              <Description>"Apply to all buildings, include enemy"</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>158</ID>
          <Description>"Prevent item corruption in storage &amp; set max count for some items"</Description>
          <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-02-03
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

//aobscanmodule(INJECT_UPDATE_MAX_ITEM_COUNT,GameAssembly.dll,03 B7 90 00 00 00 FF C3 E9 4B FF FF FF 48 8B 5C) // should be unique
aobscanregion(INJECT_UPDATE_MAX_ITEM_COUNT,ReservableItemStorageGetItemCountOfAllUnneededItemsProc+110,ReservableItemStorageGetItemCountOfAllUnneededItemsProc+160,03 B7 90 00 00 00) // should be unique
alloc(newmem,$1000,INJECT_UPDATE_MAX_ITEM_COUNT)

label(code)
label(return)
label(is_prevent_corrput_in_unneeded)
label(i_max_count_for_unneeded)
label(i_min_count_for_unneeded)
label(i_max_count_for_weapon_unneeded)
label(i_min_count_for_weapon_unneeded)
label(i_min_count_for_base_unneeded)
label(i_max_count_for_base_unneeded)

newmem:
  pushfq
  push rax
  push r14
  push rcx
  push rdx

  mov rax, [rdi+98]
  test rax, rax
  jz endp

  xor r14, r14
  xor rcx, rcx
  //mov dword ptr [i_tmp1], 0

calc_loop:
  cmp dword ptr [rax+rcx*4+20], 0
  jz to_next_loop

  add r14d, [rax+rcx*4+20]

  cmp ecx, 64
  jae to_100p_loop

  // item no degrade

  push r14
  mov r14d, [rax+rcx*4+20]
  mov dword ptr [rax+rcx*4+20], 0
  add dword ptr [rax+1B0], r14d
  pop r14
  jmp to_next_loop

to_100p_loop:

to_next_loop:
  inc ecx
  cmp ecx, 65
  jae calc_loop_sum
  jmp calc_loop

calc_loop_sum:
  //set max for some items
  //3:  ItemBerries
  //6:  ItemBread
  //8:  ItemFirewood
  //10: ItemHide
  //11: ItemHideCoat
  //12: ItemMeat
  //13: ItemRootVegetable
  //14: ItemBeans
  //14: ItemBeans
  //15: ItemGreens
  //17: ItemMushroom
  //18: ItemRoots
  //19: ItemNuts
  //20: ItemFruit
  //21: ItemPreservedVeg
  //22: ItemPreserves
  //23: ItemHerbs
  //24: ItemEggs
  //27: ItemTool
  //28: ItemHeavyTool
  //39: ItemFish
  //40: ItemShoes
  //43: ItemSmokedMeat
  //44: ItemSmokedFish
  //45: ItemFlax
  //49: ItemWater
  //52: ItemPottery
  //53: ItemWheatBeer
  //54: ItemHoney
  //55: ItemBasket
  //56: ItemWillow
  //60: ItemFurniture
  //61: ItemTallow
  //62: ItemWax
  //63: ItemSoap
  //64: ItemCandle
  //65: ItemSpice
  //70: ItemCheese
  //74: ItemGlass
  //76: ItemMedicine

  cmp dword ptr [rdi+10], #3 //ItemBerries
  je do_set_limit

  cmp dword ptr [rdi+10], #6 //ItemBread
  je do_set_limit

  cmp dword ptr [rdi+10], #8 //ItemFirewood
  je do_set_limit

  cmp dword ptr [rdi+10], #10 //ItemHide
  je do_set_limit

  cmp dword ptr [rdi+10], #11 //ItemHideCoat
  je do_set_limit

  cmp dword ptr [rdi+10], #12 //ItemMeat
  je do_set_limit

  cmp dword ptr [rdi+10], #13 //ItemRootVegetable
  je do_set_limit

  cmp dword ptr [rdi+10], #14 //ItemBeans
  je do_set_limit

  cmp dword ptr [rdi+10], #15 //ItemGreens
  je do_set_limit

  cmp dword ptr [rdi+10], #17 //ItemMushroom
  je do_set_limit

  cmp dword ptr [rdi+10], #18 //ItemRoots
  je do_set_limit

  cmp dword ptr [rdi+10], #19 //ItemNuts
  je do_set_limit

  cmp dword ptr [rdi+10], #20 //ItemFruit
  je do_set_limit

  cmp dword ptr [rdi+10], #21 //ItemPreservedVeg
  je do_set_limit

  cmp dword ptr [rdi+10], #22 //ItemPreserves
  je do_set_limit

  cmp dword ptr [rdi+10], #23 //ItemHerbs
  je do_set_limit

  cmp dword ptr [rdi+10], #24 //ItemEggs
  je do_set_limit

  cmp dword ptr [rdi+10], #27 //ItemTool
  je do_set_limit

  cmp dword ptr [rdi+10], #28 //ItemHeavyTool
  je do_set_limit

  cmp dword ptr [rdi+10], #39 //ItemFish
  je do_set_limit

  cmp dword ptr [rdi+10], #40 //ItemShoes
  je do_set_limit

  cmp dword ptr [rdi+10], #43 //ItemSmokedMeat
  je do_set_limit

  cmp dword ptr [rdi+10], #44 //ItemSmokedFish
  je do_set_limit

  cmp dword ptr [rdi+10], #45 //ItemFlax
  je do_set_limit

  cmp dword ptr [rdi+10], #49 //ItemWater
  je do_set_limit

  cmp dword ptr [rdi+10], #52 //ItemPottery
  je do_set_limit

  cmp dword ptr [rdi+10], #53 //ItemWheatBeer
  je do_set_limit

  cmp dword ptr [rdi+10], #54 //ItemHoney
  je do_set_limit

  cmp dword ptr [rdi+10], #55 //ItemBasket
  je do_set_limit

  cmp dword ptr [rdi+10], #56 //ItemWillow
  je do_set_limit

  cmp dword ptr [rdi+10], #60 //ItemFurniture
  je do_set_limit

  cmp dword ptr [rdi+10], #61 //ItemTallow
  je do_set_limit

  cmp dword ptr [rdi+10], #62 //ItemWax
  je do_set_limit

  cmp dword ptr [rdi+10], #63 //ItemSoap
  je do_set_limit

  cmp dword ptr [rdi+10], #64 //ItemCandle
  je do_set_limit

  cmp dword ptr [rdi+10], #65 //ItemSpice
  je do_set_limit

  cmp dword ptr [rdi+10], #70 //ItemCheese
  je do_set_limit

  cmp dword ptr [rdi+10], #74 //ItemGlass
  je do_set_limit

  cmp dword ptr [rdi+10], #76 //ItemMedicine
  je do_set_limit

  // weapon/arrow/armor
  cmp dword ptr [rdi+10], #29 //ItemWeapon
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #31 //ItemHeavyWeapon
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #32 //ItemShield
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #33 //ItemHauberk
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #34 //ItemPlatemail
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #35 //ItemArrow
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #37 //ItemBow
  je do_weapon_set_limit

  cmp dword ptr [rdi+10], #38 //ItemCrossbow
  je do_weapon_set_limit




  //base material
  cmp dword ptr [rdi+10], #2 //ItemLogs
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #4 //ItemStone
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #5 //ItemPlunks
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #9 //ItemFlour
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #16 //ItemGrain
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #25 //ItemIronOre
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #26 //ItemIron
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #36 //ItemBrick
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #47 //ItemCoal
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #48 //ItemClay
  je chk_base_set_limit

  cmp dword ptr [rdi+10], #73 //ItemSand
  je chk_base_set_limit


  jmp endp_pre


do_set_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_max_count_for_unneeded]
  jb chk_lower_limit
  mov ecx, [i_max_count_for_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre

chk_lower_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_min_count_for_unneeded]
  jae endp_pre
  mov ecx, [i_min_count_for_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre


do_weapon_set_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_max_count_for_weapon_unneeded]
  jb chk_weapon_lower_limit
  mov ecx, [i_max_count_for_weapon_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre

chk_weapon_lower_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_min_count_for_weapon_unneeded]
  jae endp_pre
  mov ecx, [i_min_count_for_weapon_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre


chk_base_set_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_max_count_for_base_unneeded]
  jb chk_base_lower_limit
  mov ecx, [i_max_count_for_base_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre

chk_base_lower_limit:
  mov ecx, [rax+1B0]
  cmp ecx, [i_min_count_for_base_unneeded]
  jae endp_pre
  mov ecx, [i_min_count_for_base_unneeded]
  mov [rax+1B0], ecx
  mov r14d, ecx
  jmp endp_pre


endp_pre:
  mov [rdi+90], r14d
endp:
  pop rdx
  pop rcx
  pop r14
  pop rax
  popfq

code:
  add esi,[rdi+00000090]
  jmp return
align 10 cc
  is_prevent_corrput_in_unneeded:
  dd 1
  i_max_count_for_unneeded:
  dd #185
  i_min_count_for_unneeded:
  dd #23
  i_max_count_for_weapon_unneeded:
  dd #310
  i_min_count_for_weapon_unneeded:
  dd #31
  i_max_count_for_base_unneeded:
  dd #995
  i_min_count_for_base_unneeded:
  dd #91



INJECT_UPDATE_MAX_ITEM_COUNT:
  jmp newmem
  nop
return:
registersymbol(INJECT_UPDATE_MAX_ITEM_COUNT)
registersymbol(is_prevent_corrput_in_unneeded)
registersymbol(i_max_count_for_unneeded)
registersymbol(i_min_count_for_unneeded)
registersymbol(i_max_count_for_weapon_unneeded)
registersymbol(i_min_count_for_weapon_unneeded)
registersymbol(i_min_count_for_base_unneeded)
registersymbol(i_max_count_for_base_unneeded)

[DISABLE]

INJECT_UPDATE_MAX_ITEM_COUNT:
  db 03 B7 90 00 00 00

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+757218

GameAssembly.dll+7571FA: E8 81 C5 B4 FF     - call GameAssembly.dll+2A3780
GameAssembly.dll+7571FF: 48 85 FF           - test rdi,rdi
GameAssembly.dll+757202: 74 1A              - je GameAssembly.dll+75721E
GameAssembly.dll+757204: 48 85 ED           - test rbp,rbp
GameAssembly.dll+757207: 74 0F              - je GameAssembly.dll+757218
GameAssembly.dll+757209: 48 8B D7           - mov rdx,rdi
GameAssembly.dll+75720C: 48 8B CD           - mov rcx,rbp
GameAssembly.dll+75720F: E8 2C E5 8C FF     - call GameAssembly.il2cpp_method_get_declaring_type+F10
GameAssembly.dll+757214: 84 C0              - test al,al
GameAssembly.dll+757216: 75 06              - jne GameAssembly.dll+75721E
// ---------- INJECTING HERE ----------
GameAssembly.dll+757218: 03 B7 90 00 00 00  - add esi,[rdi+00000090]
// ---------- DONE INJECTING  ----------
GameAssembly.dll+75721E: FF C3              - inc ebx
GameAssembly.dll+757220: E9 4B FF FF FF     - jmp GameAssembly.dll+757170
GameAssembly.dll+757225: 48 8B 5C 24 30     - mov rbx,[rsp+30]
GameAssembly.dll+75722A: 8B C6              - mov eax,esi
GameAssembly.dll+75722C: 48 8B 74 24 40     - mov rsi,[rsp+40]
GameAssembly.dll+757231: 48 8B 6C 24 38     - mov rbp,[rsp+38]
GameAssembly.dll+757236: 48 8B 7C 24 48     - mov rdi,[rsp+48]
GameAssembly.dll+75723B: 48 83 C4 20        - add rsp,20
GameAssembly.dll+75723F: 41 5E              - pop r14
GameAssembly.dll+757241: C3                 - ret 
}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>162</ID>
              <Description>"Set some items' min/max. amount in each storage location and market"</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
              <CheatEntries>
                <CheatEntry>
                  <ID>168</ID>
                  <Description>"Most foods, goods...."</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
                <CheatEntry>
                  <ID>163</ID>
                  <Description>"Min"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_min_count_for_unneeded</Address>
                </CheatEntry>
                <CheatEntry>
                  <ID>161</ID>
                  <Description>"Max"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_max_count_for_unneeded</Address>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>164</ID>
              <Description>"Set weapon/arrow/armor's min/max. amount in each storage location."</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
              <CheatEntries>
                <CheatEntry>
                  <ID>166</ID>
                  <Description>"Min"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_min_count_for_weapon_unneeded</Address>
                </CheatEntry>
                <CheatEntry>
                  <ID>167</ID>
                  <Description>"Max"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_max_count_for_weapon_unneeded</Address>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>160</ID>
              <Description>"Set base material min/max amount in each storage location."</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
              <CheatEntries>
                <CheatEntry>
                  <ID>169</ID>
                  <Description>"Logs, stone,..."</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
                <CheatEntry>
                  <ID>170</ID>
                  <Description>"Min"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_min_count_for_base_unneeded</Address>
                </CheatEntry>
                <CheatEntry>
                  <ID>171</ID>
                  <Description>"Max"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>4 Bytes</VariableType>
                  <Address>i_max_count_for_base_unneeded</Address>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>111</ID>
          <Description>"Set villager move speed / life"</Description>
          <Options moHideChildren="1" moDeactivateChildrenAsWell="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-07
  Author : bbfox@https://opencheattables.com
}

[ENABLE]
//Character.get_movementSpeed
aobscanmodule(INJECT_SET_VILLAGER_DATA,GameAssembly.dll,F3 0F 10 73 44 F3) // should be unique
alloc(newmem,$1000,INJECT_SET_VILLAGER_DATA)

label(code)
label(return)
label(vf_moving_speed_multi)
label(vf_shoe_bonus_base)
label(is_set_life)
label(is_set_armor)
label(vf_min_armor_value)
label(is_weaken_raider)
label(vf_raider_moving_speed_multi)

newmem:
  // Raider:
  // Float: 44: _movementSpeedBase = 3 (Villager = 4.199999809)
  // Pointer: E0: _raiderGroup &lt;&gt; 0 (Villiger = 0 (E0 equals to onDeath)
  // Byte: 70:94 &lt;combatComp&gt;k__BackingField:canBeWounded = 0 (villager = 1)
  // Float: 70: &lt;retreatTimeTillIgnore&gt;k__BackingField = 7.599225998
  // Pointer: 70:80 &lt;immuneSystem&gt;k__BackingField = 0

  mov dword ptr [is_this_object_rider], 0

  cmp dword ptr [is_set_life], 1
  jne check_armor

  push r15
  mov r15, [rbx+70]
  test r15, r15
  jz endp1

  mov dword ptr [is_this_object_rider], 1
  cmp byte ptr [r15+94], 1 //canBeWounded = 0 -&gt; assume Rider
  jne endp1

  // Villager
  mov dword ptr [is_this_object_rider], 0

  vmovss xmm15, [r15+58] //&lt;baseMaxLife&gt;k__BackingField
  vmovss xmm14, [r15+48] //_life
  vucomiss xmm14, xmm15
  jae endp1
  vmovss [r15+48], xmm15 //_life

endp1:
  pop r15


check_armor:
  cmp dword ptr [is_set_armor], 1
  jne check_rider

  push r15
  mov r15, [rbx+70]
  test r15, r15
  jz endp2

  mov dword ptr [is_this_object_rider], 1
  cmp byte ptr [r15+94], 1 //canBeWounded = 0 -&gt; assume Rider
  jne endp2

  //Villager
  mov dword ptr [is_this_object_rider], 0

  vmovss xmm15, [vf_min_armor_value]
  vmovss xmm14, [r15+5C] //baseArmor
  vucomiss xmm14, xmm15
  jae endp2
  vmovss [r15+5C], xmm15

endp2:
  pop r15


check_rider:
  cmp dword ptr [is_weaken_raider], 1
  jne code

  push r15
  mov r15, [rbx+70] //&lt;combatComp&gt;k__BackingField
  test r15, r15
  jz endp3

  mov dword ptr [is_this_object_rider], 0
  cmp byte ptr [r15+94], 0 //canBeWounded = 0 -&gt; assume Rider
  jne endp3

  // Rider
  mov dword ptr [is_this_object_rider], 1

  mov dword ptr [r15+5C], 0 // baseArmor
  mov dword ptr [r15+A4], 0 // _trainingLevel

endp3:
  pop r15


code:
  // orig code
  movss xmm6,[rbx+44]
  //

  cmp dword ptr [is_this_object_rider], 1
  je set_rider_moving_speed

  vmovss xmm14, [vf_moving_speed_multi]
  vmulss xmm6, xmm6, xmm14

  vmovss xmm15, [vf_shoe_bonus_base]
  vmovss [rbx+4C], xmm15
  jmp return

set_rider_moving_speed:
  vmovss xmm14, [vf_raider_moving_speed_multi]
  vmulss xmm6, xmm6, xmm14

  //vmovss xmm15, [vf_shoe_bonus_base]
  vxorps xmm15, xmm15, xmm15
  vmovss [rbx+4C], xmm15

  jmp return
align 10 cc
  vf_moving_speed_multi:
  dd (float)1.2
  vf_raider_moving_speed_multi:
  dd (float)0.66666666666
  vf_shoe_bonus_base:
  dd (float)1.5
  is_set_life:
  dd 0
  is_set_armor:
  dd 1
  vf_20:
  dd (float)20
  vf_min_armor_value:
  dd (float)45
  is_weaken_raider:
  dd 1
  is_this_object_rider:
  dd 0

INJECT_SET_VILLAGER_DATA:
  jmp newmem
return:
registersymbol(INJECT_SET_VILLAGER_DATA)
registersymbol(vf_moving_speed_multi)
registersymbol(vf_shoe_bonus_base)
registersymbol(is_set_life)
registersymbol(is_set_armor)
registersymbol(vf_min_armor_value)
registersymbol(is_weaken_raider)
registersymbol(vf_raider_moving_speed_multi)

[DISABLE]

INJECT_SET_VILLAGER_DATA:
  db F3 0F 10 73 44

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+A367B5

GameAssembly.dll+A36785: 57                    - push rdi
GameAssembly.dll+A36786: 48 83 EC 30           - sub rsp,30
GameAssembly.dll+A3678A: 80 3D 14 2F 53 01 00  - cmp byte ptr [GameAssembly.dll+1F696A5],00
GameAssembly.dll+A36791: 48 8B D9              - mov rbx,rcx
GameAssembly.dll+A36794: 0F 29 74 24 20        - movaps [rsp+20],xmm6
GameAssembly.dll+A36799: 75 13                 - jne GameAssembly.dll+A367AE
GameAssembly.dll+A3679B: 48 8D 0D 6E BE 4C 01  - lea rcx,[GameAssembly.dll+1F02610]
GameAssembly.dll+A367A2: E8 69 14 7D FF        - call GameAssembly.dll+207C10
GameAssembly.dll+A367A7: C6 05 F7 2E 53 01 01  - mov byte ptr [GameAssembly.dll+1F696A5],01
GameAssembly.dll+A367AE: 48 8B 0D 5B BE 4C 01  - mov rcx,[GameAssembly.dll+1F02610]
// ---------- INJECTING HERE ----------
GameAssembly.dll+A367B5: F3 0F 10 73 44        - movss xmm6,[rbx+44]
// ---------- DONE INJECTING  ----------
GameAssembly.dll+A367BA: F3 0F 59 73 40        - mulss xmm6,[rbx+40]
GameAssembly.dll+A367BF: 48 8B 7B 70           - mov rdi,[rbx+70]
GameAssembly.dll+A367C3: F6 81 33 01 00 00 01  - test byte ptr [rcx+00000133],01
GameAssembly.dll+A367CA: 74 0E                 - je GameAssembly.dll+A367DA
GameAssembly.dll+A367CC: 83 B9 E0 00 00 00 00  - cmp dword ptr [rcx+000000E0],00
GameAssembly.dll+A367D3: 75 05                 - jne GameAssembly.dll+A367DA
GameAssembly.dll+A367D5: E8 F6 B2 75 FF        - call GameAssembly.il2cpp_runtime_class_init
GameAssembly.dll+A367DA: 45 33 C0              - xor r8d,r8d
GameAssembly.dll+A367DD: 33 D2                 - xor edx,edx
GameAssembly.dll+A367DF: 48 8B CF              - mov rcx,rdi
}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>125</ID>
              <Description>"May not apply to all NPCs"</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>112</ID>
              <Description>"Moving speed multiplier"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_moving_speed_multi</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>113</ID>
              <Description>"Shoe bonus"</Description>
              <DropDownList DisplayValueAsItem="1">0.1000000015:Default
0.3:3x
0.8999999762:0.9x
1.5:15x
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_shoe_bonus_base</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>114</ID>
              <Description>"Set life when moving? (not recommended)"</Description>
              <DropDownList DescriptionOnly="1" DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>is_set_life</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>115</ID>
              <Description>"Set min. armor when moving?"</Description>
              <DropDownList DescriptionOnly="1" DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>is_set_armor</Address>
              <CheatEntries>
                <CheatEntry>
                  <ID>116</ID>
                  <Description>"Min. armor value"</Description>
                  <ShowAsSigned>0</ShowAsSigned>
                  <Color>C08000</Color>
                  <VariableType>Float</VariableType>
                  <Address>vf_min_armor_value</Address>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>122</ID>
              <Description>"Make rider weak? (training level 0 &amp; no base armor)"</Description>
              <DropDownList DescriptionOnly="1" DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>is_weaken_raider</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>124</ID>
              <Description>"Rider moving speed multiplier"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_raider_moving_speed_multi</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>18</ID>
          <Description>"Item gather number multiplier"</Description>
          <Options moHideChildren="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-04
  Author : bbfox@https://opencheattables.com
}

[ENABLE]
aobscanmodule(INJECT_MASS_ADD,GameAssembly.dll,42 01 04 09 41 83 F8 65) // should be unique
alloc(newmem,$1000,INJECT_MASS_ADD)

label(code)
label(return)
label(vf_item_add_multi)
label(vf_item_add_gold_multi)
label(i_item_cnt_threshold)
label(is_prevent_corruption)
label(is_skip_gold_limit)

//ItemBundle.AddItems #2
//ID: 66 ItemPoop
//ID: 51 ItemGoldIngot
newmem:
  push r15
  mov r15d, [rdx+10]
  cmp r15d, #66 //ItemPoop
  pop r15
  je code

  push r15
  mov r15d, [rdx+10]
  cmp r15d, #51 //ItemGoldIngot
  pop r15
  je start_gold_multi //No threshold for GoldIngot

  cmp eax, 0
  je code
  push r15
  mov r15d, [i_item_cnt_threshold]
  cmp dword ptr [rcx+r9], r15d
  pop r15
  jae code
  jmp start_multi

start_gold_multi:
  vmovss xmm14, [vf_item_add_gold_multi]
  jmp start_multi_calc

start_multi:
  vmovss xmm14, [vf_item_add_multi]

start_multi_calc:
  cvtsi2ss xmm15, eax
  vmulss xmm15, xmm15, xmm14
  vcvtss2si eax, xmm15
  push r15
  mov r15d, [rcx+r9]
  pop r15

chk_corrupt:
  cmp r8d, #40
  ja code
  cmp dword ptr [is_prevent_corruption], 1
  jne code

  add [rcx+r9],eax
  mov eax, [rcx+r9]
  mov dword ptr [rcx+r9], 0

  add [r9+1B0], eax //0020 + 64*4 = 1B0, slot 100% address
  mov eax, 0


code:
  add [rcx+r9],eax
  cmp r8d,65
  jmp return
align 10 cc
  vf_item_add_multi:
  dd (float)3.333333334
  vf_item_add_gold_multi:
  dd (float)10
  db EB 3B 54 68 69 73 20 74 61 62 6C 65 20 63 6F 6D 65 73 20 66 72 6F 6D 20 68 74 74 70 73 3A 2F
  db 2F 6F 70 65 6E 63 68 65 61 74 74 61 62 6C 65 73 2E 63 6F 6D 20 2F 20 43 45 20 37 2E 34 2B
  i_item_cnt_threshold:
  dd 64
  i_item_min_cnt_threshold:
  dd 2
  is_prevent_corruption:
  dd 1
  is_skip_gold_limit:
  dd 1

INJECT_MASS_ADD:
  jmp newmem
  nop 3
return:
registersymbol(INJECT_MASS_ADD)
registersymbol(vf_item_add_multi)
registersymbol(i_item_cnt_threshold)
registersymbol(is_prevent_corruption)
registersymbol(is_skip_gold_limit)
registersymbol(vf_item_add_gold_multi)

[DISABLE]

INJECT_MASS_ADD:
  db 42 01 04 09 41 83 F8 65

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+7021C7
GameAssembly.dll+702190 - 4D 8B 8A 98000000     - mov r9,[r10+00000098]
GameAssembly.dll+702197 - 4D 85 C9              - test r9,r9
GameAssembly.dll+70219A - 74 71                 - je GameAssembly.dll+70220D
GameAssembly.dll+70219C - 45 3B 41 18           - cmp r8d,[r9+18]
GameAssembly.dll+7021A0 - 73 71                 - jae GameAssembly.dll+702213
GameAssembly.dll+7021A2: 4A 8D 0C 85 20 00 00 00           - lea rcx,[r8*4+00000020]
GameAssembly.dll+7021AA: 48 85 D2                          - test rdx,rdx
GameAssembly.dll+7021AD: 74 5E                             - je GameAssembly.dll+70220D
GameAssembly.dll+7021AF: 48 8B 82 98 00 00 00              - mov rax,[rdx+00000098]
GameAssembly.dll+7021B6: 48 85 C0                          - test rax,rax
GameAssembly.dll+7021B9: 74 52                             - je GameAssembly.dll+70220D
GameAssembly.dll+7021BB: 44 3B 40 18                       - cmp r8d,[rax+18]
GameAssembly.dll+7021BF: 73 52                             - jae GameAssembly.dll+702213
GameAssembly.dll+7021C1: 8B 04 01                          - mov eax,[rcx+rax]
GameAssembly.dll+7021C4: 41 FF C0                          - inc r8d
// ---------- INJECTING HERE ----------
GameAssembly.dll+7021C7: 42 01 04 09                       - add [rcx+r9],eax
// ---------- DONE INJECTING  ----------
GameAssembly.dll+7021CB: 41 83 F8 65                       - cmp r8d,65
GameAssembly.dll+7021CF: 72 BF                             - jb GameAssembly.dll+702190
GameAssembly.dll+7021D1: 4D 8B 82 98 00 00 00              - mov r8,[r10+00000098]
GameAssembly.dll+7021D8: BA 01 00 00 00                    - mov edx,00000001
GameAssembly.dll+7021DD: 41 C7 82 90 00 00 00 00 00 00 00  - mov [r10+00000090],00000000
GameAssembly.dll+7021E8: 4D 85 C0                          - test r8,r8
GameAssembly.dll+7021EB: 74 20                             - je GameAssembly.dll+70220D
GameAssembly.dll+7021ED: 41 3B 50 18                       - cmp edx,[r8+18]
GameAssembly.dll+7021F1: 73 20                             - jae GameAssembly.dll+702213
GameAssembly.dll+7021F3: 8B C2                             - mov eax,edx
GameAssembly.dll+7021F5 - FF C2                 - inc edx
GameAssembly.dll+7021F7 - 41 8B 4C 80 20        - mov ecx,[r8+rax*4+20]
GameAssembly.dll+7021FC - 41 01 8A 90000000     - add [r10+00000090],ecx
GameAssembly.dll+702203 - 83 FA 65              - cmp edx,65
GameAssembly.dll+702206 - 7C E0                 - jl GameAssembly.dll+7021E8
GameAssembly.dll+702208 - 48 83 C4 28           - add rsp,28
GameAssembly.dll+70220C - C3                    - ret
GameAssembly.dll+70220D - E8 0E6AB2FF           - call GameAssembly.il2cpp_value_box+70
GameAssembly.dll+702212 - CC                    - int 3
GameAssembly.dll+702213 - E8 186AB2FF           - call GameAssembly.il2cpp_value_box+80
GameAssembly.dll+702218 - CC                    - int 3

}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>20</ID>
              <Description>"No threshold for gold ingot; multiplier does not apply to poop"</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>19</ID>
              <Description>"Multiplier"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_item_add_multi</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>139</ID>
              <Description>"Multiplier for Gold ingot"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_item_add_gold_multi</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>29</ID>
              <Description>"Multiplier threshold limt"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>i_item_cnt_threshold</Address>
              <CheatEntries>
                <CheatEntry>
                  <ID>138</ID>
                  <Description>"multiplier is disabled, if stock# exceed this value"</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>136</ID>
              <Description>"Try to prevent corruption?"</Description>
              <DropDownList DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>is_prevent_corruption</Address>
              <CheatEntries>
                <CheatEntry>
                  <ID>140</ID>
                  <Description>"Only checked when adding a new item"</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>137</ID>
              <Description>"No threshold limit for gold ingot?"</Description>
              <DropDownList DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>is_skip_gold_limit</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>143</ID>
          <Description>"When item remove: try to prevent corruption"</Description>
          <Options moHideChildren="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-31
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_REMOVE_ITEM,GameAssembly.dll,01 8E 90 00 00 00) // should be unique
alloc(newmem,$1000,INJECT_REMOVE_ITEM)

label(code)
label(return)
label(vf_item_remove_multi)
label(is_prevent_corrupt_after_remove)

//ItemBundle.RemoveItems

newmem:
  jmp start_p
  cvtsi2ss xmm15, ecx
  vmovss xmm14, [vf_item_remove_multi]
  vmulss xmm15, xmm15, xmm14
  vcvtss2si ecx, xmm15

start_p:
  cmp dword ptr [is_prevent_corrupt_after_remove], 1
  jne code
  cmp eax, #40
  ja code

  mov ecx, [r8+rax*4+20]
  mov dword ptr [r8+rax*4+20], 0
  add [r8+1B0], ecx
  mov ecx, 0

code:
  add [rsi+00000090],ecx

  jmp return
align 10 cc
  vf_item_remove_multi:
  dd (float)1.05
  is_prevent_corrupt_after_remove:
  dd 1

INJECT_REMOVE_ITEM:
  jmp newmem
  nop
return:
registersymbol(INJECT_REMOVE_ITEM)
registersymbol(vf_item_remove_multi)
registersymbol(is_prevent_corrupt_after_remove)

[DISABLE]

INJECT_REMOVE_ITEM:
  db 01 8E 90 00 00 00

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+7023C4

GameAssembly.dll+70239F: BA 01 00 00 00        - mov edx,00000001
GameAssembly.dll+7023A4: 44 89 A6 90 00 00 00  - mov [rsi+00000090],r12d
GameAssembly.dll+7023AB: 0F 1F 44 00 00        - nop dword ptr [rax+rax+00]
GameAssembly.dll+7023B0: 4D 85 C0              - test r8,r8
GameAssembly.dll+7023B3: 74 39                 - je GameAssembly.dll+7023EE
GameAssembly.dll+7023B5: 41 3B 50 18           - cmp edx,[r8+18]
GameAssembly.dll+7023B9: 73 39                 - jae GameAssembly.dll+7023F4
GameAssembly.dll+7023BB: 8B C2                 - mov eax,edx
GameAssembly.dll+7023BD: FF C2                 - inc edx
GameAssembly.dll+7023BF: 41 8B 4C 80 20        - mov ecx,[r8+rax*4+20]
// ---------- INJECTING HERE ----------
GameAssembly.dll+7023C4: 01 8E 90 00 00 00     - add [rsi+00000090],ecx
// ---------- DONE INJECTING  ----------
GameAssembly.dll+7023CA: 83 FA 65              - cmp edx,65
GameAssembly.dll+7023CD: 7C E1                 - jl GameAssembly.dll+7023B0
GameAssembly.dll+7023CF: 4C 8B 74 24 50        - mov r14,[rsp+50]
GameAssembly.dll+7023D4: 49 8B C7              - mov rax,r15
GameAssembly.dll+7023D7: 4C 8B 7C 24 58        - mov r15,[rsp+58]
GameAssembly.dll+7023DC: 4C 8B 64 24 48        - mov r12,[rsp+48]
GameAssembly.dll+7023E1: 48 8B 7C 24 40        - mov rdi,[rsp+40]
GameAssembly.dll+7023E6: 48 83 C4 20           - add rsp,20
GameAssembly.dll+7023EA: 5E                    - pop rsi
GameAssembly.dll+7023EB: 5D                    - pop rbp
}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>145</ID>
              <Description>"Try to prevent corruption?"</Description>
              <DropDownList DisplayValueAsItem="1">0:No
1:Yes
</DropDownList>
              <ShowAsSigned>0</ShowAsSigned>
              <VariableType>4 Bytes</VariableType>
              <Address>is_prevent_corrupt_after_remove</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>132</ID>
          <Description>"When add item to storage"</Description>
          <Options moHideChildren="1"/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{ Game   : Farthest Frontier.exe
  Version: 
  Date   : 2023-01-30
  Author : bbfox@https://opencheattables.com
}

[ENABLE]

aobscanmodule(INJECT_STOR_ITEM_MULTI,GameAssembly.dll,41 01 04 10 83 F9 65 72 AE) // should be unique
alloc(newmem,$1000,INJECT_STOR_ITEM_MULTI)

label(code)
label(return)
label(vf_item_count_multi)
label(i_min_storage_item)
label(i_max_poop_count)
label(i_min_gold_count)
label(i_min_amount_in_100_slot)

//ItemStorage.AddItems

newmem:
  //cmp ecx, 64
  //jne do_next
  mov [i_tmp1], eax
  cvtsi2ss xmm15, eax
  vmovss xmm14, [vf_item_count_multi]
  vmulss xmm15, xmm14, xmm15
  vcvtss2si eax, xmm15


do_next:
  push r15
  push r14

  mov r15d, [rdi+10]
  cmp r15d, #66 //ItemPoop
  jne chk_gold
  // Poop
  mov eax, [i_tmp1]
  mov r15, [rdi+98] //percentDegradationQtyArray
  mov r14d, [r15+1B0] //100%
  cmp r14d, [i_max_poop_count]
  jbe chk_gold
  mov r14d, [i_max_poop_count]
  mov [r15+1B0], r14d

chk_gold:
  mov r15d, [rdi+10]
  cmp r15d, #51 //ItemGoldIngot
  jne chk_min_amount
  mov r15, [rdi+98] //percentDegradationQtyArray
  mov r14d, [r15+1B0] //100%
  cmp r14d, [i_min_gold_count]
  jae chk_min_amount
  mov r14d, [i_min_gold_count]
  mov [r15+1B0], r14d


chk_min_amount:
  cmp ecx, 65
  jne endp
  mov r15, [rdi+98] //percentDegradationQtyArray
  mov r14d, [r15+1B0] //100%
  cmp r14d, [i_min_amount_in_100_slot]
  jae endp
  mov r14d, [i_min_amount_in_100_slot]
  mov [r15+1B0], r14d


endp:
  pop r14
  pop r15

code:
  add [r8+rdx],eax
  mov eax, [i_tmp1]
  cmp ecx,65
  jmp return
align 10 cc
  vf_item_count_multi:
  dd (float)3.3333333333
  i_min_storage_item:
  dd A
  i_max_poop_count:
  dd 14
  i_min_gold_count:
  dd #200
  i_tmp1:
  dd 0
  i_min_amount_in_100_slot:
  dd 4

INJECT_STOR_ITEM_MULTI:
  jmp newmem
  nop 2
return:
registersymbol(INJECT_STOR_ITEM_MULTI)
registersymbol(vf_item_count_multi)
registersymbol(i_min_storage_item)
registersymbol(i_max_poop_count)
registersymbol(i_min_gold_count)
registersymbol(i_min_amount_in_100_slot)

[DISABLE]

INJECT_STOR_ITEM_MULTI:
  db 41 01 04 10 83 F9 65

unregistersymbol(*)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: GameAssembly.dll+706199

GameAssembly.dll+706169: 4C 8D 04 8D 20 00 00 00        - lea r8,[rcx*4+00000020]
GameAssembly.dll+706171: 48 85 FF                       - test rdi,rdi
GameAssembly.dll+706174: 0F 84 6F 01 00 00              - je GameAssembly.dll+7062E9
GameAssembly.dll+70617A: 48 8B 87 98 00 00 00           - mov rax,[rdi+00000098]
GameAssembly.dll+706181: 48 85 C0                       - test rax,rax
GameAssembly.dll+706184: 0F 84 5F 01 00 00              - je GameAssembly.dll+7062E9
GameAssembly.dll+70618A: 3B 48 18                       - cmp ecx,[rax+18]
GameAssembly.dll+70618D: 0F 83 5C 01 00 00              - jae GameAssembly.dll+7062EF
GameAssembly.dll+706193: 41 8B 04 00                    - mov eax,[r8+rax]
GameAssembly.dll+706197: FF C1                          - inc ecx
// ---------- INJECTING HERE ----------
GameAssembly.dll+706199: 41 01 04 10                    - add [r8+rdx],eax
// ---------- DONE INJECTING  ----------
GameAssembly.dll+70619D: 83 F9 65                       - cmp ecx,65
GameAssembly.dll+7061A0: 72 AE                          - jb GameAssembly.dll+706150
GameAssembly.dll+7061A2: 4C 8B 83 98 00 00 00           - mov r8,[rbx+00000098]
GameAssembly.dll+7061A9: BA 01 00 00 00                 - mov edx,00000001
GameAssembly.dll+7061AE: C7 83 90 00 00 00 00 00 00 00  - mov [rbx+00000090],00000000
GameAssembly.dll+7061B8: 0F 1F 84 00 00 00 00 00        - nop dword ptr [rax+rax+00000000]
GameAssembly.dll+7061C0: 4D 85 C0                       - test r8,r8
GameAssembly.dll+7061C3: 0F 84 20 01 00 00              - je GameAssembly.dll+7062E9
GameAssembly.dll+7061C9: 41 3B 50 18                    - cmp edx,[r8+18]
GameAssembly.dll+7061CD: 0F 83 1C 01 00 00              - jae GameAssembly.dll+7062EF
}
</AssemblerScript>
          <CheatEntries>
            <CheatEntry>
              <ID>141</ID>
              <Description>"Affect traiding post"</Description>
              <Color>8000FF</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>133</ID>
              <Description>"Multiplier"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>Float</VariableType>
              <Address>vf_item_count_multi</Address>
              <CheatEntries>
                <CheatEntry>
                  <ID>150</ID>
                  <Description>"If you notice that the required amount of building materials is never met, please set this value to 1"</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
                <CheatEntry>
                  <ID>152</ID>
                  <Description>"If upgrade button is disabled, please set this value to 1"</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
                <CheatEntry>
                  <ID>154</ID>
                  <Description>"Transfer items between "town storage" &lt;=&gt; "trading post" in Trading post menu to increase item count"</Description>
                  <Color>8000FF</Color>
                  <GroupHeader>1</GroupHeader>
                </CheatEntry>
              </CheatEntries>
            </CheatEntry>
            <CheatEntry>
              <ID>134</ID>
              <Description>"Max poop count"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>i_max_poop_count</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>135</ID>
              <Description>"Min. gold amount"</Description>
              <ShowAsSigned>0</ShowAsSigned>
              <Color>C08000</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>i_min_gold_count</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>119</ID>
          <Description>"_WIP"</Description>
          <Options moHideChildren="1"/>
          <GroupHeader>1</GroupHeader>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>28</ID>
      <Description>"Farthest Frontier v0.8.1a  /  https://opencheattables.com  /  CE 7.4+"</Description>
      <Color>800080</Color>
      <GroupHeader>1</GroupHeader>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <LuaScript>--[[
from https://forum.cheatengine.org/viewtopic.php?p=5659739&amp;sid=72bd2d145c30bf0d344304bce17ea990#5659739
FauDrei
--]]
function toHex(num)
    if num == 0 then
        return '0'
    end
    local neg = false
    if num &lt; 0 then
        neg = true
        num = num * -1
    end
    local hexstr = "0123456789ABCDEF"
    local result = ""
    while num &gt; 0 do
        local n = math.mod(num, 16)
        result = string.sub(hexstr, n + 1, n + 1) .. result
        num = math.floor(num / 16)
    end
    if neg then
        result = '-' .. result
    end
    return result
end


function reEscape(s)
  local escPatChars = [[().%+-*?[^]]
  s = s:gsub('.',function(c) if escPatChars:find(c,1,true) then return '%'..c end end)
  return s
end

function findMethodAddrBySignature(namespace,classname,methodname,signature,check)
  local meth = findMethodBySignature(namespace,classname,methodname,signature,check)
  if meth~=nil and meth&gt;0 then
    return mono_compile_method(meth)
  end
end

function findMethodBySignature(namespace,classname,methodname,signature,check)
  assert(type(signature)=='string',"invalid signature")
  signature="^"..reEscape(signature:gsub(";",","))
  local class = mono_findClass(namespace,classname)
  if type(class)~='number' or class==0 then return nil end
  local methods=mono_class_enumMethods(class)
  if type(methods)~='table' or #methods&lt;1 then return nil end
  if check then  print('check:'..methodname..": &lt;"..signature.."&gt; vs ") end
  for i=1,#methods do
   if methodname == methods[i].name then
     local sign = mono_method_getSignature(methods[i].method)
     if check then  print("  &gt;&gt; &lt;"..sign..'&gt;') end
     if sign:match(signature) then
       return methods[i].method
     end
   end
  end
end

--registerLuaFunctionHighlight('tohex')
registerLuaFunctionHighlight('toHex')
registerLuaFunctionHighlight('reEscape')
registerLuaFunctionHighlight('findMethodAddrBySignature')
registerLuaFunctionHighlight('findMethodBySignature')

</LuaScript>
</CheatTable>
