예제 #1
0
파일: cho.py 프로젝트: Mxnuuel/gulag
class MatchSkipRequest(BanchoPacket, type=Packets.OSU_MATCH_SKIP_REQUEST):
    async def handle(self, p: Player) -> None:
        if not (m := p.match):
            return

        m.get_slot(p).skipped = True
        m.enqueue(packets.matchPlayerSkipped(p.id))

        for s in m.slots:
            if s.status == SlotStatus.playing and not s.skipped:
                return

        # all users have skipped, enqueue a skip.
        m.enqueue(packets.matchSkip(), lobby=False)
예제 #2
0
파일: bancho.py 프로젝트: kingdom5500/gulag
# PacketID: 60
@bancho_packet(Packet.c_matchSkipRequest)
def matchSkipRequest(p: Player, pr: PacketReader) -> None:
    if not (m := p.match):
        printlog(f'{p} tried unreadying outside of a match? (1)')
        return

    m.get_slot(p).skipped = True
    m.enqueue(packets.matchPlayerSkipped(p.id))

    for s in m.slots:
        if s.status & SlotStatus.playing and not s.skipped:
            return

    # All users have skipped, enqueue a skip.
    m.enqueue(packets.matchSkip(), lobby=False)


# PacketID: 63
@bancho_packet(Packet.c_channelJoin)
def channelJoin(p: Player, pr: PacketReader) -> None:
    chan_name = pr.read(osuTypes.string)[0]
    c = glob.channels.get(chan_name)

    if not c or not p.join_channel(c):
        printlog(f'{p} failed to join {chan_name}.', Ansi.YELLOW)
        return

    # Enqueue new channelinfo (playercount) to all players.
    glob.players.enqueue(packets.channelInfo(*c.basic_info))