35#include <boost/dynamic_bitset.hpp>
36#include <G3D/Vector3.h>
42 if (passenger->
GetMap() != map)
84 if (
Vehicle* vehicle = unit->GetVehicleKit())
85 vehicle->RelocatePassengers();
90 _currentPathLeg(0), _pathProgress(0), _delayedAddModel(false)
109 TC_LOG_ERROR(
"entities.transport",
"Transport (GUID: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})",
119 TC_LOG_ERROR(
"sql.sql",
"Transport not created: entry in `gameobject_template` not found, entry: {}", entry);
129 TC_LOG_ERROR(
"sql.sql",
"Transport {} (name: {}) will not be created, missing `transport_template` entry.", entry, goinfo->
name);
159 Relocate(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), position->GetOrientation());
186 TC_LOG_ERROR(
"entities.transport",
"Could not initialize GameObjectAI for Transport");
211 if (eventToTriggerIndex != boost::dynamic_bitset<uint8>::npos)
220 ++eventToTriggerIndex;
253 UpdatePosition(newPosition->GetPositionX(), newPosition->GetPositionY(), newPosition->GetPositionZ(), newPosition->GetOrientation());
310 plr->SetFallInformation(0, plr->GetPositionZ());
362 sScriptMgr->OnAddCreaturePassenger(
this, creature);
467 summon =
new TempSummon(properties, summoner,
false);
470 summon =
new Guardian(properties, summoner,
false);
473 summon =
new Puppet(properties, summoner);
476 summon =
new Totem(properties, summoner);
479 summon =
new Minion(properties, summoner,
false);
495 phaseShiftOwner = summoner;
572 for (
auto const& [cellId, guids] : *cells)
612 if (oldMapId != newMapId)
629 if (veh->GetTransport() ==
this)
632 float destX, destY, destZ, destO;
633 (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
636 (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
652 if (ref.GetSource()->GetTransport() !=
this && ref.GetSource()->InSamePhase(
this))
656 ref.GetSource()->m_visibleTransports.insert(
GetGUID());
659 ref.GetSource()->SendDirectMessage(&packet);
672 if (ref.GetSource()->GetTransport() !=
this && ref.GetSource()->m_visibleTransports.count(
GetGUID()))
674 ref.GetSource()->SendDirectMessage(&packet);
675 ref.GetSource()->m_visibleTransports.erase(
GetGUID());
685 float destX, destY, destZ, destO;
686 obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
689 switch (obj->GetTypeId())
697 obj->AddObjectToRemoveList();
711 passenger->m_movementInfo.transport.pos.GetPosition(x, y, z, o);
724 if (playerReference.GetSource()->InSamePhase(
this))
732 std::stringstream sstr;
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
std::unordered_map< uint32, CellObjectGuids > CellObjectGuidsMap
std::unordered_map< Player *, UpdateData > UpdateDataMapType
std::optional< T > Optional
Optional helper class to wrap optional values within.
@ TELE_TO_NOT_LEAVE_TRANSPORT
@ GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
@ SUMMON_CATEGORY_VEHICLE
@ UNIT_STATE_IGNORE_PATHFINDING
void SetHomePosition(float x, float y, float z, float o)
static Creature * CreateCreatureFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
void GetTransportHomePosition(float &x, float &y, float &z, float &ori) const
bool Create(ObjectGuid::LowType guidlow, Map *map, uint32 entry, Position const &pos, CreatureData const *data, uint32 vehId, bool dynamic=false)
void SetTransportHomePosition(float x, float y, float z, float o)
virtual void UpdateAI(uint32)
void SetGoState(GOState state)
GameObjectTemplate const * GetGOInfo() const
GOState GetGoState() const
std::string GetDebugInfo() const override
Position m_stationaryPosition
void ReplaceAllFlags(GameObjectFlags flags)
void RemoveFromWorld() override
void SetGoAnimProgress(uint8 animprogress)
static GameObject * CreateGameObjectFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true)
GameObjectAI * AI() const
void SetGoType(GameobjectTypes type)
void SetLocalRotation(float qx, float qy, float qz, float qw)
GameObjectTemplateAddon const * m_goTemplateAddon
GameObjectModel * m_model
UF::UpdateField< UF::GameObjectData, 0, TYPEID_GAMEOBJECT > m_gameObjectData
void UpdateModelPosition()
void SetPathProgressForClient(float progress)
void RelocateStationaryPosition(float x, float y, float z, float o)
void SetDisplayId(uint32 displayid)
GameObjectTemplate const * m_goInfo
void ClearUpdateMask(bool remove) override
void CleanupsBeforeDelete(bool finalCleanup=true) override
void AddToWorld() override
GameObjectOverride const * GetGameObjectOverride() const
void SetParentRotation(QuaternionData const &rotation)
void SetFaction(uint32 faction) override
void DynamicObjectRelocation(DynamicObject *go, float x, float y, float z, float orientation)
void GameObjectRelocation(GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
ObjectGuid::LowType GenerateLowGuid()
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
void InsertGameObjectModel(GameObjectModel const &model)
bool IsGridLoaded(uint32 gridId) const
PlayerList const & GetPlayers() const
void PlayerRelocation(Player *, float x, float y, float z, float orientation)
std::string ToString() const
void SetDynamicFlag(uint32 flag)
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
static Creature * ToCreature(Object *o)
static Unit * ToUnit(Object *o)
static GameObject * ToGameObject(Object *o)
ObjectGuid const & GetGUID() const
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
CreateObjectBits m_updateFlag
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
UF::UpdateFieldHolder m_values
void RemoveDynamicFlag(uint32 flag)
void _Create(ObjectGuid const &guid)
static AreaTrigger * ToAreaTrigger(Object *o)
static ObjectGuid GetGUID(Object const *o)
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
static DynamicObject * ToDynObject(Object *o)
static Player * ToPlayer(Object *o)
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
static void InitDbVisibleMapId(PhaseShift &phaseShift, int32 visibleMapId)
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
void SetFallInformation(uint32 time, float z)
bool IsBeingTeleported() const
virtual void InitStats(WorldObject *summoner, Milliseconds duration)
void SetTempSummonType(TempSummonType type)
virtual void InitSummon(WorldObject *summoner)
virtual void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const =0
This method transforms supplied transport offsets into global coordinates.
void UpdatePassengerPosition(Map *map, WorldObject *passenger, float x, float y, float z, float o, bool setHomePosition)
void UpdatePosition(float x, float y, float z, float o)
TransportMovementState _movementState
void SetPeriod(uint32 period)
uint32 GetTransportPeriod() const
void TeleportPassengersAndHideTransport(uint32 newMapid, float x, float y, float z, float o)
void LoadStaticPassengers()
Needed when transport moves from inactive to active grid.
void AddPassenger(WorldObject *passenger) override
Optional< uint32 > _requestStopTimestamp
void Update(uint32 diff) override
void BuildUpdate(UpdateDataMapType &data_map) override
void EnableMovement(bool enabled)
bool TeleportTransport(uint32 oldMapId, uint32 newMapId, float x, float y, float z, float o)
bool Create(ObjectGuid::LowType guidlow, uint32 entry, float x, float y, float z, float ang)
void UnloadStaticPassengers()
Needed when transport enters inactive grid.
std::string GetDebugInfo() const override
PassengerSet _staticPassengers
TimeTracker _positionChangeTimer
Creature * CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const *data)
void UpdatePassengerPositions(PassengerSet const &passengers)
int32 GetMapIdForSpawning() const override
GameObject * CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const *data)
std::set< WorldObject * > PassengerSet
uint32 GetExpectedMapId() const
Returns id of the map that transport is expected to be on, according to current path progress.
TempSummon * SummonPassenger(uint32 entry, Position const &pos, TempSummonType summonType, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, Unit *summoner=nullptr, uint32 spellId=0, uint32 vehId=0)
Temporarily summons a creature as passenger on this transport.
TransportTemplate const * _transportInfo
std::unique_ptr< boost::dynamic_bitset< uint8 > > _eventsToTrigger
void CalculatePassengerPosition(float &x, float &y, float &z, float *o=nullptr) const override
This method transforms supplied transport offsets into global coordinates.
void CleanupsBeforeDelete(bool finalCleanup=true) override
Transport * RemovePassenger(WorldObject *passenger) override
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Unit * GetVehicleBase() const
void SetCreatedBySpell(int32 spellId)
void AddUnitState(uint32 f)
bool BuildPacket(WorldPacket *packet)
constexpr uint32 GetMapId() const
PhaseShift & GetPhaseShift()
std::string const & GetName() const
void AddObjectToRemoveList()
void SetName(std::string newname)
MovementInfo m_movementInfo
void SetTransport(TransportBase *t)
TC_GAME_API uint32 GetId(std::string_view username)
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
TC_GAME_API HashMapHolder< Player >::MapType const & GetPlayers()
bool DiffGrid(Cell const &cell) const
struct GameObjectTemplate::@213::@230 moTransport
struct MovementInfo::TransportInfo transport
constexpr void SetOrientation(float orientation)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr void GetPosition(float &x, float &y) const
bool IsPositionValid() const
constexpr void Relocate(float x, float y)
constexpr float GetOrientation() const
constexpr float GetPositionZ() const
EnumFlag< SummonPropertiesFlags > GetFlags() const
uint32 GetNextPauseWaypointTimestamp(uint32 time) const
Optional< Position > ComputePosition(uint32 time, TransportMovementState *moveState, size_t *legIndex) const
std::vector< TransportPathEvent > Events
TransportPathLeg const * GetLegForTime(uint32 time) const
std::vector< TransportPathLeg > PathLegs
UpdateField< uint32, 0, 7 > SpawnTrackingStateAnimID