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

Merge pull request #2165 from HullSeals/enhancement/2163/update-inara-to-use-isthargoid-flag

[2163] Update Inara plugin to better handle Thargoid Combat events
This commit is contained in:
David Sangrey 2024-03-04 18:04:15 -05:00 committed by GitHub
commit 727b8e5413
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1001,7 +1001,18 @@ def journal_entry( # noqa: C901, CCR001
elif 'KillerName' in entry:
data['opponentName'] = entry['KillerName']
new_add_event('addCommanderCombatDeath', entry['timestamp'], data)
elif 'KillerShip' in entry:
data['opponentName'] = entry['KillerShip']
# Paranoia in case of e.g. Thargoid activity not having complete data
opponent_name_issue = 'opponentName' not in data or data['opponentName'] == ""
wing_opponent_names_issue = 'wingOpponentNames' not in data or data['wingOpponentNames'] == []
if opponent_name_issue and wing_opponent_names_issue:
logger.warning('Dropping addCommanderCombatDeath message'
'because opponentName and wingOpponentNames came out as ""')
else:
new_add_event('addCommanderCombatDeath', entry['timestamp'], data)
elif event_name == 'Interdicted':
data = {
@ -1019,8 +1030,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,31 +1056,42 @@ 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:
new_add_event('addCommanderCombatInterdiction', entry['timestamp'], data)
elif event_name == 'EscapeInterdiction':
data = {
'starsystemName': system,
'isPlayer': entry['IsPlayer'],
}
if 'Interdictor' in entry:
data['opponentName'] = entry['Interdictor']
elif 'Faction' in entry:
data['opponentName'] = entry['Faction']
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 entry.get('Interdictor') is None or entry['Interdictor'] == "":
logger.warning(
'Dropping addCommanderCombatInterdictionEscape message'
'because opponentName came out as ""'
)
if 'opponentName' not in data or data['opponentName'] == "":
logger.warning('Dropping addCommanderCombatInterdiction message because opponentName came out as ""')
else:
new_add_event(
'addCommanderCombatInterdictionEscape',
entry['timestamp'],
{
'starsystemName': system,
'opponentName': entry['Interdictor'],
'isPlayer': entry['IsPlayer'],
}
)
new_add_event('addCommanderCombatInterdictionEscape', entry['timestamp'], data)
elif event_name == 'PVPKill':
new_add_event(