aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index f9e20a9a420..289437620e1 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3495,6 +3495,62 @@ void ObjectMgr::LoadVehicleAccessories()
TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
+void ObjectMgr::LoadVehicleSeatAddon()
+{
+ uint32 oldMSTime = getMSTime();
+
+ _vehicleSeatAddonStore.clear(); // needed for reload case
+
+ uint32 count = 0;
+
+ // 0 1 2 3 4 5 6
+ QueryResult result = WorldDatabase.Query("SELECT `SeatEntry`, `SeatOrientation`, `ExitParamX`, `ExitParamY`, `ExitParamZ`, `ExitParamO`, `ExitParamValue` FROM `vehicle_seat_addon`");
+
+ if (!result)
+ {
+ TC_LOG_ERROR("server.loading", ">> Loaded 0 vehicle seat addons. DB table `vehicle_seat_addon` is empty.");
+ return;
+ }
+
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 seatID = fields[0].GetUInt32();
+ float orientation = fields[1].GetFloat();
+ float exitX = fields[2].GetFloat();
+ float exitY = fields[3].GetFloat();
+ float exitZ = fields[4].GetFloat();
+ float exitO = fields[5].GetFloat();
+ uint8 exitParam = fields[6].GetUInt8();
+
+ if (!sVehicleSeatStore.LookupEntry(seatID))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u does not exist in VehicleSeat.dbc. Skipping entry.", seatID);
+ continue;
+ }
+
+ // Sanitizing values
+ if (orientation > float(M_PI * 2))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u is using invalid angle offset value (%f). Set Value to 0.", seatID, orientation);
+ orientation = 0.0f;
+ }
+
+ if (exitParam >= AsUnderlyingType(VehicleExitParameters::VehicleExitParamMax))
+ {
+ TC_LOG_ERROR("sql.sql", "Table `vehicle_seat_addon`: SeatID: %u is using invalid exit parameter value (%u). Setting to 0 (none).", seatID, exitParam);
+ continue;
+ }
+
+ _vehicleSeatAddonStore[seatID] = VehicleSeatAddon(orientation, exitX, exitY, exitZ, exitO, exitParam);
+
+ ++count;
+ } while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u Vehicle Seat Addon entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
void ObjectMgr::LoadPetLevelInfo()
{
uint32 oldMSTime = getMSTime();