[12155] Prevent saving/loading/init capture points in instances

Reason for this are:
1) We don't want them saved/loaded between bg games
2) Saving cp slider is done by go id and would not work for instances
3) There are visual-only capture points in bg (eots)
4) It would be possible to only enable the capture points on bg start

TODO: Move this to OutdoorPvP base class
This commit is contained in:
stfx 2012-08-30 12:16:34 +02:00 committed by Antz
parent 522ccf02ae
commit 012c2ef51b
2 changed files with 12 additions and 9 deletions

View file

@ -70,10 +70,6 @@ GameObject::GameObject() : WorldObject(),
GameObject::~GameObject() GameObject::~GameObject()
{ {
// store the capture point slider value (for non visual, non locked capture points)
GameObjectInfo const* goInfo = GetGOInfo();
if (goInfo && goInfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goInfo->capturePoint.radius && m_lootState == GO_ACTIVATED)
sOutdoorPvPMgr.SetCapturePointSlider(GetEntry(), m_captureSlider);
} }
void GameObject::AddToWorld() void GameObject::AddToWorld()
@ -87,6 +83,13 @@ void GameObject::AddToWorld()
void GameObject::RemoveFromWorld() void GameObject::RemoveFromWorld()
{ {
// store the slider value for non instance, non locked capture points
if (!GetMap()->IsBattleGroundOrArena())
{
if (GetGOInfo()->type == GAMEOBJECT_TYPE_CAPTURE_POINT && m_lootState == GO_ACTIVATED)
sOutdoorPvPMgr.SetCapturePointSlider(GetEntry(), m_captureSlider);
}
///- Remove the gameobject from the accessor ///- Remove the gameobject from the accessor
if (IsInWorld()) if (IsInWorld())
{ {
@ -162,15 +165,15 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
SetGoArtKit(0); // unknown what this is SetGoArtKit(0); // unknown what this is
SetGoAnimProgress(animprogress); SetGoAnimProgress(animprogress);
// set initial data and activate non visual-only capture points
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius)
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
// Notify the battleground script // Notify the battleground script
if (map->IsBattleGroundOrArena()) if (map->IsBattleGroundOrArena())
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this); ((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
else else
{ {
// set initial data and activate non instance capture points
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT)
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));
// 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);

View file

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