CombineFunc.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. using XmdsBattleClientBot;
  10. using CommonLang;
  11. namespace XmdsBotTest.Runner
  12. {
  13. public class CombineFunc : BotRunner.RunnerModule
  14. {
  15. List<int> CombineIds = new List<int>();
  16. public CombineFunc() {
  17. module_name = "宝石合成";
  18. }
  19. public CombineFunc(BotRunner r) : base(r)
  20. {
  21. CombineIds.Add(11001);
  22. CombineIds.Add(12001);
  23. CombineIds.Add(13001);
  24. CombineIds.Add(14001);
  25. CombineIds.Add(15001);
  26. }
  27. protected internal override void OnGateBindPlayer(BindPlayerResponse e)
  28. {
  29. base.OnGateBindPlayer(e);
  30. runner.do_gm_add_item("gr1",100);
  31. runner.do_gm_add_item("gy1", 100);
  32. runner.do_gm_add_item("gb1", 100);
  33. runner.do_gm_add_item("gg1", 100);
  34. runner.do_gm_add_item("gp1", 100);
  35. }
  36. protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
  37. {
  38. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  39. {
  40. if (Enable)
  41. {
  42. combineRequest();
  43. }
  44. });
  45. }
  46. private void combineRequest()
  47. {
  48. if (Enable) {
  49. int combineId = bot.Random.Next(0, CombineIds.Count);
  50. client.GameSocket.itemHandler.combineRequest(CombineIds[combineId], 1,0,
  51. (err, rsp) =>
  52. {
  53. });
  54. }
  55. }
  56. [Desc("宝石合成配置")]
  57. [Expandable]
  58. public class Config : ConfigBase
  59. {
  60. [Desc("宝石合成检测间隔")]
  61. public static int CheckIntervalMS = 5000;
  62. public override string ToString()
  63. {
  64. return "宝石合成配置";
  65. }
  66. public override void popG2DPropertyDialog()
  67. {
  68. CommonFroms.G2D.G2DPropertyDialog<CombineFunc.Config>.Show("修改配置", this);
  69. }
  70. }
  71. }
  72. }