fix: Fixes issue with duping items and serialization, and sector lists. (#1662)
This commit is contained in:
parent
497ea87943
commit
3812a783ca
6 changed files with 32 additions and 53 deletions
|
|
@ -32,13 +32,9 @@ public abstract partial class BaseMulti : Item
|
|||
{
|
||||
if (base.ItemID != value)
|
||||
{
|
||||
var facet = Parent == null ? Map : null;
|
||||
|
||||
facet?.OnLeave(this);
|
||||
|
||||
Map?.OnLeave(this);
|
||||
base.ItemID = value;
|
||||
|
||||
facet?.OnEnter(this);
|
||||
Map?.OnEnter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -69,21 +65,6 @@ public abstract partial class BaseMulti : Item
|
|||
|
||||
public virtual MultiComponentList Components => MultiData.GetComponents(ItemID);
|
||||
|
||||
[Obsolete("Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true)]
|
||||
public virtual void RefreshComponents()
|
||||
{
|
||||
if (Parent == null)
|
||||
{
|
||||
var facet = Map;
|
||||
|
||||
if (facet != null)
|
||||
{
|
||||
facet.OnLeave(this);
|
||||
facet.OnEnter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetMaxUpdateRange() => 22;
|
||||
|
||||
public override int GetUpdateRange(Mobile m) => 22;
|
||||
|
|
|
|||
|
|
@ -599,18 +599,16 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
|
||||
var oldParent = m_Parent;
|
||||
|
||||
if (m_Map != null && oldParent == null && value != null)
|
||||
{
|
||||
m_Map.OnLeave(this);
|
||||
}
|
||||
|
||||
m_Parent = value;
|
||||
|
||||
if (m_Map != null)
|
||||
if (m_Map != null && oldParent != null && value == null)
|
||||
{
|
||||
if (oldParent != null && m_Parent == null)
|
||||
{
|
||||
m_Map.OnEnter(this);
|
||||
}
|
||||
else if (m_Parent != null)
|
||||
{
|
||||
m_Map.OnLeave(this);
|
||||
}
|
||||
m_Map.OnEnter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1207,9 +1205,13 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
{
|
||||
var old = m_Map;
|
||||
|
||||
if (m_Map != null && m_Parent == null)
|
||||
if (m_Map != null)
|
||||
{
|
||||
m_Map.OnLeave(this);
|
||||
if (m_Parent == null)
|
||||
{
|
||||
m_Map.OnLeave(this);
|
||||
}
|
||||
|
||||
SendRemovePacket();
|
||||
}
|
||||
|
||||
|
|
@ -3328,13 +3330,14 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly HashSet<string> _excludedProperties = new()
|
||||
{
|
||||
private static readonly HashSet<string> _excludedProperties =
|
||||
[
|
||||
"SaveBuffer",
|
||||
"Parent",
|
||||
"Next",
|
||||
"Previous",
|
||||
"OnLinkList"
|
||||
};
|
||||
];
|
||||
|
||||
public virtual bool DupeExcludedProperty(string propertyName) => _excludedProperties.Contains(propertyName);
|
||||
|
||||
|
|
|
|||
|
|
@ -568,12 +568,12 @@ public sealed partial class Map : IComparable<Map>, ISpanFormattable, ISpanParsa
|
|||
}
|
||||
}
|
||||
|
||||
public void OnEnter(Mobile m)
|
||||
internal void OnEnter(Mobile m)
|
||||
{
|
||||
OnEnter(m.Location, m);
|
||||
}
|
||||
|
||||
public void OnEnter(Point3D p, Mobile m)
|
||||
internal void OnEnter(Point3D p, Mobile m)
|
||||
{
|
||||
if (this != Internal)
|
||||
{
|
||||
|
|
@ -581,14 +581,14 @@ public sealed partial class Map : IComparable<Map>, ISpanFormattable, ISpanParsa
|
|||
}
|
||||
}
|
||||
|
||||
public void OnEnter(Item item)
|
||||
internal void OnEnter(Item item)
|
||||
{
|
||||
OnEnter(item.Location, item);
|
||||
}
|
||||
|
||||
public void OnEnter(Point3D p, Item item)
|
||||
internal void OnEnter(Point3D p, Item item)
|
||||
{
|
||||
if (this == Internal)
|
||||
if (this == Internal || item.Parent != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -606,12 +606,12 @@ public sealed partial class Map : IComparable<Map>, ISpanFormattable, ISpanParsa
|
|||
}
|
||||
}
|
||||
|
||||
public void OnLeave(Mobile m)
|
||||
internal void OnLeave(Mobile m)
|
||||
{
|
||||
OnLeave(m.Location, m);
|
||||
}
|
||||
|
||||
public void OnLeave(Point3D p, Mobile m)
|
||||
internal void OnLeave(Point3D p, Mobile m)
|
||||
{
|
||||
if (this != Internal)
|
||||
{
|
||||
|
|
@ -619,14 +619,14 @@ public sealed partial class Map : IComparable<Map>, ISpanFormattable, ISpanParsa
|
|||
}
|
||||
}
|
||||
|
||||
public void OnLeave(Item item)
|
||||
internal void OnLeave(Item item)
|
||||
{
|
||||
OnLeave(item.Location, item);
|
||||
}
|
||||
|
||||
public void OnLeave(Point3D p, Item item)
|
||||
internal void OnLeave(Point3D p, Item item)
|
||||
{
|
||||
if (this == Internal)
|
||||
if (this == Internal || item.Parent != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7272,6 +7272,7 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
}
|
||||
|
||||
m_Location = newLocation;
|
||||
m_Map?.OnMove(oldLocation, this);
|
||||
UpdateRegion();
|
||||
|
||||
var box = FindBankNoCreate();
|
||||
|
|
@ -7283,8 +7284,6 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
|
|||
|
||||
m_NetState?.ValidateAllTrades();
|
||||
|
||||
m_Map?.OnMove(oldLocation, this);
|
||||
|
||||
if (isTeleport && m_NetState != null && (!m_NetState.HighSeas || !NoMoveHS))
|
||||
{
|
||||
m_NetState.Sequence = 0;
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ public static class EntityPersistence
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"***** Bad deserialize of {t.GetType()} *****");
|
||||
Console.WriteLine($"***** Bad deserialize of {t.GetType()} ({t.Serial}) *****");
|
||||
Console.WriteLine(error);
|
||||
|
||||
ConsoleKey pressedKey;
|
||||
|
|
|
|||
|
|
@ -35,15 +35,11 @@ namespace Server.Saves
|
|||
|
||||
public static void Configure()
|
||||
{
|
||||
SavesEnabled = ServerConfiguration.GetOrUpdateSetting("autosave.enabled", true);
|
||||
Delay = ServerConfiguration.GetOrUpdateSetting("autosave.saveDelay", TimeSpan.FromMinutes(5.0));
|
||||
Warning = ServerConfiguration.GetOrUpdateSetting("autosave.warningDelay", TimeSpan.Zero);
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
SavesEnabled = true;
|
||||
}
|
||||
|
||||
public static void ResetAutoSave(TimeSpan saveDelay, TimeSpan warningDelay)
|
||||
{
|
||||
if (saveDelay != Delay || warningDelay != Warning)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue