public void Flush(Mobile from, bool flushToLog) { //debug hang if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("Flush\t"); } if (m_Responses.Count > 0) { for (int i = 0; i < m_Responses.Count; ++i) { object obj = m_Responses[i]; //debug hang if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("Respone\t"); } if (obj is MessageEntry) { from.SendMessage(((MessageEntry)obj).ToString()); //debug hang if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug(((MessageEntry)obj).ToString() + "\t"); } if (flushToLog) { CommandLogging.WriteLine(from, ((MessageEntry)obj).ToString()); } } else if (obj is Gump) { from.SendGump((Gump)obj); } } } else { //debug hang if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("Failure\t"); } for (int i = 0; i < m_Failures.Count; ++i) { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug(((MessageEntry)m_Failures[i]).ToString()); } from.SendMessage(((MessageEntry)m_Failures[i]).ToString()); } } if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("endflush\t"); } m_Responses.Clear(); m_Failures.Clear(); }
public void RunCommand(Mobile from, object obj, BaseCommand command, string[] args) { try { if (command is GetCommand && obj is ArrayList && ((ArrayList)obj).Count > 20000) { throw new Exception("Get command has too many potential target: " + ((ArrayList)obj).Count); } if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("RunCommand\t" + command.Commands[0] + "\t"); } CommandEventArgs e = new CommandEventArgs(from, command.Commands[0], GenerateArgString(args), args); if (!command.ValidateArgs(this, e)) { return; } bool flushToLog = false; if (obj is ArrayList) { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("objArrayList\t"); } ArrayList list = (ArrayList)obj; if (list.Count > 20) { CommandLogging.Enabled = false; } else if (list.Count == 0) { command.LogFailure("Nothing was found to use this command on."); } command.ExecuteList(e, list); if (list.Count > 20) { flushToLog = true; CommandLogging.Enabled = true; } } else if (obj != null) { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("obj\t"); } if (command.ListOptimized) { ArrayList list = new ArrayList(); list.Add(obj); command.ExecuteList(e, list); } else { command.Execute(e, obj); } } if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("flush\t"); } command.Flush(from, flushToLog); } catch (Exception ex) { if (from != null) { from.SendMessage(ex.Message); } } }
public override void Compile(Mobile from, BaseCommand command, ref string[] args, ref object obj) { try { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("Global...compiling\t"); } Extensions ext = Extensions.Parse(from, ref args); bool items, mobiles; if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("1\t"); } if (!CheckObjectTypes(from, command, ext, out items, out mobiles)) { return; } ArrayList list = new ArrayList(); if (items) { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("2\t"); } foreach (Item item in World.Items.Values) { if (ext.IsValid(item)) { list.Add(item); } } } if (mobiles) { if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("3\t"); } foreach (Mobile mob in World.Mobiles.Values) { if (ext.IsValid(mob)) { list.Add(mob); } } } if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("startfilter:list with " + list.Count + " in it\t"); } ext.Filter(list); if (LoggingCustom.CommandDebug) { LoggingCustom.LogCommandDebug("4\t"); } obj = list; } catch (Exception ex) { from.SendMessage(ex.Message); } }