[12154] Add HandleEvent and HandleGameObjectCreate to battleground class

This commit is contained in:
stfx 2012-08-30 12:12:53 +02:00 committed by Antz
parent c8814791e1
commit 522ccf02ae
3 changed files with 25 additions and 7 deletions

View file

@ -458,7 +458,13 @@ class BattleGround
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
// must be implemented in BG subclass if need AND call base class generic code
virtual void HandleKillPlayer(Player* player, Player* killer);
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/) { return; };
virtual void HandleKillUnit(Creature* /*unit*/, Player* /*killer*/) {}
// Process Capture event
virtual bool HandleEvent(uint32 /*eventId*/, GameObject* /*go*/) { return false; }
// Called when a gameobject is created
virtual void HandleGameObjectCreate(GameObject* /*go*/) {}
/* Battleground events */
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}

View file

@ -166,9 +166,15 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius)
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
// Notify the battleground script
if (map->IsBattleGroundOrArena())
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
else
{
// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleGameObjectCreate(this);
}
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
@ -2158,8 +2164,14 @@ void GameObject::TickCapturePoint()
if (eventId)
{
// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
// Notify the battleground or outdoor pvp script
if (BattleGround* bg = (*capturingPlayers.begin())->GetBattleGround())
{
// Allow only certain events to be handled by other script engines
if (bg->HandleEvent(eventId, this))
return;
}
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
{
// Allow only certain events to be handled by other script engines
if (outdoorPvP->HandleEvent(eventId, this))

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12153"
#define REVISION_NR "12154"
#endif // __REVISION_NR_H__