<?php
/* Examples:
spell.php 13180
spell.php "(INSTR(SpellName_1,'Viper Sting') AND (SELECT spell FROM characters.character_spell WHERE spell=ID LIMIT 1) IS NOT NULL)" '
*/

require "_trinity.php";

MySTART("dbcdata");

$verbose = false;
if (@$argv[count($argv)-1] == "/")  { $verbose = true; array_splice($argv,-1); }

$cname = "(attributesEx3 & 0x00020000)";
$res_spells = MyOP("SELECT * FROM spell WHERE ".EntryConditionFromArgv($cname, "SpellName_1", "Id")." ORDER BY SpellName_1");
$num = 0;

while($sp = mysql_fetch_object($res_spells)) {

printf("%6d  %-25s  %s\n",
   $sp->Id,
   $sp->SpellName_1, $sp->Rank_1
);
if ($verbose)  print_r($sp);
++$num;

}

printf("  === %d spells === \n", $num);

?>
