1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 00:30:33 +03:00

[#2262] Initial SLEF Output

This commit is contained in:
David Sangrey 2024-06-15 22:13:34 -04:00
parent b10548da57
commit c60c0483b4
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
4 changed files with 400 additions and 40 deletions

View File

@ -51,7 +51,8 @@ if __name__ == "__main__":
for m in list(data['Ships'].values()): for m in list(data['Ships'].values()):
name = coriolis_ship_map.get(m['properties']['name'], str(m['properties']['name'])) name = coriolis_ship_map.get(m['properties']['name'], str(m['properties']['name']))
assert name in reverse_ship_map, name assert name in reverse_ship_map, name
ships[name] = {'hullMass': m['properties']['hullMass']} ships[name] = {'hullMass': m['properties']['hullMass'],
'reserveFuelCapacity': m['properties']['reserveFuelCapacity']}
for i, bulkhead in enumerate(bulkheads): for i, bulkhead in enumerate(bulkheads):
modules['_'.join([reverse_ship_map[name], 'armour', bulkhead])] = {'mass': m['bulkheads'][i]['mass']} modules['_'.join([reverse_ship_map[name], 'armour', bulkhead])] = {'mass': m['bulkheads'][i]['mass']}

267
inara.json Normal file
View File

@ -0,0 +1,267 @@
{
"header": {
"appName": "EDMarketConnector",
"appVersion": "5.11.1+85f5c328.DIRTY"
},
"data": {
"FuelCapacity": {
"Main": 128,
"Reserve": 0.81
},
"Ship": "belugaliner",
"ShipName": "HSRV Guiding Light",
"ShipIdent": "NFC-23",
"HullValue": 69924158,
"ModulesValue": 96918434,
"Rebuy": 8342132,
"MaxJumpRange": 52.615143,
"UnladenMass": 1233.057983,
"CargoCapacity": 16,
"Modules": [
{
"Slot": "TinyHardpoint1",
"Item": "hpt_heatsinklauncher_turret_tiny",
"ItemHealth": 1.0,
"On": true,
"Value": 3072
},
{
"Slot": "TinyHardpoint2",
"Item": "hpt_heatsinklauncher_turret_tiny",
"ItemHealth": 1.0,
"On": true,
"Value": 3413
},
{
"Slot": "TinyHardpoint3",
"Item": "hpt_heatsinklauncher_turret_tiny",
"ItemHealth": 1.0,
"On": true,
"Value": 3072
},
{
"Slot": "TinyHardpoint4",
"Item": "hpt_heatsinklauncher_turret_tiny",
"ItemHealth": 1.0,
"On": true,
"Value": 3072
},
{
"Slot": "PaintJob",
"Item": "paintjob_belugaliner_lrpo_azure",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "Armour",
"Item": "belugaliner_armour_grade1",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "PowerPlant",
"Item": "int_powerplant_size6_class5",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 11382139
},
{
"Slot": "MainEngines",
"Item": "int_engine_size7_class2",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 1666898
},
{
"Slot": "FrameShiftDrive",
"Item": "int_hyperdrive_size7_class5",
"ItemHealth": 1.0,
"On": true,
"Value": 45006196
},
{
"Slot": "LifeSupport",
"Item": "int_lifesupport_size8_class2",
"ItemHealth": 1.0,
"On": true,
"Value": 1530326
},
{
"Slot": "PowerDistributor",
"Item": "int_powerdistributor_size6_class5",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 3049917
},
{
"Slot": "Radar",
"Item": "int_sensors_size5_class2",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 69713
},
{
"Slot": "FuelTank",
"Item": "int_fueltank_size7_class3",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 1562752
},
{
"Slot": "Decal1",
"Item": "decal_distantworlds2",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "Decal2",
"Item": "decal_distantworlds2",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "Decal3",
"Item": "decal_distantworlds2",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "ShipName0",
"Item": "nameplate_practical01_black",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "ShipName1",
"Item": "nameplate_practical01_black",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "ShipID0",
"Item": "nameplate_shipid_singleline_black",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "ShipID1",
"Item": "nameplate_shipid_singleline_black",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "Slot01_Size6",
"Item": "int_fuelscoop_size6_class5",
"ItemHealth": 1.0,
"On": true,
"Value": 25240068
},
{
"Slot": "Slot02_Size6",
"Item": "int_repairer_size6_class2",
"ItemHealth": 1.0,
"On": true,
"Value": 497429
},
{
"Slot": "Slot03_Size6",
"Item": "int_shieldgenerator_size5_class2",
"ItemHealth": 1.0,
"On": true,
"Value": 165879
},
{
"Slot": "Slot04_Size6",
"Item": "int_dronecontrol_repair_size5_class2",
"ItemHealth": 1.0,
"On": true,
"Value": 85293
},
{
"Slot": "Slot05_Size5",
"Item": "int_guardianfsdbooster_size5",
"ItemHealth": 1.0,
"On": true,
"Value": 5688921
},
{
"Slot": "Slot07_Size4",
"Item": "int_cargorack_size4_class1",
"ItemHealth": 1.0,
"On": true,
"Priority": 1,
"Value": 30124
},
{
"Slot": "Slot11_Size3",
"Item": "int_detailedsurfacescanner_tiny",
"ItemHealth": 1.0,
"On": true,
"Value": 219375
},
{
"Slot": "Slot12_Size1",
"Item": "int_repairer_size1_class5",
"ItemHealth": 1.0,
"On": false,
"Value": 710775
},
{
"Slot": "PlanetaryApproachSuite",
"Item": "int_planetapproachsuite_advanced",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "WeaponColour",
"Item": "weaponcustomisation_red",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "EngineColour",
"Item": "enginecustomisation_orange",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "VesselVoice",
"Item": "voicepack_verity",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "ShipCockpit",
"Item": "belugaliner_cockpit",
"ItemHealth": 1.0,
"On": true,
"Priority": 1
},
{
"Slot": "CargoHatch",
"Item": "modularcargobaydoor",
"ItemHealth": 1.0,
"On": false,
"Priority": 1
}
]
}
}

View File

@ -35,6 +35,7 @@ import requests
import edmc_data import edmc_data
import killswitch import killswitch
import myNotebook as nb # noqa: N813 import myNotebook as nb # noqa: N813
from edshipyard import ships
import plug import plug
import timeout_session import timeout_session
from companion import CAPIData from companion import CAPIData
@ -870,6 +871,7 @@ def journal_entry( # noqa: C901, CCR001
cur_ship['shipRebuyCost'] = state['Rebuy'] cur_ship['shipRebuyCost'] = state['Rebuy']
new_add_event('setCommanderShip', entry['timestamp'], cur_ship) new_add_event('setCommanderShip', entry['timestamp'], cur_ship)
make_slef(state, entry)
# Stored modules # Stored modules
if event_name == 'StoredModules': if event_name == 'StoredModules':
@ -1476,6 +1478,57 @@ def make_loadout(state: dict[str, Any]) -> dict[str, Any]: # noqa: CCR001
} }
def make_slef(state: dict[str, Any], entry) -> None:
initial_dict = {
"header": {"appName": appname, "appVersion": str(appversion())}
}
data_dict = {}
loadout = make_loadout(state)
modules = loadout['shipLoadout']
mod_dict = []
for module in modules:
if module['slotName']:
builder = {
'Slot': module['slotName'],
'Item': module['itemName']
}
if module.get('itemHealth'):
builder.update({'ItemHealth': module['itemHealth']})
if module.get('isOn'):
builder.update({'On': True})
elif not module.get('isOn'):
builder.update({'On': False})
if module.get('itemPriority'):
builder.update({'Priority': module['itemPriority']})
if module.get('itemValue'):
builder.update({'Value': module['itemValue']})
if not module.get('itemValue'):
builder.update({'Value': 0})
if module.get('slotName') == 'FuelTank':
cap = module['itemName'].split('size')
cap = cap[1].split('_')
cap = 2**int(cap[0])
ship = edmc_data.ship_name_map[state["ShipType"]]
fuel = {'Main': cap, 'Reserve': ships[ship]['reserveFuelCapacity']}
data_dict.update({"FuelCapacity": fuel})
mod_dict.append(builder)
data_dict.update({
'Ship': state["ShipType"],
'ShipName': state['ShipName'],
'ShipIdent': state['ShipIdent'],
'HullValue': state['HullValue'],
'ModulesValue': state['ModulesValue'],
'Rebuy': state['Rebuy'],
'MaxJumpRange': entry['MaxJumpRange'],
'UnladenMass': entry['UnladenMass'],
'CargoCapacity': entry['CargoCapacity'],
'Modules': mod_dict,
})
initial_dict.update({'data': data_dict})
json.dump(initial_dict, open('inara.json', 'w'), indent=4)
return None
def new_add_event( def new_add_event(
name: str, name: str,
timestamp: str, timestamp: str,

View File

@ -1,119 +1,158 @@
{ {
"Adder": { "Adder": {
"hullMass": 35 "hullMass": 35,
"reserveFuelCapacity": 0.36
}, },
"Alliance Challenger": { "Alliance Challenger": {
"hullMass": 450 "hullMass": 450,
"reserveFuelCapacity": 0.77
}, },
"Alliance Chieftain": { "Alliance Chieftain": {
"hullMass": 400 "hullMass": 400,
"reserveFuelCapacity": 0.77
}, },
"Alliance Crusader": { "Alliance Crusader": {
"hullMass": 500 "hullMass": 500,
"reserveFuelCapacity": 0.77
}, },
"Anaconda": { "Anaconda": {
"hullMass": 400 "hullMass": 400,
"reserveFuelCapacity": 1.07
}, },
"Asp Explorer": { "Asp Explorer": {
"hullMass": 280 "hullMass": 280,
"reserveFuelCapacity": 0.63
}, },
"Asp Scout": { "Asp Scout": {
"hullMass": 150 "hullMass": 150,
"reserveFuelCapacity": 0.47
}, },
"Beluga Liner": { "Beluga Liner": {
"hullMass": 950 "hullMass": 950,
"reserveFuelCapacity": 0.81
}, },
"Cobra MkIII": { "Cobra MkIII": {
"hullMass": 180 "hullMass": 180,
"reserveFuelCapacity": 0.49
}, },
"Cobra MkIV": { "Cobra MkIV": {
"hullMass": 210 "hullMass": 210,
"reserveFuelCapacity": 0.51
}, },
"Diamondback Explorer": { "Diamondback Explorer": {
"hullMass": 260 "hullMass": 260,
"reserveFuelCapacity": 0.52
}, },
"Diamondback Scout": { "Diamondback Scout": {
"hullMass": 170 "hullMass": 170,
"reserveFuelCapacity": 0.49
}, },
"Dolphin": { "Dolphin": {
"hullMass": 140 "hullMass": 140,
"reserveFuelCapacity": 0.5
}, },
"Eagle": { "Eagle": {
"hullMass": 50 "hullMass": 50,
"reserveFuelCapacity": 0.34
}, },
"Federal Assault Ship": { "Federal Assault Ship": {
"hullMass": 480 "hullMass": 480,
"reserveFuelCapacity": 0.72
}, },
"Federal Corvette": { "Federal Corvette": {
"hullMass": 900 "hullMass": 900,
"reserveFuelCapacity": 1.13
}, },
"Federal Dropship": { "Federal Dropship": {
"hullMass": 580 "hullMass": 580,
"reserveFuelCapacity": 0.83
}, },
"Federal Gunship": { "Federal Gunship": {
"hullMass": 580 "hullMass": 580,
"reserveFuelCapacity": 0.82
}, },
"Fer-de-Lance": { "Fer-de-Lance": {
"hullMass": 250 "hullMass": 250,
"reserveFuelCapacity": 0.67
}, },
"Hauler": { "Hauler": {
"hullMass": 14 "hullMass": 14,
"reserveFuelCapacity": 0.25
}, },
"Imperial Clipper": { "Imperial Clipper": {
"hullMass": 400 "hullMass": 400,
"reserveFuelCapacity": 0.74
}, },
"Imperial Courier": { "Imperial Courier": {
"hullMass": 35 "hullMass": 35,
"reserveFuelCapacity": 0.41
}, },
"Imperial Cutter": { "Imperial Cutter": {
"hullMass": 1100 "hullMass": 1100,
"reserveFuelCapacity": 1.16
}, },
"Imperial Eagle": { "Imperial Eagle": {
"hullMass": 50 "hullMass": 50,
"reserveFuelCapacity": 0.37
}, },
"Keelback": { "Keelback": {
"hullMass": 180 "hullMass": 180,
"reserveFuelCapacity": 0.39
}, },
"Krait MkII": { "Krait MkII": {
"hullMass": 320 "hullMass": 320,
"reserveFuelCapacity": 0.63
}, },
"Krait Phantom": { "Krait Phantom": {
"hullMass": 270 "hullMass": 270,
"reserveFuelCapacity": 0.63
}, },
"Mamba": { "Mamba": {
"hullMass": 250 "hullMass": 250,
"reserveFuelCapacity": 0.5
}, },
"Orca": { "Orca": {
"hullMass": 290 "hullMass": 290,
"reserveFuelCapacity": 0.79
}, },
"Python": { "Python": {
"hullMass": 350 "hullMass": 350,
"reserveFuelCapacity": 0.83
}, },
"Python Mk II": { "Python Mk II": {
"hullMass": 450 "hullMass": 450,
"reserveFuelCapacity": 0.83
}, },
"Sidewinder": { "Sidewinder": {
"hullMass": 25 "hullMass": 25,
"reserveFuelCapacity": 0.3
}, },
"Type-10 Defender": { "Type-10 Defender": {
"hullMass": 1200 "hullMass": 1200,
"reserveFuelCapacity": 0.77
}, },
"Type-6 Transporter": { "Type-6 Transporter": {
"hullMass": 155 "hullMass": 155,
"reserveFuelCapacity": 0.39
}, },
"Type-7 Transporter": { "Type-7 Transporter": {
"hullMass": 350 "hullMass": 350,
"reserveFuelCapacity": 0.52
}, },
"Type-9 Heavy": { "Type-9 Heavy": {
"hullMass": 850 "hullMass": 850,
"reserveFuelCapacity": 0.77
}, },
"Viper MkIII": { "Viper MkIII": {
"hullMass": 50 "hullMass": 50,
"reserveFuelCapacity": 0.41
}, },
"Viper MkIV": { "Viper MkIV": {
"hullMass": 190 "hullMass": 190,
"reserveFuelCapacity": 0.46
}, },
"Vulture": { "Vulture": {
"hullMass": 230 "hullMass": 230,
"reserveFuelCapacity": 0.57
} }
} }