[Znote AAC] Advanced Spells v2

cbrm

Just another mod
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,550
Best answers
1
Likes
802
Location
Caribbean Sea
#1
This script loads spells.xml when requested by the user at admin panel, and creates a PHP file saving all spells in arrays.
It has sort options exactly like Tibia's page. It works with both 0.2 and 0.3 distributions.

v2 - Bugfix for spells.php
.- Compatibilty for semicolon-divided vocation ids
.- Spells without specified vocations in XML will show all vocations
.-New option to sort spells by spell's words

v1 - Added promoted vocations to search query .-Removed unnecessary stuff from main function

v0 - Initial release
Preview:







Setup:
engine/function/general.php

Before
PHP:
?>
Add
PHP:
function build_spells($xml, $display_groups) {
    $t_count = 0;
    $rune = array();
    $string = '<?php'."\n".'#Generated spells file from admin panel'."\n".'#Edit at your own risk!';
    $string .= "\n".'$show_spells_groups = '.($display_groups ? 'true' : 'false').';'."\n".'$spells = array(';
    foreach($xml as $key => $value)
    {       
        if($value['lvl'])
        {
            if($key == 'rune')
            {
                if($display_groups)
                {
                    if($value['group'] == NULL)
                    {
                        echo '<span style="color:orange;font-weight:bold">WARNING: Group not found at spell "'.$value['name'].'", set to "Attack".</span><br>';
                    }
                    $rune[(string)$value['name']] = ($value['group'] == NULL) ? 'Attack' : $value['group'];
                }
                continue;
            }

            $t_count++;
            $string .= "\n\t".'array(';
           
            if($display_groups)
            {
                $string .= "\n\t\t".'"group" => ';
                {
                    if($value['function'] == 'conjureRune')
                    {
                        $string .= '\''.ucfirst($rune[(string)$value['name']]).'\'';
                    }
                    else
                    {
                        if($value['group'] == NULL)
                        {
                            echo '<span style="color:orange;font-weight:bold">WARNING: Group not found at spell "'.$value['name'].'", set to "Attack".</span><br>';
                        }
                        $string .= '\''.ucfirst(($value['group'] == NULL) ? 'Attack' : $value['group']).'\'';
                    }
                }
                $string .= ',';
            }

            $string .= "\n\t\t".'"type" => ';
            if(config('TFSVersion') == 'TFS_02')
            {
                $string .= (($value['function'] == 'conjureRune') ? '\'Rune\'' : '\'Instant\'');
            }
            if(config('TFSVersion') == 'TFS_03')
            {
                $string .= (($value['value'] == 'conjureRune') ? '\'Rune\'' : '\'Instant\'');
            }
            $string .= ',';
            $string .= "\n\t\t".'"name" => "'.$value['name'].'",';
            $string .= "\n\t\t".'"words" => \''.$value['words'].'\',';
            $string .= "\n\t\t".'"level" => '.$value['lvl'].',';
            $string .= "\n\t\t".'"mana" => ';
            $string .= (($value['mana'] == NULL) or ($value['mana'] == '')) ? '\'Var.\'' : $value['mana'];
            $string .= ',';
            $string .= "\n\t\t".'"premium" => ';
            if($value['prem'])
            {
                $string .= ($value['prem'] == 1) ? '\'yes\'' : '\'no\'';
            }
            else
            {
                $string .= '\'no\'';
            }
            $string .= ',';
            $vocs = array();
            $string .= "\n\t\t".'"vocation" => array(';
            foreach($value->vocation as $vocation)
            {
                if(config('TFSVersion') == 'TFS_02')
                {
                    $vocs[] = '\''.$vocation[0]['name'].'\'';
                }
                elseif(config('TFSVersion') == 'TFS_03')
                {
                    if(strpos($vocation[0]['id'], ';') !== FALSE)
                    {
                        $array = explode(';', $vocation[0]['id']);
                        foreach($array as $voc)
                        {
                            $vocs[] = '\''.vocation_id_to_name($voc).'\'';
                        }
                    }
                    else
                    {
                        $vocs[] = '\''.vocation_id_to_name((int)$vocation[0]['id']).'\'';
                    }
                }
            }
            if(count($vocs) < 1) foreach(config('vocations') as $id => $name) if($id > 0) $vocs[] = '\''.$name.'\'';
            $string .= implode(', ',$vocs).')'."\n\t".'),';
        }
    }   
    $string .= "\n".'); ?>';
    echo('Loaded '. $t_count .' spells!<br>');
    echo 'File "spell.php" '.(file_exists('spell.php') ? 'updated' : 'created').'!<br>';
    $file = fopen('spell.php', 'w');
    fwrite($file, $string);
    fclose($file);
}

admin.php

Before
PHP:
</ul>

<?php include 'layout/overall/footer.php'; ?>
Add
PHP:
    <li>
        <b>Update spells from file:</b><br>
        <?php
            if (!isset($_POST['action']))
            {           
                $_POST['action'] = 'undefine';
            }
           
            if ($_POST['action'] == 'upload')
            {
                $xml = $_FILES['file'];
                $_POST['action'] = 'undefine';
                if($xml['tmp_name'])
                {
                    if($xml['name'] == 'spells.xml')
                    {
                        $groups = (isset($_POST['show_groups']) && $_POST['show_groups'] == 'yes') ? true : false;
                        echo 'Successfully fetched spells.xml!<br>';
                        echo 'Using temporal file: '. $_FILES['file']['tmp_name'] .'<br>';
                        build_spells(simplexml_load_file($xml['tmp_name']), $groups);
                    }
                    else
                    {
                        echo '<span style="color:red;font-weight:bold">ERROR: File "spells.xml" not found.</span>';
                    }
                }
                else
                {
                    echo '<span style="color:red;font-weight:bold">ERROR: Upload failed.</span>';
                }
            }
        ?>
        <form enctype='multipart/form-data' method='POST'>
            <input type='checkbox' name='show_groups' value='yes'> Show spells groups (Only for TFS 0.2.9+)<br>
            <input type='hidden' name='action' value='upload' />
            <input type='file' name='file' />
            <input type='submit' value='Submit' />
        </form>
    </li>
Create spells.php
PHP:
 <?php
require_once 'engine/init.php'; include 'layout/overall/header.php'; echo '<h1>Spells</h1>';
if(file_exists('spell.php')) { require_once 'spell.php'; ?>
<table>
    <tr class="yellow">
        <td><b>Name</b></td>
        <?php if($show_spells_groups) echo '<td><b>Group</b></td>'; ?>
        <td><b>Type</b></td>
        <td><b>Exp Lvl</b></td>
        <td><b>Mana</b></td>
        <td><b>Premium</b></td>
        </span>
    </tr>

<?php
    @$sort = $_REQUEST['sort'];
    if(!isset($sort)) $sort = 'name';
   
    @$vocation = $_REQUEST['vocation'];
    if(!isset($vocation)) $vocation = 'vall';
   
    if($show_spells_groups)
    {
        @$group = $_REQUEST['_group'];
        if(!isset($group)) $group = 'gall';
    }
   
    @$type = $_REQUEST['_type'];
    if(!isset($type)) $type = 'tall';
   
    @$premium = $_REQUEST['_premium'];
    if(!isset($premium)) $premium = 'pall';
   
    $order = array();
    foreach($spells as $key => $row)
    {
        $order[$key] = $row[$sort];
    }
    array_multisort($order, SORT_ASC, $spells);
   
    foreach($spells as $spell) {
        if($vocation != 'vall')
        {
            if(!in_array($vocation, $spell['vocation'])) continue;
        }
        if($show_spells_groups && $group != 'gall')
        {
            if($spell['group'] != $group) continue;
        }
        if($type != 'tall')
        {
            if($spell['type'] != $type) continue;
        }
        if($premium != 'pall')
        {
            if($spell['premium'] != $premium) continue;
        }
    ?>
    <tr>
        <td><?php echo '<b>'.$spell['name'].'</b> ('.$spell['words'].')'; ?></td>
        <?php if($show_spells_groups) echo '<td>'.$spell['group'].'</td>'; ?>
        <td><?php echo $spell['type']; ?></td>
        <td><?php echo $spell['level']; ?></td>
        <td><?php echo $spell['mana']; ?></td>
        <td><?php echo $spell['premium']; ?></td>
    </tr>
<?php } echo '</table>'; ?>

<form action='spells.php' method='post'>
    <table>
        <tr class="yellow">
            <td colspan=4><b>Spell Search</b></td></tr>
            <tr class="yellow">
                <?php if($show_spells_groups) {
                echo'<td width=25%><b>vocation</b></td>
                    <td width=25%><b>group</b></td>
                    <td width=25%><b>type</b></td>
                    <td width=25%><b>premium</b></td>';}
                else {
                echo'<td width=40%><b>vocation</b></td>
                    <td width=30%><b>type</b></td>
                    <td width=30%><b>premium</b></td>';}?>
            </tr>
            <tr>
                <td valign='top'>
                    <input type='radio' name='vocation' value='vall' checked> all<br>
                    <?php
                    foreach(config('vocations') as $id => $vocation)
                    {
                        if($id > 0)
                        {
                            echo "<input type='radio' name='vocation' value='".$vocation."'> ".$vocation."<br>";
                        }
                    }
                    ?>
                </td>
                <?php
                if($show_spells_groups) echo"
                    <td valign='top'>
                        <input type='radio' name='_group' value='gall' checked> all<br>
                        <input type='radio' name='_group' value='Attack'> attack<br>
                        <input type='radio' name='_group' value='Healing'> healing<br>
                        <input type='radio' name='_group' value='Support'> support</td>"; ?>
                <td valign='top'>
                    <input type='radio' name='_type' value='tall' checked> all<br>
                    <input type='radio' name='_type' value='Instant'> instant<br>
                    <input type='radio' name='_type' value='Rune'> rune
                </td>
                <td valign='top'>
                    <input type='radio' name='_premium' value='pall' checked> all<br>
                    <input type='radio' name='_premium' value='no'> no<br>
                    <input type='radio' name='_premium' value='yes'> yes
                </td>
            </tr>
            <tr>
                <td>sort by:
                    <select name='sort'>
                        <option value='name' selected>name
                        <option value='words'>words
                        <?php if($show_spells_groups) echo "<option value='group' >group"; ?>
                        <option value='type' >type
                        <option value='level' >exp lvl
                        <option value='mana' >mana
                        <option value='premium' >premium
                    </select>
                </td>
                <td colspan='3'>
                    <input type='submit' name='submit'>
                </td>
            </tr>
    </table>
</form>
<?php } else { echo 'This page has not been configured yet.'; };
include 'layout/overall/footer.php'; ?>

Add page link to your layout

default layout: /layout/menu.php
Add page list:
PHP:
<li><a href="spells.php">Spells</a></li>
I cannot ensure if it will work with all TFS distros, but I'll try to do it if you request it here.
Remember you can edit your generated spell.php file, mostly needed if you use custom spells.
If you see any bug don't forget to report it here, and if you know how to improve the code I'd be grateful with it.
 
Joined
Jul 7, 2011
Messages
11
Best answers
0
Likes
1
#3
Server Error
The website encountered an error retrieving the http://localhost/friends.php http://localhost/friends.php. It may be down for maintenance or is configured incorrectly.
Here are some suggestions:
Reload this page later.
HTTP Error 500 (Internal Server Error): You have encountered an unexpected condition when the server was attempting to fulfill the request.
hey pal I have this problem, can you help me ? :(
 

cbrm

Just another mod
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,550
Best answers
1
Likes
802
Location
Caribbean Sea
#8
how should i configure spells site? im sorry, i am just learning :rolleyes:

- - - Updated - - -






i am talking about this
admin panel -> Update spells from file -> search your spells.xml -> submit

- - - Updated - - -

a) You first include then require config.php in two places.
b) Optional error message in case fopen() fails would be nice.
Yep :p I now use smth Znote left to load values from config.php
Dunno about fopen, if file doesn't exist it creates it anyways. I added some message about if spell.php is created or updated.

v1 - Added promoted vocations to search query .-Removed unnecessary stuff from main function
 
Last edited:

Amped RPG

New Member
Joined
Aug 24, 2012
Messages
163
Best answers
0
Likes
3
#9


o_O what happened?

Spells.xml
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<spells>
    <!-- Attack Runes -->
    <rune name="Poison Field" id="2285" allowfaruse="1" charges="3" lvl="14" maglv="0" exhaustion="2000" blocktype="solid" event="script" value="attack/poison field.lua"/>
    <rune name="Poison Bomb" id="2286" allowfaruse="1" charges="2" lvl="25" maglv="4" exhaustion="2000" blocktype="solid" event="script" value="attack/poison bomb.lua"/>
    <rune name="Poison Wall" id="2289" allowfaruse="1" charges="4" lvl="29" maglv="5" exhaustion="2000" blocktype="solid" event="script" value="attack/poison wall.lua"/>
    <rune name="Fire Field" id="2301" allowfaruse="1" charges="3" lvl="15" maglv="1" exhaustion="2000" blocktype="solid" event="script" value="attack/fire field.lua"/>
    <rune name="Firebomb" id="2305" allowfaruse="1" charges="2" lvl="27" maglv="5" exhaustion="2000" blocktype="solid" event="script" value="attack/fire bomb.lua"/>
    <rune name="Fire Wall" id="2303" allowfaruse="1" charges="4" lvl="33" maglv="6" exhaustion="2000" blocktype="solid" event="script" value="attack/fire wall.lua"/>
    <rune name="Soulfire" id="2308" allowfaruse="1" charges="3" lvl="27" maglv="7" exhaustion="2000" needtarget="1" blocktype="solid" event="function" value="soulfire"/>
    <rune name="Fireball" id="2302" allowfaruse="1" charges="5" lvl="27" maglv="4" exhaustion="2000" needtarget="1" blocktype="solid" event="script" value="attack/fireball.lua"/>
    <rune name="Great Fireball" id="2304" allowfaruse="1" charges="4" lvl="30" maglv="4" exhaustion="2000" blocktype="solid" event="script" value="attack/great fireball.lua"/>
    <rune name="Energy Field" id="2277" allowfaruse="1" charges="3" lvl="18" maglv="3" exhaustion="2000" blocktype="solid" event="script" value="attack/energy field.lua"/>
    <rune name="Energybomb" id="2262" allowfaruse="1" charges="2" lvl="37" maglv="10" exhaustion="2000" blocktype="solid" event="script" value="attack/energy bomb.lua"/>
    <rune name="Energy Wall" id="2279" allowfaruse="1" charges="4" lvl="41" maglv="9" exhaustion="2000" blocktype="solid" event="script" value="attack/energy wall.lua"/>
    <rune name="Light Magic Missile" id="2287" allowfaruse="1" charges="10" lvl="15" exhaustion="2000" maglv="0" needtarget="1" blocktype="solid" event="script" value="attack/light magic missile.lua"/>
    <rune name="Heavy Magic Missile" id="2311" allowfaruse="1" charges="10" lvl="25" exhaustion="2000" maglv="3" needtarget="1" blocktype="solid" event="script" value="attack/heavy magic missile.lua"/>
    <rune name="Explosion" id="2313" allowfaruse="1" charges="6" lvl="31" maglv="6" exhaustion="2000" blocktype="solid" event="script" value="attack/explosion.lua"/>
    <rune name="Sudden Death" id="2268" allowfaruse="1" charges="3" lvl="45" maglv="15" exhaustion="2000" needtarget="1" blocktype="solid" event="script" value="attack/sudden death.lua"/>
    <rune name="Icicle" id="2271" allowfaruse="1" charges="5" lvl="28" maglv="4" exhaustion="2000" needtarget="1" event="script" value="attack/icicle.lua"/>
    <rune name="Avalanche" id="2274" allowfaruse="1" charges="4" lvl="30" maglv="4" exhaustion="2000" event="script" value="attack/avalanche.lua"/>
    <rune name="Stone Shower" id="2288" allowfaruse="1" charges="4" lvl="28" maglv="4" exhaustion="2000" event="script" value="attack/stone shower.lua"/>
    <rune name="Thunderstorm" id="2315" allowfaruse="1" charges="4" lvl="28" maglv="4" exhaustion="2000" event="script" value="attack/thunderstorm.lua"/>
    <rune name="Stalagmite" id="2292" allowfaruse="1" charges="10" lvl="24" maglv="3" exhaustion="2000" needtarget="1" event="script" value="attack/stalagmite.lua"/>
    <rune name="Holy Missile" id="2295" allowfaruse="1" charges="5" lvl="27" maglv="4" exhaustion="2000" needtarget="1" blocktype="solid" event="script" value="attack/holy missile.lua">
        <vocation id="3"/>
        <vocation id="7" showInDescription="0"/>
    </rune>

    <!-- Healing Runes -->
    <rune name="Antidote Rune" id="2266" allowfaruse="1" charges="1" lvl="15" maglv="0" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/antidote rune.lua"/>
    <rune name="Intense Healing Rune" id="2265" allowfaruse="1" charges="1" lvl="15" maglv="1" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/intense healing rune.lua"/>
    <rune name="Ultimate Healing Rune" id="2273" allowfaruse="1" charges="1" lvl="24" maglv="4" exhaustion="1000" aggressive="0" needtarget="1" blocktype="solid" event="script" value="healing/ultimate healing rune.lua"/>

    <!-- Summon Runes -->
    <rune name="Animate Dead" id="2316" allowfaruse="1" charges="1" lvl="27" maglv="4" exhaustion="2000" blocktype="solid" event="script" value="summon/animate dead rune.lua"/>

    <!-- Support Runes -->
    <rune name="Chameleon" id="2291" allowfaruse="1" charges="1" lvl="27" maglv="4" exhaustion="1000" aggressive="0" selftarget="1" blocktype="solid" event="function" value="chameleon"/>
    <rune name="Desintegrate" id="2310" allowfaruse="0" charges="3" lvl="21" maglv="4" exhaustion="2000" range="1" event="script" value="support/desintegrate rune.lua"/>
    <rune name="Destroy Field" id="2261" allowfaruse="1" charges="3" lvl="17" maglv="3" exhaustion="1000" aggressive="0" range="5" event="script" value="support/destroy field rune.lua"/>
    <rune name="Magic Wall" id="2293" allowfaruse="1" charges="3" lvl="32" maglv="9" exhaustion="2000" blocktype="all" event="script" value="support/magic wall rune.lua"/>
    <rune name="Wild Growth" id="2269" allowfaruse="1" charges="2" lvl="27" maglv="8" exhaustion="2000" blocktype="all" event="script" value="support/wild growth rune.lua">
        <vocation id="2"/>
        <vocation id="6" showInDescription="0"/>
    </rune>
    <rune name="Paralyze" id="2278" allowfaruse="1" charges="1" lvl="54" maglv="18" exhaustion="2000" mana="1400" needtarget="1" blocktype="solid" event="script" value="support/paralyze rune.lua">
        <vocation id="2"/>
        <vocation id="6" showInDescription="0"/>
    </rune>

    <!-- Attack Spells -->
    <instant name="Death Strike" words="exori mort" lvl="16" mana="20" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/death strike.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Flame Strike" words="exori flam" lvl="12" mana="20" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/flame strike.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Energy Strike" words="exori vis" lvl="12" mana="20" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/energy strike.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Whirlwind Throw" words="exori hur" lvl="15" mana="40" prem="1" range="5" needtarget="1" blockwalls="1" needweapon="1" exhaustion="2000" needlearn="0" event="script" value="attack/whirlwind throw.lua">
        <vocation id="4;8"/>
    </instant>
    <instant name="Fire Wave" words="exevo flam hur" lvl="18" mana="25" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/fire wave.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Ethereal Spear" words="exori con" lvl="23" mana="25" prem="1" range="5" needtarget="1" exhaustion="2000" blockwalls="1" needlearn="0" event="script" value="attack/ethereal spear.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Energy Beam" words="exevo vis lux" lvl="23" mana="40" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/energy beam.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Great Energy Beam" words="exevo gran vis lux" lvl="29" mana="110" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/great energy beam.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Groundshaker" words="exori mas" lvl="33" mana="160" prem="1" needweapon="1" exhaustion="2000" needlearn="0" event="script" value="attack/groundshaker.lua">
        <vocation id="4;8"/>
    </instant>
    <instant name="Berserk" words="exori" lvl="35" mana="115" prem="1" needweapon="1" exhaustion="2000" needlearn="0" event="script" value="attack/berserk.lua">
        <vocation id="4;8"/>
    </instant>
    <instant name="Energy Wave" words="exevo vis hur" lvl="38" mana="170" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/energy wave.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Rage of the Skies" words="exevo gran mas vis" lvl="55" mana="650" selftarget="1" prem="1" exhaustion="2000" needlearn="0" event="script" value="attack/rage of the skies.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Fierce Berserk" words="exori gran" lvl="70" mana="340" prem="1" needweapon="1" exhaustion="2000" needlearn="0" event="script" value="attack/fierce berserk.lua">
        <vocation id="4;8"/>
    </instant>
        <instant name="Hells Core" words="exevo gran mas flam" lvl="60" mana="1200" prem="1" exhaustion="2000" selftarget="1" needlearn="0" event="script" value="attack/hells core.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Divine Missile" words="exori san" lvl="40" mana="20" prem="1" range="4" casterTargetOrDirection="1" needlearn="0" blockwalls="1" exhaustion="2000" event="script" value="attack/divine missile.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Divine Caldera" words="exevo mas san" lvl="50" mana="160" prem="1" selftarget="1" exhaustion="2000" needlearn="0" event="script" value="attack/divine caldera.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Eternal Winter" words="exevo gran mas frigo" lvl="60" mana="1200" prem="1" selftarget="1" exhaustion="2000" needlearn="0" event="script" value="attack/eternal winter.lua">
        <vocation id="2;6"/>
    </instant>
    <instant name="Ice Strike" words="exori frigo" lvl="15" mana="20" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/ice strike.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Ice Wave" words="exevo frigo hur" lvl="18" mana="25" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/ice wave.lua">
        <vocation id="2;6"/>
    </instant>
    <instant name="Terra Strike" words="exori tera" lvl="13" mana="20" prem="1" range="3" casterTargetOrDirection="1" blockwalls="1" exhaustion="2000" needlearn="0" event="script" value="attack/terra strike.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Terra Wave" words="exevo tera hur" lvl="38" mana="210" direction="1" exhaustion="2000" needlearn="0" event="script" value="attack/terra wave.lua">
        <vocation id="2;6"/>
    </instant>
    <instant name="Wrath of Nature" words="exevo gran mas tera" lvl="55" mana="770" prem="1" selftarget="1" exhaustion="2000" needlearn="0" event="script" value="attack/wrath of nature.lua">
        <vocation id="2;6"/>
    </instant>

    <!-- Healing Spells -->
    <instant name="Light Healing" words="exura" lvl="9" mana="20" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="healing/light healing.lua"/>
    <instant name="Antidote" words="exana pox" lvl="10" mana="30" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="healing/antidote.lua"/>
    <instant name="Intense Healing" words="exura gran" lvl="11" mana="70" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="healing/intense healing.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </instant>
    <instant name="Heal Friend" words="exura sio" lvl="18" mana="140" prem="1" aggressive="0" needtarget="1" params="1" exhaustion="2000" needlearn="0" event="script" value="healing/heal friend.lua">
        <vocation id="2;6"/>
    </instant>
    <instant name="Ultimate Healing" words="exura vita" lvl="20" mana="160" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="healing/ultimate healing.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </instant>
    <instant name="Mass Healing" words="exura gran mas res" lvl="36" mana="150" prem="1" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="healing/mass healing.lua">
        <vocation id="2;6"/>
    </instant>
    <instant name="Divine Healing" words="exura san" lvl="35" mana="210" prem="1" selftarget="1" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="healing/divine healing.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Wound Cleansing" words="exana mort" lvl="30" mana="65" prem="1" selftarget="1" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="healing/wound cleasing.lua">
        <vocation id="4;8"/>
    </instant>

    <!-- Support Spells -->
    <instant name="Light" words="utevo lux" lvl="8" mana="20" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/light.lua"/>
    <instant name="Find Person" words="exiva" lvl="8" mana="20" aggressive="0" params="1" exhaustion="1000" needlearn="0" event="function" value="searchPlayer"/>
    <instant name="Magic Rope" words="exani tera" lvl="9" mana="20" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/magic rope.lua"/>
    <instant name="Levitate" words="exani hur" lvl="12" mana="50" prem="1" aggressive="0" exhaustion="1000" params="1" needlearn="0" event="function" value="Levitate"/>
    <instant name="Great Light" words="utevo gran lux" lvl="13" mana="60" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/great light.lua"/>
    <instant name="Magic Shield" words="utamo vita" lvl="14" mana="50" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/magic shield.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </instant>
    <instant name="Haste" words="utani hur" lvl="14" mana="60" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/haste.lua"/>
    <instant name="Charge" words="utani tempo hur" lvl="25" mana="100" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/charge.lua">
        <vocation id="4;8"/>
    </instant>
    <instant name="Swift Foot" words="utamo tempo san" lvl="55" mana="400" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/swift foot.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Challenge" words="exeta res" lvl="20" mana="30" prem="1" aggressive="0" exhaustion="1000" needlearn="0" event="script" value="support/challenge.lua">
        <vocation id="8"/>
    </instant>
    <instant name="Strong Haste" words="utani gran hur" lvl="20" mana="100" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/strong haste.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Creature Illusion" words="utevo res ina" lvl="23" mana="100" aggressive="0" params="1" exhaustion="1000" needlearn="0" event="function" value="Illusion">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Ultimate Light" words="utevo vis lux" lvl="26" mana="140" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/ultimate light.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Cancel Invisibility" words="exana ina" lvl="26" mana="200" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/cancel invisibility.lua">
        <vocation id="1;5"/>
    </instant>
    <instant name="Invisibility" words="utana vid" lvl="35" mana="440" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/invisible.lua">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </instant>
    <instant name="Sharpshooter" words="utito tempo san" lvl="60" mana="450" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/sharpshooter.lua">
        <vocation id="3;7"/>
    </instant>
    <instant name="Protector" words="utamo tempo" lvl="55" mana="200" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/protector.lua">
        <vocation id="4;8"/>
    </instant>
    <instant name="Blood Rage" words="utito tempo" lvl="60" mana="290" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="support/blood rage.lua">
        <vocation id="4;8"/>
    </instant>

    <!-- Party Spells -->
    <instant name="Train Party" words="utito mas sio" lvl="32" mana="60" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="party/train.lua">
        <vocation id="8"/>
    </instant>
    <instant name="Protect Party" words="utamo mas sio" lvl="32" mana="90" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="party/protect.lua">
        <vocation id="7"/>
    </instant>
    <instant name="Heal Party" words="utura mas sio" lvl="32" mana="120" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="party/heal.lua">
        <vocation id="6"/>
    </instant>
    <instant name="Enchant Party" words="utori mas sio" lvl="32" mana="120" prem="1" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="party/enchant.lua">
        <vocation id="5"/>
    </instant>

    <!-- Summon Spells -->
    <instant name="Summon Creature" words="utevo res" lvl="25" params="1" exhaustion="2000" needlearn="0" event="function" value="summonMonster">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </instant>
    <instant name="Undead Legion" words="exana mas mort" lvl="30" mana="500" prem="1" exhaustion="2000" needlearn="0" event="script" value="summon/undead legion.lua">
        <vocation id="2;6"/>
    </instant>

    <!-- Conjure Spells -->
    <conjure name="Conjure Arrow" words="exevo con" lvl="13" mana="100" soul="1" conjureId="2544" conjureCount="10" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Poisoned Arrow" words="exevo con pox" lvl="16" mana="130" soul="2" conjureId="2545" conjureCount="7" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Conjure Bolt" words="exevo con mort" lvl="17" mana="140" soul="2" prem="1" conjureId="2543" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Conjure Sniper Arrow" words="exevo con hur" lvl="24" mana="160" soul="3" prem="1" conjureId="7364" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Explosive Arrow" words="exevo con flam" lvl="25" mana="290" soul="3" conjureId="2546" conjureCount="8" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Conjure Piercing Bolt" words="exevo con grav" lvl="33" mana="180" soul="3" prem="1" conjureId="7363" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Enchant Staff" words="exeta vis" lvl="41" mana="80" prem="1" conjureId="2433" reagentId="2401" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="5"/>
    </conjure>
    <conjure name="Enchant Spear" words="exeta con" lvl="45" mana="350" soul="3" prem="1" conjureId="7367" reagentId="2389" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Power Bolt" words="exevo con vis" lvl="59" mana="800" soul="4" prem="1" conjureId="2547" conjureCount="10" exhaustion="1000" needlearn="0" event="function" value="conjureItem">
        <vocation id="7"/>
    </conjure>
    <conjure name="Poison Field" words="adevo grav pox" lvl="14" mana="200" soul="1" reagentId="2260" conjureId="2285" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Light Magic Missile" words="adori min vis" lvl="15" mana="120" soul="1" reagentId="2260" conjureId="2287" conjureCount="10" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Fire Field" words="adevo grav flam" lvl="15" mana="240" soul="1" reagentId="2260" conjureId="2301" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Fireball" words="adori flam" lvl="27" mana="460" soul="3" prem="1" reagentId="2260" conjureId="2302" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Energy Field" words="adevo grav vis" lvl="18" mana="320" soul="2" reagentId="2260" conjureId="2277" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Stalagmite" words="adori tera" lvl="24" mana="400" soul="2" prem="2" reagentId="2260" conjureId="2292" conjureCount="10" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Great Fireball" words="adori mas flam" lvl="30" mana="530" soul="3" reagentId="2260" conjureId="2304" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Heavy Magic Missile" words="adori vis" lvl="25" mana="350" soul="2" reagentId="2260" conjureId="2311" conjureCount="10" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Poison Bomb" words="adevo mas pox" lvl="25" mana="520" soul="2" prem="1" reagentId="2260" conjureId="2286" conjureCount="2" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Firebomb" words="adevo mas flam" lvl="27" mana="600" soul="4" reagentId="2260" conjureId="2305" conjureCount="2" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Soulfire" words="adevo res flam" lvl="27" mana="600" soul="3" prem="1" reagentId="2260" conjureId="2308" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Poison Wall" words="adevo mas grav pox" lvl="29" mana="640" soul="3" reagentId="2260" conjureId="2289" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Explosion" words="adevo mas hur" lvl="31" mana="570" soul="4" reagentId="2260" conjureId="2313" conjureCount="6" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Fire Wall" words="adevo mas grav flam" lvl="33" mana="780" soul="4" reagentId="2260" conjureId="2303" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Energybomb" words="adevo mas vis" lvl="37" mana="880" soul="5" prem="1" reagentId="2260" conjureId="2262" conjureCount="2" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Energy Wall" words="adevo mas grav vis" lvl="41" mana="1000" soul="5" reagentId="2260" conjureId="2279" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Sudden Death" words="adori gran mort" lvl="45" mana="985" soul="5" reagentId="2260" conjureId="2268" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Antidote Rune" words="adana pox" lvl="15" mana="200" soul="1" reagentId="2260" conjureId="2266" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Intense Healing Rune" words="adura gran" lvl="15" mana="240" soul="2" reagentId="2260" conjureId="2265" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Ultimate Healing Rune" words="adura vita" lvl="24" mana="400" soul="3" reagentId="2260" conjureId="2273" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Convince Creature" words="adeta sio" lvl="16" mana="200" soul="3" reagentId="2260" conjureId="2290" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Animate Dead" words="adana mort" lvl="27" mana="600" soul="5" prem="1" reagentId="2260" conjureId="2316" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Chameleon" words="adevo ina" lvl="27" mana="600" soul="2" reagentId="2260" conjureId="2291" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Destroy Field" words="adito grav" lvl="17" mana="120" soul="2" reagentId="2260" conjureId="2261" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Desintegrate" words="adito tera" lvl="21" mana="200" soul="3" prem="1" reagentId="2260" conjureId="2310" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
        <vocation id="2;6"/>
        <vocation id="3;7"/>
    </conjure>
    <conjure name="Magic Wall" words="adevo grav tera" lvl="32" mana="750" soul="5" prem="1" reagentId="2260" conjureId="2293" conjureCount="3" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Wild Growth" words="adevo grav vita" lvl="27" mana="600" soul="5" prem="1" reagentId="2260" conjureId="2269" conjureCount="2" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Paralyze" words="adana ani" lvl="54" mana="1400" soul="3" prem="1" reagentId="2260" conjureId="2278" conjureCount="1" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Icicle" words="adori frigo" lvl="28" mana="460" soul="3" prem="1" reagentId="2260" conjureId="2271" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Avalanche" words="adori mas frigo" lvl="30" mana="530" soul="3" reagentId="2260" conjureId="2274" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Stone Shower" words="adori mas tera" lvl="28" mana="430" soul="3" prem="1" reagentId="2260" conjureId="2288" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="2;6"/>
    </conjure>
    <conjure name="Thunderstorm" words="adori mas vis" lvl="28" mana="430" soul="3" prem="1" reagentId="2260" conjureId="2315" conjureCount="4" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="1;5"/>
    </conjure>
    <conjure name="Holy Missile" words="adori san" lvl="27" mana="350" soul="3" prem="1" reagentId="2260" conjureId="2295" conjureCount="5" exhaustion="1000" needlearn="0" event="function" value="conjureRune">
        <vocation id="3;7"/>
    </conjure>
    
    <instant name="Mana Waste" words="manawaste" lvl="1" mana="0" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="manawaste.lua"/>
</spells>
 

cbrm

Just another mod
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,550
Best answers
1
Likes
802
Location
Caribbean Sea
#10
Yes, I had put 2 php tags inappropriately in spells.php which now is fixed in v2.
Any spell that doesn't specify vocation requirement in spells.xml then will show that all vocations can use it(except voc id 0)
Also I hadn't noticed the semicolon-divided vocations in the XML.

Then now this script supports all these vocations formats:
tfs 0.2
XML:
        <vocation name="Sorcerer"/>
        <vocation name="Druid"/>
        <vocation name="Master Sorcerer"/>
        <vocation name="Elder Druid"/>
tfs 0.3
XML:
        <vocation id="1"/>
        <vocation id="2"/>
        <vocation id="5"/>
        <vocation id="6"/>
XML:
        <vocation id="1;5"/>
        <vocation id="2;6"/>
I don't remember if there are other ways to divide vocations in spells.xml, anyways post it here to submit a new update for the script
 

cbrm

Just another mod
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,550
Best answers
1
Likes
802
Location
Caribbean Sea
#16
Last edited:

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,772
Best answers
1
Likes
202
Location
Chile, Santiago
#18
It says:
Code:
Update spells from file:Successfully fetched spells.xml!
Using temporal file: /tmp/phpxeIGWz
Loaded 93 spells!
File "spell.php" created!
 Show spells groups (Only for TFS 0.2.9+)
But it doesn't create the file spell.php :S
 
Joined
Oct 5, 2011
Messages
90
Best answers
0
Likes
0
#20
I'm using tfs 0.4.0 and I just did everything you told me to, but for some reason not a single spell is loaded..
 
Top