mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-10 04:12:15 +03:00
Send fleet and credits immediately after startup
This commit is contained in:
parent
ed9180d6d6
commit
e059f3c354
@ -325,7 +325,7 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
|
|||||||
if entry['event'] == 'ShipyardSwap':
|
if entry['event'] == 'ShipyardSwap':
|
||||||
this.shipswap = True # Don't know new ship name and ident 'til the following Loadout event
|
this.shipswap = True # Don't know new ship name and ident 'til the following Loadout event
|
||||||
if 'StoreShipID' in entry:
|
if 'StoreShipID' in entry:
|
||||||
add_event('setCommanderShipDock', entry['timestamp'],
|
add_event('setCommanderShip', entry['timestamp'],
|
||||||
OrderedDict([
|
OrderedDict([
|
||||||
('shipType', entry['StoreOldShip']),
|
('shipType', entry['StoreOldShip']),
|
||||||
('shipGameID', entry['StoreShipID']),
|
('shipGameID', entry['StoreShipID']),
|
||||||
@ -350,7 +350,7 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
|
|||||||
]))
|
]))
|
||||||
|
|
||||||
elif entry['event'] == 'ShipyardTransfer':
|
elif entry['event'] == 'ShipyardTransfer':
|
||||||
add_event('setCommanderShipDock', entry['timestamp'],
|
add_event('setCommanderShipTransfer', entry['timestamp'],
|
||||||
OrderedDict([
|
OrderedDict([
|
||||||
('shipType', entry['ShipType']),
|
('shipType', entry['ShipType']),
|
||||||
('shipGameID', entry['ShipID']),
|
('shipGameID', entry['ShipID']),
|
||||||
@ -507,25 +507,29 @@ def cmdr_data(data, is_beta):
|
|||||||
if ship:
|
if ship:
|
||||||
assets += ship['value']['total']
|
assets += ship['value']['total']
|
||||||
if this.needfleet:
|
if this.needfleet:
|
||||||
|
if ship['id'] != data['commander']['currentShipId']:
|
||||||
add_event('setCommanderShip', timestamp,
|
add_event('setCommanderShip', timestamp,
|
||||||
OrderedDict([
|
OrderedDict([
|
||||||
('shipType', ship['name']),
|
('shipType', ship['name']),
|
||||||
('shipGameID', ship['id']),
|
('shipGameID', ship['id']),
|
||||||
('shipName', ship.get('shipName')), # Can be None
|
('shipName', ship.get('shipName')), # Can be None
|
||||||
('shipIdent', ship.get('shipID')), # Can be None
|
('shipIdent', ship.get('shipID')), # Can be None
|
||||||
('isCurrentShip', ship['id'] == data['commander']['currentShipId']),
|
|
||||||
('shipHullValue', ship['value']['hull']),
|
('shipHullValue', ship['value']['hull']),
|
||||||
('shipModulesValue', ship['value']['modules']),
|
('shipModulesValue', ship['value']['modules']),
|
||||||
]))
|
|
||||||
if ship['id'] != data['commander']['currentShipId']:
|
|
||||||
add_event('setCommanderShipDock', timestamp,
|
|
||||||
OrderedDict([
|
|
||||||
('shipType', ship['name']),
|
|
||||||
('shipGameID', ship['id']),
|
|
||||||
('starsystemName', ship['starsystem']['name']),
|
('starsystemName', ship['starsystem']['name']),
|
||||||
('stationName', ship['station']['name']),
|
('stationName', ship['station']['name']),
|
||||||
]))
|
]))
|
||||||
this.needfleet = False
|
else:
|
||||||
|
add_event('setCommanderShip', timestamp,
|
||||||
|
OrderedDict([
|
||||||
|
('shipType', ship['name']),
|
||||||
|
('shipGameID', ship['id']),
|
||||||
|
('shipName', ship.get('shipName')), # Can be None
|
||||||
|
('shipIdent', ship.get('shipID')), # Can be None
|
||||||
|
('isCurrentShip', True),
|
||||||
|
('shipHullValue', ship['value']['hull']),
|
||||||
|
('shipModulesValue', ship['value']['modules']),
|
||||||
|
]))
|
||||||
|
|
||||||
if not (CREDIT_RATIO > this.lastcredits / data['commander']['credits'] > 1/CREDIT_RATIO):
|
if not (CREDIT_RATIO > this.lastcredits / data['commander']['credits'] > 1/CREDIT_RATIO):
|
||||||
this.events = [x for x in this.events if x['eventName'] != 'setCommanderCredits'] # Remove any unsent
|
this.events = [x for x in this.events if x['eventName'] != 'setCommanderCredits'] # Remove any unsent
|
||||||
@ -537,7 +541,10 @@ def cmdr_data(data, is_beta):
|
|||||||
]))
|
]))
|
||||||
this.lastcredits = float(data['commander']['credits'])
|
this.lastcredits = float(data['commander']['credits'])
|
||||||
|
|
||||||
# *Don't* queue a call to Inara - wait for next mandatory event
|
# *Don't* queue a call to Inara if we're just updating credits - wait for next mandatory event
|
||||||
|
if this.needfleet:
|
||||||
|
call()
|
||||||
|
this.needfleet = False
|
||||||
|
|
||||||
|
|
||||||
def add_event(name, timestamp, data):
|
def add_event(name, timestamp, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user