Skip to content

Libraries

hanbot

hanbot.path

Return Value

string returns hanbots working directory

hanbot.luapath

Return Value

string returns directory of non-shard scripts

hanbot.libpath

Return Value

string returns directory of community libraries

hanbot.shardpath

Return Value

string returns directory of shards

hanbot.hwid

Return Value

string returns current users hwid

hanbot.user

Return Value

string returns current users id

hanbot.language

Return Value

number returns language id

cb

Enums:

  • cb.draw_first (cb.draw2)
  • cb.sprite (cb.draw_sprite)
  • cb.draw
  • cb.draw_world
  • cb.draw_under_hud
  • cb.tick
  • cb.pre_tick
  • cb.spell
  • cb.keyup
  • cb.keydown
  • cb.issueorder
  • cb.issue_order
  • cb.castspell
  • cb.cast_spell
  • cb.attack_cancel
  • cb.cast_finish
  • cb.play_animation
  • cb.delete_minion
  • cb.create_minion
  • cb.delete_particle
  • cb.create_particle
  • cb.delete_missile
  • cb.create_missile
  • cb.buff_gain
  • cb.buff_lose
  • cb.path
  • cb.set_cursorpos
  • cb.error

drawing order:

cb.draw_world (game pipeline) ->

cb.draw_mouse_overs (game pipeline) ->

cb.draw_under_hud (game pipeline) ->

cb.draw_first (hanbot pipeline) ->

cb.draw_sprite (hanbot pipeline) ->

cb.draw (hanbot pipeline)

  • ALWAYS prepare your drawings in cb.tick, DONT do too much calculations in drawing callback
  • The draw_world/draw_mouse_overs/draw_under_hud pipelines will be combined to hanbot pipeline if obs_bypass is enabled in core menu.

cb.add(t, f)

Parameters

number t

function f

Return Value

void

local tick_n = 0
local function on_tick()
	tick_n = tick_n + 1
	print(tick_n)
end

cb.add(cb.tick, on_tick)

cb.remove(f)

Parameters

function f

Return Value

void

local tick_n = 0
local function on_tick()
	tick_n = tick_n + 1
	if tick_n == 10 then
		print('removed')
		cb.remove(on_tick)
	end
end

cb.add(cb.tick, on_tick)

Callbacks with no arguments

The following callbacks have no arguments:

  • cb.pre_tick
  • cb.tick
  • cb.draw_first
  • cb.draw
  • cb.sprite

cb.draw_first is triggered before cb.sprite, while cb.draw is triggered after cb.sprite.

cb.keydown and cb.keyup

Both have a single arg, key_code:

lua
local function on_key_down(k)
	if k==49 then
		print('the 1 key is down')
	end
end

local function on_key_up(k)
	if k==49 then
		print('the 1 key is up')
	end
end

cb.add(cb.keydown, on_key_down)
cb.add(cb.keyup, on_key_up)

cb.spell

Has a single arg, spell.obj:

lua
local function on_process_spell(spell)
	print(spell.name, spell.owner.charName)
end

cb.add(cb.spell, on_process_spell)

cb.issueorder

Has three args: order_type, pos, obj:

INFO

Note that cb.issueorder will only work for hanbot internal request, user's manual movement/attack will not trigger this event.

lua
local function on_issue_order(order, pos, obj)
	if order==2 then
		print(('move order issued at %.2f - %.2f'):format(pos.x, pos.z))
	end
	if order==3 then
		print(('attack order issued to %u'):format(obj))
	end
end

cb.add(cb.issueorder, on_issue_order)

cb.issue_order

Just a better version of cb.issueorder.

Args: IssueOrderArgs:

  • boolean args.process
  • number args.order
  • vec3 args.pos
  • obj args.target
  • boolean args.isShiftPressed
  • boolean args.isAltPressed
  • boolean args.shouldPlayOrderAcknowledgementSound
  • boolean args.isFromUser

Now cb.issue_order will be triggered for all requests (include manual click).

WARNING

If you want to change the target or pos of issue_order, please use orb.combat.register_f_pre_tick and TS.filter, using cb.issue_order is not recommended, it will cause lots logic problems.

lua
local function on_issue_order(args)
	if args.order==2 then
		print(('move order issued at %.2f - %.2f'):format(args.pos.x, args.pos.z))
		return
	end
	
	if args.order==3 then
		print(('attack order issued to %u'):format(args.target.ptr))
		return
	end
	
	if SOME_CONDITION_1 then
		args.pos = cursorPos -- you can change any parameters
		return
	end
	
	if SOME_CONDITION_2 then
		args.process = false -- block this issue_order 
		return
	end
end

cb.add(cb.issue_order, on_issue_order)

cb.castspell

Has four args: slot, startpos, endpos, nid:

INFO

Note that cb.cast_spell will only work for hanbot internal request, user's manual cast will not trigger this event.

lua
local function on_cast_spell(slot, startpos, endpos, nid)
	print(('%u, %.2f-%.2f, %.2f-%.2f, %u'):format(slot, startpos.x, startpos.z, endpos.x, endpos.z, nid))
end

cb.add(cb.castspell, on_cast_spell)

cb.cast_spell

Just a better version of cb.castspell.

Args: CastSpellArgs:

  • boolean args.process
  • number args.spellSlot
  • vec3 args.casterPosition
  • vec3 args.targetPosition
  • vec3 args.targetEndPosition
  • obj args.target

INFO

Note that cb.cast_spell will only work for hanbot internal request, user's manual cast will not trigger this event.

lua
local function on_cast_spell(args)
	print(('spellSlot: %u, target: %u'):format(args.spellSlot, args.target and args.target.ptr or 0))

	if SOME_CONDITION_2 then
		args.process = false -- block this cast_spell 
		return
	end
end

cb.add(cb.cast_spell, on_cast_spell)

cb.attack_cancel

Fired when AA canceled.

lua
local function on_cancel_attack(obj)
	print(('%s, cancel attack'):format(obj.charName))
end
cb.add(cb.attack_cancel, on_cancel_attack)

cb.cast_finish

Fired when a spell cast is finished. (Only valid for spell that need channeling)

lua
local function on_cast_finish(spell)
	if spell.owner==player then
		print('on_cast_finish: ' .. spell.name)
	end
end
cb.add(cb.cast_finish, on_cast_finish)

cb.play_animation

Fired when a animation (from network only) is begin to play.

lua
local function on_play_animation(obj, animation)
	print(('on_play_animation, %s, %s'):format(obj.charName, animation))
end
cb.add(cb.play_animation, on_play_animation)

cb.create_minion and cb.delete_minion

Both have a single arg, minion.obj.

lua
local function on_create_minion(obj)
	print(obj.name, obj.charName)
end

local function on_delete_minion(obj)
	--obj is invalid within the scope of this function, it is dangerous to check obj properties other than .ptr
	print(obj.ptr)
end

cb.add(cb.create_minion, on_create_minion)
cb.add(cb.delete_minion, on_delete_minion)

cb.create_missile and cb.delete_missile

Both have a single arg, missile.obj.

lua
local function on_create_missile(obj)
	print(obj.name, obj.speed, obj.spell.name)
end

local function on_delete_missile(obj)
	--obj is invalid within the scope of this function, it is dangerous to check obj properties other than .ptr
	print(obj.ptr)
end

cb.add(cb.create_missile, on_create_missile)
cb.add(cb.delete_missile, on_delete_missile)

cb.create_particle and cb.delete_particle

Both have a single arg, base.obj.

lua
local function on_create_particle(obj)
	print(obj.name, obj.x, obj.z)
end

local function on_delete_particle(obj)
	--obj is invalid within the scope of this function, it is dangerous to check obj properties other than .ptr
	print(obj.ptr)
end

cb.add(cb.create_particle, on_create_particle)
cb.add(cb.delete_particle, on_delete_particle)

cb.buff_gain and cb.buff_lose

lua
local function on_buff_gain(obj, buff)
	print('[Buff gain]: ', obj.charName, buff.name)
end

local function on_buff_lose(obj, buff)
	print('[Buff lose]: ', obj.charName, buff.name)
end

cb.add(cb.buff_gain, on_buff_gain)
cb.add(cb.buff_lose, on_buff_lose)

cb.set_cursorpos

Don't use this callback, please use player:castSpell('move').

lua
-- Only works for VelkozR / AurelionSolQ / YuumiQ / NunuW / SionR
local function on_cursorpos_change(point)
	print('[on_cursorpos_change]: ', point[0], point[1])
    
    -- set x and y
    local v = graphics.world_to_screen(g_target.pos)
    point[0] = v.x
    point[1] = v.y
end

cb.add(cb.set_cursorpos, on_cursorpos_change)

chat

chat.isOpened

Return Value

boolean returns true if chat is open

chat.size

Return Value

number returns number in chat history

chat.clear()

Clear the send buffer

Parameters

Return Value

void

chat.add(str, style)

Parameters

string str in UTF8

table style

Return Value

void

chat.send(str)

Parameters

string str in UTF8

Return Value

void

lua
chat.clear()
chat.add("hello", {bold = false, italic = false, color = 'ffffffff'})
chat.add("world", {bold = true, italic = true, color = '99999999'})
chat.print()

chat.print(str)

Parameters

string str in UTF8

Return Value

void

lua
chat.print("hello world")

chat.message(index)

Parameters

number index

Return Value

string

lua
for i=0,chat.size-1 do
    print(chat.message(i))
end

console

console.set_color(c)

Parameters

number c

Return Value

void

console.printx(str, c)

Parameters

string str

number c

Return Value

void

minimap

minimap.x

Return Value

number returns the screen x pos of the upper left corner of the minimap

minimap.y

Return Value

number returns the screen y pos of the upper left corner of the minimap

minimap.width

Return Value

number returns the screen width of the minimap

minimap.height

Return Value

number returns the screen height of the minimap

minimap.bounds

Return Value

vec2 returns the maximum map boundaries

minimap.world_to_map(v1)

Parameters

vec2\vec3 v1

Return Value

vec2 returns the screen pos of v1 on the minimap

local v1 = player.pos
local a = minimap.world_to_map(v1)
a:print()

minimap.on_map(v1)

Parameters

vec2 v1

Return Value

boolean returns true if v1 is hovering the minimap

local v1 = game.cursorPos
local a = minimap.on_map(v1)
print(a)

minimap.on_map_xy(x, y)

Parameters

number x

number y

Return Value

boolean returns true if (x, y) is hovering the minimap

local x = game.cursorPos.x
local y = game.cursorPos.y
local a = minimap.on_map_xy(x, y)
print(a)

minimap.draw_circle(v1, r, w, c, n)

Parameters

vec3 v1

number r

number w

number c

number n

Return Value

void

local function on_draw()
	local v1 = player.pos
	local radius = 1000
	local line_width = 1
	local color = 0xFFFFFFFF
	local points_n = 16
	minimap.draw_circle(v1, radius, line_width, color, points_n)
end

cb.add(cb.draw, on_draw)

ping

Enums:

  • ping.ALERT
  • ping.DANGER
  • ping.MISSING_ENEMY
  • ping.ON_MY_WAY
  • ping.RETREAT
  • ping.ASSIST_ME
  • ping.AREA_IS_WARDED

ping.send(vec3 pos [, number ping_type [, obj target]])

Parameters

vec3 pos

number ping_type

game.obj obj

Return Value

void

ping.recv(vec3 pos [, number ping_type [, obj target]])

Parameters

vec3 pos

number ping_type

game.obj obj

Return Value

void

ping.pingPortrait(obj target)

Parameters

game.obj target

Return Value

void

ping.pingLevel(obj target)

Parameters

game.obj target

Return Value

void

Parameters

number x coordinate

number z coordinate

Return Value

number returns terrain height at x,z

Parameters

vec2\vec3 v1

Return Value

boolean returns true if v1 is in grass

Parameters

vec2\vec3 v1

Return Value

boolean returns true if v1 is in water

Parameters

vec2\vec3 v1

Return Value

boolean returns true if v1 is a wall

Parameters

vec2\vec3 v1

Return Value

boolean returns true if v1 is a structure

Parameters

vec2\vec3 v1

Return Value

boolean returns true if v1 is in fog of war

deprecated, please use player:getPassablePos instead

Parameters

vec2\vec3 v1

Return Value

vec2 returns the nearst passable position (the cell start) vec2(x,z) to v1(x, z)

bool returns the nearst passable is grass or not

lua
local drop_pos = navmesh.getNearstPassable(mousePos) -- return type is vec2
graphics.draw_circle(vec3(drop_pos.x + 25, 0, drop_pos.y + 25), 4, 2, 0xFFFFFF00, 3)

Parameters

obj hero/minion

vec3 destination

table strips (shape of obstacle area)

Return Value

vec3[] returns array of paths

number returns array length

lua

local g_strips = {}

function check_spell_area()
	local collision_size = 4
	local collision_array = vec3.array(collision_size)
	
	-- push areas, and please note that the minimum unit for collision checking is cell.
	-- You need to round up points to cell boundings in real situations.
	collision_array[0] = vec3(1000, 0, 1000)
	collision_array[1] = vec3(1000, 0, 2000)
	collision_array[2] = vec3(2000, 0, 2000)
	collision_array[3] = vec3(2000, 0, 1000)
	
	table.insert(g_strips, {vec = collision_array, n = collision_size})
end

cb.add(cb.draw, function()

  g_strips = {}
  check_spell_area()

  -- draw a opening shape
  for i = 1, #g_strips do
    local strip = g_strips[i]
    local vec = strip.vec
    for j = 0, strip.n - 2 do
      graphics.draw_line(vec[j], vec[j + 1], 2, 0xffff0000)
    end
  end
  
  -- draw the path finding
  local paths,size = navmesh.calcPos(player, mousePos, g_strips)
  graphics.draw_line_strip(paths, 2, 0xFF00FF00, size)
end)

game

game.mousePos

Return Value

vec3 returns the current position of the mouse

game.mousePos2D

Return Value

vec2 returns the current position of the mouse

game.cameraPos

Return Value

vec3 returns the current position of the camera

game.cameraLocked

Return Value

boolean returns true if the camera is locked

game.setCameraLock(bool)

Parameters

boolean bool

Return Value

void

game.cameraY

Return Value

number returns the current camera zoom

game.cursorPos

Return Value

vec2 returns the current cursor position

game.time

Return Value

number returns the current game time

game.version

Return Value

string returns the current game version

You cant lock your shard to specific game version, this is a forbidden.

game.selectedTarget

Return Value

obj returns the current selected game object

game.hoveredTarget

Return Value

obj returns the current hovered game object

game.mapID

Return Value

number returns the current map ID

game.mode

Return Value

string returns the current game mode

game.type

Return Value

string returns the current game type

game.modeRoundIndex

Return Value

string returns the current round index (2v2v2v2v2)

game.modePhaseIndex

Return Value

string returns the current phase index (2v2v2v2v2)

game.shopOpen

Return Value

boolean check if shop available

game.isWindowFocused

Return Value

boolean returns true if LoL is focused

game.getHoveredTarget(int, int)

Parameters

int mouse X

int mouse Y

Return Value

obj returns the current hovered game object by position

game.sendEmote(emoteId)

Parameters

int emoteId

Return Value

void

c
EMOTE_DANCE = 0
EMOTE_TAUNT = 1
EMOTE_LAUGH = 2
EMOTE_JOKE = 3
EMOTE_TOGGLE = 4
lua
game.sendEmote(0) -- dance

game.sendRadialEmote(index)

Parameters

int index

Return Value

void

lua
game.sendRadialEmote(8) -- centre emote

game.displayMasteryBadge()

Parameters

Return Value

void

game.fnvhash(str)

Parameters

string input string

Return Value

unsigned int returns the fnvhash of input string

It is recommended to directly use game.fnvhash("some_const_str") in the code directly without any cache, which will be automatically replaced with a constant uint32_t at compile time to maximize performance.

lua
-- For example, the original code:
if (player:getBuffStacks(game.fnvhash("ezrealpassivestacks")) > 0) then
  print("abc123")
end

-- compiled code
if (player:getBuffStacks(3880576586) > 0) then
  print("abc123")
end

game.spellhash(str)

Parameters

string input string

Return Value

unsigned int returns the spell hash of input string

It is recommended to directly use game.spellhash("some_const_str") in the code directly without any cache, which will be automatically replaced with a constant uint32_t at compile time to maximize performance.

game.hashSDBM(str)

Parameters

string input string

Return Value

unsigned int returns the SDBM hash of input string

It is recommended to directly use game.hashSDBM("some_const_str") in the code directly without any cache, which will be automatically replaced with a constant uint32_t at compile time to maximize performance.

graphics

graphics.width

Return Value

number returns screen width

graphics.height

Return Value

number returns screen height

graphics.res

Return Value

vec2 returns screen resolution

graphics.draw_text_2D(str, size, x, y, color)

Parameters

string str

number size

number x

number y

number color

Return Value

void

