Commit Graph
3086 Commits
Author SHA1 Message Date
A_D d0bc006f9f Cleared final mypy errors in inara 2021-04-12 08:31:47 +01:00
Athanasius 34d4e72bc4 GitHub workflows: echo info about what we're git diff'ing
Whenever A_D does a PR the checks, for some unclear reason, also contain
'other' files causing unexpected flake8 output.

i.e. PR that changes only plugins/inara.py somehow "git diff .. | flake8"
such that flake8 complains about things in collate.py, coriolis.py,
loadout.py
2021-04-12 08:31:47 +01:00
Athanasius 878a247604 inara: A few final type fixups 2021-04-12 08:31:47 +01:00
Athanasius aaceaf0f52 inara: More type fixing 2021-04-12 08:31:47 +01:00
Athanasius 7ef6c17fa1 inara: Fix 'fleet' type 2021-04-12 08:31:47 +01:00
Athanasius 3ea6dac00b inara: Further cleanup
* missing 'this' variables declared in This.__init__()
* Types up to end of journal_entry()
2021-04-12 08:31:47 +01:00
Athanasius 6e98cf04d9 inara: Begin conversion to 'This' class. 2021-04-12 08:31:47 +01:00
Athanasius 8cbf37624c Inara: Ignore cognitive complexity & snake_case a var 2021-04-12 08:31:47 +01:00
Athanasius f494a948eb inara: Rename ALLCAPS function vars for padding. 2021-04-12 08:31:47 +01:00
Athanasius 9fd14a3980 Inara: Don't send a setCommanderReputationMajorFaction if we have no Reputations
Sure the `for k, v in ...` means not sending any that are empty/none,
but it will still send the event, just with *no* reputations.

When you're on a fresh character you have no reputations yet, so avoid
causing an Inara API error, including status line text.

Close #581
2021-04-12 08:31:47 +01:00
Athanasius 960cb17cfb Also handle 'Data' category ShipLocker and BackPack
I missed this because it is NOT in `ShipLockerItems`, but does show up
in `TransferMicroResources`.
2021-04-12 08:31:47 +01:00
Athanasius 020eb36d84 Add comment about why we empty backpack on ShipLockerMaterials 2021-04-12 08:31:47 +01:00
Athanasius 112525c31e Add paranoia check for BackPack material counts going negative.
Reset them to zero if they're negative.  It's probably from an
Embark-related TransferMicroResources event, so they should now be
zeroes anyway.
2021-04-12 08:31:47 +01:00
Athanasius 5f59487a7b Zero out BackPack Materials on ShipLockerMaterials
This at least ensures we're correct after logging back in at a station.

If you relog whilst out at a Settlement then counts will definitely be
wrong now.  But there are no events for using consumables, or picking
anything up anyway, so it's almost always going to be off there.
2021-04-12 08:31:47 +01:00
Athanasius 9609286ff4 Support for 'TransferMicroResources' event. 2021-04-12 08:31:47 +01:00
Athanasius c5d2300ba5 Support for 'TradeMicroResources' event
This has an array 'Offered' listing what was traded away.
'Category' & 'Received' is what you got in return, 'Count' many.

Again, we assume this only interacts with ShipLocker, not BackPack.
2021-04-12 08:31:47 +01:00
Athanasius c94ebad54c Support for event 'SellMicroResources'
These are being sold to a Bar Tender.

There's a MicroResources array, one per item name.  We assume this is
always selling from ShipLocker, not BackPack.
2021-04-12 08:31:47 +01:00
Athanasius a2c48fdd70 Support for 'BuyMicroResources' event
This is currently only when buying Consumables from a Pioneer Supplies
vendor.

One event per Item type, it's not an array.

We're assuming these go into ShipLocker, not BackPack.
2021-04-12 08:31:47 +01:00
Athanasius 28c4fa03b1 Add support for BacKPackMaterials event
It's unclear from my Journals if this is adding to the current or is the
total state at the time.  I think it's the latter, despite not finding
where a '737844537' had come from (looks like from a mission, but that
would be reward and should have gone straight to ShipLocker?).
2021-04-12 08:31:47 +01:00
Athanasius 7040975bd2 Add support for 'ShipLockerMaterials' 2021-04-12 08:31:47 +01:00
Athanasius ad677d73f6 monitor.state: Group all Odyssey, and add other ShipLocker categories 2021-04-12 08:31:47 +01:00
Athanasius c4df5b2822 DRY init of self.state
It's identical in both places, so use a common function.
2021-04-12 08:31:47 +01:00
Athanasius b66d599508 Pre-Release 5.0.0-beta4: appversion and changelog 2021-04-12 08:31:47 +01:00
dependabot[bot] 874b688c09 build(deps-dev): bump pytest from 6.2.2 to 6.2.3
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.2 to 6.2.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.2...6.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-12 08:31:47 +01:00
Athanasius 30db492212 Bump to Python 3.9.4
I can PyCharm debug with this, unlike 3.9.3 :)
2021-04-12 08:31:47 +01:00
Athanasius 27961c1513 AppWindow.getandsend: Only blank status text when we play the bad sound
AppWindow.getandsend() is set on a timer for all of StartUp, Location
and Docked.  This means it can trigger up to three times for a login
when docked.

