TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CombatLogSender Struct Reference

Public Member Functions

 CombatLogSender (WorldObject const *src, WorldPackets::CombatLog::CombatLogServerPacket *msg, float dist)
 
bool IsInRangeHelper (WorldObject const *object) const
 
void Visit (PlayerMapType &m)
 
void Visit (CreatureMapType &m)
 
void Visit (DynamicObjectMapType &m)
 
template<class SKIP >
void Visit (GridRefManager< SKIP > &)
 
void SendPacket (Player *player)
 

Public Attributes

WorldObject consti_source
 
WorldPackets::CombatLog::CombatLogServerPacket
const
i_message
 
float const i_distSq
 

Constructor & Destructor Documentation

CombatLogSender::CombatLogSender ( WorldObject const src,
WorldPackets::CombatLog::CombatLogServerPacket msg,
float  dist 
)
inline
16507  : i_source(src), i_message(msg), i_distSq(dist * dist)
16508  {
16509  msg->Write();
16510  }
WorldPackets::CombatLog::CombatLogServerPacket const * i_message
Definition: Unit.cpp:16504
float const i_distSq
Definition: Unit.cpp:16505
WorldObject const * i_source
Definition: Unit.cpp:16503
virtual WorldPacket const * Write()=0

+ Here is the call graph for this function:

Member Function Documentation

bool CombatLogSender::IsInRangeHelper ( WorldObject const object) const
16531 {
16532  if (!object->IsInPhase(i_source))
16533  return false;
16534 
16535  return object->GetExactDist2dSq(i_source) <= i_distSq;
16536 }
float const i_distSq
Definition: Unit.cpp:16505
WorldObject const * i_source
Definition: Unit.cpp:16503

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CombatLogSender::SendPacket ( Player player)
inline
16519  {
16520  if (!player->HaveAtClient(i_source))
16521  return;
16522 
16523  if (player->IsAdvancedCombatLoggingEnabled())
16524  player->SendDirectMessage(i_message->GetFullLogPacket());
16525  else
16526  player->SendDirectMessage(i_message->GetBasicLogPacket());
16527  }
WorldPackets::CombatLog::CombatLogServerPacket const * i_message
Definition: Unit.cpp:16504
WorldObject const * i_source
Definition: Unit.cpp:16503
WorldPacket const * GetFullLogPacket() const
Definition: CombatLogPackets.h:35
WorldPacket const * GetBasicLogPacket() const
Definition: CombatLogPackets.h:36

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void CombatLogSender::Visit ( PlayerMapType m)
16539 {
16540  for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
16541  {
16542  Player* target = iter->GetSource();
16543  if (!IsInRangeHelper(target))
16544  continue;
16545 
16546  // Send packet to all who are sharing the player's vision
16547  if (target->HasSharedVision())
16548  {
16549  SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
16550  for (; i != target->GetSharedVisionList().end(); ++i)
16551  if ((*i)->m_seer == target)
16552  SendPacket(*i);
16553  }
16554 
16555  if (target->m_seer == target || target->GetVehicle())
16556  SendPacket(target);
16557  }
16558 }
void SendPacket(Player *player)
Definition: Unit.cpp:16518
Definition: LinkedList.h:141
iterator begin()
Definition: GridRefManager.h:36
bool IsInRangeHelper(WorldObject const *object) const
Definition: Unit.cpp:16530
iterator end()
Definition: GridRefManager.h:37

+ Here is the call graph for this function:

void CombatLogSender::Visit ( CreatureMapType m)
16561 {
16562  for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
16563  {
16564  Creature* target = iter->GetSource();
16565  if (!IsInRangeHelper(target))
16566  continue;
16567 
16568  // Send packet to all who are sharing the creature's vision
16569  if (target->HasSharedVision())
16570  {
16571  SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
16572  for (; i != target->GetSharedVisionList().end(); ++i)
16573  if ((*i)->m_seer == target)
16574  SendPacket(*i);
16575  }
16576  }
16577 }
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1754
void SendPacket(Player *player)
Definition: Unit.cpp:16518
Definition: Creature.h:467
Definition: LinkedList.h:141
iterator begin()
Definition: GridRefManager.h:36
bool IsInRangeHelper(WorldObject const *object) const
Definition: Unit.cpp:16530
iterator end()
Definition: GridRefManager.h:37
bool HasSharedVision() const
Definition: Unit.h:1757

+ Here is the call graph for this function:

void CombatLogSender::Visit ( DynamicObjectMapType m)
16580 {
16581  for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
16582  {
16583  DynamicObject* target = iter->GetSource();
16584  if (!IsInRangeHelper(target))
16585  continue;
16586 
16587  if (Unit* caster = target->GetCaster())
16588  {
16589  // Send packet back to the caster if the caster has vision of dynamic object
16590  Player* player = caster->ToPlayer();
16591  if (player && player->m_seer == target)
16592  SendPacket(player);
16593  }
16594  }
16595 }
void SendPacket(Player *player)
Definition: Unit.cpp:16518
Definition: DynamicObject.h:35
Definition: LinkedList.h:141
iterator begin()
Definition: GridRefManager.h:36
bool IsInRangeHelper(WorldObject const *object) const
Definition: Unit.cpp:16530
iterator end()
Definition: GridRefManager.h:37
Unit * GetCaster() const
Definition: DynamicObject.h:54
Definition: Unit.h:1305

+ Here is the call graph for this function:

template<class SKIP >
void CombatLogSender::Visit ( GridRefManager< SKIP > &  )
inline
16516 { }

Member Data Documentation

float const CombatLogSender::i_distSq
WorldObject const* CombatLogSender::i_source

The documentation for this struct was generated from the following file: