menu
{
	name	'CHARACTER'
	modal lua "not CurrentlyInGame()"
	align center center
	ignoreEsc
	onopen
	"
		currentTab = 1
		currentTabIndex = 1
		currentItem = 0
		showStats = 0
		showJustText = 0
		showClassInfo = 0
		showAbilityBonuses = 0
		showMemorized = 0
		showBothLists = 0
		characterViewable = true
		
		if(CurrentlyInGame()) then
			pushSidebars()
		end
		updateAttrTable()
		
		if(currentPanelID == const.EXPORT_ID) then
			Infinity_PushMenu('CHARACTER_EXPORT')
		else 
			if(currentPanelID == const.CUSTOMIZE_ID) then 
				Infinity_PushMenu('CHARACTER_CUSTOMIZE')
			else
				currentPanelID = 0
			end
		end
	"
	onclose
	"
		popSidebars()
	"

	label
	{
		area	0 0 864 709
		mosaic	"GUIREC2"
	}
	
	
	label
	{
		name		"LABEL_2_268435495"
		area		200 10 454 38
		text		lua "characters[currentID].name"
		text style  	'title'
		text align	center center
		enabled "characterViewable"
	}

	label
	{
		area		622 450 166 18
		progressbar lua "getPercent(characters[currentID].level.xp, characters[currentID].level.nextLvlXp)" --progress percentage, number 0-100
		greyscale	0 --display greyscale or not, number 0-1
		progressbar color	128 0 0 255	 --color when percentage != 100
		progressbar full	128 0 0 255	 --color when percentage == 100
		enabled "characterViewable"
	}
	label
	{
		area		622 450 166 18
		text		lua "getNextLevelString()"
		text style  'normal'
		text align	center center
		text shadow 1
		enabled "characterViewable"
	}



	button
	{
		area 78 56 140 42
		bam	'GUIOSTSM'
		text 'INFORMATION_BUTTON'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 1; updateAttrTable()"
	}
	button
	{
		area 218 56 140 42
		bam	'GUIOSTSM'
		text 'CLASS_LABEL'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 2; updateAttrTable()"
	}
	button
	{
		area 358 56 140 42
		bam	'GUIOSTSM'
		text 'COMBAT_STATS_LABEL'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 9; updateAttrTable()"
	}
	button
	{
		area 498 56 140 42
		bam	'GUIOSTSM'
		text 'SKILLS_LABEL'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 3; updateAttrTable()"
	}

	button
	{
		area 638 56 140 42
		bam	'GUIOSTSM'
		text 'ABILITIES_BUTTON'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 8; updateAttrTable()"
	}

	button
	{
		area 66 130 140 42
		bam	'GUIOSTSM'
		text 'STATS_LABEL'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 6; updateAttrTable()"
	}

	button
	{
		area 238 130 140 42
		bam	'GUIOSTSM'
		text 'BIOGRAPHY_LABEL'
		text style "button"
		pad 10 4 10 4
		action "currentTab = 7; updateAttrTable()"
	}

	list
	{
		column 
		{ 
			width 65
			label
			{
				area		0 0 -1 36 
				text		lua "Infinity_FetchString( attributeItems[rowNumber][1].strRef)"
				text style  'normal'
				text align	left center
			}
		}
		column 
		{ 
			width 35
			label
			{
				area		0 0 -1 36 
				text		lua  "displayAttr(rowNumber)" --"listItems[rowNumber][1].current"
				text style  'label'
				text align right center
				text shadow lua "isStatModified(rowNumber)"
				
			}
		}

		area 426 144 152 216
		
		rowheight	36
		table		"attributeItems"
		var			currentItem
		hidehighlight
		enabled "characterViewable"
		action
		"
			helpTextString = Infinity_FetchString( attributeItems[currentItem][2])
		"		
	}

	list
	{
		column 
		{ 
			width 13
			label
			{
				area		0 0 22 -1
				bam			lua "statusEffects[rowNumber].bam"
				sequence	lua "statusEffects[rowNumber].current"
				text align	center center				
			}
		}
		column 
		{ 
			width 87
			label
			{
				area		0 0 -1 -1
				text		lua "Infinity_FetchString(statusEffects[rowNumber].strRef)"
				text style  'normal'
				text align	left center
			}
		}

		area 420 486 164 94
		rowheight	dynamic
		table		"statusEffects"
		var		notrealValue
		scrollbar	'GUISCRC'
		enabled "characterViewable"
		hidehighlight	
	}

	button
	{
		name		"BUTTON_2_2"
		area		618 147 180 279
		--text		lua "characters[currentID].portrait"
		text align	center center
		text point	10
		text color	B
		bitmap		lua "characters[currentID].portrait"
		action
		"
			Infinity_Log(dump(characters, 0))
		"
	}
	label
	{
		area 610 492 194 92
		text lua "characterDescString(characters[currentID])"
		text style 'normal'
		text align center center
		enabled "characterViewable"
		
	}
	
	-- class section
		
	text
	{
		enabled		"showClassInfo"
		area		50 182 342 412
		text		lua "getClassString()"
		text style  'normal'
		scrollbar	'GUISCRC'
	}

	-- ability bonus stuff
	
	list
	{		
		column 
		{ 
			width 100
			label
			{
				area		0 0 -1 -1
				text		lua "listItems[rowNumber][2]" 
				text style  'normal'
				text align	left center

			}
		}

		area 50 182 342 418
		
		enabled		"showAbilityBonuses"
		rowheight	45
		table		"listItems"
		var			currentItem
		scrollbar	'GUISCRC'		
		hidehighlight
		action
		"
			--helpTextString = Infinity_FetchString( listItems[currentItem][1].helpStrRef)
		"		
	}

	-- Stats screen stuff
	list
	{		
		column 
		{ 
			width 65
			label
			{
				area		0 0 -1 -1
				text		lua "Infinity_FetchString(otherlist[rowNumber][1])" 
				text style  'normal'
				text align	left center

			}
		}
		column 
		{ 
			width 35
			label
			{
				area		0 0 -1 -1
				text		lua " otherlist[rowNumber][2]"				
				text style  'normal'
				text align	center center
			}
		}

		area 50 182 346 186
		
		enabled		"showStats"
		rowheight	45
		table		"otherlist"
		var			currentItem
		scrollbar	'GUISCRC'		
		hidehighlight
		action
		"
			--helpTextString = Infinity_FetchString( listItems[currentItem][1].helpStrRef)
		"		
	}

	label
	{
		enabled		"showStats"
		area		338 368 54 38
		text		"GAME_LABEL"
		text style  'label'
		text align	center center
	}
	label
	{
		enabled		"showStats"
		area		262 368 76 38
		text		"CHAPTER_LABEL"
		text style  'label'
		text align	center center
	}

	list
	{		
		column 
		{ 
			width 65
			label
			{
				area		0 0 -1 -1
				text		lua "Infinity_FetchString(listItems[rowNumber][1])"  --lua " '^M' .. Infinity_FetchString(listItems[rowNumber][1]) .. '^-' .. '\n'  .. trunc(Infinity_FetchString( listItems[rowNumber][3]), 140)"
				text style  'normal'
				text align	left center

			}
		}
		column 
		{ 
			width 20
			label
			{
				area		0 0 -1 -1
				text		lua " listItems[rowNumber][2]"				
				text style  'normal'
				text align	center center
				
			}
		}
		column 
		{ 
			width 15
			label
			{
				area		0 0 -1 -1
				text		lua " listItems[rowNumber][3]"				
				text style  'normal'
				text align	center center
				
			}
		}

		area 54 406 350 188
		
		enabled		"showStats"
		rowheight	45
		table		"listItems"
		var			currentItem
		scrollbar	'GUISCRC'		
		hidehighlight
		action
		"
			--helpTextString = Infinity_FetchString( listItems[currentItem][1].helpStrRef)
		"		
	}


	-- Biography section 	

	text
	{
		enabled		"showJustText"
		area		54 186 342 408
		text		lua "helpTextString"
		text style  'normal'
		text align	left top
		scrollbar	'GUISCRC'
	}

	button
	{
		enabled 	"CurrentlyInGame()"
		name		"BUTTON_2_50"
		area		73 634 239 53
		text		"CUSTOMIZE_BUTTON"
		text style "button"
		bam		GUIOSTLL
		sequence	0
		clickable lua "characterScreen:IsMultiPlayerModifyable()"
		action 
		"
			characterScreen:OnCustomizeButtonClick();
		"
	}
	button
	{
		enabled 	"CurrentlyInGame()"
		name		"BUTTON_2_36"
		area		558 634 239 53
		text		"EXPORT_BUTTON"
		text style "button"
		bam		GUIOSTLR
		sequence	0
		clickable lua "characterScreen:IsExportButtonClickable()"
		action 
		"
			characterScreen:OnExportButtonClick();
		"
	}
	
	button
	{
		enabled 	"CurrentlyInGame()"
		clickable	lua "characterScreen:IsReformPartyButtonClickable()"
		name		"BUTTON_2_51"
		area		335 637 204 44
		text		"REFORM_PARTY_BUTTON"
		text style "button"
		bam		GUIOSTLM
		sequence	3
		action		"characterScreen:OnReformPartyButtonClick();"
	}
	button
	{
		enabled 	"CurrentlyInGame()"
		name		"BUTTON_2_0"
		area		430 374 140 42
		text		"DUAL_CLASS_BUTTON"
		text style "button"
		pad 10 4 10 4
		bam	'GUIOSTSM'
		sequence	2
		clickable	lua "characterScreen:IsDualClassButtonClickable()"
		action 		
		"
			popup2Button('DUALCLASS_CONFIRMATION', 'YES_BUTTON', function() characterScreen:OnDualClassButtonClick() end, 'NO_BUTTON')
		"
	}
	button
	{
		enabled 	"CurrentlyInGame()"
		name		"BUTTON_2_37"
		area		430 422 140 42
		text		"LEVEL_UP_BUTTON"
		text style "button"
		pad 10 4 10 4
		bam		'GUIOSTSM'
		sequence	3
		clickable	lua "characterScreen:IsLevelUpButtonClickable()"
		action		" characterScreen:OnLevelUpButtonClick();"
	}
	
	button
	{
		enabled 	"CurrentlyInGame()"
		on escape
		area		811 0 53 44
		action
		"
			e:SelectEngine(worldScreen)
		"
	}

	button
	{
		enabled 	"not CurrentlyInGame()"
		area		335 637 204 44
		text		"DONE_BUTTON"
		text style 	"button"
		bam		GUIOSTLM
		sequence	3
		action		"Infinity_PopMenu()"
	}
}
menu
{
	name 'CHARACTER_CUSTOMIZE'
	align center center
	modal
	ignoreesc
	onOpen
	"
		currentPanelID = const.CUSTOMIZE_ID
	"
	label 
	{
		area 0 0 864 710
		mosaic	GUICUSTB
	}

	text
	{
		area 426 120 398 490
		text 11327 --Customize help text
		scrollbar 'GUISCRC'
		text style	normal
	}
	label
	{
		area	74 12 716 44
		text	"CUSTOMIZE_TITLE"
		text style	title
	}
	button
	{
		bam 'GUICHLNG'
		sequence 0
		area 42 192 340 32		
		text style "button"
		text "APPEARANCE_BUTTON"		
		clickable lua
		"
			characterScreen:IsAppearanceButtonClickable();
		"		
		action 
		"
			characterScreen:OnAppearanceButtonClick()
		"
	}
	button
	{
		bam 'GUICHLNG'
		sequence 0
		area 42 228 340 32		
		text style "button"
		text "SOUNDS_BUTTON"		
		clickable lua
		"
			characterScreen:IsAppearanceButtonClickable();
		"	
		action 
		"
			characterScreen:OnSoundsButtonClick()
		"
	}
	button
	{
		bam 'GUICHLNG'
		sequence 0
		area 42 264 340 32		
		text style "button"
		text "COLORS_BUTTON"		
		clickable lua
		"
			characterScreen:IsAppearanceButtonClickable();
		"	
		action 
		"
			characterScreen:OnHairSkinButtonClick()
		"
	}
	button
	{
		bam 'GUICHLNG'
		sequence 0
		area 42 300 340 32		
		text style "button"
		text "SCRIPT_BUTTON"		
		action 
		"
			characterScreen:OnScriptButtonClick()
		"
	}
	button
	{
		bam 'GUICHLNG'
		sequence 0
		area 42 336 340 32		
		text style "button"
		text "BIOGRAPHY_BUTTON"		
		clickable lua
		"
			characterScreen:IsAppearanceButtonClickable();
		"
		action 
		"
			characterScreen:OnCusomizeBiographyButtonClick()
		"
	}
	button
	{
		on escape
		bam 'GUIOSTUL'
		sequence 0
		area 210 653 234 44
		text style "button"
		text	"CANCEL_BUTTON"
		action 
		"
			characterScreen:OnCancelButtonClick()
			currentPanelID = 0
			Infinity_PopMenu('CHARACTER_CUSTOMIZE')
		"
	}
	button
	{
		bam 'GUIOSTUR'
		sequence 0
		area  464 653 232 44
		text style "button"
		text "DONE_BUTTON"		
		action 
		"
			characterScreen:OnDoneButtonClick()
			currentPanelID = 0
			Infinity_PopMenu('CHARACTER_CUSTOMIZE')
		"
	}
}