Planetarion Database Dump

From Planetarion Wiki
Revision as of 12:00, 3 January 2005 by Banned (talk | contribs)
Jump to navigationJump to search

Description

The Planetarion Database Dumps are files with ingame information from Planetarion. They show planet, galaxy and alliance information, such as score, size and value.

These dump file(s) are usually used in Arbiter's and the various tool kits.

The dumpfiles are available at:

http://jpaweb01.planetarion.com/botfiles/planet_listing.txt

http://jpaweb01.planetarion.com/botfiles/galaxy_listing.txt

http://jpaweb01.planetarion.com/botfiles/alliance_listing.txt

Tools

Many alliances write their own tools using these dumpfiles, and sites such as sandmans and pilkara also utilize them.

Here are some basic php code examples on how to use em:

<?

mysql_connect( "host", "user", "pass" );
mysql_select_db( "database" ); 

$planetList = file_get_contents( "http://jpaweb01.planetarion.com/botfiles/planet_listing.txt" );

preg_match_all( "/(\d+)\t(\d+)\t(\d+)\t\"(.+)\"\t\"(.+)\"\t(.+)\t(\d+)\t(\d+)/i", 
$planetList,  $planetArray, PREG_SET_ORDER );
	
		
mysql_query( "TRUNCATE TABLE planets" );

foreach ( $planetArray as $planet )
{
	mysql_query( "INSERT INTO planets VALUES ( $planet[1], $planet[2], 
       $planet[3], '$planet [4]', '$planets[5]', '$planet[6]', $planet[7], $planet[8] )" ); 
}

?>

And here is the MySQL table structure to go with it:

CREATE TABLE `planets` (
 `x` int(10) unsigned NOT NULL default '0',
 `y` int(10) unsigned NOT NULL default '0',
 `z` int(10) unsigned NOT NULL default '0',
 `planet` varchar(70) NOT NULL default ,
 `ruler` varchar(70) NOT NULL default ,
 `race` varchar(15) NOT NULL default ,
 `roids` bigint(20) unsigned NOT NULL default '0',
 `score` bigint(20) NOT NULL default '0',
 PRIMARY KEY  (`planet`)
) TYPE=MyISAM;