Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1654] Add Ship Jump Range and Cargo Capacity to Inara #2212

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions plugins/inara.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,23 +550,6 @@ def journal_entry( # noqa: C901, CCR001

# Ship change
if event_name == 'Loadout' and this.shipswap:
cur_ship = {
'shipType': state['ShipType'],
'shipGameID': state['ShipID'],
'shipName': state['ShipName'], # Can be None
'shipIdent': state['ShipIdent'], # Can be None
'isCurrentShip': True,
}

if state['HullValue']:
cur_ship['shipHullValue'] = state['HullValue']

if state['ModulesValue']:
cur_ship['shipModulesValue'] = state['ModulesValue']

cur_ship['shipRebuyCost'] = state['Rebuy']
new_add_event('setCommanderShip', entry['timestamp'], cur_ship)

this.loadout = make_loadout(state)
new_add_event('setCommanderShipLoadout', entry['timestamp'], this.loadout)
this.shipswap = False
Expand Down Expand Up @@ -854,7 +837,7 @@ def journal_entry( # noqa: C901, CCR001
for ship in this.fleet:
new_add_event('setCommanderShip', entry['timestamp'], ship)
# Loadout
if event_name == 'Loadout' and not this.newsession:
if event_name == 'Loadout':
loadout = make_loadout(state)
if this.loadout != loadout:
this.loadout = loadout
Expand All @@ -868,6 +851,26 @@ def journal_entry( # noqa: C901, CCR001

new_add_event('setCommanderShipLoadout', entry['timestamp'], this.loadout)

cur_ship = {
'shipType': state['ShipType'],
'shipGameID': state['ShipID'],
'shipName': state['ShipName'], # Can be None
'shipIdent': state['ShipIdent'], # Can be None
'isCurrentShip': True,
'shipMaxJumpRange': entry['MaxJumpRange'],
'shipCargoCapacity': entry['CargoCapacity']
}
if state['HullValue']:
cur_ship['shipHullValue'] = state['HullValue']

if state['ModulesValue']:
cur_ship['shipModulesValue'] = state['ModulesValue']

if state['Rebuy']:
cur_ship['shipRebuyCost'] = state['Rebuy']

new_add_event('setCommanderShip', entry['timestamp'], cur_ship)

# Stored modules
if event_name == 'StoredModules':
items = {mod['StorageSlot']: mod for mod in entry['Items']} # Impose an order
Expand Down
Loading