def make_map_packet(context,
                        width=2,
                        height=2,
                        offset=(2, 2),
                        pixels=b"this"):

        packet = MapPacket(context)

        packet.map_id = 1
        packet.scale = 42
        packet.is_tracking_position = True
        packet.is_locked = False
        packet.icons = []
        d_name = u'Marshmallow' if context.protocol_later_eq(364) else None
        packet.icons.append(
            MapPacket.MapIcon(type=2,
                              direction=2,
                              location=(1, 1),
                              display_name=d_name))
        packet.icons.append(
            MapPacket.MapIcon(type=3, direction=3, location=(3, 3)))
        packet.width = width
        packet.height = height if width else 0
        packet.offset = offset if width else None
        packet.pixels = pixels if width else None
        return packet
Пример #2
0
    def make_map_packet(context,
                        width=2,
                        height=2,
                        offset=(2, 2),
                        pixels=b"this"):
        packet = MapPacket(context)

        packet.map_id = 1
        packet.scale = 42
        packet.is_tracking_position = True
        packet.icons = []
        packet.icons.append(
            MapPacket.MapIcon(type=2, direction=2, location=(1, 1)))
        packet.icons.append(
            MapPacket.MapIcon(type=3, direction=3, location=(3, 3)))
        packet.width = width
        packet.height = height
        packet.offset = offset
        packet.pixels = pixels
        return packet