def allPlayersCompleted(self): """ Cleanup match stuff and send match end packet to everyone :return: """ # Collect some info about the match that just ended to send to the api infoToSend = { "id": self.matchID, "name": self.matchName, "beatmap_id": self.beatmapID, "mods": self.mods, "game_mode": self.gameMode, "scores": {} } # Add score info for each player for i in range(0, 16): if self.slots[i].user is not None and self.slots[ i].status == slotStatuses.PLAYING: infoToSend["scores"][glob.tokens.tokens[ self.slots[i].user].userID] = { "score": self.slots[i].score, "mods": self.slots[i].mods, "failed": self.slots[i].failed, "pass": self.slots[i].passed, "team": self.slots[i].team } # Send the info to the api glob.redis.publish("api:mp_complete_match", json.dumps(infoToSend)) # Reset inProgress self.inProgress = False # Reset slots self.resetSlots() # Send match update self.sendUpdates() # Send match complete glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output log.info("MPROOM{}: Match completed".format(self.matchID)) # If this is a tournament match, then we send a notification in the chat # saying that the match has completed. chanName = "#multi_{}".format(self.matchID) if self.isTourney and (chanName in glob.channels.channels): chat.sendMessage(glob.BOT_NAME, chanName, "Match has just finished.")
def allPlayersCompleted(self): """ Cleanup match stuff and send match end packet to everyone :return: """ # Collect some info about the match that just ended to send to the api infoToSend = { "id": self.matchID, "name": self.matchName, "beatmap_id": self.beatmapID, "mods": self.mods, "game_mode": self.gameMode, "scores": {} } # Add score info for each player for i in range(0,16): if self.slots[i].user is not None and self.slots[i].status == slotStatuses.PLAYING: infoToSend["scores"][glob.tokens.tokens[self.slots[i].user].userID] = { "score": self.slots[i].score, "mods": self.slots[i].mods, "failed": self.slots[i].failed, "pass": self.slots[i].passed, "team": self.slots[i].team } # Send the info to the api glob.redis.publish("api:mp_complete_match", json.dumps(infoToSend)) # Reset inProgress self.inProgress = False # Reset slots self.resetSlots() # Send match update self.sendUpdates() # Send match complete glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output log.info("MPROOM{}: Match completed".format(self.matchID)) # Set vinse id if needed chanName = "#multi_{}".format(self.matchID) if self.vinseID is None: self.vinseID = (int(time.time()) // (60 * 15)) << 32 | self.matchID chat.sendMessage("FokaBot", chanName, "Match history available [{} here]".format( "https://vinse.ripple.moe/match/{}".format(self.vinseID) )) if not self.bloodcatAlert: chat.sendMessage( "FokaBot", chanName, "Oh by the way, in case you're playing unranked or broken maps " "that are now available through ripple's osu!direct, you can " "type '!bloodcat' in the chat to get a download link for the " "currently selected map from Bloodcat!" ) self.bloodcatAlert = True # If this is a tournament match, then we send a notification in the chat # saying that the match has completed. if self.isTourney and (chanName in glob.channels.channels): chat.sendMessage(glob.BOT_NAME, chanName, "Match has just finished.")
def allPlayersCompleted(self): """ Cleanup match stuff and send match end packet to everyone :return: """ # Collect some info about the match that just ended to send to the api infoToSend = { "id": self.matchID, "name": self.matchName, "beatmap_id": self.beatmapID, "mods": self.mods, "game_mode": self.gameMode, "host_id": self.hostUserID, "host_user_name": userUtils.getUsername(self.hostUserID), "game_type": self.matchTeamType, "game_score_condition": self.matchScoringType, "game_mod_mode": self.matchModMode, "scores": {} } # Add score info for each player for i in range(0, 16): if self.slots[i].user is not None and self.slots[ i].status == slotStatuses.PLAYING: infoToSend["scores"][glob.tokens.tokens[ self.slots[i].user].userID] = { "score": self.slots[i].score, "mods": self.slots[i].mods, "failed": self.slots[i].failed, "pass": self.slots[i].passed, "team": self.slots[i].team, "username": userUtils.getUsername(glob.tokens.tokens[ self.slots[i].user].userID) # vinse shit ;3 } # Send the info to the api glob.redis.publish("api:mp_complete_match", json.dumps(infoToSend)) self.games.append(json.dumps(infoToSend)) # Reset inProgress self.inProgress = False # Reset slots self.resetSlots() # Send match update self.sendUpdates() # Send match complete glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output log.info("MPROOM{}: Match completed".format(self.matchID)) chanName = "#multi_{}".format(self.matchID) if self.vinseID is None: self.vinseID = (int(time.time()) // (60 * 15)) << 32 | self.matchID chat.sendMessage( glob.BOT_NAME, chanName, "Match history available [{} here]".format( "https://kurikku.pw/matches/{}".format(self.vinseID))) # If this is a tournament match, then we send a notification in the chat # saying that the match has completed. if self.isTourney and (chanName in glob.channels.channels): chat.sendMessage(glob.BOT_NAME, chanName, "Match has just finished.")
def allPlayersCompleted(self): """ Cleanup match stuff and send match end packet to everyone :return: """ # Collect some info about the match that just ended to send to the api infoToSend = { "id": self.matchID, "name": self.matchName, "beatmap_id": self.beatmapID, "mods": self.mods, "game_mode": self.gameMode, "scores": {} } # Add score info for each player for i in range(0, 16): if self.slots[i].user is not None and self.slots[ i].status == slotStatuses.PLAYING: infoToSend["scores"][glob.tokens.tokens[ self.slots[i].user].userID] = { "score": self.slots[i].score, "mods": self.slots[i].mods, "failed": self.slots[i].failed, "pass": self.slots[i].passed, "team": self.slots[i].team } # Send the info to the api glob.redis.publish("api:mp_complete_match", json.dumps(infoToSend)) # Reset inProgress self.inProgress = False # Reset slots self.resetSlots() # Send match update self.sendUpdates() # Send match complete glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output log.info("MPROOM{}: Match completed".format(self.matchID)) # Set vinse id if needed chanName = "#multi_{}".format(self.matchID) if self.vinseID is None: self.vinseID = (int(time.time()) // (60 * 15)) << 32 | self.matchID chat.sendMessage( glob.BOT_NAME, chanName, "Match history available [{} here]".format( "https://multi.troke.id/match/{}".format(self.vinseID))) #ganti ke if not kalau error if not self.bloodcatAlert: chat.sendMessage( glob.BOT_NAME, chanName, "You can use !bloodcat for another beatmap mirror, in case if you have a problem with osudirect" ) self.bloodcatAlert = True # If this is a tournament match, then we send a notification in the chat # saying that the match has completed. if self.isTourney and (chanName in glob.channels.channels): chat.sendMessage(glob.BOT_NAME, chanName, "Match has just finished.")
def allPlayersCompleted(self): """ Cleanup match stuff and send match end packet to everyone :return: """ # Collect some info about the match that just ended to send to the api infoToSend = { "id": self.matchID, "name": self.matchName, "beatmap_id": self.beatmapID, "mods": self.mods, "game_mode": self.gameMode, "scores": {} } # Add score info for each player for i in range(0, 16): if self.slots[i].user is not None and self.slots[ i].status == slotStatuses.PLAYING: infoToSend["scores"][glob.tokens.tokens[ self.slots[i].user].userID] = { "score": self.slots[i].score, "mods": self.slots[i].mods, "failed": self.slots[i].failed, "pass": self.slots[i].passed, "team": self.slots[i].team } # Send the info to the api glob.redis.publish("api:mp_complete_match", json.dumps(infoToSend)) # Reset inProgress self.inProgress = False # Reset slots self.resetSlots() # Send match update self.sendUpdates() # Send match complete glob.streams.broadcast(self.streamName, serverPackets.matchComplete()) # Destroy playing stream glob.streams.dispose(self.playingStreamName) glob.streams.remove(self.playingStreamName) # Console output log.info("MPROOM{}: Match completed".format(self.matchID)) # Set vinse id if needed chanName = "#multi_{}".format(self.matchID) #if self.vinseID is None: # self.vinseID = (int(time.time()) // (60 * 15)) << 32 | self.matchID # chat.sendMessage(glob.BOT_NAME, chanName, "Match history available [{} here]".format( # "https://vinse.ussr.pl/match/{}".format(self.vinseID) # )) # Changing this to be a general notice. if not self.bloodcatAlert: chat.sendMessage( glob.BOT_NAME, chanName, "Hey! Welcome to the RealistikOsu multiplayer! If you ever encounter " "a map you are unable to download through our direct, you can use the " "!mirror command to get an external download link!") self.bloodcatAlert = True # If this is a tournament match, then we send a notification in the chat # saying that the match has completed. if self.isTourney and (chanName in glob.channels.channels): chat.sendMessage(glob.BOT_NAME, chanName, "Match has just finished.")