TeamDungeonFunc.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using pomelo.connector;
  7. using CommonLang.Property;
  8. using pomelo.area;
  9. namespace XmdsBotTest.Runner
  10. {
  11. public class TeamDungeonFunc : BotRunner.RunnerModule
  12. {
  13. public TeamDungeonFunc() {
  14. module_name = "组队副本";
  15. }
  16. public TeamDungeonFunc(BotRunner r) : base(r)
  17. {
  18. }
  19. protected internal override void OnGateBindPlayer(BindPlayerResponse e)
  20. {
  21. base.OnGateBindPlayer(e);
  22. }
  23. protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  24. {
  25. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  26. {
  27. autoJoinTeam();
  28. });
  29. }
  30. private static int[] TEAM_DUNGEONS = new int[]
  31. {
  32. 2010,2020,2030,2040,2050,2060
  33. };
  34. public override void autoJoinTeamRequest()
  35. {
  36. client.GameSocket.teamHandler.autoJoinTeamRequest(TEAM_DUNGEONS[bot.Random.Next(TEAM_DUNGEONS.Length)], 1,
  37. (err, rsp) =>
  38. { });
  39. }
  40. protected override int rand()
  41. {
  42. return Config.RandNum;
  43. }
  44. [Desc("组队副本配置")]
  45. [Expandable]
  46. public class Config : ConfigBase
  47. {
  48. [Desc("组队副本检测间隔")]
  49. public static int CheckIntervalMS = 5000;
  50. [Desc("组队副本随机数")]
  51. public static int RandNum = 15;
  52. public override string ToString()
  53. {
  54. return "组队副本配置";
  55. }
  56. public override void popG2DPropertyDialog()
  57. {
  58. CommonFroms.G2D.G2DPropertyDialog<TeamDungeonFunc.Config>.Show("修改配置", this);
  59. }
  60. }
  61. }
  62. }