Skip to content

Spell Manager

Using Spell Manager SDK

WARNING

Before using the SDK you need to instantiate it using sdk_init::spell_manager() - example provided on this page

Spell Manager Enums

cpp
enum class spell_iteration: uint8_t {
    all = 0,
    ally = 1,
    enemy = 2,
};

enum class spell_type: uint8_t {
    unsupported = 0,
    linear = 1,
    circular = 2,
};
enum class spell_iteration: uint8_t {
    all = 0,
    ally = 1,
    enemy = 2,
};

enum class spell_type: uint8_t {
    unsupported = 0,
    linear = 1,
    circular = 2,
};

Spell Class

WARNING

This class is likely to change in the future

DANGER

Those variables should NEVER be written to, else it will create exception/issues !!

cpp
class spell {
public:
    bool operator==( const spell& a )
    {
        return a.owner == this->owner && a.slot == this->slot;
    }

    int id{}; // Unique Spell ID created by Spell manager
    game_object* owner{}; // Spell caster
    game_object* target{}; // Target (for skills like Fizz R, Hwei R and in the future targetted spells)
    game_object* missile{}; // Missile if exists (can be nullptr)
    game_object* particle{}; // Particle if exists (can be nullptr)
    math::vector3 start_pos{}; // Spell start position
    math::vector3 end_pos{}; // Spell end position
    int slot{}; // Spell slot
    spell_type type{}; // Spell type
    int team_id{}; // Caster Team ID
    bool is_drawing_only{}; // Is drawing only
    bool is_cc{}; // Is CC
    bool is_particle_on_ground{}; // Is particle on ground
    bool has_projectile{}; // If the spell will create a projectile (Does not mean it has an active missile!!)
    bool missile_created{}; // If the missile has been created
    uint32_t missile_effect_key{}; // Spell hash
    float radius{};
    float projectile_speed{}; // If the spell has a projectile speed, otherwise 0 or FLT_MAX
    float travel_time{}; // If the spell has a static travel time, otherwise 0 or FLT_MAX
    float cast_delay{}; // Spell cast delay (not always set !)
    float cast_end_time{}; // Spell cast end time in game time
    float deletion_time{}; // Spell deletion time in game time
    float creation_time{}; // Spell creation time in game time
    std::string missile_name{}; // Spell missile name
    spell* parent_spell{}; // Parent spell (can be nullptr)
    std::vector< spell* > additional_spells{}; // Additional spells example for Leona R (center CC) or Return spells such as Swain E, Sivir Q, Ahri Q..
    bool from_fow{}; // If the spell was casted in Fog of War
    
    bool allow_missile_positions = true; // For internal use
    bool delete_on_missile_deletion = true; // For internal use
    bool pending_deletion{}; // For internal use
    color color{}; // For internal use
    uint8_t previous_alpha = 0; // For internal use
};
class spell {
public:
    bool operator==( const spell& a )
    {
        return a.owner == this->owner && a.slot == this->slot;
    }

    int id{}; // Unique Spell ID created by Spell manager
    game_object* owner{}; // Spell caster
    game_object* target{}; // Target (for skills like Fizz R, Hwei R and in the future targetted spells)
    game_object* missile{}; // Missile if exists (can be nullptr)
    game_object* particle{}; // Particle if exists (can be nullptr)
    math::vector3 start_pos{}; // Spell start position
    math::vector3 end_pos{}; // Spell end position
    int slot{}; // Spell slot
    spell_type type{}; // Spell type
    int team_id{}; // Caster Team ID
    bool is_drawing_only{}; // Is drawing only
    bool is_cc{}; // Is CC
    bool is_particle_on_ground{}; // Is particle on ground
    bool has_projectile{}; // If the spell will create a projectile (Does not mean it has an active missile!!)
    bool missile_created{}; // If the missile has been created
    uint32_t missile_effect_key{}; // Spell hash
    float radius{};
    float projectile_speed{}; // If the spell has a projectile speed, otherwise 0 or FLT_MAX
    float travel_time{}; // If the spell has a static travel time, otherwise 0 or FLT_MAX
    float cast_delay{}; // Spell cast delay (not always set !)
    float cast_end_time{}; // Spell cast end time in game time
    float deletion_time{}; // Spell deletion time in game time
    float creation_time{}; // Spell creation time in game time
    std::string missile_name{}; // Spell missile name
    spell* parent_spell{}; // Parent spell (can be nullptr)
    std::vector< spell* > additional_spells{}; // Additional spells example for Leona R (center CC) or Return spells such as Swain E, Sivir Q, Ahri Q..
    bool from_fow{}; // If the spell was casted in Fog of War
    
    bool allow_missile_positions = true; // For internal use
    bool delete_on_missile_deletion = true; // For internal use
    bool pending_deletion{}; // For internal use
    color color{}; // For internal use
    uint8_t previous_alpha = 0; // For internal use
};

Iterating Spells

INFO

This function iterates all the hero spells currently casting/travelling in the game

void sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration iter, const std::function< bool( sm_sdk::spell* spell ) >& fn )

Example
cpp
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    g_sdk->log_console( "Spell caster: %s | Slot: %d", spell->owner->get_char_name().c_str(), spell->slot );
} );
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    g_sdk->log_console( "Spell caster: %s | Slot: %d", spell->owner->get_char_name().c_str(), spell->slot );
} );

Getting Spells Static Data

INFO

This function returns an array with sm_sdk::static_data of all spells from a specific hero

DANGER

This function should ONLY be called in PluginLoad
You may cache the results yourself if needed for later use in events

std::array< sm_sdk::static_data, 64 > sdk::spell_manager->get_spells_static_data( game_object* hero )

Getting a Spell Missile Position

INFO

This function returns the world position of the spell missile
This can only be called on spells that have projectiles (spell->has_projectile)

math::vector3 sdk::spell_manager->get_missile_position( sm_sdk::spell* spell )

Example
cpp
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    if( spell->has_projectile )
        g_sdk->log_console( "Spell at position: %s", sdk::spell_manager->get_missile_position( spell ).to_string().c_str() );
} );
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    if( spell->has_projectile )
        g_sdk->log_console( "Spell at position: %s", sdk::spell_manager->get_missile_position( spell ).to_string().c_str() );
} );

Knowing if the Spell got casted

INFO

This function returns true if the spell has been casted

bool sdk::spell_manager->is_casted( sm_sdk::spell* spell )

Example
cpp
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    g_sdk->log_console( "Is spell casted: %d", sdk::spell_manager->is_casted( spell ) );
} );
sdk::spell_manager->iterate_spells( sm_sdk::spell_iteration::enemy, [ & ]( sm_sdk::spell* spell )
{
    g_sdk->log_console( "Is spell casted: %d", sdk::spell_manager->is_casted( spell ) );
} );

Getting Spells Count

INFO

This function returns the amount of active spells from the iterator

int sdk::spell_manager->get_spells_count( sm_sdk::spell_iteration iter )

Example
cpp
g_sdk->log_console( "Active enemy spells: %d", sdk::spell_manager->get_spells_count( sm_sdk::spell_iteration::enemy ) );
g_sdk->log_console( "Active enemy spells: %d", sdk::spell_manager->get_spells_count( sm_sdk::spell_iteration::enemy ) );