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}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
std::uint32_t uint32
Definition: Define.h:107
#define sMapMgr
Definition: MapMgr.h:221
#define sObjectMgr
Definition: ObjectMgr.h:1623
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
Map * GetMap() const
Definition: Object.h:531
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
ZoneScript * m_zoneScript
Definition: Object.h:643
std::string const & GetName() const
Definition: Object.h:458
virtual void SetMap(Map *map)
Definition: Object.cpp:2105
uint32 LowType
Definition: ObjectGuid.h:122
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:47
static void Insert(T *o)
Definition: ObjectAccessor.cpp:36
Definition: InstanceScript.h:142
bool IsDungeon() const
Definition: Map.h:448
InstanceMap * ToInstanceMap()
Definition: Map.h:546
bool AddToMap(T *, bool checkTransport=false)
Definition: Map.cpp:555
Definition: Map.h:819
InstanceScript * GetInstanceScript()
Definition: Map.h:831
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:1325
Definition: DBCStructure.h:1973
float y
Definition: DBCStructure.h:1979
float x
Definition: DBCStructure.h:1978
uint32 mapid
Definition: DBCStructure.h:1977
float z
Definition: DBCStructure.h:1980

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 (std::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 (std::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 std::size_t start = 0;
212 for (std::size_t i = 1; i < keyFrames.size(); ++i)
213 {
214 if (keyFrames[i - 1].Teleport || i + 1 == keyFrames.size())
215 {
216 std::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 (std::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 (std::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 (std::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 (std::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 (std::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:53
std::int32_t int32
Definition: Define.h:103
#define ASSERT
Definition: Errors.h:68
Movement::Spline< double > TransportSpline
Definition: TransportMgr.h:34
TaxiPathNodesByPath sTaxiPathNodesByPath
Definition: DBCStores.cpp:187
std::vector< TaxiPathNodeEntry const * > TaxiPathNodeList
Definition: DBCStructure.h:2245
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:1981

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

Member Data Documentation

◆ _instanceTransports

TransportInstanceMap TransportMgr::_instanceTransports
private

◆ _transportAnimations

TransportAnimationContainer TransportMgr::_transportAnimations
private

◆ _transportTemplates

TransportTemplates TransportMgr::_transportTemplates
private