mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 08:40:34 +03:00
Added fssbodysignals
This commit is contained in:
parent
9e647f6f2d
commit
88b3dc27e5
@ -1213,6 +1213,57 @@ class EDDN:
|
||||
this.eddn.export_journal_entry(cmdr, entry, msg)
|
||||
return None
|
||||
|
||||
def export_journal_fssbodysignals(
|
||||
self, cmdr: str, system_name: str, system_starpos: list, is_beta: bool, entry: MutableMapping[str, Any]
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Send an FSSBodySignals message to EDDN on the correct schema.
|
||||
|
||||
:param cmdr: the commander under which this upload is made
|
||||
:param system_name: Name of current star system
|
||||
:param system_starpos: Coordinates of current star system
|
||||
:param is_beta: whether or not we are in beta mode
|
||||
:param entry: the journal entry to send
|
||||
"""
|
||||
# {
|
||||
# "timestamp" : "2022-03-15T13:07:51Z",
|
||||
# "event" : "FSSBodySignals",
|
||||
# "BodyName" : "Phroi Blou BQ-Y d1162 1 a",
|
||||
# "BodyID" : 12,
|
||||
# "SystemAddress" : 39935704602251,
|
||||
# "Signals" : [
|
||||
# {
|
||||
# "Type" : "$SAA_SignalType_Geological;",
|
||||
# "Type_Localised" : "Geological",
|
||||
# "Count" : 3
|
||||
# }
|
||||
# ]
|
||||
# }
|
||||
|
||||
#######################################################################
|
||||
# Elisions
|
||||
entry = filter_localised(entry)
|
||||
#######################################################################
|
||||
|
||||
#######################################################################
|
||||
# Augmentations
|
||||
#######################################################################
|
||||
# In this case should add StarPos
|
||||
ret = this.eddn.entry_augment_system_data(entry, system_name, system_starpos)
|
||||
if isinstance(ret, str):
|
||||
return ret
|
||||
|
||||
entry = ret
|
||||
#######################################################################
|
||||
|
||||
msg = {
|
||||
'$schemaRef': f'https://eddn.edcd.io/schemas/fssbodysignals/1{"/test" if is_beta else ""}',
|
||||
'message': entry
|
||||
}
|
||||
|
||||
this.eddn.export_journal_entry(cmdr, entry, msg)
|
||||
return None
|
||||
|
||||
def canonicalise(self, item: str) -> str:
|
||||
"""
|
||||
Canonicalise the given commodity name.
|
||||
@ -1545,7 +1596,7 @@ def journal_entry( # noqa: C901, CCR001
|
||||
|
||||
# NB: If adding FSSSignalDiscovered these absolutely come in at login
|
||||
# time **BEFORE** the `Location` event, so we won't yet know things
|
||||
# like SystemNane, or StarPos.
|
||||
# like SystemName, or StarPos.
|
||||
# We can either have the "now send the batch" code add such (but
|
||||
# that has corner cases around changing systems in the meantime),
|
||||
# drop those events, or if the schema allows, send without those
|
||||
@ -1559,6 +1610,14 @@ def journal_entry( # noqa: C901, CCR001
|
||||
is_beta,
|
||||
entry
|
||||
)
|
||||
elif event_name == 'fssbodysignals':
|
||||
return this.eddn.export_journal_fssbodysignals(
|
||||
cmdr,
|
||||
system,
|
||||
state['StarPos'],
|
||||
is_beta,
|
||||
entry
|
||||
)
|
||||
|
||||
# Send journal schema events to EDDN, but not when on a crew
|
||||
if (config.get_int('output') & config.OUT_SYS_EDDN and not state['Captain'] and
|
||||
|
Loading…
x
Reference in New Issue
Block a user