diff --git a/README.md b/README.md index c7bd5b95..de3996bb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This app downloads your Cmdr's details and system, faction, scan and station dat * saves station commodity market prices to files on your computer that you can load into trading tools such as [Trade Dangerous](https://bitbucket.org/kfsone/tradedangerous/wiki/Home), [Inara](http://inara.cz), [mEDI's Elite Tools](https://github.com/mEDI-S/mEDI_s-Elite-Tools), etc. * saves a record of your ship loadout to files on your computer that you can load into outfitting tools such as [E:D Shipyard](http://www.edshipyard.com), [Coriolis](http://coriolis.io) or [Elite Trade Net](http://etn.io/). * sends your Cmdr's details, ship details, materials and flight log to [Elite: Dangerous Star Map](http://www.edsm.net/). -* sends your Cmdr's details, ship details, materials and flight log to [Inara](https://inara.cz). +* sends your Cmdr's details, ship details, materials, missions and flight log to [Inara](https://inara.cz). You can run the app on the same machine on which you're running Elite: Dangerous or on another machine connected via a network share. @@ -90,7 +90,7 @@ You can send a record of your Cmdr's details, ship details, cargo, materials and ### Inara -You can send a record of your Cmdr's details, ship details, cargo, materials and flight log to [Inara](https://inara.cz/). You will need to register for an account and then follow the “[Inara credentials](https://inara.cz/settings-api/)” link to obtain your API key. +You can send a record of your Cmdr's details, ship details, cargo, materials, missions and flight log to [Inara](https://inara.cz/). You will need to register for an account and then follow the “[Inara credentials](https://inara.cz/settings-api/)” link to obtain your API key. Your flight log on Inara is updated in real-time. Other information is updated less frequently - typically on leaving a station. Uninstall diff --git a/plugins/inara.py b/plugins/inara.py index 30c726dc..e2d5ac56 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -284,6 +284,63 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): if __debug__: print_exc() return unicode(e) + # + # Events that don't need to be sent immediately but will be sent on the next mandatory event (probably Undocked) + # + if entry['event'] == 'MissionAccepted': + data = OrderedDict([ + ('missionName', entry['Name']), + ('missionGameID', entry['MissionID']), + ('influenceGain', entry['Influence']), + ('reputationGain', entry['Reputation']), + ('starsystemNameOrigin', system), + ('stationNameOrigin', station), + ('minorfactionNameOrigin', entry['Faction']), + ]) + # optional mission-specific properties + for (iprop, prop) in [ + ('missionExpiry', 'Expiry'), # Listed as optional in the docs, but always seems to be present + ('starsystemNameTarget', 'DestinationSystem'), + ('stationNameTarget', 'DestinationStation'), + ('minorfactionNameTarget', 'TargetFaction'), + ('commodityName', 'Commodity'), + ('commodityCount', 'Count'), + ('targetName', 'Target'), + ('targetType', 'TargetType'), + ('killCount', 'KillCount'), + ('passengerType', 'PassengerType'), + ('passengerCount', 'PassengerCount'), + ('passengerIsVIP', 'PassengerVIPs'), + ('passengerIsWanted', 'PassengerWanted'), + ]: + if prop in entry: + data[iprop] = entry[prop] + add_event('addCommanderMission', entry['timestamp'], data) + + elif entry['event'] == 'MissionAbandoned': + add_event('setCommanderMissionAbandoned', entry['timestamp'], { 'missionGameID': entry['MissionID'] }) + + elif entry['event'] == 'MissionCompleted': + data = OrderedDict([ ('missionGameID', entry['MissionID']) ]) + if 'Donation' in entry: + data['donationCredits'] = entry['Donation'] + if 'Reward' in entry: + data['rewardCredits'] = entry['Reward'] + if 'Permits' in entry: + data['rewardPermits'] = [{ 'starsystemName': x } for x in entry['Permits']] + if 'CommodityReward' in entry: + data['rewardCommodities'] = [{ 'itemName': x['Name'], 'itemCount': x['Count'] } for x in entry['CommodityReward']] + add_event('setCommanderMissionCompleted', entry['timestamp'], data) + + # Journal doesn't list rewarded materials directly, just as 'MaterialCollected' + elif (entry['event'] == 'MaterialCollected' and this.events and + this.events[-1]['eventName'] == 'setCommanderMissionCompleted' and + this.events[-1]['eventTimestamp'] == entry['timestamp']): + this.events[-1]['eventData']['rewardMaterials'] = [{ 'itemName': entry['Name'], 'itemCount': entry['Count'] }] + + elif entry['event'] == 'MissionFailed': + add_event('setCommanderMissionFailed', entry['timestamp'], { 'missionGameID': entry['MissionID'] }) + def cmdr_data(data, is_beta): @@ -304,7 +361,7 @@ def cmdr_data(data, is_beta): ])) this.needcredits = False - # *Don't* queue a call to Inara - wait for next event (probably Undocked) + # *Don't* queue a call to Inara - wait for next mandatory event (probably Undocked) def add_event(name, timestamp, data):