From 906ec095b9be12c669614979fd9d52f218b890d0 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:25:21 -0700 Subject: [PATCH] fix: Use the latest number for the next serial after world load. (#1171) --- Projects/Server/World/World.cs | 15 +++++++++++++++ Projects/UOContent/Accounting/Accounts.cs | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/Projects/Server/World/World.cs b/Projects/Server/World/World.cs index 0567b67e8..84d6cd2af 100644 --- a/Projects/Server/World/World.cs +++ b/Projects/Server/World/World.cs @@ -242,6 +242,21 @@ namespace Server Items = EntityPersistence.LoadIndex(basePath, itemIndexInfo, out List> items); Guilds = EntityPersistence.LoadIndex(basePath, guildIndexInfo, out List> 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); diff --git a/Projects/UOContent/Accounting/Accounts.cs b/Projects/UOContent/Accounting/Accounts.cs index 555d5cb91..d3464b796 100644 --- a/Projects/UOContent/Accounting/Accounts.cs +++ b/Projects/UOContent/Accounting/Accounts.cs @@ -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 indexInfo = new EntityTypeIndex("Accounts"); _accountsById = EntityPersistence.LoadIndex(path, indexInfo, out List> accounts); + + if (_accountsById.Count > 0) + { + _lastAccount = _accountsById.Keys.Max(); + } + EntityPersistence.LoadData(path, indexInfo, accounts); foreach (var a in _accountsById.Values)