A
download FindByName.cs
Language: C#
LOC: 36
Project Info
SunUO
Server: BerliOS (SVN)
Type: svn
...\trunk\scripts\legacy\Misc\
   Animations.cs
   AOS.cs
   AttackMessage.cs
   AutoRestart.cs
   AutoSave.cs
   Broadcasts.cs
   CharacterCreation.cs
   Cleanup.cs
   ClientVerification.cs
   CrashGuard.cs
   DataPath.cs
   DispellableAttribute.cs
   ...llableFieldAttribute.cs
   DoorGenerator.cs
   Email.cs
   Fastwalk.cs
   FindByName.cs
   FindRunes.cs
   FoodDecay.cs
   Guild.cs
   HardwareInfo.cs
   InhumanSpeech.cs
   Keywords.cs
   LightCycle.cs
   LoginStats.cs
   Loot.cs
   LootPack.cs
   MapDefinitions.cs
   NameList.cs
   NameVerification.cs
   Notoriety.cs
   OreInfo.cs
   Paperdoll.cs
   Poison.cs
   ProfanityProtection.cs
   Profile.cs
   ProtocolExtensions.cs
   RegenRates.cs
   RenameRequests.cs
   SE.cs
   ServerList.cs
   ShardPoller.cs
   ShrinkTable.cs
   SkillCheck.cs
   SocketOptions.cs
   TextDefinition.cs
   Titles.cs
   TreasureMapProtection.cs
   uoamVendors.cs
   VendorGenerator.cs
   Weather.cs
   WeightOverloading.cs
   WelcomeTimer.cs
   ZLib.cs

using System;
using Server;

namespace Server.Misc
{
	public class FindByName
	{
		public static void Initialize()
		{
			Server.Commands.Register( "FindByName", AccessLevel.Administrator, new CommandEventHandler( FindByName_OnCommand ) );
		}

		[Usage( "FindByName <name>" )]
		[Description( "Finds an item by name." )]
		public static void FindByName_OnCommand( CommandEventArgs e )
		{
			if ( e.Length == 1 )
			{
				string name = e.GetString( 0 ).ToLower();

				foreach ( Item item in World.Items.Values )
				{
					if ( item.Name != null && item.Name.ToLower().IndexOf( name ) >= 0 )
					{
						object root = item.RootParent;

						if ( root is Mobile )
							e.Mobile.SendMessage( "{0} [{1}]: {2} ({3})", item.GetWorldLocation(), item.Map, root.GetType().Name, ((Mobile)root).Name );
						else
							e.Mobile.SendMessage( "{0} [{1}]: {2}", item.GetWorldLocation(), item.Map, root==null ? "(null)" : root.GetType().Name );
					}
				}
			}
			else
			{
				e.Mobile.SendMessage( "Format: FindByName <name>" );
			}
		}
	}
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us