Trac #130: Nun werden die Rassen so "emuliert" als ob sie in der Datenbank stehen würden.

Sämtliche andere scripte (dragonball wünsche, erstellen von chars, etc.) wurden angepasst.
Für die meisten jedoch war eine Anpassung nicht nötig, da die Änderung rückwärtskompatibel
in die getChar funktion eingebaut wurde.
main
hecht 10 years ago
parent 35bbec965b
commit 4b5ba4e829

@ -19,6 +19,7 @@ include_once(ROOT_PATH.'/include/erstellfunctions.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/usergroup.inc.php');
include_once(ROOT_PATH.'/include/exp.inc.php');
include_once(ROOT_PATH.'/include/rassen.inc.php');
// GET-Section
@ -58,7 +59,9 @@ function isAPhoneNumber(){
// $user_ida, $char_1_Type, $char_name
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'){
$race = getRaceById($type);
$type = getRaceTypeById($race['id']);
if($race == NULL || $race['special'] || $type['gm_only']) {
displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink());
return;
}
@ -69,8 +72,8 @@ 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'){
$race = getRaceById($type);
if($race == NULL) {
displayErrorMessage(NULL,'Rasse kann nicht erstellt werden!',displayHistoryBackLink());
return;
}
@ -106,26 +109,34 @@ function handleSecondPhase($type, $name){
<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>
<?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>
<?php
} else{
?>
<option value="Cheater">Cheater</option>
<?php
$race_type = getRaceTypeById($type);
if($race_type == NULL || $race_type['gm_only']) {
echo '<option value="Cheater">Cheater</option>'."\n";
} else {
$choices = array();
$rassen = getRassen();
foreach($rassen as $rasse) {
if($rasse['special']) {
// Normal users may not create special chars here!
continue;
}
if(!isset($choices[$rasse['type']])){
$choices[$rasse['type']] = array();
}
$choices[$rasse['type']][] = array('id' => $rasse['id'], 'name'=>$rasse['name']);
}
if(isset($choices[$type])) {
foreach($choices[$type] as $rasse) {
echo '<option value="'.$rasse['id'].'">'.$rasse['name'].'</option>'."\n";
}
} else {
echo '<option value="Cheater">Cheater</option>'."\n";
}
}
?>
</select>
</td>
@ -160,30 +171,27 @@ function handleSecondPhaseForTester($type, $name){
<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
}
?>
<?php
$choices = array();
$rassen = getRassen();
foreach($rassen as $rasse) {
if(!isset($choices[$rasse['type']])){
$choices[$rasse['type']] = array();
}
$choices[$rasse['type']][] = array('id' => $rasse['id'], 'name'=>$rasse['name']);
}
if(isset($choices[$type])) {
foreach($choices[$type] as $rasse) {
echo '<option value="'.$rasse['id'].'">'.$rasse['name'].'</option>'."\n";
}
} else {
echo '<option value="Cheater">Cheater</option>'."\n";
}
?>
</select>
</td>
</tr>
@ -213,6 +221,7 @@ function handleSecondPhaseForTester($type, $name){
}
function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
$type_arr = getRaceById($type);
if(($char_lvl >= 1 && $char_lvl <= 150) && $char_lvl !== NULL && is_numeric($char_lvl)) {
$lp = 0;
for ($i = 1; $i < $char_lvl; $i++) {
@ -253,7 +262,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
</tr>
<tr>
<th align="left">CharakterTyp:</th>
<td><?php echo $type;?>
<td><?php echo $type_arr['name'];?>
</td>
</tr>
<tr>
@ -313,7 +322,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
echo 'Ungültiger Levelbereich!';
}
function handleFirstPhase(){
function handleFirstPhase($user_daten,$anzahl_charactere,$tester){
?>
<form action="index.php" method="get" name="charz"
onsubmit="return isAPhoneNumber()">
@ -333,8 +342,14 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
<tr>
<th align="center">Type</th>
<td><select id="input" name="char_type">
<option value="Dragonball">Dragonball</option>
<option value="Onepiece">Onepiece</option>
<?php
$types = getRassenTypeMapping();
foreach($types as $type) {
if(!$type['gm_only'] || $tester) {
echo '<option value="'.$type['id'].'">'.$type['name'].'</option>'."\n";
}
}
?>
</select>
</td>
</tr>
@ -348,7 +363,35 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
}
$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']));
// FIXME: Check if thi works!
$anzahl_spezialchars = 0;
$all_chars = getCharsOfUser($user_daten['id']);
foreach($all_chars as $char) {
if(!is_numeric($char['rasse']) && $char['rasse'] == "Kaioshin" || $char['rasse'] == "Shichibukai") {
$anzahl_specialchars++;
continue;
}
if(is_numeric($char['rasse'])) {
$rasse = getRaceById($char['rasse']);
if($rasse != NULL && $rasse['special']){
$anzahl_specialchars++;
continue;
}
}
if(!is_numeric($char['fusion_rasse']) && $char['fusion_rasse'] == "Kaioshin" || $char['fusion_rasse'] == "Shichibukai") {
$anzahl_specialchars++;
continue;
}
if(is_numeric($char['fusion_rasse'])) {
$rasse = getRaceById($char['fusion_rasse']);
if($rasse != NULL && $rasse['special']){
$anzahl_specialchars++;
continue;
}
}
}
#$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) {
@ -359,7 +402,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
if ($anzahl_charactere < $chars_max) {
if($charm === NULL){
handleFirstPhase($user_daten,$anzahl_charactere);
handleFirstPhase($user_daten,$anzahl_charactere, isUserInGroup($usergroups, TESTER));
} else if($charm == 1){
if(isUserInGroup($usergroups, TESTER)) {
handleSecondPhaseForTester($char_type, $char_name);
@ -368,9 +411,9 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
}
} else if($charm == 2){
handleErstelleCharRequest($user_ida, $char_1_type, $char_name, $char_bild);
} else if($charm == 3) {
} else if($charm == 3 && isUserInGroup($usergroups, TESTER)) {
handleThirdPhaseForTester($char_1_type, $char_name, $char_lvl, $randomize, $user_ida);
} else if($charm == 4) {
} else if($charm == 4 && isUserInGroup($usergroups, TESTER)) {
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']);
}

@ -88,14 +88,16 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){
return false;
}
$kaioshin = mysql_fetch_assoc(mysql_query('SELECT char_type,name from chars WHERE (rasse = \''.$specialcharname.'\' or fusion_rasse = \''.$specialcharname.'\') and besitzer='.$user['id']));
$rasse = getRaceByName($specialcharname);
$kaioshin = mysql_fetch_assoc(mysql_query('SELECT char_type,name from chars WHERE (rasse = \''.$specialcharname.'\' or rasse = \''.$rasse['id'].'\' or fusion_rasse = \''.$specialcharname.'\' or fusion_rasse = \''.$rasse['id'].'\') and besitzer='.$user['id']));
if($kaioshin != null){
displayErrorMessage(NULL,'Der '.$specialcharname.'-Slot ist schon durch '.$kaioshin['name'].' belegt!!',displayHistoryBackLink());
return false;
}
// Kleine Funktion grosse Wirkung
if(!erstelleChar($user, $specialcharname, $newname)){
if(!erstelleChar($user, $rasse['id'], $newname)){
return false;
}
@ -222,4 +224,4 @@ if($charm !== NULL && $wunsch !== NULL){
} else{
displayWuensche($user_ida);
}
?>
?>

@ -318,7 +318,7 @@ function getKategorieOptions($preselect){
$total = 0;
$select = false;
$qry = mysql_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 GROUP BY tablename');
$qry = mysql_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 AND itemname != \'Geheim!\' GROUP BY tablename');
while($row = mysql_fetch_assoc($qry)){
if($preselect == $row['tablename']){
$result[$index++] = '<option value=\''.$row['tablename'].'\' selected>'.$converter[$row['tablename']].' | Anzahl:'.$row['anzahl'].'</option>';

@ -18,6 +18,7 @@
// required for status calculation!
include_once(ROOT_PATH.'/include/event.inc.php');
include_once(ROOT_PATH.'/include/clan_fights.inc.php');
include_once(ROOT_PATH.'/include/rassen.inc.php');
/*
* Char Status
@ -101,12 +102,7 @@ function getChar($charid, $buffer_enabled = true) {
}
// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
if ($GLOBALS['char_buffered_instances'][$charid] == null || !$buffer_enabled) {
// Lese das Charfeld aus der Datenbank aus
$char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid));
if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
$char['bild'] = getPicture($char);
$char = getChar2($charid);
$GLOBALS['char_buffered_instances'][$charid] = &$char; // Speichern des Chars in den Puffer
}
// Gebe Char zurueck
@ -123,6 +119,33 @@ function getChar2($charid) {
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
$char['bild'] = getPicture($char);
// Check if it is new style!
if(is_numeric($char['rasse']) && $char['rasse'] != 0) {
$rasse = getRaceById($char['rasse']);
$char['rasse']=$rasse['name'];
$type=getRaceTypeById($rasse['type']);
$char['type']=$type['name'];
if($rasse['special']) {
$char['char_type'] = $rasse['name'];
}
$char['rasse_a'] = $rasse;
} else if($char['rasse'] != '0'){
// it is old style!
$rasse = getRaceByName($char['rasse']);
$char['rasse_a'] = $rasse;
// update the old styled rasse
db_query('update chars set rasse = \''.$rasse['id'].'\', type = NULL where id = '.$charid);
}
if(is_numeric($char['fusion_rasse']) && $char['fusion_rasse'] != 0) {
$rasse = getRaceById($char['fusion_rasse']);
$char['fusion_rasse'] = $rasse['name'];
} else if($char['fusion_rasse'] != '0') {
$rasse = getRaceByName($char['fusion_rasse']);
$char['fusion_rasse_a'] = $rasse;
// update the old styled fusion_rasse
db_query('update chars set fusion_rasse = \''.$rasse['id'].'\' where id = '.$charid);
}
}
return $char;
}
@ -174,15 +197,9 @@ function getCharsOfUser($userid, $buffer_enabled = true) {
if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) {
$GLOBALS['chars_read_out_user'][$userid] = array();
$qry = mysql_query('Select * from chars where besitzer = '.$userid.' order by id');
$qry = mysql_query('Select id from chars where besitzer = '.$userid.' order by id');
while($char = mysql_fetch_assoc($qry)){
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
$char['bild'] = getPicture($char);
// Speichere den Char in das Globale-Pufferfeld
$GLOBALS['char_buffered_instances'][$char['id']] = $char;
// Gebe dem User eine Referenz auf die globale chars-Variable
$GLOBALS['chars_read_out_user'][$userid][] = &$GLOBALS['char_buffered_instances'][$char['id']];
$GLOBALS['chars_read_out_user'][$userid][] = &getChar($char['id']);
}
}
return $GLOBALS['chars_read_out_user'][$userid]; // Gebe das globale Userfeld zurück.

@ -11,6 +11,7 @@
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
include_once(ROOT_PATH.'/include/rassen.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/exp.inc.php');
@ -22,162 +23,37 @@ function erstelleUser(){
}
// Muss aus einem sicheren Kontext gestartet werden
function erstelleChar($user, $specialcharname, $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
$type = '';
$trainingspoints = 0;
$special_char = false;
$dbz = 'Dragonball';
$op = 'Onepiece';
$c_type = '';
if($newname == ''){
displayErrorMessage(NULL,'Name ist nicht erlaubt!!',displayHistoryBackLink());
return false;
}
if($specialcharname == 'Mensch') {
$HP = 150;
$MP = 30;
$Starke = 15;
$Verteidigung = 9;
$Geschwindigkeit = 13;
$Gluck = 4;
$Ausdauer = 8;
$type = $dbz;
} else if($specialcharname == 'Saiyajin') {
$HP = 120;
$MP = 30;
$Starke = 18;
$Verteidigung = 10;
$Geschwindigkeit = 9;
$Gluck = 5;
$Ausdauer = 10;
$type = $dbz;
} else if($specialcharname == 'Dämon') {
$HP = 160;
$MP = 50;
$Starke = 8;
$Verteidigung = 15;
$Geschwindigkeit = 11;
$Gluck = 0;
$Ausdauer = 9;
$type = $dbz;
} else if($specialcharname == 'Mutant') {
$HP = 180;
$MP = 15;
$Starke = 13;
$Verteidigung = 9;
$Geschwindigkeit = 18;
$Gluck = 4;
$Ausdauer = 5;
$type = $dbz;
} else if($specialcharname == 'Cyborg') {
$HP = 250;
$MP = 20;
$Starke = 11;
$Verteidigung = 30;
$Geschwindigkeit = 0;
$Gluck = 0;
$Ausdauer = 0;
$type = $dbz;
} else if($specialcharname == 'Namekianer') {
$HP = 100;
$MP = 10;
$Starke = 18;
$Verteidigung = 10;
$Geschwindigkeit = 14;
$Gluck = 6;
$Ausdauer = 10;
$type = $dbz;
} else if($specialcharname == 'Pirat') {
$HP = 100;
$MP = 25;
$Starke = 20;
$Verteidigung = 10;
$Geschwindigkeit = 15;
$Gluck = 3;
$Ausdauer = 7;
$type = $op;
} else if($specialcharname == 'Schwertkämpfer') {
$HP = 100;
$MP = 25;
$Starke = 25;
$Verteidigung = 10;
$Geschwindigkeit= 10;
$Gluck= 2;
$Ausdauer= 8;
$type = $op;
} else if($specialcharname == 'Grandline Maschine') {
$HP = 400;
$MP = 5;
$Starke = 5;
$Verteidigung = 5;
$Geschwindigkeit = 5;
$Gluck = 0;
$Ausdauer = 10;
$type = $op;
} else if($specialcharname == 'Kaioshin'){
$HP = 1000;
$MP = 150;
$Starke = 100;
$Verteidigung = 100;
$Geschwindigkeit = 100;
$Gluck = 100;
$Ausdauer = 100;
$type = $dbz;
$trainingspoints = 500;
$special_char = true;
$c_type = $specialcharname;
} else if($specialcharname == 'Shichibukai'){
$HP = 1000;
$MP = 150;
$Starke = 100;
$Verteidigung = 100;
$Geschwindigkeit = 100;
$Gluck = 100;
$Ausdauer = 100;
//$type = $specialcharname; <-- wird überschrieben?!
$trainingspoints = 500;
$special_char = true;
$type = $op;
$c_type = $specialcharname;
} else if($specialcharname == 'NPC') {
$type = $chartype;
$HP = $hp;
$MP = $mp;
$Starke = $str;
$Verteidigung = $def;
$Geschwindigkeit = $spd;
$Gluck = $lck;
$Ausdauer = $end;
//reseten der stats, damit kein boost dazukommt
$hp = 0;
$mp = 0;
$str = 0;
$def = 0;
$spd = 0;
$lck = 0;
$end = 0;
$lp = 0;
} else {
$race = getRaceById($rassen_id);
if($race == NULL) {
displayErrorMessage(NULL,'Rasse nicht vorhanden!!',displayHistoryBackLink());
return false;
}
// If-Anweisungen ende
// Werte hinzufügen, falls ein Testcharakter erstellt wird
$HP += ($hp*10);
$MP += ($mp*5);
$Starke += $str;
$Verteidigung += $def;
$Geschwindigkeit += $spd;
$Gluck += $lck;
$Ausdauer += $end;
// Durch $race können wir nun die chars generisch erstellen :) ... Bye bye multi-ifs :D
$HP = $race['hp'] + $hp*10;
$MP = $race['mp'] + $mp*5;
$Starke = $race['str'] + $str;
$Verteidigung = $race['def'] + $def;
$Geschwindigkeit = $race['spd'] + $spd;
$Gluck = $race['lck'] + $lck;
$Ausdauer = $race['stm'] + $end;
$type = ''; // Not required anymore!
$c_type = '';
$special_char = $race['special'];
$trainingspoints += $lp*2;
$LP = ($lvl - 1) * 10;
if($specialcharname != 'NPC') {
if($race['name'] != 'NPC') {
//Ueberprüfe ob ein Slot frei ist
$chars = getCharsOfUser($user['id']);
$normal = 0;
@ -214,7 +90,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = '', $lv
' \''.$MP.','.$MP.'\',' .
' '.$lvl.',' .
' \''.$type.'\',' .
' \''.$specialcharname.'\',' .
' \''.$rassen_id.'\',' .
' '.$user['id'].',' .
' \''.$c_type.'\',' .
' '.$trainingspoints.',' .
@ -225,7 +101,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = '', $lv
//echo $sql.'<br>';
$identifier = mysql_query($sql);
if($identifier == FALSE){
if(mysql_fetch_assoc(mysql_query('Select * from chars where name = \''.$newname.'\''))){
if(mysql_fetch_assoc(mysql_query('Select id from chars where name = \''.$newname.'\''))){
displayErrorMessage(NULL,'Name schon vorhanden!!',displayHistoryBackLink());
} else{
displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink());
@ -233,7 +109,7 @@ function erstelleChar($user, $specialcharname, $newname = '', $picture = '', $lv
return false; // Hat nich geklappt
}
if($specialcharname != 'NPC') {
if($race['name'] != 'NPC') {
$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');

@ -1,190 +0,0 @@
<?php
/*
* Created on 10.09.2008
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
// Schauen ob eigene Rassen genutzt werden sollen?
include_once (ROOT_PATH . '/include/config/settings.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
function init_races() {
if (isset ($GLOBALS['races_location_file'])) {
include_once ($GLOBALS['races_location_file']);
return;
}
$GLOBALS['race_kategories'][0]['name'] = 'One Piece';
$GLOBALS['race_kategories'][1]['name'] = 'Dragonball';
$GLOBALS['races']['Mensch']['id'] = 1;
$GLOBALS['races']['Mensch']['name'] = 'Mensch';
$GLOBALS['races']['Mensch']['HP'] = 150;
$GLOBALS['races']['Mensch']['MP'] = 30;
$GLOBALS['races']['Mensch']['Starke'] = 15;
$GLOBALS['races']['Mensch']['Verteidigung'] = 9;
$GLOBALS['races']['Mensch']['Geschwindigkeit'] = 13;
$GLOBALS['races']['Mensch']['Gluck'] = 4;
$GLOBALS['races']['Mensch']['Ausdauer'] = 8;
$GLOBALS['races']['Mensch']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Mensch']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Saiyajin']['id'] = 2;
$GLOBALS['races']['Saiyajin']['name'] = 'Saiyajin';
$GLOBALS['races']['Saiyajin']['HP'] = 120;
$GLOBALS['races']['Saiyajin']['MP'] = 30;
$GLOBALS['races']['Saiyajin']['Starke'] = 18;
$GLOBALS['races']['Saiyajin']['Verteidigung'] = 10;
$GLOBALS['races']['Saiyajin']['Geschwindigkeit'] = 9;
$GLOBALS['races']['Saiyajin']['Gluck'] = 5;
$GLOBALS['races']['Saiyajin']['Ausdauer'] = 10;
$GLOBALS['races']['Saiyajin']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Saiyajin']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Dämon']['id'] = 3;
$GLOBALS['races']['Dämon']['name'] = 'Dämon';
$GLOBALS['races']['Dämon']['HP'] = 160;
$GLOBALS['races']['Dämon']['MP'] = 50;
$GLOBALS['races']['Dämon']['Starke'] = 8;
$GLOBALS['races']['Dämon']['Verteidigung'] = 15;
$GLOBALS['races']['Dämon']['Geschwindigkeit'] = 11;
$GLOBALS['races']['Dämon']['Gluck'] = 0;
$GLOBALS['races']['Dämon']['Ausdauer'] = 9;
$GLOBALS['races']['Dämon']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Dämon']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Mutant']['id'] = 4;
$GLOBALS['races']['Mutant']['name'] = 'Mutant';
$GLOBALS['races']['Mutant']['HP'] = 180;
$GLOBALS['races']['Mutant']['MP'] = 15;
$GLOBALS['races']['Mutant']['Starke'] = 13;
$GLOBALS['races']['Mutant']['Verteidigung'] = 9;
$GLOBALS['races']['Mutant']['Geschwindigkeit'] = 18;
$GLOBALS['races']['Mutant']['Gluck'] = 4;
$GLOBALS['races']['Mutant']['Ausdauer'] = 5;
$GLOBALS['races']['Mutant']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Mutant']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Cyborg']['id'] = 5;
$GLOBALS['races']['Cyborg']['name'] = 'Cyborg';
$GLOBALS['races']['Cyborg']['HP'] = 250;
$GLOBALS['races']['Cyborg']['MP'] = 20;
$GLOBALS['races']['Cyborg']['Starke'] = 11;
$GLOBALS['races']['Cyborg']['Verteidigung'] = 30;
$GLOBALS['races']['Cyborg']['Geschwindigkeit'] = 0;
$GLOBALS['races']['Cyborg']['Gluck'] = 0;
$GLOBALS['races']['Cyborg']['Ausdauer'] = 0;
$GLOBALS['races']['Cyborg']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Cyborg']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Namekianer']['id'] = 6;
$GLOBALS['races']['Namekianer']['name'] = 'Namekianer';
$GLOBALS['races']['Namekianer']['HP'] = 100;
$GLOBALS['races']['Namekianer']['MP'] = 10;
$GLOBALS['races']['Namekianer']['Starke'] = 18;
$GLOBALS['races']['Namekianer']['Verteidigung'] = 10;
$GLOBALS['races']['Namekianer']['Geschwindigkeit'] = 14;
$GLOBALS['races']['Namekianer']['Gluck'] = 6;
$GLOBALS['races']['Namekianer']['Ausdauer'] = 10;
$GLOBALS['races']['Namekianer']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Namekianer']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Pirat']['id'] = 7;
$GLOBALS['races']['Pirat']['name'] = 'Pirat';
$GLOBALS['races']['Pirat']['HP'] = 100;
$GLOBALS['races']['Pirat']['MP'] = 25;
$GLOBALS['races']['Pirat']['Starke'] = 20;
$GLOBALS['races']['Pirat']['Verteidigung'] = 10;
$GLOBALS['races']['Pirat']['Geschwindigkeit'] = 15;
$GLOBALS['races']['Pirat']['Gluck'] = 3;
$GLOBALS['races']['Pirat']['Ausdauer'] = 7;
$GLOBALS['races']['Pirat']['type'] = 0; // ID der race_kategorie
$GLOBALS['races']['Pirat']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Shichibukai']['id'] = 8;
$GLOBALS['races']['Shichibukai']['name'] = 'Shichibukai';
$GLOBALS['races']['Shichibukai']['HP'] = 1000;
$GLOBALS['races']['Shichibukai']['MP'] = 150;
$GLOBALS['races']['Shichibukai']['Starke'] = 100;
$GLOBALS['races']['Shichibukai']['Verteidigung'] = 100;
$GLOBALS['races']['Shichibukai']['Geschwindigkeit'] = 100;
$GLOBALS['races']['Shichibukai']['Gluck'] = 100;
$GLOBALS['races']['Shichibukai']['Ausdauer'] = 100;
$GLOBALS['races']['Shichibukai']['type'] = $dbz;
$GLOBALS['races']['Shichibukai']['trainingspoints'] = 500;
$GLOBALS['races']['Shichibukai']['type'] = 0; // ID der race_kategorie
$GLOBALS['races']['Shichibukai']['special'] = 'yes'; // Ist kein Spezialchar!
$GLOBALS['races']['Kaioshin']['id'] = 9;
$GLOBALS['races']['Kaioshin']['name'] = 'Kaioshin';
$GLOBALS['races']['Kaioshin']['HP'] = 1000;
$GLOBALS['races']['Kaioshin']['MP'] = 150;
$GLOBALS['races']['Kaioshin']['Starke'] = 100;
$GLOBALS['races']['Kaioshin']['Verteidigung'] = 100;
$GLOBALS['races']['Kaioshin']['Geschwindigkeit'] = 100;
$GLOBALS['races']['Kaioshin']['Gluck'] = 100;
$GLOBALS['races']['Kaioshin']['Ausdauer'] = 100;
$GLOBALS['races']['Kaioshin']['trainingspoints'] = 500;
$GLOBALS['races']['Kaioshin']['type'] = 1; // ID der race_kategorie
$GLOBALS['races']['Kaioshin']['special'] = 'yes'; // Ist kein Spezialchar!
$GLOBALS['races']['Schwertkämpfer']['id'] = 10;
$GLOBALS['races']['Schwertkämpfer']['name'] = 'Schwertkämpfer';
$GLOBALS['races']['Schwertkämpfer']['HP'] = 100;
$GLOBALS['races']['Schwertkämpfer']['MP'] = 25;
$GLOBALS['races']['Schwertkämpfer']['Starke'] = 25;
$GLOBALS['races']['Schwertkämpfer']['Verteidigung'] = 10;
$GLOBALS['races']['Schwertkämpfer']['Geschwindigkeit'] = 10;
$GLOBALS['races']['Schwertkämpfer']['Gluck'] = 2;
$GLOBALS['races']['Schwertkämpfer']['Ausdauer'] = 8;
$GLOBALS['races']['Schwertkämpfer']['type'] = 0; // ID der race_kategorie
$GLOBALS['races']['Schwertkämpfer']['special'] = 'no'; // Ist kein Spezialchar!
$GLOBALS['races']['Grandline Maschine']['id'] = 11;
$GLOBALS['races']['Grandline Maschine']['name'] = 'Grandline Maschine';
$GLOBALS['races']['Grandline Maschine']['HP'] = 400;
$GLOBALS['races']['Grandline Maschine']['MP'] = 5;
$GLOBALS['races']['Grandline Maschine']['Starke'] = 5;
$GLOBALS['races']['Grandline Maschine']['Verteidigung'] = 5;
$GLOBALS['races']['Grandline Maschine']['Geschwindigkeit'] = 5;
$GLOBALS['races']['Grandline Maschine']['Gluck'] = 0;
$GLOBALS['races']['Grandline Maschine']['Ausdauer'] = 10;
$GLOBALS['races']['Grandline Maschine']['type'] = 0; // ID der race_kategorie
$GLOBALS['races']['Grandline Maschine']['special'] = 'no'; // Ist kein Spezialchar!
foreach ($GLOBALS['races'] as $race) {
$GLOBALS['race_ids'][$race['id']] = $race;
}
}
function getRaceByID($raceid) {
return $GLOBALS['race_ids'][$raceid];
}
function getRaceByName($racename) {
return $GLOBALS['races'][$racename];
}
function getRaces(){
return $GLOBALS['races'];
}
function getRaceOfChar($charid){
$char = getChar($charid);
return $char['rasse'];
}
function getRaceIdOfChar($charid){
$char = getChar($charid);
$race = getRaceByName($char['rasse']);
return $race['id'];
}
// Weil es derzeit keine Datenbankunterstuetzung gibt initialisiere die Rassen!
init_races();
?>

@ -0,0 +1,295 @@
<?php
/*
* Created on 02.05.2014
*
* @copyright (c) 2014 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
#include_once(ROOT_PATH.'/include/event.inc.php');
$GLOBALS['TMP_DB_TABLE_RACE_TYPE']=array(
array(
'name' => 'Onepiece',
'id' => 1,
'gm_only' => false,
),
array(
'name' => 'Dragonball',
'id' => 2,
'gm_only' => false,
),
array(
'name' => 'NPC',
'id' => 3,
'gm_only' => true,
),
);
// Dieses Array ist zum simulieren der Datenbank da!
$GLOBALS['TMP_DB_TABLE_RACES']=array(
array(
'name' => 'Mensch',
'type' => 2,
'id' => 1,
'hp' => 150,
'mp' => 30,
'str' => 15,
'def' => 9,
'spd' => 13,
'lck' => 4,
'stm' => 8,
'special' => false
),
array(
'name' => 'Saiyajin',
'type' => 2,
'id' => 2,
'hp' => 120,
'mp' => 30,
'str' => 18,
'def' => 10,
'spd' => 9,
'lck' => 5,
'stm' => 10,
'special' => false
),
array(
'name' => 'Dämon',
'type' => 2,
'id' => 3,
'hp' => 160,
'mp' => 50,
'str' => 8,
'def' => 9,
'spd' => 18,
'lck' => 4,
'stm' => 5,
'special' => false
),
array(
'name' => 'Mutant',
'type' => 2,
'id' => 4,
'hp' => 180,
'mp' => 15,
'str' => 13,
'def' => 9,
'spd' => 18,
'lck' => 4,
'stm' => 5,
'special' => false
),
array(
'name' => 'Cyborg',
'type' => 2,
'id' => 5,
'hp' => 250,
'mp' => 20,
'str' => 11,
'def' => 30,
'spd' => 0,
'lck' => 0,
'stm' => 0,
'special' => false
),
array(
'name' => 'Namekianer',
'type' => 2,
'id' => 6,
'hp' => 100,
'mp' => 10,
'str' => 18,
'def' => 10,
'spd' => 14,
'lck' => 6,
'stm' => 10,
'special' => false
),
// Start 'One Piece'
array(
'name' => 'Pirat',
'type' => 1,
'id' => 7,
'hp' => 100,
'mp' => 25,
'str' => 20,
'def' => 10,
'spd' => 15,
'lck' => 3,
'stm' => 7,
'special' => false
),
// In-Between Special chars
array(
'name' => 'Shichibukai',
'type' => 1,
'id' => 8,
'hp' => 1000,
'mp' => 150,
'str' => 100,
'def' => 100,
'spd' => 100,
'lck' => 100,
'stm' => 100,
'tp' => 500,
'special' => true
),
array(
'name' => 'Kaioshin',
'type' => 2,
'id' => 9,
'hp' => 1000,
'mp' => 150,
'str' => 100,
'def' => 100,
'spd' => 100,
'lck' => 100,
'stm' => 100,
'tp' => 500,
'special' => true
),
// Continue 'One Piece'
array(
'name' => 'Schwertkämpfer',
'type' => 1,
'id' => 10,
'hp' => 100,
'mp' => 25,
'str' => 25,
'def' => 10,
'spd' => 10,
'lck' => 2,
'stm' => 8,
'special' => false
),
array(
'name' => 'Grandline Maschine',
'type' => 1,
'id' => 11,
'hp' => 400,
'mp' => 5,
'str' => 5,
'def' => 5,
'spd' => 5,
'lck' => 0,
'stm' => 10,
'special' => false
),
// NPC chars
array(
'name' => 'NPC',
'type' => 3,
'id' => 12,
'hp' => 0,
'mp' => 0,
'str' => 0,
'def' => 0,
'spd' => 0,
'lck' => 0,
'stm' => 0,
'special' => true
),
);
// now sort the arrays
// Dieses Array ist dafuer da, dass nicht unnötig viele SQL-Abfragen gemacht werden!
// Fehlgriff im Design, aber solange wir nichts Klassenbasiert machen, gehts nicht anders
$GLOBALS['char_buffered_races'] = array ();
$GLOBALS['char_buffered_race_types'] = array();
function getRassen() {
return getRaces();
}
/**
* Diese Funktion gibt ein array mit allen rassen aus 'id' => array('name', 'type', ...);
*/
function getRaces() {
if(count($GLOBALS['char_buffered_races']) == 0) {
// FIXME: This is a simulated SQL Request!
foreach($GLOBALS['TMP_DB_TABLE_RACES'] as $race) {
$GLOBALS['char_buffered_races'][$race['id']] = $race;
}
}
return $GLOBALS['char_buffered_races'];
}
function getRassenTypeMapping() {
return getRaceTypes();
}
function getRaceTypes(){
if(count($GLOBALS['char_buffered_race_types']) == 0) {
foreach($GLOBALS['TMP_DB_TABLE_RACE_TYPE'] as $racetype) {
$GLOBALS['char_buffered_race_types'][$racetype['id']] = $racetype;
}
}
return $GLOBALS['char_buffered_race_types'];
}
function getRaceById($id) {
$races = getRassen();
return $races[$id];
}
function getRaceByName($name) {
// TODO: Improve performance for this
$races = getRaces();
foreach($races as $race) {
if($race['name'] == $name) {
return $race;
}
}
return NULL;
}
function getRacesByType($type) {
$races = getRaces();
$result = array();
foreach($races as $race) {
if($race['type'] == $type['id']) {
$result[] = $race;
}
}
return $result;
}
function getRaceTypeById($id) {
$types = getRaceTypes();
return $types[$id];
}
function getRaceTypeName($name) {
$types = getRaceTypes();
foreach($types as $type) {
if($type['name'] == $name) {
return $type;
}
}
return NULL;
}
function getSpecialRaceIds() {
$races = getRaces();
$result = array();
foreach($races as $race) {
if($race['special']) {
$result[] = $race;
}
}
return $result;
}
#print_r(getRassen());
#print_r(getRaceById(1));
#print_r(getRaceByName('Dämon'));

@ -5,8 +5,12 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once (ROOT_PATH.'/include/char.inc.php');
function renderSchnellleiste($user){
$Schnell_my_chars = mysql_query("SELECT name, status, id, training_points, lernpunkte, level, starke, verteidigung, speed, ausdauer, glueck FROM chars WHERE besitzer='$user[id]' LIMIT 8");
$Schnell_my_chars = getCharsOfUser($user[id]);
$char_zahl = 0;
while($my_charz = mysql_fetch_assoc($Schnell_my_chars)) {

@ -296,6 +296,16 @@ if ($charm == 6) {
exit;
}
if ($char_id1['type'] != 'Onepiece') {
displayErrorMessage(NULL,'Dieser Charakter ist kein One Piece char!', displayHistoryBackLink());
exit;
}
if ($char_id1['frucht'] != NULL) {
displayErrorMessage(NULL,'Dieser Charakter hat schon eine Teufelsfrucht gegessen!', displayHistoryBackLink());
exit;
}
$hp1 = explode(",", $char_id1['hp']);
$mp1 = explode(",", $char_id1['mp']);
@ -402,9 +412,12 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
<option value="">Charakter ausw&auml;hlen</option>
<?php
// Speziell!!
$char4 = mysql_query('SELECT id, name FROM chars WHERE besitzer='.$user_ida['id'].' AND type=\'Onepiece\' AND frucht is NULL');
while ($row4 = mysql_fetch_array($char4)) {
echo '<option value="'.$row4['id'].'">'.$row4['name'].'</option>';
#$char4 = mysql_query('SELECT id, name FROM chars WHERE besitzer='.$user_ida['id'].' AND type=\'Onepiece\' AND frucht is NULL');
$all_chars = getCharsOfUser($user_ida['id']);
foreach($all_chars as $row4) {
if($row4['type'] == 'Onepiece' && $row4['frucht'] == NULL) {
echo '<option value="'.$row4['id'].'">'.$row4['name'].'</option>';
}
}
?>
</select> <br> <br> <select id="input" name="sp_item">

@ -52,14 +52,19 @@ function anmelden($user, $charid, $art){
if($art == 'klein'){
$races = getSpecialRaceIds();
$special_race_ids = array();
foreach($races as $race) {
$special_race_ids[] = '\''.$race['id'].'\'';
}
// Char darf max lvl 25 haben und keine Fusion sein und auch keine Teufelsfrucht gegessen haben
$special_clue = 'AND level<=25 AND fusion =\'nein\' AND char_type = \'\' AND frucht is null';
$special_clue = 'AND level<=25 AND fusion_rasse = \'0\' AND rasse NOT IN ('.implode(',',$special_race_ids).') AND frucht is null';
$anzahl = 32;
} else{
$anzahl = 64;
}
// sehr speziell und deswegen nicht getChar();
$PRUEF = mysql_num_rows(mysql_query('SELECT id FROM chars WHERE id=\''.$charid.'\' '.$special_clue.' AND besitzer=\''.$user['id'].'\' LIMIT 1'));
$PRUEF = mysql_num_rows(db_query('SELECT id FROM chars WHERE id=\''.$charid.'\' '.$special_clue.' AND besitzer=\''.$user['id'].'\' LIMIT 1'));
if(!$PRUEF) {
displayErrorMessage(NULL,'Charakter erf&uuml;llt die Bestimungen nicht!','<a href="index.php?as=turnier&art='.$art.'">weiter...</a>');
return;
@ -99,7 +104,14 @@ function displayDefault($user, $art){
if($art == 'klein'){
$turniername = 'Anf&auml;nger';
$special_clue = ' AND level<=25 AND fusion =\'nein\' AND char_type = \'\' ';
$races = getSpecialRaceIds();
$special_race_ids = array();
foreach($races as $race) {
$special_race_ids[] = '\''.$race['id'].'\'';
}
// Char darf max lvl 25 haben und keine Fusion sein und auch keine Teufelsfrucht gegessen haben
$special_clue = ' AND level<=25 AND fusion_rasse = \'0\' AND rasse NOT IN ('.implode(',',$special_race_ids).') AND frucht is null';
$fee = (TURNIER_ANFAENGER_GEBUEHR=='TURNIER_ANFAENGER_GEBUEHR')?0:TURNIER_ANFAENGER_GEBUEHR;
} else if($art == 'wochen'){
$turniername = 'Wochen';
@ -110,7 +122,8 @@ function displayDefault($user, $art){
}
// sehr speziell und deswegen nicht getChar();
$sql = 'SELECT id, name FROM chars WHERE besitzer='.$user['id'].$special_clue;
$char = mysql_query($sql);
$char = db_query($sql);
if(!$char)
echo $sql;

Loading…
Cancel
Save