1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

Inara: Also check opponentName on EscapeInterdiction

And sprinkly comments around giving a reason for the checks.
This commit is contained in:
Athanasius 2022-12-01 13:45:10 +00:00
parent aac660fb05
commit 26413177a6
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

View File

@ -1069,6 +1069,7 @@ def journal_entry( # noqa: C901, CCR001
elif 'Power' in entry:
data['opponentName'] = entry['Power']
# Paranoia in case of e.g. Thargoid activity not having complete data
if data['opponentName'] == "":
logger.warning('Dropping addCommanderCombatInterdicted message because opponentName came out as ""')
@ -1091,6 +1092,7 @@ def journal_entry( # noqa: C901, CCR001
elif 'Power' in entry:
data['opponentName'] = entry['Power']
# Paranoia in case of e.g. Thargoid activity not having complete data
if data['opponentName'] == "":
logger.warning('Dropping addCommanderCombatInterdiction message because opponentName came out as ""')
@ -1098,15 +1100,23 @@ def journal_entry( # noqa: C901, CCR001
new_add_event('addCommanderCombatInterdiction', entry['timestamp'], data)
elif event_name == 'EscapeInterdiction':
new_add_event(
'addCommanderCombatInterdictionEscape',
entry['timestamp'],
{
'starsystemName': system,
'opponentName': entry['Interdictor'],
'isPlayer': entry['IsPlayer'],
}
)
# Paranoia in case of e.g. Thargoid activity not having complete data
if entry.get('Interdictor') is None or entry['Interdictor'] == "":
logger.warning(
'Dropping addCommanderCombatInterdictionEscape message'
'because opponentName came out as ""'
)
else:
new_add_event(
'addCommanderCombatInterdictionEscape',
entry['timestamp'],
{
'starsystemName': system,
'opponentName': entry['Interdictor'],
'isPlayer': entry['IsPlayer'],
}
)
elif event_name == 'PVPKill':
new_add_event(