### Example Usage Source: https://docs.legendsen.se/developers/sdk-documentation/objectmanager An example demonstrating how to iterate through enemy heroes and cast a spell on the first immobile target. ```APIDOC ## Example: Find first immobile enemy and cast Q This example demonstrates iterating through `ObjectManager.enemyHeroes` to find an immobile enemy target and cast a spell (`Q`) on it. ### Code Snippet ```lua for _, entity in ObjectManager.enemyHeroes:pairs() do if entity:IsValidTarget(Q.range) and not Champions.CanMove(entity, 0.1) and Q:Cast(entity, menu.Q.hitChanceQ) then return end end ``` ### Explanation 1. The code iterates through each `entity` in the `ObjectManager.enemyHeroes` list. 2. `entity:IsValidTarget(Q.range)` checks if the entity is a valid target within the range of spell `Q`. 3. `not Champions.CanMove(entity, 0.1)` checks if the entity is immobile (or cannot move within 0.1 seconds). 4. `Q:Cast(entity, menu.Q.hitChanceQ)` attempts to cast spell `Q` on the entity with a specified hit chance. 5. If all conditions are met and the spell is cast successfully, the function returns, stopping further iteration. ``` -------------------------------- ### Basic ImGui UI Example Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-imgui Demonstrates the creation of a simple ImGui window with various UI elements such as text, colored text, buttons, checkboxes, and a progress bar. This example is suitable for debugging and development tools. ```lua local mainWindowOpen = true local myCheckBox = true Callback.Bind(CallbackType.OnImguiDraw, function() ImGui.SetNextWindowSize(500, 500) mainWindowOpen = ImGui.Begin("My Window", mainWindowOpen, ImGuiWindowFlags.NoResize) ImGui.Text("Well hello there, General Kenobi") ImGui.TextColored(1, 1, 0, 1, "Well hello there, General Kenobi") ImGui.TextDisabled("List:") ImGui.BulletText("One") ImGui.BulletText("Two") ImGui.Text("Buttons:") ImGui.Button("50x50", 50, 50) ImGui.SameLine() ImGui.SmallButton("Small Button") myCheckBox = ImGui.Checkbox("My Checkbox", myCheckBox) ImGui.Text("Progress bar:") ImGui.ProgressBar(0.4, 400, 25, "40%") ImGui.End() end) ``` -------------------------------- ### Clipper64 Full Example: Union Operation Source: https://docs.legendsen.se/developers/sdk-documentation/library/clipper/clipper64 A comprehensive example demonstrating the usage of the Clipper64 class to perform a union operation. It includes creating paths, adding them as subjects, executing the union, and drawing the resulting paths. ```lua local Clipper64 = Clipper.Clipper64.new() Callback.Bind(CallbackType.OnDraw, function() Clipper64:Clear() local pos = Game.localPlayer.position2D -- Define subject path 1 local path1 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y + 300), Math.Vector2(pos.x - 300, pos.y + 300), }) -- Define subject path 2 local path2 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y + 200), Math.Vector2(pos.x - 200 + 300, pos.y + 200), }) Clipper64:AddSubject(path1) Clipper64:AddSubject(path2) local union = Clipper.CreatePaths64({}) -- Output for the union result Clipper64:Execute(Clipper.ClipType.Union, Clipper.FillRule.NonZero, union) -- Determine color based on cursor position relative to the union polygon local color = Clipper.PointInPolygons(Game.GetCursorWorldPosition(), union) and 0xFF00FF00 or 0xFFFF0000 -- Draw the resulting union path Renderer.DrawPaths(union, 1, color) end) ``` -------------------------------- ### Accessing fValue Example Source: https://docs.legendsen.se/developers/sdk-documentation/class/spellbookentry An example demonstrating how to access and print specific fValue entries from a spell's tooltip, like Ignite. ```APIDOC ## Example: Accessing fValue This example shows how to access the `fValue` array for a spell, such as Ignite, to retrieve specific tooltip values. ### Steps 1. **Specify the Spell Slot**: Determine the `SpellSlot` for the desired spell (e.g., `SpellSlot.F` for Ignite). 2. **Print Tooltip (Optional)**: Use `PrintTooltip(false)` to inspect the tooltip and identify the index of the desired `fValue`. 3. **Access fValue**: Access the specific `fValue` using its index (1-based). ### Code Example ```lua local slot = SpellSlot.F -- Optional: Print tooltip to identify the correct fValue index -- Game.localPlayer:GetSpellEntry(slot):PrintTooltip(false) -- Access the 1st fValue (index starts from 1) -- If Ignite is in the F slot, this will print its damage value print(Game.localPlayer:GetSpellEntry(slot).fValue[1]) ``` ``` -------------------------------- ### PointInPolygons Example Usage Source: https://docs.legendsen.se/developers/sdk-documentation/library/clipper/clipper-api Example demonstrating how to use Clipper.PointInPolygons with a 2D vector representing the cursor's world position. ```Lua local isInside = Clipper.PointInPolygons(Game.GetCursorWorldPosition():To2D(), polygonPaths) ``` -------------------------------- ### Example Usage: Drawing a Glowing Circle Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/colorinfo This example demonstrates how to use the deprecated `Renderer.ColorInfo` struct to create a glowing circle effect around a selected target. ```APIDOC ## Example: Drawing a Glowing Circle ### Description This example showcases how to create a custom glowing circle effect around a selected game target using the `Renderer.ColorInfo` struct and `Renderer.DrawEffectCircle` function. Note that `ColorInfo` is deprecated. ### Method `Callback.Bind(CallbackType.OnDraw, function() ... end)` `Renderer.DrawEffectCircle(...)` ### Endpoint N/A (This is a client-side script example) ### Parameters N/A (Directly uses game API functions) ### Request Example ```lua local MyGlowingCircleHash = Game.fnvhash("Example_MyGlowingCircle") -- This must be unique hash per drawing. Use unique prefix. local color = Renderer.ColorInfo.new(0xFFFFFFFF, 0xFF5555FF, Renderer.GradientType.Linear) -- Deprecated constructor local radius = 100 Callback.Bind(CallbackType.OnDraw, function() local tar = Game.GetSelectedTarget() if tar and tar:IsValid() then Renderer.DrawEffectCircle(MyGlowingCircleHash, tar.position2D, radius, color, Renderer.EffectType.MagicalCircle) end end) ``` ### Response #### Success Response (200) N/A - This is a visual effect, not a data response. #### Response Example N/A ``` -------------------------------- ### Clipper Union Example in Lua Source: https://docs.legendsen.se/developers/sdk-documentation/library/clipper/clipper-api Example demonstrating the Clipper.Union function in Lua. It creates two paths and calculates their union, then draws the result with different colors based on cursor position. ```lua Callback.Bind(CallbackType.OnDraw, function() local pos = Game.localPlayer.position2D local path1 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y + 300), Math.Vector2(pos.x - 300, pos.y + 300), }) local path2 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y + 200), Math.Vector2(pos.x - 200 + 300, pos.y + 200), }) local union = Clipper.Union(Clipper.CreatePaths64({path1}), Clipper.CreatePaths64({path2}), Clipper.FillRule.NonZero) Renderer.DrawPaths(union, 1, Clipper.PointInPolygons(Game.GetCursorWorldPosition(), union) and 0xFF00FF00 or 0xFFFF0000) end) ``` -------------------------------- ### Create and Configure SDKSpell Instances in Lua Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/champions Demonstrates how to create SDKSpell instances for different abilities (Q, W, E, R) and configure their skillshot properties like range, speed, collision, and hit chance. It's crucial to call Champions.Clean() OnUnload to manage these instances effectively. The example highlights the use of math.flt_max for spell speed. ```lua -- Creating SDKSpell instances: -- IMPORTANT: Make sure to call Champions.Clean() OnUnload to clear these instances! Champions.Q = SDKSpell.Create(SpellSlot.Q, 1400, DamageType.Magical) Champions.W = SDKSpell.Create(SpellSlot.W, 100, DamageType.Magical) Champions.E = SDKSpell.Create(SpellSlot.E, 1200, DamageType.Magical) Champions.R = SDKSpell.Create (SpellSlot.R, 5500, DamageType.Magical) -- Set skillshot: Champions.Q:SetSkillshot(0.25, 60, 1000, SkillshotType.SkillshotLine, true, CollisionFlag.CollidesWithYasuoWall, HitChance.High, true) Champions.R:SetSkillshot(1, 65, math.flt_max, SkillshotType.SkillshotCircle, false, CollisionFlag.CollidesWithNothing, HitChance.High, true) -- Please note how we use math.flt_max for speed instead of math.huge, this is important Callback.Bind(CallbackType.OnUnload, function() Champions.Clean() -- Clean up return CallbackResult.Dispose end) ``` -------------------------------- ### Example: DrawPaths with Clipper Union and Conditional Coloring Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-dev This example demonstrates how to use Renderer.DrawPaths in conjunction with Clipper.Union and Clipper.PointInPolygons. It creates two paths, calculates their union, and then draws the resulting paths. The color of the drawn paths changes based on whether the cursor is within the union area. ```lua Callback.Bind(CallbackType.OnDraw, function() local pos = Game.localPlayer.position2D local path1 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y + 300), Math.Vector2(pos.x - 300, pos.y + 300), }) local path2 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y + 200), Math.Vector2(pos.x - 200 + 300, pos.y + 200), }) local union = Clipper.Union(Clipper.CreatePaths64({path1}), Clipper.CreatePaths64({path2}), Clipper.FillRule.NonZero) Renderer.DrawPaths(union, 1, Clipper.PointInPolygons(Game.GetCursorWorldPosition(), union) and 0xFF00FF00 or 0xFFFF0000) end) ``` -------------------------------- ### Queue Implementation and Basic Usage (Lua) Source: https://docs.legendsen.se/developers/sdk-documentation/library/common/queue Demonstrates the basic instantiation and usage of the Common.Queue class, including pushing elements to the left and right, and iterating through the queue. This example highlights how to initialize a queue with existing values and manipulate it. ```lua local q = Queue({1, 2, 3}) q:PushLeft(1) q:PushRight(2) q:PushLeft(0) for i=1, #q do print(q[i]) end local q = Queue() q:PushRight(function() print("Action 1") end) q:PushRight(function() print("Action 2") q:PushLeft(function() print("Top Priority Action!") end) end) q:PushRight(function() print("Action 3") end) while #q > 0 do q:PopLeft()() end ``` -------------------------------- ### Renderer.DrawPaths Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-dev Draws Clipper Paths64 polygons. Includes an example demonstrating usage with Clipper.Union and Clipper.PointInPolygons. ```APIDOC ## Renderer.DrawPaths ### Description Draw Clipper `Paths64` polygons. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```lua Callback.Bind(CallbackType.OnDraw, function() local pos = Game.localPlayer.position2D local path1 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y - 300), Math.Vector2(pos.x + 300, pos.y + 300), Math.Vector2(pos.x - 300, pos.y + 300), }) local path2 = Clipper.CreatePath64FromVectors({ Math.Vector2(pos.x - 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y - 200), Math.Vector2(pos.x + 200 + 300, pos.y + 200), Math.Vector2(pos.x - 200 + 300, pos.y + 200), }) local union = Clipper.Union(Clipper.CreatePaths64({path1}), Clipper.CreatePaths64({path2}), Clipper.FillRule.NonZero) Renderer.DrawPaths(union, 1, Clipper.PointInPolygons(Game.GetCursorWorldPosition(), union) and 0xFF00FF00 or 0xFFFF0000) end) ``` ### Response #### Success Response (200) N/A #### Response Example N/A ### Function Signature `Renderer.DrawPaths(paths: Paths64, width: number, color: number) → void` ### Arguments - **paths** (Paths64) - The paths to draw. - **width** (number - float) - Line width. - **color** (number - D3DCOLOR) - Line color. ``` -------------------------------- ### Start Spell Charging Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/sdkspell Initiates the charging sequence for a spell at a given position, with an option for packet usage. Returns a boolean indicating if charging was successful. ```Lua SDKSpell:StartCharging( pos: Vector3, usePacket: boolean ) -> boolean ``` -------------------------------- ### Buff Class Properties and Functions Source: https://docs.legendsen.se/developers/sdk-documentation/class/buff This section describes the properties and functions available for the Buff class. Properties include validity status, start and expiration times, and owner/source information. Functions include GetName to retrieve the buff's name. ```APIDOC ## Buff Class ### Description Represents a buff with various properties and associated functions. ### Properties #### `isValid` (boolean) Indicates if the buff is currently valid. #### `startTime` (number) The timestamp when the buff started. #### `expireTime` (number) The timestamp when the buff expires. #### `leftTime` (number) The remaining time for the buff in seconds. #### `short` (integer) An integer representing a short identifier for the buff type. #### `int` (integer) An integer representing a detailed identifier for the buff type. #### `type` (BuffType) The type of the buff. #### `owner` (AIBaseClient) The client that owns this buff. #### `source` (AIBaseClient) The client that provided this buff. #### `hash` (integer) A hash value for the buff. ### Functions #### GetName ##### Description Returns the name of the buff. ##### Method `Buff:GetName()` ##### Returns - string: The name of the buff. ``` -------------------------------- ### Cursor and Pathfinding Utilities Source: https://docs.legendsen.se/developers/sdk-documentation/game Get the world position of the cursor, create special path obstacles, and calculate paths between two points using 2D or 3D vectors. Paths can be smoothed. ```lua local cursorWorldPos = Game.GetCursorWorldPosition() local obstaclePos = Vector2.new(50, 50) local obstacleRadius = 10 local obstacle = Game.SpecialPathObstacle(obstaclePos, obstacleRadius) local start2D = Vector2.new(0, 0) local end2D = Vector2.new(100, 100) local path2D = Game.CreatePath(start2D, end2D, true) local start3D = Vector3.new(0, 0, 0) local end3D = Vector3.new(100, 100, 50) local path3D = Game.CreatePath(start3D, end3D, true) local endPosOnly2D = Vector2.new(200, 200) local pathFromPlayer = Game.CreatePath(endPosOnly2D, true) ``` -------------------------------- ### Spell Data Retrieval and Usage Source: https://docs.legendsen.se/developers/sdk-documentation/game Get spell data using its hash. It also shows an example of retrieving a spell's calculated info, such as base gold, using its hash and level. ```lua local WSpell = Game.GetSpellByHash(Game.spelldataHash("PickACard")) -- You can get spelldata by hash if WSpell then local success, value = WSpell:GetCalculateInfo(Game.fnvhash("GoldBase"), WSpell.level) print(value) end ``` -------------------------------- ### Get Pet Handle by Index - Lua Example Source: https://docs.legendsen.se/developers/sdk-documentation/class/aibaseclient Retrieves and validates a pet handle by its index, then resolves it to an AIBaseClient object. This function is useful for iterating through an entity's pets and accessing their properties. It requires the Game, ObjectManager, and AIBaseClient objects to be available. ```lua local petHandleSize = Game.localPlayer:GetPetHandleSize() if petHandleSize > 0 then for i=0, petHandleSize-1 do local petHandle = Game.localPlayer:GetPetHandleByIndex(i) local pet = petHandle and ObjectManager.ResolveHandle(petHandle) if pet and pet:IsValid() then print(pet:GetUniqueName()) end end end ``` -------------------------------- ### Draw 2D Poly Line with Renderer Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-imgui Draws a 2D polyline connecting a series of points. It takes an array of Vector2 points, the number of points, color, ImGui flags, and line thickness. A basic example demonstrates its usage within an ImGui draw callback. ```lua Callback.Bind(CallbackType.OnImguiDraw, function() Renderer.DrawPolyline({ Math.Vector2(300, 300), Math.Vector2(350, 350), Math.Vector2(400, 320), Math.Vector2(450, 370), Math.Vector2(500, 360), Math.Vector2(550, 300), Math.Vector2(600, 330), Math.Vector2(650, 280), Math.Vector2(700, 240), Math.Vector2(750, 320), Math.Vector2(800, 300), }, 11, 0xFFFF0000, Renderer.ImDrawFlags.None, 15.0) end) ``` -------------------------------- ### Set Collision Flags Example (Lua) Source: https://docs.legendsen.se/developers/sdk-documentation/enums/collisionflag Demonstrates how to set multiple collision flags using the 'bit.bor' function for a skillshot. It shows how to combine flags like CollidesWithYasuoWall, CollidesWithMinions, and CollidesWithHeroes. Dependencies include the 'bit' library and the CollisionFlag enum. ```lua collisionFlags = bit.bor(CollisionFlag.CollidesWithYasuoWall,CollisionFlag.CollidesWithMinions,CollisionFlag.CollidesWithHeroes) Champions.Q:SetSkillshot(0.25,60,1000,SkillshotType.SkillshotLine,true,collisionFlags,HitChance.High,true) ``` -------------------------------- ### Create Root Menu Item (Lua) Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/ui/menu Creates and returns a root menu item with a specified name, display name, and base page number. This is the entry point for building a menu structure. ```Lua Menu:CreateMenu(name: string, displayName: string, page: number) -> Menu ``` -------------------------------- ### ColorData Constructors Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/colordata Provides documentation for the various constructors of the ColorData struct, allowing initialization with different parameters for color and gradient settings. ```APIDOC ## ColorData Constructors ### Description This section details the different ways to construct a `ColorData` object, allowing for solid colors, linear gradients, and custom gradients. ### Constructor 1: Full Gradient Configuration #### Method `Renderer.ColorData()` #### Endpoint N/A (Constructor) #### Parameters ##### Path Parameters None ##### Query Parameters None ##### Request Body None #### Request Example ```javascript const colorData = new Renderer.ColorData(GradientType.Linear, 0xFF0000, 0x00FF00, 90, 0.5); ``` ### Constructor 2: Linear Gradient with Angle and Factor #### Method `Renderer.ColorData()` #### Endpoint N/A (Constructor) #### Parameters ##### Path Parameters None ##### Query Parameters None ##### Request Body None #### Request Example ```javascript const colorData = new Renderer.ColorData(GradientType.Linear, 0xFF0000, 0x00FF00, 90, 0.5); ``` ### Constructor 3: Linear Gradient (Default Angle/Factor) #### Method `Renderer.ColorData()` #### Endpoint N/A (Constructor) #### Parameters ##### Path Parameters None ##### Query Parameters None ##### Request Body None #### Request Example ```javascript const colorData = new Renderer.ColorData(GradientType.Linear, 0xFF0000, 0x00FF00); ``` ### Constructor 4: Solid Color #### Method `Renderer.ColorData()` #### Endpoint N/A (Constructor) #### Parameters ##### Path Parameters None ##### Query Parameters None ##### Request Body None #### Request Example ```javascript const colorData = new Renderer.ColorData(0xFF0000); ``` ### Constructor 5: Default Constructor #### Method `Renderer.ColorData()` #### Endpoint N/A (Constructor) #### Parameters ##### Path Parameters None ##### Query Parameters None ##### Request Body None #### Request Example ```javascript const colorData = new Renderer.ColorData(); ``` ### Response #### Success Response (200) This constructor returns a `ColorData` object. #### Response Example ```json { "type": "ColorData", "from": "number - D3DCOLOR", "to": "number - D3DCOLOR", "gradientType": "GradientType", "gradientAngle": "number - float", "gradientFactor": "number - float" } ``` ``` -------------------------------- ### Champion Script Initialization in Lua Source: https://docs.legendsen.se/developers/guidelines This snippet shows how to initialize a champion script in Lua by unloading the internal C++ script. It's a crucial step for custom champion scripts in LS. ```lua Champions.CppScriptMaster(false) ``` -------------------------------- ### Example: Force Target under Cursor Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/targetselector An example demonstrating how to use `SetForcedTarget` to make the currently hovered unit the forced target. This script binds to the `OnTick` callback to continuously update the forced target. ```lua Callback.Bind(CallbackType.OnTick, function() local hover = Game.GetHoveredUnit() TargetSelector.SetForcedTarget(hover and hover:IsValid() and hover or nil) end) ``` -------------------------------- ### Update Missile Position Example - Lua Source: https://docs.legendsen.se/developers/sdk-documentation/callbacks/callbacksignatures Shows an example of modifying a missile's position during the game update using the OnUpdateMissile callback. This allows for dynamic manipulation of projectile trajectories. ```lua Callback.Bind(CallbackType.OnUpdateMissile, function(pos) pos.x = Game.GetCursorWorldPosition().x + 500 end) ``` -------------------------------- ### ClipperOffset Constructor Source: https://docs.legendsen.se/developers/sdk-documentation/library/clipper/clipperoffset Initializes a new instance of the ClipperOffset class. ```APIDOC ## ClipperOffset:new ### Description ClipperOffset constructor. ### Method `new` ### Endpoint N/A (Constructor) ### Parameters None ### Request Example ```javascript const offsetter = ClipperOffset.new(); ``` ### Response #### Success Response (void) Initializes a new ClipperOffset object. ``` -------------------------------- ### Point64 Functions Source: https://docs.legendsen.se/developers/sdk-documentation/library/clipper/point64 Documentation for the functions associated with the Point64 structure. ```APIDOC ## Point64 Functions ### Negate #### Description Negates the X and Y coordinates of this Point64 instance. #### Method `Point64:Negate()` #### Return Value `void` ### __mul (Multiplication) #### Description Multiplies the coordinates of this Point64 by a given scale factor. #### Method `Point64:__mul(scale: number)` #### Parameters - **scale** (number) - Required - The multiplicator. #### Return Value `Point64` - A new Point64 instance with scaled coordinates. ### __add (Addition) #### Description Adds the coordinates of another Point64 to this Point64 instance. #### Method `Point64:__add(point: Point64)` #### Parameters - **point** (Point64) - Required - The second point to add. #### Return Value `Point64` - A new Point64 instance representing the sum of the two points. ### __sub (Subtraction) #### Description Subtracts the coordinates of another Point64 from this Point64 instance. #### Method `Point64:__sub(point: Point64)` #### Parameters - **point** (Point64) - Required - The second point to subtract. #### Return Value `Point64` - A new Point64 instance representing the difference between the two points. ### __tostring (String Conversion) #### Description Converts the Point64 instance to its string representation. #### Method `Point64:__tostring()` #### Return Value `string` - The string representation of the Point64. ### Request Example (for __mul) ```json { "scale": 2 } ``` ### Response Example (for __mul) ```json { "x": 20, "y": 40 } ``` ``` -------------------------------- ### ChampionTracker Properties Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/championtracker Provides information about the properties of a ChampionTracker instance. ```APIDOC ## ChampionTracker Properties ### Description These are the properties associated with a ChampionTracker instance, providing details about the champion's state and tracking information. ### Method N/A (Properties access) ### Endpoint N/A (Instance properties) ### Parameters None ### Request Example N/A ### Response #### Success Response (200) - **source** (AIHeroClient) - The AIHeroClient associated with the champion. - **lastPosition** (Vector3) - The last known position of the champion. - **lastWayPoint** (Vector3) - The last known waypoint of the champion. - **invisibleSince** (number) - Timestamp when the champion became invisible. - **invisibleTimeCount** (number) - Duration the champion has been invisible. - **lastAuroWardTime** (number) - Timestamp of the last aura ward activation. - **teleportInfo** (TeleportInfo) - Information about the champion's teleport status. #### Response Example ```json { "source": { ... }, "lastPosition": { "x": 10.5, "y": 5.2, "z": 15.0 }, "lastWayPoint": { "x": 12.0, "y": 6.0, "z": 16.5 }, "invisibleSince": 1678886400, "invisibleTimeCount": 5.5, "lastAuroWardTime": 1678886300, "teleportInfo": { ... } } ``` ``` -------------------------------- ### Retrieve Skillshots at Position with Example Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/evade/evade-api Returns an array of Skillshot objects located at a specific position. The function can be configured to include ignored skillshots. The example demonstrates how to print the names of skillshots at the player's current position. ```Lua local skillshots = Evade.GetSkillshotsAtPosition(Game.localPlayer.position2D) if skillshots and #skillshots > 0 then for i, ss in skillshots:pairs() do print(ss.SpellData.Name) end end ``` -------------------------------- ### Set Custom Skillshot Ignore Rule with Example Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/evade/evade-api Allows setting a custom function to determine if a skillshot should be ignored. This function receives a Skillshot object and must return a boolean. It's crucial to unset this with 'nil' on unload to prevent issues. The example shows how to ignore all skillshots. ```Lua Evade.SetCustomShouldSpellBeIgnored(function(skillshot) return true -- Ignore this skillshot end) -- Dispose: Callback.Bind(CallbackType.OnUnload, function() Evade.SetCustomShouldSpellBeIgnored(nil) end) ``` -------------------------------- ### MenuComponent Properties Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/ui/list Describes the properties available for the MenuComponent. ```APIDOC ## MenuComponent Properties ### Description Provides access to the properties of the MenuComponent. ### Properties #### `value` - **Type**: integer - **Description**: The integer value associated with the component. #### `items` - **Type**: string[] - **Description**: A list of strings representing items in the component. Corresponds to std::vector. ``` -------------------------------- ### Create SDKSpell Instance Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/sdkspell Initializes a new SDKSpell instance with specified slot, range, and damage type. This is the first step before configuring or casting a spell. ```lua local spell = SDKSpell.Create(SpellSlot.Q, 1200, DamageType.Magical) ``` -------------------------------- ### Get Normal Vector Source: https://docs.legendsen.se/developers/sdk-documentation/math/vector2 Returns the normal vector to the current vector. This is often used in physics calculations and surface interactions. ```lua function Vector2:Normal() -- Returns normal. -- Implementation details omitted. end ``` -------------------------------- ### Load and Draw Image with ImGui Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-imgui Loads an image from a file path and returns a handle, which can then be used to draw the image using ImGui. It's crucial to release the image resource using `ReleaseImage` in the `OnUnload` callback to prevent memory leaks. Ensure to use double backslashes for file paths. ```lua local imageHandle = Renderer.LoadImageFromFile("assets\\Default_Texture_A.png") -- Load image Callback.Bind(CallbackType.OnImguiDraw, function() if imageHandle then Renderer.DrawImage(imageHandle, Math.Vector2(100, 50), Math.Vector2(600, 100)) end end) Callback.Bind(CallbackType.OnUnload, function() Renderer.ReleaseImage(imageHandle) -- IMPORTANT: Release it when disposing end) ``` -------------------------------- ### OnNewPath Source: https://docs.legendsen.se/developers/sdk-documentation/callbacks/callbacksignatures Fired when a unit gets a new path. Note: This callback may not always be reliable. ```APIDOC ## OnNewPath ### Description Fired when when unit gets a new path. Caution: This callback is sometimes unreliable, for example, when Leesin R kicks someone, the path may be incorrect. ### Method Callback ### Endpoint CallbackSignatures.OnNewPath ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **sender** (AIbaseClient) - Description: None - **isDash** (boolean) - Description: None - **dashSpeed** (number) - Description: None - **path** (Vector3[]) - Description: Path ### Request Example ```json { "sender": "AIbaseClient", "isDash": true, "dashSpeed": 100, "path": [ "Vector3", "Vector3" ] } ``` ### Response #### Success Response (200) - **CallbackResult** (CallbackResult) - Description: None #### Response Example ```json { "CallbackResult": "CallbackResult" } ``` ``` -------------------------------- ### MenuComponent Functions Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/ui/list Details the functions available for interacting with the MenuComponent. ```APIDOC ## MenuComponent Functions ### Description Provides functions to manipulate and add features to the MenuComponent. ### Functions #### `PermaShow` ##### Description Controls the permashow state of the component. ##### Signature `List:PermaShow(show: boolean, overrideSave: boolean) → void` ##### Parameters - **show** (boolean) - Required - Determines whether to display the permashow. - **overrideSave** (boolean) - Required - Forces permashow even if a save state exists. It's recommended to set this to `false` if not explicitly needed. #### `AddTooltip` ##### Description Adds a tooltip to the component. ##### Signature `List:AddTooltip(tooltipString: string) → void` ##### Parameters - **tooltipString** (string) - Required - The string content for the tooltip. ``` -------------------------------- ### Math - LineSegmentIntersection (Boolean) Source: https://docs.legendsen.se/developers/sdk-documentation/math/math-api Checks if two line segments intersect and returns a boolean value. It requires the start and end points for both segments. ```APIDOC ## Math.LineSegmentIntersection (Boolean) ### Description Checks if two line segments intersect. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` Math.LineSegmentIntersection(a1: Vector2, a2: Vector2, b1: Vector2, b2: Vector2) ``` ### Response #### Success Response (200) - **intersection** (boolean) - True if the line segments intersect, false otherwise. #### Response Example ```json { "intersection": false } ``` ``` -------------------------------- ### AIBaseClient: FindSafeSpot Source: https://docs.legendsen.se/developers/sdk-documentation/class/aibaseclient Finds a safe spot in the game environment relative to a given position. ```APIDOC ## AIBaseClient: FindSafeSpot ### Description Finds safe spot using game function. ### Method `AIBaseClient:FindSafeSpot(position: Vector3)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **position** (Vector3) - Required - nil ### Request Example ```json { "position": {"x": 100.0, "y": 0.0, "z": 200.0} } ``` ### Response #### Success Response (Vector3) The coordinates of a safe spot. #### Response Example ```json { "x": 150.0, "y": 0.0, "z": 250.0 } ``` ``` -------------------------------- ### Get Target Prediction Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/sdkspell Calculates and returns the prediction output for a given target. This is crucial for skillshot spells to ensure accuracy. ```Lua SDKSpell:GetPrediction( target: AIBaseClient ) -> PredictionOutput ``` -------------------------------- ### Get Orbwalker Target (Lua) Source: https://docs.legendsen.se/developers/sdk-documentation/sdk-types-and-functions/orbwalker Retrieves the current target selected by the Orbwalker. This function is crucial for understanding which enemy the Orbwalker is focused on. ```lua local target = Orbwalker.GetTarget() -- Use the target variable here ``` -------------------------------- ### LoadImageFromFile Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-imgui Loads an image from a file path and returns a unique handle for use with ImGui drawing functions. ```APIDOC ## LoadImageFromFile ### Description Loads an image (sprite) from a file so it can be used with ImGui functions such as `DrawImage`. Returns a unique image handle. ### Method `Renderer.LoadImageFromFile(filePath: string) -> number - handle` ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * **filePath** (string) - Required - The relative path to the image file. Use double backslashes (`\\`) instead of forward slashes (`/`). ### Request Example ```lua local imageHandle = Renderer.LoadImageFromFile("assets\\Default_Texture_A.png") ``` ### Response #### Success Response (200) * **handle** (number) - A unique identifier for the loaded image. ``` -------------------------------- ### Get Enemy Centroid Source: https://docs.legendsen.se/developers/sdk-documentation/math/math-api Finds the centroid of enemies within a specified range from a given position. It returns the centroid Vector2 and the count of affected enemies. ```lua Math.GetEnemyCentroid(position: Vector2, range: number) ``` -------------------------------- ### Get Direction Vector from Orientation Source: https://docs.legendsen.se/developers/sdk-documentation/math/math-api Retrieves the direction vector from an orientation matrix. This function can accept either an EffectEmitter object or a D3DMATRIX to define the orientation. ```lua Math.GetDirectionFromOrientation(obj: EffectEmitter) ``` ```lua Math.GetDirectionFromOrientation(matrix: _D3DMATRIX) ``` -------------------------------- ### Vector2 Properties and Functions Source: https://docs.legendsen.se/developers/sdk-documentation/math/vector2 Overview of the Vector2 class properties and functions, detailing their purpose, arguments, and return types. ```APIDOC ## Vector2 Class Documentation ### Description The Vector2 class represents a two-dimensional vector with x and y components. It provides various properties and functions for mathematical and geometric operations. ### Properties * **x** (number) - The x-component of the vector. * **y** (number) - The y-component of the vector. ### Functions * **IsValid()** * Description: Returns whether this vector is not (0, 0). * Returns: boolean * **To3D()** * Description: Returns a Vector3 with x=x, y=0, z=y. * Returns: Vector3 * **To2D()** * Description: Returns a new Vector2 with the same x and y components. * Returns: Vector2 * **Copy()** * Description: Returns a new Vector2 with the same x and y components. * Returns: Vector2 * **Project()** * Description: Returns a game world position Vector3 (ScreenToWorld). * Returns: Vector3 * **ProjectOnLine(A: Vector2, B: Vector2)** * Description: Projects the vector onto the line defined by points A and B. * Arguments: * A (Vector2): The starting point of the line. * B (Vector2): The ending point of the line. * Returns: Vector2 - The projected vector on the line AB. * **ProjectOnLineSegment(A: Vector2, B: Vector2)** * Description: Projects the vector onto the line segment defined by points A and B. * Arguments: * A (Vector2): The starting point of the line segment. * B (Vector2): The ending point of the line segment. * Returns: Vector2 - The projected vector on the line segment AB. * **IsOnLineSegment(A: Vector2, B: Vector2)** * Description: Checks if the vector's projection lies on the line segment AB. * Arguments: * A (Vector2): The starting point of the line segment. * B (Vector2): The ending point of the line segment. * Returns: boolean * **IsLineSegmentIntersection(B: Vector2, C: Vector2, D: Vector2)** * Description: Checks if the line segment AB intersects with the line segment CD. * Arguments: * B (Vector2): The second point of the first line segment. * C (Vector2): The first point of the second line segment. * D (Vector2): The second point of the second line segment. * Returns: boolean * **VectorIntersection(B: Vector2, C: Vector2, D: Vector2)** * Description: Calculates the intersection point between line segment AB and line segment CD. * Arguments: * B (Vector2): The second point of the first line segment. * C (Vector2): The first point of the second line segment. * D (Vector2): The second point of the second line segment. * Returns: Vector2 - The intersection point. * **Length()** * Description: Returns the length of the vector. * Returns: number * **Length2()** * Description: Returns the squared length of the vector. * Returns: number * **Distance(v2: Vector2)** * Description: Calculates the distance between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **Distance2(v2: Vector2)** * Description: Calculates the squared distance between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **Dot(v2: Vector2)** * Description: Calculates the dot product between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **Cross(v2: Vector2)** * Description: Calculates the cross product between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **Normalize()** * Description: Normalizes this vector in place. * Returns: void * **Normalized()** * Description: Returns a normalized version of this vector. * Returns: Vector2 * **Extend(v2: Vector2, distance: number)** * Description: Extends this vector towards the given vector v2 by the specified distance. * Arguments: * v2 (Vector2): The target vector. * distance (number): The distance to extend by. * Returns: void * **Extended(v2: Vector2, distance: number)** * Description: Returns a new vector extended towards v2 by the specified distance. * Arguments: * v2 (Vector2): The target vector. * distance (number): The distance to extend by. * Returns: Vector2 * **Shorten(v2: Vector2, distance: number)** * Description: Shortens this vector towards the given vector v2 by the specified distance. * Arguments: * v2 (Vector2): The target vector. * distance (number): The distance to shorten by. * Returns: void * **Shortened(v2: Vector2, distance: number)** * Description: Returns a new vector shortened towards v2 by the specified distance. * Arguments: * v2 (Vector2): The target vector. * distance (number): The distance to shorten by. * Returns: Vector2 * **Lerp(v2: Vector2, time: number)** * Description: Performs linear interpolation between this vector and v2 based on the time parameter. * Arguments: * v2 (Vector2): The second point. * time (number): The interpolation factor (0.0 to 1.0). * Returns: Vector2 - The interpolated vector. * **Angle()** * Description: Returns the angle of the vector in radians. * Returns: number * **AngleDeg()** * Description: Returns the angle of the vector in degrees. * Returns: number * **AngleBetween(v2: Vector2)** * Description: Returns the angle in radians between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **AngleDegBetween(v2: Vector2)** * Description: Returns the angle in degrees between this vector and another vector v2. * Arguments: * v2 (Vector2): The second point. * Returns: number * **Rotate(angle: number)** * Description: Returns a new vector rotated by the given angle in radians. * Arguments: * angle (number): The rotation angle in radians. * Returns: Vector2 * **RotateDeg(angle: number)** * Description: Returns a new vector rotated by the given angle in degrees. * Arguments: * angle (number): The rotation angle in degrees. * Returns: Vector2 * **Unpack()** * Description: Returns the x and y components of the vector as two separate numbers. * Returns: number, number ``` -------------------------------- ### Draw Text on Screen (Lua) Source: https://docs.legendsen.se/developers/sdk-documentation/renderer/renderer-imgui Draws basic text on the screen at a specified 2D position. Optional parameters include font size and color. While usable, DrawTextEx is recommended for production code. ```lua Renderer.DrawText(text, position, size, color) ```