Add ResStream.read_long/write_long and use them for every CObjects field the client loads with ResStream_ReadInt32 (sb.exe 0x7E1700) as a value: rank info, attribute/skill/resource amounts, requirements, door/deed/container/key fields, natural attacks, hardpoints, sound event types and sparse VAL_LONG (LoadSaveBehavior<long>). Hash/enum fields, list counts and flag words keep unsigned reads. The binary is unchanged; JSON now shows e.g. -1 instead of 4294967295 (rank_hirelings, rank_rank) and -10 instead of 4294967286 (attr_adj). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.9 KiB
Python
44 lines
1.9 KiB
Python
# • ▌ ▄ ·. ▄▄▄▄· ▄▄▄ .·▄▄▄▄ ▪ ▄▄▄▄▄ ▄▄▄ ▄▄▄·▄▄▄
|
|
# ·██ ▐███▪▐█ ▀█▪ ▀▄.▀·██▪ ██ ██ •██ ▪ ▀▄ █· ▐█ ▄█▀▄ █·▪
|
|
# ▐█ ▌▐▌▐█·▐█▀▀█▄ ▐▀▀▪▄▐█· ▐█▌▐█· ▐█.▪ ▄█▀▄ ▐▀▀▄ ██▀·▐▀▀▄ ▄█▀▄
|
|
# ██ ██▌▐█▌██▄▪▐█ ▐█▄▄▌██. ██ ▐█▌ ▐█▌·▐█▌.▐▌▐█•█▌ ▐█▪·•▐█•█▌▐█▌.▐▌
|
|
# ▀▀ █▪▀▀▀·▀▀▀▀ ▀▀▀ ▀▀▀▀▀• ▀▀▀ ▀▀▀ ▀█▄▀▪.▀ ▀ .▀ .▀ ▀ ▀█▄▀▪
|
|
# Magicbane Emulator Project © 2013 - 2022
|
|
# www.magicbane.com
|
|
|
|
from arcane.util.ResStream import ResStream
|
|
from .ArcStructureObject import ArcStructureObject
|
|
|
|
|
|
class ArcDungeonUnitObject(ArcStructureObject):
|
|
def load_binary(self, stream: ResStream):
|
|
super().load_binary(stream)
|
|
num_connectables = stream.read_dword()
|
|
self.dungeon_connectable_edges = [
|
|
stream.read_long() for _ in range(num_connectables)
|
|
]
|
|
|
|
def save_binary(self, stream: ResStream):
|
|
super().save_binary(stream)
|
|
stream.write_dword(len(self.dungeon_connectable_edges))
|
|
for edge in self.dungeon_connectable_edges:
|
|
stream.write_long(edge)
|
|
|
|
def load_json(self, data):
|
|
super().load_json(data)
|
|
self.dungeon_connectable_edges = data['dungeon_connectable_edges']
|
|
return data
|
|
|
|
def save_json(self):
|
|
data = super().save_json()
|
|
data['dungeon_connectable_edges'] = self.dungeon_connectable_edges
|
|
return data
|
|
|
|
|
|
class ArcDungeonExitObject(ArcDungeonUnitObject):
|
|
pass
|
|
|
|
|
|
class ArcDungeonStairObject(ArcDungeonUnitObject):
|
|
pass
|