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 ==
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 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.
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.
Line 5: Line 4:
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]].


==Location==
The dumpfiles are available at:
The dumpfiles are available at:


Line 14: Line 14:


==Structure==
==Structure==
Since 8th June 2004 the structures of the database dumps have been:
Wiki restrictions prevent the displaying of tab characters. The plain text can be accessed through the source of this page (Alt+E). Each file starts with information about what the file contains.  eg:


''Planets''<br>
<tt>Content: Planetarion Planet Listing (sorted by x, y, z)<br />
<tt>X, Y, Z, Planet name, Ruler name, Race, Size, Score, Value</tt>
Author: Appocomaster <[email protected]><br />
Version: 1.01<br />
Tick: 471<br />
Separator: ' '<br />
Format: 'x y z "planet name" "ruler name" race size score value xp'
</tt>


''Galaxies''<br>
====Planets====
<tt>X, Y, Galaxy Name, Size, Score, Value</tt>
<tt>x y z "planet name" "ruler name" race size score value xp</tt>


''Alliances''<br>
====Galaxies====
<tt>Rank, Alliance name, Size, Members, Score</tt>
<tt>x y "galaxy name" size score value xp</tt>


Each file starts with information about what the file contains.  eg:
====Alliances====
 
<tt>rank "alliance name" size members score</tt>
<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]] also utilize them.  
Many alliances write their own tools using these dumpfiles and sites such as [[Sandmans]] also utilize them.  


Below are some basic php code examples on how to use them:
Below are some basic php code examples on how to use them. ''Note: these are untested.''


  <?
  <?
  mysql_connect( "host", "user", "pass" );
  mysql_connect( "host", "user", "pass" );
  mysql_select_db( "database" );  
  mysql_select_db( "database" );  
   
   
  $planetList = file_get_contents( "http://jpaweb01.planetarion.com/botfiles/planet_listing.txt" );
  $planetList = file_get_contents( "http://game.planetarion.com/botfiles/planet_listing.txt" );
   
   
  preg_match_all( "/(\d+)\t(\d+)\t(\d+)\t\"(.+)\"\t\"(.+)\"\t(.+)\t(\d+)\t(\d+)/i",  
  preg_match_all( "/(\d+)\t(\d+)\t(\d+)\t\"(.+)\"\t\"(.+)\"\t(.+)\t(\d+)\t(\d+)\t(\d+)\t(\d+)/i",  
  $planetList,  $planetArray, PREG_SET_ORDER );
  $planetList,  $planetArray, PREG_SET_ORDER );
  mysql_query( "TRUNCATE TABLE planets" );
  mysql_query( "TRUNCATE TABLE planets" );
   
   
  foreach ( $planetArray as $planet )
  foreach ( $planetArray as $planet )
  {
  {
mysql_query( "INSERT INTO planets VALUES ( $planet[1], $planet[2],  
        mysql_query( "INSERT INTO planets VALUES ( $planet[1], $planet[2],  
         $planet[3], '$planet [4]', '$planets[5]', '$planet[6]', $planet[7], $planet[8] )" );  
         $planet[3], '$planet [4]', '$planets[5]', '$planet[6]', $planet[7],  
        $planet[8],  $planet[9],    $planet[10] )" );  
  }
  }
  ?>
  ?>


Line 69: Line 66:
   `ruler` varchar(70) NOT NULL default '',
   `ruler` varchar(70) NOT NULL default '',
   `race` varchar(15) NOT NULL default '',
   `race` varchar(15) NOT NULL default '',
   `roids` bigint(20) unsigned NOT NULL default '0',
   `size` bigint(20) unsigned NOT NULL default '0',
   `score` bigint(20) NOT NULL default '0',
   `score` bigint(20) NOT NULL default '0',
  `value` bigint(20) NOT NULL default '0',
  `xp` bigint(20) NOT NULL default '0',
   PRIMARY KEY  (`planet`)
   PRIMARY KEY  (`planet`)
  ) TYPE=MyISAM;
  ) TYPE=MyISAM;


 
==Usage notes==
 
Employing an overly aggressive polling policy is frowned upon and [[PA Team]] reserves the right to revoke your access to the dump files.


[[Category:Terminology]][[Category:Resources]]
[[Category:Terminology]][[Category:Resources]]

Revision as of 10:25, 17 June 2010

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.

Location

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

Wiki restrictions prevent the displaying of tab characters. The plain text can be accessed through the source of this page (Alt+E). Each file starts with information about what the file contains. eg:

Content: Planetarion Planet Listing (sorted by x, y, z)
Author: Appocomaster <[email protected]>
Version: 1.01
Tick: 471
Separator: ' '
Format: 'x y z "planet name" "ruler name" race size score value xp'

Planets

x y z "planet name" "ruler name" race size score value xp

Galaxies

x y "galaxy name" size score value xp

Alliances

rank "alliance name" size members score

Tools

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

Below are some basic php code examples on how to use them. Note: these are untested.

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

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

preg_match_all( "/(\d+)\t(\d+)\t(\d+)\t\"(.+)\"\t\"(.+)\"\t(.+)\t(\d+)\t(\d+)\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],  $planet[9],    $planet[10] )" ); 
}
?>

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 ,
 `size` bigint(20) unsigned NOT NULL default '0',
 `score` bigint(20) NOT NULL default '0',
 `value` bigint(20) NOT NULL default '0',
 `xp` bigint(20) NOT NULL default '0',
 PRIMARY KEY  (`planet`)
) TYPE=MyISAM;

Usage notes

Employing an overly aggressive polling policy is frowned upon and PA Team reserves the right to revoke your access to the dump files.