diff --git a/Scripts/Commands/Player/BandSelf.cs b/Scripts/Commands/Player/BandSelf.cs new file mode 100644 index 0000000..b3a2c79 --- /dev/null +++ b/Scripts/Commands/Player/BandSelf.cs @@ -0,0 +1,47 @@ +using System; +using Server; +using Server.Items; +using Server.Commands; +using Server.Mobiles; + +namespace Server.Commands +{ + public class BandSelf + { + public static void Initialize() + { + CommandSystem.Register("Bandself", AccessLevel.Player, new CommandEventHandler(Bandself_OnCommand)); + } + + [Usage("Bandself")] + [Description("Uses a bandage from the player's backpack on themselves.")] + public static void Bandself_OnCommand(CommandEventArgs e) + { + Mobile from = e.Mobile; + + // 1. Check if the player is already bandaging to avoid resetting the timer + if (BandageContext.GetContext(from) != null) + { + from.SendMessage("You are already applying a bandage."); + return; + } + + // 2. Search for a bandage in the backpack + Bandage bandage = from.Backpack.FindItemByType(); + + if (bandage != null) + { + // 3. Trigger the healing attempt directly using the established Context logic + // We call BeginHeal which handles the timer, skill checks, and target logic + if (BandageContext.BeginHeal(from, from) != null) + { + bandage.Consume(); + } + } + else + { + from.SendMessage("You do not have any bandages in your backpack."); + } + } + } +}