public static void TCCS_OnCommand(CommandEventArgs e) { try { Mobile m = e.Mobile; bool showformat = true; if (e.Arguments.Length == 1 && e.Arguments[0].ToLower() == "list") { e.Mobile.SendMessage("TCCS Info:"); e.Mobile.SendMessage(" There are {0} entries.", TCCS.TheList.Count); for (int i = 0; i < TCCS.TheList.Count; i++) { ListEntry x = (ListEntry)TCCS.TheList[i]; e.Mobile.SendMessage(" [{0}]::Mob: {1}, Enabled: {2}, Expires: {3}", i, x.Mobile, x.Enabled, x.DateTime); } showformat = false; } else if (e.Arguments.Length > 1) { int number = 0; bool invalid = false; try { number = Int32.Parse(e.Arguments[1]); } catch { invalid = true; } if (number >= TCCS.TheList.Count || TCCS.TheList.Count == 0 || number < 0) { m.SendMessage("{0} is out of range. Max is currently {1}", number, TCCS.TheList.Count - 1); invalid = true; showformat = false; } if (!invalid) { showformat = false; if (e.Arguments[0].ToLower() == "show") { ListEntry x = (ListEntry)TCCS.TheList[number]; m.SendMessage("TCCS at {0}:", number); m.SendMessage(" Mob: {0}, Enabled: {1}, DateTime: {2}", x.Mobile, x.Enabled, x.DateTime); } else if (e.Arguments[0].ToLower() == "delete") { TCCS.TheList.RemoveAt(number); m.SendMessage("ListEntry deleted"); } } } if (showformat) { m.SendMessage("format is:"); m.SendMessage("[TCCS <list|show|delete> <number>"); m.SendMessage("Always do TCCS show before TCCS delete."); } } catch (Exception exc) { LogHelper.LogException(exc); System.Console.WriteLine("Exception caught in TCCS_OnCommand: {0}", exc.Message); System.Console.WriteLine("Command was: {0}", e.Command); System.Console.WriteLine(exc.StackTrace); } }
public static void OnLoad( ) { System.Console.WriteLine("TCCS Loading..."); string filePath = Path.Combine( "Saves/AngelIsland", "TCCS.xml" ); if ( !File.Exists( filePath ) ) { return; } try { XmlDocument doc = new XmlDocument(); doc.Load( filePath ); XmlElement root = doc["TCCS"]; foreach ( XmlElement entry in root.GetElementsByTagName( "listentry" ) ) { try { ListEntry le = new ListEntry(entry); TCCS.TheList.Add(le); } catch { Console.WriteLine( "Warning: A TCCS ListEntry instance load failed" ); } } } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } }
public static void AddMacroer(string[] lines, Mobile m, DateTime dt) { ListEntry le = new ListEntry(lines, m, dt, ListEntryType.PJUM); TCCS.AddEntry( le ); PJUM.MakeAllEntriesCriminal(); }
public static void AddEntry( ListEntry entry ) { TheList.Add( entry ); ArrayList instances = TownCrier.Instances; for ( int i = 0; i < instances.Count; ++i ) ((TownCrier)instances[i]).ForceBeginAutoShout(); }