#W# Added bandage self command.
This commit is contained in:
parent
4a188a6788
commit
ef6da3147e
1 changed files with 75 additions and 0 deletions
75
Scripts/Commands/BandSelf.cs
Normal file
75
Scripts/Commands/BandSelf.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
if (BandageContext.GetContext(from) != null)
|
||||||
|
{
|
||||||
|
from.SendMessage( 33, "You are already applying a bandage." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnchantedBandage enchanted = from.Backpack.FindItemByType<EnchantedBandage>();
|
||||||
|
|
||||||
|
if (enchanted != null && enchanted.Charges > 0)
|
||||||
|
{
|
||||||
|
if ( EnchantedBandage.CooldownTable.ContainsKey( from ) && EnchantedBandage.CooldownTable[from] > DateTime.UtcNow )
|
||||||
|
{
|
||||||
|
from.SendMessage( 33, "You must wait a moment before using an enchanted bandage again." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Utility.RandomDouble() < 0.30)
|
||||||
|
{
|
||||||
|
from.Poison = null;
|
||||||
|
from.Hits = from.HitsMax;
|
||||||
|
|
||||||
|
from.PlaySound(0x1F2);
|
||||||
|
from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
|
||||||
|
from.SendMessage(63, "The enchanted bandage glows brightly, instantly curing and fully healing you!");
|
||||||
|
|
||||||
|
EnchantedBandage.CooldownTable[from] = DateTime.UtcNow + TimeSpan.FromSeconds( 5 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (BandageContext.BeginHeal(from, from) != null)
|
||||||
|
{
|
||||||
|
enchanted.Charges--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bandage bandage = from.Backpack.FindItemByType<Bandage>();
|
||||||
|
|
||||||
|
if (bandage != null)
|
||||||
|
{
|
||||||
|
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