Skip to content

Client API Reference

Availability

Client-side Lua is only available in S21.1-2. Other versions do not have client Lua support.

The client-side Lua API runs inside the Main.dll module and allows you to customize the game client's UI, handle input, access game memory, and communicate with the server via custom packets.


Global Variables

Variable Type Description
Hero table Current player's character data (position, stats, state)
CharacterAttribute table Player stats and attributes (STR, AGI, VIT, ENE, CMD)
Mouse table Mouse position (Mouse.X, Mouse.Y) and button state

Rendering Functions

LoadInterface(filePath, imageId, startX, startY, width, height)

Loads a texture/image for rendering on screen.

LoadInterface("Data\\Custom\\MyUI.tga", 100, 0, 0, 256, 256)

RenderImage(imageId, x, y, width, height)

Draws a previously loaded image on screen at the specified position.

RenderImage(100, 400, 300, 128, 128)

Text Rendering

Function Description
UIRenderText_Left(x, y, text, r, g, b) Render left-aligned text
UIRenderText_Center(x, y, text, r, g, b) Render centered text
UIRenderText_Right(x, y, text, r, g, b) Render right-aligned text
UIRenderText_Center(320, 50, "Hello World!", 255, 255, 0)

Alpha Blending

Function Description
EnableAlphaBlend() Enable alpha blending for transparent rendering
DisableAlphaBlend() Disable alpha blending

Input Functions

Function Description
SEASON3B_IsPress(key) Check if key is currently pressed
SEASON3B_IsRelease(key) Check if key was just released
SEASON3B_IsRepeat(key) Check if key is held down (repeat)
GetMouseX() Returns current mouse X position
GetMouseY() Returns current mouse Y position
IsWriteInterfaceOpen() Returns true if a text input is active
if SEASON3B_IsPress(0x54) then -- 'T' key
    UIRenderText_Center(320, 240, "T is pressed!", 0, 255, 0)
end

Network (Packet) Functions

Send and receive custom packets between client and server.

Reading Packets

Function Description
PacketGetByte(packet, offset) Read a BYTE (1 byte) from packet
PacketGetWord(packet, offset) Read a WORD (2 bytes) from packet
PacketGetDword(packet, offset) Read a DWORD (4 bytes) from packet
PacketGetFloat(packet, offset) Read a float (4 bytes) from packet
PacketGetDouble(packet, offset) Read a double (8 bytes) from packet

Sending Packets

Function Description
PacketSend(packetFormat) Sends a formatted packet to the server
-- Send a custom packet to the server
PacketSend("\xC1\x04\xF3\x01")

Memory Functions

Advanced

Memory functions provide direct access to the game client's memory. Incorrect usage can crash the client.

Write Functions

Function Description
SetByte(offset, value) Write a BYTE to memory
SetWord(offset, value) Write a WORD (2 bytes) to memory
SetDword(offset, value) Write a DWORD (4 bytes) to memory
SetFloat(offset, value) Write a float to memory
SetDouble(offset, value) Write a double to memory

Read Functions

Function Description
GetByte(offset) Read a BYTE from memory
GetWord(offset) Read a WORD from memory
GetDword(offset) Read a DWORD from memory
GetFloat(offset) Read a float from memory
GetDouble(offset) Read a double from memory

Bulk Operations

Function Description
MemoryCpy(offset, hexString) Copy hex data to memory
MemorySet(offset, byteValue, size) Fill memory region with a value
-- Read a value from memory
local value = GetDword(0x12345678)

-- Fill a memory region
MemorySet(0x12345678, 0x90, 5)

Event Registration

Register Lua functions to be called on specific client events:

LuaEventAttach("OnRender", function()
    UIRenderText_Left(10, 10, "Custom UI Text", 255, 255, 255)
end)

LuaEventAttach("OnKeyPress", function(key)
    if key == 0x74 then -- F5
        PacketSend("\xC1\x04\xF3\x01")
    end
end)