diff options
author | Jelle Meeus <sogladev@gmail.com> | 2024-10-11 07:08:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-11 07:08:14 +0200 |
commit | 859a42a41e3ad65a9ec685d0d06f206c1a52524c (patch) | |
tree | 98907afa3475e936164f6d88201ad3d6d8ca0f44 /src/server/game/Globals/ObjectMgr.cpp | |
parent | e43b760c089e99226f9a88fc005cfcb14752361c (diff) |
fix(Core/Vehicles): feat vehicle seat addon, vehicle enter/exit positions (#20082)
* implement initial vehicle_seat_addon
Co-authored-by: Ovah <dreadkiller@gmx.de>
* add more vehicle_seat_addon data
* make exiting passenger visible
fixes "immediate despawn" of travelers mammoth
* style, update comments
* remove hacked pos relocate
* remove sending MSG_MOVE_ROOT/UNROOT on Ack
* set and unset UNIT_NPC_FLAG_PLAYER_VEHICLE on init/entry
* ulduar demolisher: remove flag correction and no longer needed usableseat
* fixup! implement initial vehicle_seat_addon
* fixup! fixup! implement initial vehicle_seat_addon
* re-add AddPassenger Flame Leviathan hack
was commented by mistake
* Update rev_1725993194571320983.sql
add missing ticks
---------
Co-authored-by: Ovah <dreadkiller@gmx.de>
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e19e6098d8..6799ce7808 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3483,6 +3483,62 @@ void ObjectMgr::LoadVehicleAccessories() LOG_INFO("server.loading", " "); } +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) + { + 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].Get<uint32>(); + float orientation = fields[1].Get<float>(); + float exitX = fields[2].Get<float>(); + float exitY = fields[3].Get<float>(); + float exitZ = fields[4].Get<float>(); + float exitO = fields[5].Get<float>(); + uint8 exitParam = fields[6].Get<uint8>(); + + if (!sVehicleSeatStore.LookupEntry(seatID)) + { + 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)) + { + 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)) + { + 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()); + + LOG_INFO("server.loading", ">> Loaded %u Vehicle Seat Addon entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); +} + void ObjectMgr::LoadPetLevelInfo() { uint32 oldMSTime = getMSTime(); |