Fixed db2 loading, and world login.

This commit is contained in:
hondacrx
2023-01-11 16:38:29 -05:00
parent dd8d17a4da
commit 3dad3747ce
8 changed files with 34 additions and 65 deletions
+8 -8
View File
@@ -426,16 +426,16 @@ namespace Game.DataStorage
}
// Check loaded DB2 files proper version
if (!CliDB.AreaTableStorage.ContainsKey(14618) || // last area added in 10.0.2 (46741)
!CliDB.CharTitlesStorage.ContainsKey(749) || // last char title added in 10.0.2 (46741)
!CliDB.GemPropertiesStorage.ContainsKey(4028) || // last gem property added in 10.0.2 (46741)
!CliDB.ItemStorage.ContainsKey(202712) || // last item added in 10.0.2 (46741)
!CliDB.ItemExtendedCostStorage.ContainsKey(7862) || // last item extended cost added in 10.0.2 (46741)
!CliDB.MapStorage.ContainsKey(2582) || // last map added in 10.0.2 (46741)
!CliDB.SpellNameStorage.ContainsKey(399311)) // last spell added in 10.0.2 (46741)
if (!AreaTableStorage.ContainsKey(14618) || // last area added in 10.0.2 (46741)
!CharTitlesStorage.ContainsKey(749) || // last char title added in 10.0.2 (46741)
!GemPropertiesStorage.ContainsKey(4028) || // last gem property added in 10.0.2 (46741)
!ItemStorage.ContainsKey(202712) || // last item added in 10.0.2 (46741)
!ItemExtendedCostStorage.ContainsKey(7862) || // last item extended cost added in 10.0.2 (46741)
!MapStorage.ContainsKey(2582) || // last map added in 10.0.2 (46741)
!SpellNameStorage.ContainsKey(399311)) // last spell added in 10.0.2 (46741)
{
Log.outError(LogFilter.Misc, "You have _outdated_ DB2 files. Please extract correct versions from current using client.");
Global.WorldMgr.ShutdownServ(10, ShutdownMask.Force, ShutdownExitCode.Error);
Environment.Exit(1);
}
Log.outInfo(LogFilter.ServerLoading, "Initialized {0} DB2 data storages in {1} ms", loadedFileCount, Time.GetMSTimeDiffToNow(oldMSTime));
@@ -152,11 +152,17 @@ namespace Game.DataStorage
// string data
stringsTable = new Dictionary<long, string>();
long stringDataOffset = 0;
if (sectionIndex == 0)
stringDataOffset = (Header.RecordCount - sections[sectionIndex].NumRecords) * Header.RecordSize;
else
stringDataOffset = previousStringTableSize;
for (int i = 0; i < sections[sectionIndex].StringTableSize;)
{
long oldPos = reader.BaseStream.Position;
stringsTable[i + previousStringTableSize] = reader.ReadCString();
stringsTable[i + stringDataOffset] = reader.ReadCString();
i += (int)(reader.BaseStream.Position - oldPos);
}
@@ -200,8 +206,7 @@ namespace Game.DataStorage
refData.Entries = new Dictionary<int, int>();
ReferenceEntry[] entries = reader.ReadArray<ReferenceEntry>((uint)refData.NumRecords);
foreach (var entry in entries)
if (!refData.Entries.ContainsKey(entry.Index))
refData.Entries[entry.Index] = entry.Id;
refData.Entries[entry.Index] = entry.Id;
}
else
{
@@ -243,9 +248,12 @@ namespace Game.DataStorage
foreach (var copyRow in copyData)
{
var rec = _records[copyRow.Value].Clone();
rec.Id = copyRow.Key;
_records.Add(copyRow.Key, rec);
if (copyRow.Key != 0)
{
var rec = _records[copyRow.Value].Clone();
rec.Id = copyRow.Key;
_records.Add(copyRow.Key, rec);
}
}
previousStringTableSize += sections[sectionIndex].StringTableSize;