diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index da6aa90ea..ba2eb06db 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -24,6 +24,7 @@ #include "Map.h" #include "Transports.h" #include "ObjectAccessor.h" +#include "BattleGroundMgr.h" using namespace MaNGOS; @@ -208,5 +209,34 @@ bool CannibalizeObjectCheck::operator()(Corpse* u) return false; } +void MaNGOS::RespawnDo::operator()( Creature* u ) const +{ + // prevent respawn creatures for not active BG event + Map* map = u->GetMap(); + if (map->IsBattleGroundOrArena()) + { + BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetDBTableGUIDLow()); + if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2)) + return; + } + + u->Respawn(); +} + +void MaNGOS::RespawnDo::operator()( GameObject* u ) const +{ + // prevent respawn gameobject for not active BG event + Map* map = u->GetMap(); + if (map->IsBattleGroundOrArena()) + { + BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetDBTableGUIDLow()); + if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2)) + return; + } + + u->Respawn(); +} + + template void ObjectUpdater::Visit(GameObjectMapType &); template void ObjectUpdater::Visit(DynamicObjectMapType &); diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 35fcd0eb9..e7ce0813b 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -627,8 +627,8 @@ namespace MaNGOS { public: RespawnDo() {} - void operator()(Creature* u) const { u->Respawn(); } - void operator()(GameObject* u) const { u->Respawn(); } + void operator()(Creature* u) const; + void operator()(GameObject* u) const; void operator()(WorldObject*) const {} void operator()(Corpse*) const {} }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 36616c4de..d4cf8ae9c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10622" + #define REVISION_NR "10623" #endif // __REVISION_NR_H__