### Retrieve Game Objects and Players Source: https://context7.com/less-nefariousness5/psapi/llms.txt This snippet demonstrates how to retrieve various game objects, including the local player, all objects in the world, and visible objects. It also includes examples for arena targeting and mouse-over targeting. It requires access to the core object manager. ```lua -- Get local player local player = core.object_manager.get_local_player() if not player:is_valid() then return end -- Get all objects in world local all_objects = core.object_manager.get_all_objects() for _, obj in ipairs(all_objects) do if obj:is_unit() and obj:is_enemy_with(player) then local distance = obj:get_position():dist_to(player:get_position()) if distance < 40 then core.log(obj:get_name() .. " is " .. distance .. "m away") end end end -- Get visible objects (optimized) local visible = core.object_manager.get_visible_objects() -- Arena targeting if core.get_map_name():match("Arena") then for i = 1, 3 do local arena_target = core.object_manager.get_arena_target(i) if arena_target and arena_target:is_valid() then core.log("Arena" .. i .. ": " .. arena_target:get_name()) end end end -- Mouse-over targeting local mouseover = core.object_manager.get_mouse_over_object() if mouseover and mouseover:is_valid() then core.log("Mouseover: " .. mouseover:get_name()) end ``` -------------------------------- ### Lua: Accessing Timing and Game State Information in PSAPI Source: https://context7.com/less-nefariousness5/psapi/llms.txt Provides examples of how to retrieve timing data like current time, delta time, and game time, along with game state information such as map details, instance names, difficulty, and terrain height using PSAPI's core functions. ```lua -- Get current time since injection local current_time = core.time() -- seconds local game_time_ms = core.game_time() -- milliseconds since game start local delta = core.delta_time() -- seconds since last frame -- Network latency local ping = core.get_ping() -- milliseconds -- Map and instance information local map_id = core.get_map_id() local map_name = core.get_map_name() local instance_name = core.get_instance_name() local keystone_level = core.get_keystone_level() local difficulty_name = core.get_difficulty_name() -- Terrain height for navigation local ground_height = core.get_height_for_position(vec3.new(100, 200, 50)) ``` -------------------------------- ### Validate Spell Cast Conditions (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Validates spell cast conditions including equipped status, cooldown, facing, range, and resource affordability. It also includes functions to get spell cost details and parse spell damage/healing from tooltips. ```lua local spell_helper = require("common/utility/spell_helper") local player = core.object_manager.get_local_player() local target = player:get_target() -- Check if spell is equipped if spell_helper:has_spell_equipped(133) then -- Spell is in spellbook end -- Check cooldown status local on_cd = spell_helper:is_spell_on_cooldown(133, false, false) -- Validate spell is castable with all checks local castable = spell_helper:is_spell_castable( 133, -- spell_id player, -- caster target, -- target false, -- skip_facing false, -- skip_range false -- skip_usable ) -- Position-based spell validation local cast_pos = vec3.new(100, 200, 15) local pos_castable = spell_helper:is_spell_castable_position( 133, player, target, cast_pos, false, false, false, false, false) -- Get spell cost details local costs = spell_helper:get_spell_cost(133) -- Check if unit can afford spell local can_afford = spell_helper:can_afford_spell(player, 133, costs) -- Parse spell damage from tooltip local damage = spell_helper:get_spell_damage(133, false, false) local healing = spell_helper:get_spell_healing(47450, false, false) ``` -------------------------------- ### Input Control API - Pet and Mount Control Source: https://context7.com/less-nefariousness5/psapi/llms.txt API for commanding pet abilities and managing mount actions. ```APIDOC ## Input Control API - Pet and Mount Control ### Description Command pet abilities and manage mount/dismount actions. This includes setting pet stances, issuing commands, casting spells, and controlling movement. It also handles mounting and dismounting player mounts. ### Method Various (Internal API) ### Endpoint N/A ### Parameters None ### Request Example ```lua local player = core.object_manager.get_local_player() local pet = player:get_pet() if pet and pet:is_valid() then -- Pet stance core.input.set_pet_passive() core.input.set_pet_defensive() core.input.set_pet_aggressive() core.input.set_pet_assist() -- Pet commands core.input.set_pet_follow() core.input.set_pet_wait() -- Pet attack local target = player:get_target() if target then core.input.pet_attack(target) end -- Pet spell casting core.input.pet_cast_target_spell(123456, target) core.input.pet_cast_position_spell(123456, vec3.new(100, 200, 15)) -- Pet movement core.input.pet_move(target) core.input.pet_move_position(vec3.new(100, 200, 15)) end -- Mount management local mount_count = core.spell_book.get_mount_count() for i = 1, mount_count do local mount_info = core.spell_book.get_mount_info(i) if mount_info.is_usable and not mount_info.is_active then core.input.mount(i) break end end core.input.dismount() ``` ### Response None (Actions performed). ``` -------------------------------- ### Power and Resource Management Source: https://context7.com/less-nefariousness5/psapi/llms.txt APIs for tracking and predicting resource generation for optimal spell usage. ```APIDOC ## Power and Resource Management ### Description Track and predict resource generation for optimal spell usage. This includes base power regeneration rates, Death Knight rune status, and totem durations. ### Method Various (Internal API) ### Endpoint N/A ### Parameters None ### Request Example ```lua local player = core.object_manager.get_local_player() -- Base power regen rates local base_regen = core.spell_book.get_base_power_regen() -- out of combat local casting_regen = core.spell_book.get_casting_power_regen() -- while casting -- Death Knight runes for i = 1, 6 do local rune_info = core.spell_book.get_rune_info(i) if rune_info.ready then core.log("Rune " .. i .. " is ready") else local time_left = rune_info.duration - (core.time() - rune_info.start) core.log("Rune " .. i .. " ready in " .. time_left .. "s") end local rune_type = core.spell_book.get_rune_type(i) -- 1=Blood, 2=Unholy, 3=Frost local is_active = core.spell_book.is_rune_slot_active(i) end -- Totem tracking for i = 1, 4 do local totem_info = core.spell_book.get_totem_info(i) if totem_info.have_totem then local remaining = totem_info.duration - (core.time() - totem_info.start_time) core.log(totem_info.totem_name .. " expires in " .. remaining .. "s") end end ``` ### Response None (Informational only) ``` -------------------------------- ### Control Pet and Mount Actions (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Enables commanding pet stances, issuing movement and attack commands, and casting pet spells. It also handles mounting and dismounting player's mounts. ```lua local player = core.object_manager.get_local_player() local pet = player:get_pet() if pet and pet:is_valid() then -- Pet stance core.input.set_pet_passive() core.input.set_pet_defensive() core.input.set_pet_aggressive() core.input.set_pet_assist() -- Pet commands core.input.set_pet_follow() core.input.set_pet_wait() -- Pet attack local target = player:get_target() if target then core.input.pet_attack(target) end -- Pet spell casting core.input.pet_cast_target_spell(123456, target) core.input.pet_cast_position_spell(123456, vec3.new(100, 200, 15)) -- Pet movement core.input.pet_move(target) core.input.pet_move_position(vec3.new(100, 200, 15)) end -- Mount management local mount_count = core.spell_book.get_mount_count() for i = 1, mount_count do local mount_info = core.spell_book.get_mount_info(i) if mount_info.is_usable and not mount_info.is_active then core.input.mount(i) break end end core.input.dismount() ``` -------------------------------- ### Lua Menu System API for Configuration Source: https://context7.com/less-nefariousness5/psapi/llms.txt Enables the creation of interactive configuration menus using various UI elements like checkboxes, sliders, and keybinds. It allows for registering menus, defining elements, and rendering them within a game loop. User interactions with menu elements can be captured and used to modify game settings. ```lua -- Register menu core.menu.register_menu() -- Create menu elements local main_tree = core.menu.tree_node() local combat_enabled = core.menu.checkbox(true, "combat_enabled") local aoe_threshold = core.menu.slider_int(1, 10, 3, "aoe_threshold") local rotation_mode = core.menu.combobox(1, "rotation_mode") local interrupt_key = core.menu.keybind(0x20, false, "interrupt_key") -- Spacebar local reset_button = core.menu.button("reset_button") -- Render menu core.register_on_render_menu_callback(function() main_tree:render("Combat Settings", function () combat_enabled:render("Enable Combat", "Toggle combat automation") aoe_threshold:render("AoE Threshold", "Minimum enemies for AoE rotation") rotation_mode:render("Rotation Mode", { "Single Target", "AoE Focused", "Cleave" }, "Select rotation priority") interrupt_key:render("Interrupt Key", "Keybind for manual interrupts", false) reset_button:render("Reset Settings", "Reset all settings to default") end) end) -- Use menu values in rotation core.register_on_pre_tick_callback(function() if not combat_enabled:get_state() then return end local threshold = aoe_threshold:get() local mode = rotation_mode:get() local key_pressed = interrupt_key:get_state() if reset_button:is_clicked() then combat_enabled:set(true) aoe_threshold:set(3) rotation_mode:set(1) end end) ``` -------------------------------- ### Lua: Logging and Data File Operations in PSAPI Source: https://context7.com/less-nefariousness5/psapi/llms.txt Demonstrates how to write messages to the game console and log files using PSAPI's core logging functions. It also shows how to create, read, and write to data files for persistent storage of settings or game data. ```lua -- Basic logging core.log("Script initialized successfully") core.log_warning("Low health detected: " .. tostring(player:get_health())) core.log_error("Failed to cast spell ID 12345") -- File-based logging for persistent records core.create_log_file("combat_log.txt") core.write_log_file("combat_log.txt", "Combat started at " .. core.time()) -- Data file operations for configuration core.create_data_file("settings.lua") core.write_data_file("settings.lua", "return { enabled = true, threshold = 0.5 }") local settings_str = core.read_data_file("settings.lua") ``` -------------------------------- ### Input Control API - Movement Control Source: https://context7.com/less-nefariousness5/psapi/llms.txt API for programmatic control of player movement and facing direction. ```APIDOC ## Input Control API - Movement Control ### Description Programmatically control player movement and facing direction. This includes starting/stopping movement in cardinal directions, turning, vertical movement, jumping, and facing specific locations. ### Method Various (Internal API) ### Endpoint N/A ### Parameters None ### Request Example ```lua -- Start/stop movement in directions core.input.move_forward_start() core.input.move_forward_stop() core.input.move_backward_start() core.input.move_backward_stop() core.input.strafe_left_start() core.input.strafe_left_stop() core.input.strafe_right_start() core.input.strafe_right_stop() -- Turning core.input.turn_left_start() core.input.turn_left_stop() core.input.turn_right_start() core.input.turn_right_stop() -- Vertical movement (flying/swimming) core.input.move_up_start() core.input.move_up_stop() core.input.move_down_start() core.input.move_down_stop() -- Jump core.input.jump() -- Face position local target_pos = vec3.new(100, 200, 15) core.input.look_at(target_pos) -- Movement control core.input.disable_movement(true) -- lock movement core.input.enable_movement() -- Combat actions core.input.stop_attack() ``` ### Response None (Actions performed). ``` -------------------------------- ### Lua: Registering Callbacks for Game Events in PSAPI Source: https://context7.com/less-nefariousness5/psapi/llms.txt Shows how to register custom functions to be executed during specific game events using PSAPI's callback system. This includes pre-tick for rotations, spell casts for tracking, and rendering for UI overlays. ```lua -- Pre-tick callback runs before each game frame (primary rotation logic) core.register_on_pre_tick_callback(function() local player = core.object_manager.get_local_player() if not player or not player:is_valid() then return end -- Execute combat rotation here if player:is_in_combat() and player:get_health() > 0 then -- Cast spells, check cooldowns, etc. end end) -- Spell cast callback for tracking enemy abilities core.register_on_spell_cast_callback(function(data) if not data.caster then return end local player = core.object_manager.get_local_player() if data.caster:is_enemy_with(player) then core.log(string.format("Enemy cast %d at %.2f", data.spell_id, data.spell_cast_time)) end end) -- Render callback for on-screen overlays core.register_on_render_callback(function() local enemies = core.object_manager.get_visible_objects() for _, enemy in ipairs(enemies) do if enemy:is_valid() and enemy:is_unit() then local pos = enemy:get_position() core.graphics.circle_3d(pos, 5.0, core.color.new(255, 0, 0, 255), 2) end end end) ``` -------------------------------- ### Track Player Resources (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Tracks and logs player power regeneration rates, Death Knight rune status, and totem expiration times. It utilizes game API functions to retrieve real-time resource information. ```lua local player = core.object_manager.get_local_player() -- Base power regen rates local base_regen = core.spell_book.get_base_power_regen() -- out of combat local casting_regen = core.spell_book.get_casting_power_regen() -- while casting -- Death Knight runes for i = 1, 6 do local rune_info = core.spell_book.get_rune_info(i) if rune_info.ready then core.log("Rune " .. i .. " is ready") else local time_left = rune_info.duration - (core.time() - rune_info.start) core.log("Rune " .. i .. " ready in " .. time_left .. "s") end local rune_type = core.spell_book.get_rune_type(i) -- 1=Blood, 2=Unholy, 3=Frost local is_active = core.spell_book.is_rune_slot_active(i) end -- Totem tracking for i = 1, 4 do local totem_info = core.spell_book.get_totem_info(i) if totem_info.have_totem then local remaining = totem_info.duration - (core.time() - totem_info.start_time) core.log(totem_info.totem_name .. " expires in " .. remaining .. "s") end end ``` -------------------------------- ### Query Unit Properties and Combat Status (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Queries unit properties with combat-aware filtering and role detection. Includes functions to check if a unit is a dummy, in combat, a valid enemy, and to retrieve health percentage with incoming damage prediction. Also supports role detection (tank, healer, DPS) and listing nearby enemies or allies with various filters. ```lua local unit_helper = require("common/utility/unit_helper") local player = core.object_manager.get_local_player() -- Check if unit is training dummy if unit_helper:is_dummy(target) then core.log("Targeting a dummy") end -- Combat status with exceptions local in_combat = unit_helper:is_in_combat(player) -- Validate enemy (excludes blacklisted NPCs) if unit_helper:is_valid_enemy(target) then -- Valid combat target end -- Get health percentage (0.0 to 1.0) local hp_pct = unit_helper:get_health_percentage(target) -- Get health with incoming damage prediction local future_hp, incoming_dmg, current_hp, inc_pct = unit_helper:get_health_percentage_inc(target, 2.0) -- Role detection local role_id = unit_helper:get_role_id(player) local is_tank = unit_helper:is_tank(player) local is_healer = unit_helper:is_healer(player) local is_dps = unit_helper:is_damage_dealer(player) -- Get enemy list with filtering local enemies = unit_helper:get_enemy_list_around( player:get_position(), 40, -- range false, -- include out of combat false, -- include blacklisted false, -- players only false -- include dead ) -- Get ally list local allies = unit_helper:get_ally_list_around( player:get_position(), 40, -- range false, -- players only true, -- party only false -- include dead ) ``` -------------------------------- ### Access Game Object Properties and Methods Source: https://context7.com/less-nefariousness5/psapi/llms.txt This snippet shows how to access detailed properties and methods of a game object, such as a target unit. It covers basic information like name and level, health and resource values, position and movement data, combat status, and relationship checks. It requires a valid target object obtained through the object manager. ```lua local player = core.object_manager.get_local_player() local target = player:get_target() if target and target:is_valid() then -- Basic properties local name = target:get_name() local level = target:get_level() local npc_id = target:get_npc_id() local creature_type = target:get_creature_type() local classification = target:get_classification() -- elite, rare, boss -- Health and resources local hp = target:get_health() local max_hp = target:get_max_health() local hp_pct = (hp / max_hp) * 100 local mana = target:get_power(0) -- 0 = Mana local rage = target:get_power(1) -- 1 = Rage -- Position and movement local pos = target:get_position() local rotation = target:get_rotation() local speed = target:get_movement_speed() local is_moving = target:is_moving() -- Combat state local in_combat = target:is_in_combat() local is_dead = target:is_dead() local is_casting = target:is_casting_spell() local spell_id = target:get_active_spell_id() -- Relationship checks local is_enemy = target:is_enemy_with(player) local can_attack = player:can_attack(target) -- Physical properties local bounding_radius = target:get_bounding_radius() local height = target:get_height() local distance = pos:dist_to(player:get_position()) end ``` -------------------------------- ### Input Control API - Spell Casting and Targeting Source: https://context7.com/less-nefariousness5/psapi/llms.txt API for executing spell casts with various targeting modes and validation, including item usage. ```APIDOC ## Input Control API - Spell Casting and Targeting ### Description Execute spell casts with various targeting modes and validation. This includes setting targets, focus, cancelling casts, and using items. ### Method Various (Internal API) ### Endpoint N/A ### Parameters None ### Request Example ```lua local player = core.object_manager.get_local_player() local target = player:get_target() -- Set target if enemy and enemy:is_valid() then core.input.set_target(enemy) end -- Set focus core.input.set_focus(enemy) local focus = core.input.get_focus() -- Cancel current cast core.input.cancel_spells() -- Basic spell casting (handled by spell queue system in most cases) -- These functions interact with the game's spell casting API -- Item usage local healthstone_id = 5512 if core.spell_book.is_item_usable(healthstone_id) then core.input.use_item(healthstone_id) end -- Targeted item usage core.input.use_item_target(healthstone_id, target) -- Ground-targeted item usage local position = vec3.new(100, 200, 10) core.input.use_item_position(healthstone_id, position) ``` ### Response None (Actions performed). ``` -------------------------------- ### Lua Buff and Debuff Management with Caching Source: https://context7.com/less-nefariousness5/psapi/llms.txt Provides a module for efficiently managing and querying buffs and debuffs on game units. It utilizes caching to optimize performance when checking aura status, stacks, and remaining duration. The module can retrieve specific buffs/debuffs by ID or a list of IDs and can also fetch all active auras on a unit. ```lua local buff_manager = require("common/modules/buff_manager") local player = core.object_manager.get_local_player() -- Check for specific buff (uses caching) local buff_data = buff_manager:get_buff_data(player, 12345) if buff_data.is_active then core.log(string.format("Buff active: %d stacks, %.2fs remaining", buff_data.stacks, buff_data.remaining)) end -- Check for debuff on target local target = player:get_target() if target then local debuff_data = buff_manager:get_debuff_data(target, {12345, 23456}) if debuff_data.is_active then core.log("Debuff present with " .. debuff_data.remaining .. "s left") end end -- Get all buffs on unit local buff_cache = buff_manager:get_buff_cache(player) for _, buff in ipairs(buff_cache) do core.log(string.format("%s (ID: %d) x%d - %.1fs", buff.buff_name, buff.buff_id, buff.count, buff.expire_time - core.time())) end ``` -------------------------------- ### Query Spell Information and Validation Source: https://context7.com/less-nefariousness5/psapi/llms.txt This snippet provides functions to query spell properties, cooldowns, charges, and usability. It allows checking if a player has a spell, its cooldown remaining, global cooldown, and charge status. It also covers spell range, costs, and properties like cast time and school. Requires a player object and spell IDs. ```lua local player = core.object_manager.get_local_player() -- Spell ownership and learning local has_fireball = core.spell_book.has_spell(133) local is_learned = core.spell_book.is_spell_learned(133) local all_spells = core.spell_book.get_spells() -- Cooldown information local cd_remaining = core.spell_book.get_spell_cooldown(133) -- seconds local gcd = core.spell_book.get_global_cooldown() -- Charge system local charges = core.spell_book.get_spell_charge(108853) -- Fire Blast local max_charges = core.spell_book.get_spell_charge_max(108853) local charge_cd = core.spell_book.get_spell_charge_cooldown_duration(108853) -- Range checking local range_data = core.spell_book.get_spell_range_data(133) local min_range = range_data.min local max_range = range_data.max local in_range = core.spell_book.is_spell_in_range(133, target, player) -- Spell properties local name = core.spell_book.get_spell_name(133) local cast_time = core.spell_book.get_spell_cast_time(133) local school = core.spell_book.get_spell_school(133) local is_melee = core.spell_book.is_melee_spell(133) local is_skillshot = core.spell_book.is_spell_position_cast(133) -- Resource costs local costs = core.spell_book.get_spell_costs(133) for _, cost in ipairs(costs) do core.log(string.format("Cost: %d of type %d", cost.cost, cost.cost_type)) end ``` -------------------------------- ### Lua Notifications and Screen Position Utilities Source: https://context7.com/less-nefariousness5/psapi/llms.txt Manages timed notifications with custom display options and converts world coordinates to screen coordinates for UI elements. It also provides utilities for cursor position, line of sight checks, and raycasting for collision detection. ```lua -- Create notification core.graphics.add_notification( "low_health_warning", -- unique ID "Warning", -- title "Health below 30%!", -- message 5000, -- duration in milliseconds core.color.new(255, 0, 0, 255), -- color 0, 0, -- x/y offset 0.95, -- background alpha 0, 0 -- width/height (0 = auto) ) -- Check if notification was clicked if core.graphics.is_notification_clicked("low_health_warning", 0) then core.log("User clicked health warning") end -- Check if notification is active if core.graphics.is_notification_active("low_health_warning") then -- Notification is currently displayed end -- World to screen coordinate conversion local enemy_pos = enemy:get_position() local screen_pos = core.graphics.w2s(enemy_pos) if screen_pos then core.graphics.text_2d("Enemy", screen_pos, 16, core.color.new(255, 0, 0, 255)) end -- Cursor world position local cursor_world = core.graphics.get_cursor_world_position() -- Line of sight check local has_los = core.graphics.is_line_of_sight(player, target) -- Trace line for collision detection local flags = 0x100 -- collision flags local hits = core.graphics.trace_line(player_pos, target_pos, flags) ``` -------------------------------- ### Control Spell Casting and Targeting (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Manages spell casting and targeting operations, including setting targets, focus, canceling casts, and using items with various targeting methods. It requires valid target or position data for item usage. ```lua local player = core.object_manager.get_local_player() local target = player:get_target() -- Set target if enemy and enemy:is_valid() then core.input.set_target(enemy) end -- Set focus core.input.set_focus(enemy) local focus = core.input.get_focus() -- Cancel current cast core.input.cancel_spells() -- Basic spell casting (handled by spell queue system in most cases) -- These functions interact with the game's spell casting API -- Item usage local healthstone_id = 5512 if core.spell_book.is_item_usable(healthstone_id) then core.input.use_item(healthstone_id) end -- Targeted item usage core.input.use_item_target(healthstone_id, target) -- Ground-targeted item usage local position = vec3.new(100, 200, 10) core.input.use_item_position(healthstone_id, position) ``` -------------------------------- ### Render 2D Graphics and UI Elements in Lua Source: https://context7.com/less-nefariousness5/psapi/llms.txt Enables rendering of 2D elements such as text, lines, rectangles, and circles on the screen using Lua. It utilizes screen dimensions and color definitions. Text rendering includes width calculation for centering. Rectangles can be filled or hollow with customizable corner rounding. ```lua -- Screen dimensions local screen_size = core.graphics.get_screen_size() local screen_center = vec2.new(screen_size.x / 2, screen_size.y / 2) -- Text rendering core.graphics.text_2d("Health: 100%", vec2.new(100, 100), 20, core.color.new(255, 255, 255, 255), false, 0) -- Calculate text width for centering local text = "Centered Text" local text_width = core.graphics.get_text_width(text, 24, 0) local centered_pos = vec2.new((screen_size.x - text_width) / 2, 100) core.graphics.text_2d(text, centered_pos, 24, core.color.new(255, 255, 255, 255)) -- Lines core.graphics.line_2d(vec2.new(100, 100), vec2.new(300, 300), core.color.new(255, 0, 0, 255), 2) -- Rectangles core.graphics.rect_2d(vec2.new(50, 50), 200, 100, core.color.new(0, 255, 0, 255), 2, 5) -- 5px corner rounding core.graphics.rect_2d_filled(vec2.new(50, 200), 200, 100, core.color.new(0, 0, 255, 128), 5) -- Circles core.graphics.circle_2d(screen_center, 50, core.color.new(255, 255, 0, 255), 2) core.graphics.circle_2d_filled(vec2.new(100, 100), 30, core.color.new(255, 0, 255, 180)) ``` -------------------------------- ### Control Player Movement (Lua) Source: https://context7.com/less-nefariousness5/psapi/llms.txt Provides programmatic control over player movement, including directional movement, turning, jumping, and facing specific positions. It also allows for locking and unlocking player movement. ```lua -- Start/stop movement in directions core.input.move_forward_start() core.input.move_forward_stop() core.input.move_backward_start() core.input.move_backward_stop() core.input.strafe_left_start() core.input.strafe_left_stop() core.input.strafe_right_start() core.input.strafe_right_stop() -- Turning core.input.turn_left_start() core.input.turn_left_stop() core.input.turn_right_start() core.input.turn_right_stop() -- Vertical movement (flying/swimming) core.input.move_up_start() core.input.move_up_stop() core.input.move_down_start() core.input.move_down_stop() -- Jump core.input.jump() -- Face position local target_pos = vec3.new(100, 200, 15) core.input.look_at(target_pos) -- Movement control core.input.disable_movement(true) -- lock movement core.input.enable_movement() -- Combat actions core.input.stop_attack() ``` -------------------------------- ### Render 3D World Graphics in Lua Source: https://context7.com/less-nefariousness5/psapi/llms.txt Facilitates rendering of 3D visual elements in the game world using Lua, including text, lines, circles, cones, and rectangles. It operates on world coordinates and player positions, supporting various visual styles like gradients, partial rendering, and filled shapes with customizable thickness and depth. ```lua local player = core.object_manager.get_local_player() local player_pos = player:get_position() -- 3D text at world position core.graphics.text_3d("Player", player_pos, 18, core.color.new(255, 255, 255, 255), true, 0) -- Lines in 3D space local target_pos = vec3.new(100, 200, 15) core.graphics.line_3d(player_pos, target_pos, core.color.new(255, 0, 0, 255), 3, 2.5, true) -- Circles for range indicators core.graphics.circle_3d(player_pos, 40, core.color.new(0, 255, 0, 255), 2, 2.5) -- Partial circles (percentage-based) local cast_percent = 0.75 core.graphics.circle_3d_percentage(player_pos, 5, core.color.new(255, 255, 0, 255), cast_percent, 2) -- Gradient circles core.graphics.circle_3d_gradient(player_pos, 30, core.color.new(255, 0, 0, 255), core.color.new(255, 255, 0, 255), core.color.new(0, 255, 0, 255), 2) -- Filled circle for AoE visualization core.graphics.circle_3d_filled(target_pos, 10, core.color.new(255, 0, 0, 100)) -- Cone visualization (for directional abilities) local facing_pos = player_pos + player:get_direction() * 20 core.graphics.cone_3d(player_pos, facing_pos, 15, 45, core.color.new(0, 255, 255, 100), 2.0) -- Rectangle in 3D core.graphics.rect_3d(player_pos, target_pos, 5, core.color.new(255, 255, 255, 255), 2, 2.5) ``` -------------------------------- ### Interact with Game Objects and Loot in Lua Source: https://context7.com/less-nefariousness5/psapi/llms.txt Provides Lua functions for interacting with game objects, looting corpses, and managing player states like death or ghost form. It requires access to game object properties and UI elements for loot processing. Output includes logs of looted items. ```lua -- Object interaction local gameobject = -- some game object (herb, ore, chest, etc.) if gameobject and gameobject:can_be_used() then core.input.use_object(gameobject) end -- Looting local corpse = -- dead enemy if corpse and corpse:can_be_looted() then core.input.loot_object(corpse) -- Process loot window local loot_count = core.game_ui.get_loot_item_count() for i = 1, loot_count do local is_gold = core.game_ui.get_loot_is_gold(i) local item_id = core.game_ui.get_loot_item_id(i) local item_name = core.game_ui.get_loot_item_name(i) core.log("Looting: " .. item_name .. " (ID: " .. item_id .. ")") core.input.loot_item(i) end core.input.close_loot() end -- Skinning if corpse and corpse:can_be_skinned() then core.input.skin_object(corpse) end -- Death handling if player:is_dead() or player:is_ghost() then core.input.release_spirit() end if player:is_ghost() then core.input.resurrect_corpse() end ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.