mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +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:
commit
727b8e5413
@ -1001,7 +1001,18 @@ def journal_entry( # noqa: C901, CCR001
|
|||||||
elif 'KillerName' in entry:
|
elif 'KillerName' in entry:
|
||||||
data['opponentName'] = entry['KillerName']
|
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':
|
elif event_name == 'Interdicted':
|
||||||
data = {
|
data = {
|
||||||
@ -1019,8 +1030,11 @@ def journal_entry( # noqa: C901, CCR001
|
|||||||
elif 'Power' in entry:
|
elif 'Power' in entry:
|
||||||
data['opponentName'] = entry['Power']
|
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
|
# 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 ""')
|
logger.warning('Dropping addCommanderCombatInterdicted message because opponentName came out as ""')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -1042,31 +1056,42 @@ def journal_entry( # noqa: C901, CCR001
|
|||||||
elif 'Power' in entry:
|
elif 'Power' in entry:
|
||||||
data['opponentName'] = entry['Power']
|
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
|
# 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 ""')
|
logger.warning('Dropping addCommanderCombatInterdiction message because opponentName came out as ""')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
new_add_event('addCommanderCombatInterdiction', entry['timestamp'], data)
|
new_add_event('addCommanderCombatInterdiction', entry['timestamp'], data)
|
||||||
|
|
||||||
elif event_name == 'EscapeInterdiction':
|
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
|
# Paranoia in case of e.g. Thargoid activity not having complete data
|
||||||
if entry.get('Interdictor') is None or entry['Interdictor'] == "":
|
if 'opponentName' not in data or data['opponentName'] == "":
|
||||||
logger.warning(
|
logger.warning('Dropping addCommanderCombatInterdiction message because opponentName came out as ""')
|
||||||
'Dropping addCommanderCombatInterdictionEscape message'
|
|
||||||
'because opponentName came out as ""'
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
new_add_event(
|
new_add_event('addCommanderCombatInterdictionEscape', entry['timestamp'], data)
|
||||||
'addCommanderCombatInterdictionEscape',
|
|
||||||
entry['timestamp'],
|
|
||||||
{
|
|
||||||
'starsystemName': system,
|
|
||||||
'opponentName': entry['Interdictor'],
|
|
||||||
'isPlayer': entry['IsPlayer'],
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
elif event_name == 'PVPKill':
|
elif event_name == 'PVPKill':
|
||||||
new_add_event(
|
new_add_event(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user