Planetarion Database Dump: Difference between revisions

From Planetarion Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
== Description ==
== Description ==
The '''Planetarion Database Dumps''' are files with ingame information from [[Planetarion]].
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 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:07, 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 [[Arbiter]]'s and the various [[:Category:Resources|tool kits]].
These dump file(s) are usually used in [[Arbiter]]'s and the various [[:Category:Resources|tool kits]].
Line 13: Line 12:


http://jpaweb01.planetarion.com/botfiles/alliance_listing.txt
http://jpaweb01.planetarion.com/botfiles/alliance_listing.txt
==Structure==
Since 8th June 2004 the structures of the database dumps have been:
''Planets''<br>
<tt>X, Y, Z, Planet name, Ruler name, Race, Size, Score, Value</tt>
''Galaxies''<br>
<tt>X, Y, Galaxy Name, Size, Score, Value</tt>
''Alliances''<br>
<tt>Rank, Alliance name, Size, Members, Score</tt>
Each file starts with information about what the file contains.  eg:
<tt>Content: Planetarion Alliance Listing (sorted by rank)<br>
Author: Christian Lassem <[email protected]><br>
Version: 1.01<br>
Tick: 1406<br>
Separator: ' '<br>
Format: 'rank "alliance name" size members score'</tt>


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



Revision as of 22:43, 28 May 2005

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:07, 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 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

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;