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

@ -203,12 +203,8 @@ namespace Server.Items
public static BaseInstrument GetInstrument(Mobile from)
{
BaseInstrument item = m_Instruments[from];
if (item == null)
return null;
if (item.IsChildOf(from.Backpack))
return item;
if (m_Instruments.TryGetValue(from, out BaseInstrument instrument) && instrument.IsChildOf(from.Backpack))
return instrument;
m_Instruments.Remove(from);
return null;
@ -222,7 +218,6 @@ namespace Server.Items
public static void PickInstrument(Mobile from, InstrumentPickedCallback callback)
{
BaseInstrument instrument = GetInstrument(from);
if (instrument != null)
{
callback?.Invoke(from, instrument);
@ -531,7 +526,7 @@ namespace Server.Items
{
SetInstrument(from, this);
// Delay of 7 second before beign able to play another instrument again
// Delay of 7 second before being able to play another instrument again
new InternalTimer(from).Start();
if (CheckMusicianship(from))