예제 #1
0
파일: match.py 프로젝트: osufx/pep.py
	def sendUpdates(self):
		"""
		Send match updates packet to everyone in lobby and room streams

		:return:
		"""
		self.matchDataCache = serverPackets.updateMatch(self.matchID)
		censoredDataCache = serverPackets.updateMatch(self.matchID, censored=True)
		if self.matchDataCache is not None:
			glob.streams.broadcast(self.streamName, self.matchDataCache)
		if censoredDataCache is not None:
			glob.streams.broadcast("lobby", censoredDataCache)
		else:
			log.error("MPROOM{}: Can't send match update packet, match data is None!!!".format(self.matchID))
예제 #2
0
파일: match.py 프로젝트: Mansions/peppy
    def toggleSlotLocked(self, slotID):
        """
		Lock a slot
		Same as calling setSlot and then sendUpdate

		:param slotID: slot number
		:return:
		"""
        # Check if slot is already locked
        if self.slots[slotID].status == slotStatuses.LOCKED:
            newStatus = slotStatuses.FREE
        else:
            newStatus = slotStatuses.LOCKED

        # Send updated settings to kicked user, so he returns to lobby
        if self.slots[slotID].user is not None and self.slots[
                slotID].user in glob.tokens.tokens:
            glob.tokens.tokens[self.slots[slotID].user].enqueue(
                serverPackets.updateMatch(self.matchID))

        # Set new slot status
        self.setSlot(slotID, status=newStatus, team=0, user=None, mods=0)

        # Send updates to everyone else
        self.sendUpdates()
        log.info("MPROOM{}: Slot{} {}".format(
            self.matchID, slotID,
            "locked" if newStatus == slotStatuses.LOCKED else "unlocked"))