BuyMallProto.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 BuyMallProto : BotRunner.RunnerModule
  12. {
  13. public BuyMallProto() {
  14. module_name = "商城购买";
  15. }
  16. public BuyMallProto(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.AddTimeDelayMS(Config.CheckIntervalMS, (t) =>
  26. {
  27. if (Enable)
  28. {
  29. }
  30. });
  31. layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
  32. {
  33. if (Enable)
  34. {
  35. buyMallItemRequest();
  36. }
  37. });
  38. }
  39. private void buyMallItemRequest()
  40. {
  41. client.GameSocket.shopMallHandler.buyMallItemRequest("1", Config.BuyCount, "",0,
  42. (err, rsp) =>
  43. {
  44. if(err != null && !err.Equals(""))
  45. Console.WriteLine("xxxxxxxxxxxxx : " + err);
  46. });
  47. }
  48. [Desc("商城购买配置")]
  49. [Expandable]
  50. public class Config : ConfigBase
  51. {
  52. [Desc("商城购买检测间隔")]
  53. public static int CheckIntervalMS = 5000;
  54. [Desc("商城购买玉神石数量")]
  55. public static int BuyCount = 1;
  56. public override string ToString()
  57. {
  58. return "商城购买配置";
  59. }
  60. public override void popG2DPropertyDialog()
  61. {
  62. CommonFroms.G2D.G2DPropertyDialog<BuyMallProto.Config>.Show("修改配置", this);
  63. }
  64. }
  65. }
  66. }