public override void Execute(CommandEventArgs e, object obj) { if (!ListOptimized && !_DeleteConfirm.Contains(obj)) { string message; if (DeleteConfirmAttribute.Find(obj, out message)) { if (string.IsNullOrWhiteSpace(message)) { message = string.Format("Confirm deletion of {0}", obj); } ArrayList list = new ArrayList { obj }; e.Mobile.SendGump( new WarningGump(1060637, 30720, message, 0xFFC000, 420, 280, OnConfirmCallback, new object[] { e, list })); AddResponse("Awaiting confirmation..."); return; } } if (obj is Item) { CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj)); ((Item)obj).Delete(); AddResponse("The item has been deleted."); } else if (obj is Mobile && !((Mobile)obj).Player) { CommandLogging.WriteLine( e.Mobile, "{0} {1} deleting {2}", e.Mobile.AccessLevel, CommandLogging.Format(e.Mobile), CommandLogging.Format(obj)); ((Mobile)obj).Delete(); AddResponse("The mobile has been deleted."); } else { LogFailure("That cannot be deleted."); } _DeleteConfirm.Remove(obj); }
public override void ExecuteList(CommandEventArgs e, ArrayList list) { if (list.Count > 1) { string message = string.Format( "You are about to delete {0} objects. " + "This cannot be undone without a full server revert.<br><br>Continue?", list.Count); e.Mobile.SendGump( new WarningGump(1060637, 30720, message, 0xFFC000, 420, 280, OnConfirmCallback, new object[] { e, list })); AddResponse("Awaiting confirmation..."); return; } if (list.Count > 0) { object obj = list[0]; if (obj != null && !_DeleteConfirm.Contains(obj)) { string message; if (DeleteConfirmAttribute.Find(obj, out message)) { if (string.IsNullOrWhiteSpace(message)) { message = string.Format("Confirm deletion of {0}", obj); } e.Mobile.SendGump( new WarningGump(1060637, 30720, message, 0xFFC000, 420, 280, OnConfirmCallback, new object[] { e, list })); AddResponse("Awaiting confirmation..."); return; } } } base.ExecuteList(e, list); }