using System;
using Server;
using Server.Mobiles;

namespace Server.Items
{
	public class SlayerGroup
	{
		private static SlayerEntry[] m_TotalEntries;
		private static SlayerGroup[] m_Groups;

		public static SlayerEntry[] TotalEntries
		{
			get{ return m_TotalEntries; }
		}

		public static SlayerGroup[] Groups
		{
			get{ return m_Groups; }
		}

		public static SlayerEntry GetEntryByName( SlayerName name )
		{
			int v = (int)name;

			if ( v >= 0 && v < m_TotalEntries.Length )
				return m_TotalEntries[v];

			return null;
		}

		public static SlayerName GetLootSlayerType()
		{
			SlayerName slayer = SlayerName.UndeadDoom;

			if ( Utility.RandomMinMax(1,10) == 1 )
			{
				switch ( Utility.Random( 7 ))
				{
					case 0: slayer = SlayerName.UndeadDoom; break;
					case 1: slayer = SlayerName.Executioner; break;
					case 2: slayer = SlayerName.DragonSlaying; break;
					case 3: slayer = SlayerName.ElementalBan; break;
					case 4: slayer = SlayerName.Exorcism; break;
					case 5: slayer = SlayerName.BugButcher; break;
					case 6: slayer = SlayerName.ReptilianDeath; break;
				}
			}
			else
			{
				switch ( Utility.Random( 24 ))
				{
					case 0: slayer = SlayerName.GiantsFall; break;
					case 1: slayer = SlayerName.OrcSlaying; break;
					case 2: slayer = SlayerName.TrollSlaughter; break;
					case 3: slayer = SlayerName.OgreTrashing; break;
					case 4: slayer = SlayerName.InsectoidExtermination; break;
					case 5: slayer = SlayerName.SerpentBane; break;
					case 6: slayer = SlayerName.LizardmanSlaughter; break;
					case 7: slayer = SlayerName.DaemonDismissal; break;
					case 8: slayer = SlayerName.GargoylesFoe; break;
					case 9: slayer = SlayerName.DevilishDamnation; break;
					case 10: slayer = SlayerName.SerpentoidMassacre; break;
					case 11: slayer = SlayerName.SpidersDeath; break;
					case 12: slayer = SlayerName.ScorpionsBane; break;
					case 13: slayer = SlayerName.FlameDousing; break;
					case 14: slayer = SlayerName.WaterEvaporation; break;
					case 15: slayer = SlayerName.AirAbolish; break;
					case 16: slayer = SlayerName.ElementalHealth; break;
					case 17: slayer = SlayerName.StoneShatter; break;
					case 18: slayer = SlayerName.BloodDrinking; break;
					case 19: slayer = SlayerName.SummerBreeze; break;
					case 20: slayer = SlayerName.NaturesFury; break;
					case 21: slayer = SlayerName.SeaSlaughter; break;
					case 22: slayer = SlayerName.GoblinoidHunter; break;
					case 23: slayer = SlayerName.WeedWrecker; break;
				}
			}

			return slayer;
		}

