diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index ab693e0143b..0a60ee9719e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7480,6 +7480,33 @@ void ObjectMgr::LoadGameObjectLocales() TC_LOG_INFO("server.loading", ">> Loaded {} gameobject_template_locale strings in {} ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } +void ObjectMgr::LoadDestructibleHitpoints() +{ + uint32 oldMSTime = getMSTime(); + + _destructibleHitpointStore.clear(); // need for reload case + + // 0 1 2 + QueryResult result = WorldDatabase.Query("SELECT Id, IntactNumHits, DamagedNumHits FROM destructible_hitpoint"); + if (!result) + return; + + do + { + Field* fields = result->Fetch(); + + uint32 id = fields[0].GetUInt32(); + + DestructibleHitpoint& data = _destructibleHitpointStore[id]; + data.Id = id; + data.IntactNumHits = fields[1].GetUInt32(); + data.DamagedNumHits = fields[2].GetUInt32(); + + } while (result->NextRow()); + + TC_LOG_INFO("server.loading", ">> Loaded {} destructible_hitpoint records in {} ms", _destructibleHitpointStore.size(), GetMSTimeDiffToNow(oldMSTime)); +} + inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) { if (sLockStore.LookupEntry(dataN)) @@ -7741,6 +7768,10 @@ void ObjectMgr::LoadGameObjectTemplate() got.barberChair.SitAnimKit = 0; } break; + case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING: + if (got.destructibleBuilding.HealthRec && !GetDestructibleHitpoint(got.destructibleBuilding.HealthRec)) + TC_LOG_ERROR("sql.sql", "GameObject (Entry: {}) Has non existing Destructible Hitpoint Record {}.", entry, got.destructibleBuilding.HealthRec); + break; case GAMEOBJECT_TYPE_GARRISON_BUILDING: if (uint32 transportMap = got.garrisonBuilding.SpawnMap) _transportMaps.insert(transportMap); @@ -10452,6 +10483,11 @@ TerrainSwapInfo const* ObjectMgr::GetTerrainSwapInfo(uint32 terrainSwapId) const return Trinity::Containers::MapGetValuePtr(_terrainSwapInfoById, terrainSwapId); } +DestructibleHitpoint const* ObjectMgr::GetDestructibleHitpoint(uint32 entry) const +{ + return Trinity::Containers::MapGetValuePtr(_destructibleHitpointStore, entry); +} + GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) const { return Trinity::Containers::MapGetValuePtr(_gameObjectTemplateStore, entry); |