# BuffInstance

# Description

The BuffInstance class is used to represent and manipulate buff instances in the game, including getting various properties of buffs such as name, caster, type, etc., and checking the status of buffs.

# How to Use

auto hero = ObjectManager::GetLocalPlayer();
for (auto buff : hero->GetBuffs()) {
    if (buff && buff->IsActive() && buff->Type() == eBuffType::Stun) {
        Console::Add("Player is stunned, duration: %.1f seconds", buff->EndTime() - buff->StartTime());
    }
}

# Hash

std::uint32_t Hash()

Gets the hash value of the buff.

std::uint32_t hash = buff->Hash();

# Name

const char* Name()

Gets the name of the buff.

const char* buffName = buff->Name();
Console::Add("Buff name: %s", buffName);

# Caster

AIBaseClient* Caster()

Gets the unit that cast the buff.

auto caster = buff->Caster();
if (caster && caster->IsValid()) {
    Console::Add("Buff caster: %s", caster->Name());
}

# Type

eBuffType Type()

Gets the type of the buff.

if (buff->Type() == eBuffType::Slow) {
    Console::Add("This is a slow effect");
}

# IsActive

bool IsActive()

Checks if the buff is active.

if (buff->IsActive()) {
    // Buff is active
}

# Count

int Count()

Gets the number of stacks of the buff.

int stacks = buff->Count();
Console::Add("Buff stacks: %d", stacks);

# CountAlt

int CountAlt()

Gets the alternative stack count of the buff.

int altStacks = buff->CountAlt();

# StartTime

float StartTime()

Gets the start time of the buff.

float startTime = buff->StartTime();

# EndTime

float EndTime()

Gets the end time of the buff.

float endTime = buff->EndTime();
float remainingTime = endTime - Game::Time();
Console::Add("Buff remaining time: %.1f seconds", remainingTime);