AzeorthCore 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:378
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:159
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1606
#define sMapMgr
Definition: MapMgr.h:212
Map * GetMap() const
Definition: Object.h:517
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
ZoneScript * m_zoneScript
Definition: Object.h:628
std::string const & GetName() const
Definition: Object.h:446
virtual void SetMap(Map *map)
Definition: Object.cpp:2060
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:46
static void Insert(T *o)
Definition: ObjectAccessor.cpp:38
Definition: InstanceScript.h:140
bool IsDungeon() const
Definition: Map.h:447
InstanceMap * ToInstanceMap()
Definition: Map.h:544
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:557
Definition: Map.h:813
InstanceScript * GetInstanceScript()
Definition: Map.h:825
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:1308
Definition: DBCStructure.h:1935
float y
Definition: DBCStructure.h:1941
float x
Definition: DBCStructure.h:1940
uint32 mapid
Definition: DBCStructure.h:1939
float z
Definition: DBCStructure.h:1942

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:62
#define ASSERT
Definition: Errors.h:68
std::int32_t int32
Definition: Define.h:104
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DBCStores.cpp:182
Movement::Spline< double > TransportSpline
Definition: TransportMgr.h:34
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition: DBCStructure.h:2204
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:1943

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:167
#define LOG_WARN(filterType__,...)
Definition: Log.h:163
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: GameObject.h:41
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:152
@ CONFIG_ENABLE_CONTINENT_TRANSPORT
Definition: IWorld.h:151
#define sWorld
Definition: World.h:458
Definition: Map.h:312

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
257{
258 uint32 oldMSTime = getMSTime();
259
260 std::string dbcPath = dataPath + "dbc/";
261
262 StoreProblemList bad_dbc_files;
263 uint32 availableDbcLocales = 0xFFFFFFFF;
264
265#define LOAD_DBC(store, file, dbtable) LoadDBC(availableDbcLocales, bad_dbc_files, store, dbcPath, file, dbtable)
266
267 LOAD_DBC(sAreaTableStore, "AreaTable.dbc", "areatable_dbc");
268 LOAD_DBC(sAchievementStore, "Achievement.dbc", "achievement_dbc");
269 LOAD_DBC(sAchievementCategoryStore, "Achievement_Category.dbc", "achievement_category_dbc");
270 LOAD_DBC(sAchievementCriteriaStore, "Achievement_Criteria.dbc", "achievement_criteria_dbc");
271 LOAD_DBC(sAreaGroupStore, "AreaGroup.dbc", "areagroup_dbc");
272 LOAD_DBC(sAreaPOIStore, "AreaPOI.dbc", "areapoi_dbc");
273 LOAD_DBC(sAuctionHouseStore, "AuctionHouse.dbc", "auctionhouse_dbc");
274 LOAD_DBC(sBankBagSlotPricesStore, "BankBagSlotPrices.dbc", "bankbagslotprices_dbc");
275 LOAD_DBC(sBattlemasterListStore, "BattlemasterList.dbc", "battlemasterlist_dbc");
276 LOAD_DBC(sBarberShopStyleStore, "BarberShopStyle.dbc", "barbershopstyle_dbc");
277 LOAD_DBC(sCharStartOutfitStore, "CharStartOutfit.dbc", "charstartoutfit_dbc");
278 LOAD_DBC(sCharTitlesStore, "CharTitles.dbc", "chartitles_dbc");
279 LOAD_DBC(sChatChannelsStore, "ChatChannels.dbc", "chatchannels_dbc");
280 LOAD_DBC(sChrClassesStore, "ChrClasses.dbc", "chrclasses_dbc");
281 LOAD_DBC(sChrRacesStore, "ChrRaces.dbc", "chrraces_dbc");
282 LOAD_DBC(sCinematicCameraStore, "CinematicCamera.dbc", "cinematiccamera_dbc");
283 LOAD_DBC(sCinematicSequencesStore, "CinematicSequences.dbc", "cinematicsequences_dbc");
284 LOAD_DBC(sCreatureDisplayInfoStore, "CreatureDisplayInfo.dbc", "creaturedisplayinfo_dbc");
285 LOAD_DBC(sCreatureDisplayInfoExtraStore, "CreatureDisplayInfoExtra.dbc", "creaturedisplayinfoextra_dbc");
286 LOAD_DBC(sCreatureFamilyStore, "CreatureFamily.dbc", "creaturefamily_dbc");
287 LOAD_DBC(sCreatureModelDataStore, "CreatureModelData.dbc", "creaturemodeldata_dbc");
288 LOAD_DBC(sCreatureSpellDataStore, "CreatureSpellData.dbc", "creaturespelldata_dbc");
289 LOAD_DBC(sCreatureTypeStore, "CreatureType.dbc", "creaturetype_dbc");
290 LOAD_DBC(sCurrencyTypesStore, "CurrencyTypes.dbc", "currencytypes_dbc");
291 LOAD_DBC(sDestructibleModelDataStore, "DestructibleModelData.dbc", "destructiblemodeldata_dbc");
292 LOAD_DBC(sDungeonEncounterStore, "DungeonEncounter.dbc", "dungeonencounter_dbc");
293 LOAD_DBC(sDurabilityCostsStore, "DurabilityCosts.dbc", "durabilitycosts_dbc");
294 LOAD_DBC(sDurabilityQualityStore, "DurabilityQuality.dbc", "durabilityquality_dbc");
295 LOAD_DBC(sEmotesStore, "Emotes.dbc", "emotes_dbc");
296 LOAD_DBC(sEmotesTextStore, "EmotesText.dbc", "emotestext_dbc");
297 LOAD_DBC(sFactionStore, "Faction.dbc", "faction_dbc");
298 LOAD_DBC(sFactionTemplateStore, "FactionTemplate.dbc", "factiontemplate_dbc");
299 LOAD_DBC(sGameObjectArtKitStore, "GameObjectArtKit.dbc", "gameobjectartkit_dbc");
300 LOAD_DBC(sGameObjectDisplayInfoStore, "GameObjectDisplayInfo.dbc", "gameobjectdisplayinfo_dbc");
301 LOAD_DBC(sGemPropertiesStore, "GemProperties.dbc", "gemproperties_dbc");
302 LOAD_DBC(sGlyphPropertiesStore, "GlyphProperties.dbc", "glyphproperties_dbc");
303 LOAD_DBC(sGlyphSlotStore, "GlyphSlot.dbc", "glyphslot_dbc");
304 LOAD_DBC(sGtBarberShopCostBaseStore, "gtBarberShopCostBase.dbc", "gtbarbershopcostbase_dbc");
305 LOAD_DBC(sGtCombatRatingsStore, "gtCombatRatings.dbc", "gtcombatratings_dbc");
306 LOAD_DBC(sGtChanceToMeleeCritBaseStore, "gtChanceToMeleeCritBase.dbc", "gtchancetomeleecritbase_dbc");
307 LOAD_DBC(sGtChanceToMeleeCritStore, "gtChanceToMeleeCrit.dbc", "gtchancetomeleecrit_dbc");
308 LOAD_DBC(sGtChanceToSpellCritBaseStore, "gtChanceToSpellCritBase.dbc", "gtchancetospellcritbase_dbc");
309 LOAD_DBC(sGtChanceToSpellCritStore, "gtChanceToSpellCrit.dbc", "gtchancetospellcrit_dbc");
310 LOAD_DBC(sGtNPCManaCostScalerStore, "gtNPCManaCostScaler.dbc", "gtnpcmanacostscaler_dbc");
311 LOAD_DBC(sGtOCTClassCombatRatingScalarStore, "gtOCTClassCombatRatingScalar.dbc", "gtoctclasscombatratingscalar_dbc");
312 LOAD_DBC(sGtOCTRegenHPStore, "gtOCTRegenHP.dbc", "gtoctregenhp_dbc");
313 //LOAD_DBC(sGtOCTRegenMPStore, "gtOCTRegenMP.dbc", "gtoctregenmp_dbc"); -- not used currently
314 LOAD_DBC(sGtRegenHPPerSptStore, "gtRegenHPPerSpt.dbc", "gtregenhpperspt_dbc");
315 LOAD_DBC(sGtRegenMPPerSptStore, "gtRegenMPPerSpt.dbc", "gtregenmpperspt_dbc");
316 LOAD_DBC(sHolidaysStore, "Holidays.dbc", "holidays_dbc");
317 LOAD_DBC(sItemBagFamilyStore, "ItemBagFamily.dbc", "itembagfamily_dbc");
318 LOAD_DBC(sItemDisplayInfoStore, "ItemDisplayInfo.dbc", "itemdisplayinfo_dbc");
319 //LOAD_DBC(sItemCondExtCostsStore, "ItemCondExtCosts.dbc", "itemcondextcosts_dbc");
320 LOAD_DBC(sItemExtendedCostStore, "ItemExtendedCost.dbc", "itemextendedcost_dbc");
321 LOAD_DBC(sItemLimitCategoryStore, "ItemLimitCategory.dbc", "itemlimitcategory_dbc");
322 LOAD_DBC(sItemRandomPropertiesStore, "ItemRandomProperties.dbc", "itemrandomproperties_dbc");
323 LOAD_DBC(sItemRandomSuffixStore, "ItemRandomSuffix.dbc", "itemrandomsuffix_dbc");
324 LOAD_DBC(sItemSetStore, "ItemSet.dbc", "itemset_dbc");
325 LOAD_DBC(sLFGDungeonStore, "LFGDungeons.dbc", "lfgdungeons_dbc");
326 LOAD_DBC(sLightStore, "Light.dbc", "light_dbc");
327 LOAD_DBC(sLiquidTypeStore, "LiquidType.dbc", "liquidtype_dbc");
328 LOAD_DBC(sLockStore, "Lock.dbc", "lock_dbc");
329 LOAD_DBC(sMailTemplateStore, "MailTemplate.dbc", "mailtemplate_dbc");
330 LOAD_DBC(sMapStore, "Map.dbc", "map_dbc");
331 LOAD_DBC(sMapDifficultyStore, "MapDifficulty.dbc", "mapdifficulty_dbc");
332 LOAD_DBC(sMovieStore, "Movie.dbc", "movie_dbc");
333 LOAD_DBC(sOverrideSpellDataStore, "OverrideSpellData.dbc", "overridespelldata_dbc");
334 LOAD_DBC(sPowerDisplayStore, "PowerDisplay.dbc", "powerdisplay_dbc");
335 LOAD_DBC(sPvPDifficultyStore, "PvpDifficulty.dbc", "pvpdifficulty_dbc");
336 LOAD_DBC(sQuestXPStore, "QuestXP.dbc", "questxp_dbc");
337 LOAD_DBC(sQuestFactionRewardStore, "QuestFactionReward.dbc", "questfactionreward_dbc");
338 LOAD_DBC(sQuestSortStore, "QuestSort.dbc", "questsort_dbc");
339 LOAD_DBC(sRandomPropertiesPointsStore, "RandPropPoints.dbc", "randproppoints_dbc");
340 LOAD_DBC(sScalingStatDistributionStore, "ScalingStatDistribution.dbc", "scalingstatdistribution_dbc");
341 LOAD_DBC(sScalingStatValuesStore, "ScalingStatValues.dbc", "scalingstatvalues_dbc");
342 LOAD_DBC(sSkillLineStore, "SkillLine.dbc", "skillline_dbc");
343 LOAD_DBC(sSkillLineAbilityStore, "SkillLineAbility.dbc", "skilllineability_dbc");
344 LOAD_DBC(sSkillRaceClassInfoStore, "SkillRaceClassInfo.dbc", "skillraceclassinfo_dbc");
345 LOAD_DBC(sSkillTiersStore, "SkillTiers.dbc", "skilltiers_dbc");
346 LOAD_DBC(sSoundEntriesStore, "SoundEntries.dbc", "soundentries_dbc");
347 LOAD_DBC(sSpellStore, "Spell.dbc", "spell_dbc");
348 LOAD_DBC(sSpellCastTimesStore, "SpellCastTimes.dbc", "spellcasttimes_dbc");
349 LOAD_DBC(sSpellCategoryStore, "SpellCategory.dbc", "spellcategory_dbc");
350 LOAD_DBC(sSpellDifficultyStore, "SpellDifficulty.dbc", "spelldifficulty_dbc");
351 LOAD_DBC(sSpellDurationStore, "SpellDuration.dbc", "spellduration_dbc");
352 LOAD_DBC(sSpellFocusObjectStore, "SpellFocusObject.dbc", "spellfocusobject_dbc");
353 LOAD_DBC(sSpellItemEnchantmentStore, "SpellItemEnchantment.dbc", "spellitemenchantment_dbc");
354 LOAD_DBC(sSpellItemEnchantmentConditionStore, "SpellItemEnchantmentCondition.dbc", "spellitemenchantmentcondition_dbc");
355 LOAD_DBC(sSpellRadiusStore, "SpellRadius.dbc", "spellradius_dbc");
356 LOAD_DBC(sSpellRangeStore, "SpellRange.dbc", "spellrange_dbc");
357 LOAD_DBC(sSpellRuneCostStore, "SpellRuneCost.dbc", "spellrunecost_dbc");
358 LOAD_DBC(sSpellShapeshiftStore, "SpellShapeshiftForm.dbc", "spellshapeshiftform_dbc");
359 LOAD_DBC(sSpellVisualStore, "SpellVisual.dbc", "spellvisual_dbc");
360 LOAD_DBC(sStableSlotPricesStore, "StableSlotPrices.dbc", "stableslotprices_dbc");
361 LOAD_DBC(sSummonPropertiesStore, "SummonProperties.dbc", "summonproperties_dbc");
362 LOAD_DBC(sTalentStore, "Talent.dbc", "talent_dbc");
363 LOAD_DBC(sTalentTabStore, "TalentTab.dbc", "talenttab_dbc");
364 LOAD_DBC(sTaxiNodesStore, "TaxiNodes.dbc", "taxinodes_dbc");
365 LOAD_DBC(sTaxiPathStore, "TaxiPath.dbc", "taxipath_dbc");
366 LOAD_DBC(sTaxiPathNodeStore, "TaxiPathNode.dbc", "taxipathnode_dbc");
367 LOAD_DBC(sTeamContributionPointsStore, "TeamContributionPoints.dbc", "teamcontributionpoints_dbc");
368 LOAD_DBC(sTotemCategoryStore, "TotemCategory.dbc", "totemcategory_dbc");
369 LOAD_DBC(sTransportAnimationStore, "TransportAnimation.dbc", "transportanimation_dbc");
370 LOAD_DBC(sTransportRotationStore, "TransportRotation.dbc", "transportrotation_dbc");
371 LOAD_DBC(sVehicleStore, "Vehicle.dbc", "vehicle_dbc");
372 LOAD_DBC(sVehicleSeatStore, "VehicleSeat.dbc", "vehicleseat_dbc");
373 LOAD_DBC(sWMOAreaTableStore, "WMOAreaTable.dbc", "wmoareatable_dbc");
374 LOAD_DBC(sWorldMapAreaStore, "WorldMapArea.dbc", "worldmaparea_dbc");
375 LOAD_DBC(sWorldMapOverlayStore, "WorldMapOverlay.dbc", "worldmapoverlay_dbc");
376
377#undef LOAD_DBC
378
379 for (CharStartOutfitEntry const* outfit : sCharStartOutfitStore)
380 sCharStartOutfitMap[outfit->Race | (outfit->Class << 8) | (outfit->Gender << 16)] = outfit;
381
382 for (FactionEntry const* faction : sFactionStore)
383 {
384 if (faction->team)
385 {
386 SimpleFactionsList& flist = sFactionTeamMap[faction->team];
387 flist.push_back(faction->ID);
388 }
389 }
390
392 {
393 if (info->maxX < info->minX)
394 std::swap(*(float*)(&info->maxX), *(float*)(&info->minX));
395
396 if (info->maxY < info->minY)
397 std::swap(*(float*)(&info->maxY), *(float*)(&info->minY));
398
399 if (info->maxZ < info->minZ)
400 std::swap(*(float*)(&info->maxZ), *(float*)(&info->minZ));
401 }
402
403 // fill data
404 for (MapDifficultyEntry const* entry : sMapDifficultyStore)
405 sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = MapDifficulty(entry->resetTime, entry->maxPlayers, entry->areaTriggerText[0] != '\0');
406
407 for (PvPDifficultyEntry const* entry : sPvPDifficultyStore)
408 if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)
409 ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");
410
411 for (auto i : sSpellStore)
412 if (i->Category)
413 sSpellsByCategoryStore[i->Category].emplace(false, i->Id);
414
416 {
417 if (sSkillLineStore.LookupEntry(entry->SkillID))
418 {
419 SkillRaceClassInfoBySkill.emplace(entry->SkillID, entry);
420 }
421 }
422
423 for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
424 {
425 SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->Spell);
426 if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
427 {
428 for (CreatureFamilyEntry const* cFamily : sCreatureFamilyStore)
429 {
430 if (skillLine->SkillLine != cFamily->skillLine[0] && skillLine->SkillLine != cFamily->skillLine[1])
431 {
432 continue;
433 }
434
435 if (spellInfo->SpellLevel)
436 {
437 continue;
438 }
439
440 if (skillLine->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN)
441 {
442 continue;
443 }
444
445 sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id);
446 }
447 }
448 }
449
450 // Create Spelldifficulty searcher
451 for (SpellDifficultyEntry const* spellDiff : sSpellDifficultyStore)
452 {
453 SpellDifficultyEntry newEntry;
454
455 memset(newEntry.SpellID, 0, 4 * sizeof(uint32));
456
457 for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
458 {
459 if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
460 {
461 if (spellDiff->SpellID[x] > 0) //don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
462 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);
463
464 newEntry.SpellID[x] = 0; // spell was <= 0 or invalid, set to 0
465 }
466 else
467 newEntry.SpellID[x] = spellDiff->SpellID[x];
468 }
469
470 if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0) // id0-1 must be always set!
471 continue;
472
473 for (uint8 x = 0; x < MAX_DIFFICULTY; ++x)
474 if (newEntry.SpellID[x])
475 sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID);
476 }
477
478 // create talent spells set
479 for (TalentEntry const* talentInfo : sTalentStore)
480 {
481 TalentTabEntry const* talentTab = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
482
483 for (uint8 j = 0; j < MAX_TALENT_RANK; ++j)
484 {
485 if (talentInfo->RankID[j])
486 {
487 sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(talentInfo->TalentID, j);
488
489 if (talentTab && talentTab->petTalentMask)
490 {
491 sPetTalentSpells.insert(talentInfo->RankID[j]);
492 }
493 }
494 }
495 }
496
497 // prepare fast data access to bit pos of talent ranks for use at inspecting
498 {
499 // now have all max ranks (and then bit amount used for store talent ranks in inspect)
500 for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId)
501 {
502 TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId);
503 if (!talentTabInfo)
504 continue;
505
506 // prevent memory corruption; otherwise cls will become 12 below
507 if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
508 continue;
509
510 // store class talent tab pages
511 for (uint32 cls = 1; cls < MAX_CLASSES; ++cls)
512 if (talentTabInfo->ClassMask & (1 << (cls - 1)))
513 sTalentTabPages[cls][talentTabInfo->tabpage] = talentTabId;
514 }
515 }
516
517 for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i)
518 if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i))
519 sTaxiPathSetBySource[entry->from][entry->to] = entry;
520
521 // Calculate path nodes count
522 uint32 pathCount = sTaxiPathStore.GetNumRows();
523 std::vector<uint32> pathLength;
524 pathLength.resize(pathCount); // 0 and some other indexes not used
525
526 for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
527 if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
528 if (pathLength[entry->path] < entry->index + 1)
529 pathLength[entry->path] = entry->index + 1;
530
531 // Set path length
532 sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
533 for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
534 sTaxiPathNodesByPath[i].resize(pathLength[i]);
535
536 // fill data
537 for (TaxiPathNodeEntry const* entry : sTaxiPathNodeStore)
538 sTaxiPathNodesByPath[entry->path][entry->index] = entry;
539
540 // Initialize global taxinodes mask
541 // include existed nodes that have at least single not spell base (scripted) path
542 {
543 std::set<uint32> spellPaths;
544 for (SpellEntry const* sInfo : sSpellStore)
545 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
546 if (sInfo->Effect[j] == SPELL_EFFECT_SEND_TAXI)
547 spellPaths.insert(sInfo->EffectMiscValue[j]);
548
549 sTaxiNodesMask.fill(0);
551 sHordeTaxiNodesMask.fill(0);
554
555 for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
556 {
557 TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(i);
558 if (!node)
559 continue;
560
561 TaxiPathSetBySource::const_iterator src_i = sTaxiPathSetBySource.find(i);
562 if (src_i != sTaxiPathSetBySource.end() && !src_i->second.empty())
563 {
564 bool ok = false;
565 for (TaxiPathSetForSource::const_iterator dest_i = src_i->second.begin(); dest_i != src_i->second.end(); ++dest_i)
566 {
567 // not spell path
568 if (dest_i->second->price || spellPaths.find(dest_i->second->ID) == spellPaths.end())
569 {
570 ok = true;
571 break;
572 }
573 }
574
575 if (!ok)
576 continue;
577 }
578
579 // valid taxi network node
580 uint8 field = (uint8)((i - 1) / 32);
581 uint32 submask = 1 << ((i - 1) % 32);
582 sTaxiNodesMask[field] |= submask;
583
584 if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
585 sHordeTaxiNodesMask[field] |= submask;
586
587 if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
588 sAllianceTaxiNodesMask[field] |= submask;
589
590 if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
591 sDeathKnightTaxiNodesMask[field] |= submask;
592
593 // old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)
594 if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)
595 sOldContinentsNodesMask[field] |= submask;
596
597 // fix DK node at Ebon Hold and Shadow Vault flight master
598 if (i == 315 || i == 333)
599 ((TaxiNodesEntry*)node)->MountCreatureID[1] = 32981;
600 }
601 }
602
604 sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
605
607 sTransportMgr->AddPathRotationToTransport(rot->TransportEntry, rot->TimeSeg, rot);
608
609 for (WMOAreaTableEntry const* entry : sWMOAreaTableStore)
610 sWMOAreaInfoByTripple[WMOAreaTableKey(entry->rootId, entry->adtId, entry->groupId)] = entry;
611
612 // error checks
613 if (bad_dbc_files.size() >= DBCFileCount)
614 {
615 LOG_ERROR("dbc", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files ({}) not found by path: {}dbc", DBCFileCount, dataPath);
616 exit(1);
617 }
618 else if (!bad_dbc_files.empty())
619 {
620 std::string str;
621 for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
622 str += *i + "\n";
623
624 LOG_ERROR("dbc", "Some required *.dbc files ({} from {}) not found or not compatible:\n{}", (uint32)bad_dbc_files.size(), DBCFileCount, str);
625 exit(1);
626 }
627
628 // Check loaded DBC files proper version
629 if (!sAreaTableStore.LookupEntry(4987) || // last area added in 3.3.5a
630 !sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
631 !sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
632 !sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
633 !sMapStore.LookupEntry(724) || // last map added in 3.3.5a
634 !sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
635 {
636 LOG_ERROR("dbc", "You have _outdated_ DBC data. Please extract correct versions from current using client.");
637 exit(1);
638 }
639
640 LOG_INFO("server.loading", ">> Initialized {} Data Stores in {} ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
641 LOG_INFO("server.loading", " ");
642}
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:174
DBCStorage< ItemSetEntry > sItemSetStore(ItemSetEntryfmt)
DBCStorage< DestructibleModelDataEntry > sDestructibleModelDataStore(DestructibleModelDatafmt)
DBCStorage< GlyphSlotEntry > sGlyphSlotStore(GlyphSlotfmt)
TaxiPathSetBySource sTaxiPathSetBySource
Definition: DBCStores.cpp:178
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:147
TaxiMask sTaxiNodesMask
Definition: DBCStores.cpp:171
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< 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:120
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:139
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
DBCStorage< SpellRuneCostEntry > sSpellRuneCostStore(SpellRuneCostfmt)
DBCStorage< GtChanceToSpellCritEntry > sGtChanceToSpellCritStore(GtChanceToSpellCritfmt)
DBCStorage< SpellDifficultyEntry > sSpellDifficultyStore(SpellDifficultyfmt)
TaxiMask sOldContinentsNodesMask
Definition: DBCStores.cpp:172
DBCStorage< SpellVisualEntry > sSpellVisualStore(SpellVisualfmt)
DBCStorage< OverrideSpellDataEntry > sOverrideSpellDataStore(OverrideSpellDatafmt)
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
std::unordered_set< uint32 > sPetTalentSpells
Definition: DBCStores.cpp:164
TaxiMask sDeathKnightTaxiNodesMask
Definition: DBCStores.cpp:175
DBCStorage< HolidaysEntry > sHolidaysStore(Holidaysfmt)
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:197
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< 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:163
DBCStorage< GlyphPropertiesEntry > sGlyphPropertiesStore(GlyphPropertiesfmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
static uint32 sTalentTabPages[MAX_CLASSES][3]
Definition: DBCStores.cpp:168
DBCStorage< CreatureTypeEntry > sCreatureTypeStore(CreatureTypefmt)
std::list< std::string > StoreProblemList
Definition: DBCStores.cpp:195
PetFamilySpellsStore sPetFamilySpellsStore
Definition: DBCStores.cpp:148
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:173
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:803
#define MAX_DIFFICULTY
Definition: DBCEnums.h:288
#define MAX_BATTLEGROUND_BRACKETS
Definition: DBCEnums.h:58
@ SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN
Definition: DBCEnums.h:366
#define MAX_TALENT_RANK
Definition: DBCStructure.h:1880
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1596
@ SPELL_EFFECT_SEND_TAXI
Definition: SharedDefines.h:873
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:360
#define MAX_CLASSES
Definition: SharedDefines.h:127
#define CLASSMASK_ALL_PLAYABLE
Definition: SharedDefines.h:129
Definition: DBCStructure.h:620
Definition: DBCStructure.h:754
Definition: DBCStructure.h:898
Definition: DBCStructure.h:991
Definition: DBCStructure.h:1362
Definition: DBCStructure.h:1400
Definition: DBCStructure.h:1528
Definition: DBCStructure.h:1557
Definition: DBCStructure.h:1601
uint32 Id
Definition: DBCStructure.h:1602
uint32 Attributes
Definition: DBCStructure.h:1606
uint32 SpellLevel
Definition: DBCStructure.h:1641
Definition: DBCStructure.h:1733
int32 SpellID[MAX_DIFFICULTY]
Definition: DBCStructure.h:1735
Definition: DBCStructure.h:1885
Definition: DBCStructure.h:1902
uint32 petTalentMask
Definition: DBCStructure.h:1909
uint32 tabpage
Definition: DBCStructure.h:1910
uint32 ClassMask
Definition: DBCStructure.h:1908
Definition: DBCStructure.h:1915
uint32 map_id
Definition: DBCStructure.h:1917
uint32 MountCreatureID[2]
Definition: DBCStructure.h:1923
Definition: DBCStructure.h:1927
Definition: DBCStructure.h:1965
Definition: DBCStructure.h:1976
Definition: DBCStructure.h:2093
Definition: DBCStructure.h:2181
Definition: DBCStructure.h:2191

Member Data Documentation

◆ _instanceTransports

TransportInstanceMap TransportMgr::_instanceTransports
private

◆ _transportAnimations

TransportAnimationContainer TransportMgr::_transportAnimations
private

◆ _transportTemplates

TransportTemplates TransportMgr::_transportTemplates
private