feat(Core/Scripting): Implement OnBeforeSetBossState (#14891)

This commit is contained in:
55Honey
2023-02-07 17:15:17 +01:00
committed by GitHub
parent e7e119283f
commit a1fb48391b
3 changed files with 25 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptMgrMacros.h"
@@ -189,3 +190,20 @@ void ScriptMgr::OnInstanceIdRemoved(uint32 instanceId)
script->OnInstanceIdRemoved(instanceId);
});
}
/**
* @brief Called when any raid boss has their state updated (e.g. pull, reset, kill).
* @details Careful checks for old- and newState are required, since it can fire multiple times and not only when combat starts/ends.
*
* @param id The id of the boss in the [instance]
* @param newState The new boss state to be applied to this boss
* @param oldState The previously assigned state of this boss
* @param instance A pointer to the [map] object of the instance
*/
void ScriptMgr::OnBeforeSetBossState(uint32 id, EncounterState newState, EncounterState oldState, Map* instance)
{
ExecuteScript<GlobalScript>([&](GlobalScript* script)
{
script->OnBeforeSetBossState(id, newState, oldState, instance);
});
}