Add Outdoor PvP handlers to various files

This commit is contained in:
Xfurry 2012-08-17 18:47:59 +02:00 committed by Antz
parent 525ec3ea4c
commit e955c3bc8f
6 changed files with 68 additions and 4 deletions

View file

@ -42,6 +42,7 @@
#include "Vehicle.h"
#include "BattleGround.h"
#include "InstanceData.h"
#include "OutdoorPvP/OutdoorPvP.h"
#include "MapPersistentStateMgr.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
@ -1097,6 +1098,13 @@ uint32 Unit::DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDa
he->DuelComplete(DUEL_INTERUPTED);
}
// handle player kill in outdoor pvp
if (player_tap && pVictim->GetTypeId() == TYPEID_PLAYER && pVictim != this)
{
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(player_tap->GetCachedZoneId()))
outdoorPvP->HandlePlayerKill(player_tap, pVictim);
}
// battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->InBattleGround())
{
@ -1328,6 +1336,10 @@ void Unit::JustKilledCreature(Creature* victim)
if (InstanceData* mapInstance = victim->GetInstanceData())
mapInstance->OnCreatureDeath(victim);
// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleCreatureDeath(victim);
if (victim->IsLinkingEventTrigger())
victim->GetMap()->GetCreatureLinkingHolder()->DoCreatureLinkingEvent(LINKING_EVENT_DIE, victim);