From 6b1c04e26c981bdbd8acb0e51942a8cc7a3da681 Mon Sep 17 00:00:00 2001 From: radiskull Date: Mon, 21 Nov 2011 21:53:09 +0000 Subject: [PATCH] =?UTF-8?q?einfache=20Zufallsmethode=20beim=20erstellen=20?= =?UTF-8?q?von=20Testchars=20gebaut=20(somit=20m=C3=BCssen=20werte=20nicht?= =?UTF-8?q?=20unbedingt=20per=20Hand=20eingegeben=20werden)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ag/char.php | 158 ++++++++++++++++------------ ag/include/erstellfunctions.inc.php | 2 +- 2 files changed, 94 insertions(+), 66 deletions(-) diff --git a/ag/char.php b/ag/char.php index 0aac99e..aa37e73 100644 --- a/ag/char.php +++ b/ag/char.php @@ -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']; @@ -69,7 +70,7 @@ function handleErstelleCharRequest($user, $type, $name, $bild){ 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'){ + $type != 'Namekianer' && $type != 'Pirat' && $type != 'Schwertkämpfer' && $type != 'Grandline Maschine' && $type != 'Kaioshin' && $type != 'Shichibukai'){ displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink()); return; } @@ -147,9 +148,9 @@ function handleSecondPhase($type, $name){ function handleSecondPhaseForTester($type, $name){ ?>
- - - + @@ -192,10 +193,15 @@ function handleSecondPhaseForTester($type, $name){ - + + + + +
Level(1-150): Level(1-150):
Zufall: +
@@ -206,21 +212,39 @@ function handleSecondPhaseForTester($type, $name){ = 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 { + ?> - - - - - - + @@ -228,50 +252,52 @@ function handleThirdPhaseForTester($type, $name, $char_lvl){ - - + + - - + + - + - - + - - + - - + - - + - - + - - + - - + @@ -281,12 +307,14 @@ function handleThirdPhaseForTester($type, $name, $char_lvl){
Charakter erstellen (3/3)
CharakterTyp: CharakterTyp: +
Charakterlevel: Charakterlevel: +
verfügbare LP: verfügbare LP:
HP (1LP = 10HP): + HP (1LP = 10HP):
MP (1LP = 5MP): + MP (1LP = 5MP):
Stärke: + Stärke:
Verteidigung: + Verteidigung:
Geschwindigkeit: + Geschwindigkeit:
Ausdauer: + Ausdauer:
Glück: + Glück:
- + function handleFirstPhase(){ + ?>
- = 1 AND $user_daten['char_max'] == 7) { - $chars_max= 8; -} else { - $chars_max= $user_daten['char_max']; -} + if ($anzahl_spezialchars >= 1 AND $user_daten['char_max'] == 7) { + $chars_max= 8; + } else { + $chars_max= $user_daten['char_max']; + } -if ($anzahl_charactere < $chars_max) { - if($charm === NULL){ - handleFirstPhase($user_daten,$anzahl_charactere); - } else if($charm == 1){ - if(isUserInGroup($usergroups, TESTER)) { - handleSecondPhaseForTester($char_type, $char_name); - } 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, $_REQUEST['char_type'], $_REQUEST['char_name'], $_REQUEST['char_bild'], $_REQUEST['lvl'], $_REQUEST['lp'], + if ($anzahl_charactere < $chars_max) { + if($charm === NULL){ + handleFirstPhase($user_daten,$anzahl_charactere); + } else if($charm == 1){ + if(isUserInGroup($usergroups, TESTER)) { + handleSecondPhaseForTester($char_type, $char_name); + } 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, $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']); + } + } else { + echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.
Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.'; } -} else { - echo 'Du hast bereits die maximal mögliche Menge an Characteren erstellt, die du erstellen kannst.
Nämlich '.$anzahl_charactere.' von '.$chars_max.' Charaktere.'; -} -?> + ?> diff --git a/ag/include/erstellfunctions.inc.php b/ag/include/erstellfunctions.inc.php index 3b99395..39bf1a7 100644 --- a/ag/include/erstellfunctions.inc.php +++ b/ag/include/erstellfunctions.inc.php @@ -178,7 +178,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = '', $lv $LP = ($lvl - 1) * 10; if($specialcharname != 'NPC') { - // Ueberprüfe ob ein Slot frei ist + //Ueberprüfe ob ein Slot frei ist $chars = getCharsOfUser($user['id']); $normal = 0; $special = 0;