From 9ff3327ff738310a801302521448fb4603c7a2cc Mon Sep 17 00:00:00 2001 From: David Muckle Date: Thu, 20 Feb 2025 19:17:50 -0500 Subject: [PATCH 1/5] Add code to track PP2.0 rank, merits, etc --- monitor.py | 14 ++++++++++++++ plugins/inara.py | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/monitor.py b/monitor.py index badc4c71..e37e77c1 100644 --- a/monitor.py +++ b/monitor.py @@ -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: diff --git a/plugins/inara.py b/plugins/inara.py index f2c9830e..b48609f0 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -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) From 3c22aad2542fcfbaa87c8feb450203551c8e382c Mon Sep 17 00:00:00 2001 From: David Muckle Date: Sat, 22 Feb 2025 17:52:22 -0500 Subject: [PATCH 2/5] Update PLUGINS.md with new info about Powerplay in `state` --- PLUGINS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PLUGINS.md b/PLUGINS.md index 69f7934e..da7303f4 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -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 From 529cf68db0825373762691ed100ef417790028ff Mon Sep 17 00:00:00 2001 From: David Muckle Date: Sun, 23 Feb 2025 10:57:09 -0500 Subject: [PATCH 3/5] Remove extra newline --- PLUGINS.md | 1 - 1 file changed, 1 deletion(-) diff --git a/PLUGINS.md b/PLUGINS.md index da7303f4..f84e9444 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -842,7 +842,6 @@ 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 From 317d9fa32b1faa50b4830772dd9936ef5ca9cc49 Mon Sep 17 00:00:00 2001 From: David Muckle Date: Sun, 23 Feb 2025 11:31:11 -0500 Subject: [PATCH 4/5] Revert "Remove extra newline" This reverts commit 529cf68db0825373762691ed100ef417790028ff. --- PLUGINS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/PLUGINS.md b/PLUGINS.md index f84e9444..da7303f4 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -842,6 +842,7 @@ 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 From 3fc8251fa4bfbe7bd0a442a069c195a8a4faced4 Mon Sep 17 00:00:00 2001 From: David Muckle Date: Thu, 27 Feb 2025 11:50:56 -0500 Subject: [PATCH 5/5] Squashed commit of the following: commit 39b0aec5f2830b9b0fe9ca3c40aa0eaa52a45ba1 Merge: 9c600bf8 2f3f7262 Author: David Muckle Date: Thu Feb 27 09:29:09 2025 -0500 Merge branch 'main' into expanduser-journal-path commit 9c600bf84755c0d9c25c60007d816384862abf33 Author: David Muckle Date: Thu Feb 27 09:24:04 2025 -0500 Expanduser journal path --- journal_lock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journal_lock.py b/journal_lock.py index 2aae20a6..3e16b309 100644 --- a/journal_lock.py +++ b/journal_lock.py @@ -51,7 +51,7 @@ class JournalLock: else: try: - self.journal_dir_path = pathlib.Path(self.journal_dir) + self.journal_dir_path = pathlib.Path.expanduser(pathlib.Path(self.journal_dir)) except Exception: # pragma: no cover logger.exception("Couldn't make pathlib.Path from journal_dir")