[10623] Make .respawn work correctly with BG event spawns

This commit is contained in:
VladimirMangos 2010-10-19 11:00:34 +04:00
parent 2101b1ba0e
commit 22bc9c80a1
3 changed files with 33 additions and 3 deletions

View file

@ -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 &);

View file

@ -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 {}
};

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10622"
#define REVISION_NR "10623"
#endif // __REVISION_NR_H__