1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-21 19:37:39 +03:00

inara: Utilise Statistics Current_Wealth for commanderAssets

Inara itself seems to be doing this if it has access to CAPI-sourced
Journals.  If we don't send commanderAssets as part of
setCommanderCredits then it does ... something else ... and ends up with
your total assets value bouncing between what EDMC is causing and what
it sees from the CAPI-sourced journals.

So, don't send this from LoadGame any more, instead wait for Statistics,
and if it has the relevant data, also send commanderAssets.
This commit is contained in:
Athanasius 2022-01-20 17:45:23 +00:00
parent 333b84ada6
commit 7ac248be7a
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -737,17 +737,24 @@ def journal_entry( # noqa: C901, CCR001
logger.debug('Adding events', exc_info=e)
return str(e)
# Send credits and stats to Inara on startup only - otherwise may be out of date
# We want to utilise some Statistics data, so don't setCommanderCredits here
if event_name == 'LoadGame':
new_add_event(
'setCommanderCredits',
entry['timestamp'],
{'commanderCredits': state['Credits'], 'commanderLoan': state['Loan']}
)
this.lastcredits = state['Credits']
elif event_name == 'Statistics':
inara_data = {
'commanderCredits': state['Credits'],
'commanderLoan': state['Loan'],
}
if entry.get('Bank_Account') is not None:
if entry['Bank_Account'].get('Current_Wealth') is not None:
inara_data['commanderAssets'] = entry['Bank_Account']['Current_Wealth']
new_add_event(
'setCommanderCredits',
entry['timestamp'],
inara_data
)
new_add_event('setCommanderGameStatistics', entry['timestamp'], state['Statistics']) # may be out of date
# Selling / swapping ships