mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Merge pull request #1457 from EDCD/enhancement/1451-eddn-schema-fssallbodiesfound
eddn: Implement fssallbodiesfound/1
This commit is contained in:
commit
af514acc11
@ -1,6 +1,11 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
# This can be used to check how pre-commit is being run
|
||||
# - repo: meta
|
||||
# hooks:
|
||||
# - id: identity
|
||||
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: 'v4.1.0'
|
||||
hooks:
|
||||
@ -44,6 +49,9 @@ repos:
|
||||
rev: 'v0.931'
|
||||
hooks:
|
||||
- id: mypy
|
||||
# verbose: true
|
||||
# log_file: 'pre-commit_mypy.log'
|
||||
additional_dependencies: [ types-requests ]
|
||||
# args: [ "--follow-imports", "skip", "--ignore-missing-imports", "--scripts-are-modules" ]
|
||||
|
||||
### # pydocstyle.exe <file>
|
||||
|
@ -1145,6 +1145,44 @@ class EDDN:
|
||||
this.eddn.export_journal_entry(cmdr, entry, msg)
|
||||
return None
|
||||
|
||||
def export_journal_fssallbodiesfound(
|
||||
self, cmdr: str, system_name: str, system_starpos: list, is_beta: bool, entry: MutableMapping[str, Any]
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Send an FSSAllBodiesFound 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
|
||||
"""
|
||||
# {
|
||||
# "Count": 3,
|
||||
# "SystemAddress": 9466778822057,
|
||||
# "SystemName": "LP 704-74",
|
||||
# "event": "FSSAllBodiesFound",
|
||||
# "timestamp": "2022-02-09T18:15:14Z"
|
||||
# }
|
||||
#######################################################################
|
||||
# Augmentations
|
||||
#######################################################################
|
||||
# In this case should add StarSystem and 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/fssallbodiesfound/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.
|
||||
@ -1469,6 +1507,15 @@ def journal_entry( # noqa: C901, CCR001
|
||||
entry
|
||||
)
|
||||
|
||||
elif event_name == 'fssallbodiesfound':
|
||||
return this.eddn.export_journal_fssallbodiesfound(
|
||||
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
|
||||
(event_name in ('location', 'fsdjump', 'docked', 'scan', 'saasignalsfound', 'carrierjump')) and
|
||||
|
Loading…
x
Reference in New Issue
Block a user