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

432 Commits

Author SHA1 Message Date
David Sangrey
080d9f98f2
[1812] Handover Translations 2024-04-22 17:33:28 -04:00
David Sangrey
ccb103242c
Merge branch 'develop' into enhancement/2186/remove-darwin 2024-04-05 17:17:51 -04:00
David Sangrey
56a4ae25e0
[Nit] Clarify Comments 2024-03-27 22:21:26 -04:00
David Sangrey
1800f8f0b1
[2186] Remove Some Comments 2024-03-27 22:17:21 -04:00
David Sangrey
93d26e07e0
[2186] Remove Monitor, L10n References 2024-03-27 19:19:15 -04:00
David Sangrey
813cf92521
[1133] Add ContextMenu Globally 2024-03-23 16:54:13 -04:00
David Sangrey
4df38d6a73
[635] Remove Outdated Comment
All Dicts Keep Order.

Co-authored-by: Phoebe <40956085+C1701D@users.noreply.github.com>
2024-01-04 14:12:47 -05:00
David Sangrey
7cac00b2e8
[635] Remove Ordered Dict 2024-01-03 23:55:12 -05:00
David Sangrey
cb2a18025c
[2051] First Pass Remaining Files 2023-11-30 21:30:18 -05:00
David Sangrey
8763e9f5db
#2032 Suppress some Type Hint Errors 2023-07-22 22:02:35 -04:00
Athanasius
650b43cc3c
PLUGINS: Document monitor.is_live_galaxy() as sanctioned for use 2023-01-18 11:30:28 +00:00
Athanasius
5bd14ddd78
monitor: Don't synthesize StartUp if current event is ShutDown 2023-01-17 16:40:58 +00:00
Athanasius
9f0edc5a29
Merge pull request #1798 from EDCD/fix/1042/centralise-plugin-tracking
Move core plugin 'location' tracking into monitor.py
2023-01-17 11:31:13 +00:00
Athanasius
2f2ee885c8
monitor/tracking: *Do* clear supercruisentry/body state if Station type 2023-01-16 19:30:02 +00:00
Athanasius
3d41be7651
monitor: log INFO when for-plugins StartUp event synthesized
This is actually to do with a reported issue around the ctypes code in
`EDLogs.gamerunning()` causing:

```python
exception ignored on calling ctypes callback function: <function EDLogs.game_running.<locals>.callback at 0x0000020E9C9D0EA0>
Traceback (most recent call last):
  File "monitor.pyc", line 2041, in callback
  File "monitor.pyc", line 2034, in WindowTitle
ctypes.ArgumentError: argument 1: OverflowError: int too long to convert
```

Although I can't personally get this to trigger at all under 64-bit python,
either in PyCharm *or* with the 5.7.1-alpha1 64-bit pre-release.

`game_running()` is only used in a few places, and the key things it
malfunctioning might cause are lack of the synthetic `ShutDown` (already
has an INFO logging) and `StartUp` events.
2023-01-12 14:50:44 +00:00
Athanasius
ef1642181a
monitor/tracking: Move .stationtype to state['StationType']
* Nothing outside of monitor.py uses this, but it's of the same nature as
  StationName and MarketID, so do this for consistency.

For now we'll leave monitor.stationservices as-is.
2023-01-11 19:44:45 +00:00
Athanasius
31e8d0372d
monitor/tracking: Move .station_marketid to state['MarketID']
1. plugins/eddb.py uses this for MarketID-based station URLs.

* So do the 'rename'.
* Remove EDDB tracking in favour of this.
* Update PLUGINS.md
2023-01-11 19:44:44 +00:00
Athanasius
2a8dd14e24
tracking/stationname; Minor fixups
* Missed a some `self.station` in monitor.py
* Fixed EDDB system *and* station link setting.  Brainfart had mixed them
  together in last commit.
2023-01-11 19:44:43 +00:00
Athanasius
dde0cf876c
monitor/tracking: Move .station to state['StationName']
1. EDDB tracks this.

* So move monitor.station to monitor.state['StationName'].
* PLUGINS.md updated to cite this.
2023-01-11 19:44:41 +00:00
Athanasius
df5eb5b270
monitor/tracking: Switch .systempopulation to state['SystemPopulation']
1. EDDB plugin tracked this for keeping the Station link text up to date.

* So moved it to monitor.state['SystemPopulation'].
* PLUGINS.md updated to cite this.
* PLUGINS.md also updated to note state entries that are set to None if
  remote multi-crew is detected.
