# Spellbook

# Description

The Spellbook class is the core class for managing and manipulating hero skills, through which you can get the current casting state, skill position information, as well as caster and target information.

# How to Use

AIBaseClient* hero = ObjectManager::Player();
if (hero) {
    Spellbook* book = hero->SpellBook();
    if (book && book->IsCastingSpell()) {
        // Hero is currently casting a skill
    }
}

# Slot

eSpellSlot Slot()

Gets the slot of the skill currently being cast.

Spellbook* book = hero->SpellBook();
if (book) {
    eSpellSlot currentSlot = book->Slot();
    // Determine what skill is being cast based on the slot
}

# Slot2

eSpellSlot Slot2()

Gets the secondary slot of the skill currently being cast.

Spellbook* book = hero->SpellBook();
if (book) {
    eSpellSlot secondarySlot = book->Slot2();
    // Use secondary slot information
}

# CastTime

float CastTime()

Gets the time point when the current skill started casting.

Spellbook* book = hero->SpellBook();
if (book) {
    float castTime = book->CastTime();
    // Use casting start time
}

# CastEndTime

float CastEndTime()

Gets the time point when the current skill casting will end.

Spellbook* book = hero->SpellBook();
if (book) {
    float endTime = book->CastEndTime();
    // Calculate how much longer the skill needs to finish casting
    float remainingCastTime = endTime - Game::Time();
}

# EndTime

float EndTime()

Gets the end time point of the skill casting.

Spellbook* book = hero->SpellBook();
if (book) {
    float endTime = book->EndTime();
    // Use skill end time
}

# Delay

float Delay()

Gets the delay of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    float delay = book->Delay();
    // Use skill delay information
}

# CastDelay

float CastDelay()

Gets the casting delay of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    float castDelay = book->CastDelay();
    // Use casting delay for calculations
}

# MissileRadius

float MissileRadius()

Gets the radius of the current skill projectile.

Spellbook* book = hero->SpellBook();
if (book) {
    float radius = book->MissileRadius();
    // Use projectile radius information
}

# MissileNetworkId

int MissileNetworkId()

Gets the network ID of the current skill projectile.

Spellbook* book = hero->SpellBook();
if (book) {
    int missileId = book->MissileNetworkId();
    // Use projectile network ID
}

# Start

Vector const& Start()

Gets the starting position of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    Vector startPos = book->Start();
    // Use skill starting position
}

# End

Vector const& End()

Gets the target position of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    Vector endPos = book->End();
    // Use skill target position
}

# End2

Vector const& End2()

Gets the secondary target position of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    Vector secondaryEndPos = book->End2();
    // Use skill secondary target position
}

# Direction

Vector const& Direction()

Gets the direction vector of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    Vector dir = book->Direction();
    // Use skill direction vector
}

# IsAutoAttacking

bool IsAutoAttacking()

Determines if currently performing a basic attack.

Spellbook* book = hero->SpellBook();
if (book && book->IsAutoAttacking()) {
    // Hero is performing a basic attack
}

# IsCastingSpell

bool IsCastingSpell()

Determines if currently casting a skill.

Spellbook* book = hero->SpellBook();
if (book && book->IsCastingSpell()) {
    // Hero is casting a skill
}

# Sender

AIBaseClient* Sender()

Gets the caster of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    AIBaseClient* caster = book->Sender();
    if (caster) {
        // Use caster information
    }
}

# Target

AIBaseClient* Target()

Gets the target of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    AIBaseClient* target = book->Target();
    if (target) {
        // Use skill target information
    }
}

# SData

SpellData* SData()

Gets the skill data of the current skill.

Spellbook* book = hero->SpellBook();
if (book) {
    SpellData* spellData = book->SData();
    if (spellData) {
        // Use skill data
    }
}