<!-- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
	Hollow Earth Expedition - FENETRE NPC

	Version 1.0.0
	05/05/2009
	Grimmbart de Ferdock
	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->


<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.0">
	<template name="npctoplabel">
		<stringcontrol>
			<font>sheetlabelsmall</font>
			<center />
			<script>
				function onInit()
					if anchor then
						setAnchor("bottom", anchor[1], "top", "absolute", 2);
						setAnchor("left", anchor[1], "left", "absolute", 0);
						setAnchor("right", anchor[1], "right", "absolute", 0);
					end
				end
			</script>
		</stringcontrol>
	</template>

	<template name="attribut_prim">
		<numberfield>
			<nodrop />
			<noreset />
			<hideonvalue>0</hideonvalue>
			<font>sheettextsmall</font>
			<frame>
				<name>modifier</name>
				<offset>5,2,5,4</offset>
			</frame>
			<script>
				function onInit()
					setAnchor("top", "sante", "bottom", "absolute", 17);
					
					if anchor then
						setAnchor("left", anchor[1], "right", "relative", 5);
					else
						setAnchor("left", "sante", "left", "absolute", -2);
					end
					
					setAnchoredWidth(5);
					setAnchoredHeight(18);
					
					if getDatabaseNode().isStatic() then
						setFont("chatfont");
					end
				end
			</script>
		</numberfield>
	</template>

	<template name="attribut_prim2">
		<numberfield>
			<nodrop />
			<noreset />
			<hideonvalue>0</hideonvalue>
			<font>sheettextsmall</font>
			<frame>
				<name>modifier</name>
				<offset>5,2,5,4</offset>
			</frame>
			<script>
				function onInit()
					setAnchor("top", "corps", "bottom", "absolute", 10);
					
					if anchor then
						setAnchor("left", anchor[1], "right", "relative", 5);
					else
						setAnchor("left", "corps", "left", "absolute", -2);
					end
					
					setAnchoredWidth(5);
					setAnchoredHeight(18);
					
					if getDatabaseNode().isStatic() then
						setFont("chatfont");
					end
				end
			</script>
		</numberfield>
	</template>



	<template name="attribut_sec">
		<numberfield>
			<nodrop />
			<noreset />
			<displaysign />
			<font>sheettextsmall</font>
			<frame>
				<name>modifier</name>
				<offset>5,2,5,4</offset>
			</frame>
			<script>
				function onInit()
					setAnchor("top", "charisme", "bottom", "absolute", 17);
					
					if anchor then
						setAnchor("left", anchor[1], "right", "relative", 5);
					else
						setAnchor("left", "charisme", "left", "absolute", 0);
					end
					
					setAnchoredWidth(27);
					setAnchoredHeight(18);
					
					if getDatabaseNode().isStatic() then
						setFont("chatfont");
					end
				end
			</script>
		</numberfield>
	</template>

	<template name="attribut_sec2">
		<numberfield>
			<nodrop />
			<noreset />
			<displaysign />
			<font>sheettextsmall</font>
			<frame>
				<name>modifier</name>
				<offset>5,2,5,4</offset>
			</frame>
			<script>
				function onInit()
					setAnchor("top", "taille", "bottom", "absolute", 10);
					
					if anchor then
						setAnchor("left", anchor[1], "right", "relative", 5);
					else
						setAnchor("left", "taille", "left", "absolute", 0);
					end
					
					setAnchoredWidth(27);
					setAnchoredHeight(18);
					
					if getDatabaseNode().isStatic() then
						setFont("chatfont");
					end
				end
			</script>
		</numberfield>
	</template>
	
	<windowclass name="npc_combat">
		<datasource>npc</datasource>
		<script>
			--[[ If the size of the window changes, adjust the widths of abilities and saves ]]
			function sizeChanged()
				local winwidth, winheight = getSize();
				
				local abilitywidth = math.floor(45 + (winwidth - 235) / 3);
				corps.setAnchoredWidth(abilitywidth);
				dexterite.setAnchoredWidth(abilitywidth);
				force.setAnchoredWidth(abilitywidth);
				charisme.setAnchoredWidth(abilitywidth);
				intelligence.setAnchoredWidth(abilitywidth);
				volonte.setAnchoredWidth(abilitywidth);								
				taille.setAnchoredWidth(abilitywidth);
				deplacement.setAnchoredWidth(abilitywidth);
				perception.setAnchoredWidth(abilitywidth);
				initiative.setAnchoredWidth(abilitywidth);
				defense.setAnchoredWidth(abilitywidth);
				etourdissement.setAnchoredWidth(abilitywidth);

				end
			
			function onInit()
				self.onSizeChanged = sizeChanged;
			end
		</script>
		
		
		<sheetdata>
			<columnnumberfield name="sante">				
				<tabtarget next="corps" prev="name" />
			</columnnumberfield>
			<columnfieldlabel>
				<anchor>sante</anchor>
				<static>Santé</static>
			</columnfieldlabel>
			
	

			<!-- ------------------------------------ ATTRIBUTS -->
			<attribut_prim name="corps">
				<tabtarget next="dexterite" prev="sante" />
			</attribut_prim>
			<npctoplabel>
				<anchor>corps</anchor>
				<static>Corps</static>
			</npctoplabel>
			<attribut_prim name="dexterite">
				<anchor>corps</anchor>
				<tabtarget next="force" prev="corps" />
			</attribut_prim>
			<npctoplabel>
				<anchor>dexterite</anchor>
				<static>Dextérité</static>
			</npctoplabel>
			<attribut_prim name="force">
				<anchor>corps</anchor>
				<tabtarget next="charisme" prev="dexterite" />
			</attribut_prim>
			<npctoplabel>
				<anchor>force</anchor>
				<static>Force</static>
			</npctoplabel>
			<columnfieldlabel>
				<anchor>corps</anchor>
				<static>Attributs</static>
			</columnfieldlabel>
			
			<attribut_prim2 name="charisme">
				<!-- <anchor>corps</anchor> -->
				<tabtarget next="intelligence" prev="force" />
			</attribut_prim2>
			<npctoplabel>
				<anchor>charisme</anchor>
				<static>Charisme</static>
			</npctoplabel>
			<attribut_prim2 name="intelligence">
				<anchor>charisme</anchor>
				<tabtarget next="volonte" prev="charisme" />
			</attribut_prim2>
			<npctoplabel>
				<anchor>intelligence</anchor>
				<static>Intelligence</static>
			</npctoplabel>
			<attribut_prim2 name="volonte">
				<anchor>charisme</anchor>
				<tabtarget next="taille" prev="intelligence" />
			</attribut_prim2>
			<npctoplabel>
				<anchor>volonte</anchor>
				<static>Volonté</static>
			</npctoplabel>

			<columnfieldlabel>
				<anchor>charisme</anchor>
				<static></static>
			</columnfieldlabel>

			<!-- ------------------------------------ Attributs SECONDAIRES-->
			<attribut_sec name="taille">
				<tabtarget next="deplacement" prev="volonte" />				
			</attribut_sec>
			<npctoplabel>
				<anchor>taille</anchor>
				<static>Taille</static>
			</npctoplabel>
			
			<attribut_sec name="deplacement">
				<tabtarget next="perception" prev="taille" />
				<anchor>taille</anchor>
			</attribut_sec>
			<npctoplabel>
				<anchor>deplacement</anchor>
				<static>Déplacement</static>
			</npctoplabel>
						
			<attribut_sec name="perception">
				<tabtarget next="initiative" prev="deplacement" />
				<anchor>taille</anchor>
			</attribut_sec>
			<npctoplabel>
				<anchor>perception</anchor>
				<static>Perception</static>
			</npctoplabel>
			
			<columnfieldlabel>
				<anchor>taille</anchor>
				<static>Attributs Sec.</static>
			</columnfieldlabel>
			
			<attribut_sec2 name="initiative">
				<tabtarget next="defense" prev="perception" />
			</attribut_sec2>
			<npctoplabel>
				<anchor>initiative</anchor>
				<static>initiative</static>
			</npctoplabel>
			
			<attribut_sec2 name="defense">
				<tabtarget next="etourdissement" prev="initiative" />
				<anchor>initiative</anchor>
			</attribut_sec2>
			<npctoplabel>
				<anchor>defense</anchor>
				<static>Défense</static>
			</npctoplabel>

			<attribut_sec2 name="etourdissement">
				<tabtarget next="arme1" prev="defense" />
				<anchor>initiative</anchor>
			</attribut_sec2>
			<npctoplabel>
				<anchor>etourdissement</anchor>
				<static>Etourdissement</static>
			</npctoplabel>
			
			<columnfieldlabel>
				<anchor>taille</anchor>
				<static></static>
			</columnfieldlabel>
			<!-- ------------------------------------ -->
			
			
			<!-- ------------------------------------ ARMES 1-->
			<columnstringfield name="arme1">
				<anchor>etourdissement</anchor>
				<tabtarget next="arme1" prev="etourdissement" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>arme1</anchor>
				<static>Arme 1</static>
			</columnfieldlabel>
			<!-- ------------------------------------ ARMES 2-->
			<columnstringfield name="arme2">
				<anchor>etourdissement</anchor>
				<tabtarget next="arme3" prev="arme1" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>arme2</anchor>
				<static>Arme 2</static>
			</columnfieldlabel>
			<!-- ------------------------------------ ARMES3-->
			<columnstringfield name="arme3">
				<anchor>etourdissement</anchor>
				<tabtarget next="arme4" prev="arme2" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>arme3</anchor>
				<static>Arme 3</static>
			</columnfieldlabel>
			<!-- ------------------------------------ ARMES 4-->
			<columnstringfield name="arme4">
				<anchor>etourdissement</anchor>
				<tabtarget next="specialqualities" prev="arme3" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>arme4</anchor>
				<static>Arme 4</static>
			</columnfieldlabel>
			
			
			<columnstringfield name="specialqualities">
				<anchor>etourdissement</anchor>
				<tabtarget next="space" prev="arme4" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>specialqualities</anchor>
				<static>Particularités</static>
			</columnfieldlabel>
			
			
			<columnnumberfield name="space">
				<anchor>specialqualities</anchor>
				<tabtarget next="reach" prev="specialqualities" />
			</columnnumberfield>
			<columnfieldlabel>
				<anchor>space</anchor>
				<static>Esp. occupé</static>
			</columnfieldlabel>
			
			<columnnumberfield name="reach">
				<anchor>space</anchor>
				<tabtarget next="name" prev="space" />
			</columnnumberfield>
			<columnfieldlabel>
				<anchor>reach</anchor>
				<static>Allonge</static>
			</columnfieldlabel>
									
			<!-- Spacer -->
			<genericcontrol>
				<anchored>
					<to>reach</to>
					<position>below</position>
					<size>
						<height>25</height>
					</size>
				</anchored>
			</genericcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="npc_other">
		<datasource>npc</datasource>
		<sheetdata>
			<columnstringfield name="type">
				<tabtarget next="competences" prev="name" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>type</anchor>
				<static>Archétype</static>
			</columnfieldlabel>
			
			<columnstringfield name="competences">
				<anchor>type</anchor>
				<tabtarget next="talents" prev="type" />				
			</columnstringfield>
			<columnfieldlabel>
				<anchor>competences</anchor>
				<static>Compétences</static>
			</columnfieldlabel>

			<columnstringfield name="talents">
				<anchor>type</anchor>
				<tabtarget next="ressources" prev="competences" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>talents</anchor>
				<static>Talents</static>
			</columnfieldlabel>

			<columnstringfield name="ressources">
				<anchor>type</anchor>
				<tabtarget next="defauts" prev="talents" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>ressources</anchor>
				<static>Ressources</static>
			</columnfieldlabel>
			
			<columnstringfield name="defauts">
				<anchor>type</anchor>
				<tabtarget next="defaut" prev="ressources" />
			</columnstringfield>
			<columnfieldlabel>
				<anchor>defauts</anchor>
				<static>Défauts</static>
			</columnfieldlabel>
			
			

			<!-- Spacer -->
			<genericcontrol>
				<anchored>
					<to>defauts</to>
					<position>below</position>
					<size>
						<height>15</height>
					</size>
				</anchored>
			</genericcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="npc_description">
		<datasource>npc</datasource>
		<sheetdata>
			<!-- DESCRIPTION -->
			<formattedtextfield name="text">
				<anchored>
					<top>
						<anchor>top</anchor>
					</top>
					<left>
						<anchor>left</anchor>
					</left>
					<right>
						<anchor>right</anchor>
					</right>
				</anchored>
				<font>
					<normal>chatfont</normal>
					<bold>narratorfont</bold>
					<italic>chatitalicfont</italic>
					<bolditalic>chatbolditalicfont</bolditalic>
					<title>defaultstringcontrol</title>
				</font>
				<linkicon>
					<link>button_openwindow</link>
					<emptylink>button_emptytarget</emptylink>
				</linkicon>
				<selectioncolor>#FFD296</selectioncolor>
				<footer>footer_narrow</footer>
				<empty>Cliquer pour entrer une description</empty>
			</formattedtextfield>
		</sheetdata>
	</windowclass>

	<windowclass name="npc">
		<datasource>npc</datasource>
		<frame>charsheet</frame>
		<placement>
			<size>
				<width>500</width>
				<height>400</height>
			</size>
		</placement>
		<sizelimits>
			<minimum>
				<width>300</width>
				<height>400</height>
			</minimum>
			<dynamic />
		</sizelimits>
		<minimize>minimized_npc</minimize>
		<tooltip>
			<field>name</field>
		</tooltip>
		<sheetdata>
			<!-- NAME -->
			<genericcontrol name="nameframe">
				<bounds>38,20,-35,35</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>
			<windowopencontrol>
				<anchored>
					<to>nameframe</to>
					<position>insidetopleft</position>
					<offset>13,8</offset>
					<size>
						<width>20</width>
						<height>20</height>
					</size>
				</anchored>
				<icon>
					<normal>button_openwindow</normal>
					<pressed>button_emptytarget</pressed>
				</icon>
				<class>npc</class>
				<description>
					<field>name</field>
				</description>
			</windowopencontrol>
			<stringfield name="name">
				<anchored>
					<top>
						<parent>nameframe</parent>
						<anchor>top</anchor>
						<offset>9</offset>
					</top>
					<left>
						<parent>nameframe</parent>
						<anchor>left</anchor>
						<offset>35</offset>
					</left>
					<right>
						<parent>nameframe</parent>
						<anchor>right</anchor>
						<offset>-15</offset>
					</right>
				</anchored>
				<empty>&#171; Nouveau PNJ &#187;</empty>
				<font>sheettext</font>
			</stringfield>
			<tokenfield name="token">
				<bounds>13,25,25,25</bounds>
				<empty>indicator_emptytoken</empty>
			</tokenfield>
			<buttoncontrol>
				<bounds>-36,27,23,22</bounds>
				<icon>
					<normal>button_identityactivate</normal>
					<pressed>button_identityactivate_down</pressed>
				</icon>
				<script>
					function onButtonPress()
						GmIdentityManager.addIdentity(window.name.getValue());
					end
				</script>
			</buttoncontrol>

			<genericcontrol name="tabcontentframe">
				<bounds>10,54,-25,-15</bounds>
				<frame>
					<name>sheetgroup</name>
					<offset>0,1,0,0</offset>
				</frame>
			</genericcontrol>

			<!-- SUBWINDOWS -->
			<subwindow name="description">
				<anchored>
					<to>tabcontentframe</to>
					<position>over</position>
					<offset>-15,-7</offset>
				</anchored>
				<class>npc_description</class>
			</subwindow>
			<subwindow name="combat">
				<anchored>
					<to>tabcontentframe</to>
					<position>over</position>
					<offset>-15,-7</offset>
				</anchored>
				<class>npc_combat</class>
			</subwindow>
			<subwindow name="other">
				<anchored>
					<to>tabcontentframe</to>
					<position>over</position>
					<offset>-15,-7</offset>
				</anchored>
				<class>npc_other</class>
			</subwindow>

			<scrollercontrol name="description_scroller">
				<bounds>-79,-50,45,27</bounds>
				<target>description</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
				<invisible />
			</scrollercontrol>
			<scrollercontrol name="combat_scroller">
				<bounds>-79,-50,45,27</bounds>
				<target>combat</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
				<invisible />
			</scrollercontrol>
			<scrollercontrol name="other_scroller">
				<bounds>-79,-50,45,27</bounds>
				<target>other</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
				<invisible />
			</scrollercontrol>

			<tabcontrol name="tabs">
				<bounds>-22,50,18,223</bounds>
				<tab>
					<icon>tab_main</icon>
					<subwindow>description</subwindow>
					<scroller>description_scroller</scroller>
				</tab>
				<tab>
					<icon>tab_combat</icon>
					<subwindow>combat</subwindow>
					<scroller>combat_scroller</scroller>
				</tab>
				<tab>
					<icon>tab_other</icon>
					<subwindow>other</subwindow>
					<scroller>other_scroller</scroller>
				</tab>
				<activate>2</activate>
			</tabcontrol>
		</sheetdata>
	</windowclass>

	<windowclass name="npcsmall">
		<sizelimits>
			<minimum>
				<height>10</height>
			</minimum>
		</sizelimits>
		<sheetdata>
			<windowreferencecontrol name="open">
				<bounds>0,0,20,20</bounds>
				<icon>
					<normal>button_openwindow</normal>
					<pressed>button_emptytarget</pressed>
				</icon>
				<class>npc</class>
				<description>
					<field>name</field>
				</description>
			</windowreferencecontrol>
			<linkstringfield name="name">
				<bounds>25,1,-1,20</bounds>
				<empty>&#171; Nouveau PNJ &#187;</empty>
				<selectioncolor>#90ffffff</selectioncolor>
				<font>sheettext</font>
				<linktarget>open</linktarget>
			</linkstringfield>
		</sheetdata>
	</windowclass>

	<windowclass name="npclist">
		<frame>scrollboxfortabs</frame>
		<softclose />
		<placement>
			<size>
				<width>275</width>
				<height>350</height>
			</size>
		</placement>
		<sizelimits>
			<dynamic />
			<minimum>
				<width>200</width>
				<height>290</height>
			</minimum>
		</sizelimits>
		<nodelete />
		<sheetdata>
			<genericcontrol>
				<bounds>16,21,30,157</bounds>
				<icon>title_npcs</icon>
			</genericcontrol>
			<windowlist name="list">
				<bounds>50,25,-30,-34</bounds>
				<datasource>.</datasource>
				<class>npcsmall</class>
				<sortfields>name</sortfields>
				<footer>footer_narrow</footer>
				<allowcreate />
				<allowdelete />
				
				
				<acceptdrop>
					
					
					<field>hd</field>
					<!-- <field>ac</field> -->
					
					<field>atk</field>
					
					<class>npc</class>
					<field>name</field>
					<field>text</field>					
					<field>sante</field>
								
					<field>corps</field>
					<field>dexterite</field>
					<field>constitution</field>
					<field>force</field>
					<field>intelligence</field>
					<field>volonte</field>
					
					<field>taille</field>
					<field>deplacement</field>
					<field>perception</field>
					<field>initiative</field>
					<field>defense</field>
					<field>etourdissement</field>
					
					<field>arme1</field>
					<field>arme2</field>
					<field>arme3</field>
					<field>arme4</field>
					
					<field>specialqualities</field>
					<field>reach</field>
					<field>space</field>					
					
					<field>type</field>
					<field>competences</field>
					<field>talents</field>
					<field>defauts</field>
					<field>ressources</field>
					
					
				</acceptdrop>
				<script>
					function onSortCompare(w1, w2)
						return w1.name.getValue() &gt; w2.name.getValue();
					end;
					
					function onFilter(w)
						local f = string.lower(window.filter.getValue());
						
						if f == "" then
							return true;
						end
						
						if string.find(string.lower(w.name.getValue()), f, 0, true) then
							return true;
						end
						
						return false;
					end
				</script>
			</windowlist>
			<scrollercontrol>
				<bounds>-105,-61,45,27</bounds>
				<target>list</target>
				<button>
					<normal>button_scroller</normal>
					<pressed>button_scroller_down</pressed>
				</button>
			</scrollercontrol>

			<buttoncontrol>
				<bounds>-55,-58,34,25</bounds>
				<icon>
					<normal>button_newwindow</normal>
					<pressed>button_newwindowdown</pressed>
				</icon>
				<class>npc</class>
				<script>
					function onButtonPress()
						local node = window.getDatabaseNode();
						if node then
							node = node.createChild();
							if node then
								Interface.openWindow(class[1], node.getNodeName());
							end
						end
					end
				</script>
			</buttoncontrol>
			<categoryselectioncontrol>
				<bounds>24,-39,-24,-1</bounds>
				<targetcontrol>list</targetcontrol>
			</categoryselectioncontrol>

			<filter name="filter">
				<bounds>55,-70,-50,20</bounds>
				<target>list</target>
				<trigger>filtertrigger</trigger>
			</filter>
			<filtertrigger name="filtertrigger">
				<bounds>20,-85,21,41</bounds>
				<target>filter</target>
			</filtertrigger>			
		</sheetdata>
	</windowclass>
</root>
