### DPSMeter - Start Source: https://razorenhanced.github.io/doc/api/DPSMeter Starts the DPSMeter engine. ```APIDOC ## POST /DPSMeter/Start ### Description Starts the DPSMeter engine. ### Method POST ### Endpoint /DPSMeter/Start ### Parameters None ### Request Example ```json { "message": "Start DPSMeter" } ``` ### Response #### Success Response (200) - **status** (String) - Indicates the action was successful. #### Response Example ```json { "status": "DPSMeter started" } ``` ``` -------------------------------- ### DPSMeter Start Method Source: https://razorenhanced.github.io/doc/api/DPSMeter Initiates the DPSMeter engine, starting the data recording process. This method is essential for beginning to track damage per second metrics. It returns void. ```Lua __DPSMeter.Start() ``` -------------------------------- ### PacketLogger: Start Logging Source: https://razorenhanced.github.io/doc/api/PacketLogger Starts the RazorEnhanced packet logger, optionally specifying a custom output path and whether to append to existing logs. Returns the path of the saved log file. ```python PacketLogger.Start(outputpath: str = None, appendLogs: bool = False) -> str ``` -------------------------------- ### Packet Logger Start/Stop Source: https://razorenhanced.github.io/doc/api/PacketLogger Methods for starting and stopping the packet logger, with options for output path and append mode. ```APIDOC ## PacketLogger.Start(outputpath, appendLogs) ### Description Start the RazorEnhanced packet logger. ### Method POST ### Endpoint /PacketLogger/Start ### Parameters #### Request Body - **outputpath** (string) - Optional - Custom output path. Default: ./Desktop/Razor_Packets.log. - **appendLogs** (boolean) - Optional - True: Append to the log file - False: Overwrite the log file. Default: False. ### Request Example ```json { "outputpath": "./logs/razor.log", "appendLogs": true } ``` ### Response #### Success Response (200) - **outputPath** (string) - The path to the saved log file. #### Response Example ```json { "outputPath": "./logs/razor.log" } ``` ## PacketLogger.Stop() ### Description Stop the RazorEnhanced packet logger. ### Method POST ### Endpoint /PacketLogger/Stop ### Response #### Success Response (200) - **outputPath** (string) - The path to the saved log file before stopping. #### Response Example ```json { "outputPath": "./logs/razor.log" } ``` ``` -------------------------------- ### BandageHeal Agent Control (RE API) Source: https://razorenhanced.github.io/doc/api/BandageHeal Provides methods to control and monitor the BandageHeal agent. The Start method initiates the agent, Status checks if it's running, and Stop halts its operation. These methods are essential for managing automated healing. ```RE API __BandageHeal.Start() // Start BandageHeal Agent. // Return: Void ``` ```RE API __BandageHeal.Status() // Check BandageHeal Agent status, returns a bool value. // Return: Boolean // True: is running - False: otherwise ``` ```RE API __BandageHeal.Stop() // Stop BandageHeal Agent. // Return: Void ``` -------------------------------- ### PathFinding.walkPath (simplified) Source: https://razorenhanced.github.io/doc/api/PathFinding Initiates a walking path with optional timeout and debug/resync flags. ```APIDOC ## PathFinding.walkPath (simplified) ### Description Initiates a walking path with optional parameters for timeout and control flags. ### Method POST (Assumed, as it initiates an action) ### Endpoint `/PathFinding/walkPath` ### Parameters #### Request Body - **timeout** (single) - Optional - Maximum amount of time to run the path. Defaults to -1 (no limit). - **debugMessage** (boolean) - Optional - Outputs a debug message. Defaults to false. - **useResync** (boolean) - Optional - ReSyncs the path calculation. Defaults to false. ### Request Example ```json { "timeout": 7000, "debugMessage": false, "useResync": false } ``` ### Response #### Success Response (200) - **completed_in_time** (boolean) - True: if it finishes the path in time. False: otherwise. #### Response Example ```json { "completed_in_time": false } ``` ``` -------------------------------- ### Player.EquipUO3D Source: https://razorenhanced.github.io/doc/api/Player Equips a list of items using the UO3D packet. ```APIDOC ## Player.EquipUO3D ### Description Equips a list of items using the UO3D packet. ### Method POST ### Endpoint /player/equipu3d ### Parameters #### Request Body - **serials** (List[Int32]) - Required - A list of serial IDs for the items to equip. ``` -------------------------------- ### Get Shard Name Source: https://razorenhanced.github.io/doc/api/Misc Retrieves the name of the current shard. ```APIDOC ## GET /misc/shardName ### Description Get the name of the shard. ### Method GET ### Endpoint /misc/shardName ### Parameters None ### Request Example None ### Response #### Success Response (200) - **name** (String) - Name of the shard. #### Response Example ```json { "name": "ShardName" } ``` ``` -------------------------------- ### Window Management Source: https://razorenhanced.github.io/doc/api/Misc Provides functions to manage the game client window, including focusing, resizing, and checking its state. ```APIDOC ## Misc.FocusUOWindow ### Description Sets the UOClient window in focus or restores it if minimized. ### Method GET ### Endpoint /Misc/FocusUOWindow ### Parameters None ### Response #### Success Response (200) - **Void**: No return value. ## Misc.GetWindowSize ### Description Gets a Rectangle representing the window size. See also: https://docs.microsoft.com/dotnet/api/system.drawing.rectangle ### Method GET ### Endpoint /Misc/GetWindowSize ### Parameters None ### Response #### Success Response (200) - **Rectangle** (object) - Object with properties: X, Y, Width, Height. ### Response Example ```json { "X": 0, "Y": 0, "Width": 1024, "Height": 768 } ``` ``` -------------------------------- ### Get Shard Name Source: https://razorenhanced.github.io/doc/api/Misc Retrieves the name of the current shard. ```APIDOC ## GET /websites/razorenhanced_github_io_doc_api/Misc.ShardName ### Description Retrieves the name of the current shard. ### Method GET ### Endpoint /websites/razorenhanced_github_io_doc_api/Misc.ShardName ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **ShardName** (String) - The name of the current shard. #### Response Example { "ShardName": "MyShard" } ``` -------------------------------- ### Get Current Script Path Source: https://razorenhanced.github.io/doc/api/Misc Returns the path of the current script. ```APIDOC ## GET /websites/razorenhanced_github_io_doc_api/Misc.ScriptCurrent ### Description Returns the path of the current script. ### Method GET ### Endpoint /websites/razorenhanced_github_io_doc_api/Misc.ScriptCurrent ### Parameters #### Path Parameters None #### Query Parameters * **fullpath** (Boolean) - Optional - True to return the full path, False to return only the filename. Defaults to True. #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Path** (String) - The path of the current script. #### Response Example { "Path": "C:\\Scripts\\MyScript.py" } ``` -------------------------------- ### Player Methods Source: https://razorenhanced.github.io/doc/api/Player This section details the available methods for player actions and information retrieval. ```APIDOC ## Player Methods ### Description Provides methods for interacting with and retrieving information about a player character. ### Methods #### GET /Player/Area ##### Description Gets the name of the area the player is currently in. ##### Method GET ##### Endpoint /Player/Area ##### Parameters None ##### Response ###### Success Response (200) - **areaName** (String) - The name of the player's current area (e.g., "Britain", "Destard"). Returns "Unknown" if not recognized. ###### Response Example ```json { "areaName": "Britain" } ``` #### POST /Player/Attack ##### Description Attacks a specified mobile target. ##### Method POST ##### Endpoint /Player/Attack ##### Parameters ###### Request Body - **serial** (Int32) - Required - The serial number or Mobile object of the target to attack. ##### Request Example ```json { "serial": 1234567 } ``` ##### Response ###### Success Response (200) - **success** (Void) - Indicates the attack action was initiated. #### POST /Player/AttackLast ##### Description Attacks the player's last target. ##### Method POST ##### Endpoint /Player/AttackLast ##### Parameters None ##### Response ###### Success Response (200) - **success** (Void) - Indicates the attack action was initiated. #### POST /Player/AttackType ##### Description Attacks targets based on specified criteria. ##### Method POST ##### Endpoint /Player/AttackType ##### Parameters ###### Request Body - **graphic** (List[Int32]) - Required - A list of graphic IDs to target. - **rangemax** (Int32) - Required - The maximum range for the attack. - **selector** (String) - Required - A selector string for targeting logic. - **color** (List[Int32]) - Required - A list of color values for targeting. - **notoriety** (List[Byte]) - Required - A list of notoriety levels to target. ##### Request Example ```json { "graphic": [1, 2, 3], "rangemax": 10, "selector": "closest", "color": [0, 16#FFFFFF], "notoriety": [1, 2] } ``` ##### Response ###### Success Response (200) - **success** (Boolean) - True if the attack type was successfully executed, false otherwise. ###### Response Example ```json { "success": true } ``` ``` -------------------------------- ### BuyAgent Class Methods Source: https://razorenhanced.github.io/doc/api/BuyAgent This section details the methods available for interacting with the BuyAgent class. ```APIDOC ## BuyAgent Methods ### Description Provides methods to manage BuyAgent functionality. ### Methods #### `BuyAgent.ChangeList(listName)` ##### Description Changes the BuyAgent's active list. ##### Parameters - **listName** (String) - Required - The name of an existing buy list. ##### Return Void #### `BuyAgent.Disable()` ##### Description Disables the BuyAgent. ##### Return Void #### `BuyAgent.Enable()` ##### Description Enables the BuyAgent on the currently active list. ##### Return Void #### `BuyAgent.Status()` ##### Description Checks the BuyAgent's status. ##### Return Boolean - True if the BuyAgent is active, False otherwise. ``` -------------------------------- ### Get Scripts Directory Path Source: https://razorenhanced.github.io/doc/api/Misc Retrieves the full path to the Scripts Directory. ```APIDOC ## GET /websites/razorenhanced_github_io_doc_api/Misc.ScriptDirectory ### Description Retrieves the full path to the Scripts Directory. ### Method GET ### Endpoint /websites/razorenhanced_github_io_doc_api/Misc.ScriptDirectory ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Path** (String) - The full path to the Scripts Directory. #### Response Example { "Path": "C:\\Razor Enhanced\\Scripts" } ``` -------------------------------- ### Use Context Menu Source: https://razorenhanced.github.io/doc/api/Misc Opens and clicks an option in the context menu for a given mobile or item. ```APIDOC ## POST /misc/useContextMenu ### Description Open and click the option of Context menu, given the serial of Mobile or Item, via packets. ### Method POST ### Endpoint /misc/useContextMenu ### Parameters #### Request Body - **serial** (Int32) - Required - Serial of the Item or Mobile. - **choice** (String) - Required - Option as Text or integer. - **delay** (Int32) - Optional - Maximum wait for the action to complete. ### Request Example ```json { "serial": 123456789, "choice": "Attack", "delay": 1000 } ``` ### Response #### Success Response (200) - **success** (Boolean) - True: Option selected successfully - False: otherwise. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### Get Razor Directory Path Source: https://razorenhanced.github.io/doc/api/Misc Retrieves the full path to the main Razor Enhanced folder. ```APIDOC ## GET /websites/razorenhanced_github_io_doc_api/Misc.RazorDirectory ### Description Retrieves the full path to the main Razor Enhanced folder. This path may differ from the Python starting folder when RE is loaded as a plugin. ### Method GET ### Endpoint /websites/razorenhanced_github_io_doc_api/Misc.RazorDirectory ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **Path** (String) - The full path to the Razor Enhanced folder. #### Response Example { "Path": "C:\\Program Files\\Razor Enhanced" } ``` -------------------------------- ### Prompt and Menu Handling Source: https://razorenhanced.github.io/doc/api/Misc Functions to check for and interact with prompts and old-style menus. ```APIDOC ## Misc.HasMenu ### Description Checks if an Old Menu is open. ### Method GET ### Endpoint /Misc/HasMenu ### Parameters None ### Response #### Success Response (200) - **Boolean** (boolean) - True if a menu is open, False otherwise. ### Response Example ```json true ``` ## Misc.HasPrompt ### Description Checks if there is a prompt request. ### Method GET ### Endpoint /Misc/HasPrompt ### Parameters None ### Response #### Success Response (200) - **Boolean** (boolean) - True if there is a prompt, False otherwise. ### Response Example ```json true ``` ## Misc.HasQueryString ### Description Checks if a query string menu is opened, returns true or false. ### Method GET ### Endpoint /Misc/HasQueryString ### Parameters None ### Response #### Success Response (200) - **Boolean** (boolean) - True if a query string menu is open, False otherwise. ### Response Example ```json true ``` ## Misc.MenuContain(text) ### Description Searches in the open Old Menu if it contains a specific text. ### Method GET ### Endpoint /Misc/MenuContain ### Parameters #### Query Parameters - **text** (string) - Required - Text to search. ### Response #### Success Response (200) - **Boolean** (boolean) - True if the text is found, False otherwise. ### Response Example ```json true ``` ## Misc.MenuResponse(text) ### Description Performs a menu response by subitem name. If the item does not exist, the menu is closed. ### Method POST ### Endpoint /Misc/MenuResponse ### Parameters #### Request Body - **text** (string) - Required - Name of the subitem to respond. ### Request Example ```json { "text": "Accept" } ``` ### Response #### Success Response (200) - **Void**: No return value. #### Response Example ```json null ``` ``` -------------------------------- ### Restock Agent Control Source: https://razorenhanced.github.io/doc/api/Restock Methods to control the Restock Agent, including starting, stopping, and checking its status. ```APIDOC ## Restock Agent Control ### Description Methods to start, stop, and check the status of the Restock Agent. ### Methods #### `Restock.FStart()` **Description:** Start the Restock Agent on the currently active list. **Method:** (Not specified, likely a script call) **Parameters:** None **Return:** Void #### `Restock.FStop()` **Description:** Stop the Restock Agent. **Method:** (Not specified, likely a script call) **Parameters:** None **Return:** Void #### `Restock.Status()` **Description:** Check Restock Agent status. **Method:** (Not specified, likely a script call) **Parameters:** None **Return:** Boolean - True: if the Restock is running - False: otherwise ### Request Example ``` # Example of calling Restock.FStart() Restock.FStart() # Example of checking Restock status if Restock.Status() then print("Restock agent is running") else print("Restock agent is not running") end ``` ### Response Example ``` # For Restock.Status(), the return is a boolean True False ``` ``` -------------------------------- ### Player.PathFindTo Source: https://razorenhanced.github.io/doc/api/Player Navigates the player to the specified coordinates using client-provided pathfinding. ```APIDOC ## Player.PathFindTo ### Description Go to the given coordinates using Client-provided pathfinding. ### Method POST (assumed, as it initiates movement) ### Endpoint /Player/PathFindTo ### Parameters #### Request Body - **x** (Int32) - Required - X map coordinate or Point3D. - **y** (Int32) - Required - Y map coordinate. - **z** (Int32) - Required - Z map coordinate. ### Response #### Success Response (200) - **return** (Void) - Indicates the pathfinding request was sent. ``` -------------------------------- ### Player Properties API Source: https://razorenhanced.github.io/doc/api/Player Provides methods to get player properties as a single string line or a list of strings. ```APIDOC ## Player Properties ### Get Prop String By Index #### Description Gets a single line of player properties from the tooltip as text. #### Method GET #### Endpoint /player/properties/string/{index} #### Parameters ##### Path Parameters - **index** (integer) - Required - The line number to retrieve, starting from 0. #### Response ##### Success Response (200) - **String** (string) - The requested line of text from the player's properties. ### Get Prop String List #### Description Gets the list of all player properties from the tooltip as a list of text lines. #### Method GET #### Endpoint /player/properties/list #### Response ##### Success Response (200) - **List[String]** (array of strings) - A list of text lines representing the player's properties. ``` -------------------------------- ### PathFinding.RunPath Source: https://razorenhanced.github.io/doc/api/PathFinding Executes a pre-calculated path with optional timeout, debug messages, and resynchronization. ```APIDOC ## PathFinding.RunPath ### Description Executes a pre-calculated path with optional parameters. ### Method POST (Assumed, as it initiates an action) ### Endpoint `/PathFinding/RunPath` ### Parameters #### Request Body - **path** (List[Tile]) - Required - The list of Tile objects representing the path to execute. - **timeout** (single) - Optional - Maximum amount of time to run the path. Defaults to -1 (no limit). - **debugMessage** (boolean) - Optional - Outputs a debug message during path execution. - **useResync** (boolean) - Optional - ReSyncs the path calculation during execution. ### Request Example ```json { "path": [ { "X": 10, "Y": 20 }, { "X": 11, "Y": 21 } ], "timeout": 5000, "debugMessage": true, "useResync": false } ``` ### Response #### Success Response (200) - **completed** (boolean) - True if the path finished within the timeout, False otherwise. #### Response Example ```json { "completed": true } ``` ``` -------------------------------- ### Get Item Associated with a Mobile Layer Source: https://razorenhanced.github.io/doc/api/Player Retrieves the Item associated with a specified Mobile Layer. Returns null if the layer is invalid or not found. ```APIDOC ## GET /player/layer/item ### Description Returns the Item associated with a Mobile Layer. ### Method GET ### Endpoint /player/layer/item ### Parameters #### Query Parameters - **layerString** (string) - Required - Specifies the layer for which to retrieve the item. Accepted values: RightHand, LeftHand, Shoes, Pants, Shirt, Head, Gloves, Ring, Neck, Hair, Waist, InnerTorso, Bracelet, FacialHair, MiddleTorso, Earrings, Arms, Cloak, OuterTorso, OuterLegs, InnerLegs, Talisman. ### Response #### Success Response (200) - **Item** (object) - The item associated with the specified layer, or null if not found or the layer is invalid. ``` -------------------------------- ### CUO - Client View and Settings Source: https://razorenhanced.github.io/doc/api/CUO Manage client view modes and retrieve specific ClassicUO client settings. ```APIDOC ## CUO.FreeView ### Description Invokes the FreeView function inside the CUO code to enable or disable free camera movement. ### Method POST ### Endpoint /CUO/FreeView ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **free** (Boolean) - Required - Set to true to enable free view, false to disable. ### Request Example ```json { "free": true } ``` ### Response #### Success Response (200) - **Success** (Boolean) - Indicates if the free view setting was applied. #### Response Example ```json { "Success": true } ``` ## CUO.GetSetting ### Description Retrieves the current value of a specific ClassicUO client setting. ### Method GET ### Endpoint /CUO/GetSetting ### Parameters #### Path Parameters None #### Query Parameters - **settingName** (String) - Required - The name of the setting to retrieve. ### Request Example (No request body, use query parameter) ### Response #### Success Response (200) - **settingValue** (String) - The current value of the requested setting. #### Response Example ```json { "settingValue": "Enabled" } ``` ``` -------------------------------- ### Timer Get Remaining Time Source: https://razorenhanced.github.io/doc/api/Timer Retrieves the amount of time, in milliseconds, remaining for a specific timer. It requires the timer's name as a parameter and returns an integer representing the remaining milliseconds. ```javascript Timer.Remaining(name) ``` -------------------------------- ### PathFinding.WalkPath Source: https://razorenhanced.github.io/doc/api/PathFinding Similar to RunPath, but specifically for walking along a path with optional parameters. ```APIDOC ## PathFinding.WalkPath ### Description Executes a pre-calculated path for walking with optional parameters. ### Method POST (Assumed, as it initiates an action) ### Endpoint `/PathFinding/WalkPath` ### Parameters #### Request Body - **path** (List[Tile]) - Required - The list of Tile objects representing the path to walk. - **timeout** (single) - Optional - Maximum amount of time to walk the path. Defaults to -1 (no limit). - **debugMessage** (boolean) - Optional - Outputs a debug message during path execution. - **useResync** (boolean) - Optional - ReSyncs the path calculation during execution. ### Request Example ```json { "path": [ { "X": 10, "Y": 20 }, { "X": 11, "Y": 21 } ], "timeout": 3000, "debugMessage": false, "useResync": true } ``` ### Response #### Success Response (200) - **completed** (boolean) - True if the walk path finished within the timeout, False otherwise. #### Response Example ```json { "completed": false } ``` ``` -------------------------------- ### PacketLogger: Add Custom Packet Template Source: https://razorenhanced.github.io/doc/api/PacketLogger Adds a custom template for the RazorEnhanced packet logger to define how specific packets are parsed and displayed. This allows for detailed inspection of custom packet structures. Example provided for 'Damage' packet (0x0B). ```python PacketLogger.AddTemplate(packetTemplate: dict) ``` -------------------------------- ### PathFinding.runPath (simplified) Source: https://razorenhanced.github.io/doc/api/PathFinding Executes a pathfinding operation with optional timeout and debug/resync flags. ```APIDOC ## PathFinding.runPath (simplified) ### Description Initiates pathfinding with optional parameters for timeout and control flags. ### Method POST (Assumed, as it initiates an action) ### Endpoint `/PathFinding/runPath` ### Parameters #### Request Body - **timeout** (single) - Optional - Maximum amount of time to run the path. Defaults to -1 (no limit). - **debugMessage** (boolean) - Optional - Outputs a debug message. Defaults to false. - **useResync** (boolean) - Optional - ReSyncs the path calculation. Defaults to false. ### Request Example ```json { "timeout": 10000, "debugMessage": true, "useResync": true } ``` ### Response #### Success Response (200) - **finished_in_time** (boolean) - True: if it finishes the path in time. False: otherwise. #### Response Example ```json { "finished_in_time": true } ``` ``` -------------------------------- ### Item Methods Source: https://razorenhanced.github.io/doc/api/Item Documentation for the methods available on the Item class. ```APIDOC ## Item.Equals ### Description Checks if this instance is semantically equal to another object. ### Method `Equals` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **obj** (Object) - Required - The object to compare with the current instance. ### Request Example ```json { "obj": "some_object" } ``` ### Response #### Success Response (200) * **Return** (Boolean) - True if the specified object is semantically equal to the current instance; otherwise, false. #### Response Example ```json { "Return": true } ``` ## Item.GetHashCode ### Description Returns the hash code for this instance. ### Method `GetHashCode` ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) * **Return** (Int32) - A hash code for the current instance, suitable for use in hashing algorithms and data structures such as a hash table. #### Response Example ```json { "Return": 12345 } ``` ## Item.GetWorldPosition ### Description Retrieves the world position of the item. ### Method `GetWorldPosition` ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) * **Return** (Point3D) - The world position of the item. #### Response Example ```json { "Return": { "x": 10.5, "y": 20.0, "z": 5.2 } } ``` ## Item.IsChildOf ### Description Checks if an Item is contained in a container. Can be a Item or a Mobile (wear by). ### Method `IsChildOf` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **container** (Mobile | Item) - Required - The container to check. * **maxDepth** (Int32) - Required - The maximum depth to search within the container. ### Request Example ```json { "container": "some_container_id", "maxDepth": 5 } ``` ### Response #### Success Response (200) * **Return** (Boolean) - True: if is contained - False: otherwise. #### Response Example ```json { "Return": true } ``` ## Item.ToString ### Description Returns a string that represents the current object. ### Method `ToString` ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) * **Return** (String) - A string that represents the current object. #### Response Example ```json { "Return": "Item Name" } ``` ``` -------------------------------- ### Perform File Operations: Append, Remove, Delete, Get Paths Source: https://context7.com/context7/razorenhanced_github_io_doc_api/llms.txt Handles file operations including appending data, appending unique lines, removing specific lines, deleting files, and retrieving script, data, and Razor directories. ```python # Append data to log file log_entry = "Resource collected at {}".format(Player.Position) Misc.AppendToFile("harvest_log.txt", log_entry) # Append only if line doesn't exist (no duplicates) unique_entry = "Serial: {}".format(Player.Serial) Misc.AppendNotDupToFile("player_data.txt", unique_entry) # Remove specific line from file Misc.RemoveLineInFile("harvest_log.txt", "Old entry to remove") # Delete file Misc.DeleteFile("old_log.txt") # Get directory paths script_dir = Misc.ScriptDirectory() data_dir = Misc.DataDirectory() razor_dir = Misc.RazorDirectory() Misc.SendMessage("Scripts in: {}".format(script_dir)) ``` -------------------------------- ### Player Actions API Source: https://razorenhanced.github.io/doc/api/Player Provides methods for player-initiated actions within the game. ```APIDOC ## Player Actions ### Guild Button #### Description Presses the Guild menu button in the paperdoll. #### Method POST #### Endpoint /player/actions/guild-button #### Response ##### Success Response (200) - **Void** (void) - Indicates the action was performed. ``` ```APIDOC ## Player Actions ### Head Message #### Description Displays a message above the player's head, visible only to the player. #### Method POST #### Endpoint /player/actions/head-message #### Parameters ##### Request Body - **color** (integer) - Required - The color of the text. - **msg** (string) - Required - The text message to display. #### Response ##### Success Response (200) - **Void** (void) - Indicates the message was displayed. ``` ```APIDOC ## Player Actions ### In Range #### Description Checks if a mobile or item is within a specified range. #### Method GET #### Endpoint /player/actions/in-range #### Parameters ##### Query Parameters - **entity** (integer) - Required - The entity (mobile or item serial) to check. - **range** (integer) - Required - The maximum distance in tiles. #### Response ##### Success Response (200) - **Boolean** (boolean) - True if the entity is within range, False otherwise. ``` ```APIDOC ## Player Actions ### In Range Item #### Description Checks if a specific item is within a specified range. #### Method GET #### Endpoint /player/actions/in-range-item #### Parameters ##### Query Parameters - **item** (integer) - Required - The item to check. - **range** (integer) - Required - The maximum distance in tiles. #### Response ##### Success Response (200) - **Boolean** (boolean) - True if the item is within range, False otherwise. ``` -------------------------------- ### Control Script Execution: Run, Check Status, Stop, Suspend Source: https://context7.com/context7/razorenhanced_github_io_doc_api/llms.txt Manages the execution of other scripts, allowing you to run, check if a script is active, stop specific scripts, suspend and resume them, stop all other scripts, and get the current script's name or full path. ```python # Run another script Misc.ScriptRun('mining_helper.py') # Check if script is running if Misc.ScriptStatus('combat_helper.py'): Misc.SendMessage("Combat helper is active") # Stop a specific script Misc.ScriptStop('old_script.py') # Suspend and resume scripts Misc.ScriptSuspend('background_task.py') Misc.Pause(5000) Misc.ScriptResume('background_task.py') # Stop all scripts except current Misc.ScriptStopAll(True) # Get current script name current = Misc.ScriptCurrent(False) # Just filename full_path = Misc.ScriptCurrent(True) # Full path Misc.SendMessage("Running: {}".format(current)) ``` -------------------------------- ### Cast Other Spell Schools with Razor API Source: https://context7.com/context7/razorenhanced_github_io_doc_api/llms.txt Demonstrates casting spells from various schools beyond Magery, including Necromancy, Chivalry, Bushido, Ninjitsu, Spellweaving, and Mysticism using the Razor API. Examples show casting specific spells and abilities from these schools, with and without targeting. ```python # Cast necromancy spell Spells.CastNecro('Vampiric Embrace') Misc.Pause(1500) # Cast chivalry spell with target Spells.CastChivalry('Noble Sacrifice', Player.Serial) # Cast bushido ability Spells.CastBushido('Confidence') ``` -------------------------------- ### Player.OpenPaperDoll Source: https://razorenhanced.github.io/doc/api/Player Opens the player's paperdoll interface. ```APIDOC ## Player.OpenPaperDoll ### Description Open Player's Paperdoll. ### Method POST (assumed, as it triggers an action) ### Endpoint /Player/OpenPaperDoll ### Parameters None ### Response #### Success Response (200) - **return** (Void) - Indicates the paperdoll was opened. ``` -------------------------------- ### Player.PartyAccept Source: https://razorenhanced.github.io/doc/api/Player Accepts an incoming party offer. Can specify a specific offer if multiple are pending and optionally force acceptance if already in a party. ```APIDOC ## Player.PartyAccept ### Description Accept an incoming party offer. In case of multiple party pending invitations, from_serial is specified. ### Method POST (assumed, as it modifies party state) ### Endpoint /Player/PartyAccept ### Parameters #### Request Body - **from_serial** (Int32) - Optional - Serial to accept party from (in case of multiple offers). - **force** (Boolean) - Optional - True: Accept the party invite even you are already in a party. ### Response #### Success Response (200) - **return** (Boolean) - True: if you are now in a party - False: otherwise. ``` -------------------------------- ### Cast Magery Spells with Razor API Source: https://context7.com/context7/razorenhanced_github_io_doc_api/llms.txt Illustrates how to cast spells from the Magery school using the Razor API, including options for automatic or manual targeting. Examples cover casting spells on enemies, self-buffing, area-of-effect spells, healing allies, and repeating the last cast spell. ```python # Cast spell with automatic targeting enemy = Mobiles.FindBySerial(0x00012345) if enemy: Spells.CastMagery('Lightning', enemy.Serial) Misc.Pause(2000) # Cast buff spell on self if not Player.BuffsExist('Magic Reflection', True): Spells.CastMagery('Magic Reflection') Misc.Pause(1500) # Cast spell with manual targeting Spells.CastMagery('Paralyze Field') Target.WaitForTarget(5000) Target.TargetExecute(1500, 1750, 0, 0) # Cast healing spell on friend friend_serial = 0x00054321 Spells.CastMagery('Greater Heal', friend_serial, True) # Repeat last spell Spells.CastLastSpell() ``` -------------------------------- ### Find and Target Mobiles with Razor API Source: https://context7.com/context7/razorenhanced_github_io_doc_api/llms.txt Provides examples of locating and targeting various mobile entities (NPCs, monsters, players) using the Razor API. It covers finding mobiles by serial number, searching for the nearest hostile mobile based on notoriety, and waiting for mobile properties to load. ```python # Find mobile by serial target_mob = Mobiles.FindBySerial(0x00012345) if target_mob: Player.Attack(target_mob.Serial) # Find nearest hostile mobile mob_filter = Mobiles.Filter() mob_filter.Enabled = True mob_filter.RangeMax = 10 mob_filter.Notorieties = [3, 4, 5, 6] # Gray, criminal, orange, red mob_filter.CheckIgnoreObject = False hostiles = Mobiles.ApplyFilter(mob_filter) if len(hostiles) > 0: nearest = Mobiles.Select(hostiles, 'Nearest') Misc.SendMessage("Attacking: {}".format(nearest.Name), 33) Player.Attack(nearest.Serial) # Wait for mobile properties to load Mobiles.WaitForProps(target_mob, 1000) mob_name = target_mob.Name mob_hits = target_mob.Hits ``` -------------------------------- ### Target API Endpoints Source: https://razorenhanced.github.io/doc/api/Target This section details the various methods available within the Target class for interacting with in-game targeting. ```APIDOC ## Target Class Methods ### Description The Target class provides various methods for targeting Land, Items, and Mobiles in the game. ### Target.AttackTargetFromList #### Description Attack Target from GUI filter selector, in Targetting tab. #### Method `__Target.AttackTargetFromList(target_name)` #### Parameters - **target_name** (String) - Required - The name of the target filter. #### Return Void ### Target.Cancel #### Description Cancel the current target. #### Method `__Target.Cancel()` #### Return Void ### Target.ClearLast #### Description Clear the last target. #### Method `__Target.ClearLast()` #### Return Void ### Target.ClearLastAttack #### Description Clear the last attacked target. #### Method `__Target.ClearLastAttack()` #### Return Void ### Target.ClearLastandQueue #### Description Clear last target and target queue. #### Method `__Target.ClearLastandQueue()` #### Return Void ### Target.ClearQueue #### Description Clear Queue Target. #### Method `__Target.ClearQueue()` #### Return Void ### Target.GetLast #### Description Get serial number of last target. #### Method `__Target.GetLast()` #### Return Int32 - Serial as number. ### Target.GetLastAttack #### Description Get serial number of last attack target. #### Method `__Target.GetLastAttack()` #### Return Int32 - Serial as number. ### Target.GetTargetFromList #### Description Get Mobile object from GUI filter selector, in Targetting tab. #### Method `__Target.GetTargetFromList(target_name)` #### Parameters - **target_name** (String) - Required - Name of the target filter. #### Return Mobile - Mobile object matching. None: not found ### Target.HasTarget #### Description Get the status of the in-game target cursor. Optionally specify the target flag and check if the cursor is "Beneficial", "Harmful", or "Neutral". #### Method `__Target.HasTarget(targetFlag)` #### Parameters - **targetFlag** (String) - Required - The target flag to check for can be "Any", "Beneficial", "Harmful", or "Neutral". #### Return Boolean - True if the client has a target cursor and the optional flag matches; otherwise, false. ### Target.Last #### Description Execute the target on the last Item or Mobile targeted. #### Method `__Target.Last()` #### Return Void ### Target.LastQueued #### Description Enqueue the next target on the last Item or Mobile targeted. #### Method `__Target.LastQueued()` #### Return Void ### Target.LastUsedObject #### Description Returns the serial of last object used by the player. #### Method `__Target.LastUsedObject()` #### Return Int32 ### Target.PerformTargetFromList #### Description Execute Target from GUI filter selector, in Targetting tab. #### Method `__Target.PerformTargetFromList(target_name)` #### Parameters - **target_name** (String) - Required - Name of the target filter. #### Return Void ### Target.PromptGroundTarget #### Description Prompt a target in-game, wait for the Player to select the ground. Can also specific a text message for prompt. #### Method `__Target.PromptGroundTarget(message, color)` #### Parameters - **message** (String) - Required - Hint on what to select. - **color** (Int32) - Optional - Color of the message. (default: 945, gray) #### Return Point3D - A Point3D object, containing the X,Y,Z coordinate ### Target.PromptTarget #### Description Prompt a target in-game, wait for the Player to select an Item or a Mobile. Can also specific a text message for prompt. #### Method `__Target.PromptTarget(message, color)` #### Parameters - **message** (String) - Required - Hint on what to select. - **color** (Int32) - Optional - Color of the message. (default: 945, gray) #### Return Int32 - Serial of the selected object. ### Target.Self #### Description Execute the target on the Player. #### Method `__Target.Self()` #### Return Void ### Target.SelfQueued #### Description Enqueue the next target on the Player. #### Method `__Target.SelfQueued()` #### Return Void ### Target.SetLast #### Description Set the last target to specific mobile, using the serial. #### Method `__Target.SetLast(serial, wait)` #### Parameters - **serial** (Int32) - Required - Serial of the Mobile. - **wait** (Boolean) - Required - Wait confirmation from the server. #### Return Void ### Target.SetLastTargetFromList #### Description Set Last Target from GUI filter selector, in Targetting tab. #### Method `__Target.SetLastTargetFromList(target_name)` #### Parameters - **target_name** (String) - Required - Name of the target filter. #### Return Void ### Target.TargetExecute #### Description Execute target on specific serial, item, mobile, X Y Z point. Targets the Mobil or Item specified. #### Method `__Target.TargetExecute(x, y, z, StaticID)` #### Parameters - **x** (Int32) - Required - Serial of the Target X coordinate. object can be a Mobil or an Item. - **y** (Int32) - Required - Y coordinate. - **z** (Int32) - Required - Z coordinate. - **StaticID** (Int32) - Required - ID of Land/Tile #### Return Void ### Target.TargetExecuteRelative #### Description Execute target on specific land point with offset distance from Mobile. Distance is calculated by target Mobile.Direction. #### Method `__Target.TargetExecuteRelative(mobile, offset)` #### Parameters - **mobile** (Int32 Mobile) - Required - Serial of the mobile. - **offset** (Int32) - Required - Distance from the target. +- distance to offset from the mobile identified with serial #### Return Void ``` -------------------------------- ### Sound API Source: https://razorenhanced.github.io/doc/api/Sound This section details the methods available in the Sound API for managing sound events. ```APIDOC ## Sound API Endpoints ### Add Filter Adds a filter for incoming sound requests. ### Method `Sound.AddFilter(name, sounds)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **name** (String) - The name of the filter. - **sounds** (List[Int32]) - A list of sound IDs to filter. ### Request Example ```json { "name": "MySoundFilter", "sounds": [1001, 1002, 1005] } ``` ### Response #### Success Response (Void) This method does not return any value. ### Remove Filter Removes a previously added filter for incoming sound requests. ### Method `Sound.RemoveFilter(name)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **name** (String) - The name of the filter to be removed. ### Request Example ```json { "name": "MySoundFilter" } ``` ### Response #### Success Response (Void) This method does not return any value. ### Log Sound Events Enables or disables logging of incoming sound requests. ### Method `Sound.Log(activateLogging)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **activateLogging** (Boolean) - `True` to activate sound logging, `False` to deactivate. ### Request Example ```json { "activateLogging": true } ``` ### Response #### Success Response (Void) This method does not return any value. ### Wait For Sound Waits for a specified list of sounds to occur within a given timeout. ### Method `Sound.WaitForSound(sounds, timeout)` ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - **sounds** (List[Int32]) - A list of sound IDs to wait for. - **timeout** (Int32) - The maximum time in seconds to wait for the sounds. ### Request Example ```json { "sounds": [2001, 2003], "timeout": 10 } ``` ### Response #### Success Response (200) - **Success** (Boolean) - `True` if any of the specified sounds were heard within the timeout, `False` otherwise. #### Response Example ```json { "Success": true } ``` ```