Subsequent calls would hit the cooldown timer and blank the status text
blindly, hiding the 'Last Updated at' text.

To be honest I'm not sure it even needs blanking *then*.
2021-04-12 08:31:47 +01:00
Athanasius 88a3f6d73a Remove erroneous on-foot check for 'Where are you?!'
This causes the check to not work as intended on live and is a left-over
from before fixing the code to just use 'err'.
2021-04-12 08:31:47 +01:00
Athanasius 5c99ef1243 Fix CAPI update properly for on-foot/embarking.
* Stop relying on self.status['text'] as indicator, set and use `err`.
2021-04-12 08:31:47 +01:00
Athanasius 72d200f616 Detect when on-foot but no known station.
This will trigger the "Where are you?!" message, which now can happen.

I need to double-check this against live behaviour, and might move this
to a different check, as I think on live it's valid to query in-space.
2021-04-12 08:31:47 +01:00
Athanasius bc6557dd9c Quieten various TRACE log output.
* A lot of this is commented out.  It might be useful in the future, but
  is just too noisy for now.
* Changed the protocol webserver to info, as it is.
* Left the EDSM 'not 1XX, 2XX or 5XX' in as it's a warning, so 'pass's
  on the conditional bodies that would be empty now trace's are
  commented.
2021-04-12 08:31:47 +01:00
Athanasius 33f0064dab Document edmc_data.py
* PLUGINS.md - now we only need mention this for such data.
* ChangeLog.md - pre-emptive section.
2021-04-12 08:31:47 +01:00
Athanasius c17e6ecade collate.py: Also newline='\n' on other open-for-write 2021-04-12 08:31:47 +01:00
Athanasius dbfa50739f collate.py: Use always '\n` line-ending on commodity file 2021-04-12 08:31:47 +01:00
Athanasius 32d87f68dd collate.py: Fix references to companion_category_map 2021-04-12 08:31:47 +01:00
Athanasius 5c5e5b507e monitor.py: Fix up legavy config.get() calls 2021-04-12 08:31:47 +01:00
Athanasius ad8c63c64c Move util_ships.py ship_map to data.py ship_name_map
Also refactors data.py to edmc_data.py as I'm having weird issues with
PyCharm debugger not starting, and this seems to be to do with module
name clashes.
2021-04-12 08:31:47 +01:00
Athanasius a80635fb46 td.py: Add comment about *not* moving some constants to data.py 2021-04-12 08:31:47 +01:00
Athanasius dda5a86f3d Move Status.json flags into data.py
These aren't used by any core code, but at least one plugin uses one.
2021-04-12 08:31:46 +01:00
Athanasius a47143a6a5 Move all static data from outfitting.py into data.py 2021-04-12 08:31:46 +01:00
Athanasius b961ca814a Move edshipyard.py slot_map into data.py 2021-04-12 08:31:46 +01:00
Athanasius 02d1a8cf45 Move coriolis.py coriolis_ship_map into data.py 2021-04-12 08:31:46 +01:00
Athanasius cc809de042 config.py: Remove 'protoype' comment about appversion being a function 2021-04-12 08:31:46 +01:00
Athanasius 5db62e48a3 Move companion.py category_map into data.py 2021-04-12 08:31:46 +01:00
Athanasius 5d289454a9 Move commodity.py bracketmap into data.py 2021-04-12 08:31:46 +01:00
Athanasius ee9565564b Add new data.py file to hold all static data.
The aim here is to avoid static data in modules that contain code.  Why?
So that we can avoid some potential import loops when the 'inner' module
only wants static data but is already imported by the 'outer' module for
code purposes.
2021-04-12 08:31:46 +01:00
Athanasius f2b89691c6 Python: Use 3.9.3 2021-04-12 08:31:46 +01:00
Athanasius c1cf90bda3 Add comment about using .parent because non-main script is in library.zip 2021-04-12 08:31:46 +01:00
Athanasius f16a367986 Use full path to open .gitversion out of paranoia. 2021-04-12 08:31:46 +01:00
Athanasius 0b88117844 chdir() to __file__ when not running frozen 2021-04-12 08:31:46 +01:00
Athanasius 103e856446 EDMarketConnector.py: Move chdir as early as possible
We need the config.py read of .gitversion to be from the right place.
2021-04-12 08:31:46 +01:00