Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spell:GetReagentCost() function #165

Merged
merged 1 commit into from
Feb 25, 2024

Conversation

3ster
Copy link

@3ster 3ster commented Jan 28, 2024

Returns a table containing the reagent cost of the spell in the format

reagents = {
    [ItemTemplate] = amount,
    [ItemTemplate] = amount,
    ...
}

Example usage:

local function OnSpellCast(_, player, spell, _)
    local reagents = spell:GetReagentCost()
    player:SendBroadcastMessage("You just cast " .. spell:GetEntry() .. " with the following reagents:")
    for reagent, count in pairs(reagents) do
        player:SendBroadcastMessage(string.format("%d x %s", count, reagent:GetName()))
    end
    return false
end

RegisterPlayerEvent(PLAYER_EVENT_ON_SPELL_CAST, OnSpellCast)

@55Honey 55Honey merged commit 2bd22cf into azerothcore:master Feb 25, 2024
1 check passed
@55Honey 55Honey mentioned this pull request Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants