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

Public Member Functions

 PassengerController ()
 
void SetTransport (Transport *transport)
 
void ResetSlots (uint32 team)
 
bool SummonCreatures (PassengerSlots first, PassengerSlots last)
 
void ClearSlot (PassengerSlots slot)
 
bool SlotsNeedRefill (PassengerSlots first, PassengerSlots last) const
 

Private Member Functions

Position SelectSpawnPoint () const
 

Private Attributes

Transport_transport
 
ObjectGuid _controlledSlots [MAX_SLOTS]
 
time_t _respawnCooldowns [MAX_SLOTS]
 
Position const_spawnPoint
 
SlotInfo const_slotInfo
 

Constructor & Destructor Documentation

PassengerController::PassengerController ( )
inline
379  {
380  ResetSlots(HORDE);
381  }
Definition: SharedDefines.h:999
void ResetSlots(uint32 team)
Definition: boss_icecrown_gunship_battle.cpp:385

+ Here is the call graph for this function:

Member Function Documentation

void PassengerController::ClearSlot ( PassengerSlots  slot)
inline
428  {
429  _controlledSlots[slot].Clear();
430  _respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown;
431  }
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 Cooldown
Definition: boss_icecrown_gunship_battle.cpp:304
ObjectGuid _controlledSlots[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:455
time_t _respawnCooldowns[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:456
void Clear()
Definition: ObjectGuid.h:215
SlotInfo const * _slotInfo
Definition: boss_icecrown_gunship_battle.cpp:458

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PassengerController::ResetSlots ( uint32  team)
inline
386  {
387  _transport = NULL;
388  for (uint32 i = 0; i < MAX_SLOTS; ++i)
389  _controlledSlots[i].Clear();
390 
391  memset(_respawnCooldowns, 0, sizeof(time_t)* MAX_SLOTS);
394  }
Position const SkybreakerAddsSpawnPos
Definition: boss_icecrown_gunship_battle.cpp:210
arena_t NULL
Definition: jemalloc_internal.h:624
Position const * _spawnPoint
Definition: boss_icecrown_gunship_battle.cpp:457
ObjectGuid _controlledSlots[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:455
Position const OrgrimsHammerAddsSpawnPos
Definition: boss_icecrown_gunship_battle.cpp:211
time_t _respawnCooldowns[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:456
SlotInfo const OrgrimsHammerSlotInfo[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:341
uint32_t uint32
Definition: Define.h:150
Transport * _transport
Definition: boss_icecrown_gunship_battle.cpp:454
Definition: SharedDefines.h:999
SlotInfo const SkybreakerSlotInfo[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:307
SlotInfo const * _slotInfo
Definition: boss_icecrown_gunship_battle.cpp:458
Definition: boss_icecrown_gunship_battle.cpp:297

+ Here is the caller graph for this function:

Position PassengerController::SelectSpawnPoint ( ) const
inlineprivate
444  {
445  Position newPos;
446  float angle = frand(float(-M_PI) * 0.5f, float(M_PI) * 0.5f);
447  newPos.m_positionX = _spawnPoint->GetPositionX() + 2.0f * std::cos(angle);
448  newPos.m_positionY = _spawnPoint->GetPositionY() + 2.0f * std::sin(angle);
451  return newPos;
452  }
#define M_PI
Definition: Common.h:163
float m_positionY
Definition: Position.h:53
void SetOrientation(float orientation)
Definition: Position.h:99
double frand()
Definition: Vector3.cpp:170
float m_positionX
Definition: Position.h:52
Position const * _spawnPoint
Definition: boss_icecrown_gunship_battle.cpp:457
float GetOrientation() const
Definition: Position.h:107
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
float m_positionZ
Definition: Position.h:54
Definition: Position.h:27
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PassengerController::SetTransport ( Transport transport)
inline
383 { _transport = transport; }
Transport * _transport
Definition: boss_icecrown_gunship_battle.cpp:454

+ Here is the caller graph for this function:

bool PassengerController::SlotsNeedRefill ( PassengerSlots  first,
PassengerSlots  last 
) const
inline
434  {
435  for (int32 i = first; i <= last; ++i)
436  if (!_controlledSlots[i])
437  return true;
438 
439  return false;
440  }
ObjectGuid _controlledSlots[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:455
int32_t int32
Definition: Define.h:146
bool PassengerController::SummonCreatures ( PassengerSlots  first,
PassengerSlots  last 
)
inline
397  {
398  if (!_transport)
399  return false;
400 
401  bool summoned = false;
402  time_t now = time(NULL);
403  for (int32 i = first; i <= last; ++i)
404  {
405  if (_respawnCooldowns[i] > now)
406  continue;
407 
408  if (!_controlledSlots[i].IsEmpty())
409  {
411  if (current && current->IsAlive())
412  continue;
413  }
414 
416  {
417  _controlledSlots[i] = passenger->GetGUID();
418  _respawnCooldowns[i] = time_t(0);
419  passenger->AI()->SetData(ACTION_SET_SLOT, i);
420  summoned = true;
421  }
422  }
423 
424  return summoned;
425  }
uint32 Entry
Definition: boss_icecrown_gunship_battle.cpp:302
TempSummon * SummonPassenger(uint32 entry, Position const &pos, TempSummonType summonType, SummonPropertiesEntry const *properties=NULL, uint32 duration=0, Unit *summoner=NULL, uint32 spellId=0, uint32 vehId=0)
Temporarily summons a creature as passenger on this transport.
Definition: Transport.cpp:380
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
ObjectGuid _controlledSlots[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:455
time_t _respawnCooldowns[MAX_SLOTS]
Definition: boss_icecrown_gunship_battle.cpp:456
bool IsAlive() const
Definition: Unit.h:1692
Definition: boss_icecrown_gunship_battle.cpp:206
int32_t int32
Definition: Define.h:146
Transport * _transport
Definition: boss_icecrown_gunship_battle.cpp:454
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:174
Position SelectSpawnPoint() const
Definition: boss_icecrown_gunship_battle.cpp:443
Definition: Object.h:59
SlotInfo const * _slotInfo
Definition: boss_icecrown_gunship_battle.cpp:458

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

ObjectGuid PassengerController::_controlledSlots[MAX_SLOTS]
private
time_t PassengerController::_respawnCooldowns[MAX_SLOTS]
private
SlotInfo const* PassengerController::_slotInfo
private
Position const* PassengerController::_spawnPoint
private
Transport* PassengerController::_transport
private

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