Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-10-21 11:43:19 +08:00
92 changed files with 7381 additions and 667 deletions
+56
View File
@@ -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();
+12
View File
@@ -518,6 +518,7 @@ typedef std::map<std::pair<std::string, uint32>, ModuleString> ModuleStringConta
typedef std::unordered_map<int32, AcoreString> AcoreStringContainer;
typedef std::unordered_map<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
typedef std::unordered_map<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
typedef std::unordered_map<uint32, VehicleSeatAddon> VehicleSeatAddonContainer;
typedef std::multimap<uint32, uint32> QuestRelations;
typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator> QuestRelationBounds;
@@ -1053,6 +1054,7 @@ public:
void LoadMailServerTemplates();
void LoadVehicleTemplateAccessories();
void LoadVehicleAccessories();
void LoadVehicleSeatAddon();
void LoadGossipText();
@@ -1430,6 +1432,15 @@ public:
[[nodiscard]] bool IsTransportMap(uint32 mapId) const { return _transportMaps.count(mapId) != 0; }
VehicleSeatAddon const* GetVehicleSeatAddon(uint32 seatId) const
{
VehicleSeatAddonContainer::const_iterator itr = _vehicleSeatAddonStore.find(seatId);
if (itr == _vehicleSeatAddonStore.end())
return nullptr;
return &itr->second;
}
[[nodiscard]] uint32 GetQuestMoneyReward(uint8 level, uint32 questMoneyDifficulty) const;
void SendServerMail(Player* player, uint32 id, uint32 reqLevel, uint32 reqPlayTime, uint32 rewardMoneyA, uint32 rewardMoneyH, uint32 rewardItemA, uint32 rewardItemCountA, uint32 rewardItemH, uint32 rewardItemCountH, std::string subject, std::string body, uint8 active) const;
private:
@@ -1507,6 +1518,7 @@ private:
VehicleAccessoryContainer _vehicleTemplateAccessoryStore;
VehicleAccessoryContainer _vehicleAccessoryStore;
VehicleSeatAddonContainer _vehicleSeatAddonStore;
LocaleConstant DBCLocaleIndex;