These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Planet Info lookup. Python. Reverence. How to?

Author
Pantload
The Underpants Gnomes
#1 - 2012-02-04 06:57:12 UTC  |  Edited by: Pantload
Consider the following snippet of code:

*********************************************************************************

from reverence import blue

EVE_PATH = "###### YOUR EVE PATH HERE ######"

eve = blue.EVE(EVE_PATH)
loc = eve.cfg.evelocations.get
it = eve.cfg.invtypes.get

f = blue.ResFile()
f.Open("res:/UI/Shared/Maps/mapcache.dat")
mapcache = blue.marshal.Load(f.Read())
print "mapcache.keys() = %s" % mapcache.keys(), '\n'

planets = mapcache['planets']
planets_by_system = {}
for id, info in planets.iteritems():
....system_name = loc(info[0]).locationName
....planet_type = str(it(info[1]).typeName)
....#highsec systems seem to always have lower case letters in their names
....if system_name != system_name.upper():
........if not system_name in planets_by_system:
............planets_by_system[system_name] = []
........planets_by_system[system_name].append((planet_type, id))

for n in sorted(planets_by_system.keys()):
....print n
....for p in sorted(planets_by_system[n]):
........print p

*********************************************************************************

Sample output looks like this:

Aakari
('Planet (Barren)', 40088910)
('Planet (Barren)', 40088913)
('Planet (Barren)', 40088982)
('Planet (Gas)', 40088917)
('Planet (Gas)', 40088932)
('Planet (Gas)', 40088956)
('Planet (Gas)', 40088986)
('Planet (Lava)', 40088912)
('Planet (Lava)', 40088915)
('Planet (Oceanic)', 40088922)
('Planet (Storm)', 40088925)
('Planet (Storm)', 40088998)
Abagawa
('Planet (Barren)', 40009338)
('Planet (Gas)', 40009343)
('Planet (Gas)', 40009354)
('Planet (Gas)', 40009375)
('Planet (Ice)', 40009385)
('Planet (Lava)', 40009333)
('Planet (Lava)', 40009335)
('Planet (Storm)', 40009348)
('Planet (Temperate)', 40009340)


*********************************************************************************

Questions:

1) Where do I look up a conversion of the "id" into a planet name?
2) Can I look up attributes for a planet similar to show info in game? ( for example: planet radius )



Any help is greatly appreciated.

Cheers,
PL
Desmont McCallock
#2 - 2012-02-04 10:33:20 UTC
You need to import the SDE in a DB of your choice.
DB conversions can be found here.
Pantload
The Underpants Gnomes
#3 - 2012-02-04 17:57:40 UTC
Desmont McCallock wrote:
You need to import the SDE in a DB of your choice.
DB conversions can be found here.


I know next-to-nothing about using databases. I'm also really a novice at Python.

Can you elaborate on how I would access the information I spoke about? From the standpoint of accessing it in Python?

Any additional help would be much appreciated. I'm trying to learn here and not be such a novice at Python.


Cheers,
PL
Desmont McCallock
#4 - 2012-02-04 18:20:04 UTC
Well, the most popular used database is MySQL. So I guess first you'll have to install that on your machine (at the bottom of the page you will find a link to what you'll need to connect to MySQL from Python).

There are many programs out there that will make managing your MySQL DB easier (such as importing an MySQL dump [see DB conversions] in the database). Some that I recommend are:
HeidiSQL - free
Navicat - 30 days trial (purchasable)

This is as far as my knowledge can take me regarding Python and MySQL. For more info await a post from someone who knows more or search the web.
Dragonaire
Here there be Dragons
#5 - 2012-02-04 21:31:10 UTC
If you have Apache already installed phpMyAdmin for MySQL works well or phpPgAdmin for PostgreSQL.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.