:: spellBook
<<set $here = 'spellBook'>>
<<set $ARGS = $location_var[$here]>>
<!-- ! Make a table of Spells to Cast from a given list.  the list is in the form of the lists as done in the spellList file.-->
<!-- !-->
<!-- ! 	$ARGS[0] = Type of List: cast, learn, list-->
<!-- !				This determines the info to be displayed as wel las the HTML formatting-->
<!-- ! 	$ARGS[1] = the name of the array to use for the spell list.-->
<!-- !	$ARGS[2] = (optional) return Action Code - a dynamic piece of code to run instead of generic return.-->
<!-- !	$ARGS[3] = (optional) Additional code to put in spell link (all spells)-->
<!-- !-->
<<setinit $spellBookVar['Type'] = $location_var[$here][0]>>
<<setinit $spellBookVar['Array'] = $location_var[$here][1]>>
<<setinit $spellBookVar['ActionCode'] = $location_var[$here][2]>>
<<setinit $spellBookVar['CodeAfterSpell'] = $location_var[$here][3]>>
<!-- ! Make sure opptional variables have defaults-->
<<if $spellBookVar['ActionCode'] == ''>>
	<<setinit $spellBookVar['ActionCode'] = 'gt $loc, $loc_arg'>>
<</if>>
<<if $spellBookVar['CodeAfterSpell'] == ''>>
	<<setinit $spellBookVar['CodeAfterSpell'] = 'gt $loc, $loc_arg'>>
<</if>>
<!-- ! lets the user back out if they don't want ot cast.-->
<!-- FAILED TO CONVERT
	dynamic "act 'Never mind': <<$spellBookVar['ActionCode']>>"
-----
	ERROR: FAILED TO CONVERT LITERAL: """dynamic "act 'Never mind': $spellBookVar['ActionCode']""""

-->
<<warn "CONVERSION ERROR 6dc74526d1dd930ad9076be7654c0719">>
<!-- ! This just makes sure the current spellLists are loaded-->
<<gs 'spellList'>>
<!-- !------------------------------------------------------------------------------------------------->
<!-- ! Choose the type of spell list to determine what info will be displayed and the HTML formatting-->
<!-- !	1) 'TableText' = The header for the table.  The header row-->
<!-- !	2) 'RowCode' = The code used inside the loop to build the HTML text for that Row.-->
<!-- !! 'learn' type is for displaying which seplls the user is currently learning.-->
<<if $spellBookVar['Type'] == 'learn'>>
	<<setinit $spellBookVar['TableText'] = >>
	<center>
	<table CELLPADDING = '5'>
	<tr>
	<th align='left'>Spell</th>
	<th align='left'>Percent Learned</th>
	<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
	<!-- !! 'list' type is list of castable spells.  This makes a table of spells for the user to cast.-->
<<elseif $spellBookVar['Type'] == 'cast'>>
	<<setinit $spellBookVar['TableText'] = >>
	<center>
	<table CELLPADDING = '5'>
	<tr>
	<th align='left'>Spell</th>
	<th align='left'>Mana</th>
	<th align='left'>Description</th>
	<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
	<!-- !! 'list' type is list of castable targetable spells.  This makes a table of spells for the user to cast in combat.-->
<<elseif $spellBookVar['Type'] == 'targetable'>>
	<<setinit $spellBookVar['TableText'] = >>
	<center>
	<table CELLPADDING = '5'>
	<tr>
	<th align='left'>Spell</th>
	<th align='left'>Mana</th>
	<th align='left'>Targets</th>
	<th align='left'>Description</th>
	<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
	<!-- !! Default is a list of spells with descriptio nand mana cost listed.-->
<<else>>
	<<setinit $spellBookVar['TableText'] = >>
	<center>
	<table CELLPADDING = '5'>
	<tr>
	<th align='left'>Spell</th>
	<th align='left'>Mana</th>
	<th align='left'>Description</th>
	<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
