mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
[2262] Move SLEF to Monitor
This commit is contained in:
parent
0cc35db96b
commit
3b6259276a
267
inara.json
267
inara.json
@ -1,267 +0,0 @@
|
||||
{
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
34
monitor.py
34
monitor.py
@ -21,9 +21,10 @@ from time import gmtime, localtime, mktime, sleep, strftime, strptime, time
|
||||
from typing import TYPE_CHECKING, Any, BinaryIO, MutableMapping
|
||||
import semantic_version
|
||||
import util_ships
|
||||
from config import config
|
||||
from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_localised
|
||||
from config import config, appname, appversion
|
||||
from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_localised, ship_name_map
|
||||
from EDMCLogging import get_main_logger
|
||||
from edshipyard import ships
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import tkinter
|
||||
@ -109,6 +110,7 @@ class EDLogs(FileSystemEventHandler):
|
||||
self.group: str | None = None
|
||||
self.cmdr: str | None = None
|
||||
self.started: int | None = None # Timestamp of the LoadGame event
|
||||
self.slef: str | None = None
|
||||
|
||||
self._navroute_retries_remaining = 0
|
||||
self._last_navroute_journal_timestamp: float | None = None
|
||||
@ -701,6 +703,34 @@ class EDLogs(FileSystemEventHandler):
|
||||
module.pop('AmmoInHopper')
|
||||
|
||||
self.state['Modules'][module['Slot']] = module
|
||||
# SLEF
|
||||
initial_dict = {
|
||||
"header": {"appName": appname, "appVersion": str(appversion())}
|
||||
}
|
||||
data_dict = {}
|
||||
for module in entry['Modules']:
|
||||
if module.get('Slot') == 'FuelTank':
|
||||
cap = module['Item'].split('size')
|
||||
cap = cap[1].split('_')
|
||||
cap = 2 ** int(cap[0])
|
||||
ship = ship_name_map[entry["Ship"]]
|
||||
fuel = {'Main': cap, 'Reserve': ships[ship]['reserveFuelCapacity']}
|
||||
data_dict.update({"FuelCapacity": fuel})
|
||||
data_dict.update({
|
||||
'Ship': entry["Ship"],
|
||||
'ShipName': entry['ShipName'],
|
||||
'ShipIdent': entry['ShipIdent'],
|
||||
'HullValue': entry['HullValue'],
|
||||
'ModulesValue': entry['ModulesValue'],
|
||||
'Rebuy': entry['Rebuy'],
|
||||
'MaxJumpRange': entry['MaxJumpRange'],
|
||||
'UnladenMass': entry['UnladenMass'],
|
||||
'CargoCapacity': entry['CargoCapacity'],
|
||||
'Modules': entry['Modules'],
|
||||
})
|
||||
initial_dict.update({'data': data_dict})
|
||||
output = json.dumps(initial_dict, indent=4)
|
||||
self.slef = str(output)
|
||||
|
||||
elif event_type == 'modulebuy':
|
||||
self.state['Modules'][entry['Slot']] = {
|
||||
|
@ -35,7 +35,6 @@ import requests
|
||||
import edmc_data
|
||||
import killswitch
|
||||
import myNotebook as nb # noqa: N813
|
||||
from edshipyard import ships
|
||||
import plug
|
||||
import timeout_session
|
||||
from companion import CAPIData
|
||||
@ -872,7 +871,6 @@ def journal_entry( # noqa: C901, CCR001
|
||||
cur_ship['shipRebuyCost'] = state['Rebuy']
|
||||
|
||||
new_add_event('setCommanderShip', entry['timestamp'], cur_ship)
|
||||
make_slef(entry)
|
||||
|
||||
# Stored modules
|
||||
if event_name == 'StoredModules':
|
||||
@ -1479,39 +1477,6 @@ def make_loadout(state: dict[str, Any]) -> dict[str, Any]: # noqa: CCR001
|
||||
}
|
||||
|
||||
|
||||
def make_slef(entry) -> None:
|
||||
initial_dict = {
|
||||
"header": {"appName": appname, "appVersion": str(appversion())}
|
||||
}
|
||||
data_dict = {}
|
||||
for module in entry['Modules']:
|
||||
if module.get('Slot') == 'FuelTank':
|
||||
cap = module['Item'].split('size')
|
||||
cap = cap[1].split('_')
|
||||
cap = 2 ** int(cap[0])
|
||||
ship = edmc_data.ship_name_map[entry["Ship"]]
|
||||
fuel = {'Main': cap, 'Reserve': ships[ship]['reserveFuelCapacity']}
|
||||
data_dict.update({"FuelCapacity": fuel})
|
||||
data_dict.update({
|
||||
'Ship': entry["Ship"],
|
||||
'ShipName': entry['ShipName'],
|
||||
'ShipIdent': entry['ShipIdent'],
|
||||
'HullValue': entry['HullValue'],
|
||||
'ModulesValue': entry['ModulesValue'],
|
||||
'Rebuy': entry['Rebuy'],
|
||||
'MaxJumpRange': entry['MaxJumpRange'],
|
||||
'UnladenMass': entry['UnladenMass'],
|
||||
'CargoCapacity': entry['CargoCapacity'],
|
||||
'Modules': entry['Modules'],
|
||||
})
|
||||
initial_dict.update({'data': data_dict})
|
||||
output = json.dumps(initial_dict, indent=4)
|
||||
this.SLEF = str(output)
|
||||
print('set output')
|
||||
print(type(this.SLEF))
|
||||
return None
|
||||
|
||||
|
||||
def new_add_event(
|
||||
name: str,
|
||||
timestamp: str,
|
||||
|
@ -195,9 +195,9 @@ class HyperlinkLabel(tk.Label or ttk.Label): # type: ignore
|
||||
|
||||
if self.name == 'ship':
|
||||
# TODO: Get SLEF from Inara
|
||||
# print(self.SLEF)
|
||||
# menu.add_command(label=tr.tl('Copy INARA SLEF'), command=lambda: self.copy_slef(self), state=tk.DISABLED)
|
||||
# menu.entryconfigure(1, state=self.SLEF and tk.NORMAL or tk.DISABLED)
|
||||
print(bool(monitor.slef))
|
||||
menu.add_command(label=tr.tl('Copy INARA SLEF'), command=self.copy_slef, state=tk.DISABLED)
|
||||
menu.entryconfigure(1, state=monitor.slef and tk.NORMAL or tk.DISABLED)
|
||||
|
||||
menu.add_separator()
|
||||
for url in plug.provides('shipyard_url'):
|
||||
@ -230,7 +230,7 @@ class HyperlinkLabel(tk.Label or ttk.Label): # type: ignore
|
||||
self.clipboard_clear()
|
||||
self.clipboard_append(self['text'])
|
||||
|
||||
# def copy_slef(self, this) -> None:
|
||||
# """Copy the current text to the clipboard."""
|
||||
# self.clipboard_clear()
|
||||
# self.clipboard_append(this.SLEF)
|
||||
def copy_slef(self) -> None:
|
||||
"""Copy the current text to the clipboard."""
|
||||
self.clipboard_clear()
|
||||
self.clipboard_append(monitor.slef)
|
||||
|
Loading…
x
Reference in New Issue
Block a user