public override void OnDelete() { TownCrierStone stone = m_Stone as TownCrierStone; if (stone != null) { TownCrierb m_Crier = this as TownCrierb; stone.Registry.Remove(m_Crier); } base.OnDelete(); }
public static string SpamMessage(TownCrierb crier) { ArrayList m_Lines = new ArrayList(); if (File.Exists(path)) { using (StreamReader ip = new StreamReader(path)) { string line; while ((line = ip.ReadLine()) != null) { if (line.Length > 0) { m_Lines.Add(line); } } } } string message; if (m_Lines.Count == 0) { message = "I have no news at this time."; } else if ((crier.Custom && crier.Random) || (crier.Stone != null && !crier.Custom && crier.Stone.Random)) { int i = Utility.Random(m_Lines.Count); message = "Hear ye! Hear ye! " + m_Lines[i]; } else { try { message = "Hear ye! Hear ye! " + m_Lines[crier.Count++]; if (crier.Count == m_Lines.Count) { crier.Count = 0; } } catch { crier.Count = 0; message = "Hear ye! Hear ye! " + m_Lines[crier.Count++]; } } return(message); }
public SpamTimer(TownCrierb crier, TimeSpan m_Delay) : base(TimeSpan.Zero, m_Delay) { m_Crier = crier as TownCrierb; }