<</if>>
<<set $i = 0>>
<<setinit $spellBookVar['ArraySize'] = dyneval("result = arrsize('<<$spellBookVar['Array']>>')")>>
<<setinit $spellBookVar['Counter'] = 0>>
<<warn 'JUMP MARKER ENCOUNTERED: :SpellListLoop'>>
<!-- FAILED TO CONVERT
	$ThisSpellName = dyneval("$result = <<$spellBookVar['Array']>>[<<i>>]")
-----
	<<set $ThisSpellName = dyneval("$result = <<$spellBookVar['Array']>>[ERROR: FAILED TO CONVERT LITERAL: """<<i>>"""]")>>

-->
<<warn "CONVERSION ERROR 307e63ec2754347f48414edc40fd79d2">>
<<if $i < $spellBookVar['ArraySize']>>
	<!-- !$spellBookVar['RowCode']-->
	<<setinit $spellBookVar['TableText'] += dyneval($spellBookVar['RowCode'])>>
	<<set $i += 1>>
	<<warn 'JUMP COMMAND ENCOUNTERED: jump SpellListLoop'>>
<</if>>
<<setinit $spellBookVar['TableText'] += >>
</table>
<!-- FAILED TO CONVERT
	</center>"
-----
	ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """center>""""

-->
<<warn "CONVERSION ERROR bce9715f7ff5b21a3adb01f2db5baede">>
<<if getvar("$spellBookVar['Counter']") == 0>>
	<<setinit $spellBookVar['TableText'] = "<center>You have no spells in this list.</center>">>
<</if>>
<!-- !*pl $spellBookVar['TableText']-->
<<set $result = setup.func('cleanHTML',$spellBookVar['TableText'])>>
<<set $i to null>>
<<set $ThisSpellName to null>>
<<set $spellBookVar to null>>
<<set $spellBookVar to null>>
:: spellBookVarRowCode_macro_1[widget]
<<widget 'spellBookVarRowCode'>>
	<<if getvar("$spellLearn["+$ThisSpellName+"]") > 0 and getvar("$spellKnown["+$ThisSpellName+"]") != 1>>
		<<set $result = >>
		<tr>
		<td align='left'><<$spellName[$ThisSpellName]>></td>
		<td align='right'><<spellLearn[$ThisSpellName]>></td>
		<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
		<<setinit $spellBookVar['Counter'] += 1>>
	<<else>>
		<<set $result = ''>>
	<</if>>
<</widget>>
:: spellBookVarRowCode_macro_2[widget]
<<widget 'spellBookVarRowCode'>>
	<<if getvar("$spellKnown["+$ThisSpellName+"]") == 1>>
		<<if $spellOptDesc[$ThisSpellName] == ''>>
			<!-- ! If the spell has no Options, we jsut list it out for casting-->
			<<set $tmpHTMLCode = >>
			<tr>
			<td align='left'><a href=""EXEC: gs 'castSpell', '<<$ThisSpellName>>'& <<$spellBookVar['CodeAfterSpell']>>""><<$spellName[$ThisSpellName]>></a></td>
			<td align='right'><<spellMana[$ThisSpellName]>></td>
			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
			<!-- FAILED TO CONVERT
			</tr>"
		-----
			ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

		-->
		<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
		<<else>>
			<!-- ! If the spell does have options, we make a row for spell info, and loop through additional rows-->
			<!-- !	with options for the user to pick-->
			<<set $tmpHTMLCode = >>
			<tr>
			<td align='left'><<$spellName[$ThisSpellName]>></td>
			<td align='right'><<spellMana[$ThisSpellName]>></td>
			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
			<!-- FAILED TO CONVERT
			</tr>"
		-----
			ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

		-->
		<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
			<<set $n = 0>>
			<<warn 'JUMP MARKER ENCOUNTERED: :RowCodeLoop98'>>
			<<if $n < arrsize('>>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR a4e97aa2f64c6260838d6180800a82fd">>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpName']= dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpName'] = dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR f949dd8781060f8a98a9cde4b1be64a3">>
				<<set $tmpHTMLCode += >>
				<tr>
				<td align='left'></td>
				<td align='left'><a href=""EXEC: gs 'castSpell', '<<$ThisSpellName>>', '<<$spellBookVar['tmpVal']>>' & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>></a></td>
				<td align='left'></td>
				<!-- FAILED TO CONVERT
				</tr>"
			-----
				ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

			-->
			<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
				<<set $n += 1>>
				<<warn 'JUMP COMMAND ENCOUNTERED: jump RowCodeLoop98'>>
			<</if>>
		<</if>>
		<<set $result = $tmpHTMLCode>>
		<<setinit $spellBookVar['Counter'] += 1>>
		<<set $tmpHTMLCode to null>>
		<<set $n to null>>
	<<else>>
		<<set $result = ''>>
	<</if>>
<</widget>>
:: spellBookVarRowCode_macro_3[widget]
<<widget 'spellBookVarRowCode'>>
	<<if getvar("$spellKnown["+$ThisSpellName+"]") == 1>>
		<<set $tmpHTMLCode = >>
		<tr>
		<td align='left'><<$spellName[$ThisSpellName]>></td>
		<td align='right'><<spellMana[$ThisSpellName]>></td>
		<!-- FAILED TO CONVERT
		<td align='center'>"
	-----
		<<set ERROR: FAILED TO CONVERT LITERAL: """<td align""" = ERROR: FAILED TO CONVERT LITERAL: """'center'>"""">>

	-->
	<<warn "CONVERSION ERROR c59242bfec7f84401278626c9265ae8d">>
		<<if $spellTarget[$ThisSpellName] == 'self'>>
			<<set $tmpHTMLCode += >>
			<!-- FAILED TO CONVERT
			<a href=""EXEC: *clr & gs 'castSpell', '<<$ThisSpellName>>', 'pcs', 0, 0 & <<$spellBookVar['CodeAfterSpell']>>"">You</a>"
		-----
			<<set ERROR: FAILED TO CONVERT LITERAL: """<a href""" = ERROR: FAILED TO CONVERT LITERAL: """""EXEC:""" * $clr>> <<gs 'castSpell' '$ThisSpellName' 'pcs' 0 0>>

		-->
		<<warn "CONVERSION ERROR c0035f9c901655068767ec66a208dd1c">>
		<<elseif $spellTarget[$ThisSpellName] == 'team'>>
			<<set $n = 0>>
			<<warn 'JUMP MARKER ENCOUNTERED: :RowCodeLoop96'>>
			<<if $n < arrsize('pcs_health')>>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpName']= dyneval('$result = $pcs_name[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpName'] = dyneval('$result = $pcs_name[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR 0734daff330af99ad44e0064d1adf85e">>
				<<set $tmpHTMLCode += >>
				<a href=""EXEC: *clr & gs 'castSpell', '<<$ThisSpellName>>', 'pcs', <<n>>, 0 & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>></a>
				<!-- FAILED TO CONVERT
				<br>"
			-----
				ERROR: FAILED TO CONVERT LITERAL: """<br>""""

			-->
			<<warn "CONVERSION ERROR f02f2e98643e88776c75462086a5bf9b">>
				<<set $n += 1>>
				<<warn 'JUMP COMMAND ENCOUNTERED: jump RowCodeLoop96'>>
			<</if>>
		<<else>>
			<<set $n = 0>>
			<<warn 'JUMP MARKER ENCOUNTERED: :RowCodeLoop97'>>
			<<if $n < arrsize('opp_health')>>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpName']= dyneval('$result = $opp_name[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpName'] = dyneval('$result = $opp_name[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR 0701b1d11e830c79cd31abaf5957e712">>
				<<set $tmpHTMLCode += >>
				<a href=""EXEC: *clr & gs 'castSpell', '<<$ThisSpellName>>', 'opp', <<n>>, 0 & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>></a>
				<!-- FAILED TO CONVERT
				<br>"
			-----
				ERROR: FAILED TO CONVERT LITERAL: """<br>""""

			-->
			<<warn "CONVERSION ERROR f02f2e98643e88776c75462086a5bf9b">>
				<<set $n += 1>>
				<<warn 'JUMP COMMAND ENCOUNTERED: jump RowCodeLoop97'>>
			<</if>>
		<</if>>
		<!-- FAILED TO CONVERT
		$tmpHTMLCode += " </td>
	-----
		<<set $tmpHTMLCode += ERROR: FAILED TO CONVERT LITERAL: """" <""" / ERROR: FAILED TO CONVERT LITERAL: """td>""">>

	-->
	<<warn "CONVERSION ERROR 618651de3ebb1c682170e357a85733af">>
		<td align='left'><<$spellDesc[$ThisSpellName]>></td>
		<!-- FAILED TO CONVERT
		</tr>"
	-----
		ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

	-->
	<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
		<<set $result = $tmpHTMLCode>>
		<<setinit $spellBookVar['Counter'] += 1>>
		<<set $tmpHTMLCode to null>>
		<<set $n to null>>
	<<else>>
		<<set $result = ''>>
	<</if>>
<</widget>>
:: spellBookVarRowCode_macro[widget]
<<widget 'spellBookVarRowCode'>>
	<<if getvar("$spellKnown["+$ThisSpellName+"]") == 1>>
		<<if $spellOptDesc[$ThisSpellName] == ''>>
			<!-- ! If the spell has no Options, we jsut list it out for casting-->
			<<set $tmpHTMLCode = >>
			<tr>
			<td align='left'><<$spellName[$ThisSpellName]>></td>
			<td align='right'><<spellMana[$ThisSpellName]>></td>
			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
			<!-- FAILED TO CONVERT
			</tr>"
		-----
			ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

		-->
		<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
		<<else>>
			<!-- ! If the spell does have options, we make a row for spell info, and loop through additional rows-->
			<!-- !	with options for the user to pick-->
			<<set $tmpHTMLCode = >>
			<tr>
			<td align='left'><<$spellName[$ThisSpellName]>></td>
			<td align='right'><<spellMana[$ThisSpellName]>></td>
			<td align='left'><<$spellDesc[$ThisSpellName]>></td>
			<!-- FAILED TO CONVERT
			</tr>"
		-----
			ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

		-->
		<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
			<<set $n = 0>>
			<<warn 'JUMP MARKER ENCOUNTERED: :RowCodeLoop99'>>
			<<if $n < arrsize('>>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR a4e97aa2f64c6260838d6180800a82fd">>
				<!-- FAILED TO CONVERT
				$spellBookVar['tmpName']= dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[<<n>>]')
			-----
				<<setinit $spellBookVar['tmpName'] = dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[ERROR: FAILED TO CONVERT LITERAL: """<<n>>"""]')>>

			-->
			<<warn "CONVERSION ERROR f949dd8781060f8a98a9cde4b1be64a3">>
				<<set $tmpHTMLCode += >>
				<tr>
				<td align='left'></td>
				<td align='left'><<$spellBookVar['tmpName']>></td>
				<td align='left'></td>
				<!-- FAILED TO CONVERT
				</tr>"
			-----
				ERROR: FAILED TO CONVERT LITERAL: """<""" / ERROR: FAILED TO CONVERT LITERAL: """tr>""""

			-->
			<<warn "CONVERSION ERROR b878fa3a2eadb607c41494ad0c6a2930">>
				<<set $n += 1>>
				<<warn 'JUMP COMMAND ENCOUNTERED: jump RowCodeLoop99'>>
			<</if>>
		<</if>>
		<<set $result = $tmpHTMLCode>>
		<<setinit $spellBookVar['Counter'] += 1>>
		<<set $tmpHTMLCode to null>>
		<<set $n to null>>
	<<else>>
		<<set $result = ''>>
	<</if>>
<</widget>>
