From af0ec21a076861edd537b1d5ae5c55981ffdfacb Mon Sep 17 00:00:00 2001 From: Mark Sturgill Date: Thu, 13 Feb 2014 23:12:23 -0700 Subject: [PATCH] disguisekit generics --- .../Items/Skill Items/Thief/DisguiseKit.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs index fc6effd56..c6e7fd7e9 100644 --- a/Scripts/Items/Skill Items/Thief/DisguiseKit.cs +++ b/Scripts/Items/Skill Items/Thief/DisguiseKit.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server; using Server.Gumps; using Server.Spells; @@ -307,13 +307,14 @@ namespace Server.Items public static void CreateTimer( Mobile m, TimeSpan delay ) { if ( m != null ) - if ( !m_Timers.Contains( m ) ) + if ( !m_Timers.ContainsKey( m ) ) m_Timers[m] = new InternalTimer( m, delay ); } public static void StartTimer( Mobile m ) { - Timer t = (Timer)m_Timers[m]; + Timer t = null; + m_Timers.TryGetValue(m, out t); if ( t != null ) t.Start(); @@ -321,12 +322,13 @@ namespace Server.Items public static bool IsDisguised( Mobile m ) { - return m_Timers.Contains( m ); + return m_Timers.ContainsKey( m ); } public static bool StopTimer( Mobile m ) { - Timer t = (Timer)m_Timers[m]; + Timer t = null; + m_Timers.TryGetValue(m, out t); if ( t != null ) { @@ -339,7 +341,8 @@ namespace Server.Items public static bool RemoveTimer( Mobile m ) { - Timer t = (Timer)m_Timers[m]; + Timer t = null; + m_Timers.TryGetValue(m, out t); if ( t != null ) { @@ -352,7 +355,8 @@ namespace Server.Items public static TimeSpan TimeRemaining( Mobile m ) { - Timer t = (Timer)m_Timers[m]; + Timer t = null; + m_Timers.TryGetValue(m, out t); if ( t != null ) { @@ -362,9 +366,9 @@ namespace Server.Items return TimeSpan.Zero; } - private static Hashtable m_Timers = new Hashtable(); - - public static Hashtable Timers + private static Dictionary m_Timers = new Dictionary(); + + public static Dictionary Timers { get { return m_Timers; } }