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

feat: add GetRank method for creatures #173

Merged
merged 1 commit into from
May 4, 2024
Merged

feat: add GetRank method for creatures #173

merged 1 commit into from
May 4, 2024

Conversation

kabigon143
Copy link

Introduces the GetRank method. Rank is used in creature_template to set the rank of the creature, e.g. rare (4) or rare elite (2).

You can test this in game with this lua script:

local command = "#rank"
local function FetchCreatureRank(event, player, message, type, language)
    if message == command then
        local creature = player:GetSelection() -- Get the player's target
        
        if creature then
            local rank = creature:GetRank() -- Fetch the rank of the selected creature
            
            if rank then
                print("Creature Rank: " .. rank) -- Print the creature's rank
            else
                print("Creature rank not available.")
            end
        else
            print("No creature selected.")
        end

        return false -- Prevent the default chat behavior
    end
end
RegisterPlayerEvent(18, FetchCreatureRank)

If the player types "#rank" while having targeted a creature, the script will print the creature's rank to the console.

@55Honey 55Honey merged commit 152a491 into azerothcore:master May 4, 2024
1 check passed
@55Honey
Copy link
Member

55Honey commented May 4, 2024

Thanks for the PR!

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