1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 00:07:14 +03:00

Don't attempt to set user's ship if in Fighter or SRV

This commit is contained in:
Jonathan Harris 2018-03-04 18:01:19 +00:00
parent e2d79b9191
commit fdd770fe64
2 changed files with 7 additions and 8 deletions

View File

@ -360,7 +360,7 @@ class EDLogs(FileSystemEventHandler):
self.systemaddress = None
self.missioncargo = {}
self.started = timegm(strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ'))
self.state.update({
self.state.update({ # Don't set Ship, ShipID etc since this will reflect Fighter or SRV if starting in those
'Captain' : None,
'Credits' : entry['Credits'],
'Loan' : entry['Loan'],
@ -396,7 +396,7 @@ class EDLogs(FileSystemEventHandler):
self.state['ModulesValue'] = None
self.state['Rebuy'] = None
self.state['Modules'] = None
elif entry['event'] == 'Loadout':
elif entry['event'] == 'Loadout': # Not generated if in Fighter or SRV
self.state['ShipID'] = entry['ShipID']
self.state['ShipIdent'] = entry['ShipIdent']
self.state['ShipName'] = entry['ShipName']

View File

@ -250,13 +250,14 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
]))
# Update ship
if (entry['event'] in ['StartUp', 'Cargo'] or
(entry['event'] == 'Loadout' and this.shipswap) or
this.newuser):
if (state['ShipID'] and # Unknown if started in Fighter or SRV
(entry['event'] in ['StartUp', 'Cargo'] or
(entry['event'] == 'Loadout' and this.shipswap) or
this.newuser)):
data = OrderedDict([
('shipType', state['ShipType']),
('shipGameID', state['ShipID']),
('shipName', state['ShipName']), # Can be None
('shipName', state['ShipName']), # Can be None
('shipIdent', state['ShipIdent']), # Can be None
('isCurrentShip', True),
])
@ -278,8 +279,6 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
OrderedDict([
('starsystemName', system),
('stationName', station), # Can be None
('shipType', state['ShipType']),
('shipGameID', state['ShipID']),
]))
elif entry['event'] == 'Docked':