123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- #spellBook
- ! Make a table of Spells to Cast from a given list. the list is in the form of the lists as done in thespellList file.
- !
- ! $ARGS[0] = Type of List: cast, learn
- ! $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)
- !
- $spellBookVar['Type'] = $ARGS[0]
- $spellBookVar['Array'] = $ARGS[1]
- $spellBookVar['ActionCode'] = $ARGS[2]
- $spellBookVar['CodeAfterSpell'] = $ARGS[3]
- ! Make sure opptional variables have defaults
- if $spellBookVar['ActionCode'] = '':
- $spellBookVar['ActionCode'] = "gt '<<$loc>>', '<<$metka>>'"
- end
- if $spellBookVar['CodeAfterSpell'] = '':
- $spellBookVar['CodeAfterSpell'] = "gt '<<$loc>>', '<<$metka>>'"
- end
- ! lets the user back out if they don''t want ot cast.
- act 'Never mind':dynamic spellBookVar['ActionCode']
- ! This just makes sure the current spellLists are loaded
- if spellMana['fog'] = 0:
- gs 'spellList'
- end
- ! Build the table - Choose Header for Type
- if $spellBookVar['Type'] = 'learn':
- $spellBookVar['TableText'] = "
- <center>
- <table CELLPADDING = '5'>
- <tr>
- <th align='left'>Spell</th>
- <th align='left'>Percent Learned</th>
- </tr>"
- $spellBookVar['RowCode'] = {
- if spellLearn[$ThisSpellName] > 0 and spellKnown[$ThisSpellName] ! 1:
- $result = "
- <tr>
- <td align='left'><<$spellName[$ThisSpellName]>></td>
- <td align='right'><<spellLearn[$ThisSpellName]>></td>
- </tr>"
- spellBookVar['Counter'] += 1
- else
- $result = ''
- end
- }
- else
- ! Default is list of castable spells.
- $spellBookVar['TableText'] = "
- <center>
- <table CELLPADDING = '5'>
- <tr>
- <th align='left'>Spell</th>
- <th align='left'>Mana</th>
- <th align='left'>Description</th>
- </tr>"
- $spellBookVar['RowCode'] = {
- if spellKnown[$ThisSpellName] = 1:
- if $spellOptDesc[$ThisSpellName] = '':
- $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>
- </tr>"
- else
- $tmpHTMLCode = "
- <tr>
- <td align='left'><<$spellName[$ThisSpellName]>></td>
- <td align='right'><<spellMana[$ThisSpellName]>></td>
- <td align='left'><<$spellDesc[$ThisSpellName]>></td>
- </tr>"
- n=0
- :RowCodeLoop99
- if n < arrsize('<<$spellOptDesc[$ThisSpellName]>>'):
- $spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[<<n>>]')
- $spellBookVar['tmpName']= dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[<<n>>]')
- $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>
- </tr>"
- n += 1
- jump 'RowCodeLoop99'
- end
- end
- $result = $tmpHTMLCode
- spellBookVar['Counter'] += 1
- killvar '$tmpHTMLCode'
- killvar 'n'
- else
- $result = ''
- end
- }
- end
- i = 0
- spellBookVar['ArraySize'] = dyneval("result = arrsize('<<$spellBookVar['Array']>>')")
- spellBookVar['Counter'] = 0
- :SpellListLoop
- $ThisSpellName = dyneval("$result = <<$spellBookVar['Array']>>[<<i>>]")
- if i < spellBookVar['ArraySize']:
- !$spellBookVar['RowCode']
- $spellBookVar['TableText'] += dyneval($spellBookVar['RowCode'])
- i += 1
- jump 'SpellListLoop'
- end
- $spellBookVar['TableText'] += "
- </table>
- </center>"
- if spellBookVar['Counter'] = 0:
- $spellBookVar['TableText'] = "<center>You have no spells in this list.</center>"
- end
- $result = func('cleanHTML',$spellBookVar['TableText'])
- killvar 'i'
- killvar '$ThisSpellName'
- killvar '$spellBookVar'
- killvar 'spellBookVar'
- --- spellBook ---------------------------------
|