2023-01-11 19:44:14 +00:00
Athanasius
fa1c072d9e
monitor: Change .system to state['SystemName']
1. EDDB plugin needs to track the system name, but we're moving all of that
  into monitor.py.
2. monitor.py was tracking this in monitor.system, but it needs to be in
  monitor.state['SystemName'] in order for plugins to access it.

So, move monitor.system to monitor.state['SystemName'] and update all uses.
2023-01-11 19:44:08 +00:00
Athanasius
dab69367e2
monitor: Cite the Status.json body workaround for Body data caveat 2023-01-11 19:43:26 +00:00
Athanasius
d533919790
monitor: Add some documentation about the player location tracking caveats 2023-01-11 19:43:25 +00:00
Athanasius
edc23081b1
monitor: Extend 'approachbody' comment to call out use in plugins/eddn.py
We're setting `self.state['BodyType']` specifically so plugins/eddn.py's
'docked' handling can use it as a check.
2023-01-11 19:43:21 +00:00
Athanasius
e6abc137ce
monitor/tracking: Shift .coordinates to state['StarPos']
* Some additional commenting for future clarity.
* Remove the old eddn.py tracking.
2023-01-11 19:43:18 +00:00
Athanasius
232e91ebfc
monitor/Body: Tweak & comment, and remove defunct tracking from eddn.py
* Typod '.status' instead of 'state'.
* Bring in some sanity-checks and comments from eddn.py to monitor.py.
* Have a 'pass' elif for 'supercruiseentry' so as to comment why we do NOT
  use this to blank out body state.
* Bring in the 'if we exit to main menu, blank body state' from eddn.py.
* Remove checks from eddn.py that are now in monitor.py.
* Have a disctinct 'docked' event check in eddn.py for triggering the
  "Now we're docked, so the Delay sending until docked is satisfied"
  sending of messages.
2023-01-11 19:43:17 +00:00
Athanasius
e3254aec31
monitor: Minor cleanup on 'Location'->'Docked' handling
* All my recent Location events *have* the 'Docked' flag.
* If any don't, then just use a default on .get() to set it False.
2023-01-11 19:43:16 +00:00
Athanasius
0177fc4d69
monitor: Remove .planet in favour of state['Body']
This had mostly been done already, now it's complete.

*If* any plugin is, still, using `monitor.planet` then they get to keep
the broken pieces because it's not included in PLUGINS.md#Available-imports.
2023-01-11 19:43:16 +00:00
Athanasius
9ccd0c3b7d
monitor: Remove EDLogs.systemaddress in favour of .state version
This was literally only used within this file.
2023-01-11 19:43:15 +00:00
Athanasius
86b0aa4550
monitor: Track all System and Body state in monitor.state
* Minor grammar edit only in PLUGINS.md (I was checking if it explicitly
  stated what data is expected in the synthetic 'StartUp' event, it doesn't).
* First changes to move some monitor properties into the monitor.state
  dictionary.  This is for system or body data.
* Re-factored the generation of 'StartUp' event into
  `EDLogs.synthesize_startup_event()`.  It's done in two places, so was
  anti-DRY.
* In general any bulk setting of system & body data is now done in the
  same order for comparison clarity.
* A little of the location tracking has been duplicated from plugins/eddn.py.
  This is with a view to switching *it* to using the state version.
2023-01-11 19:43:14 +00:00
Athanasius
6bd0b042b1
monitor.py: typing: Don't use List or Dict 2023-01-11 19:43:13 +00:00
Athanasius
6d6f3b057f
typing: Use | None, not Optional[...] 2023-01-11 19:43:12 +00:00
Athanasius
79bbc8917f
Move 'this is the GameVersion we found' logging to DEBUG
This quietens it for normal EDMC.py usage.
2022-12-14 10:51:37 +00:00
Athanasius
25ed649b7a
monitor/NavRoute: Load NavRoute after catching_up ends.
This is to allow restart of EDMarketConnector whilst the game is running
to have `state['NavRoute']` hold data when the synthetic `StartUp` event
is passed to plugins.

NB: Probably need to note this in PLUGINS.md
2022-12-06 15:34:12 +00:00
Athanasius
d902093f0b
Merge pull request #1682 from EDCD/fix/1431/eddn-replay-enhancements
Change EDDN 'replay' to using an sqlite3 DB & otherwise improve
2022-11-27 15:24:28 +00:00
Athanasius
b3eff6ab32
monitor: Catch any failure to coerce gameversion
Also, log either the error or the success.  That will aid us in diagnosing
any future issues.
2022-11-27 13:02:54 +00:00
Athanasius
8a58220a66
inara: Send only Live galaxy data after Update 14
* Adds `monitor.is_live_galaxy()` for general use.
* Assumes Update 14 starts after 2022-11-29T09:00:00+00:00.  That's the
  currently schedule day, and recently the servers have been down by the time.
  Likelihood of them coming back *up* quickly seems slim to none.
* If we couldn't parse the `gameversion` from Journal using
  `semantic_version.Version.coerce()` this will fail, and assume we're on
  the Legacy galaxy.
2022-11-27 12:47:19 +00:00
Athanasius
a2d2723f49
monitor: Add an 'IsDocked' flag to monitor.state.
* This is cleaner than starting to track it in `plugins/eddn.py` specifically.
* This is literally only about if we're piloting a ship that is docked, so
  not even trying to resolve "on-foot, in a station, 'Location' said not
  docked though".
2022-11-22 15:29:05 +00:00
Athanasius
ddba99bfd8
monitor: Handle NavRouteClear & un-() an assert
* Stop trying to load `NavRoute.json` if it contained a `NavRouteClear`.
* `assert` is a *keyword*, not a function.
2022-08-10 11:28:10 +01:00
Athanasius
8e8f09ade3
Journal: FCMaterials: Implement parsing separate file
This re-uses much of the NavRoute.json code, with a minor tweak to *not*
store the result in monitor.state, instead just returning it to caller.
2022-06-04 17:27:08 +01:00
Athanasius
9f08b003c5
monitor: __navroute_retry(): be less noisy
No need to log at INFO for the retry counts, as this appears to be working,
make it DEBUG instead.

This was making the EDMC.py output needlessly noisy.
2022-03-18 09:51:35 +00:00
Athanasius
c89548c2ba
monitor: journal_newest_filename(): Check for None directory
os.listdir(None) operates on '.', which is wrong in this context, so be
sure to avoid that.
2022-03-18 09:49:02 +00:00
Athanasius
4b12a6c484
monitor: Properly type new_journal_file
Python was guessing and not allowing 'None', which it will be at shutdown
if this code triggers.
2022-03-18 09:46:35 +00:00
Athanasius
04930c59ac
monitor: Properly determine *newest* Journal file
Using os.path.getctime for the order, not the filename.  This addresses the
changed Journal filenames in Odyssey Update 11, whilst keeping compatibility
with the Horizons Update 11 old-name-style filenames.
2022-03-15 16:08:18 +00:00
Athanasius
e17a40aaff
monitor: Change Journal file regex, because Frontier are being a PITA
They've changed it to an ISO8601 style full date/time now.  But the Odyssey
client still uses the old format.
2022-03-15 13:56:48 +00:00
Athanasius
46e914fcec
monitor: Revert state['StarSystem'] addition, it's not needed.
We pass `monitor.system` in to `journal_entry()` anyway, so it doesn't need
to be separately in the passed `state`.
2022-02-11 11:57:05 +00:00
Athanasius
f1ba8ee5e1
eddn: Fix up approachsettlement & adjust other such function signatures
1. We need StarPos (as well as StarSystem)
2. Adding more state tracking in this plugin is misguided.
3. So added it in monitor instead, putting *copies* of data in the
  monitor.state dictionary.
4. So we reference those, but only available in journal_entry() itself, else
  we'd need to pass the whole of `state` in.
5. So instead pass in the bits of `state` only when we need them.
2022-02-09 16:07:16 +00:00
Athanasius
f8e0fb3658
monitor: Fold 'EngineerCraft' to lower case in event_type comparison 2022-02-04 12:22:47 +00:00
Athanasius
5e612d56b3
Merge pull request #1411 from A-UNDERSCORE-D/sys-plaform-mypy
Ensure that platform guards are recognised by mypy
2022-01-27 12:58:26 +00:00
Athanasius
3a4690d292
monitor: Gate navroute on *not* being in journal catch up mode
We can't just use `EDLogs.live` here as it'll get set `true` when the
`Commander` event is seen *during the catch up*.  We need that catchup
to have finished before we'll try processing a `NavRoute` event and
file.
2022-01-26 17:29:29 +00:00