TrinityCore
Loading...
Searching...
No Matches
Transport.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "Transport.h"
19#include "CellImpl.h"
20#include "DB2Stores.h"
21#include "GameEventSender.h"
22#include "GameObjectAI.h"
23#include "GameTime.h"
24#include "Log.h"
25#include "ObjectMgr.h"
26#include "PhasingHandler.h"
27#include "Player.h"
28#include "ScriptMgr.h"
29#include "Totem.h"
30#include "UpdateData.h"
31#include "Vehicle.h"
32#include "WorldPacket.h"
33#include <boost/dynamic_bitset.hpp>
34#include <sstream>
35
36void TransportBase::UpdatePassengerPosition(Map* map, WorldObject* passenger, Position const& position, bool setHomePosition)
37{
38 // transport teleported but passenger not yet (can happen for players)
39 if (passenger->GetMap() != map)
40 return;
41
42 float x, y, z, o;
43 position.GetPosition(x, y, z, o);
44
45 // Do not use Unit::UpdatePosition here, we don't want to remove auras
46 // as if regular movement occurred
47 switch (passenger->GetTypeId())
48 {
49 case TYPEID_UNIT:
50 {
51 Creature* creature = passenger->ToCreature();
52 map->CreatureRelocation(creature, x, y, z, o, false);
53 if (setHomePosition)
55 break;
56 }
57 case TYPEID_PLAYER:
58 //relocate only passengers in world and skip any player that might be still logging in/teleporting
59 if (passenger->IsInWorld() && !passenger->ToPlayer()->IsBeingTeleported())
60 {
61 map->PlayerRelocation(passenger->ToPlayer(), x, y, z, o);
62 passenger->ToPlayer()->SetFallInformation(0, passenger->GetPositionZ());
63 }
64 break;
66 map->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o, false);
67 passenger->ToGameObject()->RelocateStationaryPosition(position);
68 break;
70 map->DynamicObjectRelocation(passenger->ToDynObject(), x, y, z, o);
71 break;
73 map->AreaTriggerRelocation(passenger->ToAreaTrigger(), x, y, z, o);
74 break;
75 default:
76 break;
77 }
78
79 if (Unit* unit = passenger->ToUnit())
80 if (Vehicle* vehicle = unit->GetVehicleKit())
81 vehicle->RelocatePassengers();
82}
83
85 _transportInfo(nullptr), _movementState(TransportMovementState::Moving), _eventsToTrigger(std::make_unique<boost::dynamic_bitset<uint8>>()),
86 _currentPathLeg(0), _pathProgress(0), _delayedAddModel(false)
87{
92}
93
99
100bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, float x, float y, float z, float ang)
101{
102 Relocate(x, y, z, ang);
103
104 if (!IsPositionValid())
105 {
106 TC_LOG_ERROR("entities.transport", "Transport (GUID: {}) not created. Suggested coordinates isn't valid (X: {} Y: {})",
107 guidlow, x, y);
108 return false;
109 }
110
111 _Create(ObjectGuid::Create<HighGuid::Transport>(guidlow));
112
113 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
114 if (!goinfo)
115 {
116 TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, entry: {}", entry);
117 return false;
118 }
119
120 m_goInfo = goinfo;
121 m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry);
122
123 TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
124 if (!tInfo)
125 {
126 TC_LOG_ERROR("sql.sql", "Transport {} (name: {}) will not be created, missing `transport_template` entry.", entry, goinfo->name);
127 return false;
128 }
129
130 _transportInfo = tInfo;
131 _eventsToTrigger->resize(tInfo->Events.size(), true);
132
133 if (GameObjectOverride const* goOverride = GetGameObjectOverride())
134 {
135 SetFaction(goOverride->Faction);
136 ReplaceAllFlags(GameObjectFlags(goOverride->Flags));
137 }
138
139 _pathProgress = !goinfo->moTransport.allowstopping ? getMSTime() /*might be called before world update loop begins, don't use GameTime*/ % tInfo->TotalPathTime : 0;
140 SetObjectScale(goinfo->size);
141 SetPeriod(tInfo->TotalPathTime);
142 SetEntry(goinfo->entry);
143 SetDisplayId(goinfo->displayId);
147 SetName(goinfo->name);
148 SetLocalRotation(0.0f, 0.0f, 0.0f, 1.0f);
150
151 size_t legIndex;
152 if (Optional<Position> position = _transportInfo->ComputePosition(_pathProgress, nullptr, &legIndex))
153 {
154 Relocate(position->GetPositionX(), position->GetPositionY(), position->GetPositionZ(), position->GetOrientation());
155 _currentPathLeg = legIndex;
156 }
157
158 CreateModel();
159 return true;
160}
161
162void Transport::CleanupsBeforeDelete(bool finalCleanup /*= true*/)
163{
165 while (!_passengers.empty())
166 {
167 WorldObject* obj = *_passengers.begin();
168 RemovePassenger(obj);
169 }
170
172}
173
175{
176 constexpr Milliseconds positionUpdateDelay = 200ms;
177
178 if (AI())
179 AI()->UpdateAI(diff);
180 else if (!AIM_Initialize())
181 TC_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport");
182
183 sScriptMgr->OnTransportUpdate(this, diff);
184
186
188 if (!GetGOInfo()->moTransport.allowstopping)
191 _pathProgress += diff;
192 else
194
195 if (_pathProgress / GetTransportPeriod() != cycleId)
196 {
197 // reset cycle
198 _eventsToTrigger->set();
199 }
200
202
203 size_t eventToTriggerIndex = _eventsToTrigger->find_first();
204 if (eventToTriggerIndex != boost::dynamic_bitset<uint8>::npos)
205 {
206 while (eventToTriggerIndex < _transportInfo->Events.size() && _transportInfo->Events[eventToTriggerIndex].Timestamp <= timer)
207 {
208 if (TransportPathLeg const* leg = _transportInfo->GetLegForTime(_transportInfo->Events[eventToTriggerIndex].Timestamp))
209 if (leg->MapId == GetMapId())
210 GameEvents::Trigger(_transportInfo->Events[eventToTriggerIndex].EventId, this, this);
211
212 _eventsToTrigger->set(eventToTriggerIndex, false);
213 ++eventToTriggerIndex;
214 }
215 }
216
217 TransportMovementState moveState;
218 size_t legIndex;
219 if (Optional<Position> newPosition = _transportInfo->ComputePosition(timer, &moveState, &legIndex))
220 {
222 _movementState = moveState;
223
224 if (justStopped)
225 {
227 {
230 }
231 }
232
233 if (legIndex != _currentPathLeg)
234 {
236 _currentPathLeg = legIndex;
237 TeleportTransport(oldMapId, _transportInfo->PathLegs[legIndex].MapId, newPosition->GetPositionX(), newPosition->GetPositionY(), newPosition->GetPositionZ(), newPosition->GetOrientation());
238 return;
239 }
240
241 // set position
243 {
244 _positionChangeTimer.Reset(positionUpdateDelay);
246 UpdatePosition(newPosition->GetPositionX(), newPosition->GetPositionY(), newPosition->GetPositionZ(), newPosition->GetOrientation());
247 else
248 {
249 /* There are four possible scenarios that trigger loading/unloading passengers:
250 1. transport moves from inactive to active grid
251 2. the grid that transport is currently in becomes active
252 3. transport moves from active to inactive grid
253 4. the grid that transport is currently in unloads
254 */
255 bool gridActive = GetMap()->IsGridLoaded(GetPositionX(), GetPositionY());
256
257 if (_staticPassengers.empty() && gridActive) // 2.
259 else if (!_staticPassengers.empty() && !gridActive)
260 // 4. - if transports stopped on grid edge, some passengers can remain in active grids
261 // unload all static passengers otherwise passengers won't load correctly when the grid that transport is currently in becomes active
263 }
264 }
265 }
266
267 // Add model to map after we are fully done with moving maps
269 {
270 _delayedAddModel = false;
271 if (m_model)
273 }
274}
275
276void Transport::AddPassenger(WorldObject* passenger, Position const& offset)
277{
278 if (!IsInWorld())
279 return;
280
281 if (_passengers.insert(passenger).second)
282 {
283 passenger->SetTransport(this);
284 passenger->m_movementInfo.transport.guid = GetGUID();
285 passenger->m_movementInfo.transport.pos = offset;
286 TC_LOG_DEBUG("entities.transport", "Object {} boarded transport {}.", passenger->GetName(), GetName());
287
288 if (Player* plr = passenger->ToPlayer())
289 sScriptMgr->OnAddPassenger(this, plr);
290 }
291}
292
294{
295 if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) // static passenger can remove itself in case of grid unload
296 {
297 passenger->SetTransport(nullptr);
298 passenger->m_movementInfo.transport.Reset();
299 TC_LOG_DEBUG("entities.transport", "Object {} removed from transport {}.", passenger->GetName(), GetName());
300
301 if (Player* plr = passenger->ToPlayer())
302 {
303 sScriptMgr->OnRemovePassenger(this, plr);
304 plr->SetFallInformation(0, plr->GetPositionZ());
305 }
306 }
307
308 return this;
309}
310
312{
313 Map* map = GetMap();
314 if (map->GetCreatureRespawnTime(guid))
315 return nullptr;
316
317 Creature* creature = Creature::CreateCreatureFromDB(guid, map, false, true);
318 if (!creature)
319 return nullptr;
320
321 ASSERT(data);
322
323 creature->SetTransport(this);
324 creature->m_movementInfo.transport.guid = GetGUID();
326 creature->m_movementInfo.transport.seat = -1;
328 creature->SetHomePosition(creature->GetPosition());
330
334
335 if (!creature->IsPositionValid())
336 {
337 TC_LOG_ERROR("entities.transport", "Passenger {} not created. Suggested coordinates aren't valid (X: {} Y: {})", creature->GetGUID().ToString(), creature->GetPositionX(), creature->GetPositionY());
338 delete creature;
339 return nullptr;
340 }
341
344
345 if (!map->AddToMap(creature))
346 {
347 delete creature;
348 return nullptr;
349 }
350
351 _staticPassengers.insert(creature);
352 sScriptMgr->OnAddCreaturePassenger(this, creature);
353 return creature;
354}
355
357{
358 Map* map = GetMap();
359 if (map->GetGORespawnTime(guid))
360 return nullptr;
361
362 GameObject* go = GameObject::CreateGameObjectFromDB(guid, map, false);
363 if (!go)
364 return nullptr;
365
366 ASSERT(data);
367
368 go->SetTransport(this);
374
375 if (!go->IsPositionValid())
376 {
377 TC_LOG_ERROR("entities.transport", "Passenger {} not created. Suggested coordinates aren't valid (X: {} Y: {})", go->GetGUID().ToString(), go->GetPositionX(), go->GetPositionY());
378 delete go;
379 return nullptr;
380 }
381
384
385 if (!map->AddToMap(go))
386 {
387 delete go;
388 return nullptr;
389 }
390
391 _staticPassengers.insert(go);
392 return go;
393}
394
395TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSummonType summonType, SummonPropertiesEntry const* properties /*= nullptr*/, Milliseconds duration /*= 0ms*/, Unit* summoner /*= nullptr*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/)
396{
397 Map* map = FindMap();
398 if (!map)
399 return nullptr;
400
402 if (properties)
403 {
404 switch (properties->Control)
405 {
407 mask = UNIT_MASK_GUARDIAN;
408 break;
410 mask = UNIT_MASK_PUPPET;
411 break;
414 mask = UNIT_MASK_MINION;
415 break;
418 {
419 switch (SummonTitle(properties->Title))
420 {
424 mask = UNIT_MASK_GUARDIAN;
425 break;
428 mask = UNIT_MASK_TOTEM;
429 break;
432 mask = UNIT_MASK_SUMMON;
433 break;
435 mask = UNIT_MASK_MINION;
436 break;
437 default:
438 if (properties->GetFlags().HasFlag(SummonPropertiesFlags::JoinSummonerSpawnGroup)) // Mirror Image, Summon Gargoyle
439 mask = UNIT_MASK_GUARDIAN;
440 break;
441 }
442 break;
443 }
444 default:
445 return nullptr;
446 }
447 }
448
449 TempSummon* summon = nullptr;
450 switch (mask)
451 {
452 case UNIT_MASK_SUMMON:
453 summon = new TempSummon(properties, summoner, false);
454 break;
456 summon = new Guardian(properties, summoner, false);
457 break;
458 case UNIT_MASK_PUPPET:
459 summon = new Puppet(properties, summoner);
460 break;
461 case UNIT_MASK_TOTEM:
462 summon = new Totem(properties, summoner);
463 break;
464 case UNIT_MASK_MINION:
465 summon = new Minion(properties, summoner, false);
466 break;
467 }
468
469 Position globalPosition = GetPositionWithOffset(pos);
470
471 if (!summon->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, entry, globalPosition, nullptr, vehId))
472 {
473 delete summon;
474 return nullptr;
475 }
476
477 WorldObject* phaseShiftOwner = this;
478 if (summoner && !(properties && properties->GetFlags().HasFlag(SummonPropertiesFlags::IgnoreSummonerPhase)))
479 phaseShiftOwner = summoner;
480
481 if (phaseShiftOwner)
482 PhasingHandler::InheritPhaseShift(summon, phaseShiftOwner);
483
484 summon->SetCreatedBySpell(spellId);
485
486 summon->SetTransport(this);
489 summon->Relocate(globalPosition);
490 summon->SetHomePosition(globalPosition);
491 summon->SetTransportHomePosition(pos);
492
496
497 summon->InitStats(summoner, duration);
498
499 if (!map->AddToMap<Creature>(summon))
500 {
501 delete summon;
502 return nullptr;
503 }
504
505 _staticPassengers.insert(summon);
506
507 summon->InitSummon(summoner);
508 summon->SetTempSummonType(summonType);
509
510 return summon;
511}
512
517
518void Transport::UpdatePosition(float x, float y, float z, float o)
519{
520 sScriptMgr->OnRelocate(this, GetMapId(), x, y, z);
521
522 bool newActive = GetMap()->IsGridLoaded(x, y);
523 Cell oldCell(GetPositionX(), GetPositionY());
524
525 Relocate(x, y, z, o);
527 SetLocalRotationAngles(o, 0.0f, 0.0f);
529
531
532 /* There are four possible scenarios that trigger loading/unloading passengers:
533 1. transport moves from inactive to active grid
534 2. the grid that transport is currently in becomes active
535 3. transport moves from active to inactive grid
536 4. the grid that transport is currently in unloads
537 */
538 if (_staticPassengers.empty() && newActive) // 1.
540 else if (!_staticPassengers.empty() && !newActive && oldCell.DiffGrid(Cell(GetPositionX(), GetPositionY()))) // 3.
542 else
544 // 4. is handed by grid unload
545}
546
548{
550 if (!mapId)
551 return;
552
553 CellObjectGuidsMap const* cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetDifficultyID());
554 if (!cells)
555 return;
556
557 for (auto const& [cellId, guids] : *cells)
558 {
559 // GameObjects on transport
560 for (ObjectGuid::LowType spawnId : guids.gameobjects)
561 CreateGOPassenger(spawnId, sObjectMgr->GetGameObjectData(spawnId));
562
563 // Creatures on transport
564 for (ObjectGuid::LowType spawnId : guids.creatures)
565 CreateNPCPassenger(spawnId, sObjectMgr->GetCreatureData(spawnId));
566 }
567}
568
570{
571 while (!_staticPassengers.empty())
572 {
573 WorldObject* obj = *_staticPassengers.begin();
574 obj->AddObjectToRemoveList(); // also removes from _staticPassengers
575 }
576}
577
579{
580 if (!GetGOInfo()->moTransport.allowstopping)
581 return;
582
583 if (!enabled)
584 {
586 }
587 else
588 {
589 _requestStopTimestamp.reset();
592 }
593}
594
595bool Transport::TeleportTransport(uint32 oldMapId, uint32 newMapId, float x, float y, float z, float o)
596{
597 if (oldMapId != newMapId)
598 {
601 return true;
602 }
603 else
604 {
605 UpdatePosition(x, y, z, o);
606
607 // Teleport players, they need to know it
608 for (PassengerSet::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
609 {
610 if ((*itr)->GetTypeId() == TYPEID_PLAYER)
611 {
612 // will be relocated in UpdatePosition of the vehicle
613 if (Unit* veh = (*itr)->ToUnit()->GetVehicleBase())
614 if (veh->GetTransport() == this)
615 continue;
616
617 (*itr)->ToUnit()->NearTeleportTo(GetPositionWithOffset((*itr)->m_movementInfo.transport.pos));
618 }
619 }
620
621 return false;
622 }
623}
624
626{
627 if (newMapid == GetMapId())
628 {
629 AddToWorld();
630
631 for (MapReference const& ref : GetMap()->GetPlayers())
632 {
633 if (ref.GetSource()->GetTransport() != this && ref.GetSource()->InSamePhase(this))
634 {
635 UpdateData data(GetMap()->GetId());
636 BuildCreateUpdateBlockForPlayer(&data, ref.GetSource());
637 ref.GetSource()->m_visibleTransports.insert(GetGUID());
638 WorldPacket packet;
639 data.BuildPacket(&packet);
640 ref.GetSource()->SendDirectMessage(&packet);
641 }
642 }
643 }
644 else
645 {
646 UpdateData data(GetMap()->GetId());
648
649 WorldPacket packet;
650 data.BuildPacket(&packet);
651 for (MapReference const& ref : GetMap()->GetPlayers())
652 {
653 if (ref.GetSource()->GetTransport() != this && ref.GetSource()->m_visibleTransports.count(GetGUID()))
654 {
655 ref.GetSource()->SendDirectMessage(&packet);
656 ref.GetSource()->m_visibleTransports.erase(GetGUID());
657 }
658 }
659
661 }
662
663 PassengerSet passengersToTeleport = _passengers;
664 for (WorldObject* obj : passengersToTeleport)
665 {
666 float destX, destY, destZ, destO;
667 obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
668
669 switch (obj->GetTypeId())
670 {
671 case TYPEID_PLAYER:
672 if (!obj->ToPlayer()->TeleportTo({ .Location = WorldLocation(newMapid, destX, destY, destZ, destO), .TransportGuid = GetTransportGUID() }, TELE_TO_NOT_LEAVE_TRANSPORT))
673 RemovePassenger(obj);
674 break;
677 obj->AddObjectToRemoveList();
678 break;
679 default:
680 RemovePassenger(obj);
681 break;
682 }
683 }
684}
685
687{
688 for (WorldObject* passenger : passengers)
689 UpdatePassengerPosition(GetMap(), passenger, GetPositionWithOffset(passenger->m_movementInfo.transport.pos), true);
690}
691
693{
695
696 for (MapReference const& playerReference : GetMap()->GetPlayers())
697 if (playerReference.GetSource()->InSamePhase(this))
698 BuildFieldsUpdate(playerReference.GetSource(), data_map);
699
700 ClearUpdateMask(true);
701}
702
703std::string Transport::GetDebugInfo() const
704{
705 std::stringstream sstr;
706 sstr << GameObject::GetDebugInfo();
707 return sstr.str();
708}
709
std::unordered_map< Player *, UpdateData > UpdateDataMapType
Definition BaseEntity.h:32
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
#define ASSERT
Definition Errors.h:80
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:181
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:190
TempSummonType
@ TYPEID_AREATRIGGER
Definition ObjectGuid.h:49
@ TYPEID_DYNAMICOBJECT
Definition ObjectGuid.h:47
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:46
@ TYPEID_UNIT
Definition ObjectGuid.h:43
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
std::unordered_map< uint32, CellObjectGuids > CellObjectGuidsMap
Definition ObjectMgr.h:478
#define sObjectMgr
Definition ObjectMgr.h:1885
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:924
#define sScriptMgr
Definition ScriptMgr.h:1449
@ GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
SummonTitle
@ GO_DYNFLAG_LO_STOPPED
GameObjectFlags
@ GO_STATE_READY
@ GO_STATE_ACTIVE
@ SUMMON_CATEGORY_POSSESSED_VEHICLE
@ SUMMON_CATEGORY_PET
@ SUMMON_CATEGORY_VEHICLE
@ SUMMON_CATEGORY_ALLY
@ SUMMON_CATEGORY_PUPPET
@ SUMMON_CATEGORY_WILD
uint32 getMSTime()
Definition Timer.h:33
TransportMovementState
#define sTransportMgr
@ UNIT_MASK_PUPPET
Definition Unit.h:362
@ UNIT_MASK_TOTEM
Definition Unit.h:359
@ UNIT_MASK_SUMMON
Definition Unit.h:356
@ UNIT_MASK_GUARDIAN
Definition Unit.h:358
@ UNIT_MASK_MINION
Definition Unit.h:357
@ UNIT_STATE_IGNORE_PATHFINDING
Definition Unit.h:289
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void BuildUpdateChangesMask()
bool IsInWorld() const
Definition BaseEntity.h:158
void _Create(ObjectGuid const &guid)
Definition BaseEntity.h:218
CreateObjectBits m_updateFlag
Definition BaseEntity.h:352
void ClearUpdateMask(bool remove)
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
TypeID GetTypeId() const
Definition BaseEntity.h:166
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
void BuildFieldsUpdate(Player *player, UpdateDataMapType &data_map) const
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:386
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
Definition Creature.h:393
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)
Definition Creature.h:391
virtual void UpdateAI(uint32)
void SetLocalRotationAngles(float z_rot, float y_rot, float x_rot)
void SetGoState(GOState state)
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:203
void CreateModel()
GOState GetGoState() const
Definition GameObject.h:284
std::string GetDebugInfo() const override
Position m_stationaryPosition
Definition GameObject.h:497
void ReplaceAllFlags(GameObjectFlags flags)
Definition GameObject.h:279
void RemoveFromWorld() override
void SetGoAnimProgress(uint8 animprogress)
Definition GameObject.h:291
static GameObject * CreateGameObjectFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true)
GameObjectAI * AI() const
Definition GameObject.h:384
void SetGoType(GameobjectTypes type)
Definition GameObject.h:283
void SetLocalRotation(float qx, float qy, float qz, float qw)
GameObjectTemplateAddon const * m_goTemplateAddon
Definition GameObject.h:488
bool AIM_Initialize()
void UpdateModelPosition()
void RelocateStationaryPosition(float x, float y, float z, float o)
Definition GameObject.h:410
void SetDisplayId(uint32 displayid)
GameObjectTemplate const * m_goInfo
Definition GameObject.h:487
void CleanupsBeforeDelete(bool finalCleanup=true) override
void AddToWorld() override
GameObjectOverride const * GetGameObjectOverride() const
void SetParentRotation(QuaternionData const &rotation)
std::unique_ptr< GameObjectModel > m_model
Definition GameObject.h:400
void SetFaction(uint32 faction) override
Definition GameObject.h:398
Definition Map.h:225
void DynamicObjectRelocation(DynamicObject *go, float x, float y, float z, float orientation)
Definition Map.cpp:1111
void GameObjectRelocation(GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
Definition Map.cpp:1082
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
Definition Map.cpp:1050
bool AddToMap(T *)
Definition Map.cpp:517
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:558
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
Definition Map.cpp:1141
time_t GetGORespawnTime(ObjectGuid::LowType spawnId) const
Definition Map.h:525
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
Definition Map.h:524
void InsertGameObjectModel(GameObjectModel const &model)
Definition Map.h:499
bool IsGridLoaded(uint32 gridId) const
Definition Map.h:275
PlayerList const & GetPlayers() const
Definition Map.h:403
void PlayerRelocation(Player *, float x, float y, float z, float orientation)
Definition Map.cpp:1023
std::string ToString() const
uint64 LowType
Definition ObjectGuid.h:321
void SetDynamicFlag(uint32 flag)
Definition Object.h:97
DynamicObject * ToDynObject()
Definition Object.h:141
Player * ToPlayer()
Definition Object.h:126
AreaTrigger * ToAreaTrigger()
Definition Object.h:146
GameObject * ToGameObject()
Definition Object.h:131
Creature * ToCreature()
Definition Object.h:121
void RemoveDynamicFlag(uint32 flag)
Definition Object.h:98
void SetEntry(uint32 entry)
Definition Object.h:90
virtual void SetObjectScale(float scale)
Definition Object.h:93
Unit * ToUnit()
Definition Object.h:116
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)
Definition Player.cpp:27493
bool IsBeingTeleported() const
Definition Player.h:2402
virtual void InitStats(WorldObject *summoner, Milliseconds duration)
void SetTempSummonType(TempSummonType type)
virtual void InitSummon(WorldObject *summoner)
Definition Totem.h:31
void UpdatePassengerPosition(Map *map, WorldObject *passenger, Position const &position, bool setHomePosition)
Definition Transport.cpp:36
virtual Position GetPositionWithOffset(Position const &offset) const =0
This method transforms supplied transport offsets into global coordinates.
void UpdatePosition(float x, float y, float z, float o)
TransportMovementState _movementState
Definition Transport.h:112
void SetPeriod(uint32 period)
Definition Transport.h:84
uint32 GetTransportPeriod() const
Definition Transport.h:83
Position GetPositionWithOffset(Position const &offset) const override
This method transforms supplied transport offsets into global coordinates.
Definition Transport.h:76
void LoadStaticPassengers()
Needed when transport moves from inactive to active grid.
Optional< uint32 > _requestStopTimestamp
Definition Transport.h:115
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
void AddPassenger(WorldObject *passenger, Position const &offset) override
uint32 _pathProgress
Definition Transport.h:116
PassengerSet _staticPassengers
Definition Transport.h:120
bool _delayedAddModel
Definition Transport.h:122
size_t _currentPathLeg
Definition Transport.h:114
TimeTracker _positionChangeTimer
Definition Transport.h:117
Creature * CreateNPCPassenger(ObjectGuid::LowType guid, CreatureData const *data)
void UpdatePassengerPositions(PassengerSet const &passengers)
ObjectGuid GetTransportGUID() const override
Definition Transport.h:71
int32 GetMapIdForSpawning() const override
GameObject * CreateGOPassenger(ObjectGuid::LowType guid, GameObjectData const *data)
std::set< WorldObject * > PassengerSet
Definition Transport.h:35
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
Definition Transport.h:111
std::unique_ptr< boost::dynamic_bitset< uint8 > > _eventsToTrigger
Definition Transport.h:113
PassengerSet _passengers
Definition Transport.h:119
void TeleportPassengersAndHideTransport(uint32 newMapid)
void CleanupsBeforeDelete(bool finalCleanup=true) override
Transport * RemovePassenger(WorldObject *passenger) override
Definition Unit.h:635
Unit * GetVehicleBase() const
Definition Unit.cpp:12111
void SetCreatedBySpell(int32 spellId)
Definition Unit.h:860
void AddUnitState(uint32 f)
Definition Unit.h:742
bool BuildPacket(WorldPacket *packet)
constexpr WorldLocation()
Definition Position.h:194
constexpr uint32 GetMapId() const
Definition Position.h:216
Map * GetMap() const
Definition Object.h:411
Map * FindMap() const
Definition Object.h:412
PhaseShift & GetPhaseShift()
Definition Object.h:310
std::string const & GetName() const
Definition Object.h:342
void AddObjectToRemoveList()
Definition Object.cpp:1174
void SetName(std::string newname)
Definition Object.h:343
MovementInfo m_movementInfo
Definition Object.h:548
void SetTransport(TransportBase *t)
Definition Object.cpp:3100
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
uint32 GetGameTimeMS()
Definition GameTime.cpp:57
STL namespace.
Definition Cell.h:47
bool DiffGrid(Cell const &cell) const
Definition Cell.h:65
struct GameObjectTemplate::@197::@214 moTransport
struct MovementInfo::TransportInfo transport
constexpr void SetOrientation(float orientation)
Definition Position.h:82
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
bool IsPositionValid() const
Definition Position.cpp:42
constexpr void Relocate(float x, float y)
Definition Position.h:74
constexpr float GetPositionZ() const
Definition Position.h:89
uint8 phaseUseFlags
Definition SpawnData.h:137
uint32 phaseId
Definition SpawnData.h:138
Position spawnPoint
Definition SpawnData.h:136
int32 terrainSwapMap
Definition SpawnData.h:140
uint32 phaseGroup
Definition SpawnData.h:139
EnumFlag< SummonPropertiesFlags > GetFlags() const
void Update(int32 diff)
Definition Timer.h:121
bool Passed() const
Definition Timer.h:131
void Reset(int32 expiry)
Definition Timer.h:136
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