From af3b9d250a5aae2a346d8c617622c61c68a9aa64 Mon Sep 17 00:00:00 2001 From: Phoebe Date: Sun, 25 Feb 2024 15:20:14 +0100 Subject: [PATCH] Check for and use ``isThargoid`` flag - Check and use ``isThargoid`` flag for Interdiction events. - Also updates the Paranoia check to also work in case of missing and not just empty parameter. --- plugins/inara.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/inara.py b/plugins/inara.py index 121ae227..601bb98e 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -1019,8 +1019,11 @@ def journal_entry( # noqa: C901, CCR001 elif 'Power' in entry: data['opponentName'] = entry['Power'] + elif 'IsThargoid' in entry and entry['IsThargoid']: + data['opponentName'] = 'Thargoid' + # Paranoia in case of e.g. Thargoid activity not having complete data - if data['opponentName'] == "": + if 'opponentName' not in data or data['opponentName'] == "": logger.warning('Dropping addCommanderCombatInterdicted message because opponentName came out as ""') else: @@ -1042,8 +1045,13 @@ def journal_entry( # noqa: C901, CCR001 elif 'Power' in entry: data['opponentName'] = entry['Power'] + # Shouldn't be needed here as Interdiction events can't target Thargoids (yet) + # but done just in case of future changes or so + elif 'IsThargoid' in entry and entry['IsThargoid']: + data['opponentName'] = 'Thargoid' + # Paranoia in case of e.g. Thargoid activity not having complete data - if data['opponentName'] == "": + if 'opponentName' not in data or data['opponentName'] == "": logger.warning('Dropping addCommanderCombatInterdiction message because opponentName came out as ""') else: