using System;
using System.Collections;
using Server;
using Server.Mobiles;

namespace Server
{
	public class SpeedInfo
	{
		// Should we use the new method of speeds?
		private static bool Enabled = true;

		private double m_ActiveSpeed;
		private double m_PassiveSpeed;
		private Type[] m_Types;

		public double ActiveSpeed
		{
			get{ return m_ActiveSpeed; }
			set{ m_ActiveSpeed = value; }
		}

		public double PassiveSpeed
		{
			get{ return m_PassiveSpeed; }
			set{ m_PassiveSpeed = value; }
		}

		public Type[] Types
		{
			get{ return m_Types; }
			set{ m_Types = value; }
		}

		public SpeedInfo( double activeSpeed, double passiveSpeed, Type[] types )
		{
			m_ActiveSpeed = activeSpeed;
			m_PassiveSpeed = passiveSpeed;
			m_Types = types;
		}

		public static bool Contains( object obj )
		{
			if ( !Enabled )
				return false;

			if ( m_Table == null )
				LoadTable();

			SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];

			return ( sp != null );
		}

		public static bool GetSpeeds( object obj, ref double activeSpeed, ref double passiveSpeed )
		{
			if ( !Enabled )
				return false;

			if ( m_Table == null )
				LoadTable();

			SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];

			if ( sp == null )
				return false;

			activeSpeed = sp.ActiveSpeed;
			passiveSpeed = sp.PassiveSpeed;

			return true;
		}

		private static void LoadTable()
		{
			m_Table = new Hashtable();

			for ( int i = 0; i < m_Speeds.Length; ++i )
			{
				SpeedInfo info = m_Speeds[i];
				Type[] types = info.Types;

				for ( int j = 0; j < types.Length; ++j )
					m_Table[types[j]] = info;
			}
		}

		private static Hashtable m_Table;

		private static SpeedInfo[] m_Speeds = new SpeedInfo[]
			{
				/* Slow */
				new SpeedInfo( 0.3, 0.6, new Type[]
				{
				typeof( RottingDrake ), 
				typeof( ZombieDragon ),
				typeof( CarcassWorm ),
				typeof( Meglasaur ),
				typeof( Gorceratops ),
				typeof( Stegosaurus ),
				typeof( Turtle ),
				typeof( Shambler ),
				typeof( ShamblingMound ),
				typeof( AntLion ),			
				typeof( ArcticOgreLord ),	
				typeof( BoneKnight ),		
				typeof( EarthElemental ),
				typeof( MeteorElemental ),
				typeof( StoneGolem ),
				typeof( StoneStatue ),
				typeof( Goliath ),
				typeof( MudElemental ),
				typeof( MagmaElemental ),
				typeof( WoodElemental ),
				typeof( Ettin ),			
				typeof( SnowEttin ),		
				typeof( SwampThing ),		
				typeof( FrostOoze ),		
				typeof( FrostTroll ),
				typeof( Ghoul ),
				typeof( Wight ),
				typeof( Golem ),
				typeof( HeadlessOne ),		
				typeof( Mummy ),
				typeof( Ogre ),		
				typeof( Owlbear ),
				typeof( Sasquatch ),
				typeof( CorpseGolem ),	
				typeof( FleshGolem ),		
				typeof( FleshGoliath ),		
				typeof( Caveman ),			
				typeof( OgreLord ),		
				typeof( ForestGiant ),	
				typeof( HillGiant ),	
				typeof( MountainGiant ),	
				typeof( FrostGiant ),	
				typeof( Xorn ),			
				typeof( Rat ),				
				typeof( RottingCorpse ),
				typeof( Skeleton ),			
				typeof( Slime ),
				typeof( Sludge ),
				typeof( LargeSlime ),
				typeof( Zombie ),	
				typeof( ZombieGargoyle ),	
				typeof( GargoyleUndead ),			
				typeof( Walrus )
				} ),
				/* Fast */
				new SpeedInfo( 0.2, 0.4, new Type[]
				{
				typeof( BoneClaw ),
				typeof( ShadowDemon ),
				typeof( Torax ),
				typeof( Teradactyl ),
				typeof( AirElemental ),
				typeof( Typhoon ),
				typeof( AncientWyrm ),		
				typeof( Balron ),
				typeof( SeaDevil ),
				typeof( DemonClaw ),
				typeof( BladeSpirits ),
				typeof( DreadSpider ),		
				typeof( Efreet ),
				typeof( Lich ),
				typeof( Vampire ),
				typeof( Nightmare ),
				typeof( Cerberus ),
				typeof( Serperus ),
				typeof( Haderus ),
				typeof( OphidianArchmage ),
				typeof( OphidianMage ),		
				typeof( OphidianWarrior ),	
				typeof( OphidianMatriarch ),
				typeof( OphidianKnight ),
				typeof( Naga ),
				typeof( NagaWarrior ),
				typeof( NagaQueen ),
				typeof( FireNaga ),
				typeof( Kobra ),
				typeof( Medusa ), 
				typeof( PoisonElemental ),
				typeof( GasCloud ),
				typeof( StormCloud ),
				typeof( IceSalamander ),
				typeof( FireSalamander ),
				typeof( Raptor ),
				typeof( SandVortex ),		
				typeof( SavageShaman ),
				typeof( SnowElemental ),	
				typeof( SuccubusQueen ),
				typeof( WhiteWyrm ),		
				typeof( Wisp ),		
				typeof( WidowQueen ),	
				typeof( Kith ),		
				typeof( BloodSpider ),	
				typeof( GiantBlackWidow )
				} ),
				/* Very Fast */
				new SpeedInfo( 0.175, 0.350, new Type[]
				{
				typeof( EnergyVortex ),
				typeof( Pixie ),
				typeof( Fairy ),
				typeof( Swarm ),		
				typeof( SilverSerpent ),
				typeof( Leviathan ),		
				} ),
				/* Medium */
				new SpeedInfo( 0.25, 0.5, new Type[]
				{
				typeof( Demoness ),
				typeof( Hydra ),
				typeof( SeaHydra ),
				typeof( Goblin ),
				typeof( GoblinArcher ),
				typeof( GoblinWarrior ),
				typeof( MummyLord ),
				typeof( GiantCrab ),
				typeof( Lobstran ),
				typeof( Lurker ),
				typeof( ForestStalker ),
				typeof( CaveDweller ),
				typeof( Minotaur ),
				typeof( MinotaurLord ),
				typeof( MinotaurChief ),
				typeof( Ent ),	
				typeof( Fungal ),	
				typeof( FungalMage ),	
				typeof( Sphinx ),
				typeof( RoyalSphinx ),
				typeof( AncientSphinx ),
				typeof( AcidElemental ),	
				typeof( Alligator ),
				typeof( AncientLich ),
				typeof( AncientVampire ),
				typeof( Bird ),
				typeof( BlackBear ),		
				typeof( BloodElemental ),	
				typeof( BloodElementalElder ),	
				typeof( PoisonElementalElder ),	
				typeof( WaterElementalElder ),	
				typeof( Boar ),				
				typeof( BoneMagi ),
				typeof( Brigand ),
				typeof( BlackKnight ),
				typeof( BrownBear ),
				typeof( Bull ),
				typeof( BullFrog ),
				typeof( Cat ),				
				typeof( Centaur ),			
				typeof( Chicken ),			
				typeof( Cougar ),			
				typeof( Cow ),
				typeof( Cyclops ),
				typeof( CyclopsChief ),
				typeof( CyclopsLord ),
				typeof( Daemon ),
				typeof( Ktulu ),
				typeof( Deviless ),
				typeof( HornedDevil ),
				typeof( IceDevil ),
				typeof( DeepSeaSerpent ),
				typeof( GiantEel ),
				typeof( GiantSquid ),
				typeof( DemonicSpirit ),
				typeof( DireWolf ),			
				typeof( Dog ),
				typeof( Dolphin ),		
				typeof( GreatWhite ),		
				typeof( Lochasaur ),		
				typeof( Megalodon ),		
				typeof( Shark ),	
				typeof( Seahorse ),
				typeof( Tyranasaur ),
				typeof( SeaDragon ),
				typeof( Dragon ),
				typeof( Drakkhen ),
				typeof( DragonTurtle ),			
				typeof( Drake ),
				typeof( LavaDrake ),
				typeof( SeaDrake ),
				typeof( SwampDragon ),
				typeof( Dwarf ),
				typeof( DwarfWarrior ),
				typeof( DwarfKnight ),
				typeof( Eagle ),			
				typeof( ElderGazer ),	
				typeof( AncientGazer ),
				typeof( EvilMage ),
				typeof( EvilMageLord ),
				typeof( MindFlayer ),
				typeof( Executioner ),
				typeof( Savage ),
				typeof( SavageLeader ),
				typeof( FireElemental ),	
				typeof( LightningElemental ),
				typeof( FireGargoyle ),
				typeof( FrostSpider ),
				typeof( Shaclaw ),
				typeof( Gargoyle ),
				typeof( GargoyleMage ),
				typeof( GargoyleKnight ),
				typeof( GargoyleIce ),
				typeof( GargoyleStone ),
				typeof( GargoyleWizard ),
				typeof( GargoyleCrimson ),
				typeof( Gazer ),
				typeof( IceSerpent ),		
				typeof( GiantRat ),			
				typeof( GiantSerpent ),	
				typeof( Viper ),	
				typeof( Cobra ),
				typeof( GiantSpider ),
				typeof( GiantToad ),
				typeof( IceToad ),
				typeof( FireToad ),
				typeof( Goat ),
				typeof( Gorilla ),	
				typeof( Ape ),			
				typeof( GreatDeer ),
				typeof( GreyWolf ),			
				typeof( GrizzlyBear ),		
				typeof( CaveBear ),	
				typeof( KodiakBear ),	
				typeof( Lion ),
				typeof( Tiger ),
				typeof( Manticore ),	
				typeof( SnowBear ),	
				typeof( PandaBear ),	
				typeof( Harpy ),
				typeof( ElderHarpy ),
				typeof( GiantHawk ),
				typeof( GiantRaven ),
				typeof( Roc ),
				typeof( AxeBeak ),
				typeof( Griffon ),		
				typeof( Hippogriff ),			
				typeof( HellHound ),
				typeof( Deer ),
				typeof( Hobgoblin ),
				typeof( HobgoblinChief ),
				typeof( HobgoblinArcher ),
				typeof( HobgoblinShaman ),
				typeof( Horse ),
				typeof( IceElemental ),		
				typeof( IceFiend ),
				typeof( Imp ),
				typeof( FireImp ), 
				typeof( IceImp ), 				
				typeof( Kraken ),			
				typeof( HellCat ),
				typeof( LavaLizard ),
				typeof( GiantLizard ),
				typeof( LavaSerpent ),		
				typeof( Lizardman ),
				typeof( Drasolisk ),
				typeof( Silisk ),
				typeof( Sakkhra ),
				typeof( SakkhraShaman ),
				typeof( Sahuagin ),
				typeof( SahuaginMage ),
				typeof( Llama ),			
				typeof( Mongbat ),
				typeof( MountainGoat ),
				typeof( Dagon ), 
				typeof( Krakoa ), 
				typeof( OgreMagi ),
				typeof( Minion ),
				typeof( MinionWizard ),
				typeof( MinionWarrior ),
				typeof( Orc ),
				typeof( OrcCaptain ),
				typeof( OrcishLord ),
				typeof( OrcishMage ),
				typeof( PackHorse ),
				typeof( PackLlama ),
				typeof( Pirate ),
				typeof( Panther ),			
				typeof( Pig ),
				typeof( PolarBear ),		
				typeof( Rabbit ),	
				typeof( Raccoon ),	
				typeof( Squirrel ),
				typeof( Ratman ),
				typeof( RatmanArcher ),
				typeof( RatmanMage ),		
				typeof( Satyr ),
				typeof( FlameCrawler ),
				typeof( Scorpion ),
				typeof( Mantis ),
				typeof( SandScorpion ),		
				typeof( DeadlyScorpion ),			
				typeof( SeaSerpent ),
				typeof( Shade ),			
				typeof( ShadowWyrm ),		
				typeof( Sheep ),
				typeof( BoneDrake ),	
				typeof( SkeletalDragon ),	
				typeof( VampiricDragon ),	
				typeof( VampiricDrake ),	
				typeof( SkeletalMage ),
				typeof( SkeletonArcher ),	
				typeof( Snake ),
				typeof( SnowLeopard ),		
				typeof( Spectre ),
				typeof( StoneGargoyle ),	
				typeof( StoneHarpy ),
				typeof( StormGiant ),
				typeof( ShadowTitan ),
				typeof( SandGiant ),
				typeof( JungleGiant ),
				typeof( Succubus ),
				typeof( SwampTentacle ),	
				typeof( AntaurWorker ), 
				typeof( AntaurSoldier ), 
				typeof( AntaurLord ), 
				typeof( AntaurQueen ), 
				typeof( TerathanAvenger ),
				typeof( TerathanDrone ),	
				typeof( TerathanMatriarch ), 
				typeof( TerathanWarrior ),
				typeof( TimberWolf ),
				typeof( Titan ),
				typeof( Troll ),
				typeof( Yeti ),
				typeof( Bugbear ),
				typeof( Unicorn ),
				typeof( DreadHorn ),
				typeof( WaterElemental ),
				typeof( DeepSeaElemental ),
				typeof( WhippingVine ),
				typeof( WhiteWolf ),		
				typeof( Wraith ),			
				typeof( AncientWyvern ),	
				typeof( Wyvern ),
				typeof( Pharaoh ),
				typeof( LichLord ),
				typeof( Nazghoul ), 
				typeof( Demilich ), 
				typeof( VampireLord ),
				typeof( SkeletalKnight ),		
				typeof( Bat ),		
				typeof( VampireBat ),	
				typeof( CaveBat ),		
				typeof( Stirge ),
				typeof( ArcaneScarab ),
				typeof( Werewolf ),		
				typeof( Scarab ),		
				typeof( GoraxHorned ),	
				typeof( GoraxSlicer ),	
				typeof( GiantScarab ),
				typeof( IronBeetle ),
				typeof( Beetle )
				} )
			};
	}
}