PDA

View Full Version : EqAllahkazzams Corrections


Dimorge02
11-18-2011, 04:17 PM
I thought I'd share a fix for the eqbrowser source.

When I installed the eqallahkazzams clone the spell and spells list did not work properly. Below are the fixes for the spell search functionality.


Change include/function.php
Line:
print " <li><a href='".$OpenObjectByIdPage."?id=".$row["id"]."'>".$row["name"]." (".$row["id"].")</a></li>\n";

To:
print " <li><a href='".$OpenObjectByIdPage."?id=".$row[$IdAttribute]."'>".$row[$NameAttribute]." (".$row[$IdAttribute].")</a></li>\n";

Change spell.php
Add : $id = $_GET["id"];
After: include($includes_dir.'mysql.php');


Replace spells.php code with:
<?php
/** Comment TODO Spells Remake **/

include('./includes/constantes.php');
include('./includes/config.php');
include($includes_dir.'mysql.php');
include($includes_dir.'functions.php');

$isearch = (isset($_GET[ 'isearch']) ? $_GET[ 'isearch'] : '');
$iname = (isset($_GET[ 'iname']) ? $_GET[ 'iname'] : '');
$iclass = (isset($_GET[ 'iclass']) ? $_GET[ 'iclass'] : 0);
$iminlevel = (isset($_GET[ 'iminlevel']) ? $_GET[ 'iminlevel'] : 0);
$imaxlevel = (isset($_GET[ 'imaxlevel']) ? $_GET[ 'imaxlevel'] : 0);
$ieffect = (isset($_GET[ 'ieffect']) ? $_GET[ 'ieffect'] : '');
$icvs = (isset($_GET[ 'icvs']) ? $_GET[ 'icvs'] : '');

if ($imin>$imax) { $n=$imin; $imin=$imax; $imax=$n; }
if ($ieffect != "") { $ieffect=-1; }

if($isearch != "" || $icvs != "")
{
if ($imin==0) { $imin=1; }
if ($imax==0) { $imax=80; }

if ($icsv != "") { print "<table border=0 width=100%><tr valign=top><td width=100%>"; }

$query = "SELECT $tbspells.spellid,$tbspells.name";
$query .= " FROM $tbspells";
$query .= " WHERE 1=1";

if ($iname!="") {
$iname=str_replace(' ','%',$iname);
$query.=" AND name like '%".str_replace(" ","%",$iname)."%'";
}
if ($iclass>0) { $query.=" AND level$iclass>=$imin AND level$iclass<=$imax ORDER BY level$iclass ASC,name ASC"; }
else { $query.=" ORDER BY name"; }

if ($ieffect>=0) {
$query.=" AND (";
$s="";
for ($i=1; $i<=12; $i++) { $query.=" $s buff$i=$ieffect"; $s="OR"; }
$query.=" )";
}


$QueryResult = mysql_query($query) or message_die('spells.php','MYSQL_QUERY',$query,mysq l_error());
if(mysql_num_rows($QueryResult) == 1)
{ $row = mysql_fetch_array($QueryResult);
header("Location: spell.php?id=".$row["spellid"]);
exit();
}
}
else
$iname = "";

$Title="Items List";
$XhtmlCompliant = TRUE;
include($includes_dir.'headers.php');

print "<center><table border=0 width=0%>";
print "<form method='GET' action='".$PHP_SELF."'>";
print "<tr><td nowrap><b>Name : </b></td><td><input type=text value=\"$iname\" size=30 name=iname class=form></td></tr>";
print "<tr><td nowrap><b>Class : </b></td><td>";
print SelectClass("iclass",$iclass);
print "</td></tr>";
print "<tr><td nowrap><b>Min Level : </b></td><td>";
print SelectLevel("imin",80,$imin);
print "</td></tr><tr><td nowrap><b>Max Level : </b></td><td>";
print SelectLevel("imax",80,$imax);
print "</td></tr>";
print "</td></tr><tr><td nowrap><b>Spell Effect : </b></td><td>";
print SelectSpellEffect("ieffect",$ieffect);
print "</td></tr>";
print "<tr align=center><td nowrap colspan=2><input type='submit' value='Search' name='isearch' class='form'>";
print "&nbsp;<input type='submit' value='CSV' name='icsv' class='form'>";
print "&nbsp;<input type='reset' value='Reset' class='form'>";
print "</td></tr>";
print "</form></table></center>";

if(isset($QueryResult))
PrintQueryResults($QueryResult, $MaxItemsReturned, "spell.php", "spell", "spells", "spellid", "name");

if ($icsv != "") {
print "</td><td><iframe src=spellscsv.php?iclass=$iclass&iname=$iname&ieffect=$ieffect&imin=$imin&imax=$imax
width=0
border=0 frameborder=0
height=0>
</iframe></td></tr></table>";
}
include($includes_dir."footers.php");
?>