Some cleanup of contains keys and try get values (#246)

This commit is contained in:
Kamron Batman 2020-09-13 20:20:44 -07:00 • committed by GitHub
parent 9cbb0cfd23
commit a236617ad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 3508 additions and 350 deletions

View file

@ -197,7 +197,9 @@ namespace Server.Items
var version = reader.ReadInt();
if (version == 0 && Weight == 1.0)
{
Weight = -1;
}
}
}
@ -263,7 +265,9 @@ namespace Server.Items
public override void DisplayTo(Mobile m)
{
if (DynamicFurniture.Open(this, m))
{
base.DisplayTo(m);
}
}
public override void Serialize(IGenericWriter writer)
@ -295,7 +299,9 @@ namespace Server.Items
public override void DisplayTo(Mobile m)
{
if (DynamicFurniture.Open(this, m))
{
base.DisplayTo(m);
}
}
public override void Serialize(IGenericWriter writer)
@ -349,13 +355,13 @@ namespace Server.Items
public static void Close(Container c)
{
if (m_Table.TryGetValue(c, out var t))
if (m_Table.Remove(c, out var t))
{
t.Stop();
m_Table.Remove(c);
}
if (c is Armoire || c is FancyArmoire)
{
c.ItemID = c.ItemID switch
{
0xA4C => 0xA4D,
@ -364,6 +370,7 @@ namespace Server.Items
0xA52 => 0xA53,
_ => c.ItemID
};
}
}
}
@ -383,7 +390,9 @@ namespace Server.Items
protected override void OnTick()
{
if (m_Mobile.Map != m_Container.Map || !m_Mobile.InRange(m_Container.GetWorldLocation(), 3))
{
DynamicFurniture.Close(m_Container);
}
}
}
}