Skip to content

Commit 4fee374

Browse files
committed
Adding functionality to fix renamed boff abilities
1 parent 60a9648 commit 4fee374

5 files changed

Lines changed: 61 additions & 6 deletions

File tree

local/aliases.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"boff_abilities": {
3+
"Auxiliary to Battery": "Auxiliary Power to the Emergency Battery",
4+
"Auxiliary to Dampeners": "Auxiliary Power to the Inertial Dampers",
5+
"Auxiliary to Structural": "Auxiliary Power to the Structural Integrity Field"
6+
},
7+
"equipment": {},
8+
"traits": {}
9+
}

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Launcher():
88

9-
version = '2026.01b110'
9+
version = '2026.01b280'
1010
__version__ = '2.2'
1111

1212
# holds the style of the app

src/app.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
PRIMARY_SPECS, RARITIES, SCROLLOFF, SCROLLON, SECONDARY_SPECS, SMAXMAX, SMAXMIN, SMINMAX,
1010
SMINMIN)
1111
from .iofunc import (
12-
create_folder, delete_folder_contents, get_asset_path, load_icon, open_url, store_json)
12+
create_folder, delete_folder_contents, get_asset_path, load_icon, load_json, open_url,
13+
store_json)
1314
from .subwindows import ExportWindow, ItemEditor, Picker, ShipSelector
1415
from .widgets import (
1516
Cache, ContextMenu, GridLayout, HBoxLayout, ImageLabel, ShipButton, ShipImage, TooltipLabel,
@@ -98,6 +99,7 @@ def __init__(self, theme, args, path, config, versions):
9899
self.init_environment()
99100
self.app, self.window = self.create_main_window()
100101
self.cache_icons()
102+
self.cache_item_aliases()
101103
self.building = True
102104
self.build = self.empty_build()
103105
self.export_window = ExportWindow(self, self.window, self.get_build_markdown)
@@ -181,6 +183,12 @@ def cache_icons(self):
181183
self.cache.icons['STOCD'] = load_icon('stocd.png', self.app_dir).pixmap(
182184
self.box_height, self.box_height * 182 / 106)
183185

186+
def cache_item_aliases(self):
187+
"""
188+
Loads item aliases into cache (used for fixing renamed items).
189+
"""
190+
self.cache.item_aliases = load_json(get_asset_path('aliases.json', self.app_dir))
191+
184192
def main_window_close_callback(self, event):
185193
"""
186194
Executed when application is closed.

src/buildupdater.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,26 @@ def load_boff_stations(self, environment: str):
453453
self.widgets.build['space']['boff_labels'][boff_id].setCurrentText(boff_text)
454454
for ability, slot in zip(boff_data, self.widgets.build['space']['boffs'][boff_id]):
455455
if ability is not None and ability != '':
456-
tooltip = self.cache.boff_abilities['all'][ability['item']]
457-
slot.set_item_full(image(self, ability['item']), None, tooltip)
456+
tooltip = self.cache.boff_abilities['all'].get(ability['item'], None)
457+
if tooltip is None:
458+
new_name = self.cache.item_aliases['boff_abilities'].get(
459+
ability['item'], None)
460+
if new_name is None:
461+
slot.clear()
462+
else:
463+
tooltip = self.cache.boff_abilities['all'].get(new_name, None)
464+
if tooltip is None:
465+
slot.clear()
466+
else:
467+
slot.set_item_full(image(self, new_name), None, tooltip)
468+
for id, old_ability in enumerate(boff_data):
469+
if not isinstance(old_ability, dict):
470+
continue
471+
if ability['item'] == old_ability['item']:
472+
self.build['space']['boffs'][boff_id][id]['item'] = new_name
473+
break
474+
else:
475+
slot.set_item_full(image(self, ability['item']), None, tooltip)
458476
else:
459477
slot.clear()
460478
elif environment == 'ground':
@@ -465,8 +483,27 @@ def load_boff_stations(self, environment: str):
465483
self.build['ground']['boff_specs'][boff_id])
466484
for ability, slot in zip(boff_data, self.widgets.build['ground']['boffs'][boff_id]):
467485
if ability is not None and ability != '':
468-
tooltip = self.cache.boff_abilities['all'][ability['item']]
469-
slot.set_item_full(image(self, ability['item']), None, tooltip)
486+
tooltip = self.cache.boff_abilities['all'].get(ability['item'], None)
487+
if tooltip is None:
488+
new_name = self.cache.item_aliases['boff_abilities'].get(
489+
ability['item'], None)
490+
if new_name is None:
491+
slot.clear()
492+
else:
493+
tooltip = self.cache.boff_abilities['all'].get(new_name, None)
494+
if tooltip is None:
495+
slot.clear()
496+
else:
497+
slot.set_item_full(image(self, new_name), None, tooltip)
498+
for id, old_ability in enumerate(boff_data):
499+
if not isinstance(old_ability, dict):
500+
continue
501+
if ability['item'] == old_ability['item']:
502+
self.build['ground']['boffs'][boff_id][id]['item'] = (
503+
new_name)
504+
break
505+
else:
506+
slot.set_item_full(image(self, ability['item']), None, tooltip)
470507
else:
471508
slot.clear()
472509

src/widgets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ def reset_cache(self, keep_skills=False):
191191
self.images_set: set = set()
192192
self.images_populated: bool = False
193193
self.images_failed: dict = dict()
194+
self.item_aliases: dict = dict()
194195

195196
def boff_dict(self):
196197
return {

0 commit comments

Comments
 (0)