QUOTE |
using System; using System.Collections; using System.IO; using Server; using Server.Items; using Server.Mobiles; using Server.Commands; namespace Server.Scripts.Commands { public class HealSelf { public static void Initialize() { CommandSystem.Register( "Healself", AccessLevel.Player, new CommandEventHandler( HealSelf_OnCommand ) ); } [Usage( "HealSelf" )] public static void HealSelf_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; if (from==null) return; Container bp = from.Backpack; if (bp==null) return; GreaterHealPotion ha = (GreaterHealPotion)bp.FindItemByType( typeof( GreaterHealPotion )); LesserHealPotion hb = (LesserHealPotion)bp.FindItemByType( typeof( LesserHealPotion )); HealPotion hc = (HealPotion)bp.FindItemByType( typeof( HealPotion )); if ( ha != null ) { ha.DoHeal( from ); ha.Delete(); from.AddToBackpack( new Bottle() ); return; } if ( hb != null ) { hb.DoHeal( from ); hb.Delete(); from.AddToBackpack( new Bottle() ); return; } if ( hc != null ) { hc.DoHeal( from ); hc.Delete(); from.AddToBackpack( new Bottle() ); return; } from.SendMessage("You must have heal potions in your backpack to heal!"); return; } } } |