You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			269 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			269 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			PHP
		
	
| <?php
 | |
| 
 | |
| 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'		=> 50,
 | |
| 		'mp'		=> 120,
 | |
| 		'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 
 | |
| }
 |