# SpellDataInst

# Description

The SpellDataInst class represents an instance of a hero's skill, containing information about the current state of the skill, such as cooldown time, level, charge count, and methods for casting the skill.

# How to Use

AIBaseClient* hero = ObjectManager::Player();
if (hero) {
    SpellDataInst* qSpell = hero->GetSpell(eSpellSlot::Q);
    if (qSpell && qSpell->Level() > 0 && qSpell->RemainingCooldown() <= 0) {
        // Q skill has been learned and is not on cooldown, can be used
    }
}

# Ammo

int Ammo()

Gets the current ammo count of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    int ammo = spell->Ammo();
    // Use ammo count
}

# GunAmmo

int GunAmmo()

Gets the gun ammo count of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    int gunAmmo = spell->GunAmmo();
    // Use gun ammo count
}

# Level

int Level()

Gets the current level of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell) {
    int level = spell->Level();
    // Use skill level
}

# Slot

eSpellSlot Slot()

Gets the slot of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell) {
    eSpellSlot slot = spell->Slot();
    // Use skill slot
}

# ToggleState

int ToggleState()

Gets the toggle state of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    int toggleState = spell->ToggleState();
    // Use skill toggle state
}

# Cooldown

float Cooldown()

Gets the total cooldown time of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    float cd = spell->Cooldown();
    // Use skill total cooldown time
}

# RemainingCooldown

float RemainingCooldown()

Gets the remaining cooldown time of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell) {
    float remainingCd = spell->RemainingCooldown();
    if (remainingCd <= 0) {
        // Skill has finished cooling down, can be used
    }
}

# AmmoRechargeStart

float AmmoRechargeStart()

Gets the time point when ammo started recharging.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    float rechargeStart = spell->AmmoRechargeStart();
    // Use ammo recharge start time
}

# ChargingStartTime

float ChargingStartTime()

Gets the time point when the skill started charging.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    float chargingStart = spell->ChargingStartTime();
    // Use skill charging start time
}

# SData

SpellData* SData()

Gets the basic data of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell) {
    SpellData* spellData = spell->SData();
    if (spellData) {
        // Use skill basic data
    }
}

# Stacks

int Stacks()

Gets the current stack count of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell) {
    int stacks = spell->Stacks();
    // Use skill stack count
}

# IconIndex

uint8_t IconIndex()

Gets the icon index of the skill.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell) {
    uint8_t iconIndex = spell->IconIndex();
    // Use skill icon index
}

# LevelUpSpell

void LevelUpSpell()

Increases the skill level.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->CanBeUpgraded()) {
    spell->LevelUpSpell();
    // Skill has been upgraded
}

# CanBeUpgraded

bool CanBeUpgraded()

Determines if the skill can be upgraded.

SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell && spell->CanBeUpgraded()) {
    // Skill can be upgraded
}

# CastChargingSpell

bool CastChargingSpell(Vector const& position, bool triggerEvent = true)

Casts a charging skill to the specified position.

Parameter Name Parameter Type Description
position Vector const& Target position
triggerEvent bool Whether to trigger events, default is true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector targetPos = enemy->Position();
    spell->CastChargingSpell(targetPos);
}

# CastSpell

bool CastSpell(bool triggerEvent = true)

Casts a non-targeted skill.

Parameter Name Parameter Type Description
triggerEvent bool Whether to trigger events, default is true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::R);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    spell->CastSpell();
}

# CastSpell

bool CastSpell(AIBaseClient* target, bool triggerEvent = true)

Casts a skill targeted at a unit.

Parameter Name Parameter Type Description
target AIBaseClient* Target unit
triggerEvent bool Whether to trigger events, default is true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::W);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    AIBaseClient* enemy = GetNearestEnemy();
    if (enemy) {
        spell->CastSpell(enemy);
    }
}

# CastSpell

bool CastSpell(Vector const& position, bool triggerEvent = true)

Casts a skill targeted at a position.

Parameter Name Parameter Type Description
position Vector const& Target position
triggerEvent bool Whether to trigger events, default is true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::E);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector targetPos = enemy->Position();
    spell->CastSpell(targetPos);
}

# CastSpell

bool CastSpell(Vector const& startPosition, Vector const& endPosition, bool triggerEvent = true)

Casts a skill with start and end positions.

Parameter Name Parameter Type Description
startPosition Vector const& Start position
endPosition Vector const& Target position
triggerEvent bool Whether to trigger events, default is true
SpellDataInst* spell = hero->GetSpell(eSpellSlot::Q);
if (spell && spell->Level() > 0 && spell->RemainingCooldown() <= 0) {
    Vector startPos = hero->Position();
    Vector endPos = enemy->Position();
    spell->CastSpell(startPos, endPos);
}