Fixes dictionary uses (#7)

This commit is contained in:
Kamron Batman 2018-11-02 08:16:42 -07:00 committed by GitHub
parent d4a52344f2
commit 916d404c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1211 additions and 1722 deletions

View file

@ -1106,30 +1106,23 @@ namespace Server.Items
{
if (from.BAC > 0 && from.Map != Map.Internal && !from.Deleted)
{
Timer t = m_Table[from];
if (m_Table.ContainsKey(from))
return;
if (t == null)
{
if (from.BAC > 60)
from.BAC = 60;
if (from.BAC > 60)
from.BAC = 60;
t = new HeaveTimer(from);
t.Start();
Timer t = new HeaveTimer(from);
t.Start();
m_Table[from] = t;
}
m_Table[from] = t;
}
else
else if (m_Table.TryGetValue(from, out Timer t))
{
Timer t = m_Table[from];
t.Stop();
m_Table.Remove(from);
if (t != null)
{
t.Stop();
m_Table.Remove(from);
from.SendLocalizedMessage(500850); // You feel sober.
}
from.SendLocalizedMessage(500850); // You feel sober.
}
}