parameters: ()
return_statement: return
docstring: Shows the viewable 24 spells.
docstring_summary: Shows the viewable 24 spells.
docstring_tokens: Shows the viewable 24 spells .
function: def ShowSpells ():
  	"""Shows the viewable 24 spells."""
  
  	j = RowIndex()
  
  	# we have a grid of 24 spells
  	extraButtons = ExtraSpellButtons ()
  	for i in range (ButtonCount + extraButtons):
  		# ensure we can learn this many spells
  		SpellButton = SpellsWindow.GetControl (i+SpellStart)
  		if i + j >= len (Spells[SpellLevel]):
  			SpellButton.SetState (IE_GUI_BUTTON_DISABLED)
  			SpellButton.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET)
  			continue
  		else:
  			SpellButton.SetState (IE_GUI_BUTTON_ENABLED)
  			SpellButton.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND)
  
  		# fill in the button with the spell data
  		Spell = GemRB.GetSpell (Spells[SpellLevel][i+j][0], 1)
  		SpellButton.SetTooltip(Spell['SpellName'])
  		SpellButton.SetVarAssoc("ButtonPressed", i)
  		SpellButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, SpellsSelectPress)
  		if GameCheck.IsBG2():
  			SpellButton.SetSprites("GUIBTBUT",0, 0,1,2,3)
  		else:
  			SpellButton.SetSprites("GUIBTBUT",0, 0,1,24,25)
  
  		SpellButton.SetSpellIcon(Spells[SpellLevel][i+j][0], 1)
  		SpellButton.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
  
  		# don't allow the selection of an un-learnable spell
  		if Spells[SpellLevel][i+j][1] == 0:
  			SpellButton.SetState(IE_GUI_BUTTON_LOCKED)
  			# shade red
  			color = {'r' : 200, 'g' : 0, 'b' : 0, 'a' : 100}
  			SpellButton.SetBorder (0, color, 1, 1)
  		elif Spells[SpellLevel][i+j][1] == 1: # learnable
  			SpellButton.SetState (IE_GUI_BUTTON_ENABLED)
  			# unset any borders on this button or an un-learnable from last level
  			# will still shade red even though it is clickable
  			SpellButton.SetBorder (0, None, 0,0)
  		else: # specialist (for iwd2 which has no green frames)
  			# use the green border state for matching specialist spells
  			color = {'r' : 0, 'g' : 200, 'b' : 0, 'a' : 100}
  			SpellButton.SetBorder (0, color, 1,0)
  			SpellButton.SetState (IE_GUI_BUTTON_FAKEDISABLED)
  
  	# show which spells are selected
  	ShowSelectedSpells ()
  
  	GemRB.SetToken("number", str(SpellsSelectPointsLeft[SpellLevel]))
  	SpellsTextArea.SetText(17250)
  	LevelLabel = SpellsWindow.GetControl (0x10000000)
  	if LevelLabel:
  		GemRB.SetToken ("SPELLLEVEL", str(SpellLevel+1))
  		LevelLabel.SetText (10345)
  
  	return
function_tokens: def ShowSpells ( ) : j = RowIndex ( ) # we have a grid of 24 spells extraButtons = ExtraSpellButtons ( ) for i in range ( ButtonCount + extraButtons ) : # ensure we can learn this many spells SpellButton = SpellsWindow . GetControl ( i + SpellStart ) if i + j >= len ( Spells [ SpellLevel ] ) : SpellButton . SetState ( IE_GUI_BUTTON_DISABLED ) SpellButton . SetFlags ( IE_GUI_BUTTON_NO_IMAGE , OP_SET ) continue else : SpellButton . SetState ( IE_GUI_BUTTON_ENABLED ) SpellButton . SetFlags ( IE_GUI_BUTTON_NO_IMAGE , OP_NAND ) # fill in the button with the spell data Spell = GemRB . GetSpell ( Spells [ SpellLevel ] [ i + j ] [ 0 ] , 1 ) SpellButton . SetTooltip ( Spell [ 'SpellName' ] ) SpellButton . SetVarAssoc ( "ButtonPressed" , i ) SpellButton . SetEvent ( IE_GUI_BUTTON_ON_PRESS , SpellsSelectPress ) if GameCheck . IsBG2 ( ) : SpellButton . SetSprites ( "GUIBTBUT" , 0 , 0 , 1 , 2 , 3 ) else : SpellButton . SetSprites ( "GUIBTBUT" , 0 , 0 , 1 , 24 , 25 ) SpellButton . SetSpellIcon ( Spells [ SpellLevel ] [ i + j ] [ 0 ] , 1 ) SpellButton . SetFlags ( IE_GUI_BUTTON_PICTURE , OP_OR ) # don't allow the selection of an un-learnable spell if Spells [ SpellLevel ] [ i + j ] [ 1 ] == 0 : SpellButton . SetState ( IE_GUI_BUTTON_LOCKED ) # shade red color = { 'r' : 200 , 'g' : 0 , 'b' : 0 , 'a' : 100 } SpellButton . SetBorder ( 0 , color , 1 , 1 ) elif Spells [ SpellLevel ] [ i + j ] [ 1 ] == 1 : # learnable SpellButton . SetState ( IE_GUI_BUTTON_ENABLED ) # unset any borders on this button or an un-learnable from last level # will still shade red even though it is clickable SpellButton . SetBorder ( 0 , None , 0 , 0 ) else : # specialist (for iwd2 which has no green frames) # use the green border state for matching specialist spells color = { 'r' : 0 , 'g' : 200 , 'b' : 0 , 'a' : 100 } SpellButton . SetBorder ( 0 , color , 1 , 0 ) SpellButton . SetState ( IE_GUI_BUTTON_FAKEDISABLED ) # show which spells are selected ShowSelectedSpells ( ) GemRB . SetToken ( "number" , str ( SpellsSelectPointsLeft [ SpellLevel ] ) ) SpellsTextArea . SetText ( 17250 ) LevelLabel = SpellsWindow . GetControl ( 0x10000000 ) if LevelLabel : GemRB . SetToken ( "SPELLLEVEL" , str ( SpellLevel + 1 ) ) LevelLabel . SetText ( 10345 ) return