AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
TransportMgr Class Reference

#include "TransportMgr.h"

Public Member Functions

void Unload ()
 
void LoadTransportTemplates ()
 
MotionTransportCreateTransport (uint32 entry, ObjectGuid::LowType guid=0, Map *map=nullptr)
 
void SpawnContinentTransports ()
 
void CreateInstanceTransports (Map *map)
 
TransportTemplate const * GetTransportTemplate (uint32 entry) const
 
TransportAnimation const * GetTransportAnimInfo (uint32 entry) const
 
void GeneratePath (GameObjectTemplate const *goInfo, TransportTemplate *transport)
 
void AddPathNodeToTransport (uint32 transportEntry, uint32 timeSeg, TransportAnimationEntry const *node)
 
void AddPathRotationToTransport (uint32 transportEntry, uint32 timeSeg, TransportRotationEntry const *node)
 

Static Public Member Functions

static TransportMgrinstance ()
 

Private Member Functions

 TransportMgr ()
 
 ~TransportMgr ()
 
 TransportMgr (TransportMgr const &)
 
TransportMgroperator= (TransportMgr const &)
 

Private Attributes

TransportTemplates _transportTemplates
 
TransportInstanceMap _instanceTransports
 
TransportAnimationContainer _transportAnimations
 

Friends

void LoadDBCStores (std::string const &)
 

Detailed Description

Constructor & Destructor Documentation

◆ TransportMgr() [1/2]

TransportMgr::TransportMgr ( )
private
35{ }

◆ ~TransportMgr()

TransportMgr::~TransportMgr ( )
private
37{ }

◆ TransportMgr() [2/2]

TransportMgr::TransportMgr ( TransportMgr const &  )
private

Member Function Documentation

◆ AddPathNodeToTransport()

void TransportMgr::AddPathNodeToTransport ( uint32  transportEntry,
uint32  timeSeg,
TransportAnimationEntry const *  node 
)
350{
351 TransportAnimation& animNode = _transportAnimations[transportEntry];
352 if (animNode.TotalTime < timeSeg)
353 animNode.TotalTime = timeSeg;
354
355 animNode.Path[timeSeg] = node;
356}
Definition: TransportMgr.h:88
uint32 TotalTime
Definition: TransportMgr.h:93
TransportPathContainer Path
Definition: TransportMgr.h:91
TransportAnimationContainer _transportAnimations
Definition: TransportMgr.h:160

References _transportAnimations, TransportAnimation::Path, and TransportAnimation::TotalTime.

◆ AddPathRotationToTransport()

void TransportMgr::AddPathRotationToTransport ( uint32  transportEntry,
uint32  timeSeg,
TransportRotationEntry const *  node 
)
inline
144 {
145 _transportAnimations[transportEntry].Rotations[timeSeg] = node;
146 }

References _transportAnimations.

◆ CreateInstanceTransports()

void TransportMgr::CreateInstanceTransports ( Map map)
481{
482 TransportInstanceMap::const_iterator mapTransports = _instanceTransports.find(map->GetId());
483
484 // no transports here
485 if (mapTransports == _instanceTransports.end() || mapTransports->second.empty())
486 return;
487
488 // create transports
489 for (std::set<uint32>::const_iterator itr = mapTransports->second.begin(); itr != mapTransports->second.end(); ++itr)
490 CreateTransport(*itr, 0, map);
491}
uint32 GetId() const
Definition: Map.h:379
MotionTransport * CreateTransport(uint32 entry, ObjectGuid::LowType guid=0, Map *map=nullptr)
Definition: TransportMgr.cpp:358
TransportInstanceMap _instanceTransports
Definition: TransportMgr.h:158

References _instanceTransports, CreateTransport(), and Map::GetId().

◆ CreateTransport()

MotionTransport * TransportMgr::CreateTransport ( uint32  entry,
ObjectGuid::LowType  guid = 0,
Map map = nullptr 
)
359{
360 // instance case, execute GetGameObjectEntry hook
361 if (map)
362 {
363 // SetZoneScript() is called after adding to map, so fetch the script using map
364 if (map->IsDungeon())
365 if (InstanceScript* instance = static_cast<InstanceMap*>(map)->GetInstanceScript())
366 entry = instance->GetGameObjectEntry(0, entry);
367
368 if (!entry)
369 return nullptr;
370 }
371
372 TransportTemplate const* tInfo = GetTransportTemplate(entry);
373 if (!tInfo)
374 {
375 LOG_ERROR("entities.transport", "Transport {} will not be loaded, `transport_template` missing", entry);
376 return nullptr;
377 }
378
379 // create transport...
380 MotionTransport* trans = new MotionTransport();
381
382 // ...at first waypoint
383 TaxiPathNodeEntry const* startNode = tInfo->keyFrames.begin()->Node;
384 uint32 mapId = startNode->mapid;
385 float x = startNode->x;
386 float y = startNode->y;
387 float z = startNode->z;
388 float o = tInfo->keyFrames.begin()->InitialOrientation;
389
390 // initialize the gameobject base
391 ObjectGuid::LowType guidLow = guid ? guid : sObjectMgr->GetGenerator<HighGuid::Mo_Transport>().Generate();
392
393 if (!trans->CreateMoTrans(guidLow, entry, mapId, x, y, z, o, 255))
394 {
395 delete trans;
396 return nullptr;
397 }
398
399 if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId))
400 {
401 if (mapEntry->Instanceable() != tInfo->inInstance)
402 {
403 LOG_ERROR("entities.transport", "Transport {} (name: {}) attempted creation in instance map (id: {}) but it is not an instanced transport!", entry, trans->GetName(), mapId);
404 delete trans;
405 return nullptr;
406 }
407 }
408
409 // use preset map for instances (need to know which instance)
410 trans->SetMap(map ? map : sMapMgr->CreateMap(mapId, nullptr));
411 if (map && map->IsDungeon())
413
414 // xinef: transports are active so passengers can be relocated (grids must be loaded)
415 trans->setActive(true);
417 trans->GetMap()->AddToMap<MotionTransport>(trans);
418 return trans;
419}
std::uint32_t uint32
Definition: Define.h:108
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1640
#define sMapMgr
Definition: MapMgr.h:221
Map * GetMap() const
Definition: Object.h:517
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
ZoneScript * m_zoneScript
Definition: Object.h:629
std::string const & GetName() const
Definition: Object.h:446
virtual void SetMap(Map *map)
Definition: Object.cpp:2096
uint32 LowType
Definition: ObjectGuid.h:124
Definition: Transport.h:48
bool CreateMoTrans(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress)
Definition: Transport.cpp:48
static void Insert(T *o)
Definition: ObjectAccessor.cpp:36
Definition: InstanceScript.h:141
bool IsDungeon() const
Definition: Map.h:448
InstanceMap * ToInstanceMap()
Definition: Map.h:545
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555
Definition: Map.h:818
InstanceScript * GetInstanceScript()
Definition: Map.h:830
Definition: TransportMgr.h:71
bool inInstance
Definition: TransportMgr.h:76
KeyFrameVec keyFrames
Definition: TransportMgr.h:78
static TransportMgr * instance()
Definition: TransportMgr.cpp:39
TransportTemplate const * GetTransportTemplate(uint32 entry) const
Definition: TransportMgr.h:121
Definition: DBCStructure.h:1323
Definition: DBCStructure.h:1974
float y
Definition: DBCStructure.h:1980
float x
Definition: DBCStructure.h:1979
uint32 mapid
Definition: DBCStructure.h:1978
float z
Definition: DBCStructure.h:1981

