#130 Die neuen Rassen werden nun auch unter "Alle Attacken" berücksichtigt.

main
hecht 10 years ago
parent c9b42f6af0
commit bbbd354f95

@ -6,6 +6,8 @@
* *
*/ */
include_once (ROOT_PATH . '//include/config.inc.php'); include_once (ROOT_PATH . '//include/config.inc.php');
include_once (ROOT_PATH . '//include/sqlwrapper.inc.php');
include_once (ROOT_PATH . '//include/rassen.inc.php');
include_once (ROOT_PATH . '//include/designfunctions.inc.php'); include_once (ROOT_PATH . '//include/designfunctions.inc.php');
// TODO: Muss noch angepasst werden! // TODO: Muss noch angepasst werden!
@ -148,6 +150,35 @@ function showAttDetails($at_id) {
<?php <?php
} }
/*
* This method generates a sql statement out of the given paramters
*/
function getAttackenSQLStatement($tf='',$rassen='',$type='', $search='', $colums = 'attacken.*') {
if (!empty($tf) AND is_numeric($tf)) {
return 'SELECT '.$colums.' FROM `attacken` WHERE Frucht='.$tf;
} elseif (!empty($search)) {
return 'SELECT '.$colums.' FROM `attacken` WHERE name LIKE \'%'.$search.'%\' AND info not like \'%npc attacke%\'';
} elseif (empty($rassen)) {
$race_type = getRaceTypeById($type);
$ids = array();
if($race_type !== NULL) {
$races = getRacesByType($race_type);
foreach ($races as $race) {
$ids[] = 'find_in_set(\''.$race['id'].'\', rassen) != 0';
}
return 'SELECT '.$colums.' FROM `attacken` WHERE ('.implode(' OR ', $ids).') AND Frucht is NULL AND info not like \'%npc attacke%\'';
} elseif ($type == -1) { // tfs
$condition = getFruchtCondition($fruchttyp);
return 'SELECT '.$colums.' FROM `attacken` inner join wochen_markt on attacken.frucht = wochen_markt.id WHERE '.$condition.' attacken.info not like \'%npc attacke%\'';
} else {
return 'SELECT '.$colums.' FROM `attacken` WHERE info NOT LIKE \'%npc attacke%\'';
}
} else {
return 'SELECT '.$colums.' FROM `attacken` WHERE find_in_set(\''.$rassen.'\', rassen) != 0 AND Frucht is NULL AND info not like \'%npc attacke%\'';
}
}
function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruchttyp='',$search='') { function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruchttyp='',$search='') {
?> ?>
<table border="1" cellspacing="1" width="500" bgcolor="#FFFFFF" <table border="1" cellspacing="1" width="500" bgcolor="#FFFFFF"
@ -173,33 +204,10 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
<?php <?php
$sql = getAttackenSQLStatement($tf, $rassen, $type, $search);
$sql .= ' '.$order.' LIMIT '.($pagenum * 20).', 20 ';
$attacken = db_query($sql);
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)) { while ($row = mysql_fetch_array($attacken)) {
?> ?>
<tr> <tr>
@ -225,29 +233,8 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
} }
if (!empty($tf) AND is_numeric($tf)) { $row = mysql_fetch_row(db_query(getAttackenSQLStatement($tf, $rassen, $type, $search, 'count(attacken.id)')));
$total = mysql_num_rows(mysql_query('SELECT id FROM attacken WHERE Frucht='.$tf)); $total = $row[0];
} 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); $pages = ceil($total / 20);
$z = 1; $z = 1;
@ -304,14 +291,24 @@ function searchAtks() {
} }
function atksHeaderType() { function atksHeaderType() {
$choseable = array();
$race_types = getRaceTypes();
foreach($race_types as $type) {
if($type['gm_only'] == false) {
$choseable[] = $type;
}
}
$choseable[] = array('name' => 'Teufelsfr&uuml;chte', 'id' => -1);
?> ?>
<tr> <tr>
<td align="center" width="100%" bgcolor="#333333"> <td align="center" width="100%" bgcolor="#333333">
<span style="color:#FFF;font-family:Verdana;font-size:10;font-weight:bold;"> <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" 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> | <?php
<a href="index.php?as=info/attacken&type=op" style="color:#FFF;text-decoration:none;">One Piece</a> | foreach ($choseable as $choice) {
<a href="index.php?as=info/attacken&type=tf" style="color:#FFF;text-decoration:none;">Teufelsfr&uuml;chte</a> echo ' | <a href="index.php?as=info/attacken&type='.$choice['id'].'" style="color:#FFF;text-decoration:none;">'.$choice['name'].'</a>';
}
?>
</span> </span>
</td> </td>
</tr> </tr>
@ -324,36 +321,28 @@ function atksHeaderRasse($type,$link,$fruchttyp) {
<td align="center" bgcolor="#333333"> <td align="center" bgcolor="#333333">
<font color="#FFFFFF">&nbsp;</font><font color="#FFFFFF" size="1" face="Verdana"><b> <font color="#FFFFFF">&nbsp;</font><font color="#FFFFFF" size="1" face="Verdana"><b>
<?php <?php
if ($type == 'op') {
?> $links = array();
<a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=7">Pirat</a> $race_type = getRaceTypeById($type);
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=10">Schwert K&auml;mpfer</a> if($race_type !== NULL) {
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=11">Grandline Maschine</a> $races = getRacesByType($race_type);
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=8">Shichibukai</a><br> foreach ($races as $race) {
<?php $links[] = '<a href="index.php?as=info/attacken&type='.$type.'&'.$link.'&rassen='.$race['id'].'">'.$race['name'].'</a>';
} elseif ($type == 'db') { }
?> } else if($type == -1) { // TF's
<a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=1">Mensch</a> $links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=paramecia">Parameciafr&uuml;chte</a>';
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=2">Saiyajin</a> $links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=zoan">Zoanfr&uuml;chte</a>';
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&<?php echo $link; ?>&rassen=3">D&auml;mon</a> $links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=zoan">Logiafr&uuml;chte</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&uuml;chte</a>
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&fruchttyp=zoan">Zoanfr&uuml;chte</a>
- <a href="index.php?as=info/attacken&type=<?php echo $type; ?>&fruchttyp=logia">Logiafr&uuml;chte</a>
<?php
} }
echo implode(' - ', $links);
?> ?>
<b></font><font color="#FFFFFF"></font> </b></font><font color="#FFFFFF"></font>
</td> </td>
</tr> </tr>
<?php <?php
if($type == 'tf' and isset($fruchttyp)) { if($type == -1 and isset($fruchttyp)) {
?> ?>
<tr> <tr>
<td align="center" bgcolor="#333333"> <td align="center" bgcolor="#333333">
@ -361,7 +350,7 @@ function atksHeaderRasse($type,$link,$fruchttyp) {
<?php <?php
$condition = getFruchtCondition($fruchttyp); $condition = getFruchtCondition($fruchttyp);
$tf_query = mysql_query('SELECT * FROM wochen_markt WHERE '.$condition.' 1 ORDER BY item ASC'); $tf_query = db_query('SELECT * FROM wochen_markt WHERE '.$condition.' 1 ORDER BY item ASC');
$first = true; $first = true;
while ($tf_array= mysql_fetch_assoc($tf_query)) { while ($tf_array= mysql_fetch_assoc($tf_query)) {
if($first) { if($first) {
@ -371,7 +360,6 @@ function atksHeaderRasse($type,$link,$fruchttyp) {
} }
echo '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp='.$fruchttyp.'&'.$link.'&tf='.$tf_array['id'].'">'.$tf_array['item'].'</a>'; 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> <b></font><font color="#FFFFFF"></font>
</td> </td>
@ -458,9 +446,9 @@ if ($order) {
#$rassen1 = $rassen +1; #$rassen1 = $rassen +1;
#$linkz = "seiten=$seiten&order_art=$order_art&last_klick1=$last_klick1&rassen=$rassen1&teufel=$teufel"; #$linkz = "seiten=$seiten&order_art=$order_art&last_klick1=$last_klick1&rassen=$rassen1&teufel=$teufel";
if (!empty($type) AND empty($fruchttyp)) { if (!empty($type) AND empty($fruchttyp)) {
$linkz = 'type=tf&pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel; $linkz = 'type='.$type.'&pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
} elseif (!empty($type) AND !empty($fruchttyp)) { } 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; $linkz = 'type='.$type.'&fruchttyp='.$fruchttyp.'&pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
} else { } else {
$linkz = 'pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel; $linkz = 'pagenum='.$pagenum.'&order_art='.$order_art.'&last_klick1='.$last_klick1.'&rassen='.$rassen.'&teufel='.$teufel;
} }

Loading…
Cancel
Save