einfache Zufallsmethode beim erstellen von Testchars gebaut (somit müssen werte nicht unbedingt per Hand eingegeben werden)

main
radiskull 13 years ago
parent 9756a4d6aa
commit 6b1c04e26c

@ -27,6 +27,7 @@ $char_name = validateName($_GET['char_name']);
$char_1_type = validateString($_GET['char_1_Type']);
$char_bild = validateURL($_GET['char_bild']);
$char_lvl = validateInteger($_GET['char_lvl'], NULL);
$randomize = validateInteger($_GET['random'], NULL);
// Unkritisch
$charm = $_REQUEST['charm'];
@ -147,9 +148,9 @@ function handleSecondPhase($type, $name){
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; ?>">
<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">
@ -196,6 +197,11 @@ function handleSecondPhaseForTester($type, $name){
<td><input name="char_lvl" id="input">
</td>
</tr>
<tr>
<th align="left">Zufall:</th>
<td><input type="checkbox" name="random" value="1">
</td>
</tr>
<tr>
<td></td>
<td><input id="input" type=submit value="weiter">
@ -206,21 +212,39 @@ function handleSecondPhaseForTester($type, $name){
<?php
}
function handleThirdPhaseForTester($type, $name, $char_lvl){
function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
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);
if($random == 1) {
$tmp_lp = $lp;
$hp = rand(0, $lp/2);
$lp -= $hp;
$mp = rand(0, $lp/2);
$lp -= $mp;
$str = rand(0, $lp);
$lp -= $str;
$def = rand(0, $lp);
$lp -= $def;
$spd = rand(0, $lp);
$lp -= $spd;
$lck = rand(0, $lp);
$lp -= $lck;
$end = rand(0, $lp);
$lp -= $end;
handleErstelleCharRequestOfTestUser($user, $type, $name, '', $char_lvl, $tmp_lp, $hp, $mp, $str, $def, $spd, $end, $lck);
} else {
?>
<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; ?>">
<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">
@ -229,11 +253,13 @@ function handleThirdPhaseForTester($type, $name, $char_lvl){
</tr>
<tr>
<th align="left">CharakterTyp:</th>
<td><?php echo $type;?> </td>
<td><?php echo $type;?>
</td>
</tr>
<tr>
<th align="left">Charakterlevel:</th>
<td><?php echo $char_lvl;?> </td>
<td><?php echo $char_lvl;?>
</td>
</tr>
<tr>
<th align="left">verfügbare LP:</th>
@ -281,7 +307,9 @@ function handleThirdPhaseForTester($type, $name, $char_lvl){
</tr>
</table>
</form>
<?php } else
<?php
}
} else
echo 'Ungültiger Levelbereich!';
}
@ -341,7 +369,7 @@ if ($anzahl_charactere < $chars_max) {
} 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);
handleThirdPhaseForTester($char_1_type, $char_name, $char_lvl, $randomize, $user_ida);
} else if($charm == 4) {
handleErstelleCharRequestOfTestUser($user_ida, $_REQUEST['char_type'], $_REQUEST['char_name'], $_REQUEST['char_bild'], $_REQUEST['lvl'], $_REQUEST['lp'],
$_REQUEST['hp'], $_REQUEST['mp'], $_REQUEST['str'], $_REQUEST['def'], $_REQUEST['spd'], $_REQUEST['end'], $_REQUEST['lck']);

Loading…
Cancel
Save