<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once (ROOT_PATH . '//include/config.inc.php');
include_once (ROOT_PATH . '//include/designfunctions.inc.php');
// TODO: Muss noch angepasst werden!
function showAttDetails($at_id) {
$at_info = mysql_Fetch_array(mysql_query("SELECT * FROM attacken WHERE id='".$at_id."' LIMIT 1"));
$req_atk = explode(",", $at_info['req_atk']);
$req_lvl = explode(",", $at_info['req_lvl']);
$req_attack = mysql_fetch_array(mysql_query("SELECT f.name AS f_name, b.name AS b_name, c.name AS c_name, d.name AS d_name, e.name AS e_name FROM attacken a LEFT JOIN attacken b ON(b.id='".$req_atk[0]."') LEFT JOIN attacken c ON(c.id='".$req_atk[1]."') LEFT JOIN attacken d ON(d.id='".$req_atk[2]."') LEFT JOIN attacken e ON(e.id='".$req_atk[3]."') LEFT JOIN attacken f ON(f.id='".$req_atk[4]."') WHERE a.id='".$at_id."'"));
?>
< div align = "center" >
< input type = "button" value = "Zurück" onClick = "history.back()" >
< table border = "0" cellpadding = "0" cellspacing = "0" style = "border-collapse: collapse" bordercolor = "#111111" width = "100%" height = "25" >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Name< / b > < / td >
< td width = "340" height = "25" > <?php echo generateAttackNameByID ( $at_id ); ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Stä rke< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'starke' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Verteidigung< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'verteidigung' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Geschwindigkeit< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'speed' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > HP< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'hp' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > MP< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'mp' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Level< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'level' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Geld< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'geld' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Type< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'type' ]; ?> </ td >
< / tr >
< tr >
< td width = "158" height = "25" >
< p align = "center" > < b > Info< / b > < / td >
< td width = "340" height = "25" > <?php echo $at_info [ 'info' ]; ?> </ td >
< / tr >
<?php
$rassen_1 = explode(",", $at_info['rassen']);
$runde = 0;
include (ROOT_PATH . '//include/array.php');
while ($runde +1 < count ( $ rassen_1 ) ) {
$runden = $runde +1;
$rassen_na = $rassen_1[$runde] - 1;
$rassen_name = $rassen_werte[$rassen_na];
?>
< tr >
< td width = "158" height = "25" >
< p align = "center" >< b > Rassen <?php echo $runden ; ?> </ b ></ td >
< td width = "340" height = "25" > <?php echo $rassen_name ; ?> </ td >
< / tr >
<?php
$runde++;
}
$x = 0;
$req_x = 0;
if ($req_atk[0] > 0) {
$req_x++;
}
if ($req_atk[1] > 0) {
$req_x++;
}
if ($req_atk[2] > 0) {
$req_x++;
}
if ($req_atk[3] > 0) {
$req_x++;
}
if ($req_atk[4] > 0) {
$req_x++;
}
while ($x < $req_x) {
if ($x == 0) {
$req_attack1 = $req_attack['b_name'];
}
if ($x == 1) {
$req_attack1 = $req_attack['c_name'];
}
if ($x == 2) {
$req_attack1 = $req_attack['d_name'];
}
if ($x == 3) {
$req_attack1 = $req_attack['e_name'];
}
if ($x == 4) {
$req_attack1 = $req_attack['f_name'];
}
echo "
< tr >
< td width = 158 height = 25 >
< p align = center > < b > Req Technik< / b > < / td >
< td width = 340 height = 25 > $req_attack1 $at_info[geld] mal nutzen.< / td >
< / tr >
";
$x++;
}
?>
< / table >
< / div >
<?php
}
function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruchttyp='',$search='') {
?>
< table border = "1" cellspacing = "1" width = "500" bgcolor = "#FFFFFF"
bordercolor="#292929" bordercolordark="#C0C0C0"
bordercolorlight="#C0C0C0">
< tr >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b > < a href = "index.php?as=info/attacken& <?php echo $linkz ; ?> &order=name" > Name</ a ></ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b > HP< / b > < / font > < / td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b > MP< / b > < / font > < / td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b >< a href = "index.php?as=info/attacken& <?php echo $linkz ; ?> &order=starke" > Stä rke</ a ></ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b >< a href = "index.php?as=info/attacken& <?php echo $linkz ; ?> &order=verteidigung" > Ver.</ a ></ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b >< a href = "index.php?as=info/attacken& <?php echo $linkz ; ?> &order=speed" > Geschw.</ a ></ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#FFFFFF" size="1" face="Verdana">< b >< a href = "index.php?as=info/attacken& <?php echo $linkz ; ?> &order=level" > LvL:</ a ></ b ></ font ></ td >
< / tr >
<?php
if (!empty($tf) AND is_numeric($tf)) {
$attacken = mysql_query('SELECT * FROM attacken WHERE Frucht='.$tf.' '.$order.' LIMIT '.($pagenum * 20).', 20 ');
} else {
if ($rassen == 1) {
$attacken = mysql_query("SELECT * FROM attacken WHERE (rassen LIKE '%1,%11,%' OR (rassen LIKE '%1,%' AND rassen NOT LIKE '%11,%')) AND Frucht is NULL AND info not like '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
} elseif (!empty($search)) {
$attacken = mysql_query("SELECT * FROM attacken WHERE name LIKE '%".$search."%' AND info not like '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
} elseif (empty($rassen)) {
if ($type == 'op') {
$attacken = mysql_query("SELECT * FROM attacken WHERE (rassen LIKE '%1,%' OR rassen LIKE '%8,%' OR rassen LIKE '%9,%' OR rassen LIKE '%12,%') AND Frucht is NULL AND rassen!='11,' AND info not like '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
} elseif ($type == 'db') {
$attacken = mysql_query("SELECT * FROM attacken WHERE (rassen LIKE '%2,%' OR rassen LIKE '%3,%' OR rassen LIKE '%4,%' OR rassen LIKE '%5,%' OR rassen LIKE '%6,%' OR rassen LIKE '%7,%' OR rassen LIKE '%10,%') AND Frucht is NULL AND rassen!='11,' AND info not like '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
} elseif ($type == 'tf') {
$condition = getFruchtCondition($fruchttyp);
// select attacken.*, wochen_markt.kategorie from attacken inner join wochen_markt on attacken.frucht = wochen_markt.id
$sql = 'SELECT attacken.* FROM attacken inner join wochen_markt on attacken.frucht = wochen_markt.id WHERE ' .$condition.' attacken.info not like \'%npc attacke%\' '.$order.' LIMIT '.($pagenum * 20).', 20 ';
$attacken = mysql_query($sql);
} else {
$attacken = mysql_query("SELECT * FROM attacken WHERE info NOT LIKE '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
}
} else {
$attacken = mysql_query("SELECT * FROM attacken WHERE rassen LIKE '%$rassen%' AND Frucht is NULL AND info not like '%npc attacke%' $order ".' LIMIT '.($pagenum * 20).', 20 ');
}
}
while ($row = mysql_fetch_array($attacken)) {
?>
< tr >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
size="1" face="Verdana"> < / font > < font
color="#FFFFFF" size="1" face="Verdana">< b > <?php echo generateAttackLinkByID ( $row [ 'id' ]); ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#D1D1D1" size="1" face="Verdana">< b > <?php echo $row [ 'hp' ]; ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#D1D1D1" size="1" face="Verdana">< b > <?php echo $row [ 'mp' ]; ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#D1D1D1" size="1" face="Verdana">< b > <?php echo $row [ 'starke' ]; ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#D1D1D1" size="1" face="Verdana">< b > <?php echo $row [ 'verteidigung' ]; ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#333333" > < font
color="#D1D1D1" size="1" face="Verdana">< b > <?php echo $row [ 'speed' ]; ?> </ b ></ font ></ td >
< td align = "center" valign = "top" bgcolor = "#FFFFFF" > < font
color="#510002" size="1" face="Verdana">< b > <?php echo $row [ 'level' ]; ?> </ b ></ font ></ td >
< / tr >
<?php
}
if (!empty($tf) AND is_numeric($tf)) {
$total = mysql_num_rows(mysql_query('SELECT id FROM attacken WHERE Frucht='.$tf));
} else {
if ($rassen == 1) {
$total = mysql_num_rows(mysql_query("SELECT * FROM attacken WHERE (rassen LIKE '%1,%11,%' OR (rassen LIKE '%1,%' AND rassen NOT LIKE '%11,%')) AND Frucht is NULL AND info not like '%npc attacke%' "));
} elseif (!empty($search)) {
$total = mysql_num_rows(mysql_query("SELECT * FROM attacken WHERE name LIKE '%".$search."%' AND info not like '%npc attacke%' "));
} elseif (empty($rassen)) {
if ($type == 'op') {
$total = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE (rassen LIKE '%1,%' OR rassen LIKE '%8,%' OR rassen LIKE '%9,%' OR rassen LIKE '%12,%') AND Frucht is NULL AND rassen!='11,' AND info not like '%npc attacke%' "));
} elseif ($type == 'db') {
$total = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE (rassen LIKE '%2,%' OR rassen LIKE '%3,%' OR rassen LIKE '%4,%' OR rassen LIKE '%5,%' OR rassen LIKE '%6,%' OR rassen LIKE '%7,%' OR rassen LIKE '%10,%') AND Frucht is NULL AND rassen!='11,' AND info not like '%npc attacke%' "));
} elseif ($type == 'tf') {
$condition = getFruchtCondition($fruchttyp);
$total = mysql_num_rows(mysql_query('SELECT attacken.* FROM attacken inner join wochen_markt on attacken.frucht = wochen_markt.id WHERE ' .$condition.' attacken.info not like \'%npc attacke%\''));
} else {
$total = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE info NOT LIKE '%npc attacke%' "));
}
} else {
$total = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE rassen LIKE '%$rassen%' AND Frucht is NULL AND info not like '%npc attacke%' "));
}
}
$pages = ceil($total / 20);
$z = 1;
$i = 0;
#$rassen++;
while ($pages > $i) {
$seiten .= ' < a href = "index.php?as=info/attacken&type='.$type.'&pagenum='.$z.'&order_art='.$order_art.'&order='.$last_klick1.'&rassen='.$rassen.'" > $z< / a > ';
$z++;
$i++;
}
if (!empty($search)) {
$url = '< a href = "index.php?as=info/attacken&p=1&search='.$search.'&pagenum=###PAGE###&order_art='.$order_art.'&order='.$last_klick1.'&rassen='.$rassen.'&tf='.$tf.'&fruchttyp='.$fruchttyp.'" > ###LABEL###< / a > ';
} else {
$url = '< a href = "index.php?as=info/attacken&type='.$type.'&pagenum=###PAGE###&order_art='.$order_art.'&order='.$last_klick1.'&rassen='.$rassen.'&tf='.$tf.'&fruchttyp='.$fruchttyp.'" > ###LABEL###< / a > ';
}
?>
<?php
/*
< tr >
< td vAlign = "top" align = "middle" > < font color = "#333333" > Seiten< / font > < / td >
< td vAlign = "top" bgColor = "#333333" colspan = "6" >
< font face = "Verdana" size = "1" > </ font >< font face = "Verdana" color = "#ffffff" size = "1" >< b > <?php echo $seiten ; ?> </ b ></ font ></ td >
< / tr > */
echo '< tr > < td bgcolor = "#333333" colspan = "7" > '.displayPagelinksNew(20, $total, $pagenum, $url).'< / td > < / tr > ';
?>
< / table >
<?php
}
function searchAtks() {
?>
< form action = " <?php echo $_SERVER [ 'PHP_SELF' ]; ?> " method = "get" >
< input type = "hidden" name = "as" value = "info/attacken" >
< input type = "hidden" name = "p" value = "1" >
< table border = "1" cellspacing = "1" width = "500" bgcolor = "#F8F8F8"
bordercolor="#292929" bordercolordark="#C0C0C0"
bordercolorlight="#C0C0C0">
< tr >
< td align = "center" width = "100%" bgcolor = "#333333" >
< font color = "#FFFFFF" size = "1" face = "Verdana" > < b > Suchen: < / b > < / font >
< font size = "1" face = "Verdana" >
< input id = "input" name = "search" >
< input id = "input" type = submit value = "suche" >
< / font >
< / td >
< / tr >
< / table >
< / form >
<?php
}
function atksHeaderType() {
?>
< tr >
< td align = "center" width = "100%" bgcolor = "#333333" >
< span style = "color:#FFF;font-family:Verdana;font-size:10;font-weight:bold;" >
< a href = "index.php?as=info/attacken" style = "color:#FFF;text-decoration:none;" > Alle Attacken< / a > |
< a href = "index.php?as=info/attacken&type=db" style = "color:#FFF;text-decoration:none;" > Dragon-Ball< / a > |
< a href = "index.php?as=info/attacken&type=op" style = "color:#FFF;text-decoration:none;" > One Piece< / a > |
< a href = "index.php?as=info/attacken&type=tf" style = "color:#FFF;text-decoration:none;" > Teufelsfrü chte< / a >
< / span >
< / td >
< / tr >
<?php
}
function atksHeaderRasse($type,$link,$fruchttyp) {
?>
< tr >
< td align = "center" bgcolor = "#333333" >
< font color = "#FFFFFF" > < / font > < font color = "#FFFFFF" size = "1" face = "Verdana" > < b >
<?php
if ($type == 'op') {
?>
< a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=7" > Pirat</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=10" > Schwert Kä mpfer</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=11" > Grandline Maschine</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=8" > Shichibukai</ a >< br >
<?php
} elseif ($type == 'db') {
?>
< a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=1" > Mensch</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=2" > Saiyajin</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=3" > Dä mon</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=4" > Mutant</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=5" > Cyborg</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=6" > Namekianer</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> & <?php echo $link ; ?> &rassen=9" > Kaioshin</ a >< br >
<?php
} elseif ($type == 'tf') {
?>
< a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> &fruchttyp=paramecia" > Parameciafrü chte</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> &fruchttyp=zoan" > Zoanfrü chte</ a >
- < a href = "index.php?as=info/attacken&type= <?php echo $type ; ?> &fruchttyp=logia" > Logiafrü chte</ a >
<?php
}
?>
< b > < / font > < font color = "#FFFFFF" > < / font >
< / td >
< / tr >
<?php
if($type == 'tf' and isset($fruchttyp)) {
?>
< tr >
< td align = "center" bgcolor = "#333333" >
< font color = "#FFFFFF" > < / font > < font color = "#FFFFFF" size = "1" face = "Verdana" > < b >
<?php
$condition = getFruchtCondition($fruchttyp);
$tf_query = mysql_query('SELECT * FROM wochen_markt WHERE '.$condition.' 1 ORDER BY item ASC');
$first = true;
while ($tf_array= mysql_fetch_assoc($tf_query)) {
if($first) {
$first = false;
} else {
echo ' - ';
}
echo '< a href = "index.php?as=info/attacken&type='.$type.'&fruchttyp='.$fruchttyp.'&'.$link.'&tf='.$tf_array['id'].'" > '.$tf_array['item'].'< / a > ';
}
?>
< b > < / font > < font color = "#FFFFFF" > < / font >
< / td >
< / tr >
<?php
}
}
function atksHeader($link,$type='',$fruchttyp='') {
?>
< table border = "1" cellspacing = "1" width = "500" bgcolor = "#F8F8F8"
bordercolor="#292929" bordercolordark="#C0C0C0"
bordercolorlight="#C0C0C0">
<?php
atksHeaderType();
atksHeaderRasse($type,$link,$fruchttyp);
?>
< / table >
<?php
}
function getFruchtCondition($fruchttyp) {
switch (strtolower($fruchttyp)) {
case 'paramecia':
case 'zoan':
case 'logia':
return ' kategorie = \''.$fruchttyp.'\' AND ';
default:
return '';
}
}
$type= $_GET['type'];
$fruchttyp= $_GET['fruchttyp'];
$rassen = $_GET['rassen'];
$tf = $_GET['tf'];
$search = $_GET['search'];
$order = $_GET['order'];
$order_art = $_GET['order_art'];
$pagenum = $_GET['pagenum'];
$seiten = $_GET['seiten'];
$last_klick1 = $_GET['last_klick1'];
$p = $_GET['p'];
$at_id = $_GET['at_id'];
if (!isset($pagenum)) {
$pagenum= 0;
}
if (!$order_art) {
$order_art = "asc";
$last_klick = "id";
}
if (!$last_klick1) {
$last_klick1 = 'id';
}
if ($order_art == "asc" AND $last_klick1 == $order) {
$order_art = "desc";
} else {
if ($order_art == "desc" AND $last_klick1 == $order) {
$order_art = "asc";
}
}
$last_klick1 = $order;
if (!empty($rassen)) {
$rassen= $rassen;
} else {
$rassen= '';
}
/*if ($rassen AND $rassen1 != ",") {
$rassen--;
} else {
$rassen = ",";
$rassen1 = 0;
}*/
if ($order) {
$order = "order by $order $order_art";
} else {
$order = "order by frucht,level,id asc";
}
#$rassen1 = $rassen +1;
#$linkz = "seiten=$seiten&order_art=$order_art&last_klick1=$last_klick1&rassen=$rassen1&teufel=$teufel";
if (!empty($type) AND empty($fruchttyp)) {
$linkz = 'type=tf&pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
} elseif (!empty($type) AND !empty($fruchttyp)) {
$linkz = 'type=tf&fruchttyp='.$fruchttyp.'&pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
} else {
$linkz = 'pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
}
$link = "pagenum=$pagenum&order_art=$order_art&last_klick1=$last_klick1";
if ($p) {
if ($_GET['search']) {
$anzahl_atks = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%'"));
if ($anzahl_atks == 1) {
$at_z = mysql_fetch_array(mysql_query("SELECT id FROM attacken WHERE name='".trim($search)."' LIMIT 1"));
if (empty($at_z)) {
$at_z = mysql_fetch_array(mysql_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%' LIMIT 1"));
}
showAttDetails($at_z[id]);
} else {
$linkz = 'p=1&search='.trim($search).'&seiten='.$seiten.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'';
searchAtks();
atksHeader($link,$type,$fruchttyp);
showAtks($linkz,$tf,'',$order,$type,$pagenum,$fruchttyp,trim($search));
}
} elseif (isset($at_id)) {
showAttDetails($at_id);
}
exit;
}
?>
<?php
searchAtks();
atksHeader($link,$type,$fruchttyp);
showAtks($linkz,$tf,$rassen,$order,$type,$pagenum,$fruchttyp);
?>
< / center >
< / div >