Example #1
0
def create_subfield_layer(aspect, ip):
    '''Reads the SUBFIELD.pgn file and creates
    the subfield layer.'''
    layer = []
    if 'PANTS' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_SUBFIELD, ip, invert=False, sym=True)
    else:
        layer = pgnreader.parse_pagan_file(FILE_MIN_SUBFIELD, ip, invert=False, sym=True)

    return layer
def create_weapon_layer(weapon, hashcode, isSecond=False):
    """Creates the layer for weapons."""
    return pgnreader.parse_pagan_file(
        ('%s%spgn%s' % (PACKAGE_DIR, os.sep, os.sep)) + weapon + '.pgn',
        hashcode,
        sym=False,
        invert=isSecond)
def create_shield_layer(shield, hashcode):
    """Creates the layer for shields."""
    return pgnreader.parse_pagan_file(
        ('%s%spgn%s' % (PACKAGE_DIR, os.sep, os.sep)) + shield + '.pgn',
        hashcode,
        sym=False,
        invert=False)
def create_subfield_layer(aspect, ip):
    '''Reads the SUBFIELD.pgn file and creates
    the subfield layer.'''
    layer = []
    if 'PANTS' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_SUBFIELD,
                                           ip,
                                           invert=False,
                                           sym=True)
    else:
        layer = pgnreader.parse_pagan_file(FILE_MIN_SUBFIELD,
                                           ip,
                                           invert=False,
                                           sym=True)

    return layer
Example #5
0
def create_boots_layer(aspect, ip):
    '''Reads the BOOTS.pgn file and creates
    the boots layer.'''
    layer = []
    if 'BOOTS' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_BOOTS, ip, invert=False, sym=True)
    return layer
Example #6
0
def create_torso_layer(aspect, ip):
    '''Reads the TORSO.pgn file and creates
    the torso layer.'''
    layer = []
    if 'TOP' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_TORSO, ip, invert=False, sym=True)
    return layer
Example #7
0
def create_hair_layer(aspect, ip):
    '''Reads the HAIR.pgn file and creates
    the hair layer.'''
    layer = []
    if 'HAIR' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_HAIR, ip, invert=False, sym=True)
    return layer
Example #8
0
def create_shield_deco_layer(weapons, ip):
    '''Reads the SHIELD_DECO.pgn file and creates
    the shield decal layer.'''
    layer = []
    if weapons[0] in hashgrinder.SHIELDS:
        layer = pgnreader.parse_pagan_file(FILE_SHIELD_DECO, ip, invert=False, sym=False)
    return layer
def create_boots_layer(aspect, ip):
    '''Reads the BOOTS.pgn file and creates
    the boots layer.'''
    layer = []
    if 'BOOTS' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_BOOTS,
                                           ip,
                                           invert=False,
                                           sym=True)
    return layer
def create_torso_layer(aspect, ip):
    '''Reads the TORSO.pgn file and creates
    the torso layer.'''
    layer = []
    if 'TOP' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_TORSO,
                                           ip,
                                           invert=False,
                                           sym=True)
    return layer
def create_hair_layer(aspect, ip):
    '''Reads the HAIR.pgn file and creates
    the hair layer.'''
    layer = []
    if 'HAIR' in aspect:
        layer = pgnreader.parse_pagan_file(FILE_HAIR,
                                           ip,
                                           invert=False,
                                           sym=True)
    return layer
def create_shield_deco_layer(weapons, ip):
    '''Reads the SHIELD_DECO.pgn file and creates
    the shield decal layer.'''
    layer = []
    if weapons[0] in hashgrinder.SHIELDS:
        layer = pgnreader.parse_pagan_file(FILE_SHIELD_DECO,
                                           ip,
                                           invert=False,
                                           sym=False)
    return layer
def setup_pixelmap(hashcode):
    """Creates and combines all required layers to
    build a pixelmap for creating the virtual
    pixels."""

    # Color distribution.
    # colors = hashgrinder.grindIpForColors(ip)
    colors = hashgrinder.grind_hash_for_colors(hashcode)
    color_body = colors[0]
    color_subfield = colors[1]
    color_weapon_a = colors[2]
    color_weapon_b = colors[3]
    color_shield_deco = colors[4]
    color_boots = colors[5]
    color_hair = colors[6]
    color_top = colors[7]

    # Grinds for the aspect.
    aspect = hashgrinder.grind_hash_for_aspect(hashcode)

    # Determine weapons of the avatar.
    weapons = hashgrinder.grind_hash_for_weapon(hashcode)

    if DEBUG:
        print("Current aspect: %r" % aspect)
        print("Current weapons: %r" % weapons)

    # There is just one body template. The optional pixels need to be mirrored so
    # the body layout will be symmetric to avoid uncanny looks.
    layer_body = pgnreader.parse_pagan_file(FILE_BODY,
                                            hashcode,
                                            invert=False,
                                            sym=True)

    layer_hair = create_hair_layer(aspect, hashcode)
    layer_boots = create_boots_layer(aspect, hashcode)
    layer_torso = create_torso_layer(aspect, hashcode)

    has_shield = (weapons[0] in hashgrinder.SHIELDS)

    if has_shield:
        layer_weapon_a = create_shield_layer(weapons[0], hashcode)
        layer_weapon_b = create_weapon_layer(weapons[1], hashcode)
    else:
        layer_weapon_a = create_weapon_layer(weapons[0], hashcode)
        if (len(weapons) == 2):
            layer_weapon_b = create_weapon_layer(weapons[1], hashcode, True)

    layer_subfield = create_subfield_layer(aspect, hashcode)
    layer_deco = create_shield_deco_layer(weapons, hashcode)

    pixelmap = scale_pixels(color_body, layer_body)
    pixelmap += scale_pixels(color_top, layer_torso)
    pixelmap += scale_pixels(color_hair, layer_hair)
    pixelmap += scale_pixels(color_subfield, layer_subfield)
    pixelmap += scale_pixels(color_boots, layer_boots)
    pixelmap += scale_pixels(color_weapon_a, layer_weapon_a)
    if (len(weapons) == 2):
        pixelmap += scale_pixels(color_weapon_b, layer_weapon_b)
    pixelmap += scale_pixels(color_shield_deco, layer_deco)

    return pixelmap
Example #14
0
def setup_pixelmap(hashcode):
    """Creates and combines all required layers to
    build a pixelmap for creating the virtual
    pixels."""

    # Color distribution.
    # colors = hashgrinder.grindIpForColors(ip)
    colors = hashgrinder.grind_hash_for_colors(hashcode)
    color_body = colors[0]
    color_subfield = colors[1]
    color_weapon_a = colors[2]
    color_weapon_b = colors[3]
    color_shield_deco = colors[4]
    color_boots = colors[5]
    color_hair = colors[6]
    color_top = colors[7]

    # Grinds for the aspect.
    aspect = hashgrinder.grind_hash_for_aspect(hashcode)


    #Determine weapons of the avatar.
    weapons = hashgrinder.grind_hash_for_weapon(hashcode)



    if DEBUG:
        print ("Current aspect: %r" % aspect)
        print ("Current weapons: %r" % weapons)

    # There is just one body template. The optional pixels need to be mirrored so
    # the body layout will be symmetric to avoid uncanny looks.
    layer_body = pgnreader.parse_pagan_file(FILE_BODY, hashcode, invert=False, sym=True)

    layer_hair = create_hair_layer(aspect, hashcode)
    layer_boots = create_boots_layer(aspect, hashcode)
    layer_torso = create_torso_layer(aspect, hashcode)

    has_shield = (weapons[0] in hashgrinder.SHIELDS)

    if has_shield:
        layer_weapon_a = create_shield_layer(weapons[0], hashcode)
        layer_weapon_b = create_weapon_layer(weapons[1], hashcode)
    else:
        layer_weapon_a = create_weapon_layer(weapons[0], hashcode)
        if (len(weapons) == 2):
            layer_weapon_b = create_weapon_layer(weapons[1], hashcode, True)

    layer_subfield = create_subfield_layer(aspect, hashcode)
    layer_deco = create_shield_deco_layer(weapons, hashcode)

    pixelmap = scale_pixels(color_body, layer_body)
    pixelmap += scale_pixels(color_top, layer_torso)
    pixelmap += scale_pixels(color_hair, layer_hair)
    pixelmap += scale_pixels(color_subfield, layer_subfield)
    pixelmap += scale_pixels(color_boots, layer_boots)
    pixelmap += scale_pixels(color_weapon_a, layer_weapon_a)
    if (len(weapons) == 2):
        pixelmap += scale_pixels(color_weapon_b, layer_weapon_b)
    pixelmap += scale_pixels(color_shield_deco, layer_deco)

    return pixelmap
Example #15
0
def create_weapon_layer(weapon, hashcode, isSecond=False):
    """Creates the layer for weapons."""
    return pgnreader.parse_pagan_file(('%s%spgn%s' % (PACKAGE_DIR, os.sep, os.sep)) + weapon + '.pgn', hashcode, sym=False, invert=isSecond)
Example #16
0
def create_shield_layer(shield, hashcode):
    """Creates the layer for shields."""
    return pgnreader.parse_pagan_file(('%s%spgn%s' % (PACKAGE_DIR, os.sep, os.sep)) + shield + '.pgn', hashcode, sym=False, invert=False)