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

456 Commits

Author SHA1 Message Date
Athanasius
ac4f052695 Suits: Update credits on BuyWeapon
Also cleaning out some verbose comments.
2021-04-29 12:38:01 +01:00
Athanasius
7b76e327ce Suits: Always set 'id' to None
Better to get a `None` value than a KeyError.
2021-04-29 12:32:31 +01:00
Athanasius
d27075cb38 Suits: Handle LoadoutEquipModule event
We're assuming weapons only at this point.  Might need adjustment when
we get access to engineering.
2021-04-29 12:28:45 +01:00
Athanasius
d35f64ebd5 Suits: Handle LoadoutRemoveModule
Currently this seems to only trigger if you 'overwrite' an equipped
weapon with another one.  The one being removed will be cited in this
event.
2021-04-29 12:21:08 +01:00
Athanasius
218073ed73 Suits: Remove weapon from all loadouts if sold.
Also update credits total for the sale.
2021-04-29 12:07:48 +01:00
Athanasius
2253e45c18 Suits: Add some paranoia around Loadouts
* Initialise to empty dict.
* try/except in case CAPI pull hasn't happened yet when parsing Journal
  events.
2021-04-29 11:45:06 +01:00
Athanasius
e796684fc6 Suits: Handle RenameSuitLoadout 2021-04-29 11:40:59 +01:00
Athanasius
e24e0b3547 Suits: Update DeleteSuitLoadout code with alpha4 example
Also slightly simplified this.  Leaving the try/except for now, although
it should no longer be necessary.
2021-04-29 11:34:29 +01:00
Athanasius
addb178d3d Suits: Handle 'CreateSuitLoadout'
This entails converting the Journal supplied data into CAPI form.
2021-04-29 11:23:14 +01:00
Athanasius
29a517ce11 Suits: Note that we need an 'UpgradeSuit' example still
The journal document has to be mistaken about cost being in credits.
2021-04-29 10:34:03 +01:00
Athanasius
aeca211a88 Suits: Handle 'SellSuit' 2021-04-29 10:26:55 +01:00
Athanasius
c8d98bba2e suits: Guard against "no CAPI pull yet" on BuySuit 2021-04-29 10:23:39 +01:00
Athanasius
7b8c113962 suits: Record a newly bought suit in monitor.state['Suits']
We can't fill in the 'id' field, but this is likely the FDevID of the
suit type ?
2021-04-29 10:12:49 +01:00
Athanasius
96d9a80956 odyssey-4: Add outlines/comments for all upcoming events 2021-04-27 11:54:15 +01:00
Athanasius
f6611148e6 Suits: Add Artemis (ExplorationSuit_Class1) suit to ON_FOOT regex 2021-04-15 16:38:56 +01:00
Athanasius
8e8e57024d Suits: Location Ship "TacticalSuit_Class1" is also on-foot
This is the 'Dominator' suit.
2021-04-15 14:20:00 +01:00
Athanasius
d9d36dd12b Suits: Comments about suit/weapon events not having instance ID 2021-04-15 10:55:51 +01:00
Athanasius
d095e8b054 Suits: We can't do anything on SellSuit yet, placeholder. 2021-04-15 10:43:42 +01:00
Athanasius
550ca61e44 Suits: Support DeleteSuitLoadout event
* Factored "find CAPI slot id from journal LoadoutID" into its own
  function.
2021-04-14 10:16:34 +01:00
Athanasius
1509bcde2b Suits: Placeholders for DeleteSuitLoadout and CreateSuitLoadout 2021-04-14 10:01:36 +01:00
Athanasius
bb90d0fb59 Suits: If user switches to an unknown loadout, say so 2021-04-13 16:56:48 +01:00
Athanasius
c28dd8c55d Suits: Set/update suit text as necessary.
* After any Journal event we might as well set it.
* Attempt to update on a `SwitchSuitLoadout` event, assuming the new
  slot is one we heard about in the last CAPI data.
2021-04-13 16:48:16 +01:00
Athanasius
2246278286 Odyssey Suits: Store available data from CAPI.
I've gone with 'None' for when there's no data, rather than {}.  That
makes for simpler checks on if there is data (a dict.get('foo') only
checks for that, not the dict structure otherwise).

If no 'suit' in the data we assume no Odyssey, but otherwise plough on
with dict.get() statements as they'll default to None if it's not
present.

*Users* of this monitor.state[] extra data get to choose what to do if
some data is present but not other.
2021-04-13 12:12:51 +01:00
A_D
1a9983f331
Fixed edge case with reading old ship loadout 2021-04-12 19:58:23 +02:00
Athanasius
9a6b59fbd3 monitor.py: Initialise EDLogs self.systempopulation
This is the *one* field that wasn't always initialised.
2021-04-12 09:10:25 +01:00
Athanasius
79729d683e CQC game mode LoadGame has fewer fields, no Ship 2021-04-12 08:45:10 +01:00
Athanasius
13824c53bc monitor: Only forget station on Disembark if not from own ship 2021-04-12 08:31:48 +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
5c5e5b507e monitor.py: Fix up legavy config.get() calls 2021-04-12 08:31:47 +01:00
Athanasius
c26d1bce93 Comment out un-necessary logger.trace()
In monitor.py it was all that 'Location' event tracing.
2021-04-12 08:30:51 +01:00
Athanasius
3933dea479 Convert monitor.event_queue to a queue.Queue.
* We now use event_queue.empty() to see if it is indeed empty.
* Changed AppWindow.journal_event() to also use .empty() rather than
  `while True`.  Keeping the `'if not entry'` check just in case.
  This prevents it from calling monitor.get_entry() when the prior run
  through the loop has just emptied the queue.  Thus we'll only log when
  it genuinely IS unexpectedly empty.
* During *game* Shutdown we can send the synthetic 'Shutdown' event
  through, and then find and append the actual game 'Shutdown' event
  (i.e. this wasn't a crash, which is what the synthetic event is meant
  to react to).  But AppWindow.journal_event() loop picks up both events
  in one call, so the second <<JournalEvent>> sends it working on an
  empty queue.
  Thus we log in monitor.get_entry() only if the queue is empty *and*
  the game is still running.
* NB: Also adds 'Component' to the OTHER place montitor.state is
  initialised.
2021-04-12 08:30:51 +01:00
Athanasius
8f2802fbcf monitor.py: Add support for Odyssey 'Component' materials. 2021-04-12 08:30:51 +01:00
Athanasius
5edf8d5b59 Change monitor.state['on_foot'] to 'OnFoot' for consistency 2021-04-12 08:30:51 +01:00
Athanasius
f45f817fa2 EDDB plugin now setting Station name correctly on_foot
* monitor.on_foot is now monitor.state['on_foot'] as plugins need to
  access it.
* EDDB:journal_entry() now stores that in this.on_foot to check later.
* this.on_foot checked in cmdr_data() to actually set station name from
  that data if needs be.  This avoids setting it to STATION_UNDOCKED if
  data['commander']['docked'] is False, when we're on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
567cfdb9ca Will now send data to EDDN when on-foot in-station.
NB: No shipyard in tests because data['ships']['shipyard_list'] is an
empty list.  This might be the bug not having been fixed, or the station
might genuinely have no ships for sale.  We have no way to check in
Odyssey Alpha Phase 1.
2021-04-12 08:30:51 +01:00
Athanasius
a09512f3b3 Mostly refactoring companion.ship_file_name() into util_ships.py
* Also prevent "You're not docked at a station!" for on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
6fe86cd719 on_foot: Attempt to set correctly when state changes.
* For taxi-usage you 'Embark' on it to take the trip and 'Disembark'
  onto foot at the other end.
* Joining a multi-crew session will mean no longer being on foot.
* When quitting a multi-crew session we might miss that you're back
  on-foot.  Need to test.
2021-04-12 08:30:51 +01:00
Athanasius
0113295ae5 monitor.py: Set monitor.on_foot if LoadGame is in a suit
* Also sets monitor.station via BodyType/Body if the former is
  'Station'.
2021-04-12 08:30:50 +01:00
Athanasius
be740d0bcd Remove another open 'U' flag. 2021-04-01 14:46:43 +01:00