local function on_draw()
	graphics.draw_text_2D('foo', 14, game.cursorPos.x, game.cursorPos.y, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.draw_outlined_text_2D(str, size, x, y, color, outline_color)

Parameters

string str

number size

number x

number y

number color

number outline_color

Return Value

void

graphics.text_area(str, size, n)

Parameters

string str

number size

number n

Return Value

number returns str width

number returns str height

local str = 'foo'
local font_size = 14
local x, y = graphics.text_area(str, font_size)
print(x, y)

graphics.get_font()

Return Value

string returns current font name

graphics.argb(a, r, g, b)

Parameters

number a

number r

number g

number b

Return Value

number returns color

local color = graphics.argb(255, 25, 185, 90)
local function on_draw()
	graphics.draw_text_2D('foo', 14, game.cursorPos.x, game.cursorPos.y, color)
end

cb.add(cb.draw, on_draw)

graphics.world_to_screen(v1)

Parameters

vec3 v1

Return Value

vec2 returns screen position from world position

local function on_draw()
	local v = graphics.world_to_screen(player.pos)
	graphics.draw_text_2D('foo', 14, v.x, v.y, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.world_to_screen_xyz(x, y, z)

Parameters

number x

number y

number z

Return Value

vec2 returns screen position from world position

local function on_draw()
	local v = graphics.world_to_screen_xyz(player.x, player.y, player.z)
	graphics.draw_text_2D('foo', 14, v.x, v.y, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.draw_line_2D(x1, y1, x2, y2, width, color)

Parameters

number x1

number y1

number x2

number y2

number width

number color

Return Value

void

local function on_draw()
	graphics.draw_line_2D(0, 0, game.cursorPos.x, game.cursorPos.y, 2, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.draw_line(v1, v2, width, color)

Parameters

vec3 v1

vec3 v2

number width

number color

Return Value

void

local function on_draw()
	graphics.draw_line(mousePos, player.pos, 2, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.draw_triangle_2D(p1, p2, p3, width, color, is_filled, rounding)

Parameters

vec2 p1

vec2 p2

vec2 p3

number width

number color

boolean is_filled, default: false

number rounding, default: 0

Return Value

void

local function on_draw()
	graphics.draw_triangle_2D(vec2(10, 10),vec2(10, 50),vec2(50, 10), 2, 0xFFFFFFFF, true)
end

cb.add(cb.draw, on_draw)

graphics.draw_rectangle_2D(x, y, dx, dy, width, color, is_filled)

Parameters

number x

number y

number dx

number dy

number width

number color

boolean is_filled: default: false

number rounding: default: 0

Return Value

void

local function on_draw()
	graphics.draw_rectangle_2D(game.cursorPos.x, game.cursorPos.y, 90, 20, 2, 0xFFFFFFFF)
end

cb.add(cb.draw, on_draw)

graphics.draw_line_strip(pts, width, color, pts_n)

Parameters

vec3[] pts

number width

number color

number pts_n

Return Value

void

local function on_draw()
	if player.path.active then
		graphics.draw_line_strip(player.path.point, 2, 0xFFFFFFFF, player.path.count+1)
	end
end

cb.add(cb.draw, on_draw)

graphics.draw_line_strip_2D(pts, width, color, pts_n)

Parameters

vec2[] pts

number width

number color

number pts_n

Return Value

void

local v = vec2.array(4)
v[0].x = 200
v[0].y = 200
v[1].x = 400
v[1].y = 200
v[2].x = 400
v[2].y = 400
v[3].x = 200
v[3].y = 400
local function on_draw()
	graphics.draw_line_strip_2D(v, 2, 0xFFFFFFFF, 4)
end

cb.add(cb.draw, on_draw)

graphics.draw_circle(v1, radius, width, color, pts_n)

Parameters

vec3 v1

number radius

number width

number color

number pts_n

Return Value

void

local function on_draw()
	graphics.draw_circle(player.pos, player.attackRange, 2, 0xFFFFFFFF, 32)
end

cb.add(cb.draw, on_draw)

graphics.draw_circle_2D(x, y, radius, width, color, pts_n)

Parameters

number x

number y

number radius

number width

number color

number pts_n

Return Value

void

local function on_draw()
	graphics.draw_circle_2D(game.cursorPos.x, game.cursorPos.y, 120, 2, 0xFFFFFFFF, 32)
end

cb.add(cb.draw, on_draw)

graphics.draw_circle_xyz(x, y, z, radius, width, color, pts_n)

Parameters

number x

number y

number z

number radius

number width

number color

number pts_n

Return Value

void

local function on_draw()
	graphics.draw_circle_xyz(player.x, player.y, player.z, player.attackRange, 2, 0xFFFFFFFF, 32)
end

cb.add(cb.draw, on_draw)

graphics.draw_arc(v1, radius, width, color, pts_n, r1, r2)

Parameters

vec3 v1

number radius

number width

number color

number pts_n

number r1

number r2

Return Value

void

local function on_draw()
	graphics.draw_arc(player.pos, player.attackRange, 2, 0xFFFFFFFF, 32, 0, math.pi/2)
end

cb.add(cb.draw, on_draw)

graphics.draw_arc_2D(x, y, radius, width, color, pts_n, r1, r2)

Parameters

number x

number y

number radius

number width

number color

number pts_n

number r1

number r2

Return Value

void

local function on_draw()
	graphics.draw_arc(player.pos, player.attackRange, 2, 0xFFFFFFFF, 32, 0, math.pi/2)
end

cb.add(cb.draw, on_draw)

graphics.create_effect(type)

Create a shadereffect instance by type

Parameters

number type

Return Value

shadereffect.obj

-- create once, show always, with best performance
local circle_unchanged = graphics.create_effect(graphics.CIRCLE_RAINBOW)
circle_unchanged:update_circle(player.pos, 1200, 2, 0xFFFF0000)
circle_unchanged:attach(player)
circle_unchanged:show()
-- update effect in on_draw
local circle_aa = graphics.create_effect(graphics.CIRCLE_RAINBOW)
local function on_draw()
	circle_aa:update_circle(player.pos, player.attackRange, 2, 0xff123456)
end
cb.add(cb.draw, on_draw)

graphics.CIRCLE_GLOW

Return Value

number simple glow circle

graphics.CIRCLE_GLOW_RAINBOW

Return Value

number glow circle with rainbow

graphics.CIRCLE_GLOW_LIGHT

Return Value

number another glow circle

graphics.CIRCLE_GLOW_BOLD

Return Value

number another glow circle 2

graphics.CIRCLE_FIRE

Return Value

number fire circle

graphics.CIRCLE_RAINBOW

Return Value

number colorful rainbow circle

graphics.CIRCLE_RAINBOW_BOLD

Return Value

number colorful another rainbow circle

graphics.CIRCLE_FILL

Return Value

number filled circle

graphics.sprite(name)

Parameters

string name

vec2 the screen position

number scale

number color

Return Value

texture.obj

local myIcon = graphics.sprite('XXX/menu_icon.png')
if myIcon then 
	-- In some PC it will failed load PNG, so need check this
	myMenu:set('icon', myIcon)
end

graphics.game_sprite(name)

Parameters

string name

vec2 the screen position

number scale

number color

Return Value

texture.obj

-- example: https://raw.communitydragon.org/14.1/game/assets/characters/sru_blue/hud/bluesentinel_circle.png
local icon = graphics.game_sprite('ASSETS/Characters/SRU_Blue/HUD/BlueSentinel_Circle.dds')
local icon_ashe = graphics.game_sprite('ASSETS/Characters/Ashe/HUD/Ashe_Circle.dds')

graphics.draw_sprite(name, v1, scale, color)

Parameters

string|texture.obj name

vec2 the screen position

number scale

number color

Return Value

void

local function on_draw_sprite()
	--sprite files must be placed in your shard directory
	graphics.draw_sprite("sprite_name.png", vec2(p.x, p.y), 1.5, 0x66FFFFFF)
end

cb.add(cb.sprite, on_draw_sprite)

graphics.spawn_fake_click(color, v1)

Parameters

string color: "red" or "green"

vec3 v1: world_pos

Return Value

void

local function on_key_down(k)
	if k==49 then --1
		graphics.spawn_fake_click("green", mousePos)
	end
end

cb.add(cb.keydown, on_key_down)

graphics.set_draw(enabled)

Parameters

boolean enabled

Return Value

void

graphics.get_draw()

Parameters

Return Value

boolean enabled

graphics.set_draw_menu(enabled)

Parameters

boolean enabled

Return Value

void

shadereffect

shadereffect.construct(effect_description, is_3D)

Parameters

string effect_description

boolean is_3D

Return Value

shadereffect shadereffect

shadereffect.begin(shadereffect, height, is_3D)

Parameters

shadereffect shadereffect

number hieght

boolean is_3D

Return Value

void

shadereffect.set_float(shadereffect, varname, var)

Parameters

shadereffect shadereffect

string varname

number var

Return Value

void

shadereffect.set_vec2(shadereffect, varname, var)

Parameters

shadereffect shadereffect

string varname

vec2 var

Return Value

void

shadereffect.set_vec3(shadereffect, varname, var)

Parameters

shadereffect shadereffect

string varname

vec3 var

Return Value

void

shadereffect.set_vec4(shadereffect, varname, var)

Parameters

shadereffect shadereffect

string varname

vec4 var

Return Value

void

shadereffect.set_float_array(shadereffect, varname, var, size)

Parameters

shadereffect shadereffect

string varname

array var

number size

Return Value

void

shadereffect.set_color(shadereffect, varname, color)

Parameters

shadereffect shadereffect

string varname

color var

Return Value

void

objManager

objManager.player

Return Value

hero.obj returns player object

print(player.charName)

objManager.maxObjects

Return Value

number returns max object count

objManager.get(i)

Return Value

obj returns game object

for i=0, objManager.maxObjects-1 do
	local obj = objManager.get(i)
	if obj and obj.type==TYPE_HERO then
		print(obj.charName)
	end
end

objManager.enemies_n

Return Value

number returns enemy hero count

objManager.enemies

Return Value

hero.obj[] returns array of enemy heroes

for i=0, objManager.enemies_n-1 do
	local obj = objManager.enemies[i]
	print(obj.charName)
end

objManager.allies_n

Return Value

number returns ally hero count

objManager.allies

Return Value

hero.obj[] returns array of ally heroes

for i=0, objManager.allies_n-1 do
	local obj = objManager.allies[i]
	print(obj.charName)
end

objManager.minions.size[team]

Parameters

team can be any of these: TEAM_ALLY/TEAM_ENEMY/TEAM_NEUTRAL / "plants" / "others" / "farm" / "farm" / "lane_ally" / "lane_enemy" / "pets_ally" / "pets_enemy" / "barrels"

Return Value

number returns minion count of respective team

local enemyMinionCount = objManager.minions.size[TEAM_ENEMY]

objManager.minions[team][i]

Parameters

team can be any of these: TEAM_ALLY/TEAM_ENEMY/TEAM_NEUTRAL / "plants" / "others" / "farm" / "lane_ally" / "lane_enemy" / "pets_ally" / "pets_enemy" / "barrels"

Return Value

minion.obj returns minion object


local enemy_minion_size = objManager.minions.size[TEAM_ENEMY]
local enemy_minion_arr = objManager.minions[TEAM_ENEMY]
for i=0, enemy_minion_size-1 do
	local obj = enemy_minion_arr[i]
	print(obj.charName)
end

-- spell farm minions
local farm_minion_size = objManager.minions.size['farm']
local farm_minion_size = objManager.minions.size['farm']
local farm_minion_arr = objManager.minions['farm']
for i=0, farm_minion_size-1 do
	local obj = farm_minion_arr[i]
	print(obj.charName)
end

objManager.turrets.size[team]

Return Value

number returns turret count of respective team

objManager.turrets[team][i]

Return Value

turret.obj returns turret object

for i=0, objManager.turrets.size[TEAM_ALLY]-1 do
	local obj = objManager.turrets[TEAM_ALLY][i]
	print(obj.charName)
end

objManager.inhibs.size[team]

Return Value

number returns inhib count of respective team

objManager.inhibs[team][i]

Return Value

inhib.obj returns inhib object

for i=0, objManager.inhibs.size[TEAM_ALLY]-1 do
	local obj = objManager.inhibs[TEAM_ALLY][i]
	print(obj.health)
end

objManager.nexus[team]

Return Value

nexus.obj returns nexus object

print(objManager.nexus[TEAM_ENEMY].health)

objManager.allObjects[i]

Return Value

base.obj returns GameObject

objManager.allAttackableUnits[i]

Return Value

base.obj returns AttackableUnit

objManager.allHeros[i]

Return Value

hero.obj returns hero object

for i=0, objManager.allHeros.size-1 do
	local obj = objManager.allHeros[i]
	print(obj.handle)
end

objManager.allMinions[i]

Return Value

minion.obj returns minion object

objManager.minionsAlly[i]

Return Value

minion.obj returns minion object

objManager.minionsEnemy[i]

Return Value

minion.obj returns minion object

objManager.minionsNeutral[i]

Return Value

minion.obj returns minion object

objManager.minionsOther[i]

Return Value

minion.obj returns minion object

objManager.petsAlly[i]

Return Value

minion.obj returns minion object

objManager.petsEnemy[i]

Return Value

minion.obj returns minion object

objManager.barrels[i]

Return Value

minion.obj returns minion object

objManager.missiles[i]

Return Value

missile.obj returns missile object

objManager.particles[i]

Return Value

particle.obj returns particle object

objManager.wardsAlly[i]

Return Value

minion.obj returns ally ward object

objManager.loop(f)

Parameters

function f

Return Value

void

local function foo(obj)
	if obj.type==TYPE_HERO then
		print(obj.charName)
	end
end

objManager.loop(foo)

core

core.tick

Return Value

number returns current core_tick

core.fps

Return Value

number returns current fps

core.block_input()

Only works in cb.issueorder and cb.castspell, will block current operation.

Return Value

void

local function on_issue_order(order, pos, target_ptr)
	if order==3 then
		--blocks this attack
		--this only works for orders issued by hanbot
		core.block_input()
	end
end

cb.add(cb.issueorder, on_issue_order)

core.reload()

Return Value

void

sound

sound.play(name)

Parameters

string name

-- while resource is shared between all plugins, it is better to have a unique name (path)
sound.play('demo_aio_resources/load.wav')

sound.play_from_file(file_path)

Parameters

string file_path

sound.disable(is_disabled)

Parameters

boolean is_disabled

shop

shop.canShop

Return Value

bool

shop.isOpened

Return Value

bool

shop.augmentSelectionOpen

Return Value

bool

shop.augmentSelectionIds

Return Value

table See AugmentId

enum class AugmentId: std::uint32_t
{
	Oathsworn = 0x1F273AC,// buff_hash( "Oathsworn" )
	ShrinkRay = 0x302DB74,// buff_hash( "ShrinkRay" )
	UltimateRevolution = 0x4A9BDC5,// buff_hash( "UltimateRevolution" )
	StackosaurusRex = 0x55E5BD2,// buff_hash( "StackosaurusRex" )
	OrbitalLaser = 0x5E9FD41,// buff_hash( "OrbitalLaser" )
	ApexInventor = 0x93D7848,// buff_hash( "ApexInventor" )
	escAPADe = 0xB24AB25,// buff_hash( "escAPADe" )
	WarmupRoutine = 0xB731243,// buff_hash( "WarmupRoutine" )
	HeavyHitter = 0x109C1530,// buff_hash( "HeavyHitter" )
	SummonersRoulette = 0x13BDA632,// buff_hash( "SummonersRoulette" )
	EtherealWeapon = 0x13E8C4A7,// buff_hash( "EtherealWeapon" )
	TheBrutalizer = 0x16EA7954,// buff_hash( "TheBrutalizer" )
	ItsKillingTime = 0x17A308CA,// buff_hash( "ItsKillingTime" )
	GiantSlayer = 0x1950C668,// buff_hash( "GiantSlayer" )
	SearingDawn = 0x199AA2C8,// buff_hash( "SearingDawn" )
	CannonFodder = 0x1A9B0060,// buff_hash( "CannonFodder" )
	Quest_WoogletsWitchcap = 0x1BC0CAC1,// buff_hash( "Quest_WoogletsWitchcap" )
	SpinToWin = 0x209762E6,// buff_hash( "SpinToWin" )
	Executioner = 0x23F1EBC6,// buff_hash( "Executioner" )
	NowYouSeeMe = 0x26433BAB,// buff_hash( "NowYouSeeMe" )
	FeeltheBurn = 0x2D24DA51,// buff_hash( "FeeltheBurn" )
	ItsCritical = 0x2E4815CC,// buff_hash( "ItsCritical" )
	GambaAnvil = 0x2EFA5F6D,// buff_hash( "GambaAnvil" )
	MadScientist = 0x301C4AB9,// buff_hash( "MadScientist" )
	DontBlink = 0x361E81B4,// buff_hash( "DontBlink" )
	GuiltyPleasure = 0x38A48C10,// buff_hash( "GuiltyPleasure" )
	SkilledSniper = 0x3A3FB8AC,// buff_hash( "SkilledSniper" )
	OutlawsGrit = 0x3AFCE102,// buff_hash( "OutlawsGrit" )
	Clothesline = 0x3D187ED1,// buff_hash( "Clothesline" )
	BannerofCommand = 0x3F13BB13,// buff_hash( "BannerofCommand" )
	TwiceThrice = 0x42346B02,// buff_hash( "TwiceThrice" )
	SoulSiphon = 0x4293CD3B,// buff_hash( "SoulSiphon" )
	OmniSoul = 0x44031317,// buff_hash( "OmniSoul" )
	Chauffeur = 0x4474F5D0,// buff_hash( "Chauffeur" )
	ServeBeyondDeath = 0x4589990F,// buff_hash( "ServeBeyondDeath" )
	Quest_UrfsChampion = 0x4716448D,// buff_hash( "Quest_UrfsChampion" )
	CelestialBody = 0x47330DB1,// buff_hash( "CelestialBody" )
	IceCold = 0x48B5BDCA,// buff_hash( "IceCold" )
	FromBeginningToEnd = 0x48DC2006,// buff_hash( "FromBeginningToEnd" )
	DawnbringersResolve = 0x4B303285,// buff_hash( "DawnbringersResolve" )
	WillingSacrifice = 0x4B43BF6C,// buff_hash( "WillingSacrifice" )
	JuiceBox = 0x4D27E960,// buff_hash( "JuiceBox" )
	DontChase = 0x4DBF5E70,// buff_hash( "DontChase" )
	BreadAndCheese = 0x4E28F2C3,// buff_hash( "BreadAndCheese" )
	FrostWraith = 0x4F7D128E,// buff_hash( "FrostWraith" )
	FeyMagic = 0x52022D72,// buff_hash( "FeyMagic" )
	DrawYourSword = 0x522572E9,// buff_hash( "DrawYourSword" )
	InfernalSoul = 0x55780831,// buff_hash( "InfernalSoul" )
	QuantumComputing = 0x55EF3A40,// buff_hash( "QuantumComputing" )
	OkBoomerang = 0x58FEA611,// buff_hash( "OkBoomerang" )
	Eureka = 0x59B3AFC2,// buff_hash( "Eureka" )
	Dematerialize = 0x5C8D739F,// buff_hash( "Dematerialize" )
	BigBrain = 0x5F479857,// buff_hash( "BigBrain" )
	MysticPunch = 0x610EB7B4,// buff_hash( "MysticPunch" )
	HolyFire = 0x61BEDC9B,// buff_hash( "HolyFire" )
	SymphonyofWar = 0x64EB2265,// buff_hash( "SymphonyofWar" )
	Marksmage = 0x65A8CBEF,// buff_hash( "Marksmage" )
	ScopierWeapons = 0x662429D1,// buff_hash( "ScopierWeapons" )
	BluntForce = 0x6951004B,// buff_hash( "BluntForce" )
	MindtoMatter = 0x6AD13E9D,// buff_hash( "MindtoMatter" )
	Homeguard = 0x6CA0F337,// buff_hash( "Homeguard" )
	Earthwake = 0x6E25F1F7,// buff_hash( "Earthwake" )
	Quest_AngelofRetribution = 0x6F79D727,// buff_hash( "Quest_AngelofRetribution" )
	BuffBuddies = 0x71E56AB8,// buff_hash( "BuffBuddies" )
	NestingDoll = 0x73016C04,// buff_hash( "NestingDoll" )
	BreadAndJam = 0x75565D16,// buff_hash( "BreadAndJam" )
	Recursion = 0x76B60E67,// buff_hash( "Recursion" )
	TankItOrLeaveIt = 0x80B86F89,// buff_hash( "TankItOrLeaveIt" )
	FrozenFoundations = 0x819259C7,// buff_hash( "FrozenFoundations" )
	Vengeance = 0x886F1F8D,// buff_hash( "Vengeance" )
	WithHaste = 0x894E5EBC,// buff_hash( "WithHaste" )
	Erosion = 0x8C2F16FE,// buff_hash( "Erosion" )
	Perseverance = 0x8D3AE60E,// buff_hash( "Perseverance" )
	ChainLightning = 0x8E40C3DC,// buff_hash( "ChainLightning" )
	TrueshotProdigy = 0x93AB024B,// buff_hash( "TrueshotProdigy" )
	PhenomenalEvil = 0x94D656DE,// buff_hash( "PhenomenalEvil" )
	ContractKiller = 0x97C4EFA0,// buff_hash( "ContractKiller" )
	BacktoBasics = 0x984667B4,// buff_hash( "BacktoBasics" )
	CircleofDeath = 0x9A1D093E,// buff_hash( "CircleofDeath" )
	Castle = 0x9AC2A459,// buff_hash( "Castle" )
	JeweledGauntlet = 0x9CAAE31B,// buff_hash( "JeweledGauntlet" )
	SlapAround = 0x9DFB15EE,// buff_hash( "SlapAround" )
	RestlessRestoration = 0x9E1A180E,// buff_hash( "RestlessRestoration" )
	CriticalHealing = 0x9F40039E,// buff_hash( "CriticalHealing" )
	Flashy = 0x9F6FD4F0,// buff_hash( "Flashy" )
	MasterofDuality = 0x9F9005F8,// buff_hash( "MasterofDuality" )
	Quest_SteelYourHeart = 0xA173E08E,// buff_hash( "Quest_SteelYourHeart" )
	Impassable = 0xA1A3AF22,// buff_hash( "Impassable" )
	ScopiestWeapons = 0xA1D75DC2,// buff_hash( "ScopiestWeapons" )
	LightemUp = 0xA26FF4EC,// buff_hash( "LightemUp" )
	OceanSoul = 0xA3670B02,// buff_hash( "OceanSoul" )
	Deft = 0xA3E2E068,// buff_hash( "Deft" )
	LaserEyes = 0xA748902E,// buff_hash( "LaserEyes" )
	WisdomofAges = 0xA83CA207,// buff_hash( "WisdomofAges" )
	DemonsDance = 0xA8B08058,// buff_hash( "DemonsDance" )
	BloodBrother = 0xAB06A043,// buff_hash( "BloodBrother" )
	Minionmancer = 0xAB4CDD4D,// buff_hash( "Minionmancer" )
	Firebrand = 0xABA0CD52,// buff_hash( "Firebrand" )
	SpiritLink = 0xAC744FB8,// buff_hash( "SpiritLink" )
	MountainSoul = 0xAE76811D,// buff_hash( "MountainSoul" )
	Vulnerability = 0xAFE4CF71,// buff_hash( "Vulnerability" )
	RaidBoss = 0xB2EDEF40,// buff_hash( "RaidBoss" )
	MagicMissile = 0xB4545A74,// buff_hash( "MagicMissile" )
	WitchfulThinking = 0xB503AEA3,// buff_hash( "WitchfulThinking" )
	CantTouchThis = 0xB5D9645A,// buff_hash( "CantTouchThis" )
	ComboMaster = 0xBA23DC87,// buff_hash( "ComboMaster" )
	KeystoneConjurer = 0xBBE31DDB,// buff_hash( "KeystoneConjurer" )
	BreadAndButter = 0xBD47D568,// buff_hash( "BreadAndButter" )
	ThreadtheNeedle = 0xBE4AA497,// buff_hash( "ThreadtheNeedle" )
	SnowballFight = 0xBF2B1A73,// buff_hash( "SnowballFight" )
	Typhoon = 0xBF771C16,// buff_hash( "Typhoon" )
	MirrorImage = 0xC390B2C7,// buff_hash( "MirrorImage" )
	RabbleRousing = 0xC3A6E3C0,// buff_hash( "RabbleRousing" )
	SelfDestruct = 0xC451D495,// buff_hash( "SelfDestruct" )
	DefensiveManeuvers = 0xC488607E,// buff_hash( "DefensiveManeuvers" )
	SlowCooker = 0xCB705AEB,// buff_hash( "SlowCooker" )
	UltimateUnstoppable = 0xCDF2651B,// buff_hash( "UltimateUnstoppable" )
	ADAPt = 0xD18FEA7F,// buff_hash( "ADAPt" )
	TapDancer = 0xD1F84AA5,// buff_hash( "TapDancer" )
	Spellwake = 0xD3CBE301,// buff_hash( "Spellwake" )
	Flashbang = 0xD4DA8047,// buff_hash( "Flashbang" )
	ShadowRunner = 0xD5F12997,// buff_hash( "ShadowRunner" )
	CourageoftheColossus = 0xD68F7D08,// buff_hash( "CourageoftheColossus" )
	InfernalConduit = 0xD79FD9B0,// buff_hash( "InfernalConduit" )
	AcceleratingSorcery = 0xDA054EE4,// buff_hash( "AcceleratingSorcery" )
	Repulsor = 0xDABCBBC3,// buff_hash( "Repulsor" )
	ExtendoArm = 0xDE9A77E4,// buff_hash( "ExtendoArm" )
	ScopedWeapons = 0xE3E3DBBE,// buff_hash( "ScopedWeapons" )
	LightningStrikes = 0xE48980B4,// buff_hash( "LightningStrikes" )
	FallenAegis = 0xE67E996E,// buff_hash( "FallenAegis" )
	BladeWaltz = 0xE8A9A9F1,// buff_hash( "BladeWaltz" )
	FirstAidKit = 0xE9AFCCDF,// buff_hash( "FirstAidKit" )
	Dashing = 0xED80A0CB,// buff_hash( "Dashing" )
	FullyAutomated = 0xEDFA6D47,// buff_hash( "FullyAutomated" )
	HoldVeryStill = 0xF0544646,// buff_hash( "HoldVeryStill" )
	DieAnotherDay = 0xF0DBEF32,// buff_hash( "DieAnotherDay" )
	Goredrink = 0xF4EBEFD4,// buff_hash( "Goredrink" )
	Vanish = 0xF6A6FFEA,// buff_hash( "Vanish" )
	AllForYou = 0xFC06EEFA,// buff_hash( "AllForYou" )
	Goliath = 0xFCB87F9B,// buff_hash( "Goliath" )
	CenterOfTheUniverse = 0xFCCE03A7,// buff_hash( "CenterOfTheUniverse" )
	DiveBomber = 0xFD0ED9E4,// buff_hash( "DiveBomber" )
	ParasiticRelationship = 0xFE635A5B,// buff_hash( "ParasiticRelationship" )
	Restart = 0xFE9C11EC,// buff_hash( "Restart" )
	Tormentor = 0xFEFBCC4F,// buff_hash( "Tormentor" )
	SonicBoom = 0xFF509218,// buff_hash( "SonicBoom" )
};

shop.buyItem(itemID, preferredSlotID)

shop.sellItem(inventorySlotId)

shop.undo()

shop.swapItem(source, dest)

memory

Valid types:

  • char
  • unsigned char
  • short
  • unsigned short
  • int
  • unsigned int
  • long long
  • unsigned long long
  • float

memory.new(type, n)

Parameters

string type

number n

Return Value

mixed c-type array

input

Enums:

  • input.LOCK_MOVEMENT
  • input.LOCK_ABILITIES
  • input.LOCK_SUMMONERSPELLS
  • input.LOCK_SHOP
  • input.LOCK_CHAT
  • input.LOCK_MINIMAPMOVEMENT
  • input.LOCK_CAMERAMOVEMENT

input.lock(...)

Parameters

number input_type

Return Value

void

input.unlock(...)

Parameters

number input_type

Return Value

void

input.islocked(...)

Parameters

number input_type

Return Value

boolean

input.lock_slot(...)

Parameters

number slot

Return Value

void

input.unlock_slot(...)

Parameters

number slot

Return Value

void

input.islocked_slot(...)

Parameters

number slot

Return Value

boolean

keyboard

keyboard.isKeyDown(key_code)

Parameters

number key_code

Return Value

boolean returns true if key_code is down

local function on_tick()
	if keyboard.isKeyDown(0x20) then --spacebar
		print('spacebar pressed')
	end
end

cb.add(cb.tick, on_tick)

keyboard.getClipboardText()

Return Value

string returns text that was copied to clipboard

string returns error message on failure

keyboard.setClipboardText(text)

Parameters

string text

Return Value

void copies text to clipboard

keyboard.keyCodeToString(key_code)

Parameters

number key_code

Return Value

string returns corresponding character of key_code

print(keyboard.keyCodeToString(0x20))

keyboard.stringToKeyCode(key)

Parameters

string key

Return Value

number returns corresponding key_code of key

print(keyboard.stringToKeyCode('Space'))

permashow

permashow.enable(v1)

Parameters

boolean enabled

permashow.set_pos(x, y)

Parameters

number x

number y

permashow.set_drag_enabled(option)

Parameters

number option, 1 = enabled always, 2 = enabled when menu show

permashow.set_alpha(alpha)

Parameters

number alpha

permashow.set_theme(theme)

Parameters

table theme

lua
-- simple, set the alpha
permashow.set_alpha(100)

-- advanced usage, set custom theme (alpha will be ignored)
permashow.set_theme({
	itemHeight = 20,
	textSize = 14,
	textColor = 0xFFFFF799,
	textColorDisabled = 0xFFA8A8A8,

	shadowColor = 0x90000000,
	backgroundUpLeft = 0x90797145,
	backgroundUpRight = 0x904a3f23,
	backgroundBottomLeft = 0x90797145,
	backgroundBottomRight = 0x904a3f23,
	areaUpLeft = 0x90091e18,
	areaUpRight = 0x90091e18,
	areaBottomLeft = 0x9005120c,
	areaBottomRight = 0x9005120c,
	
	itemBorder1 = 0x33f4f499,
	itemBorder2 = 0x11f4f499,
	itemBorder3 = 0x33f4f499,
})
permashow.enable(true)

network

network.latency

Return Value

number returns game network latency in seconds

network.download_file(url, dest)

Parameters

string url

string dest

Return Value

boolean returns true on success

local url = 'https://i.imgur.com/k6HB1gA.gif'
local dest = hanbot.luapath..'/ok.png'
local success = network.download_file(url, dest)
print(success)

network.easy_download(cb, uri, path)

Parameters

function cb

string uri

string dest

Return Value

void

network.easy_post(cb, uri, postfields)

Parameters

function cb

string uri

string postfields

Return Value

void

module

module.seek(mod)

Parameters

string mod

Return Value

module returns module if it is loaded

local function on_tick()
	--module.seek will only return the module if its loaded
	local evade = module.seek('evade')
	if evade and evade.core.is_active() then return end
end

cb.add(cb.tick, on_tick)

module.load(id, mod)

Parameters

string id

string mod

Return Value

module returns module, loads it if needed

local foo_bar = module.load('foo', 'bar')

module.internal(mod)

Parameters

string mod

Return Value

module returns module, loads it if needed

local orb = module.internal('orb')
local function on_tick()
	local evade = module.seek('evade')
	if evade and evade.core.is_active() then return end
end

cb.add(cb.tick, on_tick)

module.lib(id)

Parameters

string id

Return Value

library returns library, loads it if needed

module.path(id)

Parameters

string id

Return Value

string returns module path

module.is_shard(id)

Parameters

string id

Return Value

boolean returns true if shard id exists

module.is_libshard(id)

Parameters

string id

Return Value

boolean returns true if libshard id exists

module.is_anyshard(id)

Parameters

string id

Return Value

boolean returns true if shard id or libshard id exists

module.file_exists(path)

Parameters

string path

Return Value

boolean returns true file exists

module.directory_exists(path)

Parameters

string path

Return Value

boolean returns true file exists

module.create_directory(id, path)

Parameters

string id

string path

Return Value

boolean returns true on success

module.create_script_directory(path)

Parameters

string path

Return Value

boolean returns true on success

module.create_lib_directory(path)

Parameters

string path

Return Value

boolean returns true on success

module.create_shard_directory(path)

Parameters

string path

Return Value

boolean returns true on success

module.open_file(id, path, mode)

Parameters

string id

string path

string mod

Return Value

file returns file handle on success

module.open_script_file(path, mode)

Parameters

string path

string mod

Return Value

file returns file handle on success

module.open_lib_file(path, mode)

Parameters

string path

string mod

Return Value

file returns file handle on success

module.open_shard_file(path, mode)

Parameters

string path

string mod

Return Value

file returns file handle on success

module.delete_file(id, path)

Parameters

string id

string path

Return Value

boolean returns true on success

module.delete_script_file(path)

Parameters

string path

Return Value

boolean returns true on success

module.delete_lib_file(path)

Parameters

string path

Return Value

boolean returns true on success

module.delete_shard_file(path)

Parameters

string path

Return Value

boolean returns true on success

module.rename_file(id, old, new)

Parameters

string id

string old

string new

Return Value

boolean returns true on success

module.rename_script_file(old, new)

Parameters

string old

string new

Return Value

boolean returns true on success

module.rename_lib_file(old, new)

Parameters

string old

string new

Return Value

boolean returns true on success

module.rename_shard_file(old, new)

Parameters

string old

string new

Return Value

boolean returns true on success

module.generate_tree(id, hash, anyfile)

Parameters

string id

string hash

boolean anyfile

Return Value

table returns file tree

Parameters

string var

string text

string group, means the shard type, set to "Champion" if you want your menu shows in Champion menu group

Return Value

object returns menu instance

local myMenu = menu('example_menu', 'Example Menu')

Parameters

string var

string text

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:header('example_header', 'Example Header')

Parameters

string var

string text

boolean value

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:boolean('example_boolean', 'Example Boolean')

local function on_tick()
	if myMenu.example_boolean:get() then
		print('example_boolean is true')
	end
end

cb.add(cb.tick, on_tick)

Parameters

string var

string text

number value

number min

number max

number step

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:slider('example_slider', 'Example Slider', 100, 0, 150, 5)

local function on_tick()
	print(myMenu.example_slider:get())
end

cb.add(cb.tick, on_tick)

Parameters

string var

string text

string key

string toggle

bool toggleValue: The default toggle value for current menu

bool permashowVisible: The default permashow visibility option for current menu

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
--this creates an on key down keybind for 'A'
myMenu:keybind('example_keybind_a', 'Example Keybind A', 'A', nil)
--this creates a toggle keybind for 'A'
myMenu:keybind('example_keybind_b', 'Example Keybind B', nil, 'A')
--this creates an on key down keybind for 'A' or toggle for 'B'
myMenu:keybind('example_keybind_c', 'Example Keybind C', 'A', 'B')
--this disable the permashow for Keybind C
myMenu.example_keybind_c:permashow(false)

local function on_tick()
	if myMenu.example_keybind_a:get() then
		print('example_keybind_a is active')
	end
end

cb.add(cb.tick, on_tick)

Parameters

string var

string text

number value

table options

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:dropdown('example_dropdown', 'Example Dropdown', 1, {'Option A', 'Option B', 'Option C',})

local function on_tick()
	print(myMenu.example_dropdown:get())
end

cb.add(cb.tick, on_tick)

Parameters

string var

string text

string buttonText

function callback

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:button('example_button', 'Example Button', 'My Button', function() print('button was pressed') end)

Parameters

string var

string text

number red

number green

number blue

number alpha

Return Value

void

local myMenu = menu('example_menu', 'Example Menu')
myMenu:color('example_color', 'Example Color', 255, 0, 0, 255)

local function on_draw()
	graphics.draw_text_2D('foo', 14, game.cursorPos.x, game.cursorPos.y, myMenu.example_color:get())
end

cb.add(cb.draw, on_draw)

Return Value

boolean returns true if the menu is currently open

local myMenu = menu('example_menu', 'Example Menu')

local function on_tick()
	if myMenu:isopen() then
		print('menu is open')
	end
end

cb.add(cb.tick, on_tick)

Return Value

boolean returns true if the menu is in classic style

Parameters

table colors

table styles

You can get parameters from Hanbot Setting - Theme Settings - Export Theme

Parameters

string property

mixed value

Return Value

void

--[[
The following properties can be set on their respective instances:
	'tooltip'
	'callback'
	'value'
	'text'
	'visible'
	'buttonText'
	'red'
	'green'
	'blue'
	'alpha'
	'options'
	'toggleValue'
	'toggle'
	'key'
	'min'
	'max'
	'step',
	'icon',
]]

local myMenu = menu('example_menu', 'Example Menu')
myMenu:slider('example_slider', 'Example Slider', 100, 0, 150, 5)

myMenu.example_slider:set('tooltip', 'This text will appear when the mouse is hovering Example Slider')
myMenu.example_slider:set('callback', function(old, new)
	-- callback will be triggered after example_slider:get()'s value changed
	print(('example_slider changed from %u to %u'):format(old, new))
end)

local myIcon = graphics.sprite('XXX/menu_icon.png')
myMenu.example_slider:set('icon', myIcon)

md5

md5.file(path)

Parameters

string path

Return Values

string returns md5 hash

md5.sum(str)

Parameters

string str

Return Values

string returns integer md5 hash

md5.tohex(str, upper)

Parameters

string str

boolean upper

Return Values

string returns str in hex, in uppercase if upper is true