Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #143 from kelltom/runelite-launcher-overhaul
Browse files Browse the repository at this point in the history
Runelite launcher overhaul
  • Loading branch information
kelltom authored Mar 5, 2023
2 parents 57ce62b + c44e95b commit aadacd1
Show file tree
Hide file tree
Showing 11 changed files with 268 additions and 3,028 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ src/utilities/record_mouse/*
!src/utilities/record_mouse/record_mouse.py
src/runelite_settings/executable_paths.json
src/settings.pickle
src/runelite_settings/profile_manager_paths.json
19 changes: 17 additions & 2 deletions src/model/osrs/combat/combat.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ def save_options(self, options: dict):
self.options_set = True

def launch_game(self):
"""
This is a somewhat impractical way of modifying a properties file prior to launching RuneLite.
In this example, we make a copy of the default settings file, modify it according to the user's
option selections, and then launch RuneLite with the modified settings file. Since RuneLite 1.9.11,
it's likely more efficient to use the Profile Manager to modify settings on the fly.
"""
if launcher.is_program_running("RuneLite"):
self.log_msg("RuneLite is already running. Please close it and try again.")
return

# Make a copy of the default settings and save locally
src = launcher.runelite_settings_folder.joinpath("osrs_settings.properties")
src = launcher.RL_SETTINGS_FOLDER_PATH.joinpath("osrs_settings.properties")
dst = Path(__file__).parent.joinpath("custom_settings.properties")
shutil.copy(str(src), str(dst))

# Modify the highlight list
loot_items = self.capitalize_loot_list(self.loot_items, to_list=False)
with dst.open() as f:
Expand All @@ -66,8 +74,15 @@ def launch_game(self):
lines[i] = f"grounditems.highlightedItems={loot_items}\n"
with dst.open("w") as f:
f.writelines(lines)

# Launch the game
launcher.launch_runelite_with_settings(self, dst)
launcher.launch_runelite(
properties_path=dst,
game_title=self.game_title,
use_profile_manager=True, # Important for games that use the new Profile Manager RL feature
profile_name="OSBCCombat", # Supply a profile name if you'd like to save it to the Profile Manager
callback=self.log_msg,
)

def main_loop(self):
self.log_msg("WARNING: This script is for testing and may not be safe for personal use. Please modify it to suit your needs.")
Expand Down
Loading

0 comments on commit aadacd1

Please sign in to comment.