1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-21 11:27:38 +03:00

Add "BodyName" property to Docked event

For planetary stations (if known)
This commit is contained in:
Jonathan Harris 2016-11-12 12:43:59 +00:00
parent 3088073b46
commit 090a55f8de
2 changed files with 13 additions and 1 deletions

@ -598,6 +598,10 @@ class AppWindow:
if thing.endswith('_Localised'):
entry.pop(thing, None)
# add planet to Docked event for planetary stations if known
if entry['event'] == 'Docked' and monitor.body:
entry['BodyName'] = monitor.body
# add mandatory StarSystem and StarPos properties to Scan events
if 'StarSystem' not in entry:
entry['StarSystem'] = monitor.system

@ -80,6 +80,7 @@ class EDLogs(FileSystemEventHandler):
self.shipid = None
self.shiptype = None
self.shippaint = None
self.body = None
self.system = None
self.station = None
self.coordinates = None
@ -138,7 +139,7 @@ class EDLogs(FileSystemEventHandler):
if __debug__:
print 'Stopping monitoring'
self.currentdir = None
self.version = self.mode = self.cmdr = self.system = self.station = self.coordinates = None
self.version = self.mode = self.cmdr = self.body = self.system = self.station = self.coordinates = None
self.is_beta = False
if self.observed:
self.observed = None
@ -236,6 +237,7 @@ class EDLogs(FileSystemEventHandler):
self.shipid = entry.get('ShipID') # None in CQC
self.shiptype = 'Ship' in entry and entry['Ship'].lower() or None # None in CQC
self.shippaint = None
self.body = None
self.system = None
self.station = None
self.coordinates = None
@ -257,12 +259,18 @@ class EDLogs(FileSystemEventHandler):
elif entry['event'] in ['Undocked']:
self.station = None
elif entry['event'] in ['Location', 'FSDJump', 'Docked']:
if entry['event'] != 'Docked':
self.body = None
if 'StarPos' in entry:
self.coordinates = tuple(entry['StarPos'])
elif self.system != entry['StarSystem']:
self.coordinates = None # Docked event doesn't include coordinates
self.system = entry['StarSystem'] == 'ProvingGround' and 'CQC' or entry['StarSystem']
self.station = entry.get('StationName') # May be None
elif entry['event'] == 'SupercruiseExit':
self.body = entry.get('BodyType') == 'Planet' and entry.get('Body')
elif entry['event'] == 'SupercruiseEntry':
self.body = None
elif entry['event'] in ['Rank', 'Promotion'] and self.ranks:
for k,v in entry.iteritems():
if k in self.ranks: