API

APEP API Reference


lTrim

  • This function removes leading whitespace characters (spaces, tabs, etc.) from a string.

Parameters

  • str(string): The input string to be trimmed.

Returns string

  • The input string with leading whitespace removed.

Example:

-- Removes leading whitespace characters.
local trimmedString = _A.lTrim("    Hello, world!")

rTrim

  • This function removes trailing whitespace characters (spaces, tabs, etc.) from a string.

Parameters

  • str(string): The input string to be trimmed.

Returns string

  • The input string with trailing whitespace removed.

Example:

-- Removes trailing whitespace characters.
local trimmedString = _A.rTrim("Hello, world!    ")

Trim

  • This function removes both leading and trailing whitespace characters (spaces, tabs, etc.) from a string.

Parameters

  • str(string): The input string to be trimmed.

Returns string

  • The input string with leading and trailing whitespace removed.

Example:

-- Removes leading and trailing whitespace characters.
local trimmedString = _A.Trim("    Hello, world!    ")

print

  • This function prints the specified arguments to the console with colorful output.

Parameters

  • ...(any): The arguments to print.

Example:

-- Prints the provided arguments with colorful output.
local mergedTable = _A.print("Hello", "world", "!")

RandomNumber

  • This function generates a random number within the specified range.

Parameters

  • min(number): The minimum value of the random number range.
  • max(number): The maximum value of the random number range.

Returns number

  • A random number within the specified range.

Example:

-- Generates a random number between 1 and 100.
local randomValue = _A.RandomNumber(1, 100)

RandomString

  • This function generates a random string of the specified length, containing both lowercase letters and digits.

Parameters

  • length(number): The length of the random string to generate.

Returns string

  • A random string of the specified length, containing a mix of lowercase letters and digits.

Example:

-- Generates a random string of length 10.
local randomStr = _A.RandomString(10)

ApepMod

  • This function calculates the remainder of the division of two numbers using the Mod algorithm. The algorithm ensures that the result is always positive and between 0 and b. It calculates the remainder by subtracting the floor division of a by b multiplied by b from a.

Parameters

  • a(number): The dividend for which the remainder is calculated.
  • b(number): The divisor.

Returns

  • remainder(number): The remainder of the division.

Example:

local result = _A.ApepMod(25, 7)

TableMerge

  • This function merges the contents of two tables. If a key in both tables corresponds to a table value, the function recursively merges those nested tables.

Parameters

  • t1(table): The first table to merge.
  • t2(table): The second table to merge.

Returns table

  • A table containing the merged contents of the two input tables.

Example:

local table1 = { a = 1, b = { x = 2, y = 3 } }
local table2 = { b = { y = 4, z = 5 }, c = 6 }
-- Merges the contents of the two tables.
local mergedTable = _A.TableMerge(table1, table2)

StrExplode

  • This function takes a string and a delimiter character, and returns a table of substrings obtained by splitting the input string at occurrences of the delimiter.

Parameters

  • str(string): The input string to be exploded.

Returns ...

  • Multiple return values representing the substrings obtained after splitting.

Example:

 -- Splits the input string into substrings.
local first, second, third = _A.StrExplode("apple,banana,orange", ",")

BagSpace

  • This function calculates the total number of free slots available across all bags.

Returns number

  • The total number of free slots available across all bags.

Example:

-- Get the total number of free slots across all bags
local freeSlots = _A.BagSpace()
print("Total free slots:", freeSlots)

SlotAliasInventorySlotNameSlotNumber
head or helmHeadSlot1
neck NeckSlot2
shoulderShoulderSlot3
shirtShirtSlot4
chestChestSlot5
belt or waistWaistSlot6
legs or pantsLegsSlot7
feet or bootsFeetSlot8
wrist or bracersWristSlot9
gloves or handsHandsSlot10
finger1Finger0Slot11
finger2Finger1Slot12
trinket1Trinket0Slot13
trinket2Trinket1Slot14
back or cloakBackSlot15
mainhand or weapon or weapon1MainHandSlot16
offhand or weapon2SecondaryHandSlot17
rangedRangedSlot18
tabardTabardSlot19

ItemEquip

  • This function equips an item in the specified slot

Parameters

  • NameOrID(string/number): The item name/ID
  • NameOrSlot(string/number): The slot name/number

Returns nil

Example:

-- Equip an item named "Sickle Axe" to the main hand slot
_A.ItemEquip("Sickle Axe", "MainHand")
-- Equip an item with ID 1602 to the SlotNumber 16 (Main Hand)
_A.ItemEquip(1602, 16)

ItemUnequip

  • This function unequips an item from a specified slot and places it in the backpack.

Parameters

  • NameOrSlot(string/number): The slot name/number

Returns number

  • Id(number): The ID of the unequipped item, or -1 if no item was found in the slot.

Example:

-- Unequip the Main Hand weapon
_A.ItemUnequip("MainHand")
-- Unequip the slot 16, where 16 is the SlotNumber for Main Hand
_A.ItemUnequip(16)

GetObjectCount

  • This function returns the total number of objects currently present in the object manager.

Returns

  • count(number): The number of objects in the object manager.

!> DEPRECATED

Example:

-- Retrieves the total number of objects in the object manager.
local objectCount = _A.GetObjectCount()

GetObjectWithIndex

  • This function takes an index as input and returns the pointer of the object with that index in the object manager.

Parameters

  • index(number): The index of the object to retrieve the pointer for.

Returns

  • pointer(string): The pointer of the object with the specified index.

!> DEPRECATED

Example:

-- Retrieves the total number of objects in the object manager.
local objectCount = _A.GetObjectCount()
-- Iterate through each object index and print its pointer.
for i=1, objectCount do
  print(_A.GetObjectWithIndex(i))
end

ObjectPointer

Parameters

  • object(string): The object.

Returns string or nil

  • The pointer as a hexadecimal string prefixed by 0x, or nil if the object does not exist.

!>Note: If the object doesn't exist, for example, ObjectPointer("party1target"), it returns nil. This API is mainly useful to get the object address of unitIDs like "target", "mouseover", etc. ObjectPointer("0xDEADBEEF") simply returns "0xDEADBEEF" and does NOT check if the address exists in the object manager. Avoid using this for arbitrary addresses.

Example:

_A.ObjectPointer("raid1")

ObjectExists

  • Get whether an object exists in the object manager with O(n) performance.

Parameters

  • object(string): The object.

Returns bool

  • true if object exists in the object manager, false otherwise.

Example:

_A.ObjectExists("part1target")

ObjectIsVisible

  • Get whether an object is visible in the object manager with O(1) performance.

Parameters

  • object(string): The object.

Returns bool

  • true if object is visible, false otherwise.

Example:

_A.ObjectIsVisible("0x10AE05BD")

ObjectPosition

  • Get an object's position.

Parameters

  • object(string): The object.

Returns number, number, number

  • The x, y, and z coordinates

!>Note: If the object doesn't exist, it returns (nil, nil, nil)

Example:

_A.ObjectPosition("mouseover")

ObjectFacing

  • Get an object's facing.

Parameters

  • object(string): The object.

Returns number

  • The facing (angle in xy) in radians

!>Note: If the object doesn't exist, it returns nil.

Example:

_A.ObjectFacing("player")

ObjectCreator

  • This function retrieves the GUID of the creator who created the specified fishing bobber object.

Parameters

  • object(string): The pointer of the object for which to retrieve the creator's pointer.

Return string

  • The pointer of the unit who created the object, or nil if the object or its creator's pointer is not available.

Example:

local objectPointer = "0x01234567"
-- Retrieves the pointer of the creator of the specified object.
local unitPointer = _A.ObjectCreator(objectPointer)

BobberCreator

  • This function retrieves the GUID of the creator of the fishing bobber object.

Parameters

  • object(string): The pointer of the fishing bobber object for which to retrieve the creator's GUID.

Returns string

  • The GUID of the creator who created the fishing bobber object, or nil if the object is not a valid.

Example:

local bobberPointer = "0x01234567"
-- Retrieves the GUID of the creator of the fishing bobber.
local creatorGUID = _A.BobberCreator(bobberPointer)

BobberIsAnimating

  • This function checks whether the specified fishing bobber object is currently animating, indicating that it has caught a fish.

Parameters

  • object(string): The fishing bobber object to check for animation.

Returns bool

  • true if the fishing bobber object is animating, indicating it has caught a fish, false otherwise.

Example:

local bobberPointer = "0x01234567"
-- Checks if the specified fishing bobber object is animating.
local isAnimating = _A.BobberIsAnimating(bobberPointer)

UnitTarget

  • This function takes a unit object and returns the target of that unit as its pointer and GUID.

Parameters

  • object(string): The unit object for which to retrieve the target.

Returns pointer, guid

  • guid(string): The GUID of the unit's target.
  • pointer(string): The pointer of the unit's target.

Example:

-- Retrieves the target of the 'mouseover'.
local GUID, pointer = _A.UnitTarget("mouseover")

UnitCastID

  • This function takes a unit object as a parameter and returns information about the unit's current cast, including its castID, channelID, GUID, and pointer.

Parameters

  • object(string): The unit object for which to retrieve the cast information.

Returns castId, channelID, guid, pointer

  • castId(number): The cast ID of the unit's current cast.
  • channelID(number): The channel ID of the unit's current channel.
  • guid(string): The GUID of the unit's cast.
  • pointer(string): The pointer of the unit's cast.

Example:

-- Retrieves the cast information of the 'target' unit.
local castId, channelID, tarGUID, tarPointer = _A.UnitCastID("target")
if castId==12345 then
    -- Do something
end

UnitIsFacing

  • This function checks whether the first unit is facing the second unit within the specified angle range.

Parameters

  • object1(string): The pointer or unitId of the first unit.
  • object2(string): The pointer or unitId of the second unit.
  • angle(number): [optional] The angle range (in degrees) within which the first unit is considered to be facing the second unit. Default is 180 degrees.

Returns

  • isFacing(bool): true if the first unit is facing the second unit within the specified angle range, false otherwise.

Example:

local angleThreshold = 90
 -- Checks if the player is facing the target within a 90-degree angle.
local isFacingTarget = _A.UnitIsFacing("player", "target", angleThreshold)

PositionIsFacingPosition

  • This function checks whether a position (defined by coordinates and facing angle) is facing another position within the specified angle range.

Parameters

  • oX(number): The X-coordinate of the position from which the facing angle originates.
  • oY(number): The Y-coordinate of the position from which the facing angle originates.
  • dX(number): The X-coordinate of the position to which the facing angle is directed.
  • dY(number): The Y-coordinate of the position to which the facing angle is directed.
  • oFacing(number): The facing angle (in radians) of the origin position.
  • angle(number): [optional] The angle range (in degrees) within which the origin position is considered to be facing the target position. Default is 180 degrees.

Returns

  • isFacing(bool): true if the origin position is facing the target position within the specified angle range, false otherwise.

Example:

local playerX, playerY = _A.ObjectPosition("player")
local playerFacing = _A.ObjectFacing("player")
local targetX, targetY = _A.ObjectPosition("target")
local angleThreshold = 90
local isFacingTarget = _A.PositionIsFacingPosition(playerX, playerY, targetX, targetY, playerFacing, angleThreshold)

UnitSpec

  • This function retrieves the specialization ID of the specified unit(player).

Parameters

  • unit(string): The unit for which to retrieve the specialization ID.

Returns number

  • The specialization ID of the unit, or nil if the unit is invalid.

Example:

local specId = _A.UnitSpec("target")
print(specId)

ObjectID

ObjectID || ObjectEntry

  • This function retrieves the entry ID of an object identified by its pointer.

Parameters

  • object(string): The pointer or object identifier (e.g., "player", "target", or a pointer value).

Returns

  • entryID(number): The entry ID of the object, or nil if the object pointer is invalid or not found.

Example:

local targetEntryID = _A.ObjectID("target")

ObjectID_GUID

  • This function retrieves the entry ID and GUID of an object identified by its pointer or object identifier.

Parameters

  • object(string): The pointer or object identifier (e.g., "player", "target", or a pointer value).

Returns entryID, guid

  • entryID(number): The entry ID of the object, or nil if the object pointer is invalid or not found.
  • guid(string): The GUID of the object, or nil if the object pointer is invalid or not found.

Example:

local targetEntryID, targetGUID = _A.ObjectID_GUID("target")

ObjectRawType

  • This function retrieves the raw type of an object identified by its pointer or object identifier. The raw type provides information about the object's category, such as player, unit, item, game object, etc.

Parameters

  • object(string): The pointer or object identifier (e.g., "player", "target", or a pointer value).

Returns

  • objectType(number): The raw type of the object, or nil if the object pointer is invalid or not found.

Example:

local targetType = _A.ObjectRawType("target")

ObjectIsUnit

  • This function checks whether the specified object is of the type "Unit", or any related subtypes such as "Player" or "ActivePlayer".

Parameters

  • object(string): The pointer or object identifier of the object to check.

Returns

  • isUnit(bool): true if the object is a unit or related subtype, false otherwise.

Example:

local isUnit = _A.ObjectIsUnit("target")

ObjectIsPlayer

  • This function checks whether the specified object is of the type "Player" or "ActivePlayer".

Parameters

  • object(string): The pointer or object identifier of the object to check.

Returns

  • isPlayer(bool): true if the object is a player or active player, false otherwise.

Example:

local isPlayer = _A.ObjectIsPlayer("target")

ObjectIsGameObject

  • This function checks whether the specified object is of the type "GameObject".

Parameters

  • object(string): The pointer or object identifier of the object to check.

Returns

  • isGameObject(bool): true if the object is a game object, false otherwise.

Example:

local isGameObject = _A.ObjectIsGameObject("0x12345678")

ObjectIsAreaTrigger

  • This function checks whether the specified object is of the type "AreaTrigger".

Parameters

  • object(string): The pointer or object identifier of the object to check.

Returns

  • isAreaTrigger(bool): true if the object is an area trigger, false otherwise.

Example:

local isAreaTrigger = _A.ObjectIsAreaTrigger("0x12345678")

UnitCombatReach

  • This function retrieves the combat reach (melee attack range) of the specified unit.

Parameters

  • object(string): The pointer or unit identifier of the unit to get the combat reach for.

Returns

  • combatReach(number): The combat reach of the unit, in yards.

Example:

local targetCombatReach = _A.UnitCombatReach("target")

UnitHeight

  • This function retrieves the height of the specified unit.

Parameters

  • object(string): The pointer or unit identifier of the unit to get the height for.

Returns

  • height(number): The height of the unit, in yards.

Example:

local playerHeight = _A.UnitHeight("player")

GetObjectWithGUID

  • This function retrieves the object's pointer using its globally unique identifier (GUID).

Parameters

  • guid(string): The GUID of the object.

Returns

  • pointer(number|nil): The pointer of the object, or nil if the object was not found.

Example:

local guid = _G.UnitGUID("target")
local targetPointer = _A.GetObjectWithGUID(guid)

GetDistanceBetweenPositions

  • This function calculates the Euclidean distance between two 3D positions in the game world.

Parameters

  • X1(number): The X coordinate of the first position.
  • Y1(number): The Y coordinate of the first position.
  • Z1(number): The Z coordinate of the first position.
  • X2(number): The X coordinate of the second position.
  • Y2(number): The Y coordinate of the second position.
  • Z2(number): The Z coordinate of the second position.

Returns

  • distance(number): The distance between the two positions.

Example:

local distance = _A.GetDistanceBetweenPositions(100, 200, 0, 150, 250, 10)
print("Distance:", distance)

GetDistanceBetweenObjects

  • This function calculates the distance between two objects.

Parameters

  • object1(string): The unitId or pointer of the first game object.
  • object2(string): The unitId or pointer of the second game object.

Returns

  • distance(number): The distance between the two objects, or nil if positions couldn't be retrieved.

Example:

local distance = _A.GetDistanceBetweenObjects("player", "0x87654321")
print("Distance:", distance)

GetRangeBetweenObjects

  • This function calculates the range between two objects while taking into account their combat reach.

Parameters

  • object1(string): The unitId or pointer of the first game object.
  • object2(string): The unitId or pointer of the second game object.

Returns

  • range(number): The effective range between the two objects, considering combat reaches.

Example:

local range = _A.GetRangeBetweenObjects("player", "0x87654321")
print("Range:", range)

GetPositionFromPosition

  • This function calculates a new position in three-dimensional space based on a starting position (X, Y, Z), a specified distance, and two angles (Angle1 and Angle2). It uses trigonometric functions to calculate the new coordinates and returns the calculated X, Y, and Z values.

Parameters

  • X(number): The X coordinate of the starting position.
  • Y(number): The Y coordinate of the starting position.
  • Z(number): The Z coordinate of the starting position.
  • Distance(number): The distance from the starting position to the new position.
  • Angle1(number): The angle (in radians) in the XY plane (horizontal plane) from the positive X-axis.
  • Angle2(number): The angle (in radians) between the XY plane and the line connecting the starting position and the new position.

Returns newX, newY, newZ

  • newX(number): The calculated X coordinate of the new position.
  • newY(number): The calculated Y coordinate of the new position.
  • newZ(number): The calculated Z coordinate of the new position.

Example:

local newX, newY, newZ = _A.GetPositionFromPosition(100, 100, 0, 10, math.rad(45), math.rad(30))
print("Distance:", distance)

GetAnglesBetweenPositions

  • This function calculates the yaw and pitch angles between two 3D positions.

Parameters

  • X1(number): The X coordinate of the first position.
  • Y1(number): The Y coordinate of the first position.
  • Z1(number): The Z coordinate of the first position.
  • X2(number): The X coordinate of the second position.
  • Y2(number): The Y coordinate of the second position.
  • Z2(number): The Z coordinate of the second position.

Returns pitch, yaw

  • yaw(number): The yaw angle in radians between the two positions.
  • pitch(number): The pitch angle in radians between the two positions.

Example:

local yaw, pitch = _A.GetAnglesBetweenPositions(0, 0, 0, 10, 10, 10)
print("Yaw angle:", yaw) -- left-right rotation around the Z axis.
print("Pitch angle:", pitch) -- up-down rotation around the X axis.

GetAnglesBetweenObjects

  • This function calculates the yaw and pitch angles between two objects.

Parameters

  • object1(string): The unitId or pointer of the first game object.
  • object2(string): The unitId or pointer of the second game object.

Returns

  • yaw(number): The yaw angle in radians between the two objects.
  • pitch(number): The pitch angle in radians between the two objects.

Example:

local yaw, pitch = _A_.GetAnglesBetweenObjects("player", "target")
print("Yaw angle:", yaw) -- left-right rotation around the Z axis.
print("Pitch angle:", pitch) -- up-down rotation around the X axis.

GetPositionBetweenPositions

  • This function calculates a new position between two given positions based on a specified distance.

Parameters

  • X1(number): The X coordinate of the first position.
  • Y1(number): The Y coordinate of the first position.
  • Z1(number): The Z coordinate of the first position.
  • X2(number): The X coordinate of the second position.
  • Y2(number): The Y coordinate of the second position.
  • Z2(number): The Z coordinate of the second position.
  • distance(number): The distance from the first position where the new position should be calculated.

Returns newX, newY, newZ

  • newX(number): The X coordinate of the new position.
  • newY(number): The Y coordinate of the new position.
  • newZ(number): The Z coordinate of the new position.

Example:

local newX, newY, newZ = _A.GetPositionBetweenPositions(100, 200, 0, 150, 250, 0, 10)
print("New position:", newX, newY, newZ)

GetPositionBetweenObjects

  • This function calculates a new position between the positions of two given objects based on a specified distance from the first object.

Parameters

  • object1(string): The unitId or pointer identifier of the first object.
  • object1(string): The unitId or pointer identifier of the second object.
  • distance(number): The distance from the first object where the new position should be calculated.

Returns newX, newY, newZ

  • newX(number): The X coordinate of the new position.
  • newY(number): The Y coordinate of the new position.
  • newZ(number): The Z coordinate of the new position.

Example:

local newX, newY, newZ = _A.GetPositionBetweenObjects("player", "0x789ABC", 10)
print("New position:", newX, newY, newZ)

ObjectIsFacing

  • This function checks if the first object is facing the second object.

Parameters

  • object1(string): The unitId or pointer identifier of the first object.
  • object1(string): The unitId or pointer identifier of the second object.

Returns

  • isFacing(bool): true if the first object is facing the second object, otherwise false.

Example:

if _A.ObjectIsFacing("player", "0x789ABC") then
    print("The player is facing the second object.")
else
    print("The player is not facing the second object.")
end

ObjectIsBehind

  • This function checks if the first object is behind the second object.

Parameters

  • object1(string): The unitId or pointer identifier of the first object.
  • object1(string): The unitId or pointer identifier of the second object.

Returns

  • isBehind(bool): true if the first object is behind the second object, otherwise false.

Example:

if _A.ObjectIsBehind("player", "0x789ABC") then
    print("The player is behind the second object.")
else
    print("The player is not behind the second object.")
end

TraceLine

  • This function traces a line between two points in the game world to determine if there is line of sight between those points. It uses the provided flags to control the behavior of the trace.

Parameters

  • sX(number): The X-coordinate of the starting point.
  • sY(number): The Y-coordinate of the starting point.
  • sZ(number): The Z-coordinate of the starting point.
  • eX(number): The X-coordinate of the ending point.
  • eY(number): The Y-coordinate of the ending point.
  • eZ(number): The Z-coordinate of the ending point.
  • flags(number): [optional] Flags to control the trace behavior. Default is 0x0.

Returns los, cX, cY, cZ

  • los(bool): true if there is line of sight between the points, false otherwise.
  • cX(number): The X-coordinate of the point of collision.
  • cY(number): The Y-coordinate of the point of collision.
  • cZ(number): The Z-coordinate of the point of collision.

!>Note: Flags allow you to control the specific types of objects and conditions that are considered when performing a line of sight check between two points in the game world. You can customize the behavior of the trace based on the nature of the obstacles you want to account for in the line of sight calculation.

FlagCollisionNote
0x0noneNo special behavior or considerations.
0x1doodadTake doodad collision into account during collision checks. Doodads are objects like props and decorations in the game world.
0x2doodad renderDoodad rendering during collision checks.
0x10wmoWorld Map Object (WMO) collision during collision checks. WMOs are complex structures like buildings.
0x20wmo renderWMO rendering during collision checks.
0x40Wmo no camExclude WMO collision with the camera.
0x100terrainInclude terrain collision in checks.
0x2000wmo doodadIgnore collision and interaction between WMOs and doodads.
0x10000liquid water walkableConsider water as walkable during collision checks.
0x20000liquid allInclude all liquid surfaces (water, lava, etc.) in collision checks.
0x80000cullPerform culling behavior to determine what should be rendered or not.
0x100000entityMovable objects (objects that can be interacted with or moved) should be considered when performing the line of sight check.
0x200000entity renderConsider entity rendering during collision checks.

Example:

local px, py, pz = _A.ObjectPosition("player")
local tx, ty, tz = _A.ObjectPosition("target")
local flags = bit.bor(0x100000, 0x10000, 0x100, 0x10, 0x1)

local los, cx, cy, cz = _A.TraceLine(px, py, pz, tx, ty, tz, flags)
if los then
  print("There is line of sight between the points.")
else
  print("There is an obstruction between the points.")
end
print("Collision point:", cx, cy, cz)

WorldToScreen

  • This function takes 3D world coordinates and converts them to screen coordinates. It returns the X and Y screen coordinates along with a flag indicating whether the coordinates are on the screen or not.

Parameters

  • x(number): The X-coordinate in the 3D world.
  • y(number): The Y-coordinate in the 3D world.
  • z(number): The Z-coordinate in the 3D world.

Returns

  • sX(number): The X-screen coordinate.
  • sY(number): The Y-screen coordinate.
  • onScreen(bool): true if the coordinates are on the screen, false otherwise.

Example:

local tx, ty, tz = _A.ObjectPosition("target")
local screenX, screenY, isOnScreen = _A.WorldToScreen(tx, ty, tz)
if isOnScreen then
    print("The target World coordinates are visible on the screen.")
else
    print("The target World coordinates are not visible on the screen.")
end

ScreenToWorld

  • This function converts screen coordinates to 3D world coordinates. It returns (X, Y, Z) along a flag indicating whether the coordinates collided or not with any object in the game world based on the hit flags.

Parameters

  • x(number): The screen X-coordinate.
  • y(number): The screen Y-coordinate.
  • hitFlags(number) - Optional. Flags specifying the type of collision detection. Defaults to (0x100000 | 0x10000 | 0x100 | 0x10 | 0x1).

Returns

  • collision (boolean) - Indicates whether the screen coordinates collided or not with any object in the game world based on the hit flags.
  • x(number): The X-coordinate in the 3D world.
  • y(number): The Y-coordinate in the 3D world.
  • z(number): The Z-coordinate in the 3D world.

!>Note: Hit Flags allow you to control the specific types of objects and conditions.

FlagCollisionNote
0x0noneNo special behavior or considerations.
0x1doodadTake doodad collision into account during collision checks. Doodads are objects like props and decorations in the game world.
0x2doodad renderDoodad rendering during collision checks.
0x10wmoWorld Map Object (WMO) collision during collision checks. WMOs are complex structures like buildings.
0x20wmo renderWMO rendering during collision checks.
0x40Wmo no camExclude WMO collision with the camera.
0x100terrainInclude terrain collision in checks.
0x2000wmo doodadIgnore collision and interaction between WMOs and doodads.
0x10000liquid water walkableConsider water as walkable during collision checks.
0x20000liquid allInclude all liquid surfaces (water, lava, etc.) in collision checks.
0x80000cullPerform culling behavior to determine what should be rendered or not.
0x100000entityMovable objects (objects that can be interacted with or moved) should be considered when performing the collision check.
0x200000entity renderConsider entity rendering during collision checks.

Example:

do
	local collision, x, y, z
	_A.C_Timer.NewTicker(0.1, function()
		if _A.IsMouseButtonDown(2) then
			local mX, mY = _A.GetCursorPosition()
			collision, x, y, z = _A.ScreenToWorld(mX, mY)	
		end
	end)

	local function draw()
		if x and y and z then
			_A.LibDraw:Circle(x, y, z)
		end
	end

	_A.Core:WhenInGame(function()
		_A.LibDraw:Sync(draw)
		_A.LibDraw:Enable(0.01)	
	end)
end

ClickPosition

  • This function simulates a mouse click at the specified 3D world position.

Parameters

  • x(number): The X-coordinate in the 3D world.
  • y(number): The Y-coordinate in the 3D world.
  • z(number): The Z-coordinate in the 3D world.

Example:

-- Click at the "target" position.
_A.ClickPosition(_A.ObjectPosition("target"))

ClickToMove

  • This function initiates a click-to-move action, causing the player or controlled entity to move to the specified 3D world position.

Parameters

  • x(number): The X-coordinate in the 3D world.
  • y(number): The Y-coordinate in the 3D world.
  • z(number): The Z-coordinate in the 3D world.

Example:

-- Move to the "target" position.
_A.ClickToMove(_A.ObjectPosition("target"))

IsForeground

  • This function determines whether the game window is currently in the foreground (active) state, meaning it has focus and user interaction is being accepted.

Returns

  • isForeground(bool): true if the game window is in the foreground, false otherwise.

Example:

local gameInForeground = _A.IsForeground()
if gameInForeground then
    print("The game window is in the foreground.")
else
    print("The game window is not in the foreground.")
end

IsMinimized

  • This function determines whether the game window is currently minimized (Only exists on the Wotlk, Cata, Mop Apep version).

Returns

  • IsMinimized(bool): true if the game window is minimized, false otherwise.

Example:

local gameMinimized = _A.IsMinimized()
if gameMinimized then
    print("The game window is minimized.")
else
    print("The game window is not minimized.")
end

GetKeyState

  • This function retrieves the state of a specific key, including whether it is currently pressed and whether it is toggled (such as caps lock).

Parameters

  • Key(number): The virtual key code of the keyboard key to check.

Returns

  • isDown(bool): true if the key is currently pressed, false otherwise.
  • isToggled(bool): true if the key is toggled (such as caps lock), false otherwise.

!>Note: Virtual key codes are used to identify keyboard keys in Windows applications. You can obtain these key codes from the official Microsoft documentation. https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

Example:

local pressed, toggled = _A.GetKeyState(65)-- The key code for the 'A' key
if pressed then
    print("The 'A' key is currently pressed.")
end
if toggled then
    print("The 'A' key is toggled (e.g., caps lock is on).")
end

IsKeyDown

  • This function checks if a specific key is currently being held down (pressed) on the keyboard.

Parameters

  • Key(string): The name of the key to check, e.g., "A", "F1", "NUMPAD0", "SPACE".

Returns

  • isKeyDown(bool): true if the key is currently being held down, false otherwise.

Example:

if f.IsKeyDown("F") then
    print("The 'F' key is currently being held down.")
end

SendKey

  • This function simulates sending a key press event to the application using the provided DirectInput Key Code.

Parameters

  • Key(number): The DirectInput Key Code corresponding to the key to be simulated.

!>Note: For a list of key codes http://www.flint.jp/misc/?q=dik&lang=en

Example:

_A.SendKey(0x41) -- Simulates pressing the 'A' key

SetFacing

  • This function sets the facing angle of the player to the specified angle in radians.

Parameters

  • angle(number): The desired facing angle in radians.

Example:

 -- Sets the player's facing angle to 0 degrees(facing north).
_A.SetFacing(0)
 -- Sets the player's facing angle to 180 degrees(facing south).
_A.SetFacing(math.pi)

FaceDirection

  • This function set the player's facing direction to a specific angle or towards a specified object.

Parameters

  • angleOrObject(number or string): The angle in radians or the object to face.
  • update(bool): [optional] Whether to immediately notify the server

Example:

 -- Sets the player's facing angle to 0 degrees(facing north). And notify the server.
_A.FaceDirection(0, true)
 -- Face towards the object and notify the server.
_A.FaceDirection("target", true)

FaceTarget

  • This function face the player towards the currently targeted object

Example:

 -- Face the player towards the currently targeted object
_A.FaceTarget()

InvertFacing

  • This function invert the player's facing direction

Example:

  -- Invert the player's facing direction
_A.InvertFacing()

GetWoWDirectory

  • This function retrieves the directory path where the World of Warcraft game is installed on your system.

Returns

  • dir(string): The directory path of the World of Warcraft installation.

Example:

local wowDirectory = _A.GetWoWDirectory()
print(wowDirectory)

GetDirectoryFiles

  • This function retrieves the names of the files in the specified directory path.

Parameters

  • path(string): The path to the directory.
  • subfolders (boolean) - If (true) include subfolders

Returns

  • files(table): A table containing the file names in the directory.

Example:

local wowDirectory = _A.GetWoWDirectory()
local files = _A.GetDirectoryFiles(wowDirectory, true)
for _, fileName in ipairs(files) do
    print(fileName)
end

GetDirectoryFolders

  • This function retrieves the names of the folders in the specified directory path.

Parameters

  • path(string): The path to the directory.
  • subfolders (boolean) - If (true) include subfolders

Returns

  • files(table): A table containing the folder names in the directory.

Example:

local wowDirectory = _A.GetWoWDirectory()
local folders = _A.GetDirectoryFolders(wowDirectory, false)
for _, folderName in ipairs(folders) do
    print(folderName)
end

GetApepDirectory

  • This function retrieves the directory path where the Apep executable is on your system.

Returns

  • directory(string): The directory path of the Apep executable.

Example:

local apepDirectory = _A.GetApepDirectory()
print(apepDirectory)

ReadFile

  • This function reads and retrieves the contents of a text file specified by the given file path.

Parameters

  • path(string): The path to the text file.

Returns

  • content(string): The contents of the text file.

Example:

local wowDirectory = _A.GetWoWDirectory()
local contents = _A.ReadFile(wowDirectory.."\\example.txt")
print(contents)

WriteFile

  • This function appends the specified text to a file or overwrites the file's content, based on the given options.

Parameters

  • path(string): The path to the text file.
  • text(string): The text to be written or appended.
  • append(bool): If true, the text will be appended; if false, the file content will be overwritten.

Returns

  • success(bool): true if the operation was successful, or an exception if an error occurred.

Example:

local wowDirectory = _A.GetWoWDirectory()
local success = _A.WriteFile(wowDirectory.."\\hello.txt", "Hello, World!", true)
if success then
    print("Text appended successfully.")
else
    print("Error occurred while writing to the file")
end

LoadScript

  • This function loads and executes a Lua script located at the specified file path.

Parameters

  • path(string): The path to the Lua script file.

Example:

local wowDirectory = _A.GetWoWDirectory()
_A.LoadScript(wowDirectory.."\\scripts\\start.lua")

BaseAddress

  • This function returns the base address of the World of Warcraft client, which can be used with other functions like ReadMemory to read specific offsets within the game's memory.

Returns

  • baseAddr(string): The base address of the World of Warcraft client in hexadecimal format.

Example:

local baseAddr = _A.BaseAddress()
print(baseAddr)

ReadMemory

  • This function reads memory at the specified address and returns the requested type of data.

Parameters

  • type(string): The type of data to read (e.g., "bool", "byte", "string", "float", etc...).
  • address(string or number): The address in hexadecimal format (string) or numeric address.
  • offset(string or number): The offset of the address.

Returns

  • The requested type of data (e.g., boolean, number, string, etc.).

    TypeReturn
    boolbool
    bytenumber
    stringstring
    floatnumber
    doublenumber
    Int16/shortstring
    UInt16/ushortstring
    Int32/intstring
    UInt32/uintstring
    Int64/longstring
    UInt64/ulongstring
    Int128string
    GUIDstring

Example:

local result = _A.ReadMemory("int", "0x12345678", 0x10)

CancelPendingSpell

  • This function cancels the pending queued spell cast, if there is any.

!>Note: When you cast a spell in WoW, and you are in the middle of a combat action, the spell is queued up to be cast when that one is done, up to a maximum number of 1 spell. This feature was implemented to help players compensate for high latency. If you cancel your current spell, the queued spell is cancelled as well. This command lets you cancel the queued spell without cancelling your current spell.

Example:

_A.CancelPendingSpell()

base64:encode

  • This function Encode a normal bytestring into a Base64-encoded string.

Parameters

  • text(string): a bytestring, can be binary data.
  • maxLineLength(number): This should be a multiple of 4, greater than 0 or nil. If non-nil, it will break up the output into lines no longer than the given number of characters. 76 is recommended.
  • lineEnding(string): a string to end each line with. This is "\r\n" by default.

Returns

  • A Base64-encoded string

Example:

local encoded = _A.base64:encode("Hello, how are you doing today?")
print(encoded) -- returns "SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw=="

base64:decode

  • This function Decode a Base64-encoded string into a bytestring.

Parameters

  • text(string): a Base64-encoded string.

Returns

  • A bytestring.

Example:

local decoded = _A.base64:decode("SGVsbG8sIGhvdyBhcmUgeW91IGRvaW5nIHRvZGF5Pw==")
print(decoded) -- returns "Hello, how are you doing today?"

json:encode

  • This function Encodes an arbitrary Lua object / variable.

Parameters

  • object: Lua value (table/string/boolean/number/nil/json.null/json.empty) to be JSON-encoded.

Returns

  • A string containing the JSON encoding.

Example:

local table = {
   ["test 1"] = {data=0, data1="xxx"},
   ["test 2"] = {data=234, data1="sdfee"}
}
local json = _A.json:encode(table)
print(json) -- returns '{"test 1":{"data":0,"data1":"xxx"},"test 2":{"data":234,"data1":"sdfee"}}'

json:decode

  • This function Decodes a JSON string and returns the decoded value as a Lua data structure / value.

Parameters

  • string: The string to scan (or "loader function" for getting next substring).
  • number(optional): The position inside s to start scan, default = 1

Returns(Lua object)

  • The object that was scanned, as a Lua table / string / number / boolean / json.null / json.empty.

Example:

local table = {
   ["test 1"] = {data=0, data1="xxx"},
   ["test 2"] = {data=234, data1="sdfee"}
}
local LuaObject = _A.json:decode('{"test 1":{"data":0,"data1":"xxx"},"test 2":{"data":234,"data1":"sdfee"}}')
print(LuaObject) --returns table: 000005D740CC4AF1

http:request

  • This function allows you to make HTTP/HTTPS requests with specified parameters.

Parameters

  • method(string): The HTTP method, either "GET" or "POST".
  • url(string): The URL to make the HTTP request to.
  • data(string): The data to be sent with the request. For "GET" requests, this should be a valid query string.
  • callback(function): The callback function to handle the response.
  • headers(string): Additional headers to include in the request.

Returns

This function doesn't return anything. It's asynchronous. Use the Callback for that.

Usage:

local headers = [[
Authentication: c2VjcmV0
X-Secret-Auth-Token: foo
User-Agent: LUA-Script
]]

_A.http:request("POST", "https://httpbin.org/post", "name=John Doe&occupation=gardener",
   function(body, code, req, res, err)
      print(body)   -- contents that were downloaded
      print(code) -- string - HTTP Response Code
      print(req)  -- string - Full HTTP Request
      print(res)  -- string - Full HTTP Response
      print(err)  -- string - Some internal Socket Error
   end,
   headers
)

Example of how to send a message to discord:

local name = _G.UnitName("player")
local message = "Name: "..name.."\nServer: ".._G.GetRealmName()
local data = {
    embeds = {
        title = "[webhook example]",
        description = message,
        color =  0xFFFF00
    }
}
local json = _A.json:encode(data):gsub(':{', ':[{'):gsub('}}', '}]}')
local url = "https://discord.com/api/webhooks/2163585181114123568/audZXgLO88RBDOUrUiWLXqu9AHya_ZAQD0HT2cQaf0Ijs-aON2peZ6j-Ol6mURqIeC3EC"

_A.http:request("POST", url, json, function() end)

GetMissiles

  • This function get information about active missiles in the game world.

Returns

  • A table containing information about active missiles, or an empty table if there are no missiles.
-- The table has the following structure:
{
   [1] = {
        spellid,       -- ID of the spell associated with the missile
        spellvisualid, -- ID of the spell's visual missile effect (NOTE: Non-existent in versions prior Legion.)
        x,             -- X-coordinate of the missile's current position
        y,             -- Y-coordinate of the missile's current position
        z,             -- Z-coordinate of the missile's current position
        caster,        -- GUID of the caster of the missile
        fx,            -- X-coordinate of the fired position
        fy,            -- Y-coordinate of the fired position
        fz,            -- Z-coordinate of the fired position
        target,        -- GUID of the missile's target
        ix,            -- X-coordinate of the impact position
        iy,            -- Y-coordinate of the impact position
        iz,            -- Z-coordinate of the impact position
    },
    [n] = {
        -- Information about the next missile, if available
    },
}

Example:

local missiles = _A.GetMissiles()
for _, missile in ipairs(missiles) do
    local spellid, x, y, z, caster, fx, fy, fz, target, ix, iy, iz = unpack(missile) -- prior Legion
    --local spellid, spellvisualid, x, y, z, caster, fx, fy, fz, target, ix, iy, iz = unpack(missile) 
    print(SpellId, x, y, z, caster, fx, fy, fz, target, ix, iy, iz)
end

Previous
Understanding apep