mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 14:05:28 +00:00
feat(Core/Scripting): Implement OnBeforeCreatureSelectLevel() hook (#17391)
* Add `OnBeforeCreatureSelectLevel()` hook - allows modules to alter the level of a creature just before it is set * Fix missing class name. * Hook should catch even if the level isn't being changed. * Trim whitespace. * Revert "Trim whitespace." This reverts commit 76768d85c0b9878828b71a008e709c1df7ddadc5. * Fix whitespace
This commit is contained in:
@@ -1486,6 +1486,9 @@ void Creature::SelectLevel(bool changelevel)
|
||||
uint8 minlevel = std::min(cInfo->maxlevel, cInfo->minlevel);
|
||||
uint8 maxlevel = std::max(cInfo->maxlevel, cInfo->minlevel);
|
||||
uint8 level = minlevel == maxlevel ? minlevel : urand(minlevel, maxlevel);
|
||||
|
||||
sScriptMgr->OnBeforeCreatureSelectLevel(cInfo, this, level);
|
||||
|
||||
if (changelevel)
|
||||
SetLevel(level);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user