mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Added rudimentry taxi status tracking
This commit is contained in:
parent
11ec6bfe49
commit
a7a9de77d7
23
monitor.py
23
monitor.py
@ -160,6 +160,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
'Suits': {},
|
'Suits': {},
|
||||||
'SuitLoadoutCurrent': None,
|
'SuitLoadoutCurrent': None,
|
||||||
'SuitLoadouts': {},
|
'SuitLoadouts': {},
|
||||||
|
'Taxi': None, # True whenever we are _in_ a taxi. ie, this is reset on Disembark etc.
|
||||||
|
'Dropship': None, # Best effort as to whether or not the above taxi is a dropship.
|
||||||
}
|
}
|
||||||
|
|
||||||
def start(self, root: 'tkinter.Tk') -> bool: # noqa: CCR001
|
def start(self, root: 'tkinter.Tk') -> bool: # noqa: CCR001
|
||||||
@ -535,6 +537,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
'Reputation': {},
|
'Reputation': {},
|
||||||
'Statistics': {},
|
'Statistics': {},
|
||||||
'Role': None,
|
'Role': None,
|
||||||
|
'Taxi': None,
|
||||||
|
'Dropship': None,
|
||||||
})
|
})
|
||||||
if entry.get('Ship') is not None and self._RE_SHIP_ONFOOT.search(entry['Ship']):
|
if entry.get('Ship') is not None and self._RE_SHIP_ONFOOT.search(entry['Ship']):
|
||||||
self.state['OnFoot'] = True
|
self.state['OnFoot'] = True
|
||||||
@ -668,6 +672,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
self.station = entry.get('StationName', '')
|
self.station = entry.get('StationName', '')
|
||||||
|
|
||||||
self.state['OnFoot'] = False
|
self.state['OnFoot'] = False
|
||||||
|
self.state['Taxi'] = entry['Taxi']
|
||||||
|
|
||||||
elif event_type == 'Disembark':
|
elif event_type == 'Disembark':
|
||||||
# This event is logged when the player steps out of a ship or SRV
|
# This event is logged when the player steps out of a ship or SRV
|
||||||
@ -694,10 +699,17 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
self.station = None
|
self.station = None
|
||||||
|
|
||||||
self.state['OnFoot'] = True
|
self.state['OnFoot'] = True
|
||||||
|
if self.state['Taxi'] is not None and not self.state['Taxi']:
|
||||||
|
logger.warning('Disembarked from a taxi but we didn\'t know we were in a taxi?')
|
||||||
|
|
||||||
|
self.state['Taxi'] = False
|
||||||
|
self.state['Dropship'] = False
|
||||||
|
|
||||||
elif event_type == 'DropshipDeploy':
|
elif event_type == 'DropshipDeploy':
|
||||||
# We're definitely on-foot now
|
# We're definitely on-foot now
|
||||||
self.state['OnFoot'] = True
|
self.state['OnFoot'] = True
|
||||||
|
self.state['Taxi'] = False
|
||||||
|
self.state['Dropship'] = False
|
||||||
|
|
||||||
elif event_type == 'Docked':
|
elif event_type == 'Docked':
|
||||||
self.station = entry.get('StationName') # May be None
|
self.station = entry.get('StationName') # May be None
|
||||||
@ -705,6 +717,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
self.stationtype = entry.get('StationType') # May be None
|
self.stationtype = entry.get('StationType') # May be None
|
||||||
self.stationservices = entry.get('StationServices') # None under E:D < 2.4
|
self.stationservices = entry.get('StationServices') # None under E:D < 2.4
|
||||||
|
|
||||||
|
# No need to set self.state['Taxi'] or Dropship here, if its those, the next event is a Disembark anyway
|
||||||
|
|
||||||
elif event_type in ('Location', 'FSDJump', 'CarrierJump'):
|
elif event_type in ('Location', 'FSDJump', 'CarrierJump'):
|
||||||
# alpha4 - any changes ?
|
# alpha4 - any changes ?
|
||||||
# Location:
|
# Location:
|
||||||
@ -742,6 +756,10 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
self.stationtype = entry.get('StationType') # May be None
|
self.stationtype = entry.get('StationType') # May be None
|
||||||
self.stationservices = entry.get('StationServices') # None in Odyssey for on-foot 'Location'
|
self.stationservices = entry.get('StationServices') # None in Odyssey for on-foot 'Location'
|
||||||
|
|
||||||
|
self.state['Taxi'] = entry.get('Taxi', None)
|
||||||
|
if not self.state['Taxi']:
|
||||||
|
self.state['Dropship'] = None
|
||||||
|
|
||||||
elif event_type == 'ApproachBody':
|
elif event_type == 'ApproachBody':
|
||||||
self.planet = entry['Body']
|
self.planet = entry['Body']
|
||||||
|
|
||||||
@ -1284,6 +1302,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
|
|
||||||
elif event_type == 'BookDropship':
|
elif event_type == 'BookDropship':
|
||||||
self.state['Credits'] -= entry.get('Cost', 0)
|
self.state['Credits'] -= entry.get('Cost', 0)
|
||||||
|
self.state['Dropship'] = True
|
||||||
# Technically we *might* now not be OnFoot.
|
# Technically we *might* now not be OnFoot.
|
||||||
# The problem is that this event is recorded both for signing up for
|
# The problem is that this event is recorded both for signing up for
|
||||||
# an on-foot CZ, and when you use the Dropship to return after the
|
# an on-foot CZ, and when you use the Dropship to return after the
|
||||||
@ -1297,12 +1316,16 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
|
|
||||||
elif event_type == 'BookTaxi':
|
elif event_type == 'BookTaxi':
|
||||||
self.state['Credits'] -= entry.get('Cost', 0)
|
self.state['Credits'] -= entry.get('Cost', 0)
|
||||||
|
# Dont set taxi state here, as we're not IN a taxi yet. Set it on Embark
|
||||||
|
|
||||||
elif event_type == 'CancelDropship':
|
elif event_type == 'CancelDropship':
|
||||||
self.state['Credits'] += entry.get('Refund', 0)
|
self.state['Credits'] += entry.get('Refund', 0)
|
||||||
|
self.state['Dropship'] = False
|
||||||
|
self.state['Taxi'] = False
|
||||||
|
|
||||||
elif event_type == 'CancelTaxi':
|
elif event_type == 'CancelTaxi':
|
||||||
self.state['Credits'] += entry.get('Refund', 0)
|
self.state['Credits'] += entry.get('Refund', 0)
|
||||||
|
self.state['Taxi'] = False
|
||||||
|
|
||||||
elif event_type == 'NavRoute':
|
elif event_type == 'NavRoute':
|
||||||
# Added in ED 3.7 - multi-hop route details in NavRoute.json
|
# Added in ED 3.7 - multi-hop route details in NavRoute.json
|
||||||
|
Loading…
x
Reference in New Issue
Block a user