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:
parent
3e931c0e80
commit
46710e1c4d
@ -997,7 +997,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 = OrderedDict([('starsystemName', system),
|
||||
@ -1014,8 +1025,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:
|
||||
@ -1037,31 +1051,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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user