kito2
www.masteria.net
If you have the database spell of gesior, then you will be able to use this php:
Thanks to Cyko who fixed it a lot, and I changed some things too...
If you don't have the table, execute this:
And that's all... I hope it works for you.
If you want an example: mtibia - the fenix version!
PHP:
<?PHP
$vocation_name[0][0] = array(0 => 'None', 1 => 'Sorcerer', 2 => 'Druid', 3 => 'Paladin', 4 => 'Knight');
$vocation_name[0][1] = array(1 => 'Master Sorcerer', 2 => 'Elder Druid', 3 => 'Royal Paladin', 4 => 'Elite Knight');
$ots = POT::getInstance();
$ots->connect(POT::DB_MYSQL, connection());
$SQL = $ots->getDBHandle();
$allowed_order_by = array('name', 'spell', 'spell_type', 'mana', 'lvl', 'mlvl', 'soul');
$vocation_id = $_REQUEST['vocation_id'];
$order = $_REQUEST['order'];
if(in_array($order, $allowed_order_by))
$orderby = $order;
else
$orderby = 'name';
$spells = $SQL->query('SELECT * FROM z_spells WHERE hide_spell != 1 ORDER BY '.$orderby.', lvl');
echo '<FORM ACTION="" METHOD=post>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>
<TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B>Spell Search</B></TD></TR>
<TR BGCOLOR='.$config['site']['darkborder'].'><TD>Only for vocation: <SELECT NAME="vocation_id">';
echo '<OPTION VALUE="a:a" ';
if('a:a' == $vocation_id)
echo 'SELECTED';
echo '>All';
foreach($vocation_name[0] as $prom => $arr)
foreach($arr as $voc_id => $voc_name)
{
echo '<OPTION VALUE="'.$prom.';'.$voc_id.'"';
if($prom.';'.$voc_id == $vocation_id && $vocation_id != "a:a" && $vocation_id != '')
echo ' SELECTED';
echo '/>'.$voc_name;
}
echo '</SELECT><input type="hidden" name="order" value="'.$orderby.'"> <INPUT TYPE=submit NAME="Submit" ALT="Submit" ></TD><TR>
</TABLE></FORM>';
echo '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR='.$config['site']['vdarkborder'].'><TD CLASS=white><B><font CLASS=white><font color="yellow">Name</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Sentence</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Type<br/>(count)</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Mana</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Exp.<br/>Level</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Magic<br/>Level</font></B></TD><TD CLASS=white><B><font CLASS=white><font color="yellow">Soul</font></B></TD><TD CLASS=white><B><font color="yellow">PACC</font></B></TD><TD CLASS=white><B><font color="yellow">For<br/>Vocations:</font></B></TD></TR></font>';
if($vocation_id != 'a:a' && $vocation_id != '')
{
foreach($vocation_name[0] as $prom => $arr)
foreach($arr as $voc_id => $voc_name)
if($prom.';'.$voc_id == $vocation_id)
$voc_n = $voc_name;
foreach($spells as $spell)
{
$spell_vocations = explode(",", $spell['vocations']);
if(in_array($vocation_id, $spell_vocations) || empty($spell['vocations']))
{
if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['darkborder']; } $number_of_rows++;
echo '<TR BGCOLOR="'.$bgcolor.'"><TD>'.$spell['name'].'</TD><TD>'.$spell['spell'].'</TD>';
if($spell['spell_type'] == 'conjure')
echo '<TD>'.$spell['spell_type'].'('.$spell['conj_count'].')</TD>';
else
echo '<TD>'.$spell['spell_type'].'</TD>';
echo '<TD>'.$spell['mana'].'</TD><TD>'.$spell['lvl'].'</TD><TD>'.$spell['mlvl'].'</TD><TD>'.$spell['soul'].'</TD><TD>'.$spell['pacc'].'</TD><TD>'.$voc_n.'</TD></TR>';
}
}
}
else
{
foreach($spells as $spell)
{
$spell_vocations = explode(",", $spell['vocations']);
$showed_vocations = 0;
$vocs = '';
foreach($spell_vocations as $voc)
{
$voc_info = explode(";", $voc);
if(!empty($vocation_name[0][$voc_info[0]][$voc_info[1]]))
{
$vocs .= $vocation_name[0][$voc_info[0]][$voc_info[1]];
if($showed_vocations != count($spell_vocations))
$vocs .= '<br/>';
}
}
if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['lightborder']; } else { $bgcolor = $config['site']['darkborder']; } $number_of_rows++;
echo '<TR BGCOLOR="'.$bgcolor.'"><TD>'.$spell['name'].'</TD><TD>'.$spell['spell'].'</TD>';
if($spell['spell_type'] == 'conjure')
echo '<TD>'.$spell['spell_type'].'('.$spell['conj_count'].')</TD>';
else
echo '<TD>'.$spell['spell_type'].'</TD>';
echo '<TD>'.$spell['mana'].'</TD><TD>'.$spell['lvl'].'</TD><TD>'.$spell['mlvl'].'</TD><TD>'.$spell['soul'].'</TD><TD>'.$spell['pacc'].'</TD><TD><font size="1">'.$vocs.'</font></TD></TR>';
}
}
echo '</TABLE>';
?>
Thanks to Cyko who fixed it a lot, and I changed some things too...
If you don't have the table, execute this:
Code:
CREATE TABLE IF NOT EXISTS `z_spells` (
`name` varchar(255) NOT NULL,
`spell` varchar(255) NOT NULL,
`spell_type` varchar(255) NOT NULL,
`mana` int(11) NOT NULL default '0',
`lvl` int(11) NOT NULL default '0',
`mlvl` int(11) NOT NULL default '0',
`soul` int(11) NOT NULL default '0',
`pacc` varchar(255) NOT NULL,
`vocations` varchar(255) NOT NULL,
`conj_count` int(11) NOT NULL default '0',
`hide_spell` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Volcar la base de datos para la tabla `z_spells`
--
INSERT INTO `z_spells` (`name`, `spell`, `spell_type`, `mana`, `lvl`, `mlvl`, `soul`, `pacc`, `vocations`, `conj_count`, `hide_spell`) VALUES
('Conjure Spear', 'exevo spear', 'conjure', 25, 6, 0, 1, 'no', '0;3,1;3', 1, 0),
('Conjure Blank Rune', 'adori blank', 'conjure', 40, 6, 0, 1, 'no', '0;1,1;1,0;2,1;2', 1, 0),
('Conjure Arrow', 'exevo con', 'conjure', 100, 13, 0, 1, 'no', '0;3,1;3', 10, 0),
('Poisoned Arrow', 'exevo con pox', 'conjure', 130, 16, 0, 2, 'no', '0;3,1;3', 7, 0),
('Conjure Bolt', 'exevo con mort', 'conjure', 140, 17, 0, 2, 'no', '0;3,1;3', 5, 0),
('Conjure Sniper Arrow', 'exevo con hur', 'conjure', 160, 24, 0, 3, 'no', '0;3,1;3', 5, 0),
('Explosive Arrow', 'exevo con flam', 'conjure', 290, 25, 0, 3, 'no', '0;3,1;3', 8, 0),
('Conjure Piercing Bolt', 'exevo con grav', 'conjure', 180, 33, 0, 3, 'no', '0;3,1;3', 5, 0),
('Enchant Staff', 'exeta vis', 'conjure', 80, 41, 0, 0, 'no', '1;1', 0, 0),
('Enchant Spear', 'exeta con', 'conjure', 350, 45, 0, 3, 'no', '0;3,1;3', 0, 0),
('Power Bolt', 'exevo con vis', 'conjure', 800, 59, 0, 4, 'no', '1;3', 10, 0),
('Poison Field', 'adevo grav pox', 'conjure', 200, 14, 0, 1, 'no', '0;1,0;2,1;1,1;2', 3, 0),
('Light Magic Missile', 'adori min vis', 'conjure', 120, 15, 0, 1, 'no', '0;1,0;2,1;1,1;2', 10, 0),
('Fire Field', 'adevo grav flam', 'conjure', 240, 15, 0, 1, 'no', '0;1,0;2,1;1,1;2', 3, 0),
('Fireball', 'adori flam', 'conjure', 460, 27, 0, 3, 'no', '0;1,1;1', 5, 0),
('Energy Field', 'adevo grav vis', 'conjure', 320, 18, 0, 2, 'no', '0;1,0;2,1;1,1;2', 3, 0),
('Stalagmite', 'adori tera', 'conjure', 400, 24, 0, 2, 'no', '0;1,1;1,0;2,1;2', 10, 0),
('Great Fireball', 'adori mas flam', 'conjure', 530, 30, 0, 3, 'no', '0;1,1;1', 4, 0),
('Heavy Magic Missile', 'adori vis', 'conjure', 350, 25, 0, 2, 'no', '0;1,1;1,0;2,1;2', 10, 0),
('Poison Bomb', 'adevo mas pox', 'conjure', 520, 25, 0, 2, 'no', '0;2,1;2', 2, 0),
('Firebomb', 'adevo mas flam', 'conjure', 600, 27, 0, 4, 'no', '0;1,0;2,1;1,1;2', 2, 0),
('Soulfire', 'adevo res flam', 'conjure', 600, 27, 0, 3, 'no', '0;1,0;2,1;1,1;2', 3, 0),
('Poison Wall', 'adevo mas grav pox', 'conjure', 640, 29, 0, 3, 'no', '0;1,0;2,1;1,1;2', 4, 0),
('Explosion', 'adevo mas hur', 'conjure', 570, 31, 0, 4, 'no', '0;1,0;2,1;1,1;2', 6, 0),
('Fire Wall', 'adevo mas grav flam', 'conjure', 780, 33, 0, 4, 'no', '0;1,0;2,1;1,1;2', 4, 0),
('Energybomb', 'adevo mas vis', 'conjure', 880, 37, 0, 5, 'no', '0;1,1;1', 2, 0),
('Energy Wall', 'adevo mas grav vis', 'conjure', 1000, 41, 0, 5, 'no', '0;1,0;2,1;1,1;2', 4, 0),
('Sudden Death', 'adori gran mort', 'conjure', 985, 45, 0, 5, 'no', '0;1,1;1', 3, 0),
('Antidote Rune', 'adana pox', 'conjure', 200, 15, 0, 1, 'no', '0;2,1;2', 1, 0),
('Intense Healing Rune', 'adura gran', 'conjure', 240, 15, 0, 2, 'no', '0;2,1;2', 1, 0),
('Ultimate Healing Rune', 'adura vita', 'conjure', 400, 24, 0, 3, 'no', '0;2,1;2', 1, 0),
('Convince Creature', 'adeta sio', 'conjure', 200, 16, 0, 3, 'no', '0;2,1;2', 1, 0),
('Animate Dead', 'adana mort', 'conjure', 600, 27, 0, 5, 'no', '0;1,0;2,1;1,1;2', 1, 0),
('Chameleon', 'adevo ina', 'conjure', 600, 27, 0, 2, 'no', '0;2,1;2', 1, 0),
('Destroy Field', 'adito grav', 'conjure', 120, 17, 0, 2, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 3, 0),
('Desintegrate', 'adito tera', 'conjure', 200, 21, 0, 3, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 3, 0),
('Magic Wall', 'adevo grav tera', 'conjure', 750, 32, 0, 5, 'no', '0;1,1;1', 3, 0),
('Wild Growth', 'adevo grav vita', 'conjure', 600, 27, 0, 5, 'no', '0;2,1;2', 2, 0),
('Paralyze', 'adana ani', 'conjure', 1400, 54, 0, 3, 'no', '0;2,1;2', 1, 0),
('Icicle', 'adori frigo', 'conjure', 460, 28, 0, 3, 'no', '0;2,1;2', 5, 0),
('Avalanche', 'adori mas frigo', 'conjure', 530, 30, 0, 3, 'no', '0;2,1;2', 4, 0),
('Stone Shower', 'adori mas tera', 'conjure', 430, 28, 0, 3, 'no', '0;2,1;2', 4, 0),
('Thunderstorm', 'adori mas vis', 'conjure', 430, 28, 0, 3, 'no', '0;1,1;1', 4, 0),
('Holy Missile', 'adori san', 'conjure', 350, 27, 0, 3, 'no', '0;3,1;3', 5, 0),
('Death Strike', 'exori mort', 'instant', 20, 16, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Flame Strike', 'exori flam', 'instant', 20, 12, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Energy Strike', 'exori vis', 'instant', 20, 12, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Whirlwind Throw', 'exori hur', 'instant', 40, 15, 0, 0, 'no', '0;4,1;4', 0, 0),
('Fire Wave', 'exevo flam hur', 'instant', 25, 18, 0, 0, 'no', '0;1,1;1', 0, 0),
('Ethereal Spear', 'exori con', 'instant', 25, 23, 0, 0, 'no', '0;3,1;3', 0, 0),
('Energy Beam', 'exevo vis lux', 'instant', 40, 23, 0, 0, 'no', '0;1,1;1', 0, 0),
('Great Energy Beam', 'exevo gran vis lux', 'instant', 110, 29, 0, 0, 'no', '0;1,1;1', 0, 0),
('Groundshaker', 'exori mas', 'instant', 160, 33, 0, 0, 'no', '0;4,1;4', 0, 0),
('Berserk', 'exori', 'instant', 115, 35, 0, 0, 'no', '0;4,1;4', 0, 0),
('Energy Wave', 'exevo vis hur', 'instant', 170, 38, 0, 0, 'no', '0;1,1;1', 0, 0),
('Rage of the Skies', 'exevo gran mas vis', 'instant', 650, 55, 0, 0, 'no', '0;1,1;1', 0, 0),
('Fierce Berserk', 'exori gran', 'instant', 340, 70, 0, 0, 'no', '0;4,1;4', 0, 0),
('Hells Core', 'exevo gran mas flam', 'instant', 1200, 60, 0, 0, 'no', '0;1,1;1', 0, 0),
('Divine Missile', 'exori san', 'instant', 20, 40, 0, 0, 'no', '0;3,1;3', 0, 0),
('Divine Caldera', 'exevo mas san', 'instant', 160, 50, 0, 0, 'no', '0;3,1;3', 0, 0),
('Eternal Winter', 'exevo gran mas frigo', 'instant', 1200, 60, 0, 0, 'no', '0;2,1;2', 0, 0),
('Ice Strike', 'exori frigo', 'instant', 20, 15, 0, 0, 'no', '0;1,1;1,0;2,1;2', 0, 0),
('Ice Wave', 'exevo frigo hur', 'instant', 25, 18, 0, 0, 'no', '0;2,1;2', 0, 0),
('Terra Strike', 'exori tera', 'instant', 20, 13, 0, 0, 'no', '0;1,1;1,0;2,1;2', 0, 0),
('Terra Wave', 'exevo tera hur', 'instant', 210, 38, 0, 0, 'no', '0;2,1;2', 0, 0),
('Wrath of Nature', 'exevo gran mas tera', 'instant', 770, 55, 0, 0, 'no', '0;2,1;2', 0, 0),
('Light Healing', 'exura', 'instant', 20, 9, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Antidote', 'exana pox', 'instant', 30, 10, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Intense Healing', 'exura gran', 'instant', 70, 11, 0, 0, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 0, 0),
('Heal Friend', 'exura sio', 'instant', 140, 18, 0, 0, 'no', '0;2,1;2', 0, 0),
('Ultimate Healing', 'exura vita', 'instant', 160, 20, 0, 0, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 0, 0),
('Mass Healing', 'exura gran mas res', 'instant', 150, 36, 0, 0, 'no', '0;2,1;2', 0, 0),
('Divine Healing', 'exura san', 'instant', 210, 35, 0, 0, 'no', '0;3,1;3', 0, 0),
('Wound Cleansing', 'exana mort', 'instant', 65, 30, 0, 0, 'no', '0;4,1;4', 0, 0),
('Light', 'utevo lux', 'instant', 20, 8, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Find Person', 'exiva', 'instant', 20, 8, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Magic Rope', 'exani tera', 'instant', 20, 9, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Levitate', 'exani hur', 'instant', 50, 12, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Great Light', 'utevo gran lux', 'instant', 60, 13, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Magic Shield', 'utamo vita', 'instant', 50, 14, 0, 0, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 0, 0),
('Haste', 'utani hur', 'instant', 60, 14, 0, 0, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0),
('Charge', 'utani tempo hur', 'instant', 100, 25, 0, 0, 'no', '0;4,1;4', 0, 0),
('Swift Foot', 'utamo tempo san', 'instant', 400, 55, 0, 0, 'no', '0;3,1;3', 0, 0),
('Challenge', 'exeta res', 'instant', 30, 20, 0, 0, 'no', '1;4', 0, 0),
('Strong Haste', 'utani gran hur', 'instant', 100, 20, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Creature Illusion', 'utevo res ina', 'instant', 100, 23, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Ultimate Light', 'utevo vis lux', 'instant', 140, 26, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Cancel Invisibility', 'exana ina', 'instant', 200, 26, 0, 0, 'no', '0;1,1;1', 0, 0),
('Invisibility', 'utana vid', 'instant', 440, 35, 0, 0, 'no', '0;1,0;2,0;3,1;1,1;2,1;3', 0, 0),
('Sharpshooter', 'utito tempo san', 'instant', 450, 60, 0, 0, 'no', '0;3,1;3', 0, 0),
('Protector', 'utamo tempo', 'instant', 200, 55, 0, 0, 'no', '0;4,1;4', 0, 0),
('Blood Rage', 'utito tempo', 'instant', 290, 60, 0, 0, 'no', '0;4,1;4', 0, 0),
('Train Party', 'utito mas sio', 'instant', 60, 32, 0, 0, 'no', '1;4', 0, 0),
('Protect Party', 'utamo mas sio', 'instant', 90, 32, 0, 0, 'no', '1;3', 0, 0),
('Heal Party', 'utura mas sio', 'instant', 120, 32, 0, 0, 'no', '1;2', 0, 0),
('Enchant Party', 'utori mas sio', 'instant', 120, 32, 0, 0, 'no', '1;1', 0, 0),
('Summon Creature', 'utevo res', 'instant', 0, 25, 0, 0, 'no', '0;1,0;2,1;1,1;2', 0, 0),
('Undead Legion', 'exana mas mort', 'instant', 500, 30, 0, 0, 'no', '0;2,1;2', 0, 0),
('Food', 'exevo pan', 'instant', 120, 14, 0, 1, 'no', '0;1,0;2,0;3,0;4,1;1,1;2,1;3,1;4', 0, 0);
And that's all... I hope it works for you.
If you want an example: mtibia - the fenix version!