# Path: constants/clientPackets.py
# def userActionChange(stream):
# def userStatsRequest(stream):
# def userPanelRequest(stream):
# def sendPublicMessage(stream):
# def sendPrivateMessage(stream):
# def setAwayMessage(stream):
# def channelJoin(stream):
# def channelPart(stream):
# def addRemoveFriend(stream):
# def startSpectating(stream):
# def matchSettings(stream):
# def createMatch(stream):
# def changeMatchSettings(stream):
# def changeSlot(stream):
# def joinMatch(stream):
# def changeMods(stream):
# def lockSlot(stream):
# def transferHost(stream):
# def matchInvite(stream):
# def matchFrames(stream):
# def tournamentMatchInfoRequest(stream):
# def tournamentJoinMatchChannel(stream):
# def tournamentLeaveMatchChannel(stream):
# 
# Path: constants/matchModModes.py
# NORMAL = 0
# FREE_MOD = 1
# 
# Path: constants/matchTeamTypes.py
# HEAD_TO_HEAD = 0
# TAG_COOP = 1
# TEAM_VS = 2
# TAG_TEAM_VS = 3
# 
# Path: constants/matchTeams.py
# NO_TEAM = 0
# BLUE = 1
# RED = 2
# 
# Path: constants/slotStatuses.py
# FREE = 1
# LOCKED = 2
# NOT_READY = 4
# READY = 8
# NO_MAP = 16
# PLAYING = 32
# OCCUPIED = 124
# PLAYING_QUIT = 128
# 
# Path: objects/glob.py
# 		VERSION = f.read().strip()
# 	VERSION = "Unknown"
# DATADOG_PREFIX = "peppy"


import random
from common import generalUtils
from common.log import logUtils as log
from constants import clientPackets
from constants import matchModModes
from constants import matchTeamTypes
from constants import matchTeams
from constants import slotStatuses
from objects import glob

		# Set match name
		match.matchName = packetData["matchName"] if packetData["matchName"] != "meme" else random.choice(memeTitles)

		# Update match settings
		match.inProgress = packetData["inProgress"]
		if packetData["matchPassword"] != "":
			match.matchPassword = generalUtils.stringMd5(packetData["matchPassword"])
		else:
			match.matchPassword = ""
		match.beatmapName = packetData["beatmapName"]
		match.beatmapID = packetData["beatmapID"]
		match.hostUserID = packetData["hostUserID"]
		match.gameMode = packetData["gameMode"]

		oldBeatmapMD5 = match.beatmapMD5
		oldMods = match.mods
		oldMatchTeamType = match.matchTeamType

		match.mods = packetData["mods"]
		match.beatmapMD5 = packetData["beatmapMD5"]
		match.matchScoringType = packetData["scoringType"]
		match.matchTeamType = packetData["teamType"]
		match.matchModMode = packetData["freeMods"]

		# Reset ready if needed
		if oldMods != match.mods or oldBeatmapMD5 != match.beatmapMD5:
			match.resetReady()

		# Reset mods if needed

# Path: constants/clientPackets.py
# def userActionChange(stream):
# def userStatsRequest(stream):
# def userPanelRequest(stream):
# def sendPublicMessage(stream):
# def sendPrivateMessage(stream):
# def setAwayMessage(stream):
# def channelJoin(stream):
# def channelPart(stream):
# def addRemoveFriend(stream):
# def startSpectating(stream):
# def matchSettings(stream):
# def createMatch(stream):
# def changeMatchSettings(stream):
# def changeSlot(stream):
# def joinMatch(stream):
# def changeMods(stream):
# def lockSlot(stream):
# def transferHost(stream):
# def matchInvite(stream):
# def matchFrames(stream):
# def tournamentMatchInfoRequest(stream):
# def tournamentJoinMatchChannel(stream):
# def tournamentLeaveMatchChannel(stream):
# 
# Path: constants/matchModModes.py
# NORMAL = 0
# FREE_MOD = 1
# 
# Path: constants/matchTeamTypes.py
# HEAD_TO_HEAD = 0
# TAG_COOP = 1
# TEAM_VS = 2
# TAG_TEAM_VS = 3
# 
# Path: constants/matchTeams.py
# NO_TEAM = 0
# BLUE = 1
# RED = 2
# 
# Path: constants/slotStatuses.py
# FREE = 1
# LOCKED = 2
# NOT_READY = 4
# READY = 8
# NO_MAP = 16
# PLAYING = 32
# OCCUPIED = 124
# PLAYING_QUIT = 128
# 
# Path: objects/glob.py
# 		VERSION = f.read().strip()
# 	VERSION = "Unknown"
# DATADOG_PREFIX = "peppy"


# Path: events/changeMatchSettingsEvent.py
import random
from common import generalUtils
from common.log import logUtils as log
from constants import clientPackets
from constants import matchModModes
from constants import matchTeamTypes
from constants import matchTeams
from constants import slotStatuses
from objects import glob


		# Set match name
		match.matchName = packetData["matchName"] if packetData["matchName"] != "meme" else random.choice(memeTitles)

		# Update match settings
		match.inProgress = packetData["inProgress"]
		if packetData["matchPassword"] != "":
			match.matchPassword = generalUtils.stringMd5(packetData["matchPassword"])
		else:
			match.matchPassword = ""
		match.beatmapName = packetData["beatmapName"]
		match.beatmapID = packetData["beatmapID"]
		match.hostUserID = packetData["hostUserID"]
		match.gameMode = packetData["gameMode"]

		oldBeatmapMD5 = match.beatmapMD5
		oldMods = match.mods
		oldMatchTeamType = match.matchTeamType

		match.mods = packetData["mods"]
		match.beatmapMD5 = packetData["beatmapMD5"]
		match.matchScoringType = packetData["scoringType"]
		match.matchTeamType = packetData["teamType"]
		match.matchModMode = packetData["freeMods"]

		# Reset ready if needed
		if oldMods != match.mods or oldBeatmapMD5 != match.beatmapMD5:
			match.resetReady()

		# Reset mods if needed

		if match.matchModMode == matchModModes.NORMAL: