mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[10623] Make .respawn work correctly with BG event spawns
This commit is contained in:
parent
2101b1ba0e
commit
22bc9c80a1
3 changed files with 33 additions and 3 deletions
|
|
@ -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<GameObject>(GameObjectMapType &);
|
||||
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType &);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue