Bug beseitigt beim Usergruppen-User-Anzeige (es wird jetzt der gesuchte Name angezeigt)

Charaktererstellung überarbeitet
Testchars sind nun erstellbar (getChar() wurde überladen)
main
radiskull 13 years ago
parent b4e6a33216
commit 7c60ccf2d6

@ -16,6 +16,8 @@ include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/erstellfunctions.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/erstellfunctions.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/usergroup.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/exp.inc.php');
// GET-Section // GET-Section
@ -23,9 +25,13 @@ include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
$char_name = validateName($_GET['char_name']); $char_name = validateName($_GET['char_name']);
$char_1_type = validateString($_GET['char_1_Type']); $char_1_type = validateString($_GET['char_1_Type']);
$char_bild = validateURL($_GET['char_bild']); $char_bild = validateURL($_GET['char_bild']);
$char_lvl = validateInteger($_GET['char_lvl'], NULL);
// Unkritisch // Unkritisch
$charm = $_GET['charm']; if($_POST['charm'] === NULL) {
$charm = $_GET['charm'];
} else
$charm = $_POST['charm'];
$char_type = $_GET['char_type']; $char_type = $_GET['char_type'];
?> ?>
@ -47,116 +53,277 @@ function isAPhoneNumber(){
--> -->
</SCRIPT> </SCRIPT>
<?php <?php
//if($charm == 2) { //if($charm == 2) {
// $user_ida, $char_1_Type, $char_name // $user_ida, $char_1_Type, $char_name
function handleErstelleCharRequest($user, $type, $name, $bild){ function handleErstelleCharRequest($user, $type, $name, $bild){
if($type != 'Mensch' && $type != 'Saiyajin' && $type != 'Dämon' && $type != 'Mutant' && $type != 'Cyborg' && $type != 'Namekianer' && $type != 'Pirat' && $type != 'Schwertkämpfer' && $type != 'Grandline Maschine'){ if($type != 'Mensch' && $type != 'Saiyajin' && $type != 'Dämon' && $type != 'Mutant' && $type != 'Cyborg' && $type != 'Namekianer' && $type != 'Pirat' && $type != 'Schwertkämpfer' && $type != 'Grandline Maschine'){
displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink()); displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink());
return; return;
} }
if(erstelleChar($user, $type, $name,$bild)){ if(erstelleChar($user, $type, $name, $bild)){
displayErrorMessage('&Auml;nderungen &uuml;bernommen','','<a href="index.php?as=char">weiter</a>'); displayErrorMessage('&Auml;nderungen &uuml;bernommen','','<a href="index.php?as=char">weiter</a>');
} }
}
function handleErstelleCharRequestOfTestUser($user, $type, $name, $bild, $lvl, $lp, $hp, $mp, $str, $def, $spd, $end, $lck){
//stats auf numeric prüfen!
if($type != 'Mensch' && $type != 'Saiyajin' && $type != 'Dämon' && $type != 'Mutant' && $type != 'Cyborg' &&
$type != 'Namekianer' && $type != 'Pirat' && $type != 'Schwertkämpfer' && $type != 'Grandline Maschine' && $type != 'Kaioshin' && $type != 'Shichibukai'){
displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink());
return;
}
if(!is_numeric($hp) || !is_numeric($mp) || !is_numeric($str) || !is_numeric($def) || !is_numeric($spd) || !is_numeric($end) || !is_numeric($lck)) {
displayErrorMessage(NULL,'Ungültige Eingabe bei den Stats!',displayHistoryBackLink());
return;
}
if($lp <= ($hp+$mp+$str+$def+$spd+$end+$lck)) {
displayErrorMessage(NULL,'Es wurden mehr Lernpunkte ausgegeben als eigentlich möglich!',displayHistoryBackLink());
return;
}
$lp -= ($hp+$mp+$str+$def+$spd+$end+$lck);
if(erstelleChar($user, $type, $name, $bild, $lvl, $lp, $hp, $mp, $str, $def, $spd, $end, $lck)){
displayErrorMessage('&Auml;nderungen &uuml;bernommen','','<a href="index.php?as=char">weiter</a>');
}
} }
//if($charm !== NULL) { //if($charm !== NULL) {
function handleSecondPhase($type, $name){ function handleSecondPhase($type, $name){
?> ?>
<form action="index.php" method="get"> <form action="index.php" method="get">
<input type="hidden" name="as" value="char"> <input type="hidden" name="as" value="char"> <input type="hidden"
<input type="hidden" name="charm" value="2"> name="charm" value="2"> <input type="hidden" name="char_name"
<input type="hidden" name="char_name" value="<?php echo $name; ?>"> value="<?php echo $name; ?>">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="20"> <table border="0" cellpadding="0" cellspacing="0"
<tr> style="border-collapse: collapse" bordercolor="#111111" width="100%"
<th colspan="2" align="center">Charakter erstellen (2/2)</th> height="20">
</tr> <tr>
<tr> <th colspan="2" align="center">Charakter erstellen (2/2)</th>
<th align="left">Rasse:</td> </tr>
<td> <tr>
<select id="input" name="char_1_Type"> <th align="left">Rasse:</th>
<?php <td><select id="input" name="char_1_Type">
if($type == 'Dragonball') { <?php
?> if($type == 'Dragonball') {
<option value="Mensch">Mensch</option> ?>
<option value="Saiyajin">Saiyajin</option> <option value="Mensch">Mensch</option>
<option value="Dämon">D&auml;mon</option> <option value="Saiyajin">Saiyajin</option>
<option value="Mutant">Mutant</option> <option value="Dämon">D&auml;mon</option>
<option value="Cyborg">Cyborg</option> <option value="Mutant">Mutant</option>
<option value="Namekianer">Namekianer</option> <option value="Cyborg">Cyborg</option>
<?php <option value="Namekianer">Namekianer</option>
} else if($type == 'Onepiece') { <?php
?> } else if($type == 'Onepiece') {
<option value="Pirat">Pirat</option> ?>
<option value="Schwertkämpfer">Schwertk&auml;mpfer</option> <option value="Pirat">Pirat</option>
<option value="Grandline Maschine">Grandline Maschine</option> <option value="Schwertkämpfer">Schwertk&auml;mpfer</option>
<?php <option value="Grandline Maschine">Grandline Maschine</option>
} else{ <?php
?> } else{
<option value="Cheater">Cheater</option> ?>
<?php <option value="Cheater">Cheater</option>
} <?php
?> }
</select> ?>
</td> </select>
</tr> </td>
<tr> </tr>
<th align="left">Charakter Bild (75x75):</th> <tr>
<td> <th align="left">Charakter Bild (75x75):</th>
<input name="char_bild" id="input"> <td><input name="char_bild" id="input">
</td> </td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td> <td><input id="input" type=submit value="weiter">
<input id="input" type=submit value="weiter"> </td>
</td> </tr>
</tr> </table>
</table>
</form> </form>
<?php <?php
} }
function handleSecondPhaseForTester($type, $name){
?>
<form action="index.php" method="GET">
<input type="hidden" name="as" value="char">
<input type="hidden" name="charm" value="3">
<input type="hidden" name="char_name" value="<?php echo $name; ?>">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
height="20">
<tr>
<th colspan="2" align="center">Charakter erstellen (2/3)</th>
</tr>
<tr>
<th align="left">Rasse:</th>
<td><select id="input" name="char_1_Type">
<?php
if($type == 'Dragonball') {
?>
<option value="Mensch">Mensch</option>
<option value="Saiyajin">Saiyajin</option>
<option value="Dämon">D&auml;mon</option>
<option value="Mutant">Mutant</option>
<option value="Cyborg">Cyborg</option>
<option value="Namekianer">Namekianer</option>
<option value="Kaioshin">Kaioshin</option>
<?php
} else if($type == 'Onepiece') {
?>
<option value="Pirat">Pirat</option>
<option value="Schwertkämpfer">Schwertk&auml;mpfer</option>
<option value="Grandline Maschine">Grandline Maschine</option>
<option value="Shichibukai">Shichibukai</option>
<?php
} else{
?>
<option value="Cheater">Cheater</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<th align="left">Charakter Bild (75x75):</th>
<td><input name="char_bild" id="input">
</td>
</tr>
<tr>
<th align="left">Level(1-150): </th>
<td><input name="char_lvl" id="input">
</td>
</tr>
<tr>
<td></td>
<td><input id="input" type=submit value="weiter">
</td>
</tr>
</table>
</form>
<?php
}
function handleThirdPhaseForTester($type, $name, $char_lvl){
if(($char_lvl >= 1 && $char_lvl <= 150) && $char_lvl !== NULL && is_numeric($char_lvl)) {
$lp = 0;
for ($i = 1; $i < $char_lvl; $i++) {
$lp += calculateTrainingPoints($i);
}
$lp = round($lp / 2);
?>
<form action="index.php" method="POST">
<input type="hidden" name="as" value="char">
<input type="hidden" name="charm" value="4">
<input type="hidden" name="char_type" value="<?php echo $type; ?>">
<input type="hidden" name="char_name" value="<?php echo $name; ?>">
<input type="hidden" name="lvl" value="<?php echo $char_lvl; ?>">
<input type="hidden" name="lp" value="<?php echo $lp; ?>">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="100%"
height="20">
<tr>
<th colspan="2" align="center">Charakter erstellen (3/3)</th>
</tr>
<tr>
<th align="left">CharakterTyp: </th>
<td><?php echo $type;?> </td>
</tr>
<tr>
<th align="left">Charakterlevel: </th>
<td><?php echo $char_lvl;?> </td>
</tr>
<tr>
<th align="left">verfügbare LP: </th>
<td><?php echo $lp?></td>
</tr>
<tr>
<th align="left">HP (1LP = 20HP): </th>
<td><input name="hp" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">MP (1LP = 10MP): </th>
<td><input name="mp" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">St&auml;rke: </th>
<td><input name="str" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">Verteidigung: </th>
<td><input name="def" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">Geschwindigkeit: </th>
<td><input name="spd" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">Ausdauer: </th>
<td><input name="end" value = "0" id="input">
</td>
</tr>
<tr>
<th align="left">Glück: </th>
<td><input name="lck" value = "0" id="input">
</td>
</tr>
<tr>
<td></td>
<td><input id="input" type=submit value="weiter">
</td>
</tr>
</table>
</form>
<?php } else
echo 'Ungültiger Levelbereich!';
}
function handleFirstPhase(){ function handleFirstPhase(){
?> ?>
<form action="index.php" method="get" name="charz" onsubmit="return isAPhoneNumber()"> <form action="index.php" method="get" name="charz"
<input type="hidden" name="as" value="char"> onsubmit="return isAPhoneNumber()">
<input type="hidden" name="charm" value="1"> <input type="hidden" name="as" value="char"> <input type="hidden"
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="25"> name="charm" value="1">
<tr> <table border="0" cellpadding="0" cellspacing="0"
<th colspan="2" align="center">Charakter Erstellen (1/2)</th> style="border-collapse: collapse" bordercolor="#111111" width="100%"
</tr> height="25">
<tr> <tr>
<th align="center">Charaktername</th> <th colspan="2" align="center">Charakter Erstellen (1/2)</th>
<td> </tr>
<input id="input" name="char_name" size="20"></input> (Buchstaben) <tr>
</td> <th align="center">Charaktername</th>
</tr> <td><input id="input" name="char_name" size="20"></input>
<tr> (Buchstaben)</td>
<th align="center">Type</th> </tr>
<td> <tr>
<select id="input" name="char_type"> <th align="center">Type</th>
<option value="Dragonball">Dragonball</option> <td><select id="input" name="char_type">
<option value="Onepiece">Onepiece</option> <option value="Dragonball">Dragonball</option>
</select> <option value="Onepiece">Onepiece</option>
</td> </select>
</tr> </td>
<tr> </tr>
<td></td> <tr>
<td><input id="input" type="submit" value="weiter"></td> <td></td>
</tr> <td><input id="input" type="submit" value="weiter"></td>
</table> </tr>
</table>
</form> </form>
<?php <?php
} }
$user_daten= mysql_fetch_assoc(mysql_query("SELECT char_max, id FROM user WHERE nickname='".$_COOKIE[name]."' LIMIT 1")); $user_daten= mysql_fetch_assoc(mysql_query("SELECT char_max, id FROM user WHERE nickname='".$_COOKIE['name']."' LIMIT 1"));
$anzahl_spezialchars = mysql_num_rows(mysql_query('SELECT char_type,name from chars WHERE (rasse = "Kaioshin" OR fusion_rasse = "Kaioshin" OR rasse = "Shichibukai" OR fusion_rasse = "Shichibukai") AND besitzer='.$user_daten['id'])); $anzahl_spezialchars = mysql_num_rows(mysql_query('SELECT char_type,name from chars WHERE (rasse = "Kaioshin" OR fusion_rasse = "Kaioshin" OR rasse = "Shichibukai" OR fusion_rasse = "Shichibukai") AND besitzer='.$user_daten['id']));
$anzahl_charactere= mysql_num_rows(mysql_query("SELECT id FROM chars WHERE besitzer='".$user_daten[id]."'")); $anzahl_charactere= mysql_num_rows(mysql_query("SELECT id FROM chars WHERE besitzer='".$user_daten['id']."'"));
if ($anzahl_spezialchars >= 1 AND $user_daten['char_max'] == 7) { if ($anzahl_spezialchars >= 1 AND $user_daten['char_max'] == 7) {
$chars_max= 8; $chars_max= 8;
@ -165,15 +332,23 @@ if ($anzahl_spezialchars >= 1 AND $user_daten['char_max'] == 7) {
} }
if ($anzahl_charactere < $chars_max) { if ($anzahl_charactere < $chars_max) {
if($charm === NULL){ if($charm === NULL){
handleFirstPhase($user_daten,$anzahl_charactere); handleFirstPhase($user_daten,$anzahl_charactere);
} else if($charm == 1){ } else if($charm == 1){
handleSecondPhase($char_type, $char_name); if(isUserInGroup($usergroups, tester)) {
} else if($charm == 2){ handleSecondPhaseForTester($char_type, $char_name);
handleErstelleCharRequest($user_ida, $char_1_type, $char_name, $char_bild); } else {
} handleSecondPhase($char_type, $char_name);
}
} else if($charm == 2){
handleErstelleCharRequest($user_ida, $char_1_type, $char_name, $char_bild);
} else if($charm == 3) {
handleThirdPhaseForTester($char_1_type, $char_name, $char_lvl);
} else if($charm == 4) {
handleErstelleCharRequestOfTestUser($user_ida, $_POST['char_type'], $_POST['char_name'], $_POST['char_bild'], $_POST['lvl'], $_POST['lp'], $_POST['hp'], $_POST['mp'], $_POST['str'], $_POST['def'], $_POST['spd'], $_POST['end'], $_POST['lck']);
}
} else { } else {
echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.<br />Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.'; echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.<br />Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.';
} }

@ -243,7 +243,7 @@ if(checkLoginData($_SESSION['user'],$_SESSION['password'])){
displayShop($_REQUEST['action'], $_REQUEST['s_id'],$_REQUEST['info'], $_REQUEST['s_name'] , $_REQUEST['s2_name'], $_REQUEST['s3_name'], $_REQUEST['s_typ'], $_REQUEST['preis'], $_REQUEST['frei'], $_REQUEST['anzahl']); displayShop($_REQUEST['action'], $_REQUEST['s_id'],$_REQUEST['info'], $_REQUEST['s_name'] , $_REQUEST['s2_name'], $_REQUEST['s3_name'], $_REQUEST['s_typ'], $_REQUEST['preis'], $_REQUEST['frei'], $_REQUEST['anzahl']);
} else if($_REQUEST['choose'] == 'usergroups'){ } else if($_REQUEST['choose'] == 'usergroups'){
//displayUserGroups($_REQUEST['action'], $_REQUEST['uname']); //displayUserGroups($_REQUEST['action'], $_REQUEST['uname']);
displayUserGroups($_REQUEST['action'] ,$_REQUEST['name'] ,$_REQUEST['ugname'], $_REQUEST['delete'], $_REQUEST['add']); displayUserGroups($_REQUEST['action'] ,$_REQUEST['uname'] ,$_REQUEST['ugname'], $_REQUEST['delete'], $_REQUEST['add']);
} else { } else {
displayOptions(); displayOptions();
} }

@ -36,7 +36,7 @@ function getOtherUserGroups($user) {
} }
function displayUserGroups($action, $name, $ugname, $delete, $add) { function displayUserGroups($action, $name, $ugname, $delete, $add) {
if($action === 'search') { if($action === 'search') {
$username = validateName($name); $username = validateName($name);
if ($delete !== NULL && $delete >= 0) { if ($delete !== NULL && $delete >= 0) {
$qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username. $qry = 'DELETE FROM user_gruppe_zuordnung WHERE user_id in (SELECT id FROM user WHERE nickname = \''.$username.
@ -48,8 +48,8 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
mysql_query($qry); mysql_query($qry);
} }
$usergroups = getUserGroups($name); $usergroups = getUserGroups($username);
$notusergroups = getOtherUserGroups($name); $notusergroups = getOtherUserGroups($username);
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
@ -123,8 +123,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
<tr> <tr>
<td colspan="3"> <td colspan="3">
<table border="1" width="100%"> <table border="1" width="100%">
<?php <?php
$count = ceil(mysql_num_rows($usergroups_qry) / 4);
echo '<tr>'; echo '<tr>';
$x = 0; $x = 0;
while($row = mysql_fetch_assoc($usergroups_qry)){ while($row = mysql_fetch_assoc($usergroups_qry)){
@ -163,7 +162,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
<th align="center" colspan="3">User suchen</th> <th align="center" colspan="3">User suchen</th>
</tr> </tr>
<tr> <tr>
<td align="center">Username: <input name="name" value="" /> <td align="center">Username: <input name="uname" value="" />
<input type="submit" value="search" /> <input type="submit" value="search" />
</td> </td>
</tr> </tr>
@ -192,7 +191,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
} }
}?> }?>

@ -19,6 +19,7 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/speed_config.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/online.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/online.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/parse.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/user.inc.php'); include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/user.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/usergroup.inc.php');
// Referer statistics (no use for this in the moment) // Referer statistics (no use for this in the moment)
//$rs = strpos($_SERVER['HTTP_REFERER'],'//'); //$rs = strpos($_SERVER['HTTP_REFERER'],'//');
@ -43,8 +44,10 @@ $passwort = validateString($_COOKIE['passwort']);
if(!checkCookiePassword($name, $passwort)){ if(!checkCookiePassword($name, $passwort)){
$POLOE = 1; $POLOE = 1;
$user_ida = array(); $user_ida = array();
$usergroups = array();
} else { } else {
$user_ida = mysql_fetch_assoc(mysql_query("SELECT * FROM user WHERE nickname='$name' LIMIT 1")); $user_ida = mysql_fetch_assoc(mysql_query("SELECT * FROM user WHERE nickname='$name' LIMIT 1"));
$usergroups = getUserGroups($name);
mysql_query('UPDATE user SET ip=\'' . $_SERVER['REMOTE_ADDR'] . '\', online_zeit=now() WHERE id='.$user_ida['id']); mysql_query('UPDATE user SET ip=\'' . $_SERVER['REMOTE_ADDR'] . '\', online_zeit=now() WHERE id='.$user_ida['id']);
if ($online_rekord_1_0['anzahl'] < $online_r) { if ($online_rekord_1_0['anzahl'] < $online_r) {
mysql_query('UPDATE online SET anzahl='.$online_r.', datum=now() WHERE id=1'); mysql_query('UPDATE online SET anzahl='.$online_r.', datum=now() WHERE id=1');

@ -15,14 +15,14 @@ include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/exp.inc.php'); include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/exp.inc.php');
function erstelleUser(){ function erstelleUser(){
// TODO: Imlementierung // TODO: Imlementierung
} }
// Muss aus einem sicheren Kontext gestartet werden // Muss aus einem sicheren Kontext gestartet werden
function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){ function erstelleChar($user, $specialcharname, $newname = '', $picture = '', $lvl = 1, $lp = 0, $hp = 0, $mp = 0, $str = 0, $def = 0, $spd = 0, $end = 0, $lck = 0){
// If-Anweisungen muessen noch durch Datenbankabfragen ersetzt werden // If-Anweisungen muessen noch durch Datenbankabfragen ersetzt werden
$type = ''; $type = '';
$trainingspoints = 0; $trainingspoints = 0;
@ -35,7 +35,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
displayErrorMessage(NULL,'Name ist nicht erlaubt!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Name ist nicht erlaubt!!',displayHistoryBackLink());
return false; return false;
} }
if($specialcharname == 'Mensch') { if($specialcharname == 'Mensch') {
$HP = 150; $HP = 150;
$MP = 30; $MP = 30;
@ -63,7 +63,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
$Gluck = 0; $Gluck = 0;
$Ausdauer = 9; $Ausdauer = 9;
$type = $dbz; $type = $dbz;
} else if($specialcharname == 'Mutant') { } else if($specialcharname == 'Mutant') {
$HP = 180; $HP = 180;
$MP = 15; $MP = 15;
$Starke = 13; $Starke = 13;
@ -72,7 +72,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
$Gluck = 4; $Gluck = 4;
$Ausdauer = 5; $Ausdauer = 5;
$type = $dbz; $type = $dbz;
} else if($specialcharname == 'Cyborg') { } else if($specialcharname == 'Cyborg') {
$HP = 250; $HP = 250;
$MP = 20; $MP = 20;
$Starke = 11; $Starke = 11;
@ -137,9 +137,9 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
$Geschwindigkeit = 100; $Geschwindigkeit = 100;
$Gluck = 100; $Gluck = 100;
$Ausdauer = 100; $Ausdauer = 100;
$type = $specialcharname; //$type = $specialcharname; <-- wird überschrieben?!
$trainingspoints = 500; $trainingspoints = 500;
$special_char = true; $special_char = true;
$type = $op; $type = $op;
$c_type = $specialcharname; $c_type = $specialcharname;
} else { } else {
@ -148,6 +148,26 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
} }
// If-Anweisungen ende // If-Anweisungen ende
// Werte hinzufügen, falls ein Testcharakter erstellt wird
$HP += ($hp*20);
$MP += ($mp*10);
$Starke += $str;
$Verteidigung += $def;
$Geschwindigkeit += $spd;
$Gluck += $lck;
$Ausdauer += $end;
$trainingspoints += $lp*2;
echo 'HP:'.$HP.'<br>';
echo 'HP:'.$MP.'<br>';
echo 'STR:'.$Starke.'<br>';
echo 'DEF:'.$Verteidigung.'<br>';
echo 'SPD:'.$Geschwindigkeit.'<br>';
echo 'LCK:'.$Gluck.'<br>';
echo 'END:'.$Ausdauer.'<br>';
echo 'TP:'.$trainingspoints.'<br>';
echo 'LVL:'.$lvl.'<br>';
// Ueberprüfe ob ein Slot frei ist // Ueberprüfe ob ein Slot frei ist
$chars = getCharsOfUser($user['id']); $chars = getCharsOfUser($user['id']);
$normal = 0; $normal = 0;
@ -165,14 +185,14 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
} else{ } else{
$slots_used = $normal + $special - 1; $slots_used = $normal + $special - 1;
} }
// echo 'Slots used: '.$slots_used.'<br>Slots available: '.$slots_avail.'<br>'; // echo 'Slots used: '.$slots_used.'<br>Slots available: '.$slots_avail.'<br>';
if($slots_used >= $user['char_max']){ if($slots_used >= $user['char_max']){
displayErrorMessage(NULL,'Alle Slots sind schon belegt!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Alle Slots sind schon belegt!!',displayHistoryBackLink());
return false; return false;
} }
// Slotüberprüfung beendet! // Slotüberprüfung beendet!
echo 'Slotüberprüfung abgeschlossen!<br>';
$sql = 'Insert into chars(name, starke, verteidigung, speed, glueck, ausdauer, hp, mp, level, type, rasse, besitzer, char_type, training_points, lernpunkte, bild, exp) ' . $sql = 'Insert into chars(name, starke, verteidigung, speed, glueck, ausdauer, hp, mp, level, type, rasse, besitzer, char_type, training_points, lernpunkte, bild, exp) ' .
'values(\''.$newname.'\',' . 'values(\''.$newname.'\',' .
' '.$Starke.',' . ' '.$Starke.',' .
@ -182,7 +202,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
' '.$Ausdauer.',' . ' '.$Ausdauer.',' .
' \''.$HP.','.$HP.'\',' . ' \''.$HP.','.$HP.'\',' .
' \''.$MP.','.$MP.'\',' . ' \''.$MP.','.$MP.'\',' .
' 1,' . ' '.$lvl.',' .
' \''.$type.'\',' . ' \''.$type.'\',' .
' \''.$specialcharname.'\',' . ' \''.$specialcharname.'\',' .
' '.$user['id'].',' . ' '.$user['id'].',' .
@ -190,26 +210,27 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = ''){
' '.$trainingspoints.',' . ' '.$trainingspoints.',' .
' 0, ' . ' 0, ' .
'\''.$picture.'\', '. '\''.$picture.'\', '.
'\'0,'.calculateRequiredExpChars(1).'\'' . '\'0,'.calculateRequiredExpChars($lvl).'\'' .
')'; ')';
// echo $sql.'<br>'; echo $sql.'<br>';
$identifier = mysql_query($sql); $identifier = mysql_query($sql);
echo $identifier;
if($identifier == FALSE){ if($identifier == FALSE){
if(mysql_fetch_assoc(mysql_query('Select * from chars where name = \''.$newname.'\''))){ if(mysql_fetch_assoc(mysql_query('Select * from chars where name = \''.$newname.'\''))){
displayErrorMessage(NULL,'Name schon vorhanden!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Name schon vorhanden!!',displayHistoryBackLink());
} else{ } else{
displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink());
} }
return false; // Hat nich geklappt return false; // Hat nich geklappt
} }
$charsw_id = mysql_fetch_assoc(mysql_query('SELECT id FROM chars WHERE name=\''.$newname.'\'')); $charsw_id = mysql_fetch_assoc(mysql_query('SELECT id FROM chars WHERE name=\''.$newname.'\''));
mysql_query('INSERT lernen SET at_id=1, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Schlag\', dauer=0'); mysql_query('INSERT lernen SET at_id=1, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Schlag\', dauer=0');
mysql_query('INSERT lernen SET at_id=2, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Kick\', dauer=0'); mysql_query('INSERT lernen SET at_id=2, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Kick\', dauer=0');
mysql_query('INSERT lernen SET at_id=3, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Block\', dauer=0'); mysql_query('INSERT lernen SET at_id=3, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Block\', dauer=0');
return true; // Hat geklappt return true; // Hat geklappt
} }
?> ?>

@ -39,9 +39,9 @@ function getUserGroups($user) {
return $groups; return $groups;
} }
function isUserInGroup($usergroup, $group) { function isUserInGroup($usergrouparray, $group) {
for($i = 0; $i < count($usergroup); $i++) { for($i = 0; $i < count($usergrouparray); $i++) {
if(in_array($group, $usergroup[$i])) { if($usergrouparray[$i]['gruppen_id'] == $group) {
return true; return true;
} }
} }

Loading…
Cancel
Save