mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-11-12 02:22:42 +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:
1 file changed
+14
-7
+14
-7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user