예제 #1
0
def handle(userToken, packetData):
	# Read packet data. Same structure as changeMatchSettings
	packetData = clientPackets.changeMatchSettings(packetData)

	# Make sure the match exists
	matchID = userToken.matchID
	if matchID not in glob.matches.matches:
		return

	with glob.matches.matches[matchID] as match:
		# Host check
		if userToken.userID != match.hostUserID:
			return

		# Update match password
		match.changePassword(packetData["matchPassword"])
예제 #2
0
def handle(userToken, packetData):
	# Read new settings
	packetData = clientPackets.changeMatchSettings(packetData)

	# Get match ID
	matchID = userToken.matchID
		
	# Make sure the match exists
	if matchID not in glob.matches.matches:
		return

	# Host check
	with glob.matches.matches[matchID] as match:
		if userToken.userID != match.hostUserID:
			return

		# Some dank memes easter egg
		memeTitles = [
			"RWC 2020",
			"Ripple is a duck",
			"Dank memes",
			"1337ms Ping",
			"Iscriviti a Xenotoze",
			"...e i marò?",
			"Superman dies",
			"The brace is on fire",
			"print_foot()",
			"#FREEZEBARKEZ",
			"Ripple devs are actually cats",
			"Thank Mr Shaural",
			"NEVER GIVE UP",
			"T I E D  W I T H  U N I T E D",
			"HIGHEST HDHR LOBBY OF ALL TIME",
			"This is gasoline and I set myself on fire",
			"Everyone is cheating apparently",
			"Kurwa mac",
			"TATOE",
			"This is not your drama landfill.",
			"I like cheese",
			"NYO IS NOT A CAT HE IS A DO(N)G",
			"Datingu startuato"
		]

		# 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:
			# Reset slot mods if not freeMods
			match.resetMods()
		else:
			# Reset match mods if freemod
			match.mods = 0

		# Initialize teams if team type changed
		if match.matchTeamType != oldMatchTeamType:
			match.initializeTeams()

		# Force no freemods if tag coop
		if match.matchTeamType == matchTeamTypes.TAG_COOP or match.matchTeamType == matchTeamTypes.TAG_TEAM_VS:
			match.matchModMode = matchModModes.NORMAL

		# Send updated settings
		match.sendUpdates()

		# Console output
		log.info("MPROOM{}: Updated room settings".format(match.matchID))
def handle(userToken, packetData):
	# Read new settings
	packetData = clientPackets.changeMatchSettings(packetData)

	# Get match ID
	matchID = userToken.matchID
		
	# Make sure the match exists
	if matchID not in glob.matches.matches:
		return

	# Host check
	with glob.matches.matches[matchID] as match:
		if userToken.userID != match.hostUserID:
			return

		# Some dank memes easter egg
		memeTitles = [
			"OWC 2020",
			"AC is a duck",
			"Dank memes",
			"1337ms Ping",
			"Iscriviti a Xenotoze",
			"...e i marò?",
			"Superman dies",
			"The brace is on fire",
			"print_foot()",
			"#FREEZEBARKEZ",
			"osu!thailand devs are actually cats",
			"Thank Mr Shaural",
			"NEVER GIVE UP",
			"T I E D  W I T H  U N I T E D",
			"HIGHEST HDHR LOBBY OF ALL TIME",
			"This is gasoline and I set myself on fire",
			"Everyone is cheating apparently",
			"Kurwa mac",
			"TATOE",
			"This is not your drama landfill.",
			"I like cheese",
			"AOBA IS NOT A CAT HE IS A DO(N)G",
			"YAMI NI NOMARE YO"
		]

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

		# Update match settings
		# NOBODY SHOULD INTRUDE A SINGLE PLAYER MATCH AFTER ALL (tempfix)
		inProgress = bool(packetData["inProgress"])
		slotTaken = [slot for slot in match.slots if slot.status & slotStatuses.OCCUPIED]
		slotPlay   = [slot for slot in slotTaken if slot.status & slotStatuses.PLAYING]
		# log.info("MPROOM{}: ProgPkt({}) SlotPlay({} left)".format(match.matchID,inProgress,len(slotPlay)))
		if len(slotTaken) <= 1:
			match.inProgress = False
		else:
			match.inProgress = len(slotPlay) > 0 and 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["multiSpecial"]

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

		# Reset mods if needed
		if match.matchModMode & matchModModes.FREE_MOD:
			# TODO: Implement a FREEMOD barrier configuration
			#   which works as follows:
			#   - turn off all FM mods on main mods
			#   - turn only FM mods on personal/player's free mods
			# match.mods = 0
			if match.freeModHandler == matchFreeModTypes.datenshi:
				for i, slot in zip(range(len(match.slots)), match.slots):
					slot.mods = packetData['slot{}Mods'.format(i)]
			else:
				match.mods = match.mods & ~mods.FM
				for i, slot in zip(range(len(match.slots)), match.slots):
					#if match.hostUserID == 3:
					#	log.info("MPROOM{} - Slot {} Mods {}".format(match.matchID, i + 1, slot.mods))
					slot.mods = packetData['slot{}Mods'.format(i)] & mods.FM
		else:
			# Synchronize mods if it's no FM
			for i, slot in zip(range(len(match.slots)), match.slots):
				slot.mods = match.mods
		
		match.seed = packetData['seed']

		# Initialize teams if team type changed
		if match.matchTeamType != oldMatchTeamType:
			match.initializeTeams()

		# Force no freemods if tag coop
		# if match.matchTeamType == matchTeamTypes.TAG_COOP or match.matchTeamType == matchTeamTypes.TAG_TEAM_VS:
		#	match.matchModMode = matchModModes.NORMAL

		# Send updated settings
		match.sendUpdates()

		# Console output
		log.info("MPROOM{}: Updated room settings".format(match.matchID))
