# Path: constants/dataTypes.py
# BYTE = 0
# UINT16 = 1
# SINT16 = 2
# UINT32 = 3
# SINT32 = 4
# UINT64 = 5
# SINT64 = 6
# STRING = 7
# FFLOAT = 8		# 'float' is a keyword
# BBYTES = 9      # 'bytes' is a keyword
# INT_LIST = 10   # TODO: Maybe there are some packets that still use uInt16 + uInt32 thing somewhere.
# 
# Path: constants/slotStatuses.py
# FREE = 1
# LOCKED = 2
# NOT_READY = 4
# READY = 8
# NO_MAP = 16
# PLAYING = 32
# OCCUPIED = 124
# PLAYING_QUIT = 128


from constants import dataTypes
from helpers import packetHelper
from constants import slotStatuses
		["matchID", dataTypes.UINT16],
		["inProgress", dataTypes.BYTE],
		["unknown", dataTypes.BYTE],
		["mods", dataTypes.UINT32],
		["matchName", dataTypes.STRING],
		["matchPassword", dataTypes.STRING],
		["beatmapName", dataTypes.STRING],
		["beatmapID", dataTypes.UINT32],
		["beatmapMD5", dataTypes.STRING]
	]

	# Slot statuses (not used)
	for i in range(0,16):
		struct.append(["slot{}Status".format(str(i)), dataTypes.BYTE])

	# Slot statuses (not used)
	for i in range(0,16):
		struct.append(["slot{}Team".format(str(i)), dataTypes.BYTE])

	# Read first part
	data.append(packetHelper.readPacketData(stream, struct))

	# Skip userIDs because fuck
	start = 7+2+1+1+4+4+16+16+len(data[0]["matchName"])+len(data[0]["matchPassword"])+len(data[0]["beatmapMD5"])+len(data[0]["beatmapName"])
	start += 1 if (data[0]["matchName"] == "") else 2
	start += 1 if (data[0]["matchPassword"] == "") else 2
	start += 2	# If beatmap name and MD5 don't change, the client sends \x0b\x00 istead of \x00 only, so always add 2. ...WHY!
	start += 2
	for i in range(0,16):
		s = data[0]["slot{}Status".format(str(i))]

# Path: constants/dataTypes.py
# BYTE = 0
# UINT16 = 1
# SINT16 = 2
# UINT32 = 3
# SINT32 = 4
# UINT64 = 5
# SINT64 = 6
# STRING = 7
# FFLOAT = 8		# 'float' is a keyword
# BBYTES = 9      # 'bytes' is a keyword
# INT_LIST = 10   # TODO: Maybe there are some packets that still use uInt16 + uInt32 thing somewhere.
# 
# Path: constants/slotStatuses.py
# FREE = 1
# LOCKED = 2
# NOT_READY = 4
# READY = 8
# NO_MAP = 16
# PLAYING = 32
# OCCUPIED = 124
# PLAYING_QUIT = 128


# Path: constants/clientPackets.py
from constants import dataTypes
from helpers import packetHelper
from constants import slotStatuses

		["matchID", dataTypes.UINT16],
		["inProgress", dataTypes.BYTE],
		["unknown", dataTypes.BYTE],
		["mods", dataTypes.UINT32],
		["matchName", dataTypes.STRING],
		["matchPassword", dataTypes.STRING],
		["beatmapName", dataTypes.STRING],
		["beatmapID", dataTypes.UINT32],
		["beatmapMD5", dataTypes.STRING]
	]

	# Slot statuses (not used)
	for i in range(0,16):
		struct.append(["slot{}Status".format(str(i)), dataTypes.BYTE])

	# Slot statuses (not used)
	for i in range(0,16):
		struct.append(["slot{}Team".format(str(i)), dataTypes.BYTE])

	# Read first part
	data.append(packetHelper.readPacketData(stream, struct))

	# Skip userIDs because fuck
	start = 7+2+1+1+4+4+16+16+len(data[0]["matchName"])+len(data[0]["matchPassword"])+len(data[0]["beatmapMD5"])+len(data[0]["beatmapName"])
	start += 1 if (data[0]["matchName"] == "") else 2
	start += 1 if (data[0]["matchPassword"] == "") else 2
	start += 2	# If beatmap name and MD5 don't change, the client sends \x0b\x00 istead of \x00 only, so always add 2. ...WHY!
	start += 2
	for i in range(0,16):
		s = data[0]["slot{}Status".format(str(i))]

		if s != slotStatuses.FREE and s != slotStatuses.LOCKED: