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

398 Commits

Author SHA1 Message Date
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
A_D
eb28a3b502
Use sys.platform, minor type updates 2022-01-26 18:51:41 +02:00
Athanasius
e98aec0169
monitor: Comment what MAX_NAVROUTE_DISCREPANCY is
So as to disambiguate from "some discrepancy within the route data".
2022-01-26 16:38:01 +00:00
A_D
62a0a96dc6
resolve final review comments 2022-01-26 17:42:50 +02:00
A_D
36ecb69964
refactor to use retry function for all attempts at navroute 2022-01-26 13:17:27 +02:00
A_D
06d4842da2
Be more parinoid about navroute files 2022-01-25 20:17:05 +02:00
A_D
d4c6cd94fe
retry navroute parsing after failure 2022-01-25 20:17:04 +02:00
Athanasius
8363e8c646
monitor: Don't re-init Enginers/Rank/Reputation on LoadGame
The order of Journal events changed from:

  1. LoadGame
  2. Rank
  3. Progress

to:

  1. Rank
  2. Progress
  3. LoadGame

in Odyssey, and in at least current 'base game' and Horizons clients as
well.  Also 'Reputation' event is before 'LoadGame' now.  So simply
allow those events to have populated the data, don't re-init on
LoadGame.

Yes, I'm preferring to leave the lines in, but commented, so it's clear
why those aren't being init'd, *and* why 'Statistics' still is, and as
of what game version.
2021-11-21 11:24:18 +00:00
Athanasius
919136874d
CAPI: Re-auth when Access Token expired: Need to .close() first
The old code did this, and without it we enter a loop of:

1. CAPI says unauthorized
2. We call login()
3. But companion.session.state == STATE_OK, so do nothing
4. Re-scheduled CAPI request goes back to 1.
2021-11-06 08:41:09 +00:00
Athanasius
2754385281
monitor: Use trace_if('journal.startup', ...) for game load-in 2021-08-13 15:14:03 +01:00
Athanasius
1378f765cc
monitor: Convert to logger.trace_if() 2021-08-13 15:14:02 +01:00
A_D
05e6838637
removed trace_on imports 2021-08-12 16:49:27 +02:00
A_D
fefa3d351d
replaced if x in trace_on with trace_if 2021-08-12 16:46:55 +02:00
Athanasius
97808f5561
monitor.py: Access trace_on via whole-config import
This is necessary so as to see the same instance of config.trace_on as
is set up by EDMarketConnector.py.
2021-08-11 12:33:22 +01:00
0bb06232b8
monitor.py: add default value to entry.get('GameMode') in CQC detection 2021-08-11 14:24:27 +03:00
bd32b44903
monitor.py: fix CQC to lower case 2021-08-11 13:50:09 +03:00
42ce2ad414
monitor.py: trace loadgames to CQC only if in trace_on 2021-08-10 14:27:47 +03:00
7b823dd64d
Remove commented out logger.debug() 2021-08-10 03:16:57 +03:00
e9ee65da14
Code style fix 2021-08-10 03:15:50 +03:00
3283439485
Code style fixes 2021-08-10 03:00:36 +03:00
a00a677746
monitor.py: use trace instead debug to log CQC loadgames 2021-08-10 02:49:58 +03:00
d7dd8c8990
Be more paranoid with GameMode and CQC 2021-08-09 17:15:54 +03:00
291fbf2908
Use both Ship and GameMode fields of LoadGame event to detect CQC
And freeze update button when in CQC
2021-08-09 15:59:30 +03:00
27fe43bf8c
WIP: implement journal_entry_cqc()
journal_entry_cqc function in plugin's api allow plugins to recieve
journal events when player are in CQC
2021-08-09 04:37:23 +03:00
Athanasius
cc6b52a9ed
Shiplocker: while/else a failure logging 2021-08-07 14:45:46 +01:00
Athanasius
dc953b49a6
shiplocker: Implement ShipLocker.json load/decoding retries
* Currently a maximum of 5 attempts, 10ms apart.
* I was going to blank `entry = {}` for this, but there's a chance the
  file load would fail when at startup and Embark the in-Journal event
  actually has all the data.  So we cross our fingers and hope that's
  the case if loading fails.
* Changed the "not all the categories" logging to WARN to call out the
  failure.
* Removed old comment about not touching Backpack here.
2021-08-07 14:38:03 +01:00
Athanasius
292b508985
monitor: Prepare for more-paranoid Shiplocker.json loading 2021-08-07 14:20:05 +01:00
Athanasius
ea88a57e18
monitor: Gate Commander/LoadGame TRACE on trace_on 'startup' 2021-08-05 13:46:20 +01:00
A_D
9466d8fc81
reorder new file checks
we want to finish our current file, if anything, before continuing onto a new file
2021-08-04 15:43:00 +02:00
A_D
7c78b40090
always update with journal data 2021-07-07 11:02:11 +02:00
A_D
dec2e07ce0
revert previous commit, handle \ in lang names 2021-07-03 17:23:30 +02:00
A_D
edbf1263a9
Dont store version on loadgame, its content is faulty 2021-07-03 17:14:25 +02:00
A_D
1e691d306e
Added support for resupply event
its a reskinned backpack, so thats how its being handled
2021-07-03 13:22:39 +02:00
A_D
d63b6ad782
removed suits["slots"] (for now) 2021-07-01 12:47:07 +02:00
A_D
67df2efc8a
DRY-ed setting version info
Also removed some uneeded type ignores
2021-07-01 12:27:15 +02:00