ModuleReconnect.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using CommonAI.ZoneClient;
  2. using CommonLang.Reflection;
  3. namespace ZeusBotTest.Runner
  4. {
  5. public class ModuleReconnect : BotRunner.RunnerModule
  6. {
  7. public ModuleReconnect(BotRunner r) : base(r)
  8. {
  9. }
  10. protected internal override void OnBattleActorReady(ZoneLayer layer, ZoneActor actor)
  11. {
  12. layer.AddTimePeriodicMS(bot.Random.Next(Config.IntervalMS_Min, Config.IntervalMS_Max), (t) =>
  13. {
  14. if (Enable)
  15. {
  16. runner.reconnect();
  17. }
  18. });
  19. }
  20. [Desc("重连配置")]
  21. [Expandable]
  22. public class Config
  23. {
  24. [Desc("重连间隔")]
  25. public static int IntervalMS_Min = 10000;
  26. [Desc("重连间隔")]
  27. public static int IntervalMS_Max = 20000;
  28. public override string ToString()
  29. {
  30. return "重连配置";
  31. }
  32. }
  33. }
  34. }