References Map::AddToMap(), MotionTransport::CreateMoTrans(), InstanceMap::GetInstanceScript(), WorldObject::GetMap(), WorldObject::GetName(), GetTransportTemplate(), TransportTemplate::inInstance, HashMapHolder< T >::Insert(), instance(), Map::IsDungeon(), TransportTemplate::keyFrames, LOG_ERROR, WorldObject::m_zoneScript, TaxiPathNodeEntry::mapid, WorldObject::setActive(), WorldObject::SetMap(), sMapMgr, sMapStore, sObjectMgr, Map::ToInstanceMap(), TaxiPathNodeEntry::x, TaxiPathNodeEntry::y, and TaxiPathNodeEntry::z.

Referenced by CreateInstanceTransports(), and SpawnContinentTransports().

◆ GeneratePath()

void TransportMgr::GeneratePath ( GameObjectTemplate const *  goInfo,
TransportTemplate transport 
)
115{
116 uint32 pathId = goInfo->moTransport.taxiPathId;
117 TaxiPathNodeList const& path = sTaxiPathNodesByPath[pathId];
118 std::vector<KeyFrame>& keyFrames = transport->keyFrames;
119 Movement::PointsArray splinePath, allPoints;
120 bool mapChange = false;
121 for (size_t i = 0; i < path.size(); ++i)
122 allPoints.push_back(G3D::Vector3(path[i]->x, path[i]->y, path[i]->z));
123
124 // Add extra points to allow derivative calculations for all path nodes
125 allPoints.insert(allPoints.begin(), allPoints.front().lerp(allPoints[1], -0.2f));
126 allPoints.push_back(allPoints.back().lerp(allPoints[allPoints.size() - 2], -0.2f));
127 allPoints.push_back(allPoints.back().lerp(allPoints[allPoints.size() - 2], -1.0f));
128
129 SplineRawInitializer initer(allPoints);
130 TransportSpline orientationSpline;
131 orientationSpline.init_spline_custom(initer);
132 orientationSpline.initLengths();
133
134 for (size_t i = 0; i < path.size(); ++i)
135 {
136 if (!mapChange)
137 {
138 TaxiPathNodeEntry const* node_i = path[i];
139 if (i != path.size() - 1 && (node_i->actionFlag & 1 || node_i->mapid != path[i + 1]->mapid))
140 {
141 keyFrames.back().Teleport = true;
142 mapChange = true;
143 }
144 else
145 {
146 KeyFrame k(node_i);
147 G3D::Vector3 h;
148 orientationSpline.evaluate_derivative(i + 1, 0.0f, h);
149 k.InitialOrientation = Position::NormalizeOrientation(std::atan2(h.y, h.x) + M_PI);
150
151 keyFrames.push_back(k);
152 splinePath.push_back(G3D::Vector3(node_i->x, node_i->y, node_i->z));
153 transport->mapsUsed.insert(k.Node->mapid);
154 }
155 }
156 else
157 mapChange = false;
158 }
159
160 if (splinePath.size() >= 2)
161 {
162 // Remove special catmull-rom spline points
163 //if (!keyFrames.front().IsStopFrame() && !keyFrames.front().Node->arrivalEventID && !keyFrames.front().Node->departureEventID)
164 {
165 splinePath.erase(splinePath.begin());
166 keyFrames.erase(keyFrames.begin());
167 }
168 //if (!keyFrames.back().IsStopFrame() && !keyFrames.back().Node->arrivalEventID && !keyFrames.back().Node->departureEventID)
169 {
170 splinePath.pop_back();
171 keyFrames.pop_back();
172 }
173 }
174
175 ASSERT(!keyFrames.empty());
176
177 if (transport->mapsUsed.size() > 1)
178 {
179 for (std::set<uint32>::const_iterator itr = transport->mapsUsed.begin(); itr != transport->mapsUsed.end(); ++itr)
180 ASSERT(!sMapStore.LookupEntry(*itr)->Instanceable());
181
182 transport->inInstance = false;
183 }
184 else
185 transport->inInstance = sMapStore.LookupEntry(*transport->mapsUsed.begin())->Instanceable();
186
187 // last to first is always "teleport", even for closed paths
188 keyFrames.back().Teleport = true;
189
190 const float speed = float(goInfo->moTransport.moveSpeed);
191 const float accel = float(goInfo->moTransport.accelRate);
192 const float accel_dist = 0.5f * speed * speed / accel;
193
194 transport->accelTime = speed / accel;
195 transport->accelDist = accel_dist;
196
197 int32 firstStop = -1;
198 int32 lastStop = -1;
199
200 // first cell is arrived at by teleportation :S
201 keyFrames[0].DistFromPrev = 0;
202 keyFrames[0].Index = 1;
203 if (keyFrames[0].IsStopFrame())
204 {
205 firstStop = 0;
206 lastStop = 0;
207 }
208
209 // find the rest of the distances between key points
210 // Every path segment has its own spline
211 size_t start = 0;
212 for (size_t i = 1; i < keyFrames.size(); ++i)
213 {
214 if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size())
215 {
216 size_t extra = !keyFrames[i - 1].Teleport ? 1 : 0;
217 TransportSpline* spline = new TransportSpline();
218 spline->init_spline(&splinePath[start], i - start + extra, Movement::SplineBase::ModeCatmullrom);
219 spline->initLengths();
220 for (size_t j = start; j < i + extra; ++j)
221 {
222 keyFrames[j].Index = j - start + 1;
223 keyFrames[j].DistFromPrev = spline->length(j - start, j + 1 - start);
224 if (j > 0)
225 keyFrames[j - 1].NextDistFromPrev = keyFrames[j].DistFromPrev;
226 keyFrames[j].Spline = spline;
227 }
228
229 if (keyFrames[i - 1].Teleport)
230 {
231 keyFrames[i].Index = i - start + 1;
232 keyFrames[i].DistFromPrev = 0.0f;
233 keyFrames[i - 1].NextDistFromPrev = 0.0f;
234 keyFrames[i].Spline = spline;
235 }
236
237 start = i;
238 }
239
240 if (keyFrames[i].IsStopFrame())
241 {
242 // remember first stop frame
243 if (firstStop == -1)
244 firstStop = i;
245 lastStop = i;
246 }
247 }
248
249 keyFrames.back().NextDistFromPrev = keyFrames.front().DistFromPrev;
250
251 if (firstStop == -1 || lastStop == -1)
252 firstStop = lastStop = 0;
253
254 // at stopping keyframes, we define distSinceStop == 0,
255 // and distUntilStop is to the next stopping keyframe.
256 // this is required to properly handle cases of two stopping frames in a row (yes they do exist)
257 float tmpDist = 0.0f;
258 for (size_t i = 0; i < keyFrames.size(); ++i)
259 {
260 int32 j = (i + lastStop) % keyFrames.size();
261 if (keyFrames[j].IsStopFrame() || j == lastStop)
262 tmpDist = 0.0f;
263 else
264 tmpDist += keyFrames[j].DistFromPrev;
265 keyFrames[j].DistSinceStop = tmpDist;
266 }
267
268 tmpDist = 0.0f;
269 for (int32 i = int32(keyFrames.size()) - 1; i >= 0; i--)
270 {
271 int32 j = (i + firstStop) % keyFrames.size();
272 tmpDist += keyFrames[(j + 1) % keyFrames.size()].DistFromPrev;
273 keyFrames[j].DistUntilStop = tmpDist;
274 if (keyFrames[j].IsStopFrame() || j == firstStop)
275 tmpDist = 0.0f;
276 }
277
278 for (size_t i = 0; i < keyFrames.size(); ++i)
279 {
280 float total_dist = keyFrames[i].DistSinceStop + keyFrames[i].DistUntilStop;
281 if (total_dist < 2 * accel_dist) // won't reach full speed
282 {
283 if (keyFrames[i].DistSinceStop < keyFrames[i].DistUntilStop) // is still accelerating
284 {
285 // calculate accel+brake time for this short segment
286 float segment_time = 2.0f * std::sqrt((keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / accel);
287 // substract acceleration time
288 keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
289 }
290 else // slowing down
291 keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
292 }
293 else if (keyFrames[i].DistSinceStop < accel_dist) // still accelerating (but will reach full speed)
294 {
295 // calculate accel + cruise + brake time for this long segment
296 float segment_time = (keyFrames[i].DistUntilStop + keyFrames[i].DistSinceStop) / speed + (speed / accel);
297 // substract acceleration time
298 keyFrames[i].TimeTo = segment_time - std::sqrt(2 * keyFrames[i].DistSinceStop / accel);
299 }
300 else if (keyFrames[i].DistUntilStop < accel_dist) // already slowing down (but reached full speed)
301 keyFrames[i].TimeTo = std::sqrt(2 * keyFrames[i].DistUntilStop / accel);
302 else // at full speed
303 keyFrames[i].TimeTo = (keyFrames[i].DistUntilStop / speed) + (0.5f * speed / accel);
304 }
305
306 // calculate tFrom times from tTo times
307 float segmentTime = 0.0f;
308 for (size_t i = 0; i < keyFrames.size(); ++i)
309 {
310 int32 j = (i + lastStop) % keyFrames.size();
311 if (keyFrames[j].IsStopFrame() || j == lastStop)
312 segmentTime = keyFrames[j].TimeTo;
313 keyFrames[j].TimeFrom = segmentTime - keyFrames[j].TimeTo;
314 }
315
316 // calculate path times
317 keyFrames[0].ArriveTime = 0;
318 float curPathTime = 0.0f;
319 if (keyFrames[0].IsStopFrame())
320 {
321 curPathTime = float(keyFrames[0].Node->delay);
322 keyFrames[0].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
323 }
324
325 for (size_t i = 1; i < keyFrames.size(); ++i)
326 {
327 curPathTime += keyFrames[i - 1].TimeTo;
328 if (keyFrames[i].IsStopFrame())
329 {
330 keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
331 keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
332 curPathTime += float(keyFrames[i].Node->delay);
333 keyFrames[i].DepartureTime = uint32(curPathTime * IN_MILLISECONDS);
334 }
335 else
336 {
337 curPathTime -= keyFrames[i].TimeTo;
338 keyFrames[i].ArriveTime = uint32(curPathTime * IN_MILLISECONDS);
339 keyFrames[i - 1].NextArriveTime = keyFrames[i].ArriveTime;
340 keyFrames[i].DepartureTime = keyFrames[i].ArriveTime;
341 }
342 }
343
344 keyFrames.back().NextArriveTime = keyFrames.back().DepartureTime;
345
346 transport->pathTime = keyFrames.back().DepartureTime;
347}
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
#define ASSERT
Definition: Errors.h:68
std::int32_t int32
Definition: Define.h:104
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DBCStores.cpp:186
Movement::Spline< double > TransportSpline
Definition: TransportMgr.h:34
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition: DBCStructure.h:2243
std::vector< Vector3 > PointsArray
Definition: MoveSplineInitArgs.h:28
static float NormalizeOrientation(float o)
Definition: Position.h:233
Definition: TransportMgr.cpp:98
Definition: TransportMgr.h:42
float accelDist
Definition: TransportMgr.h:80
std::set< uint32 > mapsUsed
Definition: TransportMgr.h:75
uint32 pathTime
Definition: TransportMgr.h:77
float accelTime
Definition: TransportMgr.h:79
void init_spline_custom(Init &initializer)
Definition: Spline.h:124
@ ModeCatmullrom
Definition: Spline.h:37
Definition: Spline.h:139
void init_spline(const Vector3 *controls, index_type count, EvaluationMode m)
Definition: Spline.h:173
Spline()=default
length_type length() const
Definition: Spline.h:200
void initLengths()
Definition: SplineImpl.h:78
void evaluate_derivative(float t, Vector3 &hermite) const
Definition: SplineImpl.h:28
uint32 actionFlag
Definition: DBCStructure.h:1982

