#W# Added BandSelf command.
This commit is contained in:
parent
f607008e48
commit
eb3beb55b4
1 changed files with 47 additions and 0 deletions
47
Scripts/Commands/Player/BandSelf.cs
Normal file
47
Scripts/Commands/Player/BandSelf.cs
Normal file
|
|
@ -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<Bandage>();
|
||||||
|
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue