42 SF_LOG_ERROR(
"entities.transport",
"Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
53 SF_LOG_ERROR(
"sql.sql",
"Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang);
62 SF_LOG_ERROR(
"sql.sql",
"Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->
name.c_str());
91bool Transport::CreateLocal(
uint32 guidlow,
uint32 entry,
Map* map,
float x,
float y,
float z,
float ang,
float rotation0,
float rotation1,
float rotation2,
float rotation3,
uint32 animprogress)
98 SF_LOG_ERROR(
"entities.transport",
"Transport (Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", entry, x, y);
109 SF_LOG_ERROR(
"entities.transport",
"Transport not created: entry in `gameobject_template` not found, entry: %u map: %u (X: %f Y: %f Z: %f) ang: %f", entry, map->
GetId(), x, y, z, ang);
115 SF_LOG_ERROR(
"entities.transport",
"Transport %u (name: %s) has unsupported local transport type %u.", entry, goinfo->
name.c_str(), goinfo->
type);
123 SF_LOG_ERROR(
"entities.transport",
"Transport %u (name: %s) will not be created, missing data in TransportAnimation.dbc", entry, goinfo->
name.c_str());
172 uint32 const positionUpdateDelay = 200;
177 SF_LOG_ERROR(
"entities.transport",
"Could not initialize GameObjectAI for Transport");
185 if (period && animation && !animation->
Path.empty())
188 TransportPathContainer::const_iterator nextItr = animation->
Path.upper_bound(timer);
189 if (nextItr == animation->
Path.end())
190 nextItr = animation->
Path.begin();
192 TransportPathContainer::const_iterator prevItr = nextItr;
193 if (prevItr == animation->
Path.begin())
194 prevItr = animation->
Path.end();
200 float segmentPct = 0.0f;
205 uint32 const segmentLength = nextTime > prevTime ? nextTime - prevTime : period - prevTime + nextTime;
206 uint32 const segmentProgress = timer >= prevTime ? timer - prevTime : period - prevTime + timer;
209 segmentPct = float(segmentProgress) / float(segmentLength);
212 G3D::Vector3 offset(prev->
X, prev->
Y, prev->
Z);
214 offset = offset.lerp(G3D::Vector3(next->
X, next->
Y, next->
Z), segmentPct);
216 G3D::Quat parentRotation(
233 m_goValue.Transport.PathProgress += diff;
251 if (timer < _currentFrame->DepartureTime)
274 if (timer >=
_currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime)
304 G3D::Vector3 pos, dir;
364 float x = data->
posX;
365 float y = data->
posY;
366 float z = data->
posZ;
383 SF_LOG_ERROR(
"entities.transport",
"Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",
396 sScriptMgr->OnAddCreaturePassenger(
this, creature);
411 float x = data->
posX;
412 float y = data->
posY;
413 float z = data->
posZ;
475 CellGuidSet::const_iterator guidEnd;
476 for (CellObjectGuidsMap::const_iterator cellItr = cells.begin(); cellItr != cells.end(); ++cellItr)
479 guidEnd = cellItr->second.creatures.end();
480 for (CellGuidSet::const_iterator guidItr = cellItr->second.creatures.begin(); guidItr != guidEnd; ++guidItr)
484 guidEnd = cellItr->second.gameobjects.end();
485 for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr)
529 const float speed = float(
m_goInfo->moTransport.moveSpeed);
530 const float accel = float(
m_goInfo->moTransport.accelRate);
533 float segmentPos, dist;
537 if (timeSinceStop < timeUntilStop)
539 if (timeSinceStop < accelTime)
540 dist = 0.5f * accel * timeSinceStop * timeSinceStop;
542 dist = accelDist + (timeSinceStop - accelTime) * speed;
547 if (timeUntilStop < _transportInfo->accelTime)
548 dist = 0.5f * accel * timeUntilStop * timeUntilStop;
550 dist = accelDist + (timeUntilStop - accelTime) * speed;
561 if (oldMap->
GetId() != newMapid)
563 Map* newMap =
sMapMgr->CreateBaseMap(newMapid);
572 if (itr->GetSource()->GetTransport() !=
this)
573 itr->GetSource()->SendDirectMessage(&packet);
585 if (itr->GetSource()->GetTransport() !=
this)
591 itr->GetSource()->SendDirectMessage(&packet);
600 float destX, destY, destZ, destO;
613 go->
Relocate(destX, destY, destZ, destO);
639 float destX, destY, destZ, destO;
640 (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
643 (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
654 for (std::set<WorldObject*>::iterator itr = passengers.begin(); itr != passengers.end(); ++itr)
664 if (unit->GetVehicle())
694 if (
Vehicle* vehicle = unit->GetVehicleKit())
695 vehicle->RelocatePassengers();
703 SF_LOG_DEBUG(
"maps.script",
"Taxi %s event %u of node %u of %s path", departure ?
"departure" :
"arrival", eventid, node.
Node->
index,
GetName().c_str());
717 Player* player = itr->GetSource();
#define SF_LOG_DEBUG(filterType__,...)
#define SF_LOG_ERROR(filterType__,...)
UNORDERED_MAP< Player *, UpdateData > UpdateDataMapType
ScriptMapMap sEventScripts
UNORDERED_MAP< uint32, CellObjectGuids > CellObjectGuidsMap
@ TELE_TO_NOT_UNSUMMON_PET
@ TELE_TO_NOT_LEAVE_TRANSPORT
@ GAMEOBJECT_TYPE_MO_TRANSPORT
@ GAMEOBJECT_TYPE_TRANSPORT
@ UNIT_STATE_IGNORE_PATHFINDING
@ UPDATEFLAG_STATIONARY_POSITION
@ GAMEOBJECT_FIELD_PARENT_ROTATION
@ GAMEOBJECT_FIELD_PERCENT_HEALTH
@ GAMEOBJECT_FIELD_FACTION_TEMPLATE
void SetHomePosition(float x, float y, float z, float o)
void FarTeleportTo(Map *map, float X, float Y, float Z, float O)
void GetTransportHomePosition(float &x, float &y, float &z, float &ori)
void SetTransportHomePosition(float x, float y, float z, float o)
bool LoadCreatureFromDB(uint32 guid, Map *map, bool addToMap=true)
virtual void UpdateAI(uint32)
std::vector< uint32 > m_transportPauseTimes
void SetGoState(GOState state)
void UpdateLegacyTransportPathProgress()
GameObjectValue m_goValue
GameObjectTemplate const * GetGOInfo() const
GOState GetGoState() const
Position m_stationaryPosition
float GetStationaryY() const OVERRIDE
void UpdateWorldRotationField()
void UpdateRotationFields(float rotation2=0.0f, float rotation3=0.0f)
void SetGoAnimProgress(uint8 animprogress)
void InitializeLegacyTransport()
GameObjectValue const * GetGOValue() const
GameObjectModel * CreateModel()
GameObjectAI * AI() const
void SetLegacyTransportStopped(bool stopped)
GameobjectTypes GetGoType() const
void SetGoType(GameobjectTypes type)
bool LoadGameObjectFromDB(uint32 guid, Map *map, bool addToMap=true)
GameObjectModel * m_model
void EventInform(uint32 eventId)
void UpdateModelPosition()
float GetStationaryZ() const OVERRIDE
void SetDisplayId(uint32 displayid)
GameObjectTemplate const * m_goInfo
uint32 GetGOStateValue(GOState state)
float GetStationaryO() const OVERRIDE
float GetStationaryX() const OVERRIDE
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)
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
bool IsGridLoaded(float x, float y) const
void RemoveFromMap(T *, bool)
PlayerList const & GetPlayers() const
void PlayerRelocation(Player *, float x, float y, float z, float orientation)
LinkedListHead::Iterator< MapReference const > const_iterator
void SetByteValue(uint16 index, uint8 offset, uint8 value)
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
uint32 GetGUIDLow() const
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
float GetFloatValue(uint16 index) const
void ClearUpdateMask(bool remove)
GameObject * ToGameObject()
void SetFloatValue(uint16 index, float value)
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
void SetEntry(uint32 entry)
virtual void SetObjectScale(float scale)
void SetUInt32Value(uint16 index, uint32 value)
bool HaveAtClient(WorldObject const *u) const
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
virtual void CalculatePassengerPosition(float &x, float &y, float &z, float *o=NULL) const =0
This method transforms supplied transport offsets into global coordinates.
void UpdatePosition(float x, float y, float z, float o)
void SetPeriod(uint32 period)
std::set< WorldObject * > _staticPassengers
void UpdatePassengerPositions(std::set< WorldObject * > &passengers)
void CalculatePassengerPosition(float &x, float &y, float &z, float *o) const
This method transforms supplied transport offsets into global coordinates.
bool TeleportTransport(uint32 newMapid, float x, float y, float z)
void LoadStaticPassengers()
Needed when transport moves from inactive to active grid.
bool _triggeredArrivalEvent
These are needed to properly control events triggering only once for each frame.
GameObject * CreateGOPassenger(uint32 guid, GameObjectData const *data)
KeyFrameVec::const_iterator _currentFrame
void DoEventIfAny(KeyFrame const &node, bool departure)
void EnableMovement(bool enabled)
bool Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
float CalculateSegmentPos(float perc)
void RemovePassenger(WorldObject *passenger)
void UnloadStaticPassengers()
Needed when transport enters inactive grid.
KeyFrameVec const & GetKeyFrames() const
std::set< WorldObject * > _passengers
TimeTrackerSmall _positionChangeTimer
bool _triggeredDepartureEvent
void BuildUpdate(UpdateDataMapType &data_map)
bool CreateLocal(uint32 guidlow, uint32 entry, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress)
KeyFrameVec::const_iterator _nextFrame
TransportTemplate const * _transportInfo
void MoveToNextWaypoint()
void AddPassenger(WorldObject *passenger)
bool IsMoving() const
Helpers to know if stop frame was reached.
Creature * CreateNPCPassenger(uint32 guid, CreatureData const *data)
void AddUnitState(uint32 f)
bool BuildPacket(WorldPacket *packet)
void SetTransport(Transport *t)
void SetName(std::string const &newname)
std::string const & GetName() const
virtual void SetMap(Map *map)
void AddObjectToRemoveList()
WorldObject(bool isWorldObject)
Transport * GetTransport() const
MovementInfo m_movementInfo
uint32 GetInitialLegacyTransportState(bool, bool hasStopFrames)
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@133216107201365043142154201341232071301300107152 transport
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@316212233253022127367165230227137227160036113140 moTransport
TaxiPathNodeEntry const * Node
struct MovementInfo::TransportInfo transport
float GetPositionZ() const
float GetOrientation() const
bool IsPositionValid() const
float GetPositionX() const
void GetPosition(float &x, float &y) const
float GetPositionY() const
void Relocate(float x, float y)
TransportPathContainer Path
struct GameObjectValue::@210223111052332366220354331325332170103204164100 Transport
TransportAnimation const * AnimationInfo