radiskull 13 years ago
parent 807faace93
commit 5d691a9697

@ -11,54 +11,55 @@
function displayAttackenMenu($action, $attackname, $attackid, $depth, $name, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $Frucht, $runden, $maxlvl) {
if($action === NULL){
?>
<table>
<table>
<tr>
<th>Attacken</th>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=create">Attacke erstellen</a>
<td><a
href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=create">Attacke
erstellen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=edit">Attacke editieren</a>
<td><a
href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=edit">Attacke
editieren</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke l&ouml;schen</a>
<td><a
href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete">Attacke
l&ouml;schen</a>
</td>
</tr>
<tr>
<th>Attackenset-Conditions</th>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition erstellen</a>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
erstellen</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition editieren</a>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
editieren</a>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition l&ouml;schen</a>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Condition
l&ouml;schen</a>
</td>
</tr>
<tr>
<td>
<br>
<td><br>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</table>
<?php
} else if(($action == 'delete' || $action == 'edit') && $attackname === NULL && $attackid === NULL){
searchfirstAttack($action);
@ -77,45 +78,41 @@ function displayAttackenMenu($action, $attackname, $attackid, $depth, $name, $st
function searchfirstAttack($action) {
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input
name="action" value="<?php echo $action; ?>" type="hidden"></input>
<table>
<tr>
<th colspan="2">Attacke suchen</th>
</tr>
<tr>
<td>
<input name="attackname">
<td><input name="attackname">
</td>
<td>
<input type="submit" name="suche">
<td><input type="submit" name="suche">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
</form>
<?php
}
function searchsecondAttack($action, $attackname) {
$qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\'');
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input
name="action" value="<?php echo $action; ?>" type="hidden"></input>
<?php if($action == 'delete'){ echo '<input name="depth" value="1" type="hidden"></input>'; }?>
<table>
<tr>
<th colspan="2">Attacke ausw&auml;hlen</th>
</tr>
<tr>
<td>
<select name="attackid">
<td><select name="attackid">
<?php
while($row = mysql_fetch_assoc($qry)){
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n';
@ -123,17 +120,15 @@ function searchsecondAttack($action, $attackname) {
?>
</select>
</td>
<td>
<input type="submit" name="ausw&auml;hlen">
<td><input type="submit" name="ausw&auml;hlen">
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
</form>
<?php
}
@ -141,141 +136,182 @@ function createOrEditAttack($action, $attackid) {
if($action == 'edit'){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
}
//Alle attacken auslesen
$att_qry = mysql_query('SELECT id,name FROM attacken WHERE info not like \'%NPC%\' ORDER BY name');
$available_attacks = array();
while($attacks = mysql_fetch_assoc($att_qry)) {
$available_attacks[] = array($attacks['id'], $attacks['name']);
}
$used_attacks = explode(',', $row['req_atk']);
?>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input>
<input name="action" value="<?php echo $action; ?>" type="hidden"></input>
<input name="attackid" value="<?php echo $attackid; ?>" type="hidden"></input>
<form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input
name="action" value="<?php echo $action; ?>" type="hidden"></input> <input
name="attackid" value="<?php echo $attackid; ?>" type="hidden"></input>
<input name="depth" value="1" type="hidden"></input>
<table>
<tr>
<th colspan="2">Attacke</th>
</tr>
<tr>
<td>
ID:
</td>
<td>
<?php echo $attackid; ?>
<td>ID:</td>
<td><?php echo $attackid; ?>
</td>
</tr>
<tr>
<td>
Name:
</td>
<td>
<input name='attackname' value='<?php echo $row['name']===NULL?'Attackenname':$row['name']; ?>'></input>
<td>Name:</td>
<td><input name='attackname'
value='<?php echo $row['name']===NULL?'Attackenname':$row['name']; ?>'></input>
</td>
</tr>
<tr>
<td>
St&auml;rke:
</td>
<td>
<input name='starke' value='<?php echo $row['starke']===NULL?0:$row['starke']; ?>'></input>
<td>St&auml;rke:</td>
<td><input name='starke'
value='<?php echo $row['starke']===NULL?0:$row['starke']; ?>'></input>
</td>
</tr>
<tr>
<td>
Verteidigung:
</td>
<td>
<input name='verteidigung' value='<?php echo $row['verteidigung']===NULL?0:$row['verteidigung']; ?>'></input>
<td>Verteidigung:</td>
<td><input name='verteidigung'
value='<?php echo $row['verteidigung']===NULL?0:$row['verteidigung']; ?>'></input>
</td>
</tr>
<tr>
<td>
Speed:
</td>
<td>
<input name='speed' value='<?php echo $row['speed']===NULL?0:$row['speed']; ?>'></input>
<td>Speed:</td>
<td><input name='speed'
value='<?php echo $row['speed']===NULL?0:$row['speed']; ?>'></input>
</td>
</tr>
<tr>
<td>
HP:
</td>
<td>
<input name='hp' value='<?php echo $row['hp']===NULL?0:$row['hp']; ?>'></input>
<td>HP:</td>
<td><input name='hp'
value='<?php echo $row['hp']===NULL?0:$row['hp']; ?>'></input>
</td>
</tr>
<tr>
<td>
MP:
</td>
<td>
<input name='mp' value='<?php echo $row['mp']===NULL?0:$row['mp']; ?>'></input>
<td>MP:</td>
<td><input name='mp'
value='<?php echo $row['mp']===NULL?0:$row['mp']; ?>'></input>
</td>
</tr>
<tr>
<td>
Rassen:
</td>
<td>
<input name='rassen' value='<?php echo $row['rassen']===NULL?0:$row['rassen']; ?>'></input>
<td>Rassen:</td>
<td><input name='rassen'
value='<?php echo $row['rassen']===NULL?0:$row['rassen']; ?>'></input>
</td>
</tr>
<tr>
<td>
Level:
</td>
<td>
<input name='level' value='<?php echo $row['level']===NULL?0:$row['level']; ?>'></input>
<td>Level:</td>
<td><input name='level'
value='<?php echo $row['level']===NULL?0:$row['level']; ?>'></input>
</td>
</tr>
<tr>
<td>
Geld:
</td>
<td>
<input name='geld' value='<?php echo $row['geld']===NULL?0:$row['geld']; ?>'></input>
<td>Geld:</td>
<td><input name='geld'
value='<?php echo $row['geld']===NULL?0:$row['geld']; ?>'></input>
</td>
</tr>
<tr>
<td>
Type:
</td>
<td>
<input name='type' value='<?php echo $row['type']===NULL?'normal':$row['type']; ?>'></input>
<td>Type:</td>
<td><select name="type">
<?php
$types = array('normal', 'kaioken', 'kaioken2', 'SSJ', 'lose', 'lose2', 'hpmp', 'hp', 'tausch', 'tausch2', 'majin', 'copy', 'runde', 'frucht', 'konterhp');
foreach ($types as $type) {
if($row['type'] == $type){
echo '<option value="'.$type.'" selected="selected">'.$type.'</option>';
} else{
echo '<option value="'.$type.'">'.$type.'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
Info:
</td>
<td>
<input name='info' value='<?php echo $row['info']===NULL?'No Info available yet!':$row['info']; ?>'></input>
<td>Info:</td>
<td><input name='info'
value='<?php echo $row['info']===NULL?'No Info available yet!':$row['info']; ?>'></input>
</td>
</tr>
<tr>
<td>
Required Attacks:
</td>
<td>
<input name='req_atk' value='<?php echo $row['req_atk']===NULL?0:$row['req_atk']; ?>'></input>
<td>Required Attacks:</td>
<td><select name="req_atk[0]">
<?php
if($used_attacks[0] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[0]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
Required Level:
<td></td>
<td><select name="req_atk[1]">
<?php
if($used_attacks[1] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[1]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td>
<td>
<input name='req_lvl' value='<?php echo $row['req_lvl']===NULL?0:$row['req_lvl']; ?>'></input>
</tr>
<tr>
<td></td>
<td><select name="req_atk[2]">
<?php
if($used_attacks[2] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
echo '<option value="0">-Keine-</option>';
}
foreach ($available_attacks as $attack) {
if($attack[0] == $used_attacks[2]){
echo '<option value="'.$attack[0].'" selected="selected">'.$attack[1].'</option>';
} else{
echo '<option value="'.$attack[0].'">'.$attack[1].'</option>';
}
}
?>
</select>
</td>
</tr>
<tr>
<td>
Frucht:
<td>Required Level:</td>
<td><input name='req_lvl'
value='<?php echo $row['req_lvl']===NULL?0:$row['req_lvl']; ?>'></input>
</td>
<td>
<select name = "Frucht">
</tr>
<tr>
<td>Frucht:</td>
<td><select name="Frucht">
<?php
// Fuers dropdown
$f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item';
$f_qry = mysql_query($f_sql);
// <input name='Frucht' value='<?php echo $row[Frucht]===NULL?0:$row[Frucht]; '></input>
// <input name='Frucht' value='<?php echo $row[Frucht]===NULL?0:$row[Frucht]; '></input>
if($row['Frucht'] === NULL || $row['Frucht'] == 0){
echo '<option value="0" selected="selected">-Keine-</option>';
} else {
@ -294,33 +330,27 @@ function createOrEditAttack($action, $attackid) {
</td>
</tr>
<tr>
<td>
Runden:
</td>
<td>
<input name='runden' value='<?php echo $row['runden']===NULL?0:$row['runden']; ?>'></input>
<td>Runden:</td>
<td><input name='runden'
value='<?php echo $row['runden']===NULL?0:$row['runden']; ?>'></input>
</td>
</tr>
<tr>
<td>
Maxlvl:
</td>
<td>
<input name='maxlvl' value='<?php echo $row['maxlvl']===NULL?0:$row['maxlvl']; ?>'></input>
<td>Maxlvl:</td>
<td><input name='maxlvl'
value='<?php echo $row['maxlvl']===NULL?0:$row['maxlvl']; ?>'></input>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value='<?php echo $action; ?>'></input>
<td colspan="2"><input type="submit" value='<?php echo $action; ?>'></input>
</td>
</tr>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br>
</td>
</tr>
</table>
</form>
</form>
<?php
}
@ -333,14 +363,19 @@ function createAttack($attackname, $Frucht, $starke, $verteidigung, $speed, $hp,
echo $sql.'<br>';
mysql_query($sql);
logaction('Attacke '.$attackname.' wurde erstellt!');
?>Attacke sollte nun erstellt sein!!<br><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
?>
Attacke sollte nun erstellt sein!!
<br>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<br>
<?php
}
function deleteAttack($attackid, $depth) {
if($depth == 4){
$sql = 'Delete from attacken where id = '.$attackid;
// echo 'Debugnachricht: '.$sql.'<br>';
// echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql);
mysql_query('Delete from lernen where at_id = '.$attackid);
logaction('Attacke mit id = '.$attackid.' wurde geloescht!');
@ -349,13 +384,25 @@ function deleteAttack($attackid, $depth) {
for($i=0;$i<$depth;$i++){
$wirklich .= 'wirklich ';
}
?>Sind sie sich <?php echo $wirklich; ?> sicher?? <a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete&attackid=<?php echo $attackid; ?>&depth=<?php echo $depth+1; ?>">ja</a><br><?php
?>
Sind sie sich
<?php echo $wirklich; ?>
sicher??
<a
href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken&action=delete&attackid=<?php echo $attackid; ?>&depth=<?php echo $depth+1; ?>">ja</a>
<br>
<?php
}
?><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<br>
<?php
}
function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) {
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid));
$req_atk = implode(',', $req_atk);
if($Frucht != 0){
$sql = 'UPDATE attacken set name = \''.htmlspecialchars(urldecode($attackname)).'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = '.$Frucht.', runden = '.$runden.', maxlvl = '.$maxlvl.' where id = '.$attackid;
} else {
@ -364,11 +411,17 @@ function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $sp
if($row['name'] != $attackname){
mysql_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid);
}
// echo 'Debugnachricht: '.$sql.'<br>';
// echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql);
logaction('Attacke mit dem jetzigen Namen '.$attackname.' wurde editiert!');
?><a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Zum Attackenmenü</a>, <a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a><br><?php
?>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?choose=attacken">Zum
Attackenmenü</a>
,
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
<br>
<?php
}

Loading…
Cancel
Save