Core/DataStores: Delay building all DB2Manager containers after loading hotfix data to ignore rows marked as deleted by hotfixes

Port From (https://github.com/TrinityCore/TrinityCore/commit/da1ac5aa73afdb7f2379b71761e2a6e855ce4e9a)
This commit is contained in:
Hondacrx
2025-06-02 16:02:07 -04:00
parent 7d4c54730c
commit bfbf96ac25
3 changed files with 17 additions and 12 deletions
+2 -4
View File
@@ -397,8 +397,6 @@ namespace Game.DataStorage
WorldMapOverlayStorage = ReadDB2<WorldMapOverlayRecord>("WorldMapOverlay.db2", HotfixStatements.SEL_WORLD_MAP_OVERLAY);
WorldStateExpressionStorage = ReadDB2<WorldStateExpressionRecord>("WorldStateExpression.db2", HotfixStatements.SEL_WORLD_STATE_EXPRESSION);
Global.DB2Mgr.LoadStores();
foreach (var entry in TaxiPathStorage.Values)
{
if (!TaxiPathSetBySource.ContainsKey(entry.FromTaxiNode))
@@ -412,7 +410,7 @@ namespace Game.DataStorage
uint[] pathLength = new uint[pathCount]; // 0 and some other indexes not used
foreach (TaxiPathNodeRecord entry in TaxiPathNodeStorage.Values)
if (pathLength[entry.PathID] < entry.NodeIndex + 1)
pathLength[entry.PathID] = (uint)entry.NodeIndex + 1u;
pathLength[entry.PathID] = (uint)Math.Max(pathLength[entry.PathID], entry.NodeIndex + 1u);
// Set path length
for (uint i = 0; i < pathCount; ++i)
@@ -465,7 +463,7 @@ namespace Game.DataStorage
Environment.Exit(1);
}
Log.outInfo(LogFilter.ServerLoading, "Initialized {0} DB2 data storages in {1} ms", loadedFileCount, Time.GetMSTimeDiffToNow(oldMSTime));
Log.outInfo(LogFilter.ServerLoading, $"Initialized {loadedFileCount} DB2 data storages in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
return availableDb2Locales;
}
+5 -1
View File
@@ -37,8 +37,10 @@ namespace Game.DataStorage
}
}
public void LoadStores()
public void IndexLoadedStores()
{
uint oldMSTime = Time.GetMSTime();
foreach (var areaGroupMember in AreaGroupMemberStorage.Values)
_areaGroupMembers.Add(areaGroupMember.AreaGroupID, areaGroupMember.AreaID);
@@ -688,6 +690,8 @@ namespace Game.DataStorage
foreach (PvpStatRecord pvpStat in PvpStatStorage.Values)
_pvpStatIdsByMap.Add(pvpStat.MapID, pvpStat.Id);
Log.outInfo(LogFilter.ServerLoading, $"Indexed DB2 data stores in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
}
public IDB2Storage GetStorage(uint type)
+10 -7
View File
@@ -415,6 +415,13 @@ namespace Game
DB.Login.Execute($"UPDATE realmlist SET icon = {(byte)server_type}, timezone = {realm_zone} WHERE id = '{Global.RealmMgr.GetCurrentRealmId().Index}'"); // One-time query
Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models...");
if (!GameObjectModel.LoadGameObjectModelList())
{
Log.outFatal(LogFilter.ServerLoading, "Unable to load gameobject models (part of vmaps), objects using WMO models will crash the client - server shutting down!");
return false;
}
Log.outInfo(LogFilter.ServerLoading, "Initialize DataStorage...");
// Load DB2s
m_availableDbcLocaleMask = CliDB.LoadStores(_dataPath, m_defaultDbcLocale);
@@ -424,13 +431,6 @@ namespace Game
return false;
}
Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models...");
if (!GameObjectModel.LoadGameObjectModelList())
{
Log.outFatal(LogFilter.ServerLoading, "Unable to load gameobject models (part of vmaps), objects using WMO models will crash the client - server shutting down!");
return false;
}
Log.outInfo(LogFilter.ServerLoading, "Loading hotfix blobs...");
Global.DB2Mgr.LoadHotfixBlob(m_availableDbcLocaleMask);
@@ -440,6 +440,9 @@ namespace Game
Log.outInfo(LogFilter.ServerLoading, "Loading hotfix optional data...");
Global.DB2Mgr.LoadHotfixOptionalData(m_availableDbcLocaleMask);
Log.outInfo(LogFilter.ServerLoading, "Indexing loaded data stores...");
Global.DB2Mgr.IndexLoadedStores();
//- Load M2 fly by cameras
M2Storage.LoadM2Cameras(_dataPath);