diff --git a/PLUGINS.md b/PLUGINS.md index 32b5fd4e..5f773d08 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -426,7 +426,9 @@ Content of `state` (updated to the current journal entry): | `ModulesValue` | `int` | Value of the current ship's modules | | `Rebuy` | `int` | Current ship's rebuy cost | | `Modules` | `dict` | Currently fitted modules | -| `Route` | `dict` | Last plotted multi-hop route | +| `NavRoute` | `dict` | Last plotted multi-hop route | + +##### Synthetic Events A special "StartUp" entry is sent if EDMC is started while the game is already running. In this case you won't receive initial events such as "LoadGame", @@ -445,6 +447,22 @@ between the two scenarios. This event is not sent when EDMC is running on a different machine so you should not *rely* on receiving this event. +##### Augmented Events + +In some cases we augment the events, as seen in the Journal, with extra data. +Examples of this are: + +1. Every `Cargo` event passed to plugins contains the data from + `Cargo.json` (but see above for caveats). + +1. Every `NavRoute` event contains the full `Route` array as loaded from + `NavRoute.json`. You do not need to access this via + `monitor.state['NavRoute']`, although it is available there. + + *NB: There is no indication available when a player cancels a route.* The + game itself does not provide any such, not in a Journal event, not in a + `Status.json` flag. + #### Player Dashboard ```python @@ -478,8 +496,8 @@ contains all the data), this will not be populated at login.** New in version 5.0.0: -`Route` contains the `json.load()` of `Route.json` as indicated by a journal -`Route` event. +`NavRoute` contains the `json.load()` of `NavRoute.json` as indicated by a journal +`NavRoute` event. #### Getting Commander Data diff --git a/monitor.py b/monitor.py index f76eba24..a2fbc1b5 100644 --- a/monitor.py +++ b/monitor.py @@ -668,9 +668,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below self.state['Cargo'].update({self.canonicalise(x['Name']): x['Count'] for x in clean}) - elif event_type == 'Route': + elif event_type == 'NavRoute': # Added in ED 3.7 - multi-hop route details in Route.json - with open(join(self.currentdir, 'Route.json'), 'rb') as rf: # type: ignore + with open(join(self.currentdir, 'NavRoute.json'), 'rb') as rf: # type: ignore entry = json.load(rf) self.state['Route'] = entry