replaced the check for determining if there are enough slots available.

main
hecht 10 years ago
parent 1f57c0768a
commit 5db0542833

@ -330,7 +330,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
echo 'Ungültiger Levelbereich!'; echo 'Ungültiger Levelbereich!';
} }
function handleFirstPhase($user_daten,$anzahl_charactere,$tester){ function handleFirstPhase($user_daten, $tester){
?> ?>
<form action="index.php" method="get" name="charz" <form action="index.php" method="get" name="charz"
onsubmit="return isAPhoneNumber()"> onsubmit="return isAPhoneNumber()">
@ -399,18 +399,12 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
} }
} }
#$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']."'"));
if ($anzahl_spezialchars >= 1 AND $user_daten['char_max'] == 7) { $check = hasUserFreeCharSlot($user_daten);
$chars_max= 8;
} else {
$chars_max= $user_daten['char_max'];
}
if ($anzahl_charactere < $chars_max) { if ($check) {
if($charm === NULL){ if($charm === NULL){
handleFirstPhase($user_daten,$anzahl_charactere, isUserInGroup($usergroups, TESTER)); handleFirstPhase($user_daten, isUserInGroup($usergroups, TESTER));
} else if($charm == 1){ } else if($charm == 1){
if(isUserInGroup($usergroups, TESTER)) { if(isUserInGroup($usergroups, TESTER)) {
handleSecondPhaseForTester($char_type, $char_name); handleSecondPhaseForTester($char_type, $char_name);
@ -426,6 +420,8 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
$_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['str'], $_REQUEST['def'], $_REQUEST['spd'], $_REQUEST['end'], $_REQUEST['lck']); $_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['str'], $_REQUEST['def'], $_REQUEST['spd'], $_REQUEST['end'], $_REQUEST['lck']);
} }
} else { } else {
$anzahl_charactere = count(getCharsOfUser($user_daten['id']));
$chars_max = $user_daten['char_max'];
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.';
} }

@ -22,6 +22,28 @@ function erstelleUser(){
} }
function hasUserFreeCharSlot($user) {
$chars = getCharsOfUser($user['id']);
$special_chars = 0;
$normal_chars = 0;
foreach($chars as $row){
if($char['rasse_a']['special']) {
$special_chars++;
} else {
$normal_chars++;
}
}
// The first special char is always on its special slot!
if($special_chars > 0)
$special_chars--;
$chars_avail = $normal_chars + $special_chars;
$slots_avail = $user['char_max'];
if($chars_avail < $slots_avail) {
return true;
}
}
// Muss aus einem sicheren Kontext gestartet werden // Muss aus einem sicheren Kontext gestartet werden
function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1, $lp = 0, $hp = 0, $mp = 0, $str = 0, $def = 0, $spd = 0, $end = 0, $lck = 0, $chartype = 'Dragonball'){ function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1, $lp = 0, $hp = 0, $mp = 0, $str = 0, $def = 0, $spd = 0, $end = 0, $lck = 0, $chartype = 'Dragonball'){
// If-Anweisungen muessen noch durch Datenbankabfragen ersetzt werden // If-Anweisungen muessen noch durch Datenbankabfragen ersetzt werden

Loading…
Cancel
Save