예제 #4
0
def handle(userToken, packetData):
    # Read new settings
    packetData = clientPackets.changeMatchSettings(packetData)

    # Get match ID
    matchID = userToken.matchID

    # Make sure the match exists
    if matchID not in glob.matches.matches:
        return

    # Host check
    with glob.matches.matches[matchID] as match:
        if userToken.userID != match.hostUserID:
            return

        # Realistik was her
        memeTitles = [
            "I hate boxes", "this text is funny", "Hit kids not juul",
            "dark is the best osu! player", "I'm spiderman", "DING DONG",
            "matt from wii sports", "Intel is an expensive space heater brand",
            "she so shiny", "im a freaking ferrari",
            "Welp shouldnt have bought that switch then", "RealistikBot hot"
        ]

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

        # Update match settings
        match.inProgress = packetData["inProgress"]
        match.matchPassword = packetData["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:
            # Reset slot mods if not freeMods
            match.resetMods()
        else:
            # Reset match mods if freemod
            match.mods = 0

        # Initialize teams if team type changed
        if match.matchTeamType != oldMatchTeamType:
            match.initializeTeams()

        # Force no freemods if tag coop
        if match.matchTeamType == matchTeamTypes.TAG_COOP or match.matchTeamType == matchTeamTypes.TAG_TEAM_VS:
            match.matchModMode = matchModModes.NORMAL

        # Send updated settings
        match.sendUpdates()

        # Console output
        log.info("MPROOM{}: Updated room settings".format(match.matchID))
예제 #5
0
def handle(userToken, packetData):
    # Read new settings
    packetData = clientPackets.changeMatchSettings(packetData)

    # Get match ID
    matchID = userToken.matchID

    # Make sure the match exists
    if matchID not in glob.matches.matches:
        return

    # Host check
    with glob.matches.matches[matchID] as match:
        if userToken.userID != match.hostUserID or userToken.userID != match.tourneyHost:
            return

        # Some dank memes easter egg
        memeTitles = [
            "KWC 2020", "Crystal is a duck", "Dank memes", "1337ms Ping",
            "Superman dies", "The brace is on fire", "70 points",
            "print_foot()", "Ripple devs are actually suckers",
            "NEVER GIVE UP AND GIVE UP", "HIGHEST HDHR LOBBY OF ALL TIME",
            "Everyone is cheating apparently",
            "When hqosu player join Kurikku, he automaticly leaves :fact:"
            "Kurwa mac", "TATOE", "This is not your drama landfill.",
            "Cmyui likes 70000 code lines"
        ]

        # 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:
            # Reset slot mods if not freeMods
            match.resetMods()
        else:
            # Reset match mods if freemod
            match.mods = 0

        # Initialize teams if team type changed
        if match.matchTeamType != oldMatchTeamType:
            match.initializeTeams()

        # Force no freemods if tag coop
        if match.matchTeamType == matchTeamTypes.TAG_COOP or match.matchTeamType == matchTeamTypes.TAG_TEAM_VS:
            match.matchModMode = matchModModes.NORMAL

        # Send updated settings
        match.sendUpdates()

        # Console output
        log.info("MPROOM{}: Updated room settings".format(match.matchID))
예제 #6
0
def handle(userToken, packetData):
	# Read new settings
	packetData = clientPackets.changeMatchSettings(packetData)

	# Get match ID
	matchID = userToken.matchID
		
	# Make sure the match exists
	if matchID not in glob.matches.matches:
		return

	# Host check
	with glob.matches.matches[matchID] as match:
		if userToken.userID != match.hostUserID:
			return

		# Some dank memes easter egg
		memeTitles = [
			"Ain't rape if you enjoy it."
		]

		# 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:
			# Reset slot mods if not freeMods
			match.resetMods()
		else:
			# Reset match mods if freemod
			match.mods = 0

		# Initialize teams if team type changed
		if match.matchTeamType != oldMatchTeamType:
			match.initializeTeams()

		# Force no freemods if tag coop
		if match.matchTeamType == matchTeamTypes.TAG_COOP or match.matchTeamType == matchTeamTypes.TAG_TEAM_VS:
			match.matchModMode = matchModModes.NORMAL

		# Send updated settings
		match.sendUpdates()

		# Console output
		log.info("MPROOM{}: Updated room settings".format(match.matchID))