Thread: Target & Effect
View Single Post
Old 05-13-2008, 05:20 PM   #9 (permalink)
Peoharen
Account Terminated
 
Peoharen's Avatar
 
Join Date: Dec 2004
Location: USA
Age: 24
Posts: 911
Send a message via Yahoo to Peoharen
Default

using System.Collections;
using System.Collections.Generic;
using Server.Network;

Code:
		protected override void OnTarget( Mobile from, object o )
		{
			IPoint3D p = (IPoint3D)o;

			if ( p == null && from == null && from.Map == null )
				return;

			List<Mobile> targets = new List<Mobile>();

			foreach ( Mobile m in from.Map.GetMobilesInRange( new Point3D( p ), 1 ) )
				if ( m != null && m.NetState != null && m.AccessLevel == AccessLevel.Player )
					targets.Add( m );

			if ( targets.Count <= 0 )
				return;

			Mobile target = targets[Utility.Random( targets.Count )];
			target.ProcessDelta();
			Packet packet = Packet.Acquire( new MovingEffect( from, target, itemID, speed, duration, fixeddirection, explodes, hue, rendermode ) );
			target.NetState.Send( packet );
		}
Fill in the red.

Last edited by Peoharen; 05-14-2008 at 05:40 PM.
Peoharen is offline   Reply With Quote