mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
Send credits and statistics at game start only
otherwise might be out of date. Statistics event may arrive before or after Docked event.
This commit is contained in:
parent
6237066af6
commit
25d9602550
@ -176,15 +176,6 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
try:
|
||||
old_events = len(this.events) # Will only send existing events if we add a new event below
|
||||
|
||||
# Send credits to Inara on startup only - otherwise may be out of date
|
||||
if entry['event'] == 'Cargo':
|
||||
add_event('setCommanderCredits', entry['timestamp'],
|
||||
OrderedDict([
|
||||
('commanderCredits', state['Credits']),
|
||||
('commanderLoan', state['Loan']),
|
||||
]))
|
||||
this.lastcredits = state['Credits']
|
||||
|
||||
# Send rank info to Inara on startup or change
|
||||
if (entry['event'] in ['StartUp', 'Cargo'] or this.newuser):
|
||||
for k,v in state['Rank'].iteritems():
|
||||
@ -202,7 +193,6 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
('majorfactionName', k.lower()),
|
||||
('majorfactionReputation', v / 100.0),
|
||||
]))
|
||||
add_event('setCommanderGameStatistics', entry['timestamp'], state['Statistics']) # may be out of date
|
||||
|
||||
elif entry['event'] == 'Promotion':
|
||||
for k,v in state['Rank'].iteritems():
|
||||
@ -348,6 +338,17 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
|
||||
# Events that don't need to be sent immediately but will be sent on the next mandatory event
|
||||
#
|
||||
|
||||
# Send credits and stats to Inara on startup only - otherwise may be out of date
|
||||
if entry['event'] == 'LoadGame':
|
||||
add_event('setCommanderCredits', entry['timestamp'],
|
||||
OrderedDict([
|
||||
('commanderCredits', state['Credits']),
|
||||
('commanderLoan', state['Loan']),
|
||||
]))
|
||||
this.lastcredits = state['Credits']
|
||||
elif entry['event'] == 'Statistics':
|
||||
add_event('setCommanderGameStatistics', entry['timestamp'], state['Statistics']) # may be out of date
|
||||
|
||||
# Selling / swapping ships
|
||||
if entry['event'] == 'ShipyardNew':
|
||||
add_event('addCommanderShip', entry['timestamp'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user