mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[12154] Add HandleEvent and HandleGameObjectCreate to battleground class
This commit is contained in:
parent
c8814791e1
commit
522ccf02ae
3 changed files with 25 additions and 7 deletions
|
|
@ -458,7 +458,13 @@ class BattleGround
|
||||||
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
|
virtual void HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) {}
|
||||||
// must be implemented in BG subclass if need AND call base class generic code
|
// must be implemented in BG subclass if need AND call base class generic code
|
||||||
virtual void HandleKillPlayer(Player* player, Player* killer);
|
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 */
|
/* Battleground events */
|
||||||
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius)
|
||||||
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
|
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
|
||||||
|
|
||||||
|
// Notify the battleground script
|
||||||
|
if (map->IsBattleGroundOrArena())
|
||||||
|
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
|
||||||
|
else
|
||||||
|
{
|
||||||
// Notify the outdoor pvp script
|
// Notify the outdoor pvp script
|
||||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
|
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
|
||||||
outdoorPvP->HandleGameObjectCreate(this);
|
outdoorPvP->HandleGameObjectCreate(this);
|
||||||
|
}
|
||||||
|
|
||||||
// Notify the map's instance data.
|
// Notify the map's instance data.
|
||||||
// Only works if you create the object in it, not if it is moves to that map.
|
// 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)
|
if (eventId)
|
||||||
{
|
{
|
||||||
// Notify the outdoor pvp script
|
// Notify the battleground or outdoor pvp script
|
||||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
|
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
|
// Allow only certain events to be handled by other script engines
|
||||||
if (outdoorPvP->HandleEvent(eventId, this))
|
if (outdoorPvP->HandleEvent(eventId, this))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12153"
|
#define REVISION_NR "12154"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue