<interface_config>
<root id="interface" x="0" y="0" w="800" h="600" active="true" />

<!-- ***************** -->
<!-- *   COSMETICS   * -->
<!-- ***************** -->

<template name="but_slider" posref="TL TL" x="0" y="0" w="122" h="32"  id="" posparent="parent" sizeref="" keep="true" value="" max="" >
  <group id="#id" posparent="#posparent" posref="#posref" w="#w" h="#h" x="#x" y="#y" sizeref="#sizeref" value="#value" max="#max" >

    <instance template="box_widget" id="back" posref="TM TM" sizeref="w" w="-38" h="22" x="0" y="0" inherit_gc_alpha="true"/>
    <view type="bitmap" id="black" posparent="back" posref="MM MM" sizeref="wh" w="-2" h="-2" inherit_gc_alpha="true" scale="true" texture="blank.tga" color="0 0 0 128"/>


    <view type="bitmap" id="bk" posref="BM BM" scale="true" y="4" sizeref="w" w="-38" h="2" texture="W_line_hor2.tga" />
    <view type="bitmap" id="bk_prev" posref="ML ML" y="5" texture="W_arrow_left_0.tga" />
    <view type="bitmap" id="bk_next" posref="MR MR" y="5" texture="W_arrow_right_0.tga" />
       
    <ctrl type="button" button_type="push_button" id="but_back" posref="ML ML" x="0" y="5"
    tx_normal="W_arrow_left_0.tga" tx_pushed="W_arrow_left_0.tga" tx_over="W_button_16_over.tga" 
    color="255 255 255 0" col_over="255 255 255 255" col_pushed="255 255 255 0"
    onclick_l="set" params_l="dblink=#value|value=max(sub(@#value,1),0)" />
    
    <ctrl type="button" button_type="push_button" id="but_next" posref="MR MR" x="0" y="5"
    tx_normal="W_arrow_right_0.tga" tx_pushed="W_arrow_right_0.tga" tx_over="W_button_16_over.tga" 
    color="255 255 255 0" col_over="255 255 255 255" col_pushed="255 255 255 0"
    onclick_l="set" params_l="dblink=#value|value=min(add(@#value,1),0)" />
     
  </group>
</template>



<proc id="cosmetics_active">
  <action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:COSMETICS|value=1" />
  <action handler="proc" params="cosmetics_update" />
	<action handler="set" params="target_property=ui:interface:cosmetics:char3d:char:anim|value=0" />
  <action handler="set" params="target_property=ui:interface:cosmetics:char3d:cam:posz|value=add(0.11,getprop('ui:interface:cosmetics:char3d:char:headz'))" />
  <action handler="set" params="target_property=ui:interface:cosmetics:char3d:cam:tgtz|value=add(0.11,getprop('ui:interface:cosmetics:char3d:char:headz'))" />
  <action handler="anim_start" params="anim=anim_refresh_cosmetics" />
</proc>

<proc id="cosmetics_update">
  <action handler="convert_server_entities" params="entity=0|dest=UI:TEMP:CHAR3D" />
  <action handler="set" params="dblink=UI:TEMP:HAIRCUT|value=0" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPA:HATCOLOR|value=0" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:TATTOO|value=0" />
  
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET1|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET2|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET3|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET4|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET5|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET6|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET7|value=4" />
  <action handler="set" params="dblink=UI:TEMP:CHAR3D:VPC:MORPHTARGET8|value=4" />
  
  <action handler="proc" params="proc_change_haircut" />
</proc>


<proc id="cosmetics_deactive">
  <action handler="set" params="dblink=UI:VARIABLES:ISACTIVE:COSMETICS|value=0" />
</proc>



<proc id="cosmetics_cam_position">
      <action handler="set" params="target_property=ui:interface:cosmetics:char3d:cam:posz|value=add(0.11,getprop('ui:interface:cosmetics:char3d:char:headz'))" />
      <action handler="set" params="target_property=ui:interface:cosmetics:char3d:cam:tgtz|value=add(0.11,getprop('ui:interface:cosmetics:char3d:char:headz'))" />
</proc>


<anim id="anim_refresh_cosmetics" duration="0.1" disable_buttons="false" on_finish="proc" on_finish_params="cosmetics_cam_position">
</anim>


<!--**************-->
<!-- PROC HAIRCUT -->
<!--**************-->

<proc id="proc_change_haircut">
	<action handler="proc" params="cosmetics_cam_position" />
	<!--
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,0)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'shave01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,1)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'short01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,2)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'short02.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,3)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'medium01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,4)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'medium02.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,5)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'medium03.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,6)" params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm, 'long01.sitem'),'HEAD')" />
	
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,0)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'shave01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,1)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'short01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,2)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'short02.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,3)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'medium01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,4)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'medium02.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,5)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'medium03.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,6)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm, 'long01.sitem'))" />
	-->
	
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,0)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_basic01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,1)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_basic02.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,2)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_basic03.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,3)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_basic04.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,4)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_style01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,5)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_style02.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,6)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_style03.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,7)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_style04.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,8)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_artistic01.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,9)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_artistic02.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,10)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_artistic03.sitem'),'HEAD')" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,11)" 	params="dblink=UI:TEMP:CHAR3D:VPA:HATMODEL|value=getVSIndex(str( %cosm1, %cosm2, 'hair_artistic04.sitem'),'HEAD')" />

	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,0)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_basic01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,1)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_basic02.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,2)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_basic03.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,3)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_basic04.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,4)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_style01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,5)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_style02.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,6)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_style03.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,7)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_style04.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,8)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_artistic01.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,9)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_artistic02.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,10)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_artistic03.sitem'))" />
	<action handler="set" cond="eq(@UI:TEMP:HAIRCUT,11)" params="target_property=ui:interface:cosmetics:txt_hair:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'hair_artistic04.sitem'))" />
	
</proc>


<!--****************-->
<!-- PROC HAIRCOLOR -->
<!--****************-->

<proc id="proc_change_haircolor">
	<action handler="set" params="target_property=ui:interface:cosmetics:txt_haircolor:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'haircolor', @UI:TEMP:CHAR3D:VPA:HATCOLOR, '.sitem'))" />
</proc>


<!--************-->
<!-- PROC TATOO -->
<!--************-->

<proc id="proc_change_tatoo">
	<action handler="set" params="target_property=ui:interface:cosmetics:txt_tatoo:hardtext|value=getItemTranslatedName(str( %cosm1, %cosm2, 'tatoo', @UI:TEMP:CHAR3D:VPC:TATTOO, '.sitem'))" />
</proc>


<!-- ************************ -->
<!-- *   COSMETICS WINDOW   * -->
<!-- ************************ -->


<group id="cosmetics" type="container" w="296" h="440" global_color="false" resizer="false" right_button="true"
	movable="true" locked="true" openable="false" win_priority="%win_priority_lowest" savable="true"
  title="uimwCosmetics" header_color="UI:SAVE:WIN:COLORS:OPT"
	on_deactive="proc"	on_deactive_params="cosmetics_deactive" on_active="proc" on_active_params="cosmetics_active">

    <group id="header_closed" x="0" y="0" child_resize_w="true" h="440" posref="TL TL" 
  	 group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color">
  	</group>
  	
  	<group id="header_opened" x="0" y="0" child_resize_w="true" h="16" posref="TL TL"
  	 group_onclick_r="active_menu" group_params_r="menu=ui:interface:base_menu_with_color">
  	</group>


    <!-- SCENE 3D -->
    <instance template="box_widget" id="back" posref="TM TM" w="288" h="304" x="0" y="-26" inherit_gc_alpha="true"/>
    <view type="bitmap" id="black" posparent="back" posref="MM MM" sizeref="wh" w="-2" h="-2" inherit_gc_alpha="true" scale="true" texture="blank.tga" color="0 0 0 80"/>
 
    <scene3d id="char3d" sizeref="wh" w="-2" h="-2" posparent="back" posref="TL TL" x="1" y="-1" curcam="cam"
      ambient="128 96 64" sun_ambient="0 0 0" sun_diffuse="255 255 196" sun_specular="0 0 0" sun_direction="-1.0 1.0 -1.0" 
      user_interaction="true" rotz_factor="0.017"
      roty_factor="0.005" roty_limit_min="-20" roty_limit_max="15"
      dist_factor="0.005" dist_limit_min="4.0" dist_limit_max="6.0">

      <character3d id="char" dblink="UI:TEMP:CHAR3D" pos="0.0 0.0 -1.75" rot="0.0 0.0 0.0" />
      <camera id="cam" fov="5" pos="0.0 -5.0 0.0" target="0.0 0.0 0" roll="0" />
      
      <light id="back" pos="0.0 28.2 1.6" color="96 64 32" near="1.0" far="4.0" />
      <light id="lgt" pos="0.0 25.3 2.48" color="255 255 255" near="1.0" far="4.0" />
    </scene3d>
		
       
    <!-- HAIRCUT -->
    <group id="haircutgrp" posparent="back" posref="BM TM" x="0" y="-4" w="276" h="32">
      <instance template="but_slider" id="slider1" posref="TL TL" x="0" y="0" w="276" h="32" value="UI:TEMP:HAIRCUT" max="11" />
      <ctrl type="scroll" id="slider2" posparent="slider1" posref="BM BM" x="0" y="0" sizeref="w" w="-38" h="8"
  							vertical="false" align="L" min="0" max="11" tracksize="8" value="UI:TEMP:HAIRCUT"
  							tx_topright="w_scroll_R.tga" tx_middle="w_scroll_l123_m.tga" tx_bottomleft="w_scroll_L.tga" />
    </group>
    <view type="text" id="txt_hair" posparent="haircutgrp" posref="TM MM" x="0" y="-12" hardtext="" color="255 255 255 255"
      global_color="false" fontsize="11" line_maxw="236" multi_line="false" multi_line_space="0" />
               
    <!-- HAIR COLOR -->
     <group id="haircolorgrp" posparent="haircutgrp" posref="BL TL" x="0" y="-8" w="276" h="32">
      <instance template="but_slider" id="slider1" posref="TL TL" x="0" y="0" w="276" h="32" value="UI:TEMP:CHAR3D:VPA:HATCOLOR" max="5"/>
      <ctrl type="scroll" id="slider2" posparent="slider1" posref="BM BM" x="0" y="0" sizeref="w" w="-38" h="8"
  							vertical="false" align="L" min="0" max="5" tracksize="8" value="UI:TEMP:CHAR3D:VPA:HATCOLOR"
  							tx_topright="w_scroll_R.tga" tx_middle="w_scroll_l123_m.tga" tx_bottomleft="w_scroll_L.tga" />
    </group>
    <view type="text" id="txt_haircolor" posparent="haircolorgrp" posref="TM MM" x="0" y="-12" hardtext="uiCosmColor" color="255 255 255 255"
      global_color="false" fontsize="11" line_maxw="236" multi_line="false" multi_line_space="0" />
    
    <!-- TATOOS -->
    <group id="tatoogrp" posparent="haircolorgrp" posref="BL TL" x="0" y="-8" w="276" h="32">
      <instance template="but_slider" id="slider1" posref="TL TL" x="0" y="0" w="276" h="32" value="UI:TEMP:CHAR3D:VPC:TATTOO" max="63" />
      <ctrl type="scroll" id="slider2" posparent="slider1" posref="BM BM" x="0" y="0" sizeref="w" w="-38" h="8"
  							vertical="false" align="L" min="0" max="63" tracksize="8" value="UI:TEMP:CHAR3D:VPC:TATTOO"
  							tx_topright="w_scroll_R.tga" tx_middle="w_scroll_l123_m.tga" tx_bottomleft="w_scroll_L.tga" />
    </group>
    <view type="text" id="txt_tatoo" posparent="tatoogrp" posref="TM MM" x="0" y="-12" hardtext="uiCosmTatoo" color="255 255 255 255"
      global_color="false" fontsize="11" line_maxw="236" multi_line="false" multi_line_space="0" />
   
		<link expr="depends(@UI:TEMP:HAIRCUT)" action="proc" params="proc_change_haircut" />
		<link expr="depends(@UI:TEMP:CHAR3D:VPA:HATCOLOR)" action="proc" params="proc_change_haircolor" />
		<link expr="depends(@UI:TEMP:CHAR3D:VPC:TATTOO)" action="proc" params="proc_change_tatoo" />

</group>





<tree node="cosmetics">
</tree>



</interface_config>