TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BfGraveyard Class Reference

#include <Battlefield.h>

Public Member Functions

 BfGraveyard (Battlefield *Bf)
 
void GiveControlTo (TeamId team)
 
TeamId GetControlTeamId () const
 
float GetDistance (Player *player)
 
void Initialize (TeamId startcontrol, uint32 gy)
 
void SetSpirit (Creature *spirit, TeamId team)
 
void AddPlayer (ObjectGuid player_guid)
 
void RemovePlayer (ObjectGuid player_guid)
 
void Resurrect ()
 
void RelocateDeadPlayers ()
 
bool HasNpc (ObjectGuid guid)
 
bool HasPlayer (ObjectGuid guid)
 
uint32 GetGraveyardId () const
 

Protected Attributes

TeamId m_ControlTeam
 
uint32 m_GraveyardId
 
ObjectGuid m_SpiritGuide [BG_TEAMS_COUNT]
 
GuidSet m_ResurrectQueue
 
Battlefieldm_Bf
 

Constructor & Destructor Documentation

BfGraveyard::BfGraveyard ( Battlefield Bf)
639 {
640  m_Bf = battlefield;
641  m_GraveyardId = 0;
643  m_SpiritGuide[0].Clear();
644  m_SpiritGuide[1].Clear();
645 }
Battlefield * m_Bf
Definition: Battlefield.h:193
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT]
Definition: Battlefield.h:191
Definition: SharedDefines.h:994
uint32 m_GraveyardId
Definition: Battlefield.h:190
TeamId m_ControlTeam
Definition: Battlefield.h:189
void Clear()
Definition: ObjectGuid.h:215

+ Here is the call graph for this function:

Member Function Documentation

void BfGraveyard::AddPlayer ( ObjectGuid  player_guid)
672 {
673  if (!m_ResurrectQueue.count(playerGuid))
674  {
675  m_ResurrectQueue.insert(playerGuid);
676 
677  if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
678  player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
679  }
680 }
GuidSet m_ResurrectQueue
Definition: Battlefield.h:192
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Battleground.h:106

+ Here is the call graph for this function:

TeamId BfGraveyard::GetControlTeamId ( ) const
inline
156 { return m_ControlTeam; }
TeamId m_ControlTeam
Definition: Battlefield.h:189
float BfGraveyard::GetDistance ( Player player)
666 {
667  const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
668  return player->GetDistance2d(safeLoc->Loc.X, safeLoc->Loc.Y);
669 }
float Y
Definition: DBCEnums.h:35
DBCStorage< WorldSafeLocsEntry > sWorldSafeLocsStore(WorldSafeLocsfmt)
Definition: DBCStructure.h:1434
uint32 m_GraveyardId
Definition: Battlefield.h:190
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
uint32 BfGraveyard::GetGraveyardId ( ) const
inline
186 { return m_GraveyardId; }
uint32 m_GraveyardId
Definition: Battlefield.h:190

+ Here is the caller graph for this function:

void BfGraveyard::GiveControlTo ( TeamId  team)
721 {
722  // Guide switching
723  // Note: Visiblity changes are made by phasing
724  /*if (m_SpiritGuide[1 - team])
725  m_SpiritGuide[1 - team]->SetVisible(false);
726  if (m_SpiritGuide[team])
727  m_SpiritGuide[team]->SetVisible(true);*/
728 
729  m_ControlTeam = team;
730  // Teleport to other graveyard, player witch were on this graveyard
732 }
void RelocateDeadPlayers()
Definition: Battlefield.cpp:734
TeamId m_ControlTeam
Definition: Battlefield.h:189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool BfGraveyard::HasNpc ( ObjectGuid  guid)
755 {
756  if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
757  return false;
758 
759  if (!m_Bf->GetCreature(m_SpiritGuide[0]) ||
761  return false;
762 
763  return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
764 }
Battlefield * m_Bf
Definition: Battlefield.h:193
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT]
Definition: Battlefield.h:191
Creature * GetCreature(ObjectGuid guid)
Definition: Battlefield.cpp:845

+ Here is the call graph for this function:

bool BfGraveyard::HasPlayer ( ObjectGuid  guid)
inline
183 { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
GuidSet m_ResurrectQueue
Definition: Battlefield.h:192
void BfGraveyard::Initialize ( TeamId  startcontrol,
uint32  gy 
)
648 {
649  m_ControlTeam = startControl;
650  m_GraveyardId = graveyardId;
651 }
uint32 m_GraveyardId
Definition: Battlefield.h:190
TeamId m_ControlTeam
Definition: Battlefield.h:189

+ Here is the caller graph for this function:

void BfGraveyard::RelocateDeadPlayers ( )
735 {
736  WorldSafeLocsEntry const* closestGrave = NULL;
737  for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
738  {
739  Player* player = ObjectAccessor::FindPlayer(*itr);
740  if (!player)
741  continue;
742 
743  if (closestGrave)
744  player->TeleportTo(player->GetMapId(), closestGrave->Loc.X, closestGrave->Loc.Y, closestGrave->Loc.Z, player->GetOrientation());
745  else
746  {
747  closestGrave = m_Bf->GetClosestGraveYard(player);
748  if (closestGrave)
749  player->TeleportTo(player->GetMapId(), closestGrave->Loc.X, closestGrave->Loc.Y, closestGrave->Loc.Z, player->GetOrientation());
750  }
751  }
752 }
float Z
Definition: DBCEnums.h:36
float Y
Definition: DBCEnums.h:35
Battlefield * m_Bf
Definition: Battlefield.h:193
GuidSet m_ResurrectQueue
Definition: Battlefield.h:192
Definition: DBCStructure.h:1434
arena_t NULL
Definition: jemalloc_internal.h:624
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
float X
Definition: DBCEnums.h:34
DBCPosition3D Loc
Definition: DBCStructure.h:1438
WorldSafeLocsEntry const * GetClosestGraveYard(Player *player)
Definition: Battlefield.cpp:571

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void BfGraveyard::RemovePlayer ( ObjectGuid  player_guid)
683 {
684  m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
685 
686  if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
687  player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
688 }
GuidSet m_ResurrectQueue
Definition: Battlefield.h:192
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Battleground.h:106

+ Here is the call graph for this function:

void BfGraveyard::Resurrect ( )
691 {
692  if (m_ResurrectQueue.empty())
693  return;
694 
695  for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
696  {
697  // Get player object from his guid
698  Player* player = ObjectAccessor::FindPlayer(*itr);
699  if (!player)
700  continue;
701 
702  // Check if the player is in world and on the good graveyard
703  if (player->IsInWorld())
705  spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
706 
707  // Resurrect player
708  player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
709  player->ResurrectPlayer(1.0f);
710  player->CastSpell(player, 6962, true);
711  player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
712 
713  player->SpawnCorpseBones(false);
714  }
715 
716  m_ResurrectQueue.clear();
717 }
Battlefield * m_Bf
Definition: Battlefield.h:193
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT]
Definition: Battlefield.h:191
Definition: Battleground.h:112
Definition: Battleground.h:109
GuidSet m_ResurrectQueue
Definition: Battlefield.h:192
Definition: Creature.h:467
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: Battleground.h:108
Creature * GetCreature(ObjectGuid guid)
Definition: Battlefield.cpp:845
TeamId m_ControlTeam
Definition: Battlefield.h:189

+ Here is the call graph for this function:

void BfGraveyard::SetSpirit ( Creature spirit,
TeamId  team 
)
654 {
655  if (!spirit)
656  {
657  TC_LOG_ERROR("bg.battlefield", "BfGraveyard::SetSpirit: Invalid Spirit.");
658  return;
659  }
660 
661  m_SpiritGuide[team] = spirit->GetGUID();
662  spirit->SetReactState(REACT_PASSIVE);
663 }
ObjectGuid m_SpiritGuide[BG_TEAMS_COUNT]
Definition: Battlefield.h:191
Definition: Unit.h:1129
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void SetReactState(ReactStates st)
Definition: Creature.h:502

+ Here is the call graph for this function:

Member Data Documentation

Battlefield* BfGraveyard::m_Bf
protected
TeamId BfGraveyard::m_ControlTeam
protected
uint32 BfGraveyard::m_GraveyardId
protected
GuidSet BfGraveyard::m_ResurrectQueue
protected
ObjectGuid BfGraveyard::m_SpiritGuide[BG_TEAMS_COUNT]
protected

The documentation for this class was generated from the following files: