#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/sqlwrapper.inc.php');
include_once (ROOT_PATH . '//include/rassen.inc.php');
include_once (ROOT_PATH . '//include/designfunctions.inc.php');
// TODO: Muss noch angepasst werden!
@ -148,6 +150,35 @@ function showAttDetails($at_id) {
<?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='') {
?>
<table border="1" cellspacing="1" width="500" bgcolor="#FFFFFF"
@ -173,33 +204,10 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
<?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)) {
?>
<tr>
@ -225,29 +233,8 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
}
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%' "));
}
}
$row = mysql_fetch_row(db_query(getAttackenSQLStatement($tf, $rassen, $type, $search, 'count(attacken.id)')));
$total = $row[0];
$pages = ceil($total / 20);
$z = 1;
@ -304,14 +291,24 @@ function searchAtks() {
}
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>
<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&uuml;chte</a>
<a href="index.php?as=info/attacken" style="color:#FFF;text-decoration:none;">Alle Attacken</a>
<?php
foreach ($choseable as $choice) {
echo ' | <a href="index.php?as=info/attacken&type='.$choice['id'].'" style="color:#FFF;text-decoration:none;">'.$choice['name'].'</a>';
}
?>
</span>
</td>
</tr>
@ -324,54 +321,45 @@ function atksHeaderRasse($type,$link,$fruchttyp) {
<td align="center" bgcolor="#333333">
<font color="#FFFFFF">&nbsp;</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&auml;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&auml;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&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
$links = array();
$race_type = getRaceTypeById($type);
if($race_type !== NULL) {
$races = getRacesByType($race_type);
foreach ($races as $race) {
$links[] = '<a href="index.php?as=info/attacken&type='.$type.'&'.$link.'&rassen='.$race['id'].'">'.$race['name'].'</a>';
}
} else if($type == -1) { // TF's
$links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=paramecia">Parameciafr&uuml;chte</a>';
$links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=zoan">Zoanfr&uuml;chte</a>';
$links[] = '<a href="index.php?as=info/attacken&type='.$type.'&fruchttyp=zoan">Logiafr&uuml;chte</a>';
}
echo implode(' - ', $links);
?>
<b></font><font color="#FFFFFF"></font>
</b></font><font color="#FFFFFF"></font>
</td>
</tr>
<?php
if($type == 'tf' and isset($fruchttyp)) {
if($type == -1 and isset($fruchttyp)) {
?>
<tr>
<td align="center" bgcolor="#333333">
<font color="#FFFFFF">&nbsp;</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>';
}
$condition = getFruchtCondition($fruchttyp);
$tf_query = db_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>
@ -458,9 +446,9 @@ if ($order) {
#$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;
$linkz = 'type='.$type.'&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;
$linkz = 'type='.$type.'&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;
}

Loading…
Cancel
Save