### start_instance Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Starts a new instance of the Wizwalker game client. It determines the installation path using `get_wiz_install` and launches the game executable. ```APIDOC ## start_instance ### Description Starts a wizard101 instance. ### Usage This function starts the game client executable from its installation directory. ``` -------------------------------- ### Start Wizard101 Instance Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Launches a new instance of Wizard101 using the determined installation path and specific command-line arguments for login. ```python def start_instance(): """ Starts a wizard101 instance """ location = get_wiz_install() subprocess.Popen( rf"{location}\Bin\WizardGraphicalClient.exe -L login.us.wizard101.com 12000", cwd=rf"{location}\Bin", ) ``` -------------------------------- ### Start Wizard101 Instance Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Launches a new instance of the Wizard101 game client. Requires the game's install location to be correctly determined. ```python def start_instance(): location = get_wiz_install() subprocess.Popen( rf"{location}\Bin\WizardGraphicalClient.exe -L login.us.wizard101.com 12000", cwd=rf"{location}\Bin", ) ``` -------------------------------- ### start_instances_with_login Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Starts a specified number of game instances and logs them in using provided credentials. It waits for the instances to start and then uses `instance_login` to authenticate. ```APIDOC ## start_instances_with_login ### Description Start a number of instances and login to them with logins. ### Parameters #### Path Parameters - **instance_number** (int) - Required - The number of instances to start. - **logins** (Iterable) - Required - An iterable of login strings, where each string is in the format 'username:password'. - **wait_for_ready** (bool) - Optional - Whether to wait for instances to be ready before logging in. Defaults to True. ``` -------------------------------- ### HotkeyListener Example Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Demonstrates how to use HotkeyListener to add, remove, and manage hotkeys with associated callbacks. Includes starting and stopping the listener, and handling hotkey removal. ```python import asyncio from wizwalker import Keycode, HotkeyListener, ModifierKeys async def main(): listener = HotkeyListener() async def callback(): print("a was pressed; removing it") await listener.remove_hotkey(Keycode.A, modifiers=ModifierKeys.NOREPEAT) await listener.add_hotkey(Keycode.A, callback, modifiers=ModifierKeys.NOREPEAT) listener.start() try: # your program here while True: await asyncio.sleep(1) finally: await listener.stop() if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### start Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Starts the hotkey listener. It initializes the message loop and registers any pre-defined hotkeys. ```APIDOC ## start ### Description Start the listener ### Method `start(self)` ### Parameters None ``` -------------------------------- ### Start Multiple Instances and Log In Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Starts a specified number of game instances and logs them in using provided credentials. Waits for instances to become ready. ```python async def start_instances_with_login(instance_number: int, logins: Iterable, wait_for_ready=True): start_handles = set(get_all_wizard_handles()) for _ in range(instance_number): start_instance() # TODO: have way to properly check if instances are on login screen # waiting for instances to start if wait_for_ready: await asyncio.sleep(7) new_handles = set(get_all_wizard_handles()).difference(start_handles) for handle, username_password in zip(new_handles, logins): username, password = username_password.split(":") instance_login(handle, username, password) ``` -------------------------------- ### Get Wizard101 Install Directory Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Retrieves the game's installation directory, checking an override path, a default location, and the Windows registry. ```python def get_wiz_install() -> Path: if _OVERRIDE_PATH: return Path(_OVERRIDE_PATH).absolute() default_install_path = Path(DEFAULT_INSTALL) if default_install_path.exists(): return default_install_path try: with winreg.OpenKey( winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\{A9E27FF5-6294-46A8-B8FD-77B1DECA3021}", 0, winreg.KEY_READ, ) as key: install_location = Path( winreg.QueryValueEx(key, "InstallLocation")[0] ).absolute() return install_location except OSError: raise Exception("Wizard101 install not found.") ``` -------------------------------- ### Listener Class Example Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Demonstrates how to set up a hotkey listener. It requires importing `asyncio`, `Hotkey`, `Keycode`, and `Listener`. The example shows defining a callback and registering a hotkey. ```python # TODO: remove in 2.0, make sure to also remove janus requirement class Listener: """ Hotkey listener Args: hotkeys: list of Hotkeys to be listened for loop: The event loop to use; defaults to current Examples: .. code-block:: py import asyncio from wizwalker import Hotkey, Keycode, Listener async def main(): async def callback(): print("a was pressed") hotkey = Hotkey(Keycode.A, callback) listener = Listener(hotkey) listener.listen_forever() ``` -------------------------------- ### Start and Login to Multiple Instances Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Starts a specified number of Wizard101 instances and logs them in using provided credentials. It waits for instances to become ready before attempting login. ```python async def start_instances_with_login(instance_number: int, logins: Iterable, wait_for_ready=True): """ Start a number of instances and login to them with logins Args: instance_number: number of instances to start logins: logins to use """ start_handles = set(get_all_wizard_handles()) for _ in range(instance_number): start_instance() # TODO: have way to properly check if instances are on login screen # waiting for instances to start if wait_for_ready: await asyncio.sleep(7) new_handles = set(get_all_wizard_handles()).difference(start_handles) for handle, username_password in zip(new_handles, logins): username, password = username_password.split(":") instance_login(handle, username, password) ``` -------------------------------- ### Basic Hotkey Listener Example Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Demonstrates how to set up a hotkey listener for a specific key (e.g., 'a') and execute a callback function when it's pressed. This example uses `asyncio` for asynchronous operations and requires importing `Hotkey`, `Keycode`, and `Listener` from `wizwalker`. ```python import asyncio from wizwalker import Hotkey, Keycode, Listener async def main(): async def callback(): print("a was pressed") hotkey = Hotkey(Keycode.A, callback) listener = Listener(hotkey) listener.listen_forever() # your program here while True: await asyncio.sleep(1) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Start a New Wizard101 Client Source: https://starrfox.github.io/wizwalker/wizwalker/client_handler.html A static method to launch a new instance of the Wizard101 client. It relies on a utility function to start the game process. ```python @staticmethod def start_wiz_client(): """ Start a new client """ utils.start_instance() ``` -------------------------------- ### Get Wizard101 Install Directory Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Retrieves the game's installation directory. It first checks for an override path, then a default path, and finally attempts to read it from the Windows Registry. ```python def get_wiz_install() -> Path: """ Get the game install root dir """ if _OVERRIDE_PATH: return Path(_OVERRIDE_PATH).absolute() default_install_path = Path(DEFAULT_INSTALL) if default_install_path.exists(): return default_install_path try: with winreg.OpenKey( winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\{A9E27FF5-6294-46A8-B8FD-77B1DECA3021}", 0, winreg.KEY_READ, ) as key: install_location = Path( winreg.QueryValueEx(key, "InstallLocation")[0] ).absolute() return install_location except OSError: raise Exception("Wizard101 install not found.") ``` -------------------------------- ### Start a New Wiz Client Source: https://starrfox.github.io/wizwalker/wizwalker/client_handler.html A static method to initiate a new wizard client instance. This is a utility function for starting the game client process. ```python @staticmethod def start_wiz_client(): """ Start a new client """ utils.start_instance() ``` -------------------------------- ### start_wiz_client Source: https://starrfox.github.io/wizwalker/wizwalker/client_handler.html Starts a new Wizwalker client instance. ```APIDOC ## start_wiz_client ### Description Starts a new client instance. ### Method Static method ### Endpoint N/A (Static method) ### Parameters None ### Request Example ```python WizwalkerClientHandler.start_wiz_client() ``` ### Response None ``` -------------------------------- ### Predicate Example for Window Filtering Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html An example predicate function demonstrating how to filter window handles. This specific example returns True for a handle of 0, indicating it should be returned. ```python def predicate(window_handle): if window_handle == 0: # handle will be returned return True else: # handle will not be returned return False ``` -------------------------------- ### Start Wizwalker Console Source: https://starrfox.github.io/wizwalker/wizwalker/cli/console.html Initiates the Wizwalker console, starts a monitor client in a separate thread, and runs the main application loop. Handles KeyboardInterrupt for graceful shutdown. ```python def start_console(loop=None, locals=None): if loop is None: loop = asyncio.get_event_loop() def app(): try: loop.run_forever() except KeyboardInterrupt: print("Closing wizwalker; hooks should be rewritten") loop.run_until_complete(locals["walker"].close()) tasks = asyncio.Task.all_tasks(loop) for task in tasks: if not task.done(): task.cancel() loop.run_until_complete(asyncio.gather(*tasks, return_exceptions=True)) def run_monitor(): cli.monitor_client(cli.MONITOR_HOST, cli.MONITOR_PORT) monitor_thread = threading.Thread(target=run_monitor, daemon=True) monitor_thread.start() # monitor_proc = multiprocessing.Process(target=test_monitor, daemon=True) # loop.call_later(2, monitor_proc.start) with start_monitor(loop, monitor=WizWalkerConsole, locals=locals): app() ``` -------------------------------- ### get_wiz_install Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Retrieves the installation root directory for the Wizwalker game. It first checks for an overridden path, then looks for a default installation, and finally queries the Windows registry. ```APIDOC ## get_wiz_install ### Description Get the game install root dir. ### Returns - **pathlib.Path** - The absolute path to the game's installation directory. ``` -------------------------------- ### Start Console Application Source: https://starrfox.github.io/wizwalker/wizwalker/cli/console.html Sets up and runs the WizWalker console application. It starts a monitor thread, integrates with an asyncio event loop, and handles keyboard interrupts for graceful shutdown. The application's run loop is managed within this function. ```python # TODO: replace app with walker when WizWalker has run loop def start_console(loop=None, locals=None): if loop is None: loop = asyncio.get_event_loop() def app(): try: loop.run_forever() except KeyboardInterrupt: print("Closing wizwalker; hooks should be rewritten") loop.run_until_complete(locals["walker"].close()) tasks = asyncio.Task.all_tasks(loop) for task in tasks: if not task.done(): task.cancel() loop.run_until_complete(asyncio.gather(*tasks, return_exceptions=True)) def run_monitor(): cli.monitor_client(cli.MONITOR_HOST, cli.MONITOR_PORT) monitor_thread = threading.Thread(target=run_monitor, daemon=True) monitor_thread.start() # monitor_proc = multiprocessing.Process(target=test_monitor, daemon=True) # loop.call_later(2, monitor_proc.start) with start_monitor(loop, monitor=WizWalkerConsole, locals=locals): app() ``` -------------------------------- ### Get Wizard101 Install Location Source: https://starrfox.github.io/wizwalker/wizwalker/client_handler.html Retrieves the installation path for Wizard101 using a utility function. This is useful for locating game assets or configuration files. ```python @cached_property def install_location(self) -> Path: """ Wizard101 install location """ return utils.get_wiz_install() ``` -------------------------------- ### Start Wizwalker Hotkey Listener Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Starts the hotkey listener. Raises a ValueError if the listener is already running. Connects to the hotkey message loop and creates tasks for the message loop and hotkey registration. ```python def start(self): """ Start the listener """ if self._message_loop_task: raise ValueError("This listener has already been started") _hotkey_message_loop.connect() self._message_loop_task = asyncio.create_task(self._message_loop()) # this is because making this method async would be breaking loop = asyncio.get_event_loop() for keycode, modifiers in self._hotkeys: loop.create_task(self._register_hotkey(keycode, modifiers)) ``` -------------------------------- ### Start Thread at Address Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_reader.html Starts a new thread in the target process, beginning execution at the given memory address. ```python await self.run_in_executor(self.process.start_thread, address) ``` -------------------------------- ### HotkeyListener with Add/Remove Hotkey Example Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Illustrates how to use the `HotkeyListener` class to add and remove hotkeys dynamically. This example shows registering a hotkey for 'a' with `ModifierKeys.NOREPEAT`, executing a callback that then removes the hotkey, and starting/stopping the listener. It requires `asyncio`, `Keycode`, `HotkeyListener`, and `ModifierKeys`. ```python import asyncio from wizwalker import Keycode, HotkeyListener, ModifierKeys async def main(): listener = HotkeyListener() async def callback(): print("a was pressed; removing it") await listener.remove_hotkey(Keycode.A, modifiers=ModifierKeys.NOREPEAT) await listener.add_hotkey(Keycode.A, callback, modifiers=ModifierKeys.NOREPEAT) listener.start() try: # your program here while True: await asyncio.sleep(1) finally: await listener.stop() ``` -------------------------------- ### Override Wizard101 Install Location Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Globally overrides the default path returned by `get_wiz_install`. Use this to point to a custom installation directory. ```python def override_wiz_install_location(path: str): """ Override the path returned by get_wiz_install Args: path: The path to override with """ # hacking old behavior so I dont have to actually fix the issue global _OVERRIDE_PATH _OVERRIDE_PATH = path ``` -------------------------------- ### Get Wizard101 Install Location Source: https://starrfox.github.io/wizwalker/wizwalker/file_readers/cache_handler.html Retrieves the installation directory of Wizard101. This is a cached property, meaning it's computed once and then stored for subsequent access. ```python @cached_property def install_location(self) -> Path: """ Wizard101 install location """ return utils.get_wiz_install() ``` -------------------------------- ### start_thread Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_reader.html Starts a new thread in the process, beginning execution at the specified memory address. ```APIDOC ## start_thread ### Description Start a thread at a given memory address. ### Method `async def start_thread(self, address: int)` ### Parameters #### Arguments - **address** (int) - Required - The address at which to start the thread. ``` -------------------------------- ### Hotkey Listener Example Source: https://starrfox.github.io/wizwalker/wizwalker/hotkey.html Demonstrates how to use the Listener class to set up hotkeys and their associated callbacks. ```APIDOC ## Listener ### Description Listens for hotkeys and executes callbacks when they are triggered. ### Method `__init__(self, *hotkeys: Hotkey)` ### Parameters - `*hotkeys` (wizwalker.hotkey.Hotkey): A variable number of Hotkey objects to listen for. ### Method `listen_forever(self) -> asyncio.Task` ### Description Returns a task that continuously listens for hotkey events. ### Method `listen(self)` ### Description Listens for a single hotkey event and triggers its associated callback. ### Method `close(self)` ### Description Closes the hotkey listener, releasing resources. ``` -------------------------------- ### Get All Language File Names Source: https://starrfox.github.io/wizwalker/wizwalker/file_readers/cache_handler.html Iterates through all names in the root WAD file and returns a list of file names that start with 'Locale/English/'. ```python lang_file_names = [] for file_name in await root_wad.names(): if file_name.startswith("Locale/English/"): lang_file_names.append(file_name) return lang_file_names ``` -------------------------------- ### Get Windows with Predicate Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/window.html Finds all child windows (recursively) that satisfy a given predicate function. The predicate should return True for matching windows. Example usage is provided in the docstring. ```python async def get_windows_with_predicate( self, predicate: Callable ) -> List["DynamicWindow"]: """ async def my_pred(window) -> bool: if await window.name() == "friend's list": return True return False await client.root_window.get_windows_by_predicate(my_pred) """ windows = [] # check our own children try: children = await self.children() except (ValueError, MemoryReadError, AddressOutOfRange): children = [] for child in children: if await predicate(child): windows.append(child) for child in children: await child._recursive_get_windows_by_predicate(predicate, windows) return windows ``` -------------------------------- ### Override Wiz Install Location Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Allows overriding the default game installation path. Useful for testing or non-standard installations. ```python _OVERRIDE_PATH = None def override_wiz_install_location(path: str): global _OVERRIDE_PATH _OVERRIDE_PATH = path ``` -------------------------------- ### Read and Write Tutorial Mode Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/duel.html Manages whether the duel is in tutorial mode. Use this to get or set the tutorial mode state. ```python async def tutorial_mode(self) -> bool: return await self.read_value_from_offset(179, "bool") ``` ```python async def write_tutorial_mode(self, tutorial_mode: bool): await self.write_value_to_offset(179, tutorial_mode, "bool") ``` -------------------------------- ### Client Initialization Source: https://starrfox.github.io/wizwalker/wizwalker/client.html Initializes a Client object with a window handle, setting up various handlers for game interaction. ```python class Client: """ Represents a connected wizard client Args: window_handle: A handle to the window this client connects to """ def __init__(self, window_handle: int): self.window_handle = window_handle self._pymem = pymem.Pymem() self._pymem.open_process_from_id(self.process_id) self.hook_handler = HookHandler(self._pymem, self) self.cache_handler = CacheHandler() self.mouse_handler = MouseHandler(self) self.stats = CurrentGameStats(self.hook_handler) self.body = CurrentActorBody(self.hook_handler) self.duel = CurrentDuel(self.hook_handler) self.quest_position = CurrentQuestPosition(self.hook_handler) self.client_object = CurrentClientObject(self.hook_handler) self.root_window = CurrentRootWindow(self.hook_handler) self.render_context = CurrentRenderContext(self.hook_handler) self.game_client = CurrentGameClient(self.hook_handler) self._teleport_helper = TeleportHelper(self.hook_handler) self._template_ids = None self._is_loading_addr = None self._world_view_window = None self._movement_update_address = None self._movement_update_original_bytes = None self._movement_update_patched = False # for teleport self._je_instruction_forward_backwards = None ``` -------------------------------- ### Get Member Name Source: https://starrfox.github.io/wizwalker/wizwalker/combat/member.html Retrieves the name of the combat member by getting the 'Name' text window. ```python async def name(self) -> str: """ Name of this member """ name_window = await self.get_name_text_window() return await name_window.maybe_text() ``` -------------------------------- ### override_wiz_install_location Source: https://starrfox.github.io/wizwalker/wizwalker/utils.html Overrides the default installation path for the Wizwalker game. This is useful for testing or when the game is installed in a non-standard location. ```APIDOC ## override_wiz_install_location ### Description Override the path returned by get_wiz_install. ### Parameters #### Path Parameters - **path** (str) - Required - The path to override with. ``` -------------------------------- ### Tutorial Mode Management Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/duel.html Methods for reading and writing the tutorial mode status of the duel. ```APIDOC ## tutorial_mode ### Description Reads whether the duel is currently in tutorial mode. ### Method `async tutorial_mode() -> bool` ### Parameters None ### Response - **tutorial_mode** (bool) - True if in tutorial mode, False otherwise. ``` ```APIDOC ## write_tutorial_mode ### Description Sets whether the duel should be in tutorial mode. ### Method `async write_tutorial_mode(tutorial_mode: bool)` ### Parameters - **tutorial_mode** (bool) - Set to True to enable tutorial mode, False to disable it. ### Response None ``` -------------------------------- ### do_start Source: https://starrfox.github.io/wizwalker/wizwalker/cli/console.html Attaches to and hooks all new clients that have connected to WizWalker. It reports the number of new clients attached. ```APIDOC ## do_start ### Description Attach and hook to all new clients ### Method N/A (Console command) ### Parameters None ### Request Example ``` do_start ``` ### Response Prints the number of attached clients and confirmation for each hooked client. ``` -------------------------------- ### Get Display Name Source: https://starrfox.github.io/wizwalker/wizwalker/combat/card.html Retrieves the human-readable display name of the card by first getting its display name code and then looking it up in the cache. ```python code = await self.display_name_code() return await self.combat_handler.client.cache_handler.get_langcode_name(code) ``` -------------------------------- ### Initialize Wizwalker Client Source: https://starrfox.github.io/wizwalker/wizwalker/client.html Initializes a Client instance with a given window handle. It opens the process, sets up hook handlers, and initializes various game data accessors. ```python import asyncio import struct import warnings from functools import cached_property from typing import Callable, List, Optional import pymem from . import ( CacheHandler, Keycode, MemoryReadError, ReadingEnumFailed, utils, ExceptionalTimeout, ) from .constants import WIZARD_SPEED from .memory import ( CurrentActorBody, CurrentClientObject, CurrentDuel, CurrentGameStats, CurrentQuestPosition, CurrentRootWindow, CurrentGameClient, DuelPhase, HookHandler, CurrentRenderContext, TeleportHelper, MovementTeleportHook, ) from .mouse_handler import MouseHandler from .utils import ( XYZ, check_if_process_running, get_window_title, set_window_title, get_window_rectangle, wait_for_value, maybe_wait_for_any_value_with_timeout, maybe_wait_for_value_with_timeout, ) class Client: """ Represents a connected wizard client Args: window_handle: A handle to the window this client connects to """ def __init__(self, window_handle: int): self.window_handle = window_handle self._pymem = pymem.Pymem() self._pymem.open_process_from_id(self.process_id) self.hook_handler = HookHandler(self._pymem, self) self.cache_handler = CacheHandler() self.mouse_handler = MouseHandler(self) self.stats = CurrentGameStats(self.hook_handler) self.body = CurrentActorBody(self.hook_handler) self.duel = CurrentDuel(self.hook_handler) self.quest_position = CurrentQuestPosition(self.hook_handler) self.client_object = CurrentClientObject(self.hook_handler) self.root_window = CurrentRootWindow(self.hook_handler) self.render_context = CurrentRenderContext(self.hook_handler) self.game_client = CurrentGameClient(self.hook_handler) self._teleport_helper = TeleportHelper(self.hook_handler) self._template_ids = None self._is_loading_addr = None self._world_view_window = None self._movement_update_address = None self._movement_update_original_bytes = None self._movement_update_patched = False # for teleport self._je_instruction_forward_backwards = None ``` -------------------------------- ### Get Member Name - wizwalker.combat.member Source: https://starrfox.github.io/wizwalker/wizwalker/combat/member.html Retrieves the name of the combat member. It first gets the name text window and then extracts the text from it. ```python async def name(self) -> str: """ Name of this member """ name_window = await self.get_name_text_window() return await name_window.maybe_text() ``` -------------------------------- ### Initialize Wizwalker Client Source: https://starrfox.github.io/wizwalker/wizwalker/client.html Initializes the client with a window handle and sets up various handlers for game interaction, including memory access, hooks, caching, and input. ```python def __init__(self, window_handle: int): self.window_handle = window_handle self._pymem = pymem.Pymem() self._pymem.open_process_from_id(self.process_id) self.hook_handler = HookHandler(self._pymem, self) self.cache_handler = CacheHandler() self.mouse_handler = MouseHandler(self) self.stats = CurrentGameStats(self.hook_handler) self.body = CurrentActorBody(self.hook_handler) self.duel = CurrentDuel(self.hook_handler) self.quest_position = CurrentQuestPosition(self.hook_handler) self.client_object = CurrentClientObject(self.hook_handler) self.root_window = CurrentRootWindow(self.hook_handler) self.render_context = CurrentRenderContext(self.hook_handler) self.game_client = CurrentGameClient(self.hook_handler) self._teleport_helper = TeleportHelper(self.hook_handler) self._template_ids = None self._is_loading_addr = None self._world_view_window = None self._movement_update_address = None self._movement_update_original_bytes = None self._movement_update_patched = False # for teleport self._je_instruction_forward_backwards = None ``` -------------------------------- ### Start WizWalker and Hook Clients Source: https://starrfox.github.io/wizwalker/wizwalker/cli/console.html Attaches to and hooks all newly available clients. It retrieves new clients using the 'walker' local object and then activates hooks for each client. ```python def do_start(self): """Attach and hook to all new clients""" walker = self.get_local("walker") clients = walker.get_new_clients() self.write(f"Attached to {len(clients)} new clients") for idx, client in enumerate(clients): self.run_coro(client.activate_hooks(), None) self.write(f"client-{idx}: hooked all") ``` -------------------------------- ### Get Member Level - Python Source: https://starrfox.github.io/wizwalker/wizwalker/combat/member.html Retrieves the current level of a member. This function fetches the member's statistics to get the reference level. ```python async def level(self) -> int: """ This member's level """ stats = await self.get_stats() return await stats.reference_level() ``` -------------------------------- ### Tutorial Mode Management Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/duel.html Functions for reading and writing the tutorial mode status. ```APIDOC ## tutorial_mode ### Description Reads the current tutorial mode status. ### Method `tutorial_mode()` ### Parameters None ### Response - `bool`: True if tutorial mode is active, False otherwise. ``` ```APIDOC ## write_tutorial_mode ### Description Sets the tutorial mode status. ### Method `write_tutorial_mode(tutorial_mode: bool)` ### Parameters - **tutorial_mode** (bool) - Required - True to enable tutorial mode, False to disable it. ``` -------------------------------- ### WizWalker Initialization Source: https://starrfox.github.io/wizwalker/wizwalker/application.html Demonstrates the initialization of the WizWalker class, including a deprecation warning. ```python def __init__(self): super().__init__() warn( "The WizWalker class is depreciated and will be removed in 2.0; please use ClientHandler", DeprecationWarning, ) ``` -------------------------------- ### Login Client Source: https://starrfox.github.io/wizwalker/wizwalker/client.html Initiates the login process for the client using the provided username and password. ```python utils.instance_login(self.window_handle, username, password) ``` -------------------------------- ### Get Object Name Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/client_object.html Retrieves the object name by first getting the object template and then calling its object_name method. Returns None if the object template is not available. ```python async def object_name(self) -> Union[str, NoneType]: """ This client object's object name if it has one """ object_template = await self.object_template() if object_template is not None: return await object_template.object_name() # explict None return None ``` -------------------------------- ### Discover and Manage New Clients Source: https://starrfox.github.io/wizwalker/wizwalker/client_handler.html Scans for all running Wizard101 client handles, identifies any that are not yet managed, creates new Client objects for them, and adds them to the internal list. Returns a list of the newly added clients. ```python def get_new_clients(self) -> List[Client]: """ Get all new clients currently not managed Returns: List of new clients added """ all_handles = utils.get_all_wizard_handles() new_clients = [] for handle in all_handles: if handle not in self._managed_handles: self._managed_handles.append(handle) new_client = self.client_cls(handle) self.clients.append(new_client) new_clients.append(new_client) return new_clients ``` -------------------------------- ### CurrentRootWindow Methods Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/window.html Methods for interacting with the current root window. ```APIDOC ## CurrentRootWindow Methods ### `read_base_address(self) -> int` Reads and returns the base address of the current root window. ``` -------------------------------- ### Get Object Name Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/client_object.html Retrieves the object's name by first getting the object template and then calling its object_name method. Returns None if the object template is not available. ```python async def object_name(self) -> Optional[str]: """ This client object's object name if it has one """ object_template = await self.object_template() if object_template is not None: return await object_template.object_name() # explict None return None ``` -------------------------------- ### Write Help Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/window.html Writes new help text to the window. ```APIDOC ## write_help ### Description Writes new help text to the window. ### Method async def write_help(self, _help: str) ### Parameters - **_help** (str) - Required - The help text to write. ``` -------------------------------- ### Write Tutorial Mode Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/duel.html Writes a new tutorial mode boolean value to memory offset 179. Expects a bool. ```python async def write_tutorial_mode(self, tutorial_mode: bool): await self.write_value_to_offset(179, tutorial_mode, "bool") ``` -------------------------------- ### Get Graphical Spell Object Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/window.html Attempts to retrieve a DynamicGraphicalSpell object associated with this window. It reads an offset from memory to get the spell's address. Optionally checks if the window type is 'SpellCheckBox'. ```python async def maybe_graphical_spell( self, *, check_type: bool = False ) -> Optional[DynamicGraphicalSpell]: if check_type: type_name = await self.maybe_read_type_name() if type_name != "SpellCheckBox": raise ValueError(f"This object is a {type_name} not a SpellCheckBox.") addr = await self.read_value_from_offset(952, "long long") if addr == 0: return None return DynamicGraphicalSpell(self.hook_handler, addr) ``` -------------------------------- ### name Source: https://starrfox.github.io/wizwalker/wizwalker/combat/card.html Gets the name of the card. ```APIDOC ## name ### Description The name of this card. ### Method `async def name(self) -> str:` ### Parameters None ### Request Example ```python # Example usage: card_name = await card_instance.name() ``` ### Response #### Success Response - `str`: The name of the card. ### Error Handling None explicitly documented. ``` -------------------------------- ### Initialize WadFileInfo Source: https://starrfox.github.io/wizwalker/wizwalker/file_readers/wad.html Initializes a WadFileInfo object with details about a file within a WAD archive. ```python class WadFileInfo: def __init__(self, *, name, offset, size, is_zip, crc, unzipped_size): self.name = name self.offset = offset self.size = size self.is_zip = is_zip self.crc = crc self.unzipped_size = unzipped_size ``` -------------------------------- ### Help String Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_objects/window.html Read and write the help string associated with the window. This is represented as a string. ```APIDOC ## help ### Description Reads the help string from memory. ### Method `async def help(self) -> str` ### Response Example ```json { "example": "Helpful information about the window." } ``` ## write_help ### Description Writes the help string to memory. ### Method `async def write_help(self, _help: str)` ### Request Body - **_help** (str) - Required - The help string to write. ``` -------------------------------- ### spell_id Source: https://starrfox.github.io/wizwalker/wizwalker/combat/card.html Gets the spell ID of the card. ```APIDOC ## spell_id ### Description This card's spell id. ### Method `async def spell_id(self) -> int:` ### Parameters None ### Request Example ```python # Example usage: spell_id = await card_instance.spell_id() ``` ### Response #### Success Response - `int`: The spell ID of the card. ### Error Handling None explicitly documented. ``` -------------------------------- ### Initialize MemoryObject Source: https://starrfox.github.io/wizwalker/wizwalker/memory/memory_object.html Initializes the MemoryObject with a HookHandler, setting up the process and an offset lookup cache. ```python class MemoryObject(MemoryReader): """ Class for any represented classes from memory """ def __init__(self, hook_handler: HookHandler): super().__init__(hook_handler.process) self.hook_handler = hook_handler self._offset_lookup_cache = {} ``` -------------------------------- ### template_id Source: https://starrfox.github.io/wizwalker/wizwalker/combat/card.html Gets the template ID of the card. ```APIDOC ## template_id ### Description This card's template id. ### Method `async def template_id(self) -> int:` ### Parameters None ### Request Example ```python # Example usage: template_id = await card_instance.template_id() ``` ### Response #### Success Response - `int`: The template ID of the card. ### Error Handling None explicitly documented. ```