29 lines
1.4 KiB
Python
29 lines
1.4 KiB
Python
"""Action bar 3 flush with bar 2, right end cap clear of bar 3 (task #3)."""
|
|
import sys,struct
|
|
from pathlib import Path
|
|
H=Path(__file__).resolve().parent;sys.path.insert(0,str(H))
|
|
import frozen_store as fs
|
|
st=fs.Store();root=st.root;lay=st.layout
|
|
def get(fid):
|
|
out=[]
|
|
for g in lay['groups']:
|
|
if not g['locale']&2 or g.get('flags1'):continue
|
|
f=0
|
|
for i,(d,) in enumerate(struct.iter_unpack('<I',memoryview(root)[g['ids_offset']:g['ckeys_offset']])):
|
|
f+=d
|
|
if f==fid:out.append(root[g['ckeys_offset']+i*16:g['ckeys_offset']+i*16+16].hex())
|
|
f+=1
|
|
assert len(out)==1,(fid,out);return st.read(out[0])[2]
|
|
# Classic constants: bar 3 right after bar 2 (bar 2 at 22, 12 buttons = 562, button padding 2).
|
|
c=get(7658507);a=b'ACTION_BAR_3_BOTTOM_BAR_OFFSET_X = 606;'
|
|
assert c.count(a)==1
|
|
(H/'inputs/7658507.before.lua').write_bytes(c)
|
|
(H/'inputs/7658507.after.lua').write_bytes(c.replace(a,b'ACTION_BAR_3_BOTTOM_BAR_OFFSET_X = 586; -- Octo: flush with bar 2 (was 606)'))
|
|
# Preset layouts: the right gryphon sits past bar 3's last button (bar 3 ends 1148; bag bar right 1116).
|
|
p=get(7406652)
|
|
import re
|
|
pat=re.compile(rb'(relativeTo = "BagsBar",\s*relativePoint = "RIGHT",\s*offsetX = )-30,')
|
|
assert len(pat.findall(p))==1,len(pat.findall(p))
|
|
(H/'inputs/7406652.before.lua').write_bytes(p);(H/'inputs/7406652.after.lua').write_bytes(pat.sub(lambda m:m.group(1)+b'24, -- Octo: clear of action bar 3 (was -30)',p))
|
|
print('ok')
|