From 28cbd6e0ea46db70e2f8388f5a0d19b70fc32b83 Mon Sep 17 00:00:00 2001 From: Athanasius <github@miggy.org> Date: Tue, 25 Jan 2022 15:27:35 +0000 Subject: [PATCH] Inara: queue 'Rank'/'setCommanderRankPilot' as soon as seen This means we *will* send a message when logging in on foot, rather than waiting for a `Cargo` event that never arrives. --- plugins/inara.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/inara.py b/plugins/inara.py index 69270e97..868671ec 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -426,16 +426,6 @@ def journal_entry( # noqa: C901, CCR001 this.newuser = False this.newsession = False - # Send rank info to Inara on startup - new_add_event( - 'setCommanderRankPilot', - entry['timestamp'], - [ - {'rankName': k.lower(), 'rankValue': v[0], 'rankProgress': v[1] / 100.0} - for k, v in state['Rank'].items() if v is not None - ] - ) - # Don't send the API call with no values. if state['Reputation']: new_add_event( @@ -503,6 +493,18 @@ def journal_entry( # noqa: C901, CCR001 this.loadout = make_loadout(state) new_add_event('setCommanderShipLoadout', entry['timestamp'], this.loadout) + # Login-time Ranks + elif event_name == 'Rank': + # Send rank info to Inara on startup + new_add_event( + 'setCommanderRankPilot', + entry['timestamp'], + [ + {'rankName': k.lower(), 'rankValue': v[0], 'rankProgress': v[1] / 100.0} + for k, v in state['Rank'].items() if v is not None + ] + ) + # Promotions elif event_name == 'Promotion': for k, v in state['Rank'].items():