#NEWLINE# def render_part( self , player , player_image , part , slot ) : #NEWLINE# #INDENT# 'Lookup, crop and color given item slot and apply to player render.' #NEWLINE# gender = player . get_gender ( ) #NEWLINE# stance = player . get_personality ( ) #NEWLINE# if ( part == 'head' ) : #NEWLINE# #INDENT# frame_key = ( 'head' , 'normal' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( part == 'legs' ) : #NEWLINE# #INDENT# frame_key = ( ( 'pants' + gender [ 0 ] ) , stance ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( part == 'back' ) : #NEWLINE# #INDENT# frame_key = ( 'back' , frame_key ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# frame = self . assets . frames ( ) . lookup_frame ( * frame_key ) #NEWLINE# if ( slot is None ) : #NEWLINE# #INDENT# return player_image #NEWLINE# #UNINDENT# item = self . assets . items ( ) . get_item ( slot [ 'name' ] ) #NEWLINE# if ( ( item is None ) or ( not ( ( gender + 'Frames' ) in item [ 0 ] ) ) ) : #NEWLINE# #INDENT# return player_image #NEWLINE# #UNINDENT# item_img_path = item [ 0 ] [ ( gender + 'Frames' ) ] #NEWLINE# if ( item_img_path [ 0 ] != '/' ) : #NEWLINE# #INDENT# item_img_path = ( ( os . path . dirname ( item [ 1 ] ) + '/' ) + item_img_path ) #NEWLINE# #UNINDENT# item_img = self . assets . images ( ) . get_image ( item_img_path ) #NEWLINE# if ( item_img is None ) : #NEWLINE# #INDENT# return player_image #NEWLINE# #UNINDENT# item_img = item_img . crop ( frame ) #NEWLINE# item_img = self . assets . images ( ) . color_image ( item_img , slot [ 'parameters' ] ) #NEWLINE# player_image . paste ( item_img , mask = item_img ) #NEWLINE# return player_image