Пример #1
0
    async def handle(self, p: Player) -> None:
        c = glob.channels[self.name]

        if not c or not p.join_channel(c):
            log(f'{p} failed to join {self.name}.', Ansi.LYELLOW)
            return

        # enqueue channelJoin to our player.
        p.enqueue(packets.channelJoin(c.name))
Пример #2
0
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))

    # Enqueue channelJoin to our player.
    p.enqueue(packets.channelJoin(c.name))
Пример #3
0
    # but not in userPresence (so that only donators
    # show up with the yellow name in-game, but everyone
    # gets osu!direct & other in-game perks).
    data += packets.banchoPrivileges(p.bancho_priv
                                     | ClientPrivileges.Supporter)

    data += packets.notification('Welcome back to the gulag!\n'
                                 f'Current build: v{glob.version}')

    # send all channel info.
    for c in glob.channels:
        if p.priv & c.read_priv != c.read_priv:
            continue  # no priv to read

        # autojoinable channels
        if c.auto_join and p.join_channel(c):
            # NOTE: p.join_channel enqueues channelJoin, but
            # if we don't send this back in this specific request,
            # the client will attempt to join the channel again.
            data += packets.channelJoin(c.name)

        data += packets.channelInfo(*c.basic_info)

    # tells osu! to reorder channels based on config.
    data += packets.channelInfoEnd()

    # fetch some of the player's
    # information from sql to be cached.
    await p.achievements_from_sql()
    await p.stats_from_sql_full()
    await p.friends_from_sql()