fix: Use the latest number for the next serial after world load. (#1171)

This commit is contained in:
Kamron Batman 2022-09-13 21:25:21 -07:00 committed by GitHub
parent fe94aa050a
commit 906ec095b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -242,6 +242,21 @@ namespace Server
Items = EntityPersistence.LoadIndex(basePath, itemIndexInfo, out List<EntityIndex<Item>> items);
Guilds = EntityPersistence.LoadIndex(basePath, guildIndexInfo, out List<EntityIndex<BaseGuild>> guilds);
if (Mobiles.Count > 0)
{
_lastMobile = Mobiles.Keys.Max();
}
if (Items.Count > 0)
{
_lastItem = Items.Keys.Max();
}
if (Guilds.Count > 0)
{
_lastGuild = Guilds.Keys.Max();
}
EntityPersistence.LoadData(basePath, mobileIndexInfo, mobiles);
EntityPersistence.LoadData(basePath, itemIndexInfo, items);
EntityPersistence.LoadData(basePath, guildIndexInfo, guilds);

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using Server.Logging;
@ -86,6 +87,12 @@ namespace Server.Accounting
IIndexInfo<Serial> indexInfo = new EntityTypeIndex("Accounts");
_accountsById = EntityPersistence.LoadIndex(path, indexInfo, out List<EntityIndex<Account>> accounts);
if (_accountsById.Count > 0)
{
_lastAccount = _accountsById.Keys.Max();
}
EntityPersistence.LoadData(path, indexInfo, accounts);
foreach (var a in _accountsById.Values)