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

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, "name", "ID")." ORDER BY name");
$num = 0;

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

printf("%6d  %-25s  %s%s%s\n",
   $sp->ID,
   $sp->name,
   @$sp->description != "" ? $sp->description : "",
   @$sp->description != "" && @$sp->auraDescription != "" ? " " : "",
   @$sp->auraDescription != "" ? "[$sp->auraDescription]" : ""
);
if ($verbose)  print_r($sp);
++$num;

}

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

?>