References TransportTemplate::accelDist, GameObjectTemplate::accelRate, TransportTemplate::accelTime, TaxiPathNodeEntry::actionFlag, ASSERT, Movement::Spline< length_type >::evaluate_derivative(), IN_MILLISECONDS, TransportTemplate::inInstance, Movement::Spline< length_type >::init_spline(), Movement::SplineBase::init_spline_custom(), KeyFrame::InitialOrientation, Movement::Spline< length_type >::initLengths(), TransportTemplate::keyFrames, Movement::Spline< length_type >::length(), TaxiPathNodeEntry::mapid, TransportTemplate::mapsUsed, Movement::SplineBase::ModeCatmullrom, GameObjectTemplate::moTransport, GameObjectTemplate::moveSpeed, KeyFrame::Node, Position::NormalizeOrientation(), TransportTemplate::pathTime, sMapStore, Movement::Spline< length_type >::Spline(), sTaxiPathNodesByPath, GameObjectTemplate::taxiPathId, TaxiPathNodeEntry::x, TaxiPathNodeEntry::y, and TaxiPathNodeEntry::z.

Referenced by LoadTransportTemplates().

◆ GetTransportAnimInfo()

TransportAnimation const * TransportMgr::GetTransportAnimInfo ( uint32  entry) const
inline
130 {
131 TransportAnimationContainer::const_iterator itr = _transportAnimations.find(entry);
132 if (itr != _transportAnimations.end())
133 return &itr->second;
134
135 return nullptr;
136 }

References _transportAnimations.

◆ GetTransportTemplate()

TransportTemplate const * TransportMgr::GetTransportTemplate ( uint32  entry) const
inline
122 {
123 TransportTemplates::const_iterator itr = _transportTemplates.find(entry);
124 if (itr != _transportTemplates.end())
125 return &itr->second;
126 return nullptr;
127 }
TransportTemplates _transportTemplates
Definition: TransportMgr.h:155

References _transportTemplates.

Referenced by CreateTransport(), and SpawnContinentTransports().

◆ instance()

TransportMgr * TransportMgr::instance ( )
static
40{
42 return &instance;
43}
Definition: TransportMgr.h:102

References instance().

Referenced by CreateTransport(), and instance().

◆ LoadTransportTemplates()

void TransportMgr::LoadTransportTemplates ( )
51{
52 uint32 oldMSTime = getMSTime();
53
54 QueryResult result = WorldDatabase.Query("SELECT entry FROM gameobject_template WHERE type = 15 ORDER BY entry ASC");
55
56 if (!result)
57 {
58 LOG_WARN("server.loading", ">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!");
59 return;
60 }
61
62 uint32 count = 0;
63
64 do
65 {
66 Field* fields = result->Fetch();
67 uint32 entry = fields[0].Get<uint32>();
68 GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry);
69 if (!goInfo)
70 {
71 LOG_ERROR("entities.transport", "Transport {} has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry);
72 continue;
73 }
74
75 if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size())
76 {
77 LOG_ERROR("entities.transport", "Transport {} (name: {}) has an invalid path specified in `gameobject_template`.`data0` ({}) field, skipped.", entry, goInfo->name, goInfo->moTransport.taxiPathId);
78 continue;
79 }
80
81 // paths are generated per template, saves us from generating it again in case of instanced transports
82 TransportTemplate& transport = _transportTemplates[entry];
83 transport.entry = entry;
84 GeneratePath(goInfo, &transport);
85
86 // transports in instance are only on one map
87 if (transport.inInstance)
88 _instanceTransports[*transport.mapsUsed.begin()].insert(entry);
89
90 ++count;
91 } while (result->NextRow());
92
93 LOG_INFO("server.loading", ">> Loaded {} Transport Templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
94 LOG_INFO("server.loading", " ");
95}
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:28
Class used to access individual fields of database query result.
Definition: Field.h:99
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113
Definition: GameObjectData.h:32
uint32 entry
Definition: TransportMgr.h:81
void GeneratePath(GameObjectTemplate const *goInfo, TransportTemplate *transport)
Definition: TransportMgr.cpp:114

