<?xml version='1.0' encoding='utf-8'?>
<CheatTable CheatEngineTableVersion="45">
  <CheatEntries>
    <CheatEntry>
      <ID>1</ID>
      <Description>"[ATTACH / ALL OFF] THE DEAD WE KNEW"</Description>
      <Color>00A5FF</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>

{ Game   : THEDEADWEKNEW-Win64-Shipping.exe
  Author  : Black_wolf
  CheatVer: 0.1.9-001-002

  Memo: Game Ver.0.1.9 / Steam build 26602550.
	
	なんかバグだらけでやる気のなくなるゲーム
	ゲームになり切れていない
}

[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.disableAll(memrec) end)
{$asm}
[DISABLE]
</AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>2</ID>
      <Description>"0. Settings / README"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>3</ID>
          <Description>"Language"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>4</ID>
              <Description>"English"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.setLang('en') end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>5</ID>
              <Description>"Japanese / 日本語"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.setLang('ja') end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>6</ID>
          <Description>"README"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>7</ID>
              <Description>"Start game, load a solo / host save, attach; allow table Lua. CE 7.5+ x64."</Description>
              <Options moManualExpandCollapse="1" />
              <Color>FFFF00</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>8</ID>
              <Description>"Supported: Game Ver.0.1.9 (Steam 26602550). Table V01."</Description>
              <Options moManualExpandCollapse="1" />
              <Color>FFFF00</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>9</ID>
              <Description>"Value rows: double-click to edit. Lists: re-enable after loading or moving inventory."</Description>
              <Options moManualExpandCollapse="1" />
              <Color>FFFF00</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>10</ID>
              <Description>"Item names follow game text; category IDs are the game equipment permission groups."</Description>
              <Options moManualExpandCollapse="1" />
              <Color>FFFF00</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
            <CheatEntry>
              <ID>12</ID>
              <Description>"Space ascent includes fall protection while enabled. Time uses 0-2399 (1200 = noon)."</Description>
              <Options moManualExpandCollapse="1" />
              <Color>FFFF00</Color>
              <GroupHeader>1</GroupHeader>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>20</ID>
          <Description>"Diagnostics"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>21</ID>
              <Description>"Toggle Lua Engine"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() local f=DWK.luaEngine();if f then if f.Visible then f.hide() else f.show() end end end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>22</ID>
              <Description>"Build / code / player validation"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.scanSelfTest() end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>23</ID>
              <Description>"Environment"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.envReport() end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>24</ID>
              <Description>"Status"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.statusReport() end)
{$asm}
[DISABLE]
</AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>100</ID>
      <Description>"01. Gameplay"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>101</ID>
          <Description>"Invincible (block player damage)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('god',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('god',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>102</ID>
          <Description>"Infinite health"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('health',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('health',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>103</ID>
          <Description>"Infinite stamina"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('stamina',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('stamina',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>104</ID>
          <Description>"No hunger"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('hunger',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('hunger',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>105</ID>
          <Description>"No thirst"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('thirst',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('thirst',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>106</ID>
          <Description>"Stealth (ignore new player perception stimuli)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('stealth',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('stealth',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>110</ID>
          <Description>"No ammo / arrow consumption"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('ammo',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('ammo',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>111</ID>
          <Description>"No item consumption (ID consumption path)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('items',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('items',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>116</ID>
          <Description>"Hold Space to ascend"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('float',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('float',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>118</ID>
          <Description>"No fall damage"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('fall',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('fall',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>120</ID>
          <Description>"Repair map key (M: open / close)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('maprepair',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('maprepair',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>107</ID>
          <Description>"Set money / ticket total..."</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.moneyPick() end)
{$asm}
[DISABLE]
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>109</ID>
          <Description>"Zombie money drop multiplier"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('moneydrop',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('moneydrop',false) end
{$asm}
</AssemblerScript>
          <Options moHideChildren="1" />
          <CheatEntries>
            <CheatEntry>
              <ID>121</ID>
              <Description>"Multiplier (0-1000; default 2)"</Description>
              <VariableType>Float</VariableType>
              <Address>dwkVars+30</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>112</ID>
          <Description>"Player speed multiplier"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('speed',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('speed',false) end
{$asm}
</AssemblerScript>
          <Options moHideChildren="1" />
          <CheatEntries>
            <CheatEntry>
              <ID>113</ID>
              <Description>"Multiplier"</Description>
              <VariableType>Float</VariableType>
              <Address>dwkVars+20</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>114</ID>
          <Description>"Jump multiplier"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('jump',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('jump',false) end
{$asm}
</AssemblerScript>
          <Options moHideChildren="1" />
          <CheatEntries>
            <CheatEntry>
              <ID>115</ID>
              <Description>"Multiplier"</Description>
              <VariableType>Float</VariableType>
              <Address>dwkVars+24</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>119</ID>
          <Description>"Ascent settings / hold Space"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>117</ID>
              <Description>"Ascent velocity (cm/s)"</Description>
              <VariableType>Float</VariableType>
              <Address>dwkVars+28</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>200</ID>
      <Description>"02. Player"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>201</ID>
          <Description>"Player editor (enable to refresh)"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.userRun(function() DWK.playerEditor(memrec) end)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.clearChildren(memrec) end
{$asm}
</AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>300</ID>
      <Description>"03. Items"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>301</ID>
          <Description>"Edit quantities / magazines (refresh list)"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.userRun(function() DWK.refreshItems(memrec) end)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.clearChildren(memrec) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>302</ID>
          <Description>"Add items (category / quantity)..."</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.addItemPick() end)
{$asm}
[DISABLE]
</AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>400</ID>
      <Description>"04. Craft / Build"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>401</ID>
          <Description>"No materials needed (recipes / building checks)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('materials',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('materials',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>402</ID>
          <Description>"Instant craft (queue / recipes)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('instant',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('instant',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>403</ID>
          <Description>"Instant build (E on the targeted placed building)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('build',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('build',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>500</ID>
      <Description>"05. World"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>501</ID>
          <Description>"Always daytime (12:00)"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('noon',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('noon',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>502</ID>
          <Description>"Select weather preset..."</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.oneShot(memrec,function() DWK.weatherPick() end)
{$asm}
[DISABLE]
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>503</ID>
          <Description>"Freeze selected weather"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('weather',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('weather',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>506</ID>
          <Description>"Prevent fog / zombie horde event"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('raid',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('raid',false) end
{$asm}
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>504</ID>
          <Description>"Freeze time"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
DWK.feature('time',true)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if DWK then DWK.feature('time',false) end
{$asm}
</AssemblerScript>
          <Options moHideChildren="1" />
          <CheatEntries>
            <CheatEntry>
              <ID>505</ID>
              <Description>"Time (0-2399, noon=1200)"</Description>
              <VariableType>Float</VariableType>
              <Address>dwkVars+2C</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols />
  <LuaScript>-- Own-runtime reload: remove the previous table's hooks and restore its patches before replacing closures.
local tablePreviousVarDef=DWK and DWK.VARDEF
local tableReloadFeatures
if DWK and DWK.pid and DWK.pid==getOpenedProcessID() and DWK.base and DWK.base() then
 local b=DWK.base();assert(readInteger(b+0x300)~=2,'Wait for the executing game call before reloading the table')
 tableReloadFeatures={};for k in pairs(DWK.featOn or {})do tableReloadFeatures[k]=true end
 if DWK.timer then DWK.timer.Enabled=false end
 if DWK.mapState and DWK.mapClose then DWK.mapClose()end
 local keys={};for k in pairs(DWK.featOn or {})do keys[#keys+1]=k end
 for _,k in ipairs(keys)do DWK.feature(k,false)end
 keys={};for k in pairs(DWK.edits or {})do keys[#keys+1]=k end
 for _,k in ipairs(keys)do DWK.restore(k)end
 keys={};for k in pairs(DWK.hookState or {})do keys[#keys+1]=k end
 for _,k in ipairs(keys)do DWK.hookOff(k)end
 if DWK.timer then DWK.timer.destroy();DWK.timer=nil end
 DWK.A={};DWK.featOn={};DWK.mapState=nil;DWK.buildKeyWasDown=false
end

DWK=DWK or {};local DWK=DWK
DWK.TAG='TDWK';DWK.TITLE='THE DEAD WE KNEW';DWK.EXE='THEDEADWEKNEW-Win64-Shipping.exe';DWK.MODULE=DWK.EXE
DWK.GAMEVER='0.1.9 (Steam 26602550)';DWK.TICK_MS=100;DWK.lang=DWK.lang or 'en'
DWK.C_GROUP=0xFFFF00;DWK.C_SCRIPT=0x00A5FF;DWK.ID_ATTACH=1;DWK.ID_TOP0=2;DWK.OFF_VARS=0x100;DWK.OFF_PTRS=0x200
DWK.RVA={names=0x93FD000,objects=0x94E07A0,world=0x965D110}
DWK.HOOKS={};DWK.SIGS={};DWK.VARDEF={[0x20]={'float',1},[0x24]={'float',1},[0x28]={'float',600},[0x2C]={'float',1200},[0x30]={'float',2}}
DWK.BUILD={ts=0x6741E1F7,size=0xA040000}
DWK.SIGS.ProcessInternal={rva=0x14963A0,len=5,bytes={72,137,92,36,8,72,137,108,36,16,72,137,116,36,24,87,65,86,65,87,72,131,236,48,76,139,114,16,73,139,248,72}}
DWK.SIGS.ProcessEvent={rva=0x1495FA0,len=6,bytes={64,85,86,87,65,84,65,85,65,86,65,87,72,129,236,0,1,0,0,72,141,108,36,48,72,137,157,40,1,0,0,72}}
DWK.SIGS.Damage={rva=0x425CA10,len=6,bytes={64,83,72,131,236,32,243,15,16,129,128,7,0,0,15,87,201,243,15,92,194,72,139,217,243,15,93,5,20,216,11,3}}
DWK.SIGS.Stamina={rva=0x425A1C0,len=6,bytes={64,83,72,131,236,48,15,41,116,36,32,72,139,217,15,40,241,232,106,2,73,255,131,248,3,125,21,15,40,206,72,139}}
DWK.SIGS.Hunger={rva=0x425A150,len=6,bytes={64,83,72,131,236,48,15,41,116,36,32,72,139,217,15,40,241,232,218,2,73,255,131,248,3,125,21,15,40,206,72,139}}
DWK.SIGS.Thirst={rva=0x425A230,len=6,bytes={64,83,72,131,236,48,15,41,116,36,32,72,139,217,15,40,241,232,250,1,73,255,131,248,3,125,21,15,40,206,72,139}}
DWK.SIGS.Stealth={rva=0x423A020,len=7,bytes={76,139,220,73,137,91,16,73,137,107,24,73,137,115,32,87,65,84,65,85,65,86,65,87,72,129,236,240,0,0,0,65}}
DWK.SIGS.Invoke={rva=0x1369330,len=5,bytes={72,137,92,36,8,72,137,108,36,16,72,137,116,36,24,72,137,124,36,32,65,86,72,131,236,32,72,139,89,32,77,139}}
DWK.SIGS.FallJump={rva=0x14A5E80,len=7,bytes={72,139,66,32,72,99,8,72,131,192,4,72,137,66,32,72,139,66,16,72,3,72,96,72,137,74,32,195,204,204,204,204}}
DWK.SIGS.NativeTick={rva=0x38CABE0,len=5,bytes={64,85,83,65,84,65,85,65,87,72,141,108,36,201,72,129,236,0,1,0,0,15,41,180,36,224,0,0,0,72,139,5}}
DWK.SIGS.MoneyRoll={rva=0x3A1BF30,len=5,bytes={72,137,92,36,8,72,137,108,36,32,86,87,65,86,72,131,236,32,69,51,246,73,139,240,68,137,116,36,72,72,139,218}}
DWK.SIGS.CraftFlow={rva=0x14A7650,len=5,bytes={72,137,92,36,8,72,137,116,36,16,87,72,131,236,32,72,139,66,32,72,141,90,72,72,99,123,40,139,48,72,131,192}}
DWK.SIGS.LowerEnergy={rva=0x425A0D0,len=6,bytes={64,83,72,131,236,48,15,41,116,36,32,72,139,217,15,40,241,232,90,3,73,255,72,139,203,131,248,3,125,18,15,40}}
DWK.SIGS.SetEnergy={rva=0x425A7D0,len=8,bytes={243,15,17,137,176,0,0,0,195,204,204,204,204,204,204,204,243,15,17,137,180,0,0,0,195,204,204,204,204,204,204,204}}
DWK.SIGS.SetStamina={rva=0x425A7F0,len=8,bytes={243,15,17,137,172,0,0,0,195,204,204,204,204,204,204,204,243,15,17,137,184,0,0,0,195,204,204,204,204,204,204,204}}
DWK.SIGS.AmmoStore={rva=0x425EA40,len=6,bytes={137,183,136,4,0,0,72,139,141,192,0,0,0,72,51,204,232,27,123,241,2,72,129,196,248,1,0,0,95,94,91,93}}
DWK.SIGS.AmmoAssign={rva=0x14A62B8,len=7,bytes={65,255,20,193,72,133,255,15,132,161,0,0,0,72,139,7,72,139,207,255,144,128,0,0,0,132,192,116,111,77,133,228}}
DWK.A      = DWK.A or {}      -- resolved signature addresses
DWK.pend   = DWK.pend or {}   -- unresolved signatures
DWK.hookState = DWK.hookState or {}
DWK.featOn = DWK.featOn or {}
DWK.dyn    = DWK.dyn or {}    -- dynamic records {mr,en,ja}
DWK.suffix = DWK.suffix or {} -- record ID -&gt; text appended to its name

----------------------------------------------------------------- helpers
local function ri(a) if not a or a==0 then return nil end local v=readInteger(a) if v and v&gt;=0x80000000 then v=v-0x100000000 end return v end
function DWK.T(en,ja) if DWK.lang=='ja' then return ja or en end return en end
function DWK.msg(en,ja) print('['..DWK.TAG..'] '..DWK.T(en,ja)) end
function DWK.err(en,ja) error(DWK.T(en,ja),0) end
local function hex(n) return string.format('%X',n) end

function DWK.mod(name) return getAddressSafe(name or DWK.MODULE) end
function DWK.modSize(name) local ok,s=pcall(getModuleSize,name or DWK.MODULE) return ok and s or nil end
function DWK.base() return getAddressSafe('dwkFlags') end
function DWK.flag(i) return DWK.base()+i end
function DWK.var(o) return DWK.base()+DWK.OFF_VARS+o end


----------------------------------------------------------------- one-shot / user action
-- run fn, show errors, then uncheck the record (action rows)
function DWK.userRun(fn)
  local ok,e=pcall(fn)
  if not ok then local m=tostring(e) print('['..DWK.TAG..'] '..m) pcall(showMessage,m) end
  return ok
end
function DWK.oneShot(mr, fn)
  DWK.userRun(fn)
  local t=createTimer(nil,false) t.Interval=150
  t.OnTimer=function(tt) tt.destroy() pcall(function() mr.Active=false end) end
  t.Enabled=true
end

----------------------------------------------------------------- attach / init
function DWK.attached() return DWK.pid~=nil and DWK.pid==getOpenedProcessID() and DWK.base()~=nil end
function DWK.require()
  if not DWK.attached() then
    DWK.err('Not attached to '..DWK.EXE..'. Run [ATTACH / ALL OFF] at the top of the table first.',
           DWK.EXE..'にアタッチされていません。先にテーブル先頭の【アタッチ／一括解除】を実行してください。')
  end
end
-- attach CE to the game; returns true when the opened process changed
function DWK.attachGame()
  local pid=getProcessIDFromProcessName(DWK.EXE)
  if not pid or pid==0 then DWK.err('The game is not running: '..DWK.EXE,'ゲームが起動していません: '..DWK.EXE) end
  local changed=false
  if getOpenedProcessID()~=pid then
    openProcess(pid) changed=true
    DWK.msg(('Attached to %s (PID %d).'):format(DWK.EXE,pid),('%s（PID %d）にアタッチしました。'):format(DWK.EXE,pid))
  end
  if not DWK.mod() then pcall(reinitializeSymbolhandler,true) end
  if not DWK.mod() then DWK.err(DWK.MODULE..' is not loaded yet. Wait until the title screen and try again.',
                              DWK.MODULE..' がまだ読み込まれていません。タイトル画面まで待ってから再実行してください。') end
  return changed
end
-- state of an old process: drop it without touching the new one
function DWK.forgetProcess()
  DWK.hookState={} DWK.featOn={} DWK.A={} DWK.pend={}
  DWK.pid=nil
end
function DWK.init()
  local pid=getOpenedProcessID()
  if DWK.pid==pid and DWK.base() then return true end
  DWK.forgetProcess()
  for _,s in ipairs({'dwkFlags','dwkVars','dwkPtrs'}) do pcall(unregisterSymbol,s) end
  -- near the module (within 2GB) so hook code can reach [dwkFlags+n] RIP-relative.
  -- AA alloc searches free blocks near the address and retries; Lua allocateMemory(size,base) retries only once.
  local mem
  if autoAssemble(('alloc(dwkFlags,$1000,%X)\nregistersymbol(dwkFlags)\n'):format(DWK.mod())) then mem=getAddressSafe('dwkFlags') end
  if not mem or mem==0 then
    pcall(unregisterSymbol,'dwkFlags')
    mem=allocateMemory(0x1000)
    if not mem or mem==0 then DWK.err('Memory allocation failed.','メモリ確保に失敗しました。') end
    registerSymbol('dwkFlags', mem, true)
    DWK.msg('WARNING: shared memory is not near '..DWK.MODULE..'. Hook features may fail to assemble.',
           '警告: 共有メモリを '..DWK.MODULE..' の近くに確保できませんでした。フックを使う機能は組み立てに失敗する場合があります。')
  end
  registerSymbol('dwkVars',  mem+DWK.OFF_VARS, true)
  registerSymbol('dwkPtrs',  mem+DWK.OFF_PTRS, true)
  for o,d in pairs(DWK.VARDEF) do
    if d[1]=='float' then writeFloat(DWK.var(o),d[2]) elseif d[1]=='qword' then writeQword(DWK.var(o),d[2]) else writeInteger(DWK.var(o),d[2]) end
  end
  DWK.pid=pid
  DWK.checkBuild()
  DWK.resolveAll()
  pcall(DWK.onAttach)
  DWK.startTimer()
  return true
end

function DWK.resolveAll()
  local ok,ng=0,0
  for n in pairs(DWK.SIGS) do if DWK.resolveSig(n) then ok=ok+1 else ng=ng+1 end end
  DWK.msg(('Signatures: %d found, %d not found.'):format(ok,ng),('シグネチャ: %d件検出、%d件未検出。'):format(ok,ng))
end
function DWK.pendingNames() local r={} for n in pairs(DWK.pend) do r[#r+1]=n end table.sort(r) return r end

----------------------------------------------------------------- hook manager
function DWK.hookOn(name)
  if DWK.hookState[name] then return end
  local h=DWK.HOOKS[name] or DWK.err('Unknown hook: '..name,'未定義のフック: '..name)
  local a=DWK.resolveSig(h.sig)
  if not a then DWK.err('Game code for this feature was not found: '..h.sig..'\n(it may not be loaded yet, or the game was updated)',
                       'この機能に必要なゲームコードが見つかりません: '..h.sig..'\n（未読み込み、またはゲーム更新で変更された可能性があります）') end
  local len=DWK.SIGS[h.sig].len or 5
  local orig=readBytes(a,len,true) or DWK.err('Cannot read hook site.','フック位置を読み取れません。')
  local db={} for i,b in ipairs(orig) do db[i]=string.format('%02X',b) end
  local s=h.aa:gsub('%$SITE','dwkA_'..h.sig):gsub('%$ORIG','db '..table.concat(db,' '))
  s=s:gsub('%$NOP', len&gt;5 and ('nop '..(len-5)) or '')
  local ok,info=autoAssemble(s)
  if not ok then DWK.err('Hook assembly failed: '..name..'\n'..tostring(info),'フックの組み立てに失敗: '..name..'\n'..tostring(info)) end
  DWK.hookState[name]={script=s, info=info, addr=a, orig=orig}
end
function DWK.hookOff(name)
  local st=DWK.hookState[name]; if not st then return end
  if DWK.attached() then
    local ok=autoAssemble(st.script, st.info)
    if not ok then writeBytes(st.addr, st.orig) end   -- fallback: restore original bytes
  end
  DWK.hookState[name]=nil
end

----------------------------------------------------------------- features
function DWK.feature(key, on)
  local f=DWK.F[key] or DWK.err('Unknown feature: '..key,'未定義の機能: '..key)
  if on then
    DWK.require()
    for _,h in ipairs(f.hooks or {}) do DWK.hookOn(h) end
    if f.flag then writeBytes(DWK.flag(f.flag),1) end
    if f.on then f.on() end
    DWK.featOn[key]=true
  else
    DWK.featOn[key]=nil
    if not DWK.attached() then return end
    if f.flag then writeBytes(DWK.flag(f.flag),0) end
    if f.off then pcall(f.off) end
    for _,h in ipairs(f.hooks or {}) do
      local used=false
      for k in pairs(DWK.featOn) do for _,x in ipairs(DWK.F[k].hooks or {}) do if x==h then used=true end end end
      if not used then DWK.hookOff(h) end
    end
  end
end

----------------------------------------------------------------- timer (pointer slots, tasks, process watch)
function DWK.startTimer()
  if DWK.timer then return end
  DWK.timer=createTimer(nil,false) DWK.timer.Interval=DWK.TICK_MS
  DWK.timer.OnTimer=function() pcall(DWK.tick) end
  DWK.timer.Enabled=true
end

----------------------------------------------------------------- ATTACH / ALL OFF
function DWK.disableAll(self)
  local ok,changed=pcall(DWK.attachGame)
  if not ok then print('['..DWK.TAG..'] '..tostring(changed)) pcall(showMessage,tostring(changed)) return end
  if changed or (DWK.pid and DWK.pid~=getOpenedProcessID()) then DWK.forgetProcess() end
  local okI,e=pcall(DWK.init) if not okI then print('['..DWK.TAG..'] '..tostring(e)) pcall(showMessage,tostring(e)) return end
  local al=getAddressList(); local n=0
  for i=al.Count-1,0,-1 do
    local m=al.getMemoryRecord(i)
    if m.Active and not (self and m.ID==self.ID) then pcall(function() m.Active=false end) n=n+1 end
  end
  local r=0 for name in pairs(DWK.hookState) do DWK.hookOff(name) r=r+1 end
  for i=0,0xFF do writeBytes(DWK.flag(i),0) end
  DWK.featOn={}
  DWK.msg(('Attach / All OFF: %d records deactivated, %d hooks restored.'):format(n,r),
         ('アタッチ／一括解除: %d件を無効化、%d件のフックを元に戻しました。'):format(n,r))
end

----------------------------------------------------------------- UI helpers
function DWK.pick(title, names)   -- returns 1-based index or nil
  local sl=createStringList() for _,s in ipairs(names) do sl.add(s) end
  local i=showSelectionList(title, '', sl, true) sl.destroy()
  if i and i&gt;=0 then return i+1 end
end
function DWK.askInt(title, prompt, def, lo, hi)
  local s=inputQuery(title, prompt, tostring(def or 0)); if not s then return nil end
  local v=tonumber(s)
  if not v or v%1~=0 or (lo and v&lt;lo) or (hi and v&gt;hi) then DWK.err('Invalid number: '..s,'不正な数値です: '..s) end
  return v
end
-- dynamic records (lists built at run time)
function DWK.clearChildren(mr) while mr.Count&gt;0 do mr.Child[0].destroy() end end
function DWK.addHdr(parent, en, ja)
  local m=getAddressList().createMemoryRecord()
  m.IsGroupHeader=true m.Description=DWK.T(en,ja) m.Color=DWK.C_GROUP m.appendToEntry(parent) m.DontSave=true
  DWK.dyn[#DWK.dyn+1]={mr=m,en=en,ja=ja} return m
end
function DWK.addRec(parent, en, ja, addr, vt)
  local m=getAddressList().createMemoryRecord()
  m.Description=DWK.T(en,ja) m.Type=vt or vtDword m.Address=addr m.appendToEntry(parent) m.DontSave=true
  DWK.dyn[#DWK.dyn+1]={mr=m,en=en,ja=ja} return m
end

----------------------------------------------------------------- language
function DWK.applyLang()
  local al=getAddressList()
  for i=0,al.Count-1 do
    local m=al.getMemoryRecord(i); local n=DWK.NAMES[m.ID]
    if n then local d=(DWK.lang=='ja') and n[2] or n[1]
      if DWK.suffix[m.ID] then d=d..' : '..DWK.suffix[m.ID] end
      m.Description=d end
  end
  local keep={}
  for _,e in ipairs(DWK.dyn) do if pcall(function() e.mr.Description=DWK.T(e.en,e.ja) end) then keep[#keep+1]=e end end
  DWK.dyn=keep
end
function DWK.setLang(l) DWK.lang=l DWK.applyLang() end

----------------------------------------------------------------- diagnostics
function DWK.luaEngine() local ok,f=pcall(getLuaEngine) if ok then return f end end
function DWK.openLuaEngine(quiet)
  local f=DWK.luaEngine()
  if f then pcall(function() f.show() end) pcall(function() f.bringToFront() end) end
  if not quiet then DWK.msg('Lua Engine opened. Messages of this table are printed here.','Lua Engineを開きました。このテーブルのメッセージはここに表示されます。') end
end
function DWK.envReport()
  DWK.openLuaEngine(true)
  local pid=getOpenedProcessID()
  print(('[%s] CE version      : %s'):format(DWK.TAG, tostring(getCEVersion and getCEVersion())))
  print(('[%s] target process  : %s (running PID %s / opened PID %s / table PID %s)'):format(DWK.TAG, DWK.EXE,
        tostring(getProcessIDFromProcessName(DWK.EXE)), tostring(pid), tostring(DWK.pid)))
  local okx,x64=pcall(targetIs64Bit) print(('[%s] target 64-bit   : %s'):format(DWK.TAG, tostring(okx and x64)))
  local m=DWK.mod()
  if m then
    local lf=ri(m+0x3C); local ts=lf and readInteger(m+lf+8)
    print(('[%s] module          : %s base=%X size=%X PE-timestamp=%X'):format(DWK.TAG, DWK.MODULE, m, DWK.modSize() or 0, ts or 0))
    if DWK.BUILD then print(('[%s] expected build  : timestamp=%X size=%X (v%s)'):format(DWK.TAG, DWK.BUILD.ts, DWK.BUILD.size or 0, DWK.GAMEVER)) end
  else print(('[%s] module          : %s NOT FOUND'):format(DWK.TAG, DWK.MODULE)) end
  print(('[%s] shared memory   : dwkFlags=%s'):format(DWK.TAG, DWK.base() and hex(DWK.base()) or 'not allocated'))
  print(('[%s] attached        : %s'):format(DWK.TAG, tostring(DWK.attached())))
end
function DWK.statusReport()
  DWK.openLuaEngine(true)
  local l=DWK.pendingNames()
  print(('[%s] unresolved signatures: %s'):format(DWK.TAG, #l&gt;0 and table.concat(l,', ') or '-'))
  local h={} for n,st in pairs(DWK.hookState) do h[#h+1]=('%s@%X'):format(n,st.addr) end table.sort(h)
  print(('[%s] active hooks        : %s'):format(DWK.TAG, #h&gt;0 and table.concat(h,', ') or '-'))
  local f={} for k in pairs(DWK.featOn) do f[#f+1]=k end table.sort(f)
  print(('[%s] features on         : %s'):format(DWK.TAG, #f&gt;0 and table.concat(f,', ') or '-'))
  local al=getAddressList(); local a={}
  for i=0,al.Count-1 do local m=al.getMemoryRecord(i) if m.Active then a[#a+1]=('[%d] %s'):format(m.ID,m.Description) end end
  print(('[%s] active records      : %s'):format(DWK.TAG, #a&gt;0 and table.concat(a,' / ') or '-'))
end

-- [GAME] TDWK build 26602550. Common framework overrides below add strict build/byte validation,
-- transactional activation, UObject identity checks and game-thread calls required by this UE title.
DWK.U={names={},props={},objects={}}
local U=DWK.U
local function q(a) if a and a&gt;0 then local v=readQword(a);if v and v&gt;0 then return v end end end
local function i(a) return a and readInteger(a) end
local function hx(a) return string.format('%X',a) end
local function valid(o)
 if not o or o&lt;0x10000 then return false end
 local idx=i(o+0xC);if not idx or idx&gt;= (i(U.go+0x14) or 0) then return false end
 local ch=q(q(U.go)+(idx//65536)*8);return ch and q(ch+(idx%65536)*24)==o
end
function U.name(id)
 if not id then return '?' end
 if U.names[id] then return U.names[id] end
 local b=q(U.gn+0x10+(id&gt;&gt;16)*8);if not b then return '?' end
 local a=b+(id&amp;65535)*2;local h=readSmallInteger(a);if not h then return '?' end
 local n=h&gt;&gt;6;if n&lt;1 or n&gt;1023 then return '?' end
 local bt=readBytes(a+2,n*((h&amp;1)==1 and 2 or 1),true);if not bt then return '?' end
 local s
 if (h&amp;1)==0 then s=string.char(table.unpack(bt)) else local z={} for k=1,#bt,2 do local v=bt[k]+bt[k+1]*256;z[#z+1]=(v&gt;=0xD800 and v&lt;=0xDFFF) and '?' or utf8.char(v) end s=table.concat(z) end
 U.names[id]=s;return s
end
function U.n(o) return U.name(i(o+0x18)) end
function U.c(o) local c=q(o+0x10);return c and U.n(c) or '?' end
function U.isA(o,n)
 local c=q(o+0x10);for k=1,64 do if not c then return false end;if U.n(c)==n then return true end;c=q(c+0x40) end;return false
end
function U.own(c)
 if U.props[c] and ((U.props[c][1] and U.props[c][1].f or 0)==(q(c+0x50) or 0)) then return U.props[c] end
 local out={};local f=q(c+0x50);local seen={}
 while f and not seen[f] and #out&lt;2000 do
  seen[f]=true;local fc=q(f+8);local p={f=f,name=U.name(i(f+0x20)),kind=fc and U.name(i(fc)) or '?',off=i(f+0x44),size=i(f+0x34),sub=q(f+0x70)}
  if not p.off or p.off&gt;0x100000 or not p.kind:match('Property$') then DWK.err('Reflection validation failed','リフレクション検証失敗') end
  out[#out+1]=p;f=q(f+0x18)
 end
 U.props[c]=out;return out
end
function U.propClass(c,n)
 for k=1,64 do if not c then return end;for _,p in ipairs(U.own(c)) do if p.name:lower()==n:lower() then return p end end;c=q(c+0x40) end
end
function U.prop(o,n) return U.propClass(q(o+0x10),n) end
function U.addr(o,n) local p=U.prop(o,n);if p then return o+p.off,p end end
function U.get(o,n) local a=U.addr(o,n);return a and q(a) end
function U.refresh()
 U.objects={}
 local count=assert(i(U.go+0x14));assert(count&gt;0 and count&lt;3000000)
 local chunks=assert(q(U.go))
 for ch=0,(count-1)//65536 do
  local c=q(chunks+ch*8)
  if c then for j=0,math.min(65536,count-ch*65536)-1 do
   local o=q(c+j*24)
   if o then local cn=U.c(o);local n=U.n(o);local row={o=o,n=n,c=cn,outer=q(o+0x20)};U.objects[#U.objects+1]=row
   end
  end end
 end
end
function U.find(n,c)
 for _,x in ipairs(U.objects) do if x.n==n and (not c or x.c==c) and valid(x.o) and U.n(x.o)==n and (not c or U.c(x.o)==c) then return x.o end end
end
function U.func(o,n)
 local c=q(o+0x10)
 for k=1,64 do
  if not c then break end
  local f=q(c+0x48);local seen={}
  while f and not seen[f] do
   seen[f]=true
   if valid(f) and U.c(f)=='Function' and U.n(f)==n and q(f+0x20)==c then return f end
   f=q(f+0x28)
  end
  c=q(c+0x40)
 end
 DWK.err('Function not found: '..n,'関数が見つかりません: '..n)
end
function U.rows(t)
 local r={};if not t or not valid(t) then return r end
 local d=q(t+0x30);local n=i(t+0x38);if not d or not n or n&gt;100000 then return r end
 local bits=q(t+0x50) or (t+0x40)
 for j=0,n-1 do local b=i(bits+(j//32)*4);if b and (b&amp;(1&lt;&lt;(j%32)))~=0 then
  local a=d+j*24;local p=q(a+8);if p and readBytes(p,1) then r[#r+1]={row=p,name=U.name(i(a))} end
 end end;return r
end
function U.text(a)
 local d=q(a);local p=d and q(d+0x18);local n=d and i(d+0x20)
 if p and n and n&gt;0 and n&lt;512 then return readString(p,(n-1)*2,true) end
end
local oldForget=DWK.forgetProcess
function DWK.forgetProcess()
 oldForget();U.names={};U.props={};U.objects={};DWK.P=nil;DWK.edits={};DWK.moveSave={};DWK.items=nil
end
function DWK.checkBuild()
 local b=DWK.mod();local pe=i(b+0x3C)
 if not pe or i(b+pe+8)~=DWK.BUILD.ts or i(b+pe+0x50)~=DWK.BUILD.size then
  DWK.err('Unsupported EXE build. Expected Steam 26602550. No game writes were made.','未対応のEXEビルドです。対応: Steam 26602550。ゲームへの書き込みは行っていません。')
 end
 return true
end
-- Supported-build resolution: PE identity plus complete original prologue bytes; reject mismatches.
function DWK.resolveSig(n)
 if DWK.A[n] then return DWK.A[n] end
 DWK.checkBuild();local s=assert(DWK.SIGS[n]);local a=DWK.mod()+s.rva;local b=readBytes(a,#s.bytes,true)
 if not b then DWK.err('Unreadable code: '..n,'コード読み取り不可: '..n) end
 for j,v in ipairs(s.bytes) do if b[j]~=v then DWK.err('Code changed: '..n,'コードが変更されています: '..n) end end
 DWK.A[n]=a;registerSymbol('dwkA_'..n,a,true);return a
end
function DWK.player(required)
 local b=DWK.mod();local w=b and q(b+DWK.RVA.world);local g=w and q(w+0x1D8);local ls=g and q(g+0x38);local lp=ls and q(ls);local pc=lp and q(lp+0x30);local p=pc and U.get(pc,'Pawn')
 if p and valid(p) and U.isA(p,'TheCharacter') then
  local x={pawn=p,pc=pc,stat=U.get(p,'PlayerStatComp'),inv=U.get(p,'BPC_InventoryComponent'),move=U.get(p,'CharacterMovement'),craft=U.get(p,'CraftingComponent'),build=U.get(p,'AC_ModularBuilding'),ps=U.get(p,'PlayerState'),gun=U.get(p,'Gun')}
  DWK.P=x;return x
 end
 DWK.P=nil;if required then DWK.err('Load a single-player / host save first.','シングルプレイ／ホストのセーブをロードしてください。') end
end
function DWK.sync()
 local p=DWK.player();local b=DWK.base();if not b then return end
 for idx,key in ipairs({'pawn','stat','inv','move','craft','build','ps','gun'}) do writeQword(b+0x200+(idx-1)*8,p and p[key] or 0) end
end
function DWK.onAttach()
 U.gn=DWK.mod()+DWK.RVA.names;U.go=DWK.mod()+DWK.RVA.objects+0x10
 assert(U.name(0)=='None','Name pool validation');U.refresh();DWK.sync()
 DWK.msg('Reflection ready; gameplay effects are not automatically verified.','リフレクション取得完了。ゲーム内効果の検証完了を意味しません。')
end
local oldInit=DWK.init
function DWK.init() DWK.checkBuild();local r=oldInit();if #U.objects==0 then DWK.onAttach() end;return r end
function DWK.need() DWK.require();local p=DWK.player(true);DWK.sync();if readBytes(p.pawn+0x168,1)~=3 then DWK.err('Host authority required.','ホスト権限が必要です。') end;return p end
DWK.edits={}
function DWK.change(key,a,typ,v,object)
 assert(a and readBytes(a,1),'Invalid memory')
 local tab=DWK.edits[key];if not tab then tab={};DWK.edits[key]=tab end
 if not tab[a] then local n=typ=='double' and 8 or typ=='byte' and 1 or 4;tab[a]={bytes=readBytes(a,n,true),object=object} end
 if typ=='double' then writeDouble(a,v) elseif typ=='float' then writeFloat(a,v) elseif typ=='byte' then writeBytes(a,v) else writeInteger(a,v) end
end
function DWK.restore(key)
 for a,v in pairs(DWK.edits[key] or {}) do if not v.object or valid(v.object) then writeBytes(a,v.bytes) end end;DWK.edits[key]=nil
end
-- PI hooks act on reflected functions, with player/component ownership checks.
function DWK.prepareVM()
 local p=DWK.need();DWK.catalog();DWK.ammoIDs={};for _,it in ipairs(DWK.items) do if it.cat==7 or it.en:lower():find('mm',1,true) or it.en:lower():find('shell',1,true) or it.en:lower():find('arrow',1,true) then DWK.ammoIDs[#DWK.ammoIDs+1]=it.id end end;local b=DWK.base();local rules={}
 local function rule(object,fn,flag,action,extra)
  if not object then return end
  rules[#rules+1]={o=object,fn=U.func(object,fn),flag=flag,action=action or 'skip',extra=extra}
 end
 rule(p.pawn,'FallingDamage',6);rule(p.pawn,'FallingDamage',7)
 rule(p.pawn,'DNZApplyDamage',0);rule(p.pawn,'DNZApplyDamage',1)
 rule(p.inv,'RemoveItemWithID',9,'remain');rule(p.inv,'RemoveItemWithID',8,'ammo')
 -- Materials use the real Blueprint gates below; no ProcessInternal early return.


 DWK.vmRules=rules;local bc=U.find('Default__BP_Master_ModularBuilding_C');DWK.buildFn=bc and U.func(bc,'BuildingProgress');writeQword(b+0x340,U.func(p.pawn,'ReceiveTick'));writeQword(b+0x348,DWK.resolveSig('ProcessEvent'))
 local aa={'[ENABLE]','alloc(dwk_vm,$4000,$SITE)','label(dwk_vm_original)','label(dwk_vm_done)','label(dwk_vm_return)','dwk_vm:','push rax','push r10','mov r10,[rdx+10]'}
 -- Capture local building progress; the timer completes only that interacted building.
 if DWK.buildFn then
  for _,v in ipairs({'label(dwk_build_capture_end)','cmp byte ptr [dwkFlags+B],0','je dwk_build_capture_end',('mov rax,%X'):format(DWK.buildFn),'cmp r10,rax','jne dwk_build_capture_end','mov rax,[rdx+28]','test rax,rax','je dwk_build_capture_end','mov rax,[rax+8]','cmp rax,[dwkPtrs+28]','jne dwk_build_capture_end','mov [dwkFlags+360],rcx','dwk_build_capture_end:'}) do aa[#aa+1]=v end
 end
 if DWK.vmDispatchLines then for _,line in ipairs(DWK.vmDispatchLines())do aa[#aa+1]=line end end
 for idx,r in ipairs(rules) do
  local lab='dwk_vm_next'..idx;aa[#aa+1]='label('..lab..')'
  aa[#aa+1]=('cmp byte ptr [dwkFlags+%X],0'):format(r.flag);aa[#aa+1]='je '..lab
  aa[#aa+1]=('mov rax,%X'):format(r.o);aa[#aa+1]='cmp rcx,rax';aa[#aa+1]='jne '..lab
  aa[#aa+1]=('mov rax,%X'):format(r.fn);aa[#aa+1]='cmp r10,rax';aa[#aa+1]='jne '..lab
  if r.action=='ammo' then
   aa[#aa+1]='mov rax,[rdx+28]';aa[#aa+1]='test rax,rax';aa[#aa+1]='je '..lab
   aa[#aa+1]='mov eax,[rax]';local ids={41,43,143,152};for _,v in ipairs(DWK.ammoIDs or {}) do ids[#ids+1]=v end
   aa[#aa+1]='label(dwk_ammo_match)';for _,id in ipairs(ids) do aa[#aa+1]=('cmp eax,%X'):format(id);aa[#aa+1]='je dwk_ammo_match' end;aa[#aa+1]='jmp '..lab;aa[#aa+1]='dwk_ammo_match:'
  end
  if r.action=='true' then local cl=U.propClass(r.fn,'ReturnValue') or U.propClass(r.fn,'Find?');if cl then aa[#aa+1]='mov rax,[rdx+28]';aa[#aa+1]='test rax,rax';aa[#aa+1]='je '..lab;aa[#aa+1]=('mov byte ptr [rax+%X],1'):format(cl.off) end end
  if r.action=='true' or r.action=='remain' or r.action=='ammo' then aa[#aa+1]='test r8,r8';aa[#aa+1]='je dwk_vm_done';aa[#aa+1]=r.action=='true' and 'mov byte ptr [r8],1' or 'mov dword ptr [r8],0' end
  aa[#aa+1]='jmp dwk_vm_done';aa[#aa+1]=lab..':'
 end
 for _,v in ipairs({'pop r10','pop rax','dwk_vm_original:','$ORIG','jmp dwk_vm_return','dwk_vm_done:','pop r10','pop rax','ret','$SITE:','jmp dwk_vm','$NOP','dwk_vm_return:','[DISABLE]','$SITE:','$ORIG','dealloc(dwk_vm)'}) do aa[#aa+1]=v end
 DWK.HOOKS.vm={sig='ProcessInternal',aa=table.concat(aa,'\n')}
end
function DWK.ensureVM() if not DWK.hookState.vm then DWK.prepareVM();DWK.hookOn('vm') end end
function DWK.toggleOn(k,flag,vm)
 DWK.need();if vm then DWK.ensureVM() end;writeBytes(DWK.flag(flag),1)
end
local oldFeature=DWK.feature
function DWK.feature(k,on)
 if on then
  if k=='noon' or k=='time' then
   local other=k=='noon' and 'time' or 'noon';local id=k=='noon' and 504 or 501;local mr=getAddressList().getMemoryRecordByID(id)
   if mr and mr.Active then mr.Active=false elseif DWK.featOn[other] then oldFeature(other,false) end
  end
  local ok,e=pcall(oldFeature,k,true);if not ok then pcall(oldFeature,k,false);error(e,0) end
 else oldFeature(k,false) end
end
function DWK.survival(field)
 local p=DWK.player();if not p then return end
 if field=='Health' then writeFloat(p.pawn+0x780,100) else local a=U.addr(p.stat,field);if a then writeFloat(a,100) end end
end
function DWK.slots()
 local p=DWK.need();local out={};local roots={};local ic=p.inv
 -- Main legacy slots and equipped slots, then nested inventory grids (S_ItemInventorySlots).
 local function grid(a,n,tag)
  if not a or n&lt;0 or n&gt;20000 then return end
  for idx=0,n-1 do local s=a+idx*28;local id=i(s);local parent=i(s+8)
   if id and id&gt;0 and id&lt;100000 and parent==idx then out[#out+1]={a=s,id=id,key=tag..':'..idx,grid=a,num=n,index=idx} end
  end
 end
 for _,off in ipairs({0xB8,0xA8}) do local a=q(ic+off);local n=i(ic+off+8) or 0;grid(a,n,'base'..off) end
 local arr=q(ic+0xD0);local n=i(ic+0xD8) or 0
 if arr and n&lt;2000 then for idx=0,n-1 do
  if idx~=(i(ic+0xE0) or -1) then
   local item=arr+idx*0x90;local inv=q(item+0x20);local count=i(item+0x28) or 0
   if inv and count&lt;100 then for j=0,count-1 do local g=inv+j*0x28;grid(q(g),i(g+8) or 0,'item'..idx..'grid'..j) end end
   grid(q(item+0x30),i(item+0x38) or 0,'equip'..idx)
  end
 end end
 return out
end
function DWK.catalog()
 if DWK.items then return DWK.items end
 local t=U.find('DT_ItemList','DataTable');local out={};DWK.itemByID={}
 for _,v in ipairs(U.rows(t)) do
  local id=i(v.row);local text=U.text(v.row+0x18) or v.name
  local r={id=id,en=text,ja=text,row=v.row,cat=readBytes(v.row+0x58,1) or 0,stack=i(v.row+0x40) or 1}
  out[#out+1]=r;DWK.itemByID[id]=r
 end
 if #out==0 then DWK.err('Item database not loaded','アイテムデータ未ロード') end
 table.sort(out,function(a,b)return a.id&lt;b.id end);DWK.items=out;return out
end
function DWK.refreshItems(mr)
 DWK.clearChildren(mr);DWK.catalog()
 for _,s in ipairs(DWK.slots()) do
  local it=DWK.itemByID[s.id];local n=(it and DWK.T(it.en,it.ja) or ('ID '..s.id))..' ['..s.key..']'
  local h=DWK.addHdr(mr,n,n);DWK.addRec(h,'Quantity','個数',hx(s.a+4),vtDword);DWK.addRec(h,'Durability','耐久度',hx(s.a+0x10),vtDword);DWK.addRec(h,'Magazine ammo','装填弾数',hx(s.a+0x14),vtDword)
 end
end
function DWK.addItem(id,count)
 local p=DWK.need();DWK.catalog();if not DWK.itemByID[id] then DWK.err('Unknown item ID','不明なアイテムID') end
 local b=DWK.call(p.inv,'AddNewItem',function(a)
  writeInteger(a+8,id);writeInteger(a+12,count);writeBytes(a+16,0);writeInteger(a+52,100)
 end)
 local rem=i(b+64) or 0;DWK.msg(('Add request: ID %d x %d; remaining %d'):format(id,count,rem),('追加要求: ID %d × %d、残数 %d'):format(id,count,rem));return rem
end
DWK.CATS={
 [0]={'General','一般'},[1]={'Rifle','ライフル'},[2]={'Armor','防具'},[3]={'Backpack','バックパック'},[4]={'Relief','レリーフ'},[5]={'Safe','金庫'},[6]={'Magazine','マガジン'},[7]={'Ammo','弾薬'},[8]={'Helmet','ヘルメット'},[9]={'Pistol','拳銃'},[10]={'Sight','照準器'},[11]={'Medicine','医薬品'},[12]={'Money','通貨'},[13]={'Silencer','サイレンサー'},[14]={'Pockets','ポケット'},[15]={'Building','建築'},[16]={'Melee','近接'},[17]={'Equipment','装備'},[18]={'Jacket','上着'},[19]={'Pants','ズボン'},[20]={'Shoes','靴'}
} -- Values verified against E_PermissionType display-name map, not inferred from item IDs.

function DWK.addItemPick()
 DWK.need();local items=DWK.catalog();local cats={};local seen={};for _,v in ipairs(items) do seen[v.cat]=true end
 for c in pairs(seen) do cats[#cats+1]=c end;table.sort(cats)
 local names={DWK.T('All categories','すべてのカテゴリ')};for _,c in ipairs(cats) do local t=DWK.CATS[c] or {'Category '..c,'区分 '..c};names[#names+1]=DWK.T(t[1],t[2]) end
 local ix=DWK.pick(DWK.T('Item category','アイテムカテゴリ'),names);if not ix then return end
 local list={};names={};for _,v in ipairs(items) do if ix==1 or v.cat==cats[ix-1] then list[#list+1]=v;names[#names+1]=('%d | %s'):format(v.id,DWK.T(v.en,v.ja)) end end
 local k=DWK.pick(DWK.T('Item','アイテム'),names);if not k then return end
 local count=DWK.askInt(DWK.T('Add item','アイテム追加'),DWK.T('Quantity','個数'),1,1,9999);if count then DWK.addItem(list[k].id,count) end
end
function DWK.playerEditor(mr)
 DWK.clearChildren(mr);local p=DWK.need()
 local list={{p.pawn,'Health','体力'}, {p.pawn,'Illness','疾病'}, {p.pawn,'Heavyness','重量'}, {p.stat,'Stamina','スタミナ'}, {p.stat,'Hunger','空腹度'}, {p.stat,'Thirst','水分'}, {p.stat,'Energy','エナジー'}, {p.move,'MaxWalkSpeed','最大歩行速度'}, {p.move,'JumpZVelocity','ジャンプ初速'}}
 for _,v in ipairs(list) do local a,pr=U.addr(v[1],v[2]);if a then DWK.addRec(mr,v[2],v[3],hx(a),pr.kind=='DoubleProperty' and vtDouble or vtSingle) end end
 local ps=p.ps;local funds=ps and U.addr(ps,'Funds')
 if funds then DWK.addRec(mr,'Money / Funds','所持金',hx(funds),vtDword) end
end
function DWK.ticketCount()
 local n=0;for _,v in ipairs(DWK.slots()) do if v.id==251 then n=n+(readInteger(v.a+4) or 0)end end;return n
end
function DWK.setMoney(target)
 assert(type(target)=='number' and target%1==0 and target&gt;=0 and target&lt;=1000000,'Ticket count must be 0..1000000')
 DWK.catalog();local it=DWK.itemByID[251];if not it or not it.en:upper():find('TICKET',1,true) then DWK.err('Ticket database identity changed','チケットのデータ同定が変わっています') end
 local current=DWK.ticketCount();local d=target-current;local p=DWK.need()
 if d&gt;0 then DWK.addItem(251,d)
 elseif d&lt;0 then
  local flag=readBytes(DWK.flag(9),1);writeBytes(DWK.flag(9),0)
  local ok,e=pcall(DWK.call,p.inv,'RemoveItemWithID',function(a)writeInteger(a,251);writeInteger(a+4,-d);writeInteger(a+8,-1)end)
  writeBytes(DWK.flag(9),flag);if not ok then error(e,0)end
 end
 local after=DWK.ticketCount();if after~=target then DWK.err(('Ticket count is %d (requested %d). Check inventory space.'):format(after,target),('チケットは%d枚です（指定%d枚）。所持品の空きを確認してください。'):format(after,target)) end
 DWK.msg(('Tickets: %d -&gt; %d'):format(current,after),('チケット: %d枚 → %d枚'):format(current,after));return after
end
function DWK.moneyPick()
 local current=DWK.ticketCount();local n=DWK.askInt(DWK.T('Money / Tickets','所持金／チケット'),DWK.T('Total tickets (current '..current..')','合計枚数（現在 '..current..'枚）'),current,0,1000000)
 if n then DWK.setMoney(n)end
end
function DWK.instant(on)
 if not on then DWK.restore('instant');return end
 local p=DWK.need();local t=U.find('DT_CraftList','DataTable');for _,r in ipairs(U.rows(t)) do DWK.change('instant',r.row+0x18,'float',0.01,t) end
 DWK.change('instant',p.inv+0x168,'double',0.01,p.inv)
end
function DWK.instantTask()
 local p=DWK.player();if not p then return end;local ar=q(p.inv+0x158);local n=i(p.inv+0x160) or 0
 if ar and n&lt;100 then for j=0,n-1 do writeFloat(ar+j*0x20+0x18,0) end end
end
function DWK.speedTask(kind)
 local p=DWK.player();if not p then return end
 local fac=readFloat(DWK.var(kind=='speed' and 0x20 or 0x24)) or 1;fac=math.max(0.1,math.min(fac,20))
 local key=kind
 if kind=='jump' then local a=U.addr(p.move,'JumpZVelocity');local save=DWK.edits[key] and DWK.edits[key][a];local orig=save and byteTableToFloat(save.bytes) or readFloat(a);DWK.change(key,a,'float',orig*fac,p.move)
 else
  -- Apply every reflected gait speed vector on this pawn as well as CharacterMovement limits.
  local c=q(p.pawn+0x10)
  for _,pr in ipairs(U.own(c)) do if pr.kind=='StructProperty' and (pr.name=='WalkSpeeds' or pr.name=='RunSpeeds' or pr.name=='SprintSpeeds' or pr.name=='CrouchSpeeds') and pr.size==24 then
   for off=0,16,8 do local a=p.pawn+pr.off+off;local sv=DWK.edits[key] and DWK.edits[key][a];local v=sv and byteTableToDouble(sv.bytes) or readDouble(a);if v then DWK.change(key,a,'double',v*fac,p.pawn) end end
  end end
  for _,name in ipairs({'MaxWalkSpeed','MaxWalkSpeedCrouched'}) do local a=U.addr(p.move,name);local sv=DWK.edits[key] and DWK.edits[key][a];local v=sv and byteTableToFloat(sv.bytes) or readFloat(a);DWK.change(key,a,'float',v*fac,p.move) end
 end
end
function DWK.floatTask()
 local p=DWK.player();if p and isKeyPressed(VK_SPACE) then local a=U.addr(p.move,'Velocity');local mode=U.addr(p.move,'MovementMode');if a and mode then writeBytes(mode,3);writeDouble(a+16,readFloat(DWK.var(0x28)) or 600) end end
end
function DWK.sky() local s=DWK.skyObj;if not s or not valid(s) then s=U.instance('Ultra_Dynamic_Sky_C');DWK.skyObj=s end;if not s then DWK.err('Sky actor not loaded','空の管理オブジェクト未ロード') end;return s end
function DWK.timeTask(noon)
 local s=DWK.sky();local v=noon and 1200 or readFloat(DWK.var(0x2C));v=math.max(0,math.min(v or 1200,2399))
 DWK.change('time',s+0x600,'byte',0,s);writeDouble(s+0x350,v)
end
function DWK.weatherPick()
 DWK.need();local w=U.instance('Ultra_Dynamic_Weather_C');if not w then DWK.err('Weather actor not loaded','天候管理オブジェクト未ロード') end
 local rows={};local names={};local ja={Clear_Skies='快晴',Partly_Cloudy='晴れ時々曇り',Cloudy='曇り',Overcast='厚い雲',Foggy='霧',Rain_Light='小雨',Rain='雨',Rain_Thunderstorm='雷雨',Snow_Light='小雪',Snow='雪',Snow_Blizzard='吹雪',Sand_Dust_Calm='穏やかな砂塵',Sand_Dust_Storm='砂嵐'}
 for _,o in ipairs(U.objects) do if o.c=='UDS_Weather_Settings_C' and ja[o.n] and valid(o.o) then rows[#rows+1]=o;names[#names+1]=DWK.T(o.n,ja[o.n]) end end
 local k=DWK.pick(DWK.T('Weather preset','天候プリセット'),names);if not k then return end
 local a=U.addr(w,'Random Weather Variation');DWK.change('weather',a,'byte',0,w)
 DWK.call(w,'Change Weather',function(b)writeQword(b,rows[k].o);writeDouble(b+8,0.1)end)
 DWK.wx={o=w,preset=rows[k].o};DWK.msg('Weather selected; enable Freeze weather to keep it.','天候を指定しました。維持する場合は天候固定を有効化してください。')
end
function DWK.weatherTask()
 local x=DWK.wx;if not x or not valid(x.o) or not valid(x.preset) then DWK.err('Select weather first','先に天候を指定してください') end
 local a=U.addr(x.o,'Random Weather Variation');DWK.change('weather',a,'byte',0,x.o)
 if q(x.o+0x320)~=x.preset then DWK.call(x.o,'Change Weather',function(b)writeQword(b,x.preset);writeDouble(b+8,0.1)end) end
end
function DWK.scanSelfTest()
 DWK.require();DWK.checkBuild();for n in pairs(DWK.SIGS) do assert(DWK.resolveSig(n)) end
 DWK.need();DWK.msg('PASS: EXE identity, original code, reflection, local player. Gameplay effects remain separate.','PASS: EXE同定・元コード・リフレクション・実プレイヤー。ゲーム内効果の検証とは別です。')
end
local oldAllOff=DWK.disableAll
function DWK.disableAll(self)
 if DWK.attached() then
  if i(DWK.base()+0x300)==2 then DWK.err('A game call is executing; retry in a moment.','ゲーム関数を実行中です。少し待って再実行してください。') end
  writeInteger(DWK.base()+0x300,0)
  for k in pairs(DWK.featOn) do pcall(DWK.feature,k,false) end
  local keys={} for k in pairs(DWK.edits) do keys[#keys+1]=k end;for _,k in ipairs(keys) do DWK.restore(k) end
 end
 oldAllOff(self)
end
DWK.F={
 god={flag=0,hooks={'damage'},on=function() DWK.toggleOn('god',0,true) end},
 health={flag=1,hooks={'damage'},on=function() DWK.toggleOn('health',1,true) end,task=function()DWK.survival('Health')end},
 stamina={flag=2,hooks={'stamina'},on=function()DWK.need()end,task=function()DWK.survival('Stamina')end},
 hunger={flag=3,hooks={'hunger'},on=function()DWK.need()end,task=function()DWK.survival('Hunger')end},
 thirst={flag=4,hooks={'thirst'},on=function()DWK.need()end,task=function()DWK.survival('Thirst')end},
 stealth={flag=5,hooks={'stealth'},on=function()DWK.need()end},
 ammo={flag=8,hooks={'ammoStore'},on=function()DWK.ammoSnapshots={};DWK.toggleOn('ammo',8,true)end,task=function()DWK.ammoTask()end,off=function()DWK.ammoSnapshots={}end},
 items={flag=9,on=function()DWK.toggleOn('items',9,true)end},
 speed={on=function()DWK.need();DWK.speedTask('speed')end,task=function()DWK.speedTask('speed')end,off=function()DWK.restore('speed')end},
 jump={on=function()DWK.need();DWK.speedTask('jump')end,task=function()DWK.speedTask('jump')end,off=function()DWK.restore('jump')end},
 float={flag=7,on=function()DWK.toggleOn('float',7,true)end,task=DWK.floatTask},
 fall={flag=6,on=function()DWK.toggleOn('fall',6,true)end},
 materials={flag=10,on=function()DWK.materials(true)end,off=function()DWK.materials(false)end},
 instant={on=function()DWK.instant(true)end,off=function()DWK.instant(false)end,task=DWK.instantTask},
 noon={on=function()DWK.need();DWK.timeTask(true)end,task=function()DWK.timeTask(true)end,off=function()if not DWK.featOn.time then DWK.restore('time')end end},
 time={on=function()DWK.need();DWK.timeTask(false)end,task=function()DWK.timeTask(false)end,off=function()if not DWK.featOn.noon then DWK.restore('time')end end},
 weather={on=DWK.weatherTask,task=DWK.weatherTask,off=function()DWK.restore('weather')end},
}
DWK.PTRS={}

function DWK.buildTask()
 local b=DWK.base();local actor=q(b+0x360);if not actor then return end
 writeQword(b+0x360,0);if not valid(actor) or not U.isA(actor,'BP_Master_ModularBuilding_C') then return end
 U.refresh()
 local n=0
 for _,v in ipairs(U.objects) do if v.outer==actor and valid(v.o) and (U.isA(v.o,'BP_ModularBuildingStaticMesh_C') or U.isA(v.o,'BP_ModularBuildingSkeletalMesh_C')) then
  local a=U.addr(v.o,'IsFinished');if a and readBytes(a,1)==0 then if DWK.featOn.materials then local p=DWK.player();DWK.call(actor,'BuildingProgress',function(b)writeQword(b,v.o);writeQword(b+8,p.build);writeQword(b+16,p.craft)end) else DWK.call(v.o,'Finished_Event')end;n=n+1 end
 end end
 DWK.call(actor,'CheckIsBuildingCompleted')
 DWK.msg(('Build completion requested for interacted building (%d components).'):format(n),('操作した建物の完成処理を要求しました（部品%d個）。'):format(n))
end
DWK.F.build={flag=11,on=function()DWK.toggleOn('build',11,true)end,task=DWK.buildTask,off=function()if DWK.base()then writeQword(DWK.base()+0x360,0)end end}


function DWK.ammoTask()
 DWK.ammoSnapshots=DWK.ammoSnapshots or {}
 for _,v in ipairs(DWK.slots()) do
  local k=hx(v.grid)..'/'..v.index..'/'..v.id;local now=readInteger(v.a+0x14) or 0;local old=DWK.ammoSnapshots[k]
  if old and old&gt;now and old&lt;10000 then
   -- Synchronize every occupied grid cell belonging to this item, not just its top-left cell.
   for j=0,v.num-1 do local a=v.grid+j*28;if readInteger(a)==v.id and readInteger(a+8)==v.index then writeInteger(a+0x14,old) end end
  else DWK.ammoSnapshots[k]=now end
 end
end




-- [GAME] 004: ammunition uses BP_WeaponBase.RoundsinChamber, not only legacy AGun.Ammo.
-- Shared UFunction::Invoke dispatcher: local-player weapon consumption and the game's custom fog raid.
local oldHookOn=DWK.hookOn
function DWK.hookOn(name)
 if not DWK.hookState[name] then
  local h=assert(DWK.HOOKS[name]);local sg=assert(DWK.SIGS[h.sig]);local a=DWK.resolveSig(h.sig);local b=readBytes(a,sg.len,true)
  for j=1,sg.len do if not b or b[j]~=sg.bytes[j] then
   DWK.err('Another table or tool already patches '..h.sig..'. Run ALL OFF in the old table before loading this revision.',
    '別のテーブル／ツールが '..h.sig..' を変更中です。旧CTの「一括解除」を実行してから修正版を開いてください。')
  end end
 end
 return oldHookOn(name)
end
function DWK.prepareDispatch()
 DWK.need();local b=DWK.base();local weapon=U.find('Default__BP_WeaponBase_C');if not weapon then DWK.err('Weapon base class missing','武器基底クラス未検出')end
 local ammoFn=U.func(weapon,'AmmoUpdate');local nei=U.prop(weapon,'Nei');local chamber=U.prop(weapon,'RoundsinChamber')
 if not nei or nei.kind~='ObjectProperty' or not chamber or chamber.kind~='IntProperty' then DWK.err('Weapon ownership/ammo layout changed','武器の所有者・弾構造が変更されています')end
 DWK.weaponAmmo={fn=ammoFn,ownerOffset=nei.off,chamberOffset=chamber.off}
 local sky=DWK.sky();local gm=U.instance('BP_ADASomeoneHearsGameMode_C')
 if not gm then DWK.err('Fog-event game mode missing','霧イベントのゲームモード未検出')end
 local skyGraph=U.func(sky,'ExecuteUbergraph_Ultra_Dynamic_Sky');local gmGraph=U.func(gm,'ExecuteUbergraph_BP_ADASomeoneHearsGameMode')
 local skyFns={};local entries={};local seen={}
 local function addEntry(v) if not seen[v]then entries[#entries+1]=v;seen[v]=true end end
 for _,n in ipairs({'FogZombie','PlaySisSound','Fogging__FinishedFunc','Fogging__UpdateFunc','Timeline__FinishedFunc','Timeline__UpdateFunc'})do
  local f=U.func(sky,n);skyFns[#skyFns+1]=f
  local d=q(f+0x60);local size=i(f+0x68)
  if size~=18 or readBytes(d,1)~=0x46 or q(d+1)~=skyGraph or readBytes(d+9,1)~=0x1D then DWK.err('Fog event thunk changed: '..n,'霧イベントの呼出し形式が変更: '..n)end
  addEntry(i(d+10))
 end
 -- Derive the two fog-only latent continuation offsets from their distinct UUIDs in the graph.
 local data=q(skyGraph+0x60);local length=i(skyGraph+0x68);local bytes=readBytes(data,length,true)
 local function u32(t,o)return t[o]+(t[o+1]&lt;&lt;8)+(t[o+2]&lt;&lt;16)+(t[o+3]&lt;&lt;24)end
 local found={}
 for j=1,#bytes-9 do if bytes[j]==0x5B and bytes[j+5]==0x1D then
  local uuid=u32(bytes,j+6)
  if uuid==0x95B555CD or uuid==0x389E9F84 then found[uuid]=u32(bytes,j+1);addEntry(found[uuid]) end
 end end
 if not found[0x95B555CD] or not found[0x389E9F84] then DWK.err('Fog latent continuations changed','霧イベントの遅延再開地点が変更されています')end
 local spawnFn=U.func(gm,'SpawnZombies');local sb=q(spawnFn+0x60);local sn=i(spawnFn+0x68);local spawnEntry
 for j=0,sn-14 do if readBytes(sb+j,1)==0x46 and q(sb+j+1)==gmGraph and readBytes(sb+j+9,1)==0x1D then spawnEntry=i(sb+j+10);break end end
 if not spawnEntry then DWK.err('Horde spawn event changed','大量出現イベントの呼出し形式が変更されています')end
 DWK.raidInfo={sky=sky,gm=gm,skyGraph=skyGraph,gmGraph=gmGraph,skyFns=skyFns,entries=entries,spawnFn=spawnFn,spawnEntry=spawnEntry}
 -- Runtime pointer slots prevent stale hard-coded UObject addresses in the assembled hook.
 writeQword(b+0x3C0,ammoFn);writeQword(b+0x3D0,sky);writeQword(b+0x3D8,skyGraph);writeQword(b+0x3E0,gm);writeQword(b+0x3E8,spawnFn);writeQword(b+0x3F0,gmGraph)
 for j,f in ipairs(skyFns)do writeQword(b+0x400+(j-1)*8,f)end
 local aa={'[ENABLE]','alloc(dwk_dispatch,$2000,$SITE)','label(dwk_dispatch_orig)','label(dwk_dispatch_return)','label(dwk_dispatch_raid)','label(dwk_dispatch_gm)','label(dwk_dispatch_block_ammo)','label(dwk_dispatch_block_raid)','label(dwk_dispatch_block)','dwk_dispatch:','pushfq','push rax','push r10',

 'dwk_dispatch_raid:','cmp byte ptr [dwkFlags+C],0','je dwk_dispatch_orig','cmp rdx,[dwkFlags+3D0]','jne dwk_dispatch_gm'}
 for j=1,#skyFns do aa[#aa+1]=('cmp rcx,[dwkFlags+%X]'):format(0x400+(j-1)*8);aa[#aa+1]='je dwk_dispatch_block_raid' end
 for _,v in ipairs({'cmp rcx,[dwkFlags+3D8]','jne dwk_dispatch_orig','mov rax,[r8+28]','test rax,rax','je dwk_dispatch_orig','mov r10d,[rax]'})do aa[#aa+1]=v end
 for _,ep in ipairs(entries)do aa[#aa+1]=('cmp r10d,%X'):format(ep);aa[#aa+1]='je dwk_dispatch_block_raid'end
 for _,v in ipairs({'jmp dwk_dispatch_orig','dwk_dispatch_gm:','cmp rdx,[dwkFlags+3E0]','jne dwk_dispatch_orig','cmp rcx,[dwkFlags+3E8]','je dwk_dispatch_block_raid','cmp rcx,[dwkFlags+3F0]','jne dwk_dispatch_orig','mov rax,[r8+28]','test rax,rax','je dwk_dispatch_orig',('cmp dword ptr [rax],%X'):format(spawnEntry),'je dwk_dispatch_block_raid','jmp dwk_dispatch_orig',
 'dwk_dispatch_block_ammo:','lock inc dword ptr [dwkFlags+3A0]','jmp dwk_dispatch_block','dwk_dispatch_block_raid:','lock inc dword ptr [dwkFlags+3A4]','mov [dwkFlags+3A8],rcx','dwk_dispatch_block:','pop r10','pop rax','popfq','ret',
 'dwk_dispatch_orig:','pop r10','pop rax','popfq','$ORIG','jmp dwk_dispatch_return','$SITE:','jmp dwk_dispatch','$NOP','dwk_dispatch_return:','[DISABLE]','$SITE:','$ORIG','dealloc(dwk_dispatch)'})do aa[#aa+1]=v end
 DWK.HOOKS.dispatch={sig='Invoke',aa=table.concat(aa,'\n')}
end
function DWK.ensureDispatch()
 if DWK.hookState.dispatch then return end
 DWK.prepareDispatch();DWK.hookOn('dispatch')
end
function DWK.releaseDispatch()
 if not DWK.featOn.ammo and not DWK.featOn.raid then DWK.hookOff('dispatch')end
end
local oldAmmoOn=DWK.F.ammo.on
local oldAmmoOff=DWK.F.ammo.off
DWK.F.ammo.on=function()DWK.ensureDispatch();oldAmmoOn()end
DWK.F.ammo.off=function()if oldAmmoOff then oldAmmoOff()end;DWK.releaseDispatch()end
function DWK.stopRaidFog()
 local st=DWK.raidInfo;assert(st,'Raid hook not prepared')
 for _,n in ipairs({'Fogging','Timeline'})do local t=U.get(st.sky,n);if t and valid(t)then DWK.call(t,'Stop')end end
 local a,pr=U.addr(st.sky,'Base Fog Density');local cdo=U.find('Default__Ultra_Dynamic_Sky_C')
 if not a or not cdo or pr.kind~='DoubleProperty' then DWK.err('Fog density layout changed','霧密度の構造が変更されています')end
 local density=readDouble(cdo+pr.off);if not density or density&lt;0 or density&gt;0.1 then DWK.err('Invalid default fog density','標準霧密度が不正です')end
 DWK.change('raid',a,'double',density,st.sky)
 DWK.msg('Fog/horde event blocked; its two fog timelines stopped. Existing enemies are not deleted.',
  '霧・大量襲撃イベントを遮断し、専用の霧演出2本を停止しました。既に出現した敵は削除しません。')
end
DWK.F.raid={flag=12,on=function()DWK.need();DWK.ensureDispatch();writeBytes(DWK.flag(12),1);DWK.stopRaidFog()end,
 off=function()DWK.restore('raid');DWK.releaseDispatch()end}


-- UE's local Blueprint calls can bypass UFunction::Invoke. Apply the identical semantic guards
-- at ProcessInternal too, where every such Blueprint function actually executes.
function DWK.vmDispatchLines()
 local st=assert(DWK.raidInfo);local weapon=assert(DWK.weaponAmmo)
 local aa={'label(dwk_vmd_raid)','label(dwk_vmd_gm)','label(dwk_vmd_orig)','label(dwk_vmd_ammo_block)','label(dwk_vmd_raid_block)','label(dwk_vmd_block)',

 'dwk_vmd_raid:','cmp byte ptr [dwkFlags+C],0','je dwk_vmd_orig','cmp rcx,[dwkFlags+3D0]','jne dwk_vmd_gm'}
 for j=1,#st.skyFns do aa[#aa+1]=('cmp r10,[dwkFlags+%X]'):format(0x400+(j-1)*8);aa[#aa+1]='je dwk_vmd_raid_block'end
 for _,v in ipairs({'cmp r10,[dwkFlags+3D8]','jne dwk_vmd_orig','mov rax,[rdx+28]','test rax,rax','je dwk_vmd_orig'})do aa[#aa+1]=v end
 for _,ep in ipairs(st.entries)do aa[#aa+1]=('cmp dword ptr [rax],%X'):format(ep);aa[#aa+1]='je dwk_vmd_raid_block'end
 for _,v in ipairs({'jmp dwk_vmd_orig','dwk_vmd_gm:','cmp rcx,[dwkFlags+3E0]','jne dwk_vmd_orig','cmp r10,[dwkFlags+3E8]','je dwk_vmd_raid_block','cmp r10,[dwkFlags+3F0]','jne dwk_vmd_orig','mov rax,[rdx+28]','test rax,rax','je dwk_vmd_orig',('cmp dword ptr [rax],%X'):format(st.spawnEntry),'je dwk_vmd_raid_block','jmp dwk_vmd_orig',
 'dwk_vmd_ammo_block:','lock inc dword ptr [dwkFlags+3A0]','jmp dwk_vmd_block','dwk_vmd_raid_block:','lock inc dword ptr [dwkFlags+3A4]','mov [dwkFlags+3A8],r10','dwk_vmd_block:','pop r10','pop rax','ret','dwk_vmd_orig:'})do aa[#aa+1]=v end
 return aa
end
local prepareVMbefore004=DWK.prepareVM
function DWK.prepareVM()DWK.prepareDispatch();return prepareVMbefore004()end
-- 004 ammunition assignment guard: evaluates Blueprint RHS normally, then suppresses decreases
-- only for exact RoundsinMag/RoundsinChamber addresses of the local player's weapon-slot objects.
function DWK.refreshAmmoWatch()
 local p=DWK.player();local out={}
 if p then
  local a,pr=U.addr(p.pawn,'WeaponSlots');local ar=a and q(a);local n=a and i(a+8) or 0
  if ar and n and n&lt;=64 then
   local inner=q(pr.f+0x78);local stride=inner and i(inner+0x34)
   if stride~=0x20 then DWK.err('Weapon-slot stride changed','武器スロットの構造が変更されています')end
   for j=0,n-1 do local w=q(ar+j*stride)
    if w and valid(w) and U.isA(w,'BP_WeaponBase_C') and U.get(w,'Nei')==p.pawn then
     for _,name in ipairs({'RoundsinMag','RoundsinChamber'})do local addr,v=U.addr(w,name);if addr and v.kind=='IntProperty' then out[#out+1]=addr end end
    end
   end
  end
 end
 if #out&gt;24 then DWK.err('Too many weapon ammo fields','武器の弾数フィールドが多すぎます')end
 local keys={}for _,a in ipairs(out)do keys[#keys+1]=hx(a)end;local key=table.concat(keys,',')
 if DWK.ammoWatchKey~=key then
  local b=DWK.base();writeInteger(b+0x43C,0);for j,a in ipairs(out)do writeQword(b+0x440+(j-1)*8,a)end
  writeInteger(b+0x43C,#out);DWK.ammoWatchKey=key
 end
 return out
end
DWK.HOOKS.ammoAssign={sig='AmmoAssign',aa=[==[
[ENABLE]
alloc(dwk_ammo_assign,$1000,$SITE)
label(dwk_ammo_assign_orig)
label(dwk_ammo_assign_loop)
label(dwk_ammo_assign_match)
label(dwk_ammo_assign_capture)
label(dwk_ammo_assign_commit)
label(dwk_ammo_assign_skip)
label(dwk_ammo_assign_return)
dwk_ammo_assign:
 cmp byte ptr [dwkFlags+8],0
 je dwk_ammo_assign_orig
 mov r10d,[dwkFlags+43C]
 test r10d,r10d
 jz dwk_ammo_assign_orig
 cmp r10d,18
 ja dwk_ammo_assign_orig
 lea r11,[dwkFlags+440]
dwk_ammo_assign_loop:
 cmp r8,[r11]
 je dwk_ammo_assign_match
 add r11,8
 dec r10d
 jnz dwk_ammo_assign_loop
 jmp dwk_ammo_assign_orig
dwk_ammo_assign_match:
 // Paired entries: magazine first, chamber second. A loaded chamber is held exactly.
dwk_ammo_assign_capture:
 sub rsp,40
 mov [rsp+20],r8
 mov r10,r11
 and r10d,8
 mov [rsp+30],r10d
 lea r8,[rsp+28]
 call qword ptr [r9+rax*8]
 mov r10,[rsp+20]
 mov eax,[rsp+28]
 cmp eax,[r10]
 jl dwk_ammo_assign_skip
 cmp dword ptr [rsp+30],8
 jne dwk_ammo_assign_commit
 cmp dword ptr [r10],0
 jg dwk_ammo_assign_skip
dwk_ammo_assign_commit:
 mov [r10],eax
 add rsp,40
 test rdi,rdi
 jmp dwk_ammo_assign_return
dwk_ammo_assign_skip:
 lock inc dword ptr [dwkFlags+3B8]
 add rsp,40
 test rdi,rdi
 jmp dwk_ammo_assign_return
dwk_ammo_assign_orig:
 $ORIG
 jmp dwk_ammo_assign_return
$SITE:
 jmp dwk_ammo_assign
 $NOP
dwk_ammo_assign_return:
[DISABLE]
$SITE:
 $ORIG
 dealloc(dwk_ammo_assign)
]==]}
DWK.F.ammo.hooks={'ammoStore','ammoAssign'}
DWK.F.ammo.on=function()DWK.ammoWatchKey=nil;DWK.refreshAmmoWatch();oldAmmoOn()end
local syncBeforeAmmoAssign=DWK.sync
function DWK.sync()syncBeforeAmmoAssign();if DWK.featOn.ammo then DWK.refreshAmmoWatch()end end

-- 007: intercept the actual graph entry jump; local Blueprint fast calls bypass ProcessInternal.
function DWK.prepareFall()
 local p=DWK.need();local fn=DWK.U.func(p.pawn,'FallingDamage');local d=readQword(fn+0x60)
 if readInteger(fn+0x68)~=18 or readBytes(d,1)~=0x46 or readBytes(d+9,1)~=0x1D then DWK.err('Fall event thunk changed','落下イベントの構造が変更されています')end
 local graph=readQword(d+1);local script=readQword(graph+0x60);local size=readInteger(graph+0x68);local ep=readInteger(d+10)
 if not script or size&lt;3 or ep&lt;0 or ep+5&gt;size or readBytes(script+ep,1)~=6 or readBytes(script+size-3,1)~=4 or readBytes(script+size-2,1)~=0x0B or readBytes(script+size-1,1)~=0x53 then DWK.err('Fall graph entry/return changed','落下処理の入口・終了位置が変更されています')end
 local b=DWK.base();writeQword(b+0x370,graph);writeQword(b+0x378,script+ep+1);writeQword(b+0x380,script+size-3)
 DWK.fallInfo={pawn=p.pawn,graph=graph,code=script+ep+1,exit=script+size-3}
end
DWK.HOOKS.fallEntry={sig='FallJump',aa=[==[
[ENABLE]
alloc(dwk_fall_entry,$1000,$SITE)
label(dwk_fall_orig)
label(dwk_fall_check)
label(dwk_fall_return)
dwk_fall_entry:
 pushfq
 push rax
 cmp byte ptr [dwkFlags+6],0
 jne dwk_fall_check
 cmp byte ptr [dwkFlags+7],0
 je dwk_fall_orig
dwk_fall_check:
 cmp rcx,[dwkPtrs]
 jne dwk_fall_orig
 mov rax,[rdx+10]
 cmp rax,[dwkFlags+370]
 jne dwk_fall_orig
 mov rax,[rdx+20]
 cmp rax,[dwkFlags+378]
 jne dwk_fall_orig
 mov rax,[dwkFlags+380]
 mov [rdx+20],rax
 lock inc dword ptr [dwkFlags+388]
 pop rax
 popfq
 ret
dwk_fall_orig:
 pop rax
 popfq
 $ORIG
 jmp dwk_fall_return
$SITE:
 jmp dwk_fall_entry
 $NOP
dwk_fall_return:
[DISABLE]
$SITE:
 $ORIG
 dealloc(dwk_fall_entry)
]==]}
for _,key in ipairs({'fall','float'})do
 local f=DWK.F[key];local prior=f.on;f.hooks={'fallEntry'}
 f.on=function()DWK.prepareFall();prior()end
 local task=f.task
 f.task=function()local p=DWK.player();if p and (not DWK.fallInfo or p.pawn~=DWK.fallInfo.pawn)then DWK.prepareFall()end;if task then task()end end
end

-- 008: preserve recipe identity; virtual recipe selection feeds the normal inventory craft button.
function DWK.prepareFreeCraft()
 local p=DWK.need();local c=DWK.U.find('Default__W_Crafting_C');local fn=DWK.U.func(c,'CheckCrafts');local d=readQword(fn+0x60);local n=readInteger(fn+0x68)
 if n~=1289 or readBytes(d,1)~=0x4C or readBytes(d+n-3,1)~=4 or readBytes(d+n-2,1)~=0x0B then DWK.err('Inventory craft checker changed','所持品クラフト判定の構造が変更されています')end
 for _,x in ipairs({{'bCanMake',0},{'ID',4}})do local pr=DWK.U.propClass(fn,x[1]);if not pr or pr.off~=x[2]then DWK.err('Craft output layout changed','クラフト判定の出力構造が変更されています')end end
 local b=DWK.base();writeQword(b+0x390,fn);writeQword(b+0x398,d+1);writeQword(b+0x3B0,d+n-3)
 DWK.freeRecipes={};DWK.catalog();local t=DWK.U.find('CraftingDataTable','DataTable')
 for _,r in ipairs(DWK.U.rows(t))do local id=readInteger(r.row+0x10);local it=DWK.itemByID[id];if it then DWK.freeRecipes[#DWK.freeRecipes+1]={id=id,en=it.en,ja=it.ja}end end
 table.sort(DWK.freeRecipes,function(a,b)return a.id&lt;b.id end);assert(#DWK.freeRecipes&gt;0,'No inventory recipes')
end
function DWK.materialsTask()
 local p=DWK.player();if not p then return end
 local h=DWK.materialHUD
 if not h or DWK.U.get(h,'Character')~=p.pawn then
  h=nil
  for _,x in ipairs(DWK.U.objects)do if x.c=='WBP_HUDCraft_C' and not x.n:find('Default__',1,true) and DWK.U.get(x.o,'Character')==p.pawn then h=x.o;break end end
  DWK.materialHUD=h
 end
 local id=0
 if h then
  for _,pr in ipairs(DWK.U.own(readQword(h+0x10)))do
   if pr.kind=='ObjectProperty' and pr.name=='WBP_Item' then
    local item=readQword(h+pr.off)
    if item and item&gt;0 then
     local a,bp=DWK.U.addr(item,'N_Selected?')
     if a and (readBytes(a,1)&amp;readBytes(bp.f+0x72,1))~=0 then
      local row=DWK.U.addr(item,'RowName');local name=row and DWK.U.name(readInteger(row));id=(DWK.freeRowIDs or {})[name] or 0;break
     end
    end
   end
  end
 end
 DWK.freeCraftID=id;writeInteger(DWK.base()+0x38C,id)
end
function DWK.patchMaterialGate(obj,name,outName)
 local fn=DWK.U.func(obj,name);local data=readQword(fn+0x60);local n=readInteger(fn+0x68);local bytes
 if outName then
  local p=DWK.U.propClass(fn,outName);assert(p and p.kind=='BoolProperty','Material bool output changed')
  if readSmallInteger(fn+0xB8)~=0xFFFF then bytes=string.char(4,0x27,0x53)
  else bytes=string.char(0x14,0x48)..string.pack('&lt;I8',p.f)..string.char(0x27,4,0x0B,0x53)end
 else bytes=string.char(4,0x0B,0x53)end
 assert(n&gt;=#bytes,'Material function too small')
 for j=1,#bytes do DWK.change('materials',data+j-1,'byte',bytes:byte(j),fn)end
end
DWK.HOOKS.freeCraft={sig='CraftFlow',aa=[==[
[ENABLE]
alloc(dwk_free_craft,$1000,$SITE)
label(dwk_free_craft_orig)
label(dwk_free_craft_return)
label(dwk_free_out_loop)
label(dwk_free_out_id)
label(dwk_free_out_next)
label(dwk_free_out_done)
dwk_free_craft:
 pushfq
 push rax
 cmp byte ptr [dwkFlags+A],0
 je dwk_free_craft_orig
 cmp dword ptr [dwkFlags+38C],0
 jle dwk_free_craft_orig
 mov rax,[rdx+10]
 cmp rax,[dwkFlags+390]
 jne dwk_free_craft_orig
 mov rax,[rdx+20]
 cmp rax,[dwkFlags+398]
 jne dwk_free_craft_orig
 mov rax,[rcx+328]
 cmp rax,[dwkPtrs]
 jne dwk_free_craft_orig
 // A virtual recipe never consumes a real item. Leave normal input recipes untouched.
 cmp dword ptr [rcx+318],0
 jne dwk_free_craft_orig
 cmp dword ptr [rcx+388],0
 jne dwk_free_craft_orig
 mov rax,[rdx+28]
 test rax,rax
 je dwk_free_craft_orig
 mov byte ptr [rax],1
 push r10
 mov r10d,[dwkFlags+38C]
 mov [rax+4],r10d
 pop r10
 // Blueprint out parameters may alias caller storage instead of Locals.
 push r10
 push r11
 mov r10,[rdx+80]
dwk_free_out_loop:
 test r10,r10
 je dwk_free_out_done
 mov r11,[r10]
 mov rax,[r10+8]
 cmp dword ptr [r11+44],0
 jne dwk_free_out_id
 mov byte ptr [rax],1
 jmp dwk_free_out_next
dwk_free_out_id:
 cmp dword ptr [r11+44],4
 jne dwk_free_out_next
 mov r11d,[dwkFlags+38C]
 mov [rax],r11d
 jmp dwk_free_out_next
dwk_free_out_next:
 mov r10,[r10+10]
 jmp dwk_free_out_loop
dwk_free_out_done:
 pop r11
 pop r10
 mov rax,[dwkFlags+3B0]
 mov [rdx+20],rax
 lock inc dword ptr [dwkFlags+3BC]
 pop rax
 popfq
 ret
dwk_free_craft_orig:
 pop rax
 popfq
 $ORIG
 jmp dwk_free_craft_return
$SITE:
 jmp dwk_free_craft
 $NOP
dwk_free_craft_return:
[DISABLE]
$SITE:
 $ORIG
 dealloc(dwk_free_craft)
]==]}
DWK.F.materials.hooks={'freeCraft'}
function DWK.materials(on)
 if not on then DWK.restore('materials');writeInteger(DWK.base()+0x38C,0);DWK.materialHUD=nil;return end
 local p=DWK.need();DWK.U.refresh();DWK.prepareFreeCraft();DWK.freeRowIDs={}
 local t=DWK.U.find('CraftingDataTable','DataTable');for _,r in ipairs(DWK.U.rows(t))do DWK.freeRowIDs[r.name]=readInteger(r.row+0x10)end
 -- Keep recipe identity and quantities intact. Patch the actual gates and the material-removal operation.
 DWK.patchMaterialGate(p.craft,'CheckItem','ReturnValue')
 DWK.patchMaterialGate(p.build,'CheckTheItem','Find?')
 DWK.patchMaterialGate(p.craft,'RemoveItemForCraft')
 -- The inventory craft controller routes its result to an equipment slot by default.
 -- Route the existing server add operation to normal inventory placement instead.
 local graph=DWK.U.func(p.pc,'ExecuteUbergraph_ADA_PlayerController');local data=readQword(graph+0x60);local size=readInteger(graph+0x68);local matches={}
 for j=0,size-23 do
  if readBytes(data+j,1)==0x1B and DWK.U.name(readInteger(data+j+1))=='AddNewItem ( SERVER )' and readBytes(data+j+13,1)==0 and (readBytes(data+j+22,1)==0x27 or readBytes(data+j+22,1)==0x28) then matches[#matches+1]=data+j+22 end
 end
 assert(#matches==1,'Inventory craft destination changed')
 DWK.change('materials',matches[1],'byte',0x28,graph)
 DWK.toggleOn('materials',10,true);DWK.materialsTask()
end
DWK.F.materials.task=DWK.materialsTask


-- 009: retain requested features across save reload / respawn; resolve every instance-dependent target again.
DWK.reloadState={};DWK.taskErrors={}
-- Old levels may remain valid until garbage collection; only select actors in the current UWorld.
function DWK.U.instance(className)
 local world=readQword(DWK.mod()+DWK.RVA.world);if not world or world==0 then return end
 for _,x in ipairs(DWK.U.objects)do
  if x.c==className and not x.n:find('Default__',1,true) and not x.n:find('GEN_VARIABLE',1,true)then
   local outer=readQword(x.o+0x20)
   if outer and outer~=0 and DWK.U.c(outer)=='Level' and readQword(outer+0x20)==world and DWK.U.c(x.o)==className then
    local idx=readInteger(x.o+0xC);local count=readInteger(DWK.U.go+0x14)
    if idx and count and idx&lt;count then local chunks=readQword(DWK.U.go);local chunk=chunks and readQword(chunks+(idx//65536)*8);if chunk and readQword(chunk+(idx%65536)*24)==x.o then return x.o end end
   end
  end
 end
end
function DWK.runtimeKey(p)
 local world=readQword(DWK.mod()+DWK.RVA.world) or 0
 local v={string.format('%X',world)}
 for _,k in ipairs({'pawn','stat','inv','move','craft','build','pc','ps'})do v[#v+1]=string.format('%X',p[k] or 0)end
 return table.concat(v,':')
end
function DWK.rebindRuntime(p)
 local U=DWK.U;local b=DWK.base();local vm=DWK.hookState.vm~=nil or DWK.reloadState.wantVM;local dispatch=DWK.hookState.dispatch~=nil or DWK.reloadState.wantDispatch
 DWK.reloadState.wantVM=vm;DWK.reloadState.wantDispatch=dispatch
 local weatherName=DWK.weatherPresetName
 if not weatherName and DWK.wx and DWK.wx.preset then local ok,n=pcall(U.n,DWK.wx.preset);if ok and n~='?'then weatherName=n end end
 U.names={};U.props={};U.refresh();DWK.skyObj=nil;DWK.items=nil;DWK.itemByID=nil;DWK.ammoWatchKey=nil;DWK.ammoSnapshots={}
 -- Rebuild before replacing code. The dedicated native protection hooks stay installed.
 DWK.prepareVM()
 if vm then DWK.hookOff('vm');DWK.hookOn('vm')end
 if dispatch then DWK.hookOff('dispatch');DWK.hookOn('dispatch')end
 if DWK.mapState and DWK.mapClose then DWK.mapClose()end
 if DWK.featOn.fall or DWK.featOn.float then DWK.prepareFall()end
 if DWK.featOn.materials then DWK.prepareFreeCraft();if DWK.freeCraftID then writeInteger(b+0x38C,DWK.freeCraftID)end;DWK.materials(true)end
 if DWK.featOn.moneydrop then DWK.prepareMoneyDrop()end
 if DWK.featOn.instant then DWK.instant(true)end
 if DWK.featOn.weather then
  if not weatherName then DWK.err('Reload: weather selection is missing','再ロード: 天候の選択情報がありません')end
  local preset=U.find(weatherName,'UDS_Weather_Settings_C');local actor=U.instance('Ultra_Dynamic_Weather_C')
  if not preset or not actor then DWK.err('Reload: waiting for weather actors','再ロード: 天候オブジェクトのロード待機中')end
  DWK.wx={o=actor,preset=preset};DWK.weatherPresetName=weatherName
 end
 if DWK.featOn.raid then DWK.stopRaidFog()end
 local al=getAddressList()
 local ed=al and al.getMemoryRecordByID(201);if ed and ed.Count&gt;0 then DWK.playerEditor(ed)end
 local inv=al and al.getMemoryRecordByID(301);if inv and inv.Count&gt;0 then DWK.refreshItems(inv)end
 DWK.sync();DWK.reloadState.bound=DWK.runtimeKey(p);DWK.reloadState.waiting=false;DWK.reloadState.lastError=nil;DWK.reloadState.wantVM=nil;DWK.reloadState.wantDispatch=nil
 DWK.msg('Reload complete: active features rebound to the current player/world.','ロード後のプレイヤー・ワールドへ、有効な機能を再接続しました。')
end
function DWK.tick()
 if not DWK.pid then return end
 if getOpenedProcessID()~=DWK.pid or getProcessIDFromProcessName(DWK.EXE)~=DWK.pid then DWK.forgetProcess();return end
 local st=DWK.reloadState;local playerOK,p=pcall(DWK.player);local syncOK=pcall(DWK.sync)
 if not playerOK or not syncOK then
  st.waiting=true;local b=DWK.base();if b then for j=0,7 do writeQword(b+0x200+j*8,0)end;writeInteger(b+0x43C,0)end
  return
 end
 if not p or not p.stat or not p.inv or not p.move or not p.craft or not p.build then
  st.waiting=true
  -- A queued call addressed to an unloaded instance must not run on the next pawn.
  local b=DWK.base();if b and readInteger(b+0x300)==1 then writeInteger(b+0x300,0)end
  return
 end
 local key=DWK.runtimeKey(p);local now=getTickCount()
 if st.waiting or st.bound~=key then
  if st.retryAt and now&lt;st.retryAt then return end
  local b=DWK.base();if readInteger(b+0x300)==2 then return end
  if readInteger(b+0x300)==1 then writeInteger(b+0x300,0)end
  local ok,e=pcall(DWK.rebindRuntime,p)
  if not ok then
   st.waiting=true;st.retryAt=now+1000
   if st.lastError~=tostring(e)then DWK.msg('Reload pending: '..tostring(e),'再接続待機: '..tostring(e));st.lastError=tostring(e)end
   return
  end
  st.retryAt=nil
 end
 if DWK.mapClosePending and DWK.mapClose and (not DWK.mapCloseRetry or now&gt;=DWK.mapCloseRetry)then local ok=pcall(DWK.mapClose);if not ok then DWK.mapCloseRetry=now+1000 else DWK.mapCloseRetry=nil end end
 for k in pairs(DWK.featOn)do
  local f=DWK.F[k]
  if f and f.task then
   local ok,e=pcall(f.task)
   if not ok then
    -- Temporary loading / pause errors do not turn off the user's checkbox or feature flags.
    local er=DWK.taskErrors[k];if not er or er.message~=tostring(e) or now-er.time&gt;5000 then DWK.msg(k..': '..tostring(e),k..': '..tostring(e));DWK.taskErrors[k]={message=tostring(e),time=now}end
   else DWK.taskErrors[k]=nil end
  end
 end
end
local weatherPickBefore009=DWK.weatherPick
function DWK.weatherPick()weatherPickBefore009();if DWK.wx and DWK.wx.preset then DWK.weatherPresetName=DWK.U.n(DWK.wx.preset)end end
local forgetBefore009=DWK.forgetProcess
function DWK.forgetProcess()forgetBefore009();DWK.reloadState={};DWK.taskErrors={};DWK.skyObj=nil;DWK.wx=nil;DWK.weatherPresetName=nil;DWK.fallInfo=nil;DWK.raidInfo=nil;DWK.ammoWatchKey=nil end

-- 009: wire the installed IA_Map=M action to the game's existing textured world-map widget.
local function mapBool(key,obj,name,on)
 local a,p=DWK.U.addr(obj,name);if not a or p.kind~='BoolProperty'then DWK.err('Map flag missing: '..name,'マップ用フラグ未検出: '..name)end
 local mask=readBytes(p.f+0x72,1);assert(mask and mask&gt;0,'Invalid bool mask');local v=readBytes(a,1)
 DWK.change(key,a,'byte',on and(v|mask)or(v&amp;(~mask&amp;255)),obj)
end
function DWK.mapWidget()
 local world=readQword(DWK.mod()+DWK.RVA.world);local gi=world and readQword(world+0x1D8)
 for _,x in ipairs(DWK.U.objects)do
  if x.c=='WBP_WorldMap_C' and not x.n:find('Default__',1,true) and readQword(x.o+0x20)==gi and DWK.U.c(x.o)=='WBP_WorldMap_C'then return x.o end
 end
 DWK.err('The existing world-map widget is not loaded.','ゲームの既存マップ画面が未ロードです。')
end
function DWK.mapClose()
 local st=DWK.mapState;if not st then DWK.mapClosePending=nil;return end
 DWK.mapClosePending=true;DWK.restore('mapUI')
 for _,v in ipairs(st.layouts or {})do DWK.checkedObject(v.slot);DWK.call(v.slot,'SetLayout',function(a)writeBytes(a,v.bytes)end)end
 DWK.call(st.widget,'RemoveFromParent')
 local p=DWK.player()
 if p and p.pc==st.pc then
  if st.look then DWK.call(st.pc,'SetIgnoreLookInput',function(a)writeBytes(a,0)end);st.look=false end
  if st.move then DWK.call(st.pc,'SetIgnoreMoveInput',function(a)writeBytes(a,0)end);st.move=false end
  DWK.call(DWK.U.find('Default__WidgetBlueprintLibrary'),'SetInputMode_GameOnly',function(a)writeQword(a,st.pc)end)
 end
 DWK.restore('mapUI');DWK.mapState=nil;DWK.mapClosePending=nil
end
function DWK.mapToggle()
 if DWK.mapState then DWK.mapClose();return end
 local p=DWK.need();for _,name in ipairs({'bIsInventoryBool','IsCraftOpened','bIsInSelectionMenu'})do local a,pr=DWK.U.addr(p.pawn,name);if a and pr.kind=='BoolProperty' and (readBytes(a,1)&amp;readBytes(pr.f+0x72,1))~=0 then DWK.err('Close other menus before opening the map.','ほかのメニューを閉じてからマップを開いてください。')end end;local w=DWK.mapWidget();local U=DWK.U;local st={widget=w,pc=p.pc};DWK.mapState=st
 local ok,e=pcall(function()
  local a,pr=U.addr(w,'Visibility');assert(a and pr.kind=='EnumProperty','Widget visibility layout');DWK.change('mapUI',a,'byte',readBytes(a,1),w)
  DWK.call(w,'SetVisibility',function(a)writeBytes(a,0)end)
  DWK.call(w,'AddToViewport',function(a)writeInteger(a,100)end)
  -- Use the native widget's real texture/zoom/marker implementation.
  DWK.call(w,'SwitchLevelWorldMap');DWK.call(w,'Init')
  local viewport=DWK.call(p.pc,'GetViewportSize');local width,height=readInteger(viewport),readInteger(viewport+4)
  local scale=DWK.call(U.find('Default__WidgetLayoutLibrary'),'GetViewportScale',function(a)writeQword(a,p.pawn)end);scale=readFloat(scale+8);assert(scale and scale&gt;0)
  local side=math.min(width,height)*0.75/scale;st.layouts={}
  local container=U.get(U.get(w,'Overlay_MapContainer'),'Slot');local image=U.get(U.get(w,'WorldMapImage'),'Slot')
  for _,slot in ipairs({container,image})do local a,pr=U.addr(slot,'LayoutData');assert(a and pr.size==64);st.layouts[#st.layouts+1]={slot=slot,bytes=readBytes(a,64,true)}end
  DWK.call(container,'SetAnchors',function(a)for j=0,3 do writeDouble(a+j*8,0.5)end end)
  DWK.call(container,'SetAlignment',function(a)writeDouble(a,0.5);writeDouble(a+8,0.5)end)
  DWK.call(container,'SetPosition',function(a)writeDouble(a,0);writeDouble(a+8,0)end)
  for _,slot in ipairs({container,image})do DWK.call(slot,'SetSize',function(a)writeDouble(a,side);writeDouble(a+8,side)end)end
  DWK.call(w,'SetVisibility',function(a)writeBytes(a,0)end)
  mapBool('mapUI',p.pawn,'InMap?',true);mapBool('mapUI',p.pc,'bShowMouseCursor',true)
  DWK.call(p.pc,'SetIgnoreMoveInput',function(a)writeBytes(a,1)end);st.move=true
  DWK.call(p.pc,'SetIgnoreLookInput',function(a)writeBytes(a,1)end);st.look=true
  DWK.call(U.find('Default__WidgetBlueprintLibrary'),'SetInputMode_GameAndUIEx',function(a)writeQword(a,p.pc);writeQword(a+8,w);writeBytes(a+16,0);writeBytes(a+17,0)end)
 end)
 if not ok then pcall(DWK.mapClose);error(e,0)end
end
DWK.F.maprepair={on=function()DWK.need();DWK.ensureVM();DWK.mapKeyWasDown=isKeyPressed(0x4D)end,
 task=function()
  local down=isKeyPressed(0x4D);local edge=down and not DWK.mapKeyWasDown;DWK.mapKeyWasDown=down
  if edge and getWindowProcessID(getForegroundWindow())==DWK.pid then DWK.mapToggle()end
 end,
 off=function()DWK.mapClose();DWK.mapKeyWasDown=false end}


-- 010: execute queued ProcessEvent calls from the native engine game-thread tick.
-- Blueprint fast calls can bypass ProcessInternal, so ReceiveTick is not a reliable sole carrier.
local lines={'[ENABLE]','alloc(dwk_game_tick,$2000,$SITE)','label(dwk_game_tick_orig)','label(dwk_game_tick_return)','label(dwk_game_tick_invalid)','dwk_game_tick:','pushfq','push rax','push rcx','push rdx','push r8','push r9','push r10','push r11','cmp qword ptr [dwkPtrs],0','je dwk_game_tick_orig','lock inc dword ptr [dwkFlags+354]','cmp dword ptr [dwkFlags+300],1','jne dwk_game_tick_orig','mov r10,[dwkFlags+368]','test r10,r10','je dwk_game_tick_invalid','mov rax,[dwkFlags+308]','cmp [r10],rax','jne dwk_game_tick_invalid','mov r11d,[dwkFlags+35C]','cmp [r10+10],r11d','jne dwk_game_tick_invalid','mov dword ptr [dwkFlags+300],2','sub rsp,A8'}
for j=0,5 do lines[#lines+1]=('movdqu [rsp+%X],xmm%d'):format(0x20+j*16,j)end
for _,s in ipairs({'mov rcx,[dwkFlags+308]','mov rdx,[dwkFlags+310]','lea r8,[dwkFlags+500]','call qword ptr [dwkFlags+348]','lock inc dword ptr [dwkFlags+350]','mov dword ptr [dwkFlags+300],3'})do lines[#lines+1]=s end
for j=0,5 do lines[#lines+1]=('movdqu xmm%d,[rsp+%X]'):format(j,0x20+j*16)end
for _,s in ipairs({'add rsp,A8','jmp dwk_game_tick_orig','dwk_game_tick_invalid:','mov dword ptr [dwkFlags+300],4','dwk_game_tick_orig:','pop r11','pop r10','pop r9','pop r8','pop rdx','pop rcx','pop rax','popfq','$ORIG','jmp dwk_game_tick_return','$SITE:','jmp dwk_game_tick','$NOP','dwk_game_tick_return:','[DISABLE]','$SITE:','$ORIG','dealloc(dwk_game_tick)'})do lines[#lines+1]=s end
DWK.HOOKS.gameTick={sig='NativeTick',aa=table.concat(lines,'\n')}
function DWK.ensureGameBridge()
 DWK.need();writeQword(DWK.base()+0x348,DWK.resolveSig('ProcessEvent'));DWK.hookOn('gameTick')
end
function DWK.checkedObject(o)
 if not o or o&lt;0x10000 then DWK.err('Invalid target object','対象オブジェクトが無効です')end
 local idx=readInteger(o+0xC);local count=readInteger(DWK.U.go+0x14)
 if not idx or not count or idx&gt;=count then DWK.err('Target object has unloaded','対象オブジェクトはアンロードされています')end
 local chunks=readQword(DWK.U.go);local ch=chunks and readQword(chunks+(idx//65536)*8);local item=ch and(ch+(idx%65536)*24)
 if not item or readQword(item)~=o or ((readInteger(o+8)or 0)&amp;0x18000)~=0 then DWK.err('Target object has expired','対象オブジェクトは破棄されています')end
 return item,readInteger(item+0x10)
end
function DWK.call(object,name,fill)
 DWK.need();DWK.ensureVM();DWK.ensureGameBridge();local b=DWK.base();local status=readInteger(b+0x300)
 if status==1 or status==2 then DWK.err('A game-thread call is pending or executing.','ゲーム内処理が実行待ち、または実行中です。')end
 local item,serial=DWK.checkedObject(object);local fn=DWK.U.func(object,name);DWK.checkedObject(fn);local size=readSmallInteger(fn+0xB6)or 0;if size&gt;0xA00 then DWK.err('Parameter buffer too large','引数領域が大きすぎます')end
 local zeros={}for j=1,0xA00 do zeros[j]=0 end;writeBytes(b+0x500,zeros);if fill then fill(b+0x500)end
 writeQword(b+0x308,object);writeQword(b+0x310,fn);writeQword(b+0x368,item);writeInteger(b+0x35C,serial)
 local tickBefore=readInteger(b+0x354);writeInteger(b+0x300,1);local start=getTickCount()
 while (readInteger(b+0x300)==1 or readInteger(b+0x300)==2) and getTickCount()-start&lt;2500 do sleep(10)end
 local result=readInteger(b+0x300)
 if result==4 then writeInteger(b+0x300,0);DWK.err('Queued target expired before execution','実行前に対象オブジェクトが破棄されました')end
 if result~=3 then
  if result==1 then writeInteger(b+0x300,0)end
  local ticks=(readInteger(b+0x354)or 0)-(tickBefore or 0)
  DWK.err(('Game-thread call timed out: %s; native ticks=%d, queue=%s. The cause is not determined by this timeout alone.'):format(name,ticks,tostring(result)),
   ('ゲーム内処理がタイムアウト: %s／ネイティブTick=%d／キュー=%s。タイムアウトだけではポーズ中かどうか判定できません。'):format(name,ticks,tostring(result)))
 end
 writeInteger(b+0x300,0);return b+0x500
end

-- 010: the installed building interaction can bypass the old VM capture.
-- Follow the component selected by the game's own trace; never complete unrelated buildings.
local materialsTick=DWK.F.materials.task
function DWK.buildInputStep()
 local down=isKeyPressed(0x45);local edge=down and not DWK.buildKeyWasDown;DWK.buildKeyWasDown=down
 if not edge or getWindowProcessID(getForegroundWindow())~=DWK.pid then return end
 local p=DWK.player();if not p then return end
 for _,n in ipairs({'bIsInventoryBool','IsCraftOpened','bIsInSelectionMenu'})do local a,pr=DWK.U.addr(p.pawn,n);if a and (readBytes(a,1)&amp;readBytes(pr.f+0x72,1))~=0 then return end end
 local actor=DWK.U.get(p.build,'HitActor');local comp=DWK.U.get(p.build,'FindComp')
 if not actor or not comp or not DWK.U.isA(actor,'BP_Master_ModularBuilding_C') then return end
 DWK.checkedObject(actor);DWK.checkedObject(comp)
 local disabled=DWK.U.addr(actor,'IsDisabled');local done=DWK.U.addr(comp,'IsFinished')
 if not disabled or readBytes(disabled,1)~=0 or not done or readBytes(done,1)~=0 then return end
 if DWK.featOn.materials then
  DWK.call(actor,'BuildingProgress',function(a)writeQword(a,comp);writeQword(a+8,p.build);writeQword(a+16,p.craft)end)
 end
 if DWK.featOn.build and (DWK.featOn.materials or readBytes(done,1)~=0) then writeQword(DWK.base()+0x360,actor);DWK.buildTask()end
end
DWK.F.materials.task=function()materialsTick();DWK.buildInputStep()end
local buildTick=DWK.F.build.task
DWK.F.build.task=function()if not DWK.featOn.materials then DWK.buildInputStep()end;buildTick()end

-- Ver.0.1.9: multiply only the ticket roll in the BP_Zombie event graph.
function DWK.prepareMoneyDrop()
 local c=DWK.U.find('Default__BP_Zombie_C');assert(c,'Zombie class is not loaded')
 local fn=DWK.U.func(c,'ExecuteUbergraph_BP_Zombie');local code=readQword(fn+0x60);local size=readInteger(fn+0x68)
 assert(size==28784,'Zombie death script changed')
 assert(readBytes(code+0x4E9F,1)==0x1D and readInteger(code+0x4EA0)==251,'Zombie ticket item changed')
 assert(readBytes(code+0x4EB7,1)==0x68,'Zombie money random call changed')
 local roll=readQword(code+0x4EB8);assert(DWK.U.c(roll)=='Function' and DWK.U.n(roll)=='RandomIntegerInRange','Zombie money roll identity changed')
 assert(readBytes(code+0x4EC0,1)==0x1D and readInteger(code+0x4EC1)==15 and readBytes(code+0x4EC5,1)==0x1D and readInteger(code+0x4EC6)==25 and readBytes(code+0x4ECA,1)==0x16,'Zombie money range changed')
 assert(readBytes(code+0x4EDD,1)==0x21 and DWK.U.name(readInteger(code+0x4EDE))=='Quantity','Zombie money quantity assignment changed')
 local b=DWK.base();writeQword(b+0xF00,fn);writeQword(b+0xF08,code+0x4EC0)
end
DWK.HOOKS.moneyDrop={sig='MoneyRoll',aa=[==[
[ENABLE]
alloc(dwk_money_drop,$1000,$SITE)
label(dwk_money_original)
label(dwk_money_unmatched)
label(dwk_money_return)
label(dwk_money_nonnegative)
label(dwk_money_capped)
dwk_money_drop:
 pushfq
 push rax
 cmp byte ptr [dwkFlags+D],0
 je dwk_money_unmatched
 mov rax,[rdx+10]
 cmp rax,[dwkFlags+F00]
 jne dwk_money_unmatched
 mov rax,[rdx+20]
 cmp rax,[dwkFlags+F08]
 jne dwk_money_unmatched
 pop rax
 popfq
 sub rsp,48
 mov [rsp+20],r8
 call dwk_money_original
 mov [rsp+28],rax
 movdqu [rsp+30],xmm0
 mov r8,[rsp+20]
 mov eax,[r8]
 cvtsi2ss xmm0,eax
 mulss xmm0,[dwkVars+30]
 cvttss2si eax,xmm0
 test eax,eax
 jns dwk_money_nonnegative
 xor eax,eax
dwk_money_nonnegative:
 cmp eax,#100000
 jle dwk_money_capped
 mov eax,#100000
dwk_money_capped:
 mov [r8],eax
 movdqu xmm0,[rsp+30]
 mov rax,[rsp+28]
 add rsp,48
 ret
dwk_money_unmatched:
 pop rax
 popfq
dwk_money_original:
 $ORIG
 jmp dwk_money_return
$SITE:
 jmp dwk_money_drop
 $NOP
dwk_money_return:
[DISABLE]
$SITE:
 $ORIG
 dealloc(dwk_money_drop)
]==]}
DWK.F.moneydrop={flag=13,hooks={'moneyDrop'},on=function()DWK.need();DWK.prepareMoneyDrop();local row=getAddressList().getMemoryRecordByID(121);if row then row.reinterpret()end end,
 task=function()
  local a=DWK.var(0x30);local v=readFloat(a)
  if not v or v~=v then writeFloat(a,2)elseif v&lt;0 then writeFloat(a,0)elseif v&gt;1000 then writeFloat(a,1000)end
 end}



DWK.HOOKS.damage={sig='Damage',aa=[==[[ENABLE]
alloc(dwk_damage,$1000,$SITE)
label(dwk_damage_orig)
label(dwk_damage_return)
label(dwk_damage_block)
dwk_damage:
pushfq
cmp rcx,[dwkPtrs+0]
jne dwk_damage_orig
cmp byte ptr [dwkFlags+0],0
jne dwk_damage_block
cmp byte ptr [dwkFlags+1],0
jne dwk_damage_block
dwk_damage_orig:
popfq
$ORIG
jmp dwk_damage_return
dwk_damage_block:
popfq
ret
$SITE:
jmp dwk_damage
$NOP
dwk_damage_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_damage)]==]}

DWK.HOOKS.stamina={sig='Stamina',aa=[==[[ENABLE]
alloc(dwk_stamina,$1000,$SITE)
label(dwk_stamina_orig)
label(dwk_stamina_return)
label(dwk_stamina_block)
dwk_stamina:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_stamina_orig
cmp byte ptr [dwkFlags+2],0
jne dwk_stamina_block
dwk_stamina_orig:
popfq
$ORIG
jmp dwk_stamina_return
dwk_stamina_block:
popfq
ret
$SITE:
jmp dwk_stamina
$NOP
dwk_stamina_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_stamina)]==]}

DWK.HOOKS.energy={sig='LowerEnergy',aa=[==[[ENABLE]
alloc(dwk_energy,$1000,$SITE)
label(dwk_energy_orig)
label(dwk_energy_return)
label(dwk_energy_block)
dwk_energy:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_energy_orig
cmp byte ptr [dwkFlags+2],0
jne dwk_energy_block
dwk_energy_orig:
popfq
$ORIG
jmp dwk_energy_return
dwk_energy_block:
popfq
ret
$SITE:
jmp dwk_energy
$NOP
dwk_energy_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_energy)]==]}

DWK.HOOKS.setEnergy={sig='SetEnergy',aa=[==[[ENABLE]
alloc(dwk_setEnergy,$1000,$SITE)
label(dwk_setEnergy_orig)
label(dwk_setEnergy_return)
label(dwk_setEnergy_block)
dwk_setEnergy:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_setEnergy_orig
cmp byte ptr [dwkFlags+2],0
jne dwk_setEnergy_block
dwk_setEnergy_orig:
popfq
$ORIG
jmp dwk_setEnergy_return
dwk_setEnergy_block:
popfq
ret
$SITE:
jmp dwk_setEnergy
$NOP
dwk_setEnergy_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_setEnergy)]==]}

DWK.HOOKS.setStamina={sig='SetStamina',aa=[==[[ENABLE]
alloc(dwk_setStamina,$1000,$SITE)
label(dwk_setStamina_orig)
label(dwk_setStamina_return)
label(dwk_setStamina_block)
dwk_setStamina:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_setStamina_orig
cmp byte ptr [dwkFlags+2],0
jne dwk_setStamina_block
dwk_setStamina_orig:
popfq
$ORIG
jmp dwk_setStamina_return
dwk_setStamina_block:
popfq
ret
$SITE:
jmp dwk_setStamina
$NOP
dwk_setStamina_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_setStamina)]==]}

DWK.HOOKS.hunger={sig='Hunger',aa=[==[[ENABLE]
alloc(dwk_hunger,$1000,$SITE)
label(dwk_hunger_orig)
label(dwk_hunger_return)
label(dwk_hunger_block)
dwk_hunger:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_hunger_orig
cmp byte ptr [dwkFlags+3],0
jne dwk_hunger_block
dwk_hunger_orig:
popfq
$ORIG
jmp dwk_hunger_return
dwk_hunger_block:
popfq
ret
$SITE:
jmp dwk_hunger
$NOP
dwk_hunger_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_hunger)]==]}

DWK.HOOKS.thirst={sig='Thirst',aa=[==[[ENABLE]
alloc(dwk_thirst,$1000,$SITE)
label(dwk_thirst_orig)
label(dwk_thirst_return)
label(dwk_thirst_block)
dwk_thirst:
pushfq
cmp rcx,[dwkPtrs+8]
jne dwk_thirst_orig
cmp byte ptr [dwkFlags+4],0
jne dwk_thirst_block
dwk_thirst_orig:
popfq
$ORIG
jmp dwk_thirst_return
dwk_thirst_block:
popfq
ret
$SITE:
jmp dwk_thirst
$NOP
dwk_thirst_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_thirst)]==]}

DWK.HOOKS.stealth={sig='Stealth',aa=[==[[ENABLE]
alloc(dwk_stealth,$1000,$SITE)
label(dwk_stealth_orig)
label(dwk_stealth_return)
label(dwk_stealth_block)
dwk_stealth:
pushfq
cmp rdx,[dwkPtrs+0]
jne dwk_stealth_orig
cmp byte ptr [dwkFlags+5],0
jne dwk_stealth_block
dwk_stealth_orig:
popfq
$ORIG
jmp dwk_stealth_return
dwk_stealth_block:
popfq
ret
$SITE:
jmp dwk_stealth
$NOP
dwk_stealth_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_stealth)]==]}

DWK.HOOKS.ammoStore={sig='AmmoStore',aa=[==[[ENABLE]
alloc(dwk_ammoStore,$1000,$SITE)
label(dwk_ammoStore_orig)
label(dwk_ammoStore_return)
label(dwk_ammoStore_block)
dwk_ammoStore:
pushfq
cmp rdi,[dwkPtrs+38]
jne dwk_ammoStore_orig
cmp byte ptr [dwkFlags+8],0
jne dwk_ammoStore_block
dwk_ammoStore_orig:
popfq
$ORIG
jmp dwk_ammoStore_return
dwk_ammoStore_block:
popfq
jmp dwk_ammoStore_return
$SITE:
jmp dwk_ammoStore
$NOP
dwk_ammoStore_return:
[DISABLE]
$SITE:
$ORIG
dealloc(dwk_ammoStore)]==]}

DWK.F.stamina.hooks={'stamina','energy','setEnergy','setStamina'};DWK.F.stamina.on=function()DWK.need();DWK.survival('Stamina');DWK.survival('Energy')end;DWK.F.stamina.task=function()DWK.survival('Stamina');DWK.survival('Energy')end
function DWK.initCollapse()
  local al=getAddressList()
  for i=0,al.Count-1 do
    local m=al.getMemoryRecord(i)
    if m.Count&gt;0 then
      local opt='' pcall(function() opt=tostring(m.Options) end)
      if not opt:find('moHideChildren') then
        local inZero=false local p=m
        while p do if p.ID==DWK.ID_TOP0 then inZero=true break end p=p.Parent end
        pcall(function() m.Collapsed = not inZero end)
      end
    end
  end
end

DWK.NAMES={
[1]={"[ATTACH / ALL OFF] THE DEAD WE KNEW","【アタッチ／一括解除】THE DEAD WE KNEW"},
[2]={"0. Settings / README","0. 設定・説明"},
[3]={"Language","言語"},
[4]={"English","English"},
[5]={"Japanese / 日本語","日本語 / Japanese"},
[6]={"README","はじめに"},
[7]={"Start game, load a solo / host save, attach; allow table Lua. CE 7.5+ x64.","ゲーム起動→ソロ／ホストのセーブをロード→アタッチ。テーブルLuaを許可。CE 7.5以降・64bit。"},
[8]={"Supported: Game Ver.0.1.9 (Steam 26602550). Table V01.","対応: ゲーム Ver.0.1.9（Steam 26602550）。CT V01。"},
[9]={"Value rows: double-click to edit. Lists: re-enable after loading or moving inventory.","値はダブルクリックで編集。一覧はロード・所持品移動後に再生成してください。"},
[10]={"Item names follow game text; category IDs are the game equipment permission groups.","アイテム名はゲーム内テキスト。カテゴリはゲームの装備許可区分を使用。"},
[12]={"Space ascent includes fall protection while enabled. Time uses 0-2399 (1200 = noon).","スペース浮上は有効中に落下保護を併用。時刻は0～2399（1200＝正午）。"},
[20]={"Diagnostics","診断"},
[21]={"Toggle Lua Engine","Lua Engine開閉"},
[22]={"Build / code / player validation","ビルド・コード・実プレイヤー検証"},
[23]={"Environment","接続・環境"},
[24]={"Status","状態"},
[100]={"01. Gameplay","01. ゲームプレイ"},
[101]={"Invincible (block player damage)","無敵（プレイヤーへのダメージを遮断）"},
[102]={"Infinite health","体力無限"},
[103]={"Infinite stamina","スタミナ無限"},
[104]={"No hunger","空腹なし"},
[105]={"No thirst","喉が渇かない"},
[106]={"Stealth (ignore new player perception stimuli)","ステルス（プレイヤーの新規知覚刺激を遮断）"},
[110]={"No ammo / arrow consumption","弾・矢を消費しない"},
[111]={"No item consumption (ID consumption path)","アイテム消費なし（ID指定消費経路）"},
[116]={"Hold Space to ascend","スペース長押しで浮上"},
[118]={"No fall damage","落下ダメージなし"},
[120]={"Repair map key (M: open / close)","マップキー修復（Mで開閉）"},
[107]={"Set money / ticket total...","所持金変更／チケット合計枚数…"},
[109]={"Zombie money drop multiplier","ゾンビのお金ドロップ倍率"},
[121]={"Multiplier (0-1000; default 2)","倍率（0～1000・初期値2）"},
[112]={"Player speed multiplier","プレイヤー速度倍率"},
[113]={"Multiplier","倍率"},
[114]={"Jump multiplier","ジャンプ倍率"},
[115]={"Multiplier","倍率"},
[119]={"Ascent settings / hold Space","浮上設定／スペース長押し"},
[117]={"Ascent velocity (cm/s)","上昇速度（cm/秒）"},
[200]={"02. Player","02. プレイヤー"},
[201]={"Player editor (enable to refresh)","プレイヤーエディタ（有効化で再取得）"},
[300]={"03. Items","03. アイテム"},
[301]={"Edit quantities / magazines (refresh list)","アイテム個数・装填弾数編集（一覧再取得）"},
[302]={"Add items (category / quantity)...","アイテム追加（カテゴリ別・個数）…"},
[400]={"04. Craft / Build","04. クラフト・ビルド"},
[401]={"No materials needed (recipes / building checks)","素材必要なし（レシピ・建築チェック）"},
[402]={"Instant craft (queue / recipes)","即クラフト（キュー・レシピ）"},
[403]={"Instant build (E on the targeted placed building)","即ビルド（設置した建物を狙ってE）"},
[500]={"05. World","05. ワールド"},
[501]={"Always daytime (12:00)","常に昼（12:00）"},
[502]={"Select weather preset...","天気指定…"},
[503]={"Freeze selected weather","指定した天気を固定"},
[506]={"Prevent fog / zombie horde event","霧・ゾンビ大量襲撃イベントを防止"},
[504]={"Freeze time","時刻を固定"},
[505]={"Time (0-2399, noon=1200)","時刻（0～2399、正午＝1200）"},
}
DWK.applyLang();DWK.initCollapse()
-- Initialize newly added value rows when upgrading a running older table.
if tableReloadFeatures and tablePreviousVarDef then
 for off,d in pairs(DWK.VARDEF)do if not tablePreviousVarDef[off]then
  if d[1]=='float'then writeFloat(DWK.var(off),d[2])elseif d[1]=='qword'then writeQword(DWK.var(off),d[2])else writeInteger(DWK.var(off),d[2])end
 end end
end
DWK.resumeRequest=tableReloadFeatures
function DWK.resumeTableFeatures()
 if not DWK.resumeRequest then return end
 DWK.need()
 local priority={'god','health','moneydrop','fall','stamina','hunger','thirst','stealth','ammo','items','materials','instant','build','float','speed','jump','raid','noon','time','weather','maprepair'}
 for _,k in ipairs(priority)do if DWK.resumeRequest[k]then DWK.feature(k,true);DWK.resumeRequest[k]=nil;local ids={god=101,health=102,moneydrop=109,stamina=103,hunger=104,thirst=105,stealth=106,ammo=110,items=111,speed=112,jump=114,float=116,fall=118,maprepair=120,materials=401,instant=402,build=403,noon=501,weather=503,time=504,raid=506};local mr=getAddressList().getMemoryRecordByID(ids[k]);if mr and not mr.Active then mr.Active=true end end end
 if next(DWK.resumeRequest)==nil then DWK.resumeRequest=nil;DWK.msg('Table reloaded; active features restored.','CT再読み込み後、有効な機能を復元しました。')end
end
local tickBeforeTableReload=DWK.tick
function DWK.tick()
 if DWK.resumeRequest then local ok,e=pcall(DWK.resumeTableFeatures);if not ok then DWK.reloadResumeError=tostring(e)end end
 tickBeforeTableReload()
end
if tableReloadFeatures then DWK.init();DWK.startTimer();local ok,e=pcall(DWK.resumeTableFeatures);if not ok then DWK.msg('Feature restore is waiting: '..tostring(e),'機能の復元待ち: '..tostring(e))end end
-- Restore script/data edits even when a feature was enabled programmatically.
local disableAllBefore010=DWK.disableAll
function DWK.disableAll(self)
 if DWK.attached()then
  local keys={};for k in pairs(DWK.featOn)do keys[#keys+1]=k end
  for _,k in ipairs(keys)do DWK.feature(k,false)end
  keys={};for k in pairs(DWK.edits)do keys[#keys+1]=k end
  for _,k in ipairs(keys)do DWK.restore(k)end
 end
 return disableAllBefore010(self)
end


</LuaScript>
</CheatTable>