- GM Panel #130 Rassen sind nun editierbar, werden aber noch nicht direkt genutzt (Vorbereitung für DB basierte Rassen)

- GM Panel NPC fix von ag07 (items funzen noch nicht)
- Div/0 Fix wenn Max HP/MP des chars 0 ist
main
hecht 10 years ago
parent c8ac95b2f4
commit 1a5efb2f8c

@ -40,9 +40,17 @@ foreach($chars as $my_charz){
else
$frucht = "";
$hptemp = explode(",", $my_charz['hp']);
$hpleft[$char_zahl] = $hptemp['0'] / $hptemp['1'] * 100;
if($hptemp['1'] != 0) {
$hpleft[$char_zahl] = $hptemp['0'] / $hptemp['1'] * 100;
} else {
$hpleft[$char_zahl] = 0;
}
$mptemp = explode(",", $my_charz['mp']);
$mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100;
if($mptemp['1']) {
$mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100;
} else {
$mpleft[$char_zahl] = 0;
}
$exptemp = explode(",", $my_charz['exp']);
$room = mysql_query('SELECT ci.name FROM clan_item ci inner join clan_ware cw on ci.id = cw.item_id WHERE cw.id='.$my_charz['clan_train']);
$clanroom=mysql_fetch_assoc($room);

@ -24,6 +24,7 @@ include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/bann.inc.php');
include_once(ROOT_PATH.'/include/faq.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php');
include_once(ROOT_PATH.'/include/rassen.inc.php');
include_once(ROOT_PATH.'/include/user.inc.php');
include_once(ROOT_PATH.'/include/usergroup.inc.php');

@ -13,6 +13,8 @@ include_once(ROOT_PATH.'/include/attackenset.inc.php');
include_once(ROOT_PATH.'/include/erstellfunctions.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
define('ACTION_EDIT', 'edit');
define('ACTION_CREATE', 'create');
@ -134,11 +136,21 @@ function displayNPCInfo($action, $task, $charid) {
//Form-Variablen
echo "\t".'<input type="hidden" name="action" value="'.$action.'"></input>'."\n";
echo "\t".'<input type="hidden" name="task" value="'.$task.'"></input>'."\n";
$npc_race = getRaceTypeName('NPC'); // do not remove npc (there is a separate setting for this)
$races = getRacesByType($npc_race); // remove all NPC
$race_ids = array();
$race_names = array();
foreach($races as $race) {
$race_ids[] = $race['id'];
$race_names[] = $race['name'];
}
//initialisierung der Variablen für Inhalt
$d_select_array = array(array('Dragonball', 'Onepiece'), array(300, 1200, 3600));
$d_select_array = array($race_ids, array(300, 1200, 3600));
$d_array = array('charakter', 'name', 'type', 'hp', 'mp', 'starke', 'verteidigung', 'speed',
'ausdauer', 'glueck', 'zeit_rec', 'level', 'lvlmin', 'lvlmax', 'bild');
$desc_select_array = array(array('Dragonball', 'Onepiece'), array('5min', '20min', '60min'));
$desc_select_array = array($race_names, array('5min', '20min', '60min'));
$desc_array = array('ID', 'Name', 'Type', 'HP', 'MP', 'Stärke', 'Verteidigung', 'Geschwindigkeit',
'Ausdauer', 'Glück', 'Kampfdauer in Sekunden', 'Level', 'Min-Level', 'Max-Level', 'Bild');
$attset = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
@ -150,10 +162,15 @@ function displayNPCInfo($action, $task, $charid) {
$attset = getAttackSet($charid, NORMALKAMPF);
$attset_names = getAttackNames($attset);
$sql = 'SELECT * FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter WHERE c.id ='.$charid;
$sql = 'SELECT kl.*, ni.* FROM chars c inner join npc_item ni on ni.charakter = c.id inner join kampf_list kl on ni.charakter = kl.charakter WHERE c.id ='.$charid;
//$sql = 'SELECT * FROM chars c inner join kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid;
$qry = db_query($sql);
$row = mysql_fetch_assoc($qry);
// Fetch the char array by getChar method (for backwards compat) with no caching enabled!
$char_data = getChar($charid, false);
foreach( $char_data as $key => $value ) {
$row[$key] = $value;
}
}
$attacks = getNPCAttacks();
@ -290,7 +307,7 @@ function createNPC($data, $att_ids) {
}
//Char erstellen, wichtig für die restlichen Sachen
$success = erstelleChar(getNPCUser(), 'NPC', $data['name'], $data['bild'], $data['level'], 0, $data['hp'], $data['mp'], $data['starke'], $data['verteidigung'], $data['speed'],
$success = erstelleChar(getNPCUser(), $data['type'], $data['name'], $data['bild'], $data['level'], 0, $data['hp'], $data['mp'], $data['starke'], $data['verteidigung'], $data['speed'],
$data['ausdauer'], $data['glueck'], $data['type']);
if($success) {
@ -339,9 +356,7 @@ function createNPC($data, $att_ids) {
function displayDeleteNPC($charid) {
$colspan = 1;
$sql = 'SELECT * FROM chars WHERE id = '.$charid;
$qry = db_query($sql);
$row = mysql_fetch_assoc($qry);
$row = getChar($charid, false);
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">NPC löschen</h1></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll der NPC '.$row['name'].' wirklich gelöscht werden</td></tr>'."\n";
@ -364,7 +379,13 @@ function displayNPCOverview($page) {
$d_array = array('id', 'name', 'level');
$desc_array = array('id', 'Name', 'Level');
$sql = 'SELECT '.join($d_array,',').' from chars where rasse = \'NPC\' ORDER BY level, Name LIMIT '.($page*20).', 20';
$npc_race = getRaceTypeName('NPC'); // do not remove npc (there is a separate setting for this)
$races = getRacesByType($npc_race); // remove all NPC
foreach($races as $race) {
$include_race_ids[] = '\''.$race['id'].'\'';
}
$sql = 'SELECT '.join($d_array,',').' from chars where rasse IN ('.implode(',', $include_race_ids).') ORDER BY level, Name LIMIT '.($page*20).', 20';
$qry = db_query($sql);
$colspan = count($d_array);
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Übersicht</h1></td></tr>'."\n";;
@ -393,7 +414,7 @@ function displayNPCOverview($page) {
echo "\t".'</tr>'."\n";
}
$total = mysql_num_rows(db_query('SELECT '.join($d_array,',').' from chars where rasse = \'NPC\''));
$total = mysql_num_rows(db_query('SELECT '.join($d_array,',').' from chars where rasse IN ('.implode(',', $include_race_ids).')'));
$url = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>';
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n";
@ -439,4 +460,4 @@ function displayNPC($action, $task, $charid, $table, $page, $data, $att_ids){
echo "\t".'</table>'."\n";
echo '</form>'."\n";
}
?>
?>

@ -0,0 +1,270 @@
<?php
$blubb = "Hallo";
function getDefaultData() {
$array = array();
$array['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!
$array['race']=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
),
array(
'name' => 'Tsufurujin',
'type' => 2,
'id' => 13,
'hp' => 40,
'mp' => 125,
'str' => 0,
'def' => 0,
'spd' => 11,
'lck' => 30,
'stm' => 0,
'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
),
);
return $array;
}
function setupRassen() {
mysql_query('DROP database `rassen`');
mysql_query('DROP database `rassen_attacken`');
mysql_query('CREATE TABLE `rassen_type` (
`id` INT NOT NULL ,
`name` VARCHAR(45) NOT NULL ,
`gm_only` TINYINT NOT NULL DEFAULT false ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;');
mysql_query('CREATE TABLE `test_ag`.`rassen` (
`id` INT NOT NULL ,
`name` VARCHAR(45) NOT NULL ,
`type` INT NOT NULL DEFAULT 0 ,
`hp` INT NOT NULL DEFAULT 0 ,
`mp` INT NOT NULL DEFAULT 0 ,
`str` INT NOT NULL DEFAULT 0 ,
`def` INT NOT NULL DEFAULT 0 ,
`spd` INT NOT NULL DEFAULT 0 ,
`lck` INT NOT NULL DEFAULT 0 ,
`stm` INT NOT NULL DEFAULT 0 ,
`special` TINYINT NOT NULL DEFAULT false ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;');
}
function displayRassen($request) {
?>
<table>
<tr>
<th colspan="4">
Rassen Übersicht
</th>
</tr>
<tr>
<th align="center">Name</th>
<th align="center">Type</th>
<th align="center" colspan="2">Aktion</th>
</tr>
<?php
if(!mysql_query('SELECT * FROM rassen_types')) {
echo '<tr><th colspan="4"><a href="">setup rassen database</a></th></tr>';
} else {
$race_types = getRaceTypes();
foreach($race_types as $type) {
$races = getRacesByType($type);
foreach($races as $race) {
echo '<tr><td>'.$race['name'].'</td><td>'.$type['name'].'</td><td>Edit</td><td>Delete</td>'."\n";
}
}
}
?>
<tr>
<td>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}

@ -132,9 +132,11 @@ function getChar2($charid) {
} 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($rasse != NULL) {
$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) {
@ -142,9 +144,11 @@ function getChar2($charid) {
$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);
if($rasse != NULL) {
$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;

Loading…
Cancel
Save