<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="45">
  <CheatEntries>
    <CheatEntry>
      <ID>1</ID>
      <Description>"【アタッチ／一括解除】WP10_2026.exe"</Description>
      <Color>00A5FF</Color>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript><![CDATA[

{ 	Game: WP10_2026.exe
 	Author  : Black_wolf
 	CheatVer:1.0.4.0-001-007
 	Memo: Game Engine: KATANA ENGINE R2.17.1
	　　　FileVersion 1.0.4.0 / Steam Build 23519875

	日本語って難しいよね。まだまだ勉強が足りない。わからない言葉だらけだった
	似たような言葉も多いし、漢字的には意味が分からないものも多い
	マニュアルをだいぶ勉強したよ
	https://www.gamecity.ne.jp/manual/WP102026/jp/

	一覧表示はデータ解析に使っていた実用性に乏しいものだけど、そのままつけてみた
	名前をダブルクリックすると該当箇所をCEで開けます

	極端な状況をいろいろ試してみたけど、ゲーム的には結局馬群にのまれない大逃げが一番強いよね

	注意！) 
	便利機能のレース にある レースタイム保護 解除は気を付けて
	本来ゲーム内で保護されている機構を突破しちゃうから、とんでもないレコードが出てゲーム性を壊しちゃう
	勝つだけの目的なら触らない方がいい

	解析を進めるといろいろとレースレコードに対してのセーフティがかかりまくっていることがわかった。
	勝敗を決めるロジックはかなり複雑。勝たせたい馬に別倍率でいじると、最後のセーフティでおかしな結果になる
	異常なレコードにならないよう調整しつつ、本当に強い馬ならレコードも出せるように調整した

	が、このゲームの不正がいろいろ見えてきてダメなゲームの典型だ
	レコードの誤差チェックで大きく早すぎるとレコードに戻されたり、データ的に絶対強い馬が勝てなかったり。
	ゲームとしてもシミュレーションとしても、くそげーだよ
	なんでこんなゲームが日本で有名な競馬ゲームなんだ


	まーいろんな馬で試したのでこれで大丈夫なはず！
	その時に利用していた機能を一覧に右クリックメニュー実装してみた
}
[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.disableAll(memrec) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
    </CheatEntry>
    <CheatEntry>
      <ID>2</ID>
      <Description>"0. 設定"</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><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec, function() WP26.setLang('en') end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>5</ID>
              <Description>"日本語（初期表示）"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec, function() WP26.setLang('ja') end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>12</ID>
          <Description>"診断"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>13</ID>
              <Description>"Lua Engine：開く／閉じる"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.openLuaEngine()
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeLuaEngine() end
{$asm}
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>14</ID>
              <Description>"一意シグネチャ確認（読み取り）"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec, function() WP26.scanSelfTest() end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>15</ID>
              <Description>"環境・接続情報"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec, function() WP26.envReport() end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>16</ID>
              <Description>"状態を表示"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec, function() WP26.statusReport() end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>100</ID>
      <Description>"01. 便利機能"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>101</ID>
          <Description>"所有馬を出走最良状態にする"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function()WP26.maxCondition(false)end)
{$asm}
[DISABLE]
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>102</ID>
          <Description>"所有馬の出走最良状態を維持"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableCondition(memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.conditionToggle(false) end
{$asm}
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>103</ID>
          <Description>"所有馬の適応能力回復"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.restoreAdaptations103() end)
{$asm}
[DISABLE]
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>161</ID>
          <Description>"無条件入居"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableAdmission109(memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(WP26.stopAdmission109)
{$asm}
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>130</ID>
          <Description>"所有競走馬の一括設定"</Description>
          <Options moHideChildren="1" />
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableBulk104(memrec,'owned')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.closeBulk104('owned')
{$asm}
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>140</ID>
          <Description>"所有幼駒の一括設定"</Description>
          <Options moHideChildren="1" />
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableBulk104(memrec,'ownedFoal')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.closeBulk104('ownedFoal')
{$asm}
]]></AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>150</ID>
          <Description>"友好度"</Description>
          <Color>FFFF00</Color>
          <Options moManualExpandCollapse="1" />
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>151</ID>
              <Description>"全馬主の友好度を5以上にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('owner',5) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>152</ID>
              <Description>"全馬主の友好度を100にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('owner',100) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>153</ID>
              <Description>"全牧場の友好度を5以上にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('farm',5) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>154</ID>
              <Description>"全牧場の友好度を100にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('farm',100) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>155</ID>
              <Description>"全調教師の友好度を5以上にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('trainer',5) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>156</ID>
              <Description>"全調教師の友好度を100にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('trainer',100) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>157</ID>
              <Description>"全騎手の友好度を5以上にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('jockey',5) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>158</ID>
              <Description>"全騎手の友好度を100にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('jockey',100) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>159</ID>
              <Description>"全員の友好度を5以上にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('all',5) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>160</ID>
              <Description>"全員の友好度を100にする"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.applyFriendship104('all',100) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>110</ID>
          <Description>"レース"</Description>
          <Options moManualExpandCollapse="1" />
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>111</ID>
              <Description>"所有馬圧勝"</Description>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableRaceBoost(memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.disableRaceBoost()
{$asm}
]]></AssemblerScript>
              <Color>00A5FF</Color>
            </CheatEntry>
            <CheatEntry>
              <ID>112</ID>
              <Description>"走行倍率"</Description>
              <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">1000:1
1100:1.1
1250:1.25
1500:1.5
2000:2
3000:3
4000:4
5000:5
10000:10
20000:20
50000:50
100000:100</DropDownList>
              <VariableType>4 Bytes</VariableType>
              <Address>wp2026RaceFactor</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>113</ID>
              <Description>"勝たせたい馬"</Description>
              <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">65535:すべての所有馬</DropDownList>
              <VariableType>4 Bytes</VariableType>
              <Address>wp2026RaceTarget</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>116</ID>
              <Description>"レースタイム保護"</Description>
              <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">0:無効
1:有効</DropDownList>
              <Color>0000C0</Color>
              <VariableType>4 Bytes</VariableType>
              <Address>wp2026RaceTimeProtection</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>115</ID>
              <Description>"相手馬を絶不調"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableOpponents103(memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
local ok,e=pcall(WP26.stopOpponents103);if not ok then WP26.msg('Restore failed: '..tostring(e),'復元失敗: '..tostring(e)) end
{$asm}
]]></AssemblerScript>
            </CheatEntry>
          
<CheatEntry>
  <ID>170</ID>
  <Description>"全レースの天候を固定"</Description>
  <Options moManualExpandCollapse="1" />
  <VariableType>Auto Assembler Script</VariableType>
  <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableClimate159('weather',memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.stopClimate159('weather')end)
{$asm}
</AssemblerScript>
  <Color>00A5FF</Color>
  <CheatEntries>
    <CheatEntry>
      <ID>171</ID>
      <Description>"天候"</Description>
      <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">0:晴れ
1:曇り
2:小雨
3:雨
4:雪</DropDownList>
      <VariableType>4 Bytes</VariableType>
      <Address>WP2026Climate159+4</Address>
    </CheatEntry>
  </CheatEntries>
</CheatEntry>
<CheatEntry>
  <ID>172</ID>
  <Description>"全レースの馬場状態を固定"</Description>
  <Options moManualExpandCollapse="1" />
  <VariableType>Auto Assembler Script</VariableType>
  <AssemblerScript>[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableClimate159('ground',memrec)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.stopClimate159('ground')end)
{$asm}
</AssemblerScript>
  <Color>00A5FF</Color>
  <CheatEntries>
    <CheatEntry>
      <ID>173</ID>
      <Description>"馬場状態"</Description>
      <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">0:良
1:稍重
2:重
3:不良</DropDownList>
      <VariableType>4 Bytes</VariableType>
      <Address>WP2026Climate159+8</Address>
    </CheatEntry>
  </CheatEntries>
</CheatEntry>
</CheatEntries>
          <Color>FFFF00</Color>
        </CheatEntry>
        <CheatEntry>
          <ID>120</ID>
          <Description>"所有・生産"</Description>
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>121</ID>
              <Description>"表示中の馬を編集"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,WP26.openDisplayedHorseEditor074)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>122</ID>
              <Description>"表示中の馬を取得"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,WP26.acquireDisplayed075)
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>123</ID>
              <Description>"取得先牧場"</Description>
              <VariableType>Byte</VariableType>
              <Address>wp2026AcquireFarm</Address>
              <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">32:タッド</DropDownList>
            </CheatEntry>
            <CheatEntry>
              <ID>124</ID>
              <Description>"自牧場産として取得"</Description>
              <VariableType>Byte</VariableType>
              <Address>wp2026AcquireHomebred</Address>
              <DropDownList ReadOnly="1" DescriptionOnly="1" DisplayValueAsItem="1">0:いいえ




1:はい</DropDownList>
            </CheatEntry>
          </CheatEntries>
          <Options moManualExpandCollapse="1" />
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>200</ID>
      <Description>"02. プレイヤー"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>210</ID>
          <Description>"プレイヤーエディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'player')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>300</ID>
      <Description>"03. 馬関連"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>310</ID>
          <Description>"所有競走馬エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'owned')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>320</ID>
          <Description>"所有幼駒エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'ownedFoal')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>360</ID>
          <Description>"所有繁殖牝馬エディタ"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'ownedMare')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Color>00A5FF</Color>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>355</ID>
          <Description>"所有種牡馬エディタ"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'ownedSire')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Color>00A5FF</Color>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>330</ID>
          <Description>"競走馬エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'race')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>340</ID>
          <Description>"幼駒エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'foal')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>370</ID>
          <Description>"繁殖牝馬エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'mare')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>350</ID>
          <Description>"種牡馬エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'sire')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>400</ID>
      <Description>"04. 人関連"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>410</ID>
          <Description>"馬主エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'owner')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>465</ID>
          <Description>"牧場"</Description>
          <Options moManualExpandCollapse="1" />
          <Color>FFFF00</Color>
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>470</ID>
              <Description>"牧場長エディタ"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'staff')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
              <Options moHideChildren="1" />
            </CheatEntry>
            <CheatEntry>
              <ID>480</ID>
              <Description>"牧場スタッフエディタ"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'farmStaff')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
              <Options moHideChildren="1" />
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>450</ID>
          <Description>"調教師エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'trainer')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>430</ID>
          <Description>"騎手エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'jockey')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>485</ID>
          <Description>"知人"</Description>
          <Options moManualExpandCollapse="1" />
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>491</ID>
              <Description>"知人エディタ"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'acquaintance')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
              <Options moHideChildren="1" />
            </CheatEntry>
            <CheatEntry>
              <ID>490</ID>
              <Description>"秘書エディタ"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'secretary')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
              <Options moHideChildren="1" />
            </CheatEntry>
          </CheatEntries>
          <Color>FFFF00</Color>
        </CheatEntry>
        <CheatEntry>
          <ID>495</ID>
          <Description>"家系図"</Description>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'family')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
          <Color>00A5FF</Color>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>500</ID>
      <Description>"05. 牧場関連"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>510</ID>
          <Description>"牧場エディタ"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'farm')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>600</ID>
      <Description>"06. アイテム関連"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>602</ID>
          <Description>"アイテム個数変更"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.enableEditor(memrec,'items')
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeEditor(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
        <CheatEntry>
          <ID>603</ID>
          <Description>"アイテム追加：追加個数"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openItemAdd(memrec)end)
{$asm}
[DISABLE]
{$lua}
if syntaxcheck then return end
if WP26 then WP26.closeItemAdd(memrec) end
{$asm}
]]></AssemblerScript>
          <Options moHideChildren="1" />
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>8000</ID>
      <Description>"07. 一覧表示"</Description>
      <Color>FFFF00</Color>
      <Options moManualExpandCollapse="1" />
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>8001</ID>
          <Description>"馬"</Description>
          <Color>FFFF00</Color>
          <Options moManualExpandCollapse="1" />
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>8010</ID>
              <Description>"所有競走馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("owned")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8011</ID>
              <Description>"所有幼駒一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("ownedFoal")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8012</ID>
              <Description>"所有繁殖牝馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("ownedMare")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8013</ID>
              <Description>"所有種牡馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("ownedSire")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8014</ID>
              <Description>"競走馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("race")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8015</ID>
              <Description>"幼駒一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("foal")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8016</ID>
              <Description>"繁殖牝馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("mare")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8017</ID>
              <Description>"種牡馬一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("sire")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
        <CheatEntry>
          <ID>8002</ID>
          <Description>"人物"</Description>
          <Color>FFFF00</Color>
          <Options moManualExpandCollapse="1" />
          <GroupHeader>1</GroupHeader>
          <CheatEntries>
            <CheatEntry>
              <ID>8018</ID>
              <Description>"騎手一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("jockey")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8019</ID>
              <Description>"調教師一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("trainer")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8020</ID>
              <Description>"馬主一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("owner")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8021</ID>
              <Description>"牧場長一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("staff")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8022</ID>
              <Description>"牧場スタッフ一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("farmStaff")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8023</ID>
              <Description>"知人一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("acquaintance")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8024</ID>
              <Description>"秘書一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("secretary")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
            <CheatEntry>
              <ID>8025</ID>
              <Description>"家系図一覧"</Description>
              <Color>00A5FF</Color>
              <VariableType>Auto Assembler Script</VariableType>
              <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.userRun(function()WP26.openEntityList116("family")end)
if memrec then WP26.deferRecordDeactivate(memrec,80)end
{$asm}
[DISABLE]
]]></AssemblerScript>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
    <CheatEntry>
      <ID>700</ID>
      <Description>"08. その他"</Description>
      <Options moManualExpandCollapse="1" />
      <Color>FFFF00</Color>
      <GroupHeader>1</GroupHeader>
      <CheatEntries>
        <CheatEntry>
          <ID>702</ID>
          <Description>"Steam実績全解除"</Description>
          <Color>00A5FF</Color>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript><![CDATA[[ENABLE]
{$lua}
if syntaxcheck then return end
WP26.oneShot(memrec,function() WP26.achievements(true) end)
{$asm}
[DISABLE]
]]></AssemblerScript>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <LuaScript><![CDATA[if WP26 and WP26.stopClimate159 then local ok,e=pcall(WP26.stopClimate159); if not ok then print('[WP2026] '..tostring(e));return end end
if WP26 and WP26.formNotice153 then unregisterFormAddNotification(WP26.formNotice153); WP26.formNotice153 = nil end
if WP26 and WP26.stopRecordSupport139 then pcall(WP26.stopRecordSupport139) end
if WP26 and WP26.stopAdmission109 then
  local ok, e = pcall(WP26.stopAdmission109)
  if not ok then
    print('[WP2026] ' .. tostring(e))
    return
  end
end
if WP26 and WP26.stopOpponents103 then
  local ok, e = pcall(WP26.stopOpponents103)
  if not ok then
    print('[WP2026] ' .. tostring(e))
    return
  end
end
if WP26 and WP26.stopRaceBoost then
  local ok, e = pcall(WP26.stopRaceBoost)
  if not ok then
    print('[WP2026] ' .. tostring(e))
    return
  end
end
if WP26 and WP26.stopRaceMath142 then local ok, e = pcall(WP26.stopRaceMath142); if not ok then print("[WP2026] " .. tostring(e)); return end end
if WP26 and WP26.editTimer then
  WP26.editTimer.destroy()
  WP26.editTimer = nil
  WP26.pendingEdits = {}
end
if WP26 and WP26.valueChangeHandler then
  getAddressList().OnValueChange = WP26.previousValueChange
end
if WP26 and WP26.TAG == 'WP2026' then
  if WP26.stopHealth then
    WP26.stopHealth()
  end
  if WP26.uiTimers then
    for timer in pairs(WP26.uiTimers) do
      timer.destroy()
    end
  end
end
if WP26 and WP26.TAG == 'WP2026' and WP26.timer then
  WP26.timer.destroy()
  WP26.timer = nil
end
if _G.WP26_CUSTOM_TYPES078 then
  for _, entry in pairs(_G.WP26_CUSTOM_TYPES078.types) do
    entry.info = nil
  end
end
WP26 = {}
local WP26 = WP26
WP26.TAG = 'WP2026'
WP26.TITLE = 'Winning Post 10 2026'
WP26.EXE = 'WP10_2026.exe'
WP26.MODULE = WP26.EXE
WP26.GAMEVER = 'FileVersion 1.0.4.0'
WP26.BUILD = { ts = 0x6A1E5BB2, size = 0x6589000 }
WP26.lang = 'ja'
WP26.C_SELECTION = 0x805020
WP26.C_GROUP = 0xFFFF00
WP26.C_SCRIPT = 0x00A5FF
WP26.ID_ATTACH = 1
WP26.ID_TOP0 = 2
WP26.OFF_VARS = 0x100
WP26.OFF_PTRS = 0x200
WP26.TICK_MS = 500
WP26.SIGS = {}
WP26.HOOKS = {}
WP26.F = {}
WP26.PTRS = {}
WP26.VARDEF = {}
function WP26.onAttach() end

--  COMMON PART  (no change needed per game)
--=====================================================================================
WP26.A = WP26.A or {} -- resolved signature addresses
WP26.pend = WP26.pend or {} -- unresolved signatures
WP26.hookState = WP26.hookState or {}
WP26.featOn = WP26.featOn or {}
WP26.dyn = WP26.dyn or {} -- dynamic records {mr,en,ja}
WP26.suffix = WP26.suffix or {} -- record ID -> 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 >= 0x80000000 then
    v = v - 0x100000000
  end
  return v
end

function WP26.T(en, ja)
  if WP26.lang == 'ja' then
    return ja or en
  end
  return en
end
function WP26.msg(en, ja)
  print('[' .. WP26.TAG .. '] ' .. WP26.T(en, ja))
end
function WP26.err(en, ja)
  error(WP26.T(en, ja), 0)
end
local function hex(n)
  return string.format('%X', n)
end

function WP26.mod(name)
  return getAddressSafe(name or WP26.MODULE)
end
function WP26.modSize(name)
  local ok, s = pcall(getModuleSize, name or WP26.MODULE)
  return ok and s or nil
end
function WP26.base()
  if WP26.sharedPid == getOpenedProcessID() and WP26.sharedBase then
    return WP26.sharedBase
  end
  return getAddressSafe('gtFlags')
end
function WP26.flag(i)
  return WP26.base() + i
end
function WP26.var(o)
  return WP26.base() + WP26.OFF_VARS + o
end


----------------------------------------------------------------- one-shot / user action
-- run fn, show errors, then uncheck the record (action rows)
function WP26.userRun(fn)
  local ok, e = pcall(fn)
  if not ok then
    local m = tostring(e)
    print('[' .. WP26.TAG .. '] ' .. m)
  end
  return ok
end
function WP26.oneShot(mr, fn)
  local id = mr.ID
  WP26.userRun(fn)
  WP26.deferRecordDeactivate(id, 150)
end

----------------------------------------------------------------- attach / init
function WP26.attached()
  return WP26.pid ~= nil and WP26.pid == getOpenedProcessID() and WP26.base() ~= nil
end
function WP26.require()
  if not WP26.attached() then
    WP26.err(
      'Not attached to ' .. WP26.EXE .. '. Run [ATTACH / ALL OFF] at the top of the table first.',
      WP26.EXE
        .. 'にアタッチされていません。先にテーブル先頭の【アタッチ／一括解除】を実行してください。'
    )
  end
end
-- attach CE to the game; returns true when the opened process changed
function WP26.attachGame()
  local pid = getProcessIDFromProcessName(WP26.EXE)
  if not pid or pid == 0 then
    WP26.err('The game is not running: ' .. WP26.EXE, 'ゲームが起動していません: ' .. WP26.EXE)
  end
  local changed = false
  if getOpenedProcessID() ~= pid then
    openProcess(pid)
    changed = true
    WP26.msg(
      ('Attached to %s (PID %d).'):format(WP26.EXE, pid),
      ('%s（PID %d）にアタッチしました。'):format(WP26.EXE, pid)
    )
  end
  if not WP26.mod() then
    pcall(reinitializeSymbolhandler, true)
  end
  if not WP26.mod() then
    WP26.err(
      WP26.MODULE .. ' is not loaded yet. Wait until the title screen and try again.',
      WP26.MODULE
        .. ' がまだ読み込まれていません。タイトル画面まで待ってから再実行してください。'
    )
  end
  return changed
end
-- state of an old process: drop it without touching the new one
function WP26.forgetProcess()
  WP26.hookState = {}
  WP26.featOn = {}
  WP26.A = {}
  WP26.pend = {}
  WP26.pid = nil
  WP26.sharedBase = nil
  WP26.sharedPid = nil
end
function WP26.checkBuild()
  if not WP26.BUILD then
    return true
  end
  local m = WP26.mod()
  local lf = ri(m + 0x3C)
  local ts = lf and readInteger(m + lf + 8)
  local sz = WP26.modSize()
  if ts ~= WP26.BUILD.ts or (WP26.BUILD.size and sz ~= WP26.BUILD.size) then
    WP26.msg(
      ('WARNING: different game build (timestamp %s, size %s). Made for v%s. Features whose code is not found are disabled.'):format(
        hex(ts or 0),
        hex(sz or 0),
        WP26.GAMEVER
      ),
      ('警告: 対応ビルドと異なります（タイムスタンプ %s、サイズ %s）。対応バージョンは v%s です。コードが見つからない機能は無効になります。'):format(
        hex(ts or 0),
        hex(sz or 0),
        WP26.GAMEVER
      )
    )
    return false
  end
  return true
end
function WP26.init()
  local pid = getOpenedProcessID()
  if WP26.pid == pid and WP26.base() then
    return true
  end
  WP26.forgetProcess()
  for _, s in ipairs({ 'gtFlags', 'gtVars', 'gtPtrs' }) do
    pcall(unregisterSymbol, s)
  end
  -- Current features use indirect pointers; no near-address allocation is required.
  local mem = allocateMemory(0x1000)
  if not mem or mem == 0 then
    WP26.err('Memory allocation failed.', 'メモリ確保に失敗しました。')
  end
  WP26.sharedBase = mem
  WP26.sharedPid = pid
  registerSymbol('gtFlags', mem, true)
  registerSymbol('gtVars', mem + WP26.OFF_VARS, true)
  registerSymbol('gtPtrs', mem + WP26.OFF_PTRS, true)
  for o, d in pairs(WP26.VARDEF) do
    if d[1] == 'float' then
      writeFloat(WP26.var(o), d[2])
    elseif d[1] == 'qword' then
      writeQword(WP26.var(o), d[2])
    else
      writeInteger(WP26.var(o), d[2])
    end
  end
  WP26.pid = pid
  WP26.checkBuild()
  WP26.resolveAll()
  pcall(WP26.onAttach)
  WP26.startTimer()
  return true
end

----------------------------------------------------------------- AOB resolver (synchronous aobscanregion)
local function aaFind(pat, s, e)
  pcall(unregisterSymbol, 'gt_tmp')
  local ok = autoAssemble(('aobscanregion(gt_tmp,%s,%s,%s)\nregistersymbol(gt_tmp)\n'):format(hex(s), hex(e), pat))
  if not ok then
    return nil
  end
  local a = getAddressSafe('gt_tmp')
  pcall(unregisterSymbol, 'gt_tmp')
  return a
end
local function aobAll(pat, s, e, maxn)
  local r = {}
  local from = s
  while from < e and #r < maxn do
    local a = aaFind(pat, from, e)
    if not a then
      break
    end
    r[#r + 1] = a
    from = a + 1
  end
  return r
end
WP26.aobAll = aobAll
function WP26.resolveSig(name)
  if WP26.A[name] then
    return WP26.A[name]
  end
  local sg = WP26.SIGS[name]
  if not sg then
    WP26.err('Unknown signature: ' .. name, '未定義のシグネチャ: ' .. name)
  end
  local m = WP26.mod(sg.mod)
  local sz = WP26.modSize(sg.mod)
  local a = m and sz and aaFind(sg.p, m, m + sz)
  if not a then
    WP26.pend[name] = true
    return nil
  end
  a = a + (sg.off or 0)
  WP26.A[name] = a
  WP26.pend[name] = nil
  pcall(unregisterSymbol, 'gtA_' .. name)
  registerSymbol('gtA_' .. name, a, true)
  return a
end
function WP26.resolveAll()
  local ok, ng = 0, 0
  for n in pairs(WP26.SIGS) do
    if WP26.resolveSig(n) then
      ok = ok + 1
    else
      ng = ng + 1
    end
  end
  WP26.msg(
    ('Signatures: %d found, %d not found.'):format(ok, ng),
    ('シグネチャ: %d件検出、%d件未検出。'):format(ok, ng)
  )
end
function WP26.pendingNames()
  local r = {}
  for n in pairs(WP26.pend) do
    r[#r + 1] = n
  end
  table.sort(r)
  return r
end

----------------------------------------------------------------- hook manager
function WP26.hookOn(name)
  if WP26.hookState[name] then
    return
  end
  local h = WP26.HOOKS[name] or WP26.err('Unknown hook: ' .. name, '未定義のフック: ' .. name)
  local a = WP26.resolveSig(h.sig)
  if not a then
    WP26.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 = WP26.SIGS[h.sig].len or 5
  local orig = readBytes(a, len, true)
    or WP26.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', 'gtA_' .. h.sig):gsub('%$ORIG', 'db ' .. table.concat(db, ' '))
  s = s:gsub('%$NOP', len > 5 and ('nop ' .. (len - 5)) or '')
  local ok, info = autoAssemble(s)
  if not ok then
    WP26.err(
      'Hook assembly failed: ' .. name .. '\n' .. tostring(info),
      'フックの組み立てに失敗: ' .. name .. '\n' .. tostring(info)
    )
  end
  WP26.hookState[name] = { script = s, info = info, addr = a, orig = orig }
end
function WP26.hookOff(name)
  local st = WP26.hookState[name]
  if not st then
    return
  end
  if WP26.attached() then
    local ok = autoAssemble(st.script, st.info)
    if not ok then
      writeBytes(st.addr, st.orig)
    end -- fallback: restore original bytes
  end
  WP26.hookState[name] = nil
end

----------------------------------------------------------------- features
function WP26.feature(key, on)
  local f = WP26.F[key] or WP26.err('Unknown feature: ' .. key, '未定義の機能: ' .. key)
  if on then
    WP26.require()
    for _, h in ipairs(f.hooks or {}) do
      WP26.hookOn(h)
    end
    if f.flag then
      writeBytes(WP26.flag(f.flag), 1)
    end
    if f.on then
      f.on()
    end
    WP26.featOn[key] = true
  else
    WP26.featOn[key] = nil
    if not WP26.attached() then
      return
    end
    if f.flag then
      writeBytes(WP26.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(WP26.featOn) do
        for _, x in ipairs(WP26.F[k].hooks or {}) do
          if x == h then
            used = true
          end
        end
      end
      if not used then
        WP26.hookOff(h)
      end
    end
  end
end

----------------------------------------------------------------- timer (pointer slots, tasks, process watch)
function WP26.tick()
  if not WP26.pid then
    return
  end
  if not WP26.attached() then
    WP26.msg(
      'Game process changed or exited. Run [ATTACH / ALL OFF] again.',
      'ゲームプロセスが変わったか終了しました。【アタッチ／一括解除】を再実行してください。'
    )
    WP26.forgetProcess()
    return
  end
  local b = WP26.base()
  if not b then
    return
  end
  for slot, fn in pairs(WP26.PTRS) do
    local ok, a = pcall(fn)
    writeQword(b + WP26.OFF_PTRS + slot * 8, (ok and a) or 0)
  end
  for k in pairs(WP26.featOn) do
    local f = WP26.F[k]
    if f.task then
      pcall(f.task)
    end
  end
  for n in pairs(WP26.pend) do
    WP26.resolveSig(n)
  end
end
function WP26.startTimer()
  if WP26.timer then
    return
  end
  WP26.timer = createTimer(nil, false)
  WP26.timer.Interval = WP26.TICK_MS
  WP26.timer.OnTimer = function()
    pcall(WP26.tick)
  end
  WP26.timer.Enabled = true
end

----------------------------------------------------------------- ATTACH / ALL OFF
function WP26.disableAll(self)
  local ok, changed = pcall(WP26.attachGame)
  if not ok then
    print('[' .. WP26.TAG .. '] ' .. tostring(changed))
    return
  end
  if changed or (WP26.pid and WP26.pid ~= getOpenedProcessID()) then
    WP26.forgetProcess()
  end
  local okI, e = pcall(WP26.init)
  if not okI then
    print('[' .. WP26.TAG .. '] ' .. 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(WP26.hookState) do
    WP26.hookOff(name)
    r = r + 1
  end
  for i = 0, 0xFF do
    writeBytes(WP26.flag(i), 0)
  end
  WP26.featOn = {}
  WP26.msg(
    ('Attach / All OFF: %d records deactivated, %d hooks restored.'):format(n, r),
    ('アタッチ／一括解除: %d件を無効化、%d件のフックを元に戻しました。'):format(n, r)
  )
end

----------------------------------------------------------------- UI helpers

-- dynamic records (lists built at run time)
function WP26.clearChildren(mr)
  while mr.Count > 0 do
    mr.Child[0].destroy()
  end
end
function WP26.addHdr(parent, en, ja)
  local m = getAddressList().createMemoryRecord()
  m.IsGroupHeader = true
  m.Options = '[moManualExpandCollapse]'
  m.Description = WP26.T(en, ja)
  m.Color = WP26.C_GROUP
  m.appendToEntry(parent)
  m.DontSave = true
  WP26.dyn[#WP26.dyn + 1] = { mr = m, id = m.ID, en = en, ja = ja }
  return m
end
function WP26.addRec(parent, en, ja, addr, vt)
  local m = getAddressList().createMemoryRecord()
  m.Description = WP26.T(en, ja)
  m.Type = vt or vtDword
  m.Address = addr
  m.appendToEntry(parent)
  m.DontSave = true
  WP26.dyn[#WP26.dyn + 1] = { mr = m, id = m.ID, en = en, ja = ja }
  return m
end

----------------------------------------------------------------- language
function WP26.applyLang()
  local al = getAddressList()
  for i = 0, al.Count - 1 do
    local m = al.getMemoryRecord(i)
    local n = WP26.NAMES[m.ID]
    if n then
      local d = (WP26.lang == 'ja') and n[2] or n[1]
      if WP26.suffix[m.ID] then
        d = d .. ' : ' .. WP26.suffix[m.ID]
      end
      m.Description = d
    end
  end
  local keep = {}
  for _, e in ipairs(WP26.dyn) do
    local row = e.id and al.getMemoryRecordByID(e.id)
    if row then
      row.Description = WP26.T(e.en, e.ja)
      keep[#keep + 1] = e
    end
  end
  WP26.dyn = keep
end
function WP26.setLang(l)
  WP26.lang = l
  WP26.applyLang()
end

----------------------------------------------------------------- diagnostics
-- Lua Engine window: record ID 13 is a toggle (check = open / uncheck = close)
function WP26.luaEngine()
  local ok, f = pcall(getLuaEngine)
  if ok then
    return f
  end
end
function WP26.openLuaEngine(quiet)
  local f = WP26.luaEngine()
  if f then
    pcall(function()
      f.show()
    end)
    pcall(function()
      f.bringToFront()
    end)
  end
  if not quiet then
    WP26.msg(
      'Lua Engine opened. Messages of this table are printed here.',
      'Lua Engineを開きました。このテーブルのメッセージはここに表示されます。'
    )
  end
end
function WP26.closeLuaEngine()
  local f = WP26.luaEngine()
  if f then
    pcall(function()
      f.hide()
    end)
  end
end
function WP26.envReport()
  WP26.openLuaEngine(true)
  local pid = getOpenedProcessID()
  print(('[%s] CE version      : %s'):format(WP26.TAG, tostring(getCEVersion and getCEVersion())))
  print(
    ('[%s] target process  : %s (running PID %s / opened PID %s / table PID %s)'):format(
      WP26.TAG,
      WP26.EXE,
      tostring(getProcessIDFromProcessName(WP26.EXE)),
      tostring(pid),
      tostring(WP26.pid)
    )
  )
  local okx, x64 = pcall(targetIs64Bit)
  print(('[%s] target 64-bit   : %s'):format(WP26.TAG, tostring(okx and x64)))
  local m = WP26.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(
        WP26.TAG,
        WP26.MODULE,
        m,
        WP26.modSize() or 0,
        ts or 0
      )
    )
    if WP26.BUILD then
      print(
        ('[%s] expected build  : timestamp=%X size=%X (v%s)'):format(
          WP26.TAG,
          WP26.BUILD.ts,
          WP26.BUILD.size or 0,
          WP26.GAMEVER
        )
      )
    end
  else
    print(('[%s] module          : %s NOT FOUND'):format(WP26.TAG, WP26.MODULE))
  end
  print(('[%s] shared memory   : gtFlags=%s'):format(WP26.TAG, WP26.base() and hex(WP26.base()) or 'not allocated'))
  print(('[%s] attached        : %s'):format(WP26.TAG, tostring(WP26.attached())))
end
function WP26.scanSelfTest()
  WP26.openLuaEngine(true)
  WP26.require()
  local okn, bad = 0, 0
  local names = {}
  for n in pairs(WP26.SIGS) do
    names[#names + 1] = n
  end
  table.sort(names)
  for _, name in ipairs(names) do
    local sg = WP26.SIGS[name]
    local m = WP26.mod(sg.mod)
    local sz = WP26.modSize(sg.mod)
    local r = aobAll(sg.p, m, m + sz, 3)
    local got = {}
    for i, a in ipairs(r) do
      got[i] = string.format('%s+%X', sg.mod or WP26.MODULE, a - m)
    end
    local st = (#r == 1) and 'OK' or ((#r == 0) and 'NOT FOUND' or 'NOT UNIQUE')
    if #r == 1 then
      okn = okn + 1
    else
      bad = bad + 1
    end
    print(('[%s]   %-16s %-10s %s'):format(WP26.TAG, name, st, table.concat(got, ', ')))
  end
  WP26.msg(
    ('AOB self-test done: %d OK, %d NG.'):format(okn, bad),
    ('AOBスキャンテスト完了: 正常 %d件、異常 %d件。'):format(okn, bad)
  )
end
function WP26.statusReport()
  WP26.openLuaEngine(true)
  local l = WP26.pendingNames()
  print(('[%s] unresolved signatures: %s'):format(WP26.TAG, #l > 0 and table.concat(l, ', ') or '-'))
  local h = {}
  for n, st in pairs(WP26.hookState) do
    h[#h + 1] = ('%s@%X'):format(n, st.addr)
  end
  table.sort(h)
  print(('[%s] active hooks        : %s'):format(WP26.TAG, #h > 0 and table.concat(h, ', ') or '-'))
  local f = {}
  for k in pairs(WP26.featOn) do
    f[#f + 1] = k
  end
  table.sort(f)
  print(('[%s] features on         : %s'):format(WP26.TAG, #f > 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(WP26.TAG, #a > 0 and table.concat(a, ' / ') or '-'))
end

WP26.SPEC = {
  ['player'] = {
    ['rva'] = 1243472,
    ['pattern'] = '48 8D 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC 89 4C 24 08 57',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = true,
    ['target_rva'] = 66918480,
  },
  ['horse'] = {
    ['rva'] = 681943,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 8B 04 01 83 E0 7F C3 CC CC CC CC CC CC CC CC CC CC CC 48 89 5C 24 08',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67233624,
  },
  ['race'] = {
    ['rva'] = 2662178,
    ['pattern'] = '48 03 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC 44 8B 05 ?? ?? ?? ??',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67282456,
  },
  ['owned'] = {
    ['rva'] = 1034583,
    ['pattern'] = '48 8B 0D ?? ?? ?? ?? 48 8D 84 01 00 01 00 00 48 83 C4 38',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67380736,
  },
  ['sire'] = {
    ['rva'] = 2072945,
    ['pattern'] = '48 8B 0D ?? ?? ?? ?? 48 03 C8 48 8B C1 48 83 C4 38 C3 CC CC CC CC',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67380608,
  },
  ['mare'] = {
    ['rva'] = 942388,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 8B 44 01 08 C1 E8 16 83 E0 1F C3',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67283480,
  },
  ['owner'] = {
    ['rva'] = 1051470,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 8B 44 01 1C C1 E8 19 C3 B8 64 00 00 00',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67283504,
  },
  ['farm'] = {
    ['rva'] = 1073566,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 0F B6 44 01 07 C3 B8 94 00 00 00',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67282416,
  },
  ['staff'] = {
    ['rva'] = 1102429,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 48 C1 E1 05 8B 14 01 C1 EA 1C 83 FA 0A',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67234280,
  },
  ['staffDynamic'] = {
    ['rva'] = 1102394,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 8B 14 01 83 E2 0F EB ?? 66 83 F9 73',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67282320,
  },
  ['trainer'] = {
    ['rva'] = 2662539,
    ['pattern'] = '48 8B 0D ?? ?? ?? ?? 48 03 C8 48 8B C1 48 83 C4 38 C3 CC CC CC 89 54 24 10',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67380656,
  },
  ['jockey'] = {
    ['rva'] = 2662334,
    ['pattern'] = '48 03 05 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC CC CC 66 89 4C 24 08',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67283200,
  },
  ['secretary'] = {
    ['rva'] = 1217732,
    ['pattern'] = '48 8B 05 ?? ?? ?? ?? 8B 04 01 C1 E8 0C 83 E0 7F C3 CC',
    ['disp'] = 3,
    ['len'] = 7,
    ['direct'] = false,
    ['target_rva'] = 67283536,
  },
  ['horseSpeedSet'] = {
    ['rva'] = 681968,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 64 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 7F 4C 6B C7 38 0F B7 CF',
  },
  ['horseStaminaSet'] = {
    ['rva'] = 682400,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 64 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 7F 4C 6B C7 38 C1 E3 07',
  },
  ['horsePowerSet'] = {
    ['rva'] = 696544,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 0F B7 CF',
  },
  ['horseGutsSet'] = {
    ['rva'] = 696688,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 C1 E3 08',
  },
  ['horseIntelligenceSet'] = {
    ['rva'] = 696832,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 C1 E3 0C',
  },
  ['horseMentalSet'] = {
    ['rva'] = 696976,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 C1 E3 10',
  },
  ['horseAccelerationSet'] = {
    ['rva'] = 697120,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 C1 E3 14',
  },
  ['horseFlexibilitySet'] = {
    ['rva'] = 697264,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 83 E3 0F 4C 6B C7 38 C1 E3 18',
  },
  ['horseHealthSet'] = {
    ['rva'] = 697408,
    ['pattern'] = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 2D 70 00 00 8B DA 66 3B F8 73 ?? 83 FA 0F 77 ?? 0F B7 CF E8 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 0F B7 CF',
  },
  ['itemCount'] = {
    ['rva'] = 1505904,
    ['pattern'] = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ?? ?? ?? ?? 85 C0 75 ?? 33 C0 E9 ?? ?? ?? ?? 0F B7 4C 24 40 E8 ?? ?? ?? ?? 85 C0 74 ?? 0F B7 4C 24 40',
  },
  ['itemSet'] = {
    ['rva'] = 1506448,
    ['pattern'] = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ?? ?? ?? ?? 85 C0 74 ?? E9 ?? ?? ?? ??',
  },
  ['itemLimit'] = {
    ['rva'] = 1507120,
    ['pattern'] = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ?? ?? ?? ?? 85 C0 74 ?? B8 FF FF FF FF',
  },
}
WP26.EDITORS = {
  ['player'] = {
    ['record'] = 210,
    ['en'] = 'Player editor',
    ['ja'] = 'プレイヤーエディタ',
    ['data'] = 'player',
    ['stride'] = 0,
    ['max'] = 0,
    ['fields'] = {
      {
        ['en'] = 'Money (internal unit)',
        ['ja'] = '所持金（内部単位）',
        ['off'] = 0,
        ['bit'] = 0,
        ['bits'] = 32,
        ['max'] = 99999999,
        ['source'] = '130140/1301C0',
      },
      {
        ['en'] = 'Club money (internal unit)',
        ['ja'] = 'クラブ所持金（内部単位）',
        ['off'] = 12,
        ['bit'] = 0,
        ['bits'] = 32,
        ['max'] = 99999999,
        ['source'] = '130140/1301C0',
      },
      {
        ['en'] = 'Green charm',
        ['ja'] = '緑のお守り',
        ['off'] = 267,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 99,
        ['source'] = '132410/132450',
      },
      {
        ['en'] = 'Bronze charm',
        ['ja'] = '銅のお守り',
        ['off'] = 268,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 99,
        ['source'] = '132410/132450',
      },
      {
        ['en'] = 'Silver charm',
        ['ja'] = '銀のお守り',
        ['off'] = 269,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 99,
        ['source'] = '132410/132450',
      },
      {
        ['en'] = 'Gold charm',
        ['ja'] = '金のお守り',
        ['off'] = 270,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 99,
        ['source'] = '132410/132450',
      },
      {
        ['en'] = 'Rainbow charm',
        ['ja'] = '虹のお守り',
        ['off'] = 271,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 99,
        ['source'] = '132410/132450',
      },
    },
    ['maxEn'] = 'Max money / charms (includes club money)',
    ['maxJa'] = '所持金・お守りMAX（クラブ所持金含む）',
  },
  ['owned'] = {
    ['record'] = 310,
    ['en'] = 'Owned horse editor',
    ['ja'] = '所有馬エディタ',
    ['data'] = 'owned',
    ['stride'] = 760,
    ['max'] = 639,
    ['fields'] = {
      {
        ['en'] = 'Condition',
        ['ja'] = '調子',
        ['off'] = 12,
        ['bit'] = 15,
        ['bits'] = 6,
        ['max'] = 50,
        ['base'] = 'race',
        ['source'] = 'BF720/BF7B0',
      },
      {
        ['en'] = 'Fatigue',
        ['ja'] = '疲労',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'race',
        ['source'] = 'C0220/C02A0',
      },
      {
        ['en'] = 'Condition trend',
        ['ja'] = '調子の波',
        ['off'] = 24,
        ['bit'] = 0,
        ['bits'] = 2,
        ['max'] = 3,
        ['base'] = 'race',
        ['source'] = 'C00F0/C0170',
      },
      {
        ['en'] = 'Trainer ID',
        ['ja'] = '調教師ID',
        ['off'] = 40,
        ['bit'] = 0,
        ['bits'] = 10,
        ['max'] = 813,
        ['base'] = 'race',
        ['source'] = 'C7D40/C7DF0',
      },
      {
        ['en'] = 'Speed (base)',
        ['ja'] = 'スピード（基本値）',
        ['off'] = 0,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A67C0/A67F0',
        ['setter'] = 'horseSpeedSet',
      },
      {
        ['en'] = 'Stamina (base)',
        ['ja'] = 'スタミナ（基本値）',
        ['off'] = 0,
        ['bit'] = 7,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A6970/A69A0',
        ['setter'] = 'horseStaminaSet',
      },
      {
        ['en'] = 'Power (base)',
        ['ja'] = 'パワー（基本値）',
        ['off'] = 12,
        ['bit'] = 8,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseGutsSet',
        ['source'] = 'UI 71333C -> CC990; native setter AA170',
      },
      {
        ['en'] = 'Guts (base)',
        ['ja'] = '勝負根性（基本値）',
        ['off'] = 12,
        ['bit'] = 20,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseAccelerationSet',
        ['source'] = 'UI 713471 -> CCE30; native setter AA320',
      },
      {
        ['en'] = 'Intelligence (base)',
        ['ja'] = '賢さ（基本値）',
        ['off'] = 12,
        ['bit'] = 24,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseFlexibilitySet',
        ['source'] = 'UI 7134D8 -> CCF80; native setter AA3B0',
      },
      {
        ['en'] = 'Mental strength (base)',
        ['ja'] = '精神力（基本値）',
        ['off'] = 12,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseHealthSet',
        ['source'] = 'UI 71353F -> CD0C0; native setter AA440',
      },
      {
        ['en'] = 'Acceleration (base)',
        ['ja'] = '瞬発力（基本値）',
        ['off'] = 12,
        ['bit'] = 16,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseMentalSet',
        ['source'] = 'UI 71340A -> CCCE0; native setter AA290',
      },
      {
        ['en'] = 'Flexibility (base)',
        ['ja'] = '柔軟性（基本値）',
        ['off'] = 12,
        ['bit'] = 12,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseIntelligenceSet',
        ['source'] = 'UI 7133A3 -> CCAE0; native setter AA200',
      },
      {
        ['en'] = 'Health (base)',
        ['ja'] = '健康（基本値）',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horsePowerSet',
        ['source'] = 'UI 7132D5 -> CC840; native setter AA0E0',
      },
    },
    ['maxEn'] = 'Max selected horse base abilities (9 fields)',
    ['maxJa'] = '選択馬の基本能力MAX（9項目）',
  },
  ['race'] = {
    ['record'] = 330,
    ['en'] = 'Racehorse editor',
    ['ja'] = '競走馬エディタ',
    ['data'] = 'race',
    ['stride'] = 232,
    ['max'] = 0xffff,
    ['fields'] = {
      {
        ['en'] = 'Condition',
        ['ja'] = '調子',
        ['off'] = 12,
        ['bit'] = 15,
        ['bits'] = 6,
        ['max'] = 50,
        ['base'] = 'race',
        ['source'] = 'BF720/BF7B0',
      },
      {
        ['en'] = 'Fatigue',
        ['ja'] = '疲労',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'race',
        ['source'] = 'C0220/C02A0',
      },
      {
        ['en'] = 'Condition trend',
        ['ja'] = '調子の波',
        ['off'] = 24,
        ['bit'] = 0,
        ['bits'] = 2,
        ['max'] = 3,
        ['base'] = 'race',
        ['source'] = 'C00F0/C0170',
      },
      {
        ['en'] = 'Trainer ID',
        ['ja'] = '調教師ID',
        ['off'] = 40,
        ['bit'] = 0,
        ['bits'] = 10,
        ['max'] = 813,
        ['base'] = 'race',
        ['source'] = 'C7D40/C7DF0',
      },
      {
        ['en'] = 'Speed (base)',
        ['ja'] = 'スピード（基本値）',
        ['off'] = 0,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A67C0/A67F0',
        ['setter'] = 'horseSpeedSet',
      },
      {
        ['en'] = 'Stamina (base)',
        ['ja'] = 'スタミナ（基本値）',
        ['off'] = 0,
        ['bit'] = 7,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A6970/A69A0',
        ['setter'] = 'horseStaminaSet',
      },
      {
        ['en'] = 'Power (base)',
        ['ja'] = 'パワー（基本値）',
        ['off'] = 12,
        ['bit'] = 8,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseGutsSet',
        ['source'] = 'UI 71333C -> CC990; native setter AA170',
      },
      {
        ['en'] = 'Guts (base)',
        ['ja'] = '勝負根性（基本値）',
        ['off'] = 12,
        ['bit'] = 20,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseAccelerationSet',
        ['source'] = 'UI 713471 -> CCE30; native setter AA320',
      },
      {
        ['en'] = 'Intelligence (base)',
        ['ja'] = '賢さ（基本値）',
        ['off'] = 12,
        ['bit'] = 24,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseFlexibilitySet',
        ['source'] = 'UI 7134D8 -> CCF80; native setter AA3B0',
      },
      {
        ['en'] = 'Mental strength (base)',
        ['ja'] = '精神力（基本値）',
        ['off'] = 12,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseHealthSet',
        ['source'] = 'UI 71353F -> CD0C0; native setter AA440',
      },
      {
        ['en'] = 'Acceleration (base)',
        ['ja'] = '瞬発力（基本値）',
        ['off'] = 12,
        ['bit'] = 16,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseMentalSet',
        ['source'] = 'UI 71340A -> CCCE0; native setter AA290',
      },
      {
        ['en'] = 'Flexibility (base)',
        ['ja'] = '柔軟性（基本値）',
        ['off'] = 12,
        ['bit'] = 12,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseIntelligenceSet',
        ['source'] = 'UI 7133A3 -> CCAE0; native setter AA200',
      },
      {
        ['en'] = 'Health (base)',
        ['ja'] = '健康（基本値）',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horsePowerSet',
        ['source'] = 'UI 7132D5 -> CC840; native setter AA0E0',
      },
    },
    ['maxEn'] = 'Max selected horse base abilities (9 fields)',
    ['maxJa'] = '選択馬の基本能力MAX（9項目）',
  },
  ['sire'] = {
    ['record'] = 350,
    ['en'] = 'Stallion editor',
    ['ja'] = '種牡馬エディタ',
    ['data'] = 'sire',
    ['stride'] = 104,
    ['max'] = 1999,
    ['fields'] = {
      {
        ['en'] = 'Speed (base)',
        ['ja'] = 'スピード（基本値）',
        ['off'] = 0,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A67C0/A67F0',
        ['setter'] = 'horseSpeedSet',
      },
      {
        ['en'] = 'Stamina (base)',
        ['ja'] = 'スタミナ（基本値）',
        ['off'] = 0,
        ['bit'] = 7,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A6970/A69A0',
        ['setter'] = 'horseStaminaSet',
      },
      {
        ['en'] = 'Power (base)',
        ['ja'] = 'パワー（基本値）',
        ['off'] = 12,
        ['bit'] = 8,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseGutsSet',
        ['source'] = 'UI 71333C -> CC990; native setter AA170',
      },
      {
        ['en'] = 'Guts (base)',
        ['ja'] = '勝負根性（基本値）',
        ['off'] = 12,
        ['bit'] = 20,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseAccelerationSet',
        ['source'] = 'UI 713471 -> CCE30; native setter AA320',
      },
      {
        ['en'] = 'Intelligence (base)',
        ['ja'] = '賢さ（基本値）',
        ['off'] = 12,
        ['bit'] = 24,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseFlexibilitySet',
        ['source'] = 'UI 7134D8 -> CCF80; native setter AA3B0',
      },
      {
        ['en'] = 'Mental strength (base)',
        ['ja'] = '精神力（基本値）',
        ['off'] = 12,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseHealthSet',
        ['source'] = 'UI 71353F -> CD0C0; native setter AA440',
      },
      {
        ['en'] = 'Acceleration (base)',
        ['ja'] = '瞬発力（基本値）',
        ['off'] = 12,
        ['bit'] = 16,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseMentalSet',
        ['source'] = 'UI 71340A -> CCCE0; native setter AA290',
      },
      {
        ['en'] = 'Flexibility (base)',
        ['ja'] = '柔軟性（基本値）',
        ['off'] = 12,
        ['bit'] = 12,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseIntelligenceSet',
        ['source'] = 'UI 7133A3 -> CCAE0; native setter AA200',
      },
      {
        ['en'] = 'Health (base)',
        ['ja'] = '健康（基本値）',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horsePowerSet',
        ['source'] = 'UI 7132D5 -> CC840; native setter AA0E0',
      },
      {
        ['en'] = 'Breeding years elapsed (display adds 1)',
        ['ja'] = '繁殖経過年数（画面表示は＋1）',
        ['off'] = 4,
        ['bit'] = 26,
        ['bits'] = 5,
        ['max'] = 31,
        ['source'] = 'DDC40/DDC90',
      },
    },
    ['maxEn'] = 'Max selected horse base abilities (9 fields)',
    ['maxJa'] = '選択馬の基本能力MAX（9項目）',
  },
  ['mare'] = {
    ['record'] = 370,
    ['en'] = 'Broodmare editor',
    ['ja'] = '繁殖牝馬エディタ',
    ['data'] = 'mare',
    ['stride'] = 68,
    ['max'] = 9999,
    ['fields'] = {
      {
        ['en'] = 'Speed (base)',
        ['ja'] = 'スピード（基本値）',
        ['off'] = 0,
        ['bit'] = 0,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A67C0/A67F0',
        ['setter'] = 'horseSpeedSet',
      },
      {
        ['en'] = 'Stamina (base)',
        ['ja'] = 'スタミナ（基本値）',
        ['off'] = 0,
        ['bit'] = 7,
        ['bits'] = 7,
        ['max'] = 100,
        ['base'] = 'horse',
        ['source'] = 'A6970/A69A0',
        ['setter'] = 'horseStaminaSet',
      },
      {
        ['en'] = 'Power (base)',
        ['ja'] = 'パワー（基本値）',
        ['off'] = 12,
        ['bit'] = 8,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseGutsSet',
        ['source'] = 'UI 71333C -> CC990; native setter AA170',
      },
      {
        ['en'] = 'Guts (base)',
        ['ja'] = '勝負根性（基本値）',
        ['off'] = 12,
        ['bit'] = 20,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseAccelerationSet',
        ['source'] = 'UI 713471 -> CCE30; native setter AA320',
      },
      {
        ['en'] = 'Intelligence (base)',
        ['ja'] = '賢さ（基本値）',
        ['off'] = 12,
        ['bit'] = 24,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseFlexibilitySet',
        ['source'] = 'UI 7134D8 -> CCF80; native setter AA3B0',
      },
      {
        ['en'] = 'Mental strength (base)',
        ['ja'] = '精神力（基本値）',
        ['off'] = 12,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseHealthSet',
        ['source'] = 'UI 71353F -> CD0C0; native setter AA440',
      },
      {
        ['en'] = 'Acceleration (base)',
        ['ja'] = '瞬発力（基本値）',
        ['off'] = 12,
        ['bit'] = 16,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseMentalSet',
        ['source'] = 'UI 71340A -> CCCE0; native setter AA290',
      },
      {
        ['en'] = 'Flexibility (base)',
        ['ja'] = '柔軟性（基本値）',
        ['off'] = 12,
        ['bit'] = 12,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horseIntelligenceSet',
        ['source'] = 'UI 7133A3 -> CCAE0; native setter AA200',
      },
      {
        ['en'] = 'Health (base)',
        ['ja'] = '健康（基本値）',
        ['off'] = 16,
        ['bit'] = 0,
        ['bits'] = 4,
        ['max'] = 15,
        ['base'] = 'horse',
        ['setter'] = 'horsePowerSet',
        ['source'] = 'UI 7132D5 -> CC840; native setter AA0E0',
      },
      {
        ['en'] = 'Breeding years elapsed (display adds 1)',
        ['ja'] = '繁殖経過年数（画面表示は＋1）',
        ['off'] = 8,
        ['bit'] = 22,
        ['bits'] = 5,
        ['max'] = 31,
        ['source'] = 'E6120/E6150',
      },
      {
        ['en'] = 'Foal count',
        ['ja'] = '出産頭数',
        ['off'] = 12,
        ['bit'] = 26,
        ['bits'] = 5,
        ['max'] = 31,
        ['source'] = 'E62B0/E62E0',
      },
    },
    ['maxEn'] = 'Max selected horse base abilities (9 fields)',
    ['maxJa'] = '選択馬の基本能力MAX（9項目）',
  },
  ['owner'] = {
    ['record'] = 410,
    ['en'] = 'Owner editor',
    ['ja'] = '馬主エディタ',
    ['data'] = 'owner',
    ['stride'] = 140,
    ['max'] = 47,
    ['fields'] = {
      {
        ['en'] = 'Friendship',
        ['ja'] = '友好度',
        ['off'] = 28,
        ['bit'] = 25,
        ['bits'] = 7,
        ['max'] = 100,
        ['source'] = '100B20/100B70',
      },
      {
        ['en'] = 'Fame',
        ['ja'] = '名声',
        ['off'] = 12,
        ['bit'] = 0,
        ['bits'] = 20,
        ['max'] = 999999,
        ['source'] = '1020D0/102120',
      },
    },
    ['maxEn'] = 'Max friendship / fame',
    ['maxJa'] = '友好度・名声MAX',
  },
  ['trainer'] = {
    ['record'] = 450,
    ['en'] = 'Trainer editor',
    ['ja'] = '調教師エディタ',
    ['data'] = 'trainer',
    ['stride'] = 148,
    ['max'] = 813,
    ['fields'] = {
      {
        ['en'] = 'Friendship',
        ['ja'] = '友好度',
        ['off'] = 32,
        ['bit'] = 15,
        ['bits'] = 7,
        ['max'] = 100,
        ['source'] = '1157C0/115820',
      },
      {
        ['en'] = 'Inspiration (experience)',
        ['ja'] = '閃き（経験値）',
        ['off'] = 85,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '1167C0/116840',
      },
      {
        ['en'] = 'Horse appraisal (experience)',
        ['ja'] = '相馬眼（経験値）',
        ['off'] = 86,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '1167C0/116840',
      },
      {
        ['en'] = 'Condition management (experience)',
        ['ja'] = '体調管理（経験値）',
        ['off'] = 87,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '1167C0/116840',
      },
      {
        ['en'] = 'Weight management (experience)',
        ['ja'] = '体重管理（経験値）',
        ['off'] = 88,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '1167C0/116840',
      },
      {
        ['en'] = 'Training (experience)',
        ['ja'] = '調教（経験値）',
        ['off'] = 89,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '1167C0/116840',
      },
    },
    ['maxEn'] = 'Max friendship / ability experience',
    ['maxJa'] = '友好度・能力経験値MAX',
  },
  ['jockey'] = {
    ['record'] = 430,
    ['en'] = 'Jockey editor',
    ['ja'] = '騎手エディタ',
    ['data'] = 'jockey',
    ['stride'] = 140,
    ['max'] = 585,
    ['fields'] = {
      {
        ['en'] = 'Friendship',
        ['ja'] = '友好度',
        ['off'] = 36,
        ['bit'] = 8,
        ['bits'] = 7,
        ['max'] = 100,
        ['source'] = '122700/1227B0',
      },
      {
        ['en'] = 'Front-running / forward (experience)',
        ['ja'] = '逃げ・先行（経験値）',
        ['off'] = 65,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '123710/1237C0',
      },
      {
        ['en'] = 'Forward / closer (experience)',
        ['ja'] = '先行・差し（経験値）',
        ['off'] = 66,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '123710/1237C0',
      },
      {
        ['en'] = 'Closer / late runner (experience)',
        ['ja'] = '差し・追込（経験値）',
        ['off'] = 67,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 255,
        ['source'] = '123710/1237C0',
      },
    },
    ['maxEn'] = 'Max friendship / ability experience',
    ['maxJa'] = '友好度・能力経験値MAX',
  },
  ['staff'] = {
    ['record'] = 470,
    ['en'] = 'Farm manager editor',
    ['ja'] = '牧場長エディタ',
    ['data'] = 'staff',
    ['stride'] = 96,
    ['max'] = 147,
    ['fields'] = {
      {
        ['en'] = 'Horse appraisal',
        ['ja'] = '相馬眼',
        ['off'] = 0,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 10,
        ['source'] = '10D220',
      },
      {
        ['en'] = 'Breeding',
        ['ja'] = '種付け',
        ['off'] = 4,
        ['bit'] = 0,
        ['bits'] = 4,
        ['max'] = 10,
        ['source'] = '10D3A0',
      },
      {
        ['en'] = 'Bloodline knowledge',
        ['ja'] = '血統知識',
        ['off'] = 4,
        ['bit'] = 4,
        ['bits'] = 4,
        ['max'] = 10,
        ['source'] = '10D520',
      },
      {
        ['en'] = 'Breaking-in',
        ['ja'] = '馴致',
        ['off'] = 4,
        ['bit'] = 8,
        ['bits'] = 4,
        ['max'] = 10,
        ['source'] = '10D6B0',
      },
      {
        ['en'] = 'Health management',
        ['ja'] = '健康管理',
        ['off'] = 4,
        ['bit'] = 28,
        ['bits'] = 4,
        ['max'] = 10,
        ['source'] = '10D840',
      },
    },
    ['maxEn'] = 'Max five abilities',
    ['maxJa'] = '能力MAX（5項目）',
  },
  ['secretary'] = {
    ['record'] = 490,
    ['en'] = 'Secretary / acquaintance editor',
    ['ja'] = '秘書・知人エディタ',
    ['data'] = 'secretary',
    ['stride'] = 68,
    ['max'] = 819,
    ['fields'] = {
      {
        ['en'] = 'Friendship',
        ['ja'] = '友好度',
        ['off'] = 0,
        ['bit'] = 12,
        ['bits'] = 7,
        ['max'] = 100,
        ['source'] = '1294B0/1294E0',
      },
    },
    ['maxEn'] = 'Max friendship',
    ['maxJa'] = '友好度MAX',
  },
  ['farm'] = {
    ['record'] = 510,
    ['en'] = 'Farm editor',
    ['ja'] = '牧場エディタ',
    ['data'] = 'farm',
    ['stride'] = 204,
    ['max'] = 36,
    ['fields'] = {
      {
        ['en'] = 'Manager ID',
        ['ja'] = '牧場長ID',
        ['off'] = 7,
        ['bit'] = 0,
        ['bits'] = 8,
        ['max'] = 147,
        ['source'] = '106170/1061C0',
      },
      {
        ['en'] = 'Friendship',
        ['ja'] = '友好度',
        ['off'] = 8,
        ['bit'] = 6,
        ['bits'] = 5,
        ['max'] = 23,
        ['source'] = '106420/106490',
      },
    },
    ['maxEn'] = 'Max friendship',
    ['maxJa'] = '友好度MAX',
  },
}
WP26.ITEMS = {
  {
    ['id'] = 0,
    ['en'] = 'Foal / racehorse ability reveal ticket',
    ['ja'] = '幼駒・競走馬 能力開示チケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 1,
    ['en'] = 'Foal / racehorse limit break ticket',
    ['ja'] = '幼駒・競走馬 限界突破チケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 2,
    ['en'] = 'Descendant encouragement ticket',
    ['ja'] = '子孫 夢への後押しチケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 3,
    ['en'] = 'Descendant sex / face selection ticket',
    ['ja'] = '子孫 性別・顔選択チケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 4,
    ['en'] = 'Broodmare foal sex selection ticket',
    ['ja'] = '繁殖牝馬 牡牝の産み分けチケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 5,
    ['en'] = 'Strongest Horse Road / Online continue ticket',
    ['ja'] = '最強馬ロード・オンライン コンティニューチケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 6,
    ['en'] = 'Online special horse-card ticket',
    ['ja'] = '最強馬ロード・オンライン 名馬カード スペシャルゲットチケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 7,
    ['en'] = 'Online SR horse-card limit break ticket',
    ['ja'] = '最強馬ロード・オンライン 名馬カード SR限界突破チケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 8,
    ['en'] = 'Online SSR horse-card limit break ticket',
    ['ja'] = '最強馬ロード・オンライン 名馬カード SSR限界突破チケット',
    ['category'] = 'Server-backed tickets',
    ['categoryJa'] = 'サーバー照会型チケット',
  },
  {
    ['id'] = 9,
    ['en'] = 'Coat catalog: Tobiano',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「トビアノ柄」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 10,
    ['en'] = 'Coat catalog: Roan',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「粕毛」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 11,
    ['en'] = 'Coat catalog: White markings',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「白毛斑」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 12,
    ['en'] = 'Coat catalog: Bay markings',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「鹿毛斑」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 13,
    ['en'] = 'Coat catalog: Palomino',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「月毛」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 14,
    ['en'] = 'Coat catalog: Buckskin',
    ['ja'] = 'オンライン対戦報酬毛色名鑑「河原毛」',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 15,
    ['en'] = 'Additional historical overseas foal purchase right',
    ['ja'] = '海外史実幼駒追加購入権',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 16,
    ['en'] = 'Overseas stallion covering right for overseas farm broodmares',
    ['ja'] = '海外牧場の繁殖牝馬への海外種牡馬種付け権',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 17,
    ['en'] = 'Extra historical training use (consumable)',
    ['ja'] = '史実調教使用可能数＋１（消費型・月１回のみ）',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 18,
    ['en'] = 'Trust-boosting carrot',
    ['ja'] = '信頼度アップのニンジン',
    ['category'] = 'Local reward items',
    ['categoryJa'] = 'ローカル報酬品',
  },
  {
    ['id'] = 19,
    ['en'] = 'Item 19 / 愛に満ちあふれた名馬たち 購入権セット 全４頭',
    ['ja'] = '愛に満ちあふれた名馬たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 20,
    ['en'] = 'Item 20 / 愛に満ちあふれた名馬たち 購入権セット 全４頭',
    ['ja'] = '愛に満ちあふれた名馬たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 21,
    ['en'] = 'Item 21 / 強敵に立ち向かった名馬たち 購入権セット 全４頭',
    ['ja'] = '強敵に立ち向かった名馬たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 22,
    ['en'] = 'Item 22 / スタートダッシュセット',
    ['ja'] = 'スタートダッシュセット',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 23,
    ['en'] = 'Item 23 / 既存秘書・やよい＆夕映＆芽愛＆リオン コスプレ衣装セット 全１６点',
    ['ja'] = '既存秘書・やよい＆夕映＆芽愛＆リオン コスプレ衣装セット 全１６点',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 24,
    ['en'] = 'Item 24 / 新秘書・白鷺 七夏 コスプレ衣装セット 全１６点',
    ['ja'] = '新秘書・白鷺 七夏 コスプレ衣装セット 全１６点',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 25,
    ['en'] = 'Item 25 / 競走馬 所有可能数＋５',
    ['ja'] = '競走馬 所有可能数＋５',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 26,
    ['en'] = 'Item 26 / 繁殖牝馬 所有可能数＋５',
    ['ja'] = '繁殖牝馬 所有可能数＋５',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 27,
    ['en'] = 'Item 27 / 種牡馬 所有可能数＋５',
    ['ja'] = '種牡馬 所有可能数＋５',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 28,
    ['en'] = 'Item 28 / 放牧場面積＋５',
    ['ja'] = '放牧場面積＋５',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 29,
    ['en'] = 'Item 29 / 放牧場・育成場面積＋２',
    ['ja'] = '放牧場・育成場面積＋２',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 30,
    ['en'] = 'Item 30 / 牧場施設「低酸素トレッドミル」＆放牧場面積＋１',
    ['ja'] = '牧場施設「低酸素トレッドミル」＆放牧場面積＋１',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 31,
    ['en'] = 'Item 31 / 牧場施設「飼葉スチーマー」＆放牧場面積＋３',
    ['ja'] = '牧場施設「飼葉スチーマー」＆放牧場面積＋３',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 32,
    ['en'] = 'Item 32 / 放牧場面積＋２＆最強馬ロード・オンライン-名馬カードコレクターセット',
    ['ja'] = '放牧場面積＋２＆最強馬ロード・オンライン-名馬カードコレクターセット',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 33,
    ['en'] = 'Item 33 / 牧場 工事期間５０％短縮',
    ['ja'] = '牧場 工事期間５０％短縮',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 34,
    ['en'] = 'Item 34 / 毛色名鑑セット（５種）',
    ['ja'] = '毛色名鑑セット（５種）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 35,
    ['en'] = 'Item 35 / 米国・欧州牧場 最速開設セット',
    ['ja'] = '米国・欧州牧場 最速開設セット',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 36,
    ['en'] = 'Item 36 / 全世界 史実種牡馬＆繁殖牝馬 無料選択購入権セット',
    ['ja'] = '全世界 史実種牡馬＆繁殖牝馬 無料選択購入権セット',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 37,
    ['en'] = 'Item 37 / 史実調教使用可能数＋１（永続型）',
    ['ja'] = '史実調教使用可能数＋１（永続型）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 38,
    ['en'] = 'Item 38 / 秘書・知人・牧場長・騎手・調教師 最速結婚可能セット',
    ['ja'] = '秘書・知人・牧場長・騎手・調教師 最速結婚可能セット',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 39,
    ['en'] = 'Item 39 / 1968年スタート 日本馬スターホース購入権セット その１ 全５頭',
    ['ja'] = '1968年スタート 日本馬スターホース購入権セット その１ 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 40,
    ['en'] = 'Item 40 / 1968年スタート 日本馬スターホース購入権セット その２ 全７頭',
    ['ja'] = '1968年スタート 日本馬スターホース購入権セット その２ 全７頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 41,
    ['en'] = 'Item 41 / 1968年スタート 海外馬スターホース購入権セット その１ 全８頭',
    ['ja'] = '1968年スタート 海外馬スターホース購入権セット その１ 全８頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 42,
    ['en'] = 'Item 42 / 1968年スタート 海外馬スターホース購入権セット その２ 全７頭',
    ['ja'] = '1968年スタート 海外馬スターホース購入権セット その２ 全７頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 43,
    ['en'] = 'Item 43 / 1967年生まれ 日本馬・海外馬スターホース購入権セット 全９頭',
    ['ja'] = '1967年生まれ 日本馬・海外馬スターホース購入権セット 全９頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 44,
    ['en'] = 'Item 44 / 常識を覆した名馬たち 購入権セット 全５頭',
    ['ja'] = '常識を覆した名馬たち 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 45,
    ['en'] = 'Item 45 / 花の47年組 購入権セット 全７頭',
    ['ja'] = '花の47年組 購入権セット 全７頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 46,
    ['en'] = 'Item 46 / 初代アイドルホース・ハイセイコーの時代 購入権セット 全４頭',
    ['ja'] = '初代アイドルホース・ハイセイコーの時代 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 47,
    ['en'] = 'Item 47 / 華麗なる一族の祖と八大競走の覇者たち 購入権セット 全６頭',
    ['ja'] = '華麗なる一族の祖と八大競走の覇者たち 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 48,
    ['en'] = 'Item 48 / クラシック３冠の激闘 購入権セット 全６頭',
    ['ja'] = 'クラシック３冠の激闘 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 49,
    ['en'] = 'Item 49 / 芦毛の怪物の激闘 購入権セット 全５頭',
    ['ja'] = '芦毛の怪物の激闘 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 50,
    ['en'] = 'Item 50 / 帝王とお祭り男の激闘 購入権セット 全６頭',
    ['ja'] = '帝王とお祭り男の激闘 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 51,
    ['en'] = 'Item 51 / シャドーロールの激闘 購入権セット 全４頭',
    ['ja'] = 'シャドーロールの激闘 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 52,
    ['en'] = 'Item 52 / 98世代の激闘 購入権セット 全４頭',
    ['ja'] = '98世代の激闘 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 53,
    ['en'] = 'Item 53 / 記憶に残る最強逃げ馬 購入権セット 全５頭',
    ['ja'] = '記憶に残る最強逃げ馬 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 54,
    ['en'] = 'Item 54 / 記憶に残る最強追い込み馬 購入権セット 全４頭',
    ['ja'] = '記憶に残る最強追い込み馬 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 55,
    ['en'] = 'Item 55 / 記憶に残る最強スプリンター 購入権セット 全４頭',
    ['ja'] = '記憶に残る最強スプリンター 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 56,
    ['en'] = 'Item 56 / 記憶に残る最強マイラー 購入権セット 全４頭',
    ['ja'] = '記憶に残る最強マイラー 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 57,
    ['en'] = 'Item 57 / 記憶に残る最強ダート馬 購入権セット 全５頭',
    ['ja'] = '記憶に残る最強ダート馬 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 58,
    ['en'] = 'Item 58 / 名家の血脈 購入権セット 全５頭',
    ['ja'] = '名家の血脈 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 59,
    ['en'] = 'Item 59 / 大王の血脈 購入権セット 全５頭',
    ['ja'] = '大王の血脈 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 60,
    ['en'] = 'Item 60 / 衝撃の血脈 購入権セット 全４頭',
    ['ja'] = '衝撃の血脈 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 61,
    ['en'] = 'Item 61 / 黄金の血脈 購入権セット 全５頭',
    ['ja'] = '黄金の血脈 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 62,
    ['en'] = 'Item 62 / 他を圧倒する王者の誇り 購入権セット 全５頭',
    ['ja'] = '他を圧倒する王者の誇り 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 63,
    ['en'] = 'Item 63 / 牝馬３冠の誇り 購入権セット 全５頭',
    ['ja'] = '牝馬３冠の誇り 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 64,
    ['en'] = 'Item 64 / 女帝たる誇り 購入権セット 全５頭',
    ['ja'] = '女帝たる誇り 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 65,
    ['en'] = 'Item 65 / 銀冠から掴んだ頂点の誇り 購入権セット 全５頭',
    ['ja'] = '銀冠から掴んだ頂点の誇り 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 66,
    ['en'] = 'Item 66 / オリジナルスーパーホース 購入権セット 全６頭',
    ['ja'] = 'オリジナルスーパーホース 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 67,
    ['en'] = 'Item 67 / 世界で火花を散らしたライバルたち 購入権セット 全１０頭',
    ['ja'] = '世界で火花を散らしたライバルたち 購入権セット 全１０頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 68,
    ['en'] = 'Item 68 / 世界 名誉ある王者たち 購入権セット 全４頭',
    ['ja'] = '世界 名誉ある王者たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 69,
    ['en'] = 'Item 69 / 世界 驚嘆の王者たち 購入権セット 全５頭',
    ['ja'] = '世界 驚嘆の王者たち 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 70,
    ['en'] = 'Item 70 / 世界 伝説の王者たち 購入権セット 全６頭',
    ['ja'] = '世界 伝説の王者たち 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 71,
    ['en'] = 'Item 71 / 世界 偉大なる王者たち 購入権セット 全６頭',
    ['ja'] = '世界 偉大なる王者たち 購入権セット 全６頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 72,
    ['en'] = 'Item 72 / 世界 永遠の王者たち 購入権セット 全５頭',
    ['ja'] = '世界 永遠の王者たち 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 73,
    ['en'] = 'Item 73 / 世界 奇跡の王者たち 購入権セット 全４頭',
    ['ja'] = '世界 奇跡の王者たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 74,
    ['en'] = 'Item 74 / 世界 はかなき王者たち 購入権セット 全３頭',
    ['ja'] = '世界 はかなき王者たち 購入権セット 全３頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 75,
    ['en'] = 'Item 75 / 世界 栄えある王者たち 購入権セット 全４頭',
    ['ja'] = '世界 栄えある王者たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 76,
    ['en'] = 'Item 76 / 世界 絶対王者たち 購入権セット 全４頭',
    ['ja'] = '世界 絶対王者たち 購入権セット 全４頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 77,
    ['en'] = 'Item 77 / 世界 新時代の王者たち 購入権セット 全５頭',
    ['ja'] = '世界 新時代の王者たち 購入権セット 全５頭',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 78,
    ['en'] = 'Item 78 / 牧場長・夢乃美空の利用権',
    ['ja'] = '牧場長・夢乃美空の利用権',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 79,
    ['en'] = 'Item 79 / 牧野若葉の衣装変更（水着）',
    ['ja'] = '牧野若葉の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 80,
    ['en'] = 'Item 80 / 牧野双葉の衣装変更（水着）',
    ['ja'] = '牧野双葉の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 81,
    ['en'] = 'Item 81 / 椎野はるかの衣装変更（水着）',
    ['ja'] = '椎野はるかの衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 82,
    ['en'] = 'Item 82 / 結城江奈の衣装変更（水着）',
    ['ja'] = '結城江奈の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 83,
    ['en'] = 'Item 83 / 橘もえぎの衣装変更（水着）',
    ['ja'] = '橘もえぎの衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 84,
    ['en'] = 'Item 84 / 駒野みのりの衣装変更（水着）',
    ['ja'] = '駒野みのりの衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 85,
    ['en'] = 'Item 85 / 青草ひまりの衣装変更（水着）',
    ['ja'] = '青草ひまりの衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 86,
    ['en'] = 'Item 86 / 鳥海藍の衣装変更（水着）',
    ['ja'] = '鳥海藍の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 87,
    ['en'] = 'Item 87 / 十和田夏美の衣装変更（水着）',
    ['ja'] = '十和田夏美の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 88,
    ['en'] = 'Item 88 / 夢乃美空の衣装変更（水着）',
    ['ja'] = '夢乃美空の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 89,
    ['en'] = 'Item 89 / 茅野翠月の衣装変更（水着）',
    ['ja'] = '茅野翠月の衣装変更（水着）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 90,
    ['en'] = 'Item 90 / 牧野若葉の衣装変更（RPG風）',
    ['ja'] = '牧野若葉の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 91,
    ['en'] = 'Item 91 / 牧野双葉の衣装変更（RPG風）',
    ['ja'] = '牧野双葉の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 92,
    ['en'] = 'Item 92 / 椎野はるかの衣装変更（RPG風）',
    ['ja'] = '椎野はるかの衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 93,
    ['en'] = 'Item 93 / 結城江奈の衣装変更（RPG風）',
    ['ja'] = '結城江奈の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 94,
    ['en'] = 'Item 94 / 橘もえぎの衣装変更（RPG風）',
    ['ja'] = '橘もえぎの衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 95,
    ['en'] = 'Item 95 / 駒野みのりの衣装変更（RPG風）',
    ['ja'] = '駒野みのりの衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 96,
    ['en'] = 'Item 96 / 青草ひまりの衣装変更（RPG風）',
    ['ja'] = '青草ひまりの衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 97,
    ['en'] = 'Item 97 / 精武万作の衣装変更（RPG風）',
    ['ja'] = '精武万作の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 98,
    ['en'] = 'Item 98 / 鳥海藍の衣装変更（RPG風）',
    ['ja'] = '鳥海藍の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 99,
    ['en'] = 'Item 99 / 十和田夏美の衣装変更（RPG風）',
    ['ja'] = '十和田夏美の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 100,
    ['en'] = 'Item 100 / 夢乃美空の衣装変更（RPG風）',
    ['ja'] = '夢乃美空の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 101,
    ['en'] = 'Item 101 / 茅野翠月の衣装変更（RPG風）',
    ['ja'] = '茅野翠月の衣装変更（RPG風）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 102,
    ['en'] = 'Item 102 / 牧野若葉の衣装変更（アイドル）',
    ['ja'] = '牧野若葉の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 103,
    ['en'] = 'Item 103 / 牧野双葉の衣装変更（アイドル）',
    ['ja'] = '牧野双葉の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 104,
    ['en'] = 'Item 104 / 椎野はるかの衣装変更（アイドル）',
    ['ja'] = '椎野はるかの衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 105,
    ['en'] = 'Item 105 / 結城江奈の衣装変更（アイドル）',
    ['ja'] = '結城江奈の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 106,
    ['en'] = 'Item 106 / 橘もえぎの衣装変更（アイドル）',
    ['ja'] = '橘もえぎの衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 107,
    ['en'] = 'Item 107 / 駒野みのりの衣装変更（アイドル）',
    ['ja'] = '駒野みのりの衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 108,
    ['en'] = 'Item 108 / 青草ひまりの衣装変更（アイドル）',
    ['ja'] = '青草ひまりの衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 109,
    ['en'] = 'Item 109 / 精武万作の衣装変更（アイドル）',
    ['ja'] = '精武万作の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 110,
    ['en'] = 'Item 110 / 鳥海藍の衣装変更（アイドル）',
    ['ja'] = '鳥海藍の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 111,
    ['en'] = 'Item 111 / 十和田夏美の衣装変更（アイドル）',
    ['ja'] = '十和田夏美の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 112,
    ['en'] = 'Item 112 / 夢乃美空の衣装変更（アイドル）',
    ['ja'] = '夢乃美空の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 113,
    ['en'] = 'Item 113 / 茅野翠月の衣装変更（アイドル）',
    ['ja'] = '茅野翠月の衣装変更（アイドル）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 114,
    ['en'] = 'Item 114 / 牧野若葉の衣装変更（十二支）',
    ['ja'] = '牧野若葉の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 115,
    ['en'] = 'Item 115 / 牧野双葉の衣装変更（十二支）',
    ['ja'] = '牧野双葉の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 116,
    ['en'] = 'Item 116 / 椎野はるかの衣装変更（十二支）',
    ['ja'] = '椎野はるかの衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 117,
    ['en'] = 'Item 117 / 結城江奈の衣装変更（十二支）',
    ['ja'] = '結城江奈の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 118,
    ['en'] = 'Item 118 / 橘もえぎの衣装変更（十二支）',
    ['ja'] = '橘もえぎの衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 119,
    ['en'] = 'Item 119 / 駒野みのりの衣装変更（十二支）',
    ['ja'] = '駒野みのりの衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 120,
    ['en'] = 'Item 120 / 青草ひまりの衣装変更（十二支）',
    ['ja'] = '青草ひまりの衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 121,
    ['en'] = 'Item 121 / 精武万作の衣装変更（十二支）',
    ['ja'] = '精武万作の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 122,
    ['en'] = 'Item 122 / 鳥海藍の衣装変更（十二支）',
    ['ja'] = '鳥海藍の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 123,
    ['en'] = 'Item 123 / 十和田夏美の衣装変更（十二支）',
    ['ja'] = '十和田夏美の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 124,
    ['en'] = 'Item 124 / 夢乃美空の衣装変更（十二支）',
    ['ja'] = '夢乃美空の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
  {
    ['id'] = 125,
    ['en'] = 'Item 125 / 茅野翠月の衣装変更（十二支）',
    ['ja'] = '茅野翠月の衣装変更（十二支）',
    ['category'] = 'DLC / costumes / rights',
    ['categoryJa'] = 'DLC・衣装・利用権',
  },
}
-- Winning Post 10 2026: game-specific extensions to GameTemplate V02.
-- Native editor overrides: lazy unique scans and nonmodal errors. The explicit race toggle owns its allocation and hook.
-- Edits are explicit one-shot actions; opening/loading this table does not attach or write.
WP26.selected = {}
WP26.history = {}
WP26.resolved = {}
WP26.entities = {}
WP26.healthTimer = nil
function WP26.userRun(fn)
  local ok, e = pcall(fn)
  if not ok then
    WP26.msg('Stopped: ' .. tostring(e), '中止: ' .. tostring(e))
  end
  return ok
end
function WP26.checkExactBuild()
  local m = WP26.mod()
  if not m then
    WP26.err('Game module is not loaded.', 'ゲームモジュールが読み込まれていません。')
  end
  local pe = readInteger(m + 0x3c)
  if not pe or readInteger(m + pe + 8) ~= WP26.BUILD.ts or WP26.modSize() ~= WP26.BUILD.size then
    WP26.err(
      'Unsupported binary. Editing is disabled.',
      '対応外のバイナリです。編集を停止しました。'
    )
  end
end
function WP26.attached()
  return WP26.pid and WP26.pid == getOpenedProcessID() and WP26.pid == getProcessIDFromProcessName(WP26.EXE)
end
function WP26.require()
  if not WP26.attached() then
    WP26.err(
      'Run ATTACH / ALL OFF first.',
      '先に最上段の【アタッチ／一括解除】を実行してください。'
    )
  end
  WP26.checkExactBuild()
end
function WP26.stopHealth()
  if WP26.stopConditionEntry137 then WP26.stopConditionEntry137() end
  if WP26.healthTimer then
    WP26.healthTimer.destroy()
    WP26.healthTimer = nil
  end
end
function WP26.forgetProcess()
  if WP26.recordDeactivateTimers then
    for _, timer in pairs(WP26.recordDeactivateTimers) do
      if WP26.uiTimers then
        WP26.uiTimers[timer] = nil
      end
      timer.destroy()
    end
    WP26.recordDeactivateTimers = {}
  end
  if WP26.editorOpenTimers then
    for _, timer in pairs(WP26.editorOpenTimers) do
      if WP26.uiTimers then
        WP26.uiTimers[timer] = nil
      end
      timer.destroy()
    end
    WP26.editorOpenTimers = {}
  end
  if WP26.editTimer then
    WP26.editTimer.destroy()
    WP26.editTimer = nil
  end
  WP26.pendingEdits = {}
  WP26.stopHealth()
  WP26.pid = nil
  WP26.resolved = {}
  WP26.selected = {}
  WP26.history = {}
  WP26.A = {}
  WP26.pend = {}
  WP26.featOn = {}
  WP26.hookState = {}
end
function WP26.disableAll(self)
  if WP26.editTimer then
    WP26.editTimer.destroy()
    WP26.editTimer = nil
  end
  WP26.pendingEdits = {}
  WP26.stopHealth()
  if WP26.uiTimers then
    for t in pairs(WP26.uiTimers) do
      t.destroy()
    end
    WP26.uiTimers = {}
  end
  WP26.editorOpenTimers = {}
  WP26.recordDeactivateTimers = {}
  local al = getAddressList()
  for i = al.Count - 1, 0, -1 do
    local m = al.getMemoryRecord(i)
    if m.Active and m ~= self then
      m.Active = false
    end
  end
  WP26.attachGame()
  WP26.checkExactBuild()
  local p = getOpenedProcessID()
  if WP26.pid ~= p then
    WP26.forgetProcess()
  end
  WP26.pid = p
  WP26.msg(
    'Attached. Repeating actions stopped; completed edits remain.',
    '接続しました。継続処理を停止しました。適用済みの値は維持されます。'
  )
end
function WP26.resolve(name)
  WP26.require()
  local s = WP26.SPEC[name]
  if not s then
    WP26.err('Unknown resolver.', '解決定義がありません。')
  end
  local got = WP26.resolved[name]
  if not got then
    local b = WP26.mod()
    local hits = WP26.aobAll(s.pattern, b, b + WP26.modSize(), 2)
    if #hits ~= 1 then
      WP26.pend[name] = true
      WP26.err(
        'Code signature is missing or ambiguous: ' .. name,
        'コードが未検出、または一致が複数あります: ' .. name
      )
    end
    got = hits[1]
    WP26.resolved[name] = got
    WP26.A[name] = got
    WP26.pend[name] = nil
  end
  return got
end
function WP26.data(name)
  local a = WP26.resolve(name)
  local s = WP26.SPEC[name]
  if not s.disp then
    return a
  end
  local d = readInteger(a + s.disp)
  if not d then
    WP26.err('Unreadable instruction.', '命令を読み取れません。')
  end
  if d >= 0x80000000 then
    d = d - 0x100000000
  end
  local p = a + s.len + d
  if not s.direct then
    p = readQword(p)
  end
  if not p or p < 0x10000 or not readBytes(p, 1) then
    WP26.err(
      'Data is not available. Load a save.',
      'データを取得できません。セーブをロードしてください。'
    )
  end
  return p
end
function WP26.bits(p, o, bit, n)
  local b = readBytes(p + o, math.ceil((bit + n) / 8), true)
  if not b then
    WP26.err('Data read failed.', 'データを読み取れません。')
  end
  local v = 0
  for i = #b, 1, -1 do
    v = (v << 8) | b[i]
  end
  return (v >> bit) & ((1 << n) - 1)
end
function WP26.native(name, ...)
  local a = WP26.resolve(name)
  local r = executeCodeEx(0, 5000, a, ...)
  if r == nil then
    WP26.err(
      'Game function did not complete; do not retry automatically.',
      'ゲーム関数の完了を確認できません。自動再試行は停止します。'
    )
  end
  return r
end
function WP26.personContext(ctx)
  local key, id = ctx.key, ctx.id
  if key ~= 'trainer' and key ~= 'jockey' then
    return
  end
  if not WP26.personRosterIncludes183(key,id) then return false end
  local first = WP26.personCompactFirst182(key)
  if id >= first then
    ctx.personDynamic = true
    ctx.primary = WP26.namePointer(key == 'trainer' and 0x402a5e0 or 0x402a5c0) + (id - first) * 0x54
  end
  local off = key == 'trainer' and 0x10 or (ctx.personDynamic and 12 or 6)
  local bit = key == 'trainer' and ctx.personDynamic and 11 or 0
  local n = WP26.bits(ctx.primary, off, bit, 11)
  local name = WP26.personNamePointer182(n)
  if not name then return false end
  ctx.personData = name
  ctx.personName = ctx.personData
  if key == 'jockey' and (id == 484 or id == 485) then
    local role = id - 477
    local variant = 0
    if readInteger(WP26.mod() + 0x3ec94f8) ~= 0 then
      variant = readBytes(WP26.mod() + 0x3fd1850 + 0x6c52 + role, 1)
    end
    if not variant or variant >= 30 then
      return false
    end
    ctx.childNames = true
    ctx.personName = WP26.data('acquaintance') + (role * 30 + variant) * 0x44
  end
  return true
end
function WP26.fieldAvailable(ctx, f)
  if f.personDynamicOnly and not ctx.personDynamic then
    return false
  end
  if ctx.personDynamic and f.personOrdinaryOnly then
    return false
  end
  if ctx.staffDynamic and f.ordinaryOnly then
    return false
  end
  if f.playerFarmOnly and (ctx.id < 32 or ctx.id > 35) then
    return false
  end
  return true
end
function WP26.context(key, id)
  WP26.require()
  local d = WP26.EDITORS[key]
  if not d or not id or id % 1 ~= 0 or id < 0 or (key ~= 'race' and key ~= 'owned' and id > (WP26.entityLimit180 and WP26.entityLimit180(key) or d.max)) then
    WP26.err('ID out of range.', 'IDが範囲外です。')
  end
  local snapshot = (key == 'race' or key == 'owned') and (WP26.raceSnapshotActive179 or WP26.raceSnapshot179()) or nil
  if key == 'owned' then assert(id < snapshot.ownedCount, 'Ownership slot is outside the game range') end
  local p = key == 'race' and assert(WP26.racePointer179(id, snapshot), 'No active racehorse record for this ID') or key == 'sire' and assert(WP26.sirePointer181(id), 'Sire region unavailable') or WP26.data(d.data) + (d.stride or 0) * id
  local ctx = { key = key, id = id, primary = p }
  if WP26.personContext(ctx) == false then
    error('Person profile unavailable', 0)
  end
  if key == 'player' then
    ctx.playerOwner = WP26.data('owner') + 46 * 0x8c
  end
  if key == 'staff' and id >= 116 then
    ctx.primary = WP26.data('staffDynamic') + (id - 116) * 0x3c
    ctx.staffDynamic = true
  end
  if key == 'owned' then
    local raceID = WP26.bits(p, 4, 2, 14)
    ctx.race = assert(WP26.racePointer179(raceID, snapshot), 'Ownership slot has no active racehorse record')
    ctx.raceID = raceID
  elseif key == 'race' then
    ctx.race = p
    ctx.raceID = id
  end
  if ctx.race then
    local h = WP26.bits(ctx.race, 0, 0, 15)
    if h >= 0x702d then
      WP26.err('Horse base data is not present.', '馬の基本データがありません。')
    end
    ctx.horse = WP26.data('horse') + h * 0x38
    ctx.horseID = h
  elseif key == 'sire' or key == 'mare' then
    local h = WP26.bits(p, 8, 0, 15)
    if h >= 0x702d then
      WP26.err('Horse base data is not present.', '馬の基本データがありません。')
    end
    ctx.horse = WP26.data('horse') + h * 0x38
    ctx.horseID = h
  end
  return ctx
end
function WP26.fieldLayout(ctx, f)
  if ctx.key == 'secretary' and ctx.id >= 90 and ctx.id < 120 then
    local foreign =
      { ['Family name'] = 25, ['Given name'] = 8, ['Family name reading'] = 51, ['Given name reading'] = 42 }
    if foreign[f.en] then
      return foreign[f.en], f.bit, f.bits
    end
  end
  if f.base == 'personName' then
    return ctx.childNames and (f.en == 'Family name' and 8 or 0x19) or f.off, f.bit, f.bits
  end
  if ctx.personDynamic and f.base ~= 'personData' and f.base ~= 'personName' then
    if f.en:find('(experience)', 1, true) then
      local start = ctx.key == 'trainer' and 0x55 or 0x41
      return (ctx.key == 'trainer' and 0x46 or 0x17) + f.off - start, 0, 8
    end
    if f.en == 'Current-year prize money' then
      return ctx.key == 'trainer' and 8 or 0, 0, 24
    end
    local pos = {
      ['Current year: Wins'] = 1,
      ['Current year: Second places'] = 2,
      ['Current year: Third places'] = 3,
      ['Current year: Other finishes'] = 4,
    }
    local i = pos[f.en]
    if i then
      local t = ctx.key == 'trainer' and { { 0, 10 }, { 0, 21 }, { 4, 0 }, { 4, 11 } }
        or { { 4, 0 }, { 4, 11 }, {
          8,
          0,
        }, {
          8,
          11,
        } }
      return t[i][1], t[i][2], 11
    end
  end
  if ctx.staffDynamic and not f.ordinaryOnly then
    local map = {
      ['Horse appraisal'] = 0,
      ['Breeding'] = 4,
      ['Bloodline knowledge'] = 8,
      ['Breaking-in'] = 12,
      ['Health management'] = 28,
    }
    return 0, map[f.en], f.bits
  end
  return f.off, f.bit, f.bits
end
function WP26.fieldRead(ctx, f)
  if f.traitSlot ~= nil then
    return WP26.traitRead(ctx, f.traitSlot)
  end
  if f.string then
    local o = WP26.fieldLayout(ctx, f)
    if f.encodedName then
      return WP26.decodeName(ctx[f.base or 'primary'] + o, f.max + 1)
    end
    return WP26.nameText(ctx[f.base or 'primary'] + o, f.max)
  end
  local o, b, n = WP26.fieldLayout(ctx, f)
  return WP26.bits(ctx[f.base or 'primary'], o, b, n) * (f.displayScale or 1) + (f.displayAdd or 0)
end
function WP26.writeField(ctx, f, v, journal)
  WP26.require()
  if not WP26.fieldAvailable(ctx, f) then
    error(
      WP26.T(
        'This field does not belong to the selected person.',
        '選択人物にはこの項目がありません。'
      ),
      0
    )
  end
  if f.specialty ~= nil and ctx.key == 'trainer' and v and v >= (ctx.personDynamic and 1 or 200) then
    local pairs = { [12] = 13, [13] = 12, [14] = 15, [15] = 14 }
    local other = pairs[f.specialty]
    if other then
      local acquired = ctx.personDynamic and WP26.bits(ctx.primary, 0x43 + math.floor(other / 8), other % 8, 1) == 1
        or not ctx.personDynamic and WP26.bits(ctx.primary, 0x41 + other, 0, 8) >= 200
      if acquired then
        error(
          WP26.T('Clear the conflicting specialty first.', '両立しない特性を先に解除してください。'),
          0
        )
      end
    end
  end
  if f.traitSlot ~= nil then
    return WP26.writeTrait(ctx, f, v, journal)
  end
  if f.umasonaSlot ~= nil then
    return WP26.writeUmasona(ctx, f, v, journal)
  end
  if f.string then
    local encoded
    if f.encodedName then
      encoded, v = WP26.encodeName(v)
    else
      encoded = utf8ToAnsi(v)
    end
    if #encoded > f.max or encoded:find('%z') then
      error(WP26.T('Name is too long.', '名前が長すぎます。'), 0)
    end
    local o = WP26.fieldLayout(ctx, f)
    local address = ctx[f.base or 'primary'] + o
    local original = readBytes(address, f.max + 1, true)
    if not original then
      error('Name read failed', 0)
    end
    local old = WP26.fieldRead(ctx, f)
    local bytes = {}
    for i = 1, f.max + 1 do
      bytes[i] = encoded:byte(i) or 0
    end
    if not writeBytes(address, bytes) or WP26.fieldRead(ctx, f) ~= v then
      writeBytes(address, original)
      error('Name update failed', 0)
    end
    if journal ~= false then
      WP26.history[#WP26.history + 1] = {
        pid = WP26.pid,
        ctx = ctx,
        field = f,
        old = old,
        new = v,
        address = address,
        stringBefore = original,
        stringAfter = readBytes(address, f.max + 1, true),
      }
    end
    return
  end
  if not v or v % 1 ~= 0 or v < (f.min or 0) or v > f.max then
    WP26.err('Value is outside the supported range.', '値が対応範囲外です。')
  end
  if f.displayScale and (v - (f.displayAdd or 0)) % f.displayScale ~= 0 then
    error(
      WP26.T(
        'Use increments of ' .. f.displayScale .. '.',
        '値は' .. f.displayScale .. '刻みで入力してください。'
      ),
      0
    )
  end
  if f.currentWeight then
    local ideal = WP26.bits(ctx.race, 10, 0, 8) * 2 + 300
    if math.abs(v - ideal) > 40 then
      error(
        WP26.T(
          'Weight must be within 40 kg of ideal weight.',
          '現在馬体重は理想馬体重の±40kg以内です。'
        ),
        0
      )
    end
  end
  local p = ctx[f.base or 'primary']
  if not p then
    WP26.err('Editor context is unavailable.', '編集対象を取得できません。')
  end
  local old = WP26.fieldRead(ctx, f)
  if old == v then
    return
  end
  local off, bit, bits = WP26.fieldLayout(ctx, f)
  local a = p + off
  local size = (bits == 8 and bit == 0) and 1 or ((bits == 16 and bit == 0) and 2 or 4)
  local orig = readBytes(a, size, true)
  local function pack(value)
    value = (value - (f.displayAdd or 0)) / (f.displayScale or 1)
    local raw = 0
    for i = size, 1, -1 do
      raw = (raw << 8) | orig[i]
    end
    local mask = ((1 << bits) - 1) << bit
    raw = (raw & ~mask) | ((value << bit) & mask)
    local bytes = {}
    for i = 1, size do
      bytes[i] = raw & 255
      raw = raw >> 8
    end
    return bytes
  end
  if f.raceSetter then
    if not ctx.raceID then
      error('Racehorse identity unavailable', 0)
    end
    WP26.native(f.raceSetter, ctx.raceID, v)
    if WP26.fieldRead(ctx, f) ~= v then
      WP26.native(f.raceSetter, ctx.raceID, old)
      error(
        WP26.T(
          'Racehorse update failed; restoration requested.',
          '競走馬の更新を確認できず、復元を要求しました。'
        ),
        0
      )
    end
  elseif f.jockeyDistanceFoundation069 ~= nil then
    WP26.native('jockeyDistanceFoundationSet069', ctx.id, f.jockeyDistanceFoundation069, v)
    if WP26.fieldRead(ctx, f) ~= v then
      WP26.native('jockeyDistanceFoundationSet069', ctx.id, f.jockeyDistanceFoundation069, old)
      error(
        WP26.T(
          'Jockey distance foundation update failed.',
          '騎手の距離基礎値を更新できませんでした。'
        ),
        0
      )
    end
  elseif f.jockeyFoundation067 ~= nil then
    WP26.native('jockeyFoundationSet067', ctx.id, f.jockeyFoundation067, v)
    if WP26.fieldRead(ctx, f) ~= v then
      WP26.native('jockeyFoundationSet067', ctx.id, f.jockeyFoundation067, old)
      error(WP26.T('Jockey foundation update failed.', '騎手の基礎値を更新できませんでした。'), 0)
    end
  elseif f.base == 'horse' then
    if not f.setter then
      WP26.err('Native horse setter is missing.', '馬の更新関数が定義されていません。')
    end
    if f.setterIndex ~= nil then
      WP26.native(f.setter, ctx.horseID, f.setterIndex, v)
    else
      WP26.native(f.setter, ctx.horseID, v)
    end
    if WP26.fieldRead(ctx, f) ~= v then
      if f.setterIndex ~= nil then
        WP26.native(f.setter, ctx.horseID, f.setterIndex, old)
      else
        WP26.native(f.setter, ctx.horseID, old)
      end
      WP26.err(
        'Native horse update could not be verified; original value was requested.',
        '馬の更新を確認できず、元の値への復元を要求しました。'
      )
    end
  elseif not writeBytes(a, pack(v)) or WP26.fieldRead(ctx, f) ~= v then
    writeBytes(a, orig)
    WP26.err(
      'Write verification failed; original bytes were restored.',
      '書き込み確認に失敗し、元のバイトへ復元しました。'
    )
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = { pid = WP26.pid, ctx = ctx, field = f, old = old, new = v, address = a }
    if #WP26.history > 4096 then
      table.remove(WP26.history, 1)
    end
  end
end
function WP26.addAction(parent, en, ja, call)
  local m = WP26.addRec(parent, en, ja, '0', vtAutoAssembler)
  m.Color = WP26.C_SCRIPT
  m.Script = '[ENABLE]\n{$lua}\nif syntaxcheck then return end\nWP26.oneShot(memrec,function() '
    .. call
    .. ' end)\n{$asm}\n[DISABLE]\n'
  return m
end

function WP26.deferEditor(key)
  local d = WP26.EDITORS[key]
  if not d then
    return
  end
  WP26.uiTimers = WP26.uiTimers or {}
  WP26.editorOpenTimers = WP26.editorOpenTimers or {}
  local previous = WP26.editorOpenTimers[d.record]
  if previous then
    WP26.uiTimers[previous] = nil
    previous.destroy()
    WP26.editorOpenTimers[d.record] = nil
  end
  local timer = createTimer(nil, false)
  timer.Interval = 350
  WP26.uiTimers[timer] = true
  WP26.editorOpenTimers[d.record] = timer
  timer.OnTimer = function(t)
    WP26.uiTimers[t] = nil
    if WP26.editorOpenTimers[d.record] ~= t then
      t.destroy()
      return
    end
    WP26.editorOpenTimers[d.record] = nil
    t.destroy()
    local parent = getAddressList().getMemoryRecordByID(d.record)
    if not parent or not parent.Active then
      return
    end
    WP26.userRun(function()
      WP26.refreshEditor(key)
    end)
  end
  timer.Enabled = true
end

function WP26.writeUmasona(ctx, f, value, journal)
  if type(value) ~= 'number' or value % 1 ~= 0 or value < 0 or value > 92 then
    error('Invalid Umasona', 0)
  end
  local fresh = WP26.context(ctx.key, ctx.id)
  if fresh.horseID ~= ctx.horseID or fresh.horse ~= ctx.horse then
    error('Horse changed', 0)
  end
  local slot = f.umasonaSlot
  local address = ctx.horse + 0x18 + slot * 2
  local before = readBytes(address, 2, true)
  if not before then
    error('Umasona read failed', 0)
  end
  if (before[1] & 127) == value then
    return
  end
  local ok, err = pcall(function()
    WP26.native('umasonaKindSet', ctx.horseID, slot, value)
    WP26.native('umasonaStateSet', ctx.horseID, slot, value == 0 and 0 or 3)
    for _, name in ipairs({
      'umasonaState2Set',
      'umasonaState3Set',
      'umasonaFlag1Set',
      'umasonaFlag2Set',
      'umasonaFlag3Set',
    }) do
      WP26.native(name, ctx.horseID, slot, 0)
    end
    if readSmallInteger(address) ~= value + (value == 0 and 0 or 0x300) then
      error('Umasona update verification failed', 0)
    end
  end)
  if not ok then
    writeBytes(address, before)
    error(err, 0)
  end
  local after = readBytes(address, 2, true)
  if journal ~= false then
    WP26.history[#WP26.history + 1] =
      { kind = 'umasona', pid = WP26.pid, ctx = ctx, slot = slot, before = before, after = after }
  end
end

function WP26.undoLast()
  WP26.require()
  local h = WP26.history[#WP26.history]
  if not h then
    WP26.msg('No recorded edits.', '戻せる変更はありません。')
    return
  end
  if h.kind == 'umasona' then
    if WP26.pid ~= h.pid then
      error('Process changed', 0)
    end
    local ctx = WP26.context(h.ctx.key, h.ctx.id)
    if ctx.horseID ~= h.ctx.horseID or ctx.horse ~= h.ctx.horse then
      error('Horse changed', 0)
    end
    local address = ctx.horse + 0x18 + h.slot * 2
    local now = readBytes(address, 2, true)
    if not now or now[1] ~= h.after[1] or now[2] ~= h.after[2] then
      error('Umasona changed; undo stopped', 0)
    end
    if not writeBytes(address, h.before) then
      error('Umasona restore failed', 0)
    end
    local restored = readBytes(address, 2, true)
    if restored[1] ~= h.before[1] or restored[2] ~= h.before[2] then
      error('Umasona restore verification failed', 0)
    end
    WP26.history[#WP26.history] = nil
    return
  end
  if h.kind == 'traits' then
    if WP26.pid ~= h.pid then
      error('Process changed', 0)
    end
    local ctx = WP26.context(h.ctx.key, h.ctx.id)
    if ctx.horseID ~= h.ctx.horseID or not WP26.sameTraits(WP26.traitSnapshot(ctx), h.after) then
      error('Horse traits changed', 0)
    end
    WP26.restoreTraits(ctx, h.before)
    WP26.history[#WP26.history] = nil
    return
  end
  if h.kind == 'item' then
    if h.pid ~= WP26.pid then
      WP26.err('The process changed.', 'プロセスが変更されています。')
    end
    local current = WP26.native('itemCount', h.id)
    if current ~= h.new then
      WP26.err(
        'Item count changed; undo stopped.',
        'アイテム個数が変化したため復元を停止しました。'
      )
    end
    WP26.native('itemSet', h.id, h.old)
    if WP26.native('itemCount', h.id) ~= h.old then
      WP26.err('Item undo could not be verified.', 'アイテムの復元を確認できません。')
    end
    WP26.history[#WP26.history] = nil
    WP26.msg('Item quantity restored.', 'アイテム個数を戻しました。')
    return
  end
  if h.pid ~= WP26.pid then
    WP26.err('The process changed.', 'プロセスが変更されています。')
  end
  if WP26.fieldRead(h.ctx, h.field) ~= h.new then
    WP26.err(
      'The game changed this value; undo stopped.',
      'ゲーム側で値が変化したため、復元を停止しました。'
    )
  end
  local ctx = h.ctx
  if ctx.key then
    local fresh = WP26.context(ctx.key, ctx.id)
    local off = WP26.fieldLayout(fresh, h.field)
    local target = fresh[h.field.base or 'primary'] + off
    if target ~= h.address then
      WP26.err(
        'Data address changed; undo stopped.',
        'データのアドレスが変化したため復元を停止しました。'
      )
    end
    ctx = fresh
  elseif WP26.racePointer179(ctx.id) ~= ctx.race then
    WP26.err('Horse table changed.', '競走馬テーブルが変更されています。')
  end
  if h.stringBefore then
    local now = readBytes(h.address, #h.stringBefore, true)
    if not now then
      error('Name buffer unavailable', 0)
    end
    for i = 1, #h.stringBefore do
      if now[i] ~= h.stringAfter[i] then
        error('Name buffer changed; undo stopped', 0)
      end
    end
    if not writeBytes(h.address, h.stringBefore) then
      error('Name restore failed', 0)
    end
    now = readBytes(h.address, #h.stringBefore, true)
    for i = 1, #h.stringBefore do
      if now[i] ~= h.stringBefore[i] then
        error('Name restore verification failed', 0)
      end
    end
  else
    WP26.writeField(ctx, h.field, h.old, false)
  end
  WP26.history[#WP26.history] = nil
  WP26.msg('Last field edit restored.', '直前の項目変更を戻しました。')
end
function WP26.ownedConditionSnapshot()
  WP26.require()
  local owned = WP26.data('owned')
  local snapshot = WP26.raceSnapshotActive179 or WP26.raceSnapshot179()
  local result = {}
  local seen = {}
  for slot = 0, snapshot.ownedCount - 1 do
    local raceID = WP26.bits(owned + slot * 0x2f8, 4, 2, 14)
    local p = WP26.racePointer179(raceID, snapshot)
    if p and not seen[raceID] then
      if WP26.bits(p, 0x24, 0, 13) == 46 then
        local ctx = WP26.context('owned', slot)
        if ctx.race ~= p then
          error('Ownership changed during lookup', 0)
        end
        local condition = WP26.bits(p, 0xc, 15, 6)
        local fatigue = WP26.bits(p, 0x10, 0, 7)
        if condition > 50 or fatigue > 100 or WP26.bits(p, 10, 0, 8) > 200 then
          error(WP26.T('Horse data failed validation.', '馬データの検査に失敗しました。'), 0)
        end
        result[#result + 1] = { slot = slot, raceID = raceID, horseID = ctx.horseID, race = p }
        seen[raceID] = true
      end
    end
  end
  return result
end
function WP26.maxCondition(quiet)
  local selected = WP26.ownedConditionSnapshot()
  if #selected == 0 then
    if not quiet then
      WP26.msg('No owned horses.', '所有馬が見つかりません。')
    end
    return 0
  end
  local condition = { off = 0xc, bit = 15, bits = 6, max = 50, base = 'race' }
  local fatigue = { off = 0x10, bit = 0, bits = 7, max = 100, base = 'race' }
  local spirit = {
    off = 0x17,
    bit = 0,
    bits = 8,
    min = -120,
    max = 120,
    base = 'race',
    raceSetter = 'horseSpiritSet063',
    signedSpirit063 = true,
  }
  for _, s in ipairs(selected) do
    local ctx = WP26.context('owned', s.slot)
    if
      ctx.raceID ~= s.raceID
      or ctx.horseID ~= s.horseID
      or ctx.race ~= s.race
      or WP26.bits(ctx.race, 0x24, 0, 13) ~= 46
    then
      error('Ownership changed before update', 0)
    end
    if WP26.bits(ctx.race, 12, 15, 6) ~= 50 then WP26.writeField(ctx, condition, 50, not quiet) end
    if WP26.bits(ctx.race, 16, 0, 7) ~= 0 then WP26.writeField(ctx, fatigue, 0, not quiet) end
    if WP26.bits(ctx.race, 23, 0, 8) ~= 90 then WP26.writeField(ctx, spirit, 90, not quiet) end
    local weight = { off = 11, bit = 0, bits = 8, min = 300, max = 700, displayScale = 2, displayAdd = 300, currentWeight = true, base = 'race' }
    local ideal = WP26.bits(ctx.race, 10, 0, 8) * 2 + 300
    if WP26.bits(ctx.race, 11, 0, 8) * 2 + 300 ~= ideal then WP26.writeField(ctx, weight, ideal, not quiet) end
  end
  WP26.syncConditionEntry137(selected)
  if not quiet then
    WP26.msg('Updated owned horses: ' .. #selected, '所有馬を更新: ' .. #selected .. '頭')
  end
  return #selected
end
function WP26.conditionToggle(on)
  local wasRunning = WP26.healthTimer ~= nil
  WP26.stopHealth()
  if not on then
    if wasRunning then
      WP26.msg('Condition maintenance stopped.', '調子・疲労の維持を停止しました。')
    end
    return true
  end
  if WP26.maxCondition(true) == 0 then
    WP26.msg('No owned horses.', '所有馬が見つかりません。')
    return false
  end
  WP26.startConditionEntry137()
  local timer = createTimer(nil, false)
  timer.Interval = 2000
  WP26.healthTimer = timer
  timer.OnTimer = function(t)
    if WP26.healthTimer ~= t then
      t.destroy()
      return
    end
    if not WP26.userRun(function()
      WP26.maxCondition(true)
    end) then
      WP26.stopHealth()
      local record = getAddressList().getMemoryRecordByID(102)
      if record then
        record.Active = false
      end
    end
  end
  timer.Enabled = true
  WP26.msg('Condition maintenance started.', '調子・疲労の維持を開始しました。')
  return true
end
function WP26.enableCondition(record)
  WP26.cancelRecordDeactivate(record.ID)
  local ok, result = pcall(WP26.conditionToggle, true)
  if not ok then
    WP26.stopHealth()
    WP26.msg('Stopped: ' .. tostring(result), '中止: ' .. tostring(result))
  end
  if not ok or not result then
    WP26.deferRecordDeactivate(record, 150)
  end
end

function WP26.steamInterface()
  WP26.require()
  local fn = getAddressSafe('steam_api64.SteamAPI_SteamUserStats_v013')
    or getAddressSafe('steam_api64.dll.SteamAPI_SteamUserStats_v013')
  if not fn then
    WP26.err('Steam stats export is unavailable.', 'Steam実績APIを取得できません。')
  end
  local p = executeCodeEx(0, 5000, fn)
  if not p or p == 0 then
    WP26.err('Steam stats interface is unavailable.', 'Steam実績インターフェースがありません。')
  end
  return p
end
function WP26.steamCall(name, ...)
  local fn = getAddressSafe('steam_api64.' .. name) or getAddressSafe('steam_api64.dll.' .. name)
  if not fn then
    WP26.err('Missing Steam export: ' .. name, 'Steamエクスポートがありません: ' .. name)
  end
  local r = executeCodeEx(0, 5000, fn, ...)
  if r == nil then
    WP26.err('Steam call timed out.', 'Steam APIの完了を確認できません。')
  end
  return r
end
function WP26.achievements(unlock)
  local p = WP26.steamInterface()
  local n = WP26.steamCall('SteamAPI_ISteamUserStats_GetNumAchievements', p)
  if n < 1 or n > 1000 then
    WP26.err('Unexpected achievement count.', '実績件数が想定範囲外です。')
  end
  WP26.openLuaEngine(true)
  local changed = 0
  for i = 0, n - 1 do
    local s = WP26.steamCall('SteamAPI_ISteamUserStats_GetAchievementName', p, i)
    local name = s and readString(s, 256)
    if not name or name == '' then
      WP26.err('Achievement ID read failed.', '実績IDを読み取れません。')
    end
    if unlock then
      local ok = WP26.steamCall('SteamAPI_ISteamUserStats_SetAchievement', p, s)
      if (ok & 255) == 0 then
        WP26.err('SetAchievement failed: ' .. name, '実績解除APIが失敗しました: ' .. name)
      end
      changed = changed + 1
    end
    if not unlock then
      print(i .. ' : ' .. name)
    end
  end
  if unlock then
    local ok = WP26.steamCall('SteamAPI_ISteamUserStats_StoreStats', p)
    if (ok & 255) == 0 then
      WP26.err(
        'StoreStats did not accept the request.',
        'Steamへの実績保存要求が受理されませんでした。'
      )
    end
    WP26.msg(
      'Unlock request submitted: ' .. changed .. '. Server completion is not verified.',
      '実績解除・保存要求を送信: ' .. changed .. '件。サーバー側の完了は未確認です。'
    )
  else
    WP26.msg('Achievement IDs listed: ' .. n, '実績ID一覧: ' .. n .. '件')
  end
end

function WP26.scanSelfTest()
  WP26.require()
  WP26.openLuaEngine(true)
  for name in pairs(WP26.SPEC) do
    local ok, a = pcall(WP26.resolve, name)
    print(name .. ' : ' .. (ok and string.format('OK %X', a) or tostring(a)))
  end
end

function WP26.clearChildren(mr)
  local remove = {}
  local function visit(m)
    for i = 0, m.Count - 1 do
      local child = m.Child[i]
      remove[child.ID] = true
      visit(child)
    end
  end
  visit(mr)
  local al = getAddressList()
  local keep = {}
  for _, d in ipairs(WP26.dyn) do
    local id = d.id
    if id and not remove[id] and al.getMemoryRecordByID(id) then
      keep[#keep + 1] = d
    end
  end
  WP26.dyn = keep
  while mr.Count > 0 do
    mr.Child[0].destroy()
  end
end

-- Bounded modal selector. Checkboxes permit multiple independent selections.

function WP26.initCollapse()
  local al = getAddressList()
  for i = 0, al.Count - 1 do
    local m = al.getMemoryRecord(i)
    if m.Count > 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 == WP26.ID_TOP0 then
            inZero = true
            break
          end
          p = p.Parent
        end
        pcall(function()
          m.Collapsed = not inZero
        end)
      end
    end
  end
end

WP26.NAMES = {
  [1] = { '[ATTACH / ALL OFF] WP10_2026.exe', '【アタッチ／一括解除】WP10_2026.exe' },
  [2] = { '0. Settings', '0. 設定' },
  [3] = { 'Language / 言語', '言語設定 / Language' },
  [4] = { 'English', 'English' },
  [5] = { 'Japanese (default)', '日本語（初期表示）' },
  [12] = { 'Diagnostics', '診断' },
  [13] = { 'Lua Engine: open / close', 'Lua Engine：開く／閉じる' },
  [14] = { 'Unique signature checks (read only)', '一意シグネチャ確認（読み取り）' },
  [15] = { 'Environment / connection information', '環境・接続情報' },
  [16] = { 'Status report', '状態を表示' },
  [100] = { '01. Gameplay', '01. 便利機能' },
  [101] = { 'Owned horses: max condition / zero fatigue', '所有馬の調子MAX・疲労0' },
  [102] = { 'Maintain owned-horse condition / fatigue', '所有馬の調子・疲労を維持' },
  [105] = {
    'Undo last field change (same process only)',
    '直前の項目変更を戻す（同一プロセスのみ）',
  },
  [200] = { '02. Player', '02. プレイヤー' },
  [300] = { '03. Horses', '03. 馬関連' },
  [400] = { '04. People', '04. 人関連' },
  [500] = { '05. Farms', '05. 牧場関連' },
  [600] = { '06. Items', '06. アイテム関連' },
  [700] = { '07. Other', '07. その他' },
  [210] = { 'Player editor', 'プレイヤーエディタ' },
  [310] = { 'Owned horse editor', '所有馬エディタ' },
  [330] = { 'Racehorse editor', '競走馬エディタ' },
  [350] = { 'Stallion editor', '種牡馬エディタ' },
  [370] = { 'Broodmare editor', '繁殖牝馬エディタ' },
  [410] = { 'Owner editor', '馬主エディタ' },
  [450] = { 'Trainer editor', '調教師エディタ' },
  [430] = { 'Jockey editor', '騎手エディタ' },
  [470] = { 'Farm manager editor', '牧場長エディタ' },
  [490] = { 'Secretary / acquaintance editor', '秘書・知人エディタ' },
  [510] = { 'Farm editor', '牧場エディタ' },
  [602] = {
    'Change local item quantity by category...',
    'アイテム個数変更（ローカル管理品・カテゴリ別）...',
  },
  [603] = {
    'Add local items by category / quantity...',
    'アイテム追加（ローカル管理品・カテゴリ別・個数）...',
  },
  [702] = { 'Unlock all Steam achievements', 'Steam実績全解除' },
}
WP26.NAME_BYTES = {
  [1] = 'ァ',
  [2] = 'ア',
  [3] = 'ィ',
  [4] = 'イ',
  [5] = 'ゥ',
  [6] = 'ウ',
  [7] = 'ェ',
  [8] = 'エ',
  [9] = 'ォ',
  [10] = 'オ',
  [11] = 'カ',
  [12] = 'ガ',
  [13] = 'キ',
  [14] = 'ギ',
  [15] = 'ク',
  [16] = 'グ',
  [17] = 'ケ',
  [18] = 'ゲ',
  [19] = 'コ',
  [20] = 'ゴ',
  [21] = 'サ',
  [22] = 'ザ',
  [23] = 'シ',
  [24] = 'ジ',
  [25] = 'ス',
  [26] = 'ズ',
  [27] = 'セ',
  [28] = 'ゼ',
  [29] = 'ソ',
  [30] = 'ゾ',
  [31] = 'タ',
  [32] = 'ダ',
  [33] = 'チ',
  [34] = 'ヂ',
  [35] = 'ッ',
  [36] = 'ツ',
  [37] = 'ヅ',
  [38] = 'テ',
  [39] = 'デ',
  [40] = 'ト',
  [41] = 'ド',
  [42] = 'ナ',
  [43] = 'ニ',
  [44] = 'ヌ',
  [45] = 'ネ',
  [46] = 'ノ',
  [47] = 'ハ',
  [48] = 'バ',
  [49] = 'パ',
  [50] = 'ヒ',
  [51] = 'ビ',
  [52] = 'ピ',
  [53] = 'フ',
  [54] = 'ブ',
  [55] = 'プ',
  [56] = 'ヘ',
  [57] = 'ベ',
  [58] = 'ペ',
  [59] = 'ホ',
  [60] = 'ボ',
  [61] = 'ポ',
  [62] = 'マ',
  [63] = 'ミ',
  [64] = 'ム',
  [65] = 'メ',
  [66] = 'モ',
  [67] = 'ャ',
  [68] = 'ヤ',
  [69] = 'ュ',
  [70] = 'ユ',
  [71] = 'ョ',
  [72] = 'ヨ',
  [73] = 'ラ',
  [74] = 'リ',
  [75] = 'ル',
  [76] = 'レ',
  [77] = 'ロ',
  [78] = 'ヮ',
  [79] = 'ワ',
  [80] = 'ヰ',
  [81] = 'ヱ',
  [82] = 'ヲ',
  [83] = 'ン',
  [84] = 'ヴ',
  [85] = 'ヵ',
  [86] = 'ヶ',
  [87] = '０',
  [88] = '１',
  [89] = '２',
  [90] = '３',
  [91] = '４',
  [92] = '５',
  [93] = '６',
  [94] = '７',
  [95] = '８',
  [96] = '９',
  [97] = '0',
  [98] = '1',
  [99] = '2',
  [100] = '3',
  [101] = '4',
  [102] = '5',
  [103] = '6',
  [104] = '7',
  [105] = '8',
  [106] = '9',
  [107] = 'A',
  [108] = 'B',
  [109] = 'C',
  [110] = 'D',
  [111] = 'E',
  [112] = 'F',
  [113] = 'G',
  [114] = 'H',
  [115] = 'I',
  [116] = 'J',
  [117] = 'K',
  [118] = 'L',
  [119] = 'M',
  [120] = 'N',
  [121] = 'O',
  [122] = 'P',
  [123] = 'Q',
  [124] = 'R',
  [125] = 'S',
  [126] = 'T',
  [127] = 'U',
  [128] = 'V',
  [129] = 'W',
  [130] = 'X',
  [131] = 'Y',
  [132] = 'Z',
  [133] = 'a',
  [134] = 'b',
  [135] = 'c',
  [136] = 'd',
  [137] = 'e',
  [138] = 'f',
  [139] = 'g',
  [140] = 'h',
  [141] = 'i',
  [142] = 'j',
  [143] = 'k',
  [144] = 'l',
  [145] = 'm',
  [146] = 'n',
  [147] = 'o',
  [148] = 'p',
  [149] = 'q',
  [150] = 'r',
  [151] = 's',
  [152] = 't',
  [153] = 'u',
  [154] = 'v',
  [155] = 'w',
  [156] = 'x',
  [157] = 'y',
  [158] = 'z',
  [159] = ' ',
  [160] = "'",
  [161] = '.',
  [162] = 'Ⅰ',
  [163] = 'Ⅱ',
  [164] = 'Ⅲ',
  [165] = 'Ⅳ',
  [166] = 'Ⅴ',
  [167] = 'Ⅵ',
  [168] = 'Ⅶ',
  [169] = 'Ⅷ',
  [170] = 'Ⅸ',
  [171] = 'Ⅹ',
  [172] = '①',
  [173] = '②',
  [174] = '③',
  [175] = '④',
  [176] = '⑤',
  [177] = '⑥',
  [178] = '⑦',
  [179] = '⑧',
  [180] = '⑨',
  [181] = '⑩',
  [182] = '第',
  [183] = '一',
  [184] = '二',
  [185] = '三',
  [186] = '四',
  [187] = '五',
  [188] = '六',
  [189] = '七',
  [190] = '八',
  [191] = '九',
  [192] = '十',
  [193] = '壱',
  [194] = '弐',
  [195] = '参',
  [196] = '拾',
  [197] = '種',
  [198] = '義',
  [199] = '雪',
  [200] = '栄',
  [201] = '幟',
  [202] = '健',
  [203] = '宝',
  [204] = '圓',
  [205] = '昭',
  [206] = '白',
  [207] = '鷲',
  [208] = '岩',
  [209] = '泉',
  [210] = '賀',
  [211] = '世',
  [212] = '☆',
  [253] = '-',
  [254] = 'ー',
}
-- Layout follows the supplied Last Caretaker human editor: named list and editable fields.
WP26.editorWindows = {}
function WP26.namePointer(rva)
  local p = readQword(WP26.mod() + rva)
  if not p or p < 0x10000 or not readBytes(p, 1) then
    error(WP26.T('Name data unavailable.', '名前データを取得できません。'), 0)
  end
  return p
end
function WP26.nameText(address, length)
  local s = readString(address, length or 32)
  if not s then
    return ''
  end
  return ansiToUtf8(s)
end
function WP26.decodeName(address, length)
  local b = readBytes(address, length or 31, true)
  if not b then
    return ''
  end
  local s = {}
  for _, v in ipairs(b) do
    if v == 0 then
      break
    end
    s[#s + 1] = WP26.NAME_BYTES[v] or ''
  end
  return table.concat(s)
end
function WP26.horseNamePart(id)
  local limit = readSmallInteger(WP26.mod() + 0x4042650)
  if id and id >= 0x9470 and id < 0x9470 + 0x658f then
    return WP26.decodeName(WP26.namePointer(0x4042678) + (id - 0x9470) * 9, 9)
  end
  if not id or not limit or id < 0 or id >= limit then
    return ''
  end
  return WP26.decodeName(WP26.namePointer(0x4042668) + id * 0x44)
end
function WP26.entityName(key, id, ctx)
  local p = ctx.primary
  if key == 'player' then
    return WP26.T('Player', 'プレイヤー')
  end
  if key == 'owned' or key == 'race' or key == 'sire' or key == 'mare' then
    local a
    if ctx.race then
      a = ctx.race + 0x44
    else
      local h = WP26.bits(p, 0, 0, 19)
      if h >= 100000 then
        return ''
      end
      a = WP26.namePointer(0x401cba8) + h * 24 + 0x14
    end
    local first = WP26.horseNamePart(readSmallInteger(a))
    local last = WP26.horseNamePart(readSmallInteger(a + 2))
    return first .. last
  elseif key == 'owner' then
    return WP26.nameText(p + 0x30, 16) .. WP26.nameText(p + 0x41, 16)
  elseif key == 'farm' then
    return WP26.nameText(p + 0x10, 32)
  elseif key == 'staff' then
    local off = ctx.staffDynamic and 8 or 0x10
    return WP26.nameText(p + off, 16) .. WP26.nameText(p + off + 0x11, 16)
  elseif key == 'secretary' or key == 'acquaintance' then
    return WP26.nameText(p + 8, 16) .. WP26.nameText(p + 0x19, 16)
  elseif key == 'jockey' or key == 'trainer' then
    if not ctx.personData and WP26.personContext(ctx) == false then
      return ''
    end
    local n = ctx.personName
    return WP26.nameText(n + (ctx.childNames and 8 or 4), 16)
      .. WP26.nameText(n + (ctx.childNames and 0x19 or 0x15), 16)
  end
  return ''
end
function WP26.editorRows(key)
  WP26.require()
  if key == 'owned' or key == 'race' then return WP26.raceRows179(key) end
  if key == 'sire' then return WP26.sireRows181() end
  local rows = {}
  local d = WP26.EDITORS[key]
  for id = 0, d.max do
    local ok, ctx = pcall(WP26.context, key, id)
    if ok then
      local include = true
      if key == 'owned' then
        include = WP26.bits(ctx.race, 0x24, 0, 13) == 46
      end
      if include then
        local name = WP26.entityName(key, id, ctx)
        if name ~= '' and not name:find('[%z\1-\31]') then
          rows[#rows + 1] = { id = id, name = name, horseID = ctx.horseID, raceID = ctx.raceID }
        end
      end
    end
  end
  table.sort(rows, function(a, b)
    if a.name == b.name then
      return a.id < b.id
    end
    return a.name < b.name
  end)
  return rows
end
WP26.SPEC['horsegrowthSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 22 83 FA 08 7D 1D 0F B7 C1 83 E2 07 48 6B C8 38 48 8B 05 98 76 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Growth type',
    ['ja'] = '成長型',
    ['off'] = 8,
    ['bit'] = 2,
    ['bits'] = 3,
    ['max'] = 7,
    ['base'] = 'horse',
    ['source'] = 'A7070/A70A0',
    ['setter'] = 'horsegrowthSet',
    ['optionsJa'] = { '早熟', '早め', '遅め', '晩成', '超晩成', '早熟鍋', '早め鍋', '覚醒' },
    ['optionsEn'] = {
      'Precocious',
      'Early',
      'Late',
      'Late maturing',
      'Very late maturing',
      'Precocious rebound',
      'Early rebound',
      'Awakening',
    },
  })
end
WP26.SPEC['horsegrowthPowerSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 04 7D 20 0F B7 C1 83 E2 03 48 6B C8 38 48 8B 05 28 76 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Growth power',
    ['ja'] = '成長力',
    ['off'] = 8,
    ['bit'] = 12,
    ['bits'] = 2,
    ['max'] = 3,
    ['base'] = 'horse',
    ['source'] = 'A70E0/A7110',
    ['setter'] = 'horsegrowthPowerSet',
    ['optionsJa'] = { 'ない', '普通', 'ある', '持続' },
    ['optionsEn'] = { 'None', 'Normal', 'Strong', 'Sustained' },
  })
end
WP26.SPEC['horsetemperamentSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 05 7D 20 0F B7 C1 83 E2 07 48 6B C8 38 48 8B 05 E8 7B F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Temperament',
    ['ja'] = '気性',
    ['off'] = 8,
    ['bit'] = 9,
    ['bits'] = 3,
    ['max'] = 4,
    ['base'] = 'horse',
    ['source'] = 'A6B20/A6B50',
    ['setter'] = 'horsetemperamentSet',
    ['optionsJa'] = { '超激', '激', '荒い', '普通', '大人' },
    ['optionsEn'] = { 'Extremely fierce', 'Fierce', 'Hot', 'Normal', 'Calm' },
  })
end
WP26.SPEC['horsesurfaceSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 08 7D 20 0F B7 C1 83 E2 0F 48 6B C8 38 48 8B 05 B8 79 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Surface aptitude',
    ['ja'] = '馬場適性',
    ['off'] = 4,
    ['bit'] = 8,
    ['bits'] = 4,
    ['max'] = 7,
    ['base'] = 'horse',
    ['source'] = 'A6D50/A6D80',
    ['setter'] = 'horsesurfaceSet',
    ['optionsJa'] = {
      '芝◎ダ×',
      '芝◎ダ△',
      '芝◎ダ○',
      '芝◎ダ◎',
      '芝○ダ◎',
      '芝△ダ◎',
      '芝×ダ◎',
      '芝○ダ○',
    },
    ['optionsEn'] = {
      'Turf excellent / Dirt poor',
      'Turf excellent / Dirt limited',
      'Turf excellent / Dirt good',
      'Turf excellent / Dirt excellent',
      'Turf good / Dirt excellent',
      'Turf limited / Dirt excellent',
      'Turf poor / Dirt excellent',
      'Turf good / Dirt good',
    },
  })
end
WP26.SPEC['horserunningStyleSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 08 7D 20 0F B7 C1 83 E2 07 48 6B C8 38 48 8B 05 D8 72 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Running style',
    ['ja'] = '脚質',
    ['off'] = 4,
    ['bit'] = 12,
    ['bits'] = 3,
    ['max'] = 7,
    ['base'] = 'horse',
    ['source'] = 'A7430/A7460',
    ['setter'] = 'horserunningStyleSet',
    ['optionsJa'] = { '大逃げ', '逃げ', '先行', '差し', '追込', '自在先行', '自在差し', '自在' },
    ['optionsEn'] = {
      'Front runner',
      'Leader',
      'Stalker',
      'Closer',
      'Late closer',
      'Versatile stalker',
      'Versatile closer',
      'Versatile',
    },
  })
end
WP26.SPEC['horsecoatSet'] =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 23 83 FA 1C 7D 1E 0F B7 C1 83 E2 1F 48 6B C8 38 48 8B 05 58 78 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Coat',
    ['ja'] = '毛色',
    ['off'] = 0,
    ['bit'] = 26,
    ['bits'] = 5,
    ['max'] = 27,
    ['base'] = 'horse',
    ['source'] = 'A6EB0/A6EE0',
    ['setter'] = 'horsecoatSet',
    ['optionsJa'] = {
      '鹿毛',
      '鹿毛黒',
      '黒鹿毛',
      '栗毛',
      '栗毛黒',
      '栃栗毛',
      '青鹿毛',
      '青毛',
      '芦毛黒',
      '芦毛灰',
      '芦毛白',
      '白毛',
      '尾花栗毛',
      '白毛斑',
      '鹿毛斑',
      '月毛',
      'シマウマ',
      '赤毛',
      '河原毛',
      'トビアノ',
      'チーター',
      '粕毛',
      'アパルーサ',
      '栃栗毛',
      'オカピ',
      '濃い鹿毛',
      '濃い栗毛',
      '栃栗毛',
    },
    ['optionsEn'] = {
      '鹿毛',
      '鹿毛黒',
      '黒鹿毛',
      '栗毛',
      '栗毛黒',
      '栃栗毛',
      '青鹿毛',
      '青毛',
      '芦毛黒',
      '芦毛灰',
      '芦毛白',
      '白毛',
      '尾花栗毛',
      '白毛斑',
      '鹿毛斑',
      '月毛',
      'シマウマ',
      '赤毛',
      '河原毛',
      'トビアノ',
      'チーター',
      '粕毛',
      'アパルーサ',
      '栃栗毛',
      'オカピ',
      '濃い鹿毛',
      '濃い栗毛',
      '栃栗毛',
    },
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Running form',
    ['ja'] = '走法',
    ['off'] = 20,
    ['bit'] = 6,
    ['bits'] = 2,
    ['max'] = 2,
    ['base'] = 'race',
    ['source'] = 'C3740/C37B0',
    ['optionsJa'] = { '普通', 'ピッチ', '大跳び' },
    ['optionsEn'] = { 'Normal', 'Pitch', 'Long stride' },
  })
end
for _, f in ipairs(WP26.EDITORS.farm.fields) do
  if f.en == 'Manager ID' then
    f.en = 'Farm manager'
    f.ja = '牧場長'
    f.relation = 'staff'
  end
end
for _, key in ipairs({ 'owned', 'race' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.en == 'Trainer ID' then
      f.en = 'Trainer'
      f.ja = '調教師'
      f.relation = 'trainer'
    end
  end
end
-- CT value-row editing follows the supplied OPGG / NOBUNAGA editor convention.
WP26.valueRows = {}
WP26.editorSessions = {}
function WP26.chooseName(title, rows, current)
  if #rows == 0 then
    return nil
  end
  local form = createForm(false)
  form.Color = 0x252525
  form.Font.Color = 0xffffff
  form.Caption = title
  form.Position = 'poScreenCenter'
  form.BorderStyle = 'bsSingle'
  form.ClientWidth = 700
  form.ClientHeight = 520
  local search = createEdit(form)
  search.Left = 12
  search.Top = 12
  search.Width = 676
  search.Height = 28
  search.Text = ''
  search.Color = 0x353535
  search.Font.Color = 0xffffff
  local list = createListBox(form)
  list.Name = 'WP26_ChoiceList'
  list.Left = 12
  list.Top = 50
  list.Width = 676
  list.Height = 410
  list.Style = 'lbOwnerDrawFixed'
  list.ItemHeight = math.max(list.ItemHeight, 24)
  list.Color = 0x252525
  list.Font.Color = 0xffffff
  list.OnDrawItem = function(sender, index, rect, state)
    if type(index) ~= 'number' or index < 0 or index >= sender.Items.Count then
      return
    end
    local canvas = sender.Canvas
    canvas.Brush.Color = index == sender.ItemIndex and WP26.C_SELECTION or 0x252525
    canvas.Font.Color = 0xffffff
    canvas.fillRect(rect.Left, rect.Top, rect.Right, rect.Bottom)
    canvas.textOut(rect.Left + 4, rect.Top + 2, sender.Items[index])
  end
  local selected = nil
  local shown = {}
  local accept = createButton(form)
  accept.Name = 'WP26_ValueAccept'
  accept.Caption = WP26.T('Select', '選択')
  accept.Left = 412
  accept.Top = 474
  accept.Width = 132
  accept.Height = 32
  accept.Default = true
  local cancel = createButton(form)
  cancel.Caption = WP26.T('Cancel', 'キャンセル')
  cancel.Left = 556
  cancel.Top = 474
  cancel.Width = 132
  cancel.Height = 32
  cancel.Cancel = true
  local function filter()
    local query = search.Text:lower()
    list.Items.beginUpdate()
    list.clear()
    shown = {}
    for _, r in ipairs(rows) do
      if query == '' or r.name:lower():find(query, 1, true) then
        shown[#shown + 1] = r
        list.Items.add(r.name)
        if r.id == current then
          list.ItemIndex = #shown - 1
        end
      end
    end
    list.Items.endUpdate()
    accept.Enabled = #shown > 0
    if list.ItemIndex < 0 and #shown > 0 then
      list.ItemIndex = 0
    end
  end
  local function choose()
    local r = shown[list.ItemIndex + 1]
    if not r then
      return
    end
    selected = r.id
    form.ModalResult = 1
  end
  accept.OnClick = choose
  list.OnDblClick = choose
  cancel.OnClick = function()
    form.ModalResult = 2
  end
  search.OnChange = filter
  filter()
  local ok, e = pcall(function()
    form.showModal()
  end)
  form.destroy()
  if not ok then
    error(e)
  end
  return selected
end
function WP26.editorRows(key)
  WP26.require()
  if key == 'owned' or key == 'race' then return WP26.raceRows179(key) end
  if key == 'sire' then return WP26.sireRows181() end
  local d = WP26.EDITORS[key]
  local rows = {}
  local root = WP26.data(d.data)
  local raceRoot = key == 'owned' and WP26.data('race') or nil
  local horseRoot = (key == 'owned' or key == 'race' or key == 'sire' or key == 'mare') and WP26.data('horse') or nil
  local dynamic = key == 'staff' and WP26.data('staffDynamic') or nil
  for id = 0, d.max do
    local ctx = { id = id, key = key, primary = root + id * d.stride }
    if key == 'staff' and id >= 116 then
      ctx.primary = dynamic + (id - 116) * 0x3c
      ctx.staffDynamic = true
    end
    local include = WP26.personContext(ctx) ~= false
    if key == 'owned' then
      local r = WP26.bits(ctx.primary, 4, 2, 14)
      if r >= 6790 then
        include = false
      else
        ctx.race = raceRoot + r * 0xe8
        ctx.raceID = r
        include = WP26.bits(ctx.race, 0x24, 0, 13) == 46
      end
    elseif key == 'race' then
      ctx.race = ctx.primary
      ctx.raceID = id
    end
    if include and horseRoot then
      local h = ctx.race and WP26.bits(ctx.race, 0, 0, 15) or WP26.bits(ctx.primary, 8, 0, 15)
      if h >= 0x702d then
        include = false
      else
        ctx.horseID = h
        ctx.horse = horseRoot + h * 0x38
      end
    end
    if include then
      local name = WP26.entityName(key, id, ctx)
      if name ~= '' and not name:find('[%z\1-\31]') then
        rows[#rows + 1] = { id = id, name = name }
      end
    end
  end
  table.sort(rows, function(a, b)
    if a.name == b.name then
      return a.id < b.id
    end
    return a.name < b.name
  end)
  return rows
end
function WP26.closeEditor(parent)
  WP26.cancelRecordDeactivate(parent.ID)
  if WP26.editorOpenTimers then
    local timer = WP26.editorOpenTimers[parent.ID]
    if timer then
      WP26.editorOpenTimers[parent.ID] = nil
      if WP26.uiTimers then
        WP26.uiTimers[timer] = nil
      end
      timer.destroy()
    end
  end
  local session = WP26.editorSessions[parent.ID]
  if session then
    for id in pairs(session.rows) do
      local info = WP26.valueRows[id]
      if info and info.valueType078 and info.valueType078.info == info then
        info.valueType078.info = nil
      end
      WP26.valueRows[id] = nil
      if WP26.pendingEdits then
        WP26.pendingEdits[id] = nil
      end
    end
    WP26.editorSessions[parent.ID] = nil
  end
  WP26.clearChildren(parent)
  WP26.suffix[parent.ID] = nil
  local n = WP26.NAMES[parent.ID]
  if n then
    parent.Description = WP26.T(n[1], n[2])
  end
end
WP26.pendingEdits = {}
WP26.editTypeSerial = 0
function WP26.normalizeNumeric120(f, value, ideal)
  value = tonumber(value)
  if not value or value ~= value or math.abs(value) == math.huge then
    return nil
  end
  value = math.max(f.min or 0, math.min(f.max, math.floor(value)))
  if f.displayScale then
    value = (f.displayAdd or 0) + math.floor((value - (f.displayAdd or 0)) / f.displayScale) * f.displayScale
  end
  if f.currentWeight and ideal then
    value = math.max(ideal - 40, math.min(ideal + 40, value))
  end
  return value
end
function WP26.queueFieldEdit(info, value)
  local d = WP26.EDITORS[info.key]
  local f = d.fields[info.index]
  local session = info.session
  if WP26.editorSessions[d.record] ~= session or WP26.pid ~= session.pid then
    return
  end
  if not info.id or WP26.valueRows[info.id] ~= info or not getAddressList().getMemoryRecordByID(info.id) then
    return
  end
  if not f.string then
    value = WP26.normalizeNumeric120(f, value)
    if value == nil then
      return
    end
  else
    value = tostring(value)
  end
  local ctx = WP26.context(info.key, session.id)
  local off = WP26.fieldLayout(ctx, f)
  if
    ctx.horseID ~= session.horseID
    or ctx.raceID ~= session.raceID
    or ctx[f.base or 'primary'] + off ~= info.address
  then
    return
  end
  if f.currentWeight then
    local ideal = WP26.bits(ctx.race, 10, 0, 8) * 2 + 300
    value = WP26.normalizeNumeric120(f, value, ideal)
  end
  local before = WP26.fieldRead(ctx, f)
  if value == before and not (WP26.needsStaffNameSync088 and WP26.needsStaffNameSync088(ctx, f)) then
    return
  end
  WP26.pendingEdits[info.id] = { info = info, value = value, before = before }
  if WP26.editTimer then
    return
  end
  local timer = createTimer(nil, false)
  WP26.editTimer = timer
  timer.Interval = 30
  timer.OnTimer = function(tt)
    tt.Enabled = false
    tt.destroy()
    WP26.editTimer = nil
    local pending = WP26.pendingEdits
    WP26.pendingEdits = {}
    for _, edit in pairs(pending) do
      local r = edit.info
      local definition = WP26.EDITORS[r.key]
      local field = definition.fields[r.index]
      local selected = r.session
      if
        WP26.editorSessions[definition.record] == selected
        and WP26.valueRows[r.id] == r
        and getAddressList().getMemoryRecordByID(r.id)
        and WP26.pid == selected.pid
      then
        WP26.userRun(function()
          local fresh = WP26.context(r.key, selected.id)
          local o = WP26.fieldLayout(fresh, field)
          if
            fresh.horseID ~= selected.horseID
            or fresh.raceID ~= selected.raceID
            or fresh[field.base or 'primary'] + o ~= r.address
            or WP26.fieldRead(fresh, field) ~= edit.before
          then
            error(
              WP26.T('Data changed; edit cancelled.', 'データが変化したため変更を停止しました。'),
              0
            )
          end
          WP26.writeField(fresh, field, edit.value)
        end)
      end
    end
  end
  timer.Enabled = true
end
function WP26.addNativeField(parent, key, index, ctx, session)
  WP26.guardEditorBuild101(key)
  local f = WP26.EDITORS[key].fields[index]
  local off = WP26.fieldLayout(ctx, f)
  local address = ctx[f.base or 'primary'] + off
  local size = f.customSize079 or (f.string and f.max + 1 or 4)
  if not f.string and f.bits == 8 and f.bit == 0 then
    size = 1
  elseif not f.string and f.bits == 16 and f.bit == 0 then
    size = 2
  end
  local row = WP26.addRec(parent, f.en, f.ja, string.format('%X', address), vtByte)
  local info = { key = key, index = index, session = session, mr = row, id = row.ID, address = address }
  WP26.valueRows[row.ID] = info
  session.rows[row.ID] = true
  -- Reuse one conversion type per editor field, rather than registering on every open.
  local cache = _G.WP26_CUSTOM_TYPES078
  if not cache then
    cache = { serial = 0, types = {} }
    _G.WP26_CUSTOM_TYPES078 = cache
  end
  local cacheKey = key .. ':' .. index .. ':' .. size .. ':' .. tostring(f.string == true)
  local entry = cache.types[cacheKey]
  if not entry then
    cache.serial = cache.serial + 1
    entry =
      { name = 'WP2026Cache078_' .. getTickCount() .. '_' .. cache.serial, string = f.string == true, size = size }
    cache.types[cacheKey] = entry
    entry.custom = registerCustomTypeLua(entry.name, size, function(...)
      local api = _G.WP26
      local active = entry.info
      if not api or not active or api.editorSessions[api.EDITORS[active.key].record] ~= active.session then
        return entry.string and '' or 0
      end
      local ok, value = pcall(api.fieldRead, active.ctx, active.field)
      if not ok then
        return entry.string and '' or 0
      end
      return value
    end, function(value)
      local api = _G.WP26
      local active = entry.info
      local unchanged = active and readBytes(active.address, entry.size, true) or {}
      for i = 1, entry.size do
        unchanged[i] = unchanged[i] or 0
      end
      if api and active and api.editorSessions[api.EDITORS[active.key].record] == active.session then
        local ok, e = pcall(api.queueFieldEdit, active, value)
        if not ok then
          api.msg(tostring(e), tostring(e))
        end
      end
      return unchanged
    end, f.derived161 ~= nil and f.derived161 ~= 'starts', f.string == true)
    assert(entry.custom, 'Custom value type unavailable')
    entry.custom.InternalOnly = true
    entry.custom.scriptUsesString = f.string == true
  end
  entry.custom.scriptUsesString = f.string == true
  info.ctx = ctx
  info.field = f
  info.valueType078 = entry
  entry.info = info
  local typeName = entry.name
  row.Type = vtCustom
  row.CustomTypeName = typeName
  row.Color = WP26.C_VALUE or 0xffffff
  local choices = f.choices
  if f.relation then
    choices = WP26.editorRows(f.relation)
  elseif f.optionsJa then
    choices = {}
    local names = WP26.lang == 'ja' and f.optionsJa or f.optionsEn
    for i, name in ipairs(names) do
      choices[#choices + 1] = { id = i - 1, name = name }
    end
  end
  WP26.guardEditorBuild101(key)
  if choices then
    local lines = {}
    for _, choice in ipairs(choices) do
      lines[#lines + 1] = choice.id .. ':' .. (choice.name or WP26.T(choice.en, choice.ja))
    end
    row.DropDownList.Text = table.concat(lines, '\n')
    row.DropDownReadOnly = true
    row.DropDownDescriptionOnly = true
    row.DisplayAsDropDownListItem = true
  end
  row.OnActivate = function(_, before)
    if before then
      return false
    end
    return true
  end
  return row
end
function WP26.refreshEditor(key)
  local d = WP26.EDITORS[key]
  local parent = getAddressList().getMemoryRecordByID(d.record)
  local id = WP26.selected[key]
  if not parent or id == nil then
    return
  end
  local ctx = WP26.context(key, id)
  local name = WP26.entityName(key, id, ctx)
  WP26.resetEditorBuild101(parent)
  local session = { pid = WP26.pid, id = id, horseID = ctx.horseID, raceID = ctx.raceID, rows = {} }
  WP26.editorSessions[parent.ID] = session
  WP26.suffix[parent.ID] = name
  parent.Description = WP26.T(d.en, d.ja) .. (name ~= '' and ' : ' .. name or '')
  if key ~= 'player' and key ~= 'items' then
    WP26.addAction(
      parent,
      'Change target...',
      '対象を変更...',
      'WP26.selectEditor(' .. string.format('%q', key) .. ')'
    )
  end
  WP26.addAction(parent, 'Refresh values', '値を再取得', 'WP26.deferEditor(' .. string.format('%q', key) .. ')')
  if key == 'mare' or key == 'ownedMare' then
    WP26.addAction(
      parent,
      'Force conception with selected stallion',
      '種牡馬を指定して強制受胎',
      'WP26.chooseConception107(' .. string.format('%q', key) .. ')'
    )
  end
  local groups = {}
  for index, f in ipairs(d.fields) do
    if WP26.fieldAvailable(ctx, f) then
      WP26.guardEditorBuild101(key)
      local owner = parent
      if f.groupJa then
        local group = f.groupJa
        if not groups[group] then
          groups[group] = WP26.addHdr(parent, f.groupEn, f.groupJa)
          groups[group].Collapsed = true
        end
        owner = groups[group]
      elseif f.category then
        if not groups[f.category] then
          local c = WP26.ITEM_CATEGORIES[f.category]
          groups[f.category] = WP26.addHdr(parent, c[1], c[2])
          groups[f.category].Collapsed = true
        end
        owner = groups[f.category]
      end
      WP26.addNativeField(owner, key, index, ctx, session)
    end
  end
  parent.Collapsed = false
end
function WP26.selectEditor(key)
  WP26.require()
  local d = WP26.EDITORS[key]
  local id = 0
  if key ~= 'player' and key ~= 'items' then
    local rows = WP26.editorRows(key)
    local initial = WP26.selected[key] or (key == 'farm' and 32 or nil)
    if key == 'secretary' and initial == nil then
      initial = readSmallInteger(WP26.data('player') + 0x20)
    end
    if key == 'staff' and initial == nil then
      initial = WP26.bits(WP26.data('farm') + 32 * 0xcc, 7, 0, 8)
    end
    id = WP26.chooseName(WP26.T(d.en, d.ja), rows, initial)
    if id == nil then
      return false
    end
  end
  WP26.context(key, id)
  WP26.selected[key] = id
  WP26.deferEditor(key)
  return true
end
function WP26.enableEditor(parent, key)
  WP26.cancelRecordDeactivate(parent.ID)
  if
    not WP26.userRun(function()
      if key == 'secretary' then
        WP26.require()
        local id = readSmallInteger(WP26.data('player') + 0x20)
        WP26.context('secretary', id)
        WP26.selected.secretary = id
        WP26.deferEditor('secretary')
        return
      end
      if not WP26.selectEditor(key) then
        WP26.deferRecordDeactivate(parent, 150)
      end
    end)
  then
    WP26.deferRecordDeactivate(parent, 150)
  end
end

table.insert(WP26.EDITORS['player'].fields, {
  ['en'] = 'Family name',
  ['ja'] = '姓',
  ['off'] = 48,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['source'] = '49C3A0 owner 46 -> FFC60',
  ['string'] = true,
  ['base'] = 'playerOwner',
})
table.insert(WP26.EDITORS['player'].fields, {
  ['en'] = 'Given name',
  ['ja'] = '名',
  ['off'] = 65,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['source'] = '49C3A0 owner 46 -> FFC60',
  ['string'] = true,
  ['base'] = 'playerOwner',
})
table.insert(WP26.EDITORS['player'].fields, {
  ['en'] = 'Fame',
  ['ja'] = '名声',
  ['off'] = 12,
  ['bit'] = 0,
  ['bits'] = 20,
  ['max'] = 999999,
  ['source'] = '49C3A0 owner 46 -> 1020D0/102120',
  ['base'] = 'playerOwner',
})
table.insert(WP26.EDITORS['owner'].fields, {
  ['en'] = 'Career wins',
  ['ja'] = '通算勝利',
  ['off'] = 16,
  ['bit'] = 0,
  ['bits'] = 30,
  ['max'] = 999999999,
  ['source'] = '101E00/101E50',
})
table.insert(WP26.EDITORS['owner'].fields, {
  ['en'] = 'Career G1 wins',
  ['ja'] = '通算ＧⅠ勝利',
  ['off'] = 8,
  ['bit'] = 0,
  ['bits'] = 20,
  ['max'] = 999999,
  ['source'] = '1003E0/100430',
})
table.insert(WP26.EDITORS['owner'].fields, {
  ['en'] = 'Overseas G1 wins',
  ['ja'] = '海外ＧⅠ勝利',
  ['off'] = 20,
  ['bit'] = 11,
  ['bits'] = 20,
  ['max'] = 999999,
  ['source'] = '100550/1005A0',
})
table.insert(WP26.EDITORS['owner'].fields, {
  ['en'] = 'Current-year prize money',
  ['ja'] = '本年賞金',
  ['off'] = 0,
  ['bit'] = 0,
  ['bits'] = 24,
  ['max'] = 9999999,
  ['source'] = '101B70/101BD0',
})
table.insert(
  WP26.EDITORS['owner'].fields,
  {
    ['en'] = 'Family name',
    ['ja'] = '姓',
    ['off'] = 48,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 16,
    ['source'] = 'FFC60',
    ['string'] = true,
  }
)
table.insert(
  WP26.EDITORS['owner'].fields,
  {
    ['en'] = 'Given name',
    ['ja'] = '名',
    ['off'] = 65,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 16,
    ['source'] = 'FFC60',
    ['string'] = true,
  }
)
table.insert(
  WP26.EDITORS['trainer'].fields,
  {
    ['en'] = 'Career wins',
    ['ja'] = '通算勝利',
    ['off'] = 20,
    ['bit'] = 0,
    ['bits'] = 16,
    ['max'] = 9999,
    ['source'] = '114B10/114B70',
  }
)
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Career G1 wins',
  ['ja'] = '通算ＧⅠ勝利',
  ['off'] = 32,
  ['bit'] = 0,
  ['bits'] = 10,
  ['max'] = 999,
  ['source'] = '114C60/114CC0',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Current-year prize money',
  ['ja'] = '本年賞金',
  ['off'] = 24,
  ['bit'] = 0,
  ['bits'] = 24,
  ['max'] = 9999999,
  ['source'] = '114DB0/114E20',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Current year: Wins',
  ['ja'] = '本年成績：１着',
  ['off'] = 0,
  ['bit'] = 10,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '114F10/115020 selector=0',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Current year: Second places',
  ['ja'] = '本年成績：２着',
  ['off'] = 0,
  ['bit'] = 21,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '114F10/115020 selector=1',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Current year: Third places',
  ['ja'] = '本年成績：３着',
  ['off'] = 4,
  ['bit'] = 10,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '114F10/115020 selector=2',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Current year: Other finishes',
  ['ja'] = '本年成績：着外',
  ['off'] = 4,
  ['bit'] = 21,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '114F10/115020 selector=3',
})
table.insert(
  WP26.EDITORS['jockey'].fields,
  {
    ['en'] = 'Career wins',
    ['ja'] = '通算勝利',
    ['off'] = 4,
    ['bit'] = 0,
    ['bits'] = 16,
    ['max'] = 9999,
    ['source'] = '1201C0/120230',
  }
)
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Career G1 wins',
  ['ja'] = '通算ＧⅠ勝利',
  ['off'] = 20,
  ['bit'] = 22,
  ['bits'] = 10,
  ['max'] = 999,
  ['source'] = '120350/1203C0',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Current-year prize money',
  ['ja'] = '本年賞金',
  ['off'] = 0,
  ['bit'] = 0,
  ['bits'] = 24,
  ['max'] = 9999999,
  ['source'] = '121730/1217C0',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Current year: Wins',
  ['ja'] = '本年成績：１着',
  ['off'] = 12,
  ['bit'] = 0,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '121920/121A00 selector=0',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Current year: Second places',
  ['ja'] = '本年成績：２着',
  ['off'] = 12,
  ['bit'] = 11,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '121920/121A00 selector=1',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Current year: Third places',
  ['ja'] = '本年成績：３着',
  ['off'] = 16,
  ['bit'] = 0,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '121920/121A00 selector=2',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Current year: Other finishes',
  ['ja'] = '本年成績：着外',
  ['off'] = 16,
  ['bit'] = 11,
  ['bits'] = 11,
  ['max'] = 1999,
  ['source'] = '121920/121A00 selector=3',
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Speed training specialty',
  ['ja'] = 'スピード育成特性',
  ['off'] = 8,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Acceleration training specialty',
  ['ja'] = '瞬発力育成特性',
  ['off'] = 8,
  ['bit'] = 8,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Guts training specialty',
  ['ja'] = '勝負根性育成特性',
  ['off'] = 8,
  ['bit'] = 9,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Power training specialty',
  ['ja'] = 'パワー育成特性',
  ['off'] = 8,
  ['bit'] = 10,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Flexibility training specialty',
  ['ja'] = '柔軟性育成特性',
  ['off'] = 8,
  ['bit'] = 11,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Mental strength training specialty',
  ['ja'] = '精神力育成特性',
  ['off'] = 8,
  ['bit'] = 12,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Intelligence training specialty',
  ['ja'] = '賢さ育成特性',
  ['off'] = 8,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(WP26.EDITORS['staff'].fields, {
  ['en'] = 'Health training specialty',
  ['ja'] = '健康育成特性',
  ['off'] = 8,
  ['bit'] = 14,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '10E5F0 / UI 2DBE51..2DBEE2',
  ['ordinaryOnly'] = true,
  ['optionsEn'] = { 'Off', 'On' },
  ['optionsJa'] = { 'なし', 'あり' },
})
table.insert(
  WP26.EDITORS['secretary'].fields,
  {
    ['en'] = 'Family name',
    ['ja'] = '姓',
    ['off'] = 8,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 16,
    ['source'] = '129970',
    ['string'] = true,
  }
)
table.insert(
  WP26.EDITORS['secretary'].fields,
  {
    ['en'] = 'Given name',
    ['ja'] = '名',
    ['off'] = 25,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 16,
    ['source'] = '129970',
    ['string'] = true,
  }
)
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Pasture level',
  ['ja'] = '牧草：レベル',
  ['off'] = 48,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288a',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Stable level',
  ['ja'] = '厩舎：レベル',
  ['off'] = 52,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288b',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Walking machine level (1)',
  ['ja'] = 'ウォーキングマシン（1基目）：レベル',
  ['off'] = 56,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288c',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Walking machine level (2)',
  ['ja'] = 'ウォーキングマシン（2基目）：レベル',
  ['off'] = 60,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288c',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Group stable level (1)',
  ['ja'] = '集団馬房（1基目）：レベル',
  ['off'] = 64,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288d',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Group stable level (2)',
  ['ja'] = '集団馬房（2基目）：レベル',
  ['off'] = 68,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288d',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Stallion barn level',
  ['ja'] = '種牡馬繋養施設：レベル',
  ['off'] = 72,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288e',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Round pen level (1)',
  ['ja'] = 'ロンギ場（1基目）：レベル',
  ['off'] = 76,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288f',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Round pen level (2)',
  ['ja'] = 'ロンギ場（2基目）：レベル',
  ['off'] = 80,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x288f',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Tourist facilities level (1)',
  ['ja'] = '観光施設（1基目）：レベル',
  ['off'] = 84,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2890',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Tourist facilities level (2)',
  ['ja'] = '観光施設（2基目）：レベル',
  ['off'] = 88,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2890',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Veterinary facilities level (1)',
  ['ja'] = '獣医施設（1基目）：レベル',
  ['off'] = 92,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2891',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Veterinary facilities level (2)',
  ['ja'] = '獣医施設（2基目）：レベル',
  ['off'] = 96,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2891',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Hot spring facilities level (1)',
  ['ja'] = '温泉施設（1基目）：レベル',
  ['off'] = 100,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2892',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Hot spring facilities level (2)',
  ['ja'] = '温泉施設（2基目）：レベル',
  ['off'] = 104,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2892',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Flower garden level (1)',
  ['ja'] = '花壇（1基目）：レベル',
  ['off'] = 108,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2893',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Flower garden level (2)',
  ['ja'] = '花壇（2基目）：レベル',
  ['off'] = 112,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2893',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Silo level',
  ['ja'] = 'サイロ：レベル',
  ['off'] = 116,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2894',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Retired horse barn level',
  ['ja'] = '功労馬繋養施設：レベル',
  ['off'] = 120,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2895',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Staff quarters level',
  ['ja'] = '従業員宿舎：レベル',
  ['off'] = 124,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x2896',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Research building level',
  ['ja'] = '研究棟：レベル',
  ['off'] = 128,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 1,
  ['source'] = '108E10 / 10AA00 / WMM 0x2897',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Mist system level',
  ['ja'] = 'ミスト：レベル',
  ['off'] = 132,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 1,
  ['source'] = '108E10 / 10AA00 / WMM 0x2898',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Treadmill level',
  ['ja'] = 'トレッドミル：レベル',
  ['off'] = 136,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 1,
  ['source'] = '108E10 / 10AA00 / WMM 0x2899',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Kids house level',
  ['ja'] = 'キッズハウス：レベル',
  ['off'] = 140,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 1,
  ['source'] = '108E10 / 10AA00 / WMM 0x289a',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Private stallion barn level',
  ['ja'] = 'Private種牡馬繋養施設：レベル',
  ['off'] = 144,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x289b',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Trainer reception room level',
  ['ja'] = '調教師応接室：レベル',
  ['off'] = 148,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x289c',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Hypoxic treadmill level',
  ['ja'] = '低酸素トレッドミル：レベル',
  ['off'] = 152,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 1,
  ['source'] = '108E10 / 10AA00 / WMM 0x289d',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Racehorse mental laboratory level',
  ['ja'] = '競走馬メンタルラボ：レベル',
  ['off'] = 156,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x289e',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'International stable level',
  ['ja'] = '国際厩舎：レベル',
  ['off'] = 160,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x289f',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Farrier level',
  ['ja'] = '装蹄所：レベル',
  ['off'] = 164,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a0',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Fodder steamer level',
  ['ja'] = '飼葉スチーマー：レベル',
  ['off'] = 168,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a1',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Uphill course level',
  ['ja'] = '坂路コース：レベル',
  ['off'] = 172,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a2',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Track course level',
  ['ja'] = 'トラックコース：レベル',
  ['off'] = 176,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 2,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a3',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Arena level',
  ['ja'] = '角馬場：レベル',
  ['off'] = 180,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 2,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a4',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Starting gate level',
  ['ja'] = 'ゲート：レベル',
  ['off'] = 184,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 2,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a5',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Exercise trail level',
  ['ja'] = '逍遥馬道：レベル',
  ['off'] = 188,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 2,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a6',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Large uphill course level',
  ['ja'] = '大型坂路コース：レベル',
  ['off'] = 192,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a7',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Large track course level',
  ['ja'] = '大型トラックコース：レベル',
  ['off'] = 196,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 2,
  ['source'] = '108E10 / 10AA00 / WMM 0x28a8',
  ['playerFarmOnly'] = true,
})
table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Preferred facility',
  ['ja'] = '得意施設',
  ['off'] = 12,
  ['bit'] = 0,
  ['bits'] = 6,
  ['max'] = 38,
  ['source'] = '10F190 -> 189B90 -> WMM',
  ['ordinaryOnly'] = true,
  ['optionsJa'] = {
    '基本施設',
    '牧草',
    '厩舎',
    'ウォーキングマシン',
    'ウォーキングマシン',
    '集団馬房',
    '集団馬房',
    '種牡馬繋養施設',
    'ロンギ場',
    'ロンギ場',
    '観光施設',
    '観光施設',
    '獣医施設',
    '獣医施設',
    '温泉施設',
    '温泉施設',
    '花壇',
    '花壇',
    'サイロ',
    '功労馬繋養施設',
    '従業員宿舎',
    '研究棟',
    'ミスト',
    'トレッドミル',
    'キッズハウス',
    'Private種牡馬繋養施設',
    '調教師応接室',
    '低酸素トレッドミル',
    '競走馬メンタルラボ',
    '国際厩舎',
    '装蹄所',
    '飼葉スチーマー',
    '坂路コース',
    'トラックコース',
    '角馬場',
    'ゲート',
    '逍遥馬道',
    '大型坂路コース',
    '大型トラックコース',
  },
  ['optionsEn'] = {
    'Basic facilities',
    'Pasture',
    'Stable',
    'Walking machine',
    'Walking machine',
    'Group stable',
    'Group stable',
    'Stallion barn',
    'Round pen',
    'Round pen',
    'Tourist facilities',
    'Tourist facilities',
    'Veterinary facilities',
    'Veterinary facilities',
    'Hot spring facilities',
    'Hot spring facilities',
    'Flower garden',
    'Flower garden',
    'Silo',
    'Retired horse barn',
    'Staff quarters',
    'Research building',
    'Mist system',
    'Treadmill',
    'Kids house',
    'Private stallion barn',
    'Trainer reception room',
    'Hypoxic treadmill',
    'Racehorse mental laboratory',
    'International stable',
    'Farrier',
    'Fodder steamer',
    'Uphill course',
    'Track course',
    'Arena',
    'Starting gate',
    'Exercise trail',
    'Large uphill course',
    'Large track course',
  },
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Age',
  ['ja'] = '年齢',
  ['off'] = 0,
  ['bit'] = 0,
  ['bits'] = 7,
  ['min'] = 18,
  ['max'] = 145,
  ['displayAdd'] = 18,
  ['base'] = 'personData',
  ['source'] = 'UI 2D7796 -> 1149C0 -> 112200; 111FE0/112220',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Sex',
  ['ja'] = '性別',
  ['off'] = 0,
  ['bit'] = 20,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'personData',
  ['source'] = '111EA0/111F70; 114980; 11FB60',
  ['optionsEn'] = { 'Male', 'Female' },
  ['optionsJa'] = { '男性', '女性' },
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Family name',
  ['ja'] = '姓',
  ['off'] = 4,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['base'] = 'personData',
  ['string'] = true,
  ['source'] = '111420/1114F0',
})
table.insert(WP26.EDITORS['trainer'].fields, {
  ['en'] = 'Given name',
  ['ja'] = '名',
  ['off'] = 21,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['base'] = 'personData',
  ['string'] = true,
  ['source'] = '1115D0/1116A0',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Age',
  ['ja'] = '年齢',
  ['off'] = 0,
  ['bit'] = 0,
  ['bits'] = 7,
  ['min'] = 18,
  ['max'] = 145,
  ['displayAdd'] = 18,
  ['base'] = 'personData',
  ['source'] = 'UI 2D7796 -> 1149C0 -> 112200; 111FE0/112220',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Sex',
  ['ja'] = '性別',
  ['off'] = 0,
  ['bit'] = 20,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'personData',
  ['source'] = '111EA0/111F70; 114980; 11FB60',
  ['optionsEn'] = { 'Male', 'Female' },
  ['optionsJa'] = { '男性', '女性' },
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Family name',
  ['ja'] = '姓',
  ['off'] = 4,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['base'] = 'personData',
  ['string'] = true,
  ['source'] = '111420/1114F0',
})
table.insert(WP26.EDITORS['jockey'].fields, {
  ['en'] = 'Given name',
  ['ja'] = '名',
  ['off'] = 21,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['base'] = 'personData',
  ['string'] = true,
  ['source'] = '1115D0/1116A0',
})
table.insert(WP26.EDITORS['secretary'].fields, {
  ['en'] = 'Age',
  ['ja'] = '年齢',
  ['off'] = 0,
  ['bit'] = 19,
  ['bits'] = 7,
  ['max'] = 100,
  ['source'] = '1295F0/129620; UI 888973 -> "%d歳"',
})
table.insert(WP26.EDITORS['secretary'].fields, {
  ['en'] = 'Sex',
  ['ja'] = '性別',
  ['off'] = 0,
  ['bit'] = 11,
  ['bits'] = 1,
  ['max'] = 1,
  ['source'] = '129450/129480; UI 888A50 -> wife / husband',
  ['optionsEn'] = { 'Male', 'Female' },
  ['optionsJa'] = { '男性', '女性' },
})
function WP26.traitRead(ctx, slot)
  local low = WP26.bits(ctx.horse, 0x28 + slot, 0, 8)
  local high = slot < 8 and WP26.bits(ctx.horse, 0x33, slot, 1) or WP26.bits(ctx.horse, 0x34, slot - 8, 1)
  return low + (high << 8)
end
function WP26.traitSnapshot(ctx)
  local t = {}
  for slot = 0, 10 do
    t[slot + 1] = WP26.traitRead(ctx, slot)
  end
  return t
end
function WP26.sameTraits(a, b)
  for i = 1, 11 do
    if a[i] ~= b[i] then
      return false
    end
  end
  return true
end
function WP26.restoreTraits(ctx, values)
  for slot = 10, 0, -1 do
    WP26.native('horseTraitSet', ctx.horseID, slot, 0)
  end
  for slot = 0, 10 do
    if values[slot + 1] ~= 0 then
      WP26.native('horseTraitSet', ctx.horseID, slot, values[slot + 1])
    end
  end
  if not WP26.sameTraits(WP26.traitSnapshot(ctx), values) then
    error(WP26.T('Trait restoration failed verification.', '特性の復元を確認できません。'), 0)
  end
end
function WP26.writeTrait(ctx, f, value, journal)
  WP26.require()
  local allowed = false
  for _, choice in ipairs(f.choices) do
    if choice.id == value then
      allowed = true
    end
  end
  if not allowed then
    error(WP26.T('Choose a compatible trait.', '対応する特性を選択してください。'), 0)
  end
  local before = WP26.traitSnapshot(ctx)
  local old = before[f.traitSlot + 1]
  if value == old then
    return
  end
  if value ~= 0 then
    for slot = 0, 10 do
      if slot ~= f.traitSlot and before[slot + 1] == value then
        error(WP26.T('This trait is already assigned.', 'この特性は設定済みです。'), 0)
      end
    end
  end
  WP26.native('horseTraitSet', ctx.horseID, f.traitSlot, value)
  local after = WP26.traitSnapshot(ctx)
  local verified = false
  if f.traitSlot >= 2 and f.traitSlot <= 9 then
    if value == 0 then
      local oldCount, newCount = 0, 0
      for i = 3, 10 do
        if before[i] == old then
          oldCount = oldCount + 1
        end
        if after[i] == old then
          newCount = newCount + 1
        end
      end
      verified = newCount < oldCount
    else
      for i = 3, 10 do
        if after[i] == value then
          verified = true
        end
      end
    end
  else
    verified = after[f.traitSlot + 1] == value
  end
  if not verified then
    WP26.restoreTraits(ctx, before)
    error(
      WP26.T('The game rejected this trait.', 'ゲーム側が特性の変更を受け付けませんでした。'),
      0
    )
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = { kind = 'traits', pid = WP26.pid, ctx = ctx, before = before, after = after }
  end
end

WP26.TRAIT_NAMES = {
  [0] = '－',
  [1] = '大舞台',
  [2] = '晴れ舞台',
  [3] = 'GⅡ大将',
  [4] = 'GⅡの守護者',
  [5] = '交流重賞巧者',
  [6] = '交流重賞ハンター',
  [7] = 'ローカル',
  [8] = '全国行脚',
  [9] = '海外遠征',
  [10] = '海外雄飛',
  [11] = '根幹距離',
  [12] = '根幹の鬼',
  [13] = '非根幹距離',
  [14] = '非根幹の鬼',
  [15] = '超長距離',
  [16] = '長距離砲',
  [17] = '鉄砲',
  [18] = '狙い撃ち',
  [19] = '叩き良化',
  [20] = '右肩上がり',
  [21] = '乾坤一擲',
  [22] = '渾身の激走',
  [23] = '大駆け',
  [24] = '大番狂わせ',
  [25] = 'タフネス',
  [26] = '超回復',
  [27] = '牡馬混合',
  [28] = '女王君臨',
  [29] = '軽ハンデ',
  [30] = '魅惑の軽斤量',
  [31] = 'スタート',
  [32] = 'ロケットスタート',
  [33] = '高速逃げ',
  [34] = '神速逃げ',
  [35] = '二の脚',
  [36] = '横綱相撲',
  [37] = '直一気',
  [38] = '鬼脚',
  [39] = '強心臓',
  [40] = '鋼の心臓',
  [41] = '距離短縮',
  [42] = '短縮一変',
  [43] = '距離延長',
  [44] = '延長一変',
  [45] = '完全燃焼',
  [46] = '全身全霊',
  [47] = '学習能力',
  [48] = '勝利の再現',
  [49] = '春競馬',
  [50] = '春満開',
  [51] = '夏競馬',
  [52] = '夏馬',
  [53] = '秋競馬',
  [54] = '秋の嵐',
  [55] = '冬競馬',
  [56] = '冬将軍',
  [57] = '東京巧者',
  [58] = '府中の申し子',
  [59] = '中山巧者',
  [60] = '中山の申し子',
  [61] = '京都巧者',
  [62] = '淀の申し子',
  [63] = '阪神巧者',
  [64] = '仁川の申し子',
  [65] = '坂越え',
  [66] = 'タフランナー',
  [67] = '平坦巧者',
  [68] = 'フラットランナー',
  [69] = '行きっぷり',
  [70] = '前進気勢',
  [71] = '一人旅',
  [72] = '唯我独尊',
  [73] = 'ペースメイク',
  [74] = 'レースメイク',
  [75] = '最短距離',
  [76] = 'インベタ張り付き',
  [77] = 'ロングスパート',
  [78] = 'ひとまくり',
  [79] = '決め打ち',
  [80] = '丁半博打',
  [81] = '香港巧者',
  [82] = '香港マイスター',
  [83] = 'ドバイ巧者',
  [84] = 'ドバイマイスター',
  [85] = 'ロンシャン巧者',
  [86] = 'ロンシャンマイスター',
  [87] = 'スプリントギア',
  [88] = '激流チェイス',
  [89] = 'スプリントターボ',
  [90] = '光速スパート',
  [91] = 'マイルギア',
  [92] = '勇往邁進',
  [93] = 'マイルターボ',
  [94] = '疾風迅雷',
  [95] = 'クラシックギア',
  [96] = '王者の行軍',
  [97] = 'クラシックターボ',
  [98] = '王者の進撃',
  [99] = '長距離ギア',
  [100] = '長駆追走',
  [101] = '長距離ターボ',
  [102] = '長駆突入',
  [103] = 'アスコット巧者',
  [104] = 'アスコットマイスター',
  [105] = '覇道',
  [106] = '異能の末脚',
  [107] = '黄金の翼',
  [108] = '熱血王道',
  [109] = '不死鳥の一閃',
  [110] = '栄冠を映す瞳',
  [111] = '衝撃の末脚',
  [112] = '絶対皇帝',
  [113] = '心酔の府中',
  [114] = '受け継がれし輝き',
  [115] = '祭囃子',
  [116] = '絶景の王道',
  [117] = '金色の暴脚',
  [118] = '快速龍王',
  [119] = '破天荒',
  [120] = '未知なる進化',
  [121] = '大歓声より速く',
  [122] = '怪物の孤高',
  [123] = '白雲の軌跡',
  [124] = '堂々たる主演',
  [125] = 'テイオーステップ',
  [126] = 'オグリコール',
  [127] = '緋色の煌めき',
  [128] = '大地が弾んで',
  [129] = '天馬の羽ばたき',
  [130] = '流星の貴公子',
  [131] = 'アイドルホースの熱狂',
  [132] = '人気より実力',
  [133] = '異次元の逃走劇',
  [134] = '覚醒の鼓動',
  [135] = '義賊活劇譚',
  [136] = '頂きへの飛翔',
  [137] = '黒白を分かつ閃光',
  [138] = '自由を照らす走り',
  [139] = 'レジェンド特性・前方',
  [140] = 'レジェンド特性・後方',
  [141] = 'レジェンド特性・自在',
  [142] = 'レジェンド特性・前方・遺伝',
  [143] = 'レジェンド特性・後方・遺伝',
  [144] = 'レジェンド特性・自在・遺伝',
  [145] = '府中の刺客',
  [146] = '淀の刺客',
  [147] = '仁川の刺客',
  [148] = '中山の刺客',
  [149] = '超音速の脚',
  [150] = '影踏ませぬ府中の脚',
  [151] = 'コーナリングマスター',
  [152] = '直千番長',
  [153] = '１４００巧者',
  [154] = '霞に消える逃走劇',
  [155] = '馬群はなす逃走劇',
  [156] = '最後方からの一閃',
  [157] = '最後方からの一撃',
  [158] = 'インからの豪脚',
  [159] = '馬群一掃する大まくり',
  [160] = 'ペースを支配する者',
  [161] = '期待のホープ',
  [162] = '充実一途',
  [163] = '本格化',
  [164] = '伏兵',
  [165] = '惑星',
  [166] = '重戦車',
  [167] = '香港ＧⅠの覇者',
  [168] = 'ダービー馬',
  [169] = '樫の女王',
  [170] = '砂の女王',
  [171] = '驚異の末脚',
  [172] = '超特急',
  [173] = 'ドバイの覇者',
  [174] = '海外からの刺客',
  [175] = '近代競馬の結晶',
  [176] = '未完の大器',
  [177] = '３歳代表',
  [178] = '最速の証明',
  [179] = '連戦連勝',
  [180] = '底知れぬ実力',
  [181] = '黄金の末脚',
  [182] = '大駆け再び',
  [183] = '白い逃亡者',
  [184] = '豪脚一閃',
  [185] = '遅咲きのステイヤー',
  [186] = '道悪の鬼',
  [187] = 'ロケットスタート',
  [188] = '交流重賞ハンター',
  [189] = '砂の王者',
  [190] = '砂の新星',
  [191] = '終い確実',
  [192] = '無事之名馬',
  [193] = '生粋のスプリンター',
  [194] = 'ニューヒロイン',
  [195] = 'ひたむきな、その走り',
  [196] = 'ダートスプリンター',
  [197] = '鋼の心臓',
  [198] = '世界が認めたその強さ',
  [199] = 'いぶし銀の輝き',
  [200] = '筋骨隆々',
  [201] = '女王の貫禄',
  [202] = '勝負気配',
  [203] = '注目の一頭',
  [204] = '安定のレース運び',
  [205] = '弾むようなステップ',
  [206] = '太陽の王子',
  [207] = '新聞を読む馬',
  [208] = 'お祭り男',
  [209] = 'お祭り女',
  [210] = 'マイルの皇帝',
  [211] = '走る精密機械',
  [212] = '女王の貫禄',
  [213] = '遅れてきた大物',
  [214] = '確かな先行力',
  [215] = '世代屈指の末脚',
  [216] = 'スタミナお化け',
  [217] = '眠れる獅子',
  [218] = '砂上の勝負師',
  [219] = '一発逆転',
  [220] = '鉄板ホース',
  [221] = 'ビクトリーロード',
  [222] = '先行押し切り',
  [223] = 'オークスコレクター',
  [224] = '世界のスプリント王',
  [225] = 'メイダンマイスター',
  [226] = 'ロンシャンマエストロ',
  [227] = '香港王者',
  [228] = '欧州マイルチャンプ',
  [229] = '直線競馬の申し子',
  [230] = '王家より戴きし栄冠',
  [231] = 'ストップス・ア・ネイション',
  [232] = 'フレミントンの英雄',
  [233] = 'ムーニーバレーの王',
  [234] = '競馬ブームの立役者',
  [235] = '府中の支配者',
  [236] = '勇者が拓く道',
  [237] = '欠点なき豪脚',
  [238] = '偉大なる紅き伝説',
  [239] = '天才の舞踏',
  [240] = '北の地の至宝',
  [241] = '最強の怪物',
  [242] = '勝利命ず王権',
  [243] = '無敵の超快速',
  [244] = '魅了する灰の幻影',
  [245] = '極めた芸術',
  [246] = '支配者の慧眼',
  [247] = '千年紀が育んだ偉才',
  [248] = '描くは栄光の結末',
  [249] = '狼煙が導く大攻勢',
  [250] = '自由と夢の象徴',
  [251] = '闘争心の化身',
  [252] = '星の海の旅人',
  [253] = '勝利へのランディング',
  [254] = '荒き血潮の咆哮',
  [255] = '奇跡の体現者',
  [256] = '紅き巨大戦艦',
  [257] = '咲き誇る名花',
  [258] = '最速の誇り',
  [259] = '魂燃やすビッグレッド',
  [260] = '全能たる鬼才',
  [261] = '堅牢なる王朝',
  [262] = '燃え滾る逃走本能',
  [263] = '百万馬力の末脚',
  [264] = '偉丈夫の七変化',
  [265] = '革命への進軍',
  [266] = '敵逃さぬ長距離砲',
  [267] = '西部のヒットマン',
  [268] = '海鳥優雅に舞う',
  [269] = '勇将の鋭き剣技',
  [270] = '頂極めし脚',
  [271] = '至高の脚',
  [272] = '畏怖もたらす閃光',
  [273] = '不滅の末脚',
  [274] = '純然たる王者',
  [275] = '獲物とらえる銃弾',
  [276] = '黒真珠の輝き',
  [277] = '蹴り抜く一閃',
  [278] = '旭日の導き',
  [279] = '祝祭彩る歌姫',
  [280] = 'ソニックブーム',
  [281] = '静寂に閃く脚',
  [282] = '黄金色に輝く名槍',
  [283] = '大いなる浪漫を求め',
  [284] = '豪脚、稲妻の如し',
  [285] = '光速を超える脚',
  [286] = '黒船襲来',
  [287] = '最強大王の進軍',
  [288] = '終わりなき驀進',
  [289] = '超音速フライト',
  [290] = '桜色に染まる月桂冠',
  [291] = '鍛え上げし芸術',
  [292] = 'モンスターマシン',
  [293] = '優美なる末脚',
  [294] = '青空を貫く稲妻',
  [295] = '王者の安定感',
  [296] = '泰然自若の差し脚',
  [297] = '女帝の辣腕',
  [298] = '獲物貫く嚆矢',
  [299] = '覚醒に至る道程',
  [300] = '荒々しき鼓動',
  [301] = '栄誉掴みしエース',
  [302] = '荒武者の一太刀',
  [303] = '逆襲の末脚',
  [304] = '暴走蒸気機関車',
  [305] = '千変万化',
  [306] = '必然たる奇跡',
  [307] = '英雄砂海を行く',
  [308] = '口笛交じりの一蹴',
  [309] = '絶対女王の王威',
  [310] = '鉄壁の門番',
  [311] = '砂塵まとう暴風雨',
  [312] = '聖女の凱旋',
  [313] = '比類なきヒロイン',
  [314] = '時代の開拓者',
  [315] = '変幻自在の太刀筋',
  [316] = 'アークの化身',
  [317] = '最速最強の証明',
  [318] = '夢と歴史の創造',
  [319] = 'あなたへの愛を込めて',
  [320] = 'その輝き、永遠に',
  [321] = '米国競馬ブームの立役者',
  [322] = '欧州競馬ブームの立役者',
}
WP26.SPEC.horseTraitSet =
  { pattern = 'B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 6B C8 38 48 8B 05 8E 35 F7 03 48 83 C0 28 48 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Unique trait',
    ['ja'] = '固有特性',
    ['off'] = 40,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 0,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 105, ['name'] = '覇道' },
      { ['id'] = 106, ['name'] = '異能の末脚' },
      { ['id'] = 107, ['name'] = '黄金の翼' },
      { ['id'] = 108, ['name'] = '熱血王道' },
      { ['id'] = 109, ['name'] = '不死鳥の一閃' },
      { ['id'] = 110, ['name'] = '栄冠を映す瞳' },
      { ['id'] = 111, ['name'] = '衝撃の末脚' },
      { ['id'] = 112, ['name'] = '絶対皇帝' },
      { ['id'] = 113, ['name'] = '心酔の府中' },
      { ['id'] = 114, ['name'] = '受け継がれし輝き' },
      { ['id'] = 115, ['name'] = '祭囃子' },
      { ['id'] = 116, ['name'] = '絶景の王道' },
      { ['id'] = 117, ['name'] = '金色の暴脚' },
      { ['id'] = 118, ['name'] = '快速龍王' },
      { ['id'] = 119, ['name'] = '破天荒' },
      { ['id'] = 120, ['name'] = '未知なる進化' },
      { ['id'] = 121, ['name'] = '大歓声より速く' },
      { ['id'] = 122, ['name'] = '怪物の孤高' },
      { ['id'] = 123, ['name'] = '白雲の軌跡' },
      { ['id'] = 124, ['name'] = '堂々たる主演' },
      { ['id'] = 125, ['name'] = 'テイオーステップ' },
      { ['id'] = 126, ['name'] = 'オグリコール' },
      { ['id'] = 127, ['name'] = '緋色の煌めき' },
      { ['id'] = 128, ['name'] = '大地が弾んで' },
      { ['id'] = 129, ['name'] = '天馬の羽ばたき' },
      { ['id'] = 130, ['name'] = '流星の貴公子' },
      { ['id'] = 131, ['name'] = 'アイドルホースの熱狂' },
      { ['id'] = 132, ['name'] = '人気より実力' },
      { ['id'] = 133, ['name'] = '異次元の逃走劇' },
      { ['id'] = 134, ['name'] = '覚醒の鼓動' },
      { ['id'] = 135, ['name'] = '義賊活劇譚' },
      { ['id'] = 136, ['name'] = '頂きへの飛翔' },
      { ['id'] = 137, ['name'] = '黒白を分かつ閃光' },
      { ['id'] = 138, ['name'] = '自由を照らす走り' },
      { ['id'] = 236, ['name'] = '勇者が拓く道' },
      { ['id'] = 237, ['name'] = '欠点なき豪脚' },
      { ['id'] = 238, ['name'] = '偉大なる紅き伝説' },
      { ['id'] = 239, ['name'] = '天才の舞踏' },
      { ['id'] = 240, ['name'] = '北の地の至宝' },
      { ['id'] = 241, ['name'] = '最強の怪物' },
      { ['id'] = 242, ['name'] = '勝利命ず王権' },
      { ['id'] = 243, ['name'] = '無敵の超快速' },
      { ['id'] = 244, ['name'] = '魅了する灰の幻影' },
      { ['id'] = 245, ['name'] = '極めた芸術' },
      { ['id'] = 246, ['name'] = '支配者の慧眼' },
      { ['id'] = 247, ['name'] = '千年紀が育んだ偉才' },
      { ['id'] = 248, ['name'] = '描くは栄光の結末' },
      { ['id'] = 249, ['name'] = '狼煙が導く大攻勢' },
      { ['id'] = 250, ['name'] = '自由と夢の象徴' },
      { ['id'] = 251, ['name'] = '闘争心の化身' },
      { ['id'] = 252, ['name'] = '星の海の旅人' },
      { ['id'] = 253, ['name'] = '勝利へのランディング' },
      { ['id'] = 254, ['name'] = '荒き血潮の咆哮' },
      { ['id'] = 255, ['name'] = '奇跡の体現者' },
      { ['id'] = 256, ['name'] = '紅き巨大戦艦' },
      { ['id'] = 257, ['name'] = '咲き誇る名花' },
      { ['id'] = 258, ['name'] = '最速の誇り' },
      { ['id'] = 259, ['name'] = '魂燃やすビッグレッド' },
      { ['id'] = 260, ['name'] = '全能たる鬼才' },
      { ['id'] = 261, ['name'] = '堅牢なる王朝' },
      { ['id'] = 262, ['name'] = '燃え滾る逃走本能' },
      { ['id'] = 263, ['name'] = '百万馬力の末脚' },
      { ['id'] = 264, ['name'] = '偉丈夫の七変化' },
      { ['id'] = 265, ['name'] = '革命への進軍' },
      { ['id'] = 266, ['name'] = '敵逃さぬ長距離砲' },
      { ['id'] = 267, ['name'] = '西部のヒットマン' },
      { ['id'] = 268, ['name'] = '海鳥優雅に舞う' },
      { ['id'] = 269, ['name'] = '勇将の鋭き剣技' },
      { ['id'] = 270, ['name'] = '頂極めし脚' },
      { ['id'] = 271, ['name'] = '至高の脚' },
      { ['id'] = 272, ['name'] = '畏怖もたらす閃光' },
      { ['id'] = 273, ['name'] = '不滅の末脚' },
      { ['id'] = 274, ['name'] = '純然たる王者' },
      { ['id'] = 275, ['name'] = '獲物とらえる銃弾' },
      { ['id'] = 276, ['name'] = '黒真珠の輝き' },
      { ['id'] = 277, ['name'] = '蹴り抜く一閃' },
      { ['id'] = 278, ['name'] = '旭日の導き' },
      { ['id'] = 279, ['name'] = '祝祭彩る歌姫' },
      { ['id'] = 280, ['name'] = 'ソニックブーム' },
      { ['id'] = 281, ['name'] = '静寂に閃く脚' },
      { ['id'] = 282, ['name'] = '黄金色に輝く名槍' },
      { ['id'] = 283, ['name'] = '大いなる浪漫を求め' },
      { ['id'] = 284, ['name'] = '豪脚、稲妻の如し' },
      { ['id'] = 285, ['name'] = '光速を超える脚' },
      { ['id'] = 286, ['name'] = '黒船襲来' },
      { ['id'] = 287, ['name'] = '最強大王の進軍' },
      { ['id'] = 288, ['name'] = '終わりなき驀進' },
      { ['id'] = 289, ['name'] = '超音速フライト' },
      { ['id'] = 290, ['name'] = '桜色に染まる月桂冠' },
      { ['id'] = 291, ['name'] = '鍛え上げし芸術' },
      { ['id'] = 292, ['name'] = 'モンスターマシン' },
      { ['id'] = 293, ['name'] = '優美なる末脚' },
      { ['id'] = 294, ['name'] = '青空を貫く稲妻' },
      { ['id'] = 295, ['name'] = '王者の安定感' },
      { ['id'] = 296, ['name'] = '泰然自若の差し脚' },
      { ['id'] = 297, ['name'] = '女帝の辣腕' },
      { ['id'] = 298, ['name'] = '獲物貫く嚆矢' },
      { ['id'] = 299, ['name'] = '覚醒に至る道程' },
      { ['id'] = 300, ['name'] = '荒々しき鼓動' },
      { ['id'] = 301, ['name'] = '栄誉掴みしエース' },
      { ['id'] = 302, ['name'] = '荒武者の一太刀' },
      { ['id'] = 303, ['name'] = '逆襲の末脚' },
      { ['id'] = 304, ['name'] = '暴走蒸気機関車' },
      { ['id'] = 305, ['name'] = '千変万化' },
      { ['id'] = 306, ['name'] = '必然たる奇跡' },
      { ['id'] = 307, ['name'] = '英雄砂海を行く' },
      { ['id'] = 308, ['name'] = '口笛交じりの一蹴' },
      { ['id'] = 309, ['name'] = '絶対女王の王威' },
      { ['id'] = 310, ['name'] = '鉄壁の門番' },
      { ['id'] = 311, ['name'] = '砂塵まとう暴風雨' },
      { ['id'] = 312, ['name'] = '聖女の凱旋' },
      { ['id'] = 313, ['name'] = '比類なきヒロイン' },
      { ['id'] = 314, ['name'] = '時代の開拓者' },
      { ['id'] = 315, ['name'] = '変幻自在の太刀筋' },
      { ['id'] = 316, ['name'] = 'アークの化身' },
      { ['id'] = 317, ['name'] = '最速最強の証明' },
      { ['id'] = 318, ['name'] = '夢と歴史の創造' },
      { ['id'] = 319, ['name'] = 'あなたへの愛を込めて' },
      { ['id'] = 320, ['name'] = 'その輝き、永遠に' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Jockey bond trait',
    ['ja'] = '騎手絆特性',
    ['off'] = 41,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 1,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 145, ['name'] = '府中の刺客' },
      { ['id'] = 146, ['name'] = '淀の刺客' },
      { ['id'] = 147, ['name'] = '仁川の刺客' },
      { ['id'] = 148, ['name'] = '中山の刺客' },
      { ['id'] = 149, ['name'] = '超音速の脚' },
      { ['id'] = 150, ['name'] = '影踏ませぬ府中の脚' },
      { ['id'] = 151, ['name'] = 'コーナリングマスター' },
      { ['id'] = 152, ['name'] = '直千番長' },
      { ['id'] = 153, ['name'] = '１４００巧者' },
      { ['id'] = 154, ['name'] = '霞に消える逃走劇' },
      { ['id'] = 155, ['name'] = '馬群はなす逃走劇' },
      { ['id'] = 156, ['name'] = '最後方からの一閃' },
      { ['id'] = 157, ['name'] = '最後方からの一撃' },
      { ['id'] = 158, ['name'] = 'インからの豪脚' },
      { ['id'] = 159, ['name'] = '馬群一掃する大まくり' },
      { ['id'] = 160, ['name'] = 'ペースを支配する者' },
      { ['id'] = 161, ['name'] = '期待のホープ' },
      { ['id'] = 162, ['name'] = '充実一途' },
      { ['id'] = 163, ['name'] = '本格化' },
      { ['id'] = 164, ['name'] = '伏兵' },
      { ['id'] = 165, ['name'] = '惑星' },
      { ['id'] = 166, ['name'] = '重戦車' },
      { ['id'] = 167, ['name'] = '香港ＧⅠの覇者' },
      { ['id'] = 168, ['name'] = 'ダービー馬' },
      { ['id'] = 169, ['name'] = '樫の女王' },
      { ['id'] = 170, ['name'] = '砂の女王' },
      { ['id'] = 171, ['name'] = '驚異の末脚' },
      { ['id'] = 172, ['name'] = '超特急' },
      { ['id'] = 173, ['name'] = 'ドバイの覇者' },
      { ['id'] = 174, ['name'] = '海外からの刺客' },
      { ['id'] = 175, ['name'] = '近代競馬の結晶' },
      { ['id'] = 176, ['name'] = '未完の大器' },
      { ['id'] = 177, ['name'] = '３歳代表' },
      { ['id'] = 178, ['name'] = '最速の証明' },
      { ['id'] = 179, ['name'] = '連戦連勝' },
      { ['id'] = 180, ['name'] = '底知れぬ実力' },
      { ['id'] = 181, ['name'] = '黄金の末脚' },
      { ['id'] = 182, ['name'] = '大駆け再び' },
      { ['id'] = 183, ['name'] = '白い逃亡者' },
      { ['id'] = 184, ['name'] = '豪脚一閃' },
      { ['id'] = 185, ['name'] = '遅咲きのステイヤー' },
      { ['id'] = 186, ['name'] = '道悪の鬼' },
      { ['id'] = 187, ['name'] = 'ロケットスタート' },
      { ['id'] = 188, ['name'] = '交流重賞ハンター' },
      { ['id'] = 189, ['name'] = '砂の王者' },
      { ['id'] = 190, ['name'] = '砂の新星' },
      { ['id'] = 191, ['name'] = '終い確実' },
      { ['id'] = 192, ['name'] = '無事之名馬' },
      { ['id'] = 193, ['name'] = '生粋のスプリンター' },
      { ['id'] = 194, ['name'] = 'ニューヒロイン' },
      { ['id'] = 195, ['name'] = 'ひたむきな、その走り' },
      { ['id'] = 196, ['name'] = 'ダートスプリンター' },
      { ['id'] = 197, ['name'] = '鋼の心臓' },
      { ['id'] = 198, ['name'] = '世界が認めたその強さ' },
      { ['id'] = 199, ['name'] = 'いぶし銀の輝き' },
      { ['id'] = 200, ['name'] = '筋骨隆々' },
      { ['id'] = 201, ['name'] = '女王の貫禄' },
      { ['id'] = 202, ['name'] = '勝負気配' },
      { ['id'] = 203, ['name'] = '注目の一頭' },
      { ['id'] = 204, ['name'] = '安定のレース運び' },
      { ['id'] = 205, ['name'] = '弾むようなステップ' },
      { ['id'] = 206, ['name'] = '太陽の王子' },
      { ['id'] = 207, ['name'] = '新聞を読む馬' },
      { ['id'] = 208, ['name'] = 'お祭り男' },
      { ['id'] = 209, ['name'] = 'お祭り女' },
      { ['id'] = 210, ['name'] = 'マイルの皇帝' },
      { ['id'] = 211, ['name'] = '走る精密機械' },
      { ['id'] = 212, ['name'] = '女王の貫禄' },
      { ['id'] = 213, ['name'] = '遅れてきた大物' },
      { ['id'] = 214, ['name'] = '確かな先行力' },
      { ['id'] = 215, ['name'] = '世代屈指の末脚' },
      { ['id'] = 216, ['name'] = 'スタミナお化け' },
      { ['id'] = 217, ['name'] = '眠れる獅子' },
      { ['id'] = 218, ['name'] = '砂上の勝負師' },
      { ['id'] = 219, ['name'] = '一発逆転' },
      { ['id'] = 220, ['name'] = '鉄板ホース' },
      { ['id'] = 221, ['name'] = 'ビクトリーロード' },
      { ['id'] = 222, ['name'] = '先行押し切り' },
      { ['id'] = 223, ['name'] = 'オークスコレクター' },
      { ['id'] = 224, ['name'] = '世界のスプリント王' },
      { ['id'] = 225, ['name'] = 'メイダンマイスター' },
      { ['id'] = 226, ['name'] = 'ロンシャンマエストロ' },
      { ['id'] = 227, ['name'] = '香港王者' },
      { ['id'] = 228, ['name'] = '欧州マイルチャンプ' },
      { ['id'] = 229, ['name'] = '直線競馬の申し子' },
      { ['id'] = 230, ['name'] = '王家より戴きし栄冠' },
      { ['id'] = 231, ['name'] = 'ストップス・ア・ネイション' },
      { ['id'] = 232, ['name'] = 'フレミントンの英雄' },
      { ['id'] = 233, ['name'] = 'ムーニーバレーの王' },
      { ['id'] = 234, ['name'] = '競馬ブームの立役者' },
      { ['id'] = 235, ['name'] = '府中の支配者' },
      { ['id'] = 321, ['name'] = '米国競馬ブームの立役者' },
      { ['id'] = 322, ['name'] = '欧州競馬ブームの立役者' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 1',
    ['ja'] = '特性1',
    ['off'] = 42,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 2,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 2',
    ['ja'] = '特性2',
    ['off'] = 43,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 3,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 3',
    ['ja'] = '特性3',
    ['off'] = 44,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 4,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 4',
    ['ja'] = '特性4',
    ['off'] = 45,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 5,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 5',
    ['ja'] = '特性5',
    ['off'] = 46,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 6,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 6',
    ['ja'] = '特性6',
    ['off'] = 47,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 7,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 7',
    ['ja'] = '特性7',
    ['off'] = 48,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 8,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Trait 8',
    ['ja'] = '特性8',
    ['off'] = 49,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 9,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 1, ['name'] = '大舞台' },
      { ['id'] = 2, ['name'] = '晴れ舞台' },
      { ['id'] = 3, ['name'] = 'GⅡ大将' },
      { ['id'] = 4, ['name'] = 'GⅡの守護者' },
      { ['id'] = 5, ['name'] = '交流重賞巧者' },
      { ['id'] = 6, ['name'] = '交流重賞ハンター' },
      { ['id'] = 7, ['name'] = 'ローカル' },
      { ['id'] = 8, ['name'] = '全国行脚' },
      { ['id'] = 9, ['name'] = '海外遠征' },
      { ['id'] = 10, ['name'] = '海外雄飛' },
      { ['id'] = 11, ['name'] = '根幹距離' },
      { ['id'] = 12, ['name'] = '根幹の鬼' },
      { ['id'] = 13, ['name'] = '非根幹距離' },
      { ['id'] = 14, ['name'] = '非根幹の鬼' },
      { ['id'] = 15, ['name'] = '超長距離' },
      { ['id'] = 16, ['name'] = '長距離砲' },
      { ['id'] = 17, ['name'] = '鉄砲' },
      { ['id'] = 18, ['name'] = '狙い撃ち' },
      { ['id'] = 19, ['name'] = '叩き良化' },
      { ['id'] = 20, ['name'] = '右肩上がり' },
      { ['id'] = 21, ['name'] = '乾坤一擲' },
      { ['id'] = 22, ['name'] = '渾身の激走' },
      { ['id'] = 23, ['name'] = '大駆け' },
      { ['id'] = 24, ['name'] = '大番狂わせ' },
      { ['id'] = 25, ['name'] = 'タフネス' },
      { ['id'] = 26, ['name'] = '超回復' },
      { ['id'] = 27, ['name'] = '牡馬混合' },
      { ['id'] = 28, ['name'] = '女王君臨' },
      { ['id'] = 29, ['name'] = '軽ハンデ' },
      { ['id'] = 30, ['name'] = '魅惑の軽斤量' },
      { ['id'] = 31, ['name'] = 'スタート' },
      { ['id'] = 32, ['name'] = 'ロケットスタート' },
      { ['id'] = 33, ['name'] = '高速逃げ' },
      { ['id'] = 34, ['name'] = '神速逃げ' },
      { ['id'] = 35, ['name'] = '二の脚' },
      { ['id'] = 36, ['name'] = '横綱相撲' },
      { ['id'] = 37, ['name'] = '直一気' },
      { ['id'] = 38, ['name'] = '鬼脚' },
      { ['id'] = 39, ['name'] = '強心臓' },
      { ['id'] = 40, ['name'] = '鋼の心臓' },
      { ['id'] = 41, ['name'] = '距離短縮' },
      { ['id'] = 42, ['name'] = '短縮一変' },
      { ['id'] = 43, ['name'] = '距離延長' },
      { ['id'] = 44, ['name'] = '延長一変' },
      { ['id'] = 45, ['name'] = '完全燃焼' },
      { ['id'] = 46, ['name'] = '全身全霊' },
      { ['id'] = 47, ['name'] = '学習能力' },
      { ['id'] = 48, ['name'] = '勝利の再現' },
      { ['id'] = 49, ['name'] = '春競馬' },
      { ['id'] = 50, ['name'] = '春満開' },
      { ['id'] = 51, ['name'] = '夏競馬' },
      { ['id'] = 52, ['name'] = '夏馬' },
      { ['id'] = 53, ['name'] = '秋競馬' },
      { ['id'] = 54, ['name'] = '秋の嵐' },
      { ['id'] = 55, ['name'] = '冬競馬' },
      { ['id'] = 56, ['name'] = '冬将軍' },
      { ['id'] = 57, ['name'] = '東京巧者' },
      { ['id'] = 58, ['name'] = '府中の申し子' },
      { ['id'] = 59, ['name'] = '中山巧者' },
      { ['id'] = 60, ['name'] = '中山の申し子' },
      { ['id'] = 61, ['name'] = '京都巧者' },
      { ['id'] = 62, ['name'] = '淀の申し子' },
      { ['id'] = 63, ['name'] = '阪神巧者' },
      { ['id'] = 64, ['name'] = '仁川の申し子' },
      { ['id'] = 65, ['name'] = '坂越え' },
      { ['id'] = 66, ['name'] = 'タフランナー' },
      { ['id'] = 67, ['name'] = '平坦巧者' },
      { ['id'] = 68, ['name'] = 'フラットランナー' },
      { ['id'] = 69, ['name'] = '行きっぷり' },
      { ['id'] = 70, ['name'] = '前進気勢' },
      { ['id'] = 71, ['name'] = '一人旅' },
      { ['id'] = 72, ['name'] = '唯我独尊' },
      { ['id'] = 73, ['name'] = 'ペースメイク' },
      { ['id'] = 74, ['name'] = 'レースメイク' },
      { ['id'] = 75, ['name'] = '最短距離' },
      { ['id'] = 76, ['name'] = 'インベタ張り付き' },
      { ['id'] = 77, ['name'] = 'ロングスパート' },
      { ['id'] = 78, ['name'] = 'ひとまくり' },
      { ['id'] = 79, ['name'] = '決め打ち' },
      { ['id'] = 80, ['name'] = '丁半博打' },
      { ['id'] = 81, ['name'] = '香港巧者' },
      { ['id'] = 82, ['name'] = '香港マイスター' },
      { ['id'] = 83, ['name'] = 'ドバイ巧者' },
      { ['id'] = 84, ['name'] = 'ドバイマイスター' },
      { ['id'] = 85, ['name'] = 'ロンシャン巧者' },
      { ['id'] = 86, ['name'] = 'ロンシャンマイスター' },
      { ['id'] = 87, ['name'] = 'スプリントギア' },
      { ['id'] = 88, ['name'] = '激流チェイス' },
      { ['id'] = 89, ['name'] = 'スプリントターボ' },
      { ['id'] = 90, ['name'] = '光速スパート' },
      { ['id'] = 91, ['name'] = 'マイルギア' },
      { ['id'] = 92, ['name'] = '勇往邁進' },
      { ['id'] = 93, ['name'] = 'マイルターボ' },
      { ['id'] = 94, ['name'] = '疾風迅雷' },
      { ['id'] = 95, ['name'] = 'クラシックギア' },
      { ['id'] = 96, ['name'] = '王者の行軍' },
      { ['id'] = 97, ['name'] = 'クラシックターボ' },
      { ['id'] = 98, ['name'] = '王者の進撃' },
      { ['id'] = 99, ['name'] = '長距離ギア' },
      { ['id'] = 100, ['name'] = '長駆追走' },
      { ['id'] = 101, ['name'] = '長距離ターボ' },
      { ['id'] = 102, ['name'] = '長駆突入' },
      { ['id'] = 103, ['name'] = 'アスコット巧者' },
      { ['id'] = 104, ['name'] = 'アスコットマイスター' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Legend trait',
    ['ja'] = 'レジェンド特性',
    ['off'] = 50,
    ['bit'] = 0,
    ['bits'] = 9,
    ['max'] = 511,
    ['base'] = 'horse',
    ['traitSlot'] = 10,
    ['choices'] = {
      { ['id'] = 0, ['name'] = '－' },
      { ['id'] = 139, ['name'] = 'レジェンド特性・前方' },
      { ['id'] = 140, ['name'] = 'レジェンド特性・後方' },
      { ['id'] = 141, ['name'] = 'レジェンド特性・自在' },
      { ['id'] = 142, ['name'] = 'レジェンド特性・前方・遺伝' },
      { ['id'] = 143, ['name'] = 'レジェンド特性・後方・遺伝' },
      { ['id'] = 144, ['name'] = 'レジェンド特性・自在・遺伝' },
    },
    ['source'] = 'AB180/AB1B0 -> 99F80/9A0E0; 9A830 metadata; UI 726542',
  })
end

WP26.EDITORS.jockey.max = 856
for _, key in ipairs({ 'trainer', 'jockey' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.en == 'Friendship' or f.en == 'Career wins' or f.en == 'Career G1 wins' or f.en == 'Age' then
      f.personOrdinaryOnly = true
    end
    if f.string and f.base == 'personData' then
      f.base = 'personName'
    end
  end
end
local trainerAbilities = {
  { 'Inspiration', '熱意' },
  { 'Horse appraisal', '相馬眼' },
  { 'Condition management', '体調管理' },
  { 'Weight management', '体重管理' },
  { 'Training', '調教' },
}
for i, n in ipairs(trainerAbilities) do
  table.insert(
    WP26.EDITORS.trainer.fields,
    {
      en = n[1],
      ja = n[2],
      off = 0x10,
      bit = 20 + i * 2,
      bits = 2,
      max = 3,
      personOrdinaryOnly = true,
      source = '1164A0/1165B0 selector=' .. (i - 1),
    }
  )
end

local jockeyAbilities = {
  { 'Front-running / forward', '逃げ・先行' },
  { 'Forward / closer', '先行・差し' },
  { 'Closer / late runner', '差し・追込' },
}
for i, n in ipairs(jockeyAbilities) do
  table.insert(
    WP26.EDITORS.jockey.fields,
    {
      en = n[1],
      ja = n[2],
      off = 0x10,
      bit = 20 + i * 2,
      bits = 2,
      max = 3,
      personOrdinaryOnly = true,
      source = '123540/1235F0 selector=' .. (i - 1),
    }
  )
end

table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Two-year-olds',
  ['ja'] = '特性：２歳戦（経験値）',
  ['off'] = 65,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 0,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Two-year-olds',
  ['ja'] = '特性：２歳戦',
  ['off'] = 67,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 0,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Three-year-olds',
  ['ja'] = '特性：３歳戦（経験値）',
  ['off'] = 66,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 1,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Three-year-olds',
  ['ja'] = '特性：３歳戦',
  ['off'] = 67,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 1,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Older horses',
  ['ja'] = '特性：古馬戦（経験値）',
  ['off'] = 67,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 2,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Older horses',
  ['ja'] = '特性：古馬戦',
  ['off'] = 67,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 2,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Fillies and mares',
  ['ja'] = '特性：牝馬（経験値）',
  ['off'] = 68,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 3,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Fillies and mares',
  ['ja'] = '特性：牝馬',
  ['off'] = 67,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 3,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Big races',
  ['ja'] = '特性：大レース（経験値）',
  ['off'] = 69,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 4,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Big races',
  ['ja'] = '特性：大レース',
  ['off'] = 67,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 4,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Classics',
  ['ja'] = '特性：クラシック（経験値）',
  ['off'] = 70,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 5,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Classics',
  ['ja'] = '特性：クラシック',
  ['off'] = 67,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 5,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Exchange graded races',
  ['ja'] = '特性：交流重賞（経験値）',
  ['off'] = 71,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 6,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Exchange graded races',
  ['ja'] = '特性：交流重賞',
  ['off'] = 67,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 6,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Local tracks',
  ['ja'] = '特性：ローカル（経験値）',
  ['off'] = 72,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 7,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Local tracks',
  ['ja'] = '特性：ローカル',
  ['off'] = 67,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 7,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Overseas expeditions',
  ['ja'] = '特性：海外遠征（経験値）',
  ['off'] = 73,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 8,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Overseas expeditions',
  ['ja'] = '特性：海外遠征',
  ['off'] = 68,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 8,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Turf',
  ['ja'] = '特性：芝（経験値）',
  ['off'] = 74,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 9,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Turf',
  ['ja'] = '特性：芝',
  ['off'] = 68,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 9,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Dirt',
  ['ja'] = '特性：ダート（経験値）',
  ['off'] = 75,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 10,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Dirt',
  ['ja'] = '特性：ダート',
  ['off'] = 68,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 10,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Travel races',
  ['ja'] = '特性：輸送競馬（経験値）',
  ['off'] = 76,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 11,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Travel races',
  ['ja'] = '特性：輸送競馬',
  ['off'] = 68,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 11,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: After a layoff',
  ['ja'] = '特性：休み明け（経験値）',
  ['off'] = 77,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 12,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: After a layoff',
  ['ja'] = '特性：休み明け',
  ['off'] = 68,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 12,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Improvement after a prep',
  ['ja'] = '特性：叩き一変（経験値）',
  ['off'] = 78,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 13,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Improvement after a prep',
  ['ja'] = '特性：叩き一変',
  ['off'] = 68,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 13,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Hard training',
  ['ja'] = '特性：スパルタ（経験値）',
  ['off'] = 79,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 14,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Hard training',
  ['ja'] = '特性：スパルタ',
  ['off'] = 68,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 14,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Light training',
  ['ja'] = '特性：軽め調教（経験値）',
  ['off'] = 80,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 15,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Light training',
  ['ja'] = '特性：軽め調教',
  ['off'] = 68,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 15,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Difficult temperament',
  ['ja'] = '特性：気性難（経験値）',
  ['off'] = 81,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 16,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Difficult temperament',
  ['ja'] = '特性：気性難',
  ['off'] = 69,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 16,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Favorites',
  ['ja'] = '特性：本命（経験値）',
  ['off'] = 82,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 17,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Favorites',
  ['ja'] = '特性：本命',
  ['off'] = 69,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 17,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Foreign-bred horses',
  ['ja'] = '特性：外国産馬（経験値）',
  ['off'] = 83,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 18,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Foreign-bred horses',
  ['ja'] = '特性：外国産馬',
  ['off'] = 69,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 18,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty experience: Motivation',
  ['ja'] = '特性：気合鼓舞（経験値）',
  ['off'] = 84,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 19,
  ['source'] = '116C70/116CF0; 189D30; UI2DCB4B',
})
table.insert(WP26.EDITORS.trainer.fields, {
  ['en'] = 'Specialty: Motivation',
  ['ja'] = '特性：気合鼓舞',
  ['off'] = 69,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 19,
  ['source'] = '11B1C0/11B210',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Big races',
  ['ja'] = '特性：大レース（経験値）',
  ['off'] = 72,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 0,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Big races',
  ['ja'] = '特性：大レース',
  ['off'] = 20,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 0,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Classics',
  ['ja'] = '特性：クラシック（経験値）',
  ['off'] = 73,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 1,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Classics',
  ['ja'] = '特性：クラシック',
  ['off'] = 20,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 1,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Exchange graded races',
  ['ja'] = '特性：交流重賞（経験値）',
  ['off'] = 74,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 2,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Exchange graded races',
  ['ja'] = '特性：交流重賞',
  ['off'] = 20,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 2,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Local tracks',
  ['ja'] = '特性：ローカル（経験値）',
  ['off'] = 75,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 3,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Local tracks',
  ['ja'] = '特性：ローカル',
  ['off'] = 20,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 3,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Overseas experience',
  ['ja'] = '特性：海外経験（経験値）',
  ['off'] = 76,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 4,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Overseas experience',
  ['ja'] = '特性：海外経験',
  ['off'] = 20,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 4,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Turf',
  ['ja'] = '特性：芝（経験値）',
  ['off'] = 77,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 5,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Turf',
  ['ja'] = '特性：芝',
  ['off'] = 20,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 5,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Dirt',
  ['ja'] = '特性：ダート（経験値）',
  ['off'] = 78,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 6,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Dirt',
  ['ja'] = '特性：ダート',
  ['off'] = 20,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 6,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Heavy ground',
  ['ja'] = '特性：重馬場（経験値）',
  ['off'] = 79,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 7,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Heavy ground',
  ['ja'] = '特性：重馬場',
  ['off'] = 20,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 7,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Debut education',
  ['ja'] = '特性：新馬教育（経験値）',
  ['off'] = 80,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 8,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Debut education',
  ['ja'] = '特性：新馬教育',
  ['off'] = 21,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 8,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Fillies and mares',
  ['ja'] = '特性：牝馬（経験値）',
  ['off'] = 81,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 9,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Fillies and mares',
  ['ja'] = '特性：牝馬',
  ['off'] = 21,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 9,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Windmill whip',
  ['ja'] = '特性：風車鞭（経験値）',
  ['off'] = 82,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 10,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Windmill whip',
  ['ja'] = '特性：風車鞭',
  ['off'] = 21,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 10,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Strong arms',
  ['ja'] = '特性：剛腕（経験値）',
  ['off'] = 83,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 11,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Strong arms',
  ['ja'] = '特性：剛腕',
  ['off'] = 21,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 11,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Settling horses',
  ['ja'] = '特性：折り合い（経験値）',
  ['off'] = 84,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 12,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Settling horses',
  ['ja'] = '特性：折り合い',
  ['off'] = 21,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 12,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Favorites',
  ['ja'] = '特性：本命（経験値）',
  ['off'] = 85,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 13,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Favorites',
  ['ja'] = '特性：本命',
  ['off'] = 21,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 13,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Outsiders',
  ['ja'] = '特性：穴馬（経験値）',
  ['off'] = 86,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 14,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Outsiders',
  ['ja'] = '特性：穴馬',
  ['off'] = 21,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 14,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Rider changes',
  ['ja'] = '特性：乗替（経験値）',
  ['off'] = 87,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 15,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Rider changes',
  ['ja'] = '特性：乗替',
  ['off'] = 21,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 15,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Veteran skill',
  ['ja'] = '特性：熟練（経験値）',
  ['off'] = 88,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 16,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Veteran skill',
  ['ja'] = '特性：熟練',
  ['off'] = 22,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 16,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Inside runs',
  ['ja'] = '特性：イン突き（経験値）',
  ['off'] = 89,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 17,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Inside runs',
  ['ja'] = '特性：イン突き',
  ['off'] = 22,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 17,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Straight races',
  ['ja'] = '特性：直線競馬（経験値）',
  ['off'] = 90,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 18,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Straight races',
  ['ja'] = '特性：直線競馬',
  ['off'] = 22,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 18,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty experience: Marking',
  ['ja'] = '特性：マーク屋（経験値）',
  ['off'] = 91,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 201,
  ['personOrdinaryOnly'] = true,
  ['specialty'] = 19,
  ['source'] = '123D00/123DA0; 189E80; UI2DD8BD',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Specialty: Marking',
  ['ja'] = '特性：マーク屋',
  ['off'] = 22,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['personDynamicOnly'] = true,
  ['specialty'] = 19,
  ['source'] = '123BC0/128780',
  ['optionsJa'] = { 'なし', 'あり' },
  ['optionsEn'] = { 'Off', 'On' },
})

WP26.ITEM_CATEGORIES = {
  { 'Coat catalogs', '毛色名鑑' },
  { 'Consumable rights', '利用権' },
  { 'Trust items', '信頼度アイテム' },
}
WP26.SPEC.itemStorage = {
  pattern = '48 8D 0D 69 A0 6F 03 E8 D4 14 EC FF E9 94 00 00 00 48 8D 0D 58 A0 6F 03',
  disp = 3,
  len = 7,
  direct = true,
  target_rva = 0x3869c00,
}
WP26.EDITORS.items = {
  record = 602,
  en = 'Item quantity editor',
  ja = 'アイテム個数変更',
  data = 'itemStorage',
  stride = 0,
  max = 0,
  fields = {},
}
WP26.itemAddCounts = {}
WP26.itemAddSession = nil
local itemOffsets = { 0x20, 0x21, 0x24, 0x25, 0x26, 0x27, 0x2c, 0x2d, 0x2e, 0x2f }
for i, off in ipairs(itemOffsets) do
  local id = i + 8
  local item = WP26.ITEMS[id + 1]
  WP26.EDITORS.items.fields[i] = {
    en = item.en,
    ja = item.ja,
    off = off,
    bit = 0,
    bits = 8,
    max = 99,
    itemID = id,
    category = i <= 6 and 1 or (i <= 9 and 2 or 3),
    source = '16FA70/16FC90 -> 30F70..31200; root 3869C00',
  }
end
function WP26.closeItemAdd(parent)
  WP26.itemAddSession = nil
  WP26.itemAddCounts = {}
  WP26.clearChildren(parent)
end
function WP26.openItemAdd(parent)
  WP26.require()
  WP26.closeItemAdd(parent)
  local session = { pid = WP26.pid }
  WP26.itemAddSession = session
  WP26.addAction(parent, 'Apply additions', '追加を実行', 'WP26.applyItemAdds()')
  local groups = {}
  for index, field in ipairs(WP26.EDITORS.items.fields) do
    local c = field.category
    if not groups[c] then
      local category = WP26.ITEM_CATEGORIES[c]
      groups[c] = WP26.addHdr(parent, category[1], category[2])
      groups[c].Collapsed = true
    end
    local address = WP26.data('itemStorage') + field.off
    local row = WP26.addRec(groups[c], field.en, field.ja, string.format('%X', address), vtByte)
    local typeName = 'WP2026_add_' .. getTickCount() .. '_' .. field.itemID
    local custom = registerCustomTypeLua(typeName, 1, function(byte)
      return WP26.itemAddCounts[field.itemID] or 0
    end, function(value)
      local unchanged = readBytes(address, 1, true) or { 0 }
      if WP26.itemAddSession == session and WP26.pid == session.pid and WP26.attached() then
        local n = tonumber(value)
        if n and n == n then
          WP26.itemAddCounts[field.itemID] = math.max(0, math.min(field.max, math.floor(n)))
        end
      end
      return unchanged
    end, false, false)
    custom.InternalOnly = true
    row.Type = vtCustom
    row.CustomTypeName = typeName
    row.OnActivate = function(_, before)
      if before then
        return false
      end
      return true
    end
  end
  parent.Collapsed = false
end
function WP26.applyItemAdds()
  WP26.require()
  local session = WP26.itemAddSession
  if not session or session.pid ~= WP26.pid then
    return
  end
  local ctx = WP26.context('items', 0)
  local plan = {}
  for _, field in ipairs(WP26.EDITORS.items.fields) do
    local n = WP26.itemAddCounts[field.itemID] or 0
    if n > 0 then
      local old = WP26.fieldRead(ctx, field)
      plan[#plan + 1] = { field = field, old = old, new = math.min(field.max, old + n) }
    end
  end
  for _, entry in ipairs(plan) do
    WP26.writeField(WP26.context('items', 0), entry.field, entry.new)
    WP26.itemAddCounts[entry.field.itemID] = 0
  end
end
WP26.NAMES[602] = { 'Item quantity editor', 'アイテム個数変更' }
WP26.NAMES[603] = { 'Add items: quantities', 'アイテム追加：追加個数' }

WP26.SPEC.horseCountrySet =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 0C 7D 20 0F B7 C1 83 E2 0F 48 6B C8 38 48 8B 05 78 77 F7 03' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Country of birth',
    ['ja'] = '生産国',
    ['off'] = 8,
    ['bit'] = 14,
    ['bits'] = 4,
    ['max'] = 11,
    ['base'] = 'horse',
    ['setter'] = 'horseCountrySet',
    ['source'] = 'A6F90/A6FC0; 3662B -> 187A00',
    ['optionsJa'] = {
      '日本',
      '米国',
      '英国',
      '愛国',
      '仏国',
      '豪州',
      '独国',
      '伊国',
      '香港',
      'UAE',
      '加国',
      '南米',
    },
    ['optionsEn'] = {
      'Japan',
      'USA',
      'United Kingdom',
      'Ireland',
      'France',
      'Oceania',
      'Germany',
      'Italy',
      'Hong Kong',
      'UAE',
      'Canada',
      'South America',
    },
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Age',
    ['ja'] = '馬齢',
    ['off'] = 12,
    ['bit'] = 21,
    ['bits'] = 3,
    ['min'] = 2,
    ['max'] = 9,
    ['displayAdd'] = 2,
    ['base'] = 'race',
    ['source'] = 'BEBC0/BEC60; BED60 adds 2',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Sex',
    ['ja'] = '性別',
    ['off'] = 16,
    ['bit'] = 14,
    ['bits'] = 1,
    ['max'] = 1,
    ['base'] = 'race',
    ['source'] = 'BB240/BB2E0; 188880',
    ['optionsJa'] = { '牡', '牝' },
    ['optionsEn'] = { 'Male', 'Female' },
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Gelded',
    ['ja'] = '去勢',
    ['off'] = 40,
    ['bit'] = 30,
    ['bits'] = 1,
    ['max'] = 1,
    ['base'] = 'race',
    ['source'] = 'BB980/BBA00; BB2E0',
    ['optionsJa'] = { 'なし', '去勢済み' },
    ['optionsEn'] = { 'No', 'Yes' },
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Ideal weight (kg)',
    ['ja'] = '理想馬体重（kg）',
    ['off'] = 10,
    ['bit'] = 0,
    ['bits'] = 8,
    ['min'] = 300,
    ['max'] = 700,
    ['displayScale'] = 2,
    ['displayAdd'] = 300,
    ['base'] = 'race',
    ['source'] = 'BBBF0/BBC90; 300+2*raw',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Current weight (kg)',
    ['ja'] = '現在馬体重（kg）',
    ['off'] = 11,
    ['bit'] = 0,
    ['bits'] = 8,
    ['min'] = 300,
    ['max'] = 700,
    ['displayScale'] = 2,
    ['displayAdd'] = 300,
    ['currentWeight'] = true,
    ['base'] = 'race',
    ['source'] = 'BC1D0/BC270/BC530; ideal +/-40kg',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Total prize money',
    ['ja'] = '総賞金',
    ['off'] = 32,
    ['bit'] = 0,
    ['bits'] = 24,
    ['max'] = 9999999,
    ['base'] = 'race',
    ['source'] = 'UI71303C -> C4300/C43A0',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Turf: Wins',
    ['ja'] = '芝：１着',
    ['off'] = 80,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C5D80; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Turf: Second',
    ['ja'] = '芝：２着',
    ['off'] = 81,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C5D80; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Turf: Third',
    ['ja'] = '芝：３着',
    ['off'] = 82,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C5D80; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Turf: Others',
    ['ja'] = '芝：着外',
    ['off'] = 83,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C5D80; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Dirt: Wins',
    ['ja'] = 'ダート：１着',
    ['off'] = 84,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C61D0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Dirt: Second',
    ['ja'] = 'ダート：２着',
    ['off'] = 85,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C61D0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Dirt: Third',
    ['ja'] = 'ダート：３着',
    ['off'] = 86,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C61D0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Dirt: Others',
    ['ja'] = 'ダート：着外',
    ['off'] = 87,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C61D0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G1: Wins',
    ['ja'] = 'ＧⅠ：１着',
    ['off'] = 88,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6B30; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G1: Second',
    ['ja'] = 'ＧⅠ：２着',
    ['off'] = 89,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6B30; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G1: Third',
    ['ja'] = 'ＧⅠ：３着',
    ['off'] = 90,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6B30; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G1: Others',
    ['ja'] = 'ＧⅠ：着外',
    ['off'] = 91,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6B30; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G2: Wins',
    ['ja'] = 'ＧⅡ：１着',
    ['off'] = 92,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6EA0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G2: Second',
    ['ja'] = 'ＧⅡ：２着',
    ['off'] = 93,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6EA0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G2: Third',
    ['ja'] = 'ＧⅡ：３着',
    ['off'] = 94,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6EA0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G2: Others',
    ['ja'] = 'ＧⅡ：着外',
    ['off'] = 95,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C6EA0; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G3: Wins',
    ['ja'] = 'ＧⅢ：１着',
    ['off'] = 96,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C7210; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G3: Second',
    ['ja'] = 'ＧⅢ：２着',
    ['off'] = 97,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C7210; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G3: Third',
    ['ja'] = 'ＧⅢ：３着',
    ['off'] = 98,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C7210; byte counters (0..255)',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'G3: Others',
    ['ja'] = 'ＧⅢ：着外',
    ['off'] = 99,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 255,
    ['base'] = 'race',
    ['groupEn'] = 'Race record',
    ['groupJa'] = '競走成績',
    ['source'] = 'UI2B0235..2B041F; C7210; byte counters (0..255)',
  })
end
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training policy',
  ['ja'] = '調教方針',
  ['off'] = 20,
  ['bit'] = 27,
  ['bits'] = 3,
  ['max'] = 6,
  ['source'] = 'F3BA0/F3C10 -> 189100; UI2BCB83',
  ['optionsJa'] = {
    'お任せ',
    'スピード重視',
    '脚質重視',
    'パワー重視',
    '距離適性重視',
    'メンタル重視',
    '健康重視',
  },
  ['optionsEn'] = { 'Automatic', 'Speed', 'Running style', 'Power', 'Distance aptitude', 'Mental strength', 'Health' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Speed',
  ['ja'] = '育成経験値：スピード',
  ['off'] = 372,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Acceleration',
  ['ja'] = '育成経験値：瞬発力',
  ['off'] = 373,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Guts',
  ['ja'] = '育成経験値：勝負根性',
  ['off'] = 374,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Power',
  ['ja'] = '育成経験値：パワー',
  ['off'] = 375,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Flexibility',
  ['ja'] = '育成経験値：柔軟性',
  ['off'] = 376,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Mental strength',
  ['ja'] = '育成経験値：精神力',
  ['off'] = 377,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Intelligence',
  ['ja'] = '育成経験値：賢さ',
  ['off'] = 378,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Training experience: Health',
  ['ja'] = '育成経験値：健康',
  ['off'] = 379,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Training experience',
  ['groupJa'] = '育成経験値',
  ['source'] = 'F7B30/F7C00; UI2A6EF9; label table39DC3D0; 12F8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Speed',
  ['ja'] = '前回育成経験値：スピード',
  ['off'] = 380,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Acceleration',
  ['ja'] = '前回育成経験値：瞬発力',
  ['off'] = 381,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Guts',
  ['ja'] = '前回育成経験値：勝負根性',
  ['off'] = 382,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Power',
  ['ja'] = '前回育成経験値：パワー',
  ['off'] = 383,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Flexibility',
  ['ja'] = '前回育成経験値：柔軟性',
  ['off'] = 384,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Mental strength',
  ['ja'] = '前回育成経験値：精神力',
  ['off'] = 385,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Intelligence',
  ['ja'] = '前回育成経験値：賢さ',
  ['off'] = 386,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Previous training experience: Health',
  ['ja'] = '前回育成経験値：健康',
  ['off'] = 387,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['groupEn'] = 'Previous training experience',
  ['groupJa'] = '前回育成経験値',
  ['source'] = 'F7D00/F7DD0; 9C4A16 current-to-previous snapshot',
})
for _, key in ipairs({ 'sire', 'mare' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.en:find('Breeding years elapsed', 1, true) then
      f.en = 'Years in breeding'
      f.ja = '繁殖年数'
      f.displayAdd = 1
      f.min = 1
      f.max = 32
    end
  end
end
WP26.SPEC.horseStyleSet =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 78 41 83 F8 0C 73 72 85 D2 74 52 83 EA 01 74 29 83 FA 01 75 64 0F B7' }
WP26.SPEC.horseStyleCapSet =
  { pattern = 'B8 2D 70 00 00 66 3B C8 73 7F 41 83 F8 0C 73 79 85 D2 74 52 83 EA 01 74 29 83 FA 01 75 6B 0F B7' }
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Burst aptitude (base)',
    ['ja'] = '瞬発戦適性（基本値）',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 0,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleSet',
    ['setterIndex'] = 0,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA540/AA5B0',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Burst aptitude growth limit',
    ['ja'] = '瞬発戦適性：成長上限',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 12,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleCapSet',
    ['setterIndex'] = 0,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA640/AA6B0',
  })
end
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Burst aptitude growth bonus',
  ['ja'] = '瞬発戦適性加算値',
  ['off'] = 276,
  ['bit'] = 19,
  ['bits'] = 4,
  ['max'] = 11,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; FC920 ->9D890/9D8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Burst aptitude experience',
  ['ja'] = '瞬発戦適性経験値',
  ['off'] = 280,
  ['bit'] = 0,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D930/9D970',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Burst previous aptitude experience',
  ['ja'] = '瞬発戦前回適性経験値',
  ['off'] = 284,
  ['bit'] = 0,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D9D0/9DA10; snapshot9C4A31..4F',
})
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Attrition aptitude (base)',
    ['ja'] = '消耗戦適性（基本値）',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 4,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleSet',
    ['setterIndex'] = 1,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA540/AA5B0',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Attrition aptitude growth limit',
    ['ja'] = '消耗戦適性：成長上限',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 16,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleCapSet',
    ['setterIndex'] = 1,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA640/AA6B0',
  })
end
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Attrition aptitude growth bonus',
  ['ja'] = '消耗戦適性加算値',
  ['off'] = 276,
  ['bit'] = 23,
  ['bits'] = 4,
  ['max'] = 11,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; FC920 ->9D890/9D8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Attrition aptitude experience',
  ['ja'] = '消耗戦適性経験値',
  ['off'] = 280,
  ['bit'] = 7,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D930/9D970',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Attrition previous aptitude experience',
  ['ja'] = '消耗戦前回適性経験値',
  ['off'] = 284,
  ['bit'] = 7,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D9D0/9DA10; snapshot9C4A31..4F',
})
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Endurance aptitude (base)',
    ['ja'] = '持久戦適性（基本値）',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 8,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleSet',
    ['setterIndex'] = 2,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA540/AA5B0',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Endurance aptitude growth limit',
    ['ja'] = '持久戦適性：成長上限',
    ['base'] = 'horse',
    ['off'] = 20,
    ['bit'] = 20,
    ['bits'] = 4,
    ['max'] = 11,
    ['setter'] = 'horseStyleCapSet',
    ['setterIndex'] = 2,
    ['groupEn'] = 'Race style aptitude',
    ['groupJa'] = '戦法適性',
    ['source'] = 'UI2A8236..2A8482 ->188E30,CD1A0,CD300; AA640/AA6B0',
  })
end
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Endurance aptitude growth bonus',
  ['ja'] = '持久戦適性加算値',
  ['off'] = 276,
  ['bit'] = 27,
  ['bits'] = 4,
  ['max'] = 11,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; FC920 ->9D890/9D8D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Endurance aptitude experience',
  ['ja'] = '持久戦適性経験値',
  ['off'] = 280,
  ['bit'] = 14,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D930/9D970',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Endurance previous aptitude experience',
  ['ja'] = '持久戦前回適性経験値',
  ['off'] = 284,
  ['bit'] = 14,
  ['bits'] = 7,
  ['max'] = 100,
  ['groupEn'] = 'Race style growth',
  ['groupJa'] = '戦法適性の育成',
  ['source'] = 'UI2A8236..2A8482; 9D9D0/9DA10; snapshot9C4A31..4F',
})
WP26.SPEC.umasonaKindSet = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2D 83 FA 06 73 28 41 83 F8 5D 7D 22 0F B7 C1 41 80 E0 7F 48 6B C8 1C 48 63 C2 48 03 C8 48 8B 05 CB 57 F7 03 80 64 48 18 80 44 08 44 48 18 C3 CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaStateSet = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 27 83 FA 06 73 22 0F B7 C1 41 80 E0 03 48 6B C8 1C 48 63 C2 48 03 C8 48 8B 05 51 57 F7 03 80 64 48 19 FC 44 08 44 48 19 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaState2Set = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2B 83 FA 06 73 26 0F B7 C1 41 80 E0 03 48 6B C8 1C 48 63 C2 48 03 C8 41 C0 E0 02 48 8B 05 CD 56 F7 03 80 64 48 19 F3 44 08 44 48 19 C3 CC CC CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaState3Set = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2B 83 FA 06 73 26 0F B7 C1 41 80 E0 03 48 6B C8 1C 48 63 C2 48 03 C8 41 C0 E0 04 48 8B 05 4D 56 F7 03 80 64 48 19 CF 44 08 44 48 19 C3 CC CC CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaFlag1Set = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 27 83 FA 06 73 22 0F B7 C1 48 6B C8 1C 48 63 C2 48 03 C8 41 C0 E0 07 48 8B 05 D1 55 F7 03 80 64 48 18 7F 44 08 44 48 18 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaFlag2Set = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2B 83 FA 06 73 26 0F B7 C1 41 80 E0 01 48 6B C8 1C 48 63 C2 48 03 C8 41 C0 E0 06 48 8B 05 4D 55 F7 03 80 64 48 19 BF 44 08 44 48 19 C3 CC CC CC CC CC CC CC CC CC CC',
}
WP26.SPEC.umasonaFlag3Set = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 27 83 FA 06 73 22 0F B7 C1 48 6B C8 1C 48 63 C2 48 03 C8 41 C0 E0 07 48 8B 05 D1 54 F7 03 80 64 48 19 7F 44 08 44 48 19 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC',
}
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 1',
    ['ja'] = 'ウマソナ1',
    ['off'] = 24,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 0,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 2',
    ['ja'] = 'ウマソナ2',
    ['off'] = 26,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 1,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 3',
    ['ja'] = 'ウマソナ3',
    ['off'] = 28,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 2,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 4',
    ['ja'] = 'ウマソナ4',
    ['off'] = 30,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 3,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 5',
    ['ja'] = 'ウマソナ5',
    ['off'] = 32,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 4,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Umasona 6',
    ['ja'] = 'ウマソナ6',
    ['off'] = 34,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 92,
    ['base'] = 'horse',
    ['umasonaSlot'] = 5,
    ['groupEn'] = 'Umasona',
    ['groupJa'] = 'ウマソナ',
    ['choices'] = {
      { ['id'] = 0, ['name'] = 'なし' },
      { ['id'] = 1, ['name'] = '引っ込み思案' },
      { ['id'] = 2, ['name'] = '負けず嫌い' },
      { ['id'] = 3, ['name'] = '反抗的' },
      { ['id'] = 4, ['name'] = '詰めが甘い' },
      { ['id'] = 5, ['name'] = '甘えん坊' },
      { ['id'] = 6, ['name'] = 'わがまま' },
      { ['id'] = 7, ['name'] = '人懐っこい' },
      { ['id'] = 8, ['name'] = '努力上手' },
      { ['id'] = 9, ['name'] = '手抜き癖' },
      { ['id'] = 10, ['name'] = 'ムラっ気' },
      { ['id'] = 11, ['name'] = '剛腕○' },
      { ['id'] = 12, ['name'] = '剛腕×' },
      { ['id'] = 13, ['name'] = '風車鞭○' },
      { ['id'] = 14, ['name'] = '風車鞭×' },
      { ['id'] = 15, ['name'] = '使い詰め○' },
      { ['id'] = 16, ['name'] = '使い詰め×' },
      { ['id'] = 17, ['name'] = '環境変化○' },
      { ['id'] = 18, ['name'] = '環境変化×' },
      { ['id'] = 19, ['name'] = '新聞を読む馬' },
      { ['id'] = 20, ['name'] = 'いたずら好き' },
      { ['id'] = 21, ['name'] = 'スランプ' },
      { ['id'] = 22, ['name'] = '目立ちたがり' },
      { ['id'] = 23, ['name'] = 'エンタテイナー' },
      { ['id'] = 24, ['name'] = '不撓不屈' },
      { ['id'] = 25, ['name'] = '甘え上手' },
      { ['id'] = 26, ['name'] = '天真爛漫' },
      { ['id'] = 27, ['name'] = '秀才肌' },
      { ['id'] = 28, ['name'] = '★剛腕○進化' },
      { ['id'] = 29, ['name'] = '★風車鞭○進化' },
      { ['id'] = 30, ['name'] = '★使い詰め○進化' },
      { ['id'] = 31, ['name'] = '★環境変化○進化' },
      { ['id'] = 32, ['name'] = '★新聞を読む馬進化' },
      { ['id'] = 33, ['name'] = '自由気まま' },
      { ['id'] = 34, ['name'] = '引っ込み思案（克服）' },
      { ['id'] = 35, ['name'] = '反抗的（克服）' },
      { ['id'] = 36, ['name'] = '詰めが甘い（克服）' },
      { ['id'] = 37, ['name'] = 'わがまま（克服）' },
      { ['id'] = 38, ['name'] = '手抜き癖（克服）' },
      { ['id'] = 39, ['name'] = 'ムラっ気（克服）' },
      { ['id'] = 40, ['name'] = '剛腕×（克服）' },
      { ['id'] = 41, ['name'] = '風車鞭×（克服）' },
      { ['id'] = 42, ['name'] = '使い詰め×（克服）' },
      { ['id'] = 43, ['name'] = '環境変化×（克服）' },
      { ['id'] = 44, ['name'] = 'スランプ（克服）' },
      { ['id'] = 45, ['name'] = 'ど根性' },
      { ['id'] = 46, ['name'] = '厩舎のボス' },
      { ['id'] = 47, ['name'] = '気合充分' },
      { ['id'] = 48, ['name'] = '絶好調' },
      { ['id'] = 49, ['name'] = '群れの一員' },
      { ['id'] = 50, ['name'] = 'スパルタ調整向き' },
      { ['id'] = 51, ['name'] = 'ソフト調整向き' },
      { ['id'] = 52, ['name'] = '前向き' },
      { ['id'] = 53, ['name'] = 'ズブい' },
      { ['id'] = 54, ['name'] = '馬込み○' },
      { ['id'] = 55, ['name'] = '馬込み×' },
      { ['id'] = 56, ['name'] = '噛みつき癖' },
      { ['id'] = 57, ['name'] = 'ズブい（克服）' },
      { ['id'] = 58, ['name'] = '馬込み×（克服）' },
      { ['id'] = 59, ['name'] = '噛みつき癖（克服）' },
      { ['id'] = 60, ['name'] = '積極果敢' },
      { ['id'] = 61, ['name'] = '瞬間の反応' },
      { ['id'] = 62, ['name'] = '馬群割り' },
      { ['id'] = 63, ['name'] = '臥薪嘗胆' },
      { ['id'] = 64, ['name'] = '★傍若無人' },
      { ['id'] = 65, ['name'] = '★野生児' },
      { ['id'] = 66, ['name'] = '荒ぶる鏑矢' },
      { ['id'] = 67, ['name'] = '稀代の気分屋' },
      { ['id'] = 68, ['name'] = 'プレイボーイ' },
      { ['id'] = 69, ['name'] = 'プレイガール' },
      { ['id'] = 70, ['name'] = '★絶対君主' },
      { ['id'] = 71, ['name'] = '★気高き恒星' },
      { ['id'] = 72, ['name'] = '食いしん坊' },
      { ['id'] = 73, ['name'] = '一心不乱' },
      { ['id'] = 74, ['name'] = '★きれい好き' },
      { ['id'] = 75, ['name'] = '気ままフライト' },
      { ['id'] = 76, ['name'] = '★人恋し馬恋し' },
      { ['id'] = 77, ['name'] = '親分肌' },
      { ['id'] = 78, ['name'] = '泰然自若' },
      { ['id'] = 79, ['name'] = '制御不能' },
      { ['id'] = 80, ['name'] = '★激情家' },
      { ['id'] = 81, ['name'] = '超わがままっ子' },
      { ['id'] = 82, ['name'] = '★写真好き' },
      { ['id'] = 83, ['name'] = '暴れん坊' },
      { ['id'] = 84, ['name'] = '★切り替え上手' },
      { ['id'] = 85, ['name'] = '奇想天外' },
      { ['id'] = 86, ['name'] = '★有り余る闘志' },
      { ['id'] = 87, ['name'] = '★お祭り好き' },
      { ['id'] = 88, ['name'] = '超実戦型' },
      { ['id'] = 89, ['name'] = '★野生根性' },
      { ['id'] = 90, ['name'] = '猪突猛進' },
      { ['id'] = 91, ['name'] = '★優等生' },
      { ['id'] = 92, ['name'] = '悠々自適' },
    },
    ['source'] = 'UI31F09B/711F18 -> A8F10; 190CD0/190F80; A8F60 + init1D19E0..1D1A49',
  })
end
table.insert(WP26.ITEM_CATEGORIES, { 'Farm manager rights', '牧場長利用権' })
table.insert(WP26.ITEM_CATEGORIES, { 'Swimsuits', '水着' })
table.insert(WP26.ITEM_CATEGORIES, { 'RPG costumes', 'RPG風衣装' })
table.insert(WP26.ITEM_CATEGORIES, { 'Idol costumes', 'アイドル衣装' })
table.insert(WP26.ITEM_CATEGORIES, { 'Zodiac costumes', '十二支衣装' })
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Farm manager access: 夢乃美空',
  ['ja'] = '牧場長・夢乃美空の利用権',
  ['off'] = 24,
  ['bit'] = 28,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 78,
  ['category'] = 4,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 牧野若葉',
  ['ja'] = '牧野若葉の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 12,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 79,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 牧野双葉',
  ['ja'] = '牧野双葉の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 80,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 椎野はるか',
  ['ja'] = '椎野はるかの衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 14,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 81,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 結城江奈',
  ['ja'] = '結城江奈の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 17,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 82,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 橘もえぎ',
  ['ja'] = '橘もえぎの衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 15,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 83,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 駒野みのり',
  ['ja'] = '駒野みのりの衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 16,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 84,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 青草ひまり',
  ['ja'] = '青草ひまりの衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 18,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 85,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 鳥海藍',
  ['ja'] = '鳥海藍の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 86,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 十和田夏美',
  ['ja'] = '十和田夏美の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 26,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 87,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 夢乃美空',
  ['ja'] = '夢乃美空の衣装変更（水着）',
  ['off'] = 24,
  ['bit'] = 29,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 88,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Swimsuit: 茅野翠月',
  ['ja'] = '茅野翠月の衣装変更（水着）',
  ['off'] = 28,
  ['bit'] = 10,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 89,
  ['category'] = 5,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 牧野若葉',
  ['ja'] = '牧野若葉の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 19,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 90,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 牧野双葉',
  ['ja'] = '牧野双葉の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 20,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 91,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 椎野はるか',
  ['ja'] = '椎野はるかの衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 22,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 92,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 結城江奈',
  ['ja'] = '結城江奈の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 23,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 93,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 橘もえぎ',
  ['ja'] = '橘もえぎの衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 24,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 94,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 駒野みのり',
  ['ja'] = '駒野みのりの衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 25,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 95,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 青草ひまり',
  ['ja'] = '青草ひまりの衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 9,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 96,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 精武万作',
  ['ja'] = '精武万作の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 21,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 97,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 鳥海藍',
  ['ja'] = '鳥海藍の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 98,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 十和田夏美',
  ['ja'] = '十和田夏美の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 27,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 99,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 夢乃美空',
  ['ja'] = '夢乃美空の衣装変更（RPG風）',
  ['off'] = 24,
  ['bit'] = 30,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 100,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'RPG costume: 茅野翠月',
  ['ja'] = '茅野翠月の衣装変更（RPG風）',
  ['off'] = 28,
  ['bit'] = 11,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 101,
  ['category'] = 6,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 牧野若葉',
  ['ja'] = '牧野若葉の衣装変更（アイドル）',
  ['off'] = 24,
  ['bit'] = 31,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 102,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 牧野双葉',
  ['ja'] = '牧野双葉の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 103,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 椎野はるか',
  ['ja'] = '椎野はるかの衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 104,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 結城江奈',
  ['ja'] = '結城江奈の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 105,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 橘もえぎ',
  ['ja'] = '橘もえぎの衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 106,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 駒野みのり',
  ['ja'] = '駒野みのりの衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 107,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 青草ひまり',
  ['ja'] = '青草ひまりの衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 108,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 精武万作',
  ['ja'] = '精武万作の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 109,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 鳥海藍',
  ['ja'] = '鳥海藍の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 110,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 十和田夏美',
  ['ja'] = '十和田夏美の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 8,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 111,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 夢乃美空',
  ['ja'] = '夢乃美空の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 9,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 112,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Idol costume: 茅野翠月',
  ['ja'] = '茅野翠月の衣装変更（アイドル）',
  ['off'] = 28,
  ['bit'] = 12,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 113,
  ['category'] = 7,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 牧野若葉',
  ['ja'] = '牧野若葉の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 114,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 牧野双葉',
  ['ja'] = '牧野双葉の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 14,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 115,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 椎野はるか',
  ['ja'] = '椎野はるかの衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 15,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 116,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 結城江奈',
  ['ja'] = '結城江奈の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 16,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 117,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 橘もえぎ',
  ['ja'] = '橘もえぎの衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 17,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 118,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 駒野みのり',
  ['ja'] = '駒野みのりの衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 18,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 119,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 青草ひまり',
  ['ja'] = '青草ひまりの衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 19,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 120,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 精武万作',
  ['ja'] = '精武万作の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 20,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 121,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 鳥海藍',
  ['ja'] = '鳥海藍の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 21,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 122,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 十和田夏美',
  ['ja'] = '十和田夏美の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 22,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 123,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 夢乃美空',
  ['ja'] = '夢乃美空の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 23,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 124,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
table.insert(WP26.EDITORS.items.fields, {
  ['en'] = 'Zodiac costume: 茅野翠月',
  ['ja'] = '茅野翠月の衣装変更（十二支）',
  ['off'] = 28,
  ['bit'] = 24,
  ['bits'] = 1,
  ['max'] = 1,
  ['itemID'] = 125,
  ['category'] = 8,
  ['source'] = 'Local flags 170200 ->25BD80/260160/2600A0;16FA70/16FC90; disk metadata2A30F70',
})
WP26.SPEC.raceLifespanSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D A7 CB E0 03 00 75 22 BA 2E 33 00 00 0F B7 C1 66 2B C2 66 83 F8 01 76 11 BA 30 33 00',
}
WP26.SPEC.raceGrowthDegreeSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 07 A5 E0 03 00 75 22 BA 2E 33 00 00 0F B7 C1 66 2B C2 66 83 F8 01 76 11 BA 30 33 00',
}
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Racing lifespan',
    ['ja'] = '競走寿命',
    ['off'] = 7,
    ['bit'] = 0,
    ['bits'] = 7,
    ['max'] = 100,
    ['base'] = 'race',
    ['raceSetter'] = 'raceLifespanSet',
    ['source'] = 'Effect6 text2A3C990 ->250BBC[6]=2506B1 ->BC940/BC8B0; retirement2F3765',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Growth degree',
    ['ja'] = '成長度',
    ['off'] = 12,
    ['bit'] = 0,
    ['bits'] = 8,
    ['max'] = 120,
    ['base'] = 'race',
    ['raceSetter'] = 'raceGrowthDegreeSet',
    ['source'] = 'Effect7 text2A3C9A8 ->250BBC[7]=250785 ->BEFE0/BEF50; caller250177',
  })
end
WP26.SPEC.raceGrowthBonusSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D E7 A0 E0 03 00 75 22 BA 2E 33 00 00 0F B7 C1 66 2B C2 66 83 F8 01 76 11 BA 30 33 00',
}
WP26.SPEC.raceBreakthroughSet = {
  pattern = '48 83 EC 28 44 8B DA E8 F4 AA 1C 00 81 60 14 FF FF F7 FF 41 F7 DB 1B C9 81 E1 00 00 08 00 09 48 14 48 83 C4 28 C3 CC CC CC CC CC CC CC CC CC CC 48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB',
}
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Growth limit bonus',
    ['ja'] = '成長度上限加算',
    ['off'] = 20,
    ['bit'] = 20,
    ['bits'] = 4,
    ['max'] = 10,
    ['base'] = 'race',
    ['raceSetter'] = 'raceGrowthBonusSet',
    ['source'] = 'BF390/BF400; BF050 limit=100+10*BF2F0+BF390; effect250812',
  })
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Limit breakthrough',
    ['ja'] = '限界突破',
    ['off'] = 20,
    ['bit'] = 19,
    ['bits'] = 1,
    ['max'] = 1,
    ['base'] = 'race',
    ['raceSetter'] = 'raceBreakthroughSet',
    ['optionsJa'] = { '未実施', '実施済み' },
    ['optionsEn'] = { 'Not applied', 'Applied' },
    ['source'] = 'BF2F0/BF360; ticket908B50..908CC4; WMM2E68E',
  })
end
WP26.SPEC.acquaintance = WP26.SPEC.secretary
WP26.EDITORS.acquaintance = WP26.EDITORS.secretary
WP26.EDITORS.acquaintance.record = 491
WP26.EDITORS.acquaintance.data = 'acquaintance'
WP26.EDITORS.acquaintance.en = 'Acquaintance editor'
WP26.EDITORS.acquaintance.ja = '知人エディタ'
WP26.SPEC.secretary = {
  pattern = '48 8B 0D E0 6F F1 03 8B 04 01 C1 E8 0C 25 FF 3F 00 00 48 83 C4 38 C3 CC CC',
  disp = 3,
  len = 7,
  direct = false,
  target_rva = 0x4042550,
}
WP26.SPEC.secretaryProfile = {
  pattern = '89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 24 83 7C 24 40 05 7D 3B 8B 4C 24 40 E8 8E FE FF FF 0F B6 C0 66 89 44 24 20 83 3D 67 CF D8 03 00 75 10 83 3D 76 CF D8 03 00 75 07 33 C0 66 89',
}
WP26.EDITORS.secretary = {
  ['record'] = 490,
  ['en'] = 'Secretary editor',
  ['ja'] = '秘書エディタ',
  ['data'] = 'secretary',
  ['stride'] = 72,
  ['max'] = 149,
  ['fields'] = {
    {
      ['en'] = 'Family name',
      ['ja'] = '姓',
      ['off'] = 8,
      ['bits'] = 8,
      ['bit'] = 0,
      ['max'] = 16,
      ['string'] = true,
      ['source'] = '12B630/12B690',
    },
    {
      ['en'] = 'Given name',
      ['ja'] = '名',
      ['off'] = 25,
      ['bits'] = 8,
      ['bit'] = 0,
      ['max'] = 16,
      ['string'] = true,
      ['source'] = '12B6E0/12B740',
    },
    {
      ['en'] = 'Family name reading',
      ['ja'] = '姓（読み）',
      ['off'] = 42,
      ['bits'] = 8,
      ['bit'] = 0,
      ['max'] = 8,
      ['string'] = true,
      ['source'] = '12B7D0; next reading at33h',
    },
    {
      ['en'] = 'Given name reading',
      ['ja'] = '名（読み）',
      ['off'] = 51,
      ['bits'] = 8,
      ['bit'] = 0,
      ['max'] = 8,
      ['string'] = true,
      ['source'] = '12B830; next fields at3Ch',
    },
    {
      ['en'] = 'Age',
      ['ja'] = '年齢',
      ['off'] = 4,
      ['bit'] = 0,
      ['bits'] = 7,
      ['max'] = 100,
      ['source'] = '12BB90/12BBF0; marriage eligibility62E31F, annual78F9DF',
    },
    {
      ['en'] = 'Sex',
      ['ja'] = '性別',
      ['off'] = 0,
      ['bit'] = 11,
      ['bits'] = 1,
      ['max'] = 1,
      ['optionsJa'] = { '男性', '女性' },
      ['optionsEn'] = { 'Male', 'Female' },
      ['source'] = '12B420/12B490; marriage eligibility62E315',
    },
  },
}
WP26.NAMES[490] = { 'Secretary editor', '秘書エディタ' }
WP26.NAMES[491] = { 'Acquaintance editor', '知人エディタ' }
local baseEditorRows = WP26.editorRows
function WP26.editorRows(key)
  if key ~= 'secretary' then
    return baseEditorRows(key)
  end
  WP26.require()
  local rows = {}
  local seen = {}
  local function include(id)
    if not id or id < 0 or id >= WP26.entityCount180('secretary') or seen[id] then
      return
    end
    local ctx = WP26.context('secretary', id)
    local name = WP26.entityName('secretary', id, ctx)
    if name ~= '' and not name:find('[%z\1-\31]') then
      rows[#rows + 1] = { id = id, name = name }
      seen[id] = true
    end
  end
  include(readSmallInteger(WP26.data('player') + 0x20))
  for role = 0, 4 do
    include(WP26.secretaryId180(role))
  end
  return rows
end
function WP26.encodeName(value)
  local reverse = {}
  for id, name in pairs(WP26.NAME_BYTES) do
    if not reverse[name] or id < reverse[name] then
      reverse[name] = id
    end
  end
  local bytes = {}
  local normalized = {}
  for _, code in utf8.codes(value) do
    if code >= 0x3041 and code <= 0x3096 then
      code = code + 0x60
    end
    local character = utf8.char(code)
    local id = reverse[character]
    if not id then
      error(WP26.T('Unsupported reading character.', '読みで使用できない文字です。'), 0)
    end
    bytes[#bytes + 1] = string.char(id)
    normalized[#normalized + 1] = character
  end
  return table.concat(bytes), table.concat(normalized)
end
for _, f in ipairs(WP26.EDITORS.secretary.fields) do
  if f.off == 42 or f.off == 51 then
    f.encodedName = true
  end
end

table.insert(WP26.EDITORS.farm.fields, 3, {
  en = 'Basic facilities level',
  ja = '基本施設：レベル',
  off = 0x2c,
  bit = 14,
  bits = 3,
  max = 2,
  playerFarmOnly = true,
  source = 'EXE39DD7C0[0] -> WMM2889; metadata39D5E60[0]+2=2;108E10/108F60',
})
WP26.SPEC.personMaster =
  { pattern = '48 8B 0D FA EF DE 03 48 03 C8 48 8B C1 48', disp = 3, len = 7, direct = false, target_rva = 67380904 }
WP26.SPEC.foal = {
  pattern = '48 8B 05 B2 83 F5 03 0F B7 44 01 0C B9 FF 7F 00 00 66 23 C1 C3',
  disp = 3,
  len = 7,
  direct = false,
  target_rva = 67282352,
}

-- The first facility has four effective levels; metadata byte 2 is not its level cap.
for _, f in ipairs(WP26.EDITORS.farm.fields) do
  if f.en == 'Basic facilities level' then
    f.max = 4
    f.source = '106640 writes levels1..4;108F60 accepts0..4;106520 derives area'
    f.optionsJa = { '自動', '1', '2', '3', '4' }
    f.optionsEn = { 'Automatic', '1', '2', '3', '4' }
  end
  if f.en == 'Friendship' then
    f.en = 'Location'
    f.ja = '所在地'
    f.source = '106420/106490 ->189AD0 ->39DD6A0'
    f.optionsJa = {
      '伊達',
      '白老',
      '安平',
      '鵡川',
      '日高',
      '新冠',
      '静内',
      '三石',
      '浦河',
      '襟裳',
      '大樹',
      '厚真',
      '平取',
      '様似',
      '青森',
      '福島',
      '茨城',
      '栃木',
      '九州',
      '米国',
      '英国',
      '愛国',
      '仏国',
      '豪州',
    }
    f.optionsEn = {
      'Date',
      'Shiraoi',
      'Abira',
      'Mukawa',
      'Hidaka',
      'Niikappu',
      'Shizunai',
      'Mitsuishi',
      'Urakawa',
      'Erimo',
      'Taiki',
      'Atsuma',
      'Biratori',
      'Samani',
      'Aomori',
      'Fukushima',
      'Ibaraki',
      'Tochigi',
      'Kyushu',
      'USA',
      'UK',
      'Ireland',
      'France',
      'Australia',
    }
  end
end

table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Farm name',
  ['ja'] = '牧場名',
  ['off'] = 16,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 12,
  ['string'] = true,
  ['source'] = '105640/105690; name buffer10h..1Ch',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Farm name reading',
  ['ja'] = '牧場名（読み）',
  ['off'] = 29,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 12,
  ['string'] = true,
  ['encodedName'] = true,
  ['source'] = '105BB0/105D30; reading1Dh..29h',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Area',
  ['ja'] = '面積',
  ['off'] = 44,
  ['bit'] = 14,
  ['bits'] = 3,
  ['max'] = 3,
  ['displayAdd'] = -1,
  ['playerFarmOnly'] = true,
  ['area'] = true,
  ['optionsJa'] = { '小', '普通', '大', '特大' },
  ['optionsEn'] = { 'Small', 'Normal', 'Large', 'Extra large' },
  ['source'] = '106520/106640;189B00->39DD760',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Friendship',
  ['ja'] = '友好度',
  ['off'] = 3,
  ['bit'] = 0,
  ['bits'] = 7,
  ['max'] = 100,
  ['source'] = '106210/106270; UI7214D6..721547',
})

local originalContext029 = WP26.context
function WP26.context(key, id)
  if key == 'farmStaff' then
    local ctx = WP26.context('staff', id)
    if not WP26.isFarmStaff(ctx) then
      error('Farm staff changed', 0)
    end
    return ctx
  elseif key == 'acquaintance' and id >= 1000 then
    return WP26.context('staff', id - 1000)
  elseif key == 'foal' or key == 'ownedFoal' then
    WP26.require()
    if not id or id % 1 ~= 0 or id < 0 or id >= 6260 then
      error('Foal unavailable', 0)
    end
    local p = WP26.data('foal') + id * 0x34
    local h = WP26.bits(p, 12, 0, 15)
    if h >= 0x702d then
      error('Foal base data unavailable', 0)
    end
    if key == 'ownedFoal' and WP26.bits(p, 20, 2, 13) ~= 46 then
      error('Foal ownership changed', 0)
    end
    return { key = key, id = id, primary = p, foal = p, foalID = id, horseID = h, horse = WP26.data('horse') + h * 0x38 }
  end
  local ctx = originalContext029(key, id)
  if key == 'staff' and not ctx.staffDynamic then
    local person = WP26.bits(ctx.primary, 12, 8, 14)
    if person < 10000 then
      ctx.staffProfile = WP26.data('personMaster') + person * 0x8c
      ctx.staffPersonID = person
    end
  end
  return ctx
end
function WP26.isFarmStaff(ctx)
  if ctx.staffDynamic then
    return false
  end
  local person = WP26.bits(ctx.primary, 12, 8, 14)
  if person >= 10000 then
    return false
  end
  local p = WP26.data('personMaster') + person * 0x8c
  local role = WP26.bits(p, 0x48, 2, 6)
  if role == 14 then
    return true
  end
  if role ~= 15 then
    return false
  end
  -- 168C10: a nominal manager without any assigned farm is displayed as staff.
  local root = WP26.data('farm')
  for id = 0, 36 do
    if readBytes(root + id * 0xcc + 7, 1) == ctx.id then
      return false
    end
  end
  return true
end
local originalAvailable029 = WP26.fieldAvailable
function WP26.fieldAvailable(ctx, f)
  if f.contactSource and ctx.key ~= f.contactSource then
    return false
  end
  if f.staffProfileOnly and not ctx.staffProfile then
    return false
  end
  return originalAvailable029(ctx, f)
end
local originalRead029 = WP26.fieldRead
function WP26.fieldRead(ctx, f)
  if f.area then
    local level = WP26.bits(ctx.primary, 44, 14, 3)
    if level == 0 then
      level = math.min(WP26.bits(ctx.primary, 8, 0, 3) + 1, 4)
    end
    return math.min(math.max(level - 1, 0), 3)
  end
  return originalRead029(ctx, f)
end

table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Family name',
  ['ja'] = '姓',
  ['off'] = 12,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['string'] = true,
  ['base'] = 'staffProfile',
  ['staffProfileOnly'] = true,
  ['source'] = '167FA0/167FE0 ->253680',
})
table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Given name',
  ['ja'] = '名',
  ['off'] = 29,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['string'] = true,
  ['base'] = 'staffProfile',
  ['staffProfileOnly'] = true,
  ['source'] = '168030/168070',
})
table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Family name reading',
  ['ja'] = '姓（読み）',
  ['off'] = 46,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 8,
  ['string'] = true,
  ['encodedName'] = true,
  ['base'] = 'staffProfile',
  ['staffProfileOnly'] = true,
  ['source'] = '168220/1682A0',
})
table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Given name reading',
  ['ja'] = '名（読み）',
  ['off'] = 55,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 8,
  ['string'] = true,
  ['encodedName'] = true,
  ['base'] = 'staffProfile',
  ['staffProfileOnly'] = true,
  ['source'] = '168260/168320',
})
table.insert(WP26.EDITORS.staff.fields, {
  ['en'] = 'Sex',
  ['ja'] = '性別',
  ['off'] = 72,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'staffProfile',
  ['staffProfileOnly'] = true,
  ['optionsJa'] = { '男性', '女性' },
  ['optionsEn'] = { 'Male', 'Female' },
  ['source'] = '1683A0/168400',
})

WP26.EDITORS.farmStaff = {
  record = 480,
  en = 'Farm staff editor',
  ja = '牧場スタッフエディタ',
  data = 'staff',
  stride = 0x60,
  max = 147,
  fields = WP26.EDITORS.staff.fields,
}
WP26.NAMES[465] = { 'Farm', '牧場' }
WP26.NAMES[480] = { 'Farm staff editor', '牧場スタッフエディタ' }
local oldContactCount = #WP26.EDITORS.acquaintance.fields
for _, f in ipairs(WP26.EDITORS.acquaintance.fields) do
  f.contactSource = 'acquaintance'
end
for _, f in ipairs(WP26.EDITORS.staff.fields) do
  local c = {}
  for k, v in pairs(f) do
    c[k] = v
  end
  c.contactSource = 'staff'
  table.insert(WP26.EDITORS.acquaintance.fields, c)
end
WP26.EDITORS.acquaintance.max = 1147
for _, key in ipairs({ 'ownedFoal', 'foal' }) do
  local d = {
    record = key == 'ownedFoal' and 320 or 340,
    en = key == 'ownedFoal' and 'Owned foal editor' or 'Foal editor',
    ja = key == 'ownedFoal' and '所有幼駒エディタ' or '幼駒エディタ',
    data = 'foal',
    stride = 52,
    max = 6259,
    fields = {},
  }
  for _, f in ipairs(WP26.EDITORS.race.fields) do
    if f.base == 'horse' then
      d.fields[#d.fields + 1] = f
    end
  end
  WP26.EDITORS[key] = d
  WP26.NAMES[d.record] = { d.en, d.ja }
end
local originalName029 = WP26.entityName
function WP26.entityName(key, id, ctx)
  if key == 'foal' or key == 'ownedFoal' then
    return WP26.horseNamePart(readSmallInteger(ctx.primary + 28))
      .. WP26.horseNamePart(readSmallInteger(ctx.primary + 30))
  end
  if key == 'farmStaff' or (key == 'acquaintance' and ctx.key == 'staff') then
    key = 'staff'
  end
  if key == 'staff' and ctx.staffProfile then
    return WP26.nameText(ctx.staffProfile + 12, 16) .. WP26.nameText(ctx.staffProfile + 29, 16)
  end
  if key == 'farm' then
    return WP26.nameText(ctx.primary + 16, 12)
  end
  return originalName029(key, id, ctx)
end
local originalRows029 = WP26.editorRows
function WP26.editorRows(key)
  if key ~= 'staff' and key ~= 'farmStaff' and key ~= 'acquaintance' and key ~= 'foal' and key ~= 'ownedFoal' then
    return originalRows029(key)
  end
  WP26.require()
  local rows = {}
  local function add(id, ctx)
    local name = WP26.entityName(key, id, ctx)
    if name ~= '' and not name:find('[%z\1-\31]') then
      rows[#rows + 1] = { id = id, name = name }
    end
  end
  if key == 'staff' or key == 'farmStaff' or key == 'acquaintance' then
    if key == 'acquaintance' then
      local root = WP26.data(key)
      for id = 0, WP26.entityCount180('acquaintance') - 1 do
        add(id, { key = key, id = id, primary = root + id * 68 })
      end
    end
    local root = WP26.data('staff')
    local dynamic = WP26.data('staffDynamic')
    local people = WP26.data('personMaster')
    local farms = WP26.data('farm')
    local managers = {}
    for id = 0, 36 do
      managers[readBytes(farms + id * 204 + 7, 1)] = true
    end
    for id = 0, WP26.entityCount180('staff') - 1 do
      local ctx = { key = 'staff', id = id, primary = root + id * 96 }
      if id >= 116 then
        ctx.primary = dynamic + (id - 116) * 60
        ctx.staffDynamic = true
      else
        local person = WP26.bits(ctx.primary, 12, 8, 14)
        if person < 10000 then
          ctx.staffProfile = people + person * 140
          ctx.staffPersonID = person
        end
      end
      local valid = ctx.staffDynamic or id < 16 or ctx.staffProfile ~= nil
      local role = ctx.staffProfile and WP26.bits(ctx.staffProfile, 72, 2, 6) or nil
      local staff = role == 14 or (role == 15 and not managers[id])
      if valid and (key == 'acquaintance' or (key == 'farmStaff') == staff) then
        add(key == 'acquaintance' and 1000 + id or id, ctx)
      end
    end
  else
    local root = WP26.data('foal')
    local horse = WP26.data('horse')
    local limit = readSmallInteger(WP26.mod() + 0x4042650)
    local names = WP26.namePointer(0x4042668)
    local shorts = WP26.namePointer(0x4042678)
    local cache = {}
    local function namePart(id)
      if cache[id] then
        return cache[id]
      end
      local value = ''
      if id >= 0x9470 and id < 0x9470 + 0x658f then
        value = WP26.decodeName(shorts + (id - 0x9470) * 9, 9)
      elseif id < limit then
        value = WP26.decodeName(names + id * 68)
      end
      cache[id] = value
      return value
    end
    for id = 0, 6259 do
      local p = root + id * 52
      local h = WP26.bits(p, 12, 0, 15)
      if h < 0x702d and (key == 'foal' or WP26.bits(p, 20, 2, 13) == 46) then
        local name = namePart(readSmallInteger(p + 28)) .. namePart(readSmallInteger(p + 30))
        if name ~= '' then
          rows[#rows + 1] = { id = id, name = name }
        end
      end
    end
  end
  table.sort(rows, function(a, b)
    if a.name == b.name then
      return a.id < b.id
    end
    return a.name < b.name
  end)
  return rows
end

-- Player farm friendship is the manager's friendship; NPC/club farms keep their own.
local farmContext030 = WP26.context
function WP26.context(key, id)
  if key == 'acquaintance' and id >= 820 and id < 1000 then
    error('Contact unavailable', 0)
  end
  local ctx = farmContext030(key, id)
  if key == 'farm' then
    ctx.farmFriendship = ctx.primary + 3
    if id == 32 or id == 34 or id == 35 then
      local manager = readBytes(ctx.primary + 7, 1)
      if manager and manager < 116 then
        ctx.farmFriendship = WP26.data('staff') + manager * 96 + 8
      else
        ctx.farmFriendship = nil
      end
    end
  end
  return ctx
end
for _, f in ipairs(WP26.EDITORS.farm.fields) do
  if f.en == 'Friendship' then
    f.base = 'farmFriendship'
    f.off = 0
    f.farmFriendship = true
    f.source = '7214F9..721547 routes player farms to10E9E0, other farms106210'
  end
end
local farmAvailable030 = WP26.fieldAvailable
function WP26.fieldAvailable(ctx, f)
  if f.farmFriendship and not ctx.farmFriendship then
    return false
  end
  return farmAvailable030(ctx, f)
end
-- Area zero is a derived fallback; retain its exact stored representation for undo.
local farmWrite030 = WP26.writeField
function WP26.writeField(ctx, f, v, journal)
  if not f.area then
    return farmWrite030(ctx, f, v, journal)
  end
  local before = WP26.bits(ctx.primary, 44, 14, 3)
  local count = #WP26.history
  farmWrite030(ctx, f, v, journal)
  if journal ~= false and #WP26.history > count then
    local h = WP26.history[#WP26.history]
    h.areaBefore = before
    h.areaAfter = WP26.bits(ctx.primary, 44, 14, 3)
  end
end
local farmUndo030 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.areaBefore == nil then
    return farmUndo030()
  end
  WP26.require()
  if WP26.pid ~= h.pid then
    error('Process changed', 0)
  end
  local ctx = WP26.context(h.ctx.key, h.ctx.id)
  if ctx.primary ~= h.ctx.primary or WP26.bits(ctx.primary, 44, 14, 3) ~= h.areaAfter then
    error('Area changed', 0)
  end
  local a = ctx.primary + 44
  local raw = readInteger(a)
  local expected = (raw & ~0x1c000) | (h.areaBefore << 14)
  if not writeInteger(a, expected) or WP26.bits(ctx.primary, 44, 14, 3) ~= h.areaBefore then
    error('Area restore failed', 0)
  end
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.farmFacilityStaffSet =
  { pattern = '40 53 56 57 48 83 EC 20 0F B7 D9 41 0F B7 F8 B9 EB 00 00 00 48 63 F2 8D 43 DB 66 3B C1 0F 86 C4' }
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 牧草',
  ['ja'] = '牧草：担当者',
  ['off'] = 48,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 1,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ウォーキングマシン（1基目）',
  ['ja'] = 'ウォーキングマシン（1基目）：担当者',
  ['off'] = 56,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 3,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ウォーキングマシン（2基目）',
  ['ja'] = 'ウォーキングマシン（2基目）：担当者',
  ['off'] = 60,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 4,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 集団馬房（1基目）',
  ['ja'] = '集団馬房（1基目）：担当者',
  ['off'] = 64,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 5,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 集団馬房（2基目）',
  ['ja'] = '集団馬房（2基目）：担当者',
  ['off'] = 68,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 6,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ロンギ場（1基目）',
  ['ja'] = 'ロンギ場（1基目）：担当者',
  ['off'] = 76,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 8,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ロンギ場（2基目）',
  ['ja'] = 'ロンギ場（2基目）：担当者',
  ['off'] = 80,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 9,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 観光施設（1基目）',
  ['ja'] = '観光施設（1基目）：担当者',
  ['off'] = 84,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 10,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 観光施設（2基目）',
  ['ja'] = '観光施設（2基目）：担当者',
  ['off'] = 88,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 11,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 獣医施設（1基目）',
  ['ja'] = '獣医施設（1基目）：担当者',
  ['off'] = 92,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 12,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 獣医施設（2基目）',
  ['ja'] = '獣医施設（2基目）：担当者',
  ['off'] = 96,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 13,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 温泉施設（1基目）',
  ['ja'] = '温泉施設（1基目）：担当者',
  ['off'] = 100,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 14,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 温泉施設（2基目）',
  ['ja'] = '温泉施設（2基目）：担当者',
  ['off'] = 104,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 15,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 花壇（1基目）',
  ['ja'] = '花壇（1基目）：担当者',
  ['off'] = 108,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 16,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 花壇（2基目）',
  ['ja'] = '花壇（2基目）：担当者',
  ['off'] = 112,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 17,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 功労馬繋養施設',
  ['ja'] = '功労馬繋養施設：担当者',
  ['off'] = 120,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 19,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 研究棟',
  ['ja'] = '研究棟：担当者',
  ['off'] = 128,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 21,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ミスト',
  ['ja'] = 'ミスト：担当者',
  ['off'] = 132,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 22,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: トレッドミル',
  ['ja'] = 'トレッドミル：担当者',
  ['off'] = 136,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 23,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: キッズハウス',
  ['ja'] = 'キッズハウス：担当者',
  ['off'] = 140,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 24,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 低酸素トレッドミル',
  ['ja'] = '低酸素トレッドミル：担当者',
  ['off'] = 152,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 27,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 競走馬メンタルラボ',
  ['ja'] = '競走馬メンタルラボ：担当者',
  ['off'] = 156,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 28,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 国際厩舎',
  ['ja'] = '国際厩舎：担当者',
  ['off'] = 160,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 29,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 装蹄所',
  ['ja'] = '装蹄所：担当者',
  ['off'] = 164,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 30,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 飼葉スチーマー',
  ['ja'] = '飼葉スチーマー：担当者',
  ['off'] = 168,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 31,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 坂路コース',
  ['ja'] = '坂路コース：担当者',
  ['off'] = 172,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 32,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: トラックコース',
  ['ja'] = 'トラックコース：担当者',
  ['off'] = 176,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 33,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 角馬場',
  ['ja'] = '角馬場：担当者',
  ['off'] = 180,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 34,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: ゲート',
  ['ja'] = 'ゲート：担当者',
  ['off'] = 184,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 35,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 逍遥馬道',
  ['ja'] = '逍遥馬道：担当者',
  ['off'] = 188,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 36,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 大型坂路コース',
  ['ja'] = '大型坂路コース：担当者',
  ['off'] = 192,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 37,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})
table.insert(WP26.EDITORS.farm.fields, {
  ['en'] = 'Facility staff: 大型トラックコース',
  ['ja'] = '大型トラックコース：担当者',
  ['off'] = 196,
  ['bit'] = 6,
  ['bits'] = 8,
  ['max'] = 148,
  ['playerFarmOnly'] = true,
  ['facilityStaff'] = 38,
  ['relation'] = 'farmPeople',
  ['groupJa'] = '施設担当者',
  ['groupEn'] = 'Facility staff',
  ['source'] = '10ABD0 eligibility;10AD60/10AC60;10B020 prevents duplicate assignment;10B170->10C1C0 name',
})

local farmRows031 = WP26.editorRows
function WP26.editorRows(key)
  if key ~= 'farmPeople' then
    return farmRows031(key)
  end
  local rows = { { id = 148, name = WP26.T('None', 'なし') } }
  for _, source in ipairs({ 'staff', 'farmStaff' }) do
    for _, r in ipairs(farmRows031(source)) do
      rows[#rows + 1] = r
    end
  end
  return rows
end
local farmAvailable031 = WP26.fieldAvailable
function WP26.fieldAvailable(ctx, f)
  if f.facilityStaff ~= nil and WP26.bits(ctx.primary, f.off, 14, 3) == 0 then
    return false
  end
  return farmAvailable031(ctx, f)
end
local function assignmentValue(root, farm, facility)
  return WP26.bits(root + farm * 204, 44 + facility * 4, 6, 8)
end
local function setAssignmentBits(root, farm, facility, value)
  local a = root + farm * 204 + 44 + facility * 4
  local raw = readInteger(a)
  if
    not raw
    or not writeInteger(a, (raw & ~0x3fc0) | (value << 6))
    or assignmentValue(root, farm, facility) ~= value
  then
    error('Facility staff restore failed', 0)
  end
end
local farmWrite031 = WP26.writeField
function WP26.writeField(ctx, f, v, journal)
  if f.facilityStaff == nil then
    return farmWrite031(ctx, f, v, journal)
  end
  WP26.require()
  if
    ctx.key ~= 'farm'
    or ctx.id < 32
    or ctx.id > 35
    or not WP26.fieldAvailable(ctx, f)
    or not v
    or v % 1 ~= 0
    or v < 0
    or v > 148
  then
    error('Invalid facility staff target', 0)
  end
  local allowed = v == 148
  if not allowed then
    for _, r in ipairs(WP26.editorRows('farmPeople')) do
      if r.id == v then
        allowed = true
        break
      end
    end
  end
  if not allowed then
    error('Staff profile unavailable', 0)
  end
  local root = WP26.data('farm')
  if root + ctx.id * 204 ~= ctx.primary then
    error('Farm changed', 0)
  end
  if assignmentValue(root, ctx.id, f.facilityStaff) == v then
    return
  end
  local before = {}
  for farm = 32, 35 do
    for facility = 0, 38 do
      before[#before + 1] = { farm = farm, facility = facility, value = assignmentValue(root, farm, facility) }
    end
  end
  local ok, err = pcall(function()
    WP26.native('farmFacilityStaffSet', ctx.id, f.facilityStaff, v)
    assert(assignmentValue(root, ctx.id, f.facilityStaff) == v, 'Facility assignment readback mismatch')
    if v ~= 148 then
      local n = 0
      for _, q in ipairs(before) do
        if assignmentValue(root, q.farm, q.facility) == v then
          n = n + 1
        end
      end
      assert(n == 1, 'Duplicate facility assignment')
    end
  end)
  local changes = {}
  for _, q in ipairs(before) do
    local after = assignmentValue(root, q.farm, q.facility)
    if after ~= q.value then
      changes[#changes + 1] = { farm = q.farm, facility = q.facility, before = q.value, after = after }
    end
  end
  if not ok then
    for _, q in ipairs(changes) do
      setAssignmentBits(root, q.farm, q.facility, q.before)
    end
    error(err, 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = { kind = 'farmStaffAssignment', pid = WP26.pid, root = root, changes = changes }
  end
end
local farmUndo031 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'farmStaffAssignment' then
    return farmUndo031()
  end
  WP26.require()
  local root = WP26.data('farm')
  if WP26.pid ~= h.pid or root ~= h.root then
    error('Farm data changed', 0)
  end
  for _, q in ipairs(h.changes) do
    if assignmentValue(root, q.farm, q.facility) ~= q.after then
      error('Facility staff changed; undo stopped', 0)
    end
  end
  for _, q in ipairs(h.changes) do
    setAssignmentBits(root, q.farm, q.facility, q.before)
  end
  WP26.history[#WP26.history] = nil
end

-- aptitudes034: labels 16AEE0/39DF2A8; ranks 16AF20/39DF2C0; UI62329E/6233C6.
local aptitudeNames034 = { { 'Study', '勉強' }, { 'Athletics', '運動' }, { 'Ranching', '牧場' } }
for slot, names in ipairs(aptitudeNames034) do
  local function field(off, bit, bits, source)
    return {
      en = names[1],
      ja = names[2],
      off = off,
      bit = bit,
      bits = bits,
      max = 6,
      optionsJa = { 'Ｅ', 'Ｄ', 'Ｃ', 'Ｂ', 'Ａ', 'Ｓ', 'SS' },
      optionsEn = { 'E', 'D', 'C', 'B', 'A', 'S', 'SS' },
      source = source,
    }
  end
  table.insert(
    WP26.EDITORS.secretary.fields,
    field(59 + slot, 0, 8, '12BE70/12BEF0;16D712->16AAC0; UI6233C6; labels16AEE0')
  )
  local contact = field(59 + slot, 0, 8, '129FF0/12A030; UI62341E; labels16AEE0')
  contact.contactSource = 'acquaintance'
  table.insert(WP26.EDITORS.acquaintance.fields, contact)
  for _, key in ipairs({ 'staff', 'acquaintance' }) do
    local f = field(80, (slot - 1) * 3, 3, '16AA30/16AAC0; profile253680; UI labels16AEE0')
    f.base = 'staffProfile'
    f.staffProfileOnly = true
    if key == 'acquaintance' then
      f.contactSource = 'staff'
    end
    table.insert(WP26.EDITORS[key].fields, f)
  end
end

WP26.RACE_PAYLOAD = {
  ['hex'] = '9c50515241504151415241535356ff05b8020000833dad020000010f8569020000488b05c80200004c8b15c90200004c39100f8552020000458b42504183f8020f82440200004183f8120f873a020000488b05a90200004c8b184d85db0f8427020000458b4b044183f9010f8c19020000488b0590020000488b304885f60f8406020000410fb68b080100004439c10f83ef01000041837c8b0c000f85e301000031c9418b448b0c4401c80f80d301000085c00f8ecb010000ffc14439c172e38b54243085d20f8eb8010000bbffffff7f31c94963448b544885c00f88a30100008b5424304801d0483d9bc420000f8790010000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dc9010000488b05e6010000488b3031db31c9488b05f00100008b10410fb7844a48ba000039d074313d851a0000732a4869c0e80000008b44062425ff1f000083f82e750881faffff0000740d418b448b0c4401c839d80f4fd8ffc14439c172b285db0f8e0b010000488b05620100008b1081fae80300000f82f600000089d8480fafc231d2b9e803000048f7f18b153a0100004839d0480f47c289c3891d6f01000031c9488b055e0100008b10410fb7844a48ba000081faffff0000740839d00f85940000003d851a00000f83890000004869c0e80000008b44062425ff1f000083f82e7574488b050c0100003a087469418b448b0c4401c83b05ce0000007f0639d87d55eb068b1dc0000000890dae0000008905ac00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d75000000ff055f0000008b1db1000000ffc14439c10f8239ffffffeb06ff054a0000005e5b415b415a415941585a59589d41554883ec40488b054b000000488b004531d2ff25670000006666666666662e0f1f840000000000454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  ['original'] = '41554883ec40488b05db2ad2034533d2',
  ['dataOffset'] = 712,
  ['size'] = 812,
}
function WP26.ensureRaceConfig()
  WP26.require()
  local pid = getOpenedProcessID()
  local c = WP26_RACE_CONFIG
  local valid = c and c.pid == pid and readQword(c.mem) == 0x3147464336325057
  if not valid then
    local mem = assert(allocateMemory(4096), 'Race configuration allocation failed')
    assert(
      writeQword(mem, 0x3147464336325057) and writeInteger(mem + 16, 1500),
      'Race configuration initialization failed'
    )
    c = { pid = pid, mem = mem, factor = mem + 16 }
    WP26_RACE_CONFIG = c
  end
  if not c.target then
    c.target = c.mem + 20
    assert(writeInteger(c.target, 65535), 'Race target initialization failed')
  end
  pcall(unregisterSymbol, 'wp2026RaceFactor')
  registerSymbol('wp2026RaceFactor', c.factor, true)
  pcall(unregisterSymbol, 'wp2026RaceTarget')
  registerSymbol('wp2026RaceTarget', c.target, true)
  return c.factor
end
WP26.NAMES[110] = { 'Race', 'レース' }
WP26.NAMES[111] = { 'Owned horses: dominate watched races', '所有馬を観戦で圧勝させる' }
WP26.NAMES[112] = { 'Running multiplier', '走行倍率' }
WP26.NAMES[113] = { 'Horse to boost', '勝たせたい馬' }
function WP26.refreshRaceTargets()
  (WP26.raceConfigOnly148 or WP26.ensureRaceConfig)()
  local choices = { WP26.T('65535:All owned horses', '65535:すべての所有馬') }
  for _, r in ipairs(WP26.editorRows('owned')) do
    local ctx = WP26.context('owned', r.id)
    choices[#choices + 1] = tostring(ctx.raceID) .. ':' .. r.name
  end
  local rec = getAddressList().getMemoryRecordByID(113)
  if rec then
    local text = table.concat(choices, '\n')
    if rec.DropDownList.Text:gsub('\r', ''):gsub('\n$', '') ~= text then rec.DropDownList.Text = text end
    rec.DropDownReadOnly = true
    rec.DropDownDescriptionOnly = true
    rec.DisplayAsDropDownListItem = true
  end
end
local function raceSame(a, b)
  if not a or #a ~= #b then
    return false
  end
  for i = 1, #b do
    if a[i] ~= b[i] then
      return false
    end
  end
  return true
end
local function raceBytes(s)
  local t = {}
  for i = 1, #s do
    t[i] = s:byte(i)
  end
  return t
end
local function raceHex(s)
  local t = {}
  for b in s:gmatch('%x%x') do
    t[#t + 1] = tonumber(b, 16)
  end
  return t
end
local function raceCall(st, n, ...)
  return executeCodeLocalEx(st.api[n], ...)
end
local function raceRead(st, a, n)
  assert(
    n <= 2048 and raceCall(st, 'ReadProcessMemory', st.handle, a, st.buffer.Memory, n, 0) ~= 0,
    'Race data read failed'
  )
  return readBytesLocal(st.buffer.Memory, n, true)
end
local function raceWrite(st, a, bytes, protect)
  assert(#bytes <= 2048)
  local p = st.buffer.Memory
  assert(writeBytesLocal(p, bytes) == #bytes)
  local old
  if protect then
    assert(raceCall(st, 'VirtualProtectEx', st.handle, a, #bytes, 0x40, p + 3072) ~= 0, 'Race code protection failed')
    old = readIntegerLocal(p + 3072)
  end
  local ok = raceCall(st, 'WriteProcessMemory', st.handle, a, p, #bytes, 0) ~= 0
  local restored = true
  if old then
    restored = raceCall(st, 'VirtualProtectEx', st.handle, a, #bytes, old, p + 3072) ~= 0
  end
  assert(ok and restored and raceSame(raceRead(st, a, #bytes), bytes), 'Race write verification failed')
  if protect then
    assert(raceCall(st, 'FlushInstructionCache', st.handle, a, #bytes) ~= 0, 'Race code flush failed')
  end
end
local function raceAlive(st)
  return st
    and st.handle
    and raceCall(st, 'GetExitCodeProcess', st.handle, st.buffer.Memory + 3080) ~= 0
    and readIntegerLocal(st.buffer.Memory + 3080) == 259
end
local function racePatch(st, enable)
  local sites = { { site = st.site, original = st.original, patch = st.patch } }
  for _, v in ipairs(st.rollSites or {}) do
    sites[#sites + 1] = v
  end
  local currents = {}
  for i, v in ipairs(sites) do
    local current = raceRead(st, v.site, #v.original)
    currents[i] = current
    assert(
      raceSame(current, v.original) or ((not enable or st.active) and raceSame(current, v.patch)),
      'Race hook belongs to another table'
    )
  end
  assert((executeCodeLocal(st.api.NtSuspendProcess, st.handle) & 0xffffffff) == 0, 'Race process suspension failed')
  local changed = false
  local ok, err = pcall(function()
    for i, v in ipairs(sites) do
      assert(raceSame(raceRead(st, v.site, #currents[i]), currents[i]), 'Race code changed before patch')
    end
    for _, pointer in ipairs(st.repairPointers156 or {}) do raceWrite(st, pointer.address, raceBytes(string.pack('<I8', pointer.value))) end
    raceWrite(st, st.data, { 0, 0, 0, 0 })
    changed = true
    for _, v in ipairs(sites) do
      raceWrite(st, v.site, enable and v.patch or v.original, true)
    end
    if enable then
      raceWrite(st, st.data, { 1, 0, 0, 0 })
    end
  end)
  if not ok and changed then
    st.active = true
    pcall(function()
      raceWrite(st, st.data, { 0, 0, 0, 0 })
    end)
    for _, v in ipairs(sites) do
      pcall(function()
        raceWrite(st, v.site, v.original, true)
      end)
    end
  end
  local resumed = executeCodeLocal(st.api.NtResumeProcess, st.handle) & 0xffffffff
  assert(resumed == 0, 'Race process resume failed')
  if not ok then
    error(err, 0)
  end
  st.active = enable
end
local function racePrepareRoll057(st)
  local specs = WP26.START_ROLL057
  if not st.rollSites then
    for _, name in ipairs({ 'late', 'good' }) do
      local d = specs[name]
      assert(
        raceSame(raceRead(st, st.base + d.site, 18), raceHex(d.original)),
        'Start judgment code does not match local EXE'
      )
    end
    local spirit = WP26.RACE_SPIRIT064
    assert(
      raceSame(raceRead(st, st.base + spirit.site, 15), raceHex(spirit.original)),
      'Race spirit code does not match local EXE'
    )
    local pace = WP26.PACE_GUARD066
    assert(
      raceSame(raceRead(st, st.base + pace.site, 20), raceHex(pace.original)),
      'Race pace code does not match local EXE'
    )
    st.rollSites = {}
    for index, name in ipairs({ 'late', 'good' }) do
      local d = specs[name]
      local cave = st.mem + 2048 + (index - 1) * 512
      local site = st.base + d.site
      local patch =
        raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.rep(string.char(0x90), 4))
      raceWrite(st, cave, raceHex(d.hex))
      st.rollSites[#st.rollSites + 1] = {
        site = site,
        original = raceHex(d.original),
        patch = patch,
        cave = cave,
        data = cave + d.dataOffset,
        size = d.size,
        resume = st.base + d.resume,
        skip = st.base + d.skip,
        flag = st.base + d.flag,
      }
    end
    local d = WP26.RACE_SPIRIT064
    local cave = st.mem + 3072
    local patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.char(0x90))
    raceWrite(st, cave, raceHex(d.hex))
    st.rollSites[#st.rollSites + 1] = {
      kind = 'spirit',
      site = st.base + d.site,
      original = raceHex(d.original),
      patch = patch,
      cave = cave,
      data = cave + d.dataOffset,
      size = d.size,
      resume = st.base + d.resume,
      setter = st.base + d.setter,
    }
    local d = WP26.PACE_GUARD066
    local cave = st.mem + 3584
    local patch =
      raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.rep(string.char(0x90), 6))
    raceWrite(st, cave, raceHex(d.hex))
    st.rollSites[#st.rollSites + 1] = {
      kind = 'pace',
      site = st.base + d.site,
      original = raceHex(d.original),
      patch = patch,
      cave = cave,
      data = cave + d.dataOffset,
      size = d.size,
      resume = st.base + d.resume,
      skip = st.base + d.skip,
    }
    if not WP26.RACE_NO_CLOCK135 then
    local d = WP26.RACE_CLOCK111
    local cave = st.mem + 4096
    local patch =
      raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.rep(string.char(0x90), 4))
    raceWrite(st, cave, raceHex(d.hex))
    st.rollSites[#st.rollSites + 1] = {
      kind = 'clock',
      site = st.base + d.site,
      original = raceHex(d.original),
      patch = patch,
      cave = cave,
      data = cave + d.dataOffset,
      size = d.size,
      resume = st.base + d.resume,
    }
    end
    local d = WP26.RACE_FLOOR114
    local cave = st.mem + 6144
    local patch =
      raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.rep(string.char(0x90), #d.original // 2 - 14))
    raceWrite(st, cave, raceHex(d.hex))
    st.rollSites[#st.rollSites + 1] = {
      kind = 'floor',
      site = st.base + d.site,
      original = raceHex(d.original),
      patch = patch,
      cave = cave,
      data = cave + d.dataOffset,
      size = d.size,
      resume = st.base + d.resume,
      skip = st.base + d.skip,
    }
    if WP26.RACE_RENDER_CAP130 then
      local d = WP26.RACE_RENDER_CAP130
      local cave = st.mem + 7168
      local patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.char(0x90))
      raceWrite(st, cave, raceHex(d.hex))
      st.rollSites[#st.rollSites + 1] = {
        kind = 'renderCap', site = st.base + d.site, original = raceHex(d.original), patch = patch,
        cave = cave, data = cave + d.dataOffset, size = d.size, resume = st.base + d.resume,
      }
    end
  end
  for _, v in ipairs(st.rollSites) do
    local pointers
    if v.kind == 'renderCap' then
      pointers = { st.data, WP26_RACE_CONFIG.target, st.base + 0x47E8E98, st.base + 0x4856670,
        st.base + 0x402A618, st.base + 0x480BA50, v.resume }
    elseif v.kind == 'floor' then
      pointers = {
        st.data,
        WP26_RACE_CONFIG.target,
        st.base + 0x47E8E98,
        st.base + 0x4856670,
        st.base + 0x402A618,
        st.base + 0x480A7F0,
        v.skip,
        v.resume,
        st.base + 0x47E8D9C,
      }
    elseif v.kind == 'clock' then
      pointers = {
        st.data,
        WP26_RACE_CONFIG.target,
        st.base + 0x47E8E98,
        st.base + 0x4856670,
        st.base + 0x402A618,
        st.base + 0x480D390,
        st.base + 0x47E8E48,
        v.resume,
        st.base + 0x47E8D9C,
      }
    elseif v.kind == 'pace' then
      pointers = {
        st.data,
        WP26_RACE_CONFIG.target,
        st.base + 0x47E8E98,
        st.base + 0x4856670,
        st.base + 0x47F8238,
        st.base + 0x402A618,
        v.skip,
        v.resume,
        st.base + 0x47E8E48,
      }
    elseif v.kind == 'spirit' then
      pointers = { st.data, WP26_RACE_CONFIG.target, st.base + 0x402A618, v.setter, v.resume }
    else
      pointers = {
        st.data,
        WP26_RACE_CONFIG.target,
        st.base + 0x47E8E98,
        st.base + 0x4856670,
        st.base + 0x402A618,
        st.base + 0x47E8D9B,
        v.resume,
        v.skip,
        v.flag,
      }
    end
    for i, x in ipairs(pointers) do
      raceWrite(st, v.data + 8 + (i - 1) * 8, raceBytes(string.pack('<I8', x)))
    end
    assert(raceCall(st, 'FlushInstructionCache', st.handle, v.cave, v.size) ~= 0, 'Start payload flush failed')
  end
end

function WP26.stopRaceBoost()
  local st = WP26.raceState or WP26_RACE_CACHE
  if not st or not st.active then
    return true
  end
  if raceAlive(st) then
    racePatch(st, false)
  else
    st.active = false
  end
  return true
end
function WP26.startRaceBoost()
  WP26.require()
  assert(WP26.checkBuild(), 'Unsupported race build')
  local base = WP26.mod()
  local site = base + 0xAC63B0
  local spec = WP26.RACE_PAYLOAD
  local st = WP26_RACE_CACHE
  if
    st
    and (st.pid ~= WP26.pid or st.base ~= base or st.identity ~= (WP26.racePayloadIdentity066()) or not raceAlive(st))
  then
    if st.active and raceAlive(st) then
      racePatch(st, false)
    end
    if st.handle then
      raceCall(st, 'CloseHandle', st.handle)
      st.handle = nil
    end
    if st.buffer then
      st.buffer.destroy()
      st.buffer = nil
    end
    st = nil
    WP26_RACE_CACHE = nil
  end
  if not st then
    st =
      { pid = WP26.pid, base = base, site = site, identity = WP26.racePayloadIdentity066(), api = {}, active = false }
    for _, n in ipairs({
      'OpenProcess',
      'CloseHandle',
      'VirtualAllocEx',
      'ReadProcessMemory',
      'WriteProcessMemory',
      'VirtualProtectEx',
      'FlushInstructionCache',
      'GetExitCodeProcess',
    }) do
      st.api[n] = assert(getAddressSafe('kernel32.' .. n, true), 'Local API unavailable: ' .. n)
    end
    for _, n in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
      st.api[n] = assert(getAddressSafe('ntdll.' .. n, true), 'Local API unavailable: ' .. n)
    end
    st.handle = raceCall(st, 'OpenProcess', 0xC38, 0, st.pid)
    assert(st.handle and st.handle ~= 0, 'Race process handle unavailable')
    st.buffer = createMemoryStream()
    st.buffer.Size = 4096
    local constructed, constructionError = pcall(function()
      st.original = raceHex(spec.original)
      if not raceSame(raceRead(st, site, 16), st.original) then
        WP26.restoreKnownRace085()
      end
      if not raceSame(raceRead(st, site, 16), st.original) then
        error(
          WP26.T(
            'Unknown race code; installation stopped.',
            '未対応のレース処理を検出したため、取り付けを停止しました。'
          ),
          0
        )
      end
      st.mem = raceCall(st, 'VirtualAllocEx', st.handle, 0, 8192, 0x3000, 0x40)
      assert(st.mem and st.mem ~= 0, 'Race memory allocation failed')
      st.data = st.mem + spec.dataOffset
      st.patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', st.mem) .. string.char(0x90, 0x90))
      raceWrite(st, st.mem, raceHex(spec.hex))
      assert(raceCall(st, 'FlushInstructionCache', st.handle, st.mem, spec.size) ~= 0)
    end)
    if not constructed then
      raceCall(st, 'CloseHandle', st.handle)
      st.handle = nil
      st.buffer.destroy()
      st.buffer = nil
      error(constructionError, 0)
    end
    WP26_RACE_CACHE = st
  end
  WP26.raceState = st
  assert(
    raceSame(raceRead(st, st.mem, spec.dataOffset), raceHex(spec.hex:sub(1, spec.dataOffset * 2))),
    'Race payload changed'
  )
  WP26.refreshRaceTargets()
  local pointers = {
    WP26.ensureRaceConfig(),
    base + 0x47E8E98,
    base + 0x4856670,
    base + 0x47F8238,
    base + 0x402A618,
    base + 0x47E8D9B,
    base + 0xAC63C0,
    WP26_RACE_CONFIG.target,
  }
  for i, v in ipairs(pointers) do
    raceWrite(st, st.data + 32 + (i - 1) * 8, raceBytes(string.pack('<I8', v)))
  end
  racePrepareRoll057(st)
  if not st.active then
    racePatch(st, true)
  end
  return true
end
function WP26.enableRaceBoost(record)
  WP26.cancelRecordDeactivate(record.ID)
  local ok, e = pcall(WP26.startRaceBoost)
  if not ok then
    pcall(WP26.stopRaceBoost)
    WP26.msg('Stopped: ' .. tostring(e), '中止: ' .. tostring(e))
    WP26.deferRecordDeactivate(record, 150)
  end
end
function WP26.disableRaceBoost()
  local ok, e = pcall(WP26.stopRaceBoost)
  if not ok then
    WP26.msg('Race restore failed: ' .. tostring(e), 'レース処理の復元失敗: ' .. tostring(e))
  end
  return ok
end
local raceAllOff038 = WP26.disableAll
function WP26.disableAll(self)
  if not WP26.disableRaceBoost() then
    return false
  end
  local result = raceAllOff038(self)
  if WP26.attached() then
    WP26.refreshRaceTargets()
  end
  return result
end
local raceTick038 = WP26.tick
function WP26.tick()
  if
    WP26.raceState
    and WP26.raceState.active
    and (getOpenedProcessID() ~= WP26.raceState.pid or not WP26.attached())
  then
    if not WP26.disableRaceBoost() then
      if WP26.timer then
        WP26.timer.Enabled = false
      end
      return
    end
  end
  return raceTick038()
end

local function ownedFarm040(farm)
  return farm == 32 or farm == 34 or farm == 35
end
for _, q in ipairs({
  { 'ownedMare', 'mare', 360, 'Owned broodmare editor', '所有繁殖牝馬エディタ' },
  { 'ownedSire', 'sire', 355, 'Owned sire editor', '所有種牡馬エディタ' },
}) do
  local d = {}
  for k, v in pairs(WP26.EDITORS[q[2]]) do
    d[k] = v
  end
  d.record = q[3]
  d.en = q[4]
  d.ja = q[5]
  d.fields = {}
  for _, f in ipairs(WP26.EDITORS[q[2]].fields) do
    local c = {}
    for k, v in pairs(f) do
      c[k] = v
    end
    d.fields[#d.fields + 1] = c
  end
  WP26.EDITORS[q[1]] = d
  WP26.NAMES[q[3]] = { q[4], q[5] }
end
WP26.NAMES[310] = { 'Owned racehorse editor', '所有競走馬エディタ' }
WP26.EDITORS.owned.en = 'Owned racehorse editor'
WP26.EDITORS.owned.ja = '所有競走馬エディタ'
WP26.NAMES[485] = { 'Acquaintances', '知人' }
WP26.NAMES[495] = { 'Family tree', '家系図' }
local breedingContext040 = WP26.context
function WP26.context(key, id)
  local original = key == 'ownedMare' and 'mare' or key == 'ownedSire' and 'sire'
  if not original then
    return breedingContext040(key, id)
  end
  local ctx = breedingContext040(original, id)
  if not ownedFarm040(WP26.bits(ctx.horse, 16, 22, 9)) then
    error(WP26.T('Horse ownership changed.', '馬の所有状態が変わりました。'), 0)
  end
  ctx.key = key
  return ctx
end
local breedingRows040 = WP26.editorRows
function WP26.editorRows(key)
  local original = key == 'ownedMare' and 'mare' or key == 'ownedSire' and 'sire'
  if not original then
    return breedingRows040(key)
  end
  local all = breedingRows040(original)
  local d = WP26.EDITORS[original]
  local root = WP26.data(d.data)
  local horses = WP26.data('horse')
  local rows = {}
  for _, r in ipairs(all) do
    local p = original == 'sire' and assert(WP26.sirePointer181(r.id)) or root + r.id * d.stride
    local h = WP26.bits(p, 8, 0, 15)
    if h < 0x702d and ownedFarm040(WP26.bits(horses + h * 56, 16, 22, 9)) then
      rows[#rows + 1] = r
    end
  end
  return rows
end

local breedingName040 = WP26.entityName
function WP26.entityName(key, id, ctx)
  if key == 'ownedMare' then
    key = 'mare'
  elseif key == 'ownedSire' then
    key = 'sire'
  end
  return breedingName040(key, id, ctx)
end
pcall(WP26.initCollapse)
WP26.applyLang()

WP26.SPEC.weakThroatSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 67 5A E0 03',
}
WP26.SPEC.weakLegsSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 57 5B E0 03',
}
WP26.SPEC.weakBackSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 77 59 E0 03',
}
WP26.SPEC.ownedTrustSet = {
  pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 59 E6 18 00 85 C0 75 02 EB 42 0F B7 44 24 40 66 89 44 24 20 0F',
}
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Roaring',
  ['ja'] = '喉鳴り',
  ['off'] = 20,
  ['bit'] = 10,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakThroatSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDC04/C3A10/C3A80;resource10F040',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Leg fragility',
  ['ja'] = '脚部不安',
  ['off'] = 20,
  ['bit'] = 8,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakLegsSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDC8B/C3920/C3990;resource10F041',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Weak back',
  ['ja'] = '腰の甘さ',
  ['off'] = 20,
  ['bit'] = 12,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakBackSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDD9C/C3B00/C3B70;resource10F042',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Roaring',
  ['ja'] = '喉鳴り',
  ['off'] = 20,
  ['bit'] = 10,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakThroatSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDC04/C3A10/C3A80;resource10F040',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Leg fragility',
  ['ja'] = '脚部不安',
  ['off'] = 20,
  ['bit'] = 8,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakLegsSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDC8B/C3920/C3990;resource10F041',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Weak back',
  ['ja'] = '腰の甘さ',
  ['off'] = 20,
  ['bit'] = 12,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakBackSet',
  ['groupJa'] = '弱点',
  ['groupEn'] = 'Weaknesses',
  ['choices'] = {
    { ['id'] = 0, ['en'] = 'None', ['ja'] = 'なし' },
    { ['id'] = 1, ['en'] = 'Improved', ['ja'] = '改善' },
    { ['id'] = 2, ['en'] = 'Present', ['ja'] = 'あり' },
  },
  ['source'] = 'UI2BDD9C/C3B00/C3B70;resource10F042',
})

local trustStep043 = 50 -- local EXE tuning 3A5A280; checked again on read/write
for _, f in ipairs({
  {
    en = 'Trust',
    ja = '信頼度',
    off = 0x1E2,
    bit = 0,
    bits = 16,
    max = 150,
    horseTrust = true,
    groupJa = '信頼',
    groupEn = 'Trust',
    source = 'UI712D80 table3A99F10 field64;713989/F2730/F9140;F8F90/F9000',
  },
  {
    en = 'Trust level',
    ja = '信頼Lv.',
    off = 0x1E2,
    bit = 0,
    bits = 16,
    max = 3,
    horseTrust = true,
    trustLevel = true,
    groupJa = '信頼',
    groupEn = 'Trust',
    choices = {
      { id = 0, en = 'Lv.0', ja = 'Lv.0' },
      { id = 1, en = 'Lv.1', ja = 'Lv.1' },
      { id = 2, en = 'Lv.2', ja = 'Lv.2' },
      { id = 3, en = 'Lv.3', ja = 'Lv.3' },
    },
    source = 'F9140 floor(trust/tuning3A5A280), clamp0..3',
  },
}) do
  table.insert(WP26.EDITORS.owned.fields, f)
end
local trustRead043 = WP26.fieldRead
function WP26.fieldRead(ctx, f)
  if f.trustLevel then
    local step = readInteger(WP26.mod() + 0x3A5A280)
    assert(step == trustStep043, 'Trust tuning changed')
    return math.min(3, math.max(0, math.floor(WP26.bits(ctx.primary, 0x1E2, 0, 16) / step)))
  end
  return trustRead043(ctx, f)
end
local trustWrite043 = WP26.writeField
function WP26.writeField(ctx, f, v, journal)
  if not f.horseTrust then
    return trustWrite043(ctx, f, v, journal)
  end
  WP26.require()
  assert(ctx.key == 'owned' and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid trust value')
  local fresh = WP26.context('owned', ctx.id)
  assert(fresh.primary == ctx.primary and fresh.raceID == ctx.raceID, 'Ownership changed')
  local step = readInteger(WP26.mod() + 0x3A5A280)
  assert(step == trustStep043, 'Trust tuning changed')
  local raw = f.trustLevel and v * step or v
  local old = WP26.bits(ctx.primary, 0x1E2, 0, 16)
  if raw == old then
    return
  end
  WP26.native('ownedTrustSet', ctx.id, raw)
  if WP26.bits(ctx.primary, 0x1E2, 0, 16) ~= raw then
    WP26.native('ownedTrustSet', ctx.id, old)
    error('Trust update verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = { kind = 'horseTrust', pid = WP26.pid, ctx = ctx, before = old, after = raw }
  end
end
local trustUndo043 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'horseTrust' then
    return trustUndo043()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Process changed')
  local c = WP26.context('owned', h.ctx.id)
  assert(c.primary == h.ctx.primary and c.raceID == h.ctx.raceID, 'Ownership changed')
  assert(WP26.bits(c.primary, 0x1E2, 0, 16) == h.after, 'Trust changed')
  WP26.native('ownedTrustSet', c.id, h.before)
  assert(WP26.bits(c.primary, 0x1E2, 0, 16) == h.before, 'Trust restoration failed')
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.horseRelationSet = {
  pattern = '48 89 54 24 10 89 4C 24 08 48 83 EC 38 8B 4C 24 40 E8 0A 0E 00 00 48 89 44 24 20 48 83 7C 24 20 00 74 16 48 8B 54 24 48',
}
WP26.RELATION_NAMES = {
  [0] = '知り合い',
  [1] = '仲が良い',
  [2] = '友達',
  [3] = '親友',
  [4] = '惹かれる',
  [5] = '恋慕',
  [6] = '恋仲',
  [7] = '恋愛',
  [8] = '苦手',
  [9] = '嫌い',
  [10] = '不仲',
  [11] = '犬猿',
  [12] = '敵',
  [13] = '難敵',
  [14] = '強敵',
  [15] = '好敵手',
  [16] = '僚馬',
  [17] = '盟友',
  [18] = '蜜月',
  [19] = '相思相愛',
  [20] = '幼馴染',
  [21] = '幼馴染',
  [22] = '不倶戴天',
  [23] = '調教相手',
  [24] = '威嚇',
  [25] = '目が離せない',
  [26] = '比翼連理',
  [27] = '姐御と舎弟',
  [28] = '割れ鍋に綴じ蓋',
  [29] = '水と油',
  [30] = '呉越同舟',
  [31] = '終生のライバル',
  [32] = '宿敵',
  [33] = 'ワールドクラスの恋',
  [34] = '芦毛の両雄',
  [35] = '時代背負いし３強',
  [36] = '月を照らす星',
  [37] = '酒と朱の交わり',
  [38] = '姐の背中は大きく',
  [39] = '響け、愛の行進曲',
  [40] = '三羽烏は天に舞う',
  [41] = 'アスリート姉妹',
  [42] = '大小連なる絆',
  [43] = '大小連なる名コンビ',
  [44] = '暴れん坊と優等生',
  [45] = '正反対の最強コンビ',
  [46] = '同厩生の問題児',
  [47] = '絆紡ぎし白桜',
  [48] = '名血婦人会',
  [49] = '名優、静寂の視線',
  [50] = '最強の隣人',
  [51] = '兄弟で残す衝撃',
  [52] = '雲の上の安らぎ',
  [53] = '瓜二つの友',
  [54] = '剛毅なママ友',
  [55] = '先駆者の初恋',
  [56] = '怪物同士の逃避行',
  [57] = '八重に咲く浪漫',
  [58] = '龍王の可憐な対峙',
  [59] = '龍王の可憐な旅路',
  [60] = '龍王の可憐な恋路',
  [61] = 'お嬢様と笑う馬',
  [62] = 'ターフ上のロマンス',
  [63] = '一番の輝きを夢見て',
  [64] = '名優と鉄の女',
  [65] = '乙女、大海を知る',
  [66] = '青雲の下に咲く花',
  [67] = 'キングとクイーン',
  [68] = '手に収まらぬ冠を',
  [69] = '元祖３強',
  [70] = '四つ脚同士の宿敵',
  [71] = 'ＴＴＧ',
  [72] = '共に踏み出す一歩',
  [73] = '龍呼びし再会',
  [74] = '艱難辛苦を越えて',
  [75] = 'エースをねらえ',
  [76] = '３冠から３強へ',
  [77] = '芦毛の英雄たち',
  [78] = '芦毛伝説の継承',
  [79] = '王者に迫る刺客',
  [80] = '天か地か',
  [81] = '日本と世界の交差点',
  [82] = '友であり宿敵',
  [83] = '主演と助演',
  [84] = '覇王と名脇役',
  [85] = '主演と「主演」',
  [86] = '桜の分岐路',
  [87] = '剛で剛を制す',
  [88] = '新星称える祭囃子',
  [89] = '牝馬戦国時代',
  [90] = '古馬３強',
  [91] = '新時代の旗手',
  [92] = '泥まみれの好敵手',
  [93] = '３冠の重みを知る者',
  [94] = '共に高め合う友',
  [95] = '夢と浪漫の決戦',
  [96] = '女帝と天敵',
  [97] = '黄金の敵対心',
  [98] = '首領の睨み合い',
  [99] = '白黒つけし者たち',
  [100] = 'ボスと反逆者',
  [101] = '生涯の仇敵',
  [102] = '始まりの宿敵',
  [103] = '竜虎のマッチレース',
  [104] = 'あの影を追いかけて',
  [105] = '稀代の女王たち',
  [106] = '真紅の美酒を君と',
  [107] = '奇跡の目撃者',
  [108] = '赤土に集う者たち',
  [109] = '約束の地に集う勇者',
}

local relationContext044 = WP26.context
function WP26.context(key, id)
  local c = relationContext044(key, id)
  local typ, horse
  if c.raceID then
    typ = 0
    horse = c.raceID
  elseif key == 'sire' or key == 'ownedSire' then
    typ = 1
    horse = id
  elseif key == 'mare' or key == 'ownedMare' then
    typ = 2
    horse = id
  end
  if typ then
    c.relationType = typ
    c.relationHorse = horse
    c.relationRows = {}
    local root = WP26.mod() + 0x3FD1850
    local n = readSmallInteger(root + 0x47BDA)
    assert(n and n <= 10000, 'Invalid relationship table')
    local block = n > 0 and readBytes(root + 0xD25A, n * 24, true) or {}
    assert(block, 'Relationship read failed')
    for i = 0, n - 1 do
      local j = i * 24
      local a = root + 0xD25A + j
      local first = block[j + 1] + block[j + 2] * 256
      local second = block[j + 3] + block[j + 4] * 256
      local t1 = block[j + 5]
      local t2 = block[j + 6]
      if (first == horse and t1 == typ) or (second == horse and t2 == typ) then
        local slot = #c.relationRows + 1
        assert(slot <= 6, 'Relationship count exceeds native limit')
        c['horseRelation' .. slot] = a
        c.relationRows[slot] = {
          index = i,
          address = a,
          other = first == horse and t1 == typ and second or first,
          otherType = first == horse and t1 == typ and t2 or t1,
          identity = { block[j + 1], block[j + 2], block[j + 3], block[j + 4], t1, t2 },
        }
      end
    end
  end
  return c
end
local relationAvailable044 = WP26.fieldAvailable
function WP26.fieldAvailable(c, f)
  if f.horseRelationSlot and not c['horseRelation' .. f.horseRelationSlot] then
    return false
  end
  return relationAvailable044(c, f)
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare', 'ownedSire', 'ownedMare' }) do
  for slot = 1, 6 do
    local choices = {}
    for id = 0, 109 do
      choices[#choices + 1] = { id = id, name = WP26.RELATION_NAMES[id] }
    end
    table.insert(WP26.EDITORS[key].fields, {
      en = 'Relationship ' .. slot,
      ja = '関係' .. slot,
      off = 6,
      bit = 0,
      bits = 8,
      max = 109,
      base = 'horseRelation' .. slot,
      horseRelationSlot = slot,
      choices = choices,
      groupJa = '名馬相関',
      groupEn = 'Horse relationships',
      source = 'menu74FA64 table3AC2060[6]->8FF5A0->326230->32DE40->140990; storage141220/140400; definitions194760/194900',
    })
  end
end
local relationAdd044 = WP26.addNativeField
function WP26.addNativeField(parent, key, index, c, session)
  local f = WP26.EDITORS[key].fields[index]
  if f.relationRank then
    local kind = readBytes(c[f.base] + 6, 1)
    local current = readBytes(WP26.mod() + 0x3951450 + kind * 208 + 25, 1)
    f.choices = {}
    if current == 0 then
      f.choices[#f.choices + 1] = { id = 0, name = 'S' }
    end
    for r = 1, 4 do
      f.choices[#f.choices + 1] = { id = r, name = ({ 'A', 'B', 'C', 'D' })[r] }
    end
  end
  local row = relationAdd044(parent, key, index, c, session)
  if f.horseRelationSlot then
    local r = c.relationRows[f.horseRelationSlot]
    local otherKey = ({ [0] = 'race', [1] = 'sire', [2] = 'mare' })[r.otherType]
    local name = otherKey and WP26.entityName(otherKey, r.other, relationContext044(otherKey, r.other)) or ''
    WP26.guardEditorBuild101(key)
    assert(name ~= '', 'Relationship partner name unavailable')
    local group = row.Parent
    local title = WP26.T('Relationship: ', '名馬相関：') .. name
    group.Description = title
    for _, d in ipairs(WP26.dyn) do
      if d.id == group.ID then
        d.en = 'Relationship: ' .. name
        d.ja = '名馬相関：' .. name
      end
    end
  end
  return row
end
local relationWrite044 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.horseRelationSlot then
    return relationWrite044(c, f, v, journal)
  end
  WP26.require()
  assert(type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid relationship value')
  local fresh = WP26.context(c.key, c.id)
  local a = c[f.base]
  assert(a == fresh[f.base], 'Relationship changed')
  local old = readBytes(a, 24, true)
  local newer = {}
  for i, x in ipairs(old) do
    newer[i] = x
  end
  local originalIdentity = c.relationRows[f.horseRelationSlot].identity
  for i = 1, 6 do
    assert(old[i] == originalIdentity[i], 'Relationship endpoints changed')
  end
  if f.relationRank then
    local kind = old[7]
    local def = WP26.mod() + 0x3951450 + kind * 208
    local rank = readBytes(def + 25, 1)
    if rank == v then
      return
    end
    assert(v >= 1 and v <= 4, 'No compatible S-rank definition selected')
    local category = readBytes(def + 24, 1)
    assert(category <= 3, 'Unknown relationship category')
    v = category * 4 + 4 - v
    newer[8] = 0
    newer[9] = 0
  end
  if old[f.off + 1] == v then
    return
  end
  newer[f.off + 1] = v
  if f.relationEffectRank ~= nil and (v == 29 or v == 11 or v == 12) then
    newer[f.off + 2] = 0
  end
  WP26.relationScratch = WP26.relationScratch or {}
  local scratch = WP26.relationScratch
  if scratch.pid ~= WP26.pid then
    scratch.pid = WP26.pid
    scratch.address = assert(allocateMemory(4096), 'Relationship buffer unavailable')
  end
  assert(writeBytes(scratch.address, newer), 'Relationship buffer write failed')
  local index = fresh.relationRows[f.horseRelationSlot].index
  WP26.native('horseRelationSet', index, scratch.address)
  local actual = readBytes(a, 24, true)
  local ok = true
  for i = 1, 24 do
    if actual[i] ~= newer[i] then
      ok = false
    end
  end
  if not ok then
    writeBytes(scratch.address, old)
    WP26.native('horseRelationSet', index, scratch.address)
    error('Relationship update verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] =
      { kind = 'horseRelation', pid = WP26.pid, ctx = c, field = f, index = index, before = old, after = newer }
  end
end
local relationUndo044 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'horseRelation' then
    return relationUndo044()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Process changed')
  local c = WP26.context(h.ctx.key, h.ctx.id)
  local a = c[h.field.base]
  assert(a == h.ctx[h.field.base], 'Relationship changed')
  local actual = readBytes(a, 24, true)
  for i = 1, 24 do
    assert(actual[i] == h.after[i], 'Relationship state changed')
  end
  local scratch = WP26.relationScratch
  assert(scratch and scratch.pid == WP26.pid)
  assert(writeBytes(scratch.address, h.before))
  WP26.native('horseRelationSet', h.index, scratch.address)
  actual = readBytes(a, 24, true)
  for i = 1, 24 do
    assert(actual[i] == h.before[i], 'Relationship restoration failed')
  end
  WP26.history[#WP26.history] = nil
end

WP26.RELATION_EFFECTS = {
  { id = 0, ja = 'ＳＰＵＰ', en = 'Speed UP' },
  { id = 1, ja = 'パワーＵＰ', en = 'Power UP' },
  { id = 2, ja = '勝負根性ＵＰ', en = 'Guts UP' },
  { id = 3, ja = '瞬発力ＵＰ', en = 'Acceleration UP' },
  { id = 4, ja = '賢さＵＰ', en = 'Intelligence UP' },
  { id = 5, ja = '精神力ＵＰ', en = 'Mental strength UP' },
  { id = 6, ja = '柔軟性ＵＰ', en = 'Flexibility UP' },
  { id = 7, ja = '健康ＵＰ', en = 'Health UP' },
  { id = 8, ja = '適応(瞬)ＵＰ', en = 'Burst aptitude UP' },
  { id = 9, ja = '適応(消)ＵＰ', en = 'Attrition aptitude UP' },
  { id = 10, ja = '適応(持)ＵＰ', en = 'Endurance aptitude UP' },
  { id = 11, ja = 'プラスウマソナ', en = 'Positive Umasona' },
  { id = 12, ja = '特性獲得', en = 'Gain trait' },
  { id = 13, ja = '配合時爆発力', en = 'Breeding explosion' },
  { id = 14, ja = '引退時活力', en = 'Retirement vitality' },
  { id = 15, ja = 'ＳＰ育成', en = 'Speed training' },
  { id = 16, ja = 'パワー育成', en = 'Power training' },
  { id = 17, ja = '勝負根性育成', en = 'Guts training' },
  { id = 18, ja = '瞬発力育成', en = 'Acceleration training' },
  { id = 19, ja = '賢さ育成', en = 'Intelligence training' },
  { id = 20, ja = '精神力育成', en = 'Mental strength training' },
  { id = 21, ja = '柔軟性育成', en = 'Flexibility training' },
  { id = 22, ja = '健康育成', en = 'Health training' },
  { id = 23, ja = '適応(瞬)', en = 'Burst adaptation' },
  { id = 24, ja = '適応(消)', en = 'Attrition adaptation' },
  { id = 25, ja = '適応(持)', en = 'Endurance adaptation' },
  { id = 26, ja = '子孫適応(瞬)', en = 'Descendant burst adaptation' },
  { id = 27, ja = '子孫適応(消)', en = 'Descendant attrition adaptation' },
  { id = 28, ja = '子孫適応(持)', en = 'Descendant endurance adaptation' },
  { id = 29, ja = 'なし', en = 'None' },
}

local relationRead045 = WP26.fieldRead
function WP26.fieldRead(c, f)
  if f.relationRank then
    local kind = WP26.bits(c[f.base], 6, 0, 8)
    assert(kind < 110, 'Unknown relationship')
    return readBytes(WP26.mod() + 0x3951450 + kind * 208 + 25, 1)
  end
  return relationRead045(c, f)
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare', 'ownedSire', 'ownedMare' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.horseRelationSlot then
      f.groupJa = '名馬相関 ' .. f.horseRelationSlot
      f.groupEn = 'Relationship ' .. f.horseRelationSlot
      f.ja = '関係'
      f.en = 'Relationship'
      for _, choice in ipairs(f.choices) do
        local rank = readBytes and nil
        choice.name = nil
        choice.en = WP26.RELATION_NAMES[choice.id]
        choice.ja = WP26.RELATION_NAMES[choice.id]
      end
    end
  end
  for slot = 1, 6 do
    local base = 'horseRelation' .. slot
    local common = {
      horseRelationSlot = slot,
      base = base,
      bit = 0,
      bits = 8,
      groupJa = '名馬相関 ' .. slot,
      groupEn = 'Relationship ' .. slot,
    }
    local function field(x)
      for k, v in pairs(common) do
        x[k] = v
      end
      table.insert(WP26.EDITORS[key].fields, x)
    end
    field({
      en = 'Rank',
      ja = 'ランク',
      off = 6,
      max = 4,
      relationRank = true,
      source = '194840 definition+19; rank change selects same-category generic relation kind; rank0S requires named historical definition',
    })
    for rank = 0, 4 do
      local label = ({ 'S', 'A', 'B', 'C', 'D' })[rank + 1]
      field({
        en = 'Rank ' .. label .. ': Effect',
        ja = 'ランク' .. label .. '：効果',
        off = 12 + rank * 2,
        max = 29,
        relationEffectRank = rank,
        choices = WP26.RELATION_EFFECTS,
        source = '1411A0 rank/effect/value writer;141050 cumulative effect;32A260/329F73 labels194390',
      })
      field({
        en = 'Rank ' .. label .. ': Amount / target',
        ja = 'ランク' .. label .. '：効果量・対象',
        off = 13 + rank * 2,
        max = 255,
        relationEffectAmount = rank,
        source = '1411A0 unsigned byte amount;141050 cumulative sum;242DB0 application dispatcher',
      })
    end
  end
end
local relationLang045 = WP26.applyLang
function WP26.applyLang()
  relationLang045()
  for _, v in pairs(WP26.valueRows or {}) do
    local f = WP26.EDITORS[v.key].fields[v.index]
    local row = v.id and getAddressList().getMemoryRecordByID(v.id)
    if row and f.choices then
      local lines = {}
      for _, c in ipairs(f.choices) do
        lines[#lines + 1] = c.id .. ':' .. (c.name or WP26.T(c.en, c.ja))
      end
      row.DropDownList.Text = table.concat(lines, '\n')
    end
  end
  if WP26_RACE_CONFIG and WP26.attached() then
    WP26.refreshRaceTargets()
  end
end

WP26.SPEC.foal = {
  pattern = '48 8B 05 8F 4C F5 03 0F B7 0C C8 B8 FF 7F 00 00 66 23 C8 33 C0 66 3B CA 0F 93 C0',
  disp = 3,
  len = 7,
  direct = false,
  target_rva = 0x402AAC8,
}
WP26.A.foal = nil
for _, key in ipairs({ 'ownedFoal', 'foal' }) do
  WP26.EDITORS[key].stride = 24
  WP26.EDITORS[key].max = 3439
end
local foalContext046 = WP26.context
function WP26.context(key, id)
  if key == 'foal' or key == 'ownedFoal' then
    WP26.require()
    assert(type(id) == 'number' and id % 1 == 0 and id >= 0 and id < WP26.entityCount180('foal'), 'Foal unavailable')
    local a = WP26.data('foal') + id * 24
    local h = WP26.bits(a, 0, 0, 15)
    assert(h < 0x702D, 'Foal base unavailable')
    if key == 'ownedFoal' then
      assert(WP26.bits(a, 4, 14, 13) == 46, 'Foal ownership changed')
    end
    return { key = key, id = id, primary = a, foal = a, foalID = id, horseID = h, horse = WP26.data('horse') + h * 56 }
  end
  return foalContext046(key, id)
end
local foalName046 = WP26.entityName
function WP26.entityName(key, id, c)
  if key == 'foal' or key == 'ownedFoal' then
    local cache = WP26.foalNameCache
    if not cache or cache.pid ~= WP26.pid or cache.root ~= WP26.data('foal') then
      WP26.readFoalNames()
      cache = WP26.foalNameCache
    end
    return cache.names[id] or ''
  end
  return foalName046(key, id, c)
end
local foalRows046 = WP26.editorRows
function WP26.editorRows(key)
  if key ~= 'foal' and key ~= 'ownedFoal' then
    return foalRows046(key)
  end
  local names = WP26.readFoalNames()
  local root = WP26.data('foal')
  local bytes = assert(readBytes(root, WP26.entityCount180('foal') * 24, true))
  local rows = {}
  for id = 0, WP26.entityCount180('foal') - 1 do
    local j = id * 24
    local h = (bytes[j + 1] + bytes[j + 2] * 256) & 0x7FFF
    local word = bytes[j + 5] + bytes[j + 6] * 256 + bytes[j + 7] * 65536 + bytes[j + 8] * 16777216
    local owner = (word >> 14) & 0x1FFF
    if h < 0x702D and (key == 'foal' or owner == 46) and names[id] ~= '' then
      rows[#rows + 1] = { id = id, name = names[id] }
    end
  end
  table.sort(rows, function(a, b)
    if a.name == b.name then
      return a.id < b.id
    end
    return a.name < b.name
  end)
  return rows
end

WP26.SPEC.horseMemoSet =
  { pattern = '83 FA 19 0F 87 E7 00 00 00 48 63 C2 4C 8D 0D AD AD CA FF 41 8B 94 81 34 53 35 00 49 03 D1 FF E2' }
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Speed',
  ['ja'] = 'メモ：スピード',
  ['off'] = 268,
  ['bit'] = 0,
  ['bits'] = 3,
  ['max'] = 5,
  ['memoIndex'] = 0,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[0]; getter9D5C0; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Acceleration',
  ['ja'] = 'メモ：瞬発力',
  ['off'] = 268,
  ['bit'] = 7,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 1,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[1]; getter9D610; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Flexibility',
  ['ja'] = 'メモ：柔軟性',
  ['off'] = 270,
  ['bit'] = 0,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 2,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[2]; getter9D620; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Mental strength',
  ['ja'] = 'メモ：精神力',
  ['off'] = 268,
  ['bit'] = 19,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 3,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[3]; getter9D5E0; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Intelligence',
  ['ja'] = 'メモ：賢さ',
  ['off'] = 268,
  ['bit'] = 22,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 4,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[4]; getter9D5F0; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Guts',
  ['ja'] = 'メモ：勝負根性',
  ['off'] = 268,
  ['bit'] = 10,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 5,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[5]; getter9D5D0; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Power',
  ['ja'] = 'メモ：パワー',
  ['off'] = 268,
  ['bit'] = 13,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 6,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[6]; getter9D600; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Health',
  ['ja'] = 'メモ：健康',
  ['off'] = 268,
  ['bit'] = 25,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 7,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[7]; getter9D630; FC920 owned+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Distance aptitude',
  ['ja'] = 'メモ：距離適性',
  ['off'] = 272,
  ['bit'] = 6,
  ['bits'] = 4,
  ['max'] = 9,
  ['memoIndex'] = 8,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[8]; getter9D680; FC920 owned+100h',
  ['optionsJa'] = {
    '不明',
    '短距離',
    'マイル',
    '中距離',
    'クラシック',
    '長距離',
    '万能・短',
    '万能・中',
    '万能・長',
    '万能',
  },
  ['optionsEn'] = {
    'Unknown',
    'Sprint',
    'Mile',
    'Middle distance',
    'Classic',
    'Long distance',
    'Versatile: short',
    'Versatile: middle',
    'Versatile: long',
    'Versatile',
  },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Tight turns',
  ['ja'] = 'メモ：小回り',
  ['off'] = 272,
  ['bit'] = 10,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 9,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[9]; getter9D690; FC920 owned+100h',
  ['optionsJa'] = { '不明', '普通', '苦手', '改善' },
  ['optionsEn'] = { 'Unknown', 'Normal', 'Poor', 'Improved' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Surface aptitude',
  ['ja'] = 'メモ：馬場適性',
  ['off'] = 268,
  ['bit'] = 3,
  ['bits'] = 4,
  ['max'] = 8,
  ['memoIndex'] = 10,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[10]; getter9D660; FC920 owned+100h',
  ['optionsJa'] = {
    '不明',
    '芝◎ ダ×',
    '芝◎ ダ△',
    '芝◎ ダ○',
    '芝◎ ダ◎',
    '芝○ ダ◎',
    '芝△ ダ◎',
    '芝× ダ◎',
    '芝○ ダ○',
  },
  ['optionsEn'] = {
    'Unknown',
    'Turf◎ Dirt×',
    'Turf◎ Dirt△',
    'Turf◎ Dirt○',
    'Turf◎ Dirt◎',
    'Turf○ Dirt◎',
    'Turf△ Dirt◎',
    'Turf× Dirt◎',
    'Turf○ Dirt○',
  },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Right-handed tracks',
  ['ja'] = 'メモ：右回り',
  ['off'] = 272,
  ['bit'] = 12,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 11,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[11]; getter9D6A0; FC920 owned+100h',
  ['optionsJa'] = { '不明', '普通', '苦手', '改善' },
  ['optionsEn'] = { 'Unknown', 'Normal', 'Poor', 'Improved' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Running style',
  ['ja'] = 'メモ：脚質',
  ['off'] = 275,
  ['bit'] = 0,
  ['bits'] = 4,
  ['max'] = 8,
  ['memoIndex'] = 12,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[12]; getter9D6C0; FC920 owned+100h',
  ['optionsJa'] = {
    '不明',
    '大逃げ',
    '逃げ',
    '先行',
    '差し',
    '追込',
    '自在先行',
    '自在差し',
    '自在',
  },
  ['optionsEn'] = {
    'Unknown',
    'Big escape',
    'Front runner',
    'Prominent',
    'Midfield',
    'Closer',
    'Versatile prominent',
    'Versatile midfield',
    'Versatile',
  },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Left-handed tracks',
  ['ja'] = 'メモ：左回り',
  ['off'] = 272,
  ['bit'] = 14,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 13,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[13]; getter9D6B0; FC920 owned+100h',
  ['optionsJa'] = { '不明', '普通', '苦手', '改善' },
  ['optionsEn'] = { 'Unknown', 'Normal', 'Poor', 'Improved' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Temperament',
  ['ja'] = 'メモ：気性',
  ['off'] = 272,
  ['bit'] = 0,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 14,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[14]; getter9D650; FC920 owned+100h',
  ['optionsJa'] = { '不明', '激', '荒い', '普通', '大人' },
  ['optionsEn'] = { 'Unknown', 'Fierce', 'Rough', 'Normal', 'Calm' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Roaring',
  ['ja'] = 'メモ：喉鳴り',
  ['off'] = 272,
  ['bit'] = 18,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 15,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[15]; getter9D6E0; FC920 owned+100h',
  ['optionsJa'] = { '不明', 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'Unknown', 'None', 'Improved', 'Present' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Personality',
  ['ja'] = 'メモ：性格',
  ['off'] = 276,
  ['bit'] = 11,
  ['bits'] = 4,
  ['max'] = 14,
  ['memoIndex'] = 16,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[16]; getter9D760; FC920 owned+100h',
  ['optionsJa'] = {
    '不明',
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Unknown',
    'Obedient',
    'Timid',
    'Serious',
    'Normal',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Leg fragility',
  ['ja'] = 'メモ：脚部不安',
  ['off'] = 272,
  ['bit'] = 20,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 17,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[17]; getter9D6F0; FC920 owned+100h',
  ['optionsJa'] = { '不明', 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'Unknown', 'None', 'Improved', 'Present' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Growth type',
  ['ja'] = 'メモ：成長型',
  ['off'] = 268,
  ['bit'] = 28,
  ['bits'] = 3,
  ['max'] = 5,
  ['memoIndex'] = 18,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[18]; getter9D640; FC920 owned+100h',
  ['optionsJa'] = { '不明', '早熟', '早め', '遅め', '晩成', '覚醒' },
  ['optionsEn'] = { 'Unknown', 'Early', 'Early-medium', 'Late-medium', 'Late', 'Awakening' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Weak back',
  ['ja'] = 'メモ：腰の甘さ',
  ['off'] = 272,
  ['bit'] = 22,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 19,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[19]; getter9D700; FC920 owned+100h',
  ['optionsJa'] = { '不明', 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'Unknown', 'None', 'Improved', 'Present' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Heavy going',
  ['ja'] = 'メモ：重馬場',
  ['off'] = 272,
  ['bit'] = 3,
  ['bits'] = 3,
  ['max'] = 4,
  ['memoIndex'] = 20,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[20]; getter9D670; FC920 owned+100h',
  ['optionsJa'] = { '不明', '苦手', '普通', '得意', '鬼' },
  ['optionsEn'] = { 'Unknown', 'Poor', 'Normal', 'Good', 'Exceptional' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Slow-start habit',
  ['ja'] = 'メモ：出遅れ癖',
  ['off'] = 264,
  ['bit'] = 28,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 21,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[21]; getter9D720; FC920 owned+100h',
  ['optionsJa'] = { '不明', 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'Unknown', 'None', 'Improved', 'Present' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Memo: Running form',
  ['ja'] = 'メモ：走法',
  ['off'] = 274,
  ['bit'] = 0,
  ['bits'] = 2,
  ['max'] = 3,
  ['memoIndex'] = 22,
  ['groupJa'] = 'メモ',
  ['groupEn'] = 'Notes',
  ['source'] = 'Native memo UI33DC80->355240[22]; getter9D6D0; FC920 owned+100h',
  ['optionsJa'] = { '不明', '普通', 'ピッチ', '大跳び' },
  ['optionsEn'] = { 'Unknown', 'Normal', 'Pitch', 'Long stride' },
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Speed',
  ['ja'] = 'スピード：判明',
  ['off'] = 264,
  ['bit'] = 7,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field0-> getter9CDB0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Acceleration',
  ['ja'] = '瞬発力：判明',
  ['off'] = 264,
  ['bit'] = 8,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field1-> getter9CDE0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Flexibility',
  ['ja'] = '柔軟性：判明',
  ['off'] = 264,
  ['bit'] = 11,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field2-> getter9CE00; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Mental strength',
  ['ja'] = '精神力：判明',
  ['off'] = 264,
  ['bit'] = 12,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field3-> getter9CE10; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Intelligence',
  ['ja'] = '賢さ：判明',
  ['off'] = 264,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field4-> getter9CE20; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Guts',
  ['ja'] = '勝負根性：判明',
  ['off'] = 264,
  ['bit'] = 9,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field5-> getter9CDD0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Power',
  ['ja'] = 'パワー：判明',
  ['off'] = 264,
  ['bit'] = 10,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field6-> getter9CDF0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Health',
  ['ja'] = '健康：判明',
  ['off'] = 264,
  ['bit'] = 14,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field7-> getter9CE30; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Distance aptitude',
  ['ja'] = '距離適性：判明',
  ['off'] = 264,
  ['bit'] = 15,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field8-> getter9CDC0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Tight turns',
  ['ja'] = '小回り：判明',
  ['off'] = 264,
  ['bit'] = 0,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field9-> getter9CE80; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Surface aptitude',
  ['ja'] = '馬場適性：判明',
  ['off'] = 260,
  ['bit'] = 21,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field10-> getter9CE60; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Right-handed tracks',
  ['ja'] = '右回り：判明',
  ['off'] = 264,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field11-> getter9CE90; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Running style',
  ['ja'] = '脚質：判明',
  ['off'] = 260,
  ['bit'] = 23,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field12-> getter9CEB0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Left-handed tracks',
  ['ja'] = '左回り：判明',
  ['off'] = 264,
  ['bit'] = 2,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field13-> getter9CEA0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Temperament',
  ['ja'] = '気性：判明',
  ['off'] = 260,
  ['bit'] = 20,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field14-> getter9CE50; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Roaring',
  ['ja'] = '喉鳴り：判明',
  ['off'] = 264,
  ['bit'] = 4,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field15-> getter9CED0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Personality',
  ['ja'] = '性格：判明',
  ['off'] = 276,
  ['bit'] = 10,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field16-> getter9CFE0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Leg fragility',
  ['ja'] = '脚部不安：判明',
  ['off'] = 264,
  ['bit'] = 5,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field17-> getter9CEE0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Growth type',
  ['ja'] = '成長型：判明',
  ['off'] = 256,
  ['bit'] = 15,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field18-> getter9CE40; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Weak back',
  ['ja'] = '腰の甘さ：判明',
  ['off'] = 264,
  ['bit'] = 6,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field19-> getter9CEF0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Heavy going',
  ['ja'] = '重馬場：判明',
  ['off'] = 260,
  ['bit'] = 22,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field20-> getter9CE70; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Slow-start habit',
  ['ja'] = '出遅れ癖：判明',
  ['off'] = 264,
  ['bit'] = 30,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field21-> getter9CFC0; owned snapshotFC920+100h',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Revealed: Running form',
  ['ja'] = '走法：判明',
  ['off'] = 264,
  ['bit'] = 3,
  ['bits'] = 1,
  ['max'] = 1,
  ['groupJa'] = '能力の判明状態',
  ['groupEn'] = 'Revealed abilities',
  ['optionsJa'] = { '未判明', '判明' },
  ['optionsEn'] = { 'Unknown', 'Revealed' },
  ['source'] = '33DEC0 field22-> getter9CEC0; owned snapshotFC920+100h',
})
WP26.SPEC.smallTurnsSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 47 5C E0 03',
}
WP26.SPEC.rightTurnsSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 17 83 E0 03',
}
WP26.SPEC.leftTurnsSet = {
  pattern = '40 53 48 83 EC 20 B8 85 1A 00 00 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 06 F7 E0',
}
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Poor at tight turns',
  ['ja'] = '小回り苦手',
  ['off'] = 16,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'race',
  ['raceSetter'] = 'smallTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterC3830, matched turn labels2A8C6B0..D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Poor on right-handed tracks',
  ['ja'] = '右回り苦手',
  ['off'] = 28,
  ['bit'] = 30,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'race',
  ['raceSetter'] = 'rightTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterC1160, matched turn labels2A8C6B0..D0',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Poor on left-handed tracks',
  ['ja'] = '左回り苦手',
  ['off'] = 16,
  ['bit'] = 31,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'horse',
  ['raceSetter'] = 'leftTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterB9D90, matched turn labels2A8C6B0..D0',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Poor at tight turns',
  ['ja'] = '小回り苦手',
  ['off'] = 16,
  ['bit'] = 13,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'race',
  ['raceSetter'] = 'smallTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterC3830, matched turn labels2A8C6B0..D0',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Poor on right-handed tracks',
  ['ja'] = '右回り苦手',
  ['off'] = 28,
  ['bit'] = 30,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'race',
  ['raceSetter'] = 'rightTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterC1160, matched turn labels2A8C6B0..D0',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Poor on left-handed tracks',
  ['ja'] = '左回り苦手',
  ['off'] = 16,
  ['bit'] = 31,
  ['bits'] = 1,
  ['max'] = 1,
  ['base'] = 'horse',
  ['raceSetter'] = 'leftTurnsSet',
  ['groupJa'] = 'コース適性',
  ['groupEn'] = 'Track aptitude',
  ['optionsJa'] = { '普通', '苦手' },
  ['optionsEn'] = { 'Normal', 'Poor' },
  ['source'] = 'UI2BDB1F..2BDB95 -> native getterB9D90, matched turn labels2A8C6B0..D0',
})

local memoWrite047 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if f.memoIndex == nil then
    return memoWrite047(c, f, v, journal)
  end
  WP26.require()
  assert(c.key == 'owned' and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid memo value')
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary and fresh.horseID == c.horseID, 'Ownership changed')
  local a = c.primary + 0x100
  local before = readBytes(a, 32, true)
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  WP26.native('horseMemoSet', a, f.memoIndex, v)
  if WP26.fieldRead(c, f) ~= v then
    WP26.native('horseMemoSet', a, f.memoIndex, old)
    error('Memo update verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'horseMemo',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      before = before,
      after = readBytes(a, 32, true),
    }
  end
end
local memoUndo047 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'horseMemo' then
    return memoUndo047()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Process changed')
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.primary == h.ctx.primary and c.horseID == h.ctx.horseID, 'Ownership changed')
  local a = c.primary + 0x100
  local now = readBytes(a, 32, true)
  for i, x in ipairs(h.after) do
    assert(now[i] == x, 'Memo changed')
  end
  WP26.native('horseMemoSet', a, h.field.memoIndex, h.old)
  now = readBytes(a, 32, true)
  for i, x in ipairs(h.before) do
    assert(now[i] == x, 'Memo restoration failed')
  end
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.jockeyDistanceSet = {
  pattern = '48 83 EC 28 4C 63 DA 0F B7 C1 BA 4A 02 00 00 45 8B D0 66 2B C2 BA 0E 01 00 00 66 3B C2 77 18 0F B7 C0 48 6B C8 54 48 03',
}
WP26.SPEC.jockeyAffinitySet = {
  pattern = '48 83 EC 28 4C 63 D2 0F B7 C1 BA 4A 02 00 00 45 8B D8 66 2B C2 BA 0E 01 00 00 66 3B C2 77 1E 41 83 FA 02 73 75 0F B7 C0',
}
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Sprint grade',
  ['ja'] = '短距離適性',
  ['off'] = 68,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 4,
  ['jockeyDistance'] = 0,
  ['jockeyGrade'] = 1,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
  ['optionsEn'] = { 'D', 'C', 'B', 'A', 'S' },
  ['optionsJa'] = { 'D', 'C', 'B', 'A', 'S' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Sprint experience',
  ['ja'] = '短距離経験値',
  ['off'] = 68,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['jockeyDistance'] = 0,
  ['jockeyGrade'] = 0,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Mile grade',
  ['ja'] = 'マイル適性',
  ['off'] = 69,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 4,
  ['jockeyDistance'] = 1,
  ['jockeyGrade'] = 1,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
  ['optionsEn'] = { 'D', 'C', 'B', 'A', 'S' },
  ['optionsJa'] = { 'D', 'C', 'B', 'A', 'S' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Mile experience',
  ['ja'] = 'マイル経験値',
  ['off'] = 69,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['jockeyDistance'] = 1,
  ['jockeyGrade'] = 0,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Middle distance grade',
  ['ja'] = '中距離適性',
  ['off'] = 70,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 4,
  ['jockeyDistance'] = 2,
  ['jockeyGrade'] = 1,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
  ['optionsEn'] = { 'D', 'C', 'B', 'A', 'S' },
  ['optionsJa'] = { 'D', 'C', 'B', 'A', 'S' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Middle distance experience',
  ['ja'] = '中距離経験値',
  ['off'] = 70,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['jockeyDistance'] = 2,
  ['jockeyGrade'] = 0,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Long distance grade',
  ['ja'] = '長距離適性',
  ['off'] = 71,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 4,
  ['jockeyDistance'] = 3,
  ['jockeyGrade'] = 1,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
  ['optionsEn'] = { 'D', 'C', 'B', 'A', 'S' },
  ['optionsJa'] = { 'D', 'C', 'B', 'A', 'S' },
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Long distance experience',
  ['ja'] = '長距離経験値',
  ['off'] = 71,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 255,
  ['jockeyDistance'] = 3,
  ['jockeyGrade'] = 0,
  ['groupEn'] = 'Distance aptitude',
  ['groupJa'] = '距離適性',
  ['source'] = 'UI2DD75E->124800;1246E0/124770; thresholds39DAE60',
})

local umasonaChoices048
for _, f in ipairs(WP26.EDITORS.owned.fields) do
  if f.umasonaSlot == 0 then
    umasonaChoices048 = f.choices
    break
  end
end
assert(umasonaChoices048)
for i = 0, 1 do
  table.insert(WP26.EDITORS.jockey.fields, {
    en = 'Preferred Umasona ' .. (i + 1),
    ja = '得意ウマソナ' .. (i + 1),
    off = 0x88 + i,
    bit = 0,
    bits = 8,
    max = 92,
    jockeyAffinity = i,
    choices = umasonaChoices048,
    groupEn = 'Preferred Umasona',
    groupJa = '得意ウマソナ',
    source = 'UI2DD9A6->127720/1277D0;127880->192810',
  })
end
local layout048 = WP26.fieldLayout
function WP26.fieldLayout(c, f)
  if f.jockeyDistance ~= nil then
    return (f.jockeyStyle and (c.personDynamic and 0x17 or 0x41) or (c.personDynamic and 0x1A or 0x44))
      + f.jockeyDistance,
      0,
      8
  end
  if f.jockeyAffinity ~= nil then
    return (c.personDynamic and 0x4E or 0x88) + f.jockeyAffinity, 0, 8
  end
  return layout048(c, f)
end
local read048 = WP26.fieldRead
function WP26.fieldRead(c, f)
  if f.jockeyGrade == 1 then
    local raw = WP26.bits(
      c.primary,
      (f.jockeyStyle and (c.personDynamic and 0x17 or 0x41) or (c.personDynamic and 0x1A or 0x44)) + f.jockeyDistance,
      0,
      8
    )
    local thresholds = { 0, 51, 101, 191, 231, 256 }
    for i = 1, 5 do
      if raw >= thresholds[i] and raw < thresholds[i + 1] then
        return i - 1
      end
    end
  end
  return read048(c, f)
end
local write048 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if f.jockeyDistance == nil and f.jockeyAffinity == nil then
    return write048(c, f, v, journal)
  end
  WP26.require()
  assert(c.key == 'jockey' and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid jockey value')
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary, 'Jockey changed')
  local off = WP26.fieldLayout(c, f)
  local old = readBytes(c.primary + off, 1)
  local raw = f.jockeyGrade == 1 and ({ 0, 51, 101, 191, 231 })[v + 1] or v
  if old == raw then
    return
  end
  local fn = f.jockeyStyle and 'jockeyStyleExperienceSet'
    or (f.jockeyDistance ~= nil and 'jockeyDistanceSet' or 'jockeyAffinitySet')
  local index = f.jockeyDistance ~= nil and f.jockeyDistance or f.jockeyAffinity
  WP26.native(fn, c.id, index, raw)
  if readBytes(c.primary + off, 1) ~= raw then
    WP26.native(fn, c.id, index, old)
    error('Jockey update verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] =
      { kind = 'jockey048', pid = WP26.pid, ctx = c, off = off, fn = fn, index = index, old = old, after = raw }
  end
end
local undo048 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'jockey048' then
    return undo048()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.primary == h.ctx.primary and readBytes(c.primary + h.off, 1) == h.after, 'Jockey changed')
  WP26.native(h.fn, c.id, h.index, h.old)
  assert(readBytes(c.primary + h.off, 1) == h.old, 'Jockey restoration failed')
  WP26.history[#WP26.history] = nil
end
-- Correct semantic labels using the native UI's literal strings (CP932).
for _, key in ipairs({ 'owned', 'race' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.raceSetter == 'smallTurnsSet' then
      f.en = 'Poor on left-handed tracks'
      f.ja = '左回り苦手'
      f.source = 'UI2BDB1F C3830; literal2A8C6B0 左回り苦手'
    elseif f.raceSetter == 'leftTurnsSet' then
      f.en = 'Poor at tight turns'
      f.ja = '小回り苦手'
      f.source = 'UI2BDB89 B9D90; literal2A8C6D0 小回り苦手'
    end
  end
end

WP26.SPEC.jockeyStyleExperienceSet = {
  pattern = '48 83 EC 28 B8 59 03 00 00 4C 63 DA 45 8B D0 66 3B C8 72 26 74 6A B8 6A 03 00 00 66 3B C8 77 09 83 3D 29 5D DA 03 00 75',
}

local styles049 = { ['Front-running / forward'] = 0, ['Forward / closer'] = 1, ['Closer / late runner'] = 2 }
for _, f in ipairs(WP26.EDITORS.jockey.fields) do
  local index = styles049[f.en]
  if index ~= nil then
    f.jockeyDistance = index
    f.jockeyStyle = true
    f.jockeyGrade = 1
    f.off = 0x41 + index
    f.bit = 0
    f.bits = 8
    f.max = 4
    f.optionsEn = { 'X', 'Triangle', 'Circle', 'Double circle', 'Filled circle' }
    f.optionsJa = { '×', '△', '○', '◎', '●' }
    f.groupEn = 'Running-style aptitude'
    f.groupJa = '脚質適性'
    f.source = 'UI2DD5A3->123B30;123710/1237C0; thresholds39DAE50'
  elseif f.en:find('(experience)', 1, true) and f.en:find(' / ', 1, true) then
    f.max = 255
    f.groupEn = 'Running-style aptitude'
    f.groupJa = '脚質適性'
  end
end

WP26.SPEC.jockeyStableGet = {
  pattern = '48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 0F B7 F9 33 DB BE 2E 03 00 00 0F 1F 80 00 00 00 00 66 3B DE 72 1A 33 D2 0F',
}
WP26.SPEC.trainerJockeyGet = {
  pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ED 07 F7 FF 85 C0 75 07 B8 59 03 00 00 EB 3D 0F B7 4C 24 40 E8 68 CF FF FF',
}
WP26.SPEC.trainerJockeySet = {
  pattern = '66 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 78 07 F7 FF 85 C0 75 02 EB 68 0F B7 4C 24 40 E8 F8 CE FF FF',
}
WP26.SPEC.trainerRegionGet = {
  pattern = '66 89 4C 24 08 48 83 EC 38 83 3D 50 3B DB 03 00 74 12 0F B7 4C 24 40 E8 F4 09 F7 FF 85 C0 75 04 33 C0 EB 4F 0F B7 4C 24',
}
WP26.SPEC.jockeyRegionGet = {
  pattern = '48 83 EC 28 8B 15 96 6B DA 03 B8 59 03 00 00 44 8D 40 12 85 D2 74 20 66 3B C8 72 1B 74 3B B8 6A 03 00 00 66 3B C8 76 20',
}
WP26.SPEC.jockeyRegionSet = {
  pattern = '48 83 EC 28 B8 59 03 00 00 44 8B D2 66 3B C8 72 26 74 75 B8 6A 03 00 00 66 3B C8 77 09 83 3D CC 6A DA 03 00 75 11 BA 6B',
}
WP26.jockeyStableCache = {}
local stableField050 = {
  en = 'Affiliated stable',
  ja = '所属厩舎',
  off = 0,
  bit = 0,
  bits = 16,
  max = 814,
  jockeyStable = true,
  groupEn = 'Affiliation',
  groupJa = '所属',
  source = 'UI2DA164->125680 inverse115BC0; native assignment115C30; region122970/122A20',
}
table.insert(WP26.EDITORS.jockey.fields, stableField050)
local refresh050 = WP26.refreshEditor
function WP26.refreshEditor(key)
  if key == 'jockey' and WP26.selected[key] ~= nil then
    local id = WP26.selected[key]
    WP26.jockeyStableCache[id] = WP26.native('jockeyStableGet', id)
    local choices = { { id = 814, en = 'Freelance', ja = 'フリー' } }
    for _, r in ipairs(WP26.editorRows('trainer')) do
      choices[#choices + 1] = { id = r.id, name = r.name }
    end
    stableField050.choices = choices
  end
  return refresh050(key)
end
local read050 = WP26.fieldRead
function WP26.fieldRead(c, f)
  if f.jockeyStable then
    return WP26.jockeyStableCache[c.id] or 814
  end
  return read050(c, f)
end
local write050 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.jockeyStable then
    return write050(c, f, v, journal)
  end
  WP26.require()
  assert(c.key == 'jockey' and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= 814, 'Invalid stable')
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary, 'Jockey changed')
  local old = WP26.native('jockeyStableGet', c.id)
  assert(WP26.jockeyStableCache[c.id] == old, 'Affiliation changed')
  if old == v then
    return
  end
  local before = {}
  if old < 814 then
    before[old] = WP26.native('trainerJockeyGet', old)
    assert(before[old] == c.id, 'Previous stable changed')
  end
  if v < 814 then
    WP26.context('trainer', v)
    before[v] = WP26.native('trainerJockeyGet', v)
  end
  local home = WP26.native('jockeyRegionGet', c.id)
  local afterHome = home
  local function restore()
    for id, value in pairs(before) do
      WP26.native('trainerJockeySet', id, value)
    end
    WP26.native('jockeyRegionSet', c.id, home)
    WP26.jockeyStableCache[c.id] = old
  end
  local ok, e = pcall(function()
    if old < 814 then
      WP26.native('trainerJockeySet', old, 857)
    end
    if v < 814 then
      WP26.native('trainerJockeySet', v, c.id)
      afterHome = WP26.native('trainerRegionGet', v)
      WP26.native('jockeyRegionSet', c.id, afterHome)
    end
    assert(WP26.native('jockeyStableGet', c.id) == v, 'Native affiliation mismatch')
    assert(WP26.native('jockeyRegionGet', c.id) == afterHome, 'Native region mismatch')
  end)
  if not ok then
    restore()
    error(e, 0)
  end
  local after = {}
  for id in pairs(before) do
    after[id] = WP26.native('trainerJockeyGet', id)
  end
  WP26.jockeyStableCache[c.id] = v
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'jockeyStable050',
      pid = WP26.pid,
      ctx = c,
      before = before,
      after = after,
      home = home,
      afterHome = afterHome,
      old = old,
      new = v,
    }
  end
end
local undo050 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'jockeyStable050' then
    return undo050()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.primary == h.ctx.primary and WP26.native('jockeyStableGet', c.id) == h.new, 'Affiliation changed')
  for id, value in pairs(h.after) do
    assert(WP26.native('trainerJockeyGet', id) == value, 'Trainer assignment changed')
  end
  assert(WP26.native('jockeyRegionGet', c.id) == h.afterHome, 'Region changed')
  for id, value in pairs(h.before) do
    WP26.native('trainerJockeySet', id, value)
  end
  WP26.native('jockeyRegionSet', c.id, h.home)
  for id, value in pairs(h.before) do
    assert(WP26.native('trainerJockeyGet', id) == value, 'Trainer restoration failed')
  end
  assert(WP26.native('jockeyStableGet', c.id) == h.old, 'Affiliation restoration failed')
  WP26.jockeyStableCache[c.id] = h.old
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.horseMainJockeySet = {
  pattern = '48 89 5C 24 10 57 48 83 EC 20 0F B7 D9 0F B7 FA B9 30 33 00 00 0F B7 C3 66 2B C1 0F B7 CB 66 83 F8 63 0F 86 F9 00 00 00',
}

for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    en = 'Main jockey',
    ja = '主戦騎手',
    off = 4,
    bit = 14,
    bits = 10,
    max = 857,
    base = 'race',
    horseMainJockey = true,
    groupEn = 'Connections',
    groupJa = '関係者',
    source = 'UI2B33DA->BABE0; BAC90 native main-jockey replacement and local trait/counter reset',
  })
end
function WP26.jockeyMountRows(id)
  return WP26.withRaceSnapshot179(function(snapshot)
    local out={}
    for _,row in ipairs(WP26.editorRows('race')) do
      local c=WP26.context('race',row.id)
      if WP26.bits(c.race,4,14,10)==id then out[#out+1]=row end
    end
    return out
  end)
end

function WP26.openJockeyMount(id)
  WP26.context('race', id)
  WP26.selected.race = id
  WP26.deferEditor('race')
end
local refresh051 = WP26.refreshEditor
function WP26.refreshEditor(key)
  if key == 'owned' or key == 'race' then
    if not WP26.jockeyChoices051 then
      local choices = { { id = 857, en = 'None', ja = 'なし' } }
      for _, r in ipairs(WP26.editorRows('jockey')) do
        choices[#choices + 1] = r
      end
      WP26.jockeyChoices051 = choices
    end
    for _, f in ipairs(WP26.EDITORS[key].fields) do
      if f.horseMainJockey then
        f.choices = WP26.jockeyChoices051
      end
    end
  end
  local result = refresh051(key)
  if key == 'jockey' and WP26.selected.jockey ~= nil then
    local parent = getAddressList().getMemoryRecordByID(WP26.EDITORS.jockey.record)
    local rows = WP26.jockeyMountRows(WP26.selected.jockey)
    if #rows > 0 then
      local group = WP26.addHdr(parent, 'Main mounts', '主戦馬')
      for _, r in ipairs(rows) do
        WP26.addAction(group, r.name, r.name, 'WP26.openJockeyMount(' .. r.id .. ')')
      end
      group.Collapsed = true
    end
  end
  return result
end
local write051 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.horseMainJockey then
    return write051(c, f, v, journal)
  end
  WP26.require()
  assert(
    (c.key == 'owned' or c.key == 'race') and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= 857,
    'Invalid jockey'
  )
  if v < 857 then
    WP26.context('jockey', v)
  end
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.horseID == c.horseID and fresh.raceID == c.raceID, 'Horse changed')
  if WP26.fieldRead(c, f) == v then
    return
  end
  local snapshots = {
    { p = c.race, n = 232, b = readBytes(c.race, 232, true) },
    {
      p = c.horse,
      n = 56,
      b = readBytes(c.horse, 56, true),
    },
  }
  WP26.native('horseMainJockeySet', c.raceID, v)
  local patches = {}
  for _, x in ipairs(snapshots) do
    local a = readBytes(x.p, x.n, true)
    for i, b in ipairs(x.b) do
      if a[i] ~= b then
        patches[#patches + 1] = { p = x.p + i - 1, before = b, after = a[i] }
      end
    end
  end
  if WP26.fieldRead(c, f) ~= v then
    for _, x in ipairs(patches) do
      writeBytes(x.p, x.before)
    end
    error('Main jockey verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = { kind = 'mainJockey051', pid = WP26.pid, ctx = c, patches = patches }
  end
end
local undo051 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'mainJockey051' then
    return undo051()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.horseID == h.ctx.horseID and c.raceID == h.ctx.raceID, 'Horse changed')
  for _, x in ipairs(h.patches) do
    assert(readBytes(x.p, 1) == x.after, 'Horse data changed')
  end
  for _, x in ipairs(h.patches) do
    writeBytes(x.p, x.before)
    assert(readBytes(x.p, 1) == x.before, 'Main jockey restoration failed')
  end
  WP26.history[#WP26.history] = nil
end

WP26.RELATION_GRANT_TRAITS = {
  1,
  3,
  5,
  7,
  9,
  11,
  13,
  15,
  17,
  19,
  21,
  23,
  25,
  27,
  29,
  31,
  33,
  35,
  37,
  39,
  41,
  43,
  45,
  47,
  49,
  51,
  53,
  55,
  57,
  59,
  61,
  63,
  65,
  67,
  69,
  71,
  73,
  75,
  77,
  79,
  81,
  83,
  85,
  87,
  89,
  91,
  93,
  95,
  97,
  99,
  101,
  103,
}

WP26.relationTargetChoices052 = {}
local umasonaChoices052 = { { id = 0, en = 'Random', ja = 'ランダム' } }
for _, f in ipairs(WP26.EDITORS.owned.fields) do
  if f.umasonaSlot == 0 then
    for _, r in ipairs(f.choices) do
      if r.id > 0 then
        umasonaChoices052[#umasonaChoices052 + 1] = r
      end
    end
    break
  end
end
local traitChoices052 = { { id = 0, en = 'Random', ja = 'ランダム' } }
for _, id in ipairs(WP26.RELATION_GRANT_TRAITS) do
  traitChoices052[#traitChoices052 + 1] = { id = id, name = WP26.TRAIT_NAMES[id] }
end
WP26.relationTargetChoices052[11] = umasonaChoices052
WP26.relationTargetChoices052[12] = traitChoices052
function WP26.decorateRelationTarget(c, f, row)
  if f.relationEffectAmount == nil then
    return
  end
  local effect = readBytes(c[f.base] + f.off - 1, 1)
  local info = WP26.valueRows[row.ID]
  if info and info.targetEffect052 == effect and info.targetLang052 == WP26.lang then
    return
  end
  if info then
    info.targetEffect052 = effect
    info.targetLang052 = WP26.lang
  end
  local choices = WP26.relationRewardChoices062(effect)
  local rank = ({ 'S', 'A', 'B', 'C', 'D' })[f.relationEffectAmount + 1]
  local en = 'Rank ' .. rank .. ': ' .. (effect == 11 and 'Umasona' or effect == 12 and 'Trait' or 'Amount')
  local ja = 'ランク'
    .. rank
    .. '：'
    .. (effect == 11 and 'ウマソナ' or effect == 12 and '特性' or '効果量')
  row.Description = WP26.T(en, ja)
  for _, d in ipairs(WP26.dyn) do
    if d.mr == row then
      d.en = en
      d.ja = ja
    end
  end
  local lines = {}
  if choices then
    for _, r in ipairs(choices) do
      lines[#lines + 1] = r.id .. ':' .. (r.name or WP26.T(r.en, r.ja))
    end
  end
  row.DropDownList.Text = table.concat(lines, '\n')
  row.DropDownReadOnly = choices ~= nil
  row.DropDownDescriptionOnly = choices ~= nil
  row.DisplayAsDropDownListItem = choices ~= nil
end
function WP26.updateRelationTargets(c, slot, rank)
  for _, r in pairs(WP26.valueRows) do
    if r.key == c.key and r.session.id == c.id then
      local f = WP26.EDITORS[r.key].fields[r.index]
      if
        f.relationEffectAmount ~= nil
        and (slot == nil or f.horseRelationSlot == slot)
        and (rank == nil or f.relationEffectAmount == rank)
        and c[f.base]
      then
        local row = r.id and getAddressList().getMemoryRecordByID(r.id)
        if row then
          WP26.decorateRelationTarget(c, f, row)
        end
      end
    end
  end
end
local add052 = WP26.addNativeField
function WP26.addNativeField(parent, key, index, c, session)
  local row = add052(parent, key, index, c, session)
  WP26.decorateRelationTarget(c, WP26.EDITORS[key].fields[index], row)
  return row
end
local write052 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if f.relationEffectAmount ~= nil then
    local effect = readBytes(c[f.base] + f.off - 1, 1)
    local choices = WP26.relationRewardChoices062(effect)
    if choices then
      local found = false
      for _, r in ipairs(choices) do
        if r.id == v then
          found = true
        end
      end
      assert(found, 'Invalid named relationship reward')
    end
  end
  local result = write052(c, f, v, journal)
  if f.relationEffectRank ~= nil then
    WP26.updateRelationTargets(c, f.horseRelationSlot, f.relationEffectRank)
  end
  return result
end
local undo052 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  local result = undo052()
  if h and h.kind == 'horseRelation' and h.field.relationEffectRank ~= nil then
    WP26.updateRelationTargets(WP26.context(h.ctx.key, h.ctx.id), h.field.horseRelationSlot, h.field.relationEffectRank)
  end
  return result
end
local lang052 = WP26.applyLang
function WP26.applyLang()
  lang052()
  local done = {}
  for _, r in pairs(WP26.valueRows) do
    local f = WP26.EDITORS[r.key].fields[r.index]
    if f.relationEffectAmount ~= nil and not done[r.key] then
      done[r.key] = true
      local ok, c = pcall(WP26.context, r.key, r.session.id)
      if ok then
        WP26.updateRelationTargets(c)
      end
    end
  end
end

WP26.SPEC.horsePersonalitySet = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 0E 7D 20 0F B7 C1 83 E2 0F 48 6B C8 38 48 8B 05 E8 77 F7 03 C1 E2 05 81 64 01 08 1F',
}
WP26.SPEC.weakSlowStartSet = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 87 55 E0 03',
}
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.sire.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.mare.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.ownedSire.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.ownedMare.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.foal.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.ownedFoal.fields, {
  ['en'] = 'Personality',
  ['ja'] = '性格',
  ['off'] = 8,
  ['bit'] = 5,
  ['bits'] = 4,
  ['max'] = 13,
  ['base'] = 'horse',
  ['setter'] = 'horsePersonalitySet',
  ['groupEn'] = 'Temperament and personality',
  ['groupJa'] = '気性・性格',
  ['optionsJa'] = {
    '従順',
    '臆病',
    '真面目',
    '普通',
    '強気',
    '頑固',
    '熱血',
    'リーダー',
    '孤高',
    'マイペース',
    '繊細',
    '気まぐれ',
    'がんばり屋',
    '寂しがり屋',
  },
  ['optionsEn'] = {
    'Obedient',
    'Timid',
    'Serious',
    '普通',
    'Bold',
    'Stubborn',
    'Passionate',
    'Leader',
    'Loner',
    'Easygoing',
    'Sensitive',
    'Fickle',
    'Hard worker',
    'Lonely',
  },
  ['source'] = 'UI2BDF03 B94C0->187DA0; base getterA6F20/setterA6F50; native names39DC490',
})
table.insert(WP26.EDITORS.owned.fields, {
  ['en'] = 'Slow-start habit',
  ['ja'] = '出遅れ癖',
  ['off'] = 20,
  ['bit'] = 16,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakSlowStartSet',
  ['groupEn'] = 'Weaknesses',
  ['groupJa'] = '弱点',
  ['optionsJa'] = { 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'None', 'Improved', 'Present' },
  ['source'] = 'UI336CB2->9CFC0 reveal /C3EF0 actual; setterC3F60 stores race+14h bits16..17',
})
table.insert(WP26.EDITORS.race.fields, {
  ['en'] = 'Slow-start habit',
  ['ja'] = '出遅れ癖',
  ['off'] = 20,
  ['bit'] = 16,
  ['bits'] = 2,
  ['max'] = 2,
  ['base'] = 'race',
  ['raceSetter'] = 'weakSlowStartSet',
  ['groupEn'] = 'Weaknesses',
  ['groupJa'] = '弱点',
  ['optionsJa'] = { 'なし', '改善', 'あり' },
  ['optionsEn'] = { 'None', 'Improved', 'Present' },
  ['source'] = 'UI336CB2->9CFC0 reveal /C3EF0 actual; setterC3F60 stores race+14h bits16..17',
})
WP26.SPEC.family = {
  pattern = '0F B7 44 24 30 48 69 C0 8C 00 00 00 48 8B 0D FA EF DE 03 48 03 C8 48 8B C1 48 83 C4 28 C3 CC CC',
  disp = 15,
  len = 19,
  direct = false,
}
WP26.SPEC.familySexSet = {
  pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 29 CD 11 00 85 C0 75 02 EB 4A 83 7C 24 48 00 75 0A C7 44 24 20',
}
WP26.SPEC.familyBirthYearSet = {
  pattern = '66 89 54 24 10 66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 78 C0 11 00 85 C0 75 02 EB 13 0F B7 4C 24 30 E8 A8 A5 0E 00',
}
WP26.SPEC.familyTalentSet = {
  pattern = '44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 64 A6 11 00 85 C0 75 05 E9 C8 00 00 00 83 7C 24',
}

WP26.EDITORS.family =
  { record = 495, en = 'Family tree', ja = '家系図', data = 'family', stride = 140, max = 9999, fields = {} }
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Family name',
  ['ja'] = '姓',
  ['off'] = 12,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['source'] = '167FA0/167FE0; master person+0Ch raw CP932',
  ['string'] = true,
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Given name',
  ['ja'] = '名',
  ['off'] = 29,
  ['bit'] = 0,
  ['bits'] = 8,
  ['max'] = 16,
  ['source'] = '168030/168070; master person+1Dh raw CP932',
  ['string'] = true,
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Sex',
  ['ja'] = '性別',
  ['off'] = 72,
  ['bit'] = 1,
  ['bits'] = 1,
  ['max'] = 1,
  ['familySetter'] = 'familySexSet',
  ['optionsEn'] = { 'Male', 'Female' },
  ['optionsJa'] = { '男', '女' },
  ['source'] = '1683A0/168400; family UI8F8663',
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Birth year',
  ['ja'] = '生年',
  ['off'] = 68,
  ['bit'] = 0,
  ['bits'] = 16,
  ['min'] = 1800,
  ['max'] = 2200,
  ['familySetter'] = 'familyBirthYearSet',
  ['source'] = '169070/1690B0; master person+44h',
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Study aptitude',
  ['ja'] = '勉強能力',
  ['off'] = 80,
  ['bit'] = 0,
  ['bits'] = 3,
  ['max'] = 6,
  ['familySetter'] = 'familyTalentSet',
  ['familyIndex'] = 0,
  ['groupJa'] = '能力',
  ['groupEn'] = 'Abilities',
  ['source'] = 'UI8FA718/8FA7F2/8FA8C5 ->16AA30;16AAC0 index0',
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Sport aptitude',
  ['ja'] = '運動能力',
  ['off'] = 80,
  ['bit'] = 3,
  ['bits'] = 3,
  ['max'] = 6,
  ['familySetter'] = 'familyTalentSet',
  ['familyIndex'] = 1,
  ['groupJa'] = '能力',
  ['groupEn'] = 'Abilities',
  ['source'] = 'UI8FA718/8FA7F2/8FA8C5 ->16AA30;16AAC0 index1',
})
table.insert(WP26.EDITORS.family.fields, {
  ['en'] = 'Ranch aptitude',
  ['ja'] = '牧場能力',
  ['off'] = 80,
  ['bit'] = 6,
  ['bits'] = 3,
  ['max'] = 6,
  ['familySetter'] = 'familyTalentSet',
  ['familyIndex'] = 2,
  ['groupJa'] = '能力',
  ['groupEn'] = 'Abilities',
  ['source'] = 'UI8FA718/8FA7F2/8FA8C5 ->16AA30;16AAC0 index2',
})

local context054 = WP26.context
function WP26.context(key, id)
  if key ~= 'family' then
    return context054(key, id)
  end
  WP26.require()
  assert(type(id) == 'number' and id % 1 == 0 and id >= 0 and id < WP26.entityCount180('family'), 'Invalid family member')
  local p = WP26.data('family') + id * 140
  assert(WP26.bits(p, 72, 0, 1) == 1, 'Family member unavailable')
  return { key = key, id = id, primary = p }
end
local name054 = WP26.entityName
function WP26.entityName(key, id, c)
  if key == 'family' then
    return WP26.nameText(c.primary + 12, 16) .. WP26.nameText(c.primary + 29, 16)
  end
  return name054(key, id, c)
end
local rows054 = WP26.editorRows
function WP26.editorRows(key)
  if key ~= 'family' then
    return rows054(key)
  end
  WP26.require()
  local root = WP26.data('family')
  local b = readBytes(root, WP26.entityCount180('family') * 140, true)
  assert(b, 'Family table unavailable')
  local out = {}
  for id = 0, WP26.entityCount180('family') - 1 do
    if (b[id * 140 + 73] & 1) == 1 then
      local c = { primary = root + id * 140 }
      local name = WP26.entityName(key, id, c)
      if name ~= '' then
        out[#out + 1] = { id = id, name = name }
      end
    end
  end
  table.sort(out, function(a, b)
    return a.name < b.name
  end)
  return out
end
local write054 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.familySetter then
    return write054(c, f, v, journal)
  end
  WP26.require()
  assert(
    c.key == 'family' and type(v) == 'number' and v % 1 == 0 and v >= (f.min or 0) and v <= f.max,
    'Invalid family value'
  )
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary)
  local before = readBytes(c.primary, 140, true)
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  if f.familyIndex ~= nil then
    WP26.native(f.familySetter, c.id, f.familyIndex, v)
  else
    WP26.native(f.familySetter, c.id, v)
  end
  if WP26.fieldRead(c, f) ~= v then
    if f.familyIndex ~= nil then
      WP26.native(f.familySetter, c.id, f.familyIndex, old)
    else
      WP26.native(f.familySetter, c.id, old)
    end
    error('Family update verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'family054',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      before = before,
      after = readBytes(c.primary, 140, true),
    }
  end
end
local undo054 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'family054' then
    return undo054()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  local now = readBytes(c.primary, 140, true)
  for i, v in ipairs(h.after) do
    assert(now[i] == v, 'Family data changed')
  end
  if h.field.familyIndex ~= nil then
    WP26.native(h.field.familySetter, c.id, h.field.familyIndex, h.old)
  else
    WP26.native(h.field.familySetter, c.id, h.old)
  end
  now = readBytes(c.primary, 140, true)
  for i, v in ipairs(h.before) do
    assert(now[i] == v, 'Family restoration failed')
  end
  WP26.history[#WP26.history] = nil
end
-- Keep the existing heading in the game's category order, and give it the normal editor lifecycle.
WP26.NAMES[495] = { 'Family tree', '家系図' }
-- Native personality enumeration index3 is 普通.
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare', 'ownedSire', 'ownedMare', 'foal', 'ownedFoal' }) do
  for _, f in ipairs(WP26.EDITORS[key].fields) do
    if f.setter == 'horsePersonalitySet' then
      f.optionsEn[4] = 'Normal'
    end
  end
end

function WP26.steamAchievementState()
  local stats = WP26.steamInterface()
  local utils = WP26.steamCall('SteamAPI_SteamUtils_v010')
  assert(utils and utils ~= 0, 'Steam utilities unavailable')
  assert(WP26.steamCall('SteamAPI_ISteamUtils_GetAppID', utils) == 3839710, 'Steam application mismatch')
  local n = WP26.steamCall('SteamAPI_ISteamUserStats_GetNumAchievements', stats)
  assert(n >= 1 and n <= 1000, 'Unexpected achievement count')
  local scratch = WP26.steamScratch055
  if not scratch or scratch.pid ~= WP26.pid then
    scratch = { pid = WP26.pid, address = assert(allocateMemory(4096), 'Steam status buffer unavailable') }
    WP26.steamScratch055 = scratch
  end
  local rows = {}
  local unlocked = 0
  for i = 0, n - 1 do
    local ptr = WP26.steamCall('SteamAPI_ISteamUserStats_GetAchievementName', stats, i)
    local name = ptr and readString(ptr, 256)
    assert(name and name ~= '', 'Achievement name unavailable')
    writeBytes(scratch.address, 0)
    local ok = WP26.steamCall('SteamAPI_ISteamUserStats_GetAchievement', stats, ptr, scratch.address)
    assert((ok & 255) ~= 0, 'Achievement state unavailable')
    local value = readBytes(scratch.address, 1) ~= 0
    rows[#rows + 1] = { ptr = ptr, name = name, unlocked = value }
    if value then
      unlocked = unlocked + 1
    end
  end
  return { stats = stats, total = n, unlocked = unlocked, rows = rows }
end
function WP26.achievements(unlock)
  local state = WP26.steamAchievementState()
  local changed = 0
  if unlock then
    for _, r in ipairs(state.rows) do
      if not r.unlocked then
        local ok = WP26.steamCall('SteamAPI_ISteamUserStats_SetAchievement', state.stats, r.ptr)
        assert((ok & 255) ~= 0, 'Achievement update failed: ' .. r.name)
        changed = changed + 1
      end
    end
    if changed > 0 then
      local ok = WP26.steamCall('SteamAPI_ISteamUserStats_StoreStats', state.stats)
      assert((ok & 255) ~= 0, 'Steam save request failed')
    end
    state = WP26.steamAchievementState()
    assert(state.unlocked == state.total, 'Achievement readback mismatch')
    WP26.msg(
      'Unlocked achievements: ' .. state.unlocked .. ' / ' .. state.total,
      '実績解除：' .. state.unlocked .. '／' .. state.total
    )
  else
    WP26.msg(
      'Achievements: ' .. state.unlocked .. ' / ' .. state.total,
      '実績：' .. state.unlocked .. '／' .. state.total
    )
  end
  return state
end

WP26.START_ROLL057 = {
  ['late'] = {
    hex = '9c50515241524153ff05e2000000488b05e30000008338010f859d00000089d983f9120f8392000000488b05d80000004c8b104c3b15d6000000757f418b425083f801727683f812777139c1736d488b05cb00000038087462410fb7944a48ba000081fa851a00007351488b058f0000008b003dffff0000740439d0753d488b0593000000488b00483d00000100722b4869d2e80000008b44102425ff1f000083f82e7516ff0549000000415b415a5a59589d0fb7c083f800eb0d415b415a5a59589d0fb7c039f87d1250488b056600000080080158ff254c000000ff254e000000660f1f4400005750524f4c4c35360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    dataOffset = 240,
    size = 320,
    site = 11307010,
    resume = 11307028,
    skip = 11307225,
    flag = 75402650,
    original = '0fb7c03bc70f8dcc000000800d8605d20301',
  },
  ['good'] = {
    hex = '9c50515241524153ff05ea000000488b05eb0000008338010f85a40000004489f983f9120f8398000000488b05df0000004c8b104c3b15dd0000000f8581000000418b425083f801727883f812777339c1736f488b05ce00000038087464410fb7944a48ba000081fa851a00007353488b05920000008b003dffff0000740439d0753f488b0596000000488b00483d00000100722d4869d2e80000008b44102425ff1f000083f82e7518ff054c000000415b415a5a59589d0fb7c03d00000100eb0d415b415a5a59589d0fb7c039d87d1250488b056700000080080258ff254d000000ff254f0000000f1f80000000005750524f4c4c35360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    dataOffset = 248,
    size = 328,
    site = 11308607,
    resume = 11308625,
    skip = 11308846,
    flag = 75402650,
    original = '0fb7c03bc30f8de4000000800d49ffd10302',
  },
}

for _, f in ipairs(WP26.EDITORS.family.fields) do
  if f.familyIndex ~= nil then
    f.optionsJa = { 'Ｅ', 'Ｄ', 'Ｃ', 'Ｂ', 'Ａ', 'Ｓ', 'SS' }
    f.optionsEn = { 'E', 'D', 'C', 'B', 'A', 'S', 'SS' }
  end
end

for _, key in ipairs({ 'owned', 'race', 'sire', 'mare', 'ownedSire', 'ownedMare' }) do
  for slot = 1, 6 do
    table.insert(WP26.EDITORS[key].fields, {
      en = 'Relationship progress (%)',
      ja = '相関進行度（％）',
      off = 7,
      bit = 0,
      bits = 8,
      max = 100,
      base = 'horseRelation' .. slot,
      horseRelationSlot = slot,
      groupJa = '名馬相関 ' .. slot,
      groupEn = 'Relationship ' .. slot,
      source = 'UI32B566..582 record+7 current/+8 previous ->328E10;32905C..32908B divides current/previous by100 for195A30 gauge; rankA/S gauge hidden',
    })
  end
end

WP26.SPEC.foalAgeSet = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 20 83 FA 01 77 1B 0F B7 C1 C1 E2 1F 48 8D 0C 40 48 8B 05 B8 27 F5 03 81 24 C8 FF FF FF 7F 09',
}
WP26.SPEC.foalSexSet = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 22 83 FA 02 7D 1D 0F B7 C1 C1 E2 1F 48 8D 0C 40 48 8B 05 B8 26 F5 03 81 64 C8 08 FF FF FF 7F',
}
for _, key in ipairs({ 'foal', 'ownedFoal' }) do
  table.insert(WP26.EDITORS[key].fields, {
    en = 'Age',
    ja = '馬齢',
    off = 0,
    bit = 31,
    bits = 1,
    max = 1,
    foalSetter = 'foalAgeSet',
    optionsJa = { '0歳', '1歳' },
    optionsEn = { '0 years', '1 year' },
    source = 'Sex-age formatter188935 ->D82C0; native setterD82F0; foal DWORD0 bit31',
  })
  table.insert(WP26.EDITORS[key].fields, {
    en = 'Sex',
    ja = '性別',
    off = 8,
    bit = 31,
    bits = 1,
    max = 1,
    foalSetter = 'foalSexSet',
    optionsJa = { '牡', '牝' },
    optionsEn = { 'Colt', 'Filly' },
    source = 'Sex-age formatter188948 ->D83C0->187F00; native setterD83F0; foal DWORD8 bit31',
  })
end
local write059 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.foalSetter then
    return write059(c, f, v, journal)
  end
  WP26.require()
  assert(
    (c.key == 'foal' or c.key == 'ownedFoal') and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max,
    'Invalid foal value'
  )
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary and fresh.horseID == c.horseID, 'Foal changed')
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  local before = readBytes(c.primary, 24, true)
  WP26.native(f.foalSetter, c.id, v)
  if WP26.fieldRead(c, f) ~= v then
    WP26.native(f.foalSetter, c.id, old)
    error('Foal update verification failed', 0)
  end
  WP26.foalNameCache = nil
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'foal059',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      before = before,
      after = readBytes(c.primary, 24, true),
    }
  end
end
local undo059 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'foal059' then
    return undo059()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.horseID == h.ctx.horseID, 'Foal changed')
  local actual = readBytes(c.primary, 24, true)
  for i, v in ipairs(h.after) do
    assert(actual[i] == v, 'Foal data changed')
  end
  WP26.native(h.field.foalSetter, c.id, h.old)
  actual = readBytes(c.primary, 24, true)
  for i, v in ipairs(h.before) do
    assert(actual[i] == v, 'Foal restoration failed')
  end
  WP26.foalNameCache = nil
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.umasonaDefinitions = { pattern = '48 8B 05 59 60 C4 03 C3', disp = 3, len = 7, direct = false }

function WP26.relationRewardChoices062(effect)
  if effect ~= 11 then
    return WP26.relationTargetChoices052[effect]
  end
  if not WP26.positiveUmasona062 or WP26.positiveUmasona062.pid ~= WP26.pid then
    WP26.require()
    local manager = WP26.data('umasonaDefinitions')
    local root = readQword(manager + 16)
    assert(root and root > 65536, 'Umasona definitions unavailable')
    local bytes = readBytes(root, 93 * 432, true)
    assert(bytes, 'Umasona definition read failed')
    local positive = {}
    local choices = { { id = 0, en = 'Random', ja = 'ランダム' } }
    for i = 0, 92 do
      local off = i * 432
      local id = bytes[off + 1] | (bytes[off + 2] << 8) | (bytes[off + 3] << 16) | (bytes[off + 4] << 24)
      local kind = bytes[off + 41] | (bytes[off + 42] << 8) | (bytes[off + 43] << 16) | (bytes[off + 44] << 24)
      if id > 0 and id <= 92 and kind == 1 then
        positive[id] = true
      end
    end
    for _, r in ipairs(WP26.relationTargetChoices052[11]) do
      if r.id > 0 and positive[r.id] then
        choices[#choices + 1] = r
      end
    end
    assert(#choices > 1 and #choices < 93, 'Unexpected positive Umasona count')
    WP26.positiveUmasona062 = { pid = WP26.pid, root = root, choices = choices, ids = positive }
  end
  return WP26.positiveUmasona062.choices
end

WP26.SPEC.horseSpiritSet063 = {
  pattern = '48 83 EC 28 B8 FA 32 00 00 44 8B DA 66 3B C8 72 37 74 5E B8 2D 33 00 00 66 3B C8 73 09 83 3D 5C 75 E0 03 00 75 22 BA 2E 33 00 00 0F B7 C1 66 2B C2 66 83 F8 01 76 11 BA 30 33 00 00 0F B7 C1 66 2B C2 66 83 F8 63 77 29',
}
local readSpirit063 = WP26.fieldRead
function WP26.fieldRead(c, f)
  local value = readSpirit063(c, f)
  if f.signedSpirit063 and value >= 128 then
    return value - 256
  end
  return value
end
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, {
    en = 'Fighting spirit',
    ja = '気合',
    off = 0x17,
    bit = 0,
    bits = 8,
    min = -120,
    max = 120,
    base = 'race',
    raceSetter = 'horseSpiritSet063',
    signedSpirit063 = true,
    groupEn = 'Condition',
    groupJa = 'コンディション',
    source = 'Debug column3 気合: 3A99F58->710F40/71101E->C1F10; C1F90 signed byte -120..120; gradeC2080',
  })
end

WP26.RACE_SPIRIT064 = {
  ['hex'] = '9c5051524150415141524153ff059e000000488b059f00000083380175640fb79424c802000081fa851a00007354488b058b0000008b003dffff0000740439c27540488b057f000000488b00483d00000100722e4869d2e80000008b44102425ff1f000083f82e7519ff0545000000415b415a415941585a59589dba78000000eb0e415b415a415941585a59589d89c2488b8c2480020000ff1532000000ff25340000000f1f40005350495249543634000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  ['dataOffset'] = 176,
  ['size'] = 224,
  ['site'] = 11229860,
  ['resume'] = 11229875,
  ['setter'] = 12430448,
  ['original'] = '8bd0488b8c2480020000e8bd511200',
}

WP26.PACE_GUARD066 = {
  ['hex'] = '9c5051524150415141524153ff0536010000488b05370100008338010f85eb000000488b05370100004c8b104c3b15350100000f85d4000000418b4a5083f9010f82c700000083f9120f87be000000488b051a0100004c8b184d39d80f85ab000000410fb6930801000039ca0f839b000000458b4b044183f9010f8c8d00000041837c930c000f85810000004531c0438b44830c4401c8707485c07e7041ffc04139c872ea410fb7945248ba000081fa851a00007357488b059b0000008b003dffff0000740439d07543488b05a7000000488b00483d0000010072314869d2e80000008b44102425ff1f000083f82e751cff0555000000415b415a415941585a59589d4183f901ff2573000000415b415a415941585a59589d4183f9017517488b056a000000488b000fb6908b000000ff2552000000ff25440000000f1f400057505041434536360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
  ['dataOffset'] = 328,
  ['size'] = 408,
  ['site'] = 11298465,
  ['skip'] = 11298530,
  ['resume'] = 11298485,
  ['original'] = '4183f901753b488b059a27d2030fb6908b000000',
}

function WP26.racePayloadIdentity066()
  return table.concat({
    WP26.RACE_PAYLOAD.hex,
    WP26.START_ROLL057.late.hex,
    WP26.START_ROLL057.good.hex,
    WP26.RACE_SPIRIT064.hex,
    WP26.PACE_GUARD066.hex,
  }, ':')
end

WP26.SPEC.jockeyFoundationSet067 = {
  pattern = '48 83 EC 28 45 8B D0 0F B7 C1 41 B8 4A 02 00 00 66 41 2B C0 41 B8 0E 01 00 00 66 41 3B C0 0F 86 A1 00 00 00 B8 59 03 00 00 66 3B C8 72 2C 0F 84',
}
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Escape / front (base value)',
  ['ja'] = '逃げ・先行（基礎値）',
  ['off'] = 16,
  ['bit'] = 22,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyFoundation067'] = 0,
  ['groupEn'] = 'Tactics foundation',
  ['groupJa'] = '戦法の基礎値',
  ['source'] = '123540/1235F0, separate from123710 experience; raceAB76A0/AB78A3 andB52190/B523C9;0..3',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Front / stalk (base value)',
  ['ja'] = '先行・差し（基礎値）',
  ['off'] = 16,
  ['bit'] = 24,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyFoundation067'] = 1,
  ['groupEn'] = 'Tactics foundation',
  ['groupJa'] = '戦法の基礎値',
  ['source'] = '123540/1235F0, separate from123710 experience; raceAB76A0/AB78A3 andB52190/B523C9;0..3',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Stalk / close (base value)',
  ['ja'] = '差し・追込（基礎値）',
  ['off'] = 16,
  ['bit'] = 26,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyFoundation067'] = 2,
  ['groupEn'] = 'Tactics foundation',
  ['groupJa'] = '戦法の基礎値',
  ['source'] = '123540/1235F0, separate from123710 experience; raceAB76A0/AB78A3 andB52190/B523C9;0..3',
})

function WP26.cancelRecordDeactivate(id)
  local timers = WP26.recordDeactivateTimers
  local timer = timers and timers[id]
  if timer then
    timers[id] = nil
    if WP26.uiTimers then
      WP26.uiTimers[timer] = nil
    end
    timer.destroy()
  end
end
function WP26.deferRecordDeactivate(record, delay)
  local id = type(record) == 'number' and record or record.ID
  WP26.cancelRecordDeactivate(id)
  WP26.uiTimers = WP26.uiTimers or {}
  WP26.recordDeactivateTimers = WP26.recordDeactivateTimers or {}
  local timer = createTimer(nil, false)
  timer.Interval = delay or 150
  WP26.uiTimers[timer] = true
  WP26.recordDeactivateTimers[id] = timer
  timer.OnTimer = function(t)
    WP26.uiTimers[t] = nil
    if WP26.recordDeactivateTimers[id] ~= t then
      t.destroy()
      return
    end
    WP26.recordDeactivateTimers[id] = nil
    t.destroy()
    local current = getAddressList().getMemoryRecordByID(id)
    if current then
      pcall(function()
        current.Active = false
      end)
    end
  end
  timer.Enabled = true
end

WP26.SPEC.jockeyDistanceFoundationSet069 = {
  pattern = '48 83 EC 28 B8 59 03 00 00 45 8B D0 66 3B C8 72 30 0F 84 BF 00 00 00 B8 6A 03 00 00 66 3B C8 77 09 83 3D F8 4E DA 03 00 75 17 41 B8 6B 03 00 00',
}
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Sprint (base value)',
  ['ja'] = '短距離（基礎値）',
  ['off'] = 24,
  ['bit'] = 27,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyDistanceFoundation069'] = 0,
  ['groupEn'] = 'Distance foundation',
  ['groupJa'] = '距離の基礎値',
  ['source'] = '124520/1245F0; separate from1246E0 experience; B5286A/B5287C consume both; 0..3',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Mile (base value)',
  ['ja'] = 'マイル（基礎値）',
  ['off'] = 24,
  ['bit'] = 29,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyDistanceFoundation069'] = 1,
  ['groupEn'] = 'Distance foundation',
  ['groupJa'] = '距離の基礎値',
  ['source'] = '124520/1245F0; separate from1246E0 experience; B5286A/B5287C consume both; 0..3',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Middle distance (base value)',
  ['ja'] = '中距離（基礎値）',
  ['off'] = 12,
  ['bit'] = 22,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyDistanceFoundation069'] = 2,
  ['groupEn'] = 'Distance foundation',
  ['groupJa'] = '距離の基礎値',
  ['source'] = '124520/1245F0; separate from1246E0 experience; B5286A/B5287C consume both; 0..3',
})
table.insert(WP26.EDITORS.jockey.fields, {
  ['en'] = 'Long distance (base value)',
  ['ja'] = '長距離（基礎値）',
  ['off'] = 12,
  ['bit'] = 24,
  ['bits'] = 2,
  ['max'] = 3,
  ['personOrdinaryOnly'] = true,
  ['jockeyDistanceFoundation069'] = 3,
  ['groupEn'] = 'Distance foundation',
  ['groupJa'] = '距離の基礎値',
  ['source'] = '124520/1245F0; separate from1246E0 experience; B5286A/B5287C consume both; 0..3',
})

WP26.SPEC.foalBreederSet070 = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 33 B8 11 01 00 00 66 3B D0 77 29 0F B7 C1 48 8D 0C 40 48 8B 05 16 25 F5 03 81 64 C8 08 FF 07',
}
WP26.SPEC.foalStablingSet070 = {
  pattern = 'B8 70 0D 00 00 44 0F B7 C2 66 3B C8 73 52 0F B7 C1 48 8D 0C 40 48 8B 05 9C 3F F5 03 0F B7 14 C8 B8 FF 7F 00 00 66 23 D0',
}
WP26.SPEC.foalTransactionSet070 = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 1F 83 FA 06 7D 1A 0F B7 C1 83 E2 07 48 8D 0C 40 48 8B 05 F8 2D F5 03 83 64 C8 14 F8 09 54 C8',
}
WP26.SPEC.horseOriginSet070 = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 25 83 FA 0C 7D 20 0F B7 C1 83 E2 0F 48 6B C8 38 48 8B 05 78 77 F7 03 C1 E2 0E 81 64 01 08 FF',
}
WP26.SPEC.farmNameDefinitions070 =
  { pattern = '48 8B 0D B9 4C F2 03 BA 25 00 00 00 85 C0 74 31 66 3B DF 0F 83 EE 00 00', disp = 3, len = 7 }
function WP26.farmChoices070()
  local main = WP26.data('farm')
  local foreign = WP26.data('farmNameDefinitions070')
  local rows = {}
  local ordinary = WP26.entityCount180('farm')
  local total = WP26.entityCount180('farmAll')
  for id = 0, total - 1 do
    local a = id < ordinary and main + id * 204 + 16 or foreign + (id - ordinary) * 32 + 4
    local name = WP26.nameText(a, id < ordinary and 12 or 28)
    if name ~= '' and not name:find('[%z\1-\31]') then
      rows[#rows + 1] = { id = id, name = name }
    end
  end
  rows[#rows + 1] = { id = total, name = WP26.T('None', 'なし') }
  return rows
end
for _, key in ipairs({ 'foal', 'ownedFoal' }) do
  local fields = WP26.EDITORS[key].fields
  table.insert(fields, {
    en = 'Breeder',
    ja = '生産者',
    off = 8,
    bit = 11,
    bits = 9,
    max = 273,
    foalDetailSetter070 = 'foalBreederSet070',
    farmChoices070 = true,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'UI7156DB ->D8550;D8590; foal+8 bit11..19',
  })
  table.insert(fields, {
    en = 'Stabling farm',
    ja = '繋養先',
    base = 'horse',
    off = 16,
    bit = 22,
    bits = 9,
    max = 273,
    foalDetailSetter070 = 'foalStablingSet070',
    farmChoices070 = true,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'UI7156F5 ->D6AB0;D6B10; horse+10h bit22..30',
  })
  table.insert(fields, {
    en = 'Transaction type',
    ja = '取引形態',
    off = 20,
    bit = 0,
    bits = 3,
    max = 5,
    foalDetailSetter070 = 'foalTransactionSet070',
    optionsJa = { 'なし', '自家生産', '庭先取引', '国内セリ', '海外セリ', '金銭譲渡' },
    optionsEn = { 'None', 'Homebred', 'Private sale', 'Domestic auction', 'Overseas auction', 'Monetary transfer' },
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'UI71570F ->D7C80 ->188280 native6labels;D7CB0; foal+14h bit0..2',
  })
end
local add070 = WP26.addNativeField
function WP26.addNativeField(parent, key, index, ctx, session)
  local f = WP26.EDITORS[key].fields[index]
  if f.farmChoices070 then
    f.choices = WP26.farmChoices070()
  end
  return add070(parent, key, index, ctx, session)
end
local write070 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.foalDetailSetter070 then
    return write070(c, f, v, journal)
  end
  WP26.require()
  assert(
    (c.key == 'foal' or c.key == 'ownedFoal') and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max,
    'Invalid foal detail'
  )
  if f.displayScale and v % f.displayScale ~= 0 then
    error(
      WP26.T(
        'Use increments of ' .. f.displayScale .. '.',
        '値は' .. f.displayScale .. '刻みで入力してください。'
      ),
      0
    )
  end
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary and fresh.horseID == c.horseID, 'Foal identity changed')
  if f.farmChoices070 then
    local valid = false
    for _, r in ipairs(WP26.farmChoices070()) do
      if r.id == v then
        valid = true
        break
      end
    end
    assert(valid, 'Farm unavailable')
  end
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  local before = assert(readBytes(c.primary, 24, true))
  local horseBefore = assert(readBytes(c.horse, 56, true))
  WP26.native(f.foalDetailSetter070, c.id, v)
  if WP26.fieldRead(c, f) ~= v then
    WP26.native(f.foalDetailSetter070, c.id, old)
    error('Foal detail update failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'foalDetail070',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      new = v,
      before = before,
      after = readBytes(c.primary, 24, true),
      horseBefore = horseBefore,
      horseAfter = readBytes(c.horse, 56, true),
    }
  end
end
local undo070 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'foalDetail070' then
    return undo070()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.horseID == h.ctx.horseID, 'Foal identity changed')
  local function equal(a, expected)
    local actual = assert(readBytes(a, #expected, true))
    for i, v in ipairs(expected) do
      assert(actual[i] == v, 'Foal detail data changed')
    end
  end
  equal(c.primary, h.after)
  equal(c.horse, h.horseAfter)
  WP26.native(h.field.foalDetailSetter070, c.id, h.old)
  equal(c.primary, h.before)
  equal(c.horse, h.horseBefore)
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.foalTransactionPriceSet070 = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 36 81 FA 40 42 0F 00 73 2E 0F B7 C1 48 8D 0C 40 48 8B 05 C8 30 F5 03 81 64 C8 0C 00 C0 FF FF',
}
for _, key in ipairs({ 'foal', 'ownedFoal' }) do
  table.insert(WP26.EDITORS[key].fields, {
    ['en'] = 'Transaction price (10,000 yen)',
    ['ja'] = '取引額（万円）',
    ['off'] = 12,
    ['bit'] = 0,
    ['bits'] = 14,
    ['max'] = 999900,
    ['displayScale'] = 100,
    ['foalDetailSetter070'] = 'foalTransactionPriceSet070',
    ['groupEn'] = 'Profile and transaction',
    ['groupJa'] = '出身・取引',
    ['source'] = 'UI71547E ->D79A0 x100 ->18AF60; nativeD79E0 /100; stored0..9999',
  })
end
for _, key in ipairs({ 'owned', 'ownedFoal', 'ownedMare', 'ownedSire', 'race', 'foal', 'mare', 'sire' }) do
  table.insert(WP26.EDITORS[key].fields, 1, {
    ['en'] = 'Origin',
    ['ja'] = '出身',
    ['off'] = 8,
    ['bit'] = 14,
    ['bits'] = 4,
    ['max'] = 11,
    ['base'] = 'horse',
    ['setter'] = 'horseOriginSet070',
    ['optionsJa'] = {
      '日本',
      '米国',
      '英国',
      '愛国',
      '仏国',
      '豪州',
      '独国',
      '伊国',
      '香港',
      'UAE',
      '加国',
      '南米',
    },
    ['optionsEn'] = {
      'Japan',
      'USA',
      'UK',
      'Ireland',
      'France',
      'Australia',
      'Germany',
      'Italy',
      'Hong Kong',
      'UAE',
      'Canada',
      'South America',
    },
    ['groupEn'] = 'Profile and transaction',
    ['groupJa'] = '出身・取引',
    ['source'] = 'UI71155E ->B95E0 ->187A00 twelve labels; A6F90/A6FC0 horse+8 bit14..17',
  })
end

WP26.SPEC.raceBreederSet071 = {
  pattern = '48 83 EC 28 44 0F B7 DA 0F B7 C1 BA 86 1A 00 00 66 2B C2 BA 73 18 00 00 66 3B C2 77 34 B9 11 01 00 00 66 44 3B D9 0F 87',
}
WP26.SPEC.raceTransactionSet071 = {
  pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D E7 71 E0 03',
}
WP26.SPEC.horseStablingSet071 = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2F B8 11 01 00 00 66 3B D0 77 25 0F B7 C1 4C 6B C0 38 0F B7 C2 4C 03 05 33 79 F7 03 25 FF 01',
}
for _, key in ipairs({ 'owned', 'race' }) do
  table.insert(WP26.EDITORS[key].fields, 2, {
    en = 'Breeder',
    ja = '生産者',
    off = 40,
    bit = 10,
    bits = 9,
    max = 273,
    base = 'race',
    raceSetter = 'raceBreederSet071',
    farmChoices070 = true,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'UI2B332F/2B3342 ->BBA80;BBB30; race+28h bit10..18',
  })
  table.insert(WP26.EDITORS[key].fields, 3, {
    en = 'Transaction type',
    ja = '取引形態',
    off = 24,
    bit = 20,
    bits = 3,
    max = 5,
    base = 'race',
    raceSetter = 'raceTransactionSet071',
    optionsJa = { 'なし', '自家生産', '庭先取引', '国内セリ', '海外セリ', '金銭譲渡' },
    optionsEn = { 'None', 'Homebred', 'Private sale', 'Domestic auction', 'Overseas auction', 'Monetary transfer' },
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'UI7130A4 ->C2290/C2300; race+18h bit20..22; retired records are not accepted by this accessor',
  })
end
for _, key in ipairs({ 'owned', 'race', 'sire', 'mare', 'ownedSire', 'ownedMare' }) do
  table.insert(WP26.EDITORS[key].fields, 3, {
    en = 'Stabling farm',
    ja = '繋養先',
    off = 16,
    bit = 22,
    bits = 9,
    max = 273,
    base = 'horse',
    horseStabling071 = true,
    farmChoices070 = true,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'A6DC0/A6E00 horse+10h bit22..30; same storage as foal D6AB0/D6B10',
  })
end
local write071 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not (f.profileSetter071 or f.horseStabling071) then
    return write071(c, f, v, journal)
  end
  WP26.require()
  assert(type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= 273, 'Invalid farm')
  local valid = false
  for _, r in ipairs(WP26.farmChoices070()) do
    if r.id == v then
      valid = true
      break
    end
  end
  assert(valid, 'Farm unavailable')
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.primary == c.primary and fresh.horseID == c.horseID, 'Horse identity changed')
  if f.profileSetter071 then
    assert(
      fresh.pastRace == c.pastRace and fresh.profilePublicID071 == c.profilePublicID071,
      'Past-race identity changed'
    )
  end
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  local a = f.profileSetter071 and c.pastRace or c.horse
  local size = f.profileSetter071 and 52 or 56
  local before = assert(readBytes(a, size, true))
  local fn = f.profileSetter071 or 'horseStablingSet071'
  local id = f.profileSetter071 and c.profilePublicID071 or c.horseID
  WP26.native(fn, id, v)
  if WP26.fieldRead(c, f) ~= v then
    WP26.native(fn, id, old)
    error('Horse profile update failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'profile071',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      new = v,
      address = a,
      before = before,
      after = readBytes(a, size, true),
      fn = fn,
      nativeID = id,
    }
  end
end
local undo071 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'profile071' then
    return undo071()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local key = h.ctx.key == 'ownedMare' and 'mare' or h.ctx.key == 'ownedSire' and 'sire' or h.ctx.key
  local c = WP26.context(key, h.ctx.id)
  assert(c.horseID == h.ctx.horseID and c.primary == h.ctx.primary, 'Horse identity changed')
  local a = h.field.profileSetter071 and c.pastRace or c.horse
  assert(a == h.address, 'Horse profile address changed')
  local function equal(expected)
    local actual = assert(readBytes(a, #expected, true))
    for i, v in ipairs(expected) do
      assert(actual[i] == v, 'Horse profile data changed')
    end
  end
  equal(h.after)
  WP26.native(h.fn, h.nativeID, h.old)
  equal(h.before)
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.raceFatherSet072 = {
  pattern = '48 83 EC 28 44 0F B7 DA 0F B7 C1 BA 86 1A 00 00 66 2B C2 BA 73 18 00 00 66 3B C2 77 37 B9 D0 07 00 00 66 44 3B D9 0F 87',
}
WP26.SPEC.raceMotherSet072 = {
  pattern = '48 83 EC 28 44 8B 05 75 F1 E0 03 0F B7 C1 44 0F B7 DA BA FB 32 00 00 66 2B C2 66 83 F8 32 77 05 45 85 C0 75 42 BA 85 1A',
}
WP26.SPEC.foalFatherSet072 = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 30 B8 D0 07 00 00 66 3B D0 77 26 0F B7 C1 48 8D 0C 40 48 8B 05 36 26 F5 03 81 64 C8 08 00 F8',
}
WP26.SPEC.foalMotherSet072 = {
  pattern = 'B8 70 0D 00 00 66 3B C8 73 30 B8 10 27 00 00 66 3B D0 77 26 0F B7 C1 48 8D 0C 40 48 8B 05 56 2F F5 03 81 64 C8 04 00 C0',
}
WP26.SPEC.pedigreeFatherSet072 = {
  pattern = '81 F9 A0 86 01 00 73 2D 81 FA A0 86 01 00 72 08 81 FA FF FF 01 00 75 1D 8B C1 81 E2 FF FF 07 00 48 8D 0C 40 48 8B 05 9D',
}
WP26.SPEC.pedigreeMotherSet072 = {
  pattern = '81 F9 A0 86 01 00 73 2F 81 FA A0 86 01 00 72 08 81 FA FF FF 01 00 75 1F 8B C1 81 E2 FF FF 07 00 48 8D 0C 40 48 8B 05 2D',
}
WP26.SPEC.pedigree072 =
  { pattern = '48 8B 05 DD 09 F3 03 8B 04 C8 25 FF FF 07 00 C3 CC CC CC CC CC CC CC CC', disp = 3, len = 7 }
local context072 = WP26.context
function WP26.context(key, id)
  local c = context072(key, id)
  if key == 'sire' or key == 'mare' or key == 'ownedSire' or key == 'ownedMare' then
    local pedigree = WP26.bits(c.primary, 0, 0, 19)
    if pedigree < 100000 then
      c.pedigreeID072 = pedigree
      c.pedigree072 = WP26.data('pedigree072') + pedigree * 24
    end
  end
  return c
end
function WP26.pedigreeName072(id)
  if id >= 100000 then
    return WP26.T('None', 'なし')
  end
  local a = WP26.data('pedigree072') + id * 24 + 20
  return WP26.horseNamePart(readSmallInteger(a)) .. WP26.horseNamePart(readSmallInteger(a + 2))
end
function WP26.parentChoices072(c, f)
  local key = f.parentKind072 == 'father' and 'sire' or 'mare'
  local d = WP26.EDITORS[key]
  local root = WP26.data(d.data)
  local rows = {}
  local seen = {}
  for _, r in ipairs(WP26.editorRows(key)) do
    local p = key == 'sire' and assert(WP26.sirePointer181(r.id)) or root + r.id * d.stride
    local pedigree = WP26.bits(p, 0, 0, 19)
    local id = f.parentMaster072 and pedigree or r.id
    if pedigree < 100000 and not seen[id] and (f.parentMaster072 or id <= f.max) then
      rows[#rows + 1] = { id = id, name = r.name, pedigree072 = pedigree }
      seen[id] = true
    end
  end
  local none = f.parentMaster072 and 0x1ffff or key == 'sire' and 2000 or 10000
  rows[#rows + 1] = { id = none, name = WP26.T('None', 'なし') }
  if f.parentMaster072 then
    local current = WP26.fieldRead(c, f)
    if current < 100000 and not seen[current] then
      rows[#rows + 1] = { id = current, name = WP26.pedigreeName072(current), pedigree072 = current }
    end
  end
  return rows
end
for _, key in ipairs({ 'owned', 'race', 'foal', 'ownedFoal', 'sire', 'mare', 'ownedSire', 'ownedMare' }) do
  local foal = key == 'foal' or key == 'ownedFoal'
  local master = key == 'sire' or key == 'mare' or key == 'ownedSire' or key == 'ownedMare'
  for i, kind in ipairs({ 'father', 'mother' }) do
    local father = kind == 'father'
    local setter = master and (father and 'pedigreeFatherSet072' or 'pedigreeMotherSet072')
      or foal and (father and 'foalFatherSet072' or 'foalMotherSet072')
      or (father and 'raceFatherSet072' or 'raceMotherSet072')
    table.insert(WP26.EDITORS[key].fields, i + 1, {
      en = father and 'Father' or 'Mother',
      ja = father and '父' or '母',
      base = master and 'pedigree072' or foal and 'primary' or 'race',
      off = master and (father and 0 or 4) or (father and 8 or 4),
      bit = 0,
      bits = master and 19 or father and 11 or 14,
      max = master and 0x1ffff or father and 2000 or 10000,
      parentSetter072 = setter,
      parentKind072 = kind,
      parentMaster072 = master,
      groupEn = 'Pedigree',
      groupJa = '血統',
      source = master and 'DD580/E5870 ->EC1B0/EC220; EC1E0/EC250 pedigree parent indices'
        or foal and 'D8430/D8470 sire slot;D7B10/D7B50 mare slot'
        or 'BA7B0/BA860 sire slot;BA320/BA390 mare slot;790010 converts these into pedigree EC1E0/EC250',
    })
  end
end
local available072 = WP26.fieldAvailable
function WP26.fieldAvailable(c, f)
  if f.parentMaster072 and not c.pedigree072 then
    return false
  end
  return available072(c, f)
end
local add072 = WP26.addNativeField
function WP26.addNativeField(parent, key, index, c, session)
  local f = WP26.EDITORS[key].fields[index]
  if f.parentSetter072 then
    f.choices = WP26.parentChoices072(c, f)
  end
  return add072(parent, key, index, c, session)
end
function WP26.parentCycle072(child, parent)
  if parent >= 100000 then
    return false
  end
  local root = WP26.data('pedigree072')
  local todo = { parent }
  local seen = {}
  while #todo > 0 do
    local id = table.remove(todo)
    if id == child then
      return true
    end
    if id < 100000 and not seen[id] then
      seen[id] = true
      local a = root + id * 24
      local father = WP26.bits(a, 0, 0, 19)
      local mother = WP26.bits(a, 4, 0, 19)
      if father < 100000 then
        todo[#todo + 1] = father
      end
      if mother < 100000 then
        todo[#todo + 1] = mother
      end
    end
  end
  return false
end
local write072 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.parentSetter072 then
    return write072(c, f, v, journal)
  end
  WP26.require()
  assert(WP26.fieldAvailable(c, f) and type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid parent')
  local fresh = WP26.context(c.key, c.id)
  assert(
    fresh.primary == c.primary and fresh.horseID == c.horseID and fresh.pedigreeID072 == c.pedigreeID072,
    'Horse identity changed'
  )
  local none = f.parentMaster072 and 0x1ffff or f.parentKind072 == 'father' and 2000 or 10000
  if f.parentMaster072 then
    assert(v < 100000 or v == none, 'Invalid pedigree parent')
    assert(not WP26.parentCycle072(c.pedigreeID072, v), 'Parentage cycle rejected')
  elseif v ~= none then
    local parentKey = f.parentKind072 == 'father' and 'sire' or 'mare'
    local pc = WP26.context(parentKey, v)
    local pedigree = WP26.bits(pc.primary, 0, 0, 19)
    assert(pedigree < 100000 and WP26.entityName(parentKey, v, pc) ~= '', 'Parent unavailable')
    if f.choices then
      local matched = false
      for _, r in ipairs(f.choices) do
        if r.id == v and r.pedigree072 == pedigree then
          matched = true
          break
        end
      end
      assert(matched, 'Parent identity changed')
    end
  end
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  local address = c[f.base] + f.off
  local before = assert(readBytes(address, 4, true))
  local nativeID = f.parentMaster072 and c.pedigreeID072 or c.raceID or c.id
  WP26.native(f.parentSetter072, nativeID, v)
  if WP26.fieldRead(c, f) ~= v then
    WP26.native(f.parentSetter072, nativeID, old)
    error('Parent update failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'parentage072',
      pid = WP26.pid,
      ctx = c,
      field = f,
      old = old,
      new = v,
      address = address,
      before = before,
      after = readBytes(address, 4, true),
      nativeID = nativeID,
    }
  end
end
local undo072 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'parentage072' then
    return undo072()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(
    c.primary == h.ctx.primary and c.horseID == h.ctx.horseID and c.pedigreeID072 == h.ctx.pedigreeID072,
    'Horse identity changed'
  )
  local a = c[h.field.base] + h.field.off
  assert(a == h.address, 'Parent field moved')
  local function equal(expected)
    local now = assert(readBytes(a, 4, true))
    for i, v in ipairs(expected) do
      assert(now[i] == v, 'Parent data changed')
    end
  end
  equal(h.after)
  WP26.native(h.field.parentSetter072, h.nativeID, h.old)
  equal(h.before)
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.horseMaternalSet073 = {
  pattern = 'B8 2D 70 00 00 66 3B C8 73 2B 81 FA 00 F4 01 00 77 23 0F B7 C1 81 E2 FF FF 03 00 48 6B C8 38 48 8B 05 A2 59 F7 03 C1 E2',
}
WP26.SPEC.pedigreeMaternalSet073 = {
  pattern = '81 F9 A0 86 01 00 73 2A 81 FA 00 F4 01 00 77 22 8B C1 81 E2 FF FF 03 00 C1 E2 03 48 8D 0C 40 48 8B 05 C2 08 F3 03 81 64',
}
WP26.SPEC.pedigreePaternalSet073 = {
  pattern = '81 F9 A0 86 01 00 73 30 B8 A0 0F 00 00 66 3B D0 77 26 8B C1 48 8D 0C 40 48 8B 05 09 1D F3 03 81 24 C8 FF FF 07 80 4C 8D',
}
WP26.SPEC.familyLookup073 = {
  pattern = '89 4C 24 08 48 83 EC 28 8B 4C 24 30 E8 BF 31 03 00 85 C0 74 18 48 63 44 24 30 48 6B C0 24 48 8B 0D D3 E6 DE 03 48 03 C8',
}
WP26.SPEC.familyOwnershipSet073 = {
  pattern = '89 54 24 10 89 4C 24 08 48 83 EC 38 8B 4C 24 40 E8 DB CD 1B 00 48 89 44 24 20 48 83 7C 24 20 00 74 2E 83 7C 24 48 00 7C',
}
local parentWrite073 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.parentSetter072 then
    return parentWrite073(c, f, v, journal)
  end
  WP26.require()
  assert(type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= f.max, 'Invalid parent')
  local old = WP26.fieldRead(c, f)
  if old == v then
    return
  end
  local regions = {}
  local seen = {}
  local function save(a, n)
    if not seen[a] then
      regions[#regions + 1] = { address = a, before = assert(readBytes(a, n, true)) }
      seen[a] = true
    end
  end
  save(c[f.base] + f.off, 4)
  local mother = f.parentKind072 == 'mother'
  local line
  local family
  local own
  local typ
  if mother then
    local parent = v
    if not f.parentMaster072 then
      if v < 10000 then
        parent = WP26.bits(WP26.data('mare') + v * 68, 0, 0, 19)
      else
        parent = 0x1ffff
      end
    end
    line = parent < 100000 and WP26.bits(WP26.data('pedigree072') + parent * 24, 12, 3, 18) or 128000
    assert(line <= 128000, 'Unsupported maternal line')
    save(c.horse + 16, 4)
    if f.parentMaster072 then
      save(c.pedigree072 + 12, 4)
    end
    if c.key == 'foal' or c.key == 'ownedFoal' then
      typ = 0
      own = WP26.bits(c.primary, 4, 14, 13) == 46
    elseif c.race then
      typ = 1
      own = WP26.bits(c.race, 36, 0, 13) == 46
    else
      typ = (c.key == 'sire' or c.key == 'ownedSire') and 2 or 3
      local farm = WP26.bits(c.horse, 16, 22, 9)
      own = farm == 32 or farm == 34 or farm == 35
    end
    if line < 128000 then
      family = WP26.native('familyLookup073', line)
      if family and family > 65536 then
        save(family + 26, 1)
      else
        family = nil
      end
    end
  elseif f.parentMaster072 then
    line = v < 100000 and WP26.bits(WP26.data('pedigree072') + v * 24, 0, 19, 12) or 4000
    assert(line <= 4000, 'Unsupported paternal line')
  end
  local ok, e = pcall(function()
    parentWrite073(c, f, v, false)
    if mother then
      WP26.native('horseMaternalSet073', c.horseID, line)
      assert(WP26.bits(c.horse, 16, 4, 18) == line, 'Horse maternal line mismatch')
      if f.parentMaster072 then
        WP26.native('pedigreeMaternalSet073', c.pedigreeID072, line)
        assert(WP26.bits(c.pedigree072, 12, 3, 18) == line, 'Pedigree maternal line mismatch')
      end
      if family then
        WP26.native('familyOwnershipSet073', line, typ + (own and 0 or 4))
        assert(WP26.bits(family, 26, 0, 3) == typ + (own and 0 or 4), 'Family ownership mismatch')
      end
    elseif f.parentMaster072 then
      WP26.native('pedigreePaternalSet073', c.pedigreeID072, line)
      assert(WP26.bits(c.pedigree072, 0, 19, 12) == line, 'Pedigree paternal line mismatch')
    end
  end)
  if not ok then
    for _, r in ipairs(regions) do
      assert(writeBytes(r.address, r.before), 'Parent rollback failed')
    end
    error(e, 0)
  end
  for _, r in ipairs(regions) do
    r.after = assert(readBytes(r.address, #r.before, true))
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] =
      { kind = 'parentage073', pid = WP26.pid, ctx = c, field = f, old = old, new = v, regions = regions }
  end
end
local parentUndo073 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'parentage073' then
    return parentUndo073()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(
    c.primary == h.ctx.primary and c.horseID == h.ctx.horseID and c.pedigreeID072 == h.ctx.pedigreeID072,
    'Horse identity changed'
  )
  local function equal(r, bytes)
    local now = assert(readBytes(r.address, #bytes, true))
    for i, v in ipairs(bytes) do
      assert(now[i] == v, 'Parent transaction data changed')
    end
  end
  for _, r in ipairs(h.regions) do
    equal(r, r.after)
  end
  for _, r in ipairs(h.regions) do
    assert(writeBytes(r.address, r.before), 'Parent restoration failed')
    equal(r, r.before)
  end
  WP26.history[#WP26.history] = nil
end

WP26.SPEC.shownHorseWindow074 = {
  pattern = '48 89 15 13 46 F2 03 BA 0C 00 00 00 48 89 5C 24 30 48 8B 49 18 E8 F8 A7 9D 00 48 8B 0D 51 43 5D 04 BA 0D 00 00 00 48 8B',
}
WP26.SPEC.ownedIndex074 = {
  pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 9D D8 19 00 66 89 44 24 20 0F B7 44 24 20 48 83 C4 38 C3 CC CC CC CC CC CC',
}
WP26.NAMES[120] = { 'Ownership and breeding', '所有・生産' }
WP26.NAMES[121] = { 'Edit the displayed horse', '表示中の馬を編集' }
WP26.shownClasses074 = {
  [0x2aacce8] = { key = 'race', off = 0x54c, max = 0xffff, class = 'CInfoHrWin' },
  [0x2aad148] = { key = 'owned', off = 0x54c, max = 639, class = 'CInfoMhWin' },
  [0x2aace00] = { key = 'sire', off = 0x548, max = 1999, class = 'CInfoSrWin' },
  [0x2aacf18] = { key = 'mare', off = 0x40adc, max = 9999, class = 'CInfoMrWin' },
  [0x2aad030] = { key = 'foal', off = 0x550, max = 3439, class = 'CInfoPnWin' },
}
function WP26.displayedTarget074()
  WP26.require()
  local a = WP26.resolve('shownHorseWindow074')
  local d = readInteger(a + 3)
  assert(d, 'Window reference unavailable')
  if d >= 0x80000000 then
    d = d - 0x100000000
  end
  local p = readQword(a + 7 + d)
  if not p or p < 65536 then
    return nil
  end
  local vt = readQword(p)
  local kind = vt and WP26.shownClasses074[vt - WP26.mod()]
  if not kind then
    return nil
  end
  local raw = readSmallInteger(p + kind.off)
  if not raw or (kind.key == 'race' and not WP26.racePointer179(raw)) or (kind.key == 'sire' and not WP26.sirePointer181(raw)) or (kind.key ~= 'race' and kind.key ~= 'sire' and raw > kind.max) then
    return nil
  end
  local c = WP26.context(kind.key, raw)
  local key, id = kind.key, raw
  if key == 'owned' then
    key = 'race'
    id = c.raceID
    c = WP26.context(key, id)
  end
  local name = WP26.entityName(key, id, c)
  if name == '' or name:find('[%z\1-\31]') then
    return nil
  end
  local editorKey, editorID = key, id
  if key == 'race' and WP26.bits(c.race, 36, 0, 13) == 46 then
    local owned = WP26.native('ownedIndex074', id)
    if owned and owned < 640 then
      local oc = WP26.context('owned', owned)
      if oc.raceID == id and oc.horseID == c.horseID then
        editorKey = 'owned'
        editorID = owned
      end
    end
  elseif key == 'foal' and WP26.bits(c.primary, 4, 14, 13) == 46 then
    editorKey = 'ownedFoal'
  elseif key == 'sire' or key == 'mare' then
    local farm = WP26.bits(c.horse, 16, 22, 9)
    if farm == 32 or farm == 34 or farm == 35 then
      editorKey = key == 'sire' and 'ownedSire' or 'ownedMare'
    end
  end
  return {
    pid = WP26.pid,
    key = key,
    id = id,
    ctx = c,
    name = name,
    editorKey = editorKey,
    editorID = editorID,
    window = p,
    vtable = vt,
    raw = raw,
    kind = kind,
  }
end
function WP26.validateDisplayedTarget074(t)
  local now = WP26.displayedTarget074()
  assert(
    now
      and now.pid == t.pid
      and now.window == t.window
      and now.vtable == t.vtable
      and now.raw == t.raw
      and now.key == t.key
      and now.id == t.id
      and now.ctx.horseID == t.ctx.horseID,
    'Displayed horse changed'
  )
  return now
end
local select074 = WP26.selectEditor
function WP26.selectEditor(key)
  local target = WP26.autoEditorSelection074
  if target and target.editorKey == key then
    WP26.autoEditorSelection074 = nil
    WP26.validateDisplayedTarget074(target)
    WP26.context(key, target.editorID)
    WP26.selected[key] = target.editorID
    WP26.deferEditor(key)
    return true
  end
  return select074(key)
end
function WP26.openDisplayedHorseEditor074()
  local t = WP26.displayedTarget074()
  if not t then
    WP26.msg('Open a horse detail screen.', '馬の詳細画面を開いてください。')
    return
  end
  local p = assert(getAddressList().getMemoryRecordByID(WP26.EDITORS[t.editorKey].record))
  if p.Active then
    p.Active = false
  end
  WP26.autoEditorSelection074 = t
  local ok, e = pcall(function()
    p.Active = true
    assert(p.Active, 'Editor activation failed')
  end)
  WP26.autoEditorSelection074 = nil
  if not ok then
    error(e, 0)
  end
  p.Collapsed = false
  getAddressList().SelectedRecord = p
end
WP26.applyLang()

WP26.SPEC.acquireRaceOwner075 = {
  pattern = '48 89 5C 24 10 57 48 83 EC 20 B8 86 1A 00 00 0F B7 FA 0F B7 D9 66 2B C8 B8 73 18 00 00 66 3B C8 77 3B B8 C4 11 00 00 66',
}
WP26.SPEC.acquireOwnedSlot075 = {
  pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 6D D8 19 00 66 89 44 24 20 0F B7 4C 24 20 E8 EE 4E 19 00 85 C0 74 0A 0F B7',
}
WP26.SPEC.acquireOwnedRaceID075 = {
  pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 5D 54 19 00 85 C0 75 07 B8 FA 32 00 00 EB 4B 0F B7 44 24 40 66 89 44 24 20',
}
WP26.SPEC.acquireFoalOwner075 = {
  pattern = '48 89 5C 24 08 57 48 83 EC 20 0F B7 F9 B8 70 0D 00 00 0F B7 DA 66 3B F8 73 62 B8 C4 11 00 00 66 3B D8 77 58 48 8B 05 3D',
}
WP26.SPEC.acquireSireOwner075 = {
  pattern = '66 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 58 37 FA FF 85 C0 75 02 EB 38 0F B7 4C 24 40 E8 C8 74 11 00',
}
WP26.SPEC.acquireSireFarm075 = {
  pattern = '66 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 C8 F8 FF FF 0F B7 54 24 48 0F B7 C8 E8 FB 9E FC FF 0F B7 4C',
}
WP26.SPEC.acquireMareFarm075 = {
  pattern = '48 89 74 24 10 57 48 83 EC 20 0F B7 F9 B8 10 27 00 00 0F B7 F2 66 3B F8 0F 83 07 01 00 00 4C 8B 05 B3 5C F4 03 B9 FF 7F',
}
WP26.SPEC.sireOwnedCheck075 = {
  pattern = '66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 5D 9D FA FF 85 C0 75 04 33 C0 EB 24 0F B7 4C 24 30 E8 DB FA FF FF 85 C0 74',
}
WP26.SPEC.mareOwnedCheck075 = {
  pattern = 'B8 10 27 00 00 66 3B C8 73 5B 0F B7 C1 48 6B C8 44 48 8B 05 30 6C F4 03 0F B7 54 01 08 B8 FF 7F 00 00 66 23 D0 B8 2D 70',
}
WP26.NAMES[122] = { 'Acquire the displayed horse', '表示中の馬を取得' }
WP26.NAMES[123] = { 'Destination farm', '取得先牧場' }
WP26.NAMES[124] = { 'Treat as homebred', '自牧場産として取得' }
function WP26.acquireFarmChoices075()
  local rows = {}
  local root = WP26.data('farm')
  for _, id in ipairs({ 32, 34, 35 }) do
    local name = WP26.nameText(root + id * 204 + 16, 12)
    if name ~= '' then
      rows[#rows + 1] = { id = id, name = name }
    end
  end
  return rows
end
function WP26.ensureAcquireConfig075()
  WP26.ensureRaceConfig()
  local c = WP26_RACE_CONFIG
  if not c.acquireFarm then
    c.acquireFarm = c.mem + 32
    assert(writeBytes(c.acquireFarm, 32))
  end
  if not c.acquireHomebred then
    c.acquireHomebred = c.mem + 36
    assert(writeBytes(c.acquireHomebred, 1))
  end
  for name, a in pairs({ wp2026AcquireFarm = c.acquireFarm, wp2026AcquireHomebred = c.acquireHomebred }) do
    pcall(unregisterSymbol, name)
    registerSymbol(name, a, true)
  end
  local farm = getAddressList().getMemoryRecordByID(123)
  if farm then
    local rows = {}
    for _, r in ipairs(WP26.acquireFarmChoices075()) do
      rows[#rows + 1] = r.id .. ':' .. r.name
    end
    farm.DropDownList.Text = table.concat(rows, '\n')
    farm.DropDownReadOnly = true
    farm.DropDownDescriptionOnly = true
    farm.DisplayAsDropDownListItem = true
  end
  local homebred = getAddressList().getMemoryRecordByID(124)
  if homebred then
    homebred.DropDownList.Text = WP26.T('0:No\n1:Yes', '0:いいえ\n1:はい')
    homebred.DropDownReadOnly = true
    homebred.DropDownDescriptionOnly = true
    homebred.DisplayAsDropDownListItem = true
  end
  return c
end
function WP26.acquireSnapshots075(c, withOwnedPool)
  local regions = {}
  local seen = {}
  local function add(a, n)
    if not seen[a] then
      regions[#regions + 1] =
        { address = a, n = n, before = assert(readBytes(a, n, true), 'Acquisition snapshot unavailable') }
      seen[a] = true
    end
  end
  add(c.primary, WP26.EDITORS[c.key].stride)
  add(c.horse, 56)
  if c.pedigree072 then
    add(c.pedigree072, 24)
  end
  add(WP26.data('player'), 65536)
  if withOwnedPool then
    add(WP26.data('owned'), 641 * 760)
    add(WP26.mod() + 0x404260c, 8)
  end
  local families = { WP26.bits(c.horse, 16, 4, 18) }
  if c.pedigree072 then
    families[#families + 1] = WP26.bits(c.pedigree072, 12, 3, 18)
  end
  for _, id in ipairs(families) do
    if id < 128000 then
      local ptr = WP26.native('familyLookup073', id)
      if ptr and ptr > 65536 then
        add(ptr, 36)
      end
    end
  end
  return regions
end
function WP26.acquirePatches075(regions)
  local patches = {}
  local seen = {}
  for _, r in ipairs(regions) do
    local after = assert(readBytes(r.address, r.n, true), 'Acquisition readback unavailable')
    for i, b in ipairs(r.before) do
      if after[i] ~= b then
        local a = r.address + i - 1
        if not seen[a] then
          patches[#patches + 1] = { address = a, before = b, after = after[i] }
          seen[a] = true
        end
      end
    end
  end
  return patches
end
function WP26.restoreAcquirePatches075(patches, verifyAfter)
  if verifyAfter then
    for _, r in ipairs(patches) do
      assert(readBytes(r.address, 1) == r.after, 'Acquisition data changed; restoration stopped')
    end
  end
  for _, r in ipairs(patches) do
    assert(writeBytes(r.address, r.before), 'Acquisition restoration failed')
    assert(readBytes(r.address, 1) == r.before, 'Acquisition restoration mismatch')
  end
end
function WP26.acquireActor075(key, id, farm, homebred, journal)
  WP26.require()
  assert(key == 'race' or key == 'foal' or key == 'sire' or key == 'mare', 'Unsupported horse kind')
  local valid = false
  for _, r in ipairs(WP26.acquireFarmChoices075()) do
    if r.id == farm then
      valid = true
      break
    end
  end
  assert(valid, 'Destination farm unavailable')
  local c = WP26.context(key, id)
  local name = WP26.entityName(key, id, c)
  assert(name ~= '', 'Horse unavailable')
  local regions = WP26.acquireSnapshots075(c, key == 'race')
  local slot
  local ok, e = pcall(function()
    if key == 'race' then
      WP26.native('acquireRaceOwner075', id, 46)
      slot = WP26.native('acquireOwnedSlot075', id)
      assert(slot and slot < 640, 'No free ownership slot')
      assert(WP26.native('acquireOwnedRaceID075', slot) == id, 'Ownership registration mismatch')
      assert(WP26.bits(c.race, 36, 0, 13) == 46, 'Racehorse owner mismatch')
      WP26.native('horseStablingSet071', c.horseID, farm)
      if homebred then
        WP26.native('raceBreederSet071', id, farm)
        WP26.native('raceTransactionSet071', id, 1)
        assert(
          WP26.bits(c.race, 40, 10, 9) == farm and WP26.bits(c.race, 24, 20, 3) == 1,
          'Racehorse production mismatch'
        )
      end
    elseif key == 'foal' then
      WP26.native('acquireFoalOwner075', id, 46)
      WP26.native('foalStablingSet070', id, farm)
      assert(WP26.bits(c.primary, 4, 14, 13) == 46, 'Foal owner mismatch')
      if homebred then
        WP26.native('foalBreederSet070', id, farm)
        WP26.native('foalTransactionSet070', id, 1)
        assert(
          WP26.bits(c.primary, 8, 11, 9) == farm and WP26.bits(c.primary, 20, 0, 3) == 1,
          'Foal production mismatch'
        )
      end
    elseif key == 'sire' then
      WP26.native('acquireSireOwner075', id, 46)
      WP26.native('acquireSireFarm075', id, farm)
      assert(WP26.bits(c.primary, 64, 3, 13) == 46, 'Sire owner mismatch')
      assert(WP26.native('sireOwnedCheck075', id) ~= 0, 'Sire ownership check failed')
    else
      WP26.native('acquireMareFarm075', id, farm)
      assert(WP26.native('mareOwnedCheck075', id) ~= 0, 'Broodmare ownership check failed')
    end
    local fresh = WP26.context(key, id)
    assert(
      fresh.primary == c.primary and fresh.horseID == c.horseID and fresh.pedigreeID072 == c.pedigreeID072,
      'Horse identity changed'
    )
    assert(WP26.bits(c.horse, 16, 22, 9) == farm, 'Destination farm mismatch')
  end)
  local patches = WP26.acquirePatches075(regions)
  if not ok then
    WP26.restoreAcquirePatches075(patches, true)
    error(e, 0)
  end
  if journal ~= false and #patches > 0 then
    WP26.history[#WP26.history + 1] =
      { kind = 'acquire075', pid = WP26.pid, ctx = c, patches = patches, name = name, slot = slot }
  end
  return { key = key, id = id, name = name, slot = slot, changes = #patches }
end
function WP26.acquireDisplayed075()
  local target = WP26.displayedTarget074()
  if not target then
    WP26.msg('Open a horse detail screen.', '馬の詳細画面を開いてください。')
    return
  end
  local config = WP26.ensureAcquireConfig075()
  local farm = readBytes(config.acquireFarm, 1)
  local homebred = readBytes(config.acquireHomebred, 1) == 1
  WP26.validateDisplayedTarget074(target)
  local result = WP26.acquireActor075(target.key, target.id, farm, homebred)
  WP26.msg('Acquired: ' .. result.name, '取得: ' .. result.name)
end
local undo075 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'acquire075' then
    return undo075()
  end
  WP26.require()
  assert(h.pid == WP26.pid)
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(
    c.primary == h.ctx.primary and c.horseID == h.ctx.horseID and c.pedigreeID072 == h.ctx.pedigreeID072,
    'Horse identity changed'
  )
  WP26.restoreAcquirePatches075(h.patches, true)
  WP26.history[#WP26.history] = nil
end
local moveField075 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if
    not f.horseStabling071 or not (c.key == 'sire' or c.key == 'ownedSire' or c.key == 'mare' or c.key == 'ownedMare')
  then
    return moveField075(c, f, v, journal)
  end
  WP26.require()
  assert(type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= 273, 'Invalid farm')
  local valid = false
  for _, r in ipairs(WP26.farmChoices070()) do
    if r.id == v then
      valid = true
      break
    end
  end
  assert(valid, 'Farm unavailable')
  local key = (c.key == 'sire' or c.key == 'ownedSire') and 'sire' or 'mare'
  local fresh = WP26.context(key, c.id)
  assert(fresh.primary == c.primary and fresh.horseID == c.horseID, 'Horse identity changed')
  if WP26.fieldRead(c, f) == v then
    return
  end
  local regions = WP26.acquireSnapshots075(fresh, false)
  local ok, e = pcall(function()
    WP26.native(key == 'sire' and 'acquireSireFarm075' or 'acquireMareFarm075', c.id, v)
    assert(WP26.fieldRead(c, f) == v, 'Farm transfer mismatch')
  end)
  local patches = WP26.acquirePatches075(regions)
  if not ok then
    WP26.restoreAcquirePatches075(patches, true)
    error(e, 0)
  end
  if journal ~= false and #patches > 0 then
    WP26.history[#WP26.history + 1] = { kind = 'acquire075', pid = WP26.pid, ctx = fresh, patches = patches }
  end
end
local allOff075 = WP26.disableAll
function WP26.disableAll(self)
  local result = allOff075(self)
  if WP26.attached() then
    WP26.ensureAcquireConfig075()
  end
  return result
end
local lang075 = WP26.applyLang
function WP26.applyLang()
  lang075()
  if WP26.attached() then
    WP26.ensureAcquireConfig075()
  end
end
WP26.applyLang()

-- Keep the game-labelled profile selector; remove the older duplicate country row.
for _, key in ipairs({ 'owned', 'ownedFoal', 'ownedMare', 'ownedSire', 'race', 'foal', 'mare', 'sire' }) do
  local fields = WP26.EDITORS[key].fields
  local hasOrigin = false
  for _, f in ipairs(fields) do
    if f.setter == 'horseOriginSet070' then
      hasOrigin = true
    end
  end
  if hasOrigin then
    for i = #fields, 1, -1 do
      if fields[i].setter == 'horseCountrySet' then
        table.remove(fields, i)
      end
    end
  end
end

WP26.SPEC.horseNameFree079 =
  { pattern = '48 83 EC 38 B8 02 00 00 00 66 89 44 24 20 EB 0D 0F B7 44 24 20 66 FF C0 66 89 44 24 20 0F B7 4C' }

WP26.SPEC.horseNameAllocate079 =
  { pattern = '48 89 4C 24 08 48 83 EC 38 E8 F2 B1 1E 00 66 89 44 24 20 48 8B 54 24 40 0F B7 4C 24 20 E8 5E EA' }

WP26.SPEC.raceNameSet079 = {
  pattern = '48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 B8 86 1A 00 00 48 63 DA 0F B7 F1 41 0F B7 F8 66 2B F0 B8 73 18 00 00 66 3B',
}

WP26.SPEC.pedigreeNameSet079 = {
  pattern = '81 F9 A0 86 01 00 73 4D 48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 48 63 DA 41 0F B7 F8 8B F1 83 FB 02 7D 21 41 0F B7',
}

local nameContext079 = WP26.context
function WP26.context(key, id)
  local c = nameContext079(key, id)
  if key == 'owned' or key == 'race' then
    c.horseName079 = c.race + 0x44
  elseif key == 'sire' or key == 'mare' or key == 'ownedSire' or key == 'ownedMare' then
    assert(c.pedigree072, 'Horse pedigree unavailable')
    c.horseName079 = c.pedigree072 + 0x14
  end
  return c
end
local nameRead079 = WP26.fieldRead
function WP26.fieldRead(c, f)
  if f.horseName079 then
    return WP26.entityName(c.key, c.id, c)
  end
  return nameRead079(c, f)
end
function WP26.setNamePair079(c, first, second)
  local fn, id
  if c.race then
    fn = 'raceNameSet079'
    id = c.raceID
  else
    fn = 'pedigreeNameSet079'
    id = c.pedigreeID072
  end
  assert(id ~= nil, 'Horse name identity unavailable')
  WP26.native(fn, id, 0, first)
  WP26.native(fn, id, 1, second)
end
local function pair079(bytes)
  return bytes[1] + bytes[2] * 256, bytes[3] + bytes[4] * 256
end
local function equal079(address, expected)
  local now = readBytes(address, #expected, true)
  if not now then
    return false
  end
  for i, v in ipairs(expected) do
    if now[i] ~= v then
      return false
    end
  end
  return true
end
function WP26.nameTokenReferenced079(token)
  local function scan(root, count, stride, off)
    for start = 0, count - 1, 256 do
      local n = math.min(256, count - start)
      local bytes = readBytes(root + start * stride, n * stride, true)
      if not bytes then
        return true
      end
      for i = 0, n - 1 do
        local j = i * stride + off + 1
        if bytes[j] + bytes[j + 1] * 256 == token or bytes[j + 2] + bytes[j + 3] * 256 == token then
          return true
        end
      end
    end
    return false
  end
  local ok, referenced = pcall(function()
    local referenced = WP26.withRaceSnapshot179(function(snapshot)
      for _,id in ipairs(WP26.raceIds179(snapshot)) do
        if scan(WP26.racePointer179(id,snapshot),1,232,0x44) then return true end
      end
      return false
    end)
    if referenced then return true end
    if scan(WP26.data('pedigree072'), 100000, 24, 0x14) then
      return true
    end
    return scan(WP26.namePointer(0x402A5B0), 6260, 52, 0x1C)
  end)
  return not ok or referenced
end
function WP26.releaseName079(h)
  if equal079(h.poolAddress, h.poolAfter) and not WP26.nameTokenReferenced079(h.token) then
    assert(writeBytes(h.poolAddress, h.poolBefore), 'Name pool restoration failed')
    assert(equal079(h.poolAddress, h.poolBefore), 'Name pool restoration verification failed')
    return true
  end
  return false
end
function WP26.updateNameCaption079(c)
  WP26.foalNameCache = nil
  for key, d in pairs(WP26.EDITORS) do
    local session = WP26.editorSessions[d.record]
    if session and session.horseID == c.horseID then
      local ok, name = pcall(function()
        return WP26.entityName(key, session.id, WP26.context(key, session.id))
      end)
      local parent = getAddressList().getMemoryRecordByID(d.record)
      if ok and parent then
        WP26.suffix[d.record] = name
        parent.Description = WP26.T(d.en, d.ja) .. ' : ' .. name
      end
    end
  end
end
local nameWrite079 = WP26.writeField
function WP26.writeField(c, f, value, journal)
  if not f.horseName079 then
    return nameWrite079(c, f, value, journal)
  end
  WP26.require()
  if type(value) ~= 'string' then
    error(WP26.T('Enter a horse name.', '馬名を入力してください。'), 0)
  end
  local supported, encoded, normalized = pcall(WP26.encodeName, value)
  if not supported then
    error(
      WP26.T('Unsupported horse name character.', '馬名に使用できない文字が含まれています。'),
      0
    )
  end
  if #encoded == 0 or #encoded > 9 then
    error(
      WP26.T('Horse names must contain 1 to 9 characters.', '馬名は1～9文字で入力してください。'),
      0
    )
  end
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.horseID == c.horseID and fresh.horseName079 == c.horseName079, 'Horse identity changed')
  local old = WP26.fieldRead(fresh, f)
  if old == normalized then
    return
  end
  local before = assert(readBytes(fresh.horseName079, 4, true))
  local slot = WP26.native('horseNameFree079')
  if slot < 2 or slot >= 0x658F then
    error(WP26.T('Horse name storage is full.', '馬名の保存領域に空きがありません。'), 0)
  end
  local pool = WP26.namePointer(0x4042678) + slot * 9
  local poolBefore = assert(readBytes(pool, 9, true))
  assert(poolBefore[1] == 0, 'Horse name slot changed')
  local buffer = assert(allocateMemory(64), 'Name buffer unavailable')
  local bytes = {}
  local ansi = utf8ToAnsi(normalized)
  for i = 1, #ansi do
    bytes[i] = ansi:byte(i)
  end
  bytes[#bytes + 1] = 0
  if not writeBytes(buffer, bytes) then
    deAlloc(buffer)
    error('Name input write failed', 0)
  end
  -- Do not free an input buffer after an unconfirmed native timeout.
  local token = WP26.native('horseNameAllocate079', buffer)
  deAlloc(buffer)
  assert(token == 0x9470 + slot, 'Horse name allocation changed; actor update stopped')
  local poolAfter = assert(readBytes(pool, 9, true))
  local after = { token & 255, token >> 8, 255, 255 }
  local h = {
    kind = 'horseName079',
    pid = WP26.pid,
    ctx = fresh,
    field = f,
    old = old,
    new = normalized,
    address = fresh.horseName079,
    before = before,
    after = after,
    token = token,
    poolAddress = pool,
    poolBefore = poolBefore,
    poolAfter = poolAfter,
  }
  local ok, e = pcall(function()
    local now = WP26.context(c.key, c.id)
    assert(
      now.horseID == fresh.horseID and now.horseName079 == h.address and equal079(h.address, before),
      'Horse changed before renaming'
    )
    WP26.setNamePair079(now, token, 65535)
    assert(equal079(h.address, after) and WP26.fieldRead(now, f) == normalized, 'Horse name update failed')
  end)
  if not ok then
    local current = readBytes(h.address, 4, true)
    if current and current[1] + current[2] * 256 == token then
      local first, second = pair079(before)
      pcall(WP26.setNamePair079, fresh, first, second)
    end
    pcall(WP26.releaseName079, h)
    error(e, 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = h
  end
  WP26.updateNameCaption079(fresh)
end
local nameUndo079 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'horseName079' then
    return nameUndo079()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Game process changed')
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(
    c.horseID == h.ctx.horseID and c.horseName079 == h.address and equal079(h.address, h.after),
    'Horse name changed; undo stopped'
  )
  local first, second = pair079(h.before)
  WP26.setNamePair079(c, first, second)
  assert(equal079(h.address, h.before), 'Horse name restoration failed')
  WP26.releaseName079(h)
  WP26.history[#WP26.history] = nil
  WP26.updateNameCaption079(c)
end
for _, key in ipairs({ 'owned', 'race', 'ownedSire', 'sire', 'ownedMare', 'mare' }) do
  table.insert(WP26.EDITORS[key].fields, 1, {
    en = 'Horse name',
    ja = '馬名',
    base = 'horseName079',
    off = 0,
    bit = 0,
    bits = 32,
    max = 9,
    string = true,
    customSize079 = 4,
    horseName079 = true,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = 'A4E40/290040/2038C0 allocate private name;C4D50 race+44h;EAC50 pedigree+14h',
  })
end

WP26.NAMES[105] = nil

WP26.SPEC.gameCalendar081 = {
  pattern = '48 83 EC 28 83 3D A5 7E D7 03 00 74 0B 8B 05 A1 7E D7 03 48 83 C4 28 C3 48 89 5C 24 20 E8 0E 10 FE FF 8B D8 E8 47 FF FF',
}

WP26.SPEC.raceAgeSet081 = {
  pattern = '48 83 EC 28 44 8B DA 0F B7 C1 BA 86 1A 00 00 66 2B C2 BA 73 18 00 00 66 3B C2 77 32 41 83 FB 07 0F 87 86 00 00 00 0F B7',
}

WP26.SPEC.pedigreeYearSet081 = {
  pattern = '44 0F B7 C2 81 F9 A0 86 01 00 73 42 41 B9 E8 03 00 00 41 0F B7 C0 66 41 2B C1 BA D0 07 00 00 66 3B C2 77 2A 8B C1 48 8D',
}

function WP26.currentYear081()
  WP26.resolve('gameCalendar081')
  local base = WP26.mod()
  if readInteger(base + 0x3EC9500) ~= 0 then
    return assert(readInteger(base + 0x3EC9504))
  end
  local p = WP26.data('player')
  local scenario = readBytes(p + 0x1D, 1, false)
  local starts = { 1968, 1976, 1984, 1991, 1998, 2005, 2012, 2020, 2027 }
  local start = starts[scenario + 1]
  assert(start, 'Calendar scenario unavailable')
  return (start + assert(readSmallInteger(p + 0x22))) % 3000
end
local function yearStorage081(c, kind)
  if kind == 'race' then
    return c.race + 0xC, 'raceAgeSet081', c.raceID, WP26.bits(c.race, 0xC, 21, 3)
  end
  if kind == 'foal' then
    return c.primary, 'foalAgeSet', c.id, WP26.bits(c.primary, 0, 31, 1)
  end
  assert(c.pedigree072 and c.pedigreeID072, 'Horse pedigree unavailable')
  return c.pedigree072 + 4, 'pedigreeYearSet081', c.pedigreeID072, WP26.bits(c.pedigree072, 4, 19, 11) + 1000
end
local yearRead081 = WP26.fieldRead
function WP26.fieldRead(c, f)
  local kind = f.horseYearKind081
  if not kind then
    return yearRead081(c, f)
  end
  local _, _, _, stored = yearStorage081(c, kind)
  if kind == 'breed' then
    return f.birthYear081 and stored or WP26.currentYear081() - stored
  end
  local age = stored + (kind == 'race' and 2 or 0)
  return f.birthYear081 and WP26.currentYear081() - age or age
end
local yearWrite081 = WP26.writeField
function WP26.writeField(c, f, value, journal)
  local kind = f.horseYearKind081
  if not kind then
    return yearWrite081(c, f, value, journal)
  end
  WP26.require()
  if type(value) ~= 'number' or value % 1 ~= 0 then
    error(WP26.T('Enter a whole number.', '整数で入力してください。'), 0)
  end
  local currentYear = WP26.currentYear081()
  local year = f.birthYear081 and value or currentYear - value
  local age = currentYear - year
  local stored
  if kind == 'race' then
    if age < 2 or age > 9 then
      error(WP26.T('Racehorse age must be 2 to 9.', '競走馬の馬齢は2～9歳で入力してください。'), 0)
    end
    stored = age - 2
  elseif kind == 'foal' then
    if age < 0 or age > 1 then
      error(WP26.T('Foal age must be 0 or 1.', '幼駒の馬齢は0歳か1歳で入力してください。'), 0)
    end
    stored = age
  else
    if year < 1000 or year > currentYear or year > 3000 then
      error(WP26.T('Birth year is outside the supported range.', '生年が対応範囲外です。'), 0)
    end
    stored = year
  end
  local fresh = WP26.context(c.key, c.id)
  assert(fresh.horseID == c.horseID, 'Horse identity changed')
  local address, fn, id, old = yearStorage081(fresh, kind)
  local expectedAddress = yearStorage081(c, kind)
  assert(address == expectedAddress, 'Horse year address changed')
  if old == stored then
    return
  end
  local before = assert(readBytes(address, 4, true))
  WP26.native(fn, id, stored)
  local _, _, _, got = yearStorage081(fresh, kind)
  if got ~= stored then
    WP26.native(fn, id, old)
    error('Horse year update failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'horseYear081',
      pid = WP26.pid,
      ctx = fresh,
      yearKind = kind,
      address = address,
      fn = fn,
      target = id,
      oldStored = old,
      before = before,
      after = readBytes(address, 4, true),
    }
  end
  if kind == 'foal' then
    WP26.foalNameCache = nil
  end
end
local yearUndo081 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'horseYear081' then
    return yearUndo081()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Game process changed')
  local c = WP26.context(h.ctx.key, h.ctx.id)
  local address, fn, id = yearStorage081(c, h.yearKind)
  assert(
    c.horseID == h.ctx.horseID and address == h.address and fn == h.fn and id == h.target,
    'Horse identity changed'
  )
  local function equal(expected)
    local now = assert(readBytes(address, 4, true))
    for i, v in ipairs(expected) do
      assert(now[i] == v, 'Horse year data changed')
    end
  end
  equal(h.after)
  WP26.native(fn, id, h.oldStored)
  equal(h.before)
  WP26.history[#WP26.history] = nil
  if h.yearKind == 'foal' then
    WP26.foalNameCache = nil
  end
end
for _, key in ipairs({ 'owned', 'race', 'ownedFoal', 'foal', 'ownedSire', 'sire', 'ownedMare', 'mare' }) do
  local kind = (key == 'owned' or key == 'race') and 'race'
    or (key == 'foal' or key == 'ownedFoal') and 'foal'
    or 'breed'
  local base = kind == 'race' and 'race' or kind == 'breed' and 'pedigree072' or nil
  local off = kind == 'race' and 12 or kind == 'breed' and 4 or 0
  local bit = kind == 'race' and 21 or kind == 'breed' and 19 or 31
  local bits = kind == 'race' and 3 or kind == 'breed' and 11 or 1
  if kind ~= 'breed' then
    local found = 0
    for _, f in ipairs(WP26.EDITORS[key].fields) do
      if f.en == 'Age' then
        f.horseYearKind081 = kind
        f.source = (f.source or '') .. '; native year editor081'
        found = found + 1
      end
    end
    assert(found == 1, 'Age field missing or duplicated: ' .. key)
  else
    table.insert(WP26.EDITORS[key].fields, 2, {
      en = 'Age',
      ja = '馬齢',
      base = base,
      off = off,
      bit = bit,
      bits = bits,
      min = 0,
      max = 2000,
      horseYearKind081 = kind,
      groupEn = 'Profile and transaction',
      groupJa = '出身・取引',
      source = '151650 current year - EC530 birth year;EC570 setter; native retirement74CDC1..74CDCE',
    })
  end
  table.insert(WP26.EDITORS[key].fields, 3, {
    en = 'Birth year',
    ja = '生年',
    base = base,
    off = off,
    bit = bit,
    bits = bits,
    min = 1000,
    max = 3000,
    birthYear081 = true,
    horseYearKind081 = kind,
    groupEn = 'Profile and transaction',
    groupJa = '出身・取引',
    source = kind == 'breed' and 'EC530/EC570 pedigree+4 bits19..29 +1000'
      or kind == 'race' and '151650 current year - BED60;BEC60 stored age0..7 +2'
      or '151650 current year - D82C0;D82F0 stored age0..1',
  })
end

-- Local EXE: 285140 validates person ID < 10000; 253680 resolves 140-byte profile.
-- 169070 reads profile+44h; 1690B0 writes only its birth-year WORD.
local seen082 = {}
for _, key in ipairs({ 'staff', 'farmStaff' }) do
  local editor = WP26.EDITORS[key]
  if editor and not seen082[editor.fields] then
    seen082[editor.fields] = true
    table.insert(editor.fields, {
      en = 'Birth year',
      ja = '生年',
      base = 'staffProfile',
      off = 68,
      bit = 0,
      bits = 16,
      min = 1800,
      max = 2200,
      staffProfileOnly = true,
      staffBirth082 = true,
      source = '169070/1690B0;253680 person master+44h;285140 person ID <10000',
    })
  end
end
local write082 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.staffBirth082 then
    return write082(c, f, v, journal)
  end
  WP26.require()
  if type(v) ~= 'number' or v % 1 ~= 0 or v < f.min or v > f.max then
    error(WP26.T('Enter a valid birth year.', '対応範囲内の生年を入力してください。'), 0)
  end
  local fresh = WP26.context(c.key, c.id)
  assert(
    fresh.staffProfile and fresh.staffProfile == c.staffProfile and fresh.staffPersonID == c.staffPersonID,
    'Staff identity changed'
  )
  local before = assert(readBytes(fresh.staffProfile, 140, true))
  local old = WP26.fieldRead(fresh, f)
  if old == v then
    return
  end
  WP26.native('familyBirthYearSet', fresh.staffPersonID, v)
  if WP26.fieldRead(fresh, f) ~= v then
    WP26.native('familyBirthYearSet', fresh.staffPersonID, old)
    error('Staff birth year verification failed', 0)
  end
  if journal ~= false then
    WP26.history[#WP26.history + 1] = {
      kind = 'staffBirth082',
      pid = WP26.pid,
      ctx = fresh,
      field = f,
      old = old,
      before = before,
      after = assert(readBytes(fresh.staffProfile, 140, true)),
    }
  end
end
local undo082 = WP26.undoLast
function WP26.undoLast()
  local h = WP26.history[#WP26.history]
  if not h or h.kind ~= 'staffBirth082' then
    return undo082()
  end
  WP26.require()
  assert(h.pid == WP26.pid, 'Process changed')
  local c = WP26.context(h.ctx.key, h.ctx.id)
  assert(c.staffProfile == h.ctx.staffProfile and c.staffPersonID == h.ctx.staffPersonID, 'Staff identity changed')
  local now = assert(readBytes(c.staffProfile, 140, true))
  for i, v in ipairs(h.after) do
    assert(now[i] == v, 'Staff data changed')
  end
  WP26.native('familyBirthYearSet', c.staffPersonID, h.old)
  now = assert(readBytes(c.staffProfile, 140, true))
  for i, v in ipairs(h.before) do
    assert(now[i] == v, 'Staff restoration failed')
  end
  WP26.history[#WP26.history] = nil
end
-- Native 16CDA0: current year (151650) minus birth year (169070).
local ageFields082 = {}
for _, key in ipairs({ 'staff', 'farmStaff', 'family' }) do
  local fields = WP26.EDITORS[key].fields
  if not ageFields082[fields] then
    ageFields082[fields] = true
    local base
    if key ~= 'family' then
      base = 'staffProfile'
    end
    table.insert(fields, {
      en = 'Age',
      ja = '年齢',
      base = base,
      off = 68,
      bit = 0,
      bits = 16,
      min = 0,
      max = 200,
      staffProfileOnly = key ~= 'family',
      personAge082 = true,
      source = '16CDA0 ->151650 current year -169070 person birth year',
    })
  end
end
local readAge082 = WP26.fieldRead
function WP26.fieldRead(c, f)
  if not f.personAge082 then
    return readAge082(c, f)
  end
  local address = f.base and c[f.base] or c.primary
  return WP26.currentYear081() - assert(readSmallInteger(address + 68))
end
local writeAge082 = WP26.writeField
function WP26.writeField(c, f, v, journal)
  if not f.personAge082 then
    return writeAge082(c, f, v, journal)
  end
  if type(v) ~= 'number' or v % 1 ~= 0 or v < 0 or v > 200 then
    error(WP26.T('Enter an age from 0 to 200.', '年齢は0～200歳で入力してください。'), 0)
  end
  local fields = WP26.EDITORS[c.key].fields
  local birth
  for _, candidate in ipairs(fields) do
    if candidate.staffBirth082 or candidate.familySetter == 'familyBirthYearSet' then
      birth = candidate
      break
    end
  end
  assert(birth, 'Person birth year field unavailable')
  return writeAge082(c, birth, WP26.currentYear081() - v, journal)
end

-- Conversion callbacks are also used for CE's dropdown probes and rendering.
-- They must never log, raise a validation error, or write game memory.
function WP26.parseRaceMultiplier084(value)
  local text = tostring(value or ''):gsub('%s', ''):gsub('[xX]$', ''):gsub('×$', '')
  local number = tonumber(text)
  local decimals = text:match('%.(%d+)$')
  if not number or number ~= number or number < 1 or number > 4294967.295 or (decimals and #decimals > 3) then
    return nil
  end
  local raw = math.floor(number * 1000 + 0.5)
  if raw < 1000 or raw > 0xFFFFFFFF then
    return nil
  end
  return raw
end
function WP26.raceMultiplierToBytes084(value, address)
  local raw = WP26.parseRaceMultiplier084(value)
  if not raw then
    local c = _G.WP26_RACE_CONFIG
    if c and c.pid == getOpenedProcessID() and address == c.factor then
      raw = readInteger(c.factor)
    end
    raw = raw or 1000
  end
  return { raw & 255, (raw >> 8) & 255, (raw >> 16) & 255, (raw >> 24) & 255 }
end
local cache084 = _G.WP26_RACE_TYPE087
if not cache084 then
  cache084 = { name = 'WP2026RaceMultiplier087' }
  cache084.custom = registerCustomTypeLua(cache084.name, 4, function(a, b, c, d)
    local raw = (a or 0) | ((b or 0) << 8) | ((c or 0) << 16) | ((d or 0) << 24)
    local text = string.format('%.3f', raw / 1000):gsub('0+$', ''):gsub('%.$', '')
    return text
  end, function(value, address)
    local api = _G.WP26
    if api and api.raceMultiplierToBytes084 then
      return api.raceMultiplierToBytes084(value, address)
    end
    return { 232, 3, 0, 0 }
  end)
  assert(cache084.custom, 'Race multiplier type unavailable')
  cache084.custom.InternalOnly = true
  cache084.custom.scriptUsesString = true
  _G.WP26_RACE_TYPE087 = cache084
end
local row084 = getAddressList().getMemoryRecordByID(112)
if row084 then
  row084.Type = vtCustom
  row084.CustomTypeName = cache084.name
  row084.DropDownList.Text = table.concat(
    { '1:1', '1.1:1.1', '1.25:1.25', '1.5:1.5', '2:2', '3:3', '4:4', '5:5', '10:10', '20:20', '50:50', '100:100' },
    '\n'
  )
  row084.DropDownReadOnly = false
  row084.DropDownDescriptionOnly = true
  row084.DisplayAsDropDownListItem = false
end

WP26.KNOWN_RACE085 = {
  {
    ['name'] = '066',
    ['main'] = {
      ['hex'] = '9c50515241504151415241535356ff0548020000833d3d020000010f8507020000488b05580200004c8b15590200004c39100f85f0010000458b42504183f8020f82e20100004183f8120f87d8010000488b05390200004c8b184d85db0f84c5010000458b4b044183f9010f8cb70100004181f9e80300000f8faa010000488b0513020000488b304885f60f8497010000410fb68b080100004439c10f838001000041837c8b0c000f857401000031c9418b448b0c4401c885c00f8e620100003de80300000f8f57010000ffc14439c172de31db31c9488b05d30100008b10410fb7844a48ba000039d074383d851a000073314869c0e80000008b44062425ff1f000083f82e750881faffff00007414418b448b0c4401c83de80300007f0539d80f4fd8ffc14439c172ab85db0f8ef5000000488b053e0100008b1081fae80300000f82e000000081fab80b00000f87d400000089d80fafc231d2b9e8030000f7f189c381fbf40100007e05bbf401000031c9488b05360100008b10410fb7844a48ba000081faffff0000740839d00f85800000003d851a000073794869c0e80000008b44062425ff1f000083f82e7564488b05e80000003a087459418b448b0c4401c839d87d4d890d9a00000089059800000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d61000000ff054b000000ffc14439c10f8253ffffffeb06ff053c0000005e5b415b415a415941585a59589d41554883ec40488b053d000000488b004531d2ff2559000000904543415236325057000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 600,
      ['size'] = 696,
    },
    ['pace'] = {
      ['hex'] = '9c5051524150415141524153ff0546010000488b05470100008338010f85fd000000488b05470100004c8b104c3b15450100000f85e6000000418b4a5083f9010f82d900000083f9120f87d0000000488b052a0100004c8b184d39d80f85bd000000410fb6930801000039ca0f83ad000000458b4b044183f9010f8c9f0000004181f9e80300000f8f9200000041837c930c000f85860000004531c0438b44830c4401c885c07e773de80300007f7041ffc04139c872e5410fb7945248ba000081fa851a00007357488b05990000008b003dffff0000740439d07543488b05a5000000488b00483d0000010072314869d2e80000008b44102425ff1f000083f82e751cff0553000000415b415a415941585a59589d4183f901ff2571000000415b415a415941585a59589d4183f9017517488b0568000000488b000fb6908b000000ff2550000000ff2542000000669057505041434536360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 344,
      ['size'] = 424,
      ['site'] = 11298465,
      ['skip'] = 11298530,
      ['resume'] = 11298485,
      ['original'] = '4183f901753b488b059a27d2030fb6908b000000',
    },
  },
  {
    ['name'] = '083',
    ['main'] = {
      ['hex'] = '9c50515241504151415241535356ff05b8020000833dad020000010f8569020000488b05c80200004c8b15c90200004c39100f8552020000458b42504183f8020f82440200004183f8120f873a020000488b05a90200004c8b184d85db0f8427020000458b4b044183f9010f8c19020000488b0590020000488b304885f60f8406020000410fb68b080100004439c10f83ef01000041837c8b0c000f85e301000031c9418b448b0c4401c80f80d301000085c00f8ecb010000ffc14439c172e38b54243085d20f8eb8010000bbffffff7f31c94963448b544885c00f88a30100008b5424304801d0483d9bc420000f8790010000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dc9010000488b05e6010000488b3031db31c9488b05f00100008b10410fb7844a48ba000039d074313d851a0000732a4869c0e80000008b44062425ff1f000083f82e750881faffff0000740d418b448b0c4401c839d80f4fd8ffc14439c172b285db0f8e0b010000488b05620100008b1081fae80300000f82f600000089d8480fafc231d2b9e803000048f7f18b153a0100004839d0480f47c289c3891d6f01000031c9488b055e0100008b10410fb7844a48ba000081faffff0000740839d00f85940000003d851a00000f83890000004869c0e80000008b44062425ff1f000083f82e7574488b050c0100003a087469418b448b0c4401c83b05ce0000007f0639d87d55eb068b1dc0000000890dae0000008905ac00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d75000000ff055f0000008b1db1000000ffc14439c10f8239ffffffeb06ff054a0000005e5b415b415a415941585a59589d41554883ec40488b054b000000488b004531d2ff25670000006666666666662e0f1f840000000000454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 712,
      ['size'] = 812,
    },
    ['pace'] = {
      ['hex'] = '9c5051524150415141524153ff0536010000488b05370100008338010f85eb000000488b05370100004c8b104c3b15350100000f85d4000000418b4a5083f9010f82c700000083f9120f87be000000488b051a0100004c8b184d39d80f85ab000000410fb6930801000039ca0f839b000000458b4b044183f9010f8c8d00000041837c930c000f85810000004531c0438b44830c4401c8707485c07e7041ffc04139c872ea410fb7945248ba000081fa851a00007357488b059b0000008b003dffff0000740439d07543488b05a7000000488b00483d0000010072314869d2e80000008b44102425ff1f000083f82e751cff0555000000415b415a415941585a59589d4183f901ff2573000000415b415a415941585a59589d4183f9017517488b056a000000488b000fb6908b000000ff2552000000ff25440000000f1f400057505041434536360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 328,
      ['size'] = 408,
      ['site'] = 11298465,
      ['skip'] = 11298530,
      ['resume'] = 11298485,
      ['original'] = '4183f901753b488b059a27d2030fb6908b000000',
    },
  },
}

function WP26.restoreKnownRace085(dryRun)
  WP26.require()
  assert(WP26.checkBuild(), 'Unsupported race build')
  local base = WP26.mod()
  local function bytes(h)
    local a = {}
    for x in h:gmatch('%x%x') do
      a[#a + 1] = tonumber(x, 16)
    end
    return a
  end
  local function same(a, b)
    if not a or #a ~= #b then
      return false
    end
    for i, v in ipairs(b) do
      if a[i] ~= v then
        return false
      end
    end
    return true
  end
  local function read(a, n)
    return assert(readBytes(a, n, true), 'Race recovery read failed')
  end
  local specs = {
    { rva = 0xAC63B0, off = 0, n = 16, original = WP26.RACE_PAYLOAD.original },
    { rva = WP26.START_ROLL057.late.site, off = 1024, n = 18, original = WP26.START_ROLL057.late.original },
    { rva = WP26.START_ROLL057.good.site, off = 1536, n = 18, original = WP26.START_ROLL057.good.original },
    { rva = WP26.RACE_SPIRIT064.site, off = 2048, n = 15, original = WP26.RACE_SPIRIT064.original },
    { rva = WP26.PACE_GUARD066.site, off = 2560, n = 20, original = WP26.PACE_GUARD066.original },
  }
  local originalCount = 0
  for _, d in ipairs(specs) do
    d.original = bytes(d.original)
    d.current = read(base + d.rva, d.n)
    if same(d.current, d.original) then
      originalCount = originalCount + 1
    end
  end
  if originalCount == #specs then
    return 0
  end
  local first = specs[1].current
  assert(
    first[1] == 255 and first[2] == 37 and first[3] == 0 and first[4] == 0 and first[5] == 0 and first[6] == 0,
    'Unrecognized race patch'
  )
  local cave = assert(readQword(base + 0xAC63B0 + 6), 'Race recovery target missing')
  assert(cave > 65536, 'Invalid race recovery target')
  local profile
  for _, candidate in ipairs(WP26.KNOWN_RACE085) do
    local code = bytes(candidate.main.hex)
    if same(read(cave, candidate.main.dataOffset), { table.unpack(code, 1, candidate.main.dataOffset) }) then
      profile = candidate
      break
    end
  end
  assert(profile, 'Unrecognized race payload; unchanged')
  if
    profile.name == '110'
    or profile.name == '111'
    or profile.name == '112'
    or profile.name == '114'
    or (profile.name == '115' or profile.name == '128' or profile.name == '129' or profile.name == '130' or profile.name == '131' or profile.name == '134' or profile.name == '135' or profile.name == '137' or profile.name == '139' or profile.name == '142' or profile.name == '143' or profile.name == '144' or profile.name == '146')
  then
    for i = 2, #specs do
      specs[i].off = specs[i].off + 1024
    end
  end
  if profile.clock then
    local d = profile.clock or WP26.RACE_CLOCK111
    specs[#specs + 1] =
      { rva = d.site, off = 4096, n = 18, original = bytes(d.original), current = read(base + d.site, 18) }
  end
  if profile.floor then
    local d = profile.floor
    specs[#specs + 1] =
      { rva = d.site, off = 6144, n = #d.original // 2, original = bytes(d.original), current = read(base + d.site, #d.original // 2) }
  end
  if profile.cap then
    local d = profile.cap
    specs[#specs + 1] = { rva = d.site, off = 7168, n = 15, original = bytes(d.original), current = read(base + d.site, 15) }
  end
  local data = cave + profile.main.dataOffset
  local enabled = readInteger(data)
  assert(enabled == 0 or enabled == 1, 'Invalid race enable state')
  local factor = assert(readQword(data + 32))
  local target = assert(readQword(data + 88))
  assert(target == factor + 4 and readQword(factor - 16) == 0x3147464336325057, 'Unrecognized race configuration')
  local mainPointers =
    { base + 0x47E8E98, base + 0x4856670, base + 0x47F8238, base + 0x402A618, base + 0x47E8D9B, base + 0xAC63C0 }
  for i, p in ipairs(mainPointers) do
    assert(readQword(data + 40 + (i - 1) * 8) == p, 'Race pointer mismatch')
  end
  local payloads = { profile.main, WP26.START_ROLL057.late, WP26.START_ROLL057.good, profile.spirit or WP26.RACE_SPIRIT064, profile.pace }
  if profile.clock then
    payloads[6] = profile.clock or WP26.RACE_CLOCK111
  end
  if profile.floor then
    payloads[#payloads + 1] = profile.floor
  end
  if profile.cap then payloads[#payloads + 1] = profile.cap end
  for i, d in ipairs(specs) do
    local expected = bytes('ff2500000000' .. (string.pack('<I8', cave + d.off):gsub('.', function(c)
      return string.format('%02x', c:byte())
    end)) .. string.rep('90', d.n - 14))
    assert(same(d.current, expected), 'Race patch set is incomplete or belongs to another table')
    local code = bytes(payloads[i].hex)
    local prefix = { table.unpack(code, 1, payloads[i].dataOffset) }
    assert(same(read(cave + d.off, #prefix), prefix), 'Race auxiliary payload mismatch')
    if i > 1 then
      local aux = cave + d.off + payloads[i].dataOffset
      assert(readQword(aux + 8) == data and readQword(aux + 16) == target, 'Race auxiliary configuration mismatch')
      local expectedPointers
      if profile.cap and i == #specs then
        expectedPointers = { data, target, base + 0x47E8E98, base + 0x4856670,
          base + 0x402A618, base + 0x480BA50, base + profile.cap.resume }
      elseif payloads[i] == profile.floor then
        local spec = payloads[i]
        expectedPointers = {
          data,
          target,
          base + 0x47E8E98,
          base + 0x4856670,
          base + 0x402A618,
          base + 0x480A7F0,
          base + spec.skip,
          base + spec.resume,
          base + 0x47E8D9C,
        }
      elseif payloads[i] == profile.clock then
        expectedPointers = {
          data,
          target,
          base + 0x47E8E98,
          base + 0x4856670,
          base + 0x402A618,
          base + 0x480D390,
          base + 0x47E8E48,
          base + WP26.RACE_CLOCK111.resume,
          base + 0x47E8D9C,
        }
      elseif i == 2 or i == 3 then
        local spec = payloads[i]
        expectedPointers = {
          data,
          target,
          base + 0x47E8E98,
          base + 0x4856670,
          base + 0x402A618,
          base + 0x47E8D9B,
          base + spec.resume,
          base + spec.skip,
          base + spec.flag,
        }
      elseif i == 4 then
        local spec = payloads[i]
        expectedPointers = { data, target, base + 0x402A618, base + spec.setter, base + spec.resume }
      else
        local spec = payloads[i]
        expectedPointers = {
          data,
          target,
          base + 0x47E8E98,
          base + 0x4856670,
          base + 0x47F8238,
          base + 0x402A618,
          base + spec.skip,
          base + spec.resume,
          base + 0x47E8E48,
        }
      end
      for j, p in ipairs(expectedPointers) do
        assert(readQword(aux + 8 + (j - 1) * 8) == p, 'Race auxiliary pointer mismatch')
      end
    end
  end
  if dryRun then
    return {
      profile = profile.name,
      cave = cave,
      data = data,
      enabled = enabled,
      sites = #specs,
      bytes = (profile.name == '114' or (profile.name == '115' or profile.name == '128' or profile.name == '129' or profile.name == '130' or profile.name == '131' or profile.name == '134' or profile.name == '135' or profile.name == '137' or profile.name == '139' or profile.name == '142' or profile.name == '143' or profile.name == '144' or profile.name == '146')) and 121
        or ((profile.name == '111' or profile.name == '112') and 105 or 87),
    }
  end
  local names = { 'OpenProcess', 'CloseHandle', 'VirtualProtectEx', 'FlushInstructionCache' }
  local api = {}
  for _, name in ipairs(names) do
    api[name] = assert(getAddressSafe('kernel32.' .. name, true))
  end
  for _, name in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
    api[name] = assert(getAddressSafe('ntdll.' .. name, true))
  end
  local handle = executeCodeLocalEx(api.OpenProcess, 0xC38, 0, WP26.pid)
  assert(handle and handle ~= 0, 'Race recovery handle unavailable')
  local buffer = createMemoryStream()
  buffer.Size = 32
  local suspended = false
  local ok, err = pcall(function()
    assert((executeCodeLocal(api.NtSuspendProcess, handle) & 0xffffffff) == 0, 'Race recovery suspension failed')
    suspended = true
    for _, d in ipairs(specs) do
      assert(same(read(base + d.rva, d.n), d.current), 'Race code changed before recovery')
    end
    assert(readInteger(data) == enabled, 'Race enable state changed before recovery')
    assert(writeInteger(data, 0), 'Race disable write failed')
    for _, d in ipairs(specs) do
      local address = base + d.rva
      assert(same(read(address, d.n), d.current), 'Race code changed during recovery')
      assert(
        executeCodeLocalEx(api.VirtualProtectEx, handle, address, d.n, 0x40, buffer.Memory) ~= 0,
        'Race recovery protection failed'
      )
      local protection = readIntegerLocal(buffer.Memory)
      local writeOK, wrote = pcall(writeBytes, address, d.original)
      local restored = executeCodeLocalEx(api.VirtualProtectEx, handle, address, d.n, protection, buffer.Memory) ~= 0
      assert(
        writeOK and wrote and restored and same(read(address, d.n), d.original),
        'Race original code restoration failed'
      )
      assert(
        executeCodeLocalEx(api.FlushInstructionCache, handle, address, d.n) ~= 0,
        'Race recovery cache flush failed'
      )
    end
  end)
  local resumed = true
  if suspended then
    resumed = (executeCodeLocal(api.NtResumeProcess, handle) & 0xffffffff) == 0
  end
  executeCodeLocalEx(api.CloseHandle, handle)
  buffer.destroy()
  assert(resumed, 'Race recovery resume failed')
  if not ok then
    error(err, 0)
  end
  -- Keep the former allocation alive: a suspended thread may still finish inside it.
  WP26.lastRecovery085 = {
    cave = cave,
    data = data,
    profile = profile.name,
    sites = #specs,
    bytes = (profile.name == '114' or (profile.name == '115' or profile.name == '128' or profile.name == '129' or profile.name == '130' or profile.name == '131' or profile.name == '134' or profile.name == '135' or profile.name == '137' or profile.name == '139' or profile.name == '142' or profile.name == '143' or profile.name == '144' or profile.name == '146')) and 121
      or ((profile.name == '111' or profile.name == '112') and 105 or 87),
  }
  return #specs
end

-- Bind editable rows to the same configuration addresses embedded in the payload.
-- Do not depend on an address list's cached resolution of an older symbol.
function WP26.bindRaceConfig086()
  local c = assert(WP26_RACE_CONFIG, 'Race configuration unavailable')
  local list = getAddressList()
  for _, pair in ipairs({ { 112, c.factor }, { 113, c.target } }) do
    local row = list.getMemoryRecordByID(pair[1])
    if row then
      local address = string.format('%X', pair[2])
      if row.Address ~= address then
        row.Address = address
        row.reinterpret()
      end
      assert(row.CurrentAddress == pair[2], 'Race configuration binding mismatch')
    end
  end
end
local ensure086 = WP26.ensureRaceConfig
function WP26.ensureRaceConfig()
  local address = ensure086()
  WP26.bindRaceConfig086()
  return address
end
if WP26.attached() then
  WP26.ensureRaceConfig()
end

do
  do
    WP26.SPEC.staffNameSet088 = {
      rva = 1098400,
      pattern = '48 85 D2 0F 84 E7 00 00 00 48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 20 49 8B F8 48 8B F2 0F B7 D9 4D 85 C0 0F 84 B7 00 00 00 48 8B CA 48 89 6C',
    }
    WP26.SPEC.staffSurnameReadingSet088 = {
      rva = 1098816,
      pattern = '4C 8B C2 48 85 D2 74 71 8D 41 8C 66 83 F8 1F 77 14 0F B7 C0 48 6B C8 3C 48 8B 05 31 E1 F1 03 48 83 C0 2A EB 23 66 83 F9 73 B8 74 00 00 00 66 0F',
    }
    WP26.SPEC.staffGivenReadingSet088 = {
      rva = 1098944,
      pattern = '4C 8B C2 48 85 D2 74 71 8D 41 8C 66 83 F8 1F 77 14 0F B7 C0 48 6B C8 3C 48 8B 05 B1 E0 F1 03 48 83 C0 33 EB 23 66 83 F9 73 B8 74 00 00 00 66 0F',
    }
    -- Static EXE: dynamic staff ID116..147 => 60-byte records.
    -- 10C1C0/10C2A0 surname+08h/given+19h; 10C3A0/10C440 reading+2Ah;
    -- 10C3F0/10C4C0 reading+33h. No inferred date-of-birth field.
    local definitions088 = {
      { en = 'Family name', ja = '姓', off = 8, max = 16, dynamicStaffName088 = 0 },
      { en = 'Given name', ja = '名', off = 25, max = 16, dynamicStaffName088 = 1 },
      {
        en = 'Family name reading',
        ja = '姓（読み）',
        off = 42,
        max = 8,
        dynamicStaffName088 = 2,
        encodedName = true,
      },
      {
        en = 'Given name reading',
        ja = '名（読み）',
        off = 51,
        max = 8,
        dynamicStaffName088 = 3,
        encodedName = true,
      },
    }
    for _, f in ipairs(definitions088) do
      f.string = true
      f.bits = 8
      f.bit = 0
      f.source = '10C1C0/10C2A0;10C3A0/10C440;10C3F0/10C4C0; dynamic staff60B'
      table.insert(WP26.EDITORS.staff.fields, f)
    end
    local available088 = WP26.fieldAvailable
    function WP26.fieldAvailable(c, f)
      if f.dynamicStaffName088 ~= nil and not c.staffDynamic then
        return false
      end
      return available088(c, f)
    end
    local layout088 = WP26.fieldLayout
    function WP26.fieldLayout(c, f)
      if f.dynamicStaffName088 ~= nil then
        return f.off, 0, 8
      end
      return layout088(c, f)
    end
    local function updateCaption088(c)
      local d = WP26.EDITORS.staff
      local session = WP26.editorSessions[d.record]
      if session and session.id == c.id then
        local parent = getAddressList().getMemoryRecordByID(d.record)
        local name = WP26.entityName('staff', c.id, c)
        if parent then
          WP26.suffix[d.record] = name
          parent.Description = WP26.T(d.en, d.ja) .. ' : ' .. name
        end
      end
    end
    local write088 = WP26.writeField
    function WP26.writeField(c, f, value, journal)
      local index = f.dynamicStaffName088
      if index == nil then
        return write088(c, f, value, journal)
      end
      WP26.require()
      local fresh = WP26.context(c.key, c.id)
      assert(fresh.staffDynamic and fresh.primary == c.primary, 'Staff identity changed')
      assert(type(value) == 'string', 'Name must be text')
      local encoded, normalized
      if f.encodedName then
        encoded, normalized = WP26.encodeName(value)
      else
        encoded = utf8ToAnsi(value)
        normalized = value
      end
      if #encoded > f.max or encoded:find('%z') or (not f.encodedName and ansiToUtf8(encoded) ~= normalized) then
        error(
          WP26.T(
            'Name is too long or contains unsupported characters.',
            '名前が長すぎるか、使用できない文字を含みます。'
          ),
          0
        )
      end
      local old = WP26.fieldRead(fresh, f)
      if old == normalized then
        return
      end
      local before = assert(readBytes(c.primary, 60, true))
      local mem = assert(allocateMemory(64), 'Name buffer allocation failed')
      local input = {}
      for i = 1, 64 do
        input[i] = 0
      end
      for i = 1, #encoded do
        input[i] = encoded:byte(i)
      end
      local other = index == 0 and 25 or 8
      if index < 2 then
        for i = 0, 16 do
          input[33 + i] = before[other + i + 1]
        end
      end
      if not writeBytes(mem, input) then
        deAlloc(mem, 64)
        error('Name input write failed', 0)
      end
      local ok, e = pcall(function()
        if index == 0 then
          WP26.native('staffNameSet088', c.id, mem, mem + 32)
        elseif index == 1 then
          WP26.native('staffNameSet088', c.id, mem + 32, mem)
        else
          WP26.native(index == 2 and 'staffSurnameReadingSet088' or 'staffGivenReadingSet088', c.id, mem)
        end
      end)
      -- An uncertain native completion must keep its argument buffer alive.
      if not ok then
        WP26.pendingNativeBuffers088 = WP26.pendingNativeBuffers088 or {}
        WP26.pendingNativeBuffers088[mem] = true
        error(e, 0)
      end
      deAlloc(mem, 64)
      local after = assert(readBytes(c.primary, 60, true))
      if WP26.fieldRead(fresh, f) ~= normalized then
        local original = {}
        for i = 1, f.max + 1 do
          original[i] = before[f.off + i]
        end
        writeBytes(c.primary + f.off, original)
        error('Staff name verification failed', 0)
      end
      updateCaption088(fresh)
      if journal ~= false then
        WP26.history[#WP26.history + 1] =
          { kind = 'dynamicStaffName088', pid = WP26.pid, ctx = fresh, before = before, after = after }
      end
    end
    local undo088 = WP26.undoLast
    function WP26.undoLast()
      local h = WP26.history[#WP26.history]
      if not h or h.kind ~= 'dynamicStaffName088' then
        return undo088()
      end
      WP26.require()
      assert(h.pid == WP26.pid, 'Process changed')
      local c = WP26.context(h.ctx.key, h.ctx.id)
      assert(c.staffDynamic and c.primary == h.ctx.primary, 'Staff identity changed')
      local now = assert(readBytes(c.primary, 60, true))
      for i, b in ipairs(h.after) do
        assert(now[i] == b, 'Staff data changed')
      end
      assert(writeBytes(c.primary, h.before), 'Staff name restoration failed')
      now = assert(readBytes(c.primary, 60, true))
      for i, b in ipairs(h.before) do
        assert(now[i] == b, 'Staff name restoration mismatch')
      end
      WP26.history[#WP26.history] = nil
      updateCaption088(c)
    end
    WP26.dynamicStaffNamesLoaded088 = true
  end
end

do
  do
    WP26.SPEC.staffPersonGet088 = {
      rva = 1109376,
      pattern = 'B8 94 00 00 00 66 3B C8 73 38 8D 41 8C 66 83 F8 1F 76 2F 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 3A FC F0 03 48 C1',
    }
    WP26.SPEC.personSurnameSet088 = {
      rva = 1474528,
      pattern = '48 89 54 24 10 66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 48 D1 11 00 85 C0 75 02 EB 25 48 83 7C 24 38 00 75 02 EB 1B 0F B7 4C 24 30 E8 6E B6',
    }
    WP26.SPEC.personGivenSet088 = {
      rva = 1474672,
      pattern = '48 89 54 24 10 66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 B8 D0 11 00 85 C0 75 02 EB 25 48 83 7C 24 38 00 75 02 EB 1B 0F B7 4C 24 30 E8 DE B5',
    }
    WP26.SPEC.personSurnameReadingSet088 = {
      rva = 1475232,
      pattern = '48 89 54 24 10 66 89 4C 24 08 48 83 EC 48 48 8B 05 F3 76 99 03 48 33 C4 48 89 44 24 30 0F B7 4C 24 50 E8 79 CE 11 00 85 C0 75 02 EB 3A 48 83 7C',
    }
    WP26.SPEC.personGivenReadingSet088 = {
      rva = 1475360,
      pattern = '48 89 54 24 10 66 89 4C 24 08 48 83 EC 48 48 8B 05 73 76 99 03 48 33 C4 48 89 44 24 30 0F B7 4C 24 50 E8 F9 CD 11 00 85 C0 75 02 EB 3A 48 83 7C',
    }
    local primaryOffsets088 = { 16, 33, 50, 59 }
    local profileOffsets088 = { 12, 29, 46, 55 }
    local indices088 =
      { ['Family name'] = 0, ['Given name'] = 1, ['Family name reading'] = 2, ['Given name reading'] = 3 }
    for _, f in ipairs(WP26.EDITORS.staff.fields) do
      if f.base == 'staffProfile' and indices088[f.en] ~= nil then
        f.ordinaryStaffName088 = indices088[f.en]
        f.base = 'primary'
        f.off = primaryOffsets088[indices088[f.en] + 1]
        f.staffProfileOnly = nil
        f.ordinaryOnly = true
        f.source = '10C1C0/10C2A0;10C3A0/10C440;10C3F0/10C4C0;10ED80 optional person link'
      end
    end
    local function text088(address, f)
      return f.encodedName and WP26.decodeName(address, 9) or WP26.nameText(address, 16)
    end
    function WP26.needsStaffNameSync088(c, f)
      local index = f.ordinaryStaffName088
      if index == nil or c.staffDynamic or not c.staffProfile then
        return false
      end
      return text088(c.primary + primaryOffsets088[index + 1], f)
        ~= text088(c.staffProfile + profileOffsets088[index + 1], f)
    end
    local function caption088(c)
      for _, key in ipairs({ 'staff', 'farmStaff' }) do
        local d = WP26.EDITORS[key]
        local s = WP26.editorSessions[d.record]
        if s and s.id == c.id then
          local parent = getAddressList().getMemoryRecordByID(d.record)
          local name = WP26.nameText(c.primary + 16, 16) .. WP26.nameText(c.primary + 33, 16)
          if parent then
            WP26.suffix[d.record] = name
            parent.Description = WP26.T(d.en, d.ja) .. ' : ' .. name
          end
        end
      end
    end
    local ordinaryWrite088 = WP26.writeField
    function WP26.writeField(c, f, value, journal)
      local index = f.ordinaryStaffName088
      if index == nil then
        return ordinaryWrite088(c, f, value, journal)
      end
      WP26.require()
      local fresh = WP26.context(c.key, c.id)
      assert(
        not fresh.staffDynamic and fresh.primary == c.primary and fresh.staffProfile == c.staffProfile,
        'Staff identity changed'
      )
      local person = WP26.native('staffPersonGet088', c.id)
      assert(
        (person < 10000 and person == c.staffPersonID and c.staffProfile) or (person == 10000 and not c.staffProfile),
        'Staff person link changed'
      )
      local encoded, normalized
      if f.encodedName then
        encoded, normalized = WP26.encodeName(value)
      else
        encoded = utf8ToAnsi(value)
        normalized = value
      end
      if #encoded > f.max or encoded:find('%z') or (not f.encodedName and ansiToUtf8(encoded) ~= normalized) then
        error(
          WP26.T(
            'Name is too long or contains unsupported characters.',
            '名前が長すぎるか、使用できない文字を含みます。'
          ),
          0
        )
      end
      local off = primaryOffsets088[index + 1]
      local profileOff = profileOffsets088[index + 1]
      if
        text088(c.primary + off, f) == normalized
        and (not c.staffProfile or text088(c.staffProfile + profileOff, f) == normalized)
      then
        return
      end
      local ansiReading
      if f.encodedName then
        ansiReading = utf8ToAnsi(normalized)
        if #ansiReading > 16 or ansiToUtf8(ansiReading) ~= normalized then
          error('Reading encoding mismatch', 0)
        end
      end
      local beforeA = assert(readBytes(c.primary, 96, true))
      local beforeB = c.staffProfile and assert(readBytes(c.staffProfile, 140, true))
      local mem = assert(allocateMemory(128), 'Name buffer allocation failed')
      local input = {}
      for i = 1, 128 do
        input[i] = 0
      end
      for i = 1, #encoded do
        input[i] = encoded:byte(i)
      end
      if index < 2 then
        local other = index == 0 and 33 or 16
        for i = 0, 16 do
          input[33 + i] = beforeA[other + i + 1]
        end
      else
        for i = 1, #ansiReading do
          input[64 + i] = ansiReading:byte(i)
        end
      end
      if not writeBytes(mem, input) then
        deAlloc(mem, 128)
        error('Name input write failed', 0)
      end
      local ok, e = pcall(function()
        if index < 2 then
          WP26.native('staffNameSet088', c.id, index == 0 and mem or mem + 32, index == 0 and mem + 32 or mem)
          if c.staffProfile then
            WP26.native(index == 0 and 'personSurnameSet088' or 'personGivenSet088', person, mem)
          end
        else
          WP26.native(index == 2 and 'staffSurnameReadingSet088' or 'staffGivenReadingSet088', c.id, mem)
          if c.staffProfile then
            WP26.native(index == 2 and 'personSurnameReadingSet088' or 'personGivenReadingSet088', person, mem + 64)
          end
        end
      end)
      if not ok then
        WP26.pendingNativeBuffers088 = WP26.pendingNativeBuffers088 or {}
        WP26.pendingNativeBuffers088[mem] = true
        error(e, 0)
      end
      deAlloc(mem, 128)
      local afterA = assert(readBytes(c.primary, 96, true))
      local afterB = c.staffProfile and assert(readBytes(c.staffProfile, 140, true))
      if
        text088(c.primary + off, f) ~= normalized
        or (c.staffProfile and text088(c.staffProfile + profileOff, f) ~= normalized)
      then
        local original = {}
        for i = 1, f.max + 1 do
          original[i] = beforeA[off + i]
        end
        writeBytes(c.primary + off, original)
        if beforeB then
          original = {}
          for i = 1, f.max + 1 do
            original[i] = beforeB[profileOff + i]
          end
          writeBytes(c.staffProfile + profileOff, original)
        end
        error('Staff and person name verification failed', 0)
      end
      caption088(fresh)
      if journal ~= false then
        WP26.history[#WP26.history + 1] = {
          kind = 'ordinaryStaffName088',
          pid = WP26.pid,
          ctx = fresh,
          primaryBefore = beforeA,
          primaryAfter = afterA,
          profileBefore = beforeB,
          profileAfter = afterB,
        }
      end
    end
    local ordinaryUndo088 = WP26.undoLast
    function WP26.undoLast()
      local h = WP26.history[#WP26.history]
      if not h or h.kind ~= 'ordinaryStaffName088' then
        return ordinaryUndo088()
      end
      WP26.require()
      assert(h.pid == WP26.pid, 'Process changed')
      local c = WP26.context(h.ctx.key, h.ctx.id)
      assert(c.primary == h.ctx.primary and c.staffProfile == h.ctx.staffProfile, 'Staff identity changed')
      local regions = { { c.primary, h.primaryBefore, h.primaryAfter } }
      if h.profileBefore then
        regions[#regions + 1] = { c.staffProfile, h.profileBefore, h.profileAfter }
      end
      for _, r in ipairs(regions) do
        local now = assert(readBytes(r[1], #r[3], true))
        for i, b in ipairs(r[3]) do
          assert(now[i] == b, 'Staff name data changed')
        end
      end
      for _, r in ipairs(regions) do
        assert(writeBytes(r[1], r[2]), 'Staff name restoration failed')
        local now = assert(readBytes(r[1], #r[2], true))
        for i, b in ipairs(r[2]) do
          assert(now[i] == b, 'Staff name restoration mismatch')
        end
      end
      WP26.history[#WP26.history] = nil
      caption088(c)
    end
    WP26.ordinaryStaffNamesLoaded088 = true
    local staffEntity088 = WP26.entityName
    function WP26.entityName(key, id, c)
      if (key == 'staff' or key == 'farmStaff' or c.key == 'staff') and not c.staffDynamic then
        return WP26.nameText(c.primary + 16, 16) .. WP26.nameText(c.primary + 33, 16)
      end
      return staffEntity088(key, id, c)
    end
  end
  -- Local EXE FFDE0/FFE30 getters and FFE80/FFF10 nine-byte setters.
  if not WP26.ownerReadingsLoaded089 then
    for _, key in ipairs({ 'owner', 'player' }) do
      for index, label in ipairs({
        { 'Family name reading', '姓（読み）' },
        {
          'Given name reading',
          '名（読み）',
        },
      }) do
        table.insert(WP26.EDITORS[key].fields, {
          en = label[1],
          ja = label[2],
          off = index == 1 and 82 or 91,
          bit = 0,
          bits = 8,
          max = 8,
          string = true,
          encodedName = true,
          base = key == 'player' and 'playerOwner' or 'primary',
          source = index == 1 and 'FFDE0/FFE80; normal owner +52h' or 'FFE30/FFF10; normal owner +5Bh',
        })
      end
    end
    WP26.ownerReadingsLoaded089 = true
  end

  do
    WP26.SPEC.ownerCrownSet090 = {
      rva = 0x101020,
      pattern = '48 89 74 24 10 57 48 83 EC 20 B8 C4 11 00 00 48 63 FA 41 0F B7 F0 66 3B C8 73 73 83 FF 02 7D 6E 48 89 5C 24 30 B8 93 11 00 00 8D 59 D0 66 3B D8',
    }
    if not WP26.crownEditorLoaded090 then
      local positionsJa = { 'なし', '前', '後', '両方' }
      local positionsEn = { 'None', 'Prefix', 'Suffix', 'Both' }
      for _, key in ipairs({ 'owner', 'player' }) do
        for slot = 0, 1 do
          local base = key == 'player' and 'playerOwner' or 'primary'
          table.insert(WP26.EDITORS[key].fields, {
            en = 'Crown name ' .. (slot + 1),
            ja = '冠名' .. (slot + 1),
            off = 44 + slot * 2,
            bit = 0,
            bits = 16,
            max = 9,
            string = true,
            customSize079 = 2,
            crownName090 = slot,
            base = base,
            source = '100D90/101020;100E30; name pool A4E40',
          })
          table.insert(WP26.EDITORS[key].fields, {
            en = 'Crown position ' .. (slot + 1),
            ja = '冠名' .. (slot + 1) .. '：位置',
            off = 24,
            bit = 26 + slot * 2,
            bits = 2,
            max = 3,
            base = base,
            optionsJa = positionsJa,
            optionsEn = positionsEn,
            source = '1010C0/101190;189890',
          })
        end
        table.insert(WP26.EDITORS[key].fields, {
          en = 'Crown name usage',
          ja = '冠名の使い分け',
          off = 28,
          bit = 9,
          bits = 2,
          max = 2,
          base = key == 'player' and 'playerOwner' or 'primary',
          optionsJa = { 'なし', '牡牝', '自家生産' },
          optionsEn = { 'None', 'Sex', 'Homebred' },
          source = '1012B0/101310;1898C0',
        })
      end
      local read = WP26.fieldRead
      function WP26.fieldRead(c, f)
        if f.crownName090 ~= nil then
          return WP26.horseNamePart(readSmallInteger(c[f.base] + f.off))
        end
        return read(c, f)
      end
      local referenced = WP26.nameTokenReferenced079
      function WP26.nameTokenReferenced079(token)
        if referenced(token) then
          return true
        end
        for _, s in ipairs({ { WP26.data('owner'), 48, 140, 44 }, { WP26.namePointer(0x402A5D0), 4500, 72, 16 } }) do
          local bytes = readBytes(s[1], s[2] * s[3], true)
          if not bytes then
            return true
          end
          for i = 0, s[2] - 1 do
            local j = i * s[3] + s[4] + 1
            if bytes[j] + bytes[j + 1] * 256 == token or bytes[j + 2] + bytes[j + 3] * 256 == token then
              return true
            end
          end
        end
        return false
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if f.crownName090 == nil then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        local address = c[f.base] + f.off
        assert(fresh[f.base] + f.off == address, 'Owner identity changed')
        local encoded, normalized = WP26.encodeName(value)
        assert(#encoded <= 9, 'Crown name exceeds nine characters')
        if WP26.fieldRead(c, f) == normalized then
          return
        end
        local old = readSmallInteger(address)
        local token = 65535
        local h = { kind = 'crown090', pid = WP26.pid, key = c.key, id = c.id, field = f, address = address, old = old }
        if #encoded > 0 then
          local slot = WP26.native('horseNameFree079')
          assert(slot >= 2 and slot < 0x658F, 'Name storage is full')
          h.poolAddress = WP26.namePointer(0x4042678) + slot * 9
          h.poolBefore = assert(readBytes(h.poolAddress, 9, true))
          assert(h.poolBefore[1] == 0, 'Name slot changed')
          local mem = assert(allocateMemory(64))
          local bytes = {}
          local ansi = utf8ToAnsi(normalized)
          for i = 1, #ansi do
            bytes[i] = ansi:byte(i)
          end
          bytes[#bytes + 1] = 0
          assert(writeBytes(mem, bytes))
          local ok, result = pcall(WP26.native, 'horseNameAllocate079', mem)
          if not ok then
            WP26.pendingCrownBuffers090 = WP26.pendingCrownBuffers090 or {}
            WP26.pendingCrownBuffers090[mem] = true
            error(result, 0)
          end
          deAlloc(mem)
          token = result
          assert(token == 0x9470 + slot, 'Name allocation changed')
          h.token = token
          h.poolAfter = assert(readBytes(h.poolAddress, 9, true))
        end
        WP26.native('ownerCrownSet090', c.key == 'player' and 46 or c.id, f.crownName090, token)
        assert(
          readSmallInteger(address) == token and WP26.fieldRead(c, f) == normalized,
          'Crown name verification failed'
        )
        h.new = token
        if journal ~= false then
          WP26.history[#WP26.history + 1] = h
        end
      end
      local undo = WP26.undoLast
      function WP26.undoLast()
        local h = WP26.history[#WP26.history]
        if not h or h.kind ~= 'crown090' then
          return undo()
        end
        WP26.require()
        assert(h.pid == WP26.pid, 'Process changed')
        local c = WP26.context(h.key, h.id)
        assert(
          c[h.field.base] + h.field.off == h.address and readSmallInteger(h.address) == h.new,
          'Crown name changed'
        )
        WP26.native('ownerCrownSet090', h.key == 'player' and 46 or h.id, h.field.crownName090, h.old)
        assert(readSmallInteger(h.address) == h.old, 'Crown name restoration failed')
        if h.token then
          assert(WP26.releaseName079(h), 'Crown name pool is still referenced')
        end
        WP26.history[#WP26.history] = nil
      end
      WP26.crownEditorLoaded090 = true
    end
  end
  do
    WP26.SPEC.ownerDynamic091 = {
      rva = 0x103FC3,
      pattern = '48 8B 05 06 66 F2 03 48 8D 04 C8 48 83 C0 36 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC B8 94 11',
      disp = 3,
      len = 7,
      direct = false,
      target_rva = 0x402A5D0,
    }
    if not WP26.compactOwnerLoaded091 then
      WP26.EDITORS.owner.max = 4547
      local context = WP26.context
      function WP26.context(key, id)
        local c = context(key, id)
        if key == 'owner' and id >= WP26.entityCount180('ownerNormal') then
          c.ownerDynamic091 = true
          c.primary = WP26.data('ownerDynamic091') + (id - WP26.entityCount180('ownerNormal')) * 72
        end
        return c
      end
      local layout = WP26.fieldLayout
      function WP26.fieldLayout(c, f)
        if c.ownerDynamic091 then
          local offsets =
            { ['Family name'] = 20, ['Given name'] = 37, ['Family name reading'] = 54, ['Given name reading'] = 63 }
          if offsets[f.en] then
            return offsets[f.en], 0, 8
          end
          if f.crownName090 ~= nil then
            return 16 + f.crownName090 * 2, 0, 16
          end
          if f.source == '1010C0/101190;189890' then
            return 4, f.bit + 2, 2
          end
          if f.source == '1012B0/101310;1898C0' then
            return 8, 0, 2
          end
        end
        return layout(c, f)
      end
      local available = WP26.fieldAvailable
      function WP26.fieldAvailable(c, f)
        if c.ownerDynamic091 then
          if not f.string and f.source ~= '1010C0/101190;189890' and f.source ~= '1012B0/101310;1898C0' then
            return false
          end
        end
        return available(c, f)
      end
      local name = WP26.entityName
      function WP26.entityName(key, id, c)
        if c.ownerDynamic091 then
          return WP26.nameText(c.primary + 20, 16) .. WP26.nameText(c.primary + 37, 16)
        end
        return name(key, id, c)
      end
      local read = WP26.fieldRead
      function WP26.fieldRead(c, f)
        if c.ownerDynamic091 and f.crownName090 ~= nil then
          return WP26.horseNamePart(readSmallInteger(c.primary + 16 + f.crownName090 * 2))
        end
        return read(c, f)
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if c.ownerDynamic091 and f.crownName090 ~= nil then
          local copy = {}
          for k, v in pairs(f) do
            copy[k] = v
          end
          copy.off = 16 + f.crownName090 * 2
          return write(c, copy, value, journal)
        end
        local result = write(c, f, value, journal)
        if c.ownerDynamic091 and (f.en == 'Family name' or f.en == 'Given name') then
          local d = WP26.EDITORS.owner
          local s = WP26.editorSessions[d.record]
          local parent = getAddressList().getMemoryRecordByID(d.record)
          if s and s.id == c.id and parent then
            local full = WP26.entityName('owner', c.id, c)
            WP26.suffix[d.record] = full
            parent.Description = WP26.T(d.en, d.ja) .. ' : ' .. full
          end
        end
        return result
      end
      local rows = WP26.editorRows
      function WP26.editorRows(key)
        if key ~= 'owner' then
          return rows(key)
        end
        WP26.require()
        local result = {}
        local normal = WP26.data('owner')
        for id = 0, WP26.entityCount180('ownerNormal') - 1 do
          local c = { key = 'owner', id = id, primary = normal + id * 140 }
          local text = WP26.entityName('owner', id, c)
          if text ~= '' and not text:find('[%z\1-\31]') then
            result[#result + 1] = { id = id, name = text }
          end
        end
        local data = assert(readBytes(WP26.data('ownerDynamic091'), (WP26.entityCount180('owner') - WP26.entityCount180('ownerNormal')) * 72, true))
        local function text(start)
          local chars = {}
          for i = start, start + 15 do
            if data[i] == 0 then
              break
            end
            chars[#chars + 1] = string.char(data[i])
          end
          return ansiToUtf8(table.concat(chars))
        end
        for i = 0, WP26.entityCount180('owner') - WP26.entityCount180('ownerNormal') - 1 do
          local full = text(i * 72 + 21) .. text(i * 72 + 38)
          if full ~= '' and not full:find('[%z\1-\31]') then
            result[#result + 1] = { id = i + WP26.entityCount180('ownerNormal'), name = full }
          end
        end
        table.sort(result, function(a, b)
          if a.name == b.name then
            return a.id < b.id
          end
          return a.name < b.name
        end)
        return result
      end
      WP26.compactOwnerLoaded091 = true
    end
  end
  do
    WP26.SPEC.ownedFoalFind092 = {
      rva = 0xFAEC0,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 0D B3 FD FF 85 C0 75 07 B8 A0 00 00 00 EB 48 33 C0 66 89 44 24 20 EB 0D 0F B7 44 24 20 66 FF C0 66',
    }
    WP26.SPEC.ownedFoalHorse092 = {
      rva = 0xFAD70,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 6D C9 18 00 85 C0 75 07 B8 70 0D 00 00 EB 44 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 4E C9',
    }
    WP26.SPEC.ownedFoalGrowth092 = {
      rva = 0xFB0F0,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 E3 C5 18 00 85 C0 75 0A B8 A0 00 00 00 66 89 44 24 20 0F B7 44 24 20',
    }
    WP26.SPEC.ownedFoalYellowGet092 = {
      rva = 0xFB3D0,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 FF C2 18 00 85 C0 75 0A B8 A0 00 00 00 66 89 44 24 20 0F',
    }
    WP26.SPEC.ownedFoalYellowSet092 = {
      rva = 0xFB430,
      pattern = '44 88 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 9A C2 18 00 85 C0 75 0A B8 A0 00 00 00 66',
    }
    WP26.SPEC.ownedFoalGreenGet092 = {
      rva = 0xFB580,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 4F C1 18 00 85 C0 75 0A B8 A0 00 00 00 66 89 44 24 20 0F',
    }
    WP26.SPEC.ownedFoalGreenSet092 = {
      rva = 0xFB5E0,
      pattern = '44 88 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 EA C0 18 00 85 C0 75 0A B8 A0 00 00 00 66',
    }
    WP26.SPEC.ownedFoalDetails092 = {
      rva = 0xFB124,
      pattern = '48 8B 0D 0D 75 F4 03 48 8D 44 01 04 48 83 C4 38 C3 CC CC CC CC CC CC CC CC CC CC CC 48 89 54 24',
      disp = 3,
      len = 7,
      direct = false,
      target_rva = 0x4042638,
    }
    if not WP26.ownedFoalDetailsLoaded092 then
      local context = WP26.context
      function WP26.context(key, id)
        local c = context(key, id)
        if (key == 'foal' or key == 'ownedFoal') and WP26.bits(c.primary, 4, 14, 13) == 46 then
          local root = WP26.data('ownedFoalDetails092')
          WP26.ownedFoalLinks092 = WP26.ownedFoalLinks092 or {}
          local link = WP26.ownedFoalLinks092[id]
          if
            not link
            or link.pid ~= WP26.pid
            or link.root ~= root
            or link.horseID ~= c.horseID
            or WP26.bits(root + link.slot * 84, 0, 0, 12) ~= id
          then
            link = nil
            local bytes = assert(readBytes(root, 160 * 84, true))
            local slot
            for i = 0, 159 do
              local j = i * 84 + 1
              if ((bytes[j] + bytes[j + 1] * 256) & 0xFFF) == id then
                assert(slot == nil, 'Duplicate owned foal identity')
                slot = i
              end
            end
            if slot then
              local address = root + slot * 84
              assert(slot >= 0 and slot < 160 and WP26.bits(address, 0, 0, 12) == id, 'Owned foal identity mismatch')
              link = { pid = WP26.pid, root = root, horseID = c.horseID, slot = slot }
              WP26.ownedFoalLinks092[id] = link
            end
          end
          if link then
            c.ownedFoalSlot092 = link.slot
            c.ownedFoalDetails092 = root + link.slot * 84
          end
        end
        return c
      end
      local available = WP26.fieldAvailable
      function WP26.fieldAvailable(c, f)
        if f.ownedFoal092 and not c.ownedFoalDetails092 then
          return false
        end
        return available(c, f)
      end
      local names = {
        { 'Speed', 'スピード', 4, 0, 7 },
        { 'Acceleration', '瞬発力', 4, 11, 4 },
        { 'Guts', '勝負根性', 4, 7, 4 },
        { 'Power', 'パワー', 8, 0, 4 },
        { 'Flexibility', '柔軟性', 8, 4, 4 },
        { 'Mental strength', '精神力', 8, 8, 4 },
        { 'Intelligence', '賢さ', 8, 12, 4 },
        { 'Health', '健康', 8, 16, 4 },
      }
      for _, key in ipairs({ 'ownedFoal', 'foal' }) do
        for stat, n in ipairs(names) do
          table.insert(WP26.EDITORS[key].fields, {
            en = 'Growth bonus: ' .. n[1],
            ja = '育成加算：' .. n[2],
            off = n[3],
            bit = n[4],
            bits = n[5],
            max = (1 << n[5]) - 1,
            base = 'ownedFoalDetails092',
            ownedFoal092 = true,
            foalGrowthStat092 = stat - 1,
            groupEn = 'Growth bonuses',
            groupJa = '育成による能力加算',
            source = 'Current EXE FAEC0/FB0F0; D6420/DAB80/DACE0/DAE40/DAFA0/DB100/DB260/DB3B0; reference HOwnershipChildData',
          })
        end
        for color = 0, 1 do
          for stat, n in ipairs(names) do
            table.insert(WP26.EDITORS[key].fields, {
              en = (color == 0 and 'Yellow training: ' or 'Green training: ') .. n[1],
              ja = '育成度（' .. (color == 0 and '黄' or '緑') .. '）：' .. n[2],
              off = (color == 0 and 44 or 52) + stat - 1,
              bit = 0,
              bits = 8,
              max = 255,
              base = 'ownedFoalDetails092',
              ownedFoal092 = true,
              foalTraining092 = color,
              foalGrowthStat092 = stat - 1,
              groupEn = 'Training progress',
              groupJa = '育成度',
              source = color == 0 and 'Current EXE FB3D0/FB430; owned foal +2Ch'
                or 'Current EXE FB580/FB5E0; owned foal +34h',
            })
          end
        end
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if not f.ownedFoal092 then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(
          c.ownedFoalDetails092
            and fresh.ownedFoalDetails092 == c.ownedFoalDetails092
            and fresh.ownedFoalSlot092 == c.ownedFoalSlot092
            and fresh.horseID == c.horseID,
          'Owned foal changed'
        )
        assert(
          WP26.native('ownedFoalFind092', c.id) == fresh.ownedFoalSlot092
            and WP26.native('ownedFoalHorse092', fresh.ownedFoalSlot092) == c.id,
          'Owned foal changed before writing'
        )
        if f.foalTraining092 == nil then
          return write(fresh, f, value, journal)
        end
        assert(
          type(value) == 'number' and value % 1 == 0 and value >= 0 and value <= 255,
          'Training value is outside its byte range'
        )
        local old = WP26.fieldRead(fresh, f)
        if old == value then
          return
        end
        local setter = f.foalTraining092 == 0 and 'ownedFoalYellowSet092' or 'ownedFoalGreenSet092'
        local getter = f.foalTraining092 == 0 and 'ownedFoalYellowGet092' or 'ownedFoalGreenGet092'
        WP26.native(setter, fresh.ownedFoalSlot092, f.foalGrowthStat092, value)
        assert(
          WP26.fieldRead(fresh, f) == value
            and WP26.native(getter, fresh.ownedFoalSlot092, f.foalGrowthStat092) == value,
          'Native foal training verification failed'
        )
        if journal ~= false then
          WP26.history[#WP26.history + 1] =
            { kind = 'foalTraining092', pid = WP26.pid, ctx = fresh, field = f, old = old, new = value }
        end
      end
      local undo = WP26.undoLast
      function WP26.undoLast()
        local h = WP26.history[#WP26.history]
        if not h or h.kind ~= 'foalTraining092' then
          return undo()
        end
        WP26.require()
        assert(h.pid == WP26.pid, 'Process changed')
        local c = WP26.context(h.ctx.key, h.ctx.id)
        assert(
          c.ownedFoalDetails092 == h.ctx.ownedFoalDetails092
            and c.horseID == h.ctx.horseID
            and WP26.fieldRead(c, h.field) == h.new,
          'Owned foal training changed'
        )
        WP26.writeField(c, h.field, h.old, false)
        WP26.history[#WP26.history] = nil
      end
      WP26.ownedFoalDetailsLoaded092 = true
    end
  end
  do
    WP26.SPEC.ownedEffective01093 = {
      rva = 0xB82E0,
      pattern = '48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 83 EC 20 0F B7 F1 45 8B F9 B9 86 1A 00 00 0F B7 C6 66 2B C1 45 8B F0 B9 73 18 00 00 8B EA 66 3B',
    }
    WP26.SPEC.ownedEffective02093 = {
      rva = 0xCCCE0,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 6F B4 FE FF B9 2D 70 00 00 66 3B C1 73 19 0F B7 C0 4C 6B',
    }
    WP26.SPEC.ownedEffective03093 = {
      rva = 0xCCE30,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 1F B3 FE FF B9 2D 70 00 00 66 3B C1 73 1B 0F B7 C0 4C 6B',
    }
    WP26.SPEC.ownedEffective04093 = {
      rva = 0xCC990,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 BF B7 FE FF B9 2D 70 00 00 66 3B C1 73 1B 0F B7 C0 4C 6B',
    }
    WP26.SPEC.ownedEffective05093 = {
      rva = 0xCCAE0,
      pattern = '40 53 57 48 83 EC 28 48 89 6C 24 40 0F B7 F9 48 89 74 24 48 8B EA 4C 89 74 24 50 45 8B F0 4C 89 7C 24 20 45 8B F9 E8 65 B6 FE FF B9 2D 70 00 00',
    }
    WP26.SPEC.ownedEffective06093 = {
      rva = 0xCD0C0,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 8F B0 FE FF B9 2D 70 00 00 66 3B C1 73 18 0F B7 C0 4C 6B',
    }
    WP26.SPEC.ownedEffective07093 = {
      rva = 0xCCF80,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 CF B1 FE FF B9 2D 70 00 00 66 3B C1 73 19 0F B7 C0 4C 6B',
    }
    WP26.SPEC.ownedEffective08093 = {
      rva = 0xCC840,
      pattern = '48 89 5C 24 18 57 48 83 EC 20 48 89 6C 24 30 0F B7 F9 48 89 74 24 38 41 8B E9 8B F2 E8 0F B9 FE FF B9 2D 70 00 00 66 3B C1 73 18 0F B7 C0 4C 6B',
    }
    if not WP26.ownedGrowthLoaded093 then
      local names = {
        { 'Speed', 'スピード', 256, 0, 7 },
        { 'Acceleration', '瞬発力', 256, 11, 4 },
        { 'Guts', '勝負根性', 256, 7, 4 },
        { 'Power', 'パワー', 260, 0, 4 },
        { 'Flexibility', '柔軟性', 260, 4, 4 },
        { 'Mental strength', '精神力', 260, 8, 4 },
        { 'Intelligence', '賢さ', 260, 12, 4 },
        { 'Health', '健康', 260, 16, 4 },
      }
      for index, n in ipairs(names) do
        table.insert(WP26.EDITORS.owned.fields, {
          en = 'Growth bonus: ' .. n[1],
          ja = '育成加算：' .. n[2],
          off = n[3],
          bit = n[4],
          bits = n[5],
          max = (1 << n[5]) - 1,
          base = 'primary',
          ownedGrowth093 = index,
          groupEn = 'Growth bonuses',
          groupJa = '育成による能力加算',
          source = 'Current EXE FC920; owned+100h growth block; effective getter validated separately',
        })
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if not f.ownedGrowth093 then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(
          c.key == 'owned'
            and fresh.primary == c.primary
            and fresh.raceID == c.raceID
            and fresh.horseID == c.horseID
            and WP26.bits(fresh.race, 36, 0, 13) == 46,
          'Owned racehorse changed'
        )
        return write(fresh, f, value, journal)
      end
      WP26.ownedGrowthLoaded093 = true
    end
  end
  do
    WP26.SPEC.ownerTrainerGet094 = {
      rva = 0x102480,
      pattern = 'B8 C4 11 00 00 66 3B C8 0F 83 D1 00 00 00 83 FA 02 0F 8D C8 00 00 00 44 8D 41 D0 B8 93 11 00 00 66 44 3B C0 77 56 85 D2 74 30 83 FA 01 74 09 BA',
    }
    WP26.SPEC.ownerTrainerSet094 = {
      rva = 0x102570,
      pattern = '48 89 5C 24 10 48 89 6C 24 18 48 89 7C 24 20 41 56 48 83 EC 20 41 0F B7 F8 41 BE 2E 03 00 00 8B DA 0F B7 E9 66 41 3B FE 76 21 BA 01 00 00 00 0F',
    }
    if not WP26.ownerTrainersLoaded094 then
      for _, key in ipairs({ 'owner', 'player' }) do
        for slot = 0, 1 do
          table.insert(WP26.EDITORS[key].fields, {
            en = 'Preferred trainer ' .. (slot + 1),
            ja = '預託調教師' .. (slot + 1),
            off = slot == 0 and 12 or 24,
            bit = slot == 0 and 20 or 0,
            bits = 10,
            max = 814,
            base = key == 'player' and 'playerOwner' or 'primary',
            ownerTrainer094 = slot,
            groupEn = 'Preferred trainers',
            groupJa = '預託調教師',
            source = 'Current EXE 102480/102570; normal140B and compact72B layouts verified',
          })
        end
      end
      local layout = WP26.fieldLayout
      function WP26.fieldLayout(c, f)
        if f.ownerTrainer094 ~= nil and c.ownerDynamic091 then
          return 4, 8 + f.ownerTrainer094 * 10, 10
        end
        return layout(c, f)
      end
      local available = WP26.fieldAvailable
      function WP26.fieldAvailable(c, f)
        if f.ownerTrainer094 ~= nil then
          return c.key == 'owner' or c.key == 'player'
        end
        return available(c, f)
      end
      local add = WP26.addNativeField
      function WP26.addNativeField(parent, key, index, c, session)
        local f = WP26.EDITORS[key].fields[index]
        if f.ownerTrainer094 ~= nil then
          if not session.ownerTrainerChoices094 then
            local choices = WP26.editorRows('trainer')
            choices[#choices + 1] = { id = 814, en = 'None', ja = 'なし' }
            session.ownerTrainerChoices094 = choices
          end
          f.choices = session.ownerTrainerChoices094
        end
        return add(parent, key, index, c, session)
      end
      local write = WP26.writeField
      local function identity(c, f)
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert((c.key == 'owner' or c.key == 'player') and fresh[f.base] == c[f.base], 'Owner identity changed')
        return fresh, c.key == 'player' and 46 or c.id
      end
      local function restore(c, f, value)
        local copy = {}
        for k, v in pairs(f) do
          copy[k] = v
        end
        copy.max = 1023
        write(c, copy, value, false)
      end
      function WP26.writeField(c, f, value, journal)
        if f.ownerTrainer094 == nil then
          return write(c, f, value, journal)
        end
        local fresh, owner = identity(c, f)
        assert(
          type(value) == 'number' and value % 1 == 0 and value >= 0 and value <= 814,
          'Trainer value is out of range'
        )
        if value ~= 814 then
          local t = WP26.context('trainer', value)
          assert(WP26.entityName('trainer', value, t) ~= '', 'Trainer name unavailable')
        end
        local old = WP26.fieldRead(fresh, f)
        if old == value then
          return
        end
        WP26.native('ownerTrainerSet094', owner, f.ownerTrainer094, value)
        if
          WP26.fieldRead(fresh, f) ~= value or WP26.native('ownerTrainerGet094', owner, f.ownerTrainer094) ~= value
        then
          local current = identity(c, f)
          restore(current, f, old)
          error('Owner trainer verification failed', 0)
        end
        if journal ~= false then
          WP26.history[#WP26.history + 1] =
            { kind = 'ownerTrainer094', pid = WP26.pid, ctx = fresh, field = f, old = old, new = value }
        end
      end
      local undo = WP26.undoLast
      function WP26.undoLast()
        local h = WP26.history[#WP26.history]
        if not h or h.kind ~= 'ownerTrainer094' then
          return undo()
        end
        local c, owner = identity(h.ctx, h.field)
        assert(h.pid == WP26.pid and WP26.fieldRead(c, h.field) == h.new, 'Owner trainer changed')
        restore(c, h.field, h.old)
        assert(
          WP26.native('ownerTrainerGet094', owner, h.field.ownerTrainer094) == h.old,
          'Owner trainer restoration failed'
        )
        WP26.history[#WP26.history] = nil
      end
      WP26.ownerTrainersLoaded094 = true
    end
  end
  do
    WP26.SPEC.gear1Get095 = {
      rva = 0xBD690,
      pattern = '48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 5A BE E0 03 00 75 29 BA 2E 33 00 00 0F B7 C1',
    }
    WP26.SPEC.gear1Set095 = {
      rva = 0xBD700,
      pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D E7 BD E0 03 00 75 22 BA 2E 33 00 00',
    }
    WP26.SPEC.gear2Get095 = {
      rva = 0xBD770,
      pattern = '48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 7A BD E0 03 00 75 29 BA 2E 33 00 00 0F B7 C1',
    }
    WP26.SPEC.gear2Set095 = {
      rva = 0xBD7E0,
      pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 07 BD E0 03 00 75 22 BA 2E 33 00 00',
    }
    WP26.SPEC.gear3Get095 = {
      rva = 0xBD850,
      pattern = '48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 9A BC E0 03 00 75 29 BA 2E 33 00 00 0F B7 C1',
    }
    WP26.SPEC.gear3Set095 = {
      rva = 0xBD8C0,
      pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 27 BC E0 03 00 75 22 BA 2E 33 00 00',
    }
    WP26.SPEC.gear4Get095 = {
      rva = 0xBD930,
      pattern = '48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D BA BB E0 03 00 75 29 BA 2E 33 00 00 0F B7 C1',
    }
    WP26.SPEC.gear4Set095 = {
      rva = 0xBD9A0,
      pattern = '48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 47 BB E0 03 00 75 22 BA 2E 33 00 00',
    }
    WP26.SPEC.gear5Get095 = {
      rva = 0xBDA10,
      pattern = '48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D DA BA E0 03 00 75 29 BA 2E 33 00 00 0F B7 C1',
    }
    WP26.SPEC.gear5Set095 = {
      rva = 0xBDA80,
      pattern = '48 83 EC 28 44 8B DA 83 FA 02 7D 5A B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 62 BA E0 03 00 75 22',
    }
    if not WP26.gearLoaded095 then
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Headgear color',
        ja = '頭部装備の色',
        off = 0,
        bit = 15,
        bits = 5,
        max = 31,
        base = 'race',
        raceSetter = 'gear1Set095',
        gear095 = 1,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
          { id = 9, en = 'Purple', ja = '紫' },
          { id = 15, en = 'Racing silks', ja = '勝負服' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD690/BD700; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.race.fields, {
        en = 'Headgear color',
        ja = '頭部装備の色',
        off = 0,
        bit = 15,
        bits = 5,
        max = 31,
        base = 'race',
        raceSetter = 'gear1Set095',
        gear095 = 1,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
          { id = 9, en = 'Purple', ja = '紫' },
          { id = 15, en = 'Racing silks', ja = '勝負服' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD690/BD700; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Shadow roll / cheekpieces color',
        ja = 'シャドーロール・チークの色',
        off = 0,
        bit = 20,
        bits = 5,
        max = 9,
        base = 'race',
        raceSetter = 'gear2Set095',
        gear095 = 2,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
          { id = 9, en = 'Purple', ja = '紫' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD770/BD7E0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.race.fields, {
        en = 'Shadow roll / cheekpieces color',
        ja = 'シャドーロール・チークの色',
        off = 0,
        bit = 20,
        bits = 5,
        max = 9,
        base = 'race',
        raceSetter = 'gear2Set095',
        gear095 = 2,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
          { id = 9, en = 'Purple', ja = '紫' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD770/BD7E0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Bandage color',
        ja = 'バンテージの色',
        off = 0,
        bit = 25,
        bits = 5,
        max = 31,
        base = 'race',
        raceSetter = 'gear3Set095',
        gear095 = 3,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD850/BD8C0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.race.fields, {
        en = 'Bandage color',
        ja = 'バンテージの色',
        off = 0,
        bit = 25,
        bits = 5,
        max = 31,
        base = 'race',
        raceSetter = 'gear3Set095',
        gear095 = 3,
        choices = {
          { id = 0, en = 'None', ja = 'なし' },
          { id = 1, en = 'White', ja = '白' },
          { id = 2, en = 'Black', ja = '黒' },
          { id = 3, en = 'Red', ja = '赤' },
          { id = 4, en = 'Blue', ja = '青' },
          { id = 5, en = 'Yellow', ja = '黄' },
          { id = 6, en = 'Green', ja = '緑' },
          { id = 7, en = 'Orange', ja = '橙' },
          { id = 8, en = 'Pink', ja = '桃' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD850/BD8C0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Headgear type',
        ja = '頭部装備の種類',
        off = 0,
        bit = 30,
        bits = 2,
        max = 3,
        base = 'race',
        raceSetter = 'gear4Set095',
        gear095 = 4,
        choices = { { id = 0, en = 'Hood', ja = 'メンコ' }, { id = 1, en = 'Blinkers', ja = 'ブリンカー' } },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD930/BD9A0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.race.fields, {
        en = 'Headgear type',
        ja = '頭部装備の種類',
        off = 0,
        bit = 30,
        bits = 2,
        max = 3,
        base = 'race',
        raceSetter = 'gear4Set095',
        gear095 = 4,
        choices = { { id = 0, en = 'Hood', ja = 'メンコ' }, { id = 1, en = 'Blinkers', ja = 'ブリンカー' } },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BD930/BD9A0; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Shadow roll / cheekpieces',
        ja = 'シャドーロール・チークの種類',
        off = 36,
        bit = 30,
        bits = 2,
        max = 1,
        base = 'race',
        raceSetter = 'gear5Set095',
        gear095 = 5,
        choices = {
          { id = 0, en = 'Shadow roll', ja = 'シャドーロール' },
          { id = 1, en = 'Cheekpieces', ja = 'チークピーシーズ' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BDA10/BDA80; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      table.insert(WP26.EDITORS.race.fields, {
        en = 'Shadow roll / cheekpieces',
        ja = 'シャドーロール・チークの種類',
        off = 36,
        bit = 30,
        bits = 2,
        max = 1,
        base = 'race',
        raceSetter = 'gear5Set095',
        gear095 = 5,
        choices = {
          { id = 0, en = 'Shadow roll', ja = 'シャドーロール' },
          { id = 1, en = 'Cheekpieces', ja = 'チークピーシーズ' },
        },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE BDA10/BDA80; renderer 2C070/C6DD90/C6E000/C6E0E0/C6E170',
      })
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if not f.gear095 then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(
          fresh.race == c.race and fresh.raceID == c.raceID and fresh.horseID == c.horseID,
          'Racehorse identity changed'
        )
        return write(fresh, f, value, journal)
      end
      WP26.gearLoaded095 = true
    end
  end
  do
    WP26.SPEC.breeding1Get096 = {
      rva = 0xDDB50,
      pattern = '66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 6D FE FF FF 6B C0 32 48 83 C4 28 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC',
    }
    WP26.SPEC.breeding1Set096 = {
      rva = 0xDDB80,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 28 33 D2 8B 44 24 38 B9 32 00 00 00 F7 F1 8B D0 0F B7 4C 24 30 E8 7A FE FF FF 48 83 C4 28 C3 CC CC CC CC CC',
    }
    WP26.SPEC.breeding2Get096 = {
      rva = 0xDD790,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ED 8B FA FF 85 C0 75 04 33 C0 EB 1C 0F B7 4C 24 40 E8 5B C9 11 00 8B 00 C1 E8 14 25 FF 03 00 00 89',
    }
    WP26.SPEC.breeding2Set096 = {
      rva = 0xDD7E0,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 99 8B FA FF 85 C0 74 0A 81 7C 24 48 E7 03 00 00 76 02 EB 33 0F B7 4C 24 40 E8 FF C8 11',
    }
    WP26.SPEC.breeding3Get096 = {
      rva = 0xDD8B0,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 CD 8A FA FF 85 C0 75 04 33 C0 EB 1D 0F B7 4C 24 40 E8 3B C8 11 00 8B 40 04 C1 E8 10 25 FF 03 00 00',
    }
    WP26.SPEC.breeding3Set096 = {
      rva = 0xDD900,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 79 8A FA FF 85 C0 74 0A 81 7C 24 48 E7 03 00 00 76 02 EB 37 0F B7 4C 24 40 E8 DF C7 11',
    }
    if not WP26.breedingLoaded096 then
      table.insert(WP26.EDITORS.sire.fields, {
        en = 'Stud fee (10,000 yen)',
        ja = '種付け料（万円）',
        off = 12,
        bit = 20,
        bits = 7,
        max = 5000,
        displayScale = 50,
        base = 'primary',
        breeding096 = 1,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DDB50/DDB80; independent setter bounds and displayed units',
      })
      table.insert(WP26.EDITORS.ownedSire.fields, {
        en = 'Stud fee (10,000 yen)',
        ja = '種付け料（万円）',
        off = 12,
        bit = 20,
        bits = 7,
        max = 5000,
        displayScale = 50,
        base = 'primary',
        breeding096 = 1,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DDB50/DDB80; independent setter bounds and displayed units',
      })
      table.insert(WP26.EDITORS.sire.fields, {
        en = 'Progeny graded wins',
        ja = '産駒の重賞勝利数',
        off = 0,
        bit = 20,
        bits = 10,
        max = 999,
        displayScale = 1,
        base = 'primary',
        breeding096 = 2,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DD790/DD7E0; independent setter bounds and displayed units',
      })
      table.insert(WP26.EDITORS.ownedSire.fields, {
        en = 'Progeny graded wins',
        ja = '産駒の重賞勝利数',
        off = 0,
        bit = 20,
        bits = 10,
        max = 999,
        displayScale = 1,
        base = 'primary',
        breeding096 = 2,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DD790/DD7E0; independent setter bounds and displayed units',
      })
      table.insert(WP26.EDITORS.sire.fields, {
        en = 'Progeny G1 wins',
        ja = '産駒のG1勝利数',
        off = 4,
        bit = 16,
        bits = 10,
        max = 999,
        displayScale = 1,
        base = 'primary',
        breeding096 = 3,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DD8B0/DD900; independent setter bounds and displayed units',
      })
      table.insert(WP26.EDITORS.ownedSire.fields, {
        en = 'Progeny G1 wins',
        ja = '産駒のG1勝利数',
        off = 4,
        bit = 16,
        bits = 10,
        max = 999,
        displayScale = 1,
        base = 'primary',
        breeding096 = 3,
        groupEn = 'Breeding records',
        groupJa = '種牡馬成績・種付け',
        source = 'Current EXE DD8B0/DD900; independent setter bounds and displayed units',
      })
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if not f.breeding096 then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(
          (c.key == 'sire' or c.key == 'ownedSire') and fresh.primary == c.primary and fresh.horseID == c.horseID,
          'Breeding horse identity changed'
        )
        assert(
          type(value) == 'number'
            and value % 1 == 0
            and value >= 0
            and value <= f.max
            and value % (f.displayScale or 1) == 0,
          'Value outside supported range or increment'
        )
        local old = WP26.fieldRead(fresh, f)
        if old == value then
          return
        end
        local setter = 'breeding' .. f.breeding096 .. 'Set096'
        local getter = 'breeding' .. f.breeding096 .. 'Get096'
        WP26.native(setter, c.id, value)
        if WP26.fieldRead(fresh, f) ~= value or WP26.native(getter, c.id) ~= value then
          WP26.native(setter, c.id, old)
          error('Breeding update readback failed', 0)
        end
        if journal ~= false then
          WP26.history[#WP26.history + 1] =
            { pid = WP26.pid, ctx = fresh, field = f, old = old, new = value, address = fresh.primary + f.off }
        end
      end
      WP26.breedingLoaded096 = true
    end
  end
  do
    if not WP26.gearPaletteLoaded097 then
      local head = {
        { 10, 'Red / white pattern', '赤・白（模様）' },
        { 11, 'Green / white pattern', '緑・白（模様）' },
        { 12, 'Blue / white pattern', '青・白（模様）' },
        { 13, 'Blue / white alternate pattern', '青・白（別柄）' },
        { 14, 'Pink / green pattern', '桃・緑（模様）' },
      }
      local bandage = {
        { 9, 'White / black', '白・黒' },
        { 10, 'White / red', '白・赤' },
        { 11, 'White / blue', '白・青' },
        { 12, 'White / blue alternate pattern', '白・青（別柄）' },
        { 13, 'White / yellow', '白・黄' },
        { 14, 'White / green', '白・緑' },
        { 15, 'Black / white', '黒・白' },
        { 16, 'Black / red', '黒・赤' },
        { 17, 'Black / yellow', '黒・黄' },
        { 18, 'Red / white', '赤・白' },
        { 19, 'Red / green', '赤・緑' },
        { 20, 'Blue / white', '青・白' },
        { 21, 'Blue / black', '青・黒' },
        { 22, 'Blue / red', '青・赤' },
        { 23, 'Blue / yellow', '青・黄' },
        { 24, 'Yellow / black', '黄・黒' },
        { 25, 'Yellow / red', '黄・赤' },
        { 26, 'Yellow / blue', '黄・青' },
        { 27, 'Green / white', '緑・白' },
        { 28, 'Pink / white', '桃・白' },
        { 29, 'Pink / white alternate pattern', '桃・白（別柄）' },
        { 30, 'Pink / red', '桃・赤' },
        { 31, 'Pink / blue', '桃・青' },
      }
      for _, key in ipairs({ 'owned', 'race' }) do
        for _, f in ipairs(WP26.EDITORS[key].fields) do
          local additions = f.gear095 == 1 and head or f.gear095 == 3 and bandage
          if additions then
            local exists = {}
            for _, c in ipairs(f.choices) do
              exists[c.id] = true
            end
            for _, n in ipairs(additions) do
              assert(not exists[n[1]], 'Duplicate gear choice')
              f.choices[#f.choices + 1] = { id = n[1], en = n[2], ja = n[3] }
            end
            table.sort(f.choices, function(a, b)
              return a.id < b.id
            end)
            f.source = f.source
              .. '; current EXE C6DD90/C6E000/C720D0; color pairs and distinct pattern branches verified'
          end
        end
      end
      WP26.gearPaletteLoaded097 = true
    end
  end
  do
    WP26.SPEC.trainerDedicatedGet097 = {
      rva = 0x115BC0,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 ED 07 F7 FF 85 C0 75 07 B8 59 03 00 00 EB 3D 0F B7 4C 24 40 E8 68 CF FF FF 85 C0 74 14 0F B7 4C 24',
    }
    WP26.SPEC.trainerDedicatedSet097 = {
      rva = 0x115C30,
      pattern = '66 89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 78 07 F7 FF 85 C0 75 02 EB 68 0F B7 4C 24 40 E8 F8 CE FF FF 85 C0 74 19 0F B7 4C 24',
    }
    WP26.SPEC.trainerPreferredGet097 = {
      rva = 0x115D40,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 69 06 F7 FF 85 C0 74 07 83 7C 24 48 02 7C 07 B8 59 03 00 00 EB 6E 0F B7 4C 24 40 E8 DD',
    }
    WP26.SPEC.trainerPreferredSet097 = {
      rva = 0x115DF0,
      pattern = '66 44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 B3 05 F7 FF 85 C0 74 07 83 7C 24 58 02 7C 05 E9 AA 00 00 00 0F B7 4C',
    }
    if not WP26.trainerJockeysLoaded097 then
      for slot = 0, 2 do
        table.insert(WP26.EDITORS.trainer.fields, {
          en = slot == 0 and 'Dedicated jockey' or 'Preferred jockey ' .. slot,
          ja = slot == 0 and '専属騎手' or '主戦騎手' .. slot,
          off = slot * 4,
          bit = 0,
          bits = 10,
          max = 857,
          base = 'primary',
          trainerJockey097 = slot,
          groupEn = 'Jockeys',
          groupJa = '騎手',
          source = 'EXE115BC0/115C30;115D40/115DF0; normal148B trainer layout',
        })
      end
      local available = WP26.fieldAvailable
      function WP26.fieldAvailable(c, f)
        if f.trainerJockey097 ~= nil then
          return c.key == 'trainer' and not c.personDynamic
        end
        return available(c, f)
      end
      local add = WP26.addNativeField
      function WP26.addNativeField(parent, key, index, c, session)
        local f = WP26.EDITORS[key].fields[index]
        if f.trainerJockey097 ~= nil then
          if not session.trainerJockeyChoices097 then
            local choices = WP26.editorRows('jockey')
            choices[#choices + 1] = { id = 857, en = 'None', ja = 'なし' }
            session.trainerJockeyChoices097 = choices
          end
          f.choices = session.trainerJockeyChoices097
        end
        return add(parent, key, index, c, session)
      end
      function WP26.trainerJockeyNativeGet097(id, slot)
        if slot == 0 then
          return WP26.native('trainerDedicatedGet097', id)
        end
        return WP26.native('trainerPreferredGet097', id, slot - 1)
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if f.trainerJockey097 == nil then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(
          c.key == 'trainer' and not fresh.personDynamic and fresh.primary == c.primary,
          'Trainer identity changed'
        )
        assert(
          type(value) == 'number' and value % 1 == 0 and value >= 0 and value <= 857,
          'Jockey outside supported range'
        )
        local old = WP26.fieldRead(fresh, f)
        if old == value then
          return
        end
        local slot = f.trainerJockey097
        local function set(v)
          if slot == 0 then
            WP26.native('trainerDedicatedSet097', c.id, v)
          else
            WP26.native('trainerPreferredSet097', c.id, slot - 1, v)
          end
        end
        set(value)
        if WP26.fieldRead(fresh, f) ~= value or WP26.trainerJockeyNativeGet097(c.id, slot) ~= value then
          set(old)
          error('Trainer jockey write did not apply', 0)
        end
        if journal ~= false then
          WP26.history[#WP26.history + 1] =
            { pid = WP26.pid, ctx = fresh, field = f, old = old, new = value, address = fresh.primary + f.off }
        end
      end
      WP26.trainerJockeysLoaded097 = true
    end
  end
  do
    WP26.SPEC.horseProgenyGet097 = {
      rva = 0xA7150,
      pattern = 'B8 2D 70 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 38 48 8B 05 ED 75 F7 03 8B 04 01 C1 E8 0E 83 E0 0F C3 CC CC CC CC CC CC CC CC CC CC CC',
    }
    WP26.SPEC.horseProgenySet097 = {
      rva = 0xA7180,
      pattern = 'B8 2D 70 00 00 66 3B C8 73 23 83 FA 0B 7D 1E 0F B7 C1 83 E2 0F 48 6B C8 38 48 8B 05 B8 75 F7 03 C1 E2 0E 81 24 01 FF 3F FC FF 09 14 01 C3 CC CC',
    }
    if not WP26.progenyQualityLoaded097 then
      for _, key in ipairs({ 'owned', 'race', 'ownedFoal', 'foal', 'ownedMare', 'mare', 'ownedSire', 'sire' }) do
        local exists = false
        for _, f in ipairs(WP26.EDITORS[key].fields) do
          if f.progeny097 then
            exists = true
            break
          end
        end
        if not exists then
          table.insert(WP26.EDITORS[key].fields, {
            en = 'Progeny quality',
            ja = '子出し',
            off = 0,
            bit = 14,
            bits = 4,
            min = 0,
            max = 10,
            base = 'horse',
            setter = 'horseProgenySet097',
            progeny097 = true,
            groupEn = 'Breeding ability',
            groupJa = '繁殖能力',
            source = 'EXE A7150/A7180; sire DD2F0; inheritance803000 uses sire/mare values with0..10 cap',
          })
        end
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if not f.progeny097 then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(fresh.horse == c.horse and fresh.horseID == c.horseID, 'Horse identity changed')
        return write(fresh, f, value, journal)
      end
      WP26.progenyQualityLoaded097 = true
    end
  end
  do
    WP26.SPEC.gearAutoGet097 = {
      rva = 0xF3240,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 1D 44 19 00 85 C0 75 04 33 C0 EB 47 0F B7 44 24 40 66 89 44 24 20 0F B7 4C 24 20 E8 01 44 19 00 85',
    }
    WP26.SPEC.gearAutoSet097 = {
      rva = 0xF32B0,
      pattern = '89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 A9 43 19 00 85 C0 74 07 83 7C 24 48 02 7E 02 EB 5F 0F B7 44 24 40 66 89 44 24 20 0F B7',
    }
    WP26.SPEC.gearOwnedSlotGet097 = {
      rva = 0xF2730,
      pattern = '66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 9D D8 19 00 66 89 44 24 20 0F B7 44 24 20 48 83 C4 38 C3 CC CC CC CC CC CC CC CC CC CC CC CC CC CC',
    }
    WP26.SPEC.gearAutoApply097 = {
      rva = 0x952A30,
      pattern = '40 53 48 83 EC 20 0F B7 D9 E8 F2 FC 79 FF 0F B7 C8 E8 FA 07 7A FF 83 F8 01 75 13 0F B7 CB E8 DD 24 FE FF B8 01 00 00 00 48 83 C4 20 5B C3 33 C0',
    }
    if not WP26.gearManualLoaded097 then
      table.insert(WP26.EDITORS.owned.fields, {
        en = 'Automatic equipment',
        ja = 'オート馬具',
        off = 12,
        bit = 27,
        bits = 1,
        max = 1,
        base = 'primary',
        gearAutoMode097 = true,
        choices = { { id = 0, en = 'Manual', ja = '手動' }, { id = 1, en = 'Automatic', ja = '自動' } },
        groupEn = 'Equipment',
        groupJa = '馬具',
        source = 'EXE F3240/F32B0;952A30 gates934F30 reset',
      })
      function WP26.ownedGearIdentity097(c)
        local slot, address
        if c.key == 'owned' then
          slot = c.id
          address = c.primary
        else
          slot = WP26.native('gearOwnedSlotGet097', c.raceID)
          if slot >= 640 then
            return
          end
          address = WP26.data('owned') + slot * 760
        end
        assert(WP26.bits(address, 4, 2, 14) == c.raceID, 'Ownership backlink changed')
        return slot, address
      end
      local write = WP26.writeField
      function WP26.writeField(c, f, value, journal)
        if f.gearAutoMode097 then
          WP26.require()
          local fresh = WP26.context(c.key, c.id)
          assert(c.key == 'owned' and fresh.primary == c.primary and fresh.raceID == c.raceID, 'Owned horse changed')
          assert(value == 0 or value == 1, 'Invalid automatic-equipment setting')
          local old = WP26.fieldRead(fresh, f)
          if value == old then
            return
          end
          WP26.native('gearAutoSet097', c.id, value)
          assert(
            WP26.fieldRead(fresh, f) == value and WP26.native('gearAutoGet097', c.id) == value,
            'Automatic equipment write did not apply'
          )
          if journal ~= false then
            WP26.history[#WP26.history + 1] =
              { pid = WP26.pid, ctx = fresh, field = f, old = old, new = value, address = fresh.primary + 12 }
          end
          return
        end
        if not f.gear095 or journal == false then
          return write(c, f, value, journal)
        end
        WP26.require()
        local fresh = WP26.context(c.key, c.id)
        assert(fresh.race == c.race and fresh.raceID == c.raceID and fresh.horseID == c.horseID, 'Racehorse changed')
        local slot, address = WP26.ownedGearIdentity097(fresh)
        local mode = slot and WP26.native('gearAutoGet097', slot) or 0
        local depth = #WP26.history
        local old = WP26.fieldRead(fresh, f)
        if mode == 1 then
          WP26.native('gearAutoSet097', slot, 0)
          assert(WP26.native('gearAutoGet097', slot) == 0, 'Could not select manual equipment')
        end
        local ok, e = pcall(write, fresh, f, value, journal)
        if not ok then
          if mode == 1 then
            WP26.native('gearAutoSet097', slot, mode)
          end
          error(e, 0)
        end
        if mode == 1 then
          if #WP26.history == depth then
            WP26.history[#WP26.history + 1] =
              { pid = WP26.pid, ctx = fresh, field = f, old = old, new = value, address = fresh.race + f.off }
          end
          local h = WP26.history[#WP26.history]
          h.gearAutoBefore097 = mode
          h.gearAutoSlot097 = slot
          h.gearAutoRace097 = fresh.raceID
        end
      end
      local undo = WP26.undoLast
      function WP26.undoLast()
        local h = WP26.history[#WP26.history]
        if not h or h.gearAutoBefore097 == nil then
          return undo()
        end
        WP26.require()
        assert(h.pid == WP26.pid, 'Process changed')
        local c = WP26.context(h.ctx.key, h.ctx.id)
        local slot = WP26.ownedGearIdentity097(c)
        assert(
          slot == h.gearAutoSlot097 and c.raceID == h.gearAutoRace097 and WP26.native('gearAutoGet097', slot) == 0,
          'Automatic equipment changed after edit'
        )
        undo()
        WP26.native('gearAutoSet097', slot, h.gearAutoBefore097)
        assert(WP26.native('gearAutoGet097', slot) == h.gearAutoBefore097, 'Automatic equipment restoration failed')
      end
      WP26.gearManualLoaded097 = true
    end
  end
  do
    WP26.RACE_PAYLOAD = {
      ['dataOffset'] = 888,
      ['size'] = 988,
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['hex'] = '9c5051524150415141524153535655ff0567030000833d5c030000010f8519030000488b05770300004c8b15780300004c39100f8502030000458b42504183f8020f82f40200004183f8120f87ea020000488b05580300004c8b184d85db0f84d7020000458b4b044183f9010f8cc9020000488b053f030000488b304885f60f84b6020000410fb68b080100004439c10f839f02000031c9418b448b0c4401c80f808f02000085c00f8e87020000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54243885d20f8e52020000bbffffff7f31c94963448b544885c00f883d0200008b5424384801d0483d9bc420000f872a020000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d62020000488b057f020000488b30488b2d55020000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c289554831db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d388945408b550081fae80300000f821601000089d8480fafc231d2b9e803000048f7f18b15590100004839d0480f47c289c3891d8e01000031c9410fb7844a48ba00003d851a00000f83c20000004869c0e80000008b44062425ff1f000083f82e0f85a9000000488b05400100003a080f849a000000410fb7844a48ba00003b450475338b550881fae8030000722889d83b45440f4c4544480fafc231d251b9e803000048f7f1598b15d40000004839d0480f47c289c3418b448b0c4401c839d87d4d890dad0000008905ab00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d74000000ff055e0000008b1db0000000ffc14439c10f8219ffffffeb06ff05490000005d5e5b415b415a415941585a59589d41554883ec40488b0549000000488b004531d2ff2565000000666666662e0f1f840000000000454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    }
    WP26.PACE_GUARD066 = {
      ['hex'] = '9c5051524150415141524153ff052e010000488b052f0100008338010f85e7000000488b052f0100004c8b104c3b152d0100000f85d0000000418b4a5083f9010f82c300000083f9120f87ba000000488b05120100004c8b184d39d80f85a7000000410fb6930801000039ca0f8397000000458b4b044183f9010f8c890000004531c0438b44830c4401c8707c85c07e7841ffc04139c872ea418b44930c4101c145894b044531c0432944830c41ffc04139c872f3410fb7945248ba000081fa851a00007343488b05a3000000488b00483d0000010072314869d2e80000008b44102425ff1f000083f82e751cff0551000000415b415a415941585a59589d4183f901ff256f000000415b415a415941585a59589d4183f9017517488b0566000000488b000fb6908b000000ff254e000000ff254000000057505041434536360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 320,
      ['size'] = 400,
      ['site'] = 11298465,
      ['skip'] = 11298530,
      ['resume'] = 11298485,
      ['original'] = '4183f901753b488b059a27d2030fb6908b000000',
    }
    table.insert(WP26.KNOWN_RACE085, { name = '098', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066 })
    local oldEnsure098 = WP26.ensureRaceConfig
    function WP26.ensureRaceConfig()
      local pointer = oldEnsure098()
      local c = WP26_RACE_CONFIG
      if readInteger(c.mem + 28) ~= 98001 then
        assert(writeInteger(c.mem + 24, 1500))
        assert(
          writeBytes(
            c.mem + 64,
            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
          )
        )
        assert(writeInteger(c.mem + 28, 98001))
      end
      c.selectedFactor = c.mem + 24
      local row = getAddressList().getMemoryRecordByID(114)
      if row then
        local standard = getAddressList().getMemoryRecordByID(112)
        if row.CustomTypeName ~= standard.CustomTypeName then
          row.Type = vtCustom
          row.CustomTypeName = standard.CustomTypeName
        end
        row.DropDownList.Text = standard.DropDownList.Text
        row.DropDownReadOnly = false
        row.DropDownDescriptionOnly = true
        row.DisplayAsDropDownListItem = false
        local address = string.format('%X', c.selectedFactor)
        if row.Address ~= address then
          row.Address = address
          row.reinterpret()
        end
        assert(row.CurrentAddress == c.selectedFactor, 'Selected multiplier binding mismatch')
      end
      return pointer
    end
    local oldConvert098 = WP26.raceMultiplierToBytes084
    function WP26.raceMultiplierToBytes084(value, address)
      local c = WP26_RACE_CONFIG
      if
        not WP26.parseRaceMultiplier084(value)
        and c
        and c.pid == getOpenedProcessID()
        and address == c.selectedFactor
      then
        local raw = readInteger(address) or 1500
        return { raw & 255, (raw >> 8) & 255, (raw >> 16) & 255, (raw >> 24) & 255 }
      end
      return oldConvert098(value, address)
    end
    do
      local row = getAddressList().getMemoryRecordByID(114)
      local standard = getAddressList().getMemoryRecordByID(112)
      if row and standard then
        row.Type = vtCustom
        row.CustomTypeName = standard.CustomTypeName
        row.DropDownList.Text = standard.DropDownList.Text
        row.DropDownReadOnly = false
        row.DropDownDescriptionOnly = true
        row.DisplayAsDropDownListItem = false
      end
    end
    if WP26.attached() then
      WP26.ensureRaceConfig()
    end
  end
  do
    WP26.SPEC.factorGet099 = {
      rva = 0xEAEC0,
      pattern = '81 F9 A0 86 01 00 73 3B 83 FA 02 7D 36 85 D2 74 1D 83 FA 01 75 2D 8B C1 48 8D 0C 40 48 8B 05 C5 1C F3 03 8B 44 C8 08 C1 E8 04 83 E0 0F C3 8B C1',
    }
    WP26.SPEC.factorSet099 = {
      rva = 0xEAF10,
      pattern = '81 F9 A0 86 01 00 73 4C 83 FA 02 7D 47 85 D2 74 28 83 FA 01 75 3E 8B C1 41 83 E0 0F 41 C1 E0 04 48 8D 0C 40 48 8B 05 6D 1C F3 03 81 64 C8 08 0F',
    }
    WP26.SPEC.factorLabel099 = {
      rva = 0x189310,
      pattern = '89 4C 24 08 83 7C 24 08 0A 7C 09 48 8D 05 A0 0A D1 03 EB 10 48 63 44 24 08 48 8D 0D 10 3E 85 03 48 8B 04 C1 C3 CC CC CC CC CC CC CC CC CC CC CC',
    }
    local choices = {
      { id = 0, en = 'Speed', ja = 'スピード' },
      { id = 1, en = 'Stamina', ja = 'スタミナ' },
      { id = 2, en = 'Power', ja = 'パワー' },
      { id = 3, en = 'Acceleration', ja = '瞬発力' },
      { id = 4, en = 'Guts', ja = '勝負根性' },
      { id = 5, en = 'Flexibility', ja = '柔軟性' },
      { id = 6, en = 'Early maturity', ja = '早熟' },
      { id = 7, en = 'Late maturity', ja = '晩成' },
      { id = 8, en = 'Difficult temperament', ja = '気性難' },
      { id = 9, en = 'None', ja = '－' },
    }
    for _, key in ipairs({ 'sire', 'ownedSire', 'mare', 'ownedMare' }) do
      for slot = 0, 1 do
        table.insert(WP26.EDITORS[key].fields, {
          en = slot == 0 and 'Left factor' or 'Right factor',
          ja = slot == 0 and '因子・左' or '因子・右',
          base = 'pedigree072',
          off = 8,
          bit = slot * 4,
          bits = 4,
          max = 9,
          factorSlot099 = slot,
          choices = choices,
          groupEn = 'Pedigree',
          groupJa = '血統',
          source = 'EXE EAEC0/EAF10; labels189310; pedigree24B+8 low/high nibble',
        })
      end
    end
    local available = WP26.fieldAvailable
    function WP26.fieldAvailable(c, f)
      if f.factorSlot099 ~= nil and not c.pedigree072 then
        return false
      end
      return available(c, f)
    end
    local write = WP26.writeField
    function WP26.writeField(c, f, v, journal)
      if f.factorSlot099 == nil then
        return write(c, f, v, journal)
      end
      WP26.require()
      assert(type(v) == 'number' and v % 1 == 0 and v >= 0 and v <= 9, 'Invalid pedigree factor')
      local fresh = WP26.context(c.key, c.id)
      assert(
        fresh.primary == c.primary and fresh.pedigreeID072 == c.pedigreeID072 and fresh.pedigree072 == c.pedigree072,
        'Pedigree identity changed'
      )
      local old = WP26.fieldRead(fresh, f)
      if old == v then
        return
      end
      local address = fresh.pedigree072 + 8
      local before = assert(readBytes(address, 4, true))
      WP26.native('factorSet099', fresh.pedigreeID072, f.factorSlot099, v)
      if WP26.fieldRead(fresh, f) ~= v or WP26.native('factorGet099', fresh.pedigreeID072, f.factorSlot099) ~= v then
        WP26.native('factorSet099', fresh.pedigreeID072, f.factorSlot099, old)
        error('Pedigree factor readback failed', 0)
      end
      if journal ~= false then
        WP26.history[#WP26.history + 1] = {
          kind = 'factor099',
          pid = WP26.pid,
          ctx = fresh,
          field = f,
          old = old,
          new = v,
          address = address,
          before = before,
          after = readBytes(address, 4, true),
        }
      end
    end
    local undo = WP26.undoLast
    function WP26.undoLast()
      local h = WP26.history[#WP26.history]
      if not h or h.kind ~= 'factor099' then
        return undo()
      end
      WP26.require()
      assert(h.pid == WP26.pid, 'Process changed')
      local c = WP26.context(h.ctx.key, h.ctx.id)
      assert(
        c.primary == h.ctx.primary and c.pedigreeID072 == h.ctx.pedigreeID072 and c.pedigree072 + 8 == h.address,
        'Pedigree identity changed'
      )
      local function same(expected)
        local now = assert(readBytes(h.address, 4, true))
        for i, v in ipairs(expected) do
          assert(now[i] == v, 'Pedigree data changed')
        end
      end
      same(h.after)
      WP26.native('factorSet099', c.pedigreeID072, h.field.factorSlot099, h.old)
      same(h.before)
      WP26.history[#WP26.history] = nil
    end
    WP26.factorsLoaded099 = true
  end
  do
    WP26.SPEC.dramaGet100 = {
      rva = 0xEB100,
      pattern = '81 F9 A0 86 01 00 73 75 83 FA 04 7D 70 85 D2 74 57 83 EA 01 74 3A 83 EA 01 74 1D 83 FA 01 75 5D 8B C1 48 8D 0C 40 48 8B 05 7B 1A F3 03 8B 44 C8',
    }
    WP26.SPEC.dramaSet100 = {
      rva = 0xEB190,
      pattern = '81 F9 A0 86 01 00 0F 83 A4 00 00 00 83 FA 04 0F 8D 9B 00 00 00 85 D2 74 7C 83 EA 01 74 54 83 EA 01 74 2C 83 FA 01 0F 85 84 00 00 00 8B C1 41 83',
    }
    WP26.SPEC.dramaLabel100 = {
      rva = 0x90190,
      pattern = '48 8B 15 C1 9B E0 03 48 85 D2 74 21 8D 41 FF 83 F8 0C 77 19 33 C0 FF C9 83 F9 0D 0F 42 C1 48 69 C8 9C 01 00 00 48 8D 42 0E 48 03 C1 C3 48 8D 05',
    }
    WP26.SPEC.dramaActiveGet100 = {
      rva = 0xEB4B0,
      pattern = '81 F9 A0 86 01 00 73 77 83 FA 04 7D 72 85 D2 74 56 83 EA 01 74 39 83 EA 01 74 1C 83 FA 01 75 5F 8B C1 48 8D 0C 40 48 8B 05 CB 16 F3 03 8B 44 C8',
    }
    WP26.SPEC.dramaActiveSet100 = {
      rva = 0xEB540,
      pattern = '48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 8B F1 41 8B D8 8B FA 81 F9 A0 86 01 00 0F 83 05 01 00 00 8B CA E8 17 4A FA FF 85 C0 0F 84 F6 00 00',
    }
    local choices = {
      { id = 0, en = 'None', ja = 'なし' },
      { id = 1, en = 'Racing idol', ja = '競馬界のアイドル' },
      { id = 2, en = 'Great supremacy', ja = '偉大なる覇道' },
      { id = 3, en = 'Pure white radiance', ja = '純白の輝き' },
      { id = 4, en = 'Overwhelming victory', ja = '圧勝劇' },
      { id = 5, en = 'Winning streak', ja = '連勝街道' },
      { id = 6, en = 'Triple crown legacy', ja = '３冠から３冠へ' },
      { id = 7, en = 'Ruler of an era', ja = '時代の覇者' },
      { id = 8, en = 'Top100 horse', ja = '１００傑馬' },
      { id = 9, en = 'Prize money champion', ja = '賞金王' },
      { id = 10, en = 'Worldwide success', ja = '世界を股にかける活躍' },
      { id = 11, en = 'Return to the sea of stars', ja = '星海への凱旋' },
      { id = 12, en = 'Inherited shield', ja = '名優が継ぎし盾' },
      { id = 13, en = 'Duelist', ja = '決闘者' },
      { id = 33, en = 'Racing idol (active)', ja = '競馬界のアイドル（活性化）' },
      { id = 34, en = 'Great supremacy (active)', ja = '偉大なる覇道（活性化）' },
      { id = 35, en = 'Pure white radiance (active)', ja = '純白の輝き（活性化）' },
      { id = 36, en = 'Overwhelming victory (active)', ja = '圧勝劇（活性化）' },
      { id = 37, en = 'Winning streak (active)', ja = '連勝街道（活性化）' },
      { id = 38, en = 'Triple crown legacy (active)', ja = '３冠から３冠へ（活性化）' },
      { id = 39, en = 'Ruler of an era (active)', ja = '時代の覇者（活性化）' },
      { id = 40, en = 'Top100 horse (active)', ja = '１００傑馬（活性化）' },
      { id = 41, en = 'Prize money champion (active)', ja = '賞金王（活性化）' },
      { id = 42, en = 'Worldwide success (active)', ja = '世界を股にかける活躍（活性化）' },
      { id = 43, en = 'Return to the sea of stars (active)', ja = '星海への凱旋（活性化）' },
      { id = 44, en = 'Inherited shield (active)', ja = '名優が継ぎし盾（活性化）' },
      { id = 45, en = 'Duelist (active)', ja = '決闘者（活性化）' },
    }
    for _, key in ipairs({ 'sire', 'ownedSire', 'mare', 'ownedMare' }) do
      for slot = 0, 3 do
        table.insert(WP26.EDITORS[key].fields, {
          en = 'Drama factor ' .. (slot + 1),
          ja = 'ドラマ因子' .. (slot + 1),
          base = 'pedigree072',
          off = 16,
          bit = slot * 6,
          bits = 6,
          max = 45,
          dramaSlot100 = slot,
          choices = choices,
          groupEn = 'Pedigree',
          groupJa = '血統',
          source = 'EXE EB100/EB190; UI718C26/71C9E8 ->90190; pedigree24B+16 bits0/6/12/18',
        })
      end
    end
    local available = WP26.fieldAvailable
    function WP26.fieldAvailable(c, f)
      if f.dramaSlot100 ~= nil and not c.pedigree072 then
        return false
      end
      return available(c, f)
    end
    local write = WP26.writeField
    function WP26.writeField(c, f, v, journal)
      if f.dramaSlot100 == nil then
        return write(c, f, v, journal)
      end
      WP26.require()
      assert(
        type(v) == 'number' and v % 1 == 0 and ((v >= 0 and v <= 13) or (v >= 33 and v <= 45)),
        'Invalid drama factor'
      )
      local fresh = WP26.context(c.key, c.id)
      assert(
        fresh.primary == c.primary and fresh.pedigreeID072 == c.pedigreeID072 and fresh.pedigree072 == c.pedigree072,
        'Pedigree identity changed'
      )
      local old = WP26.fieldRead(fresh, f)
      if old == v then
        return
      end
      local address = fresh.pedigree072 + 16
      local before = assert(readBytes(address, 4, true))
      local writeOK, writeError = pcall(function()
        local factor = v & 31
        local active = v >> 5
        if active == 1 then
          for slot = 0, 3 do
            assert(WP26.native('dramaActiveSet100', fresh.pedigreeID072, slot, 0) == 1, 'Drama deactivation failed')
          end
        else
          assert(
            WP26.native('dramaActiveSet100', fresh.pedigreeID072, f.dramaSlot100, 0) == 1,
            'Drama deactivation failed'
          )
        end
        WP26.native('dramaSet100', fresh.pedigreeID072, f.dramaSlot100, factor)
        if active == 1 then
          assert(
            WP26.native('dramaActiveSet100', fresh.pedigreeID072, f.dramaSlot100, 1) == 1,
            'Drama activation failed'
          )
        end
        if
          WP26.fieldRead(fresh, f) ~= v
          or WP26.native('dramaGet100', fresh.pedigreeID072, f.dramaSlot100) ~= factor
          or WP26.native('dramaActiveGet100', fresh.pedigreeID072, f.dramaSlot100) ~= active
        then
          error('Drama factor readback failed', 0)
        end
      end)
      if not writeOK then
        assert(writeBytes(address, before), 'Drama rollback failed')
        error(writeError, 0)
      end
      if journal ~= false then
        WP26.history[#WP26.history + 1] = {
          kind = 'drama100',
          pid = WP26.pid,
          ctx = fresh,
          field = f,
          old = old,
          new = v,
          address = address,
          before = before,
          after = readBytes(address, 4, true),
        }
      end
    end
    local undo = WP26.undoLast
    function WP26.undoLast()
      local h = WP26.history[#WP26.history]
      if not h or h.kind ~= 'drama100' then
        return undo()
      end
      WP26.require()
      assert(h.pid == WP26.pid, 'Process changed')
      local c = WP26.context(h.ctx.key, h.ctx.id)
      assert(
        c.primary == h.ctx.primary and c.pedigreeID072 == h.ctx.pedigreeID072 and c.pedigree072 + 16 == h.address,
        'Pedigree identity changed'
      )
      local function same(expected)
        local now = assert(readBytes(h.address, 4, true))
        for i, v in ipairs(expected) do
          assert(now[i] == v, 'Pedigree data changed')
        end
      end
      same(h.after)
      assert(writeBytes(h.address, h.before), 'Drama restoration failed')
      same(h.before)
      WP26.history[#WP26.history] = nil
    end
    WP26.dramaLoaded100 = true
  end
  do
    -- An editor may be closed while a slow field-choice lookup pumps UI messages.
    -- Keep its records alive until the constructing Lua frame has unwound.
    local api = WP26
    local cancelled = {}
    api.editorBuilds101 = {}
    api.editorLifecycleStats101 = { started = 0, completed = 0, cancelled = 0 }
    local rawClose = api.closeEditor
    local rawRefresh = api.refreshEditor
    local function retire(id)
      local session = api.editorSessions[id]
      if not session then
        return
      end
      for rowId in pairs(session.rows) do
        local info = api.valueRows[rowId]
        if info and info.valueType078 and info.valueType078.info == info then
          info.valueType078.info = nil
        end
        api.valueRows[rowId] = nil
        api.pendingEdits[rowId] = nil
      end
      api.editorSessions[id] = nil
    end
    local function current(build)
      if not build.alive or _G.WP26 ~= api then
        return false
      end
      local parent = getAddressList().getMemoryRecordByID(build.recordId)
      return parent and parent == build.parent
    end
    function api.guardEditorBuild101(key)
      local build = api.editorBuilds101[key]
      if not build then
        return
      end
      if build.cancelled or not current(build) or not build.parent.Active or api.selected[key] ~= build.selected then
        build.cancelled = true
        error(cancelled, 0)
      end
    end
    local function closeNow(parent)
      local tree = getAddressList().Control[0]
      tree.beginUpdate()
      local ok, e = pcall(rawClose, parent)
      tree.endUpdate()
      if not ok then
        error(e, 0)
      end
    end
    function api.resetEditorBuild101(parent)
      local build = api.currentEditorBuild101
      if build then
        api.guardEditorBuild101(build.key)
      end
      closeNow(parent)
    end
    function api.closeEditor(parent)
      local build
      for _, candidate in pairs(api.editorBuilds101) do
        if candidate.recordId == parent.ID then
          build = candidate
          break
        end
      end
      if build then
        build.cancelled = true
        build.rebuild = false
        retire(build.recordId)
        if api.editorOpenTimers then
          local t = api.editorOpenTimers[parent.ID]
          if t then
            api.editorOpenTimers[parent.ID] = nil
            if api.uiTimers then
              api.uiTimers[t] = nil
            end
            t.destroy()
          end
        end
        parent.Collapsed = true
        return
      end
      return closeNow(parent)
    end
    function api.refreshEditor(key)
      local definition = api.EDITORS[key]
      if not definition then
        return
      end
      local parent = getAddressList().getMemoryRecordByID(definition.record)
      local selected = api.selected[key]
      if not parent or not parent.Active or selected == nil then
        return
      end
      local existing = api.editorBuilds101[key]
      if existing then
        existing.cancelled = true
        existing.rebuild = true
        return
      end
      local build =
        { key = key, parent = parent, recordId = parent.ID, selected = selected, alive = true, cancelled = false }
      api.editorBuilds101[key] = build
      api.editorLifecycleStats101.started = api.editorLifecycleStats101.started + 1
      local previous = api.currentEditorBuild101
      api.currentEditorBuild101 = build
      local ok, e = pcall(rawRefresh, key)
      api.currentEditorBuild101 = previous
      api.editorBuilds101[key] = nil
      local valid = current(build)
      if build.cancelled or not ok then
        retire(build.recordId)
        if valid then
          closeNow(parent)
        end
        api.editorLifecycleStats101.cancelled = api.editorLifecycleStats101.cancelled + 1
      else
        api.editorLifecycleStats101.completed = api.editorLifecycleStats101.completed + 1
      end
      if build.rebuild and valid and parent.Active then
        api.deferEditor(key)
      end
      if not ok and e ~= cancelled then
        error(e, 0)
      end
    end
    local addRec = api.addRec
    function api.addRec(...)
      local build = api.currentEditorBuild101
      if build then
        api.guardEditorBuild101(build.key)
      end
      return addRec(...)
    end
    local addHdr = api.addHdr
    function api.addHdr(...)
      local build = api.currentEditorBuild101
      if build then
        api.guardEditorBuild101(build.key)
      end
      return addHdr(...)
    end
    local addField = api.addNativeField
    function api.addNativeField(parent, key, ...)
      api.guardEditorBuild101(key)
      local row = addField(parent, key, ...)
      api.guardEditorBuild101(key)
      return row
    end
    local hooked = {}
    for _, definition in pairs(api.EDITORS) do
      local id = definition.record
      if id and not hooked[id] then
        hooked[id] = true
        local parent = getAddressList().getMemoryRecordByID(id)
        if parent then
          local old = parent.OnDestroy
          parent.OnDestroy = function(sender)
            for _, build in pairs(api.editorBuilds101) do
              if build.recordId == id then
                build.alive = false
                build.cancelled = true
              end
            end
            retire(id)
            if old then
              old(sender)
            end
          end
        end
      end
    end
    api.editorLifecycleLoaded101 = true
  end
  do
    -- Shared, memory-independent entity picker. Rows are read once by a caller adapter.
    WP26.EntityPicker101 = {}
    local Picker = WP26.EntityPicker101
    -- A list is a read-only snapshot: resolve each data root once, then restore
    -- the normal resolver before showing a modal dialog or accepting a target.
    local function snapshotRead(fn, ...)
      local api = WP26
      api.require()
      local data, requireNormal = api.data, api.require
      local roots = {}
      local pid = api.pid
      local base = api.mod()
      local pe = assert(readInteger(base + 0x3c))
      local lastCheck = getTickCount()
      assert(readInteger(base + pe + 8) == api.BUILD.ts and readInteger(base + pe + 0x50) == api.BUILD.size)
      api.require = function()
        assert(WP26 == api and getOpenedProcessID() == pid and api.pid == pid, 'Picker process changed')
        assert(
          readInteger(base + pe + 8) == api.BUILD.ts and readInteger(base + pe + 0x50) == api.BUILD.size,
          'Picker binary changed'
        )
        local now = getTickCount()
        if now - lastCheck >= 250 then
          requireNormal()
          lastCheck = now
        end
      end
      api.data = function(name)
        assert(WP26 == api and getOpenedProcessID() == pid and api.pid == pid, 'Picker process changed')
        local root = roots[name]
        if not root then
          root = data(name)
          roots[name] = root
        end
        assert(readBytes(root, 1) ~= nil, 'Picker snapshot became unavailable')
        return root
      end
      local result = table.pack(pcall(fn, ...))
      api.data = data
      api.require = requireNormal
      if not result[1] then
        error(result[2], 0)
      end
      assert(WP26 == api, 'Picker table changed')
      for name,root in pairs(roots) do assert(data(name)==root, 'Search data region changed during lookup') end
      api.require()
      return table.unpack(result, 2, result.n)
    end
    local function text(v)
      return v == nil and '' or tostring(v)
    end
    function Picker.matches(value, query, numeric)
      query = text(query):match('^%s*(.-)%s*$')
      if query == '' then
        return true
      end
      if numeric then
        local n = tonumber(value)
        if not n then
          return false
        end
        local number = '[+-]?%d*%.?%d+'
        local lo, hi = query:match('^(' .. number .. ')%s*%-%s*(' .. number .. ')$')
        if lo then
          return n >= tonumber(lo) and n <= tonumber(hi)
        end
        local op, rhs = query:match('^([<>!=]+)%s*(' .. number .. ')$')
        rhs = tonumber(rhs)
        if rhs then
          if op == '>=' then
            return n >= rhs
          elseif op == '<=' then
            return n <= rhs
          elseif op == '>' then
            return n > rhs
          elseif op == '<' then
            return n < rhs
          elseif op == '=' or op == '==' then
            return n == rhs
          elseif op == '!=' then
            return n ~= rhs
          end
        end
        local exact = tonumber(query)
        if exact then
          return n == exact
        end
      end
      return text(value):lower():find(query:lower(), 1, true) ~= nil
    end
    function Picker.view(rows, columns, queries, sortIndex, ascending)
      local shown = {}
      for _, row in ipairs(rows) do
        local include = true
        for i, col in ipairs(columns) do
          if not Picker.matches(row[col.key], queries[i], col.numeric) then
            include = false
            break
          end
        end
        if include then
          shown[#shown + 1] = row
        end
      end
      local col = columns[sortIndex]
      table.sort(shown, function(a, b)
        local x, y = a[col.key], b[col.key]
        if x == nil or y == nil then
          if x ~= y then
            return y == nil
          end
        else
          if not col.numeric then
            x = text(x):lower()
            y = text(y):lower()
          end
          if x ~= y then
            if ascending then
              return x < y
            else
              return x > y
            end
          end
        end
        return a.id < b.id
      end)
      return shown
    end
    function WP26.entityRegion122(key, c)
      local api = WP26
      local function home(v)
        if v == 0 or v == 1 or (v >= 12 and v <= 25) then
          return 'jp'
        end
        if v == 2 then
          return 'us'
        end
        if v >= 3 and v <= 7 then
          return 'eu'
        end
        return 'other'
      end
      if key == 'jockey' then
        return home(api.bits(c.primary, 4, c.personDynamic and 22 or 27, 5))
      elseif key == 'trainer' then
        if c.personDynamic then
          return home(api.bits(c.primary, 20, 0, 5))
        end
        return home(api.bits(c.primary, 32, 10, 5))
      elseif key == 'owner' then
        return home(api.bits(c.primary, c.ownerDynamic091 and 12 or 24, c.ownerDynamic091 and 1 or 10, 5))
      elseif c.race then
        return WP26.horseRegion183(c)
      end
      if key=='farm' then return WP26.farmRegion183(c.id) end
      if c.horse then return WP26.farmRegion183(WP26.bits(c.horse,16,22,9)) end
    end
    function WP26.regionRows122(rows, region)
      if region == 'all' then
        return rows
      end
      local result = {}
      for _, row in ipairs(rows) do
        if row.region == nil or row.region == region then
          result[#result + 1] = row
        end
      end
      return result
    end
    function WP26.regionButtons122(form, state, render)
      state.region = 'jp'
      state.regionButtons = {}
      for i, item in ipairs({
        { 'jp', 'Japan', '日本' },
        { 'eu', 'Europe', '欧州' },
        { 'us', 'USA', '米国' },
        { 'all', 'All', 'すべて' },
      }) do
        local button = createButton(form)
        button.Name = 'WP26_Region122_' .. item[1]
        button.Caption = WP26.T(item[2], item[3])
        button.OnClick = function()
          state.region = item[1]
          for j, other in ipairs(state.regionButtons) do
            other.Font.Style = j == i and '[fsBold]' or '[]'
          end
          render()
        end
        button.Font.Style = i == 1 and '[fsBold]' or '[]'
        state.regionButtons[i] = button
      end
    end
    function Picker.create(options)
      local state = {
        rows = options.rows,
        columns = options.columns,
        shown = {},
        filters = {},
        sortIndex = options.sortIndex or 2,
        ascending = true,
        lastId = options.current,
        result = nil,
        updating = false,
      }
      local form = createForm(false)
      state.form = form
      form.Name = 'WP26_EntityPicker101'
      form.Caption = options.title
      form.Position = 'poScreenCenter'
      form.BorderStyle = 'bsSizeable'
      form.ClientWidth = 840
      form.ClientHeight = math.max(330, math.min(620, 180 + #options.rows * 32))
      form.Font.Name = 'Yu Gothic UI'
      form.Font.Size = 10
      form.Color = 0x252525
      form.Font.Color = 0xf0f0f0
      pcall(function()
        form.Constraints.MinWidth = 700
        form.Constraints.MinHeight = 380
      end)
      local list = createListView(form)
      state.list = list
      list.Name = 'WP26_EntityTable101'
      list.ViewStyle = 'vsReport'
      list.RowSelect = true
      list.HideSelection = false
      list.ReadOnly = true
      list.MultiSelect = false
      list.OwnerData = true
      list.Color = 0x252525
      list.Font.Color = 0xf0f0f0
      local headers = {}
      local headerButtons = {}
      state.headerButtons = headerButtons
      list.ShowColumnHeaders = false
      for i, col in ipairs(state.columns) do
        local h = list.Columns.add()
        h.Caption = col.title
        headers[i] = h
        local button = createButton(form)
        button.Name = 'WP26_EntitySort101_' .. i
        button.Caption = col.title
        headerButtons[i] = button
        button.OnClick = function()
          state.sort(i)
        end
        local edit = createEdit(form)
        edit.Name = 'WP26_EntityFilter101_' .. i
        edit.Text = ''
        edit.Color = 0x353535
        edit.Font.Color = 0xffffff
        edit.ShowHint = true
        pcall(function()
          edit.TextHint = WP26.T('Search ' .. col.title, col.title .. '検索')
        end)
        edit.Hint = col.numeric and WP26.T('Exact value, range10-30, or >=10', '数値、範囲10-30、>=10で検索')
          or WP26.T('Search this column', 'この列を検索')
        state.filters[i] = edit
      end
      local count = createLabel(form)
      state.count = count
      count.Font.Color = 0xcfcfcf
      local clear = createButton(form)
      state.clear = clear
      clear.Caption = WP26.T('Clear filters', '検索解除')
      local accept = createButton(form)
      state.accept = accept
      accept.Name = 'WP26_EntityAccept101'
      accept.Caption = WP26.T('Select', '選択')
      accept.Default = true
      local cancel = createButton(form)
      state.cancel = cancel
      cancel.Name = 'WP26_EntityCancel101'
      cancel.Caption = WP26.T('Cancel', 'キャンセル')
      cancel.Cancel = true
      function state.selectedId()
        local item = list.Selected
        local row = item and state.shown[item.Index + 1]
        return row and row.id or nil
      end
      list.OnData = function(sender, item)
        local row = state.shown[item.Index + 1]
        if not row then
          return
        end
        item.Caption = text(row[state.columns[1].key])
        item.SubItems.clear()
        for i = 2, #state.columns do
          item.SubItems.add(text(row[state.columns[i].key]))
        end
      end
      function state.render()
        if state.updating then
          return
        end
        local selected = state.selectedId()
        if selected ~= nil then
          state.lastId = selected
        end
        local queries = {}
        for i, edit in ipairs(state.filters) do
          queries[i] = edit.Text
        end
        state.shown = Picker.view(
          WP26.regionRows122(state.rows, state.region),
          state.columns,
          queries,
          state.sortIndex,
          state.ascending
        )
        list.beginUpdate()
        list.Items.clear()
        list.Items.Count = #state.shown
        local selectedIndex = -1
        for i, row in ipairs(state.shown) do
          if row.id == state.lastId then
            selectedIndex = i - 1
            break
          end
        end
        list.ItemIndex = selectedIndex
        list.endUpdate()
        if state.lastId == nil and #state.shown > 0 then
          list.ItemIndex = 0
          state.lastId = state.shown[1].id
        end
        for i, h in ipairs(headers) do
          h.Caption = state.columns[i].title .. (i == state.sortIndex and (state.ascending and ' ↑' or ' ↓') or '')
          headerButtons[i].Caption = h.Caption
        end
        count.Caption = WP26.T('Shown ', '表示 ') .. #state.shown .. ' / ' .. #state.rows
        accept.Enabled = state.selectedId() ~= nil
      end
      function state.sort(index)
        if state.sortIndex == index then
          state.ascending = not state.ascending
        else
          state.sortIndex = index
          state.ascending = true
        end
        state.render()
      end
      list.OnColumnClick = function(sender, column)
        for i, h in ipairs(headers) do
          if h.Caption == column.Caption then
            state.sort(i)
            return
          end
        end
      end
      list.OnSelectItem = function()
        accept.Enabled = state.selectedId() ~= nil
      end
      local function choose()
        local id = state.selectedId()
        if id ~= nil then
          state.result = id
          form.ModalResult = 1
        end
      end
      accept.OnClick = choose
      list.OnDblClick = choose
      cancel.OnClick = function()
        state.result = nil
        form.ModalResult = 2
      end
      for _, edit in ipairs(state.filters) do
        edit.OnKeyDown = function(sender, key)
          if key == 40 and #state.shown > 0 then
            if list.ItemIndex < 0 then
              list.ItemIndex = 0
            end
            list.setFocus()
            return 0
          end
          return key
        end
      end
      for _, edit in ipairs(state.filters) do
        edit.OnChange = state.render
      end
      clear.OnClick = function()
        state.updating = true
        for _, edit in ipairs(state.filters) do
          edit.Text = ''
        end
        state.updating = false
        state.render()
      end
      list.OnCustomDrawItem = function(sender, item, drawState)
        local row = state.shown[item.Index + 1]
        if not row then
          return false
        end
        local rect = item.displayRect('drBounds')
        local canvas = sender.Canvas
        canvas.Font.Color = 0xffffff
        canvas.Brush.Color = item.Selected and WP26.C_SELECTION or 0x252525
        canvas.fillRect(rect.Left, rect.Top, sender.Width, rect.Bottom)
        local x = rect.Left
        for i, col in ipairs(state.columns) do
          local width = headers[i].Width
          canvas.textRect(
            { Left = x + 6, Top = rect.Top, Right = x + width - 6, Bottom = rect.Bottom },
            x + 6,
            rect.Top + 2,
            text(row[col.key])
          )
          x = x + width
        end
        return false
      end
      WP26.regionButtons122(form, state, function()
        state.render()
      end)
      local function layout()
        local w, h = form.ClientWidth, form.ClientHeight
        for i, button in ipairs(state.regionButtons) do
          button.Left = w - 334 + (i - 1) * 80
          button.Top = 10
          button.Width = 80
          button.Height = 30
        end
        local x = 14
        local available = w - 48
        local fixed, flex = 0, 0
        for _, col in ipairs(state.columns) do
          if col.flex then
            flex = flex + 1
          else
            fixed = fixed + (col.width or 100)
          end
        end
        for i, col in ipairs(state.columns) do
          local width = col.flex and math.max(180, math.floor((available - fixed) / math.max(1, flex)))
            or (col.width or 100)
          headers[i].Width = width
          headers[i].MinWidth = width
          headers[i].MaxWidth = width
          local edit = state.filters[i]
          edit.Left = x
          edit.Top = 54
          edit.Width = width - 6
          edit.Height = 28
          x = x + width
          local button = headerButtons[i]
          button.Left = edit.Left
          button.Top = 91
          button.Width = width
          button.Height = 30
        end
        list.Left = 14
        list.Top = 122
        list.Width = w - 28
        list.Height = h - 186
        count.Left = 16
        count.Top = h - 43
        clear.Left = 155
        clear.Top = h - 49
        clear.Width = 110
        clear.Height = 33
        accept.Left = w - 266
        accept.Top = h - 49
        accept.Width = 118
        accept.Height = 33
        cancel.Left = w - 136
        cancel.Top = h - 49
        cancel.Width = 118
        cancel.Height = 33
      end
      form.OnResize = layout
      form.OnShow = state.render
      layout()
      state.render()
      function state.destroy()
        form.destroy()
      end
      return state
    end
    function Picker.show(options)
      local state = Picker.create(options)
      local ok, result = pcall(function()
        state.form.showModal()
        return state.result
      end)
      state.destroy()
      if not ok then
        error(result, 0)
      end
      return result
    end
    function Picker.standardColumns()
      return {
        { key = 'displayId', title = 'ID', numeric = true, width = 100 },
        { key = 'name', title = WP26.T('Name', '名前'), flex = true },
        { key = 'age', title = WP26.T('Age', '年齢'), numeric = true, width = 100 },
        { key = 'sex', title = WP26.T('Sex', '性別'), width = 100 },
      }
    end
    local function entityPickerRows(key, rows)
      local fields = WP26.EDITORS[key].fields
      local ageField, sexField, geldedField
      for _, f in ipairs(fields) do
        if f.en == 'Age' and not f.birthYear081 then
          ageField = f
        elseif f.en == 'Sex' then
          sexField = f
        elseif f.en == 'Gelded' then
          geldedField = f
        end
      end
      local result = {}
      for _, row in ipairs(rows) do
        local entry = { id = row.id, name = row.name, displayId = row.id }
        local ok, c = pcall(WP26.listContext180, key, row.id)
        if ok then
          entry.region = WP26.entityRegion122(key, c)
          entry.displayId = c.raceID or row.id
          entry.horseID = c.horseID
          entry.raceID = c.raceID
          entry.primary = c.primary
          if ageField and WP26.fieldAvailable(c, ageField) then
            local valid, value = pcall(WP26.fieldRead, c, ageField)
            if valid then
              entry.age = value
            end
          end
          if sexField and WP26.fieldAvailable(c, sexField) then
            local valid, value = pcall(WP26.fieldRead, c, sexField)
            if valid then
              local labels = WP26.lang == 'ja' and sexField.optionsJa or sexField.optionsEn
              entry.sex = labels and labels[value + 1] or tostring(value)
            end
          end
          if geldedField and WP26.fieldAvailable(c, geldedField) then
            local valid, value = pcall(WP26.fieldRead, c, geldedField)
            if valid and value == 1 then
              entry.sex = WP26.T('Gelding', '騸')
            end
          end
          if not entry.sex then
            if key == 'mare' or key == 'ownedMare' then
              entry.sex = WP26.T('Female', '牝')
            elseif key == 'sire' or key == 'ownedSire' then
              entry.sex = WP26.T('Male', '牡')
            end
          end
        end
        result[#result + 1] = entry
      end
      return result
    end
    WP26.entitySnapshotRead116 = snapshotRead
    function WP26.entityPickerRows101(key, rows)
      return snapshotRead(entityPickerRows, key, rows)
    end
    function WP26.chooseEntity101(key, title, rows, current)
      if #rows == 0 then
        return nil
      end
      local snapshot = WP26.entityPickerRows101(key, rows)
      local selected =
        Picker.show({ title = title, rows = snapshot, columns = Picker.standardColumns(), current = current })
      if selected ~= nil then
        for _, row in ipairs(snapshot) do
          if row.id == selected then
            local ok, c = pcall(WP26.context, key, selected)
            if not ok or c.primary ~= row.primary or c.horseID ~= row.horseID or c.raceID ~= row.raceID then
              WP26.msg(
                'The selected entity changed. Select again.',
                '対象が変わりました。選び直してください。'
              )
              return nil
            end
            break
          end
        end
      end
      return selected
    end
    -- Every editor target selector uses the shared snapshot adapter.
    WP26.entityPickerTargets101 = {}
    for key in pairs(WP26.EDITORS) do
      WP26.entityPickerTargets101[key] = true
    end
    local previousRows102 = WP26.editorRows
    function WP26.editorRows(key)
      if WP26.entityPickerTargets101[key] then
        return snapshotRead(previousRows102, key)
      end
      return previousRows102(key)
    end
    local previousChoose101 = WP26.chooseName
    function WP26.chooseName(title, rows, current)
      local key = WP26.pickerEditorKey101
      if WP26.entityPickerTargets101[key] then
        return WP26.chooseEntity101(key, title, rows, current)
      end
      return previousChoose101(title, rows, current)
    end
    local previousSelect101 = WP26.selectEditor
    function WP26.selectEditor(key)
      local previous = WP26.pickerEditorKey101
      WP26.pickerEditorKey101 = key
      local ok, result = pcall(previousSelect101, key)
      WP26.pickerEditorKey101 = previous
      if not ok then
        error(result, 0)
      end
      return result
    end
  end
  do
    WP26.OPPONENT_SPECS103 = {
      {
        ['kind'] = 'condition',
        ['site'] = 784160,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f858b000000440fb7c94181f9851a0000737e488b05b30000004c8b104c3b15b1000000756b458b42504183f80272614183f812775b31d266453b8c5248ba00007409ffc24439c272eeeb45488b058a0000004c8b184981fb0000010072324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'fatigue',
        ['site'] = 786976,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f8592000000440fb7c94181f9851a00000f8381000000488b05af0000004c8b104c3b15ad000000756e458b42504183f80272644183f812775e31d266453b8c5248ba00007409ffc24439c272eeeb48488b05860000004c8b184981fb0000010072354969c1e80000004c01d88b502481e2ff1f000083fa2e741db8640000004889442430ff053e000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252c0000000f1f400033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'spirit',
        ['site'] = 794384,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f8594000000440fb7c94181f9851a00000f8383000000488b05af0000004c8b104c3b15ad0000007570458b42504183f80272664183f812776031d266453b8c5248ba00007409ffc24439c272eeeb4a488b05860000004c8b184981fb0000010072374969c1e80000004c01d88b502481e2ff1f000083fa2e741f48c7c088ffffff4889442430ff053c000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252a000000669033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'weightRaw',
        ['site'] = 770512,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833de5000000010f85ab000000440fb7c94181f9851a00000f839a000000488b05cf0000004c8b104c3b15cd0000000f8583000000458b42504183f80272794183f812777331d266453b8c5248ba00007409ffc24439c272eeeb5d488b05a20000004c8b184981fb00000100724a4969c1e80000004c01d88b502481e2ff1f000083fa2e74320fb6400a3dc800000077273da0000000770583c028eb0383e8284889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 248,
        ['size'] = 288,
      },
    }
    local api = WP26
    api.NAMES[111] = { 'Owned horses dominate', '所有馬圧勝' }
    api.NAMES[103] = { 'Restore owned horse adaptations', '所有馬の適応能力回復' }
    api.NAMES[115] = { 'Opponents in the current race: worst condition', '相手馬を絶不調' }
    function api.restoreAdaptations103()
      local targets = api.ownedConditionSnapshot()
      local fields = {}
      for _, f in ipairs(api.EDITORS.owned.fields) do
        if f.setter == 'horseStyleSet' or f.setter == 'horseStyleCapSet' then
          fields[#fields + 1] = f
        end
      end
      assert(#fields == 6, 'Adaptation field definitions unavailable')
      local count = 0
      for _, target in ipairs(targets) do
        local c = api.context('owned', target.slot)
        assert(c.raceID == target.raceID and c.horseID == target.horseID, 'Horse ownership changed')
        local old = {}
        for i, f in ipairs(fields) do
          old[i] = api.fieldRead(c, f)
        end
        local ok, e = pcall(function()
          for _, f in ipairs(fields) do
            api.writeField(c, f, 11, false)
            assert(api.fieldRead(c, f) == 11, 'Adaptation recovery verification failed')
          end
        end)
        if not ok then
          for i = #fields, 1, -1 do
            pcall(api.writeField, c, fields[i], old[i], false)
          end
          error(e, 0)
        end
        count = count + 1
      end
      if count > 0 then
        api.msg('Restored owned horse adaptations: ' .. count, '所有馬の適応能力を回復: ' .. count .. '頭')
      end
      return count
    end
    local function bytes(hex)
      local out = {}
      for x in hex:gmatch('%x%x') do
        out[#out + 1] = tonumber(x, 16)
      end
      return out
    end
    local function equal(a, b)
      if not a or #a ~= #b then
        return false
      end
      for i, v in ipairs(b) do
        if a[i] ~= v then
          return false
        end
      end
      return true
    end
    local function call(s, name, ...)
      local arguments = table.pack(...)
      for i = 1, arguments.n do
        assert(math.type(arguments[i]) == 'integer', 'Non-integer Windows API argument: ' .. name)
      end
      return executeCodeLocalEx(s.api[name], table.unpack(arguments, 1, arguments.n))
    end
    local function read(s, address, size)
      assert(
        size <= 1024 and call(s, 'ReadProcessMemory', s.handle, address, s.buffer.Memory, size, 0) ~= 0,
        'Opponent code read failed'
      )
      return readBytesLocal(s.buffer.Memory, size, true)
    end
    local function write(s, address, value, protect)
      assert(#value <= 1024 and writeBytesLocal(s.buffer.Memory, value) == #value)
      local old
      if protect then
        assert(call(s, 'VirtualProtectEx', s.handle, address, #value, 0x40, s.buffer.Memory + 2048) ~= 0)
        old = readIntegerLocal(s.buffer.Memory + 2048)
      end
      local ok = call(s, 'WriteProcessMemory', s.handle, address, s.buffer.Memory, #value, 0) ~= 0
      local restored = true
      if old then
        restored = call(s, 'VirtualProtectEx', s.handle, address, #value, old, s.buffer.Memory + 2048) ~= 0
      end
      assert(ok and restored and equal(read(s, address, #value), value), 'Opponent code write verification failed')
      if protect then
        assert(call(s, 'FlushInstructionCache', s.handle, address, #value) ~= 0)
      end
    end
    local function alive(s)
      return s.handle
        and call(s, 'GetExitCodeProcess', s.handle, s.buffer.Memory + 2056) ~= 0
        and readIntegerLocal(s.buffer.Memory + 2056) == 259
    end
    local function patch(s, on)
      for _, v in ipairs(s.sites) do
        assert(
          equal(read(s, v.site, #v.original), s.active and v.patch or v.original),
          'Opponent hook identity mismatch'
        )
      end
      assert((call(s, 'NtSuspendProcess', s.handle) & 0xffffffff) == 0, 'Opponent patch suspend failed')
      local changed = false
      local ok, e = pcall(function()
        for _, v in ipairs(s.sites) do
          write(s, v.data, bytes('00000000'))
          changed = true
        end
        for _, v in ipairs(s.sites) do
          write(s, v.site, on and v.patch or v.original, true)
        end
        if on then
          for _, v in ipairs(s.sites) do
            write(s, v.data, bytes('01000000'))
          end
        end
      end)
      if not ok and changed then
        local restored = true
        for _, v in ipairs(s.sites) do
          local a = pcall(write, s, v.data, bytes('00000000'))
          local b = pcall(write, s, v.site, v.original, true)
          restored = restored and a and b
        end
        s.active = not restored
      elseif ok then
        s.active = on
      end
      local resumed = (call(s, 'NtResumeProcess', s.handle) & 0xffffffff) == 0
      assert(resumed, 'Opponent patch resume failed')
      if not ok then
        error(e, 0)
      end
    end
    function api.stopOpponents103()
      local s = WP26_OPPONENT_CACHE103
      if s and s.active then
        if alive(s) then
          patch(s, false)
        else
          s.active = false
        end
      end
      return true
    end
    function api.inspectOpponentHooks(base)
      local specs = api.OPPONENT_SPECS103
      local first = specs[1]
      local current = readBytes(base + first.site, #first.original // 2, true)
      if equal(current, bytes(first.original)) then
        return nil
      end
      assert(
        current
          and current[1] == 0xff
          and current[2] == 0x25
          and current[3] == 0
          and current[4] == 0
          and current[5] == 0
          and current[6] == 0,
        'Unrecognized opponent hook'
      )
      local mem = assert(readQword(base + first.site + 6))
      assert(mem > 65536, 'Invalid opponent hook allocation')
      local result = { mem = mem, sites = {} }
      for i, d in ipairs(specs) do
        local original = bytes(d.original)
        local cave = mem + (i - 1) * 1024
        local data = cave + d.dataOffset
        local site = base + d.site
        local patch = bytes(
          (string.char(0xff, 0x25, 0, 0, 0, 0) .. string.pack('<I8', cave) .. string.rep(
            string.char(0x90),
            #original - 14
          )):gsub('.', function(c)
            return string.format('%02x', c:byte())
          end)
        )
        assert(equal(readBytes(site, #patch, true), patch), 'Opponent hook set differs: ' .. d.kind)
        local code = bytes(d.hex)
        for _, rel in ipairs(d.relocations or {}) do
          local address = string.pack('<I8', base + rel.rva)
          for j = 1, 8 do
            code[rel.offset + j] = address:byte(j)
          end
        end
        local prefix = { table.unpack(code, 1, d.dataOffset) }
        assert(equal(readBytes(cave, d.dataOffset, true), prefix), 'Opponent hook payload differs: ' .. d.kind)
        for j, address in ipairs({ base + 0x47e8e98, base + 0x4856670, base + 0x402a618, site + #original }) do
          assert(readQword(data + 8 + (j - 1) * 8) == address, 'Opponent hook pointer differs: ' .. d.kind)
        end
        local enabled = readInteger(data)
        assert(enabled == 0 or enabled == 1, 'Invalid opponent hook state')
        if result.enabled == nil then
          result.enabled = enabled
        else
          assert(result.enabled == enabled, 'Opponent hook state is incomplete')
        end
        result.sites[#result.sites + 1] =
          { kind = d.kind, site = site, cave = cave, data = data, original = original, patch = patch }
      end
      return result
    end

    function api.startOpponents103()
      api.require()
      local pid, base = api.pid, api.mod()
      local s = WP26_OPPONENT_CACHE103
      if s and (s.pid ~= pid or s.base ~= base or s.identity ~= (api.opponentIdentity147 or 110) or not alive(s)) then
        api.stopOpponents103()
        if s.handle then
          call(s, 'CloseHandle', s.handle); s.handle = nil
        end
        if s.buffer then
          s.buffer.destroy(); s.buffer = nil
        end
        s = nil
        WP26_OPPONENT_CACHE103 = nil
      end
      if not s then
        s = { pid = pid, base = base, identity = (api.opponentIdentity147 or 110), active = false, api = {}, sites = {} }
        for _, name in ipairs({
          'OpenProcess',
          'CloseHandle',
          'VirtualAllocEx',
          'ReadProcessMemory',
          'WriteProcessMemory',
          'VirtualProtectEx',
          'FlushInstructionCache',
          'GetExitCodeProcess',
        }) do
          s.api[name] = assert(getAddressSafe('kernel32.' .. name, true))
        end
        for _, name in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
          s.api[name] = assert(getAddressSafe('ntdll.' .. name, true))
        end
        s.handle = call(s, 'OpenProcess', 0xC38, 0, pid)
        assert(s.handle and s.handle ~= 0)
        s.buffer = createMemoryStream()
        s.buffer.Size = 4096
        local ok, e = pcall(function()
          local previous = api.inspectOpponentHooks(base)
          if previous then
            s.mem = previous.mem
            s.sites = previous.sites
            s.active = true
            s.adopted = true
            s.needsEnable = previous.enabled == 0
            return
          end
          for _, d in ipairs(api.OPPONENT_SPECS103) do
            assert(
              equal(read(s, base + d.site, #d.original // 2), bytes(d.original)),
              'Opponent code differs from local EXE: ' .. d.kind
            )
          end
          s.mem = call(s, 'VirtualAllocEx', s.handle, 0, 8192, 0x3000, 0x40)
          assert(s.mem and s.mem ~= 0)
          for i, d in ipairs(api.OPPONENT_SPECS103) do
            local cave = s.mem + (i - 1) * 1024
            local site = base + d.site
            local original = bytes(d.original)
            local data = cave + d.dataOffset
            write(s, cave, bytes(d.hex))
            for _, rel in ipairs(d.relocations or {}) do
              write(
                s,
                cave + rel.offset,
                bytes((string.pack('<I8', base + rel.rva):gsub('.', function(c)
                  return string.format('%02x', c:byte())
                end)))
              )
            end
            for index, address in ipairs({ base + 0x47E8E98, base + 0x4856670, base + 0x402A618, site + #original }) do
              write(
                s,
                data + 8 + (index - 1) * 8,
                bytes((string.pack('<I8', address):gsub('.', function(c)
                  return string.format('%02x', c:byte())
                end)))
              )
            end
            assert(call(s, 'FlushInstructionCache', s.handle, cave, d.size) ~= 0)
            local hook = string.char(0xff, 0x25, 0, 0, 0, 0)
              .. string.pack('<I8', cave)
              .. string.rep(string.char(0x90), #original - 14)
            local h = {}
            for n = 1, #hook do
              h[n] = hook:byte(n)
            end
            s.sites[#s.sites + 1] =
              { kind = d.kind, site = site, cave = cave, data = data, original = original, patch = h }
          end
        end)
        if not ok then
          call(s, 'CloseHandle', s.handle)
          s.buffer.destroy()
          error(e, 0)
        end
        WP26_OPPONENT_CACHE103 = s
      end
      if not s.active or s.needsEnable then
        patch(s, true)
        s.needsEnable = nil
      end
      return true
    end
    function api.enableOpponents103(record)
      api.cancelRecordDeactivate(record.ID)
      local ok, e = pcall(api.startOpponents103)
      if not ok then
        pcall(api.stopOpponents103)
        api.msg('Stopped: ' .. tostring(e), '中止: ' .. tostring(e))
        api.deferRecordDeactivate(record, 150)
      end
    end
    local disable = api.disableAll
    function api.disableAll(...)
      api.stopOpponents103()
      return disable(...)
    end
    local forget = api.forgetProcess
    function api.forgetProcess(...)
      api.stopOpponents103()
      return forget(...)
    end
    api.applyLang()
  end
  do
    WP26.SPEC.foalWeakLegs159 = {["pattern"] = "B8 70 0D 00 00 66 3B C8 73 25 83 FA 03 7D 20 0F B7 C1 83 E2 03 C1 E2 1C 48 8D 0C 40 48 8B 05 05 23 F5 03 81 64 C8 10 FF"}
    for _,key in ipairs({'foal','ownedFoal'}) do table.insert(WP26.EDITORS[key].fields,{["en"] = "Leg fragility", ["ja"] = "脚部不安", ["off"] = 16, ["bit"] = 28, ["bits"] = 2, ["max"] = 2, ["foalSetter"] = "foalWeakLegs159", ["groupEn"] = "Weaknesses", ["groupJa"] = "弱点", ["optionsJa"] = {"なし", "改善", "あり"}, ["optionsEn"] = {"None", "Improved", "Present"}, ["source"] = "Local EXE D8770/D87A0; foal+10 bits28..29; D88C0 checks Present=2"}) end
    WP26.SPEC.foalWeakThroat159 = {["pattern"] = "B8 70 0D 00 00 66 3B C8 73 22 83 FA 03 7D 1D 0F B7 C1 C1 E2 1E 48 8D 0C 40 48 8B 05 98 22 F5 03 81 64 C8 10 FF FF FF 3F"}
    for _,key in ipairs({'foal','ownedFoal'}) do table.insert(WP26.EDITORS[key].fields,{["en"] = "Roaring", ["ja"] = "喉鳴り", ["off"] = 16, ["bit"] = 30, ["bits"] = 2, ["max"] = 2, ["foalSetter"] = "foalWeakThroat159", ["groupEn"] = "Weaknesses", ["groupJa"] = "弱点", ["optionsJa"] = {"なし", "改善", "あり"}, ["optionsEn"] = {"None", "Improved", "Present"}, ["source"] = "Local EXE D87E0/D8810; foal+10 bits30..31; D88C0 checks Present=2"}) end
    WP26.SPEC.foalWeakBack159 = {["pattern"] = "B8 70 0D 00 00 66 3B C8 73 22 83 FA 03 7D 1D 0F B7 C1 83 E2 03 C1 E2 05 48 8D 0C 40 48 8B 05 25 22 F5 03 83 64 C8 14 9F"}
    for _,key in ipairs({'foal','ownedFoal'}) do table.insert(WP26.EDITORS[key].fields,{["en"] = "Weak back", ["ja"] = "腰の甘さ", ["off"] = 20, ["bit"] = 5, ["bits"] = 2, ["max"] = 2, ["foalSetter"] = "foalWeakBack159", ["groupEn"] = "Weaknesses", ["groupJa"] = "弱点", ["optionsJa"] = {"なし", "改善", "あり"}, ["optionsEn"] = {"None", "Improved", "Present"}, ["source"] = "Local EXE D8850/D8880; foal+14 bits5..6; D88C0 checks Present=2"}) end
  end
  do
    local api = WP26
    api.bulkSettings104 = { owned = {}, ownedFoal = {} }
    api.bulkStates104 = {}
    api.bulkDefinitions104 = {}
    local wanted = {
      Breeder = true,
      ['Stabling farm'] = true,
      ['Transaction type'] = true,
      Father = true,
      Mother = true,
      ['Racing lifespan'] = true,
      ['Growth degree'] = true,
      ['Growth limit bonus'] = true,
      ['Trust level'] = true,
      Personality = true,
    }
    local core = false
    for _, f in ipairs(api.EDITORS.owned.fields) do
      if f.en == 'Speed (base)' then
        core = true
      end
      if core then
        wanted[f.en] = true
      end
      if f.en == 'Current weight (kg)' then
        core = false
      end
      if
        f.groupEn == 'Race style aptitude'
        or f.groupEn == 'Race style growth'
        or f.groupEn == 'Umasona'
        or f.groupEn == 'Weaknesses'
        or f.groupEn == 'Track aptitude'
      then
        wanted[f.en] = true
      end
    end
    local profile = { 'Breeder', 'Stabling farm', 'Transaction type', 'Father', 'Mother' }
    for _, key in ipairs({ 'owned', 'ownedFoal' }) do
      local list = {}
      local used = {}
      local function add(i, f)
        if used[f.en] then
          return
        end
        used[f.en] = true
        list[#list + 1] = {
          index = i,
          field = f,
          en = f.en,
          ja = f.ja,
          groupEn = f.groupEn or 'Basic abilities',
          groupJa = f.groupJa or '基本能力',
        }
      end
      for _, name in ipairs(profile) do
        for i, f in ipairs(api.EDITORS[key].fields) do
          if f.en == name then
            add(i, f)
          end
        end
      end
      for i, f in ipairs(api.EDITORS[key].fields) do
        if
          wanted[f.en] or (key == 'ownedFoal' and (f.groupEn == 'Growth bonuses' or f.groupEn == 'Training progress'))
        then
          add(i, f)
        end
      end
      api.bulkDefinitions104[key] = list
    end
    local function definition(key, name)
      for _, d in ipairs(assert(api.bulkDefinitions104[key])) do
        if d.en == name then
          return d
        end
      end
      error('Unsupported bulk field', 0)
    end
    function api.bulkSet104(key, name, value)
      local d = definition(key, name)
      local f = d.field
      if value == nil or value == '' or value == '-1' or value == api.T('Not set', '未設定') then
        api.bulkSettings104[key][name] = nil
        return
      end
      value = tonumber(value)
      assert(
        value and value % 1 == 0 and value >= (f.min or 0) and value <= f.max,
        api.T('Enter a value within the field range.', '項目の範囲内の値を入力してください。')
      )
      if f.displayScale then
        assert(
          (value - (f.displayAdd or 0)) % f.displayScale == 0,
          api.T('Use the field step size.', '項目の刻みに合わせて入力してください。')
        )
      end
      if d.allowed then
        assert(d.allowed[value], api.T('Select a listed value.', '一覧にある値を選択してください。'))
      end
      api.bulkSettings104[key][name] = value
    end
    local function targets(key)
      local out = {}
      if key == 'owned' then
        for _, s in ipairs(api.ownedConditionSnapshot()) do
          out[#out + 1] = { id = s.slot, horseID = s.horseID, raceID = s.raceID }
        end
      else
        for _, row in ipairs(api.editorRows('ownedFoal')) do
          local c = api.context(key, row.id)
          assert(api.bits(c.primary, 4, 14, 13) == 46)
          out[#out + 1] = { id = row.id, horseID = c.horseID, primary = c.primary }
        end
      end
      return out
    end
    local function fresh(key, t)
      assert(_G.WP26 == api, 'Table changed during bulk operation')
      local c = api.context(key, t.id)
      assert(c.horseID == t.horseID and (key ~= 'owned' or c.raceID == t.raceID), 'Bulk horse identity changed')
      assert(
        key == 'owned' and api.bits(c.race, 0x24, 0, 13) == 46
          or key == 'ownedFoal' and c.primary == t.primary and api.bits(c.primary, 4, 14, 13) == 46,
        'Horse ownership changed'
      )
      return c
    end
    function api.bulkPlan104(key)
      api.require()
      local chosen = {}
      for _, d in ipairs(api.bulkDefinitions104[key]) do
        local v = api.bulkSettings104[key][d.en]
        if v ~= nil then
          chosen[#chosen + 1] = { field = d.field, value = v, en = d.en }
        end
      end
      if #chosen == 0 then
        return {}, 0
      end
      local plan = {}
      for _, t in ipairs(targets(key)) do
        local c = fresh(key, t)
        local edits = {}
        local weights = {}
        for _, d in ipairs(chosen) do
          assert(
            api.fieldAvailable(c, d.field),
            api.T('Field unavailable for this horse: ', 'この馬では設定できません: ') .. d.field.ja
          )
          local before = api.fieldRead(c, d.field)
          edits[#edits + 1] = { field = d.field, value = d.value, before = before, en = d.en }
          if d.en == 'Ideal weight (kg)' then
            weights.ideal = d.value
          elseif d.en == 'Current weight (kg)' then
            weights.current = d.value
          end
        end
        if weights.current then
          local ideal = weights.ideal or (api.bits(c.race, 10, 0, 8) * 2 + 300)
          for _, edit in ipairs(edits) do
            if edit.field.currentWeight then
              edit.value = api.normalizeNumeric120(edit.field, edit.value, ideal)
            end
          end
        end
        plan[#plan + 1] = { target = t, edits = edits }
      end
      return plan, #chosen
    end
    function api.applyBulk104(key)
      local plan, columns = api.bulkPlan104(key)
      if columns == 0 then
        api.msg('No fields selected.', '設定された項目がありません。')
        return 0, 0
      end
      local total = 0
      local completed = {}
      local function restore(target, edits)
        local restored = true
        for _, edit in ipairs(edits) do
          local good = pcall(function()
            local current = fresh(key, target)
            api.writeField(current, edit.field, edit.before, false)
            assert(api.fieldRead(current, edit.field) == edit.before)
          end)
          restored = restored and good
        end
        return restored
      end
      for _, p in ipairs(plan) do
        local c = fresh(key, p.target)
        local changed = {}
        local ok, e = pcall(function()
          for _, edit in ipairs(p.edits) do
            c = fresh(key, p.target)
            assert(api.fieldRead(c, edit.field) == edit.before, 'Field changed before bulk update')
            if edit.value ~= edit.before then
              changed[#changed + 1] = edit
              api.writeField(c, edit.field, edit.value, false)
              assert(api.fieldRead(c, edit.field) == edit.value, 'Bulk update verification failed')
            end
          end
        end)
        if not ok then
          local restored = restore(p.target, changed)
          -- Preserve the ideal/current weight dependency when restoring a pair.
          for i = #completed, 1, -1 do
            local good = restore(completed[i].target, completed[i].edits)
            restored = restored and good
          end
          if not restored then
            error(tostring(e) .. api.T(' / restoration incomplete', '／復元未完了'), 0)
          end
          error(e, 0)
        end
        total = total + #changed
        completed[#completed + 1] = { target = p.target, edits = changed }
      end
      api.msg(
        'Bulk settings applied: ' .. #plan .. ' horses / ' .. total .. ' changes',
        '一括設定を適用: ' .. #plan .. '頭／' .. total .. '項目変更'
      )
      return #plan, total
    end
    local function choices(d, c)
      local f = d.field
      if f.parentSetter072 then
        return api.parentChoices072(c, f)
      elseif f.farmChoices070 then
        return api.farmChoices070()
      elseif f.relation then
        return api.editorRows(f.relation)
      elseif f.optionsJa then
        local out = {}
        local labels = api.lang == 'ja' and f.optionsJa or f.optionsEn
        for i, label in ipairs(labels) do
          out[#out + 1] = { id = i - 1, name = label }
        end
        return out
      else
        return f.choices
      end
    end
    local function valid(s)
      return _G.WP26 == api
        and s.alive
        and not s.cancelled
        and getAddressList().getMemoryRecordByID(s.record) == s.parent
        and s.parent.Active
    end
    local function check(s)
      if not valid(s) then
        error(s.cancelToken, 0)
      end
    end
    local function closeNow(s)
      for _, entry in ipairs(s.entries) do
        if entry.state == s then
          entry.state = nil
        end
      end
      if s.alive and _G.WP26 == api and getAddressList().getMemoryRecordByID(s.record) == s.parent then
        api.closeEditor(s.parent)
      end
      api.bulkStates104[s.key] = nil
    end
    function api.closeBulk104(key)
      local s = api.bulkStates104[key]
      if not s then
        return
      end
      s.cancelled = true
      if not s.building then
        closeNow(s)
      end
    end
    local function memory()
      api.require()
      local c = WP26_BULK_MEMORY104
      if not c or c.pid ~= api.pid then
        c = { pid = api.pid, address = assert(allocateMemory(4096)) }
        WP26_BULK_MEMORY104 = c
      end
      return c.address
    end
    function api.resetBulk104(key)
      api.bulkSettings104[key] = {}
      local s = api.bulkStates104[key]
      if s then
        for _, row in ipairs(s.rows) do
          row.reinterpret()
        end
      end
    end
    function api.openBulk104(parent, key)
      api.require()
      local record = key == 'owned' and 130 or 140
      if getAddressList().getMemoryRecordByID(record) ~= parent or not parent.Active then
        return false
      end
      local previous = api.bulkStates104[key]
      api.closeBulk104(key)
      if previous and previous.building then
        return false
      end
      local s = {
        key = key,
        parent = parent,
        record = record,
        alive = true,
        cancelled = false,
        building = true,
        cancelToken = {},
        rows = {},
        entries = {},
        labels = {},
      }
      api.bulkStates104[key] = s
      api.bulkDestroyHooks104 = api.bulkDestroyHooks104 or {}
      if not api.bulkDestroyHooks104[parent.ID] then
        api.bulkDestroyHooks104[parent.ID] = true
        local oldDestroy = parent.OnDestroy
        parent.OnDestroy = function(sender)
          local current = api.bulkStates104[key]
          if current then
            current.alive = false
            current.cancelled = true
          end
          if oldDestroy then
            oldDestroy(sender)
          end
        end
      end
      local ok, e = pcall(function()
        check(s)
        local available = targets(key)
        check(s)
        if #available == 0 then
          error(s.cancelToken, 0)
        end
        local c = fresh(key, available[1])
        check(s)
        local groups = {}
        local root = memory()
        local offset = key == 'owned' and 0 or 2048
        api.addAction(
          parent,
          'Load settings from a horse',
          '馬から設定を読み込む',
          'WP26.loadBulkSource106(' .. string.format('%q', key) .. ')'
        )
        s.applyAction119 = api.addAction(
          parent,
          'Apply configured fields',
          '設定項目を一括適用',
          'WP26.applyBulk104(' .. string.format('%q', key) .. ')'
        )
        api.addAction(
          parent,
          'Clear all settings',
          '設定をすべて解除',
          'WP26.resetBulk104(' .. string.format('%q', key) .. ')'
        )
        local cache = WP26_BULK_TYPES104 or { serial = 0, types = {} }
        WP26_BULK_TYPES104 = cache
        for i, d in ipairs(api.bulkDefinitions104[key]) do
          check(s)
          local f = d.field
          local options = choices(d, c)
          check(s)
          local group = d.groupEn
          if not groups[group] then
            groups[group] = api.addHdr(parent, d.groupEn, d.groupJa)
            groups[group].Collapsed = true
          end
          local row = api.addRec(groups[group], d.en, d.ja, string.format('%X', root + offset + (i - 1) * 4), vtByte)
          row.Color = api.C_VALUE or 0xffffff
          local identity = key .. ':' .. d.en
          local entry = cache.types[identity]
          if not entry then
            cache.serial = cache.serial + 1
            entry = { name = 'WP26Bulk104_' .. getTickCount() .. '_' .. cache.serial, key = key, en = d.en }
            cache.types[identity] = entry
            entry.custom = registerCustomTypeLua(entry.name, 4, function()
              local state = entry.state
              if not state or not state.alive or state.cancelled or _G.WP26 ~= state.api then
                return '-1'
              end
              local value = state.api.bulkSettings104[entry.key][entry.en]
              return tostring(value == nil and -1 or value)
            end, function(value)
              local state = entry.state
              local current
              local active = state and state.api
              if
                active
                and _G.WP26 == active
                and state.alive
                and not state.cancelled
                and getAddressList().getMemoryRecordByID(state.record) == state.parent
                and state.parent.Active
              then
                local good, err = pcall(active.bulkSet104, entry.key, entry.en, value)
                active.bulkInputResult119(entry.key, entry.en, value, not good and err or nil)
                current = active.bulkSettings104[entry.key][entry.en]
              end
              local raw = current == nil and 0xffffffff or (current & 0xffffffff)
              return { raw & 255, (raw >> 8) & 255, (raw >> 16) & 255, (raw >> 24) & 255 }
            end, false, true)
            assert(entry.custom)
            entry.custom.InternalOnly = true
            entry.custom.scriptUsesString = true
          end
          s.api = api
          entry.state = s
          s.entries[#s.entries + 1] = entry
          s.rows[#s.rows + 1] = row
          row.Type = vtCustom
          row.CustomTypeName = entry.name
          row.ShowAsSigned = false
          local list = { '-1:' .. api.T('Not set', '未設定') }
          d.allowed = nil
          if options then
            d.allowed = {}
            for _, choice in ipairs(options) do
              d.allowed[choice.id] = true
              list[#list + 1] = choice.id .. ':' .. (choice.name or api.T(choice.en, choice.ja))
            end
          end
          row.DropDownList.Text = table.concat(list, '\n')
          row.DropDownReadOnly = options ~= nil
          row.DropDownDescriptionOnly = true
          row.DisplayAsDropDownListItem = true
          s.labels[#s.labels + 1] = { row = row, definition = d, options = options }
          row.OnActivate = function(_, before)
            if before then
              return false
            end
            return true
          end
        end
        check(s)
        parent.Collapsed = false
      end)
      s.building = false
      if not ok or not valid(s) then
        closeNow(s)
        if not ok and e ~= s.cancelToken then
          error(e, 0)
        end
        return false
      end
      return true
    end
    function api.enableBulk104(parent, key)
      api.cancelRecordDeactivate(parent.ID)
      local timer = createTimer(nil, false)
      timer.Interval = 100
      api.uiTimers = api.uiTimers or {}
      api.uiTimers[timer] = true
      timer.OnTimer = function(t)
        api.uiTimers[t] = nil
        t.destroy()
        local record = key == 'owned' and 130 or 140
        if _G.WP26 ~= api or getAddressList().getMemoryRecordByID(record) ~= parent or not parent.Active then
          return
        end
        local good, result = pcall(api.openBulk104, parent, key)
        if _G.WP26 ~= api or getAddressList().getMemoryRecordByID(record) ~= parent then
          return
        end
        if not good then
          api.msg(tostring(result), tostring(result))
        end
        if not good or not result then
          api.deferRecordDeactivate(parent, 150)
        end
      end
      timer.Enabled = true
    end
    api.NAMES[130] = { 'Owned racehorses: bulk settings', '所有競走馬の一括設定' }
    api.NAMES[140] = { 'Owned foals: bulk settings', '所有幼駒の一括設定' }
    local setLang = api.setLang
    function api.setLang(lang)
      setLang(lang)
      for _, s in pairs(api.bulkStates104) do
        if not s.building and valid(s) then
          for _, entry in ipairs(s.labels) do
            local f = entry.definition.field
            local options = entry.options
            local lines = { '-1:' .. api.T('Not set', '未設定') }
            if f.optionsJa then
              local names = api.lang == 'ja' and f.optionsJa or f.optionsEn
              for i, name in ipairs(names) do
                lines[#lines + 1] = (i - 1) .. ':' .. name
              end
            elseif options then
              for _, choice in ipairs(options) do
                lines[#lines + 1] = choice.id .. ':' .. (choice.name or api.T(choice.en, choice.ja))
              end
            end
            entry.row.DropDownList.Text = table.concat(lines, '\n')
            entry.row.reinterpret()
          end
        end
      end
    end
    api.applyLang()
  end
  do
    WP26.FRIEND_SPECS104 = {
      ['ownerGet'] = { ['rva'] = 1051424, ['original'] = 'b8c4110000663bc873338d41d0ba9311' },
      ['ownerSet'] = { ['rva'] = 1051504, ['original'] = 'b8c4110000663bc8734183fa64773c8d' },
      ['farmGet'] = { ['rva'] = 1073680, ['original'] = 'b811010000663bc8720333c0c38d41db' },
      ['farmSet'] = { ['rva'] = 1073776, ['original'] = 'b811010000663bc8736183fa64775c8d' },
      ['managerGet'] = { ['rva'] = 1108448, ['original'] = 'b894000000663bc873308d418c6683f8' },
      ['managerSet'] = { ['rva'] = 1108528, ['original'] = 'b894000000663bc873348d418c6683f8' },
      ['trainerGet'] = { ['rva'] = 1136576, ['original'] = '66894c24084883ec380fb74c2440e8ed' },
      ['trainerSet'] = { ['rva'] = 1136672, ['original'] = '8954241066894c24084883ec380fb74c' },
      ['trainerValid'] = { ['rva'] = 549824, ['original'] = '40534883ec20b82e0300000fb7d9663b' },
      ['trainerVirtual'] = { ['rva'] = 1125200, ['original'] = '66894c24084883ec180fb74424203d4c' },
      ['jockeyGet'] = { ['rva'] = 1189632, ['original'] = '4883ec28b859030000663bc872267439' },
      ['jockeySet'] = { ['rva'] = 1189808, ['original'] = '4883ec28b859030000448bd2663bc872' },
    }
    local api = WP26
    function api.friendNative104(name, ...)
      local now = getTickCount()
      local identity = api.friendIdentity104
      if not identity or identity.pid ~= api.pid or now - identity.time >= 250 then
        api.require()
        local base = api.mod()
        local pe = assert(readInteger(base + 0x3c))
        identity = { pid = api.pid, base = base, pe = pe, time = now }
        api.friendIdentity104 = identity
      end
      assert(_G.WP26 == api and api.pid == getOpenedProcessID(), 'Friendship process changed')
      assert(
        readInteger(identity.base + identity.pe + 8) == api.BUILD.ts
          and readInteger(identity.base + identity.pe + 0x50) == api.BUILD.size,
        'Friendship binary changed'
      )
      local d = assert(api.FRIEND_SPECS104[name])
      api.friendChecked104 = api.friendChecked104 or {}
      local address = identity.base + d.rva
      if api.friendChecked104[name] ~= api.pid then
        local bytes = assert(readBytes(address, #d.original // 2, true))
        local i = 1
        for b in d.original:gmatch('%x%x') do
          assert(bytes[i] == tonumber(b, 16), 'Friendship code differs from local EXE')
          i = i + 1
        end
        api.friendChecked104[name] = api.pid
      end
      local arguments = table.pack(...)
      for i = 1, arguments.n do
        assert(math.type(arguments[i]) == 'integer')
      end
      local result = executeCodeEx(0, 5000, address, table.unpack(arguments, 1, arguments.n))
      assert(result ~= nil, 'Friendship function did not complete')
      return result
    end
    function api.friendshipTargets104(key)
      api.require()
      local list = {}
      local function add(id, getter, setter, readID)
        list[#list + 1] = { key = key, id = id, getter = getter, setter = setter, readID = readID or id }
      end
      if key == 'owner' then
        -- EXE100B20 returns a constant100 for every owner ID48..4547.
        for id = 0, 47 do
          add(id, 'ownerGet', 'ownerSet')
        end
      elseif key == 'farm' then
        for id = 0, 272 do
          if id == 32 or id == 34 or id == 35 then
            local manager = readBytes(api.data('farm') + id * 204 + 7, 1, false)
            if manager and manager < 116 then
              add(id, 'managerGet', 'managerSet', manager)
            end
          else
            add(id, 'farmGet', 'farmSet')
          end
        end
      elseif key == 'trainer' then
        for id = 0, 587 do
          if api.friendNative104('trainerValid', id) ~= 0 and api.friendNative104('trainerVirtual', id) == 0 then
            add(id, 'trainerGet', 'trainerSet')
          end
        end
      elseif key == 'jockey' then
        for id = 0, 585 do
          if id == 484 or id == 485 then
            local ok, c = pcall(api.context, 'jockey', id)
            if ok and c.childNames then
              local root = api.data('acquaintance')
              local contact = (c.personName - root) // 68
              local field
              for _, f in ipairs(api.EDITORS.acquaintance.fields) do
                if f.en == 'Friendship' then
                  field = f
                  break
                end
              end
              assert(field and contact >= 0 and contact < 820, 'Child jockey friendship identity unavailable')
              local target = {
                key = key,
                id = id,
                getter = 'jockeyGet',
                readID = id,
                contact = contact,
                field = field,
                address = c.personName,
              }
              list[#list + 1] = target
            end
          else
            add(id, 'jockeyGet', 'jockeySet')
          end
        end
      else
        error('Unsupported friendship category', 0)
      end
      return list
    end
    function api.friendshipValue104(t)
      assert(_G.WP26 == api, 'Table changed during friendship update')
      local value = api.friendNative104(t.getter, t.readID)
      assert(value >= 0 and value <= 100, 'Friendship value outside0..100')
      if t.contact then
        local c = api.context('acquaintance', t.contact)
        assert(c.primary == t.address and api.fieldRead(c, t.field) == value, 'Child jockey friendship route changed')
      end
      return value
    end
    local function setValue(t, value)
      assert(_G.WP26 == api)
      api.require()
      if t.contact then
        local c = api.context('acquaintance', t.contact)
        assert(c.primary == t.address)
        api.writeField(c, t.field, value, false)
      else
        api.friendNative104(t.setter, t.readID, value)
      end
    end
    function api.friendshipPlan104(key, target)
      assert(target == 5 or target == 100)
      local list = {}
      local categories = key == 'all' and { 'owner', 'farm', 'trainer', 'jockey' } or { key }
      for _, category in ipairs(categories) do
        for _, t in ipairs(api.friendshipTargets104(category)) do
          local old = api.friendshipValue104(t)
          if (target == 5 and old < 5) or (target == 100 and old ~= 100) then
            t.before = old
            t.value = target
            list[#list + 1] = t
          end
        end
      end
      return list
    end
    function api.applyFriendship104(key, target)
      local plan = api.friendshipPlan104(key, target)
      local changed = {}
      local ok, e = pcall(function()
        for _, t in ipairs(plan) do
          local current = api.friendshipValue104(t)
          if (target == 100 and current ~= 100) or (target == 5 and current < 5) then
            t.before = current
            changed[#changed + 1] = t
            setValue(t, target)
            assert(api.friendshipValue104(t) == target, 'Friendship update verification failed')
          end
        end
      end)
      if not ok then
        local restored = true
        for i = #changed, 1, -1 do
          local t = changed[i]
          local good = pcall(function()
            setValue(t, t.before)
            assert(api.friendshipValue104(t) == t.before)
          end)
          restored = restored and good
        end
        if not restored then
          error(tostring(e) .. api.T(' / restoration incomplete', '／復元未完了'), 0)
        end
        error(e, 0)
      end
      api.msg('Friendship updated: ' .. #changed, '友好度を更新: ' .. #changed .. '件')
      return #changed
    end
    api.NAMES[150] = { 'Friendship', '友好度' }
    local names = {
      { 'owner', 'Owners', '馬主' },
      { 'farm', 'Farms', '牧場' },
      { 'trainer', 'Trainers', '調教師' },
      { 'jockey', 'Jockeys', '騎手' },
      { 'all', 'Everyone', '全員' },
    }
    for i, n in ipairs(names) do
      api.NAMES[149 + i * 2] = {
        n[2] .. ': friendship at least5',
        n[1] == 'all' and '全員の友好度を5以上にする' or '全' .. n[3] .. 'の友好度を5以上にする',
      }
      api.NAMES[150 + i * 2] = {
        n[2] .. ': friendship100',
        n[1] == 'all' and '全員の友好度を100にする' or '全' .. n[3] .. 'の友好度を100にする',
      }
    end
    api.applyLang()
  end
  do
    local api = WP26
    function api.bulkSourceRows122()
      local rows = {}
      for _, key in ipairs({ 'race', 'foal' }) do
        local snapshot = api.entityPickerRows101(key, api.editorRows(key))
        for _, row in ipairs(snapshot) do
          if row.primary then
            row.sourceKey, row.sourceId = key, row.id
            row.id = #rows + 1
            row.kind = key == 'race' and api.T('Racehorse', '競走馬') or api.T('Foal', '幼駒')
            rows[#rows + 1] = row
          end
        end
      end
      return rows
    end
    function api.bulkReadSource106(key, id, kind)
      api.require()
      assert(key == 'owned' or key == 'ownedFoal')
      local sourceKey = kind or (key == 'owned' and 'race' or 'foal')
      assert(sourceKey == 'race' or sourceKey == 'foal')
      local sourceId = id
      if sourceKey == 'race' then
        for _, t in ipairs(api.ownedConditionSnapshot()) do
          if t.raceID == id then
            sourceKey = 'owned'
            sourceId = t.slot
            break
          end
        end
      else
        local c = api.context('foal', id)
        if api.bits(c.primary, 4, 14, 13) == 46 then
          sourceKey = 'ownedFoal'
        end
      end
      local c = api.context(sourceKey, sourceId)
      local fields = {}
      for _, f in ipairs(api.EDITORS[sourceKey].fields) do
        fields[f.en] = f
      end
      local values = {}
      local loaded, skipped = 0, 0
      for _, d in ipairs(api.bulkDefinitions104[key]) do
        local f = fields[d.en]
        if f and api.fieldAvailable(c, f) then
          local value = api.fieldRead(c, f)
          value = api.normalizeNumeric120(d.field, value)
          assert(value ~= nil, 'Source field unreadable: ' .. d.en)
          values[d.en] = value
          loaded = loaded + 1
        else
          skipped = skipped + 1
        end
      end
      local current = api.context(sourceKey, sourceId)
      assert(
        _G.WP26 == api and current.primary == c.primary and current.horseID == c.horseID and current.raceID == c.raceID,
        'Source horse changed while reading'
      )
      if sourceKey == 'owned' then
        assert(api.bits(current.race, 0x24, 0, 13) == 46, 'Source horse ownership changed')
      end
      if sourceKey == 'ownedFoal' then
        assert(api.bits(current.primary, 4, 14, 13) == 46, 'Source foal ownership changed')
      end
      return values,
        {
          loaded = loaded,
          skipped = skipped,
          key = sourceKey,
          id = sourceId,
          sourceId = id,
          name = api.entityName(sourceKey, sourceId, current),
        }
    end
    function api.loadBulkSource106(key, id, kind)
      local state = api.bulkStates104[key]
      local function alive()
        return _G.WP26 == api
          and api.bulkStates104[key] == state
          and state
          and state.alive
          and not state.cancelled
          and not state.building
          and getAddressList().getMemoryRecordByID(state.record) == state.parent
          and state.parent.Active
      end
      if not alive() then
        return false
      end
      if id == nil then
        local rows = api.bulkSourceRows122()
        local columns = api.EntityPicker101.standardColumns()
        columns[#columns + 1] = { key = 'kind', title = api.T('Category', '区分'), width = 110 }
        local selected = api.EntityPicker101.show({
          title = api.T('Load settings from a horse', '馬から設定を読み込む'),
          rows = rows,
          columns = columns,
        })
        if selected ~= nil then
          local row = rows[selected]
          if not row then
            return false
          end
          local current = api.context(row.sourceKey, row.sourceId)
          if current.primary ~= row.primary or current.horseID ~= row.horseID or current.raceID ~= row.raceID then
            api.msg(
              'The selected horse changed. Select again.',
              '対象が変わりました。選び直してください。'
            )
            return false
          end
          id, kind = row.sourceId, row.sourceKey
        end
        if id == nil or not alive() then
          return false
        end
      end
      local values, source = api.bulkReadSource106(key, id, kind)
      if not alive() then
        return false
      end
      -- Replace the template only after the complete source has been read.
      -- Fields unavailable on this horse stay unset, rather than retaining an older preset.
      api.bulkSettings104[key] = values
      for _, row in ipairs(state.rows) do
        row.reinterpret()
      end
      api.msg(
        'Loaded settings: ' .. source.name .. ' / ' .. source.loaded .. ' fields',
        '設定を読み込み: ' .. source.name .. '／' .. source.loaded .. '項目'
      )
      return true, source
    end
  end
  do
    WP26.PREG_SPECS107 = {
      ['mateGet'] = {
        ['rva'] = 941536,
        ['original'] = 'b810270000663bc87206b8d0070000c30fb7c1486bc844488b051a4cf4038b14',
      },
      ['mateSet'] = {
        ['rva'] = 941600,
        ['original'] = 'b810270000663bc8732db8d0070000663bd077230fb7c14c6bc0440fb7c24c03',
      },
      ['stateGet'] = {
        ['rva'] = 942880,
        ['original'] = 'b810270000663bc8720333c0c30fb7c1486bc844488b05dd46f4038b440114c1',
      },
      ['stateSet'] = {
        ['rva'] = 942928,
        ['original'] = 'b810270000663bc8732283fa047d1d0fb7c183e203486bc844488b05a846f403',
      },
      ['modeSet'] = {
        ['rva'] = 943040,
        ['original'] = 'b810270000663bc8732583fa047d200fb7c183e203486bc844488b053846f403',
      },
      ['seasonSet'] = {
        ['rva'] = 943152,
        ['original'] = 'b810270000663bc8732283fa047d1d0fb7c1486bc844488b05cb45f403c1e21e',
      },
      ['mareRegion'] = {
        ['rva'] = 933552,
        ['original'] = '40534883ec200fb7d90fb7cbe83ffdffff85c0740833c04883c4205bc3b81027',
      },
      ['regionSeason'] = {
        ['rva'] = 1385168,
        ['original'] = '83f90677224863c1488d1521ddeaff8b8c82fc2215004803caffe1b801000000',
      },
      ['isOwnedMare'] = {
        ['rva'] = 933328,
        ['original'] = 'b810270000663bc8735b0fb7c1486bc844488b05306cf4030fb7540108b8ff7f',
      },
      ['isClubMare'] = {
        ['rva'] = 933440,
        ['original'] = 'b810270000663bc8734c0fb7c1486bc844488b05c06bf4030fb7540108b8ff7f',
      },
      ['factorSlot'] = {
        ['rva'] = 1250016,
        ['original'] = '8954241066894c24084883ec38c744242864000000c744242400000000eb0a8b',
      },
      ['familySlot'] = {
        ['rva'] = 1251520,
        ['original'] = '8954241066894c24084883ec38c744242864000000c744242400000000eb0a8b',
      },
      ['playerRoot'] = {
        ['rva'] = 1243472,
        ['original'] = '488d05f91eea03c3cccccccccccccccc894c2408574883ec40e8e2ffffff4533',
      },
      ['prepareFactors'] = {
        ['rva'] = 8397376,
        ['original'] = '40555356574154415541564157488dac24b8c0ffffb848400000e851930a0248',
      },
      ['randomGet'] = {
        ['rva'] = 5714160,
        ['original'] = '8b050e184e03c3cccccccccccccccccc6683f902730333c0c36905f1174e0365',
      },
      ['randomSet'] = {
        ['rva'] = 5714144,
        ['original'] = '890d1e184e03c3cccccccccccccccccc8b050e184e03c3cccccccccccccccccc',
      },
    }
    local api = WP26
    local uncertain = {}
    function api.pregNative107(name, ...)
      api.require()
      local spec = assert(api.PREG_SPECS107[name])
      local address = api.mod() + spec.rva
      api.pregChecked107 = api.pregChecked107 or {}
      if api.pregChecked107[name] ~= api.pid then
        local actual = assert(readBytes(address, #spec.original // 2, true))
        local i = 1
        for b in spec.original:gmatch('%x%x') do
          assert(actual[i] == tonumber(b, 16), 'Conception code differs from local EXE')
          i = i + 1
        end
        api.pregChecked107[name] = api.pid
      end
      local arguments = table.pack(...)
      for i = 1, arguments.n do
        assert(math.type(arguments[i]) == 'integer', 'Conception argument is not an integer')
      end
      local result = executeCodeEx(0, 5000, address, table.unpack(arguments, 1, arguments.n))
      if result == nil then
        api.pregnancyUnconfirmed107 = true
        error(uncertain, 0)
      end
      return result
    end
    local function same(a, b)
      if not a or #a ~= #b then
        return false
      end
      for i, v in ipairs(b) do
        if a[i] ~= v then
          return false
        end
      end
      return true
    end
    local function copy(a)
      local b = {}
      for i, v in ipairs(a) do
        b[i] = v
      end
      return b
    end
    local function pack(bits, off, bit, width, value)
      local raw = 0
      for i = 4, 1, -1 do
        raw = (raw << 8) | bits[off + i]
      end
      local mask = ((1 << width) - 1) << bit
      raw = (raw & ~mask) | ((value << bit) & mask)
      for i = 1, 4 do
        bits[off + i] = raw & 255
        raw = raw >> 8
      end
    end
    function api.conceptionPlan107(key, id, sireId)
      api.require()
      assert(
        not api.pregnancyUnconfirmed107,
        api.T('A previous game function is unconfirmed.', '前回のゲーム関数の完了が未確認です。')
      )
      assert(key == 'mare' or key == 'ownedMare')
      local c = api.context(key, id)
      local sire = api.context('sire', sireId)
      assert(
        c.pedigreeID072 and sire.pedigreeID072 and c.pedigreeID072 < 100000 and sire.pedigreeID072 < 100000,
        'Breeding pedigree unavailable'
      )
      assert(c.pedigreeID072 ~= sire.pedigreeID072, 'The same horse cannot be both parents')
      local oldSire = api.pregNative107('mateGet', id)
      local oldState = api.pregNative107('stateGet', id)
      assert(
        oldSire == api.bits(c.primary, 0, 19, 11) and oldState == api.bits(c.primary, 20, 5, 2),
        'Mare pregnancy layout mismatch'
      )
      local plan = {
        key = key,
        id = id,
        sireId = sireId,
        mare = c,
        sire = sire,
        oldSire = oldSire,
        oldState = oldState,
        before = assert(readBytes(c.primary, 68, true)),
      }
      plan.generate = api.pregNative107('isOwnedMare', id) ~= 0 or api.pregNative107('isClubMare', id) ~= 0
      plan.season = api.pregNative107('regionSeason', api.pregNative107('mareRegion', id))
      assert(plan.season >= 0 and plan.season < 4)
      if plan.generate then
        plan.first = api.pregNative107('factorSlot', id, 1)
        plan.second = api.pregNative107('familySlot', id, 1)
        assert(
          plan.first >= 0 and plan.first < 100 and plan.second >= 0 and plan.second < 100,
          api.T('Pregnant mare factor storage is full.', '受胎牝馬の因子保存枠が不足しています。')
        )
        local player = api.pregNative107('playerRoot')
        assert(player == api.mod() + 0x3FD1850, 'Player pregnancy storage changed')
        plan.pool = player + 0x5FF8
        plan.poolBefore = assert(readBytes(plan.pool, 2000, true))
        plan.allowed = {}
        plan.segments = {}
        for _, v in ipairs({
          { 0, plan.first, 2 },
          { 0xC8, plan.first, 4 },
          { 0x258, plan.first, 4 },
          { 0x3E8, plan.second, 2 },
          { 0x4B0, plan.second, 4 },
          { 0x640, plan.second, 4 },
        }) do
          local at = v[1] + v[2] * v[3]
          local segment = { address = plan.pool + at, bytes = {} }
          for i = 1, v[3] do
            plan.allowed[at + i] = true
            segment.bytes[i] = plan.poolBefore[at + i]
          end
          plan.segments[#plan.segments + 1] = segment
        end
      end
      plan.noop = oldSire == sireId
        and oldState == 1
        and (
          not plan.generate
          or (api.pregNative107('factorSlot', id, 0) < 100 and api.pregNative107('familySlot', id, 0) < 100)
        )
      return plan
    end
    function api.forceConception107(key, id, sireId)
      local p = api.conceptionPlan107(key, id, sireId)
      if p.noop then
        return { changed = false, id = id, sireId = sireId }
      end
      local function identity(rollback)
        assert(rollback or _G.WP26 == api, 'Table changed during conception update')
        local c = api.context(key, id)
        local s = api.context('sire', sireId)
        assert(
          c.primary == p.mare.primary
            and c.horseID == p.mare.horseID
            and c.pedigreeID072 == p.mare.pedigreeID072
            and s.horseID == p.sire.horseID
            and s.pedigreeID072 == p.sire.pedigreeID072,
          'Breeding horse identity changed'
        )
        return c
      end
      local changed = false
      local ok, e = pcall(function()
        identity()
        assert(same(readBytes(p.mare.primary, 68, true), p.before), 'Mare changed before conception')
        if p.pool then
          assert(same(readBytes(p.pool, 2000, true), p.poolBefore), 'Pregnancy storage changed before update')
        end
        changed = true
        if p.generate then
          api.pregNative107('prepareFactors', id, sireId, 0, 0)
          assert(
            api.pregNative107('factorSlot', id, 0) == p.first and api.pregNative107('familySlot', id, 0) == p.second,
            'Pregnancy factor allocation changed'
          )
          local after = assert(readBytes(p.pool, 2000, true))
          p.unexpected = {}
          for i, b in ipairs(p.poolBefore) do
            if not p.allowed[i] and after[i] ~= b then
              p.unexpected[#p.unexpected + 1] = { offset = i, before = b, after = after[i] }
            end
          end
          assert(#p.unexpected == 0, 'Unrelated pregnancy factor record changed')
        end
        identity()
        api.pregNative107('mateSet', id, sireId)
        api.pregNative107('modeSet', id, 0)
        api.pregNative107('seasonSet', id, p.season)
        api.pregNative107('stateSet', id, 1)
        assert(
          api.pregNative107('mateGet', id) == sireId and api.pregNative107('stateGet', id) == 1,
          'Conception verification failed'
        )
        local expected = copy(p.before)
        pack(expected, 0, 19, 11, sireId)
        pack(expected, 20, 20, 2, 0)
        pack(expected, 20, 30, 2, p.season)
        pack(expected, 20, 5, 2, 1)
        assert(same(readBytes(p.mare.primary, 68, true), expected), 'Unrelated mare field changed')
      end)
      if not ok then
        if e == uncertain or api.pregnancyUnconfirmed107 then
          error(
            api.T(
              'Game function completion unconfirmed; no automatic retry or rollback.',
              'ゲーム関数の完了を確認できないため、自動再試行と追加書き込みを停止しました。'
            ),
            0
          )
        end
        if changed then
          local restored = pcall(function()
            identity(true)
            assert(writeBytes(p.mare.primary, p.before))
            assert(same(readBytes(p.mare.primary, 68, true), p.before))
            if p.pool then
              for _, segment in ipairs(p.segments) do
                assert(writeBytes(segment.address, segment.bytes))
                assert(same(readBytes(segment.address, #segment.bytes, true), segment.bytes))
              end
              for _, v in ipairs(p.unexpected or {}) do
                local address = p.pool + v.offset - 1
                assert(readBytes(address, 1, false) == v.after, 'Unexpected pregnancy record changed again')
                assert(writeBytes(address, v.before))
                assert(readBytes(address, 1, false) == v.before)
              end
            end
          end)
          if not restored then
            error(tostring(e) .. api.T(' / restoration incomplete', '／復元未完了'), 0)
          end
        end
        error(e, 0)
      end
      return { changed = true, id = id, sireId = sireId, factors = p.generate }
    end
    function api.chooseConception107(key)
      api.require()
      local definition = api.EDITORS[key]
      local parent = getAddressList().getMemoryRecordByID(definition.record)
      local id = api.selected[key]
      if not parent or not parent.Active or id == nil then
        return false
      end
      local c = api.context(key, id)
      local current = api.pregNative107('mateGet', id)
      local sireId = api.chooseEntity101(
        'sire',
        api.T('Select a stallion for forced conception', '強制受胎させる種牡馬を選択'),
        api.editorRows('sire'),
        current
      )
      if
        sireId == nil
        or _G.WP26 ~= api
        or getAddressList().getMemoryRecordByID(definition.record) ~= parent
        or not parent.Active
        or api.selected[key] ~= id
      then
        return false
      end
      local now = api.context(key, id)
      assert(now.horseID == c.horseID and now.pedigreeID072 == c.pedigreeID072, 'Selected mare changed')
      local result = api.forceConception107(key, id, sireId)
      local sire = api.context('sire', sireId)
      api.msg(
        'Conception: ' .. api.entityName(key, id, now) .. ' / ' .. api.entityName('sire', sireId, sire),
        '受胎: ' .. api.entityName(key, id, now) .. '／' .. api.entityName('sire', sireId, sire)
      )
      return result
    end
  end
  do
    WP26.FRIEND_EXTRA108 = {
      ['contactGet'] = { rva = 1217712, original = 'b834030000663bc8720333c0c30fb7c1486bc844488b058515f0038b0401c1e8' },
      ['contactSet'] = { rva = 1217760, original = 'b834030000663bc8732383fa64771e0fb7c183e27f486bc844488b055015f003' },
    }
    WP26.FRIEND_CODE108 =
      '53565741544155415641574883ec204889cb448b6308448b6b04c7430c00000000c7431000000000c7431800000000c7431c0000000031ff4439e70f839200000089fe48c1e60648037330c7462000000000c7462400000000f7461801000000741a8b4e10ff5320ff431c85c0745d8b4e10ff5328ff431c85c075508b4e10ff16ff431c83f8640f872f010000894628488b46304885c074118b4e2cffd0ff431c3b46280f85120100008b462889461c4183fd05750783f8057311eb0583f864740ac7462401000000ff4318ffc7e965ffffff833b000f84d700000031ff4439e70f83cc00000089fe48c1e60648037330837e24000f84b1000000f746180100000074228b4e10ff5320ff431c85c00f84970000008b4e10ff5328ff431c85c00f85860000008b4e10ff16ff431c83f8640f8791000000894628488b46304885c0740d8b4e2cffd0ff431c3b462875788b46284183fd05750783f805734eeb0583f864744789461cc7462001000000ff430c8b4e144489eaff5608ff431c8b4e10ff16ff431c83f8647749894628488b46304885c0740d8b4e2cffd0ff431c3b462875308b46284439e87528ffc7e92bffffffc7431001000000eb5dc7431002000000897b14eb51c7431002000000897b14eb0ac7431003000000897b144489e785ff7434ffcf89fe48c1e60648037330837e200074ea8b4e148b561cff5608ff431c8b4e10ff16ff431c3b461c74d1c7431004000000ebc88b43104883c420415f415e415d415c5f5e5bc3'
    local api = WP26
    api.friendshipLegacyPlan108 = api.friendshipPlan104
    local function batch(key, target, mode)
      assert(target == 5 or target == 100)
      api.require()
      local base = api.mod()
      local functions = {}
      for name, d in pairs(api.FRIEND_SPECS104) do
        local actual = assert(readBytes(base + d.rva, #d.original // 2, true))
        local i = 1
        for b in d.original:gmatch('%x%x') do
          assert(actual[i] == tonumber(b, 16), 'Friendship code differs from local EXE')
          i = i + 1
        end
        functions[name] = base + d.rva
      end
      for name, d in pairs(api.FRIEND_EXTRA108) do
        local actual = assert(readBytes(base + d.rva, #d.original // 2, true))
        local i = 1
        for b in d.original:gmatch('%x%x') do
          assert(actual[i] == tonumber(b, 16), 'Friendship code differs from local EXE')
          i = i + 1
        end
        functions[name] = base + d.rva
      end
      local cache = _G.WP26_FRIEND_BATCH108
      if not cache or cache.pid ~= api.pid then
        cache = { pid = api.pid, address = assert(allocateMemory(131072)) }
        _G.WP26_FRIEND_BATCH108 = cache
        local bytes = {}
        for b in api.FRIEND_CODE108:gmatch('%x%x') do
          bytes[#bytes + 1] = tonumber(b, 16)
        end
        assert(writeBytes(cache.address, bytes))
      end
      assert(not cache.running, 'Friendship update is already running')
      local list = {}
      local categories = key == 'all' and { 'owner', 'farm', 'trainer', 'jockey' } or { key }
      local function add(category, id, getter, setter, readID, alias)
        list[#list + 1] =
          { key = category, id = id, getter = getter, setter = setter, readID = readID or id, alias = alias }
      end
      for _, category in ipairs(categories) do
        if category == 'owner' then
          for id = 0, 47 do
            add(category, id, 'ownerGet', 'ownerSet')
          end
        elseif category == 'farm' then
          local root = api.data('farm')
          for id = 0, 272 do
            if id == 32 or id == 34 or id == 35 then
              local manager = readBytes(root + id * 204 + 7, 1, false)
              if manager and manager < 116 then
                add(category, id, 'managerGet', 'managerSet', manager)
              end
            else
              add(category, id, 'farmGet', 'farmSet')
            end
          end
        elseif category == 'trainer' then
          for id = 0, 587 do
            add(category, id, 'trainerGet', 'trainerSet')
          end
        elseif category == 'jockey' then
          for id = 0, 585 do
            if id == 484 or id == 485 then
              local ok, c = pcall(api.context, 'jockey', id)
              if ok and c.childNames then
                local contact = (c.personName - api.data('acquaintance')) // 68
                assert(contact >= 0 and contact < 820)
                add(category, id, 'contactGet', 'contactSet', contact, 'jockeyGet')
              end
            else
              add(category, id, 'jockeyGet', 'jockeySet')
            end
          end
        else
          error('Unsupported friendship category', 0)
        end
      end
      assert(#list <= 1495 and _G.WP26 == api and getOpenedProcessID() == api.pid)
      local entry = cache.address + 8192
      local header = cache.address + 4096
      local chunks = {}
      for _, t in ipairs(list) do
        chunks[#chunks + 1] = string.pack(
          '<I8I8I4I4I4I4I4I4I4I4I8I8',
          functions[t.getter],
          functions[t.setter],
          t.readID,
          t.readID,
          t.key == 'trainer' and 1 or 0,
          0,
          0,
          0,
          0,
          t.id,
          t.alias and functions[t.alias] or 0,
          0
        )
      end
      local function put(address, s)
        local bytes = { s:byte(1, #s) }
        assert(writeBytes(address, bytes))
      end
      put(entry, table.concat(chunks))
      put(
        header,
        string.pack(
          '<I4I4I4I4I4I4I4I4I8I8I8I8',
          mode,
          target,
          #list,
          0,
          0,
          0,
          0,
          0,
          functions.trainerValid,
          functions.trainerVirtual,
          entry,
          0
        )
      )
      cache.running = true
      local ok, result = pcall(executeCodeEx, 0, 5000, cache.address, header)
      if not ok or result == nil then
        error('Friendship batch did not complete; further calls are blocked', 0)
      end
      cache.running = false
      local status = readInteger(header + 16)
      assert(status == 1, 'Friendship update stopped; status=' .. tostring(status))
      local plan = {}
      if mode == 0 then
        for i, t in ipairs(list) do
          local p = entry + (i - 1) * 64
          if readInteger(p + 36) == 1 then
            t.before = readInteger(p + 28)
            t.value = target
            plan[#plan + 1] = t
          end
        end
      end
      return readInteger(header + 12), plan
    end
    function api.friendshipPlan104(key, target)
      local _, plan = batch(key, target, 0)
      return plan
    end
    function api.applyFriendship104(key, target)
      local changed = batch(key, target, 1)
      api.msg('Friendship updated: ' .. changed, '友好度を更新: ' .. changed .. '件')
      return changed
    end
  end
  do
    WP26.ADMISSION_SPEC109 = {
      rva = 9810076,
      offset = 32,
      original = '0000488d349d00000000488b05637f66038b0c068bc12bc73bcf410f46c185c075620fb7cbe8faa67bff85c07507bacb9c0000eb1a488b05307f66038b040603c733',
    }
    local api = WP26
    local function call(s, name, ...)
      local args = table.pack(...)
      for i = 1, args.n do
        assert(math.type(args[i]) == 'integer')
      end
      return executeCodeLocalEx(s.api[name], table.unpack(args, 1, args.n))
    end
    local function alive(s)
      return call(s, 'GetExitCodeProcess', s.handle, s.buffer.Memory + 256) ~= 0
        and readIntegerLocal(s.buffer.Memory + 256) == 259
    end
    local function read(s, address, size)
      assert(
        call(s, 'ReadProcessMemory', s.handle, address, s.buffer.Memory, size, 0) ~= 0,
        'Admission code read failed'
      )
      return readBytesLocal(s.buffer.Memory, size, true)
    end
    local function matches(s, on)
      local actual = read(s, s.base + api.ADMISSION_SPEC109.rva, #api.ADMISSION_SPEC109.original // 2)
      local i = 1
      for byte in api.ADMISSION_SPEC109.original:gmatch('%x%x') do
        local expected = tonumber(byte, 16)
        if i == api.ADMISSION_SPEC109.offset + 1 and on then
          expected = 0xeb
        end
        if actual[i] ~= expected then
          return false
        end
        i = i + 1
      end
      return true
    end
    local function patch(s, on)
      assert(matches(s, s.active), 'Admission code differs from local EXE')
      local address = s.base + api.ADMISSION_SPEC109.rva + api.ADMISSION_SPEC109.offset
      assert(
        call(s, 'VirtualProtectEx', s.handle, address, 1, 0x40, s.buffer.Memory + 264) ~= 0,
        'Admission protection failed'
      )
      local protection = assert(readIntegerLocal(s.buffer.Memory + 264))
      writeBytesLocal(s.buffer.Memory, on and 0xeb or 0x75)
      local written = call(s, 'WriteProcessMemory', s.handle, address, s.buffer.Memory, 1, 0) ~= 0
      if written then
        s.active = on
      end
      local restored = call(s, 'VirtualProtectEx', s.handle, address, 1, protection, s.buffer.Memory + 268) ~= 0
      local flushed = call(s, 'FlushInstructionCache', s.handle, address, 1) ~= 0
      assert(written and restored and flushed and matches(s, on), 'Admission code write verification failed')
    end
    function api.stopAdmission109()
      local s = _G.WP26_ADMISSION109
      if s and s.active then
        if alive(s) then
          patch(s, false)
        else
          s.active = false
        end
      end
      return true
    end
    function api.startAdmission109()
      api.require()
      local s = _G.WP26_ADMISSION109
      if s and (s.pid ~= api.pid or not alive(s)) then
        api.stopAdmission109()
        call(s, 'CloseHandle', s.handle)
        s.buffer.destroy()
        _G.WP26_ADMISSION109 = nil
        s = nil
      end
      if not s then
        s = { pid = api.pid, base = api.mod(), active = false, api = {} }
        for _, name in ipairs({
          'OpenProcess',
          'CloseHandle',
          'ReadProcessMemory',
          'WriteProcessMemory',
          'VirtualProtectEx',
          'FlushInstructionCache',
          'GetExitCodeProcess',
        }) do
          s.api[name] = assert(getAddressSafe('kernel32.' .. name, true))
        end
        s.handle = call(s, 'OpenProcess', 0x438, 0, s.pid)
        assert(s.handle and s.handle ~= 0)
        s.buffer = createMemoryStream()
        s.buffer.Size = 512
        _G.WP26_ADMISSION109 = s
      end
      if not s.active then
        patch(s, true)
      end
      return true
    end
    function api.enableAdmission109(record)
      api.cancelRecordDeactivate(record.ID)
      local ok, e = pcall(api.startAdmission109)
      if not ok then
        pcall(api.stopAdmission109)
        api.msg('Stopped: ' .. tostring(e), '中止: ' .. tostring(e))
        api.deferRecordDeactivate(record, 150)
      end
    end
    local disable = api.disableAll
    function api.disableAll(...)
      api.stopAdmission109()
      return disable(...)
    end
    local forget = api.forgetProcess
    function api.forgetProcess(...)
      api.stopAdmission109()
      return forget(...)
    end
    api.NAMES[161] = { 'Unconditional stable admission', '無条件入居' }
    api.applyLang()
  end
  do
    WP26.RACE_PAYLOAD = {
      ['dataOffset'] = 1352,
      ['size'] = 1460,
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['hex'] = '9c5051524150415141524153535655574154415541564157ff052e050000833d23050000010f85de040000488b053e0500004c8b153f0500004c39100f85c7040000458b42504183f8020f82b90400004183f8120f87af040000488b051f0500004c8b184d85db0f849c040000458b4b044183f9010f8c8e040000488b0506050000488b304885f60f847b040000410fb68b080100004439c10f836404000031c9418b448b0c4401c80f805404000085c00f8e4c040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8e17040000bbffffff7f31c94963448b544885c00f88020400008b5424604801d0483d9bc420000f87ef030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d29040000488b0546040000488b30488b2d1c040000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c289554831db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d388945408b550081fae80300000f82db02000089d8480fafc231d2b9e803000048f7f18b15200300004839d0480f47c289c3c70555030000ffffffffc7054f03000000000000891d4103000031c9833d40030000017419410fb7844a48ba00003b4504750b890d26030000e9fa010000410fb7844a48ba00003d851a00000f83e60100004869c0e80000008b44062425ff1f000083f82e0f85cd010000488b05d10200003a080f84be010000410fb7844a48ba00003b450475338b550881fae8030000722889d83b45440f4c4544480fafc231d251b9e803000048f7f1598b15650200004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4439f70f84e5000000410fb7847a48ba00003d851a0000732f4869c0e80000008b44062425ff1f000083f82e751a4585ff0f84b70000008b5d0881fbe80300000f82a8000000eb038b5d00418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0dc70100004839c8480f47c1480fafc331d2b9e803000048f7f14585ff744d410fb78c7a48ba000081f9851a000073164869c9e80000008b540e2481e2ff1f000083fa2e74268b550881fae8030000721b8b0d750100004839c8480f47c1480fafc231d2b9e803000048f7f148ffc08b0d570100004839c8480f47c14439e8440f4fe8ffc74439c70f8207ffffff4489eb4489f1418b448b0c4401c839d87d4d890d1a01000089051801000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891de1000000ff05cb000000833d2401000001747b8b1d14010000ffc14439c10f82cafdffff8b0d0701000083f9ff745fc745440000000031ff410fb7847a48ba00003d851a0000732a3b450474254869c0e80000008b44062425ff1f000083f82e7510418b44bb0c4401c83b45447e03894544ffc74439c772bfc705b200000001000000e966fdffffff054b000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0542000000488b004531d2ff255e000000660f1f440000454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000000',
    }
    WP26.OPPONENT_SPECS103 = {
      {
        ['kind'] = 'condition',
        ['site'] = 784160,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f858b000000440fb7c94181f9851a0000737e488b05b30000004c8b104c3b15b1000000756b458b42504183f80272614183f812775b31d266453b8c5248ba00007409ffc24439c272eeeb45488b058a0000004c8b184981fb0000010072324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'fatigue',
        ['site'] = 786976,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f8592000000440fb7c94181f9851a00000f8381000000488b05af0000004c8b104c3b15ad000000756e458b42504183f80272644183f812775e31d266453b8c5248ba00007409ffc24439c272eeeb48488b05860000004c8b184981fb0000010072354969c1e80000004c01d88b502481e2ff1f000083fa2e741db8640000004889442430ff053e000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252c0000000f1f400033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'spirit',
        ['site'] = 794384,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833dc5000000010f8594000000440fb7c94181f9851a00000f8383000000488b05af0000004c8b104c3b15ad0000007570458b42504183f80272664183f812776031d266453b8c5248ba00007409ffc24439c272eeeb4a488b05860000004c8b184981fb0000010072374969c1e80000004c01d88b502481e2ff1f000083fa2e741f48c7c088ffffff4889442430ff053c000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252a000000669033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 256,
      },
      {
        ['kind'] = 'weightRaw',
        ['site'] = 770512,
        ['original'] = '4883ec28ba861a00000fb7c1662bc2',
        ['hex'] = '9c5051524150415141524153833de5000000010f85ab000000440fb7c94181f9851a00000f839a000000488b05cf0000004c8b104c3b15cd0000000f8583000000458b42504183f80272794183f812777331d266453b8c5248ba00007409ffc24439c272eeeb5d488b05a20000004c8b184981fb00000100724a4969c1e80000004c01d88b502481e2ff1f000083fa2e74320fb6400a3dc800000077273da0000000770583c028eb0383e8284889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 248,
        ['size'] = 288,
      },
      {
        ['kind'] = 'raceTraits',
        ['site'] = 11235568,
        ['original'] = '8954241048894c24084883ec28488b442430',
        ['hex'] = '9c5051524150415141524153833dd5000000010f859c000000488b05d00000004c8b104c3b15ce0000000f8585000000458b42504183f802727b4183f8127775488b05b90000004c8b184981fb00000100726231d24869c25c0100004a8d4410544839c87409ffc24439c272e8eb46450fb78c5248ba0000eb004181f9851a000073324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff0544000000415b415a415941585a59589dc3415b415a415941585a59589d8954241048894c24084883ec28488b442430ff252f0000000f1f800000000030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 232,
        ['size'] = 408,
        ['relocations'] = {},
      },
      {
        ['kind'] = 'activeTraitEffects',
        ['site'] = 11346432,
        ['original'] = '415441564883ec48833dd96ed30300',
        ['hex'] = '9c5051524150415141524153833dc5000000010f8581000000488b05c00000004c8b104c3b15be000000756e458b42504183f80272644183f812775e488b05ad0000004c8b184981fb00000100724b4439c27346450fb78c5248ba0000eb004181f9851a000073324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff054f000000415b415a415941585a59589dc3415b415a415941585a59589d415441564883ec48488b0509000000833800ff253a000000e890804401000000662e0f1f84000000000030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 216,
        ['size'] = 392,
        ['relocations'] = { { ['offset'] = 190, ['rva'] = 75534568 } },
      },
      {
        ['kind'] = 'positiveSpeedEffects',
        ['site'] = 11297584,
        ['original'] = '4c8bd14585c9746c4183f8014c8b05f51ed303',
        ['hex'] = '9c5051524150415141524153833dd5000000010f85940000004183f8010f858a0000004585c90f8e81000000488b05bd0000004c8b104c3b15bb000000756e458b42504183f80272644183f812775e488b05aa0000004c8b184981fb00000100724b4439c27346450fb78c5248ba0000eb004181f9851a000073324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff054c000000415b415a415941585a59589dc3415b415a415941585a59589d4989ca4585c974144183f8014c8b050a0000004d8b00ff2533000000c338827f4401000000669030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 232,
        ['size'] = 408,
        ['relocations'] = { { ['offset'] = 214, ['rva'] = 75465272 } },
      },
      {
        ['kind'] = 'positiveUmasonaCopy',
        ['site'] = 12430576,
        ['original'] = '4963c0889408c8000000c3cccccc',
        ['hex'] = '9c5051524150415141524153833d15010000010f85d80000004183f8060f83ce00000083fa5d0f83c5000000488d0525010000803c10010f85b4000000488b05ec0000004c8b104c3b15ea0000000f859d000000458b42504183f8020f828f0000004183f8120f8785000000488b05cd0000004c8b184981fb00000100727231d24869c25c0100004a8d4410544839c87409ffc24439c272e8eb56450fb78c5248ba0000eb004181f9851a000073424969c1e80000004c01d88b502481e2ff1f000083fa2e742a4863442418488b4c2428c68401c8000000004889442430ff0548000000415b415a415941585a59589dc3415b415a415941585a59589d4963c0889408c8000000c3ccccccff25370000006666666666662e0f1f84000000000030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000',
        ['dataOffset'] = 296,
        ['size'] = 472,
        ['relocations'] = {},
      },
    }
    WP26.POSITIVE_UMASONA110 = {
      [2] = true,
      [5] = true,
      [7] = true,
      [8] = true,
      [10] = true,
      [11] = true,
      [13] = true,
      [15] = true,
      [17] = true,
      [19] = true,
      [20] = true,
      [22] = true,
      [23] = true,
      [24] = true,
      [25] = true,
      [26] = true,
      [27] = true,
      [28] = true,
      [29] = true,
      [30] = true,
      [31] = true,
      [32] = true,
      [33] = true,
      [45] = true,
      [46] = true,
      [47] = true,
      [48] = true,
      [49] = true,
      [50] = true,
      [51] = true,
      [52] = true,
      [54] = true,
      [60] = true,
      [61] = true,
      [62] = true,
      [63] = true,
      [64] = true,
      [65] = true,
      [66] = true,
      [67] = true,
      [68] = true,
      [69] = true,
      [70] = true,
      [71] = true,
      [72] = true,
      [73] = true,
      [74] = true,
      [75] = true,
      [76] = true,
      [77] = true,
      [78] = true,
      [79] = true,
      [80] = true,
      [81] = true,
      [82] = true,
      [83] = true,
      [84] = true,
      [85] = true,
      [86] = true,
      [87] = true,
      [88] = true,
      [89] = true,
      [90] = true,
      [91] = true,
      [92] = true,
    }
    local api = WP26
    function api.syncOpponentUmasona110(on)
      api.require()
      local entry = readQword(api.mod() + 0x47E8E98)
      if entry ~= api.mod() + 0x4856670 then
        return 0
      end
      local count = readInteger(entry + 0x50)
      if not count or count < 2 or count > 18 then
        return 0
      end
      local pool = api.data('race')
      local horses = api.data('horse')
      local changed = 0
      for index = 0, count - 1 do
        local id = readSmallInteger(entry + 0xba48 + index * 2)
        if id and id >= 0 and id < 6790 then
          local race = pool + id * 232
          if api.bits(race, 0x24, 0, 13) ~= 46 then
            local horse = api.bits(race, 0, 0, 15)
            if horse < 28717 then
              local source = assert(readBytes(horses + horse * 56 + 24, 12, true))
              local object = entry + 0x54 + index * 348
              for slot = 0, 5 do
                local kind = source[slot * 2 + 1] & 127
                local active = (source[slot * 2 + 2] & 3) == 3
                local address = object + 0xc8 + slot
                if api.POSITIVE_UMASONA110[kind] and active then
                  local current = readBytes(address, 1, false)
                  local expected = on and kind or 0
                  local value = on and 0 or kind
                  if current == expected then
                    assert(
                      readQword(api.mod() + 0x47E8E98) == entry
                        and readSmallInteger(entry + 0xba48 + index * 2) == id
                        and api.bits(race, 0, 0, 15) == horse
                        and api.bits(race, 0x24, 0, 13) ~= 46,
                      'Race identity changed'
                    )
                    assert(
                      writeBytes(address, value) and readBytes(address, 1, false) == value,
                      'Race Umasona write verification failed'
                    )
                    changed = changed + 1
                  end
                end
              end
            end
          end
        end
      end
      return changed
    end
    local start = api.startOpponents103
    function api.startOpponents103()
      local result = start()
      api.syncOpponentUmasona110(true)
      return result
    end
    local stop = api.stopOpponents103
    function api.stopOpponents103()
      local s = _G.WP26_OPPONENT_CACHE103
      local restore = s
        and s.active
        and (s.identity == 110 or s.identity == 147)
        and s.pid == getOpenedProcessID()
        and s.pid == getProcessIDFromProcessName(api.EXE)
      local result = stop()
      if restore then
        api.syncOpponentUmasona110(false)
      end
      return result
    end
    api.raceRevision110 = true

    table.insert(WP26.KNOWN_RACE085, { name = '110', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066 })
  end
  do
    WP26.RACE_PAYLOAD = {
      ['hex'] = '9c5051524150415141524153535655574154415541564157ff0576050000833d6b050000010f851b050000488b05860500004c8b15870500004c39100f8504050000458b42504183f8020f82f60400004183f8120f87ec040000488b05670500004c8b184d85db0f84d9040000458b4b044183f9010f8ccb040000488b054e050000488b304885f60f84b8040000410fb68b080100004439c10f83a104000031c9418b448b0c4401c80f809104000085c00f8e89040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8e54040000bbffffff7f31c94963448b544885c00f883f0400008b5424604801d0483d9bc420000f872c040000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d71040000488b058e040000488b30488b2d64040000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d388945408b550081fae80300000f82db02000089d8480fafc231d2b9e803000048f7f18b152b0300004839d0480f47c289c3c70560030000ffffffffc7055a03000000000000891d4c03000031c9833d4b030000017419410fb7844a48ba00003b4504750b890d31030000e9fa010000410fb7844a48ba00003d851a00000f83e60100004869c0e80000008b44062425ff1f000083f82e0f85cd010000488b05dc0200003a080f84be010000410fb7844a48ba00003b450475338b550881fae8030000722889d83b45440f4c4544480fafc231d251b9e803000048f7f1598b15700200004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4439f70f84e5000000410fb7847a48ba00003d851a0000732f4869c0e80000008b44062425ff1f000083f82e751a4585ff0f84b70000008b5d0881fbe80300000f82a8000000eb038b5d00418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0dd20100004839c8480f47c1480fafc331d2b9e803000048f7f14585ff744d410fb78c7a48ba000081f9851a000073164869c9e80000008b540e2481e2ff1f000083fa2e74268b550881fae8030000721b8b0d800100004839c8480f47c1480fafc231d2b9e803000048f7f148ffc08b0d620100004839c8480f47c14439e8440f4fe8ffc74439c70f8207ffffff4489eb4489f1418b448b0c4401c839d87d4d890d2501000089052301000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891dec000000ff05d6000000833d2f01000001747b8b1d1f010000ffc14439c10f82cafdffff8b0d1201000083f9ff745fc745440000000031ff410fb7847a48ba00003d851a0000732a3b450474254869c0e80000008b44062425ff1f000083f82e7510418b44bb0c4401c83b45447e03894544ffc74439c772bfc705bd00000001000000e966fdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003131314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000000',
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['size'] = 1532,
      ['dataOffset'] = 1424,
    }
    WP26.RACE_CLOCK111 = {
      ['site'] = 11501022,
      ['resume'] = 11501040,
      ['original'] = '89442444b804000000486bc0004863440450',
      ['hex'] = '9c5051524150415141524153ff0516020000488b05170200008338010f85d30100008b44243085c00f84c70100003dffff00000f83bc010000488b05000200004c8b104c3b15fe0100000f85a5010000458b42504183f8020f82970100004183f8120f878d010000488b0501020000443b000f857d0100008b9424900000004439c20f836d010000450fb78c5248ba00004181f9851a00000f8357010000488b05ab010000488b084881f9000001000f82400100004969c1e80000008b44012425ff1f000041b80000000083f82e410f94c04c8b1d5f0100004983eb044181bb8000000099b101000f8507010000418b033de80300000f82f9000000b9e80300004585c0741d453b4b047511418b4b0881f9e80300007305b9e8030000480fafc8eb05b940420f00b8c59d1c814133425031d2450fb7945248ba00004431d069c0930100014c8b15fc000000ffc24c8b15f3000000413b525072d8413b838400000075168b542430413b938c000000741b413b93880000007412418983840000008b4424304189838800000045898b900000008b942490000000486bd20c488b05b30000008b141041899394000000418b83880000004869c040420f0031d248f7f1ba010000004839d0480f42c2418b93880000004839d0480f47c24189838c000000488944243041ff8398000000ff0537000000415b415a415941585a59589d89442444b804000000486bc0004863440450ff254f0000000f1f80000000003131314b4c4350570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 552,
      ['size'] = 632,
    }
    local api = WP26
    local ensure = api.ensureRaceConfig
    function api.ensureRaceConfig()
      local pointer = ensure()
      if readInteger(pointer + 128) ~= 111001 then
        local zero = {}
        for i = 1, 64 do
          zero[i] = 0
        end
        assert(writeBytes(pointer + 128, zero))
        assert(writeInteger(pointer + 128, 111001))
      end
      return pointer
    end
    local identity = api.racePayloadIdentity066
    function api.racePayloadIdentity066()
      return identity() .. ':' .. api.RACE_CLOCK111.hex
    end
    table.insert(
      api.KNOWN_RACE085,
      { name = '111', main = api.RACE_PAYLOAD, pace = api.PACE_GUARD066, clock = api.RACE_CLOCK111 }
    )
    if api.attached() then
      api.ensureRaceConfig()
    end
  end
  do
    WP26.RACE_PAYLOAD = {
      ['hex'] = '9c5051524150415141524153535655574154415541564157ff05d6040000833dcb040000010f857a040000488b05e60400004c8b15e70400004c39100f8563040000458b42504183f8020f82550400004183f8120f874b040000488b05c70400004c8b184d85db0f8438040000458b4b044183f9010f8c2a040000488b05ae040000488b304885f60f8417040000410fb68b080100004439c10f830004000031c9418b448b0c4401c80f80f003000085c00f8ee8030000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8eb3030000bbffffff7f31c94963448b544885c00f889e0300008b5424604801d0483d9bc420000f878b030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dd1030000488b05ee030000488b30488b2dc4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891dfa0200008b550081fae80300000f823402000089d8480fafc231d2b9e803000048f7f18b15850200004839d0480f47c289c3c705ba020000ffffffffc705b402000000000000891da602000031c9833da5020000017419410fb7844a48ba00003b4504750b890d8b020000e99d010000410fb7844a48ba00003d851a00000f83890100004869c0e80000008b44062425ff1f000083f82e0f8570010000488b05360200003a080f8461010000410fb7844a48ba00003b450475308b550881fae803000072258b0533020000480fafc231d251b9e803000048f7f1598b15cd0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4439f70f848b000000410fb7847a48ba00003d851a000073174869c0e80000008b44062425ff1f000083f82e7502eb648b5d004585ff74038b5d0881fbe80300007251418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d370100004839c8480f47c1480fafc331d2b9e803000048f7f148ffc08b0d190100004839c8480f47c14439e8440f4fe8ffc74439c70f8261ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddc0000008905da00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da3000000ff058d000000833de60000000174318b1dd6000000ffc14439c10f8227feffff8b0dc900000083f9ff7415c705be00000001000000e90dfeffffff0557000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054e000000488b004531d2ff256a000000662e0f1f8400000000003231314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000',
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['size'] = 1376,
      ['dataOffset'] = 1264,
    }
    WP26.RACE_CLOCK111 = {
      ['site'] = 11501022,
      ['resume'] = 11501040,
      ['original'] = '89442444b804000000486bc0004863440450',
      ['hex'] = '9c5051524150415141524153ff0516020000488b05170200008338010f85cf0100008b44243085c00f84c30100003dffff00000f83b8010000488b05000200004c8b104c3b15fe0100000f85a1010000458b42504183f8020f82930100004183f8120f8789010000488b0501020000443b000f85790100008b9424900000004439c20f8369010000450fb78c5248ba00004181f9851a00000f8353010000488b05ab010000488b084881f9000001000f823c0100004969c1e80000008b44012425ff1f000041b80000000083f82e410f94c04c8b1d5f0100004983eb044181bb8000000099b101000f8503010000418b03b940420f004585c074293de80300000f82eb000000453b4b047504418b43083de80300000f82d6000000b9e8030000480fafc8b8c59d1c814133425031d2450fb7945248ba00004431d069c0930100014c8b1500010000ffc24c8b15f7000000413b525072d8413b838400000075168b542430413b938c000000741b413b93880000007412418983840000008b4424304189838800000045898b900000008b942490000000486bd20c488b05b70000008b141041899394000000418b83880000004869c040420f0031d248f7f1ba010000004839d0480f42c2418b93880000004839d0480f47c24189838c000000488944243041ff8398000000ff053b000000415b415a415941585a59589d89442444b804000000486bc0004863440450ff255300000066662e0f1f8400000000003231314b4c4350570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 552,
      ['size'] = 632,
    }
    table.insert(
      WP26.KNOWN_RACE085,
      { name = '112', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111 }
    )
  end
  do
    local api = WP26
    -- CE keeps an open process handle. Validate that target directly instead of
    -- enumerating all Windows processes on every read or field callback.
    function api.attached()
      local pid = api.pid
      if not pid or pid ~= getOpenedProcessID() then
        return false
      end
      local base = api.mod()
      return base ~= nil and readSmallInteger(base) == 0x5a4d
    end
    api.uiPerformance113 = { editorBuilds = 0, bulkBuilds = 0, editorMs = 0, bulkMs = 0 }
    local function batch(kind, fn, ...)
      local tree = getAddressList().Control[0]
      local start = getTickCount()
      tree.beginUpdate()
      local values = table.pack(pcall(fn, ...))
      tree.endUpdate()
      local stats = api.uiPerformance113
      stats[kind .. 'Builds'] = stats[kind .. 'Builds'] + 1
      stats[kind .. 'Ms'] = stats[kind .. 'Ms'] + getTickCount() - start
      if not values[1] then
        error(values[2], 0)
      end
      return table.unpack(values, 2, values.n)
    end
    local refresh = api.refreshEditor
    function api.refreshEditor(...)
      return batch('editor', refresh, ...)
    end
    local bulk = api.openBulk104
    function api.openBulk104(...)
      return batch('bulk', bulk, ...)
    end
  end
  do
    WP26.RACE_FLOOR114 = {
      ['site'] = 11351686,
      ['resume'] = 11351702,
      ['skip'] = 11351763,
      ['original'] = '3bc87349448bc88bd3442bc941395850',
      ['hex'] = '9c5051524150415141524153ff0596010000488b05970100008338010f854e0100004c8b1d8f0100004983eb044181bb8000000099b101000f85320100008b4c242883f9010f822501000081f9ffff00000f8319010000413b8b8c0000000f850c010000413b8b880000000f83ff000000488b05480100004c8b104c3b15460100000f85e8000000458b42504183f8020f82da0000004183f8120f87d0000000488b0549010000443b000f85c0000000488b05210100003b48280f85b00000000fb650044439c20f83a3000000450fb78c5248ba00004181f9851a00000f838d000000453b8b900000000f8580000000488b05d9000000488b00483d00000100726e4969d1e80000008b54102481e2ff1f000083fa2e7558418b03453b4b047504418b43083de80300007644b8c59d1c814431c031d2450fb78c5248ba00004431c869c093010001ffc24439c272e7413b83840000007518ff054e000000415b415a415941585a59589dff2570000000415b415a415941585a59589d39c173124189c189da4129c941395850ff2556000000ff25480000000f1f840000000000343131524c4650570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 424,
      ['size'] = 504,
    }
    WP26.RACE_PAYLOAD = {
      ['hex'] = '9c5051524150415141524153535655574154415541564157ff05d6040000833dcb040000010f857a040000488b05e60400004c8b15e70400004c39100f8563040000458b42504183f8020f82550400004183f8120f874b040000488b05c70400004c8b184d85db0f8438040000458b4b044183f9010f8c2a040000488b05ae040000488b304885f60f8417040000410fb68b080100004439c10f830004000031c9418b448b0c4401c80f80f003000085c00f8ee8030000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8eb3030000bbffffff7f31c94963448b544885c00f889e0300008b5424604801d0483d9bc420000f878b030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dd1030000488b05ee030000488b30488b2dc4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891dfa0200008b550081fae80300000f823402000089d8480fafc231d2b9e803000048f7f18b15850200004839d0480f47c289c3c705ba020000ffffffffc705b402000000000000891da602000031c9833da5020000017419410fb7844a48ba00003b4504750b890d8b020000e99d010000410fb7844a48ba00003d851a00000f83890100004869c0e80000008b44062425ff1f000083f82e0f8570010000488b05360200003a080f8461010000410fb7844a48ba00003b450475308b550881fae803000072258b0533020000480fafc231d251b9e803000048f7f1598b15cd0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4439f70f848b000000410fb7847a48ba00003d851a000073174869c0e80000008b44062425ff1f000083f82e7502eb648b5d004585ff74038b5d0881fbe80300007251418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d370100004839c8480f47c1480fafc331d2b9e803000048f7f148ffc08b0d190100004839c8480f47c14439e8440f4fe8ffc74439c70f8261ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddc0000008905da00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da3000000ff058d000000833de60000000174318b1dd6000000ffc14439c10f8227feffff8b0dc900000083f9ff7415c705be00000001000000e90dfeffffff0557000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054e000000488b004531d2ff256a000000662e0f1f8400000000003431314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000',
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['size'] = 1376,
      ['dataOffset'] = 1264,
    }
    local identity = WP26.racePayloadIdentity066
    function WP26.racePayloadIdentity066()
      return identity() .. ':' .. WP26.RACE_FLOOR114.hex
    end
    table.insert(
      WP26.KNOWN_RACE085,
      {
        name = '114',
        main = WP26.RACE_PAYLOAD,
        pace = WP26.PACE_GUARD066,
        clock = WP26.RACE_CLOCK111,
        floor = WP26.RACE_FLOOR114,
      }
    )
  end
  do
    local api = WP26
    api.NAMES[116] = { 'Race time protection', 'レースタイム保護' }
    local ensure = api.ensureRaceConfig
    function api.ensureRaceConfig()
      local pointer = ensure()
      if readInteger(pointer + 180) ~= 115001 then
        assert(
          writeInteger(pointer + 176, 1) and writeInteger(pointer + 180, 115001),
          'Race time protection initialization failed'
        )
      end
      pcall(unregisterSymbol, 'wp2026RaceTimeProtection')
      registerSymbol('wp2026RaceTimeProtection', pointer + 176, true)
      return pointer
    end
    local apply = api.applyLang
    function api.applyLang()
      apply()
      local row = getAddressList().getMemoryRecordByID(116)
      if row then
        row.DropDownList.Text = api.T('0:Disabled\n1:Enabled', '0:無効\n1:有効')
        row.Color = 0x7070ff
      end
    end
    api.RACE_FLOOR114 = {
      ['site'] = 11351686,
      ['resume'] = 11351702,
      ['skip'] = 11351763,
      ['original'] = '3bc87349448bc88bd3442bc941395850',
      ['hex'] = '9c5051524150415141524153ff05a6010000488b05a70100008338010f855c0100004c8b1d9f0100004983eb044183bbb0000000000f85430100004181bb8000000099b101000f85320100008b4c242883f9010f822501000081f9ffff00000f8319010000413b8b8c0000000f850c010000413b8b880000000f83ff000000488b054a0100004c8b104c3b15480100000f85e8000000458b42504183f8020f82da0000004183f8120f87d0000000488b054b010000443b000f85c0000000488b05230100003b48280f85b00000000fb650044439c20f83a3000000450fb78c5248ba00004181f9851a00000f838d000000453b8b900000000f8580000000488b05db000000488b00483d00000100726e4969d1e80000008b54102481e2ff1f000083fa2e7558418b03453b4b047504418b43083de80300007644b8c59d1c814431c031d2450fb78c5248ba00004431c869c093010001ffc24439c272e7413b83840000007518ff0550000000415b415a415941585a59589dff2572000000415b415a415941585a59589d39c173124189c189da4129c941395850ff2558000000ff254a000000662e0f1f840000000000353131524c4650570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
      ['dataOffset'] = 440,
      ['size'] = 520,
    }
    api.RACE_PAYLOAD = {
      ['hex'] = '9c5051524150415141524153535655574154415541564157ff05d6040000833dcb040000010f857a040000488b05e60400004c8b15e70400004c39100f8563040000458b42504183f8020f82550400004183f8120f874b040000488b05c70400004c8b184d85db0f8438040000458b4b044183f9010f8c2a040000488b05ae040000488b304885f60f8417040000410fb68b080100004439c10f830004000031c9418b448b0c4401c80f80f003000085c00f8ee8030000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8eb3030000bbffffff7f31c94963448b544885c00f889e0300008b5424604801d0483d9bc420000f878b030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dd1030000488b05ee030000488b30488b2dc4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891dfa0200008b550081fae80300000f823402000089d8480fafc231d2b9e803000048f7f18b15850200004839d0480f47c289c3c705ba020000ffffffffc705b402000000000000891da602000031c9833da5020000017419410fb7844a48ba00003b4504750b890d8b020000e99d010000410fb7844a48ba00003d851a00000f83890100004869c0e80000008b44062425ff1f000083f82e0f8570010000488b05360200003a080f8461010000410fb7844a48ba00003b450475308b550881fae803000072258b0533020000480fafc231d251b9e803000048f7f1598b15cd0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4439f70f848b000000410fb7847a48ba00003d851a000073174869c0e80000008b44062425ff1f000083f82e7502eb648b5d004585ff74038b5d0881fbe80300007251418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d370100004839c8480f47c1480fafc331d2b9e803000048f7f148ffc08b0d190100004839c8480f47c14439e8440f4fe8ffc74439c70f8261ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddc0000008905da00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da3000000ff058d000000833de60000000174318b1dd6000000ffc14439c10f8227feffff8b0dc900000083f9ff7415c705be00000001000000e90dfeffffff0557000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054e000000488b004531d2ff256a000000662e0f1f8400000000003531314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000',
      ['original'] = '41554883ec40488b05db2ad2034533d2',
      ['size'] = 1376,
      ['dataOffset'] = 1264,
    }
    table.insert(
      api.KNOWN_RACE085,
      {
        name = '115',
        main = api.RACE_PAYLOAD,
        pace = api.PACE_GUARD066,
        clock = api.RACE_CLOCK111,
        floor = api.RACE_FLOOR114,
      }
    )
    if api.attached() then
      api.ensureRaceConfig()
    end
    api.applyLang()
  end
  do
    local api = WP26
    if _G.WP26_LIST_WINDOWS116 then
      local old = {}
      for _, s in pairs(_G.WP26_LIST_WINDOWS116) do
        old[#old + 1] = s
      end
      for _, s in ipairs(old) do
        pcall(s.destroy)
      end
    end
    api.EntityLists116 = { windows = {} }
    _G.WP26_LIST_WINDOWS116 = api.EntityLists116.windows
    local Lists = api.EntityLists116
    local function str(v)
      return v == nil and '' or tostring(v)
    end
    function Lists.columns(key)
      local cols = api.EntityPicker101.standardColumns()
      for i, f in ipairs(api.EDITORS[key].fields) do
        if
          not f.horseRelationSlot
          and not (f.base and f.base:find('horseRelation', 1, true))
          and f.en ~= 'Age'
          and f.en ~= 'Sex'
          and not f.horseName079
        then
          cols[#cols + 1] = {
            key = 'f' .. i,
            title = api.T(f.en, f.ja),
            numeric = not f.string,
            field = f,
            index = i,
            width = math.max(125, math.min(260, #api.T(f.en, f.ja) * 7)),
            group = api.T(f.groupEn, f.groupJa),
          }
        end
      end
      for _, col in ipairs(cols) do
        if col.key == 'name' then
          col.width = 210
          col.flex = nil
        end
      end
      return cols
    end
    local function relationKey(f)
      if f.relation then
        return f.relation
      end
      if f.parentKind072 then
        return f.parentKind072 == 'father' and 'sire' or 'mare'
      end
      if f.farmChoices070 then
        return 'farm'
      end
      if f.horseMainJockey then
        return 'jockey'
      end
    end
    function Lists.display(s, f, value)
      if value == nil then
        return '—'
      end
      if f.string then
        return str(value)
      end
      local labels = api.lang == 'ja' and f.optionsJa or f.optionsEn
      if labels and labels[value + 1] then
        return labels[value + 1]
      end
      if f.choices then
        local map = s.choiceMaps[f]
        if not map then
          map = {}
          for _, c in ipairs(f.choices) do
            map[c.id] = c.name or api.T(c.en, c.ja)
          end
          s.choiceMaps[f] = map
        end
        if map[value] then
          return map[value]
        end
      end
      local key = relationKey(f)
      if key and api.EDITORS[key] then
        local cache = s.names[key]
        if not cache then
          cache = {}
          s.names[key] = cache
        end
        if cache[value] == nil then
          local ok, name = pcall(function()
            return api.entityName(key, value, api.context(key, value))
          end)
          cache[value] = ok and name ~= '' and name or false
        end
        if cache[value] then
          return cache[value] .. ' [' .. value .. ']'
        end
      end
      return str(value)
    end
    function Lists.readRow(s, source)
      assert(not s.closed, 'List closed')
      local c = api.context(s.key, source.id)
      local row = {
        id = source.id,
        displayId = c.raceID or source.id,
        name = source.name,
        display = {},
        primary = c.primary,
        horseID = c.horseID,
        raceID = c.raceID,
      }
      row.region = api.entityRegion122(s.key, c)
      for _, col in ipairs(s.columns) do
        assert(not s.closed, 'List closed')
        local f = col.field
        if f then
          if api.fieldAvailable(c, f) then
            local value = api.fieldRead(c, f)
            assert(not s.closed, 'List closed')
            row[col.key] = value
            row.display[col.key] = Lists.display(s, f, value)
          else
            row.display[col.key] = '—'
          end
        end
      end
      for _, f in ipairs(api.EDITORS[s.key].fields) do
        assert(not s.closed, 'List closed')
        if f.en == 'Age' and not f.birthYear081 and api.fieldAvailable(c, f) then
          row.age = api.fieldRead(c, f)
        elseif f.en == 'Sex' and api.fieldAvailable(c, f) then
          row.sex = Lists.display(s, f, api.fieldRead(c, f))
        elseif f.en == 'Gelded' and api.fieldAvailable(c, f) and api.fieldRead(c, f) == 1 then
          row.gelded = true
        end
      end
      if row.gelded then
        row.sex = api.T('Gelding', '騸')
      elseif not row.sex then
        if s.key == 'mare' or s.key == 'ownedMare' then
          row.sex = api.T('Female', '牝')
        elseif s.key == 'sire' or s.key == 'ownedSire' then
          row.sex = api.T('Male', '牡')
        end
      end
      for i = 1, 4 do
        local col = s.columns[i]
        row.display[col.key] = str(row[col.key])
      end
      local cells = {}
      for i = 2, #s.columns do
        cells[#cells + 1] = (row.display[s.columns[i].key] or '—'):gsub('[\r\n]', ' ')
      end
      row.subText = table.concat(cells, '\n')
      local right = {}
      for i = 4, #s.columns do
        right[#right + 1] = (row.display[s.columns[i].key] or '—'):gsub('[\r\n]', ' ')
      end
      row.rightText = table.concat(right, '\n')
      return row
    end
    function Lists.view(s)
      local rows = {}
      for _, row in ipairs(api.regionRows122(s.rows, s.region)) do
        local include = true
        for key, query in pairs(s.queries) do
          if query ~= '' then
            if key == '*' then
              local found = false
              for _, col in ipairs(s.columns) do
                if api.EntityPicker101.matches(row.display[col.key], query, false) then
                  found = true
                  break
                end
              end
              if not found then
                include = false
                break
              end
            else
              local col = s.byKey[key]
              local numeric = col.numeric
                and (tonumber(query) ~= nil or query:match('^[<>!=]') or query:match('^%d+%s*%-%s*%d+$'))
              if not api.EntityPicker101.matches(numeric and row[key] or row.display[key], query, numeric) then
                include = false
                break
              end
            end
          end
        end
        if include then
          rows[#rows + 1] = row
        end
      end
      return api.EntityPicker101.view(rows, s.columns, {}, s.sortIndex, s.ascending)
    end
function Lists.context124(s, row, restoring)
  assert((restoring or not s.closed) and _G.WP26 == api, 'List closed')
  api.require()
  assert(getOpenedProcessID() == s.pid and api.pid == s.pid, 'List process changed')
  local c = api.context(s.key, row.id)
  assert(
    c.primary == row.primary and c.horseID == row.horseID and c.raceID == row.raceID,
    api.T('The entity changed. Refresh the list.', '対象が変わりました。一覧を更新してください。')
  )
  return c
end
function Lists.cellField124(s, row, column)
  local c = Lists.context124(s, row)
  local col = s.columns[column or 0]
  if col and col.field and api.fieldAvailable(c, col.field) then
    return col.field
  end
  local wanted = col and ({ age = 'Age', sex = 'Sex', name = 'Horse name' })[col.key]
  if wanted then
    for _, f in ipairs(api.EDITORS[s.key].fields) do
      if f.en == wanted and api.fieldAvailable(c, f) then
        return f
      end
    end
  end
end
function Lists.updateCells124(s, row, changed)
  local c = Lists.context124(s, row)
  if changed.Sex or changed.Gelded then
    changed.Sex = true
    changed.Gelded = true
  end
  if changed.Age or changed['Birth year'] then
    changed.Age = true
    changed['Birth year'] = true
  end
  for _, col in ipairs(s.columns) do
    local f = col.field
    if f and changed[f.en] and api.fieldAvailable(c, f) then
      local v = api.fieldRead(c, f)
      row[col.key] = v
      row.display[col.key] = Lists.display(s, f, v)
    end
  end
  if changed.Age then
    for _, f in ipairs(api.EDITORS[s.key].fields) do
      if f.en == 'Age' and api.fieldAvailable(c, f) then
        row.age = api.fieldRead(c, f)
        break
      end
    end
  end
  if changed.Sex or changed.Gelded then
    for _, f in ipairs(api.EDITORS[s.key].fields) do
      if f.en == 'Sex' and api.fieldAvailable(c, f) then
        row.sex = Lists.display(s, f, api.fieldRead(c, f))
      end
      if f.en == 'Gelded' and api.fieldAvailable(c, f) then
        row.gelded = api.fieldRead(c, f) == 1
      end
    end
    if row.gelded then
      row.sex = api.T('Gelding', '騸')
    end
  end
  if changed['Horse name'] or changed['Family name'] or changed['Given name'] or changed.Name then
    row.name = api.entityName(s.key, row.id, c)
  end
  for i = 1, 4 do
    row.display[s.columns[i].key] = str(row[s.columns[i].key])
  end
  local sub, right = {}, {}
  for i = 2, #s.columns do
    sub[#sub + 1] = (row.display[s.columns[i].key] or '—'):gsub('[\r\n]', ' ')
  end
  for i = 4, #s.columns do
    right[#right + 1] = (row.display[s.columns[i].key] or '—'):gsub('[\r\n]', ' ')
  end
  row.subText, row.rightText = table.concat(sub, '\n'), table.concat(right, '\n')
  for i, r in ipairs(s.shown) do
    if r == row then
      sendMessage(s.list.Handle, 0x1015, i - 1, i - 1)
      sendMessage(s.frozen.Handle, 0x1015, i - 1, i - 1)
      break
    end
  end
end
function Lists.applyEdits124(s, row, edits, trace)
  local c = Lists.context124(s, row)
  local plan, changed = {}, {}
  for _, edit in ipairs(edits) do
    local f = edit.field
    assert(api.fieldAvailable(c, f), 'Field unavailable')
    local before = api.fieldRead(c, f)
    if edit.before ~= nil then
      assert(
        before == edit.before,
        api.T('Value changed. Edit again.', '値が変わりました。再度編集してください。')
      )
    end
    local v = edit.value
    if f.string then
      v = tostring(v)
    else
      local ideal = f.currentWeight and (api.bits(c.race, 10, 0, 8) * 2 + 300) or nil
      v = api.normalizeNumeric120(f, v, ideal)
      assert(v ~= nil, api.T('Enter a number.', '数値を入力してください。'))
    end
    changed[f.en] = true
    if before ~= v then
      plan[#plan + 1] = { field = f, before = before, value = v }
    end
  end
  local applied = {}
  local ok, err = pcall(function()
    for _, edit in ipairs(plan) do
      local fresh = Lists.context124(s, row)
      assert(api.fieldRead(fresh, edit.field) == edit.before, 'Value changed before write')
      applied[#applied + 1] = edit
      if trace then trace[#trace+1]={row=row,field=edit.field,before=edit.before,value=edit.value} end
      api.writeField(fresh, edit.field, edit.value, false)
      assert(api.fieldRead(Lists.context124(s, row), edit.field) == edit.value, 'Write readback differs')
      changed[edit.field.en] = true
    end
  end)
  if not ok then
    local restored = true
    for i = #applied, 1, -1 do
      local edit = applied[i]
      local good = pcall(function()
        local fresh = Lists.context124(s, row, true)
        api.writeField(fresh, edit.field, edit.before, false)
        assert(api.fieldRead(fresh, edit.field) == edit.before, 'Restoration readback differs')
      end)
      restored = restored and good
    end
    error(tostring(err) .. (restored and '' or api.T(' / restoration incomplete', '／復元未完了')), 0)
  end
  if changed.Trust then
    changed['Trust level'] = true
  end
  Lists.updateCells124(s, row, changed)
  return #plan
end
function Lists.horsePlan124(s, row, strongest)
  local c = Lists.context124(s, row)
  assert(
    (
      { owned = true, ownedFoal = true, ownedMare = true, ownedSire = true, race = true, foal = true, mare = true, sire = true }
    )[s.key],
    'Horse only'
  )
  local edits = {}
  local recovery = { Condition = 50, Fatigue = 0, ['Fighting spirit'] = 90, ['Racing lifespan'] = 100 }
  local strong = {
    ['Speed (base)'] = true,
    ['Stamina (base)'] = true,
    ['Power (base)'] = true,
    ['Guts (base)'] = true,
    ['Intelligence (base)'] = true,
    ['Mental strength (base)'] = true,
    ['Acceleration (base)'] = true,
    ['Flexibility (base)'] = true,
    ['Health (base)'] = true,
    ['Growth degree'] = true,
    ['Growth limit bonus'] = true,
    ['Growth power'] = true,
    ['Progeny quality'] = true,
    Trust = true,
  }
  for _, f in ipairs(api.EDITORS[s.key].fields) do
    if api.fieldAvailable(c, f) then
      local value = recovery[f.en]
      if f.currentWeight then
        value = api.bits(c.race, 10, 0, 8) * 2 + 300
      end
      if f.groupEn == 'Weaknesses' then
        value = 0
      end
      if f.groupEn == 'Race style aptitude' then
        value = f.max
      end
      if strongest then
        if strong[f.en] or f.groupEn == 'Growth bonuses'
          or (f.en and f.en:lower():find('experience',1,true))
          or (f.ja and f.ja:find('経験値',1,true))
          or f.groupEn == 'Training progress' then
          value = f.max
        end
        if f.groupEn == 'Track aptitude' then
          value = 0
        end
        if f.groupEn == 'Race style growth' and not f.en:find('previous', 1, true) then
          value = f.max
        end
      end
      if value ~= nil then
        edits[#edits + 1] = { field = f, value = value }
      end
    end
  end
  return edits
end
function Lists.memoPlan127(s, row)
  local c = Lists.context124(s, row)
  local edits = {}
  for _, f in ipairs(api.EDITORS[s.key].fields) do
    if f.memoIndex~=nil and api.fieldAvailable(c,f) then
      local value=api.memoValue186(c,f.memoIndex)
      assert(value>=1 and value<=f.max, api.T('Memo value is outside the game range.', 'メモ値がゲームの範囲外です。'))
      edits[#edits+1]={field=f,value=value}
    elseif f.groupEn == 'Revealed abilities' and api.fieldAvailable(c, f) then
      edits[#edits + 1] = { field = f, value = 1 }
    end
  end
  return edits
end
function Lists.choiceRows124(s, row, f)
  local c = Lists.context124(s, row)
  local key = relationKey(f)
  local rows
  if f.parentKind072 then
    rows = api.parentChoices072(c, f)
  elseif f.farmChoices070 then
    rows = api.farmChoices070()
  elseif f.jockeyStable then
    key = 'trainer'
    rows = api.editorRows(key)
  elseif key then
    rows = api.editorRows(key)
  elseif f.choices then
    rows = f.choices
  elseif f.optionsJa or f.optionsEn then
    rows = {}
    local labels = api.lang == 'ja' and f.optionsJa or f.optionsEn
    for i, name in ipairs(labels or {}) do
      rows[#rows + 1] = { id = i - 1, name = name }
    end
  end
  if not rows then
    return nil
  end
  local result = {}
  for _, r in ipairs(rows) do
    result[#result + 1] = { id = r.id, displayId = r.id, name = r.name or api.T(r.en, r.ja) }
  end
  if key and not f.parentMaster072 and api.EDITORS[key] then
    result = api.entityPickerRows101(key, result)
  end
  return result
end
function Lists.selectedRows125(s, view, clicked)
  local rows, included = {}, false
  local index = -1
  while true do
    local nextIndex = tonumber(sendMessage(view.Handle, 0x100c, index, 2)) or -1
    if nextIndex < 0 or nextIndex >= #s.shown or nextIndex <= index then
      break
    end
    local row = s.shown[nextIndex + 1]
    rows[#rows + 1] = row
    included = included or row == clicked
    index = nextIndex
  end
  if clicked and not included then
    return { clicked }
  end
  return rows
end
function Lists.applyBatch125(s, requests)
  local seen = {}
  for _, request in ipairs(requests) do
    assert(not seen[request.row.id], 'Duplicate batch target')
    seen[request.row.id] = true
    local c = Lists.context124(s, request.row)
    for _, edit in ipairs(request.edits) do
      assert(
        api.fieldAvailable(c, edit.field),
        api.T(
          'A selected target cannot edit this field.',
          'この項目を編集できない対象が含まれています。'
        )
      )
      local before = api.fieldRead(c, edit.field)
      if edit.before ~= nil then
        assert(
          before == edit.before,
          api.T('Value changed. Edit again.', '値が変わりました。再度編集してください。')
        )
      end
      edit.before = before
    end
  end
  local trace, changed = {}, 0
  local ok, err = pcall(function()
    for _, request in ipairs(requests) do
      changed = changed + Lists.applyEdits124(s, request.row, request.edits, trace)
    end
  end)
  if not ok then
    local restored = true
    for i = #trace, 1, -1 do
      local edit = trace[i]
      local good = pcall(function()
        local c = Lists.context124(s, edit.row, true)
        local current = api.fieldRead(c, edit.field)
        if current ~= edit.before then
          assert(current == edit.value, 'Value changed during batch restoration')
          api.writeField(c, edit.field, edit.before, false)
          assert(api.fieldRead(c, edit.field) == edit.before, 'Batch restoration readback differs')
        end
        if not s.closed then
          Lists.updateCells124(s, edit.row, { [edit.field.en] = true })
        end
      end)
      restored = restored and good
    end
    error(
      tostring(err)
        .. (restored and '' or api.T(' / batch restoration incomplete', '／一括変更の復元未完了')),
      0
    )
  end
  return changed, #requests
end
function Lists.captureValues125(s, rows, field)
  local before = {}
  for _, row in ipairs(rows) do
    local c = Lists.context124(s, row)
    assert(
      api.fieldAvailable(c, field),
      api.T(
        'A selected target cannot edit this field.',
        'この項目を編集できない対象が含まれています。'
      )
    )
    before[row] = api.fieldRead(c, field)
  end
  return before
end
function Lists.applyValue125(s, rows, field, value, before)
  local requests = {}
  for _, row in ipairs(rows) do
    requests[#requests + 1] = { row = row, edits = { { field = field, value = value, before = before[row] } } }
  end
  return Lists.applyBatch125(s, requests)
end

function Lists.installContext124(s)
  local popup = createPopupMenu(s.form)
  s.popup124, s.menuItems124 = popup, {}
  local horses = ({
    owned = true,
    ownedFoal = true,
    ownedMare = true,
    ownedSire = true,
    race = true,
    foal = true,
    mare = true,
    sire = true,
  })[s.key] == true
  local function report(err)
    if not s.closed then
      s.status.Caption = tostring(err)
    end
  end
  function s.runMenu124(fn)
    if s.closed or s.busy or s.inFlight then
      return
    end
    s.inFlight = true
    local ok, err = pcall(fn)
    s.inFlight = false
    if not ok then
      report(err)
    end
  end
  function s.cancelCell124()
    s.edit124 = nil
    if s.cellInput124 then
      s.cellInput124.Visible = false
    end
  end
  function s.commitCell124()
    local edit = s.edit124
    if not edit then
      return
    end
    s.runMenu124(function()
    local count = Lists.applyValue125(s, edit.targets, edit.field, s.cellInput124.Text, edit.beforeValues)
      s.cancelCell124()
      s.status.Caption = api.T('Updated: ', '変更: ') .. count .. api.T(' fields / selected ', '項目／選択 ') .. #edit.targets .. api.T(' targets', '件')
    end)
  end
  function s.editCell124(row, column, targets)
    s.runMenu124(function()
      targets = targets or Lists.selectedRows125(s, s.list, row)
      local c = Lists.context124(s, row)
      local f = Lists.cellField124(s, row, column)
      if f and f.readOnly161 then return end
      if not f then
        local fields, rows = {}, {}
        for _, candidate in ipairs(api.EDITORS[s.key].fields) do
          if not candidate.readOnly161 and api.fieldAvailable(c, candidate) then
            fields[#fields + 1] = candidate
            rows[#rows + 1] = { id = #fields, displayId = #fields, name = api.T(candidate.en, candidate.ja) }
          end
        end
        local picked = api.EntityPicker101.show({
          title = api.T('Change value', '値を変更'),
          rows = rows,
          columns = { { key = 'name', title = api.T('Field', '項目'), flex = true } },
        })
        if not picked or s.closed then
          return
        end
        f = fields[picked]
        column = nil
        for i, col in ipairs(s.columns) do
          if col.field == f then
            column = i
            break
          end
        end
      end
      c = Lists.context124(s, row)
      local beforeValues = Lists.captureValues125(s, targets, f)
      local before = beforeValues[row]
      local choices = Lists.choiceRows124(s, row, f)
      if choices then
        local picked = api.EntityPicker101.show({
          title = api.T(f.en, f.ja),
          rows = choices,
          columns = api.EntityPicker101.standardColumns(),
          current = before,
        })
        if picked == nil or s.closed then
          return
        end
        local count = Lists.applyValue125(s, targets, f, picked, beforeValues)
        s.status.Caption = api.T('Updated: ', '変更: ') .. count .. api.T(' fields / selected ', '項目／選択 ') .. #targets .. api.T(' targets', '件')
      else
        local input = s.cellInput124
        if not input then
          input = createEdit(s.form)
          s.cellInput124 = input
          input.Color = 0x353535
          input.Font.Color = 0xffffff
          input.OnKeyDown = function(_, key)
            if key == 13 then
              s.commitCell124()
              return 0
            end
            if key == 27 then
              s.cancelCell124()
              return 0
            end
            return key
          end
          input.OnExit = s.cancelCell124
        end
        local index
        for i, r in ipairs(s.shown) do
          if r == row then
            index = i - 1
            break
          end
        end
        assert(index ~= nil, 'Row unavailable')
        local view = (column or 0) <= 2 and s.frozen or s.list
        local sub = (column or 0) <= 2 and math.max(0, (column or 1) - 1) or column - 3
        local rect = createMemoryStream()
        rect.Size = 16
        rect.Position = 0
        rect.writeDword(0)
        rect.writeDword(sub)
        local valid = sendMessage(view.Handle, 0x1038, index, rect.Memory) ~= 0
        rect.Position = 0
        local left = rect.readDword()
        local top = rect.readDword()
        local right = rect.readDword()
        local bottom = rect.readDword()
        rect.destroy()
        if left > 0x7fffffff then
          left = left - 0x100000000
        end
        if right > 0x7fffffff then
          right = right - 0x100000000
        end
        local host = view == s.frozen and s.frozenHost or nil
        local ox = view.Left + (host and host.Left or 0)
        local oy = view.Top + (host and host.Top or 0)
        local width = view == s.frozen and s.frozenHost.Width or view.Width
        local x = math.max(0, left)
        local endX = math.min(width, right)
        if column and valid and top < 0x7fffffff and endX - x >= 40 then
          input.Left = ox + x
          input.Top = oy + top
          input.Width = endX - x
          input.Height = math.max(26, bottom - top)
        else
          input.Left = s.search.Left
          input.Top = s.search.Top
          input.Width = s.search.Width
          input.Height = 28
        end
        input.Text = tostring(before)
        s.edit124 = { row = row, targets = targets, field = f, before = before, beforeValues = beforeValues }
        input.Visible = true
        input.bringToFront()
        input.setFocus()
        input.selectAll()
        s.status.Caption = api.T('Selected ', '選択 ') .. #targets .. api.T(' targets / ', '件／') .. api.T(f.en, f.ja)
      end
    end)
  end
  function s.hitCell124(view, x, y)
    local hit = createMemoryStream()
    hit.Size = 32
    hit.Position = 0
    hit.writeDword(x)
    hit.writeDword(y)
    sendMessage(view.Handle, 0x1039, 0, hit.Memory)
    hit.Position = 12
    local index = hit.readDword()
    local sub = hit.readDword()
    hit.destroy()
    if index >= #s.shown then
      return nil
    end
    return s.shown[index + 1], view == s.frozen and sub + 1 or sub + 3, index
  end
  function s.setMenuTarget124(row, column, index, view)
    if s.closed then s.menuTarget124 = nil;return false end
    local rows = row and Lists.selectedRows125(s, view or s.frozen, row) or {}
    s.menuTarget124 = { row = row, rows = rows, column = column, index = index }
    local valid = row ~= nil and not s.closed and not s.busy
    for _, item in pairs(s.menuItems124) do
      item.Enabled = valid
    end
    if s.menuItems124.memo then
      local available = false
      for _, f in ipairs(api.EDITORS[s.key].fields) do
        if f.groupEn == 'Revealed abilities' then available = true;break end
      end
      s.menuItems124.memo.Enabled = valid and available
    end
    return valid
  end
  local function mouse(view, button, x, y)
    if s.closed or button ~= 1 then
      return
    end
    local ok, err = pcall(function()
      s.cancelCell124()
      local row, col, index = s.hitCell124(view, x, y)
      s.setMenuTarget124(row, col, index, view)
    end)
    if not ok then
      s.setMenuTarget124(nil)
      report(err)
    end
  end
  s.list.OnMouseDown = mouse
  s.frozen.OnMouseDown = mouse
  local function add(key, en, ja, fn)
    local item = createMenuItem(popup)
    item.Caption = api.T(en, ja)
    item.OnClick = function()
      local ok, err = pcall(fn)
      if not ok then
        report(err)
      end
    end
    popup.Items.add(item)
    s.menuItems124[key] = item
  end
  add('open', 'Open in editor', 'エディタで開く', function()
    local t = s.menuTarget124
    if not t or not t.row then
      return
    end
    Lists.context124(s, t.row)
    for i, r in ipairs(s.shown) do
      if r == t.row then
        s.frozen.ItemIndex = i - 1
        s.list.ItemIndex = i - 1
        s.openSelected()
        return
      end
    end
  end)
  add('edit', 'Change value', '値を変更', function()
    local t = s.menuTarget124
    if t and t.row then
      s.editCell124(t.row, t.column, t.rows)
    end
  end)
  if horses then
    add('acquire', 'Acquire', '強奪', function()
      s.runMenu124(function()
        local t = assert(s.menuTarget124)
        local targets = t.rows
        for _, row in ipairs(targets) do Lists.context124(s, row) end
        local config = api.ensureAcquireConfig075()
        local farm, homebred = readBytes(config.acquireFarm, 1), readBytes(config.acquireHomebred, 1) == 1
        local key = ({ owned='race', ownedFoal='foal', ownedMare='mare', ownedSire='sire' })[s.key] or s.key
        local completed = 0
        for _, row in ipairs(targets) do
          local ok, err = pcall(function()
            local c = Lists.context124(s, row)
            api.acquireActor075(key, c.raceID or row.id, farm, homebred)
            completed = completed + 1
            Lists.updateCells124(s, row, {Breeder=true,['Stabling farm']=true,Owner=true,['Transaction type']=true})
          end)
          if not ok then error(api.T('Acquired: ', '強奪: ')..completed..' / '..#targets..api.T(' horses / ', '頭／')..tostring(err), 0) end
          s.status.Caption = api.T('Acquired: ', '強奪: ')..completed..' / '..#targets..api.T(' horses', '頭')
        end
      end)
    end)
    for _, item in ipairs({
      {'recover', 'Full recovery', '全回復', false},
      {'strongest', 'Maximize abilities', '最強', true},
    }) do
      add(item[1], item[2], item[3], function()
        s.runMenu124(function()
          local targets = assert(s.menuTarget124).rows
          local requests = {}
          for _, row in ipairs(targets) do requests[#requests+1]={row=row,edits=Lists.horsePlan124(s,row,item[4])} end
          local count = Lists.applyBatch125(s, requests)
          s.status.Caption = api.T(item[2], item[3])..': '..#targets..api.T(' horses / ', '頭／')..count..api.T(' fields', '項目')
        end)
      end)
    end
  end
  if horses then
    add('memo', 'Reveal all notes', 'メモ全判明', function()
      s.runMenu124(function()
        local targets = assert(s.menuTarget124).rows
        local requests = {}
        for _, row in ipairs(targets) do
          local edits = Lists.memoPlan127(s, row)
          assert(#edits > 0, api.T('No revealable notes', '判明対象のメモがありません'))
          requests[#requests + 1] = { row = row, edits = edits }
        end
        local count = Lists.applyBatch125(s, requests)
        s.status.Caption = api.T('Reveal all notes', 'メモ全判明') .. ': ' .. #targets
          .. api.T(' horses / ', '頭／') .. count .. api.T(' fields', '項目')
      end)
    end)
  end
  s.list.PopupMenu = popup
  s.frozen.PopupMenu = popup
  s.setMenuTarget124(nil)
  s.list.OnDblClick = function()
    if s.closed then return end
    local ok, err = pcall(function()
      local x, y = getMousePos()
      x, y = s.list.screenToClient(x, y)
      local row, col = s.hitCell124(s.list, x, y)
      if row then
        s.editCell124(row, col)
      end
    end)
    if not ok then
      report(err)
    end
  end
  s.disposeMenu126 = function()
    s.list.OnMouseDown = nil
    s.frozen.OnMouseDown = nil
    s.list.OnDblClick = nil
    if s.cellInput124 then
      s.cellInput124.OnExit = nil
      s.cellInput124.OnKeyDown = nil
    end
    for _, item in pairs(s.menuItems124) do item.OnClick = nil end
  end
  local destroy = s.destroy
  function s.destroy()
    if s.closed then return end
    s.cancelCell124()
    s.menuTarget124 = nil
    destroy()
  end
end

    function Lists.create(key)
      local s = {
        key = key,
        columns = Lists.columns(key),
        byKey = {},
        rows = {},
        shown = {},
        queries = {},
        sortIndex = 2,
        ascending = true,
        names = {},
        choiceMaps = {},
        closed = false,
        pid = api.pid,
        busy = false,
        position = 1,
        errors = 0,
      }
      local form = createForm(false)
      s.form = form
      form.Name = 'WP26_EntityList116_' .. key
      form.Caption = api.T(api.EDITORS[key].en, api.EDITORS[key].ja):gsub(' editor$', ''):gsub('エディタ$', '')
        .. api.T(' — parameter list', ' — パラメーター一覧')
      form.Position = 'poScreenCenter'
      form.BorderStyle = 'bsSizeable'
      form.ClientWidth = 1500
      form.ClientHeight = 820
      form.Color = 0x252525
      form.Font.Name = 'Yu Gothic UI'
      form.Font.Size = 10
      form.Font.Color = 0xffffff
      pcall(function()
        form.Constraints.MinWidth = 900
        form.Constraints.MinHeight = 450
      end)
      local layout
      local field = createComboBox(form)
      field.Color = 0x353535
      field.Font.Color = 0xffffff
      s.field = field
      field.Style = 'csDropDownList'
      api.styleCombo153(field)
      field.Items.add(api.T('All columns', 'すべての列'))
      local search = createEdit(form)
      s.search = search
      search.Color = 0x353535
      search.Font.Color = 0xffffff
      search.Text = ''
      local clear = createButton(form)
      s.clear = clear
      clear.Caption = api.T('Clear filters', '検索解除')
      local refresh = createButton(form)
      s.refresh = refresh
      refresh.Caption = api.T('Refresh', '更新')
      local close = createButton(form)
      s.close = close
      close.Caption = api.T('Close', '閉じる')
      close.Cancel = true
      local status = createLabel(form)
      s.status = status
      status.Font.Color = 0xffffff
      local list = createListView(form)
      s.list = list
      list.ViewStyle = 'vsReport'
      list.OwnerData = true
      list.ReadOnly = true
      list.RowSelect = true
      list.HideSelection = false
      list.MultiSelect = true
      list.Color = 0x252525
      list.Font.Color = 0xffffff
      list.ShowColumnHeaders = true
      local host = createPanel(form)
      s.frozenHost = host
      host.Caption = ''
      host.BevelOuter = 'bvNone'
      host.Color = 0x252525
      local frozen = createListView(host)
      s.frozen = frozen
      frozen.ViewStyle = 'vsReport'
      frozen.OwnerData = true
      frozen.ReadOnly = true
      frozen.RowSelect = true
      frozen.HideSelection = false
      frozen.MultiSelect = true
      frozen.Color = 0x252525
      frozen.Font.Color = 0xffffff
      frozen.ShowColumnHeaders = true
      for i, col in ipairs(s.columns) do
        s.byKey[col.key] = col
        local header = (i <= 2 and frozen or list).Columns.add()
        header.Caption = col.title
        header.Width = col.width or 110
        field.Items.add(col.title)
      end
      local send = assert(getAddressSafe('user32.SendMessageW', true))
      local style = assert(getAddressSafe('user32.GetWindowLongW', true))
      local metrics = assert(getAddressSafe('user32.GetSystemMetrics', true))
      local showScroll = assert(getAddressSafe('user32.ShowScrollBar', true))
      local function message(view, msg, w, l)
        return sendMessage(view.Handle, msg, w or 0, l or 0)
      end
      frozen.OnData = function(_, item)
        if s.closed then
          return
        end
        local row = s.shown[item.Index + 1]
        if row then
          item.Caption = row.display.displayId
          item.SubItems.Text = row.display.name
        end
      end
      field.ItemIndex = 0
      list.OnData = function(_, item)
        if s.closed then
          return
        end
        local row = s.shown[item.Index + 1]
        if not row then
          return
        end
        item.Caption = row.display[s.columns[3].key]
        item.SubItems.Text = row.rightText or ''
      end
      -- Explicit selected text and background, including horizontally scrolled columns.
      api.styleList155(list, s, 3)
      api.styleList155(frozen, s, 1)
      function s.syncScroll()
        if
          s.closed
          or s.rendering
          or s.syncing
          or #s.shown == 0
          or list.Items.Count ~= #s.shown
          or frozen.Items.Count ~= #s.shown
        then
          return
        end
        s.syncing = true
        local left = message(frozen, 0x1027)
        local right = message(list, 0x1027)
        local source, target, top
        if left ~= s.lastLeft and right == s.lastRight then
          source, target, top = frozen, list, left
        elseif right ~= s.lastRight or left ~= right then
          source, target, top = list, frozen, right
        end
        if target then
          local from = message(target, 0x1027)
          local item = target.Items[from]
          if item then
            local rect = item.displayRect('drBounds')
            message(target, 0x1014, 0, (top - from) * math.max(1, rect.Bottom - rect.Top))
          end
        end
        if target then
          s.lastLeft = message(frozen, 0x1027)
          s.lastRight = message(list, 0x1027)
        else
          s.lastLeft = left
          s.lastRight = right
        end
        s.syncing = false
      end
      local scrollTimer = createTimer(form, false)
      s.scrollTimer = scrollTimer
      scrollTimer.Interval = 20
      scrollTimer.OnTimer = function()
        if s.closed then
          return
        end
        local width = frozen.Columns[0].Width + frozen.Columns[1].Width + 4
        local now = getTickCount()
        local bar = s.barHeight or 0
        if now >= (s.geometryNext or 0) then
          bar = (executeCodeLocalEx(style, list.Handle, -16) & 0x100000) ~= 0 and executeCodeLocalEx(metrics, 3) or 0
          s.geometryNext = now + 250
        end
        if width ~= s.fixedWidth or bar ~= s.barHeight then
          s.fixedWidth = width
          s.barHeight = bar
          layout()
        end
        s.syncScroll()
      end
      scrollTimer.Enabled = true
      local function selectOther(sender, item)
        if s.closed or s.rendering or s.busy or s.selecting or not item then return end
        local other = sender == frozen and list or frozen
        if item.Index < 0 or item.Index >= other.Items.Count then return end
        local state = sendMessage(sender.Handle, 0x102c, item.Index, 3)
        if state == sendMessage(other.Handle, 0x102c, item.Index, 3) then return end
        local buffer = createMemoryStream()
        buffer.Size=32;buffer.Position=12;buffer.writeDword(state);buffer.writeDword(3)
        s.selecting = true
        local ok, err = pcall(sendMessage, other.Handle, 0x102b, item.Index, buffer.Memory)
        s.selecting = false
        buffer.destroy()
        if not ok and not s.closed then status.Caption=tostring(err) end
      end
      frozen.OnSelectItem = selectOther
      list.OnSelectItem = selectOther
      function s.openSelected()
        if s.closed or s.inFlight then
          return
        end
        local index = frozen.ItemIndex
        local row = s.shown[index + 1]
        if not row then
          return
        end
        s.inFlight = true
        local ok, err = pcall(function()
          api.require()
          assert(getOpenedProcessID() == s.pid and api.pid == s.pid, 'List process changed')
          local c = api.context(s.key, row.id)
          assert(
            c.primary == row.primary and c.horseID == row.horseID and c.raceID == row.raceID,
            api.T(
              'The entity changed. Refresh the list.',
              '対象が変わりました。一覧を更新してください。'
            )
          )
          if s.closed then
            return
          end
          local record = assert(getAddressList().getMemoryRecordByID(api.EDITORS[s.key].record))
          api.selected[s.key] = row.id
          if record.Active then
            api.deferEditor(s.key)
          else
            Lists.openTarget = { key = s.key, id = row.id }
            local valid, e = pcall(function()
              record.Active = true
            end)
            Lists.openTarget = nil
            assert(valid, e)
          end
          local ancestor = record.Parent
          while ancestor do
            ancestor.Collapsed = false
            ancestor = ancestor.Parent
          end
          record.Collapsed = false
          getAddressList().SelectedRecord = record
          local node = getAddressList().Control[0].Selected
          if node then
            node.makeVisible()
          end
          getMainForm().show()
          getMainForm().bringToFront()
        end)
        s.inFlight = false
        if not ok and not s.closed then
          status.Caption = api.T('Cannot open: ', '開けません：') .. str(err)
        end
      end
      frozen.OnDblClick = s.openSelected
      function s.render()
        if s.closed then
          return
        end
        s.shown = Lists.view(s)
        s.rendering = true
        list.beginUpdate()
        frozen.beginUpdate()
        list.Items.Count = 0
        frozen.Items.Count = 0
        list.Items.Count = #s.shown
        frozen.Items.Count = #s.shown
        frozen.endUpdate()
        list.endUpdate()
        s.rendering = false
        list.repaint()
        frozen.repaint()
        s.lastLeft = nil
        s.lastRight = nil
        for i, col in ipairs(s.columns) do
          local view = i <= 2 and frozen or list
          local offset = i <= 2 and i - 1 or i - 3
          view.Columns[offset].Caption = col.title .. (i == s.sortIndex and (s.ascending and ' ↑' or ' ↓') or '')
        end
        local filters = 0
        for _, q in pairs(s.queries) do
          if q ~= '' then
            filters = filters + 1
          end
        end
        status.Caption = api.T('Shown ', '表示 ')
          .. #s.shown
          .. ' / '
          .. #s.rows
          .. api.T('   Columns: ', '   項目数：')
          .. #s.columns
          .. api.T('   Filters: ', '   検索条件：')
          .. filters
          .. (s.busy and api.T('   Loading ', '   読み取り中 ') .. math.min(s.position - 1, #s.sources) .. ' / ' .. #s.sources or '')
          .. (s.errors > 0 and api.T('   Unavailable: ', '   読み取り不可：') .. s.errors or '')
      end
      function s.sort(index)
        if s.sortIndex == index then
          s.ascending = not s.ascending
        else
          s.sortIndex = index
          s.ascending = true
        end
        s.render()
      end
      list.OnColumnClick = function(_, column)
        for i = 0, list.Columns.Count - 1 do
          if list.Columns[i].Caption == column.Caption then
            s.sort(i + 3)
            break
          end
        end
      end
      frozen.OnColumnClick = function(_, column)
        for i = 0, 1 do
          if frozen.Columns[i].Caption == column.Caption then
            s.sort(i + 1)
            break
          end
        end
      end
      local filterTimer = createTimer(form, false)
      filterTimer.Interval = 160
      filterTimer.OnTimer = function()
        filterTimer.Enabled = false
        if not s.closed then
          s.render()
        end
      end
      s.filterTimer = filterTimer
      search.OnChange = function()
        if s.changing then
          return
        end
        local col = s.columns[field.ItemIndex]
        s.queries[col and col.key or '*'] = search.Text
        filterTimer.Enabled = false
        filterTimer.Enabled = true
      end
      field.OnChange = function()
        s.changing = true
        local col = s.columns[field.ItemIndex]
        search.Text = s.queries[col and col.key or '*'] or ''
        s.changing = false
      end
      clear.OnClick = function()
        s.queries = {}
        s.changing = true
        search.Text = ''
        s.changing = false
        s.render()
      end
      local loader = createTimer(form, false)
      loader.Interval = 15
      s.loader = loader
      function s.begin()
        if s.closed or s.busy then
          return
        end
        s.busy = true
        refresh.Enabled = false
        s.errors = 0
        s.names = {}
        s.choiceMaps = {}
        s.position = 1
        s.rows = {}
        s.shown = {}
        list.Items.Count = 0
        frozen.Items.Count = 0
        s.inFlight = true
        local ok, rows = pcall(api.editorRows, s.key)
        s.inFlight = false
        if s.closed then
          return
        end
        if not ok then
          s.busy = false
          refresh.Enabled = true
          status.Caption = api.T('Cannot read list: ', '一覧を取得できません：') .. str(rows)
          return
        end
        s.sources = rows
        s.pid = api.pid
        s.render()
        loader.Enabled = true
      end
      loader.OnTimer = function()
        loader.Enabled = false
        if s.closed then
          return
        end
        local started = getTickCount()
        s.inFlight = true
        local ok, err = pcall(api.entitySnapshotRead116, function()
          assert(WP26 == api and api.pid == s.pid and getOpenedProcessID() == s.pid, 'List process changed')
          repeat
            if s.closed then
              break
            end
            local source = s.sources[s.position]
            if not source then
              break
            end
            local valid, row = pcall(Lists.readRow, s, source)
            if valid then
              s.rows[#s.rows + 1] = row
            else
              s.errors = s.errors + 1
              s.lastError = row
            end
            s.position = s.position + 1
          until s.closed or s.position > #s.sources or getTickCount() - started >= 25
        end)
        s.inFlight = false
        if s.closed then
          return
        end
        if not ok then
          s.busy = false
          refresh.Enabled = true
          status.Caption = api.T('Reading stopped: ', '読み取り停止：') .. str(err)
          return
        end
        if s.position > #s.sources then
          s.busy = false
          refresh.Enabled = true
          s.render()
        else
          status.Caption = api.T('Loading ', '読み取り中 ') .. (s.position - 1) .. ' / ' .. #s.sources
          loader.Enabled = true
        end
      end
      refresh.OnClick = s.begin
      api.regionButtons122(form, s, function()
        s.render()
      end)
      layout = function()
        local w, h = form.ClientWidth, form.ClientHeight
        field.Left = 14
        field.Top = 12
        field.Width = 260
        field.Height = 28
        search.Left = 284
        search.Top = 12
        search.Width = math.max(180, w - 680)
        search.Height = 28
        clear.Left = w - 380
        clear.Top = 10
        clear.Width = 110
        clear.Height = 32
        refresh.Left = w - 260
        refresh.Top = 10
        refresh.Width = 110
        refresh.Height = 32
        close.Left = w - 140
        close.Top = 10
        close.Width = 126
        close.Height = 32
        for i, button in ipairs(s.regionButtons) do
          button.Left = w - 334 + (i - 1) * 80
          button.Top = 46
          button.Width = 80
          button.Height = 28
        end
        status.Left = 16
        status.Top = 52
        status.AutoSize = false
        status.Height = 24
        status.Width = math.max(200, w - 370)
        local fw = s.fixedWidth or 314
        host.Left = 14
        host.Top = 80
        host.Width = fw
        host.Height = h - 94 - (s.barHeight or 0)
        frozen.Left = 0
        frozen.Top = 0
        frozen.Width = fw + executeCodeLocalEx(metrics, 2) + 2
        frozen.Height = host.Height
        list.Left = 18 + fw
        list.Top = 80
        list.Width = math.max(150, w - 32 - fw)
        list.Height = h - 94
      end
      function s.destroy()
        if s.closed then
          return
        end
        s.closed = true
        loader.Enabled = false
        filterTimer.Enabled = false
        scrollTimer.Enabled = false
        if Lists.windows[key] == s then
          Lists.windows[key] = nil
        end
        form.OnResize = nil
        form.hide()
        -- Native getters may pump UI messages. Keep controls alive until their caller returns.
        local disposer = createTimer(nil, false)
        disposer.Interval = 50
        s.disposer = disposer
        disposer.OnTimer = function()
          if s.inFlight then
            return
          end
          disposer.Enabled = false
          s.disposer = nil
          if s.disposeMenu126 then s.disposeMenu126();s.disposeMenu126 = nil end
          list.OnData = nil
          list.OnCustomDrawItem = nil
          list.OnColumnClick = nil
          list.OnSelectItem = nil
          frozen.OnData = nil
          frozen.OnCustomDrawItem = nil
          frozen.OnColumnClick = nil
          frozen.OnSelectItem = nil
          frozen.OnDblClick = nil
          form.OnClose = nil
          form.destroy()
          s.disposed = true
          disposer.destroy()
        end
        disposer.Enabled = true
      end
      close.OnClick = s.destroy
      form.OnClose = function()
        s.destroy()
        return caHide
      end
      Lists.installContext124(s)
      form.OnResize = layout
      layout()
      Lists.windows[key] = s
      return s
    end
    local enableEditor = api.enableEditor
    function api.enableEditor(parent, key)
      local target = Lists.openTarget
      if target and target.key == key then
        api.selected[key] = target.id
        api.deferEditor(key)
        return
      end
      return enableEditor(parent, key)
    end
    function api.openEntityList116(key)
      api.require()
      local old = Lists.windows[key]
      if old and not old.closed then
        old.form.show()
        old.form.bringToFront()
        return old
      end
      local s = Lists.create(key)
      s.form.show()
      s.begin()
      return s
    end

    api.NAMES[8000] = { '07. Parameter lists', '07. 一覧表示' }
    api.NAMES[8001] = { 'Horses', '馬' }
    api.NAMES[8002] = { 'People', '人物' }
    api.NAMES[8010] = { 'Owned racehorses list', '所有競走馬一覧' }
    api.NAMES[8011] = { 'Owned foals list', '所有幼駒一覧' }
    api.NAMES[8012] = { 'Owned broodmares list', '所有繁殖牝馬一覧' }
    api.NAMES[8013] = { 'Owned stallions list', '所有種牡馬一覧' }
    api.NAMES[8014] = { 'Racehorses list', '競走馬一覧' }
    api.NAMES[8015] = { 'Foals list', '幼駒一覧' }
    api.NAMES[8016] = { 'Broodmares list', '繁殖牝馬一覧' }
    api.NAMES[8017] = { 'Stallions list', '種牡馬一覧' }
    api.NAMES[8018] = { 'Jockeys list', '騎手一覧' }
    api.NAMES[8019] = { 'Trainers list', '調教師一覧' }
    api.NAMES[8020] = { 'Owners list', '馬主一覧' }
    api.NAMES[8021] = { 'Farm managers list', '牧場長一覧' }
    api.NAMES[8022] = { 'Farm staff list', '牧場スタッフ一覧' }
    api.NAMES[8023] = { 'Acquaintances list', '知人一覧' }
    api.NAMES[8024] = { 'Secretaries list', '秘書一覧' }
    api.NAMES[8025] = { 'Family list', '家系図一覧' }
    api.applyLang()
  end
  do
    WP26.NAMES[700] = { '08. Other', '08. その他' }
    WP26.applyLang()
  end
  do
    local api = WP26
    local cached = _G.WP26_BULK_TYPES104
    if not cached then
      _G.WP26_BULK_TYPES104 = { serial = 0, types = {}, version119 = 119 }
    elseif cached.version119 ~= 119 then
      for _, entry in pairs(cached.types) do
        entry.state = nil
      end
      cached.types = {}
      cached.version119 = 119
    end
    api.bulkInputIssues119 = { owned = {}, ownedFoal = {} }
    local function def(key, name)
      for _, d in ipairs(api.bulkDefinitions104[key]) do
        if d.en == name then
          return d
        end
      end
      error('Unsupported bulk field', 0)
    end
    local function labelChoices(key, name, f)
      local state = api.bulkStates104[key]
      if state then
        for _, e in ipairs(state.labels) do
          if e.definition.en == name then
            return e.options
          end
        end
      end
      if f.optionsJa then
        local t = {}
        for i, n in ipairs(f.optionsJa) do
          t[#t + 1] = { id = i - 1, name = n, en = f.optionsEn and f.optionsEn[i], ja = n }
        end
        return t
      end
      return f.choices
    end
    function api.bulkRefreshInput119(key)
      local state = api.bulkStates104[key]
      if not state or not state.alive or state.cancelled then
        return
      end
      for _, e in ipairs(state.labels) do
        local d = e.definition
        e.row.Color = api.C_VALUE or 0xffffff
        local range = ''
        if not e.options then
          range = ' ['
            .. (d.field.min or 0)
            .. '～'
            .. d.field.max
            .. (d.field.displayScale and (' / ' .. d.field.displayScale) or '')
            .. ']'
        end
        e.row.Description = api.T(d.en, d.ja) .. range
      end
      if state.applyAction119 then
        state.applyAction119.Description = api.T('Apply configured fields', '設定項目を一括適用')
        state.applyAction119.Color = 0x00a5ff
      end
    end
    function api.bulkInputResult119(key, name, value, err)
      api.bulkInputIssues119[key][name] = nil
      api.bulkRefreshInput119(key)
    end
    local set = api.bulkSet104
    function api.bulkSet104(key, name, value)
      local d = def(key, name)
      local f = d.field
      if type(value) == 'string' then
        value = value:match('^%s*(.-)%s*$')
        if value == '未設定' or value == 'Not set' then
          value = nil
        elseif not tonumber(value) then
          local number = value:match('^([+-]?%d+)%s*:')
          if number then
            value = number
          else
            local found
            for _, c in ipairs(labelChoices(key, name, f) or {}) do
              if value == c.name or value == c.en or value == c.ja then
                if found and found ~= c.id then
                  found = nil
                  break
                end
                found = c.id
              end
            end
            if found ~= nil then
              value = found
            end
          end
        end
      end
      if value ~= nil and value ~= '' and value ~= '-1' then
        value = api.normalizeNumeric120(f, value)
        if value == nil then
          return
        end
      end
      local ok = pcall(set, key, name, value)
      if not ok then
        return
      end
    end
    local reset = api.resetBulk104
    function api.resetBulk104(key)
      api.bulkInputIssues119[key] = {}
      local r = reset(key)
      api.bulkRefreshInput119(key)
      return r
    end
    local load = api.loadBulkSource106
    function api.loadBulkSource106(...)
      local r = table.pack(load(...))
      if r[1] then
        local key = (...)
        api.bulkInputIssues119[key] = {}
        api.bulkRefreshInput119(key)
      end
      return table.unpack(r, 1, r.n)
    end
    local open = api.openBulk104
    function api.openBulk104(parent, key)
      local r = open(parent, key)
      if r then
        api.bulkRefreshInput119(key)
      end
      return r
    end
    local lang = api.setLang
    function api.setLang(...)
      local r = lang(...)
      for key in pairs(api.bulkInputIssues119) do
        api.bulkRefreshInput119(key)
      end
      return r
    end
    local function encode(t)
      local out = {}
      for i = 1, 11 do
        out[i] = tostring(t[i] or 0)
      end
      return table.concat(out, ',')
    end
    local function decode(text)
      local t = {}
      for x in text:gmatch('[^,]+') do
        t[#t + 1] = assert(tonumber(x))
      end
      assert(#t == 11)
      return t
    end
    function api.bulkTraitsTarget119(before, edits)
      local wanted = { table.unpack(before) }
      for _, edit in ipairs(edits) do
        wanted[edit.field.traitSlot + 1] = edit.value
      end
      local seen = {}
      local regular = {}
      for i = 3, 10 do
        local v = wanted[i]
        if v ~= 0 and not seen[v] then
          regular[#regular + 1] = v
          seen[v] = true
        end
      end
      for i = 3, 10 do
        wanted[i] = regular[i - 2] or 0
      end
      return wanted
    end
    local plan = api.bulkPlan104
    function api.bulkPlan104(key)
      local result, columns = plan(key)
      for _, p in ipairs(result) do
        local traits = {}
        local ordinary = {}
        for _, e in ipairs(p.edits) do
          if e.field.traitSlot ~= nil then
            traits[#traits + 1] = e
          else
            ordinary[#ordinary + 1] = e
          end
        end
        if #traits > 0 then
          local c = api.context(key, p.target.id)
          local before = api.traitSnapshot(c)
          local wanted = api.bulkTraitsTarget119(before, traits)
          local field = {
            bulkTraits119 = true,
            ja = '特性',
            en = 'Traits',
            horseID = c.horseID,
            address = c.horse + 0x28,
            pid = api.pid,
            before = encode(before),
            raw = assert(readBytes(c.horse + 0x28, 13, true)),
          }
          ordinary[#ordinary + 1] = { field = field, before = field.before, value = encode(wanted), en = 'Traits' }
        end
        p.edits = ordinary
      end
      return result, columns
    end
    local read = api.fieldRead
    function api.fieldRead(c, f)
      if f.bulkTraits119 then
        return encode(api.traitSnapshot(c))
      end
      return read(c, f)
    end
    local write = api.writeField
    function api.writeField(c, f, value, journal)
      if not f.bulkTraits119 then
        return write(c, f, value, journal)
      end
      api.require()
      assert(api.pid == f.pid and c.horseID == f.horseID and c.horse + 0x28 == f.address, 'Bulk trait target changed')
      if value == f.before then
        local raw = { table.unpack(f.raw) }
        raw[13] = (assert(readBytes(f.address + 12, 1)) & 0xf8) | (raw[13] & 7)
        assert(writeBytes(f.address, raw), 'Bulk trait rollback failed')
      else
        local wanted = decode(value)
        for slot = 10, 0, -1 do
          api.native('horseTraitSet', c.horseID, slot, 0)
        end
        for _, slot in ipairs({ 0, 1, 10 }) do
          if wanted[slot + 1] ~= 0 then
            api.native('horseTraitSet', c.horseID, slot, wanted[slot + 1])
          end
        end
        for slot = 2, 9 do
          if wanted[slot + 1] ~= 0 then
            api.native('horseTraitSet', c.horseID, slot, wanted[slot + 1])
          end
        end
      end
      assert(encode(api.traitSnapshot(c)) == value, 'Bulk trait verification failed')
    end
  end
  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2",["size"] = 1408,["dataOffset"] = 1296,["hex"] = "9c5051524150415141524153535655574154415541564157ff05f6040000833deb040000010f859b040000488b05060500004c8b15070500004c39100f8584040000458b42504183f8020f82760400004183f8120f876c040000488b05e70400004c8b184d85db0f8459040000458b4b044183f9010f8c4b040000488b05ce040000488b304885f60f8438040000410fb68b080100004439c10f832104000031c9418b448b0c4401c80f801104000085c00f8e09040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ed4030000bbffffff7f31c94963448b544885c00f88bf0300008b5424604801d0483d9bc420000f87ac030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891df1030000488b050e040000488b30488b2de4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003832314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '128', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111, floor = WP26.RACE_FLOOR114 })
  end

  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1408, ["dataOffset"] = 1296, ["hex"] = "9c5051524150415141524153535655574154415541564157ff05f6040000833deb040000010f859b040000488b05060500004c8b15070500004c39100f8584040000458b42504183f8020f82760400004183f8120f876c040000488b05e70400004c8b184d85db0f8459040000458b4b044183f9010f8c4b040000488b05ce040000488b304885f60f8438040000410fb68b080100004439c10f832104000031c9418b448b0c4401c80f801104000085c00f8e09040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ed4030000bbffffff7f31c94963448b544885c00f88bf0300008b5424604801d0483d9bc420000f87ac030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891df1030000488b050e040000488b30488b2de4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003932314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_CLOCK111 = {["site"] = 11501022, ["resume"] = 11501040, ["original"] = "89442444b804000000486bc0004863440450", ["hex"] = "9c5051524150415141524153ff0566030000488b05670300008338010f8522030000534c8b1d5e0300004983eb044181bb8000000099b101000f8535010000418b4308413b030f862801000041813be80300000f821b010000488b05300300004c8b104c3b152e0300000f85040100008b4c247c83f9020f82f7000000413b4a500f87ed00000083f9120f87e400000031d28b849498000000413b42500f83d1000000410fb7844248ba0000413b4304740bffc239ca72dae9b700000085d20f84af0000003d851a00000f83a4000000488b1dc9020000488b1b4881fb000001000f828d0000004869c0e80000008b44032425ff1f000083f82e7578448b8c94980000004c8b059d020000496bc10c4901c08b842498000000413b42507355488b1d82020000486bc00c4801c38b430483f802723f413940047239ffc8418940048b0383f8027202ffc84189008b4308418940088b84949400000089849498000000ffca75ee44898c2498000000ff05540200005b8b44243085c00f84c30100003dffff00000f83b8010000488b05fd0100004c8b104c3b15fb0100000f85a1010000458b42504183f8020f82930100004183f8120f8789010000488b05fe010000443b000f85790100008b9424900000004439c20f8369010000450fb78c5248ba00004181f9851a00000f8353010000488b05a8010000488b084881f9000001000f823c0100004969c1e80000008b44012425ff1f000041b80000000083f82e410f94c04c8b1d5c0100004983eb044181bb8000000099b101000f8503010000418b03b940420f004585c074293de80300000f82eb000000453b4b047504418b43083de80300000f82d6000000b9e8030000480fafc8b8c59d1c814133425031d2450fb7945248ba00004431d069c0930100014c8b15fd000000ffc24c8b15f4000000413b525072d8413b838400000075168b542430413b938c000000741b413b93880000007412418983840000008b4424304189838800000045898b900000008b942490000000486bd20c488b05b40000008b141041899394000000418b83880000004869c040420f0031d248f7f1ba010000004839d0480f42c2418b93880000004839d0480f47c24189838c000000488944243041ff8398000000ff0538000000415b415a415941585a59589d89442444b804000000486bc0004863440450ff25500000000f1f8400000000003932314b4c435057000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 888, ["size"] = 972}
    table.insert(WP26.KNOWN_RACE085, { name = '129', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111, floor = WP26.RACE_FLOOR114 })
  end

  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1408, ["dataOffset"] = 1296, ["hex"] = "9c5051524150415141524153535655574154415541564157ff05f6040000833deb040000010f859b040000488b05060500004c8b15070500004c39100f8584040000458b42504183f8020f82760400004183f8120f876c040000488b05e70400004c8b184d85db0f8459040000458b4b044183f9010f8c4b040000488b05ce040000488b304885f60f8438040000410fb68b080100004439c10f832104000031c9418b448b0c4401c80f801104000085c00f8e09040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ed4030000bbffffff7f31c94963448b544885c00f88bf0300008b5424604801d0483d9bc420000f87ac030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891df1030000488b050e040000488b30488b2de4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003033314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_RENDER_CAP130 = {["site"] = 11542006, ["resume"] = 11542021, ["original"] = "0f28c8f30f5f8fa8000000410f2fcc", ["hex"] = "9c50515241504151415241534883ec10f30f7f0424ff053d010000488b053e0100008338010f85ed000000488b053e0100004c8b104c3b153c0100000f85d6000000418b4a5083f9020f82c900000083f9120f87c00000004889f8482b05260100000f82b000000031d241b86001000049f7f085d20f859d0000004839c80f83940000004989c0470fb78c4248ba00004181f9851a0000737f488b05e0000000488b00483d00000100726d4969c9e80000008b4c082481e1ff1f000083f92e75574c8b1da00000004983eb04418b03453b4b047504418b43083de80300007238f3480f2ac0f30f5e05ab000000f3440f59e0448905a3000000f30f10879c000000f30f110597000000f3440f112592000000ff0544000000f30f6f04244883c410415b415a415941585a59589d0f28c8f30f5f8fa8000000410f2fccff254e00000066666666662e0f1f84000000000030333150414350570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a44ffffffff0000000000000000", ["size"] = 424, ["dataOffset"] = 344}
    local identity = WP26.racePayloadIdentity066
    function WP26.racePayloadIdentity066() return identity() .. ':' .. WP26.RACE_RENDER_CAP130.hex end
    table.insert(WP26.KNOWN_RACE085, { name = '130', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130 })
  end

  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1408, ["dataOffset"] = 1296, ["hex"] = "9c5051524150415141524153535655574154415541564157ff05f6040000833deb040000010f859b040000488b05060500004c8b15070500004c39100f8584040000458b42504183f8020f82760400004183f8120f876c040000488b05e70400004c8b184d85db0f8459040000458b4b044183f9010f8c4b040000488b05ce040000488b304885f60f8438040000410fb68b080100004439c10f832104000031c9418b448b0c4401c80f801104000085c00f8e09040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ed4030000bbffffff7f31c94963448b544885c00f88bf0300008b5424604801d0483d9bc420000f87ac030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891df1030000488b050e040000488b30488b2de4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003133314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_CLOCK111 = {["site"] = 11501022, ["resume"] = 11501040, ["original"] = "89442444b804000000486bc0004863440450", ["hex"] = "9c5051524150415141524153ff0556040000488b05570400008338010f8511040000534c8b1d4e0400004983eb044181bb8000000099b101000f8535010000418b4308413b030f862801000041813be80300000f821b010000488b05200400004c8b104c3b151e0400000f85040100008b4c247c83f9020f82f7000000413b4a500f87ed00000083f9120f87e400000031d28b849498000000413b42500f83d1000000410fb7844248ba0000413b4304740bffc239ca72dae9b700000085d20f84af0000003d851a00000f83a4000000488b1db9030000488b1b4881fb000001000f828d0000004869c0e80000008b44032425ff1f000083f82e7578448b8c94980000004c8b058d030000496bc10c4901c08b842498000000413b42507355488b1d72030000486bc00c4801c38b430483f802723f413940047239ffc8418940048b0383f8027202ffc84189008b4308418940088b84949400000089849498000000ffca75ee44898c2498000000ff05440300005b4c8b1dfc0200004983eb044183bbb0000000000f84d6000000488b050b030000488b084881f9000001000f828e020000488b01488b90080100004c8b05f20200004981e8f07daf004981c040c5ba004c39c20f85660200004881ec80000000f30f7f442420f30f7f4c2430f30f7f542440f30f7f5c2450f30f7f642460f30f7f6c2470ffd2f30f6f442420f30f6f4c2430f30f6f542440f30f6f5c2450f30f6f642460f30f6f6c24704881c48000000083f8010f82050200003dffff00000f83fa0100008b4c243039c10f42c848894c24304c8b1d2a0200004983eb04418983b8000000ff055d020000e9cf0100008b44243085c00f84c30100003dffff00000f83b8010000488b05fe0100004c8b104c3b15fc0100000f85a1010000458b42504183f8020f82930100004183f8120f8789010000488b05ff010000443b000f85790100008b9424900000004439c20f8369010000450fb78c5248ba00004181f9851a00000f8353010000488b05a9010000488b084881f9000001000f823c0100004969c1e80000008b44012425ff1f000041b80000000083f82e410f94c04c8b1d5d0100004983eb044181bb8000000099b101000f8503010000418b03b940420f004585c074293de80300000f82eb000000453b4b047504418b43083de80300000f82d6000000b9e8030000480fafc8b8c59d1c814133425031d2450fb7945248ba00004431d069c0930100014c8b15fe000000ffc24c8b15f5000000413b525072d8413b838400000075168b542430413b938c000000741b413b93880000007412418983840000008b4424304189838800000045898b900000008b942490000000486bd20c488b05b50000008b141041899394000000418b83880000004869c040420f0031d248f7f1ba010000004839d0480f42c2418b93880000004839d0480f47c24189838c000000488944243041ff8398000000ff0539000000415b415a415941585a59589d89442444b804000000486bc0004863440450ff2551000000660f1f8400000000003133314b4c43505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 1128, ["size"] = 1216}
    table.insert(WP26.KNOWN_RACE085, { name = '131', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130 })
  end

  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1408, ["dataOffset"] = 1296, ["hex"] = "9c5051524150415141524153535655574154415541564157ff05f6040000833deb040000010f859b040000488b05060500004c8b15070500004c39100f8584040000458b42504183f8020f82760400004183f8120f876c040000488b05e70400004c8b184d85db0f8459040000458b4b044183f9010f8c4b040000488b05ce040000488b304885f60f8438040000410fb68b080100004439c10f832104000031c9418b448b0c4401c80f801104000085c00f8e09040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ed4030000bbffffff7f31c94963448b544885c00f88bf0300008b5424604801d0483d9bc420000f87ac030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891df1030000488b050e040000488b30488b2de4030000c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003433314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_FLOOR114 = {["site"] = 11351686, ["resume"] = 11351702, ["skip"] = 11351763, ["original"] = "3bc87349448bc88bd3442bc941395850", ["hex"] = "9c5051524150415141524153ff0526030000488b05270300008338010f85de0200004c8b1d1f0300004983eb044183bbb0000000000f84690100004181bb8000000099b101000f85b40200008b44243083f8010f82a70200003d00ff00000f879c020000488b05e50200004c8b104c3b15e30200000f8585020000458b42504183f8020f82770200004183f8120f876d020000488b05ce0200000fb648044439c10f8359020000410fb78c4a48ba000081f9851a00000f8344020000488b159d020000488b124881fa000001000f822d0200004869c9e80000008b4c0a2481e1ff1f000083f92e0f85130200004c8b15740200004981ea60250100418b12418d48ff458b0c8a4129d10f86f10100004181f9ff0000000f86e40100004883ec208914248b44245039c20f47c2894424048b54245081c2ff00000029c27e5d8954240831c9418b048a3b0424724e2b04244439c87746ffc14439c172e831c9418b048a2b04248b542408480fafc231d249f7f1034424044189048a488b15e701000089448a28ffc14439c172d28b4424044889442448ff05ed0100004883c420e95c0100004c8b1d9d0100004983eb044183bbb0000000000f85430100004181bb8000000099b101000f85320100008b4c242883f9010f822501000081f9ffff00000f8319010000413b8b8c0000000f850c010000413b8b880000000f83ff000000488b05480100004c8b104c3b15460100000f85e8000000458b42504183f8020f82da0000004183f8120f87d0000000488b0549010000443b000f85c0000000488b05210100003b48280f85b00000000fb650044439c20f83a3000000450fb78c5248ba00004181f9851a00000f838d000000453b8b900000000f8580000000488b05d9000000488b00483d00000100726e4969d1e80000008b54102481e2ff1f000083fa2e7558418b03453b4b047504418b43083de80300007644b8c59d1c814431c031d2450fb78c5248ba00004431c869c093010001ffc24439c272e7413b83840000007518ff054e000000415b415a415941585a59589dff2570000000415b415a415941585a59589d39c173124189c189da4129c941395850ff2556000000ff25480000000f1f840000000000343331524c465057000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 824, ["size"] = 908}
    table.insert(WP26.KNOWN_RACE085, { name = '134', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, clock = WP26.RACE_CLOCK111, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130 })
  end

  do
    WP26.RACE_NO_CLOCK135 = true
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1440, ["dataOffset"] = 1328, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0516050000833d0b050000010f85bb040000488b05260500004c8b15270500004c39100f85a4040000458b42504183f8020f82960400004183f8120f878c040000488b05070500004c8b184d85db0f8479040000458b4b044183f9010f8c6b040000488b05ee040000488b304885f60f8458040000410fb68b080100004439c10f834104000031c9418b448b0c4401c80f803104000085c00f8e29040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d11040000488b052e040000488b30488b2d040400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003533314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_FLOOR114 = {["site"] = 11351686, ["resume"] = 11351702, ["skip"] = 11351763, ["original"] = "3bc87349448bc88bd3442bc941395850", ["hex"] = "9c5051524150415141524153ff05f6000000488b05f70000008338010f85af0000004c8b1def0000004983eb044183bbb0000000000f85960000004181bb8000000099b101000f8585000000488b05cd0000004c8b104c3b15cb0000007572458b42504183f80272684183f8127762488b05c20000000fb650044439c27352450fb78c5248ba00004181f9851a00007340488b0598000000488b00483d00000100722e4969d1e80000008b54102481e2ff1f000083fa2e7518ff054d000000415b415a415941585a59589dff256f000000415b415a415941585a59589d39c173124189c189da4129c941395850ff2555000000ff25470000000f1f8000000000353331524c4650570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 264, ["size"] = 344}
    WP26.RACE_RENDER_CAP130 = {["site"] = 11542006, ["resume"] = 11542021, ["original"] = "0f28c8f30f5f8fa8000000410f2fcc", ["hex"] = "9c50515241504151415241534883ec20f30f7f0424f30f7f4c2410ff05b7010000488b05b80100008338010f8567010000488b05b80100004c8b104c3b15b60100000f8550010000418b4a5083f9020f824301000083f9120f873a0100004889f8482b05a00100000f822a01000031d241b86001000049f7f085d20f85170100004839c80f830e0100004989c0470fb78c4248ba00004181f9851a00000f83f5000000488b0556010000488b00483d000001000f82df0000004969c9e80000008b4c082481e1ff1f000083f92e0f85c50000004c8b1d0e0100004983eb04453b4b040f85b00000000fb78722010000c1e80c83f8010f829d00000083f8070f8394000000f30f10879c000000f30f11050c0100000f57c031c94c39c1743b488b15e30000004869c1600100004801c20fb78222010000c1e80c83f801721b83f8077316f30f108a9c0000000f2ec97a09f3410f5dccf30f5fc1ffc1413b4a5072b8f30f5905bf000000f30f5f879c000000f30f11879c000000f3440f5925a600000044890593000000f3440f112592000000ff0544000000f30f6f4c2410f30f6f04244883c420415b415a415941585a59589d0f28c8f30f5f8fa8000000410f2fccff25480000000f1f84000000000035333150414350570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a44ffffffff0000000000000000ae47813f", ["size"] = 556, ["dataOffset"] = 472}
    table.insert(WP26.KNOWN_RACE085, { name = '135', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130 })
  end

  do
    for _, profile in ipairs(WP26.KNOWN_RACE085) do profile.spirit = profile.spirit or WP26.RACE_SPIRIT064 end
    WP26.RACE_SPIRIT064 = {["hex"] = "9c5051524150415141524153ff0586000000488b0587000000833801754d0fb79424c802000081fa851a0000733d488b057b000000488b00483d00000100722b4869d2e80000008b44102425ff1f000083f82e7516ff0541000000415b415a415941585a59589d31d2eb0e415b415a415941585a59589d89c2488b8c2480020000ff1531000000ff25330000000f1f005350495249543337000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 152, ["size"] = 200, ["site"] = 11229860, ["resume"] = 11229875, ["setter"] = 12430448, ["original"] = "8bd0488b8c2480020000e8bd511200"}
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1440, ["dataOffset"] = 1328, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0516050000833d0b050000010f85bb040000488b05260500004c8b15270500004c39100f85a4040000458b42504183f8020f82960400004183f8120f878c040000488b05070500004c8b184d85db0f8479040000458b4b044183f9010f8c6b040000488b05ee040000488b304885f60f8458040000410fb68b080100004439c10f834104000031c9418b448b0c4401c80f803104000085c00f8e29040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d11040000488b052e040000488b30488b2d040400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003733314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '137', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
    WP26.HEALTH_ENTRY137 = {["hex"] = "9c5051524150415141524153ff051a010000833d0f010000010f85df000000440fb78c24c80200004181f9851a00000f83c9000000488b05fc000000488b00483d000001000f82b30000004969d1e80000008b44102425ff1f000083f82e0f859a000000488b05d5000000488b00483b05d30000000f8583000000448b50504183fa0172794183fa1277734c8b8424c0020000488d50544939d072624c89c14829d14989c34889c831d2b95c01000048f7f185d275484c39d07343410fb780a20000003d2c01000072343dbc020000772da901000000752666418980a000000041c680880000006941c6808a0000000041c680cf00000078ff0532000000415b415a415941585a59589d0fb78c2488020000ff153800000089c2ff253800000057504845414c33370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 296, ["size"] = 352, ["site"] = 11232122, ["original"] = "0fb78c2488020000e8293360ff8bd0", ["getter"] = 759472, ["resume"] = 11232137}
  function WP26.stopConditionEntry137()
    local st = _G.WP26_HEALTH137
    if st and st.active and raceAlive(st) then
      racePatch(st, false)
    end
    if st then st.active = false end
  end
  function WP26.startConditionEntry137()
    WP26.require()
    local base = WP26.mod()
    local d = WP26.HEALTH_ENTRY137
    local st = _G.WP26_HEALTH137
    if st and (st.pid ~= WP26.pid or st.base ~= base or st.identity ~= d.hex or not raceAlive(st)) then
      WP26.stopConditionEntry137()
      if st.handle then raceCall(st, 'CloseHandle', st.handle); st.handle = nil end
      if st.buffer then st.buffer.destroy(); st.buffer = nil end
      st = nil
      _G.WP26_HEALTH137 = nil
    end
    if not st then
      st = { pid = WP26.pid, base = base, site = base + d.site, api = {}, active = false, identity = d.hex }
      for _, n in ipairs({ 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'WriteProcessMemory', 'VirtualProtectEx', 'FlushInstructionCache', 'GetExitCodeProcess' }) do
        st.api[n] = assert(getAddressSafe('kernel32.' .. n, true), 'Local API unavailable: ' .. n)
      end
      for _, n in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
        st.api[n] = assert(getAddressSafe('ntdll.' .. n, true), 'Local API unavailable: ' .. n)
      end
      st.handle = raceCall(st, 'OpenProcess', 0xC38, 0, st.pid)
      assert(st.handle and st.handle ~= 0, 'Condition process handle unavailable')
      st.buffer = createMemoryStream()
      st.buffer.Size = 4096
      local ok, err = pcall(function()
        st.original = raceHex(d.original)
        assert(raceSame(raceRead(st, st.site, #st.original), st.original), 'Condition entry code differs from local EXE')
        st.mem = assert(allocateMemory(4096), 'Condition memory allocation failed')
        st.data = st.mem + d.dataOffset
        st.patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', st.mem) .. string.char(0x90))
        raceWrite(st, st.mem, raceHex(d.hex))
        local pointers = { base + 0x402a618, base + 0x47e8e98, base + 0x4856670, base + d.getter, base + d.resume }
        for i, ptr in ipairs(pointers) do
          raceWrite(st, st.data + 16 + (i - 1) * 8, raceBytes(string.pack('<I8', ptr)))
        end
        assert(raceCall(st, 'FlushInstructionCache', st.handle, st.mem, d.size) ~= 0)
      end)
      if not ok then
        if st.mem and not st.borrowed then deAlloc(st.mem, 4096) end
        raceCall(st, 'CloseHandle', st.handle)
        st.buffer.destroy()
        error(err, 0)
      end
      _G.WP26_HEALTH137 = st
    end
    assert(raceSame(raceRead(st, st.mem, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'Condition payload changed')
    racePatch(st, true)
    return st
  end
  function WP26.syncConditionEntry137(selected)
    local base = WP26.mod()
    local entry = readQword(base + 0x47e8e98)
    if entry ~= base + 0x4856670 then return 0 end
    local count = readInteger(entry + 0x50)
    if not count or count < 1 or count > 18 then return 0 end
    local owned = {}
    for _, row in ipairs(selected) do owned[row.raceID] = row end
    local changed = 0
    for i = 0, count - 1 do
      local id = readSmallInteger(entry + 0xba48 + i * 2)
      local row = owned[id]
      if row and WP26.bits(row.race, 0x24, 0, 13) == 46 then
        local ideal = readSmallInteger(entry + 0x54 + i * 0x15c + 0xa2)
        if ideal and ideal >= 300 and ideal <= 700 and ideal % 2 == 0 then
          local object = entry + 0x54 + i * 0x15c
          assert(writeSmallInteger(object + 0xa0, ideal) and writeBytes(object + 0x88, 105) and writeBytes(object + 0x8a, 0) and writeBytes(object + 0xcf, 210), 'Condition snapshot write failed')
          assert(readSmallInteger(object + 0xa0) == ideal and readBytes(object + 0x88, 1) == 105 and readBytes(object + 0x8a, 1) == 0 and readBytes(object + 0xcf, 1) == 210, 'Condition snapshot verification failed')
          changed = changed + 1
        end
      end
    end
    return changed
  end

    WP26.NAMES[101] = { 'Owned horses: best race condition', '所有馬を出走最良状態にする' }
    WP26.NAMES[102] = { 'Maintain owned horses in best race condition', '所有馬の出走最良状態を維持' }
  end

  do
    WP26.RECORD139 = {["hex"] = "4883ec2881f955010000720231c9e8950100003dffffff7f740d89c2ff15e60100004883c428c3b8ffff00004883c428c381f955010000720231c94c8b15be0100004d8b124c6bd9144d01da4188520f85d2780641c6421100c3c1fa0841885211c3535556574883ec28ff058401000089cb0fb7ea4489c681f9550100000f838700000081fe0080ffff7c7f81fefe0000007f7789e9ff157401000085c0746b89d9ff157001000001f083f8017c5c3dfeff00007f5589d9e8eb0000004c89d7807f1003740b3dffffff7f743e39c67d3a89ea89d9ff154501000089ea89d9ff154301000089f289d9e843ffffffff153c01000089c289d9ff153a010000ff05f4000000b801000000eb0231c04883c4285f5e5d5bc35355564883ec2089cb89d54489c631c989da4189e84531c9ff150c0100003d55010000732589c1e8660000003dffffff7f750c41807a11007510b8ff00000031c939c60f9ec189c8eb0231c04883c4205e5d5bc34883ec5883f90a732eff15cf0000003d55010000732189c1e8210000003dffffff7f741331c9398424800000000f9ec189c84883c458c331c04883c458c34c8b15510000004d8b124c6bd9144d01da410fb6421185c07412a9800000007418c1e008418a420f0fbfc0c3410fb6420f3dff0000007401c3b8ffffff7fc3905750524543313339000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["size"] = 592, ["dataOffset"] = 496, ["sites"] = {{["label"] = "readEntry", ["offset"] = 0, ["site"] = 1585904, ["original"] = "894c24084883ec48c6442420008b442450", ["size"] = 17}, {["label"] = "storeEntry", ["offset"] = 49, ["site"] = 2509376, ["original"] = "89542410894c24084883ec388b442440", ["size"] = 16}, {["label"] = "updateEntry", ["offset"] = 98, ["site"] = 2419984, ["original"] = "44894424186689542410894c2408", ["size"] = 14}, {["label"] = "wideEntry", ["offset"] = 278, ["site"] = 1586144, ["original"] = "448944241889542410894c24084883ec48", ["size"] = 17}, {["label"] = "localEntry", ["offset"] = 362, ["site"] = 1586928, ["original"] = "44894c2420448944241889542410", ["size"] = 14}}, ["pointers"] = {67380000, 2695040, 549536, 2053392, 2509248, 2509088, 1381968, 2509472, 1587376, 1586816}}
  function WP26.startRecordSupport139()
    WP26.require()
    local base = WP26.mod()
    local d = WP26.RECORD139
    local st = _G.WP26_RECORD139
    if st and (st.pid ~= WP26.pid or st.base ~= base or not raceAlive(st)) then
      if st.handle then raceCall(st, 'CloseHandle', st.handle); st.handle = nil end
      if st.buffer then st.buffer.destroy(); st.buffer = nil end
      st = nil
      _G.WP26_RECORD139 = nil
    end
    if not st then
      st = { pid = WP26.pid, base = base, api = {}, active = false }
      for _, n in ipairs({ 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'WriteProcessMemory', 'VirtualProtectEx', 'FlushInstructionCache', 'GetExitCodeProcess' }) do
        st.api[n] = assert(getAddressSafe('kernel32.' .. n, true), 'Local API unavailable: ' .. n)
      end
      for _, n in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
        st.api[n] = assert(getAddressSafe('ntdll.' .. n, true), 'Local API unavailable: ' .. n)
      end
      st.handle = raceCall(st, 'OpenProcess', 0xC38, 0, st.pid)
      assert(st.handle and st.handle ~= 0, 'Record process handle unavailable')
      st.buffer = createMemoryStream()
      st.buffer.Size = 4096
      local ok, err = pcall(function()
        local first = d.sites[1]
        local bytes = raceRead(st, base + first.site, #first.original // 2)
        if not raceSame(bytes, raceHex(first.original)) then
          assert(bytes and bytes[1] == 0xFF and bytes[2] == 0x25 and bytes[3] == 0 and bytes[4] == 0 and bytes[5] == 0 and bytes[6] == 0, 'Unknown record reader')
          local candidate = readQword(base + first.site + 6) - first.offset
          assert(candidate >= 65536 and raceSame(raceRead(st, candidate, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'Unknown record payload')
          for _, v in ipairs(d.sites) do
            local expected = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', candidate + v.offset) .. string.rep(string.char(0x90), #v.original // 2 - 14))
            assert(raceSame(raceRead(st, base + v.site, #expected), expected), 'Record hook mismatch: ' .. v.label)
          end
          for i, rva in ipairs(d.pointers) do
            assert(readQword(candidate + d.dataOffset + 16 + (i - 1) * 8) == base + rva, 'Record pointer mismatch')
          end
          st.mem, st.borrowed, st.active = candidate, true, true
        else
          for _, v in ipairs(d.sites) do
            assert(raceSame(raceRead(st, base + v.site, #v.original // 2), raceHex(v.original)), 'Record code differs from local EXE: ' .. v.label)
          end
        end
        local tableAddress = readQword(base + 0x4042320)
        local records = tableAddress and tableAddress >= 65536 and readBytes(tableAddress, 341 * 20, true) or nil
        for i = 0, records and 340 or -1 do
          local high = records[i * 20 + 18]
          assert(high == 0 or high >= 128, 'Record extension field is not compatible')
        end
        st.mem = st.mem or assert(allocateMemory(4096), 'Record memory allocation failed')
        st.data = st.mem + d.dataOffset
        if not st.borrowed then
          raceWrite(st, st.mem, raceHex(d.hex))
          for i, rva in ipairs(d.pointers) do
            raceWrite(st, st.data + 16 + (i - 1) * 8, raceBytes(string.pack('<I8', base + rva)))
          end
        end
        local sites = {}
        for _, v in ipairs(d.sites) do
          sites[#sites + 1] = {
            site = base + v.site,
            original = raceHex(v.original),
            patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', st.mem + v.offset) .. string.rep(string.char(0x90), #v.original // 2 - 14)),
          }
        end
        st.site, st.original, st.patch = sites[1].site, sites[1].original, sites[1].patch
        st.rollSites = {}
        for i = 2, #sites do st.rollSites[#st.rollSites + 1] = sites[i] end
        assert(raceCall(st, 'FlushInstructionCache', st.handle, st.mem, d.size) ~= 0)
      end)
      if not ok then
        if st.mem and not st.borrowed then deAlloc(st.mem, 4096) end
        raceCall(st, 'CloseHandle', st.handle)
        st.buffer.destroy()
        error(err, 0)
      end
      _G.WP26_RECORD139 = st
    end
    assert(raceSame(raceRead(st, st.mem, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'Record payload changed')
    if st.active then
      local installed = raceSame(raceRead(st, st.site, #st.patch), st.patch)
      for _, site in ipairs(st.rollSites) do
        installed = installed and raceSame(raceRead(st, site.site, #site.patch), site.patch)
      end
      assert(installed, 'Record hooks changed after connection')
    else
      racePatch(st, true)
    end
    return st
  end
  function WP26.stopRecordSupport139()
    local st = _G.WP26_RECORD139
    if not st or not st.active or st.borrowed then return true end
    if not raceAlive(st) then st.active = false; return true end
    local p = readQword(st.base + 0x4042320)
    local records = p and p >= 65536 and readBytes(p, 341 * 20, true) or nil
    for i = 0, records and 340 or -1 do
      assert(records[i * 20 + 18] == 0, 'Extended records still require the record reader')
    end
    racePatch(st, false)
    return true
  end
  local recordConfig139 = WP26.ensureRaceConfig
  WP26.raceConfigOnly148 = recordConfig139
  function WP26.ensureRaceConfig(...)
    local factor = recordConfig139(...)
    WP26.startRecordSupport139()
    return factor
  end
  local recordAttach139 = WP26.disableAll
  function WP26.disableAll(...)
    local result = recordAttach139(...)
    WP26.startRecordSupport139()
    return result
  end

    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1440, ["dataOffset"] = 1328, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0516050000833d0b050000010f85bb040000488b05260500004c8b15270500004c39100f85a4040000458b42504183f8020f82960400004183f8120f878c040000488b05070500004c8b184d85db0f8479040000458b4b044183f9010f8c6b040000488b05ee040000488b304885f60f8458040000410fb68b080100004439c10f834104000031c9418b448b0c4401c80f803104000085c00f8e29040000ffc14439c172e3410fb69308010000418b54930c4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d11040000488b052e040000488b30488b2d040400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d1a0300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15a50200004839d0480f47c289c3c705da020000ffffffffc705d402000000000000891dc602000031c9833dc5020000017419410fb7844a48ba00003b4504750b890dab020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b05560200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0553020000480fafc231d251b9e803000048f7f1598b15ed0100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d420100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d180100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890ddb0000008905d900000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da2000000ff058c000000833de50000000174318b1dd5000000ffc14439c10f8206feffff8b0dc800000083f9ff7415c705bd00000001000000e9ecfdffffff0556000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b054d000000488b004531d2ff2569000000660f1f8400000000003933314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    WP26.RACE_FLOOR114 = {["site"] = 11351654, ["resume"] = 11351674, ["skip"] = 11351940, ["original"] = "8b0d244cd20333db4c8b052358d10348896c2440", ["hex"] = "9c5051524150415141524153ff056e010000488b056f0100008338010f85250100004c8b1d670100004983eb044181bb8000000099b101000f8509010000488b05530100004c8b104c3b15510100000f85f2000000458b42504183f8020f82e40000004183f8120f87da000000488b053c0100000fb650044439c20f83c6000000450fb78c5248ba00004181f9851a00000f83b0000000488b050a010000488b00483d000001000f829a0000004969d1e80000008b54102481e2ff1f000083fa2e0f85800000004183bbb000000000743a4c8b1dd80000004d8d93a0dafeff31c94531c9418b148a83fa017c5a81fafeff00007f524439ca7c4d413b548b2875464189d1ffc14439c172d9ff0573000000415b415a415941585a59589d48896c244048897c2448488b2d720000004881ed7066850431db4c8b055a0000004d8b00ff2571000000415b415a415941585a59589d4c8b1d56000000418b8ba0dafeff31db4c8b052e0000004d8b0048896c2440ff25480000005750464c523133390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 384, ["size"] = 464}
    table.insert(WP26.KNOWN_RACE085, { name = '139', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
  end

  do
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1456, ["dataOffset"] = 1344, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0526050000833d1b050000010f85c5040000488b05360500004c8b15370500004c39100f85ae040000458b42504183f8020f82a00400004183f8120f8796040000488b05170500004c8b184d85db0f8483040000458b4b044183f9010f8c75040000488b05fe040000488b304885f60f8462040000410fb68b080100004439c10f834b04000031c9418b448b0c4401c80f803b04000085c00f8c33040000ffc14439c172e3410fb69308010000418b54930c4401ca85d27e184429ca4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d17040000488b0534040000488b30488b2d0a0400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d200300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15ab0200004839d0480f47c289c3c705e0020000ffffffffc705da02000000000000891dcc02000031c9833dcb020000017419410fb7844a48ba00003b4504750b890db1020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b055c0200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0559020000480fafc231d251b9e803000048f7f1598b15f30100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d480100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d1e0100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890de10000008905df00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da8000000ff0592000000833deb0000000174318b1ddb000000ffc14439c10f8206feffff8b0dce00000083f9ff7415c705c300000001000000e9ecfdffffff055c000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0553000000488b004531d2ff256f0000006666666666662e0f1f8400000000003234314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '142', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
    WP26.RACE_SPIRIT064 = {["hex"] = "9c5051524150415141524153ff0586000000488b058700000083380175500fb79424c802000081fa851a00007340488b057b000000488b00483d00000100722e4869d2e80000008b44102425ff1f000083f82e7519ff0541000000415b415a415941585a59589dba5a000000eb0e415b415a415941585a59589d89c2488b8c2480020000ff152e000000ff25300000005350524954313433000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 152, ["size"] = 200, ["site"] = 11229860, ["resume"] = 11229875, ["setter"] = 12430448, ["original"] = "8bd0488b8c2480020000e8bd511200"}
    WP26.HEALTH_ENTRY137 = {["hex"] = "9c5051524150415141524153ff051a010000833d0f010000010f85df000000440fb78c24c80200004181f9851a00000f83c9000000488b05fc000000488b00483d000001000f82b30000004969d1e80000008b44102425ff1f000083f82e0f859a000000488b05d5000000488b00483b05d30000000f8583000000448b50504183fa0172794183fa1277734c8b8424c0020000488d50544939d072624c89c14829d14989c34889c831d2b95c01000048f7f185d275484c39d07343410fb780a20000003d2c01000072343dbc020000772da901000000752666418980a000000041c680880000006941c6808a0000000041c680cf000000d2ff0532000000415b415a415941585a59589d0fb78c2488020000ff153800000089c2ff253800000057504845413134330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 296, ["size"] = 352, ["site"] = 11232122, ["original"] = "0fb78c2488020000e8293360ff8bd0", ["getter"] = 759472, ["resume"] = 11232137}
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1456, ["dataOffset"] = 1344, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0526050000833d1b050000010f85c5040000488b05360500004c8b15370500004c39100f85ae040000458b42504183f8020f82a00400004183f8120f8796040000488b05170500004c8b184d85db0f8483040000458b4b044183f9010f8c75040000488b05fe040000488b304885f60f8462040000410fb68b080100004439c10f834b04000031c9418b448b0c4401c80f803b04000085c00f8c33040000ffc14439c172e3410fb69308010000418b54930c4401ca85d27e184429ca4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d17040000488b0534040000488b30488b2d0a0400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d200300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15ab0200004839d0480f47c289c3c705e0020000ffffffffc705da02000000000000891dcc02000031c9833dcb020000017419410fb7844a48ba00003b4504750b890db1020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b055c0200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0559020000480fafc231d251b9e803000048f7f1598b15f30100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d480100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d1e0100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890de10000008905df00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da8000000ff0592000000833deb0000000174318b1ddb000000ffc14439c10f8206feffff8b0dce00000083f9ff7415c705c300000001000000e9ecfdffffff055c000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0553000000488b004531d2ff256f0000006666666666662e0f1f8400000000003334314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '143', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
    WP26.RACE_FLOOR114 = {["site"] = 11351654, ["resume"] = 11351674, ["skip"] = 11351940, ["original"] = "8b0d244cd20333db4c8b052358d10348896c2440", ["hex"] = "9c5051524150415141524153ff052e010000488b052f0100008338010f85e10000004c8b1d270100004983eb044181bb8000000099b101000f85c5000000488b05130100004c8b104c3b15110100000f85ae000000458b42504183f8020f82a00000004183f8120f8796000000488b05fc0000000fb650044439c20f8382000000450fb78c5248ba00004181f9851a00007370488b05ce000000488b00483d00000100725e4969d1e80000008b54102481e2ff1f000083fa2e75484183bbb000000000753eeb00ff0577000000415b415a415941585a59589d48896c244048897c2448488b2d760000004881ed7066850431db4c8b055e0000004d8b00ff2575000000415b415a415941585a59589d4c8b1d5a000000418b8ba0dafeff31db4c8b05320000004d8b0048896c2440ff254c0000000f1f40005750464c523134340000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 320, ["size"] = 400}
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1456, ["dataOffset"] = 1344, ["hex"] = "9c5051524150415141524153535655574154415541564157ff0526050000833d1b050000010f85c5040000488b05360500004c8b15370500004c39100f85ae040000458b42504183f8020f82a00400004183f8120f8796040000488b05170500004c8b184d85db0f8483040000458b4b044183f9010f8c75040000488b05fe040000488b304885f60f8462040000410fb68b080100004439c10f834b04000031c9418b448b0c4401c80f803b04000085c00f8c33040000ffc14439c172e3410fb69308010000418b54930c4401ca85d27e184429ca4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8ef4030000bbffffff7f31c94963448b544885c00f88df0300008b5424604801d0483d9bc420000f87cc030000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891d17040000488b0534040000488b30488b2d0a0400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891d200300008b550081fae80300000f825502000089d8480fafc231d2b9e803000048f7f18b15ab0200004839d0480f47c289c3c705e0020000ffffffffc705da02000000000000891dcc02000031c9833dcb020000017419410fb7844a48ba00003b4504750b890db1020000e9be010000410fb7844a48ba00003d851a00000f83aa0100004869c0e80000008b44062425ff1f000083f82e0f8591010000488b055c0200003a080f8482010000410fb7844a48ba00003b450475308b550881fae803000072258b0559020000480fafc231d251b9e803000048f7f1598b15f30100004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0d480100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0d1e0100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff4489eb4489f1418b448b0c4401c839d87d4d890de10000008905df00000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891da8000000ff0592000000833deb0000000174318b1ddb000000ffc14439c10f8206feffff8b0dce00000083f9ff7415c705c300000001000000e9ecfdffffff055c000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0553000000488b004531d2ff256f0000006666666666662e0f1f8400000000003434314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '144', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
    WP26.RACE_FLOOR114 = {["site"] = 11351654, ["resume"] = 11351674, ["skip"] = 11351940, ["original"] = "8b0d244cd20333db4c8b052358d10348896c2440", ["hex"] = "9c5051524150415141524153ff056e010000488b056f0100008338010f85250100004c8b1d670100004983eb044181bb8000000099b101000f8509010000488b05530100004c8b104c3b15510100000f85f2000000458b42504183f8020f82e40000004183f8120f87da000000488b053c0100000fb650044439c20f83c6000000450fb78c5248ba00004181f9851a00000f83b0000000488b050a010000488b00483d000001000f829a0000004969d1e80000008b54102481e2ff1f000083fa2e0f85800000004183bbb000000000743a4c8b1dd80000004d8d93a0dafeff31c94531c9418b148a83fa017c5a81fafeff00007f524439ca7c4d413b548b2875464189d1ffc14439c172d9ff0573000000415b415a415941585a59589d48896c244048897c2448488b2d720000004881ed7066850431db4c8b055a0000004d8b00ff2571000000415b415a415941585a59589d4c8b1d56000000418b8ba0dafeff31db4c8b052e0000004d8b0048896c2440ff25480000005750464c523133390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 384, ["size"] = 464}
    WP26.RACE_PAYLOAD = {["original"] = "41554883ec40488b05db2ad2034533d2", ["size"] = 1632, ["dataOffset"] = 1520, ["hex"] = "9c5051524150415141524153535655574154415541564157ff05d6050000833dcb050000010f8582050000488b05e60500004c8b15e70500004c39100f856b050000458b42504183f8020f825d0500004183f8120f8753050000488b05c70500004c8b184d85db0f8440050000458b4b044183f9010f8c32050000488b05ae050000488b304885f60f841f050000410fb68b080100004439c10f830805000031c9418b448b0c4401c80f80f804000085c00f8cf0040000ffc14439c172e3410fb69308010000418b54930c4401ca85d27e184429ca4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8eb1040000bbffffff7f31c94963448b544885c00f889c0400008b5424604801d0483d9bc420000f8789040000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dc7040000488b05e4040000488b30488b2dba0400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d851a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891dd00300008b550081fae80300000f821203000089d8480fafc231d2b9e803000048f7f18b155b0300004839d0480f47c289c3c70590030000ffffffffc7058a03000000000000891d7c03000031c9833d7b030000017419410fb7844a48ba00003b4504750b890d61030000e97b020000410fb7844a48ba00003d851a00000f83670200004869c0e80000008b44062425ff1f000083f82e0f854e020000488b050c0300003a080f843f020000410fb7844a48ba00003b450475308b550881fae803000072258b0509030000480fafc231d251b9e803000048f7f1598b15a30200004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d851a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0df80100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0dce0100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff83bdb0000000000f84b0000000488b05ad010000488db8b8f20000468b24b7438b44b30c4401c84139c4440f4ce0430fb7847248ba00003b4504757a428b1cb785db790231db31c94439f1743f410fb7844a48ba00003d851a0000732f4869c0e80000008b44062425ff1f000083f82e751a448b3c8f418b448b0c4401c84139c7440f4cf84439fb410f4cdfffc14439c172b589d8486bc06531d2b96400000048f7f1baffffff7f4839d0480f47c24139c4440f4ce04539e5450f4fec4489eb4489f1418b448b0c4401c839d87d4d890dd40000008905d200000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d9b000000ff0585000000833dde0000000174318b1dce000000ffc14439c10f8249fdffff8b0dc100000083f9ff7415c705b600000001000000e92ffdffffff054f000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0546000000488b004531d2ff256200000066903634314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000"}
    table.insert(WP26.KNOWN_RACE085, { name = '146', main = WP26.RACE_PAYLOAD, pace = WP26.PACE_GUARD066, floor = WP26.RACE_FLOOR114, cap = WP26.RACE_RENDER_CAP130, spirit = WP26.RACE_SPIRIT064 })
    WP26.MATH142 = {["hex"] = "9c5051524150415141524153535655574154415541564157ff054a020000833d3b020000010f85f6010000488b05460200004c8b104c3b15440200000f85df010000458b6a504183fd010f82d10100004183fd120f87c7010000488b05270200004c8b184981fb000001000f82b0010000488b0518020000488b304881fe000001000f82990100004531c94531c0430fb7844248ba00003d851a0000731b4869c0e80000008b44062425ff1f000083f82e750641b90100000041ffc04539e872cd4585c97510f70594010000020000000f844b010000448b7c24604585ff0f881e0100004d63630431ed31ff49c7c6ffffffff4531d24531c04b635c830c4c01e30f88fb0000004881fbffffff7f0f87ee00000039eb0f4feb4b634c83544885c90f88db0000004c01f94881f9378941000f87cb00000085db74194869c1e803000031d248f7f34c39f073084989c689df4989ca41ffc04539e8729d85ff0f849e00000089e8490fafc7483dffffff7f0f878c00000089e8490fafc2483dffffff7f777e4585e47f2541897b044531c04b6344830c4c01e04829f8438944830c41ffc04539e872e8ff05be000000f705ac00000001000000740f4585c9740ac744245000000000eb58837c2450017551488b05d1000000488b00483d0000010072200fb6888b000000488b05c00000000308ffc985c97f29c744245000000000eb1fff0568000000415f415e415d415c5f5d5e5b415b415a415941585a59589dc3415f415e415d415c5f5d5e5b415b415a415941585a59589d5341574881ecb8000000488b054e000000488b00ff254d0000000f1f440000574d41544831343200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 608, ["size"] = 696, ["site"] = 11298416, ["resume"] = 11298434, ["original"] = "405341574881ecb8000000488b0526930303", ["cookie"] = 61864360}
  function WP26.startRaceMath142(mode)
    WP26.require()
    local base = WP26.mod()
    local d = WP26.MATH142
    local st = _G.WP26_MATH142
    if st and (st.pid ~= WP26.pid or st.base ~= base or st.identity ~= d.hex or not raceAlive(st)) then
      if st.active and raceAlive(st) then racePatch(st, false) end
      if st.handle then raceCall(st, 'CloseHandle', st.handle); st.handle = nil end
      if st.buffer then st.buffer.destroy(); st.buffer = nil end
      st = nil
      _G.WP26_MATH142 = nil
    end
    if not st then
      st = { pid = WP26.pid, base = base, api = {}, active = false, identity = d.hex }
      for _, n in ipairs({ 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'WriteProcessMemory', 'VirtualProtectEx', 'FlushInstructionCache', 'GetExitCodeProcess' }) do
        st.api[n] = assert(getAddressSafe('kernel32.' .. n, true), 'Local API unavailable: ' .. n)
      end
      for _, n in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
        st.api[n] = assert(getAddressSafe('ntdll.' .. n, true), 'Local API unavailable: ' .. n)
      end
      st.handle = raceCall(st, 'OpenProcess', 0xC38, 0, st.pid)
      assert(st.handle and st.handle ~= 0, 'Race math process handle unavailable')
      st.buffer = createMemoryStream()
      st.buffer.Size = 4096
      local ok, err = pcall(function()
        st.site, st.original = base + d.site, raceHex(d.original)
        assert(raceSame(raceRead(st, st.site, #st.original), st.original), 'Race math code differs from local EXE')
        st.mem = assert(allocateMemory(4096), 'Race math memory allocation failed')
        st.data = st.mem + d.dataOffset
        st.patch = raceBytes(string.char(0xFF, 0x25, 0, 0, 0, 0) .. string.pack('<I8', st.mem) .. string.rep(string.char(0x90), #st.original - 14))
        raceWrite(st, st.mem, raceHex(d.hex))
        local pointers = { base + 0x47e8e98, base + 0x4856670, base + 0x47f8238, base + 0x402a618, base + d.cookie, base + d.resume, base + 0x47e8e48, base + 0x47e8dfc }
        for i, ptr in ipairs(pointers) do
          raceWrite(st, st.data + 24 + (i - 1) * 8, raceBytes(string.pack('<I8', ptr)))
        end
        assert(raceCall(st, 'FlushInstructionCache', st.handle, st.mem, d.size) ~= 0)
      end)
      if not ok then
        if st.mem and not st.borrowed then deAlloc(st.mem, 4096) end
        raceCall(st, 'CloseHandle', st.handle)
        st.buffer.destroy()
        error(err, 0)
      end
      _G.WP26_MATH142 = st
    end
    assert(raceSame(raceRead(st, st.mem, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'Race math payload changed')
    local current = readInteger(st.data + 4) or 0
    raceWrite(st, st.data + 4, raceBytes(string.pack('<I4', current | mode)))
    if not st.active then racePatch(st, true) end
    return st
  end
  function WP26.stopRaceMath142()
    local st = _G.WP26_MATH142
    if st and st.active and raceAlive(st) then racePatch(st, false) end
    if st then st.active = false end
    return true
  end
  function WP26.refreshRaceMath142()
    local st = _G.WP26_MATH142
    if not st or st.pid ~= WP26.pid or not raceAlive(st) then return end
    local mode = 0
    local race = _G.WP26_RACE_CACHE
    local opponents = _G.WP26_OPPONENT_CACHE103
    if race and race.pid == st.pid and race.active then mode = mode | 1 end
    if opponents and opponents.pid == st.pid and opponents.active then mode = mode | 2 end
    if mode == 0 then
      WP26.stopRaceMath142()
    else
      raceWrite(st, st.data + 4, raceBytes(string.pack('<I4', mode)))
    end
  end
  local startBoost142, stopBoost142 = WP26.startRaceBoost, WP26.stopRaceBoost
  function WP26.startRaceBoost(...)
    WP26.startRaceMath142(1)
    local ok, result = pcall(startBoost142, ...)
    WP26.refreshRaceMath142()
    if not ok then error(result, 0) end
    return result
  end
  function WP26.stopRaceBoost(...)
    local result = stopBoost142(...)
    WP26.refreshRaceMath142()
    return result
  end
  local startOpponents142, stopOpponents142 = WP26.startOpponents103, WP26.stopOpponents103
  function WP26.startOpponents103(...)
    WP26.startRaceMath142(2)
    local ok, result = pcall(startOpponents142, ...)
    WP26.refreshRaceMath142()
    if not ok then error(result, 0) end
    return result
  end
  function WP26.stopOpponents103(...)
    local result = stopOpponents142(...)
    WP26.refreshRaceMath142()
    return result
  end

  end

  do
    local api = WP26
    local legacy = { table.unpack(api.OPPONENT_SPECS103) }
    api.OPPONENT_LEGACY147 = legacy
    api.OPPONENT_SPECS103 = { table.unpack(legacy) }
    api.OPPONENT_SPECS103[6] = {["kind"] = "activeTraitEffects", ["site"] = 637280, ["original"] = "48895c2408574883ec200fb7f9b800020000", ["hex"] = "4883ec28e8b8000000488d6424289c5051524150415141524153833dcf000000010f858d00000085c00f8e85000000488b442440483b05a50000007577488b05b40000004c8b104c3b15b20000007564458b42504183f802725a4183f81277548b5424684439c2734b450fb78c5248ba00004181f9851a00007339488b05860000004c8b184981fb0000010072264969c1e8000000418b54032481e2ff1f000083fa2e740f48c744243000000000ff0540000000415b415a415941585a59589dc348895c2408574883ec200fb7f9b800020000ff25370000000f1f80000000000100beba7856341237343150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000", ["dataOffset"] = 240, ["size"] = 280, ["relocations"] = {{["offset"] = 224, ["rva"] = 11346771}}}
    api.opponentIdentity147 = 147
    local inspect = api.inspectOpponentHooks
    function api.inspectOpponentHooks(base)
      local current = api.OPPONENT_SPECS103
      local ok, result = pcall(inspect, base)
      if ok then return result end
      api.OPPONENT_SPECS103 = legacy
      local compatible, old = pcall(inspect, base)
      api.OPPONENT_SPECS103 = current
      if compatible then return old end
      error(result, 0)
    end

  end

  WP26.previousValueChange = getAddressList().OnValueChange
  WP26.valueChangeHandler = function(sender, rec)
    if rec and rec.ID == 113 then
      local ok, err = pcall(WP26.refreshRaceTargets)
      if not ok then WP26.msg(tostring(err)); return true end
    end
    if WP26.previousValueChange then return WP26.previousValueChange(sender, rec) end
    return false
  end
  getAddressList().OnValueChange = WP26.valueChangeHandler

  do
    WP26.HISTORY154 = {["hex"] = "534883ec2089d383fb1273414489c2ff15b300000048c1e3044801d80fb6480c85c975258b5010c1fa1285d2791b4c8b4424284c3b0596000000740d4c3b0595000000740489d0eb0989c8eb05b8ffffffff4883c4205bc353564883ec2889d34489c683fb12734c4489caff155700000048c1e3044801d88b501081e2ffff030085f6791b81fe00e0ffff7c1b89f181e1ff3f0000c1e11209cac6400c00eb1181feff0000007605befe0000004088700c8950104883c4285e5bc30f1f4400005750485331353421000000000000000000000000000000000000000000000000", ["size"] = 224, ["dataOffset"] = 200, ["sites"] = {{["label"] = "historyRead", ["site"] = 1570000, ["offset"] = 0, ["original"] = "44894424188954241048894c24084883ec28"}, {["label"] = "historyWrite", ["site"] = 1570080, ["offset"] = 88, ["original"] = "44894c242044894424188954241048894c2408"}, {["label"] = "historyRecordCompare", ["site"] = 1587110, ["original"] = "77", ["patch"] = "7f", ["offset"] = 0}}, ["pointers"] = {2662560, 1400068, 1400392}, ["flagOffset"] = 3840}
    WP26.HISTORY_LEGACY156 = {["hex"] = "534883ec2089d383fb1273414489c2ff15b300000048c1e3044801d80fb6480c85c975258b5010c1fa1285d2791b4c8b4424284c3b0596000000740d4c3b0595000000740489d0eb0989c8eb05b8ffffffff4883c4205bc353564883ec2889d34489c683fb12734c4489caff155700000048c1e3044801d88b501081e2ffff030085f6791b81fe00e0ffff7c1b89f181e1ff3f0000c1e11209cac6400c00eb1181feff0000007605befe0000004088700c8950104883c4285e5bc30f1f4400005750485331353421000000000000000000000000000000000000000000000000", ["size"] = 224, ["dataOffset"] = 200, ["sites"] = {{["label"] = "historyRead", ["site"] = 1570000, ["offset"] = 0, ["original"] = "44894424188954241048894c24084883ec28"}, {["label"] = "historyWrite", ["site"] = 1570080, ["offset"] = 88, ["original"] = "44894c242044894424188954241048894c2408"}}, ["pointers"] = {2662560, 1400068, 1400392}}
    local function recoverHistory156(st, base)
      local d = WP26.HISTORY_LEGACY156
      local first = d.sites[1]
      local bytes = raceRead(st, base + first.site, #first.original // 2)
      if not bytes or bytes[1] ~= 0xff or bytes[2] ~= 0x25 then return false end
      local mem = readQword(base + first.site + 6) - first.offset
      if mem < 65536 or not raceSame(raceRead(st, mem, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))) then return false end
      local sites = {}
      for _, v in ipairs(d.sites) do
        local patch = raceBytes(string.char(0xff,0x25,0,0,0,0) .. string.pack('<I8',mem + v.offset) .. string.rep(string.char(0x90),#v.original // 2 - 14))
        assert(raceSame(raceRead(st,base + v.site,#patch),patch),'Legacy history hook mismatch')
        sites[#sites+1] = {site=base+v.site,original=raceHex(v.original),patch=patch}
      end
      local actual, expected = readQword(mem + d.dataOffset), base + d.pointers[1]
      if actual == expected then return false end
      assert(actual == expected or ((actual >> 32) == (expected >> 32) and (actual & 0xffffffff) <= 1),'Unknown legacy history pointer')
      for i=2,#d.pointers do assert(readQword(mem+d.dataOffset+(i-1)*8)==base+d.pointers[i],'Legacy history pointer mismatch')end
      local repair = {handle=st.handle,api=st.api,buffer=st.buffer,pid=st.pid,base=base,active=true,data=mem+0xf00,
        site=sites[1].site,original=sites[1].original,patch=sites[1].patch,rollSites={sites[2]},
        repairPointers156={{address=mem+d.dataOffset,value=expected}}}
      racePatch(repair,false)
      st.active = false
      return true
    end

    local function historyPatch157(v, mem)
      if v.patch then return raceHex(v.patch) end
      return raceBytes(string.char(0xFF,0x25,0,0,0,0) .. string.pack('<I8',mem + v.offset) .. string.rep(string.char(0x90),#v.original // 2 - 14))
    end
  function WP26.startHistorySupport154()
    WP26.require()
    local base = WP26.mod()
    local d = WP26.HISTORY154
    local st = _G.WP26_HISTORY154
    if st and (st.pid ~= WP26.pid or st.base ~= base or st.layout156 ~= 157 or not raceAlive(st)) then
      if st.handle then raceCall(st, 'CloseHandle', st.handle); st.handle = nil end
      if st.buffer then st.buffer.destroy(); st.buffer = nil end
      st = nil
      _G.WP26_HISTORY154 = nil
    end
    if not st then
      st = { pid = WP26.pid, base = base, api = {}, active = false, layout156 = 157 }
      for _, n in ipairs({ 'OpenProcess', 'CloseHandle', 'ReadProcessMemory', 'WriteProcessMemory', 'VirtualProtectEx', 'FlushInstructionCache', 'GetExitCodeProcess' }) do
        st.api[n] = assert(getAddressSafe('kernel32.' .. n, true), 'Local API unavailable: ' .. n)
      end
      for _, n in ipairs({ 'NtSuspendProcess', 'NtResumeProcess' }) do
        st.api[n] = assert(getAddressSafe('ntdll.' .. n, true), 'Local API unavailable: ' .. n)
      end
      st.handle = raceCall(st, 'OpenProcess', 0xC38, 0, st.pid)
      assert(st.handle and st.handle ~= 0, 'History process handle unavailable')
      st.buffer = createMemoryStream()
      st.buffer.Size = 4096
      local ok, err = pcall(function()
        local first = d.sites[1]
        recoverHistory156(st, base)
        local bytes = raceRead(st, base + first.site, #first.original // 2)
        if not raceSame(bytes, raceHex(first.original)) then
          assert(bytes and bytes[1] == 0xFF and bytes[2] == 0x25 and bytes[3] == 0 and bytes[4] == 0 and bytes[5] == 0 and bytes[6] == 0, 'Unknown history reader')
          local candidate = readQword(base + first.site + 6) - first.offset
          assert(candidate >= 65536 and raceSame(raceRead(st, candidate, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'Unknown history payload')
          for _, v in ipairs(d.sites) do
            local expected = historyPatch157(v, candidate)
            local actual = raceRead(st, base + v.site, #expected)
            if v.patch and raceSame(actual, raceHex(v.original)) then st.needsPatch157 = true
            else assert(raceSame(actual, expected), 'History hook mismatch: ' .. v.label) end
          end
          for i, rva in ipairs(d.pointers) do
            assert(readQword(candidate + d.dataOffset + (i - 1) * 8) == base + rva, 'History pointer mismatch')
          end
          st.mem, st.borrowed, st.active = candidate, true, true
        else
          for _, v in ipairs(d.sites) do
            assert(raceSame(raceRead(st, base + v.site, #v.original // 2), raceHex(v.original)), 'History code differs from local EXE: ' .. v.label)
          end
        end
        st.mem = st.mem or assert(allocateMemory(4096), 'History memory allocation failed')
        st.data = st.mem + d.flagOffset
        if not st.borrowed then
          raceWrite(st, st.mem, raceHex(d.hex))
          for i, rva in ipairs(d.pointers) do
            raceWrite(st, st.mem + d.dataOffset + (i - 1) * 8, raceBytes(string.pack('<I8', base + rva)))
          end
        end
        local sites = {}
        for _, v in ipairs(d.sites) do
          sites[#sites + 1] = {
            site = base + v.site,
            original = raceHex(v.original),
            patch = historyPatch157(v, st.mem),
          }
        end
        st.site, st.original, st.patch = sites[1].site, sites[1].original, sites[1].patch
        st.rollSites = {}
        for i = 2, #sites do st.rollSites[#st.rollSites + 1] = sites[i] end
        assert(raceCall(st, 'FlushInstructionCache', st.handle, st.mem, d.size) ~= 0)
      end)
      if not ok then
        if st.mem and not st.borrowed then deAlloc(st.mem, 4096) end
        raceCall(st, 'CloseHandle', st.handle)
        st.buffer.destroy()
        error(err, 0)
      end
      _G.WP26_HISTORY154 = st
    end
    assert(raceSame(raceRead(st, st.mem, d.dataOffset), raceHex(d.hex:sub(1, d.dataOffset * 2))), 'History payload changed')
    for i, rva in ipairs(d.pointers) do assert(readQword(st.mem + d.dataOffset + (i - 1) * 8) == base + rva, 'History pointer changed') end
    if st.needsPatch157 then racePatch(st, true); st.needsPatch157 = nil end
    if st.active then
      local installed = raceSame(raceRead(st, st.site, #st.patch), st.patch)
      for _, site in ipairs(st.rollSites) do
        installed = installed and raceSame(raceRead(st, site.site, #site.patch), site.patch)
      end
      assert(installed, 'History hooks changed after connection')
    else
      racePatch(st, true)
    end
    return st
  end

    function WP26.stopHistorySupport154()
      local st = _G.WP26_HISTORY154
      if not st or not st.active or st.borrowed then return true end
      if not raceAlive(st) then st.active = false; return true end
      racePatch(st, false)
      return true
    end
    local recordStart = WP26.startRecordSupport139
    function WP26.startRecordSupport139(...)
      local st = recordStart(...)
      WP26.startHistorySupport154()
      return st
    end
  end

  do
    local api = WP26
    function api.styleCombo153(combo)
      local index, text, style = combo.ItemIndex, combo.Text, tostring(combo.Style)
      combo.Style = (style == 'csDropDownList' or style == 'csOwnerDrawFixed') and 'csOwnerDrawFixed' or 'csOwnerDrawEditableFixed'
      combo.Color = 0x252525
      combo.Font.Color = 0xffffff
      local height = math.max(math.abs(combo.Font.Height), combo.Canvas.getTextHeight('蝗ｽAg')) + 6
      combo.ItemHeight = height
      combo.Height = height + 8
      sendMessage(combo.Handle, 0x153, 0, height)
      sendMessage(combo.Handle, 0x153, -1, height)
      combo.OnDrawItem = function(sender, item, rect, state)
        local canvas = sender.Canvas
        canvas.Font.Color = 0xffffff
        local flags = tostring(state)
        canvas.Brush.Color = (flags:find('odSelected', 1, true) or flags:find('odComboBoxEdit', 1, true)) and api.C_SELECTION or 0x252525
        canvas.fillRect(rect)
        if item >= 0 and item < sender.Items.Count then
          local text = sender.Items[item]
          local y = rect.Top + math.max(0, (rect.Bottom - rect.Top - canvas.getTextHeight(text)) // 2)
          canvas.textOut(rect.Left + 4, y, text)
        end
      end
      combo.ItemIndex = index
      if index == -1 then combo.Text = text end
    end
    function api.styleList155(view, state, firstColumn)
      local widths = {}
      view.OnCustomDraw = function(sender)
        if state.closed then return false end
        widths = {}
        for i = 0, sender.Columns.Count - 1 do widths[i + 1] = sender.Columns[i].Width end
        return true
      end
      view.OnCustomDrawItem = function(sender, item)
        if state.closed then return false end
        local row = state.shown[item.Index + 1]
        if not row then return false end
        local rect, canvas = item.displayRect('drBounds'), sender.Canvas
        canvas.Font.Color = 0xffffff
        canvas.Brush.Color = item.Selected and api.C_SELECTION or 0x252525
        canvas.fillRect(0, rect.Top, sender.ClientWidth, rect.Bottom)
        local x = rect.Left
        for i, width in ipairs(widths) do
          if x >= sender.ClientWidth then break end
          local column = state.columns[firstColumn + i - 1]
          if x + width > 0 and column then
            canvas.textRect({Left=x+6,Top=rect.Top,Right=x+width-6,Bottom=rect.Bottom}, x+6, rect.Top+2, row.display[column.key] or '')
          end
          x = x + width
        end
        return false
      end
    end
    local previous = api.valueChangeHandler
    api.valueChangeHandler = function(sender, rec)
      local handled = previous(sender, rec)
      api.valueDialogPending153 = not handled and rec and (rec.DropDownCount or 0) > 0
      return handled
    end
    getAddressList().OnValueChange = api.valueChangeHandler
    api.formNotice153 = registerFormAddNotification(function(form)
      if _G.WP26 ~= api or not api.valueDialogPending153 then return end
      if form.ClassName ~= 'TfrmMemrecCombobox' then return end
      api.valueDialogPending153 = false
      local timer = createTimer(form, false)
      local attempts = 0
      timer.Interval = 1
      timer.OnTimer = function(sender)
        attempts = attempts + 1
        local combo = form.findComponentByName('cbMemrecCombobox')
        if combo then
          sender.Enabled = false
          local ok, err = pcall(api.styleCombo153, combo)
          if not ok then print('[WP2026] ' .. tostring(err)) end
          sender.destroy()
        elseif attempts >= 20 then sender.destroy() end
      end
      timer.Enabled = true
    end)
  end

  do
    WP26.CLIMATE159 = {["hex"] = "83f90b732a83fa037325833d7700000001751cf705770000000100000074108b056700000083f80477054883c428c3ff15630000004883c428c383f90b733083fa03732b4183f8027325833d3700000001751cf705370000000200000074108b052b00000083f80377054883c438c3ff152b0000004883c438c3660f1f4400005750434c313539210000000000000000000000000000000000000000000000000000000000000000", ["size"] = 168, ["dataOffset"] = 136, ["pointerOffset"] = 152, ["pointers"] = {1259872, 1260544}, ["sites"] = {{["label"] = "weather", ["site"] = 1544415, ["offset"] = 0, ["original"] = "e87ca8fbff4883c428c3cccccccc"}, {["label"] = "ground", ["site"] = 1544521, ["offset"] = 58, ["original"] = "e8b2aafbff4883c438c3cccccccc"}}}
    local function climatePatch159(v, mem)
      return raceBytes(string.char(0xff,0x25,0,0,0,0) .. string.pack('<I8',mem+v.offset))
    end
    function WP26.bindClimate160(st)
      assert(st.pid==getOpenedProcessID(),'Climate binding process changed')
      local list=getAddressList()
      for _,v in ipairs({{171,4},{173,8}}) do
        local row=list.getMemoryRecordByID(v[1])
        if row then
          row.Address='WP2026Climate159+'..v[2]
          row.reinterpret()
          assert(row.CurrentAddress==st.data+v[2],'Climate configuration binding mismatch')
        end
      end
    end
    local function climateState159()
      WP26.require()
      assert(WP26.checkBuild(), 'Unsupported climate build')
      local base, d = WP26.mod(), WP26.CLIMATE159
      local st = _G.WP26_CLIMATE159
      if st and (st.pid ~= WP26.pid or st.base ~= base or not raceAlive(st)) then
        if st.active and raceAlive(st) then racePatch(st,false) end
        if st.handle then raceCall(st,'CloseHandle',st.handle) end
        if st.buffer then st.buffer.destroy() end
        st=nil; _G.WP26_CLIMATE159=nil
      end
      if not st then
        st={pid=WP26.pid,base=base,api={},active=false}
        for _,n in ipairs({'OpenProcess','CloseHandle','ReadProcessMemory','WriteProcessMemory','VirtualProtectEx','FlushInstructionCache','GetExitCodeProcess'}) do
          st.api[n]=assert(getAddressSafe('kernel32.'..n,true),'Local climate API unavailable: '..n)
        end
        for _,n in ipairs({'NtSuspendProcess','NtResumeProcess'}) do st.api[n]=assert(getAddressSafe('ntdll.'..n,true)) end
        st.handle=raceCall(st,'OpenProcess',0xC38,0,st.pid)
        assert(st.handle and st.handle~=0,'Climate process handle unavailable')
        st.buffer=createMemoryStream();st.buffer.Size=4096
        local ok,err=pcall(function()
          local first=d.sites[1]
          local bytes=raceRead(st,base+first.site,#first.original//2)
          if not raceSame(bytes,raceHex(first.original)) then
            assert(bytes and bytes[1]==0xff and bytes[2]==0x25 and bytes[3]==0 and bytes[4]==0 and bytes[5]==0 and bytes[6]==0,'Unknown climate hook')
            local candidate=readQword(base+first.site+6)-first.offset
            assert(candidate and candidate>=65536 and raceSame(raceRead(st,candidate,d.dataOffset),raceHex(d.hex:sub(1,d.dataOffset*2))),'Unknown climate payload')
            for _,v in ipairs(d.sites) do
              local patch=climatePatch159(v,candidate)
              assert(raceSame(raceRead(st,base+v.site,#patch),patch),'Climate hook mismatch: '..v.label)
            end
            for i,rva in ipairs(d.pointers) do assert(readQword(candidate+d.pointerOffset+(i-1)*8)==base+rva,'Climate pointer mismatch') end
            st.mem,st.borrowed,st.active=candidate,true,true
          else
            for _,v in ipairs(d.sites) do assert(raceSame(raceRead(st,base+v.site,#v.original//2),raceHex(v.original)),'Climate code differs from local EXE: '..v.label) end
          end
          st.mem=st.mem or assert(allocateMemory(4096),'Climate allocation failed')
          st.data=st.mem+d.dataOffset
          if not st.borrowed then
            raceWrite(st,st.mem,raceHex(d.hex))
            for i,rva in ipairs(d.pointers) do raceWrite(st,st.mem+d.pointerOffset+(i-1)*8,raceBytes(string.pack('<I8',base+rva))) end
          end
          local sites={}
          for _,v in ipairs(d.sites) do sites[#sites+1]={site=base+v.site,original=raceHex(v.original),patch=climatePatch159(v,st.mem)} end
          st.site,st.original,st.patch=sites[1].site,sites[1].original,sites[1].patch
          st.rollSites={sites[2]}
          assert(raceCall(st,'FlushInstructionCache',st.handle,st.mem,d.size)~=0)
        end)
        if not ok then
          if st.mem and not st.borrowed then deAlloc(st.mem,4096) end
          raceCall(st,'CloseHandle',st.handle);st.buffer.destroy();error(err,0)
        end
        _G.WP26_CLIMATE159=st
      end
      assert(raceSame(raceRead(st,st.mem,d.dataOffset),raceHex(d.hex:sub(1,d.dataOffset*2))),'Climate payload changed')
      for i,rva in ipairs(d.pointers) do assert(readQword(st.mem+d.pointerOffset+(i-1)*8)==base+rva,'Climate pointer changed') end
      for _,v in ipairs({{site=st.site,original=st.original,patch=st.patch},st.rollSites[1]}) do
        assert(raceSame(raceRead(st,v.site,#v.original),st.active and v.patch or v.original),'Climate code changed')
      end
      local address=getAddressSafe('WP2026Climate159')
      if address~=st.data then
        if address then unregisterSymbol('WP2026Climate159') end
        registerSymbol('WP2026Climate159',st.data,true)
      end
      WP26.bindClimate160(st)
      return st
    end
    local attach=WP26.disableAll
    function WP26.disableAll(...)
      local result=attach(...)
      if WP26.attached() then climateState159() end
      return result
    end
    function WP26.startClimate159(kind)
      assert(kind=='weather' or kind=='ground','Unknown climate option')
      local st=climateState159()
      local mask=assert(readInteger(st.data+12))
      assert(mask>=0 and mask<=3,'Invalid climate activation state')
      local nextMask=mask | (kind=='weather' and 1 or 2)
      raceWrite(st,st.data+12,raceBytes(string.pack('<I4',nextMask)))
      if not st.active then
        local ok,err=pcall(racePatch,st,true)
        if not ok then
          raceWrite(st,st.data+12,raceBytes(string.pack('<I4',mask)))
          local restored=raceSame(raceRead(st,st.site,#st.original),st.original)
          for _,v in ipairs(st.rollSites) do restored=restored and raceSame(raceRead(st,v.site,#v.original),v.original) end
          if restored then st.active=false end
          error(err,0)
        end
      end
      return st
    end
    function WP26.stopClimate159(kind)
      local st=_G.WP26_CLIMATE159
      if not st then return true end
      if not raceAlive(st) then st.active=false;return true end
      local mask=assert(readInteger(st.data+12))
      local nextMask=kind and (mask & ~(kind=='weather' and 1 or 2)) or 0
      if nextMask==0 and st.active then racePatch(st,false) end
      raceWrite(st,st.data+12,raceBytes(string.pack('<I4',nextMask)))
      return true
    end
    function WP26.enableClimate159(kind,rec)
      if not WP26.userRun(function()WP26.startClimate159(kind)end) and rec then rec.Active=false end
    end
    local apply=WP26.applyLang
    function WP26.applyLang(...)
      apply(...)
      local al=getAddressList()
      for _,v in ipairs({{171,{'Clear','Cloudy','Light rain','Rain','Snow'},{'晴れ','曇り','小雨','雨','雪'}},{173,{'Firm / Fast','Good','Yielding / Muddy','Soft / Sloppy'},{'良','稍重','重','不良'}}}) do
        local row=al.getMemoryRecordByID(v[1])
        if row then
          local names=WP26.lang=='ja' and v[3] or v[2];local lines={}
          for i,name in ipairs(names) do lines[#lines+1]=(i-1)..':'..name end
          row.DropDownList.Text=table.concat(lines,'\n')
        end
      end
    end
    WP26.NAMES[170]={'Lock weather for all races','全レースの天候を固定'}
    WP26.NAMES[171]={'Weather','天候'}
    WP26.NAMES[172]={'Lock going for all races','全レースの馬場状態を固定'}
    WP26.NAMES[173]={'Going','馬場状態'}
    WP26.applyLang()
  end

  do
    for _, key in ipairs({'jockey','trainer'}) do
      local fields, results = WP26.EDITORS[key].fields, {}
      for _, name in ipairs({'Current year: Wins','Current year: Second places','Current year: Third places','Current year: Other finishes'}) do
        for _, f in ipairs(fields) do if f.en == name then results[#results+1] = f; break end end
      end
      assert(#results == 4, 'Annual result fields unavailable')
      for _, v in ipairs({{'Current year: Starts','本年出走数','starts'},{'Current year: Win rate','本年勝率','win'},{'Current year: Top-two rate','本年連対率','topTwo'}}) do
        fields[#fields+1] = {en=v[1],ja=v[2],derived161=v[3],readOnly161=true,statFields161=results,off=0,bit=0,bits=32,max=v[3]=='starts' and 8188 or 1,groupEn='Annual results',groupJa='本年成績',source=key=='jockey' and 'EXE121C80;125820;9E8C1B-9E8C79' or 'EXE114F10;115260;9E8A32-9E8AA7'}
      end
    end
    local read, available, write, queue = WP26.fieldRead, WP26.fieldAvailable, WP26.writeField, WP26.queueFieldEdit
    function WP26.fieldAvailable(c,f)
      if f.derived161 then for _, source in ipairs(f.statFields161) do if not available(c,source) then return false end end; return true end
      return available(c,f)
    end
    function WP26.fieldRead(c,f)
      if not f.derived161 then return read(c,f) end
      local counts,total={},0
      for i,source in ipairs(f.statFields161) do counts[i]=read(c,source);total=total+counts[i] end
      if f.derived161=='starts' then return total end
      if total==0 then return 0 end
      local numerator=counts[1]+(f.derived161=='topTwo' and counts[2] or 0)
      return (numerator*1000//total)/1000
    end
    function WP26.writeField(c,f,...)
      if f.readOnly161 then return end
      return write(c,f,...)
    end
    function WP26.queueFieldEdit(info,value)
      if WP26.EDITORS[info.key].fields[info.index].readOnly161 then return end
      return queue(info,value)
    end
    local change=WP26.valueChangeHandler
    WP26.valueChangeHandler=function(sender,rec)
      local info=rec and WP26.valueRows[rec.ID]
      if info and WP26.EDITORS[info.key].fields[info.index].readOnly161 then return true end
      return change(sender,rec)
    end
    getAddressList().OnValueChange=WP26.valueChangeHandler
    local lists=WP26.EntityLists116
    local display,update=lists.display,lists.updateCells124
    function lists.display(s,f,value)
      if value~=nil and f.derived161 and f.derived161~='starts' then return string.format('%.3f',value) end
      return display(s,f,value)
    end
    function lists.updateCells124(s,row,changed)
      for _,f in ipairs(WP26.EDITORS[s.key].fields) do
        if f.derived161 then
          for _,source in ipairs(f.statFields161) do if changed[source.en] then changed[f.en]=true;break end end
        end
      end
      return update(s,row,changed)
    end
  end

  do
    local definitions={
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Star / blaze',
      ['ja']='星・流星',
      ['off']=0,
      ['bit']=20,
      ['bits']=6,
      ['base']='horse',
      ['max']=44,
      ['source']='Local EXE A7000/A7030; HAblData.ryuusei; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_ryuusei',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_ryuusei',
        ['setter']='parameter162Set_HAblData_ryuusei',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Height category',
      ['ja']='体高',
      ['off']=0,
      ['bit']=18,
      ['bits']=2,
      ['base']='horse',
      ['max']=2,
      ['source']='Local EXE A74A0/A74D0; HAblData.taikou; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_taikou',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_taikou',
        ['setter']='parameter162Set_HAblData_taikou',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Body length category',
      ['ja']='全長',
      ['off']=4,
      ['bit']=15,
      ['bits']=2,
      ['base']='horse',
      ['max']=2,
      ['source']='Local EXE A7510/A7540; HAblData.zenchou; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_zenchou',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_zenchou',
        ['setter']='parameter162Set_HAblData_zenchou',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Visible eye whites',
      ['ja']='三白眼',
      ['off']=4,
      ['bit']=23,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE A7650/A7680; HAblData.sanpakugan; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_sanpakugan',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_sanpakugan',
        ['setter']='parameter162Set_HAblData_sanpakugan',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Attention mark',
      ['ja']='注目馬フラグ',
      ['off']=8,
      ['bit']=18,
      ['bits']=3,
      ['base']='horse',
      ['max']=7,
      ['source']='Local EXE A7750/A7780; HAblData.tyumokuba; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_tyumokuba',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_tyumokuba',
        ['setter']='parameter162Set_HAblData_tyumokuba',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='World bloodline: sire',
      ['ja']='父に世界系統を持つかのフラグ',
      ['off']=4,
      ['bit']=27,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE A8B90/A8BC0; HAblData.sekaikeitou_flg1; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_sekaikeitou_flg1',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_sekaikeitou_flg1',
        ['setter']='parameter162Set_HAblData_sekaikeitou_flg1',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='World bloodline: damsire',
      ['ja']='母父に世界系統を持つかのフラグ',
      ['off']=4,
      ['bit']=28,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE A8C00/A8C30; HAblData.sekaikeitou_flg2; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_sekaikeitou_flg2',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_sekaikeitou_flg2',
        ['setter']='parameter162Set_HAblData_sekaikeitou_flg2',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='World bloodline: paternal granddams sire',
      ['ja']='父母父に世界系統を持つかのフラグ',
      ['off']=4,
      ['bit']=29,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE A8C70/A8CA0; HAblData.sekaikeitou_flg3; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_sekaikeitou_flg3',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_sekaikeitou_flg3',
        ['setter']='parameter162Set_HAblData_sekaikeitou_flg3',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='World bloodline: maternal granddams sire',
      ['ja']='母母父に世界系統を持つかのフラグ',
      ['off']=4,
      ['bit']=30,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE A8CE0/A8D10; HAblData.sekaikeitou_flg4; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_sekaikeitou_flg4',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_sekaikeitou_flg4',
        ['setter']='parameter162Set_HAblData_sekaikeitou_flg4',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Umasona 1 state A',
      ['ja']='ウマソナ1関連1',
      ['off']=24,
      ['bit']=8,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A8FA0; HAblData.umasona1_kanren1; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=true,
      ['parameter162']='HAblData_umasona1_kanren1'
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Umasona 1 state B',
      ['ja']='ウマソナ1関連2',
      ['off']=24,
      ['bit']=10,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A9020; HAblData.umasona1_kanren2; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=true,
      ['parameter162']='HAblData_umasona1_kanren2'
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Boom horse mark',
      ['ja']='ブームを起こした馬マーク',
      ['off']=4,
      ['bit']=31,
      ['bits']=1,
      ['base']='horse',
      ['max']=1,
      ['source']='Local EXE AA4D0/AA500; HAblData.boom_mark; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_boom_mark',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_boom_mark',
        ['setter']='parameter162Set_HAblData_boom_mark',
        ['id']='horseID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Racehorse region',
      ['ja']='地域',
      ['off']=24,
      ['bit']=3,
      ['bits']=2,
      ['base']='race',
      ['max']=3,
      ['source']='Local EXE B7C40/B7CB0; HRaceData.area; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_area'
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Watch race',
      ['ja']='観戦',
      ['off']=12,
      ['bit']=31,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['source']='Local EXE BB490/BB510; HRaceData.kansen; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_kansen',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_kansen',
        ['setter']='parameter162Set_HRaceData_kansen',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='SSH flag',
      ['ja']='SSHフラグ',
      ['off']=28,
      ['bit']=28,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['source']='Local EXE BB690/BB710; HRaceData.SSH_flg; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_SSH_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Regional registration',
      ['ja']='地方馬フラグ',
      ['off']=24,
      ['bit']=31,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['source']='Local EXE BB790/BB810; HRaceData.maruchihou; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_maruchihou',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Overseas travel history',
      ['ja']='海外遠征済みフラグ',
      ['off']=4,
      ['bit']=31,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['source']='Local EXE BEDD0/BEE40; HRaceData.kaigaiensei; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_kaigaiensei',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_kaigaiensei',
        ['setter']='parameter162Set_HRaceData_kaigaiensei',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Race sharpness',
      ['ja']='レース勘',
      ['off']=12,
      ['bit']=24,
      ['bits']=7,
      ['base']='race',
      ['max']=100,
      ['source']='Local EXE BF480/BF4F0; HRaceData.race_kan; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_race_kan',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_race_kan',
        ['setter']='parameter162Set_HRaceData_race_kan',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Class value',
      ['ja']='クラス',
      ['off']=16,
      ['bit']=15,
      ['bits']=3,
      ['base']='race',
      ['max']=7,
      ['source']='Local EXE BFE70/BFF10; HRaceData.klass; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_klass',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_klass',
        ['setter']='parameter162Set_HRaceData_klass',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Pasture duration (weeks)',
      ['ja']='何週間放牧',
      ['off']=16,
      ['bit']=7,
      ['bits']=6,
      ['base']='race',
      ['max']=52,
      ['source']='Local EXE C0900/C0980; HRaceData.houboku_len; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_houboku_len',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_houboku_len',
        ['setter']='parameter162Set_HRaceData_houboku_len',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Pasture state',
      ['ja']='放牧状態値',
      ['off']=8,
      ['bit']=11,
      ['bits']=5,
      ['base']='race',
      ['max']=20,
      ['source']='Local EXE C0CA0/C0D20; HRaceData.houbokuchuu; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_houbokuchuu',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_houbokuchuu',
        ['setter']='parameter162Set_HRaceData_houbokuchuu',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Travel destination',
      ['ja']='遠征先',
      ['off']=40,
      ['bit']=19,
      ['bits']=3,
      ['base']='race',
      ['max']=7,
      ['source']='Local EXE C0DA0/C0EC0; HRaceData.ensei; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_ensei',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_ensei',
        ['setter']='parameter162Set_HRaceData_ensei',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Retirement state',
      ['ja']='引退状態',
      ['off']=20,
      ['bit']=4,
      ['bits']=2,
      ['base']='race',
      ['max']=3,
      ['source']='Local EXE C1430; HRaceData.intai; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_intai'
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Stable admission state',
      ['ja']='入厩済み',
      ['off']=28,
      ['bit']=31,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['source']='Local EXE C1850/C18C0; HRaceData.nyuukyuu; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_nyuukyuu',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Base prize money',
      ['ja']='本賞金',
      ['off']=28,
      ['bit']=0,
      ['bits']=24,
      ['base']='race',
      ['max']=16777215,
      ['source']='Local EXE C4180; HRaceData.earning_hon; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_earning_hon'
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Career G1 wins',
      ['ja']='G1勝ち数',
      ['off']=32,
      ['bit']=24,
      ['bits']=8,
      ['base']='race',
      ['max']=255,
      ['source']='Local EXE C7310/C73B0; HRaceData.g1_win_count; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_g1_win_count',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_g1_win_count',
        ['setter']='parameter162Set_HRaceData_g1_win_count',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Owner',
      ['ja']='オーナー',
      ['off']=36,
      ['bit']=0,
      ['bits']=13,
      ['base']='race',
      ['max']=8191,
      ['source']='Local EXE C7AF0; HRaceData.owner; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_owner',
      ['string']=true,
      ['customSize079']=4,
      ['entityLabel162']='owner'
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Epithet',
      ['ja']='異名',
      ['off']=164,
      ['bit']=0,
      ['bits']=11,
      ['base']='race',
      ['max']=2047,
      ['source']='Local EXE D0210/D02B0; HRaceData.imyou; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=false,
      ['parameter162']='HRaceData_imyou',
      ['choices']={
        {
          ['id']=0,
          ['name']='皇帝ノ子'
        },
        {
          ['id']=1,
          ['name']='皇帝カラ、帝王ヘ'
        },
        {
          ['id']=2,
          ['name']='3冠ノ末脚、再ビ'
        },
        {
          ['id']=3,
          ['name']='期待ノ良血'
        },
        {
          ['id']=4,
          ['name']='グランプリホース'
        },
        {
          ['id']=5,
          ['name']='盾ノ覇者'
        },
        {
          ['id']=6,
          ['name']='無冠ノ貴公子'
        },
        {
          ['id']=7,
          ['name']='期待ノホープ'
        },
        {
          ['id']=8,
          ['name']='2歳チャンピオン'
        },
        {
          ['id']=9,
          ['name']='実力馬'
        },
        {
          ['id']=10,
          ['name']='充実一途'
        },
        {
          ['id']=11,
          ['name']='本格化'
        },
        {
          ['id']=12,
          ['name']='一角崩シ'
        },
        {
          ['id']=13,
          ['name']='伏兵'
        },
        {
          ['id']=14,
          ['name']='惑星'
        },
        {
          ['id']=15,
          ['name']='虎視眈々'
        },
        {
          ['id']=16,
          ['name']='重戦車'
        },
        {
          ['id']=17,
          ['name']='女帝'
        },
        {
          ['id']=18,
          ['name']='日本総大将'
        },
        {
          ['id']=19,
          ['name']='古豪'
        },
        {
          ['id']=20,
          ['name']='年度代表馬'
        },
        {
          ['id']=21,
          ['name']='イザ3冠ヘ'
        },
        {
          ['id']=22,
          ['name']='無敗ノ3冠馬'
        },
        {
          ['id']=23,
          ['name']='無敗ノ2冠馬'
        },
        {
          ['id']=24,
          ['name']='無敗ノ快速馬'
        },
        {
          ['id']=25,
          ['name']='不敗神話'
        },
        {
          ['id']=26,
          ['name']='香港GIノ覇者'
        },
        {
          ['id']=27,
          ['name']='英雄'
        },
        {
          ['id']=28,
          ['name']='ダービー馬'
        },
        {
          ['id']=29,
          ['name']='2歳女王'
        },
        {
          ['id']=30,
          ['name']='樫ノ女王'
        },
        {
          ['id']=31,
          ['name']='砂ノ女王'
        },
        {
          ['id']=32,
          ['name']='影ナキ逃亡者'
        },
        {
          ['id']=33,
          ['name']='シャドーロールノ怪物'
        },
        {
          ['id']=34,
          ['name']='華麗ナル一族'
        },
        {
          ['id']=35,
          ['name']='若キジョッキーノ相棒'
        },
        {
          ['id']=36,
          ['name']='ターフノ名優'
        },
        {
          ['id']=37,
          ['name']='雑草魂'
        },
        {
          ['id']=38,
          ['name']='聖剣ノ切レ味'
        },
        {
          ['id']=39,
          ['name']='悲願ノGI制覇ヘ'
        },
        {
          ['id']=40,
          ['name']='ブロンズコレクター'
        },
        {
          ['id']=41,
          ['name']='芦毛ノアイドルホース'
        },
        {
          ['id']=42,
          ['name']='貴婦人'
        },
        {
          ['id']=43,
          ['name']='驚異ノ末脚'
        },
        {
          ['id']=44,
          ['name']='超特急'
        },
        {
          ['id']=45,
          ['name']='絶対王者'
        },
        {
          ['id']=46,
          ['name']='ドバイノ覇者'
        },
        {
          ['id']=47,
          ['name']='欧州王者'
        },
        {
          ['id']=48,
          ['name']='北米王者'
        },
        {
          ['id']=49,
          ['name']='海外カラノ刺客'
        },
        {
          ['id']=50,
          ['name']='連覇ナルカ'
        },
        {
          ['id']=51,
          ['name']='レース巧者'
        },
        {
          ['id']=52,
          ['name']='地ノ果テマデモ'
        },
        {
          ['id']=53,
          ['name']='近代競馬ノ結晶'
        },
        {
          ['id']=54,
          ['name']='未完ノ大器'
        },
        {
          ['id']=55,
          ['name']='2ツメノ戴冠ヘ'
        },
        {
          ['id']=56,
          ['name']='3歳代表'
        },
        {
          ['id']=57,
          ['name']='3冠馬'
        },
        {
          ['id']=58,
          ['name']='5冠馬'
        },
        {
          ['id']=59,
          ['name']='7冠馬'
        },
        {
          ['id']=60,
          ['name']='北米3冠'
        },
        {
          ['id']=61,
          ['name']='欧州3冠'
        },
        {
          ['id']=62,
          ['name']='牝馬3冠'
        },
        {
          ['id']=63,
          ['name']='最速ノ証明'
        },
        {
          ['id']=64,
          ['name']='連戦連勝'
        },
        {
          ['id']=65,
          ['name']='ミンナノ夢ヲ乗セテ'
        },
        {
          ['id']=66,
          ['name']='異端ノ血統'
        },
        {
          ['id']=67,
          ['name']='年間無敗'
        },
        {
          ['id']=68,
          ['name']='スカーレット一族'
        },
        {
          ['id']=69,
          ['name']='父子3代制覇ヘ'
        },
        {
          ['id']=70,
          ['name']='父子制覇ヘ'
        },
        {
          ['id']=71,
          ['name']='オールラウンダー'
        },
        {
          ['id']=72,
          ['name']='底知レヌ実力'
        },
        {
          ['id']=73,
          ['name']='黄金ノ末脚'
        },
        {
          ['id']=74,
          ['name']='大駆ケ再ビ'
        },
        {
          ['id']=75,
          ['name']='未知ナル栗毛'
        },
        {
          ['id']=76,
          ['name']='人気不要'
        },
        {
          ['id']=77,
          ['name']='密林ノ王者'
        },
        {
          ['id']=78,
          ['name']='光速ノ貴公子'
        },
        {
          ['id']=79,
          ['name']='最強ノ大王'
        },
        {
          ['id']=80,
          ['name']='府中ノ女王'
        },
        {
          ['id']=81,
          ['name']='真紅ノ女王'
        },
        {
          ['id']=82,
          ['name']='スピードスター'
        },
        {
          ['id']=83,
          ['name']='信ズル乙女'
        },
        {
          ['id']=84,
          ['name']='淀ノ昇リ龍'
        },
        {
          ['id']=85,
          ['name']='白イ逃亡者'
        },
        {
          ['id']=86,
          ['name']='豪脚一閃'
        },
        {
          ['id']=87,
          ['name']='シルバーコレクター'
        },
        {
          ['id']=88,
          ['name']='地方ノ星'
        },
        {
          ['id']=89,
          ['name']='人馬一体'
        },
        {
          ['id']=90,
          ['name']='遅咲キノステイヤー'
        },
        {
          ['id']=91,
          ['name']='変幻自在'
        },
        {
          ['id']=92,
          ['name']='雪辱ヲ期ス王者'
        },
        {
          ['id']=93,
          ['name']='三度目ノ正直'
        },
        {
          ['id']=94,
          ['name']='コノ夏最大ノ上ガリ馬'
        },
        {
          ['id']=95,
          ['name']='名伯楽ノ悲願'
        },
        {
          ['id']=96,
          ['name']='皇帝'
        },
        {
          ['id']=97,
          ['name']='稀代ノアイドルホース'
        },
        {
          ['id']=98,
          ['name']='風神'
        },
        {
          ['id']=99,
          ['name']='駆ケ抜ケルソヨ風'
        },
        {
          ['id']=100,
          ['name']='黒イ刺客'
        },
        {
          ['id']=101,
          ['name']='電撃ノ驀進王'
        },
        {
          ['id']=102,
          ['name']='雷帝'
        },
        {
          ['id']=103,
          ['name']='一等星'
        },
        {
          ['id']=104,
          ['name']='トップガンノ軌跡'
        },
        {
          ['id']=105,
          ['name']='音速ノ貴公子'
        },
        {
          ['id']=106,
          ['name']='ワンダーホース'
        },
        {
          ['id']=107,
          ['name']='ベストサイアーノ結晶'
        },
        {
          ['id']=108,
          ['name']='ターフヲ舞ウ怪鳥'
        },
        {
          ['id']=109,
          ['name']='気品漂ウ胡蝶蘭'
        },
        {
          ['id']=110,
          ['name']='不世出ノ歌劇王'
        },
        {
          ['id']=111,
          ['name']='黒船来航'
        },
        {
          ['id']=112,
          ['name']='大海ニ映エル蜃気楼'
        },
        {
          ['id']=113,
          ['name']='摩天楼ノ幻影'
        },
        {
          ['id']=114,
          ['name']='熱狂ヲ導ク王者'
        },
        {
          ['id']=115,
          ['name']='龍王'
        },
        {
          ['id']=116,
          ['name']='超良血'
        },
        {
          ['id']=117,
          ['name']='世界的良血'
        },
        {
          ['id']=118,
          ['name']='道悪ノ鬼'
        },
        {
          ['id']=119,
          ['name']='天才少年'
        },
        {
          ['id']=120,
          ['name']='天才少女'
        },
        {
          ['id']=121,
          ['name']='野武士'
        },
        {
          ['id']=122,
          ['name']='地方カラノ挑戦者'
        },
        {
          ['id']=123,
          ['name']='二段エンジン'
        },
        {
          ['id']=124,
          ['name']='ロケットスタート'
        },
        {
          ['id']=125,
          ['name']='交流重賞ハンター'
        },
        {
          ['id']=126,
          ['name']='砂ノ王者'
        },
        {
          ['id']=127,
          ['name']='砂ノ新星'
        },
        {
          ['id']=128,
          ['name']='終イ確実'
        },
        {
          ['id']=129,
          ['name']='坂路ノ申シ子'
        },
        {
          ['id']=130,
          ['name']='黄金旅程'
        },
        {
          ['id']=131,
          ['name']='鉄ノ女'
        },
        {
          ['id']=132,
          ['name']='無事是名馬'
        },
        {
          ['id']=133,
          ['name']='リトルヒーロー'
        },
        {
          ['id']=134,
          ['name']='躍動スル小兵'
        },
        {
          ['id']=135,
          ['name']='生粋ノスプリンター'
        },
        {
          ['id']=136,
          ['name']='横綱級ノ大物'
        },
        {
          ['id']=137,
          ['name']='砂漠ノ金狼'
        },
        {
          ['id']=138,
          ['name']='バラノ一族'
        },
        {
          ['id']=139,
          ['name']='第三ノ舞台ヘ'
        },
        {
          ['id']=140,
          ['name']='ターフノ恋物語'
        },
        {
          ['id']=141,
          ['name']='明日ヘノ逃避行'
        },
        {
          ['id']=142,
          ['name']='弾丸シュート'
        },
        {
          ['id']=143,
          ['name']='新タナル芦毛伝説'
        },
        {
          ['id']=144,
          ['name']='アット驚ク'
        },
        {
          ['id']=145,
          ['name']='太陽王'
        },
        {
          ['id']=146,
          ['name']='真紅ノ勝利者'
        },
        {
          ['id']=147,
          ['name']='猫、子猫、寝転ガル'
        },
        {
          ['id']=148,
          ['name']='目覚メシ晩成血統'
        },
        {
          ['id']=149,
          ['name']='勇躍スル青鹿毛'
        },
        {
          ['id']=150,
          ['name']='雷光ノ差シ脚'
        },
        {
          ['id']=151,
          ['name']='高嶺ノ花'
        },
        {
          ['id']=152,
          ['name']='黒鉄ノ王者'
        },
        {
          ['id']=153,
          ['name']='ゴールヲ照ラス道標'
        },
        {
          ['id']=154,
          ['name']='破顔一勝'
        },
        {
          ['id']=155,
          ['name']='月夜ヲ切リ裂ク嵐'
        },
        {
          ['id']=156,
          ['name']='不屈ノ男'
        },
        {
          ['id']=157,
          ['name']='運命ノ引キ金'
        },
        {
          ['id']=158,
          ['name']='不可視ナル旋風'
        },
        {
          ['id']=159,
          ['name']='流星ノ貴公子'
        },
        {
          ['id']=160,
          ['name']='ニューヒロイン'
        },
        {
          ['id']=161,
          ['name']='桜ノ女王'
        },
        {
          ['id']=162,
          ['name']='秋ノ新星'
        },
        {
          ['id']=163,
          ['name']='サマースプリント制覇'
        },
        {
          ['id']=164,
          ['name']='サマーマイルチャンプ'
        },
        {
          ['id']=165,
          ['name']='サマー2000ノ覇者'
        },
        {
          ['id']=166,
          ['name']='ベテラン牝馬'
        },
        {
          ['id']=167,
          ['name']='ヒタムキナ、ソノ走リ'
        },
        {
          ['id']=168,
          ['name']='ダートスプリンター'
        },
        {
          ['id']=169,
          ['name']='鋼ノ心臓'
        },
        {
          ['id']=170,
          ['name']='世界ガ認メタソノ強サ'
        },
        {
          ['id']=171,
          ['name']='イブシ銀ノ輝キ'
        },
        {
          ['id']=172,
          ['name']='小倉ノ鬼'
        },
        {
          ['id']=173,
          ['name']='中京巧者'
        },
        {
          ['id']=174,
          ['name']='筋骨隆々'
        },
        {
          ['id']=175,
          ['name']='女王ノ貫禄'
        },
        {
          ['id']=176,
          ['name']='歴史的名牝'
        },
        {
          ['id']=177,
          ['name']='強ク、速ク、美シク'
        },
        {
          ['id']=178,
          ['name']='破天荒伝説'
        },
        {
          ['id']=179,
          ['name']='新時代到来'
        },
        {
          ['id']=180,
          ['name']='マバユイ輝キ'
        },
        {
          ['id']=181,
          ['name']='受ケ継ギシ熱イ鼓動'
        },
        {
          ['id']=182,
          ['name']='獅子心王'
        },
        {
          ['id']=183,
          ['name']='思イヲ胸ニ'
        },
        {
          ['id']=184,
          ['name']='ツカミトル栄冠'
        },
        {
          ['id']=185,
          ['name']='世界ノマイル王'
        },
        {
          ['id']=186,
          ['name']='大地舞ウ、深紅ノ翼'
        },
        {
          ['id']=187,
          ['name']='絶景ノ頂ヘ'
        },
        {
          ['id']=188,
          ['name']='王者ヘノ道程'
        },
        {
          ['id']=189,
          ['name']='父ヨリ継ギシ夢'
        },
        {
          ['id']=190,
          ['name']='栄光ノ方角ヘ'
        },
        {
          ['id']=191,
          ['name']='抜山蓋世'
        },
        {
          ['id']=192,
          ['name']='ソノ名ハ希望'
        },
        {
          ['id']=193,
          ['name']='限界ヲ超越セヨ'
        },
        {
          ['id']=194,
          ['name']='雷神'
        },
        {
          ['id']=195,
          ['name']='頑張ルオ馬サン'
        },
        {
          ['id']=196,
          ['name']='先代女王ノ意地'
        },
        {
          ['id']=197,
          ['name']='シンデレラストーリー'
        },
        {
          ['id']=198,
          ['name']='GIホース'
        },
        {
          ['id']=199,
          ['name']='主役ノ座ハ渡サナイ'
        },
        {
          ['id']=200,
          ['name']='地力十分'
        },
        {
          ['id']=201,
          ['name']='実績上位'
        },
        {
          ['id']=202,
          ['name']='強豪'
        },
        {
          ['id']=203,
          ['name']='主役候補'
        },
        {
          ['id']=204,
          ['name']='一線級'
        },
        {
          ['id']=205,
          ['name']='素質馬'
        },
        {
          ['id']=206,
          ['name']='ワガ道ヲ行ク'
        },
        {
          ['id']=207,
          ['name']='勝負気配'
        },
        {
          ['id']=208,
          ['name']='注目ノ一頭'
        },
        {
          ['id']=209,
          ['name']='好位抜ケ出シ'
        },
        {
          ['id']=210,
          ['name']='直線一気'
        },
        {
          ['id']=211,
          ['name']='上昇ムード'
        },
        {
          ['id']=212,
          ['name']='安定ノレース運ビ'
        },
        {
          ['id']=213,
          ['name']='雄大ナ馬格'
        },
        {
          ['id']=214,
          ['name']='弾ムヨウナステップ'
        },
        {
          ['id']=215,
          ['name']='小サナ巨人'
        },
        {
          ['id']=216,
          ['name']='太陽ノ王子'
        },
        {
          ['id']=217,
          ['name']='第三ノ男'
        },
        {
          ['id']=218,
          ['name']='新聞ヲ読ム馬'
        },
        {
          ['id']=219,
          ['name']='オ祭リ男'
        },
        {
          ['id']=220,
          ['name']='オ祭リ女'
        },
        {
          ['id']=221,
          ['name']='レコードブレイカー'
        },
        {
          ['id']=222,
          ['name']='マイルノ皇帝'
        },
        {
          ['id']=223,
          ['name']='走ル労働者'
        },
        {
          ['id']=224,
          ['name']='アイアンホース'
        },
        {
          ['id']=225,
          ['name']='走ル精密機械'
        },
        {
          ['id']=226,
          ['name']='無敗ノ2冠牝馬'
        },
        {
          ['id']=227,
          ['name']='無敗ノ3冠牝馬'
        },
        {
          ['id']=228,
          ['name']='2ツメノ花束ヲ'
        },
        {
          ['id']=229,
          ['name']='リトルプリンセス'
        },
        {
          ['id']=230,
          ['name']='星ニ祈ル乙女'
        },
        {
          ['id']=231,
          ['name']='偉大ナル母ヲ越エテ'
        },
        {
          ['id']=232,
          ['name']='勝チ気ナ少女'
        },
        {
          ['id']=233,
          ['name']='月下ノ旅人'
        },
        {
          ['id']=234,
          ['name']='王ノ中ノ王'
        },
        {
          ['id']=235,
          ['name']='吹キ抜ケル風ノヨウニ'
        },
        {
          ['id']=236,
          ['name']='超爆発'
        },
        {
          ['id']=237,
          ['name']='熱波ノ砂嵐'
        },
        {
          ['id']=238,
          ['name']='走ル数学者'
        },
        {
          ['id']=239,
          ['name']='小サナ巨人'
        },
        {
          ['id']=240,
          ['name']='欧州ノ統治者'
        },
        {
          ['id']=241,
          ['name']='スピードアクター'
        },
        {
          ['id']=242,
          ['name']='侵略者'
        },
        {
          ['id']=243,
          ['name']='豪州無双'
        },
        {
          ['id']=244,
          ['name']='時ヲ超エタ美'
        },
        {
          ['id']=245,
          ['name']='砂上ノ宝石'
        },
        {
          ['id']=246,
          ['name']='稀代ノ大逃走'
        },
        {
          ['id']=247,
          ['name']='偉大ナル血ノ後継者'
        },
        {
          ['id']=248,
          ['name']='晴天ノ霹靂'
        },
        {
          ['id']=249,
          ['name']='光輝ク白イ星'
        },
        {
          ['id']=250,
          ['name']='ターフノ調香師'
        },
        {
          ['id']=251,
          ['name']='一世一代ノ大駆ケ'
        },
        {
          ['id']=252,
          ['name']='勇敢ナル闘士'
        },
        {
          ['id']=253,
          ['name']='白星量産'
        },
        {
          ['id']=254,
          ['name']='未知ナル一番星'
        },
        {
          ['id']=255,
          ['name']='奇跡ノ弾丸'
        },
        {
          ['id']=256,
          ['name']='光ノ射ス方ヘ'
        },
        {
          ['id']=257,
          ['name']='世界ガ見上ゲタ月'
        },
        {
          ['id']=258,
          ['name']='菊ノ才媛'
        },
        {
          ['id']=259,
          ['name']='白馬ノ王子'
        },
        {
          ['id']=260,
          ['name']='日曜ノトップアイドル'
        },
        {
          ['id']=261,
          ['name']='砂塵快速超特急'
        },
        {
          ['id']=262,
          ['name']='真・トリプルティアラ'
        },
        {
          ['id']=263,
          ['name']='漆黒ノ帝王'
        },
        {
          ['id']=264,
          ['name']='無欠ノ輝キ'
        },
        {
          ['id']=265,
          ['name']='ガラス細工ノ幻獣'
        },
        {
          ['id']=266,
          ['name']='月下美人'
        },
        {
          ['id']=267,
          ['name']='地方ノ夢ノ結晶'
        },
        {
          ['id']=268,
          ['name']='退クコトナキ挑戦者'
        },
        {
          ['id']=269,
          ['name']='アークライト'
        },
        {
          ['id']=270,
          ['name']='地方競馬ノ底力'
        },
        {
          ['id']=271,
          ['name']='記念ノ結晶'
        },
        {
          ['id']=272,
          ['name']='ベストトゥベスト'
        },
        {
          ['id']=273,
          ['name']='驚キノ結末'
        },
        {
          ['id']=274,
          ['name']='アラビアンナイト'
        },
        {
          ['id']=275,
          ['name']='長距離ニ君臨スル暴君'
        },
        {
          ['id']=276,
          ['name']='黒イ戦士'
        },
        {
          ['id']=277,
          ['name']='最強世代後継者'
        },
        {
          ['id']=278,
          ['name']='泥ノスイマー'
        },
        {
          ['id']=279,
          ['name']='奇跡ノ血筋'
        },
        {
          ['id']=280,
          ['name']='砂ノ破壊王'
        },
        {
          ['id']=281,
          ['name']='日本刀ノキレ味'
        },
        {
          ['id']=282,
          ['name']='異次元ラップ'
        },
        {
          ['id']=283,
          ['name']='金色ノ飛翔馬'
        },
        {
          ['id']=284,
          ['name']='王ヲ継グモノ'
        },
        {
          ['id']=285,
          ['name']='スーパースター'
        },
        {
          ['id']=286,
          ['name']='神威、示サン'
        },
        {
          ['id']=287,
          ['name']='響ケ、勝利ノ歌声'
        },
        {
          ['id']=288,
          ['name']='気高ク、勇マシク'
        },
        {
          ['id']=289,
          ['name']='雄々シキ突風'
        },
        {
          ['id']=290,
          ['name']='祝祭ノ時、来タル'
        },
        {
          ['id']=291,
          ['name']='大歓声ノサナカヘ'
        },
        {
          ['id']=292,
          ['name']='アナタヘト捧グ勝利'
        },
        {
          ['id']=293,
          ['name']='気高キ百合ノ如ク'
        },
        {
          ['id']=294,
          ['name']='ファンタジックラン'
        },
        {
          ['id']=295,
          ['name']='幸セノ花ヲ咲カセテ'
        },
        {
          ['id']=296,
          ['name']='夢ハ終ワラナイ'
        },
        {
          ['id']=297,
          ['name']='鋭イ一突キ'
        },
        {
          ['id']=298,
          ['name']='枯レヌ闘争心'
        },
        {
          ['id']=299,
          ['name']='火ノ玉マーズ'
        },
        {
          ['id']=300,
          ['name']='新タナル黄金時代ヘ'
        },
        {
          ['id']=301,
          ['name']='最高級ノキラメキヲ'
        },
        {
          ['id']=302,
          ['name']='孝行娘ノ創世記'
        },
        {
          ['id']=303,
          ['name']='戴クハ金色ノ王冠'
        },
        {
          ['id']=304,
          ['name']='愛ノ逃避行'
        },
        {
          ['id']=305,
          ['name']='心震ワス大覚醒'
        },
        {
          ['id']=306,
          ['name']='勝利ヲ奪ウ義賊ガ如ク'
        },
        {
          ['id']=307,
          ['name']='刻メ、華麗ナリズム'
        },
        {
          ['id']=308,
          ['name']='不屈ノエリート'
        },
        {
          ['id']=309,
          ['name']='王者ノ風格'
        },
        {
          ['id']=310,
          ['name']='女王ノ貫禄'
        },
        {
          ['id']=311,
          ['name']='遅レテキタ大物'
        },
        {
          ['id']=312,
          ['name']='ド迫力ノ大流星'
        },
        {
          ['id']=313,
          ['name']='確カナ先行力'
        },
        {
          ['id']=314,
          ['name']='世代屈指ノ末脚'
        },
        {
          ['id']=315,
          ['name']='決メ手上位'
        },
        {
          ['id']=316,
          ['name']='スタミナオ化ケ'
        },
        {
          ['id']=317,
          ['name']='トリックスター'
        },
        {
          ['id']=318,
          ['name']='ターフノスナイパー'
        },
        {
          ['id']=319,
          ['name']='小サナ魔術師'
        },
        {
          ['id']=320,
          ['name']='眠レル獅子'
        },
        {
          ['id']=321,
          ['name']='闘将'
        },
        {
          ['id']=322,
          ['name']='砂上ノ勝負師'
        },
        {
          ['id']=323,
          ['name']='怪童'
        },
        {
          ['id']=324,
          ['name']='歴戦ノ強者'
        },
        {
          ['id']=325,
          ['name']='金髪少年'
        },
        {
          ['id']=326,
          ['name']='金髪少女'
        },
        {
          ['id']=327,
          ['name']='赤兎馬ノ再来'
        },
        {
          ['id']=328,
          ['name']='赤鬼'
        },
        {
          ['id']=329,
          ['name']='一発逆転'
        },
        {
          ['id']=330,
          ['name']='鉄板ホース'
        },
        {
          ['id']=331,
          ['name']='ビクトリーロード'
        },
        {
          ['id']=332,
          ['name']='スピード満点'
        },
        {
          ['id']=333,
          ['name']='先行押シ切リ'
        },
        {
          ['id']=334,
          ['name']='苦難ヲ乗リ越エル勇者'
        },
        {
          ['id']=335,
          ['name']='優雅ニ舞ウ才媛'
        },
        {
          ['id']=336,
          ['name']='世界ヲ変エル疾走'
        },
        {
          ['id']=337,
          ['name']='神童'
        },
        {
          ['id']=338,
          ['name']='立チハダカル魔王'
        },
        {
          ['id']=339,
          ['name']='イタリアンドリーム'
        },
        {
          ['id']=340,
          ['name']='気高キマドンナ'
        },
        {
          ['id']=341,
          ['name']='ミス・パーフェクト'
        },
        {
          ['id']=342,
          ['name']='3冠ノ血ノ証明'
        },
        {
          ['id']=343,
          ['name']='ターフヲ走ル彗星'
        },
        {
          ['id']=344,
          ['name']='三代目ビッグレッド'
        },
        {
          ['id']=345,
          ['name']='歓喜ニ包マレテ'
        },
        {
          ['id']=346,
          ['name']='鮮ヤカナ逃亡劇'
        },
        {
          ['id']=347,
          ['name']='空前ニシテ絶後'
        },
        {
          ['id']=348,
          ['name']='天地揺ラス快速馬'
        },
        {
          ['id']=349,
          ['name']='影踏マセヌ超特急'
        },
        {
          ['id']=350,
          ['name']='勝利ノソノ先ヘ'
        },
        {
          ['id']=351,
          ['name']='ラフィアンノ再来'
        },
        {
          ['id']=352,
          ['name']='温和ナ巨人'
        },
        {
          ['id']=353,
          ['name']='常識外レノ舞姫'
        },
        {
          ['id']=354,
          ['name']='灼熱ヲ望ム陽炎'
        },
        {
          ['id']=355,
          ['name']='フライングフィリー'
        },
        {
          ['id']=356,
          ['name']='砂ニ煙ル勝利ノ狼煙'
        },
        {
          ['id']=357,
          ['name']='司ル者'
        },
        {
          ['id']=358,
          ['name']='征服スル鋼鉄ノ王'
        },
        {
          ['id']=359,
          ['name']='神ノ馬'
        },
        {
          ['id']=360,
          ['name']='疾駆スルスキッピー'
        },
        {
          ['id']=361,
          ['name']='夢ヲ描ク天才画家'
        },
        {
          ['id']=362,
          ['name']='魅惑ノ芦毛'
        },
        {
          ['id']=363,
          ['name']='静寂ニ包マレル頂'
        },
        {
          ['id']=364,
          ['name']='千年紀ノ王者'
        },
        {
          ['id']=365,
          ['name']='輝キ増ス栄光'
        },
        {
          ['id']=366,
          ['name']='難攻不落ノ要塞'
        },
        {
          ['id']=367,
          ['name']='最高峰ノ走リ'
        },
        {
          ['id']=368,
          ['name']='常識ヲ超エタ天才'
        },
        {
          ['id']=369,
          ['name']='可憐ナ超長距離砲'
        },
        {
          ['id']=370,
          ['name']='ザ・ロック'
        },
        {
          ['id']=371,
          ['name']='静寂ヲ切リ裂ク閃光'
        },
        {
          ['id']=372,
          ['name']='仕留メル一撃'
        },
        {
          ['id']=373,
          ['name']='白キ賢弟'
        },
        {
          ['id']=374,
          ['name']='幻影両断'
        },
        {
          ['id']=375,
          ['name']='走リデ裁ク執行者'
        },
        {
          ['id']=376,
          ['name']='未来ヲ占ウ淑女'
        },
        {
          ['id']=377,
          ['name']='芸術的ステイヤー'
        },
        {
          ['id']=378,
          ['name']='希望ノタメノ疾走'
        },
        {
          ['id']=379,
          ['name']='烈風吹キ荒レル'
        },
        {
          ['id']=380,
          ['name']='勝利ヲ奪ウ侵略者'
        },
        {
          ['id']=381,
          ['name']='運命ノ開拓者'
        },
        {
          ['id']=382,
          ['name']='栄光ヲ詠ウ詩人'
        },
        {
          ['id']=383,
          ['name']='躍動スル変革者'
        },
        {
          ['id']=384,
          ['name']='誇リ高キ公爵'
        },
        {
          ['id']=385,
          ['name']='スベテヲ呑ミ込ム豪脚'
        },
        {
          ['id']=386,
          ['name']='金色ニ輝クティアラ'
        },
        {
          ['id']=387,
          ['name']='無垢ナル天才少女'
        },
        {
          ['id']=388,
          ['name']='汚レナキ黒イ宝石'
        },
        {
          ['id']=389,
          ['name']='ブラックビューティ'
        },
        {
          ['id']=390,
          ['name']='空ニ瞬ク恒星'
        },
        {
          ['id']=391,
          ['name']='フェアリーマジック'
        },
        {
          ['id']=392,
          ['name']='戴冠ヘノ祈リ'
        },
        {
          ['id']=393,
          ['name']='百獣ノ王、君臨ス'
        },
        {
          ['id']=394,
          ['name']='シンデレラカラ女王ヘ'
        },
        {
          ['id']=395,
          ['name']='世界ヲ席巻スル怪物'
        },
        {
          ['id']=396,
          ['name']='記憶ニ刻マレル衝撃'
        },
        {
          ['id']=397,
          ['name']='金城鉄壁ノ走リ'
        },
        {
          ['id']=398,
          ['name']='栄冠ヲ見ツメル天使'
        },
        {
          ['id']=399,
          ['name']='聖女ロンシャンニ立ツ'
        },
        {
          ['id']=400,
          ['name']='喝采ヲ浴ビル英傑'
        },
        {
          ['id']=401,
          ['name']='砂上ヲ統ベル王'
        },
        {
          ['id']=402,
          ['name']='勝利ニツナグ走リ'
        },
        {
          ['id']=403,
          ['name']='3冠馬ノ証明'
        },
        {
          ['id']=404,
          ['name']='王座ヲ防衛スル者'
        },
        {
          ['id']=405,
          ['name']='新・グレイゴースト'
        },
        {
          ['id']=406,
          ['name']='ブローニュノ森ノ精'
        },
        {
          ['id']=407,
          ['name']='威風堂々'
        },
        {
          ['id']=408,
          ['name']='歓喜スル九龍ノ王'
        },
        {
          ['id']=409,
          ['name']='勝チ誇ル獅子ノ咆哮'
        },
        {
          ['id']=410,
          ['name']='マイルキング'
        },
        {
          ['id']=411,
          ['name']='ターフニ響ク独奏曲'
        },
        {
          ['id']=412,
          ['name']='勝利ヲ奪ウ怪盗'
        },
        {
          ['id']=413,
          ['name']='不滅ノ末脚'
        },
        {
          ['id']=414,
          ['name']='麗シキマイルノ覇者'
        },
        {
          ['id']=415,
          ['name']='大志ヲ抱ク昇リ竜'
        },
        {
          ['id']=416,
          ['name']='アメリカンヒロイン'
        },
        {
          ['id']=417,
          ['name']='ザ・ブル'
        },
        {
          ['id']=418,
          ['name']='勇名、世界ニ馳セル'
        },
        {
          ['id']=419,
          ['name']='赤褐色ノ弾丸'
        },
        {
          ['id']=420,
          ['name']='ソノ末脚、嵐ノゴトシ'
        },
        {
          ['id']=421,
          ['name']='早熟ノ天才'
        },
        {
          ['id']=422,
          ['name']='頂点ヘツナガル軌跡'
        },
        {
          ['id']=423,
          ['name']='幻ノ黄金'
        },
        {
          ['id']=424,
          ['name']='偉大ナル王者'
        },
        {
          ['id']=425,
          ['name']='宿敵超エ頂点ヘ'
        },
        {
          ['id']=426,
          ['name']='新時代ノ先駆者'
        },
        {
          ['id']=427,
          ['name']='革新者'
        },
        {
          ['id']=428,
          ['name']='秘宝ヲ求メ行ク冒険者'
        },
        {
          ['id']=429,
          ['name']='卓越ノゼネラリスト'
        },
        {
          ['id']=430,
          ['name']='圧勝劇ノ再演'
        },
        {
          ['id']=431,
          ['name']='純白ニ染マル栄光'
        },
        {
          ['id']=432,
          ['name']='背ニ希望ト夢ヲ乗セ'
        },
        {
          ['id']=433,
          ['name']='馬群ヲ貫ク名槍'
        },
        {
          ['id']=434,
          ['name']='大王ノ進撃'
        },
        {
          ['id']=435,
          ['name']='隻眼ノ雄'
        },
        {
          ['id']=436,
          ['name']='黄金ノ一撃'
        },
        {
          ['id']=437,
          ['name']='獲物ヲ狙ウガンマン'
        },
        {
          ['id']=438,
          ['name']='燦然ト輝ク大海'
        },
        {
          ['id']=439,
          ['name']='妖艶ニ舞ウ二羽ノ蝶'
        },
        {
          ['id']=440,
          ['name']='ヒタスラニ頂点ヘ'
        },
        {
          ['id']=441,
          ['name']='独唱ノ始マリ'
        },
        {
          ['id']=442,
          ['name']='雷鳴トドロク'
        },
        {
          ['id']=443,
          ['name']='恋焦ガレル美シサ'
        },
        {
          ['id']=444,
          ['name']='響ク鳳凰ノサエズリ'
        },
        {
          ['id']=445,
          ['name']='旭日昇天'
        },
        {
          ['id']=446,
          ['name']='ソノ覚醒、マサニ劇的'
        },
        {
          ['id']=447,
          ['name']='求メルハ金色ノ勲章'
        },
        {
          ['id']=448,
          ['name']='巨塔ソビエ立ツ'
        },
        {
          ['id']=449,
          ['name']='重砲打チ鳴ラス'
        },
        {
          ['id']=450,
          ['name']='百戦錬磨ノ強者'
        },
        {
          ['id']=451,
          ['name']='香港ノ英雄'
        },
        {
          ['id']=452,
          ['name']='不死鳥'
        },
        {
          ['id']=453,
          ['name']='南海ヲ統ベル王'
        },
        {
          ['id']=454,
          ['name']='栄光ヲ渇望スル叫ビ'
        },
        {
          ['id']=455,
          ['name']='名伯楽ノ最高傑作'
        },
        {
          ['id']=456,
          ['name']='秘メタル夢解キ放ツ'
        },
        {
          ['id']=457,
          ['name']='銀ノ国ヨリ来タリテ'
        },
        {
          ['id']=458,
          ['name']='ミドルレンジマスター'
        },
        {
          ['id']=459,
          ['name']='激情秘メタル宰相'
        },
        {
          ['id']=460,
          ['name']='豪脚デ魅セル舞手'
        },
        {
          ['id']=461,
          ['name']='ビッグレッドトレイン'
        },
        {
          ['id']=462,
          ['name']='タイタンオブザターフ'
        },
        {
          ['id']=463,
          ['name']='タフネススプリンター'
        },
        {
          ['id']=464,
          ['name']='天衣無縫'
        },
        {
          ['id']=465,
          ['name']='磨カレタ琥珀ノ輝キ'
        },
        {
          ['id']=466,
          ['name']='黄金ノ馬'
        },
        {
          ['id']=467,
          ['name']='3冠馬キラー'
        },
        {
          ['id']=468,
          ['name']='世界ヘノ挑戦者'
        },
        {
          ['id']=469,
          ['name']='3冠馬ノ最高傑作'
        },
        {
          ['id']=470,
          ['name']='魔性ノ青鹿毛'
        },
        {
          ['id']=471,
          ['name']='勇躍スル巨人'
        },
        {
          ['id']=472,
          ['name']='波乱ヲ呼ブ台風ノ目'
        },
        {
          ['id']=473,
          ['name']='究極ノ美女'
        },
        {
          ['id']=474,
          ['name']='輝ク満開ノ桜'
        },
        {
          ['id']=475,
          ['name']='魅惑ノ栗毛'
        },
        {
          ['id']=476,
          ['name']='マイルノ帝王'
        },
        {
          ['id']=477,
          ['name']='高速スマッシュ'
        },
        {
          ['id']=478,
          ['name']='白イ稲妻'
        },
        {
          ['id']=479,
          ['name']='若キ天才ノ恋人'
        },
        {
          ['id']=480,
          ['name']='芦毛ノ怪物'
        },
        {
          ['id']=481,
          ['name']='大井カラ来タ豪傑'
        },
        {
          ['id']=482,
          ['name']='舞イハアナタトトモニ'
        },
        {
          ['id']=483,
          ['name']='短距離ニ花開ク乙女'
        },
        {
          ['id']=484,
          ['name']='裸足ノシンデレラ'
        },
        {
          ['id']=485,
          ['name']='マイルノ女王'
        },
        {
          ['id']=486,
          ['name']='密林ヲ切リ裂ク影'
        },
        {
          ['id']=487,
          ['name']='芦毛ノ王者'
        },
        {
          ['id']=488,
          ['name']='嵐ヲ呼ブ逃亡者'
        },
        {
          ['id']=489,
          ['name']='オッズヲ見ル馬'
        },
        {
          ['id']=490,
          ['name']='勝利ヘノ片道切符'
        },
        {
          ['id']=491,
          ['name']='金色ノ暴君'
        },
        {
          ['id']=492,
          ['name']='晩春ニ咲ク八重桜'
        },
        {
          ['id']=493,
          ['name']='気高キ乙女'
        },
        {
          ['id']=494,
          ['name']='フロックデナイ証明'
        },
        {
          ['id']=495,
          ['name']='輝キハ海ヲ越エテ'
        },
        {
          ['id']=496,
          ['name']='マイル王、世界ヘ飛翔'
        },
        {
          ['id']=497,
          ['name']='勝利ヘノ導キ'
        },
        {
          ['id']=498,
          ['name']='奇跡ノロングスパート'
        },
        {
          ['id']=499,
          ['name']='新タナル銀河'
        },
        {
          ['id']=500,
          ['name']='一流マイラーノ流儀'
        },
        {
          ['id']=501,
          ['name']='暗闇ニ差ス一筋ノ光'
        },
        {
          ['id']=502,
          ['name']='激情ノ箒星'
        },
        {
          ['id']=503,
          ['name']='世界ノ夜ヲ照ラス月'
        },
        {
          ['id']=504,
          ['name']='砂ノ王座、朱ニ染マル'
        },
        {
          ['id']=505,
          ['name']='青空ヲ切リ裂ク末脚'
        },
        {
          ['id']=506,
          ['name']='府中デ瞬ク閃光'
        },
        {
          ['id']=507,
          ['name']='砂煙ヲ切リ裂ク隼'
        },
        {
          ['id']=508,
          ['name']='可憐ナ電撃少女'
        },
        {
          ['id']=509,
          ['name']='盾ノ怪物'
        },
        {
          ['id']=510,
          ['name']='遅咲キノシンデレラ'
        },
        {
          ['id']=511,
          ['name']='晴天ニ輝ク新星'
        },
        {
          ['id']=512,
          ['name']='快速レーサー'
        },
        {
          ['id']=513,
          ['name']='金緑石ノ煌メキ'
        },
        {
          ['id']=514,
          ['name']='父ニ届ケ、雲ノ軌跡'
        },
        {
          ['id']=515,
          ['name']='タクト振ルウ女王'
        },
        {
          ['id']=516,
          ['name']='理想ノサラブレッド'
        },
        {
          ['id']=517,
          ['name']='トリプルティアラ'
        },
        {
          ['id']=518,
          ['name']='イギリス3冠馬'
        },
        {
          ['id']=519,
          ['name']='フランス3冠馬'
        },
        {
          ['id']=520,
          ['name']='アイルランド3冠馬'
        },
        {
          ['id']=521,
          ['name']='欧州マイル3冠馬'
        },
        {
          ['id']=522,
          ['name']='BCコレクター'
        },
        {
          ['id']=523,
          ['name']='ワールドチャンピオン'
        },
        {
          ['id']=524,
          ['name']='オークスコレクター'
        },
        {
          ['id']=525,
          ['name']='世界ノスプリント王'
        },
        {
          ['id']=526,
          ['name']='メイダンマイスター'
        },
        {
          ['id']=527,
          ['name']='ロンシャンマエストロ'
        },
        {
          ['id']=528,
          ['name']='香港王者'
        },
        {
          ['id']=529,
          ['name']='欧州マイルチャンプ'
        },
        {
          ['id']=530,
          ['name']='直線競馬ノ申シ子'
        },
        {
          ['id']=531,
          ['name']='王家ヨリ戴キシ栄冠'
        },
        {
          ['id']=532,
          ['name']='ストップス・ア・ネイション'
        },
        {
          ['id']=533,
          ['name']='フレミントンノ英雄'
        },
        {
          ['id']=534,
          ['name']='ムーニーバレーノ王'
        },
        {
          ['id']=535,
          ['name']='ヒーローノ凱旋'
        },
        {
          ['id']=536,
          ['name']='秘宝手ニ入レシ者'
        },
        {
          ['id']=537,
          ['name']='豪州ノ秘密兵器'
        },
        {
          ['id']=538,
          ['name']='欧州ノ雄'
        },
        {
          ['id']=539,
          ['name']='アメリカンドリーム'
        },
        {
          ['id']=540,
          ['name']='ドバイ・ザ・キング'
        },
        {
          ['id']=541,
          ['name']='トップオブザワールド'
        },
        {
          ['id']=542,
          ['name']='世界ヲ席巻スル血脈'
        },
        {
          ['id']=543,
          ['name']='重厚ナ欧州血統'
        },
        {
          ['id']=544,
          ['name']='巻キ起コス砂嵐'
        },
        {
          ['id']=545,
          ['name']='天馬'
        },
        {
          ['id']=546,
          ['name']='緑ノ刺客'
        },
        {
          ['id']=547,
          ['name']='自由ナル夢ヲ乗セテ'
        },
        {
          ['id']=548,
          ['name']='アーチノ門番'
        },
        {
          ['id']=549,
          ['name']='西海岸ノ鉄人'
        },
        {
          ['id']=550,
          ['name']='世界ニ舞ウ黒蝶'
        },
        {
          ['id']=551,
          ['name']='逆境、モノトモセズ'
        },
        {
          ['id']=552,
          ['name']='類マレナル闘争心'
        },
        {
          ['id']=553,
          ['name']='最強ノ好敵手'
        },
        {
          ['id']=554,
          ['name']='大陸震ワス下剋上'
        },
        {
          ['id']=555,
          ['name']='壮観ナル鋼鉄艦'
        },
        {
          ['id']=556,
          ['name']='ソノスピードハ未来ヘト'
        },
        {
          ['id']=557,
          ['name']='欧州駆ケル虹ノ旅'
        },
        {
          ['id']=558,
          ['name']='伝説ノ幕開ケ'
        },
        {
          ['id']=559,
          ['name']='愚者ノ快進撃'
        },
        {
          ['id']=560,
          ['name']='プエルトリコノ逃亡者'
        },
        {
          ['id']=561,
          ['name']='名勝負ノ担イ手'
        },
        {
          ['id']=562,
          ['name']='気高キ三ツノ冠ヲ'
        },
        {
          ['id']=563,
          ['name']='世界ニ示ス才覚'
        },
        {
          ['id']=564,
          ['name']='赤キ血、伝エシ花婿'
        },
        {
          ['id']=565,
          ['name']='勇敢ナル小兵'
        },
        {
          ['id']=566,
          ['name']='空飛ブスプリントキング'
        },
        {
          ['id']=567,
          ['name']='珊瑚礁ヲ見下ロシテ'
        },
        {
          ['id']=568,
          ['name']='格調高キ長距離王'
        },
        {
          ['id']=569,
          ['name']='炎ノ伝承者'
        },
        {
          ['id']=570,
          ['name']='ファイブティアラガール'
        },
        {
          ['id']=571,
          ['name']='愛シキ人ノタメニ'
        },
        {
          ['id']=572,
          ['name']='栄光ノ凱歌ヲ'
        },
        {
          ['id']=573,
          ['name']='名マイラーノ血筋'
        },
        {
          ['id']=574,
          ['name']='独国ノ王、鎮座ス'
        },
        {
          ['id']=575,
          ['name']='名王ノ治世、来タル'
        },
        {
          ['id']=576,
          ['name']='偉大ナル不沈艦'
        },
        {
          ['id']=577,
          ['name']='策略巡ラス行軍'
        },
        {
          ['id']=578,
          ['name']='僅差ノ魔術師'
        },
        {
          ['id']=579,
          ['name']='世界ヘノワンステップ'
        },
        {
          ['id']=580,
          ['name']='夏ヲ司ル無彩色'
        },
        {
          ['id']=581,
          ['name']='ソノ末脚、愉快ナリ'
        },
        {
          ['id']=582,
          ['name']='幻影ノ如キ圧勝劇'
        },
        {
          ['id']=583,
          ['name']='絶エ間ナイ努力ノ証'
        },
        {
          ['id']=584,
          ['name']='今コノ時ヲ支配シテ'
        },
        {
          ['id']=585,
          ['name']='王都ヨリ来タル風'
        },
        {
          ['id']=586,
          ['name']='ビッグ・レッドノ再来'
        },
        {
          ['id']=587,
          ['name']='鋼鉄ノ巨人'
        },
        {
          ['id']=588,
          ['name']='夏ニ降リ積モル雪'
        },
        {
          ['id']=589,
          ['name']='大聖堂ノ英傑'
        },
        {
          ['id']=590,
          ['name']='砂塵切リ裂ク駿馬'
        },
        {
          ['id']=591,
          ['name']='黄金色ノ名槍'
        },
        {
          ['id']=592,
          ['name']='馬場不問ノタフガール'
        },
        {
          ['id']=593,
          ['name']='ターフヲ駆ケル暴風'
        },
        {
          ['id']=594,
          ['name']='天才ノ血ノ証明'
        },
        {
          ['id']=595,
          ['name']='夢ヲ描ク詩人'
        },
        {
          ['id']=596,
          ['name']='研ギ澄マサレシ双刀'
        },
        {
          ['id']=597,
          ['name']='勝利見渡ス大桟橋'
        },
        {
          ['id']=598,
          ['name']='良血ノマイルプリンス'
        },
        {
          ['id']=599,
          ['name']='新時代ノ旗手'
        },
        {
          ['id']=600,
          ['name']='クラッチシューター'
        },
        {
          ['id']=601,
          ['name']='ターフヲ司ルモンスター'
        },
        {
          ['id']=602,
          ['name']='勝利ヲイザナウ高品質'
        },
        {
          ['id']=603,
          ['name']='輝カシキSノ系譜'
        },
        {
          ['id']=604,
          ['name']='砂浜駆ケル天才少女'
        },
        {
          ['id']=605,
          ['name']='狂気ノ逃ゲ馬'
        },
        {
          ['id']=606,
          ['name']='追随ナキ快速少女'
        },
        {
          ['id']=607,
          ['name']='スーパーカー'
        },
        {
          ['id']=608,
          ['name']='胸イッパイノ愛ヲ'
        },
        {
          ['id']=609,
          ['name']='条件不問ノタフガイ'
        },
        {
          ['id']=610,
          ['name']='気マグレジョージ'
        },
        {
          ['id']=611,
          ['name']='妖精女王'
        },
        {
          ['id']=612,
          ['name']='突キ進ムハ栄光ノ道'
        },
        {
          ['id']=613,
          ['name']='砂ヲ掴ム底力'
        },
        {
          ['id']=614,
          ['name']='道営史上最強馬'
        },
        {
          ['id']=615,
          ['name']='勝利ノ花道'
        },
        {
          ['id']=616,
          ['name']='ターフノプレイボーイ'
        },
        {
          ['id']=617,
          ['name']='父ノ夢ヲ胸ニ'
        },
        {
          ['id']=618,
          ['name']='堅実無比ノ末脚'
        },
        {
          ['id']=619,
          ['name']='小サクモ強靭ナ北風'
        },
        {
          ['id']=620,
          ['name']='華麗ナル淑女'
        },
        {
          ['id']=621,
          ['name']='瞬ク閃光ノ宿命'
        },
        {
          ['id']=622,
          ['name']='太陽ノ王子'
        },
        {
          ['id']=623,
          ['name']='真ノエーストナレ'
        },
        {
          ['id']=624,
          ['name']='天運掴メ'
        },
        {
          ['id']=625,
          ['name']='驚愕ノ大駆ケ'
        },
        {
          ['id']=626,
          ['name']='行進ハ終ワラナイ'
        },
        {
          ['id']=627,
          ['name']='見初メラレシ才媛'
        },
        {
          ['id']=628,
          ['name']='暮レニ花開ク力'
        },
        {
          ['id']=629,
          ['name']='孤独ナ皇帝'
        },
        {
          ['id']=630,
          ['name']='強者ヲ抜キ去ル北斗'
        },
        {
          ['id']=631,
          ['name']='偉大ナルレース職人'
        },
        {
          ['id']=632,
          ['name']='天命カナエシ馬'
        },
        {
          ['id']=633,
          ['name']='小サキカウボーイ'
        },
        {
          ['id']=634,
          ['name']='銀髪鬼'
        },
        {
          ['id']=635,
          ['name']='直線駆ケル女王'
        },
        {
          ['id']=636,
          ['name']='掲ゲルチャンピオンベルト'
        },
        {
          ['id']=637,
          ['name']='愛サレシマイラー'
        },
        {
          ['id']=638,
          ['name']='花ノ伝道師'
        },
        {
          ['id']=639,
          ['name']='天照ラス次世代エース'
        },
        {
          ['id']=640,
          ['name']='世界ヘ示ス闘魂'
        },
        {
          ['id']=641,
          ['name']='破竹ノ快進撃'
        },
        {
          ['id']=642,
          ['name']='小柄ナ根性娘'
        },
        {
          ['id']=643,
          ['name']='スプリング・スプリンター'
        },
        {
          ['id']=644,
          ['name']='金襴緞子'
        },
        {
          ['id']=645,
          ['name']='神ヘ捧グ戴冠'
        },
        {
          ['id']=646,
          ['name']='信念ツナグ馬'
        },
        {
          ['id']=647,
          ['name']='忍ビ寄ル狩人'
        },
        {
          ['id']=648,
          ['name']='傷ダラケノ一本竹'
        },
        {
          ['id']=649,
          ['name']='待チワビタ戴冠'
        },
        {
          ['id']=650,
          ['name']='フルサイズカー'
        },
        {
          ['id']=651,
          ['name']='知恵深キ才女'
        },
        {
          ['id']=652,
          ['name']='目指スハ大判ノ勝利'
        },
        {
          ['id']=653,
          ['name']='ガラスノ鬼脚'
        },
        {
          ['id']=654,
          ['name']='刹那ニ光ル輝キ'
        },
        {
          ['id']=655,
          ['name']='遅レテキタ大器'
        },
        {
          ['id']=656,
          ['name']='名血ノ王女'
        },
        {
          ['id']=657,
          ['name']='天ニ瞬ク一等星'
        },
        {
          ['id']=658,
          ['name']='唯我独尊ノ大駆ケ'
        },
        {
          ['id']=659,
          ['name']='迫真ノ粘リ腰'
        },
        {
          ['id']=660,
          ['name']='快速ノド根性娘'
        },
        {
          ['id']=661,
          ['name']='ゴールノ先ニ福来タル'
        },
        {
          ['id']=662,
          ['name']='グッドルッキングホース'
        },
        {
          ['id']=663,
          ['name']='狂気ノ豪脚'
        },
        {
          ['id']=664,
          ['name']='ソノ走リ、千代ニ刻ム'
        },
        {
          ['id']=665,
          ['name']='野生、猛ルガママニ'
        },
        {
          ['id']=666,
          ['name']='激闘ノ記憶、鮮ヤカニ'
        },
        {
          ['id']=667,
          ['name']='天翔一閃'
        },
        {
          ['id']=668,
          ['name']='待望ノ讃歌、高ラカニ'
        },
        {
          ['id']=669,
          ['name']='ガラスノ脚、キラメイテ'
        },
        {
          ['id']=670,
          ['name']='無敵ノ舞、ゴ覧アレ'
        },
        {
          ['id']=671,
          ['name']='北国ヨリ来タル美人'
        },
        {
          ['id']=672,
          ['name']='異能ニシテ万能'
        },
        {
          ['id']=673,
          ['name']='気高キ女帝'
        },
        {
          ['id']=674,
          ['name']='愛サレシ名脇役'
        },
        {
          ['id']=675,
          ['name']='頂点ヘ届ケ、コノ執念'
        },
        {
          ['id']=676,
          ['name']='正真正銘ノ強サ'
        },
        {
          ['id']=677,
          ['name']='舞ッテ掴ムハ金ノ輝キ'
        },
        {
          ['id']=678,
          ['name']='大海越エ、輝キ掴ム'
        },
        {
          ['id']=679,
          ['name']='不屈ノダイヤモンド'
        },
        {
          ['id']=680,
          ['name']='超良血ノ大器'
        },
        {
          ['id']=681,
          ['name']='絹ノ道、駆ケル騎士'
        },
        {
          ['id']=682,
          ['name']='父ニ見セル、春ノ奇跡'
        },
        {
          ['id']=683,
          ['name']='掟破リノ二刀流'
        },
        {
          ['id']=684,
          ['name']='終ワラヌ夢ヘノマイ進'
        },
        {
          ['id']=685,
          ['name']='マダ見ヌ景色ノ先ヲ征ケ'
        },
        {
          ['id']=686,
          ['name']='蝶モ蜂モ抜キ去リテ'
        },
        {
          ['id']=687,
          ['name']='秘メラレシ良血ノ証'
        },
        {
          ['id']=688,
          ['name']='純白ノアイドル'
        },
        {
          ['id']=689,
          ['name']='黄金船ノ愛娘'
        },
        {
          ['id']=690,
          ['name']='偉大ナル王ノ末脚'
        },
        {
          ['id']=691,
          ['name']='祝福掴ム荒武者'
        },
        {
          ['id']=692,
          ['name']='絆結ブステイヤー'
        },
        {
          ['id']=693,
          ['name']='頭上ニ輝ク花冠'
        },
        {
          ['id']=694,
          ['name']='王ヨリ継ギシスピード'
        },
        {
          ['id']=695,
          ['name']='キラメクレイピア'
        },
        {
          ['id']=696,
          ['name']='雨ノ中、星ハ光ル'
        },
        {
          ['id']=697,
          ['name']='イツカ勝利ノ大輪ヲ'
        },
        {
          ['id']=698,
          ['name']='翔ケル良血ノ結晶'
        },
        {
          ['id']=699,
          ['name']='ソノ軌跡、変幻自在'
        },
        {
          ['id']=700,
          ['name']='王者ノ誇リ、見セル時'
        },
        {
          ['id']=701,
          ['name']='天ニ掲ゲル勝利ノ証'
        },
        {
          ['id']=702,
          ['name']='情熱ノスピードクイーン'
        },
        {
          ['id']=703,
          ['name']='コボレンバカリノ栄光ヲ'
        },
        {
          ['id']=704,
          ['name']='美女ハ風ヲ背ニ受ケテ'
        },
        {
          ['id']=705,
          ['name']='猛キ阿武隈ノ激流'
        },
        {
          ['id']=706,
          ['name']='主役ハ奥羽ヨリ来タル'
        },
        {
          ['id']=707,
          ['name']='南関ノ守護者'
        },
        {
          ['id']=708,
          ['name']='鳴リ響ク勝利ノ行進曲'
        },
        {
          ['id']=709,
          ['name']='思イハ何ヨリモ強シ'
        },
        {
          ['id']=710,
          ['name']='記憶ニ輝ク快速娘'
        },
        {
          ['id']=711,
          ['name']='不滅ノキラメキ'
        },
        {
          ['id']=712,
          ['name']='頂点ヘノ道ヲ行ケ'
        },
        {
          ['id']=713,
          ['name']='常識ヲ破壊セヨ'
        },
        {
          ['id']=714,
          ['name']='原野ヲ花園ニ変エテ'
        },
        {
          ['id']=715,
          ['name']='豪放ナル落雷'
        },
        {
          ['id']=716,
          ['name']='白菊挿シタ旅役者'
        },
        {
          ['id']=717,
          ['name']='運ト努力ノ大金星'
        },
        {
          ['id']=718,
          ['name']='名種牡馬、最後ノ傑作'
        },
        {
          ['id']=719,
          ['name']='熱狂ニ立チ向カイシ馬'
        },
        {
          ['id']=720,
          ['name']='千種ニ物ヲ思ウ走リヨ'
        },
        {
          ['id']=721,
          ['name']='国民的アイドルホース'
        },
        {
          ['id']=722,
          ['name']='宿敵撫デ斬ル豪脚'
        },
        {
          ['id']=723,
          ['name']='華麗ナル名牝'
        },
        {
          ['id']=724,
          ['name']='大地ハウ実力者'
        },
        {
          ['id']=725,
          ['name']='四白流星ノ貴公子'
        },
        {
          ['id']=726,
          ['name']='ターフノ天才児'
        },
        {
          ['id']=727,
          ['name']='気高キ槍騎兵'
        },
        {
          ['id']=728,
          ['name']='世界ガ認メシ駿才'
        },
        {
          ['id']=729,
          ['name']='ジャジャ馬娘'
        },
        {
          ['id']=730,
          ['name']='情熱ノマンボステップ'
        },
        {
          ['id']=731,
          ['name']='ビッグ・レッド'
        },
        {
          ['id']=732,
          ['name']='本能ガ照ラス走リ'
        },
        {
          ['id']=733,
          ['name']='無敵ノヒロイン'
        },
        {
          ['id']=734,
          ['name']='日本ヲ変エタ馬'
        },
        {
          ['id']=735,
          ['name']='女王ガ愛シタ名血'
        },
        {
          ['id']=736,
          ['name']='伝エシヒールノプライド'
        },
        {
          ['id']=737,
          ['name']='大金脈ノ源'
        },
        {
          ['id']=738,
          ['name']='ロンシャンノ女王'
        },
        {
          ['id']=739,
          ['name']='伝説ヘノテイクオフ'
        },
        {
          ['id']=740,
          ['name']='幸セナ愛ハ続ク'
        },
        {
          ['id']=741,
          ['name']='双峰照ラス一等星'
        },
        {
          ['id']=742,
          ['name']='自由ヲ映ス気高キ宝冠'
        },
        {
          ['id']=743,
          ['name']='磨キ上ゲラレシ最高傑作'
        },
        {
          ['id']=744,
          ['name']='飛燕砂塵ニ舞ウ'
        },
        {
          ['id']=745,
          ['name']='刻ム女王ノ足跡'
        },
        {
          ['id']=746,
          ['name']='黄金色ノ逃亡者'
        },
        {
          ['id']=747,
          ['name']='星照ラス末脚ノ煌メキ'
        },
        {
          ['id']=748,
          ['name']='人馬一体ノ極ミ'
        },
        {
          ['id']=749,
          ['name']='大海原ヲ行ク一人旅'
        },
        {
          ['id']=750,
          ['name']='砂ノ革命者'
        },
        {
          ['id']=751,
          ['name']='偉大ナル魔神'
        },
        {
          ['id']=752,
          ['name']='奇跡ノ輝キ試練ヲ超エル'
        },
        {
          ['id']=753,
          ['name']='奏デル勝利ノメロディ'
        },
        {
          ['id']=754,
          ['name']='ヒタムキニ勝利目指シテ'
        },
        {
          ['id']=755,
          ['name']='花ノ都ニ轟ク衝撃'
        },
        {
          ['id']=756,
          ['name']='灰色ノ大天使'
        },
        {
          ['id']=757,
          ['name']='曇リナキ炎ノ英雄'
        },
        {
          ['id']=758,
          ['name']='砂海駆ケル重戦車'
        },
        {
          ['id']=759,
          ['name']='競馬ブームノ立役者'
        },
        {
          ['id']=760,
          ['name']='熱烈峻厳'
        },
        {
          ['id']=761,
          ['name']='府中ノ支配者'
        },
        {
          ['id']=762,
          ['name']='負ケジ魂'
        },
        {
          ['id']=763,
          ['name']='府中ノ刺客'
        },
        {
          ['id']=764,
          ['name']='淀ノ刺客'
        },
        {
          ['id']=765,
          ['name']='仁川ノ刺客'
        },
        {
          ['id']=766,
          ['name']='中山ノ刺客'
        },
        {
          ['id']=767,
          ['name']='超音速ノ脚'
        },
        {
          ['id']=768,
          ['name']='府中ヲ貫ク末脚'
        },
        {
          ['id']=769,
          ['name']='コーナリングマスター'
        },
        {
          ['id']=770,
          ['name']='直千番長'
        },
        {
          ['id']=771,
          ['name']='洋芝大好キ'
        },
        {
          ['id']=772,
          ['name']='関西ニ愛サレシ者'
        },
        {
          ['id']=773,
          ['name']='1400巧者'
        },
        {
          ['id']=774,
          ['name']='霞ニ消エル逃走劇'
        },
        {
          ['id']=775,
          ['name']='馬群ハナス逃走劇'
        },
        {
          ['id']=776,
          ['name']='最後方カラノ一閃'
        },
        {
          ['id']=777,
          ['name']='最後方カラノ一撃'
        },
        {
          ['id']=778,
          ['name']='安定堅実'
        },
        {
          ['id']=779,
          ['name']='インカラノ豪脚'
        },
        {
          ['id']=780,
          ['name']='馬群一掃スル大マクリ'
        },
        {
          ['id']=781,
          ['name']='ペースヲ支配スル者'
        },
        {
          ['id']=782,
          ['name']='初メテノ愛馬'
        },
        {
          ['id']=783,
          ['name']='5月ノプリンス'
        },
        {
          ['id']=784,
          ['name']='光ル君ノ末脚'
        },
        {
          ['id']=785,
          ['name']='伊達男ノ大輪菊'
        },
        {
          ['id']=786,
          ['name']='天ノ川駆ケル優駿'
        },
        {
          ['id']=787,
          ['name']='再誕スルロンシャンノ英雄'
        },
        {
          ['id']=788,
          ['name']='グレイゴースト'
        },
        {
          ['id']=789,
          ['name']='唱エヨ、最強ノ名ヲ'
        },
        {
          ['id']=790,
          ['name']='舞エ、ソノ血ヲ滾ラセテ'
        },
        {
          ['id']=791,
          ['name']='ビッグ・サイ'
        },
        {
          ['id']=792,
          ['name']='唯我独尊ノ快速王'
        },
        {
          ['id']=793,
          ['name']='世紀ノ一戦ノ覇者'
        },
        {
          ['id']=794,
          ['name']='ソノ血デ支配セヨ'
        },
        {
          ['id']=795,
          ['name']='曇リナキ夜ニ光ル星'
        },
        {
          ['id']=796,
          ['name']='愚カ者カラ最モ勤勉ナル者ヘ'
        },
        {
          ['id']=797,
          ['name']='スベテノ道ヲ白ニ染メテ'
        },
        {
          ['id']=798,
          ['name']='完璧ユエノ退屈'
        },
        {
          ['id']=799,
          ['name']='研ギ澄マス気品ハ皇帝ノ如シ'
        },
        {
          ['id']=800,
          ['name']='騎士ガ魅セル絶技乱舞'
        },
        {
          ['id']=801,
          ['name']='命燃ヤス超快速'
        },
        {
          ['id']=802,
          ['name']='夢ノ担イ手'
        },
        {
          ['id']=803,
          ['name']='母ニ捧グ栄冠'
        },
        {
          ['id']=804,
          ['name']='電撃ノ末脚'
        },
        {
          ['id']=805,
          ['name']='不撓不屈ノ女王'
        },
        {
          ['id']=806,
          ['name']='色褪セヌ黄金ノ輝キ'
        },
        {
          ['id']=807,
          ['name']='栄冠ヘ拳掲ゲテ'
        },
        {
          ['id']=808,
          ['name']='名家ノ祖'
        },
        {
          ['id']=809,
          ['name']='金色ノ夢ヲ映ス瞳'
        },
        {
          ['id']=810,
          ['name']='海渡ル決闘者'
        },
        {
          ['id']=811,
          ['name']='至高ノ大環礁'
        },
        {
          ['id']=812,
          ['name']='金蹄統ベル挑戦者'
        },
        {
          ['id']=813,
          ['name']='開眼セシ天賦ノ才'
        },
        {
          ['id']=814,
          ['name']='名馬ノ魂継承'
        },
        {
          ['id']=815,
          ['name']='世界100傑馬'
        },
        {
          ['id']=816,
          ['name']='神速ノ渡リ鳥'
        },
        {
          ['id']=817,
          ['name']='栄誉ハ鈴ノ音ト共ニ'
        },
        {
          ['id']=818,
          ['name']='馬場不問ノ快男児'
        },
        {
          ['id']=819,
          ['name']='桜纏イシ魅惑ノ香リ'
        },
        {
          ['id']=820,
          ['name']='雨中ニ芽吹ク可憐ナ萌木'
        },
        {
          ['id']=821,
          ['name']='カラカスノ大砲弾'
        },
        {
          ['id']=822,
          ['name']='連綿トツナグ踊リ子ノ血'
        },
        {
          ['id']=823,
          ['name']='好敵手ト磨イタ勝利ノ鍵'
        },
        {
          ['id']=824,
          ['name']='真夏ノ来訪者'
        },
        {
          ['id']=825,
          ['name']='ソノ血ハ大河トナリテ'
        },
        {
          ['id']=826,
          ['name']='輝キハ海峡越エテ'
        },
        {
          ['id']=827,
          ['name']='解析不能ノ才気'
        },
        {
          ['id']=828,
          ['name']='後世ニ伝エル不思議ノ種'
        },
        {
          ['id']=829,
          ['name']='後世ニツナグ全霊ノ末脚'
        },
        {
          ['id']=830,
          ['name']='透キ通ル砂ノ結晶'
        },
        {
          ['id']=831,
          ['name']='勝利ノ美酒モ、敗北ノ苦渋モ'
        },
        {
          ['id']=832,
          ['name']='勝利ヲ一網打尽'
        },
        {
          ['id']=833,
          ['name']='頂点ヘノタッチダウン'
        },
        {
          ['id']=834,
          ['name']='強ク美シキチャリオット'
        },
        {
          ['id']=835,
          ['name']='勇名轟カス稲妻'
        },
        {
          ['id']=836,
          ['name']='短距離ノ優雅ナル制覇者'
        },
        {
          ['id']=837,
          ['name']='春風ト走ル可憐ナ旅人'
        },
        {
          ['id']=838,
          ['name']='王ニ屈セヌ騎士ノ血'
        },
        {
          ['id']=839,
          ['name']='顕示スル無二ノ栄冠'
        },
        {
          ['id']=840,
          ['name']='解キ放タレシ快速'
        },
        {
          ['id']=841,
          ['name']='砂纏ウ初代王女'
        },
        {
          ['id']=842,
          ['name']='窪地ニ眠ル悲願ノ豪脚'
        },
        {
          ['id']=843,
          ['name']='勇者ヲ追ウ意地ノ脚'
        },
        {
          ['id']=844,
          ['name']='ターフニ輝ク東洋ノ真珠'
        },
        {
          ['id']=845,
          ['name']='未来ニ轟ク蒸気機関車'
        },
        {
          ['id']=846,
          ['name']='強ク羽バタク芦毛ノ翼'
        },
        {
          ['id']=847,
          ['name']='ビッグ・レッドノ一等星'
        },
        {
          ['id']=848,
          ['name']='ハンデキャップ・マスター'
        },
        {
          ['id']=849,
          ['name']='敗北カラ学ンダ繁栄'
        },
        {
          ['id']=850,
          ['name']='常識外レノスプリンター'
        },
        {
          ['id']=851,
          ['name']='晩成ノワールドツーリスト'
        },
        {
          ['id']=852,
          ['name']='陽光ニ誘ワレシ名マイラー'
        },
        {
          ['id']=853,
          ['name']='躍動スルケルトノ調ベ'
        },
        {
          ['id']=854,
          ['name']='名門ニ恥ジヌ絶対ノ記録'
        },
        {
          ['id']=855,
          ['name']='精確無比ノ逃ゲ脚'
        },
        {
          ['id']=856,
          ['name']='古代都市ノ気高キ王女'
        },
        {
          ['id']=857,
          ['name']='底見セヌマイティランナー'
        },
        {
          ['id']=858,
          ['name']='期待ヲ超エル大歓喜'
        },
        {
          ['id']=859,
          ['name']='奇跡ヲ呼ブ大魔術師'
        },
        {
          ['id']=860,
          ['name']='薔薇手ニスル若キ感性'
        },
        {
          ['id']=861,
          ['name']='ソノ強サ、折リ紙付キ'
        },
        {
          ['id']=862,
          ['name']='刹那ニ燃エ上ガル愛'
        },
        {
          ['id']=863,
          ['name']='重戦車、砂嵐ヲ裂ク'
        },
        {
          ['id']=864,
          ['name']='慈鳥ガ叶エル王女ノ夢'
        },
        {
          ['id']=865,
          ['name']='脚質自在ノ煌メキ'
        },
        {
          ['id']=866,
          ['name']='挑ミ続ケル航海王子'
        },
        {
          ['id']=867,
          ['name']='栄光ヲ運ブ圧勝街道'
        },
        {
          ['id']=868,
          ['name']='伝統ヲ継グ勇敢ナル騎士'
        },
        {
          ['id']=869,
          ['name']='強サハ時ニ罪トナル'
        },
        {
          ['id']=870,
          ['name']='時代ヲ先行クアスリート'
        },
        {
          ['id']=871,
          ['name']='名手ニ授ケル異次元ノ脚'
        },
        {
          ['id']=872,
          ['name']='風雅ナルマイルノ雄'
        },
        {
          ['id']=873,
          ['name']='ホープ導ク未完ノ大器'
        },
        {
          ['id']=874,
          ['name']='逆転呼ブ灰色ノ閃光'
        },
        {
          ['id']=875,
          ['name']='晴レ舞台デ魅セル血ノ記憶'
        },
        {
          ['id']=876,
          ['name']='成長続ケル魅惑ノ魂'
        },
        {
          ['id']=877,
          ['name']='解キ放タレタ疾風'
        },
        {
          ['id']=878,
          ['name']='幸セ運ブ快速馬'
        },
        {
          ['id']=879,
          ['name']='神住マウ峰ニ名ヲ刻ム'
        },
        {
          ['id']=880,
          ['name']='頂点掴ンダ勝利ノ使者'
        },
        {
          ['id']=881,
          ['name']='急加速スル遅咲キノ才能'
        },
        {
          ['id']=882,
          ['name']='麗シキ最高峰ノ到達者'
        },
        {
          ['id']=883,
          ['name']='オテンバ娘ハ止メラレナイ'
        },
        {
          ['id']=884,
          ['name']='不滅ノビッグA'
        },
        {
          ['id']=885,
          ['name']='世界ニ誇示スル浪漫ノ道'
        },
        {
          ['id']=886,
          ['name']='誉レ高キスーパーステイヤー'
        },
        {
          ['id']=887,
          ['name']='パーフェクト・ゲーム'
        },
        {
          ['id']=888,
          ['name']='涙ガ私ヲ強クスル'
        },
        {
          ['id']=889,
          ['name']='偉業ニ迫ル才媛'
        },
        {
          ['id']=890,
          ['name']='大洋越エテ掴ンダ栄光'
        },
        {
          ['id']=891,
          ['name']='草原ヲ舞ウ昇リ竜'
        },
        {
          ['id']=892,
          ['name']='譲ラヌステイヤーズクラウン'
        },
        {
          ['id']=893,
          ['name']='大西洋ヲ渡ル熱風'
        },
        {
          ['id']=894,
          ['name']='砕ケヌ砂漠ノ宝石'
        },
        {
          ['id']=895,
          ['name']='真ナル薔薇ノ女王'
        },
        {
          ['id']=896,
          ['name']='抜錨スル赤キ英雄'
        },
        {
          ['id']=897,
          ['name']='開カレタ最速ノ門'
        },
        {
          ['id']=898,
          ['name']='真ノ強者ハ二度輝ク'
        },
        {
          ['id']=899,
          ['name']='鉄ノ女、来タル'
        },
        {
          ['id']=900,
          ['name']='紡ガレル音速ノ遺伝子'
        },
        {
          ['id']=901,
          ['name']='不撓不屈ノプリンス'
        },
        {
          ['id']=902,
          ['name']='金雲ハ祝祭ニ懸カル'
        },
        {
          ['id']=903,
          ['name']='放タレシ勝利ノ弾丸'
        },
        {
          ['id']=904,
          ['name']='苦境デ開カレル悟リ'
        },
        {
          ['id']=905,
          ['name']='加速スル乙女ノ誇リ'
        },
        {
          ['id']=906,
          ['name']='聖ナル雷ノ祝福'
        },
        {
          ['id']=907,
          ['name']='豪脚魅セル可憐ナ天使'
        },
        {
          ['id']=908,
          ['name']='幸運呼ビコム末脚'
        },
        {
          ['id']=909,
          ['name']='優美ナル孝行娘'
        },
        {
          ['id']=910,
          ['name']='月光ノ守護女神'
        },
        {
          ['id']=911,
          ['name']='砂塵ニ舞ウ魅惑ノ走リ'
        },
        {
          ['id']=912,
          ['name']='アルカディアノ快速女王'
        },
        {
          ['id']=913,
          ['name']='マッチョハ三度蘇ル'
        },
        {
          ['id']=914,
          ['name']='輝キ纏イシ冒険者'
        },
        {
          ['id']=915,
          ['name']='獲物狙ウ狩人ノ灯'
        },
        {
          ['id']=916,
          ['name']='ベール脱ギシ砂ノ旗手'
        },
        {
          ['id']=917,
          ['name']='栄光ツナグ美シキ舞踏'
        },
        {
          ['id']=918,
          ['name']='遙カナ高ミニ至ル脚'
        },
        {
          ['id']=919,
          ['name']='名門ノジーニアスレディ'
        },
        {
          ['id']=920,
          ['name']='パーフェクトプリンセス'
        },
        {
          ['id']=921,
          ['name']='揺ルガヌ心ノ女王'
        },
        {
          ['id']=922,
          ['name']='闇夜貫ク稲妻'
        },
        {
          ['id']=923,
          ['name']='国統ベルマイルノ怪童'
        },
        {
          ['id']=924,
          ['name']='蘇ル超良血ノ名花'
        },
        {
          ['id']=925,
          ['name']='熱キマグマノ麒麟児'
        },
        {
          ['id']=926,
          ['name']='駆ケ上ガル愛ノ伝道師'
        },
        {
          ['id']=927,
          ['name']='絆ガ紡イダ復活劇'
        },
        {
          ['id']=928,
          ['name']='砂上デ輝ク強者ノ血脈'
        },
        {
          ['id']=929,
          ['name']='覚醒ノ時、来タリ'
        },
        {
          ['id']=930,
          ['name']='駆ケ上ガル勝利ノ螺旋'
        },
        {
          ['id']=931,
          ['name']='浪漫ノ旅ハ万里ヲ越エテ'
        },
        {
          ['id']=932,
          ['name']='無垢ナル願イト共ニ'
        },
        {
          ['id']=933,
          ['name']='青キバラノ姫騎士'
        },
        {
          ['id']=934,
          ['name']='優シキ心ハ海ヲ越エ'
        },
        {
          ['id']=935,
          ['name']='元祖ビッグ・レッド'
        },
        {
          ['id']=936,
          ['name']='ワーテルローノ復讐'
        },
        {
          ['id']=937,
          ['name']='雪辱ヲ果タス荒野ノ決闘'
        },
        {
          ['id']=938,
          ['name']='名手ガ称エル最良ノ騎士'
        },
        {
          ['id']=939,
          ['name']='キング・ケリー'
        },
        {
          ['id']=940,
          ['name']='祖国ヘ、再ビノ凱旋'
        },
        {
          ['id']=941,
          ['name']='名伯楽ノ眼ニ曇リナシ'
        },
        {
          ['id']=942,
          ['name']='ザ・プリンス'
        },
        {
          ['id']=943,
          ['name']='勇気ト光輝ニ包マレシ3冠馬'
        },
        {
          ['id']=944,
          ['name']='星降ル堅牢ノ王宮'
        },
        {
          ['id']=945,
          ['name']='長距離3冠ニ至ル長イ旅路'
        },
        {
          ['id']=946,
          ['name']='末脚光ル覚醒ノ大器'
        },
        {
          ['id']=947,
          ['name']='父ノ影ヲ踏ムコト能ワズ'
        },
        {
          ['id']=948,
          ['name']='暗ガリノ先ヲ望ム快速'
        },
        {
          ['id']=949,
          ['name']='悪ヲ断ツ勇ナル一閃'
        },
        {
          ['id']=950,
          ['name']='ステイヤーニシテスレイヤー'
        },
        {
          ['id']=951,
          ['name']='栄冠掴ム三度目ノ謁見'
        },
        {
          ['id']=952,
          ['name']='北米ノ天才踊リ子'
        },
        {
          ['id']=953,
          ['name']='宿敵倒ス剣ノ舞'
        },
        {
          ['id']=954,
          ['name']='伝説ノレッド・テラー'
        },
        {
          ['id']=955,
          ['name']='伝統ノ一戦ヲ制シタ名血'
        },
        {
          ['id']=956,
          ['name']='名門ガ生ンダ国民的人気馬'
        },
        {
          ['id']=957,
          ['name']='豪脚デ愛サレタ米版シービー'
        },
        {
          ['id']=958,
          ['name']='オールド・ジャック'
        },
        {
          ['id']=959,
          ['name']='正義ヲ貫ク快速王'
        },
        {
          ['id']=960,
          ['name']='兄譲リノ快速美少女'
        },
        {
          ['id']=961,
          ['name']='ハンガリーノ奇跡'
        },
        {
          ['id']=962,
          ['name']='19世紀英国ノ至宝'
        },
        {
          ['id']=963,
          ['name']='世界競馬史上初ノ3冠馬'
        },
        {
          ['id']=964,
          ['name']='近代スピード競馬ノ源泉'
        },
        {
          ['id']=965,
          ['name']='名師ガ叶エタ生涯無敗ノ奇跡'
        },
        {
          ['id']=966,
          ['name']='全米ヲ震撼サセタ3冠圧勝劇'
        },
        {
          ['id']=967,
          ['name']='マイル無双ノ吟遊詩人'
        },
        {
          ['id']=968,
          ['name']='ビッグ・レッドノ最高傑作'
        },
        {
          ['id']=969,
          ['name']='大恐慌時代ヲ救ウ希望ノ星'
        },
        {
          ['id']=970,
          ['name']='英クラシック4冠ヲ制シタ王笏'
        },
        {
          ['id']=971,
          ['name']='神ガ讃エタ5冠馬'
        },
        {
          ['id']=972,
          ['name']='幻ノ馬'
        },
        {
          ['id']=973,
          ['name']='准将ジェラールノ快進撃'
        },
        {
          ['id']=974,
          ['name']='天昇ノ赤龍'
        },
        {
          ['id']=975,
          ['name']='白キ愛ヲ伝エシモノ'
        },
        {
          ['id']=976,
          ['name']='夜明ケヲ望ム若武者'
        },
        {
          ['id']=977,
          ['name']='鋼鉄ノ炎'
        },
        {
          ['id']=978,
          ['name']='白銀ノ大峡谷'
        },
        {
          ['id']=979,
          ['name']='父ノ夢、カナウ未来'
        },
        {
          ['id']=980,
          ['name']='活性化スル日ノ本ノ血脈'
        },
        {
          ['id']=981,
          ['name']='漆黒ノ大獅子'
        },
        {
          ['id']=982,
          ['name']='歓喜湧ク巨人ノ歩ミ'
        },
        {
          ['id']=983,
          ['name']='要塞都市ノ守護者'
        },
        {
          ['id']=984,
          ['name']='気高キ雷光'
        },
        {
          ['id']=985,
          ['name']='長キ祈リノ果テニ'
        },
        {
          ['id']=986,
          ['name']='アメリカン・エリート'
        },
        {
          ['id']=987,
          ['name']='米国ヲ席巻スル正統王者'
        },
        {
          ['id']=988,
          ['name']='音速ノ青キ翼'
        },
        {
          ['id']=989,
          ['name']='号砲鳴ラセ高ラカニ'
        },
        {
          ['id']=990,
          ['name']='日蝕ノ女王'
        },
        {
          ['id']=991,
          ['name']='宿命ニ抗ッタ信念'
        },
        {
          ['id']=992,
          ['name']='太陽ノ英雄譚'
        },
        {
          ['id']=993,
          ['name']='渓谷ヲ駆ケ抜ケル翼'
        },
        {
          ['id']=994,
          ['name']='南半球カラ来タ怪物'
        },
        {
          ['id']=995,
          ['name']='猛キ闘志ニ宿ル勝運'
        },
        {
          ['id']=996,
          ['name']='気マグレ王子'
        },
        {
          ['id']=997,
          ['name']='希望届ケル勝利ノ凱歌'
        },
        {
          ['id']=998,
          ['name']='覚醒スル野生ノ血'
        },
        {
          ['id']=999,
          ['name']='鷲ヨ、強ク高ク舞エ'
        },
        {
          ['id']=1000,
          ['name']='漆黒マトイシ名門ノ雄'
        },
        {
          ['id']=1001,
          ['name']='故郷デ覚醒シタ才気'
        },
        {
          ['id']=1002,
          ['name']='クイーン・オブ・オークス'
        },
        {
          ['id']=1003,
          ['name']='偉大ナ父ニ届ケル吉報'
        },
        {
          ['id']=1004,
          ['name']='栄光ハ挫折ノ先ニ'
        },
        {
          ['id']=1005,
          ['name']='世界ヲ魅了スル真珠'
        },
        {
          ['id']=1006,
          ['name']='伝統ノ直線、誰ヨリモ速ク'
        },
        {
          ['id']=1007,
          ['name']='未来ヘ語リ継ガレル理念'
        },
        {
          ['id']=1008,
          ['name']='身ヲ覆ウホドノ栄光ヲ'
        },
        {
          ['id']=1009,
          ['name']='大金脈ヲ夢見テ'
        },
        {
          ['id']=1010,
          ['name']='大海ヲ照ラス秘宝'
        },
        {
          ['id']=1011,
          ['name']='ターフニ見出ス白キ才能'
        },
        {
          ['id']=1012,
          ['name']='偉業成ス英国貴人'
        },
        {
          ['id']=1013,
          ['name']='砂上ニ飾ル白キ花'
        },
        {
          ['id']=1014,
          ['name']='ブローニュノ雨ニ愛サレテ'
        },
        {
          ['id']=1015,
          ['name']='常識外レノ征服者'
        },
        {
          ['id']=1016,
          ['name']='世紀ノ一戦ヲ制シタモノ'
        },
        {
          ['id']=1017,
          ['name']='伝統ノ地ニ刻ム末脚'
        },
        {
          ['id']=1018,
          ['name']='故郷ニ捧ゲル勝利'
        },
        {
          ['id']=1019,
          ['name']='ミリオネアガール'
        },
        {
          ['id']=1020,
          ['name']='世界ヲ沸カスミラノノ俊才'
        },
        {
          ['id']=1021,
          ['name']='偉業ヲ映ス聖ナル泉'
        },
        {
          ['id']=1022,
          ['name']='紡ガレル名牝ノ血脈'
        },
        {
          ['id']=1023,
          ['name']='果テナキ勝利ヘノ船出'
        },
        {
          ['id']=1024,
          ['name']='並ビ立ツ聖戦士'
        },
        {
          ['id']=1025,
          ['name']='天下無双ノポリー'
        },
        {
          ['id']=1026,
          ['name']='名家ニ駆ケタ夢'
        },
        {
          ['id']=1027,
          ['name']='マハラジャノ疾風'
        },
        {
          ['id']=1028,
          ['name']='大陸ヲ染メル黒キ光'
        },
        {
          ['id']=1029,
          ['name']='花開ク名家ノ才'
        },
        {
          ['id']=1030,
          ['name']='荒鷲ノ恩返シ'
        },
        {
          ['id']=1031,
          ['name']='汚レナキ王冠'
        },
        {
          ['id']=1032,
          ['name']='双界ヲ統ベル光'
        },
        {
          ['id']=1033,
          ['name']='白面ノ荒法師'
        },
        {
          ['id']=1034,
          ['name']='幻ヲ映ス傑作'
        },
        {
          ['id']=1035,
          ['name']='望マレシ勝利ノ行進'
        },
        {
          ['id']=1036,
          ['name']='規格外ノ怪物'
        },
        {
          ['id']=1037,
          ['name']='良血ノ貴公子'
        },
        {
          ['id']=1038,
          ['name']='西ヨリ来タル黄金ノ末脚'
        },
        {
          ['id']=1039,
          ['name']='美少女ノ逃走劇'
        },
        {
          ['id']=1040,
          ['name']='超良血ノ女王'
        },
        {
          ['id']=1041,
          ['name']='新世界切リ拓ク大河'
        },
        {
          ['id']=1042,
          ['name']='激闘制ス船橋ノ雄'
        },
        {
          ['id']=1043,
          ['name']='百折不撓ノ女神'
        },
        {
          ['id']=1044,
          ['name']='蒼海ヲ旅スル少女'
        },
        {
          ['id']=1045,
          ['name']='秘メタ闘魂、猛進ス'
        },
        {
          ['id']=1046,
          ['name']='仁川ノ歌劇王'
        },
        {
          ['id']=1047,
          ['name']='昇リ至ル最強ノ座'
        },
        {
          ['id']=1048,
          ['name']='マイルノ魔術師'
        },
        {
          ['id']=1049,
          ['name']='雌雄超越セシ豪脚'
        },
        {
          ['id']=1050,
          ['name']='ターフニ輝ク北十字星'
        },
        {
          ['id']=1051,
          ['name']='盾ノ栄誉ヲ授ケシ太陽'
        },
        {
          ['id']=1052,
          ['name']='鍛エ、鍛エ抜カレシ刺客'
        },
        {
          ['id']=1053,
          ['name']='東ヨリ来タル超特急'
        },
        {
          ['id']=1054,
          ['name']='春告ゲル盾ノ輝キ'
        },
        {
          ['id']=1055,
          ['name']='イザ、主演舞台ヘ'
        },
        {
          ['id']=1056,
          ['name']='白キ大井ノ帝王'
        },
        {
          ['id']=1057,
          ['name']='優雅ニ瞬ク南十字星'
        },
        {
          ['id']=1058,
          ['name']='マイル・キラー'
        },
        {
          ['id']=1059,
          ['name']='ターフヲ駆ケル英国紳士'
        },
        {
          ['id']=1060,
          ['name']='才女、凱旋ス'
        },
        {
          ['id']=1061,
          ['name']='雄弁ナル強者ノ走リ'
        },
        {
          ['id']=1062,
          ['name']='砂海泳破セシ女王'
        },
        {
          ['id']=1063,
          ['name']='麗シキアスクルムノ豪脚'
        },
        {
          ['id']=1064,
          ['name']='昂ル本能ノママニ'
        },
        {
          ['id']=1065,
          ['name']='伊達男ガ叶エシ夢'
        },
        {
          ['id']=1066,
          ['name']='心打ツ、我ガ誇リノ馬'
        },
        {
          ['id']=1067,
          ['name']='王道制ス四天王ガ一角'
        },
        {
          ['id']=1068,
          ['name']='返リ咲ク薔薇ノ大輪'
        },
        {
          ['id']=1069,
          ['name']='巨星放ツ不屈ノ輝キ'
        },
        {
          ['id']=1070,
          ['name']='嵐ヲ制ス緑風'
        },
        {
          ['id']=1071,
          ['name']='苦節ガ磨キシ勝利ノ宝石'
        },
        {
          ['id']=1072,
          ['name']='幸福運ブ遅咲キノ薔薇'
        },
        {
          ['id']=1073,
          ['name']='誇リト名誉ヲ胸ニ'
        },
        {
          ['id']=1074,
          ['name']='砂塵ニ舞ウペガサス'
        },
        {
          ['id']=1075,
          ['name']='万国踏破スル矜持'
        },
        {
          ['id']=1076,
          ['name']='天使再臨'
        },
        {
          ['id']=1077,
          ['name']='天翔ル都ノ英雄'
        },
        {
          ['id']=1078,
          ['name']='砂塵嵐ノ猛襲'
        },
        {
          ['id']=1079,
          ['name']='戦場突キ進ム逃将'
        },
        {
          ['id']=1080,
          ['name']='米国競馬ブームノ立役者'
        },
        {
          ['id']=1081,
          ['name']='欧州競馬ブームノ立役者'
        },
        {
          ['id']=1082,
          ['name']='時代ノ先駆者'
        },
        {
          ['id']=1083,
          ['name']='世界最強ノ証明'
        },
        {
          ['id']=1084,
          ['name']='舞踊ル黒藍ノ仮面'
        },
        {
          ['id']=1085,
          ['name']='堂々タル勝利ノ博覧'
        },
        {
          ['id']=2047,
          ['en']='None',
          ['ja']='なし'
        }
      },
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_imyou',
        ['setter']='parameter162Set_HRaceData_imyou',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Relationship count',
      ['ja']='相関図頭数',
      ['off']=44,
      ['bit']=4,
      ['bits']=3,
      ['base']='race',
      ['max']=7,
      ['source']='Local EXE D11C0/D1230; HRaceData.soukanzu_count; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_soukanzu_count'
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Drama factor 1 (race record)',
      ['ja']='ドラマ因子1',
      ['off']=44,
      ['bit']=7,
      ['bits']=5,
      ['base']='race',
      ['max']=31,
      ['source']='Local EXE D1310; HRaceData.dramafactor1; isolated native verification',
      ['groupEn']='Registration / race state',
      ['groupJa']='登録・競走状態',
      ['readOnly161']=true,
      ['parameter162']='HRaceData_dramafactor1'
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Ability record ID',
      ['ja']='能力番号',
      ['off']=0,
      ['bit']=0,
      ['bits']=15,
      ['base']='primary',
      ['max']=32767,
      ['source']='Local EXE D63A0/D63E0; HChildData.abl_num; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=true,
      ['parameter162']='HChildData_abl_num'
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Reputation',
      ['ja']='評判',
      ['off']=16,
      ['bit']=0,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['source']='Local EXE D85E0/D8610; HChildData.hyouban; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_hyouban',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_hyouban',
        ['setter']='parameter162Set_HChildData_hyouban',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Racing lifespan',
      ['ja']='競走寿命',
      ['off']=12,
      ['bit']=24,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['source']='Local EXE D8640/D8670; HChildData.zyumyou; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_zyumyou',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_zyumyou',
        ['setter']='parameter162Set_HChildData_zyumyou',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Appraisal value (10,000 yen)',
      ['ja']='評価額（万円）',
      ['off']=12,
      ['bit']=14,
      ['bits']=10,
      ['base']='primary',
      ['max']=99900,
      ['source']='Local EXE D8A70/D8AA0; HChildData.price2; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_price2',
      ['displayScale']=100,
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_price2',
        ['setter']='parameter162Set_HChildData_price2',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Growth limit bonus',
      ['ja']='成長度上限加算',
      ['off']=4,
      ['bit']=27,
      ['bits']=4,
      ['base']='primary',
      ['max']=10,
      ['source']='Local EXE D8FA0/D8FD0; HChildData.seigen; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_seigen',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_seigen',
        ['setter']='parameter162Set_HChildData_seigen',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Poor right-handed courses',
      ['ja']='右回り苦手',
      ['off']=16,
      ['bit']=23,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE D9140/D9170; HChildData.migimawari_X; isolated native verification',
      ['groupEn']='Weaknesses',
      ['groupJa']='弱点',
      ['readOnly161']=false,
      ['parameter162']='HChildData_migimawari_X',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_migimawari_X',
        ['setter']='parameter162Set_HChildData_migimawari_X',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Poor left-handed courses',
      ['ja']='左回り苦手',
      ['off']=16,
      ['bit']=24,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE D91B0/D91E0; HChildData.hidarimawari_X; isolated native verification',
      ['groupEn']='Weaknesses',
      ['groupJa']='弱点',
      ['readOnly161']=false,
      ['parameter162']='HChildData_hidarimawari_X',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_hidarimawari_X',
        ['setter']='parameter162Set_HChildData_hidarimawari_X',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='SSH flag',
      ['ja']='SSHフラグ',
      ['off']=16,
      ['bit']=26,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE D94A0/D94D0; HChildData.SSH_flg; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=true,
      ['parameter162']='HChildData_SSH_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Charm class',
      ['ja']='札',
      ['off']=8,
      ['bit']=28,
      ['bits']=3,
      ['base']='primary',
      ['max']=6,
      ['source']='Local EXE D9510/D9540; HChildData.fuda_color; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_fuda_color',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_fuda_color',
        ['setter']='parameter162Set_HChildData_fuda_color',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Age in breeding record',
      ['ja']='繁殖データの馬齢',
      ['off']=40,
      ['bit']=20,
      ['bits']=6,
      ['base']='primary',
      ['max']=63,
      ['source']='Local EXE DDEE0/DDF30; HSireData.age; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_age'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Retirement state',
      ['ja']='引退状態',
      ['off']=0,
      ['bit']=30,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE DE210; HSireData.intai; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_intai'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Studbook full',
      ['ja']='BookFull',
      ['off']=48,
      ['bit']=30,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE DE350/DE3A0; HSireData.bookfull; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_bookfull',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_bookfull',
        ['setter']='parameter162Set_HSireData_bookfull',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='SSH flag',
      ['ja']='SSHフラグ',
      ['off']=4,
      ['bit']=31,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE DE420/DE470; HSireData.SSH_flg; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_SSH_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Syndicate',
      ['ja']='シンジケート',
      ['off']=48,
      ['bit']=31,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE DE710/DE760; HSireData.syndicate; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_syndicate',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_syndicate',
        ['setter']='parameter162Set_HSireData_syndicate',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Historical horse ID',
      ['ja']='史実番号',
      ['off']=4,
      ['bit']=0,
      ['bits']=16,
      ['base']='primary',
      ['max']=65535,
      ['source']='Local EXE DEAE0; HSireData.shizitsu_num; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_shizitsu_num'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Successful crop year',
      ['ja']='当たり年フラグ',
      ['off']=60,
      ['bit']=23,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE DEE20/DEE70; HSireData.atari_flg; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_atari_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_atari_flg',
        ['setter']='parameter162Set_HSireData_atari_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Major win (upper left)',
      ['ja']='主な勝ち鞍(左上)',
      ['off']=24,
      ['bit']=20,
      ['bits']=12,
      ['base']='primary',
      ['max']=4095,
      ['source']='Local EXE DF620; HSireData.kachikura_LT; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_kachikura_LT'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Recorded starts',
      ['ja']='競走成績 戦数',
      ['off']=8,
      ['bit']=22,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE DFF60/DFFB0; HSireData.record_len; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_record_len'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Career G1 wins',
      ['ja']='現役時代G1勝ち数',
      ['off']=16,
      ['bit']=20,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E00E0/E0130; HSireData.g1_win_count; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_g1_win_count',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_g1_win_count',
        ['setter']='parameter162Set_HSireData_g1_win_count',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Covering count',
      ['ja']='種付け数',
      ['off']=40,
      ['bit']=12,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E01A0/E01F0; HSireData.tanetsuke_count; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_tanetsuke_count',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_tanetsuke_count',
        ['setter']='parameter162Set_HSireData_tanetsuke_count',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Active progeny count',
      ['ja']='現役産駒数',
      ['off']=48,
      ['bit']=0,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E02C0/E0300; HSireData.geneki_count; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_geneki_count',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_geneki_count',
        ['setter']='parameter162Set_HSireData_geneki_count',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Private stallion',
      ['ja']='Private種牡馬',
      ['off']=0,
      ['bit']=19,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E27A0/E27D0; HSireData.priv_flg; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_priv_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_priv_flg',
        ['setter']='parameter162Set_HSireData_priv_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Horse mark',
      ['ja']='マーク(所有馬表示)',
      ['off']=16,
      ['bit']=28,
      ['bits']=4,
      ['base']='primary',
      ['max']=15,
      ['source']='Local EXE E2950/E29A0; HSireData.mark; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_mark',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_mark',
        ['setter']='parameter162Set_HSireData_mark',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Spring event completed',
      ['ja']='春嵐イベントを最後までこなしたかのフラグ',
      ['off']=48,
      ['bit']=28,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E29F0/E2A40; HSireData.spring_flg; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_spring_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_spring_flg',
        ['setter']='parameter162Set_HSireData_spring_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Relationship count',
      ['ja']='相関図頭数',
      ['off']=64,
      ['bit']=0,
      ['bits']=3,
      ['base']='primary',
      ['max']=7,
      ['source']='Local EXE E2AB0/E2AF0; HSireData.soukanzu_count; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HSireData_soukanzu_count'
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Triple Crown',
      ['ja']='三冠フラグ',
      ['off']=56,
      ['bit']=2,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E36A0/E36F0; HSireData.sankan_flg; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_sankan_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_sankan_flg',
        ['setter']='parameter162Set_HSireData_sankan_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Ability record ID',
      ['ja']='能力番号',
      ['off']=8,
      ['bit']=0,
      ['bits']=15,
      ['base']='primary',
      ['max']=32767,
      ['source']='Local EXE E3FE0/E4020; HDamData.abl_num; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_abl_num'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Appraisal value (10,000 yen)',
      ['ja']='評価額（万円）',
      ['off']=16,
      ['bit']=0,
      ['bits']=11,
      ['base']='primary',
      ['max']=99900,
      ['source']='Local EXE E5B40/E5B70; HDamData.price; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_price',
      ['displayScale']=100,
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_price',
        ['setter']='parameter162Set_HDamData_price',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Age in breeding record',
      ['ja']='繁殖データの馬齢',
      ['off']=20,
      ['bit']=0,
      ['bits']=5,
      ['base']='primary',
      ['max']=31,
      ['source']='Local EXE E5F40/E5F70; HDamData.age; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_age'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Years at stud',
      ['ja']='繋養年数',
      ['off']=8,
      ['bit']=27,
      ['bits']=5,
      ['base']='primary',
      ['max']=31,
      ['source']='Local EXE E61F0/E6220; HDamData.keiyou_years; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_keiyou_years',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_keiyou_years',
        ['setter']='parameter162Set_HDamData_keiyou_years',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Pregnancy state',
      ['ja']='受胎確認',
      ['off']=20,
      ['bit']=5,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE E6320/E6350; HDamData.status; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_status'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Retirement state',
      ['ja']='引退状態',
      ['off']=12,
      ['bit']=24,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE E65F0/E6620; HDamData.intai; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_intai'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Triple Crown',
      ['ja']='三冠フラグ',
      ['off']=20,
      ['bit']=12,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E7310/E7340; HDamData.sankan_flg; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_sankan_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_sankan_flg',
        ['setter']='parameter162Set_HDamData_sankan_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='SSH flag',
      ['ja']='SSHフラグ',
      ['off']=20,
      ['bit']=11,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E7820/E7850; HDamData.SSH_flg; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_SSH_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Recorded starts',
      ['ja']='競走成績 戦数',
      ['off']=12,
      ['bit']=0,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E7AC0/E7AF0; HDamData.record_len; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_record_len'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Recorded wins',
      ['ja']='競走成績 勝数',
      ['off']=12,
      ['bit']=8,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E7B20/E7B50; HDamData.record_win; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_record_win',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_record_win',
        ['setter']='parameter162Set_HDamData_record_win',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Career G1 wins',
      ['ja']='現役時代G1勝ち数',
      ['off']=12,
      ['bit']=16,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E7B80/E7BB0; HDamData.g1_win_count; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_g1_win_count',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_g1_win_count',
        ['setter']='parameter162Set_HDamData_g1_win_count',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Charm class',
      ['ja']='札',
      ['off']=20,
      ['bit']=7,
      ['bits']=3,
      ['base']='primary',
      ['max']=6,
      ['source']='Local EXE E7BE0/E7C10; HDamData.fuda_color; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_fuda_color',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_fuda_color',
        ['setter']='parameter162Set_HDamData_fuda_color',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Historical horse ID',
      ['ja']='史実番号',
      ['off']=4,
      ['bit']=0,
      ['bits']=16,
      ['base']='primary',
      ['max']=65535,
      ['source']='Local EXE E7CC0/E7CF0; HDamData.shizitsu_num; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_shizitsu_num'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Historical foal ID',
      ['ja']='受胎中の史実番号',
      ['off']=4,
      ['bit']=16,
      ['bits']=16,
      ['base']='primary',
      ['max']=65535,
      ['source']='Local EXE E7D80/E7DB0; HDamData.preg_shizitsu_num; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_preg_shizitsu_num'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Horse mark',
      ['ja']='マーク(所有馬表示)',
      ['off']=20,
      ['bit']=26,
      ['bits']=4,
      ['base']='primary',
      ['max']=15,
      ['source']='Local EXE E8610/E8640; HDamData.mark; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_mark',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_mark',
        ['setter']='parameter162Set_HDamData_mark',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Spring event completed',
      ['ja']='春雷イベントを最後までこなしたかのフラグ',
      ['off']=0,
      ['bit']=31,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E8680/E86B0; HDamData.spring_flg; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_spring_flg',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_spring_flg',
        ['setter']='parameter162Set_HDamData_spring_flg',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Vitality (green)',
      ['ja']='活力(緑)',
      ['off']=24,
      ['bit']=0,
      ['bits']=6,
      ['base']='primary',
      ['max']=20,
      ['source']='Local EXE E86F0/E8720; HDamData.katsuryoku_green; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_katsuryoku_green',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_katsuryoku_green',
        ['setter']='parameter162Set_HDamData_katsuryoku_green',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Vitality (yellow)',
      ['ja']='活力(黄)',
      ['off']=24,
      ['bit']=6,
      ['bits']=7,
      ['base']='primary',
      ['max']=127,
      ['source']='Local EXE E87A0; HDamData.katsuryoku_yellow; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_katsuryoku_yellow'
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Vitality boost active',
      ['ja']='活力増強発生中',
      ['off']=24,
      ['bit']=13,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE E8A00/E8A30; HDamData.katsuryoku_hassei; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_katsuryoku_hassei',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_katsuryoku_hassei',
        ['setter']='parameter162Set_HDamData_katsuryoku_hassei',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Vitality boost count',
      ['ja']='活力増強発生回数',
      ['off']=24,
      ['bit']=14,
      ['bits']=5,
      ['base']='primary',
      ['max']=25,
      ['source']='Local EXE E8AF0/E8B20; HDamData.katsuryoku_kaisu; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HDamData_katsuryoku_kaisu',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HDamData_katsuryoku_kaisu',
        ['setter']='parameter162Set_HDamData_katsuryoku_kaisu',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedMare','mare'},
    ['field']={
      ['en']='Relationship count',
      ['ja']='相関図頭数',
      ['off']=24,
      ['bit']=19,
      ['bits']=3,
      ['base']='primary',
      ['max']=7,
      ['source']='Local EXE E8EF0/E8F20; HDamData.soukanzu_count; isolated native verification',
      ['groupEn']='Broodmare records',
      ['groupJa']='繁殖牝馬成績・状態',
      ['readOnly161']=true,
      ['parameter162']='HDamData_soukanzu_count'
    }
  },
  {
    ['keys']={'ownedSire','sire','ownedMare','mare'},
    ['field']={
      ['en']='Horse name alphabet',
      ['ja']='馬名表示(0カナ,1英字)',
      ['off']=4,
      ['bit']=30,
      ['bits']=1,
      ['base']='pedigree072',
      ['max']=1,
      ['source']='Local EXE EC060/EC090; HBloodData.display; isolated native verification',
      ['groupEn']='Pedigree record',
      ['groupJa']='血統登録',
      ['readOnly161']=false,
      ['parameter162']='HBloodData_display',
      ['optionsEn']={'Katakana','Latin alphabet'},
      ['optionsJa']={'カタカナ','英字'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HBloodData_display',
        ['setter']='parameter162Set_HBloodData_display',
        ['id']='pedigreeID072'
      }
    }
  },
  {
    ['keys']={'ownedSire','sire','ownedMare','mare'},
    ['field']={
      ['en']='Mare family ID',
      ['ja']='牝系図番号',
      ['off']=12,
      ['bit']=3,
      ['bits']=18,
      ['base']='pedigree072',
      ['max']=262143,
      ['source']='Local EXE EC290/EC2C0; HBloodData.mare_line_num; isolated native verification',
      ['groupEn']='Pedigree record',
      ['groupJa']='血統登録',
      ['readOnly161']=true,
      ['parameter162']='HBloodData_mare_line_num'
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Horse record ID',
      ['ja']='競走馬番号',
      ['off']=4,
      ['bit']=2,
      ['bits']=14,
      ['base']='primary',
      ['max']=16383,
      ['source']='Local EXE F2200; HOwnershipRaceData.horse_num; isolated native verification',
      ['groupEn']='Ownership state',
      ['groupJa']='所有状態',
      ['readOnly161']=true,
      ['parameter162']='HOwnershipRaceData_horse_num'
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Training policy assigned',
      ['ja']='調教方針指示済み',
      ['off']=20,
      ['bit']=30,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE F3CA0/F3D10; HOwnershipRaceData.choukyou_houshinsumi; isolated native verification',
      ['groupEn']='Ownership state',
      ['groupJa']='所有状態',
      ['readOnly161']=false,
      ['parameter162']='HOwnershipRaceData_choukyou_houshinsumi',
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_choukyou_houshinsumi',
        ['setter']='parameter162Set_HOwnershipRaceData_choukyou_houshinsumi',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Next-race policy',
      ['ja']='次走方針',
      ['off']=20,
      ['bit']=7,
      ['bits']=3,
      ['base']='primary',
      ['max']=7,
      ['source']='Local EXE F3EB0/F3F20; HOwnershipRaceData.zisou_houshin; isolated native verification',
      ['groupEn']='Ownership state',
      ['groupJa']='所有状態',
      ['readOnly161']=false,
      ['parameter162']='HOwnershipRaceData_zisou_houshin',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_zisou_houshin',
        ['setter']='parameter162Set_HOwnershipRaceData_zisou_houshin',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Trust gauge (green)',
      ['ja']='信頼(緑)',
      ['off']=484,
      ['bit']=0,
      ['bits']=16,
      ['base']='primary',
      ['max']=65535,
      ['source']='Local EXE F91C0/F9230; HOwnershipRaceData.shinrai_green; isolated native verification',
      ['groupEn']='Ownership state',
      ['groupJa']='所有状態',
      ['readOnly161']=false,
      ['parameter162']='HOwnershipRaceData_shinrai_green',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_shinrai_green',
        ['setter']='parameter162Set_HOwnershipRaceData_shinrai_green',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Horse record ID',
      ['ja']='幼駒番号',
      ['off']=0,
      ['bit']=0,
      ['bits']=12,
      ['base']='ownedFoalDetails092',
      ['max']=4095,
      ['source']='Local EXE FAD70; HOwnershipChildData.horse_num; isolated native verification',
      ['groupEn']='Owned foal record',
      ['groupJa']='所有幼駒記録',
      ['readOnly161']=true,
      ['parameter162']='HOwnershipChildData_horse_num',
      ['ownedFoal092']=true
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Growth power',
      ['ja']='成長力',
      ['off']=20,
      ['bit']=19,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 1160A0/116100; PTrainerData.seichouryoku; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PTrainerData_seichouryoku',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PTrainerData_seichouryoku',
        ['setter']='parameter162Set_PTrainerData_seichouryoku',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Retirement state',
      ['ja']='引退',
      ['off']=20,
      ['bit']=25,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 1162D0/116330; PTrainerData.intai; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=true,
      ['parameter162']='PTrainerData_intai',
      ['personOrdinaryOnly']=true
    }
  },
  {
    ['keys']={'jockey'},
    ['field']={
      ['en']='Jockey name record ID',
      ['ja']='騎手名番号',
      ['off']=4,
      ['bit']=16,
      ['bits']=11,
      ['base']='primary',
      ['max']=2047,
      ['source']='Local EXE 11EB10/11EBA0; PJockeyData.jockey_name_num; isolated native verification',
      ['groupEn']='Jockey profile',
      ['groupJa']='騎手基礎情報',
      ['readOnly161']=true,
      ['parameter162']='PJockeyData_jockey_name_num',
      ['personOrdinaryOnly']=true
    }
  },
  {
    ['keys']={'jockey'},
    ['field']={
      ['en']='Home base',
      ['ja']='拠点',
      ['off']=4,
      ['bit']=27,
      ['bits']=5,
      ['base']='primary',
      ['max']=31,
      ['source']='Local EXE 122970/122A20; PJockeyData.kyoten; isolated native verification',
      ['groupEn']='Jockey profile',
      ['groupJa']='騎手基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PJockeyData_kyoten',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PJockeyData_kyoten',
        ['setter']='parameter162Set_PJockeyData_kyoten',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'jockey'},
    ['field']={
      ['en']='Retirement state',
      ['ja']='引退',
      ['off']=16,
      ['bit']=31,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['source']='Local EXE 122D70/122DE0; PJockeyData.intai; isolated native verification',
      ['groupEn']='Jockey profile',
      ['groupJa']='騎手基礎情報',
      ['readOnly161']=true,
      ['parameter162']='PJockeyData_intai',
      ['personOrdinaryOnly']=true,
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'jockey'},
    ['field']={
      ['en']='Overseas graded-race points',
      ['ja']='海外重賞pt',
      ['off']=124,
      ['bit']=16,
      ['bits']=16,
      ['base']='primary',
      ['max']=60000,
      ['source']='Local EXE 124C20/124C70; PJockeyData.graderace_point; isolated native verification',
      ['groupEn']='Jockey profile',
      ['groupJa']='騎手基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PJockeyData_graderace_point',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PJockeyData_graderace_point',
        ['setter']='parameter162Set_PJockeyData_graderace_point',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Right foreleg marking',
      ['ja']='右前足模様',
      ['off']=4,
      ['bit']=0,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A7210/A72A0; HAblData.right_flont; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_right_flont',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_right_flont',
        ['setter']='parameter162Set_HAblData_right_flont',
        ['id']='horseID',
        ['index']=0
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Left foreleg marking',
      ['ja']='左前足模様',
      ['off']=4,
      ['bit']=2,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A7210/A72A0; HAblData.left_flont; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_left_flont',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_left_flont',
        ['setter']='parameter162Set_HAblData_left_flont',
        ['id']='horseID',
        ['index']=1
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Right hindleg marking',
      ['ja']='右後足模様',
      ['off']=4,
      ['bit']=4,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A7210/A72A0; HAblData.right_hind; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_right_hind',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_right_hind',
        ['setter']='parameter162Set_HAblData_right_hind',
        ['id']='horseID',
        ['index']=2
      }
    }
  },
  {
    ['keys']={'owned','race','ownedFoal','foal','ownedMare','mare','ownedSire','sire'},
    ['field']={
      ['en']='Left hindleg marking',
      ['ja']='左後足模様',
      ['off']=4,
      ['bit']=6,
      ['bits']=2,
      ['base']='horse',
      ['max']=3,
      ['source']='Local EXE A7210/A72A0; HAblData.left_hinde; isolated native verification',
      ['groupEn']='Appearance / bloodline',
      ['groupJa']='外見・血統状態',
      ['readOnly161']=false,
      ['parameter162']='HAblData_left_hinde',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HAblData_left_hinde',
        ['setter']='parameter162Set_HAblData_left_hinde',
        ['id']='horseID',
        ['index']=3
      }
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Sprint foundation',
      ['ja']='短距離(新人)',
      ['off']=32,
      ['bit']=22,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 117220/117310; PTrainerData.shinjin_tankyori; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PTrainerData_shinjin_tankyori',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PTrainerData_shinjin_tankyori',
        ['setter']='parameter162Set_PTrainerData_shinjin_tankyori',
        ['id']='id',
        ['index']=0
      }
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Mile foundation',
      ['ja']='マイル(新人)',
      ['off']=32,
      ['bit']=24,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 117220/117310; PTrainerData.shinjin_mile; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PTrainerData_shinjin_mile',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PTrainerData_shinjin_mile',
        ['setter']='parameter162Set_PTrainerData_shinjin_mile',
        ['id']='id',
        ['index']=1
      }
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Middle-distance foundation',
      ['ja']='中距離(新人)',
      ['off']=32,
      ['bit']=26,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 117220/117310; PTrainerData.shinjin_tyukyori; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PTrainerData_shinjin_tyukyori',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PTrainerData_shinjin_tyukyori',
        ['setter']='parameter162Set_PTrainerData_shinjin_tyukyori',
        ['id']='id',
        ['index']=2
      }
    }
  },
  {
    ['keys']={'trainer'},
    ['field']={
      ['en']='Long-distance foundation',
      ['ja']='長距離(新人)',
      ['off']=32,
      ['bit']=28,
      ['bits']=2,
      ['base']='primary',
      ['max']=3,
      ['source']='Local EXE 117220/117310; PTrainerData.shinjin_tyoukyori; isolated native verification',
      ['groupEn']='Trainer profile',
      ['groupJa']='調教師基礎情報',
      ['readOnly161']=false,
      ['parameter162']='PTrainerData_shinjin_tyoukyori',
      ['personOrdinaryOnly']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_PTrainerData_shinjin_tyoukyori',
        ['setter']='parameter162Set_PTrainerData_shinjin_tyoukyori',
        ['id']='id',
        ['index']=3
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Leading rank 1 year ago',
      ['ja']='1年前成績',
      ['off']=48,
      ['bit']=20,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E05F0/E06F0; HSireData.rank_1_ago; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_rank_1_ago',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_rank_1_ago',
        ['setter']='parameter162Set_HSireData_rank_1_ago',
        ['id']='id',
        ['index']=0
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Leading rank 2 years ago',
      ['ja']='2年前成績',
      ['off']=52,
      ['bit']=0,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E05F0/E06F0; HSireData.rank_2_ago; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_rank_2_ago',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_rank_2_ago',
        ['setter']='parameter162Set_HSireData_rank_2_ago',
        ['id']='id',
        ['index']=1
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Leading rank 3 years ago',
      ['ja']='3年前成績',
      ['off']=52,
      ['bit']=8,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E05F0/E06F0; HSireData.rank_3_ago; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_rank_3_ago',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_rank_3_ago',
        ['setter']='parameter162Set_HSireData_rank_3_ago',
        ['id']='id',
        ['index']=2
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Leading rank 4 years ago',
      ['ja']='4年前成績',
      ['off']=52,
      ['bit']=16,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E05F0/E06F0; HSireData.rank_4_ago; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_rank_4_ago',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_rank_4_ago',
        ['setter']='parameter162Set_HSireData_rank_4_ago',
        ['id']='id',
        ['index']=3
      }
    }
  },
  {
    ['keys']={'ownedSire','sire'},
    ['field']={
      ['en']='Leading rank 5 years ago',
      ['ja']='5年前成績',
      ['off']=52,
      ['bit']=24,
      ['bits']=8,
      ['base']='primary',
      ['max']=255,
      ['source']='Local EXE E05F0/E06F0; HSireData.rank_5_ago; isolated native verification',
      ['groupEn']='Stallion records',
      ['groupJa']='種牡馬成績・状態',
      ['readOnly161']=false,
      ['parameter162']='HSireData_rank_5_ago',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HSireData_rank_5_ago',
        ['setter']='parameter162Set_HSireData_rank_5_ago',
        ['id']='id',
        ['index']=4
      }
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Growth degree',
      ['ja']='成長度',
      ['off']=8,
      ['bit']=20,
      ['bits']=8,
      ['base']='primary',
      ['max']=125,
      ['source']='Local EXE D8DA0/D8DD0; HChildData.seichou; isolated native verification',
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['readOnly161']=false,
      ['parameter162']='HChildData_seichou',
      ['foalGrowthCap162']=true,
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_seichou',
        ['setter']='parameter162Set_HChildData_seichou',
        ['id']='id'
      }
    }
  }
}
    local specs={
  ['parameter162Get_HAblData_ryuusei']={
    ['rva']=684032,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 38 48 8B 05 3D'
  },
  ['parameter162Set_HAblData_ryuusei']={
    ['rva']=684080,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 23 83 FA 2D 7D 1E 0F'
  },
  ['parameter162Get_HAblData_taikou']={
    ['rva']=685216,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 06 B8 01 00 00 00 C3 0F B7 C1 48 6B C8 38 48 8B 05 9A 72'
  },
  ['parameter162Set_HAblData_taikou']={
    ['rva']=685264,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 23 83 FA 03 7D 1E 0F'
  },
  ['parameter162Get_HAblData_zenchou']={
    ['rva']=685328,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 06 B8 01 00 00 00 C3 0F B7 C1 48 6B C8 38 48 8B 05 2A 72'
  },
  ['parameter162Set_HAblData_zenchou']={
    ['rva']=685376,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 25 83 FA 03 7D 20 0F B7 C1 83 E2 03 48 6B C8 38 48 8B 05 F8 71 F7 03'
  },
  ['parameter162Get_HAblData_sanpakugan']={
    ['rva']=685648,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 38 48 8B 05 ED 70 F7 03 8B'
  },
  ['parameter162Set_HAblData_sanpakugan']={
    ['rva']=685696,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 23 0F B7 C1 4C 6B C0 38 4C 03 05 C0 70 F7 03'
  },
  ['parameter162Get_HAblData_tyumokuba']={
    ['rva']=685904,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 38 48 8B 05 ED 6F F7 03 8B'
  },
  ['parameter162Set_HAblData_tyumokuba']={
    ['rva']=685952,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 20 0F B7 C1 83 E2 07'
  },
  ['parameter162Get_HAblData_sekaikeitou_flg1']={
    ['rva']=691088,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 6B C8 38 48 8B 05 AE 5B'
  },
  ['parameter162Set_HAblData_sekaikeitou_flg1']={
    ['rva']=691136,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 38 4C 03 05 7E 5B'
  },
  ['parameter162Get_HAblData_sekaikeitou_flg2']={
    ['rva']=691200,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 6B C8 38 48 8B 05 3E 5B'
  },
  ['parameter162Set_HAblData_sekaikeitou_flg2']={
    ['rva']=691248,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 38 4C 03 05 0E 5B'
  },
  ['parameter162Get_HAblData_sekaikeitou_flg3']={
    ['rva']=691312,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 6B C8 38 48 8B 05 CE 5A'
  },
  ['parameter162Set_HAblData_sekaikeitou_flg3']={
    ['rva']=691360,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 38 4C 03 05 9E 5A'
  },
  ['parameter162Get_HAblData_sekaikeitou_flg4']={
    ['rva']=691424,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 6B C8 38 48 8B 05 5E 5A'
  },
  ['parameter162Set_HAblData_sekaikeitou_flg4']={
    ['rva']=691472,
    ['pattern']='B8 2D 70 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 38 4C 03 05 2E 5A'
  },
  ['parameter162Get_HAblData_boom_mark']={
    ['rva']=697552,
    ['pattern']='B8 2D 70 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 38 48 8B 05 6D 42 F7 03 8B'
  },
  ['parameter162Set_HAblData_boom_mark']={
    ['rva']=697600,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 23 0F B7 C1 4C 6B C0 38 4C 03 05 40 42 F7 03'
  },
  ['parameter162Get_HRaceData_kansen']={
    ['rva']=767120,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 76 56 B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 45 E0'
  },
  ['parameter162Set_HRaceData_kansen']={
    ['rva']=767248,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D D7 DF E0 03'
  },
  ['parameter162Get_HRaceData_kaigaiensei']={
    ['rva']=781776,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 1A A7 E0'
  },
  ['parameter162Set_HRaceData_kaigaiensei']={
    ['rva']=781888,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D A7 A6 E0 03'
  },
  ['parameter162Get_HRaceData_race_kan']={
    ['rva']=783488,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 6A A0 E0'
  },
  ['parameter162Set_HRaceData_race_kan']={
    ['rva']=783600,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D F7 9F E0 03'
  },
  ['parameter162Get_HRaceData_klass']={
    ['rva']=786032,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 1A 0F B7 C0 48 6B C8 34 48 8B 05 19'
  },
  ['parameter162Set_HRaceData_klass']={
    ['rva']=786192,
    ['pattern']='48 83 EC 28 44 8B DA 0F B7 C1 BA 86 1A 00 00 66 2B C2 BA 73 18 00 00 66 3B C2 77 2E 41 83 FB 06'
  },
  ['parameter162Get_HRaceData_houboku_len']={
    ['rva']=788736,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 76 59 B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D D5 8B'
  },
  ['parameter162Set_HRaceData_houboku_len']={
    ['rva']=788864,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 67 8B E0 03'
  },
  ['parameter162Get_HRaceData_houbokuchuu']={
    ['rva']=789664,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 76 59 B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 35 88'
  },
  ['parameter162Set_HRaceData_houbokuchuu']={
    ['rva']=789792,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D C7 87 E0 03'
  },
  ['parameter162Get_HRaceData_ensei']={
    ['rva']=789920,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 76 59 B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 35 87'
  },
  ['parameter162Set_HRaceData_ensei']={
    ['rva']=790208,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 27 86 E0 03'
  },
  ['parameter162Get_HRaceData_g1_win_count']={
    ['rva']=815888,
    ['pattern']='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 18 0F B7 C0 48 6B C8 34 48 8B 05 79'
  },
  ['parameter162Set_HRaceData_g1_win_count']={
    ['rva']=816048,
    ['pattern']='48 83 EC 28 44 8B DA 0F B7 C1 BA 86 1A 00 00 66 2B C2 BA 73 18 00 00 66 3B C2 77 22'
  },
  ['parameter162Get_HRaceData_imyou']={
    ['rva']=852496,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 74 8B 15'
  },
  ['parameter162Set_HRaceData_imyou']={
    ['rva']=852656,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 0F B7 DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 36 92 DF'
  },
  ['parameter162Get_HChildData_hyouban']={
    ['rva']=886240,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 CD 24 F5 03 8B'
  },
  ['parameter162Set_HChildData_hyouban']={
    ['rva']=886288,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 1F 83 FA 64 77 1A 0F'
  },
  ['parameter162Get_HChildData_zyumyou']={
    ['rva']=886336,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 6D 24 F5 03 0F'
  },
  ['parameter162Set_HChildData_zyumyou']={
    ['rva']=886384,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 64 77 20 0F B7 C1 83 E2 7F C1 E2 18'
  },
  ['parameter162Get_HChildData_price2']={
    ['rva']=887408,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 3D 20 F5 03 8B'
  },
  ['parameter162Set_HChildData_price2']={
    ['rva']=887456,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 2B 81 FA E7 03 00 00'
  },
  ['parameter162Get_HChildData_seigen']={
    ['rva']=888736,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 0D 1B F5 03 8B'
  },
  ['parameter162Set_HChildData_seigen']={
    ['rva']=888784,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 0A 77 20 0F'
  },
  ['parameter162Get_HChildData_migimawari_X']={
    ['rva']=889152,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 6D 19 F5 03 8B'
  },
  ['parameter162Set_HChildData_migimawari_X']={
    ['rva']=889200,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 27 0F B7 C1 48 8D 0C 40 48 8B 05 40 19 F5 03'
  },
  ['parameter162Get_HChildData_hidarimawari_X']={
    ['rva']=889264,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 FD'
  },
  ['parameter162Set_HChildData_hidarimawari_X']={
    ['rva']=889312,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 27 0F B7 C1 48 8D 0C 40 48 8B 05 D0 18 F5 03'
  },
  ['parameter162Get_HChildData_fuda_color']={
    ['rva']=890128,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 9D 15 F5 03 8B'
  },
  ['parameter162Set_HChildData_fuda_color']={
    ['rva']=890176,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 07 7D 20 0F'
  },
  ['parameter162Get_HSireData_bookfull']={
    ['rva']=910160,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 2D 80 FA FF 85'
  },
  ['parameter162Set_HSireData_bookfull']={
    ['rva']=910240,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 D9 7F FA FF 85'
  },
  ['parameter162Get_HSireData_syndicate']={
    ['rva']=911120,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 6D 7C FA FF 85'
  },
  ['parameter162Set_HSireData_syndicate']={
    ['rva']=911200,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 19 7C FA FF 85'
  },
  ['parameter162Get_HSireData_atari_flg']={
    ['rva']=912928,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 5D 75 FA FF 85'
  },
  ['parameter162Set_HSireData_atari_flg']={
    ['rva']=913008,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 09 75 FA FF 85'
  },
  ['parameter162Get_HSireData_g1_win_count']={
    ['rva']=917728,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 9D 62 FA FF 85'
  },
  ['parameter162Set_HSireData_g1_win_count']={
    ['rva']=917808,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 49 62 FA FF 85'
  },
  ['parameter162Get_HSireData_tanetsuke_count']={
    ['rva']=917920,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 DD 61 FA FF 85'
  },
  ['parameter162Set_HSireData_tanetsuke_count']={
    ['rva']=918000,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 89 61 FA FF 85'
  },
  ['parameter162Get_HSireData_geneki_count']={
    ['rva']=918208,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 BD 60 FA FF 85'
  },
  ['parameter162Set_HSireData_geneki_count']={
    ['rva']=918272,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 79 60 FA FF 85'
  },
  ['parameter162Get_HSireData_priv_flg']={
    ['rva']=927648,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 5D 79 11 00 8B'
  },
  ['parameter162Set_HSireData_priv_flg']={
    ['rva']=927696,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 83 7C 24 48 00 74 0A C7 44 24 20 01 00 00 00 EB 08 C7 44 24 20 00 00 00 00 0F B7 4C 24 40 E8 10 79 11 00'
  },
  ['parameter162Get_HSireData_mark']={
    ['rva']=928080,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 2D 3A FA FF 85'
  },
  ['parameter162Set_HSireData_mark']={
    ['rva']=928160,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 59 77 11 00 48'
  },
  ['parameter162Get_HSireData_spring_flg']={
    ['rva']=928240,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 8D 39 FA FF 85'
  },
  ['parameter162Set_HSireData_spring_flg']={
    ['rva']=928320,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 83 7C 24 48 00 74 0A C7 44 24 20 01 00 00 00 EB 08 C7 44 24 20 00 00 00 00 0F B7 4C 24 40 E8 A0 76 11 00'
  },
  ['parameter162Get_HSireData_sankan_flg']={
    ['rva']=931488,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 DD 2C FA FF 85'
  },
  ['parameter162Set_HSireData_sankan_flg']={
    ['rva']=931568,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 83 7C 24 48 00 74 0A C7 44 24 20 01 00 00 00 EB 08 C7 44 24 20 00 00 00 00 0F B7 4C 24 40 E8 F0 69 11 00'
  },
  ['parameter162Get_HDamData_price']={
    ['rva']=940864,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 BD 4E F4 03 8B'
  },
  ['parameter162Set_HDamData_price']={
    ['rva']=940912,
    ['pattern']='B8 10 27 00 00 66 3B C8 73 28 81 FA E7 03 00 00'
  },
  ['parameter162Get_HDamData_keiyou_years']={
    ['rva']=942576,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 0D 48 F4 03 8B'
  },
  ['parameter162Set_HDamData_keiyou_years']={
    ['rva']=942624,
    ['pattern']='B8 10 27 00 00 66 3B C8 73 22 83 FA 1F 77 1D 0F'
  },
  ['parameter162Get_HDamData_sankan_flg']={
    ['rva']=946960,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 ED 36 F4 03 8B'
  },
  ['parameter162Set_HDamData_sankan_flg']={
    ['rva']=947008,
    ['pattern']='B8 10 27 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 44 4C 03 05 BE 36'
  },
  ['parameter162Get_HDamData_record_win']={
    ['rva']=949024,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 DD 2E F4 03 0F'
  },
  ['parameter162Set_HDamData_record_win']={
    ['rva']=949072,
    ['pattern']='B8 10 27 00 00 66 3B C8 73 1A 81 FA FF 00 00 00 77 12 0F B7 C1 48 6B C8 44 48 8B 05 A8 2E F4 03'
  },
  ['parameter162Get_HDamData_g1_win_count']={
    ['rva']=949120,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 7D 2E F4 03 0F'
  },
  ['parameter162Set_HDamData_g1_win_count']={
    ['rva']=949168,
    ['pattern']='B8 10 27 00 00 66 3B C8 73 1A 81 FA FF 00 00 00 77 12 0F B7 C1 48 6B C8 44 48 8B 05 48 2E F4 03'
  },
  ['parameter162Get_HDamData_fuda_color']={
    ['rva']=949216,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 1D'
  },
  ['parameter162Set_HDamData_fuda_color']={
    ['rva']=949264,
    ['pattern']='B8 10 27 00 00 66 3B C8 73 25 83 FA 07 7D 20 0F'
  },
  ['parameter162Get_HDamData_mark']={
    ['rva']=951824,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 ED 23 F4 03 8B'
  },
  ['parameter162Set_HDamData_mark']={
    ['rva']=951872,
    ['pattern']='B8 10 27 00 00 66 3B C8 66 0F 42 C1 83 E2 0F 0F'
  },
  ['parameter162Get_HDamData_spring_flg']={
    ['rva']=951936,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 7D 23 F4 03 8B'
  },
  ['parameter162Set_HDamData_spring_flg']={
    ['rva']=951984,
    ['pattern']='B8 10 27 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 44 4C 03 05 4E 23'
  },
  ['parameter162Get_HDamData_katsuryoku_green']={
    ['rva']=952048,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 07 8B 05 40 1D 52 04'
  },
  ['parameter162Set_HDamData_katsuryoku_green']={
    ['rva']=952096,
    ['pattern']='3B 15 4E DD 96 03 77 26 B8 10 27 00 00 66 3B C8'
  },
  ['parameter162Get_HDamData_katsuryoku_hassei']={
    ['rva']=952832,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 FD 1F F4 03 8B'
  },
  ['parameter162Set_HDamData_katsuryoku_hassei']={
    ['rva']=952880,
    ['pattern']='B8 10 27 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 4C 6B C0 44 4C 03 05 CE 1F'
  },
  ['parameter162Get_HDamData_katsuryoku_kaisu']={
    ['rva']=953072,
    ['pattern']='B8 10 27 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 6B C8 44 48 8B 05 0D 1F F4 03 8B'
  },
  ['parameter162Set_HDamData_katsuryoku_kaisu']={
    ['rva']=953120,
    ['pattern']='83 FA 19 77 2C B8 10 27 00 00 66 3B C8 66 0F 42'
  },
  ['parameter162Get_HBloodData_display']={
    ['rva']=966752,
    ['pattern']='81 F9 A0 86 01 00 72 03 33 C0 C3 8B C1 48 8D 0C 40 48 8B 05 30 0B F3 03'
  },
  ['parameter162Set_HBloodData_display']={
    ['rva']=966800,
    ['pattern']='81 F9 A0 86 01 00 73 26 8B C1 48 8D 0C 40 48 8B 05 03 0B F3'
  },
  ['parameter162Get_HOwnershipRaceData_choukyou_houshinsumi']={
    ['rva']=998560,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 BD 39 19 00 85'
  },
  ['parameter162Set_HOwnershipRaceData_choukyou_houshinsumi']={
    ['rva']=998672,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 49 39 19 00 85'
  },
  ['parameter162Get_HOwnershipRaceData_zisou_houshin']={
    ['rva']=999088,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 AD 37 19 00 85'
  },
  ['parameter162Set_HOwnershipRaceData_zisou_houshin']={
    ['rva']=999200,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 39 37 19 00 85'
  },
  ['parameter162Get_HOwnershipRaceData_shinrai_green']={
    ['rva']=1020352,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 9D E4 18 00 85'
  },
  ['parameter162Set_HOwnershipRaceData_shinrai_green']={
    ['rva']=1020464,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 29 E4 18 00 85'
  },
  ['parameter162Get_PTrainerData_seichouryoku']={
    ['rva']=1138848,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 0D 03 F7 FF 85'
  },
  ['parameter162Set_PTrainerData_seichouryoku']={
    ['rva']=1138944,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 A9 02 F7 FF 85'
  },
  ['parameter162Get_PJockeyData_kyoten']={
    ['rva']=1190256,
    ['pattern']='48 83 EC 28 8B 15 96 6B DA 03 B8 59 03 00 00 44'
  },
  ['parameter162Set_PJockeyData_kyoten']={
    ['rva']=1190432,
    ['pattern']='48 83 EC 28 B8 59 03 00 00 44 8B D2 66 3B C8 72 26 74 75 B8'
  },
  ['parameter162Get_PJockeyData_graderace_point']={
    ['rva']=1199136,
    ['pattern']='48 83 EC 28 BA 4A 02 00 00 0F B7 C1 66 2B C2 BA 0E 01 00 00 66 3B C2 77 18 0F B7 C0'
  },
  ['parameter162Set_PJockeyData_graderace_point']={
    ['rva']=1199216,
    ['pattern']='48 83 EC 28 41 BA 60 EA 00 00 0F B7 C1 41 3B D2'
  },
  ['parameter162Get_HAblData_right_flont']={
    ['rva']=684560,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 79 83 FA 04 7D 74 85'
  },
  ['parameter162Set_HAblData_right_flont']={
    ['rva']=684704,
    ['pattern']='B8 2D 70 00 00 66 3B C8 0F 83 AC 00 00 00 83 FA'
  },
  ['parameter162Get_HAblData_left_flont']={
    ['rva']=684560,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 79 83 FA 04 7D 74 85'
  },
  ['parameter162Set_HAblData_left_flont']={
    ['rva']=684704,
    ['pattern']='B8 2D 70 00 00 66 3B C8 0F 83 AC 00 00 00 83 FA'
  },
  ['parameter162Get_HAblData_right_hind']={
    ['rva']=684560,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 79 83 FA 04 7D 74 85'
  },
  ['parameter162Set_HAblData_right_hind']={
    ['rva']=684704,
    ['pattern']='B8 2D 70 00 00 66 3B C8 0F 83 AC 00 00 00 83 FA'
  },
  ['parameter162Get_HAblData_left_hinde']={
    ['rva']=684560,
    ['pattern']='B8 2D 70 00 00 66 3B C8 73 79 83 FA 04 7D 74 85'
  },
  ['parameter162Set_HAblData_left_hinde']={
    ['rva']=684704,
    ['pattern']='B8 2D 70 00 00 66 3B C8 0F 83 AC 00 00 00 83 FA'
  },
  ['parameter162Get_PTrainerData_shinjin_tankyori']={
    ['rva']=1143328,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 F1 F6 FF 85'
  },
  ['parameter162Set_PTrainerData_shinjin_tankyori']={
    ['rva']=1143568,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 94 F0 F6 FF'
  },
  ['parameter162Get_PTrainerData_shinjin_mile']={
    ['rva']=1143328,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 F1 F6 FF 85'
  },
  ['parameter162Set_PTrainerData_shinjin_mile']={
    ['rva']=1143568,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 94 F0 F6 FF'
  },
  ['parameter162Get_PTrainerData_shinjin_tyukyori']={
    ['rva']=1143328,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 F1 F6 FF 85'
  },
  ['parameter162Set_PTrainerData_shinjin_tyukyori']={
    ['rva']=1143568,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 94 F0 F6 FF'
  },
  ['parameter162Get_PTrainerData_shinjin_tyoukyori']={
    ['rva']=1143328,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 F1 F6 FF 85'
  },
  ['parameter162Set_PTrainerData_shinjin_tyoukyori']={
    ['rva']=1143568,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 94 F0 F6 FF'
  },
  ['parameter162Get_HSireData_rank_1_ago']={
    ['rva']=919024,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 5D FA FF 85'
  },
  ['parameter162Set_HSireData_rank_1_ago']={
    ['rva']=919280,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 BA FF'
  },
  ['parameter162Get_HSireData_rank_2_ago']={
    ['rva']=919024,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 5D FA FF 85'
  },
  ['parameter162Set_HSireData_rank_2_ago']={
    ['rva']=919280,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 BA FF'
  },
  ['parameter162Get_HSireData_rank_3_ago']={
    ['rva']=919024,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 5D FA FF 85'
  },
  ['parameter162Set_HSireData_rank_3_ago']={
    ['rva']=919280,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 BA FF'
  },
  ['parameter162Get_HSireData_rank_4_ago']={
    ['rva']=919024,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 5D FA FF 85'
  },
  ['parameter162Set_HSireData_rank_4_ago']={
    ['rva']=919280,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 BA FF'
  },
  ['parameter162Get_HSireData_rank_5_ago']={
    ['rva']=919024,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 89 5D FA FF 85'
  },
  ['parameter162Set_HSireData_rank_5_ago']={
    ['rva']=919280,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 BA FF'
  },
  ['parameter162Get_HChildData_seichou']={
    ['rva']=888224,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 0D 1D F5 03 8B'
  },
  ['parameter162Set_HChildData_seichou']={
    ['rva']=888272,
    ['pattern']='48 89 5C 24 08 57 48 83 EC 20 0F B7 D9 B8 70 0D'
  }
}

    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
    function WP26.foalGrowthCeiling162(c,bonus)
      return 100+WP26.bits(c.primary,16,27,1)*10+(bonus or WP26.bits(c.primary,4,27,4))
    end
    for _,key in ipairs({'foal','ownedFoal'}) do
      table.insert(WP26.EDITORS[key].fields,{en='Growth ceiling',ja='成長度上限',off=4,bit=27,bits=4,max=125,readOnly161=true,growthCeiling162=true,parameter162='HChildData_growth_ceiling',groupEn='Foal development',groupJa='幼駒育成',source='Local EXE D8D30; 100/110 plus current growth-limit bonus'})
    end
    local available=WP26.fieldAvailable
    function WP26.fieldAvailable(c,f)
      if f.parameter162 and not c[f.base or 'primary'] then return false end
      if f.foalGrowthCap162 then
        local planned=WP26.plannedGrowth162
        f.max=planned and planned.key==c.key and planned.id==c.id and planned.ceiling or WP26.foalGrowthCeiling162(c)
      end
      return available(c,f)
    end
    local queue=WP26.queueFieldEdit
    function WP26.queueFieldEdit(info,value)
      local field=WP26.EDITORS[info.key].fields[info.index]
      if field.foalGrowthCap162 then field.max=WP26.foalGrowthCeiling162(WP26.context(info.key,info.session.id)) end
      return queue(info,value)
    end
    local read=WP26.fieldRead
    function WP26.fieldRead(c,f)
      if f.growthCeiling162 then return WP26.foalGrowthCeiling162(c) end
      if not f.entityLabel162 then return read(c,f) end
      local raw={};for k,v in pairs(f) do raw[k]=v end;raw.string=false
      local id=read(c,raw)
      c.parameterLabels162=c.parameterLabels162 or {}
      local cached=c.parameterLabels162[f.parameter162]
      if cached and cached.id==id then return cached.name end
      local ok,name=pcall(function()return WP26.entityName(f.entityLabel162,id,WP26.context(f.entityLabel162,id))end)
      name=ok and name~='' and name or tostring(id)
      c.parameterLabels162[f.parameter162]={id=id,name=name}
      return name
    end
    local write=WP26.writeField
    function WP26.writeField(c,f,value,journal)
      local native=f.nativeParameter162
      if not native then return write(c,f,value,journal) end
      WP26.require()
      local fresh=WP26.context(c.key,c.id)
      local member=f.base or 'primary'
      assert(fresh[member] and fresh[member]==c[member] and fresh.horseID==c.horseID and fresh.raceID==c.raceID and fresh[native.id]==c[native.id],'Parameter identity changed')
      assert(WP26.fieldAvailable(fresh,f),'Parameter unavailable for this record')
      if f.foalGrowthCap162 then f.max=WP26.foalGrowthCeiling162(fresh) end
      value=WP26.normalizeNumeric120(f,value)
      assert(value~=nil,'Numeric parameter required')
      local scale,add=f.displayScale or 1,f.displayAdd or 0
      local raw=math.tointeger((value-add)/scale)
      assert(raw~=nil,'Parameter increment mismatch')
      local id=fresh[native.id];assert(type(id)=='number','Native parameter identity unavailable')
      local old=WP26.fieldRead(fresh,f)
      local previous=assert(math.tointeger((old-add)/scale),'Stored parameter is not an integer')
      local function get()
        if native.index~=nil then return WP26.native(native.getter,id,native.index) end
        return WP26.native(native.getter,id)
      end
      local function set(v)
        if native.index~=nil then return WP26.native(native.setter,id,native.index,v) end
        return WP26.native(native.setter,id,v)
      end
      assert(get()==previous,'Parameter getter disagrees with record')
      if old==value then return end
      set(raw)
      if WP26.fieldRead(fresh,f)~=value or get()~=raw then
        set(previous)
        assert(WP26.fieldRead(fresh,f)==old,'Parameter restoration failed')
        error('Parameter native write verification failed',0)
      end
      if journal~=false then
        WP26.history[#WP26.history+1]={pid=WP26.pid,ctx=fresh,field=f,old=old,new=value,address=fresh[member]+f.off}
        if #WP26.history>4096 then table.remove(WP26.history,1) end
      end
    end
    local lists=WP26.EntityLists116
    local plan=lists.horsePlan124
    function lists.horsePlan124(s,row,strongest)
      local edits=plan(s,row,strongest);local filtered={}
      local c=(s.key=='foal' or s.key=='ownedFoal') and lists.context124(s,row) or nil
      local bonus=c and WP26.bits(c.primary,4,27,4) or 0
      if strongest then
        for _,edit in ipairs(edits) do if edit.field.parameter162=='HChildData_seigen' then bonus=edit.value end end
      end
      for _,edit in ipairs(edits) do
        if not edit.field.readOnly161 then
          if strongest and edit.field.foalGrowthCap162 then edit.value=WP26.foalGrowthCeiling162(c,bonus) end
          filtered[#filtered+1]=edit
        end
      end
      return filtered
    end
    local apply=lists.applyEdits124
    WP26.applyEditsBeforeGrowth162=apply
    function lists.applyEdits124(s,row,edits,trace)
      local copied,bonusEdit,growthEdit={},nil,nil
      for _,edit in ipairs(edits) do
        copied[#copied+1]=edit
        if edit.field.parameter162=='HChildData_seigen' then bonusEdit=edit end
        if edit.field.foalGrowthCap162 then growthEdit=edit end
      end
      if not growthEdit then return apply(s,row,edits,trace) end
      local c=lists.context124(s,row)
      local bonus=WP26.bits(c.primary,4,27,4)
      local nextBonus=bonusEdit and WP26.normalizeNumeric120(bonusEdit.field,bonusEdit.value) or bonus
      if bonusEdit then
        local first,last=nextBonus>=bonus and bonusEdit or growthEdit,nextBonus>=bonus and growthEdit or bonusEdit
        copied={first}
        for _,edit in ipairs(edits) do if edit~=first and edit~=last then copied[#copied+1]=edit end end
        copied[#copied+1]=last
      end
      local previous=WP26.plannedGrowth162
      WP26.plannedGrowth162={key=c.key,id=c.id,ceiling=WP26.foalGrowthCeiling162(c,nextBonus)}
      local result=table.pack(pcall(apply,s,row,copied,trace))
      WP26.plannedGrowth162=previous
      if not result[1] then error(result[2],0) end
      return table.unpack(result,2,result.n)
    end
  end

  do
    local definitions={
  {
    ['keys']={'staff','farmStaff'},
    ['field']={
      ['en']='Appraisal experience',
      ['ja']='相馬眼経験値',
      ['off']=0,
      ['bit']=0,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_0_7',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10C860/10C8A0; increment calls ability setter 10D1B0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_0_7',
        ['setter']='parameter162Set_StaffData_field_0_0_7',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'staff','farmStaff'},
    ['field']={
      ['en']='Bloodline knowledge experience',
      ['ja']='血統知識経験値',
      ['off']=0,
      ['bit']=7,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_7_7',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CA10/10CA50; increment calls ability setter 10D4B0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_7_7',
        ['setter']='parameter162Set_StaffData_field_0_7_7',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'staff','farmStaff'},
    ['field']={
      ['en']='Breeding experience',
      ['ja']='種付け経験値',
      ['off']=0,
      ['bit']=14,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_14_7',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CBE0/10CC20; increment calls ability setter 10D330; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_14_7',
        ['setter']='parameter162Set_StaffData_field_0_14_7',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'staff','farmStaff'},
    ['field']={
      ['en']='Breaking-in experience',
      ['ja']='馴致経験値',
      ['off']=0,
      ['bit']=21,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_21_7',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CDB0/10CDF0; increment calls ability setter 10D640; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_21_7',
        ['setter']='parameter162Set_StaffData_field_0_21_7',
        ['id']='id'
      }
    }
  },
  {
    ['keys']={'staff','farmStaff'},
    ['field']={
      ['en']='Health management experience',
      ['ja']='健康管理経験値',
      ['off']=8,
      ['bit']=23,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_8_23_7',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CF80/10CFC0; increment calls ability setter 10D7D0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_8_23_7',
        ['setter']='parameter162Set_StaffData_field_8_23_7',
        ['id']='id'
      }
    }
  }
}
    local specs={
  ['parameter162Get_StaffData_field_0_0_7']={
    ['rva']=1099872,
    ['pattern']='B8 94 00 00 00 66 3B C8 72 03 33 C0 C3 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 60 21 F1 03'
  },
  ['parameter162Set_StaffData_field_0_0_7']={
    ['rva']=1099936,
    ['pattern']='B8 94 00 00 00 66 3B C8 73 2E 83 FA 64 77 29 66 83 F9 73 B8 74 00 00 00'
  },
  ['parameter162Get_StaffData_field_0_7_7']={
    ['rva']=1100304,
    ['pattern']='B8 94 00 00 00 66 3B C8 72 03 33 C0 C3 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 B0 1F F1 03'
  },
  ['parameter162Set_StaffData_field_0_7_7']={
    ['rva']=1100368,
    ['pattern']='B8 94 00 00 00 66 3B C8 73 34 83 FA 64 77 2F 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 83 E2 7F 0F B7 C0 C1 E2 07 48 8D 0C'
  },
  ['parameter162Get_StaffData_field_0_14_7']={
    ['rva']=1100768,
    ['pattern']='B8 94 00 00 00 66 3B C8 72 03 33 C0 C3 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 E0 1D F1 03'
  },
  ['parameter162Set_StaffData_field_0_14_7']={
    ['rva']=1100832,
    ['pattern']='B8 94 00 00 00 66 3B C8 73 34 83 FA 64 77 2F 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 83 E2 7F 0F B7 C0 C1 E2 0E 48 8D 0C'
  },
  ['parameter162Get_StaffData_field_0_21_7']={
    ['rva']=1101232,
    ['pattern']='B8 94 00 00 00 66 3B C8 72 03 33 C0 C3 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 10 1C F1 03'
  },
  ['parameter162Set_StaffData_field_0_21_7']={
    ['rva']=1101296,
    ['pattern']='B8 94 00 00 00 66 3B C8 73 34 83 FA 64 77 2F 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 83 E2 7F 0F B7 C0 C1 E2 15 48 8D 0C'
  },
  ['parameter162Get_StaffData_field_8_23_7']={
    ['rva']=1101696,
    ['pattern']='B8 94 00 00 00 66 3B C8 72 03 33 C0 C3 66 83 F9 73 B8 74 00 00 00 66 0F 46 C1 0F B7 C0 48 8D 0C 40 48 8B 05 40 1A F1 03'
  },
  ['parameter162Set_StaffData_field_8_23_7']={
    ['rva']=1101760,
    ['pattern']='B8 94 00 00 00 66 3B C8 73 36 83 FA 64 77 31 66 83 F9 73 B8 74 00 00 00'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      local installed={}
      for _,key in ipairs(definition.keys) do
        local destination=WP26.EDITORS[key].fields
        if not installed[destination] then
        installed[destination]=true
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(destination,field)
        end
      end
    end
  end

  do
    local definitions={
  {
    ['keys']={'family'},
    ['field']={
      ['en']='Hobby',
      ['ja']='趣味',
      ['off']=76,
      ['bit']=17,
      ['bits']=6,
      ['base']='primary',
      ['max']=13,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_17_6',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_17_6',
        ['setter']='parameter162Set_FamilyData_field_4C_17_6',
        ['id']='id'
      },
      ['source']='Local EXE 169360/1693A0; family UI 8F7580; local name tables 39DF030/39DF0A0',
      ['optionsEn']={'None','Video games','Amusement parks','Listening to music','Cycling','Watching movies','Watching sports','Model building','Reading','Horse riding','Insect collecting','Playing instruments','Keeping pets','Ballet'},
      ['optionsJa']={'なし','ゲーム','遊園地','音楽鑑賞','サイクリング','映画鑑賞','スポーツ観戦','模型作り','読書','乗馬','昆虫採集','楽器演奏','ペット飼育','バレエ'}
    }
  },
  {
    ['keys']={'family'},
    ['field']={
      ['en']='Dream',
      ['ja']='将来の夢',
      ['off']=76,
      ['bit']=0,
      ['bits']=6,
      ['base']='primary',
      ['max']=23,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_0_6',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_0_6',
        ['setter']='parameter162Set_FamilyData_field_4C_0_6',
        ['id']='id'
      },
      ['source']='Local EXE 169420/169460; family UI 8F7580; local name tables 39DF030/39DF0A0',
      ['optionsEn']={'None','Baseball player','Football player','School teacher','Kindergarten teacher','Doctor','Civil servant','Engineer','Car mechanic','Entertainer','Chef','Office worker','Nurse','Manga artist','Hairdresser','Animal keeper','Cake shop owner','Designer','Office lady','Horse owner','Jockey','Trainer','Farm manager','Idol'},
      ['optionsJa']={'なし','野球選手','サッカー選手','学校の先生','幼稚園の先生','医者','公務員','エンジニア','車の整備士','芸能人','調理師','サラリーマン','看護師','漫画家','美容師','動物の飼育員','ケーキ屋','デザイナー','ＯＬ','馬主','騎手','調教師','牧場長','アイドル'}
    }
  },
  {
    ['keys']={'family'},
    ['field']={
      ['en']='Fame',
      ['ja']='名声',
      ['off']=76,
      ['bit']=6,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_6_7',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_6_7',
        ['setter']='parameter162Set_FamilyData_field_4C_6_7',
        ['id']='id'
      },
      ['source']='Local EXE 16A100/16A140; family UI 8F7580; local name tables 39DF030/39DF0A0'
    }
  },
  {
    ['keys']={'owner'},
    ['field']={
      ['en']='Owned farm',
      ['ja']='所属牧場',
      ['off']=28,
      ['bit']=0,
      ['bits']=9,
      ['base']='primary',
      ['max']=273,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_1C_0_9',
      ['readOnly161']=true,
      ['source']='Local EXE 1006B0; verified native getter; local caller tracing',
      ['farmChoices070']=true,
      ['ownerLayout164']={
        ['off']=8,
        ['bit']=12,
        ['bits']=9
      }
    }
  },
  {
    ['keys']={'owner'},
    ['field']={
      ['en']='Home base',
      ['ja']='拠点',
      ['off']=24,
      ['bit']=10,
      ['bits']=5,
      ['base']='primary',
      ['max']=25,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_18_10_5',
      ['readOnly161']=true,
      ['source']='Local EXE 1009B0; verified native getter; local caller tracing',
      ['optionsEn']={'Kanto','Kansai','United States','United Kingdom','Ireland','France','Germany','Italy','Hong Kong','Australia','Singapore','UAE','Hokkaido','Iwate','Tochigi','Takasaki','Urawa','Funabashi','Oi','Kawasaki','Nagoya','Kasamatsu','Kanazawa','Hyogo','Kochi','Saga'},
      ['optionsJa']={'関東','関西','米国','英国','愛国','仏国','独国','伊国','香港','豪州','星国','ＵＡＥ','北海道','岩手','栃木','高崎','浦和','船橋','大井','川崎','名古屋','笠松','金沢','兵庫','高知','佐賀'},
      ['ownerLayout164']={
        ['off']=12,
        ['bit']=1,
        ['bits']=5
      }
    }
  },
  {
    ['keys']={'owner'},
    ['field']={
      ['en']='Previous-year prize money',
      ['ja']='前年賞金',
      ['off']=4,
      ['bit']=0,
      ['bits']=24,
      ['base']='primary',
      ['max']=16777215,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_4_0_24',
      ['readOnly161']=true,
      ['source']='Local EXE 101CE0; verified native getter; local caller tracing'
    }
  },
  {
    ['keys']={'farm'},
    ['field']={
      ['en']='Current-year prize money',
      ['ja']='本年賞金',
      ['off']=0,
      ['bit']=0,
      ['bits']=24,
      ['base']='primary',
      ['max']=9999999,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='FarmData_field_0_0_24',
      ['readOnly161']=true,
      ['source']='Local EXE 105F00; verified native getter; local caller tracing'
    }
  },
  {
    ['keys']={'farm'},
    ['field']={
      ['en']='Previous-year prize money',
      ['ja']='前年賞金',
      ['off']=4,
      ['bit']=0,
      ['bits']=24,
      ['base']='primary',
      ['max']=9999999,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='FarmData_field_4_0_24',
      ['readOnly161']=true,
      ['source']='Local EXE 106070; verified native getter; local caller tracing'
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Current secretary',
      ['ja']='現在の秘書',
      ['off']=32,
      ['bit']=0,
      ['bits']=16,
      ['base']='primary',
      ['max']=65535,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='PlayerData_field_20_0_16',
      ['readOnly161']=true,
      ['source']='Local EXE 130380; verified native getter; local caller tracing',
      ['string']=true,
      ['customSize079']=4,
      ['entityLabel162']='secretary',
      ['entityNone164']=150
    }
  }
}
    local specs={
  ['parameter162Get_FamilyData_field_4C_17_6']={
    ['rva']=1479520,
    ['pattern']='66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 CD BD 11 00 85 C0 75 04 33'
  },
  ['parameter162Set_FamilyData_field_4C_17_6']={
    ['rva']=1479584,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 89 BD 11 00 85'
  },
  ['parameter162Get_FamilyData_field_4C_0_6']={
    ['rva']=1479712,
    ['pattern']='66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 0D BD 11 00 85 C0 75 04 33'
  },
  ['parameter162Set_FamilyData_field_4C_0_6']={
    ['rva']=1479776,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 C9 BC 11 00 85'
  },
  ['parameter162Get_FamilyData_field_4C_6_7']={
    ['rva']=1483008,
    ['pattern']='66 89 4C 24 08 48 83 EC 28 0F B7 4C 24 30 E8 2D B0 11 00 85 C0 75 04 33'
  },
  ['parameter162Set_FamilyData_field_4C_6_7']={
    ['rva']=1483072,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 E9 AF 11 00 85'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
    local available=WP26.fieldAvailable
    function WP26.fieldAvailable(c,f)
      if f.ownerLayout164 and c.ownerDynamic091 then return c.primary~=nil end
      return available(c,f)
    end
    local layout=WP26.fieldLayout
    function WP26.fieldLayout(c,f)
      if c.ownerDynamic091 and f.ownerLayout164 then
        local v=f.ownerLayout164
        return v.off,v.bit,v.bits
      end
      return layout(c,f)
    end
    local read=WP26.fieldRead
    function WP26.fieldRead(c,f)
      if f.entityNone164 then
        local off,bit,bits=WP26.fieldLayout(c,f)
        if WP26.bits(c[f.base or 'primary'],off,bit,bits)==f.entityNone164 then return WP26.T('None','なし') end
      end
      return read(c,f)
    end
    for _,f in ipairs(WP26.EDITORS.jockey.fields) do
      if f.parameter162=='PJockeyData_kyoten' then f.optionsEn={'Kanto','Kansai','United States','United Kingdom','Ireland','France','Germany','Italy','Hong Kong','Australia','Singapore','UAE','Hokkaido','Iwate','Tochigi','Takasaki','Urawa','Funabashi','Oi','Kawasaki','Nagoya','Kasamatsu','Kanazawa','Hyogo','Kochi','Saga'};f.optionsJa={'関東','関西','米国','英国','愛国','仏国','独国','伊国','香港','豪州','星国','ＵＡＥ','北海道','岩手','栃木','高崎','浦和','船橋','大井','川崎','名古屋','笠松','金沢','兵庫','高知','佐賀'} end
    end
  end

  do
    local definitions={
  {
    ['keys']={'staff','farmStaff','secretary','acquaintance'},
    ['field']={
      ['en']='Hobby',
      ['ja']='趣味',
      ['off']=76,
      ['bit']=17,
      ['bits']=6,
      ['base']='personProfile165',
      ['max']=13,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_17_6_profile165',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_17_6',
        ['setter']='parameter162Set_FamilyData_field_4C_17_6',
        ['id']='personID165'
      },
      ['source']='Local EXE 169360/1693A0; family UI 8F7580; local name tables 39DF030/39DF0A0; master links: staff 10EE30, secretary 12B520, acquaintance 129EF0',
      ['optionsEn']={'None','Video games','Amusement parks','Listening to music','Cycling','Watching movies','Watching sports','Model building','Reading','Horse riding','Insect collecting','Playing instruments','Keeping pets','Ballet'},
      ['optionsJa']={'なし','ゲーム','遊園地','音楽鑑賞','サイクリング','映画鑑賞','スポーツ観戦','模型作り','読書','乗馬','昆虫採集','楽器演奏','ペット飼育','バレエ'},
      ['profileParameter165']=true
    }
  },
  {
    ['keys']={'staff','farmStaff','secretary','acquaintance'},
    ['field']={
      ['en']='Dream',
      ['ja']='将来の夢',
      ['off']=76,
      ['bit']=0,
      ['bits']=6,
      ['base']='personProfile165',
      ['max']=23,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_0_6_profile165',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_0_6',
        ['setter']='parameter162Set_FamilyData_field_4C_0_6',
        ['id']='personID165'
      },
      ['source']='Local EXE 169420/169460; family UI 8F7580; local name tables 39DF030/39DF0A0; master links: staff 10EE30, secretary 12B520, acquaintance 129EF0',
      ['optionsEn']={'None','Baseball player','Football player','School teacher','Kindergarten teacher','Doctor','Civil servant','Engineer','Car mechanic','Entertainer','Chef','Office worker','Nurse','Manga artist','Hairdresser','Animal keeper','Cake shop owner','Designer','Office lady','Horse owner','Jockey','Trainer','Farm manager','Idol'},
      ['optionsJa']={'なし','野球選手','サッカー選手','学校の先生','幼稚園の先生','医者','公務員','エンジニア','車の整備士','芸能人','調理師','サラリーマン','看護師','漫画家','美容師','動物の飼育員','ケーキ屋','デザイナー','ＯＬ','馬主','騎手','調教師','牧場長','アイドル'},
      ['profileParameter165']=true
    }
  },
  {
    ['keys']={'staff','farmStaff','secretary','acquaintance'},
    ['field']={
      ['en']='Fame',
      ['ja']='名声',
      ['off']=76,
      ['bit']=6,
      ['bits']=7,
      ['base']='personProfile165',
      ['max']=100,
      ['groupEn']='Profile',
      ['groupJa']='人物情報',
      ['parameter162']='FamilyData_field_4C_6_7_profile165',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FamilyData_field_4C_6_7',
        ['setter']='parameter162Set_FamilyData_field_4C_6_7',
        ['id']='personID165'
      },
      ['source']='Local EXE 16A100/16A140; family UI 8F7580; local name tables 39DF030/39DF0A0; master links: staff 10EE30, secretary 12B520, acquaintance 129EF0',
      ['profileParameter165']=true
    }
  },
  {
    ['keys']={'acquaintance'},
    ['field']={
      ['en']='Appraisal experience',
      ['ja']='相馬眼経験値',
      ['off']=0,
      ['bit']=0,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_0_7_contact165',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10C860/10C8A0; increment calls ability setter 10D1B0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_0_7',
        ['setter']='parameter162Set_StaffData_field_0_0_7',
        ['id']='id'
      },
      ['contactSource']='staff'
    }
  },
  {
    ['keys']={'acquaintance'},
    ['field']={
      ['en']='Bloodline knowledge experience',
      ['ja']='血統知識経験値',
      ['off']=0,
      ['bit']=7,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_7_7_contact165',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CA10/10CA50; increment calls ability setter 10D4B0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_7_7',
        ['setter']='parameter162Set_StaffData_field_0_7_7',
        ['id']='id'
      },
      ['contactSource']='staff'
    }
  },
  {
    ['keys']={'acquaintance'},
    ['field']={
      ['en']='Breeding experience',
      ['ja']='種付け経験値',
      ['off']=0,
      ['bit']=14,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_14_7_contact165',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CBE0/10CC20; increment calls ability setter 10D330; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_14_7',
        ['setter']='parameter162Set_StaffData_field_0_14_7',
        ['id']='id'
      },
      ['contactSource']='staff'
    }
  },
  {
    ['keys']={'acquaintance'},
    ['field']={
      ['en']='Breaking-in experience',
      ['ja']='馴致経験値',
      ['off']=0,
      ['bit']=21,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_0_21_7_contact165',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CDB0/10CDF0; increment calls ability setter 10D640; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_0_21_7',
        ['setter']='parameter162Set_StaffData_field_0_21_7',
        ['id']='id'
      },
      ['contactSource']='staff'
    }
  },
  {
    ['keys']={'acquaintance'},
    ['field']={
      ['en']='Health management experience',
      ['ja']='健康管理経験値',
      ['off']=8,
      ['bit']=23,
      ['bits']=7,
      ['base']='primary',
      ['max']=100,
      ['ordinaryOnly']=true,
      ['parameter162']='StaffData_field_8_23_7_contact165',
      ['groupEn']='Ability experience',
      ['groupJa']='能力経験値',
      ['source']='Local EXE 10CF80/10CFC0; increment calls ability setter 10D7D0; ordinary staff only',
      ['nativeParameter162']={
        ['getter']='parameter162Get_StaffData_field_8_23_7',
        ['setter']='parameter162Set_StaffData_field_8_23_7',
        ['id']='id'
      },
      ['contactSource']='staff'
    }
  }
}
    for _,definition in ipairs(definitions) do
      local installed={}
      for _,key in ipairs(definition.keys) do
        local destination=WP26.EDITORS[key].fields
        if not installed[destination] then
          installed[destination]=true
          local field={}
          for name,value in pairs(definition.field) do field[name]=value end
          table.insert(destination,field)
        end
      end
    end
    local context=WP26.context
    function WP26.context(key,id)
      local c=context(key,id)
      local person
      if c.key=='staff' then person=c.staffPersonID
      elseif c.key=='secretary' then person=WP26.bits(c.primary,0,12,14)
      elseif c.key=='acquaintance' then person=WP26.bits(c.primary,4,0,14)
      end
      if person and person>=0 and person<10000 then
        local address=WP26.data('personMaster')+person*140
        if WP26.bits(address,72,0,1)==1 then
          c.personProfile165=address
          c.personID165=person
        end
      end
      return c
    end
  end

  do
    local definitions={
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Career G1 wins',
      ['ja']='通算GI勝利',
      ['off']=8,
      ['bit']=0,
      ['bits']=20,
      ['base']='playerOwner',
      ['max']=999999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_8_0_20_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_8_0_20_166',
        ['setter']='parameter162Set_POwnerData_field_8_0_20_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 1003E0/100430; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Overseas G1 wins',
      ['ja']='海外GI勝利',
      ['off']=20,
      ['bit']=11,
      ['bits']=20,
      ['base']='playerOwner',
      ['max']=999999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_14_11_20_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_14_11_20_166',
        ['setter']='parameter162Set_POwnerData_field_14_11_20_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 100550/1005A0; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'owner'},
    ['field']={
      ['en']='Sex',
      ['ja']='性別',
      ['off']=24,
      ['bit']=25,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_18_25_1_166_owner',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_18_25_1_166',
        ['setter']='parameter162Set_POwnerData_field_18_25_1_166',
        ['id']='id'
      },
      ['source']='Local EXE 101650/1016B0; owner UI 881BB8/8F865F; player owner ID 46',
      ['optionsEn']={'Male','Female'},
      ['optionsJa']={'男性','女性'},
      ['ownerLayout164']={
        ['off']=12,
        ['bit']=0,
        ['bits']=1
      }
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Sex',
      ['ja']='性別',
      ['off']=24,
      ['bit']=25,
      ['bits']=1,
      ['base']='playerOwner',
      ['max']=1,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_18_25_1_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_18_25_1_166',
        ['setter']='parameter162Set_POwnerData_field_18_25_1_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 101650/1016B0; owner UI 881BB8/8F865F; player owner ID 46',
      ['optionsEn']={'Male','Female'},
      ['optionsJa']={'男性','女性'}
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Current-year prize money',
      ['ja']='本年賞金',
      ['off']=0,
      ['bit']=0,
      ['bits']=24,
      ['base']='playerOwner',
      ['max']=9999999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_0_0_24_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_0_0_24_166',
        ['setter']='parameter162Set_POwnerData_field_0_0_24_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 101B70/101BD0; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Career wins',
      ['ja']='通算勝利',
      ['off']=16,
      ['bit']=0,
      ['bits']=30,
      ['base']='playerOwner',
      ['max']=999999999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_10_0_30_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_10_0_30_166',
        ['setter']='parameter162Set_POwnerData_field_10_0_30_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 101E00/101E50; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'owner'},
    ['field']={
      ['en']='Current-year wins',
      ['ja']='本年勝利',
      ['off']=8,
      ['bit']=20,
      ['bits']=11,
      ['base']='primary',
      ['max']=1999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_8_20_11_166_owner',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_8_20_11_166',
        ['setter']='parameter162Set_POwnerData_field_8_20_11_166',
        ['id']='id'
      },
      ['source']='Local EXE 101F70/101FC0; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Current-year wins',
      ['ja']='本年勝利',
      ['off']=8,
      ['bit']=20,
      ['bits']=11,
      ['base']='playerOwner',
      ['max']=1999,
      ['groupEn']='Owner profile / records',
      ['groupJa']='馬主情報・記録',
      ['parameter162']='POwnerData_field_8_20_11_166_player',
      ['nativeParameter162']={
        ['getter']='parameter162Get_POwnerData_field_8_20_11_166',
        ['setter']='parameter162Set_POwnerData_field_8_20_11_166',
        ['id']='playerOwnerID166'
      },
      ['source']='Local EXE 101F70/101FC0; owner UI 881BB8/8F865F; player owner ID 46'
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Owned farm',
      ['ja']='所属牧場',
      ['off']=28,
      ['bit']=0,
      ['bits']=9,
      ['base']='playerOwner',
      ['max']=273,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_1C_0_9_player166',
      ['readOnly161']=true,
      ['source']='Local EXE 1006B0; verified native getter; local caller tracing',
      ['farmChoices070']=true
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Home base',
      ['ja']='拠点',
      ['off']=24,
      ['bit']=10,
      ['bits']=5,
      ['base']='playerOwner',
      ['max']=25,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_18_10_5_player166',
      ['readOnly161']=true,
      ['source']='Local EXE 1009B0; verified native getter; local caller tracing',
      ['optionsEn']={'Kanto','Kansai','United States','United Kingdom','Ireland','France','Germany','Italy','Hong Kong','Australia','Singapore','UAE','Hokkaido','Iwate','Tochigi','Takasaki','Urawa','Funabashi','Oi','Kawasaki','Nagoya','Kasamatsu','Kanazawa','Hyogo','Kochi','Saga'},
      ['optionsJa']={'関東','関西','米国','英国','愛国','仏国','独国','伊国','香港','豪州','星国','ＵＡＥ','北海道','岩手','栃木','高崎','浦和','船橋','大井','川崎','名古屋','笠松','金沢','兵庫','高知','佐賀'}
    }
  },
  {
    ['keys']={'player'},
    ['field']={
      ['en']='Previous-year prize money',
      ['ja']='前年賞金',
      ['off']=4,
      ['bit']=0,
      ['bits']=24,
      ['base']='playerOwner',
      ['max']=16777215,
      ['groupEn']='Profile / records',
      ['groupJa']='人物情報・記録',
      ['parameter162']='POwnerData_field_4_0_24_player166',
      ['readOnly161']=true,
      ['source']='Local EXE 101CE0; verified native getter; local caller tracing'
    }
  }
}
    local specs={
  ['parameter162Get_POwnerData_field_8_0_20_166']={
    ['rva']=1049568,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 35 8D 41 D0 BA 93 11 00 00 66 3B C2 76 28 66 83 F9 2F B8 30 00 00 00 66 0F 46 C1 0F B7 C0 48 69 C8 8C 00 00 00 48 8B 05 1B A6 F2'
  },
  ['parameter162Set_POwnerData_field_8_0_20_166']={
    ['rva']=1049648,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 47 81 FA 3F 42 0F 00 77 3F 8D 41 D0 41 B8 93 11 00 00 66 41 3B C0 76 30 66 83 F9 2F B8 30 00 00 00 66 0F 46 C1 81 E2 FF FF 0F 00 0F B7 C0 48 69 C8 8C 00 00 00 48 8B 05 BB A5 F2'
  },
  ['parameter162Get_POwnerData_field_14_11_20_166']={
    ['rva']=1049936,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 38 8D 41 D0 BA 93 11 00 00 66 3B C2 76 2B 66 83 F9 2F B8 30 00 00 00 66 0F 46 C1 0F B7 C0 48 69 C8 8C 00 00 00 48 8B 05 AB A4 F2'
  },
  ['parameter162Set_POwnerData_field_14_11_20_166']={
    ['rva']=1050016,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 4A 81 FA 3F 42 0F 00 77 42 8D 41 D0 41 B8 93'
  },
  ['parameter162Get_POwnerData_field_18_25_1_166']={
    ['rva']=1054288,
    ['pattern']='B8 C4 11 00 00 66 3B C8 72 03 33 C0 C3 8D 41 D0 BA 93 11 00 00 66 3B C2 77 16 0F B7 C0 48 8D 0C C0 48 8B 05 58 8F F2 03'
  },
  ['parameter162Set_POwnerData_field_18_25_1_166']={
    ['rva']=1054384,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 5F 83 FA 02 7D 5A 8D 41 D0 41 B8 93 11 00 00'
  },
  ['parameter162Get_POwnerData_field_0_0_24_166']={
    ['rva']=1055600,
    ['pattern']='B8 C4 11 00 00 66 3B C8 72 03 33 C0 C3 8D 41 D0 BA 93 11 00 00 66 3B C2 77 17 0F B7 C0 48 8D 0C C0 48 8B 05 38 8A F2 03'
  },
  ['parameter162Set_POwnerData_field_0_0_24_166']={
    ['rva']=1055696,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 64 81 FA 7F 96 98 00 77 5C 8D 41 D0 41 B8 93'
  },
  ['parameter162Get_POwnerData_field_10_0_30_166']={
    ['rva']=1056256,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 35 8D 41 D0 BA 93 11 00 00 66 3B C2 76 28 66 83 F9 2F B8 30 00 00 00 66 0F 46 C1 0F B7 C0 48 69 C8 8C 00 00 00 48 8B 05 FB 8B F2'
  },
  ['parameter162Set_POwnerData_field_10_0_30_166']={
    ['rva']=1056336,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 47 81 FA FF C9 9A 3B 77 3F 8D 41 D0 41 B8 93'
  },
  ['parameter162Get_POwnerData_field_8_20_11_166']={
    ['rva']=1056624,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 38 8D 41 D0 BA 93 11 00 00 66 3B C2 76 2B 66 83 F9 2F B8 30 00 00 00 66 0F 46 C1 0F B7 C0 48 69 C8 8C 00 00 00 48 8B 05 8B 8A F2'
  },
  ['parameter162Set_POwnerData_field_8_20_11_166']={
    ['rva']=1056704,
    ['pattern']='B8 C4 11 00 00 66 3B C8 73 4A 81 FA CF 07 00 00 77 42 8D 41 D0 41 B8 93'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
    local context=WP26.context
    function WP26.context(key,id)
      local c=context(key,id)
      if c.key=='player' and c.playerOwner then c.playerOwnerID166=46 end
      return c
    end
  end

  do
    local definitions={
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Browband pattern',
      ['ja']='額革の模様',
      ['off']=48,
      ['bit']=2,
      ['bits']=3,
      ['base']='race',
      ['max']=6,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_2_3_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BDBE0/BDC50; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_2_3_169',
        ['setter']='parameter162Set_HRaceData_field_30_2_3_169',
        ['id']='raceID'
      },
      ['optionsEn']={'None','Pattern 1','Pattern 2','Pattern 3','Pattern 4','Pattern 5','Pattern 6'},
      ['optionsJa']={'なし','模様1','模様2','模様3','模様4','模様5','模様6'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Noseband pattern',
      ['ja']='鼻革の模様',
      ['off']=48,
      ['bit']=5,
      ['bits']=3,
      ['base']='race',
      ['max']=6,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_5_3_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BDCD0/BDD40; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_5_3_169',
        ['setter']='parameter162Set_HRaceData_field_30_5_3_169',
        ['id']='raceID'
      },
      ['optionsEn']={'None','Pattern 1','Pattern 2','Pattern 3','Pattern 4','Pattern 5','Pattern 6'},
      ['optionsJa']={'なし','模様1','模様2','模様3','模様4','模様5','模様6'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Hood base color',
      ['ja']='メンコ地色',
      ['off']=48,
      ['bit']=8,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_8_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BDDC0/BDE30; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_8_4_169',
        ['setter']='parameter162Set_HRaceData_field_30_8_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Browband pattern color 1',
      ['ja']='額革の模様色1',
      ['off']=48,
      ['bit']=12,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_12_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BDEB0/BDF20; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_12_4_169',
        ['setter']='parameter162Set_HRaceData_field_30_12_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Browband pattern color 2',
      ['ja']='額革の模様色2',
      ['off']=48,
      ['bit']=16,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_16_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BDFA0/BE010; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_16_4_169',
        ['setter']='parameter162Set_HRaceData_field_30_16_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Noseband pattern color 1',
      ['ja']='鼻革の模様色1',
      ['off']=48,
      ['bit']=20,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_20_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE090/BE100; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_20_4_169',
        ['setter']='parameter162Set_HRaceData_field_30_20_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Noseband pattern color 2',
      ['ja']='鼻革の模様色2',
      ['off']=48,
      ['bit']=24,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_24_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE180/BE1F0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_24_4_169',
        ['setter']='parameter162Set_HRaceData_field_30_24_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Cross noseband color',
      ['ja']='クロス鼻革の色',
      ['off']=52,
      ['bit']=8,
      ['bits']=4,
      ['base']='race',
      ['max']=8,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_34_8_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE270/BE2E0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_34_8_4_169',
        ['setter']='parameter162Set_HRaceData_field_34_8_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Hide noseband',
      ['ja']='鼻革なし',
      ['off']=48,
      ['bit']=28,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_28_1_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE360/BE3D0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_28_1_169',
        ['setter']='parameter162Set_HRaceData_field_30_28_1_169',
        ['id']='raceID'
      },
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Watari',
      ['ja']='ワタリ',
      ['off']=48,
      ['bit']=29,
      ['bits']=1,
      ['base']='race',
      ['max']=1,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_30_29_1_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE450/BE4C0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_30_29_1_169',
        ['setter']='parameter162Set_HRaceData_field_30_29_1_169',
        ['id']='raceID'
      },
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'}
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Watari color 1',
      ['ja']='ワタリの色1',
      ['off']=52,
      ['bit']=0,
      ['bits']=4,
      ['base']='race',
      ['max']=9,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_34_0_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE540/BE5B0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_34_0_4_169',
        ['setter']='parameter162Set_HRaceData_field_34_0_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Watari color 2',
      ['ja']='ワタリの色2',
      ['off']=52,
      ['bit']=4,
      ['bits']=4,
      ['base']='race',
      ['max']=9,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_34_4_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE620/BE690; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_34_4_4_169',
        ['setter']='parameter162Set_HRaceData_field_34_4_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned','race'},
    ['field']={
      ['en']='Watari color 3',
      ['ja']='ワタリの色3',
      ['off']=52,
      ['bit']=12,
      ['bits']=4,
      ['base']='race',
      ['max']=9,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HRaceData_field_34_12_4_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE BE710/BE780; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HRaceData_field_34_12_4_169',
        ['setter']='parameter162Set_HRaceData_field_34_12_4_169',
        ['id']='raceID'
      }
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Mane decoration',
      ['ja']='タテガミ装飾',
      ['off']=0,
      ['bit']=19,
      ['bits']=2,
      ['base']='primary',
      ['max']=2,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HOwnershipRaceData_field_0_19_2_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE F2F30/F2FA0; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_field_0_19_2_169',
        ['setter']='parameter162Set_HOwnershipRaceData_field_0_19_2_169',
        ['id']='id'
      },
      ['optionsEn']={'None','Ribbon','Braids'},
      ['optionsJa']={'なし','リボン','三つ編み'}
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Mane decoration color 1',
      ['ja']='タテガミ装飾の色1',
      ['off']=0,
      ['bit']=21,
      ['bits']=4,
      ['base']='primary',
      ['max']=10,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HOwnershipRaceData_mane_color_1_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE F3040/F3120; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_mane_color_1_169',
        ['setter']='parameter162Set_HOwnershipRaceData_mane_color_1_169',
        ['id']='id',
        ['index']=0
      }
    }
  },
  {
    ['keys']={'owned'},
    ['field']={
      ['en']='Mane decoration color 2',
      ['ja']='タテガミ装飾の色2',
      ['off']=0,
      ['bit']=25,
      ['bits']=4,
      ['base']='primary',
      ['max']=10,
      ['groupEn']='Equipment',
      ['groupJa']='馬具',
      ['parameter162']='HOwnershipRaceData_mane_color_2_169',
      ['equipmentParameter169']=true,
      ['source']='Local EXE F3040/F3120; UI mode routes 92C630/92D640/92DD10/92B910; WMM 10157..10167; renderer 2C070',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HOwnershipRaceData_mane_color_2_169',
        ['setter']='parameter162Set_HOwnershipRaceData_mane_color_2_169',
        ['id']='id',
        ['index']=1
      }
    }
  }
}
    local specs={
  ['parameter162Get_HRaceData_field_30_2_3_169']={
    ['rva']=777184,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 46 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 0A B9 E0'
  },
  ['parameter162Set_HRaceData_field_30_2_3_169']={
    ['rva']=777296,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 07 7D 5B B8 85 1A 00 00 66 3B C8 76 3C BA FB'
  },
  ['parameter162Get_HRaceData_field_30_5_3_169']={
    ['rva']=777424,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 46 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 1A B8 E0'
  },
  ['parameter162Set_HRaceData_field_30_5_3_169']={
    ['rva']=777536,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 07 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB'
  },
  ['parameter162Get_HRaceData_field_30_8_4_169']={
    ['rva']=777664,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 2A B7 E0'
  },
  ['parameter162Set_HRaceData_field_30_8_4_169']={
    ['rva']=777776,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D B2 B6 E0'
  },
  ['parameter162Get_HRaceData_field_30_12_4_169']={
    ['rva']=777904,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 3A B6 E0'
  },
  ['parameter162Set_HRaceData_field_30_12_4_169']={
    ['rva']=778016,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D C2 B5 E0'
  },
  ['parameter162Get_HRaceData_field_30_16_4_169']={
    ['rva']=778144,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 4A B5 E0'
  },
  ['parameter162Set_HRaceData_field_30_16_4_169']={
    ['rva']=778256,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D D2 B4 E0'
  },
  ['parameter162Get_HRaceData_field_30_20_4_169']={
    ['rva']=778384,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 5A B4 E0'
  },
  ['parameter162Set_HRaceData_field_30_20_4_169']={
    ['rva']=778496,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D E2 B3 E0'
  },
  ['parameter162Get_HRaceData_field_30_24_4_169']={
    ['rva']=778624,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 6A B3 E0'
  },
  ['parameter162Set_HRaceData_field_30_24_4_169']={
    ['rva']=778736,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D F2 B2 E0'
  },
  ['parameter162Get_HRaceData_field_34_8_4_169']={
    ['rva']=778864,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 7A B2 E0'
  },
  ['parameter162Set_HRaceData_field_34_8_4_169']={
    ['rva']=778976,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 09 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 02 B2 E0'
  },
  ['parameter162Get_HRaceData_field_30_28_1_169']={
    ['rva']=779104,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 8A B1 E0'
  },
  ['parameter162Set_HRaceData_field_30_28_1_169']={
    ['rva']=779216,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 17 B1 E0 03'
  },
  ['parameter162Get_HRaceData_field_30_29_1_169']={
    ['rva']=779344,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 9A B0 E0'
  },
  ['parameter162Set_HRaceData_field_30_29_1_169']={
    ['rva']=779456,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 44 8B DA 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 27 B0 E0 03'
  },
  ['parameter162Get_HRaceData_field_34_0_4_169']={
    ['rva']=779584,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D AA AF E0'
  },
  ['parameter162Set_HRaceData_field_34_0_4_169']={
    ['rva']=779696,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 0A 7D 57 B8 85 1A 00 00 66 3B C8 76 3C BA FB'
  },
  ['parameter162Get_HRaceData_field_34_4_4_169']={
    ['rva']=779808,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D CA AE E0'
  },
  ['parameter162Set_HRaceData_field_34_4_4_169']={
    ['rva']=779920,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 0A 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 52 AE E0'
  },
  ['parameter162Get_HRaceData_field_34_12_4_169']={
    ['rva']=780048,
    ['pattern']='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D DA AD E0'
  },
  ['parameter162Set_HRaceData_field_34_12_4_169']={
    ['rva']=780160,
    ['pattern']='48 83 EC 28 44 8B DA 83 FA 0A 7D 5E B8 85 1A 00 00 66 3B C8 76 3C BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 62 AD E0'
  },
  ['parameter162Get_HOwnershipRaceData_field_0_19_2_169']={
    ['rva']=995120,
    ['pattern']='66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 2D 47 19 00 85 C0 75 04 33'
  },
  ['parameter162Set_HOwnershipRaceData_field_0_19_2_169']={
    ['rva']=995232,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 38 0F B7 4C 24 40 E8 B9 46 19 00 85'
  },
  ['parameter162Get_HOwnershipRaceData_mane_color_1_169']={
    ['rva']=995392,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 19 46 19 00 85'
  },
  ['parameter162Set_HOwnershipRaceData_mane_color_1_169']={
    ['rva']=995616,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 34 45 19 00'
  },
  ['parameter162Get_HOwnershipRaceData_mane_color_2_169']={
    ['rva']=995392,
    ['pattern']='89 54 24 10 66 89 4C 24 08 48 83 EC 48 0F B7 4C 24 50 E8 19 46 19 00 85'
  },
  ['parameter162Set_HOwnershipRaceData_mane_color_2_169']={
    ['rva']=995616,
    ['pattern']='44 89 44 24 18 89 54 24 10 66 89 4C 24 08 48 83 EC 58 0F B7 4C 24 60 E8 34 45 19 00'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
  end

  do
    local definitions={
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Growth ceiling extension',
      ['ja']='成長上限拡張',
      ['off']=16,
      ['bit']=27,
      ['bits']=1,
      ['base']='primary',
      ['max']=1,
      ['optionsEn']={'Off','On'},
      ['optionsJa']={'無効','有効'},
      ['groupEn']='Foal development',
      ['groupJa']='幼駒育成',
      ['growthCeilingFlag170']=true,
      ['parameter162']='HChildData_growth_ceiling_extension170',
      ['source']='Local EXE D8F30/D8F60; D8D30 adds 10 to the base growth ceiling; isolated native validation',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_growth_ceiling_extension170',
        ['setter']='parameter162Set_HChildData_growth_ceiling_extension170',
        ['id']='id'
      }
    }
  }
}
    local specs={
  ['parameter162Get_HChildData_growth_ceiling_extension170']={
    ['rva']=888624,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 19 0F B7 C1 48 8D 0C 40 48 8B 05 80 1B F5 03'
  },
  ['parameter162Set_HChildData_growth_ceiling_extension170']={
    ['rva']=888672,
    ['pattern']='B8 70 0D 00 00 66 3B C8 66 0F 42 C1 0F B7 C0 48 8D 0C 40 48 8B 05 4E 1B'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
    local lists=WP26.EntityLists116
    local plan=lists.horsePlan124
    function lists.horsePlan124(s,row,strongest)
      local edits=plan(s,row,strongest)
      if not strongest or (s.key~='foal' and s.key~='ownedFoal') then return edits end
      local c=lists.context124(s,row)
      local bonus=WP26.bits(c.primary,4,27,4)
      for _,edit in ipairs(edits) do
        if edit.field.parameter162=='HChildData_seigen' then bonus=edit.value end
      end
      for _,field in ipairs(WP26.EDITORS[s.key].fields) do
        if field.growthCeilingFlag170 and WP26.fieldAvailable(c,field) then
          edits[#edits+1]={field=field,value=1}
          break
        end
      end
      for _,edit in ipairs(edits) do
        if edit.field.foalGrowthCap162 then edit.value=110+bonus end
      end
      return edits
    end
    local apply=lists.applyEdits124
    function lists.applyEdits124(s,row,edits,trace)
      local flagEdit,bonusEdit,growthEdit
      for _,edit in ipairs(edits) do
        if edit.field.growthCeilingFlag170 then flagEdit=edit end
        if edit.field.parameter162=='HChildData_seigen' then bonusEdit=edit end
        if edit.field.foalGrowthCap162 then growthEdit=edit end
      end
      if not flagEdit then return apply(s,row,edits,trace) end
      local c=lists.context124(s,row)
      local oldFlag=WP26.bits(c.primary,16,27,1)
      local oldBonus=WP26.bits(c.primary,4,27,4)
      local nextFlag=WP26.normalizeNumeric120(flagEdit.field,flagEdit.value)
      local nextBonus=bonusEdit and WP26.normalizeNumeric120(bonusEdit.field,bonusEdit.value) or oldBonus
      local ceiling=100+nextFlag*10+nextBonus
      local first,middle,last={},{},{}
      for _,edit in ipairs(edits) do
        local old
        if edit==flagEdit then old=oldFlag
        elseif edit==bonusEdit then old=oldBonus end
        if old~=nil then
          local target=edit==flagEdit and nextFlag or nextBonus
          local destination=target>=old and first or last
          destination[#destination+1]=edit
        elseif edit==growthEdit then
          local copied={}
          for name,value in pairs(edit) do copied[name]=value end
          local requested=tonumber(edit.value)
          if requested then copied.value=math.min(ceiling,requested) end
          middle[#middle+1]=copied
        else
          middle[#middle+1]=edit
        end
      end
      local ordered={}
      for _,group in ipairs({first,middle,last}) do
        for _,edit in ipairs(group) do ordered[#ordered+1]=edit end
      end
      local previous=WP26.plannedGrowth162
      WP26.plannedGrowth162={key=c.key,id=c.id,ceiling=ceiling}
      local result=table.pack(pcall(WP26.applyEditsBeforeGrowth162,s,row,ordered,trace))
      WP26.plannedGrowth162=previous
      if not result[1] then error(result[2],0) end
      return table.unpack(result,2,result.n)
    end
  end

  do
    local definitions={
  {
    ['keys']={'farm'},
    ['field']={
      ['en']='Farm name suffix',
      ['ja']='牧場名の末尾',
      ['off']=8,
      ['bit']=11,
      ['bits']=3,
      ['base']='primary',
      ['max']=4,
      ['optionsEn']={'None','Bokujo','Farm','Stallion','Stud'},
      ['optionsJa']={'なし','牧場','ファーム','スタリオン','スタッド'},
      ['groupEn']='Farm profile',
      ['groupJa']='牧場情報',
      ['parameter162']='FarmData_name_suffix172',
      ['source']='Local EXE 104F60/104FD0; FED50 ->189A40/189A70/189AA0 ->39DD620/39DD648/39DD670; native normal/compact tests',
      ['nativeParameter162']={
        ['getter']='parameter162Get_FarmData_name_suffix172',
        ['setter']='parameter162Set_FarmData_name_suffix172',
        ['id']='id'
      }
    }
  }
}
    local specs={
  ['parameter162Get_FarmData_name_suffix172']={
    ['rva']=1068896,
    ['pattern']='B8 11 01 00 00 66 3B C8 72 03 33 C0 C3 8D 41 DB BA EB 00 00 00 66 3B C2 77 18 0F B7 C8 48 8B 05 1C 56 F2 03'
  },
  ['parameter162Set_FarmData_name_suffix172']={
    ['rva']=1069008,
    ['pattern']='B8 11 01 00 00 66 3B C8 73 63 83 FA 05 7D 5E 8D 41 DB 41 B8 EB 00 00 00'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
  end

  do
    local definitions={
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Injury type',
      ['ja']='故障の種類',
      ['off']=16,
      ['bit']=16,
      ['bits']=3,
      ['base']='primary',
      ['max']=6,
      ['groupEn']='Condition',
      ['groupJa']='体調',
      ['foalInjuryRecovery173']=true,
      ['parameter162']='HChildData_injury_type173',
      ['source']='Local EXE DA710/DA740; UI71588D..7158C9 and2C176F..2C17E4; 189160 injury labels; isolated native verification',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_injury_type173',
        ['setter']='parameter162Set_HChildData_injury_type173',
        ['id']='id'
      },
      ['optionsEn']={'None','Fever','Muscle stiffness','Colic','Bucked shins','Hoof crack','Lameness'},
      ['optionsJa']={'なし','熱発','コズミ','疝痛','ソエ','裂蹄','跛行'}
    }
  },
  {
    ['keys']={'ownedFoal','foal'},
    ['field']={
      ['en']='Injury recovery weeks',
      ['ja']='故障の残り週数',
      ['off']=16,
      ['bit']=19,
      ['bits']=4,
      ['base']='primary',
      ['max']=8,
      ['groupEn']='Condition',
      ['groupJa']='体調',
      ['foalInjuryRecovery173']=true,
      ['parameter162']='HChildData_injury_weeks173',
      ['source']='Local EXE DA780/DA7B0; UI71588D..7158C9 and2C176F..2C17E4; 189160 injury labels; isolated native verification',
      ['nativeParameter162']={
        ['getter']='parameter162Get_HChildData_injury_weeks173',
        ['setter']='parameter162Set_HChildData_injury_weeks173',
        ['id']='id'
      }
    }
  }
}
    local specs={
  ['parameter162Get_HChildData_injury_type173']={
    ['rva']=894736,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 06 B8 07 00 00 00 C3 0F B7 C1 48 8D 0C 40 48'
  },
  ['parameter162Set_HChildData_injury_type173']={
    ['rva']=894784,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 07 7F 20 0F B7 C1 83 E2 07 C1 E2 10'
  },
  ['parameter162Get_HChildData_injury_weeks173']={
    ['rva']=894848,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 2D 03 F5 03 8B'
  },
  ['parameter162Set_HChildData_injury_weeks173']={
    ['rva']=894896,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 08 77 20 0F B7 C1 83 E2 0F C1 E2 13'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=specs[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local current=readBytes(address,#spec.bytes162,true)
      assert(current and #current==#spec.bytes162,'Parameter code unreadable: '..name)
      for i,byte in ipairs(spec.bytes162) do assert(current[i]==byte,'Parameter code mismatch: '..name) end
      WP26.resolved[name]=address;WP26.A[name]=address;WP26.pend[name]=nil
      return address
    end
    for _,definition in ipairs(definitions) do
      for _,key in ipairs(definition.keys) do
        local field={}
        for name,value in pairs(definition.field) do field[name]=value end
        table.insert(WP26.EDITORS[key].fields,field)
      end
    end
    local lists=WP26.EntityLists116
    local plan=lists.horsePlan124
    function lists.horsePlan124(s,row,strongest)
      local edits=plan(s,row,strongest)
      if s.key~='foal' and s.key~='ownedFoal' then return edits end
      local c=lists.context124(s,row)
      for _,field in ipairs(WP26.EDITORS[s.key].fields) do
        if field.foalInjuryRecovery173 and WP26.fieldAvailable(c,field) then
          edits[#edits+1]={field=field,value=0}
        end
      end
      return edits
    end
  end

  do
    do
      local previous=WP26.RACE_PAYLOAD
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153535655574154415541564157ff05d6050000833dcb050000010f8582050000488b05e60500004c8b15e70500004c39100f856b050000458b42504183f8020f825d0500004183f8120f8753050000488b05c70500004c8b184d85db0f8440050000458b4b044183f9010f8c32050000488b05ae050000488b304885f60f841f050000410fb68b080100004439c10f830805000031c9418b448b0c4401c80f80f804000085c00f8cf0040000ffc14439c172e3410fb69308010000418b54930c4401ca85d27e184429ca4101d145894b0431c94129548b0cffc14439c172f48b54246085d20f8eb1040000bbffffff7f31c94963448b544885c00f889c0400008b5424604801d0483d9bc420000f8789040000486bd06439da0f42da4889c6b8ffffff7f31d2f7f639d80f42d8ffc14439c172be891dc7040000488b05e4040000488b30488b2dba0400008b4500486bc06531d2b96400000048f7f1baffffffff4839d0480f47c2894508c745440000000031c9bac59d1c81410fb7844a48ba000031c269d293010001ffc14439c172e84431c2895548418b033b95ac00000075083b85a8000000731ec7858400000000000000c7858800000000000000c7858c000000000000008985a80000008995ac00000031db31c9410fb7844a48ba00003d861a000073354869c0e80000008b44062425ff1f000083f82e7520410fb7844a48ba00003b4504741f418b448b0c4401c83b45447e12894544eb0d418b448b0c4401c839d80f4fd8ffc14439c172a785db7f46418b43088b55483b554c75144c3b5d38750e3b454072098b5d3085db7e02eb1931c9418b548b0c4401ca39d30f4cdaffc14439c172ec895d308b554889554c4c895d38894540891dd00300008b550081fae80300000f821203000089d8480fafc231d2b9e803000048f7f18b155b0300004839d0480f47c289c3c70590030000ffffffffc7058a03000000000000891d7c03000031c9833d7b030000017419410fb7844a48ba00003b4504750b890d61030000e97b020000410fb7844a48ba00003d861a00000f83670200004869c0e80000008b44062425ff1f000083f82e0f854e020000488b050c0300003a080f843f020000410fb7844a48ba00003b450475308b550881fae803000072258b0509030000480fafc231d251b9e803000048f7f1598b15a30200004839d0480f47c289c34189ce458b648b5444036424604189dd4531ff410fb7844a48ba00003b4504410f94c731ff4183e7014439f70f84a8000000410fb7847a48ba00003d861a000073284869c0e80000008b44062425ff1f000083f82e75134585ff747e8b5d083b5d0076764183cf02eb138b5d004585ff74038b5d0881fbe8030000725d418b44bb0c4401c8490fafc4418b4cbb54034c2460488d4408ff31d248f7f18b0df80100004839c8480f47c1480fafc331d2b9e803000041f7c70200000074038b4d0048f7f148ffc08b0dce0100004839c8480f47c14439e8440f4fe8ffc74439c70f8240ffffff83bdb0000000000f84b0000000488b05ad010000488db8b8f20000468b24b7438b44b30c4401c84139c4440f4ce0430fb7847248ba00003b4504757a428b1cb785db790231db31c94439f1743f410fb7844a48ba00003d861a0000732f4869c0e80000008b44062425ff1f000083f82e751a448b3c8f418b448b0c4401c84139c7440f4cf84439fb410f4cdfffc14439c172b589d8486bc06531d2b96400000048f7f1baffffff7f4839d0480f47c24139c4440f4ce04539e5450f4fec4489eb4489f1418b448b0c4401c839d87d4d890dd40000008905d200000089da29c2410fb6830801000039c8751b410153044101d131c039c87405412954830cffc04439c072f0eb0a89d84429c84189448b0c891d9b000000ff0585000000833dde0000000174318b1dce000000ffc14439c10f8249fdffff8b0dc100000083f9ff7415c705b600000001000000e92ffdffffff054f000000415f415e415d415c5f5d5e5b415b415a415941585a59589d41554883ec40488b0546000000488b004531d2ff256200000066903634314b4c435057454341523632505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff0000000000000000'
      WP26.RACE_PAYLOAD=current
    end
    do
      local previous=WP26.RACE_SPIRIT064
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153ff0586000000488b058700000083380175500fb79424c802000081fa861a00007340488b057b000000488b00483d00000100722e4869d2e80000008b44102425ff1f000083f82e7519ff0541000000415b415a415941585a59589dba5a000000eb0e415b415a415941585a59589d89c2488b8c2480020000ff152e000000ff25300000005350524954313433000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.RACE_SPIRIT064=current
    end
    do
      local previous=WP26.RACE_RENDER_CAP130
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c50515241504151415241534883ec20f30f7f0424f30f7f4c2410ff05b7010000488b05b80100008338010f8567010000488b05b80100004c8b104c3b15b60100000f8550010000418b4a5083f9020f824301000083f9120f873a0100004889f8482b05a00100000f822a01000031d241b86001000049f7f085d20f85170100004839c80f830e0100004989c0470fb78c4248ba00004181f9861a00000f83f5000000488b0556010000488b00483d000001000f82df0000004969c9e80000008b4c082481e1ff1f000083f92e0f85c50000004c8b1d0e0100004983eb04453b4b040f85b00000000fb78722010000c1e80c83f8010f829d00000083f8070f8394000000f30f10879c000000f30f11050c0100000f57c031c94c39c1743b488b15e30000004869c1600100004801c20fb78222010000c1e80c83f801721b83f8077316f30f108a9c0000000f2ec97a09f3410f5dccf30f5fc1ffc1413b4a5072b8f30f5905bf000000f30f5f879c000000f30f11879c000000f3440f5925a600000044890593000000f3440f112592000000ff0544000000f30f6f4c2410f30f6f04244883c420415b415a415941585a59589d0f28c8f30f5f8fa8000000410f2fccff25480000000f1f84000000000035333150414350570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007a44ffffffff0000000000000000ae47813f'
      WP26.RACE_RENDER_CAP130=current
    end
    do
      local previous=WP26.MATH142
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153535655574154415541564157ff054a020000833d3b020000010f85f6010000488b05460200004c8b104c3b15440200000f85df010000458b6a504183fd010f82d10100004183fd120f87c7010000488b05270200004c8b184981fb000001000f82b0010000488b0518020000488b304881fe000001000f82990100004531c94531c0430fb7844248ba00003d861a0000731b4869c0e80000008b44062425ff1f000083f82e750641b90100000041ffc04539e872cd4585c97510f70594010000020000000f844b010000448b7c24604585ff0f881e0100004d63630431ed31ff49c7c6ffffffff4531d24531c04b635c830c4c01e30f88fb0000004881fbffffff7f0f87ee00000039eb0f4feb4b634c83544885c90f88db0000004c01f94881f9378941000f87cb00000085db74194869c1e803000031d248f7f34c39f073084989c689df4989ca41ffc04539e8729d85ff0f849e00000089e8490fafc7483dffffff7f0f878c00000089e8490fafc2483dffffff7f777e4585e47f2541897b044531c04b6344830c4c01e04829f8438944830c41ffc04539e872e8ff05be000000f705ac00000001000000740f4585c9740ac744245000000000eb58837c2450017551488b05d1000000488b00483d0000010072200fb6888b000000488b05c00000000308ffc985c97f29c744245000000000eb1fff0568000000415f415e415d415c5f5d5e5b415b415a415941585a59589dc3415f415e415d415c5f5d5e5b415b415a415941585a59589d5341574881ecb8000000488b054e000000488b00ff254d0000000f1f440000574d41544831343200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.MATH142=current
    end
    do
      local previous=WP26.RACE_CLOCK111
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153ff0556040000488b05570400008338010f8511040000534c8b1d4e0400004983eb044181bb8000000099b101000f8535010000418b4308413b030f862801000041813be80300000f821b010000488b05200400004c8b104c3b151e0400000f85040100008b4c247c83f9020f82f7000000413b4a500f87ed00000083f9120f87e400000031d28b849498000000413b42500f83d1000000410fb7844248ba0000413b4304740bffc239ca72dae9b700000085d20f84af0000003d861a00000f83a4000000488b1db9030000488b1b4881fb000001000f828d0000004869c0e80000008b44032425ff1f000083f82e7578448b8c94980000004c8b058d030000496bc10c4901c08b842498000000413b42507355488b1d72030000486bc00c4801c38b430483f802723f413940047239ffc8418940048b0383f8027202ffc84189008b4308418940088b84949400000089849498000000ffca75ee44898c2498000000ff05440300005b4c8b1dfc0200004983eb044183bbb0000000000f84d6000000488b050b030000488b084881f9000001000f828e020000488b01488b90080100004c8b05f20200004981e8f07daf004981c040c5ba004c39c20f85660200004881ec80000000f30f7f442420f30f7f4c2430f30f7f542440f30f7f5c2450f30f7f642460f30f7f6c2470ffd2f30f6f442420f30f6f4c2430f30f6f542440f30f6f5c2450f30f6f642460f30f6f6c24704881c48000000083f8010f82050200003dffff00000f83fa0100008b4c243039c10f42c848894c24304c8b1d2a0200004983eb04418983b8000000ff055d020000e9cf0100008b44243085c00f84c30100003dffff00000f83b8010000488b05fe0100004c8b104c3b15fc0100000f85a1010000458b42504183f8020f82930100004183f8120f8789010000488b05ff010000443b000f85790100008b9424900000004439c20f8369010000450fb78c5248ba00004181f9861a00000f8353010000488b05a9010000488b084881f9000001000f823c0100004969c1e80000008b44012425ff1f000041b80000000083f82e410f94c04c8b1d5d0100004983eb044181bb8000000099b101000f8503010000418b03b940420f004585c074293de80300000f82eb000000453b4b047504418b43083de80300000f82d6000000b9e8030000480fafc8b8c59d1c814133425031d2450fb7945248ba00004431d069c0930100014c8b15fe000000ffc24c8b15f5000000413b525072d8413b838400000075168b542430413b938c000000741b413b93880000007412418983840000008b4424304189838800000045898b900000008b942490000000486bd20c488b05b50000008b141041899394000000418b83880000004869c040420f0031d248f7f1ba010000004839d0480f42c2418b93880000004839d0480f47c24189838c000000488944243041ff8398000000ff0539000000415b415a415941585a59589d89442444b804000000486bc0004863440450ff2551000000660f1f8400000000003133314b4c43505700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.RACE_CLOCK111=current
    end
    do
      local previous=WP26.HEALTH_ENTRY137
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153ff051a010000833d0f010000010f85df000000440fb78c24c80200004181f9861a00000f83c9000000488b05fc000000488b00483d000001000f82b30000004969d1e80000008b44102425ff1f000083f82e0f859a000000488b05d5000000488b00483b05d30000000f8583000000448b50504183fa0172794183fa1277734c8b8424c0020000488d50544939d072624c89c14829d14989c34889c831d2b95c01000048f7f185d275484c39d07343410fb780a20000003d2c01000072343dbc020000772da901000000752666418980a000000041c680880000006941c6808a0000000041c680cf000000d2ff0532000000415b415a415941585a59589d0fb78c2488020000ff153800000089c2ff253800000057504845413134330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.HEALTH_ENTRY137=current
    end
    do
      local previous=WP26.PACE_GUARD066
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153ff052e010000488b052f0100008338010f85e7000000488b052f0100004c8b104c3b152d0100000f85d0000000418b4a5083f9010f82c300000083f9120f87ba000000488b05120100004c8b184d39d80f85a7000000410fb6930801000039ca0f8397000000458b4b044183f9010f8c890000004531c0438b44830c4401c8707c85c07e7841ffc04139c872ea418b44930c4101c145894b044531c0432944830c41ffc04139c872f3410fb7945248ba000081fa861a00007343488b05a3000000488b00483d0000010072314869d2e80000008b44102425ff1f000083f82e751cff0551000000415b415a415941585a59589d4183f901ff256f000000415b415a415941585a59589d4183f9017517488b0566000000488b000fb6908b000000ff254e000000ff254000000057505041434536360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.PACE_GUARD066=current
    end
    do
      local previous=WP26.RACE_FLOOR114
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153ff056e010000488b056f0100008338010f85250100004c8b1d670100004983eb044181bb8000000099b101000f8509010000488b05530100004c8b104c3b15510100000f85f2000000458b42504183f8020f82e40000004183f8120f87da000000488b053c0100000fb650044439c20f83c6000000450fb78c5248ba00004181f9861a00000f83b0000000488b050a010000488b00483d000001000f829a0000004969d1e80000008b54102481e2ff1f000083fa2e0f85800000004183bbb000000000743a4c8b1dd80000004d8d93a0dafeff31c94531c9418b148a83fa017c5a81fafeff00007f524439ca7c4d413b548b2875464189d1ffc14439c172d9ff0573000000415b415a415941585a59589d48896c244048897c2448488b2d720000004881ed7066850431db4c8b055a0000004d8b00ff2571000000415b415a415941585a59589d4c8b1d56000000418b8ba0dafeff31db4c8b052e0000004d8b0048896c2440ff25480000005750464c523133390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.RACE_FLOOR114=current
    end
    do
      local previous=WP26.START_ROLL057.late
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c50515241524153ff05e2000000488b05e30000008338010f859d00000089d983f9120f8392000000488b05d80000004c8b104c3b15d6000000757f418b425083f801727683f812777139c1736d488b05cb00000038087462410fb7944a48ba000081fa861a00007351488b058f0000008b003dffff0000740439d0753d488b0593000000488b00483d00000100722b4869d2e80000008b44102425ff1f000083f82e7516ff0549000000415b415a5a59589d0fb7c083f800eb0d415b415a5a59589d0fb7c039f87d1250488b056600000080080158ff254c000000ff254e000000660f1f4400005750524f4c4c35360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.START_ROLL057.late=current
    end
    do
      local previous=WP26.START_ROLL057.good
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c50515241524153ff05ea000000488b05eb0000008338010f85a40000004489f983f9120f8398000000488b05df0000004c8b104c3b15dd0000000f8581000000418b425083f801727883f812777339c1736f488b05ce00000038087464410fb7944a48ba000081fa861a00007353488b05920000008b003dffff0000740439d0753f488b0596000000488b00483d00000100722d4869d2e80000008b44102425ff1f000083f82e7518ff054c000000415b415a5a59589d0fb7c03d00000100eb0d415b415a5a59589d0fb7c039d87d1250488b056700000080080258ff254d000000ff254f0000000f1f80000000005750524f4c4c35360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.START_ROLL057.good=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[1]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833dc5000000010f858b000000440fb7c94181f9861a0000737e488b05b30000004c8b104c3b15b1000000756b458b42504183f80272614183f812775b31d266453b8c5248ba00007409ffc24439c272eeeb45488b058a0000004c8b184981fb0000010072324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[1]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[2]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833dc5000000010f8592000000440fb7c94181f9861a00000f8381000000488b05af0000004c8b104c3b15ad000000756e458b42504183f80272644183f812775e31d266453b8c5248ba00007409ffc24439c272eeeb48488b05860000004c8b184981fb0000010072354969c1e80000004c01d88b502481e2ff1f000083fa2e741db8640000004889442430ff053e000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252c0000000f1f400033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[2]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[3]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833dc5000000010f8594000000440fb7c94181f9861a00000f8383000000488b05af0000004c8b104c3b15ad0000007570458b42504183f80272664183f812776031d266453b8c5248ba00007409ffc24439c272eeeb4a488b05860000004c8b184981fb0000010072374969c1e80000004c01d88b502481e2ff1f000083fa2e741f48c7c088ffffff4889442430ff053c000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff252a000000669033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[3]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[4]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833de5000000010f85ab000000440fb7c94181f9861a00000f839a000000488b05cf0000004c8b104c3b15cd0000000f8583000000458b42504183f80272794183f812777331d266453b8c5248ba00007409ffc24439c272eeeb5d488b05a20000004c8b184981fb00000100724a4969c1e80000004c01d88b502481e2ff1f000083fa2e74320fb6400a3dc800000077273da0000000770583c028eb0383e8284889442430ff0545000000415b415a415941585a59589dc3415b415a415941585a59589d4883ec28ba861a00000fb7c1662bc2ff253300000066662e0f1f84000000000033303150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[4]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[5]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833dd5000000010f859c000000488b05d00000004c8b104c3b15ce0000000f8585000000458b42504183f802727b4183f8127775488b05b90000004c8b184981fb00000100726231d24869c25c0100004a8d4410544839c87409ffc24439c272e8eb46450fb78c5248ba0000eb004181f9861a000073324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff0544000000415b415a415941585a59589dc3415b415a415941585a59589d8954241048894c24084883ec28488b442430ff252f0000000f1f800000000030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[5]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[6]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='4883ec28e8b8000000488d6424289c5051524150415141524153833dcf000000010f858d00000085c00f8e85000000488b442440483b05a50000007577488b05b40000004c8b104c3b15b20000007564458b42504183f802725a4183f81277548b5424684439c2734b450fb78c5248ba00004181f9861a00007339488b05860000004c8b184981fb0000010072264969c1e8000000418b54032481e2ff1f000083fa2e740f48c744243000000000ff0540000000415b415a415941585a59589dc348895c2408574883ec200fb7f9b800020000ff25370000000f1f80000000000100beba7856341237343150504f505700000000000000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[6]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[7]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833dd5000000010f85940000004183f8010f858a0000004585c90f8e81000000488b05bd0000004c8b104c3b15bb000000756e458b42504183f80272644183f812775e488b05aa0000004c8b184981fb00000100724b4439c27346450fb78c5248ba0000eb004181f9861a000073324969c1e80000004c01d88b502481e2ff1f000083fa2e741a31c04889442430ff054c000000415b415a415941585a59589dc3415b415a415941585a59589d4989ca4585c974144183f8014c8b050a0000004d8b00ff2533000000c338827f4401000000669030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[7]=current
    end
    do
      local previous=WP26.OPPONENT_SPECS103[8]
      local current={}
      for key,value in pairs(previous) do current[key]=value end
      current.hex='9c5051524150415141524153833d15010000010f85d80000004183f8060f83ce00000083fa5d0f83c5000000488d0525010000803c10010f85b4000000488b05ec0000004c8b104c3b15ea0000000f859d000000458b42504183f8020f828f0000004183f8120f8785000000488b05cd0000004c8b184981fb00000100727231d24869c25c0100004a8d4410544839c87409ffc24439c272e8eb56450fb78c5248ba0000eb004181f9861a000073424969c1e80000004c01d88b502481e2ff1f000083fa2e742a4863442418488b4c2428c68401c8000000004889442430ff0548000000415b415a415941585a59589dc3415b415a415941585a59589d4963c0889408c8000000c3ccccccff25370000006666666666662e0f1f84000000000030313150504f50570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000010001010001010001000100010001010001010101010101010101010100000000000000000000000101010101010101000100000000000101010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000'
      WP26.OPPONENT_SPECS103[8]=current
    end
  end

  do
    local labelsJa={'なし','休養','熱発','コズミ','挫跖','肺出血','疲労','疝痛','フレグモーネ','鼻出血','ソエ','裂蹄','去勢','跛行','繋靱帯炎','骨折','屈腱炎','屈腱断裂','粉砕骨折','繋靱帯断裂','疾病発症'}
    local labelsEn={'None','Rest','Fever','Muscle stiffness','Sole bruising','Pulmonary bleeding','Fatigue','Colic','Phlegmon','Nosebleed','Bucked shins','Hoof crack','Gelding surgery','Lameness','Suspensory ligament inflammation','Fracture','Tendonitis','Tendon rupture','Comminuted fracture','Suspensory ligament rupture','Disease onset'}
    for _,key in ipairs({'owned','race'}) do
      for _,field in ipairs(WP26.EDITORS[key].fields) do
        if field.parameter162=='HRaceData_houbokuchuu' then
          assert(field.max==20)
          field.en='Pasture / injury state'
          field.ja='放牧・故障状態'
          field.optionsJa=labelsJa
          field.optionsEn=labelsEn
          field.raceInjuryState176=true
        elseif field.parameter162=='HRaceData_houboku_len' then
          field.en='Pasture / treatment duration (weeks)'
          field.ja='放牧・治療期間（週）'
          field.raceInjuryWeeks176=true
        end
      end
    end
    local lists=WP26.EntityLists116
    local plan=lists.horsePlan124
    function lists.horsePlan124(s,row,strongest)
      local edits=plan(s,row,strongest)
      if s.key~='owned' and s.key~='race' then return edits end
      local c=lists.context124(s,row)
      local state,weeks
      for _,field in ipairs(WP26.EDITORS[s.key].fields) do
        if field.raceInjuryState176 then state=field
        elseif field.raceInjuryWeeks176 then weeks=field end
      end
      if state and weeks and WP26.fieldAvailable(c,state) and WP26.fieldAvailable(c,weeks) then
        local value=WP26.fieldRead(c,state)
        if value>=2 and value<=20 and value~=12 then
          edits[#edits+1]={field=weeks,value=0}
          edits[#edits+1]={field=state,value=0}
        end
      end
      return edits
    end
  end

  do
    local signatures={
  {
    ['rva']=2661984,
    ['bytes']={68,139,5,169,246,195,3,15,183,209,185,251,50,0,0,184,133,26,0,0,68,141,73,51,68,141,81,53,102,59,208,118,79,15,183,194,102,43,193,102,131,248,50,119,5,69,133,192,117,62,15,183,194,102,65,43,193,102,131,248,1,118,49,15,183,194,102,65,43,194,102,131,248,99,118,36,185,134,26,0,0,15,183,193,102,65,43,194,102,131,248,99,119,56,15,183,192,72,105,192,232,0,0,0,72,3,5,105,7,218,3,195,15,183,194,102,43,193,15,183,202,102,131,248,50,119,210,69,133,192,116,205,15,183,192,72,105,192,232,0,0,0,72,3,5,51,7,218,3,195,15,183,193,102,65,43,193,102,131,248,1,15,183,193,119,21,73,43,193,72,141,13,64,7,218,3,72,105,192,232,0,0,0,72,3,193,195,72,105,192,232,0,0,0,72,3,5,239,6,218,3,195},
    ['mask']={true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,true,false,false,false,false,true,true,true,false,true,true,true,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true,true,false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true}
  },
  {
    ['rva']=3185881,
    ['bytes']={186,11,0,0,0},
    ['mask']={true,false,false,false,false}
  },
  {
    ['rva']=3185936,
    ['bytes']={67,139,140,4,64,250,170,2,139,198,35,193,59,193,15,133,248,0,0,0,71,15,183,172,4,70,250,170,2,67,15,183,156,4,68,250,170,2},
    ['mask']={true,true,true,true,false,false,false,false,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true,false,false,false,false}
  },
  {
    ['rva']=2651760,
    ['bytes']={51,192,186,128,2,0,0,102,59,202,15,146,192,195},
    ['mask']={true,true,true,false,false,false,false,true,true,true,true,true,true,true}
  },
  {
    ['rva']=754036,
    ['bytes']={186,134,26,0,0,15,183,193,102,43,194,186,115,24,0,0,102,59,194,119,32},
    ['mask']={true,false,false,false,false,true,true,true,true,true,true,true,false,false,false,false,true,true,true,true,true}
  },
  {
    ['rva']=754089,
    ['bytes']={184,133,26,0,0,102,59,200,118,70},
    ['mask']={true,false,false,false,false,true,true,true,true,true}
  },
  {
    ['rva']=744670,
    ['bytes']={184,45,51,0,0,102,59,200,115,15},
    ['mask']={true,false,false,false,false,true,true,true,true,true}
  }
}
    local function number(bytes,offset,size)
      local value=0
      for i=size-1,0,-1 do value=(value<<8)|bytes[offset+i+1] end
      return value
    end
    function WP26.raceSnapshot179()
      WP26.require()
      local base=WP26.mod()
      local blocks={}
      for i,s in ipairs(signatures) do
        local bytes=assert(readBytes(base+s.rva,#s.bytes,true),'Race roster code unavailable')
        for j,wanted in ipairs(s.bytes) do
          assert(not s.mask[j] or bytes[j]==wanted,'Race roster code changed')
        end
        blocks[i]=bytes
      end
      local code=blocks[1]
      local first=number(code,0x0b,4)
      local limit=number(code,0x10,4)
      local inline=first+number(code,0x17,1)
      local extra=first+number(code,0x1b,1)
      local conditionalCount=number(code,0x2a,1)+1
      local extraCount=number(code,0x49,1)+1
      local dummy=number(code,0x4d,4)
      assert(number(blocks[5],1,4)==dummy and number(blocks[6],1,4)==limit,'Race ability getter and resolver disagree')
      local conditionalUiEnd=number(blocks[7],1,4)-1
      local count=number(blocks[2],1,4)
      local tableRva=number(blocks[3],4,4)
      assert(number(blocks[3],0x19,4)==tableRva+6 and number(blocks[3],0x22,4)==tableRva+4,'Race roster layout changed')
      assert(count>0 and count<=0x10000 and tableRva+count*8<=WP26.BUILD.size,'Race roster ranges invalid')
      assert(limit<first and dummy==limit+1 and first+conditionalCount<=inline and inline+2<=extra and extra+extraCount<=0x10000,'Race roster dispatch invalid')
      local ranges=assert(readBytes(base+tableRva,count*8,true),'Race roster ranges unavailable')
      local function pointer(rva)
        local v=readQword(base+rva)
        return v and v>=0x10000 and v or nil
      end
      local s={base=base,code=code,ranges=ranges,tableRva=tableRva,count=count,limit=limit,first=first,
        conditionalCount=conditionalCount,conditionalUiEnd=conditionalUiEnd,inline=inline,extra=extra,extraCount=extraCount,
        ownedCount=number(blocks[4],3,4),normal=pointer(0x402a618),conditional=pointer(0x402a628),
        extraRoot=pointer(0x402a638),flag=assert(readInteger(base+0x3ec9510)),owned=pointer(0x4042600)}
      assert(s.normal and s.ownedCount>0 and s.ownedCount<=0x10000,'Race roster data unavailable')
      local covered=false
      s.active={}
      for i=0,count-1 do
        local flags=number(ranges,i*8,4)
        local lo=number(ranges,i*8+4,2)
        local hi=number(ranges,i*8+6,2)
        if flags&0x80000000~=0 and lo<=hi then
          s.active[#s.active+1]={first=lo,last=hi}
          if lo==0 and hi==limit then covered=true end
          assert((lo==0 and hi<=limit) or (lo>=first and hi<first+conditionalCount) or
            (lo>=inline and hi<inline+2) or (lo>=extra and hi<extra+extraCount),'Race roster range has no matching record region')
        end
      end
      assert(covered,'Race roster range and resolver disagree')
      return s
    end
    function WP26.racePointer179(id,s)
      if type(id)~='number' or id%1~=0 or id<0 or id>0xffff then return nil end
      s=s or WP26.raceSnapshotActive179 or WP26.raceSnapshot179()
      if id<=s.limit then return s.normal+id*232 end
      if id>=s.first and id<s.first+s.conditionalCount and s.flag~=0 and s.conditional then
        return s.conditional+(id-s.first)*232
      end
      if id>=s.inline and id<s.inline+2 then return s.base+0x402a650+(id-s.inline)*232 end
      if id>=s.extra and id<s.extra+s.extraCount and s.extraRoot then return s.extraRoot+(id-s.extra)*232 end
      return nil
    end
    function WP26.raceSnapshotCheck179(s)
      local now=WP26.raceSnapshot179()
      for _,k in ipairs({'base','limit','first','conditionalCount','conditionalUiEnd','inline','extra','extraCount','ownedCount','normal','conditional','extraRoot','flag','owned','tableRva','count'}) do
        assert(now[k]==s[k],'Race roster changed during lookup')
      end
      for i,v in ipairs(s.ranges) do assert(now.ranges[i]==v,'Race roster ranges changed during lookup') end
    end
    function WP26.withRaceSnapshot179(fn)
      if WP26.raceSnapshotActive179 then return fn(WP26.raceSnapshotActive179) end
      local s=WP26.raceSnapshot179()
      WP26.raceSnapshotActive179=s
      local result=table.pack(pcall(fn,s))
      WP26.raceSnapshotActive179=nil
      if not result[1] then error(result[2],0) end
      WP26.raceSnapshotCheck179(s)
      return table.unpack(result,2,result.n)
    end
    function WP26.raceIds179(s)
      local ids,seen={},{}
      local function add(id)
        if not seen[id] and WP26.racePointer179(id,s) then seen[id]=true;ids[#ids+1]=id end
      end
      for _,range in ipairs(s.active) do for id=range.first,range.last do add(id) end end
      if s.flag~=0 then for id=s.first,math.min(s.conditionalUiEnd,s.first+s.conditionalCount-1) do add(id) end end
      for id=s.inline,s.inline+1 do add(id) end
      for slot=0,s.ownedCount-1 do add(WP26.bits(s.owned+slot*760,4,2,14)) end
      table.sort(ids)
      return ids
    end
    function WP26.raceRows179(key)
      return WP26.withRaceSnapshot179(function(s)
        local rows={}
        local ids={}
        if key=='owned' then for id=0,s.ownedCount-1 do ids[#ids+1]=id end
        else ids=WP26.raceIds179(s) end
        for _,id in ipairs(ids) do
          local raceID=key=='owned' and WP26.bits(s.owned+id*760,4,2,14) or id
          local race=WP26.racePointer179(raceID,s)
          if race and (key~='owned' or WP26.bits(race,36,0,13)==46) then
            local horseID=WP26.bits(race,0,0,15)
            if horseID<0x702d then
              local ctx={key=key,id=id,primary=key=='owned' and s.owned+id*760 or race,race=race,raceID=raceID,horseID=horseID,horse=WP26.data('horse')+horseID*56}
              local name=WP26.entityName(key,id,ctx)
              if name~='' and not name:find('[%z\1-\31]') then rows[#rows+1]={id=id,name=name} end
            end
          end
        end
        table.sort(rows,function(a,b)if a.name==b.name then return a.id<b.id end return a.name<b.name end)
        return rows
      end)
    end
  end

  do
    local specifications={
  ['foal']={
    ['rva']=2651088,
    ['bytes']={51,192,186,112,13,0,0,102,59,202,15,146,192,195},
    ['offset']=3,
    ['size']=4,
    ['add']=0
  },
  ['mare']={
    ['rva']=932784,
    ['bytes']={184,16,39,0,0,102,59,200,114,17},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['secretary']={
    ['rva']=2651552,
    ['bytes']={51,192,186,150,0,0,0,102,59,202,15,146,192,195},
    ['offset']=3,
    ['size']=4,
    ['add']=0
  },
  ['family']={
    ['rva']=2642240,
    ['bytes']={51,192,186,16,39,0,0,102,59,202,15,146,192,195},
    ['offset']=3,
    ['size']=4,
    ['add']=0
  },
  ['staff']={
    ['rva']=1096863,
    ['bytes']={184,148,0,0,0,15,183,217,102,59,200,15,131,244,0},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['acquaintance']={
    ['rva']=1216333,
    ['bytes']={184,52,3,0,0,102,59,216,15,131},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['jockey']={
    ['rva']=3198078,
    ['bytes']={184,89,3,0,0},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['trainer']={
    ['rva']=3199012,
    ['bytes']={184,46,3,0,0},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['sire']={
    ['rva']=549780,
    ['bytes']={184,208,7,0,0,102,59,200,114,14},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  },
  ['farm']={
    ['rva']=1070246,
    ['bytes']={131,251,36,184,37},
    ['offset']=2,
    ['size']=1,
    ['add']=1
  },
  ['ownerNormal']={
    ['rva']=1045072,
    ['bytes']={102,131,249,48},
    ['offset']=3,
    ['size']=1,
    ['add']=0
  },
  ['owner']={
    ['rva']=1045087,
    ['bytes']={186,147,17,0,0},
    ['offset']=1,
    ['size']=4,
    ['add']=1
  },
  ['farmAll']={
    ['rva']=1074214,
    ['bytes']={184,17,1,0,0},
    ['offset']=1,
    ['size']=4,
    ['add']=0
  }
}
    function WP26.entityCount180(key)
      if key=='ownedFoal' then key='foal' elseif key=='ownedMare' then key='mare' elseif key=='ownedSire' then key='sire' elseif key=='farmStaff' then key='staff' end
      local s=assert(specifications[key],'Entity count specification unavailable')
      local bytes=assert(readBytes(WP26.mod()+s.rva,#s.bytes,true),'Entity count code unavailable')
      for i,wanted in ipairs(s.bytes) do
        if i<=s.offset or i>s.offset+s.size then assert(bytes[i]==wanted,'Entity count code changed: '..key) end
      end
      local count=0
      for i=s.size-1,0,-1 do count=(count<<8)|bytes[s.offset+i+1] end
      count=count+s.add
      if key=='owner' then count=count+WP26.entityCount180('ownerNormal') end
      assert(count>0 and count<=0x10000,'Invalid entity count: '..key)
      return count
    end
    function WP26.entityLimit180(key)
      local canonical=key=='ownedMare' and 'mare' or key=='ownedSire' and 'sire' or key=='ownedFoal' and 'foal' or key=='farmStaff' and 'staff' or key
      if not specifications[canonical] then return WP26.EDITORS[key].max end
      local count=WP26.entityCount180(canonical)
      return key=='acquaintance' and math.max(count-1,1000+WP26.entityCount180('staff')-1) or count-1
    end
    function WP26.readFoalNames()
      WP26.require()
      local count=WP26.entityCount180('foal')
      local root=WP26.data('foal')
      local pedigrees=WP26.data('pedigree072')
      local mares=WP26.data('mare')
      local map=WP26.namePointer(0x402aa88)
      local bytes=assert(readBytes(root,count*24,true),'Foal list unavailable')
      local names={}
      local year=WP26.currentYear081()
      local mareCount=WP26.entityCount180('mare')
      local function value(offset,size)
        local result=0
        for i=size-1,0,-1 do result=(result<<8)|bytes[offset+i+1] end
        return result
      end
      local function name(pedigree)
        if pedigree>=100000 then return '' end
        local address=pedigrees+pedigree*24+20
        return WP26.horseNamePart(readSmallInteger(address))..WP26.horseNamePart(readSmallInteger(address+2))
      end
      for id=0,count-1 do
        local primary=value(id*24,4)
        local text=''
        if primary&0x7fff<0x702d then
          local known=(primary>>15)&0xffff
          if known<25000 then text=name(assert(readInteger(map+known*4)))
          else
            local mother=value(id*24+4,2)&0x3fff
            if mother<mareCount then
              local pedigree=WP26.bits(mares+mother*68,0,0,19)
              text=name(pedigree)
              if text~='' then text=text..string.format('%02d',(year-(primary>>31)+100)%100) end
            end
          end
        end
        names[id]=text
      end
      assert(root==readQword(WP26.mod()+0x402aac8) and count==WP26.entityCount180('foal'),'Foal list changed during lookup')
      WP26.foalNameCache={pid=WP26.pid,root=root,names=names}
      return names
    end
    function WP26.secretaryId180(role)
      assert(role>=0 and role<5 and role%1==0,'Invalid secretary role')
      local base=WP26.mod()
      local variant=0
      if readInteger(base+0x3ec94f8)~=0 or readInteger(base+0x3ec9510)~=0 then
        variant=assert(readBytes(base+0x3fd1850+0x6c6a+role,1))
      end
      assert(variant<30,'Secretary variant unavailable')
      return role*30+variant
    end
    function WP26.listContext180(key,id)
      local breeding=key=='sire' or key=='ownedSire' or key=='mare' or key=='ownedMare'
      if key~='owned' and key~='race' and key~='foal' and key~='ownedFoal' and not breeding then return WP26.context(key,id) end
      local primary,race,raceID,horseID
      if key=='owned' or key=='race' then
        local s=WP26.raceSnapshotActive179 or WP26.raceSnapshot179()
        if key=='owned' then
          assert(id>=0 and id<s.ownedCount and id%1==0,'Invalid owned horse slot')
          primary=s.owned+id*760;raceID=WP26.bits(primary,4,2,14)
        else raceID=id end
        race=assert(WP26.racePointer179(raceID,s),'Racehorse region unavailable')
        primary=primary or race
        horseID=WP26.bits(race,0,0,15)
      elseif breeding then
        local original=(key=='sire' or key=='ownedSire') and 'sire' or 'mare'
        assert(id>=0 and id<=WP26.entityLimit180(original) and id%1==0,'Invalid breeding horse ID')
        primary=original=='sire' and assert(WP26.sirePointer181(id)) or WP26.data(original)+id*WP26.EDITORS[original].stride
        horseID=WP26.bits(primary,8,0,15)
      else
        assert(id>=0 and id<WP26.entityCount180('foal') and id%1==0,'Invalid foal ID')
        primary=WP26.data('foal')+id*24;horseID=WP26.bits(primary,0,0,15)
      end
      assert(horseID<0x702d,'Horse base unavailable')
      local c={key=key,id=id,primary=primary,race=race,raceID=raceID,horseID=horseID,horse=WP26.data('horse')+horseID*56}
      if breeding then
        local pedigree=WP26.bits(primary,0,0,19)
        assert(pedigree<100000,'Breeding horse pedigree unavailable')
        c.pedigreeID072=pedigree;c.pedigree072=WP26.data('pedigree072')+pedigree*24
      end
      return c
    end
    local picker=WP26.entityPickerRows101
    function WP26.entityPickerRows101(key,rows)
      if key=='owned' or key=='race' then return WP26.withRaceSnapshot179(function()return picker(key,rows)end) end
      return picker(key,rows)
    end
    local rows=WP26.editorRows
    function WP26.editorRows(key)
      local canonical=key=='ownedMare' and 'mare' or key=='ownedSire' and 'sire' or key=='ownedFoal' and 'foal' or key=='farmStaff' and 'staff' or key
      if specifications[canonical] then
        local count=WP26.entityCount180(canonical)
        WP26.EDITORS[key].max=key=='acquaintance' and math.max(count-1,1000+WP26.entityCount180('staff')-1) or count-1
        local result=rows(key)
        assert(count==WP26.entityCount180(canonical),'Entity range changed during lookup')
        return result
      end
      return rows(key)
    end
  end

  do
    local expected={102,137,76,36,8,72,131,236,24,15,183,68,36,32,61,209,7,0,0,124,21,15,183,68,36,32,61,218,7,0,0,127,9,199,4,36,1,0,0,0,235,7,199,4,36,0,0,0,0,139,4,36,72,131,196,24,195}
    function WP26.sireRegions181()
      WP26.require()
      local base=WP26.mod()
      local code=assert(readBytes(base+0xdc120,#expected,true),'Sire dispatch unavailable')
      for i,v in ipairs(expected) do assert(code[i]==v,'Sire dispatch changed') end
      local normal=WP26.entityCount180('sire')
      local first=assert(readInteger(base+0xdc12f))
      local last=assert(readInteger(base+0xdc13b))
      assert(first>normal and last>=first and last<0x10000,'Sire regions invalid')
      local ordinary=WP26.data('sire')
      local extra=readQword(base+0x4042590)
      if not extra or extra<65536 then extra=nil end
      return {normal=normal,first=first,last=last,ordinary=ordinary,extra=extra}
    end
    function WP26.sirePointer181(id,s)
      if type(id)~='number' or id%1~=0 or id<0 then return nil end
      s=s or WP26.sireRegions181()
      if id<s.normal then return s.ordinary+id*104 end
      if s.extra and id>=s.first and id<=s.last then return s.extra+(id-s.first)*104 end
      return nil
    end
    function WP26.sireRows181()
      local s=WP26.sireRegions181()
      local horse=WP26.data('horse')
      local result={}
      local function include(id)
        local primary=assert(WP26.sirePointer181(id,s))
        local h=WP26.bits(primary,8,0,15)
        local pedigree=WP26.bits(primary,0,0,19)
        if h<0x702d and pedigree<100000 then
          local ctx={key='sire',id=id,primary=primary,horseID=h,horse=horse+h*56,pedigreeID072=pedigree,pedigree072=WP26.data('pedigree072')+pedigree*24}
          local name=WP26.entityName('sire',id,ctx)
          if name~='' and not name:find('[%z\1-\31]') then result[#result+1]={id=id,name=name} end
        end
      end
      for id=0,s.normal-1 do include(id) end
      if s.extra then for id=s.first,s.last do include(id) end end
      local now=WP26.sireRegions181()
      for _,key in ipairs({'normal','first','last','ordinary','extra'}) do assert(s[key]==now[key],'Sire region changed during lookup') end
      table.sort(result,function(a,b)if a.name==b.name then return a.id<b.id end return a.name<b.name end)
      return result
    end
    local limit=WP26.entityLimit180
    function WP26.entityLimit180(key)
      if key=='sire' or key=='ownedSire' then return WP26.sireRegions181().last end
      return limit(key)
    end
  end

  do
    local expected={68,139,5,73,247,195,3,184,135,6,0,0,65,186,199,0,0,0,68,141,72,35,102,59,200,114,63,116,28,184,169,6,0,0,102,59,200,119,5,69,133,192,117,46,15,183,193,102,65,43,193,102,65,59,194,118,33,184,254,7,0,0,15,183,200,102,65,43,201,102,65,59,202,119,55,15,183,193,72,107,192,56,72,3,5,79,11,218,3,195,184,136,6,0,0,15,183,209,102,43,208,15,183,193,102,131,250,33,119,208,69,133,192,116,203,15,183,194,72,107,192,56,72,3,5,15,11,218,3,195,15,183,192,72,107,192,56,72,3,5,248,10,218,3,195}
    function WP26.personNames182()
      local base=WP26.mod()
      local bytes=assert(readBytes(base+0x289dc0,#expected,true),'Person name dispatch unavailable')
      for i,v in ipairs(expected) do assert(bytes[i]==v,'Person name dispatch changed') end
      local function pointer(rva)local v=readQword(base+rva);return v and v>=65536 and v or nil end
      return {normal=assert(pointer(0x402a948),'Person names unavailable'),conditional=pointer(0x402a950),extra=pointer(0x402a968),flag=assert(readInteger(base+0x3ec9510))}
    end
    function WP26.personNamePointer182(id,s)
      if type(id)~='number' or id%1~=0 or id<0 or id>65535 then return nil end
      s=s or WP26.personNamesActive182 or WP26.personNames182()
      if id<0x687 then return s.normal+id*56 end
      if id>=0x688 and id<=0x6a9 and s.flag~=0 and s.conditional then return s.conditional+(id-0x688)*56 end
      if id>=0x6aa and id<=0x771 and s.extra then return s.extra+(id-0x6aa)*56 end
      return nil
    end
    function WP26.personCompactFirst182(key)
      if key=='jockey' then
        assert(readBytes(WP26.mod()+0x11eb4e,1)==0xba,'Jockey compact dispatch changed')
        local first=assert(readInteger(WP26.mod()+0x11eb4f))
        assert(first+assert(readInteger(WP26.mod()+0x11eb5a))+1==WP26.entityCount180(key),'Jockey ranges disagree')
        return first
      end
      assert(key=='trainer' and readBytes(WP26.mod()+0x112b5e,1)==0x3d,'Trainer compact dispatch changed')
      local first=assert(readInteger(WP26.mod()+0x112b5f))
      local last=assert(readInteger(WP26.mod()+0x112b6b))
      assert(first<=last and last+1==WP26.entityCount180(key),'Trainer ranges disagree')
      return first
    end
    local function snapshot(fn)
      if WP26.personNamesActive182 then return fn() end
      local s=WP26.personNames182()
      WP26.personNamesActive182=s
      local result=table.pack(pcall(fn))
      WP26.personNamesActive182=nil
      if not result[1] then error(result[2],0) end
      local now=WP26.personNames182()
      for _,key in ipairs({'normal','conditional','extra','flag'}) do assert(s[key]==now[key],'Person name region changed during lookup') end
      return table.unpack(result,2,result.n)
    end
    local rows=WP26.editorRows
    function WP26.editorRows(key)
      if key=='jockey' or key=='trainer' then return snapshot(function()return rows(key)end) end
      return rows(key)
    end
    local picker=WP26.entityPickerRows101
    function WP26.entityPickerRows101(key,rows)
      if key=='jockey' or key=='trainer' then return snapshot(function()return picker(key,rows)end) end
      return picker(key,rows)
    end
  end

  do
    local definitions={jockey={lea=0x30ccd5,next=0x30ccdc,count=0x30ccdc},trainer={lea=0x30d066,next=0x30d06d,count=0x30d056}}
    function WP26.personRanges183(key,fresh)
      if not fresh and WP26.personRangesActive183 and WP26.personRangesActive183.key==key then return WP26.personRangesActive183 end
      local d=assert(definitions[key],'Person roster unavailable')
      local base=WP26.mod()
      local op=assert(readBytes(base+d.lea,3,true))
      assert(op[1]==0x48 and op[2]==0x8d and op[3]==5 and readBytes(base+d.count,1)==0xb9,'Person roster instructions changed')
      local displacement=assert(readInteger(base+d.lea+3))
      if displacement>=0x80000000 then displacement=displacement-0x100000000 end
      local tableRva=d.next+displacement-6
      local count=assert(readInteger(base+d.count+1))
      assert(count>0 and count<=65536 and tableRva>=0 and tableRva+count*8<=WP26.BUILD.size,'Person roster descriptor bounds invalid')
      local bytes=assert(readBytes(base+tableRva,count*8,true),'Person roster descriptors unavailable')
      local function value(offset,size)local v=0;for i=size-1,0,-1 do v=(v<<8)|bytes[offset+i+1] end;return v end
      local ranges={};local last=-1
      for i=0,count-1 do
        local flags=value(i*8,4);local first=value(i*8+4,2);local finish=value(i*8+6,2)
        if flags&0xc0000000~=0 and first<=finish then ranges[#ranges+1]={first=first,last=finish};last=math.max(last,finish) end
      end
      assert(last>=0,'No person roster ranges available')
      return {key=key,ranges=ranges,last=last,bytes=bytes,tableRva=tableRva,count=count}
    end
    function WP26.personRosterIncludes183(key,id)
      local s=WP26.personRanges183(key)
      for _,range in ipairs(s.ranges) do if id>=range.first and id<=range.last then return true end end
      return false
    end
    function WP26.farmLocation183(id)
      if type(id)~='number' or id%1~=0 or id<0 or id>=WP26.entityCount180('farmAll') then return nil end
      if id==36 then return 2 end
      local ordinary=WP26.entityCount180('farm')
      if id<ordinary then return WP26.bits(WP26.data('farm')+id*204,8,6,5) end
      return WP26.bits(WP26.data('farmNameDefinitions070')+(id-ordinary)*32,0,0,5)
    end
    function WP26.farmRegion183(id)
      local location=WP26.farmLocation183(id)
      if location==nil then return 'other' end
      if location<19 then return 'jp' elseif location==19 then return 'us' elseif location<=22 then return 'eu' end
      return 'other'
    end
    function WP26.horseRegion183(c)
      local s=WP26.raceSnapshotActive179 or WP26.raceSnapshot179()
      local id=c.raceID
      if id and s.flag~=0 and id>=s.first and id<s.first+s.conditionalCount then
        local group=s.conditionalCount//3
        assert(group*3==s.conditionalCount,'Conditional race region layout changed')
        local index=id-s.first
        if index<group then return 'jp' elseif index<group*2 then return 'us' else return 'eu' end
      end
      local region=WP26.bits(c.race,24,3,2)
      return region==0 and 'jp' or region==1 and 'us' or region==2 and 'eu' or 'other'
    end
    local count=WP26.entityCount180
    function WP26.entityCount180(key)
      if definitions[key] then return WP26.personRanges183(key).last+1 end
      return count(key)
    end
    local function snapshot(key,fn)
      local previous=WP26.personRangesActive183
      if previous and previous.key==key then return fn() end
      local s=WP26.personRanges183(key,true);WP26.personRangesActive183=s
      local result=table.pack(pcall(fn));WP26.personRangesActive183=previous
      if not result[1] then error(result[2],0) end
      local now=WP26.personRanges183(key,true)
      assert(s.tableRva==now.tableRva and s.count==now.count,'Person roster descriptor changed during lookup')
      for i,v in ipairs(s.bytes) do assert(v==now.bytes[i],'Person roster ranges changed during lookup') end
      return table.unpack(result,2,result.n)
    end
    local rows=WP26.editorRows
    function WP26.editorRows(key)
      if definitions[key] then return snapshot(key,function()return rows(key)end) end
      return rows(key)
    end
    local picker=WP26.entityPickerRows101
    function WP26.entityPickerRows101(key,rows)
      if definitions[key] then return snapshot(key,function()return picker(key,rows)end) end
      return picker(key,rows)
    end
  end

  do
    local specs={
  ['parameter162Get_HChildData_running_form184']={
    ['rva']=884496,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 9D 2B F5 03 8B 44 C8 14 C1 E8 03 83 E0 03 C3'
  },
  ['parameter162Set_HChildData_running_form184']={
    ['rva']=884544,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 22 83 FA 03 7D 1D 0F B7 C1 83 E2 03 C1 E2 03 48 8D 0C 40 48 8B 05 65 2B F5 03 83 64 C8 14 E7 09 54 C8 14 C3'
  },
  ['parameter162Get_HChildData_sibling_best184']={
    ['rva']=894624,
    ['pattern']='B8 70 0D 00 00 66 3B C8 72 03 33 C0 C3 0F B7 C1 48 8D 0C 40 48 8B 05 0D 04 F5 03 8B 44 C8 10 C1 E8 0E 83 E0 03 C3'
  },
  ['parameter162Set_HChildData_sibling_best184']={
    ['rva']=894672,
    ['pattern']='B8 70 0D 00 00 66 3B C8 73 25 83 FA 04 7F 20 0F B7 C1 83 E2 03 C1 E2 0E 48 8D 0C 40 48 8B 05 D5 03 F5 03 81 64 C8 10 FF 3F FF FF 09 54 C8 10 C3'
  }
}
    for name,spec in pairs(specs) do
      spec.bytes162={}
      for byte in spec.pattern:gmatch('%x%x') do spec.bytes162[#spec.bytes162+1]=tonumber(byte,16) end
      WP26.SPEC[name]=spec
    end
    local definitions={
  {
    ['en']='Running form',
    ['ja']='走法',
    ['off']=20,
    ['bit']=3,
    ['bits']=2,
    ['max']=2,
    ['groupEn']='Base abilities',
    ['groupJa']='基本能力',
    ['optionsJa']={'普通','ピッチ','大跳び'},
    ['optionsEn']={'Normal','Pitch','Long stride'},
    ['source']='D7F10/D7F40;9ED970->C37B0 registration copy;188D00->39DC9D0 labels',
    ['parameter162']='HChildData_running_form184',
    ['nativeParameter162']={
      ['id']='id',
      ['getter']='parameter162Get_HChildData_running_form184',
      ['setter']='parameter162Set_HChildData_running_form184'
    }
  },
  {
    ['en']='Best sibling achievement',
    ['ja']='兄弟最高実績',
    ['off']=16,
    ['bit']=14,
    ['bits']=2,
    ['max']=3,
    ['groupEn']='Sibling records',
    ['groupJa']='兄弟情報',
    ['optionsJa']={'表示なし','オープン馬','重賞馬','ＧⅠ馬'},
    ['optionsEn']={'No label','Open-class horse','Graded-stakes horse','G1 horse'},
    ['source']='2B1FFF caption;2B200A..2B2034 labels;2B20AA->DA6A0;BDB3BC/BDB3D0 update by dam',
    ['parameter162']='HChildData_sibling_best184',
    ['nativeParameter162']={
      ['id']='id',
      ['getter']='parameter162Get_HChildData_sibling_best184',
      ['setter']='parameter162Set_HChildData_sibling_best184'
    }
  }
}
    for _,definition in ipairs(definitions) do
    local installed={}
    for _,key in ipairs({'ownedFoal','foal'}) do
      local fields=WP26.EDITORS[key].fields
      if not installed[fields] then
        installed[fields]=true
        local field={}
        for name,value in pairs(definition) do field[name]=value end
        fields[#fields+1]=field
      end
    end
    end
  end

  do
    local helpers={
      [0]={rva=0xCB250,pattern='48 83 EC 28 45 33 C9 33 D2 45 8D 41 01 E8 7E D0 FE FF 8B C8 83 F8 4A 76 0A B8 04 00 00 00 48 83'},
      [1]={rva=0xB8D50,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 80 3F 01 00 8B D0 48 8D 0D 5B 21 92 03 B8 03 00 00 00 4C 8D'},
      [2]={rva=0xB8D00,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 D0 3D 01 00 8B D0 48 8D 0D AB 21 92 03 B8 03 00 00 00 4C 8D'},
      [3]={rva=0xB9D40,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 70 33 01 00 8B D0 48 8D 0D 6B 11 92 03 B8 03 00 00 00 4C 8D'},
      [4]={rva=0xB8DF0,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 80 41 01 00 8B D0 48 8D 0D BB 20 92 03 B8 03 00 00 00 4C 8D'},
      [5]={rva=0xB8DA0,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 80 40 01 00 8B D0 48 8D 0D 0B 21 92 03 B8 03 00 00 00 4C 8D'},
      [6]={rva=0xB8CB0,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 D0 3C 01 00 8B D0 48 8D 0D FB 21 92 03 B8 03 00 00 00 4C 8D'},
      [7]={rva=0xB9C10,pattern='48 83 EC 28 45 33 C9 45 8D 41 01 E8 20 2C 01 00 8B D0 48 8D 0D 9B 12 92 03 B8 03 00 00 00 4C 8D'},
      [8]={rva=0xC7F70,pattern='48 89 5C 24 08 57 48 83 EC 20 45 33 C9 33 D2 0F B7 D9 45 8D 41 01 E8 55 4B 00 00 0F 57 C0 8B C0'},
      [9]={rva=0xB9D90,pattern='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 76 0F E8 C2 E3 FF FF B9 2D'},
      [10]={rva=0xB8E40,pattern='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 2E 0F B7 C0 48 6B C8 34 48 8B 05 49 17 F7 03 0F'},
      [11]={rva=0xC1160,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D 8A 83 E0 03 00 75 29'},
      [12]={rva=0xC1D10,pattern='40 55 48 83 EC 20 0F B7 E9 B9 86 1A 00 00 0F B7 C5 66 2B C1 B9 73 18 00 00 66 3B C1 0F 87 03 01'},
      [13]={rva=0xC3830,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D BA 5C E0 03 00 75 29'},
      [14]={rva=0xB8B90,pattern='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 2E 0F B7 C0 48 6B C8 34 48 8B 05 F9 19 F7 03 0F'},
      [15]={rva=0xC3A10,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D DA 5A E0 03 00 75 29'},
      [16]={rva=0xB94C0,pattern='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 2E 0F B7 C0 48 6B C8 34 48 8B 05 C9 10 F7 03 0F'},
      [17]={rva=0xC3920,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D CA 5B E0 03 00 75 29'},
      [18]={rva=0xB98F0,pattern='48 83 EC 28 BA 86 1A 00 00 0F B7 C1 66 2B C2 BA 73 18 00 00 66 3B C2 77 2E 0F B7 C0 48 6B C8 34 48 8B 05 99 0C F7 03 0F'},
      [19]={rva=0xC3B00,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D EA 59 E0 03 00 75 29'},
      [20]={rva=0xC8330,pattern='48 89 5C 24 20 56 48 83 EC 20 0F B7 D9 33 F6 B9 86 1A 00 00 0F B7 C3 66 2B C1 B9 73 18 00 00 66'},
      [21]={rva=0xC3EF0,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D FA 55 E0 03 00 75 29'},
      [22]={rva=0xC3740,pattern='48 83 EC 28 B8 85 1A 00 00 66 3B C8 76 43 BA FB 32 00 00 0F B7 C1 66 2B C2 66 83 F8 32 77 09 83 3D AA 5D E0 03 00 75 29'},
    }
    local byName={}
    for index,spec in pairs(helpers) do local name='memoTruth186_'..index;spec.bytes186={};for byte in spec.pattern:gmatch('%x%x') do spec.bytes186[#spec.bytes186+1]=tonumber(byte,16) end;WP26.SPEC[name]=spec;byName[name]=spec end
    local resolve=WP26.resolve
    function WP26.resolve(name)
      local spec=byName[name]
      if not spec then return resolve(name) end
      WP26.require()
      local address=WP26.mod()+spec.rva
      local bytes=readBytes(address,#spec.bytes186,true)
      assert(bytes and #bytes==#spec.bytes186, 'Memo reader unavailable: '..name)
      for index,byte in ipairs(spec.bytes186) do assert(bytes[index]==byte, 'Memo reader code mismatch: '..name) end
      return address
    end
    function WP26.memoValue186(c,index)
      assert(c.key=='owned' and helpers[index], 'Memo target unavailable')
      local fresh=WP26.context(c.key,c.id)
      assert(fresh.primary==c.primary and fresh.raceID==c.raceID and fresh.horseID==c.horseID, 'Memo target changed')
      local value=tonumber(WP26.native('memoTruth186_'..index,c.raceID,0))
      assert(value and value%1==0 and value>=0, 'Memo source unavailable')
      if index==9 or index==11 or index==13 then value=value~=0 and 1 or 0
      elseif index==14 then value=({[0]=0,[1]=0,[2]=1,[3]=2,[4]=3})[value] or 0
      elseif index==18 then value=({[0]=0,[1]=1,[2]=2,[3]=3,[4]=3,[5]=0,[6]=1,[7]=4})[value] or 0 end
      return value+1
    end
    for _,f in ipairs(WP26.EDITORS.owned.fields) do
      if f.memoIndex==9 then f.en='Memo: Left-handed tracks';f.ja='メモ：左回り'
      elseif f.memoIndex==13 then f.en='Memo: Tight turns';f.ja='メモ：小回り'
      elseif f.en=='Revealed: Tight turns' then f.en='Revealed: Left-handed tracks';f.ja='左回り：判明'
      elseif f.en=='Revealed: Left-handed tracks' then f.en='Revealed: Tight turns';f.ja='小回り：判明' end
    end
  end

end
]]></LuaScript>
</CheatTable>