1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-22 20:00:29 +03:00

Send Mission events to Inara

This commit is contained in:
Jonathan Harris 2017-11-07 00:23:40 +00:00
parent de1197fd1b
commit 1d3c44d953
2 changed files with 60 additions and 3 deletions

View File

@ -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

View File

@ -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):