示例#1
0
文件: cho.py 项目: Mxnuuel/gulag
class MatchComplete(BanchoPacket, type=Packets.OSU_MATCH_COMPLETE):
    async def handle(self, p: Player) -> None:
        if not (m := p.match):
            return

        m.get_slot(p).status = SlotStatus.complete

        # check if there are any players that haven't finished.
        if any([s.status == SlotStatus.playing for s in m.slots]):
            return

        # find any players just sitting in the multi room
        # that have not been playing the map; they don't
        # need to know all the players have completed, only
        # the ones who are playing (just new match info).
        not_playing = [
            s.player.id for s in m.slots if s.status
            & SlotStatus.has_player and s.status != SlotStatus.complete
        ]

        was_playing = [
            s for s in m.slots if s.player and s.player.id not in not_playing
        ]

        m.unready_players(expected=SlotStatus.complete)

        m.in_progress = False
        m.enqueue(packets.matchComplete(), lobby=False, immune=not_playing)
        m.enqueue_state()

        if m.is_scrimming:
            # determine winner, update match points & inform players.
            asyncio.create_task(m.update_matchpoints(was_playing))
示例#2
0
class MatchComplete(BanchoPacket, type=Packets.OSU_MATCH_COMPLETE):
    async def handle(self, p: Player) -> None:
        if not (m := p.match):
            return

        m.get_slot(p).status = SlotStatus.complete

        # check if there are any players that haven't finished.
        if any(s.status == SlotStatus.playing for s in m.slots):
            return

        m.unready_players(expected=SlotStatus.complete)

        m.in_progress = False
        m.enqueue(packets.matchComplete())
        m.enqueue(packets.updateMatch(m))
示例#3
0
class MatchComplete(ClientPacket, type=ClientPacketType.MATCH_COMPLETE):
    async def handle(self, p: Player) -> None:
        if not (m := p.match):
            return

        m.get_slot(p).status = SlotStatus.complete

        all_completed = True

        for s in m.slots:
            if s.status & SlotStatus.playing:
                all_completed = False
                break

        if all_completed:
            m.in_progress = False
            m.enqueue(packets.matchComplete())

            for s in m.slots:  # reset match statuses
                if s.status == SlotStatus.complete:
                    s.status = SlotStatus.not_ready
示例#4
0
    if not (m := p.match):
        printlog(f'{p} sent a scoreframe outside of a match?')
        return

    m.get_slot(p).status = SlotStatus.complete

    all_completed = True

    for s in m.slots:
        if s.status & SlotStatus.playing:
            all_completed = False
            break

    if all_completed:
        m.in_progress = False
        m.enqueue(packets.matchComplete())

        for s in m.slots:  # Reset match statuses
            if s.status == SlotStatus.complete:
                s.status = SlotStatus.not_ready


# PacketID: 51
@bancho_packet(Packet.c_matchChangeMods)
def matchChangeMods(p: Player, pr: PacketReader) -> None:
    if not (m := p.match):
        printlog(f'{p} tried changing multi mods outside of a match?')
        return

    mods = pr.read(osuTypes.i32)[0]