def triggers(file_path): f = File(file_path) data = [] while not f.eof(): trigger = {"id": f.readUInt32()} assert (f.readUInt16() == 0xffff) trigger["unknown_a"] = f.readUInt8() assert (f.readUInt8() == 0xff) trigger["type"] = TriggerType(f.readUInt32()) trigger["target"] = _readObjectId(f) trigger["enabled"] = bool(f.readUInt8()) trigger["unknown_b"] = f.readUInt8() assert (f.readUInt16() == 0xffff) trigger["timer_start"] = f.readUInt32() if trigger["type"] == TriggerType.TIMER: assert (f.readUInt32() == 0) assert (f.readUInt32() == 0) elif trigger["type"] == TriggerType.PROXIMITY: trigger["distance"] = f.readUInt16() assert (f.readUInt16() == 0xffff) trigger["from"] = _readObjectId(f) trigger["to"] = _readObjectId(f) trigger["reversed"] = bool(f.readUInt8()) trigger["instant"] = bool(f.readUInt8()) assert (f.readUInt16() == 0xffff) elif trigger["type"] == TriggerType.UNUSED: assert (f.readUInt32() == 0) data.append(trigger) return data
def lst(file_path): f = File(file_path) n = f.readUInt32() entries = [] while not f.eof(): entries.append(f.readString()) assert (n == len(entries)) return entries
def worldList(file_path): f = File(file_path) data = {} while not f.eof(): scene_id = f.readUInt16() assert(f.readUInt16() == scene_id) assert(f.readUInt16() == 0) comment = f.readStringBuffer(21) data[scene_id] = comment return data
def adviceDat(file_path): # Reads w{world}a000.dat files. The contain information about characters giving the player advie. # I'm pretty sure this file is not for the game to read. # There're so many typos and variations, I'm pretty sure they're developer notes. f = File(file_path) entries = [] while not f.eof(): level = _adviceEntry(f) if level is None: break entries.append(level) return entries
def worldObj(file_path): f = File(file_path) screen = [] while not f.eof(): counter = f.readUInt16() object_id = _readObjectId(f) assert(object_id["id"] == counter) name = f.readStringBuffer(30).strip() description = f.readStringBuffer(260).strip() screen.append({ "id": object_id, "name": name, "description": description, }) return screen
def worldStrt(file_path): f = File(file_path) data = [] while not f.eof(): screen = {} screen["advice_id"] = f.readUInt16() screen["advice_timer"] = f.readUInt16() screen["unknown1"] = f.readUInt8() screen["unknown2"] = f.readUInt8() screen["id"] = f.readUInt16() assert (screen["id"] == len(data)) screen["target"] = _readObjectId(f) screen["action_type"] = f.readUInt8() screen["who"] = _readObjectId(f) screen["other"] = _readObjectId(f) assert(f.readUInt32() == 0xffffffff) # unknown3 screen["unknown4"] = f.readUInt16() assert(screen["unknown4"] in (0xff, 0x1, 0x0)) assert(f.readUInt16() == 0x0) # unknown5 assert(f.readUInt8() == 0x0) # unknown6 for i in range(15): assert (f.readUInt8() == 0) data.append(screen) return data
def astStatDat(file_path): f = File(file_path) state = readAstroState(f) assert (f.eof()) return state