From b0bd466ee5667b2c8fb4117abcf58ddf2a0a5b24 Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Fri, 24 Jul 2026 08:13:10 -0400 Subject: [PATCH] #W# Tweaked BandSelf command to prevent spaming Enchanted Bandage. --- Scripts/Commands/Player/BandSelf.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Scripts/Commands/Player/BandSelf.cs b/Scripts/Commands/Player/BandSelf.cs index 2b4240a..1094120 100644 --- a/Scripts/Commands/Player/BandSelf.cs +++ b/Scripts/Commands/Player/BandSelf.cs @@ -19,20 +19,23 @@ namespace Server.Commands { 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."); + from.SendMessage( 33, "You are already applying a bandage." ); return; } - // 2. Search for the custom Enchanted Bandage first EnchantedBandage enchanted = from.Backpack.FindItemByType(); if (enchanted != null && enchanted.Charges > 0) { - // The 50% chance check - if (Utility.RandomDouble() < 0.50) + 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; @@ -40,26 +43,24 @@ namespace Server.Commands 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 { - // Failed 50% check. Trigger normal heal using the custom charges. if (BandageContext.BeginHeal(from, from) != null) { enchanted.Charges--; } } - // Return here so we don't accidentally consume a regular bandage below return; } - // 3. Fallback: Search for a standard bandage in the backpack Bandage bandage = from.Backpack.FindItemByType(); if (bandage != null) { - // We call BeginHeal which handles the timer, skill checks, and target logic if (BandageContext.BeginHeal(from, from) != null) { bandage.Consume();