References _instanceTransports, _transportTemplates, TransportTemplate::entry, GeneratePath(), Field::Get(), getMSTime(), GetMSTimeDiffToNow(), TransportTemplate::inInstance, LOG_ERROR, LOG_INFO, LOG_WARN, TransportTemplate::mapsUsed, sObjectMgr, sTaxiPathNodesByPath, and WorldDatabase.

◆ operator=()

TransportMgr & TransportMgr::operator= ( TransportMgr const &  )
private

◆ SpawnContinentTransports()

void TransportMgr::SpawnContinentTransports ( )
422{
423 if (_transportTemplates.empty())
424 return;
425
426 uint32 count = 0;
427 uint32 oldMSTime = getMSTime();
428 QueryResult result = WorldDatabase.Query("SELECT guid, entry FROM transports");
429
430 if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT))
431 {
432
433 if (result)
434 {
435 do
436 {
437 Field* fields = result->Fetch();
438 ObjectGuid::LowType guid = fields[0].Get<uint32>();
439 uint32 entry = fields[1].Get<uint32>();
440
441 if (TransportTemplate const* tInfo = GetTransportTemplate(entry))
442 if (!tInfo->inInstance)
443 if (CreateTransport(entry, guid))
444 ++count;
445
446 } while (result->NextRow());
447 }
448
449 LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
450 }
451
453 {
454 // pussywizard: preload grids for continent static transports
455 QueryResult result2 = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11");
456
457 if (result2)
458 {
459 do
460 {
461 Field* fields = result2->Fetch();
462 uint16 mapId = fields[0].Get<uint16>();
463 float x = fields[1].Get<float>();
464 float y = fields[2].Get<float>();
465
466 MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
467 if (mapEntry && !mapEntry->Instanceable())
468 if (Map* map = sMapMgr->CreateBaseMap(mapId))
469 {
470 map->LoadGrid(x, y);
471 ++count;
472 }
473 } while (result2->NextRow());
474 }
475
476 LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
477 }
478}
std::uint16_t uint16
Definition: Define.h:109
@ CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING
Definition: IWorld.h:154
@ CONFIG_ENABLE_CONTINENT_TRANSPORT
Definition: IWorld.h:153
#define sWorld
Definition: World.h:447
Definition: Map.h:313

References _transportTemplates, CONFIG_ENABLE_CONTINENT_TRANSPORT, CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING, CreateTransport(), Field::Get(), getMSTime(), GetMSTimeDiffToNow(), GetTransportTemplate(), LOG_INFO, sMapMgr, sMapStore, sWorld, and WorldDatabase.

◆ Unload()

void TransportMgr::Unload ( )
46{
47 _transportTemplates.clear();
48}

References _transportTemplates.

Friends And Related Function Documentation

◆ LoadDBCStores

void LoadDBCStores ( std::string const &  )
friend
261{
262 uint32 oldMSTime = getMSTime();
263
264 std::string dbcPath = dataPath + "dbc/";
265
266 StoreProblemList bad_dbc_files;
267 uint32 availableDbcLocales = 0xFFFFFFFF;
268
269#define LOAD_DBC(store, file, dbtable) LoadDBC(availableDbcLocales, bad_dbc_files, store, dbcPath, file, dbtable)
270
271 LOAD_DBC(sAreaTableStore, "AreaTable.dbc", "areatable_dbc");
272 LOAD_DBC(sAchievementStore, "Achievement.dbc", "achievement_dbc");
273 LOAD_DBC(sAchievementCategoryStore, "Achievement_Category.dbc", "achievement_category_dbc");
274 LOAD_DBC(sAchievementCriteriaStore, "Achievement_Criteria.dbc", "achievement_criteria_dbc");
275 LOAD_DBC(sAreaGroupStore, "AreaGroup.dbc", "areagroup_dbc");
276 LOAD_DBC(sAreaPOIStore, "AreaPOI.dbc", "areapoi_dbc");
277 LOAD_DBC(sAuctionHouseStore, "AuctionHouse.dbc", "auctionhouse_dbc");
278 LOAD_DBC(sBankBagSlotPricesStore, "BankBagSlotPrices.dbc", "bankbagslotprices_dbc");
279 LOAD_DBC(sBattlemasterListStore, "BattlemasterList.dbc", "battlemasterlist_dbc");
280 LOAD_DBC(sBarberShopStyleStore, "BarberShopStyle.dbc", "barbershopstyle_dbc");
281 LOAD_DBC(sCharStartOutfitStore, "CharStartOutfit.dbc", "charstartoutfit_dbc");
282 LOAD_DBC(sCharTitlesStore, "CharTitles.dbc", "chartitles_dbc");
283 LOAD_DBC(sChatChannelsStore, "ChatChannels.dbc", "chatchannels_dbc");
284 LOAD_DBC(sChrClassesStore, "ChrClasses.dbc", "chrclasses_dbc");
285 LOAD_DBC(sChrRacesStore, "ChrRaces.dbc", "chrraces_dbc");
286 LOAD_DBC(sCinematicCameraStore, "CinematicCamera.dbc", "cinematiccamera_dbc");
287 LOAD_DBC(sCinematicSequencesStore, "CinematicSequences.dbc", "cinematicsequences_dbc");
288 LOAD_DBC(sCreatureDisplayInfoStore, "CreatureDisplayInfo.dbc", "creaturedisplayinfo_dbc");
289 LOAD_DBC(sCreatureDisplayInfoExtraStore, "CreatureDisplayInfoExtra.dbc", "creaturedisplayinfoextra_dbc");
290 LOAD_DBC(sCreatureFamilyStore, "CreatureFamily.dbc", "creaturefamily_dbc");
291 LOAD_DBC(sCreatureModelDataStore, "CreatureModelData.dbc", "creaturemodeldata_dbc");
292 LOAD_DBC(sCreatureSpellDataStore, "CreatureSpellData.dbc", "creaturespelldata_dbc");
293 LOAD_DBC(sCreatureTypeStore, "CreatureType.dbc", "creaturetype_dbc");
294 LOAD_DBC(sCurrencyTypesStore, "CurrencyTypes.dbc", "currencytypes_dbc");
295 LOAD_DBC(sDestructibleModelDataStore, "DestructibleModelData.dbc", "destructiblemodeldata_dbc");
296 LOAD_DBC(sDungeonEncounterStore, "DungeonEncounter.dbc", "dungeonencounter_dbc");
297 LOAD_DBC(sDurabilityCostsStore, "DurabilityCosts.dbc", "durabilitycosts_dbc");
298 LOAD_DBC(sDurabilityQualityStore, "DurabilityQuality.dbc", "durabilityquality_dbc");
299 LOAD_DBC(sEmotesStore, "Emotes.dbc", "emotes_dbc");
300 LOAD_DBC(sEmotesTextStore, "EmotesText.dbc", "emotestext_dbc");
301 LOAD_DBC(sFactionStore, "Faction.dbc", "faction_dbc");
302 LOAD_DBC(sFactionTemplateStore, "FactionTemplate.dbc", "factiontemplate_dbc");
303 LOAD_DBC(sGameObjectArtKitStore, "GameObjectArtKit.dbc", "gameobjectartkit_dbc");
304 LOAD_DBC(sGameObjectDisplayInfoStore, "GameObjectDisplayInfo.dbc", "gameobjectdisplayinfo_dbc");
305 LOAD_DBC(sGemPropertiesStore, "GemProperties.dbc", "gemproperties_dbc");
306 LOAD_DBC(sGlyphPropertiesStore, "GlyphProperties.dbc", "glyphproperties_dbc");
307 LOAD_DBC(sGlyphSlotStore, "GlyphSlot.dbc", "glyphslot_dbc");
308 LOAD_DBC(sGtBarberShopCostBaseStore, "gtBarberShopCostBase.dbc", "gtbarbershopcostbase_dbc");
309 LOAD_DBC(sGtCombatRatingsStore, "gtCombatRatings.dbc", "gtcombatratings_dbc");
310 LOAD_DBC(sGtChanceToMeleeCritBaseStore, "gtChanceToMeleeCritBase.dbc", "gtchancetomeleecritbase_dbc");
311 LOAD_DBC(sGtChanceToMeleeCritStore, "gtChanceToMeleeCrit.dbc", "gtchancetomeleecrit_dbc");
312 LOAD_DBC(sGtChanceToSpellCritBaseStore, "gtChanceToSpellCritBase.dbc", "gtchancetospellcritbase_dbc");
313 LOAD_DBC(sGtChanceToSpellCritStore, "gtChanceToSpellCrit.dbc", "gtchancetospellcrit_dbc");
314 LOAD_DBC(sGtNPCManaCostScalerStore, "gtNPCManaCostScaler.dbc", "gtnpcmanacostscaler_dbc");
315 LOAD_DBC(sGtOCTClassCombatRatingScalarStore, "gtOCTClassCombatRatingScalar.dbc", "gtoctclasscombatratingscalar_dbc");
316 LOAD_DBC(sGtOCTRegenHPStore, "gtOCTRegenHP.dbc", "gtoctregenhp_dbc");
317 //LOAD_DBC(sGtOCTRegenMPStore, "gtOCTRegenMP.dbc", "gtoctregenmp_dbc"); -- not used currently
318 LOAD_DBC(sGtRegenHPPerSptStore, "gtRegenHPPerSpt.dbc", "gtregenhpperspt_dbc");
319 LOAD_DBC(sGtRegenMPPerSptStore, "gtRegenMPPerSpt.dbc", "gtregenmpperspt_dbc");
320 LOAD_DBC(sHolidaysStore, "Holidays.dbc", "holidays_dbc");
321 LOAD_DBC(sItemStore, "Item.dbc", "item_dbc");
322 LOAD_DBC(sItemBagFamilyStore, "ItemBagFamily.dbc", "itembagfamily_dbc");
323 LOAD_DBC(sItemDisplayInfoStore, "ItemDisplayInfo.dbc", "itemdisplayinfo_dbc");
324 //LOAD_DBC(sItemCondExtCostsStore, "ItemCondExtCosts.dbc", "itemcondextcosts_dbc");
325 LOAD_DBC(sItemExtendedCostStore, "ItemExtendedCost.dbc", "itemextendedcost_dbc");
326 LOAD_DBC(sItemLimitCategoryStore, "ItemLimitCategory.dbc", "itemlimitcategory_dbc");
327 LOAD_DBC(sItemRandomPropertiesStore, "ItemRandomProperties.dbc", "itemrandomproperties_dbc");
328 LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc", "itemrandomsuffix_dbc");
329 LOAD_DBC(sItemSetStore, "ItemSet.dbc", "itemset_dbc");
330 LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc", "lfgdungeons_dbc");
331 LOAD_DBC(sLightStore, "Light.dbc", "light_dbc");
332 LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc", "liquidtype_dbc");
333 LOAD_DBC(sLockStore, "Lock.dbc", "lock_dbc");
334 LOAD_DBC(sMailTemplateStore, "MailTemplate.dbc", "mailtemplate_dbc");
335 LOAD_DBC(sMapStore, "Map.dbc", "map_dbc");
336 LOAD_DBC(sMapDifficultyStore, "MapDifficulty.dbc", "mapdifficulty_dbc");
337 LOAD_DBC(sMovieStore, "Movie.dbc", "movie_dbc");
338 LOAD_DBC(sNamesReservedStore, "NamesReserved.dbc", "namesreserved_dbc");
339 LOAD_DBC(sNamesProfanityStore, "NamesProfanity.dbc", "namesprofanity_dbc");
340 LOAD_DBC(sOverrideSpellDataStore, "OverrideSpellData.dbc", "overridespelldata_dbc");
341 LOAD_DBC(sPowerDisplayStore, "PowerDisplay.dbc", "powerdisplay_dbc");
342 LOAD_DBC(sPvPDifficultyStore, "PvpDifficulty.dbc", "pvpdifficulty_dbc");
343 LOAD_DBC(sQuestXPStore, "QuestXP.dbc", "questxp_dbc");
344 LOAD_DBC(sQuestFactionRewardStore, "QuestFactionReward.dbc", "questfactionreward_dbc");
345 LOAD_DBC(sQuestSortStore, "QuestSort.dbc", "questsort_dbc");
346 LOAD_DBC(sRandomPropertiesPointsStore, "RandPropPoints.dbc", "randproppoints_dbc");
347 LOAD_DBC(sScalingStatDistributionStore, "ScalingStatDistribution.dbc", "scalingstatdistribution_dbc");
348 LOAD_DBC(sScalingStatValuesStore, "ScalingStatValues.dbc", "scalingstatvalues_dbc");
349 LOAD_DBC(sSkillLineStore, "SkillLine.dbc", "skillline_dbc");
350 LOAD_DBC(sSkillLineAbilityStore, "SkillLineAbility.dbc", "skilllineability_dbc");
351 LOAD_DBC(sSkillRaceClassInfoStore, "SkillRaceClassInfo.dbc", "skillraceclassinfo_dbc");
352 LOAD_DBC(sSkillTiersStore, "SkillTiers.dbc", "skilltiers_dbc");
353 LOAD_DBC(sSoundEntriesStore, "SoundEntries.dbc", "soundentries_dbc");
354 LOAD_DBC(sSpellStore, "Spell.dbc", "spell_dbc");
355 LOAD_DBC(sSpellCastTimesStore, "SpellCastTimes.dbc", "spellcasttimes_dbc");
356 LOAD_DBC(sSpellCategoryStore, "SpellCategory.dbc", "spellcategory_dbc");
357 LOAD_DBC(sSpellDifficultyStore, "SpellDifficulty.dbc", "spelldifficulty_dbc");
358 LOAD_DBC(sSpellDurationStore, "SpellDuration.dbc", "spellduration_dbc");
359 LOAD_DBC(sSpellFocusObjectStore, "SpellFocusObject.dbc", "spellfocusobject_dbc");
360 LOAD_DBC(sSpellItemEnchantmentStore, "SpellItemEnchantment.dbc", "spellitemenchantment_dbc");
361 LOAD_DBC(sSpellItemEnchantmentConditionStore, "SpellItemEnchantmentCondition.dbc", "spellitemenchantmentcondition_dbc");
362 LOAD_DBC(sSpellRadiusStore, "SpellRadius.dbc", "spellradius_dbc");
363 LOAD_DBC(sSpellRangeStore, "SpellRange.dbc", "spellrange_dbc");
364 LOAD_DBC(sSpellRuneCostStore, "SpellRuneCost.dbc", "spellrunecost_dbc");
365 LOAD_DBC(sSpellShapeshiftStore, "SpellShapeshiftForm.dbc", "spellshapeshiftform_dbc");
366 LOAD_DBC(sSpellVisualStore, "SpellVisual.dbc", "spellvisual_dbc");
367 LOAD_DBC(sStableSlotPricesStore, "StableSlotPrices.dbc", "stableslotprices_dbc");
368 LOAD_DBC(sSummonPropertiesStore, "SummonProperties.dbc", "summonproperties_dbc");
369 LOAD_DBC(sTalentStore, "Talent.dbc", "talent_dbc");
370 LOAD_DBC(sTalentTabStore, "TalentTab.dbc", "talenttab_dbc");
371 LOAD_DBC(sTaxiNodesStore, "TaxiNodes.dbc", "taxinodes_dbc");
372 LOAD_DBC(sTaxiPathStore, "TaxiPath.dbc", "taxipath_dbc");
373 LOAD_DBC(sTaxiPathNodeStore, "TaxiPathNode.dbc", "taxipathnode_dbc");
374 LOAD_DBC(sTeamContributionPointsStore, "TeamContributionPoints.dbc", "teamcontributionpoints_dbc");
375 LOAD_DBC(sTotemCategoryStore, "TotemCategory.dbc", "totemcategory_dbc");
376 LOAD_DBC(sTransportAnimationStore, "TransportAnimation.dbc", "transportanimation_dbc");
377 LOAD_DBC(sTransportRotationStore, "TransportRotation.dbc", "transportrotation_dbc");
378 LOAD_DBC(sVehicleStore, "Vehicle.dbc", "vehicle_dbc");
379 LOAD_DBC(sVehicleSeatStore, "VehicleSeat.dbc", "vehicleseat_dbc");
380 LOAD_DBC(sWMOAreaTableStore, "WMOAreaTable.dbc", "wmoareatable_dbc");
381 LOAD_DBC(sWorldMapAreaStore, "WorldMapArea.dbc", "worldmaparea_dbc");
382 LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
383
384#undef LOAD_DBC
385
386 for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
387 sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
388
389 for (FactionEntry const* faction : sFactionStore)
390 {
391 if (faction->team)
392 {
393 SimpleFactionsList& flist = sFactionTeamMap[faction->team];
394 flist.push_back(faction->ID);
395 }
396 }
397
399 {
400 if (info->maxX < info->minX)
401 std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
402
403 if (info->maxY < info->minY)
404 std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
405
406 if (info->maxZ < info->minZ)
407 std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
408 }
409
410 // fill data
411 for (MapDifficultyEntry const* entry : sMapDifficultyStore)
412 sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
413
414 for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
415 if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
416 ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
417
418 for (auto i : sSpellStore)
419 if (i->Category)
420 sSpellsByCategoryStore[i->Category].emplace(false, i->Id);
421
423 {
424 if (sSkillLineStore.LookupEntry(entry->SkillID))
425 {
426 SkillRaceClassInfoBySkill.emplace(entry->SkillID, entry);
427 }
428 }
429
430 for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
431 {
432 SpellEntry const* spellEntry = sSpellStore.LookupEntry(skillLine->Spell);
433 if (spellEntry && spellEntry->Attributes & SPELL_ATTR0_PASSIVE)
434 {
435 for (CreatureFamilyEntry const* cFamily : sCreatureFamilyStore)
436 {
437 if (skillLine->SkillLine != cFamily->skillLine[0] && skillLine->SkillLine != cFamily->skillLine[1])
438 {
439 continue;
440 }
441
442 if (spellEntry->SpellLevel)
443 {
444 continue;
445 }
446
447 if (skillLine->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN)
448 {
449 continue;
450 }
451
452 sPetFamilySpellsStore[cFamily->ID].insert(spellEntry->Id);
453 }
454 }
455 }
456
457 // Create Spelldifficulty searcher
458 for (SpellDifficultyEntry const* spellDiff : sSpellDifficultyStore)
459 {
460 SpellDifficultyEntry newEntry;
461
462 memset(newEntry.SpellID, 0, 4 * sizeof(uint32));
463
464 for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
465 {
466 if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
467 {
468 if (spellDiff->SpellID[x] > 0) //don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
469 LOG_ERROR("sql.sql", "spelldifficulty_dbc: spell {} at field id: {} at spellid {} does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
470
471 newEntry.SpellID[x] = 0; // spell was <= 0 or invalid, set to 0
472 }
473 else
474 newEntry.SpellID[x] = spellDiff->SpellID[x];
475 }
476
477 if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0) // id0-1 must be always set!
478 continue;
479
480 for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
481 if (newEntry.SpellID[x])
482 sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
483 }
484
485 // create talent spells set
486 for (TalentEntry const* talentInfo : sTalentStore)
487 {
488 TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
489
490 for (uint8 j = 0; j < MAX_TALENT_RANK; ++j)
491 {
492 if (talentInfo->RankID[j])
493 {
494 sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j);
495
496 if (talentTab && talentTab->petTalentMask)
497 {
498 sPetTalentSpells.insert(talentInfo->RankID[j]);
499 }
500 }
501 }
502 }
503
504 // prepare fast data access to bit pos of talent ranks for use at inspecting
505 {
506 // now have all max ranks (and then bit amount used for store talent ranks in inspect)
507 for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
508 {
509 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
510 if (!talentTabInfo)
511 continue;
512
513 // prevent memory corruption; otherwise cls will become 12 below
514 if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
515 continue;
516
517 // store class talent tab pages
518 for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
519 if (talentTabInfo->ClassMask & (1 << (cls - 1)))
520 sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
521 }
522 }
523
524 for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
525 if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
526 sTaxiPathSetBySource[entry->from][entry->to] = entry;
527
528 // Calculate path nodes count
529 uint32 pathCount = sTaxiPathStore.GetNumRows();
530 std::vector<uint32> pathLength;
531 pathLength.resize(pathCount); // 0 and some other indexes not used
532
533 for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
534 if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
535 if (pathLength[entry->path] < entry->index + 1)
536 pathLength[entry->path] = entry->index + 1;
537
538 // Set path length
539 sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
540 for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
541 sTaxiPathNodesByPath[i].resize(pathLength[i]);
542
543 // fill data
544 for (TaxiPathNodeEntry const* entry : sTaxiPathNodeStore)
545 sTaxiPathNodesByPath[entry->path][entry->index] = entry;
546
547 // Initialize global taxinodes mask
548 // include existed nodes that have at least single not spell base (scripted) path
549 {
550 std::set<uint32> spellPaths;
551 for (SpellEntry const* sInfo : sSpellStore)
552 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
553 if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
554 spellPaths.insert(sInfo->EffectMiscValue[j]);
555
556 sTaxiNodesMask.fill(0);
558 sHordeTaxiNodesMask.fill(0);
561
562 for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
563 {
564 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
565 if (!node)
566 continue;
567
568 TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
569 if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty())
570 {
571 bool ok = false;
572 for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
573 {
574 // not spell path
575 if (dest_i->second->price || spellPaths.find(dest_i->second->ID) == spellPaths.end())
576 {
577 ok = true;
578 break;
579 }
580 }
581
582 if (!ok)
583 continue;
584 }
585
586 // valid taxi network node
587 uint8 field = (uint8)((i - 1) / 32);
588 uint32 submask = 1 << ((i - 1) % 32);
589 sTaxiNodesMask[field] |= submask;
590
591 if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
592 sHordeTaxiNodesMask[field] |= submask;
593
594 if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
595 sAllianceTaxiNodesMask[field] |= submask;
596
597 if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
598 sDeathKnightTaxiNodesMask[field] |= submask;
599
600 // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)
601 if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)
602 sOldContinentsNodesMask[field] |= submask;
603
604 // fix DK node at Ebon Hold and Shadow Vault flight master
605 if (i == 315 || i == 333)
606 ((TaxiNodesEntry*)node)->MountCreatureID[1] = 32981;
607 }
608 }
609
611 sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
612
614 sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);
615
616 for (WMOAreaTableEntry const* entry : sWMOAreaTableStore)
617 sWMOAreaInfoByTripple[WMOAreaTableKey(entry->rootId, entry->adtId, entry->groupId)] = entry;
618
619 // error checks
620 if (bad_dbc_files.size() >= DBCFileCount)
621 {
622 LOG_ERROR("dbc", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files ({}) not found by path: {}dbc", DBCFileCount, dataPath);
623 exit(1);
624 }
625 else if (!bad_dbc_files.empty())
626 {
627 std::string str;
628 for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
629 str += *i + "\n";
630
631 LOG_ERROR("dbc", "Some required *.dbc files ({} from {}) not found or not compatible:\n{}", (uint32)bad_dbc_files.size(), DBCFileCount, str);
632 exit(1);
633 }
634
635 // Check loaded DBC files proper version
636 if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a
637 !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
638 !sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
639 !sItemStore.LookupEntry(56806) || // last client known item added in 3.3.5a
640 !sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
641 !sMapStore.LookupEntry(724) || // last map added in 3.3.5a
642 !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
643 {
644 LOG_ERROR("dbc", "You have _outdated_ DBC data. Please extract correct versions from current using client.");
645 exit(1);
646 }
647
648 LOG_INFO("server.loading", ">> Initialized {} Data Stores in {} ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
649 LOG_INFO("server.loading", " ");
650}
std::uint8_t uint8
Definition: Define.h:110
DBCStorage< DurabilityQualityEntry > sDurabilityQualityStore(DurabilityQualityfmt)
DBCStorage< AchievementCriteriaEntry > sAchievementCriteriaStore(AchievementCriteriafmt)
DBCStorage< MovieEntry > sMovieStore(MovieEntryfmt)
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
DBCStorage< RandomPropertiesPointsEntry > sRandomPropertiesPointsStore(RandomPropertiesPointsfmt)
DBCStorage< CharTitlesEntry > sCharTitlesStore(CharTitlesEntryfmt)
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
DBCStorage< VehicleSeatEntry > sVehicleSeatStore(VehicleSeatEntryfmt)
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
DBCStorage< TalentTabEntry > sTalentTabStore(TalentTabEntryfmt)
DBCStorage< ScalingStatDistributionEntry > sScalingStatDistributionStore(ScalingStatDistributionfmt)
#define LOAD_DBC(store, file, dbtable)
TaxiMask sAllianceTaxiNodesMask
Definition: DBCStores.cpp:178
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
DBCStorage< DestructibleModelDataEntry > sDestructibleModelDataStore(DestructibleModelDatafmt)
DBCStorage< GlyphSlotEntry > sGlyphSlotStore(GlyphSlotfmt)
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DBCStores.cpp:182
DBCStorage< LFGDungeonEntry > sLFGDungeonStore(LFGDungeonEntryfmt)
DBCStorage< MailTemplateEntry > sMailTemplateStore(MailTemplateEntryfmt)
DBCStorage< GtChanceToSpellCritBaseEntry > sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt)
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
DBCStorage< ItemLimitCategoryEntry > sItemLimitCategoryStore(ItemLimitCategoryEntryfmt)
DBCStorage< SpellRadiusEntry > sSpellRadiusStore(SpellRadiusfmt)
DBCStorage< SummonPropertiesEntry > sSummonPropertiesStore(SummonPropertiesfmt)
SpellCategoryStore sSpellsByCategoryStore
Definition: DBCStores.cpp:151
TaxiMask sTaxiNodesMask
Definition: DBCStores.cpp:175
std::tuple< int16, int8, int32 > WMOAreaTableKey
Definition: DBCStores.cpp:34
std::map< uint32, CharStartOutfitEntry const * > sCharStartOutfitMap
Definition: DBCStores.cpp:51
DBCStorage< ScalingStatValuesEntry > sScalingStatValuesStore(ScalingStatValuesfmt)
DBCStorage< CharStartOutfitEntry > sCharStartOutfitStore(CharStartOutfitEntryfmt)
DBCStorage< QuestFactionRewEntry > sQuestFactionRewardStore(QuestFactionRewardfmt)
DBCStorage< GtCombatRatingsEntry > sGtCombatRatingsStore(GtCombatRatingsfmt)
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
DBCStorage< SkillTiersEntry > sSkillTiersStore(SkillTiersfmt)
DBCStorage< AchievementCategoryEntry > sAchievementCategoryStore(AchievementCategoryfmt)
DBCStorage< SpellCategoryEntry > sSpellCategoryStore(SpellCategoryfmt)
DBCStorage< ItemEntry > sItemStore(Itemfmt)
DBCStorage< ChatChannelsEntry > sChatChannelsStore(ChatChannelsEntryfmt)
DBCStorage< PowerDisplayEntry > sPowerDisplayStore(PowerDisplayfmt)
DBCStorage< BankBagSlotPricesEntry > sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt)
DBCStorage< BattlemasterListEntry > sBattlemasterListStore(BattlemasterListEntryfmt)
static DBCStorage< TaxiPathNodeEntry > sTaxiPathNodeStore(TaxiPathNodeEntryfmt)
DBCStorage< CreatureSpellDataEntry > sCreatureSpellDataStore(CreatureSpellDatafmt)
MapDifficultyMap sMapDifficultyMap
Definition: DBCStores.cpp:121
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< SpellItemEnchantmentConditionEntry > sSpellItemEnchantmentConditionStore(SpellItemEnchantmentConditionfmt)
DBCStorage< SpellCastTimesEntry > sSpellCastTimesStore(SpellCastTimefmt)
DBCStorage< SpellRangeEntry > sSpellRangeStore(SpellRangefmt)
DBCStorage< MapDifficultyEntry > sMapDifficultyStore(MapDifficultyEntryfmt)
DBCStorage< ItemBagFamilyEntry > sItemBagFamilyStore(ItemBagFamilyfmt)
DBCStorage< BarberShopStyleEntry > sBarberShopStyleStore(BarberShopStyleEntryfmt)
SkillRaceClassInfoMap SkillRaceClassInfoBySkill
Definition: DBCStores.cpp:143
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
DBCStorage< SpellRuneCostEntry > sSpellRuneCostStore(SpellRuneCostfmt)
DBCStorage< GtChanceToSpellCritEntry > sGtChanceToSpellCritStore(GtChanceToSpellCritfmt)
DBCStorage< SpellDifficultyEntry > sSpellDifficultyStore(SpellDifficultyfmt)
TaxiMask sOldContinentsNodesMask
Definition: DBCStores.cpp:176
DBCStorage< SpellVisualEntry > sSpellVisualStore(SpellVisualfmt)
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
std::unordered_set< uint32 > sPetTalentSpells
Definition: DBCStores.cpp:168
TaxiMask sDeathKnightTaxiNodesMask
Definition: DBCStores.cpp:179
DBCStorage< HolidaysEntry > sHolidaysStore(Holidaysfmt)
DBCStorage< NamesReservedEntry > sNamesReservedStore(NamesReservedfmt)
DBCStorage< GtOCTClassCombatRatingScalarEntry > sGtOCTClassCombatRatingScalarStore(GtOCTClassCombatRatingScalarfmt)
DBCStorage< WorldMapAreaEntry > sWorldMapAreaStore(WorldMapAreaEntryfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< SoundEntriesEntry > sSoundEntriesStore(SoundEntriesfmt)
DBCStorage< EmotesTextEntry > sEmotesTextStore(EmotesTextEntryfmt)
DBCStorage< AchievementEntry > sAchievementStore(Achievementfmt)
DBCStorage< TotemCategoryEntry > sTotemCategoryStore(TotemCategoryEntryfmt)
DBCStorage< TransportRotationEntry > sTransportRotationStore(TransportRotationfmt)
DBCStorage< QuestSortEntry > sQuestSortStore(QuestSortEntryfmt)
DBCStorage< LightEntry > sLightStore(LightEntryfmt)
DBCStorage< GtRegenMPPerSptEntry > sGtRegenMPPerSptStore(GtRegenMPPerSptfmt)
DBCStorage< GameObjectArtKitEntry > sGameObjectArtKitStore(GameObjectArtKitfmt)
DBCStorage< DurabilityCostsEntry > sDurabilityCostsStore(DurabilityCostsfmt)
DBCStorage< WorldMapOverlayEntry > sWorldMapOverlayStore(WorldMapOverlayEntryfmt)
DBCStorage< GtChanceToMeleeCritBaseEntry > sGtChanceToMeleeCritBaseStore(GtChanceToMeleeCritBasefmt)
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
DBCStorage< GtRegenHPPerSptEntry > sGtRegenHPPerSptStore(GtRegenHPPerSptfmt)
DBCStorage< SkillRaceClassInfoEntry > sSkillRaceClassInfoStore(SkillRaceClassInfofmt)
static FactionTeamMap sFactionTeamMap
Definition: DBCStores.cpp:75
DBCStorage< GemPropertiesEntry > sGemPropertiesStore(GemPropertiesEntryfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
uint32 DBCFileCount
Definition: DBCStores.cpp:201
DBCStorage< DungeonEncounterEntry > sDungeonEncounterStore(DungeonEncounterfmt)
DBCStorage< GtNPCManaCostScalerEntry > sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt)
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
DBCStorage< AreaGroupEntry > sAreaGroupStore(AreaGroupEntryfmt)
DBCStorage< QuestXPEntry > sQuestXPStore(QuestXPfmt)
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
DBCStorage< CreatureFamilyEntry > sCreatureFamilyStore(CreatureFamilyfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
DBCStorage< GtOCTRegenHPEntry > sGtOCTRegenHPStore(GtOCTRegenHPfmt)
DBCStorage< TaxiPathEntry > sTaxiPathStore(TaxiPathEntryfmt)
DBCStorage< WMOAreaTableEntry > sWMOAreaTableStore(WMOAreaTableEntryfmt)
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
DBCStorage< NamesProfanityEntry > sNamesProfanityStore(NamesProfanityfmt)
DBCStorage< TaxiNodesEntry > sTaxiNodesStore(TaxiNodesEntryfmt)
DBCStorage< TeamContributionPointsEntry > sTeamContributionPointsStore(TeamContributionPointsfmt)
DBCStorage< SpellDurationEntry > sSpellDurationStore(SpellDurationfmt)
DBCStorage< SpellFocusObjectEntry > sSpellFocusObjectStore(SpellFocusObjectfmt)
DBCStorage< AuctionHouseEntry > sAuctionHouseStore(AuctionHouseEntryfmt)
DBCStorage< TransportAnimationEntry > sTransportAnimationStore(TransportAnimationfmt)
DBCStorage< AreaPOIEntry > sAreaPOIStore(AreaPOIEntryfmt)
TalentSpellPosMap sTalentSpellPosMap
Definition: DBCStores.cpp:167
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
static uint32 sTalentTabPages[MAX_CLASSES][3]
Definition: DBCStores.cpp:172
DBCStorage< CreatureTypeEntry > sCreatureTypeStore(CreatureTypefmt)
std::list< std::string > StoreProblemList
Definition: DBCStores.cpp:199
PetFamilySpellsStore sPetFamilySpellsStore
Definition: DBCStores.cpp:152
DBCStorage< CinematicSequencesEntry > sCinematicSequencesStore(CinematicSequencesEntryfmt)
DBCStorage< GtBarberShopCostBaseEntry > sGtBarberShopCostBaseStore(GtBarberShopCostBasefmt)
DBCStorage< CinematicCameraEntry > sCinematicCameraStore(CinematicCameraEntryfmt)
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
DBCStorage< ItemDisplayInfoEntry > sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesEntryfmt)
DBCStorage< CurrencyTypesEntry > sCurrencyTypesStore(CurrencyTypesfmt)
DBCStorage< EmotesEntry > sEmotesStore(EmotesEntryfmt)
DBCStorage< GtChanceToMeleeCritEntry > sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt)
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
DBCStorage< PvPDifficultyEntry > sPvPDifficultyStore(PvPDifficultyfmt)
TaxiMask sHordeTaxiNodesMask
Definition: DBCStores.cpp:177
DBCStorage< StableSlotPricesEntry > sStableSlotPricesStore(StableSlotPricesfmt)
static WMOAreaInfoByTripple sWMOAreaInfoByTripple
Definition: DBCStores.cpp:41
std::list< uint32 > SimpleFactionsList
Definition: DBCStores.h:28
uint32 MAKE_PAIR32(uint16 l, uint16 h)
Definition: ObjectDefines.h:87
#define sTransportMgr
Definition: TransportMgr.h:163
#define sSpellMgr
Definition: SpellMgr.h:825
#define MAX_DIFFICULTY
Definition: DBCEnums.h:291
#define MAX_BATTLEGROUND_BRACKETS
Definition: DBCEnums.h:60
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN
Definition: DBCEnums.h:369
#define MAX_TALENT_RANK
Definition: DBCStructure.h:1919
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1635
@ SPELL_EFFECT_SEND_TAXI
Definition: SharedDefines.h:901
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:388
#define MAX_CLASSES
Definition: SharedDefines.h:155
#define CLASSMASK_ALL_PLAYABLE
Definition: SharedDefines.h:157
Definition: DBCStructure.h:620
Definition: DBCStructure.h:754
Definition: DBCStructure.h:898
Definition: DBCStructure.h:991
Definition: DBCStructure.h:1377
Definition: DBCStructure.h:1429
Definition: DBCStructure.h:1567
Definition: DBCStructure.h:1596
Definition: DBCStructure.h:1640
uint32 Id
Definition: DBCStructure.h:1641
uint32 Attributes
Definition: DBCStructure.h:1645
uint32 SpellLevel
Definition: DBCStructure.h:1680
Definition: DBCStructure.h:1772
int32 SpellID[MAX_DIFFICULTY]
Definition: DBCStructure.h:1774
Definition: DBCStructure.h:1924
Definition: DBCStructure.h:1941
uint32 petTalentMask
Definition: DBCStructure.h:1948
uint32 tabpage
Definition: DBCStructure.h:1949
uint32 ClassMask
Definition: DBCStructure.h:1947
Definition: DBCStructure.h:1954
uint32 map_id
Definition: DBCStructure.h:1956
uint32 MountCreatureID[2]
Definition: DBCStructure.h:1962
Definition: DBCStructure.h:1966
Definition: DBCStructure.h:2004
Definition: DBCStructure.h:2015
Definition: DBCStructure.h:2132
Definition: DBCStructure.h:2220
Definition: DBCStructure.h:2230

Member Data Documentation

◆ _instanceTransports

TransportInstanceMap TransportMgr::_instanceTransports
private

◆ _transportAnimations

TransportAnimationContainer TransportMgr::_transportAnimations
private

◆ _transportTemplates

TransportTemplates TransportMgr::_transportTemplates
private