Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Transport.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "Cell.h"
7#include "CellImpl.h"
8#include "Common.h"
9#include "DBCStores.h"
10#include "GameObjectAI.h"
12#include "MapManager.h"
13#include "MapReference.h"
14#include "ObjectMgr.h"
15#include "Path.h"
16#include "Player.h"
17#include "ScriptMgr.h"
18#include "Transport.h"
19#include "Vehicle.h"
20#include "World.h"
21#include "WorldPacket.h"
22#include <G3D/Quat.h>
23
29
35
36bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
37{
38 Relocate(x, y, z, ang);
39
40 if (!IsPositionValid())
41 {
42 SF_LOG_ERROR("entities.transport", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
43 guidlow, x, y);
44 return false;
45 }
46
48
49 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
50
51 if (!goinfo)
52 {
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);
54 return false;
55 }
56
57 m_goInfo = goinfo;
58
59 TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry);
60 if (!tInfo)
61 {
62 SF_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str());
63 return false;
64 }
65
66 _transportInfo = tInfo;
67
68 // initialize waypoints
69 _nextFrame = tInfo->keyFrames.begin();
73
74 m_goValue.Transport.PathProgress = 0;
78 SetPeriod(tInfo->pathTime);
79 SetEntry(goinfo->entry);
80 SetDisplayId(goinfo->displayId);
84 SetGoAnimProgress(animprogress);
85 SetName(goinfo->name);
86 UpdateRotationFields(0.0f, 1.0f);
88 return true;
89}
90
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)
92{
93 Relocate(x, y, z, ang);
94 m_stationaryPosition.Relocate(x, y, z, ang);
95
96 if (!IsPositionValid())
97 {
98 SF_LOG_ERROR("entities.transport", "Transport (Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", entry, x, y);
99 return false;
100 }
101
102 SetMap(map);
103
104 Object::_Create(guidlow ? guidlow : sObjectMgr->GenerateLowGuid(HIGHGUID_MO_TRANSPORT), 0, HIGHGUID_MO_TRANSPORT);
105
106 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
107 if (!goinfo)
108 {
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);
110 return false;
111 }
112
113 if (goinfo->type != GAMEOBJECT_TYPE_TRANSPORT)
114 {
115 SF_LOG_ERROR("entities.transport", "Transport %u (name: %s) has unsupported local transport type %u.", entry, goinfo->name.c_str(), goinfo->type);
116 return false;
117 }
118
119 m_goInfo = goinfo;
120 m_goValue.Transport.AnimationInfo = sTransportMgr->GetTransportAnimInfo(entry);
121 if (!m_goValue.Transport.AnimationInfo)
122 {
123 SF_LOG_ERROR("entities.transport", "Transport %u (name: %s) will not be created, missing data in TransportAnimation.dbc", entry, goinfo->name.c_str());
124 return false;
125 }
126
129
130 uint32 flags = goinfo->flags;
131 switch (entry)
132 {
133 case 218203:
134 case 218204:
135 case 218205:
136 case 218206:
137 case 218207:
138 case 218208:
140 break;
141 default:
142 break;
143 }
144
145 SetObjectScale(goinfo->size);
148 SetEntry(goinfo->entry);
149 SetDisplayId(goinfo->displayId);
151 SetName(goinfo->name);
152
155 UpdateRotationFields(rotation2, rotation3);
156
159 goinfo->transport.startOpen != 0, !m_transportPauseTimes.empty()));
162 SetGoAnimProgress(animprogress);
163
167 return true;
168}
169
171{
172 uint32 const positionUpdateDelay = 200;
173
174 if (AI())
175 AI()->UpdateAI(diff);
176 else if (!AIM_Initialize())
177 SF_LOG_ERROR("entities.transport", "Could not initialize GameObjectAI for Transport");
178
180 {
182
183 uint32 const period = GetPeriod();
185 if (period && animation && !animation->Path.empty())
186 {
187 uint32 const timer = GetTimer() % period;
188 TransportPathContainer::const_iterator nextItr = animation->Path.upper_bound(timer);
189 if (nextItr == animation->Path.end())
190 nextItr = animation->Path.begin();
191
192 TransportPathContainer::const_iterator prevItr = nextItr;
193 if (prevItr == animation->Path.begin())
194 prevItr = animation->Path.end();
195 --prevItr;
196
197 TransportAnimationEntry const* prev = prevItr->second;
198 TransportAnimationEntry const* next = nextItr->second;
199
200 float segmentPct = 0.0f;
201 if (prev != next)
202 {
203 uint32 const prevTime = prev->TimeSeg;
204 uint32 const nextTime = next->TimeSeg;
205 uint32 const segmentLength = nextTime > prevTime ? nextTime - prevTime : period - prevTime + nextTime;
206 uint32 const segmentProgress = timer >= prevTime ? timer - prevTime : period - prevTime + timer;
207
208 if (segmentLength)
209 segmentPct = float(segmentProgress) / float(segmentLength);
210 }
211
212 G3D::Vector3 offset(prev->X, prev->Y, prev->Z);
213 if (prev != next)
214 offset = offset.lerp(G3D::Vector3(next->X, next->Y, next->Z), segmentPct);
215
216 G3D::Quat parentRotation(
221
222 G3D::Vector3 pos = G3D::Vector3(GetStationaryX(), GetStationaryY(), GetStationaryZ()) + parentRotation.toRotationMatrix() * offset;
223 UpdatePosition(pos.x, pos.y, pos.z, GetStationaryO());
224 }
225
226 sScriptMgr->OnTransportUpdate(this, diff);
227 return;
228 }
229
230 if (GetKeyFrames().size() <= 1)
231 return;
232
233 m_goValue.Transport.PathProgress += diff;
234
235 uint32 timer = m_goValue.Transport.PathProgress % GetPeriod();
236
237 // Set current waypoint
238 // Desired outcome: _currentFrame->DepartureTime < timer < _nextFrame->ArriveTime
239 // ... arrive | ... delay ... | departure
240 // event / event /
241 for (;;)
242 {
243 if (timer >= _currentFrame->ArriveTime)
244 {
246 {
249 }
250
251 if (timer < _currentFrame->DepartureTime)
252 {
253 SetMoving(false);
254 if (_pendingStop)
256 break; // its a stop frame and we are waiting
257 }
258 }
259
260 if (_pendingStop && timer >= _currentFrame->DepartureTime && GetGoState() == GOState::GO_STATE_READY)
261 {
262 m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetPeriod());
263 m_goValue.Transport.PathProgress *= GetPeriod();
264 m_goValue.Transport.PathProgress += _currentFrame->ArriveTime;
265 break;
266 }
267
268 if (timer >= _currentFrame->DepartureTime && !_triggeredDepartureEvent)
269 {
270 DoEventIfAny(*_currentFrame, true); // departure event
272 }
273
274 if (timer >= _currentFrame->DepartureTime && timer < _currentFrame->NextArriveTime)
275 break; // found current waypoint
276
278
279 // not waiting anymore
280 SetMoving(true);
281
282 // Enable movement
283 if (GetGOInfo()->moTransport.canBeStopped)
285
286 sScriptMgr->OnRelocate(this, _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z);
287
288 SF_LOG_DEBUG("entities.transport", "Transport %u (%s) moved to node %u %u %f %f %f", GetEntry(), GetName().c_str(), _currentFrame->Node->index, _currentFrame->Node->mapid, _currentFrame->Node->x, _currentFrame->Node->y, _currentFrame->Node->z);
289
290 // Departure event
291 if (_currentFrame->IsTeleportFrame())
292 if (TeleportTransport(_nextFrame->Node->mapid, _nextFrame->Node->x, _nextFrame->Node->y, _nextFrame->Node->z))
293 return; // Update more in new map thread
294 }
295
296 // Set position
297 _positionChangeTimer.Update(diff);
298 if (_positionChangeTimer.Passed())
299 {
300 _positionChangeTimer.Reset(positionUpdateDelay);
301 if (IsMoving())
302 {
303 float t = CalculateSegmentPos(float(timer) * 0.001f);
304 G3D::Vector3 pos, dir;
305 _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos);
306 _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir);
307 UpdatePosition(pos.x, pos.y, pos.z, atan2(dir.x, dir.y));
308 }
309 }
310
311 sScriptMgr->OnTransportUpdate(this, diff);
312}
313
315{
316 if (!IsInWorld())
317 return;
318
319 if (_passengers.insert(passenger).second)
320 {
321 passenger->SetTransport(this);
322 passenger->m_movementInfo.transport.guid = GetGUID();
323
325 if (Unit* unit = passenger->ToUnit())
326 unit->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);
327
328 SF_LOG_DEBUG("entities.transport", "Object %s boarded transport %s.", passenger->GetName().c_str(), GetName().c_str());
329
330 if (Player* plr = passenger->ToPlayer())
331 sScriptMgr->OnAddPassenger(this, plr);
332 }
333}
334
336{
337 if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) // static passenger can remove itself in case of grid unload
338 {
339 passenger->m_movementInfo.transport.Reset();
340 passenger->SetTransport(NULL);
341
343 if (Unit* unit = passenger->ToUnit())
344 unit->ClearUnitState(UNIT_STATE_IGNORE_PATHFINDING);
345
346 SF_LOG_DEBUG("entities.transport", "Object %s removed from transport %s.", passenger->GetName().c_str(), GetName().c_str());
347
348 if (Player* plr = passenger->ToPlayer())
349 sScriptMgr->OnRemovePassenger(this, plr);
350 }
351}
352
354{
355 Map* map = GetMap();
356 Creature* creature = new Creature();
357
358 if (!creature->LoadCreatureFromDB(guid, map, false))
359 {
360 delete creature;
361 return NULL;
362 }
363
364 float x = data->posX;
365 float y = data->posY;
366 float z = data->posZ;
367 float o = data->orientation;
368
369 creature->SetTransport(this);
370 creature->m_movementInfo.transport.guid = GetGUID();
371 creature->m_movementInfo.transport.pos.Relocate(x, y, z, o);
372 CalculatePassengerPosition(x, y, z, &o);
373 creature->Relocate(x, y, z, o);
374 creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
376
380
381 if (!creature->IsPositionValid())
382 {
383 SF_LOG_ERROR("entities.transport", "Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)",
384 creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY());
385 delete creature;
386 return NULL;
387 }
388
389 if (!map->AddToMap(creature))
390 {
391 delete creature;
392 return NULL;
393 }
394
395 _staticPassengers.insert(creature);
396 sScriptMgr->OnAddCreaturePassenger(this, creature);
397 return creature;
398}
399
401{
402 Map* map = GetMap();
403 GameObject* go = new GameObject();
404
405 if (!go->LoadGameObjectFromDB(guid, map, false))
406 {
407 delete go;
408 return NULL;
409 }
410
411 float x = data->posX;
412 float y = data->posY;
413 float z = data->posZ;
414 float o = data->orientation;
415
416 go->SetTransport(this);
418 go->m_movementInfo.transport.pos.Relocate(x, y, z, o);
419 CalculatePassengerPosition(x, y, z, &o);
420 go->Relocate(x, y, z, o);
421
422 if (!go->IsPositionValid())
423 {
424 SF_LOG_ERROR("entities.transport", "GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY());
425 delete go;
426 return NULL;
427 }
428
429 if (!map->AddToMap(go))
430 {
431 delete go;
432 return NULL;
433 }
434
435 _staticPassengers.insert(go);
436 return go;
437}
438
439void Transport::UpdatePosition(float x, float y, float z, float o)
440{
441 bool newActive = GetMap()->IsGridLoaded(x, y);
442
443 Relocate(x, y, z, o);
446 else
447 UpdateRotationFields(std::sin(o / 2.0f), std::cos(o / 2.0f));
449
451
453 return;
454
455 /* There are four possible scenarios that trigger loading/unloading passengers:
456 1. transport moves from inactive to active grid
457 2. the grid that transport is currently in becomes active
458 3. transport moves from active to inactive grid
459 4. the grid that transport is currently in unloads
460 */
461 if (_staticPassengers.empty() && newActive) // 1. and 2.
463 else if (!_staticPassengers.empty() && !newActive && Cell(x, y).DiffGrid(Cell(GetPositionX(), GetPositionY()))) // 3.
465 else
467 // 4. is handed by grid unload
468}
469
471{
472 if (uint32 mapId = GetGOInfo()->moTransport.mapID)
473 {
474 CellObjectGuidsMap const& cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetSpawnMode());
475 CellGuidSet::const_iterator guidEnd;
476 for (CellObjectGuidsMap::const_iterator cellItr = cells.begin(); cellItr != cells.end(); ++cellItr)
477 {
478 // Creatures on transport
479 guidEnd = cellItr->second.creatures.end();
480 for (CellGuidSet::const_iterator guidItr = cellItr->second.creatures.begin(); guidItr != guidEnd; ++guidItr)
481 CreateNPCPassenger(*guidItr, sObjectMgr->GetCreatureData(*guidItr));
482
483 // GameObjects on transport
484 guidEnd = cellItr->second.gameobjects.end();
485 for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr)
486 CreateGOPassenger(*guidItr, sObjectMgr->GetGOData(*guidItr));
487 }
488 }
489}
490
492{
493 while (!_staticPassengers.empty())
494 {
495 WorldObject* obj = *_staticPassengers.begin();
496 obj->AddObjectToRemoveList(); // also removes from _staticPassengers
497 }
498}
499
501{
503 {
505 return;
506 }
507
508 if (!GetGOInfo()->moTransport.canBeStopped)
509 return;
510
511 _pendingStop = !enabled;
512}
513
515{
516 // Clear events flagging
519
520 // Set frames
522 if (_nextFrame == GetKeyFrames().end())
523 _nextFrame = GetKeyFrames().begin();
524}
525
527{
528 KeyFrame const& frame = *_currentFrame;
529 const float speed = float(m_goInfo->moTransport.moveSpeed);
530 const float accel = float(m_goInfo->moTransport.accelRate);
531 float timeSinceStop = frame.TimeFrom + (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
532 float timeUntilStop = frame.TimeTo - (now - (1.0f / float(IN_MILLISECONDS)) * frame.DepartureTime);
533 float segmentPos, dist;
534 float accelTime = _transportInfo->accelTime;
535 float accelDist = _transportInfo->accelDist;
536 // calculate from nearest stop, less confusing calculation...
537 if (timeSinceStop < timeUntilStop)
538 {
539 if (timeSinceStop < accelTime)
540 dist = 0.5f * accel * timeSinceStop * timeSinceStop;
541 else
542 dist = accelDist + (timeSinceStop - accelTime) * speed;
543 segmentPos = dist - frame.DistSinceStop;
544 }
545 else
546 {
547 if (timeUntilStop < _transportInfo->accelTime)
548 dist = 0.5f * accel * timeUntilStop * timeUntilStop;
549 else
550 dist = accelDist + (timeUntilStop - accelTime) * speed;
551 segmentPos = frame.DistUntilStop - dist;
552 }
553
554 return segmentPos / frame.NextDistFromPrev;
555}
556
557bool Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
558{
559 Map const* oldMap = GetMap();
560
561 if (oldMap->GetId() != newMapid)
562 {
563 Map* newMap = sMapMgr->CreateBaseMap(newMapid);
564 Map::PlayerList const& oldPlayers = GetMap()->GetPlayers();
565 if (!oldPlayers.isEmpty())
566 {
567 UpdateData data(GetMapId());
569 WorldPacket packet;
570 data.BuildPacket(&packet);
571 for (Map::PlayerList::const_iterator itr = oldPlayers.begin(); itr != oldPlayers.end(); ++itr)
572 if (itr->GetSource()->GetTransport() != this)
573 itr->GetSource()->SendDirectMessage(&packet);
574 }
575
577 GetMap()->RemoveFromMap<Transport>(this, false);
578 SetMap(newMap);
579
580 Map::PlayerList const& newPlayers = GetMap()->GetPlayers();
581 if (!newPlayers.isEmpty())
582 {
583 for (Map::PlayerList::const_iterator itr = newPlayers.begin(); itr != newPlayers.end(); ++itr)
584 {
585 if (itr->GetSource()->GetTransport() != this)
586 {
587 UpdateData data(newMapid);
588 BuildCreateUpdateBlockForPlayer(&data, itr->GetSource());
589 WorldPacket packet;
590 data.BuildPacket(&packet);
591 itr->GetSource()->SendDirectMessage(&packet);
592 }
593 }
594 }
595
596 for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end();)
597 {
598 WorldObject* obj = (*itr++);
599
600 float destX, destY, destZ, destO;
601 obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
602 TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, GetOrientation());
603
604 switch (obj->GetTypeId())
605 {
607 obj->ToCreature()->FarTeleportTo(newMap, destX, destY, destZ, destO);
608 break;
610 {
611 GameObject* go = obj->ToGameObject();
612 go->GetMap()->RemoveFromMap(go, false);
613 go->Relocate(destX, destY, destZ, destO);
614 go->SetMap(newMap);
615 newMap->AddToMap(go);
616 break;
617 }
619 if (!obj->ToPlayer()->TeleportTo(newMapid, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_UNSUMMON_PET))
620 _passengers.erase(obj);
621 break;
622 default:
623 break;
624 }
625 }
626
627 Relocate(x, y, z, GetOrientation());
629 GetMap()->AddToMap<Transport>(this);
630 return true;
631 }
632 else
633 {
634 // Teleport players, they need to know it
635 for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr)
636 {
637 if ((*itr)->GetTypeId() == TypeID::TYPEID_PLAYER)
638 {
639 float destX, destY, destZ, destO;
640 (*itr)->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
641 TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, GetOrientation());
642
643 (*itr)->ToUnit()->NearTeleportTo(destX, destY, destZ, destO);
644 }
645 }
646
647 UpdatePosition(x, y, z, GetOrientation());
648 return false;
649 }
650}
651
652void Transport::UpdatePassengerPositions(std::set<WorldObject*>& passengers)
653{
654 for (std::set<WorldObject*>::iterator itr = passengers.begin(); itr != passengers.end(); ++itr)
655 {
656 WorldObject* passenger = *itr;
657 // transport teleported but passenger not yet (can happen for players)
658 if (passenger->GetMap() != GetMap())
659 continue;
660
661 // if passenger is on vehicle we have to assume the vehicle is also on transport
662 // and its the vehicle that will be updating its passengers
663 if (Unit* unit = passenger->ToUnit())
664 if (unit->GetVehicle())
665 continue;
666
667 // Do not use Unit::UpdatePosition here, we don't want to remove auras
668 // as if regular movement occurred
669 float x, y, z, o;
670 passenger->m_movementInfo.transport.pos.GetPosition(x, y, z, o);
671 CalculatePassengerPosition(x, y, z, &o);
672 switch (passenger->GetTypeId())
673 {
675 {
676 Creature* creature = passenger->ToCreature();
677 GetMap()->CreatureRelocation(creature, x, y, z, o, false);
678 creature->GetTransportHomePosition(x, y, z, o);
679 CalculatePassengerPosition(x, y, z, &o);
680 creature->SetHomePosition(x, y, z, o);
681 break;
682 }
684 GetMap()->PlayerRelocation(passenger->ToPlayer(), x, y, z, o);
685 break;
687 GetMap()->GameObjectRelocation(passenger->ToGameObject(), x, y, z, o, false);
688 break;
689 default:
690 break;
691 }
692
693 if (Unit* unit = passenger->ToUnit())
694 if (Vehicle* vehicle = unit->GetVehicleKit())
695 vehicle->RelocatePassengers();
696 }
697}
698
699void Transport::DoEventIfAny(KeyFrame const& node, bool departure)
700{
701 if (uint32 eventid = departure ? node.Node->departureEventID : node.Node->arrivalEventID)
702 {
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());
704 GetMap()->ScriptsStart(sEventScripts, eventid, this, this);
705 EventInform(eventid);
706 }
707}
708
710{
711 Map::PlayerList const& players = GetMap()->GetPlayers();
712 if (players.isEmpty())
713 return;
714
715 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
716 {
717 Player* player = itr->GetSource();
718 if (!player->IsInWorld())
719 continue;
720
721 if (player->GetTransport() != this && !player->HaveAtClient(this))
722 continue;
723
724 BuildFieldsUpdate(player, data_map);
725 }
726
727 ClearUpdateMask(true);
728}
@ IN_MILLISECONDS
Definition Common.h:125
std::uint32_t uint32
Definition Define.h:77
#define ASSERT
Definition Errors.h:29
GOState
Definition GameObject.h:575
@ GO_STATE_ACTIVE
Definition GameObject.h:576
@ GO_STATE_READY
Definition GameObject.h:577
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define sMapMgr
Definition MapManager.h:145
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_GAMEOBJECT
Definition Object.h:56
@ TYPEID_UNIT
Definition Object.h:54
UNORDERED_MAP< Player *, UpdateData > UpdateDataMapType
Definition Object.h:107
@ HIGHGUID_MO_TRANSPORT
ScriptMapMap sEventScripts
Definition ObjectMgr.cpp:51
UNORDERED_MAP< uint32, CellObjectGuids > CellObjectGuidsMap
Definition ObjectMgr.h:421
#define sObjectMgr
Definition ObjectMgr.h:1617
@ TELE_TO_NOT_UNSUMMON_PET
Definition Player.h:832
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:830
#define sScriptMgr
Definition ScriptMgr.h:764
@ GAMEOBJECT_TYPE_MO_TRANSPORT
@ GAMEOBJECT_TYPE_TRANSPORT
@ GO_FLAG_NODESPAWN
@ GO_FLAG_TRANSPORT
#define sTransportMgr
@ UNIT_STATE_IGNORE_PATHFINDING
Definition Unit.h:539
@ UPDATEFLAG_ROTATION
Definition UpdateData.h:34
@ UPDATEFLAG_LOWGUID
Definition UpdateData.h:29
@ UPDATEFLAG_TRANSPORT
Definition UpdateData.h:26
@ UPDATEFLAG_STATIONARY_POSITION
Definition UpdateData.h:31
@ OBJECT_FIELD_SCALE
@ GAMEOBJECT_FIELD_PARENT_ROTATION
@ GAMEOBJECT_FIELD_PERCENT_HEALTH
@ GAMEOBJECT_FIELD_FACTION_TEMPLATE
@ GAMEOBJECT_FIELD_FLAGS
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:626
void FarTeleportTo(Map *map, float X, float Y, float Z, float O)
void GetTransportHomePosition(float &x, float &y, float &z, float &ori)
Definition Creature.h:633
void SetTransportHomePosition(float x, float y, float z, float o)
Definition Creature.h:631
bool LoadCreatureFromDB(uint32 guid, Map *map, bool addToMap=true)
virtual void UpdateAI(uint32)
std::vector< uint32 > m_transportPauseTimes
Definition GameObject.h:874
void SetGoState(GOState state)
void UpdateLegacyTransportPathProgress()
GameObjectValue m_goValue
Definition GameObject.h:873
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:643
GOState GetGoState() const
Definition GameObject.h:717
Position m_stationaryPosition
Definition GameObject.h:877
float GetStationaryY() const OVERRIDE
Definition GameObject.h:837
void UpdateWorldRotationField()
void UpdateRotationFields(float rotation2=0.0f, float rotation3=0.0f)
void SetGoAnimProgress(uint8 animprogress)
Definition GameObject.h:733
void InitializeLegacyTransport()
GameObjectValue const * GetGOValue() const
Definition GameObject.h:645
GameObjectModel * CreateModel()
GameObjectAI * AI() const
Definition GameObject.h:824
void SetLegacyTransportStopped(bool stopped)
GameobjectTypes GetGoType() const
Definition GameObject.h:719
void SetGoType(GameobjectTypes type)
Definition GameObject.h:720
bool LoadGameObjectFromDB(uint32 guid, Map *map, bool addToMap=true)
bool AIM_Initialize()
GameObjectModel * m_model
Definition GameObject.h:830
void EventInform(uint32 eventId)
void UpdateModelPosition()
float GetStationaryZ() const OVERRIDE
Definition GameObject.h:838
void SetDisplayId(uint32 displayid)
GameObjectTemplate const * m_goInfo
Definition GameObject.h:871
uint32 GetGOStateValue(GOState state)
float GetStationaryO() const OVERRIDE
Definition GameObject.h:839
float GetStationaryX() const OVERRIDE
Definition GameObject.h:836
bool isEmpty() const
Definition LinkedList.h:86
void GameObjectRelocation(GameObject *go, float x, float y, float z, float orientation, bool respawnRelocationOnFail=true)
Definition Map.cpp:946
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
Definition Map.cpp:909
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
bool AddToMap(T *)
Definition Map.cpp:504
MapRefManager PlayerList
Definition Map.h:406
bool IsGridLoaded(float x, float y) const
Definition Map.h:283
void RemoveFromMap(T *, bool)
Definition Map.cpp:826
uint32 GetId(void) const
Definition Map.h:300
PlayerList const & GetPlayers() const
Definition Map.h:407
void PlayerRelocation(Player *, float x, float y, float z, float orientation)
Definition Map.cpp:877
friend class Map
Definition Object.h:589
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:1158
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition Object.cpp:932
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
bool IsInWorld() const
Definition Object.h:114
uint32 GetGUIDLow() const
Definition Object.h:120
TypeID GetTypeId() const
Definition Object.h:131
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition Object.cpp:172
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
Definition Object.cpp:129
float GetFloatValue(uint16 index) const
Definition Object.cpp:337
void ClearUpdateMask(bool remove)
Definition Object.cpp:917
GameObject * ToGameObject()
Definition Object.h:213
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
void SetFloatValue(uint16 index, float value)
Definition Object.cpp:1141
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
Definition Object.cpp:282
void SetEntry(uint32 entry)
Definition Object.h:126
virtual void SetObjectScale(float scale)
Definition Object.h:129
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:1038
uint16 m_updateFlag
Definition Object.h:245
Unit * ToUnit()
Definition Object.h:210
bool HaveAtClient(WorldObject const *u) const
Definition Player.cpp:18066
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0)
Definition Player.cpp:2090
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)
Definition Transport.h:51
std::set< WorldObject * > _staticPassengers
Definition Transport.h:92
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.
Definition Transport.h:39
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.
Definition Transport.h:88
GameObject * CreateGOPassenger(uint32 guid, GameObjectData const *data)
KeyFrameVec::const_iterator _currentFrame
Definition Transport.h:81
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)
Definition Transport.cpp:36
float CalculateSegmentPos(float perc)
void RemovePassenger(WorldObject *passenger)
void UnloadStaticPassengers()
Needed when transport enters inactive grid.
void Update(uint32 diff)
KeyFrameVec const & GetKeyFrames() const
Definition Transport.h:54
bool _pendingStop
Definition Transport.h:85
std::set< WorldObject * > _passengers
Definition Transport.h:91
TimeTrackerSmall _positionChangeTimer
Definition Transport.h:83
bool _triggeredDepartureEvent
Definition Transport.h:89
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)
Definition Transport.cpp:91
bool _isMoving
Definition Transport.h:84
KeyFrameVec::const_iterator _nextFrame
Definition Transport.h:82
TransportTemplate const * _transportInfo
Definition Transport.h:79
void MoveToNextWaypoint()
void AddPassenger(WorldObject *passenger)
bool IsMoving() const
Helpers to know if stop frame was reached.
Definition Transport.h:76
uint32 GetPeriod() const
Definition Transport.h:50
Creature * CreateNPCPassenger(uint32 guid, CreatureData const *data)
uint32 GetTimer() const
Definition Transport.h:52
void SetMoving(bool val)
Definition Transport.h:77
Definition Unit.h:1367
void AddUnitState(uint32 f)
Definition Unit.h:1481
bool BuildPacket(WorldPacket *packet)
uint32 GetMapId() const
Definition Object.h:546
Map * GetMap() const
Definition Object.h:740
void SetTransport(Transport *t)
Definition Object.h:805
uint32 LastUsedScriptID
Definition Object.h:794
void SetName(std::string const &newname)
Definition Object.h:665
std::string const & GetName() const
Definition Object.h:664
virtual void SetMap(Map *map)
Definition Object.cpp:2514
void AddObjectToRemoveList()
Definition Object.cpp:2550
WorldObject(bool isWorldObject)
Definition Object.cpp:1514
Transport * GetTransport() const
Definition Object.h:797
MovementInfo m_movementInfo
Definition Object.h:807
uint32 GetInitialLegacyTransportState(bool, bool hasStopFrames)
Definition Cell.h:37
float orientation
Definition Creature.h:269
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@133216107201365043142154201341232071301300107152 transport
std::string name
Definition GameObject.h:28
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@316212233253022127367165230227137227160036113140 moTransport
float DistUntilStop
float NextDistFromPrev
float DistSinceStop
uint32 DepartureTime
TaxiPathNodeEntry const * Node
float TimeFrom
float TimeTo
struct MovementInfo::TransportInfo transport
float GetPositionZ() const
Definition Object.h:330
float GetOrientation() const
Definition Object.h:331
bool IsPositionValid() const
Definition Object.cpp:2049
float GetPositionX() const
Definition Object.h:328
void GetPosition(float &x, float &y) const
Definition Object.h:333
float GetPositionY() const
Definition Object.h:329
void Relocate(float x, float y)
Definition Object.h:302
uint32 arrivalEventID
uint32 departureEventID
uint32 index
float Y
float Z
float X
uint32 TimeSeg
TransportPathContainer Path
KeyFrameVec keyFrames
struct GameObjectValue::@210223111052332366220354331325332170103204164100 Transport
TransportAnimation const * AnimationInfo
Definition GameObject.h:540