using System; using Server.Accounting; using Server.Mobiles; namespace Server.Custom { /// /// Fires a handful of the bridge's event streams by doing real things to the world, so the /// emit path and JSON shape can be verified without a game client attached. /// /// These are genuine triggers, not synthetic EventSink.Invoke calls: DepositGold raises /// AccountGoldChange from Account.cs:1635, the Fame/Karma setters raise theirs from /// Mobile.cs:7121,7141, and World.Save raises the save boundaries from World.cs:1151,1202. /// Calling Invoke directly would prove only that the handler compiles. /// /// Test scaffolding. Never deployed. Mutates the world (gold, fame, karma) and saves. /// Run only against a seeded throwaway world with a backup. /// public static class BridgeEventProbe { public static void Initialize() { if (Config.Get("Bridge.EventProbeOnStart", false)) EventSink.ServerStarted += () => Timer.DelayCall(TimeSpan.FromSeconds(4.0), Run); } private static void Run() { try { var acct = Accounting.Accounts.GetAccount("seed_000") as Account; if (acct == null) { Console.WriteLine("[EventProbe] no seed_000 account; seed the world first"); return; } var pm = acct[0] as PlayerMobile; if (pm == null) { Console.WriteLine("[EventProbe] seed_000 has no character in slot 0"); return; } Console.WriteLine("[EventProbe] firing gold.change ..."); acct.DepositGold(12345); Console.WriteLine("[EventProbe] firing fame.change ..."); pm.Fame = pm.Fame + 100; Console.WriteLine("[EventProbe] firing karma.change ..."); pm.Karma = pm.Karma - 50; Console.WriteLine("[EventProbe] firing world.save.before / world.save.after ..."); World.Save(); Console.WriteLine("[EventProbe] done"); } catch (Exception ex) { Console.WriteLine("[EventProbe] FAILED: " + ex); } } } }