using System; using Server.Accounting; using Server.Engines.Help; namespace Server.Custom { /// /// Puts a couple of genuine PageEntry tickets into the help-page queue so BridgePages /// (poll/stream + snapshot + respond/close) can be verified without a game client. /// /// The enqueue is real (PageQueue.Enqueue). The only accommodation for the missing client: /// each entry's InternalTimer would remove the page on its first tick because the sender has /// no NetState (PageQueue.cs:167 treats "no NetState" as a logout), so we call PageEntry.Stop /// to keep the ticket in the queue for the test. Everything the bridge does — detect, snapshot, /// respond, close — then operates on real queue entries. /// /// Test scaffolding. Never deployed. Gated behind Bridge.PageProbeOnStart. /// public static class BridgePageProbe { public static void Initialize() { if (Config.Get("Bridge.PageProbeOnStart", false)) EventSink.ServerStarted += () => Timer.DelayCall(TimeSpan.FromSeconds(4.0), Run); } private static void Run() { try { Enqueue("seed_030", "My quest is stuck, please help.", PageType.Stuck); Enqueue("seed_031", "Found a bug with a player vendor.", PageType.Bug); Console.WriteLine("[PageProbe] done"); } catch (Exception ex) { Console.WriteLine("[PageProbe] FAILED: " + ex); } } private static void Enqueue(string account, string message, PageType type) { var acct = Accounting.Accounts.GetAccount(account) as Account; var sender = acct == null ? null : acct[0]; if (sender == null) { Console.WriteLine("[PageProbe] {0} has no character in slot 0; seed the world first", account); return; } var entry = new PageEntry(sender, message, type); PageQueue.Enqueue(entry); entry.Stop(); // keep it in the queue despite the offline sender Console.WriteLine("[PageProbe] enqueued {0} page for {1} (0x{2:X})", type, account, sender.Serial.Value); } } }