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

Merge pull request #2372 from dvdmuckle/powerplay-2.0-additions

Add code to track PP2.0 rank, merits, etc
This commit is contained in:
David Sangrey 2025-02-25 22:46:58 +00:00 committed by GitHub
commit 2f3f7262da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View File

@ -688,6 +688,7 @@ Content of `state` (updated to the current journal entry):
| `StationName`[3] | `Optional[str]` | Name of the station we're docked at, if applicable |
| `MarketID`[3] | `Optional[str]` | MarketID of the station we're docked at, if applicable |
| `StationType`[3] | `Optional[str]` | Type of the station we're docked at, if applicable |
| `Powerplay` | `dict` | `dict` of information on Powerplay
[1] - Contents of `NavRoute` not changed if a `NavRouteClear` event is seen,
but plugins will see the `NavRouteClear` event.
@ -836,6 +837,12 @@ the 'Body' name value.
`StationName`, `MarketID`, and `StationType` added to the `state` dictionary.
New in version 5.13.0:
`state` now has `Powerplay`, a `dict` including `Rank`, `Merits`, `Power`,
`TimePledged`, and `Votes`. `Votes` should only be populated if playing in
legacy mode, as it is no longer a concept in the current version of the game.
___
##### Synthetic Events

View File

@ -179,6 +179,13 @@ class EDLogs(FileSystemEventHandler):
'StationName': None,
'NavRoute': None,
'Powerplay': {
'Power': None,
'Rank': None,
'Merits': None,
'Votes': None,
'TimePledged': None,
},
}
def start(self, root: 'tkinter.Tk') -> bool: # noqa: CCR001
@ -1839,6 +1846,13 @@ class EDLogs(FileSystemEventHandler):
# There should be a `Backpack` event as you 'come to' in the
# new location, so no need to zero out BackPack here.
elif event_type == 'powerplay':
self.state['Powerplay']['Power'] = entry.get('Power', '')
self.state['Powerplay']['Rank'] = entry.get('Rank', 0)
self.state['Powerplay']['Merits'] = entry.get('Merits', 0)
self.state['Powerplay']['Votes'] = entry.get('Votes', 0)
self.state['Powerplay']['TimePledged'] = entry.get('TimePledged', 0)
return entry
except Exception as ex:

View File

@ -548,6 +548,10 @@ def journal_entry( # noqa: C901, CCR001
power_defect_data = {'powerName': entry["ToPower"], 'rankValue': 1}
new_add_event('setCommanderRankPower', entry['timestamp'], power_defect_data)
elif event_name == 'Powerplay':
power_data = {'powerName': entry["Power"], 'rankValue': entry["Rank"], 'meritsValue': entry["Merits"]}
new_add_event('setCommanderRankPower', entry['timestamp'], power_data)
# Ship change
if event_name == 'Loadout' and this.shipswap:
this.loadout = make_loadout(state)