Skip to content

Events

Event Registering

In order to register to a game event, g_sdk->event_manager->register_callback must be called inside PluginLoad

Example:

cpp
void __fastcall present()
{
    g_sdk->log_console( "[+] Presenting the frame!" );
}

extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
    g_sdk = sdk;
    
    g_sdk->event_manager->register_callback( event_manager::event::present, reinterpret_cast< void* >( present ) );

    g_sdk->log_console( "[+] ExampleModule loaded!" );

    return true;
}
void __fastcall present()
{
    g_sdk->log_console( "[+] Presenting the frame!" );
}

extern "C" __declspec( dllexport ) bool PluginLoad( core_sdk* sdk, void** custom_sdk )
{
    g_sdk = sdk;
    
    g_sdk->event_manager->register_callback( event_manager::event::present, reinterpret_cast< void* >( present ) );

    g_sdk->log_console( "[+] ExampleModule loaded!" );

    return true;
}

Event Unregistering

In order to unregister from a game event, g_sdk->event_manager->unregister_callback must be called inside PluginUnload

cpp
extern "C" __declspec( dllexport ) void PluginUnload()
{
    g_sdk->event_manager->unregister_callback( event_manager::event::present, reinterpret_cast< void* >( present ) );

    g_sdk->log_console( "[-] ExampleModule unloaded!" );
}
extern "C" __declspec( dllexport ) void PluginUnload()
{
    g_sdk->event_manager->unregister_callback( event_manager::event::present, reinterpret_cast< void* >( present ) );

    g_sdk->log_console( "[-] ExampleModule unloaded!" );
}

event::present

INFO

Triggers every rendering frame - should only be used for UI drawings

TIP

The following example draws a white circle in the middle of the screen

cpp
void __fastcall present()
{
    const auto width = g_sdk->renderer->get_window_width();
	const auto height = g_sdk->renderer->get_window_height();
	math::vector2 screen_center { static_cast< float >( width ) * 0.5f , static_cast< float >( height ) * 0.5f };

	g_sdk->renderer->add_circle_2d( screen_center, 20.f, 1.f, 0xFFFFFFFF );
}
void __fastcall present()
{
    const auto width = g_sdk->renderer->get_window_width();
	const auto height = g_sdk->renderer->get_window_height();
	math::vector2 screen_center { static_cast< float >( width ) * 0.5f , static_cast< float >( height ) * 0.5f };

	g_sdk->renderer->add_circle_2d( screen_center, 20.f, 1.f, 0xFFFFFFFF );
}

event::draw_environment

INFO

Triggers every rendering frame - should only be used for UI drawings under the environment

TIP

The following example draws a circle under the environment

cpp
void __fastcall draw_environment()
{
	auto player = g_sdk->object_manager->get_local_player();
	if( player )
		g_sdk->renderer->add_circle_3d( player->get_position(), 20.f, 1.f, 0xFFFFFFFF );
}
void __fastcall draw_environment()
{
	auto player = g_sdk->object_manager->get_local_player();
	if( player )
		g_sdk->renderer->add_circle_3d( player->get_position(), 20.f, 1.f, 0xFFFFFFFF );
}

event::wndproc

INFO

Triggers when the game receives a window message
More info

TIP

The following example prints a console message whenever LMB is pressed

cpp
void __fastcall wndproc( uint32_t msg, uint32_t wparam, uint32_t lparam )
{
	if ( msg == WM_LBUTTONDOWN )
	{
		g_sdk->log_console( "[+] LMB was pressed" );
	}
}
void __fastcall wndproc( uint32_t msg, uint32_t wparam, uint32_t lparam )
{
	if ( msg == WM_LBUTTONDOWN )
	{
		g_sdk->log_console( "[+] LMB was pressed" );
	}
}

event::game_update

INFO

Triggers every game frame - should only be used for module logic

TIP

The following example prints a console message while the player is moving

cpp
void __fastcall game_update()
{
    const auto player = g_sdk->object_manager->get_local_player();
    if ( player && player->is_moving() )
    {
        g_sdk->log_console( "[+] Moving!" );
    }
}
void __fastcall game_update()
{
    const auto player = g_sdk->object_manager->get_local_player();
    if ( player && player->is_moving() )
    {
        g_sdk->log_console( "[+] Moving!" );
    }
}

event::create_object

INFO

Triggers for each object creation

TIP

The following example logs the name of the created object

cpp
void __fastcall create_object( game_object* object )
{
    g_sdk->log_console( "[+] Object %s created", object->get_name().c_str() );
}
void __fastcall create_object( game_object* object )
{
    g_sdk->log_console( "[+] Object %s created", object->get_name().c_str() );
}

event::delete_object

INFO

Triggers for each object deletion

TIP

The following example logs the name of the deleted object

cpp
void __fastcall delete_object( game_object* object )
{
    g_sdk->log_console( "[-] Object %s deleted", object->get_name().c_str() );
}
void __fastcall delete_object( game_object* object )
{
    g_sdk->log_console( "[-] Object %s deleted", object->get_name().c_str() );
}

event::create_missile

INFO

Triggers for each missile creation

TIP

The following example logs the name and the attack id of the cast linked to the missile

cpp
void __fastcall create_missile( game_object* missile )
{
    const auto spell_cast = missile->get_missile_spell_cast();
    if ( spell_cast )
    {
        const auto attack_id = spell_cast->get_attack_id();
        const auto name = spell_cast->get_spell_data()->get_static_data()->get_name();

        g_sdk->log_console( "[+] Missile linked to attack id %d created - name: %s", attack_id, name );
    }
}
void __fastcall create_missile( game_object* missile )
{
    const auto spell_cast = missile->get_missile_spell_cast();
    if ( spell_cast )
    {
        const auto attack_id = spell_cast->get_attack_id();
        const auto name = spell_cast->get_spell_data()->get_static_data()->get_name();

        g_sdk->log_console( "[+] Missile linked to attack id %d created - name: %s", attack_id, name );
    }
}

event::basic_attack

INFO

Triggers when an AI object starts the cast of a basic attack

TIP

The following example logs the names of both the source and the target of the attack

cpp
void __fastcall basic_attack( game_object* object, game_object* target, spell_cast* cast )
{
    g_sdk->log_console( "[+] %s started attacking %s", object->get_name().c_str(), target->get_name().c_str() );
}
void __fastcall basic_attack( game_object* object, game_object* target, spell_cast* cast )
{
    g_sdk->log_console( "[+] %s started attacking %s", object->get_name().c_str(), target->get_name().c_str() );
}

event::stop_cast

INFO

Triggers when an AI stops the cast

TIP

The following example logs the name of the cast that got stopped

cpp
void __fastcall stop_cast( game_object* object, spell_cast* cast, bool was_attack_processed )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s stopped the cast %s (processed: %d)", object->get_name().c_str(), name, was_attack_processed );
}
void __fastcall stop_cast( game_object* object, spell_cast* cast, bool was_attack_processed )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s stopped the cast %s (processed: %d)", object->get_name().c_str(), name, was_attack_processed );
}

event::process_cast

INFO

Triggers when an AI starts the cast of a spell

TIP

The following example logs the name of the cast that was started

cpp
void __fastcall process_cast( game_object* object, spell_cast* cast )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s started casting %s", object->get_name().c_str(), name );
}
void __fastcall process_cast( game_object* object, spell_cast* cast )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s started casting %s", object->get_name().c_str(), name );
}

event::buff_gain

INFO

Triggers when an AI gains a buff

TIP

The following example logs the name of the gained buff

cpp
void __fastcall buff_gain( game_object* object, buff_instance* buff )
{
	g_sdk->log_console( "[+] %s gained buff %s", object->get_name().c_str(), buff->get_name().c_str() );
}
void __fastcall buff_gain( game_object* object, buff_instance* buff )
{
	g_sdk->log_console( "[+] %s gained buff %s", object->get_name().c_str(), buff->get_name().c_str() );
}

event::buff_loss

INFO

Triggers when an AI loses a buff

TIP

The following example logs the name of the lost buff

cpp
void __fastcall buff_loss( game_object* object, buff_instance* buff )
{
	g_sdk->log_console( "[+] %s lost buff %s", object->get_name().c_str(), buff->get_name().c_str() );
}
void __fastcall buff_loss( game_object* object, buff_instance* buff )
{
	g_sdk->log_console( "[+] %s lost buff %s", object->get_name().c_str(), buff->get_name().c_str() );
}

event::draw_world

INFO

Triggers every world rendering frame - should only be used for world layer drawings

TIP

The following example draws a 3D white circle around the player

cpp
void __fastcall draw_world()
{
	const auto player = g_sdk->object_manager->get_local_player();
	if ( player )
	{
		auto position = player->get_position();
		g_sdk->renderer->add_circle_3d( position, player->get_bounding_radius(), 1.f, 0xFFFFFFFF );
	}
}
void __fastcall draw_world()
{
	const auto player = g_sdk->object_manager->get_local_player();
	if ( player )
	{
		auto position = player->get_position();
		g_sdk->renderer->add_circle_3d( position, player->get_bounding_radius(), 1.f, 0xFFFFFFFF );
	}
}

event::neutral_minion_kill

INFO

Triggers every time a jungle camp monster gets killed

TIP

The following example logs information about the killed monster

cpp
void __fastcall neutral_minion_kill( game_object* object, game_object* minion, int camp_side_team_id )
{
	const auto ally_camp = camp_side_team_id == object->get_team_id();

	g_sdk->log_console( "[+] %s killed a monster (%s) from an %s camp", object->get_name().c_str(),
					    minion->get_name().c_str(), ally_camp ? "allied" : "enemy" );
}
void __fastcall neutral_minion_kill( game_object* object, game_object* minion, int camp_side_team_id )
{
	const auto ally_camp = camp_side_team_id == object->get_team_id();

	g_sdk->log_console( "[+] %s killed a monster (%s) from an %s camp", object->get_name().c_str(),
					    minion->get_name().c_str(), ally_camp ? "allied" : "enemy" );
}

event::new_path

INFO

Triggers every time an AI changes its path

TIP

The following example logs the speed of the dash when an AI dashes

cpp
void __fastcall new_path( game_object* object, bool is_dash, float dash_speed )
{
	if ( is_dash )
	{
		g_sdk->log_console( "[+] %s has dashed with %.02f speed", object->get_name().c_str(), dash_speed );
	}
}
void __fastcall new_path( game_object* object, bool is_dash, float dash_speed )
{
	if ( is_dash )
	{
		g_sdk->log_console( "[+] %s has dashed with %.02f speed", object->get_name().c_str(), dash_speed );
	}
}

event::execute_cast

INFO

Triggers when an AI finishes the active cast

TIP

The following example logs the name of the cast that was finished

cpp
void __fastcall execute_cast( game_object* object, spell_cast* cast )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s finished casting %s", object->get_name().c_str(), name );
}
void __fastcall execute_cast( game_object* object, spell_cast* cast )
{
    const auto name = cast->get_spell_data()->get_static_data()->get_name();

    g_sdk->log_console( "[+] %s finished casting %s", object->get_name().c_str(), name );
}

event::issue_order

DANGER

This event does not trigger for issue_order called from modules (including Orbwalker)

WARNING

This is a preventable event, the return value determines whether the order will be allowed or not

INFO

Triggers when the local player tries to issue an order

TIP

The following example prevents game_object_order::stop orders from being executed

cpp
bool __fastcall issue_order( game_object* object, game_object_order order_type, math::vector3 position, game_object* target, bool move_pet )
{
	if ( order_type == game_object_order::stop )
	{
		g_sdk->log_console( "[+] Stop order prevented!" );
		return false;
	}

	return true;
}
bool __fastcall issue_order( game_object* object, game_object_order order_type, math::vector3 position, game_object* target, bool move_pet )
{
	if ( order_type == game_object_order::stop )
	{
		g_sdk->log_console( "[+] Stop order prevented!" );
		return false;
	}

	return true;
}

event::cast_spell

DANGER

This event does not trigger for cast_spell called from modules

WARNING

This is a preventable event, the return value determines whether the cast will be allowed or not

INFO

Triggers when the local player tries to cast a spell

TIP

The following example prevents the spell on slot 0 from being casted

cpp
bool __fastcall cast_spell( game_object* object, int spell_slot, math::vector3 position, game_object* target )
{
	if ( spell_slot == 0 )
	{
		g_sdk->log_console( "[+] Prevented the cast of spell 0!" );
		return false;
	}

	return true;
}
bool __fastcall cast_spell( game_object* object, int spell_slot, math::vector3 position, game_object* target )
{
	if ( spell_slot == 0 )
	{
		g_sdk->log_console( "[+] Prevented the cast of spell 0!" );
		return false;
	}

	return true;
}

event::packet

WARNING

This event is only enabled on DEVELOPER builds

INFO

Triggers when the client receives a network packet

TIP

The following example logs the opcode of the received packet

cpp
void __fastcall packet( uint16_t packet_opcode, uint64_t packet_data, uint32_t rpc_network_id )
{
    g_sdk->log_console( "[+] Received packet with opcode 0x%x", packet_opcode );
}
void __fastcall packet( uint16_t packet_opcode, uint64_t packet_data, uint32_t rpc_network_id )
{
    g_sdk->log_console( "[+] Received packet with opcode 0x%x", packet_opcode );
}

event::animation

INFO

Triggers when an AI plays an animation

TIP

The following example logs the hash of the played animation

cpp
void __fastcall animation( game_object* object, uint32_t animation_hash )
{
	g_sdk->log_console( "[+] %s plays animation 0x%x", object->get_name().c_str(), animation_hash );
}
void __fastcall animation( game_object* object, uint32_t animation_hash )
{
	g_sdk->log_console( "[+] %s plays animation 0x%x", object->get_name().c_str(), animation_hash );
}

event::cast_heal

INFO

Triggers when an AI object casts heal

TIP

The following example logs the source, the target and the amount of heal that was casted

cpp
void __fastcall cast_heal( game_object* object, game_object* target, float amount )
{
	g_sdk->log_console( "[+] %s casted heal on %s (amount: %.02f)", object->get_name().c_str(),
					    target->get_name().c_str(), amount );
}
void __fastcall cast_heal( game_object* object, game_object* target, float amount )
{
	g_sdk->log_console( "[+] %s casted heal on %s (amount: %.02f)", object->get_name().c_str(),
					    target->get_name().c_str(), amount );
}

event::spell_hit

INFO

Triggers when a spell has been hit

cpp
void __fastcall spell_hit( game_object* object, spell_cast* cast )
{
	g_sdk->log_console( "[+] %s hit spell slot %d", object->get_name().c_str(),
					    cast->get_spell_slot() );
}
void __fastcall spell_hit( game_object* object, spell_cast* cast )
{
	g_sdk->log_console( "[+] %s hit spell slot %d", object->get_name().c_str(),
					    cast->get_spell_slot() );
}