		static SlayerGroup()
		{
			SlayerGroup humanoid = new SlayerGroup();
			SlayerGroup undead = new SlayerGroup();
			SlayerGroup elemental = new SlayerGroup();
			SlayerGroup abyss = new SlayerGroup();
			SlayerGroup arachnid = new SlayerGroup();
			SlayerGroup reptilian = new SlayerGroup();
			SlayerGroup nature = new SlayerGroup();
			SlayerGroup sea = new SlayerGroup();
			SlayerGroup weed = new SlayerGroup();

			// --------------------------------------------------------------------------------------------------------------------------------------

			humanoid.Super = new SlayerEntry( SlayerName.Executioner, 
				typeof( Goblin ),
				typeof( GoblinArcher ),
				typeof( GoblinWarrior ),
				typeof( Minotaur ),
				typeof( MinotaurChief ),
				typeof( MinotaurLord ),
				typeof( Yeti ),
				typeof( Bugbear ),
				typeof( ArcticOgreLord ), 
				typeof( Pharaoh ),
				typeof( Brigand ), 
				typeof( BlackKnight ),
				typeof( Caveman ), 
				typeof( Cyclops ), 
				typeof( CyclopsChief ), 
				typeof( CyclopsLord ), 
				typeof( Dwarf ),
				typeof( DwarfWarrior ),
				typeof( DwarfKnight ),
				typeof( Ettin ), 
				typeof( EvilMage ), 
				typeof( EvilMageLord ), 
				typeof( FrostTroll ), 
				typeof( Hobgoblin ), 
				typeof( HobgoblinChief ),
				typeof( HobgoblinArcher ),
				typeof( HobgoblinShaman ),
				typeof( Ogre ), 
				typeof( OgreLord ), 
				typeof( OgreMagi ), 
				typeof( Orc ), 
				typeof( OrcCaptain ),
				typeof( OrcishLord ), 
				typeof( OrcishMage ), 
				typeof( ForestGiant ),
				typeof( HillGiant ),
				typeof( MountainGiant ),
				typeof( FrostGiant ),
				typeof( SnowEttin ),
				typeof( ShadowTitan ),
				typeof( SandGiant ),
				typeof( JungleGiant ),
				typeof( Pirate ), 
				typeof( Ratman ), 
				typeof( RatmanArcher ), 
				typeof( RatmanMage ), 
				typeof( SavageShaman ), 
				typeof( Savage ), 
				typeof( SavageLeader ),
				typeof( StormGiant ), 
				typeof( Titan ), 
				typeof( SeaGiant ),
				typeof( Troll ) );
			humanoid.Entries = new SlayerEntry[]
				{
					new SlayerEntry( SlayerName.GiantsFall, 
				typeof( ArcticOgreLord ), 
				typeof( Cyclops ), 
				typeof( CyclopsChief ), 
				typeof( CyclopsLord ), 
				typeof( Ettin ), 
				typeof( FrostTroll ),
 				typeof( ForestGiant ),
				typeof( HillGiant ),
				typeof( MountainGiant ),
				typeof( FrostGiant ),
				typeof( SnowEttin ),
				typeof( ShadowTitan ),
				typeof( SandGiant ),
				typeof( JungleGiant ),
				typeof( Ogre ), 
				typeof( OgreLord ), 
				typeof( StormGiant ), 
				typeof( Titan ), 
				typeof( SeaGiant ),
				typeof( Troll ) ),
					new SlayerEntry( SlayerName.OgreTrashing, 
				typeof( Ogre ), 
				typeof( OgreLord ), 
				typeof( OgreMagi ), 
				typeof( ArcticOgreLord ) ),
					new SlayerEntry( SlayerName.OrcSlaying, 
				typeof( Orc ), 
				typeof( OrcCaptain ),
				typeof( OrcishLord ), 
				typeof( OrcishMage ) ),
					new SlayerEntry( SlayerName.GoblinoidHunter, 
				typeof( GoblinWarrior ),
				typeof( Goblin ),
				typeof( GoblinArcher ),
				typeof( Hobgoblin ), 
				typeof( HobgoblinChief ),
				typeof( HobgoblinArcher ),
				typeof( HobgoblinShaman ) ),
					new SlayerEntry( SlayerName.TrollSlaughter, 
				typeof( Troll ), 
				typeof( FrostTroll ) )
				};

			// --------------------------------------------------------------------------------------------------------------------------------------

			undead.Super = new SlayerEntry( SlayerName.UndeadDoom, 
				typeof( ZombieGargoyle ),	
				typeof( GargoyleUndead ),	
				typeof( CorpseGolem ), 
				typeof( FleshGolem ), 
				typeof( FleshGoliath ), 
				typeof( AncientLich ), 
				typeof( BoneKnight ), 
				typeof( BoneMagi ),
				typeof( Ghoul ), 
				typeof( Wight ),
				typeof( Lich ), 
				typeof( LichLord ), 
				typeof( Nazghoul ), 
				typeof( Demilich ), 
				typeof( DemonicSpirit ), 
				typeof( Mummy ), 
				typeof( MummyLord ),
				typeof( RottingCorpse ), 
				typeof( Shade ), 
				typeof( SkeletalDragon ), 
				typeof( VampiricDragon ), 
				typeof( ZombieDragon ), 
				typeof( BoneDrake ),	
				typeof( VampiricDrake ), 
				typeof( RottingDrake ), 
				typeof( SkeletalKnight ), 
				typeof( SkeletalMage ), 
				typeof( Skeleton ), 
				typeof( BoneClaw ),
				typeof( SkeletonArcher ), 
				typeof( Spectre ), 
				typeof( Vampire ), 
				typeof( VampireLord ), 
				typeof( AncientVampire ), 
				typeof( Wraith ), 
				typeof( Zombie ) );
			undead.Entries = new SlayerEntry[0];

			// --------------------------------------------------------------------------------------------------------------------------------------

			nature.Super = new SlayerEntry( SlayerName.NaturesFury, 
				typeof( Centaur ), 
				typeof( Pixie ), 
				typeof( Fairy ),
				typeof( Satyr ), 
				typeof( Ent ), 
				typeof( Unicorn ), 
				typeof( DreadHorn ),
				typeof( Wisp ) );
			nature.Entries = new SlayerEntry[0];

			// --------------------------------------------------------------------------------------------------------------------------------------

			sea.Super = new SlayerEntry( SlayerName.SeaSlaughter, 
				typeof( WaterElemental ), 
				typeof( DeepSeaElemental ),
				typeof( Typhoon ),
				typeof( DeepSeaSerpent ), 
				typeof( SeaSerpent ), 
				typeof( GiantEel ),
				typeof( SeaDevil ),
				typeof( Kraken ), 
				typeof( Dagon ), 
				typeof( Krakoa ), 
				typeof( Turtle ),
				typeof( Ktulu ),
				typeof( Lurker ),
				typeof( Dolphin ),
				typeof( GreatWhite ),
				typeof( SeaDrake ),	
				typeof( SeaDragon ),
				typeof( GiantCrab ),
				typeof( Lobstran ),
				typeof( Lochasaur ),
				typeof( Megalodon ),
				typeof( Sahuagin ),
				typeof( SahuaginMage ),
				typeof( Shark ),	
				typeof( Seahorse ),	
				typeof( SeaGiant ),
				typeof( WaterElementalElder ),	
				typeof( Leviathan ) );
			sea.Entries = new SlayerEntry[0];

			// --------------------------------------------------------------------------------------------------------------------------------------

			weed.Super = new SlayerEntry( SlayerName.WeedWrecker, 
				typeof( WhippingVine ), 
				typeof( SwampTentacle ), 
				typeof( Reaper ), 
				typeof( SwampThing ), 
				typeof( Fungal ), 
				typeof( FungalMage ), 
				typeof( WoodElemental ),
				typeof( Ent ), 
				typeof( Shambler ),
				typeof( ShamblingMound ),
				typeof( BloodLotus ),
				typeof( Corpser ) );
			weed.Entries = new SlayerEntry[0];

			// --------------------------------------------------------------------------------------------------------------------------------------

			elemental.Super = new SlayerEntry( SlayerName.ElementalBan, 
				typeof( BloodElementalElder ),	
				typeof( PoisonElementalElder ),	
				typeof( WaterElementalElder ),	
				typeof( MeteorElemental ),
				typeof( DeepSeaElemental ),
				typeof( AcidElemental ), 
				typeof( AirElemental ), 
				typeof( BloodElemental ), 
				typeof( EarthElemental ), 
				typeof( StoneGolem ), 
				typeof( StoneStatue ),
				typeof( Goliath ),
				typeof( MudElemental ),
				typeof( MagmaElemental ),
				typeof( WoodElemental ),
				typeof( Efreet ), 
				typeof( FireElemental ), 
				typeof( IceElemental ), 
				typeof( LightningElemental ),
				typeof( PoisonElemental ), 
				typeof( GasCloud ),
				typeof( StormCloud ),
				typeof( SandVortex ), 
				typeof( SnowElemental ), 
				typeof( Typhoon ),
				typeof( WaterElemental ) );
			elemental.Entries = new SlayerEntry[]
				{
					new SlayerEntry( SlayerName.BloodDrinking, 
				typeof( BloodElementalElder ),	
				typeof( BloodElemental ) ),
					new SlayerEntry( SlayerName.StoneShatter, 
				typeof( StoneGolem ), 
				typeof( StoneStatue ),
				typeof( MeteorElemental ),
				typeof( Goliath ),
				typeof( MudElemental ),
				typeof( MagmaElemental ),
				typeof( EarthElemental ) ),
					new SlayerEntry( SlayerName.ElementalHealth, 
				typeof( PoisonElementalElder ),	
				typeof( GasCloud ),
				typeof( PoisonElemental ) ),
					new SlayerEntry( SlayerName.FlameDousing, 
				typeof( FireElemental ) ),
					new SlayerEntry( SlayerName.SummerBreeze, 
				typeof( SnowElemental ), 
				typeof( IceElemental ) ),
					new SlayerEntry( SlayerName.AirAbolish, 
				typeof( LightningElemental ),
				typeof( AirElemental ) ),
					new SlayerEntry( SlayerName.WaterEvaporation, 
				typeof( Typhoon ),
				typeof( StormCloud ),
				typeof( WaterElementalElder ),	
				typeof( DeepSeaElemental ),
				typeof( WaterElemental ) )
				};

			// --------------------------------------------------------------------------------------------------------------------------------------

			abyss.Super = new SlayerEntry( SlayerName.Exorcism, 
			typeof( Balron ), 
			typeof( SeaDevil ),
			typeof( Daemon ), 
			typeof( ShadowDemon ),
			typeof( Minion ),
			typeof( MinionWizard ),
			typeof( MinionWarrior ),
			typeof( Ktulu ),
			typeof( Deviless ),
			typeof( HornedDevil ),
			typeof( Gargoyle ), 
			typeof( GargoyleMage ),
			typeof( GargoyleKnight ),
			typeof( GargoyleIce ),
			typeof( GargoyleStone ),
			typeof( GargoyleWizard ),
			typeof( GargoyleCrimson ),
			typeof( FireGargoyle ), 
			typeof( DemonicSpirit ), 
			typeof( DemonClaw ),
			typeof( Demoness ),
			typeof( IceFiend ), 
			typeof( IceDevil ),
			typeof( Imp ), 
			typeof( FireImp ), 
			typeof( IceImp ), 
			typeof( Succubus ), 
			typeof( SuccubusQueen ), 
			typeof( StoneGargoyle ) );

			abyss.Entries = new SlayerEntry[]
				{
					new SlayerEntry( SlayerName.DaemonDismissal, 
			typeof( Daemon ), 
			typeof( ShadowDemon ),
			typeof( Ktulu ),
			typeof( Deviless ),
			typeof( IceFiend ), 
			typeof( DemonClaw ),
			typeof( Demoness ),
			typeof( Imp ), 
			typeof( FireImp ), 
			typeof( DemonicSpirit ), 
			typeof( IceImp ), 
			typeof( Succubus ), 
			typeof( SuccubusQueen ) ),
					new SlayerEntry( SlayerName.GargoylesFoe, 
			typeof( FireGargoyle ), 
			typeof( Gargoyle ), 
			typeof( GargoyleMage ),
			typeof( GargoyleKnight ),
			typeof( GargoyleIce ),
			typeof( GargoyleStone ),
			typeof( GargoyleWizard ),
			typeof( GargoyleCrimson ),
			typeof( StoneGargoyle ) ),
					new SlayerEntry( SlayerName.DevilishDamnation, 
			typeof( IceDevil ),
			typeof( SeaDevil ),
			typeof( Minion ),
			typeof( MinionWizard ),
			typeof( MinionWarrior ),
			typeof( HornedDevil ),
			typeof( Balron ) )
				};

			// --------------------------------------------------------------------------------------------------------------------------------------

			arachnid.Super = new SlayerEntry( SlayerName.BugButcher, 
				typeof( DreadSpider ), 
				typeof( FrostSpider ), 
				typeof( GiantBlackWidow ), 
				typeof( BloodSpider ),	
				typeof( Kith ),	
				typeof( WidowQueen ),
				typeof( GiantSpider ), 
				typeof( FlameCrawler ),
				typeof( Scorpion ), 
				typeof( Mantis ),
				typeof( ArcaneScarab ), 
				typeof( Shaclaw ),
				typeof( FireBeetle ), 
				typeof( GoraxHorned ),	
				typeof( GoraxSlicer ),	
				typeof( Swarm ), 
				typeof( AntLion ), 
				typeof( SandScorpion ), 
				typeof( Scarab ),		
				typeof( GiantScarab ),	
				typeof( DeadlyScorpion ), 
				typeof( Beetle ), 
				typeof( IronBeetle ),
				typeof( CarcassWorm ),
				typeof( AntaurWorker ), 
				typeof( AntaurSoldier ), 
				typeof( AntaurLord ), 
				typeof( AntaurQueen ), 
				typeof( TerathanAvenger ), 
				typeof( TerathanDrone ), 
				typeof( TerathanMatriarch ), 
				typeof( TerathanWarrior ) );
			arachnid.Entries = new SlayerEntry[]
				{
					new SlayerEntry( SlayerName.ScorpionsBane, 
				typeof( FlameCrawler ),
				typeof( SandScorpion ), 
				typeof( DeadlyScorpion ), 
				typeof( Scorpion ) ),
					new SlayerEntry( SlayerName.SpidersDeath, 
				typeof( Kith ),	
				typeof( DreadSpider ), 
				typeof( FrostSpider ), 
				typeof( GiantBlackWidow ), 
				typeof( BloodSpider ),	
				typeof( WidowQueen ),
				typeof( GiantSpider ) ),
					new SlayerEntry( SlayerName.InsectoidExtermination, 
				typeof( AntaurWorker ), 
				typeof( AntaurSoldier ), 
				typeof( AntaurLord ), 
				typeof( AntaurQueen ), 
				typeof( TerathanAvenger ), 
				typeof( TerathanDrone ), 
				typeof( TerathanMatriarch ), 
				typeof( TerathanWarrior ) )
				};

			// --------------------------------------------------------------------------------------------------------------------------------------

			reptilian.Super = new SlayerEntry( SlayerName.ReptilianDeath, 
				typeof( SeaDragon ),
				typeof( AncientWyrm ), 
				typeof( DeepSeaSerpent ), 
				typeof( GiantEel ),
				typeof( Dragon ), 
				typeof( Drakkhen ),
				typeof( DragonTurtle ), 
				typeof( Turtle ), 
				typeof( Drake ),
				typeof( LavaDrake ),
				typeof( SeaDrake ),
				typeof( SwampDragon ),
				typeof( Serperus ),
				typeof( IceSerpent ), 
				typeof( GiantSerpent ), 
				typeof( Torax ),
				typeof( GiantLizard ),
				typeof( GiantToad ),
				typeof( IceToad ),
				typeof( FireToad ),
				typeof( BullFrog ),
				typeof( Viper ), 
				typeof( LavaSerpent ), 
				typeof( Cobra ), 
				typeof( Lizardman ), 
				typeof( Drasolisk ),
				typeof( Silisk ),
				typeof( Sakkhra ),
				typeof( SakkhraShaman ),
				typeof( Naga ),
				typeof( NagaWarrior ),
				typeof( NagaQueen ),
				typeof( FireNaga ),
				typeof( OphidianArchmage ), 	
				typeof( Teradactyl ),
				typeof( Stegosaurus ),
				typeof( Meglasaur ),
				typeof( Gorceratops ),
				typeof( Lochasaur ),	
				typeof( Tyranasaur ),
				typeof( Kobra ),
				typeof( OphidianKnight ), 
				typeof( OphidianMage ), 
				typeof( OphidianMatriarch ), 
				typeof( OphidianWarrior ), 
				typeof( Hydra ),
				typeof( SeaHydra ),
				typeof( Medusa ), 
				typeof( IceSalamander ),
				typeof( FireSalamander ),
				typeof( Raptor ),
				typeof( SeaSerpent ), 
				typeof( ShadowWyrm ), 
				typeof( SilverSerpent ), 
				typeof( SkeletalDragon ), 
				typeof( VampiricDragon ), 
				typeof( ZombieDragon ), 
				typeof( BoneDrake ),	
				typeof( VampiricDrake ), 
				typeof( RottingDrake ), 
				typeof( Snake ), 
				typeof( WhiteWyrm ), 
				typeof( AncientWyvern ), 
				typeof( Wyvern ) );
			reptilian.Entries = new SlayerEntry[]
				{
					new SlayerEntry( SlayerName.DragonSlaying, 
				typeof( AncientWyrm ), 
				typeof( Dragon ), 
				typeof( Drakkhen ),
				typeof( Drake ),
				typeof( LavaDrake ),
				typeof( SeaDrake ),
				typeof( SwampDragon ),
				typeof( ShadowWyrm ), 
				typeof( DragonTurtle ), 
				typeof( SkeletalDragon ), 
				typeof( VampiricDragon ), 
				typeof( BoneDrake ),	
				typeof( ZombieDragon ), 
				typeof( RottingDrake ), 
				typeof( VampiricDrake ), 
				typeof( SeaDragon ),
				typeof( WhiteWyrm ), 
				typeof( AncientWyvern ), 
				typeof( Wyvern ) ),
					new SlayerEntry( SlayerName.LizardmanSlaughter, 
				typeof( Drasolisk ),
				typeof( Silisk ),
				typeof( Sakkhra ),
				typeof( SakkhraShaman ),
				typeof( Lizardman ) ),
					new SlayerEntry( SlayerName.SerpentoidMassacre, 
				typeof( Naga ),
				typeof( NagaWarrior ),
				typeof( NagaQueen ),
				typeof( FireNaga ),
				typeof( IceSalamander ),
				typeof( FireSalamander ),
				typeof( Medusa ), 
				typeof( Hydra ),
				typeof( SeaHydra ),
				typeof( Kobra ),
				typeof( OphidianArchmage ), 
				typeof( OphidianKnight ), 
				typeof( OphidianMage ), 
				typeof( OphidianMatriarch ), 
				typeof( OphidianWarrior ) ),
					new SlayerEntry( SlayerName.SerpentBane, 
				typeof( GiantEel ),
				typeof( DeepSeaSerpent ), 
				typeof( GiantSerpent ), 
				typeof( IceSerpent ), 
				typeof( Viper ), 
				typeof( LavaSerpent ), 
				typeof( Cobra ), 
				typeof( SeaSerpent ), 
				typeof( SilverSerpent ), 
				typeof( Snake ) )
				};

			// --------------------------------------------------------------------------------------------------------------------------------------

			m_Groups = new SlayerGroup[]
				{
					humanoid,
					undead,
					elemental,
					abyss,
					arachnid,
					reptilian,
					nature,
					sea,
					weed
				};

			m_TotalEntries = CompileEntries( m_Groups );
		}

		private static SlayerEntry[] CompileEntries( SlayerGroup[] groups )
		{
			SlayerEntry[] entries = new SlayerEntry[32];

			for ( int i = 0; i < groups.Length; ++i )
			{
				SlayerGroup g = groups[i];

				g.Super.Group = g;

				entries[(int)g.Super.Name] = g.Super;

				for ( int j = 0; j < g.Entries.Length; ++j )
				{
					g.Entries[j].Group = g;
					entries[(int)g.Entries[j].Name] = g.Entries[j];
				}
			}

			return entries;
		}

		private SlayerEntry m_Super;
		private SlayerEntry[] m_Entries;

		public SlayerEntry Super{ get{ return m_Super; } set{ m_Super = value; } }
		public SlayerEntry[] Entries{ get{ return m_Entries; } set{ m_Entries = value; } }

		public SlayerGroup()
		{
		}
	}
}