Planetarion Database Dump

From Planetarion Wiki
Revision as of 16:40, 16 November 2006 by Squidly (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. They are generated at the end of the tick which is usually around xx:04, but it has been recommended that any sites wishing to use them retrieve them no earlier than xx:15 in order to allow for ticks which take longer than normal.

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

The dumpfiles are available at:

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

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

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

Structure

Since 8th June 2004 the structures of the database dumps have been:

Planets
X, Y, Z, Planet name, Ruler name, Race, Size, Score, Value

Galaxies
X, Y, Galaxy Name, Size, Score, Value

Alliances
Rank, Alliance name, Size, Members, Score

Each file starts with information about what the file contains. eg:

Content: Planetarion Alliance Listing (sorted by rank)
Author: Christian Lassem <[email protected]>
Version: 1.01
Tick: 1406
Separator: ' '
Format: 'rank "alliance name" size members score'

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;