[12153] Remove unneeded InBattleGround() as it is already checked by GetBattleGround()

Also call OutdoorPvP handlers before instance script ones
This commit is contained in:
stfx 2012-08-29 01:10:19 +02:00 committed by Antz
parent a53ac2aca7
commit c8814791e1
5 changed files with 15 additions and 19 deletions

View file

@ -166,16 +166,16 @@ 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 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.
// Normally non-players do not teleport to other maps.
if (InstanceData* iData = map->GetInstanceData())
iData->OnObjectCreate(this);
// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleGameObjectCreate(this);
return true;
}
@ -344,9 +344,8 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
if (IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
{
// BattleGround gameobjects case
if (((Player*)ok)->InBattleGround())
if (BattleGround* bg = ((Player*)ok)->GetBattleGround())
bg->HandleTriggerBuff(GetObjectGuid());
if (BattleGround* bg = ((Player*)ok)->GetBattleGround())
bg->HandleTriggerBuff(GetObjectGuid());
}
}
}