aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorMeji <alvaro.megias@outlook.com>2025-05-11 22:00:41 +0200
committerGitHub <noreply@github.com>2025-05-11 22:00:41 +0200
commit47440e9dd2f5cad5d274e61a1ce8e559b80d0496 (patch)
treeed2ebf43c2345b0e971c885845adb5faecd590dd /src/server/game/Globals/ObjectMgr.cpp
parent260fab23786917619ad3453677ed7d983a431cc4 (diff)
Core/Vehicles: Added field to set a default pitch (#30878)
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index e3aca85d208..2ce15f2d166 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3528,8 +3528,8 @@ void ObjectMgr::LoadVehicleTemplate()
_vehicleTemplateStore.clear();
- // 0 1
- QueryResult result = WorldDatabase.Query("SELECT creatureId, despawnDelayMs FROM vehicle_template");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT creatureId, despawnDelayMs, Pitch FROM vehicle_template");
if (!result)
{
@@ -3543,15 +3543,38 @@ void ObjectMgr::LoadVehicleTemplate()
uint32 creatureId = fields[0].GetUInt32();
- if (!GetCreatureTemplate(creatureId))
+ CreatureTemplate const* creatureInfo = GetCreatureTemplate(creatureId);
+ if (!creatureInfo)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template`: Creature (Entry: {}) does not exist.", creatureId);
+ continue;
+ }
+
+ if (!creatureInfo->VehicleId)
{
- TC_LOG_ERROR("sql.sql", "Table `vehicle_template`: Vehicle {} does not exist.", creatureId);
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template`: Creature (Entry: {}) is not a vehicle.", creatureId);
continue;
}
VehicleTemplate& vehicleTemplate = _vehicleTemplateStore[creatureId];
vehicleTemplate.DespawnDelay = Milliseconds(fields[1].GetInt32());
+ if (!fields[2].IsNull())
+ {
+ VehicleEntry const* vehicle = sVehicleStore.LookupEntry(creatureInfo->VehicleId);
+ if (!vehicle)
+ continue;
+
+ float pitch = fields[2].GetFloat();
+ if (pitch < vehicle->PitchMin || pitch > vehicle->PitchMax)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_template`: Creature (Entry: {}) has invalid Pitch ({}).`. Ignoring",
+ creatureId, pitch);
+ continue;
+ }
+
+ vehicleTemplate.Pitch = pitch;
+ }
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded {} Vehicle Template entries in {} ms", _vehicleTemplateStore.size(), GetMSTimeDiffToNow(oldMSTime));