Fixes hotfix loading.

This commit is contained in:
hondacrx
2023-02-04 18:50:13 -05:00
parent 1ebd81dcd7
commit e0e20b6b1c
3 changed files with 228 additions and 214 deletions
+9 -3
View File
@@ -17,7 +17,7 @@ namespace Game.DataStorage
{
uint oldMSTime = Time.GetMSTime();
string db2Path = dataPath + "/dbc";
string db2Path = $"{dataPath}/dbc";
BitSet availableDb2Locales = new((int)Locale.Total);
foreach (var dir in Directory.GetDirectories(db2Path))
@@ -33,7 +33,13 @@ namespace Game.DataStorage
uint loadedFileCount = 0;
DB6Storage<T> ReadDB2<T>(string fileName, HotfixStatements preparedStatement, HotfixStatements preparedStatementLocale = 0) where T : new()
{
return DBReader.Read<T>(availableDb2Locales, $"{db2Path}/{defaultLocale}/", fileName, preparedStatement, preparedStatementLocale, ref loadedFileCount);
DB6Storage<T> storage = new();
storage.LoadData($"{db2Path}/{defaultLocale}/{fileName}");
storage.LoadHotfixData(availableDb2Locales, preparedStatement, preparedStatementLocale);
Global.DB2Mgr.AddDB2(storage.GetTableHash(), storage);
loadedFileCount++;
return storage;
}
AchievementStorage = ReadDB2<AchievementRecord>("Achievement.db2", HotfixStatements.SEL_ACHIEVEMENT, HotfixStatements.SEL_ACHIEVEMENT_LOCALE);
@@ -420,7 +426,7 @@ namespace Game.DataStorage
!MapStorage.ContainsKey(2582) || // last map added in 10.0.5 (47660)
!SpellNameStorage.ContainsKey(401848)) // last spell added in 10.0.5 (47660)
{
Log.outError(LogFilter.Misc, "You have _outdated_ DB2 files. Please extract correct versions from current using client.");
Log.outFatal(LogFilter.ServerLoading, "You have _outdated_ DB2 files. Please extract correct versions from current using client.");
Environment.Exit(1);
}