Пример #1
0
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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
def astStatDat(file_path):
    f = File(file_path)
    state = readAstroState(f)
    assert (f.eof())
    return state