CAction.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #pragma once
  2. namespace GameAssist {
  3. // 模块图片;
  4. typedef struct __IMG__
  5. {
  6. std::string name; // 名称;
  7. std::string file_path; // 路径;
  8. std::string desc; // 描述;
  9. int nType; // 类型;
  10. };
  11. typedef struct __GACTION__ {
  12. byte byActionType; // 动作类型;
  13. std::string strActionName; // 动作名称;
  14. POINT ptClick;
  15. POINT ptStart;
  16. POINT ptEnd;
  17. }GAction, * pGAction;
  18. typedef struct POINT_NPC
  19. {
  20. POINT ptMap; // npc所在地图坐标;
  21. POINT ptNpc; // npc具体坐标;
  22. }PNPC, * pPNPC;
  23. extern std::map<std::string, POINT> g_mapZYNPC;
  24. extern std::map<std::string, PNPC> g_mapZYNPC2;
  25. // 单击:POINT
  26. // 右击:POINT
  27. // 双击:POINT
  28. // 移动:POINT、POINT
  29. // 拖动:POINT、POINT
  30. // 剪切板:字符串
  31. // 按键:CTRL/ALT/SHIFT + Key;粘贴CTRL+C:用于寻路NPC查找、物品查找
  32. // 地图
  33. // 战斗状态:
  34. // 健康状态:
  35. // 查找物品:
  36. // 查找NPC:
  37. // 查找宝藏:
  38. // 查找上古:
  39. // 查找资源堆:
  40. // 购买物品:
  41. class CAction
  42. {
  43. HWND m_hGameWnd;
  44. static ThreadSection m_ts;
  45. POINT m_ptCur;
  46. public:
  47. // 鼠标移动;
  48. void MouseMove(POINT pt, bool bSetCurPos = true);
  49. void MouseMove(POINT ptStart, POINT ptEnd, bool bSetCurPos = true);
  50. void MouseMoveEx(POINT pt, bool bSetCurPos = true);
  51. void MouseMoveEx(POINT ptStart, POINT ptEnd, bool bSetCurPos = true);
  52. // 鼠标单击;
  53. void MouseClick();
  54. void MouseClick(POINT pt);
  55. // 鼠标双击;
  56. void MouseDbClick();
  57. void MouseDbClick(POINT pt);
  58. // 鼠标右击;
  59. void MouseRClick();
  60. void MouseRClick(POINT pt);
  61. // 鼠标拖动;
  62. void MouseDrag(POINT pt);
  63. // 发送按键;
  64. void SendKey(DWORD key, BOOL bCtrl = FALSE, BOOL bAtl = FALSE, BOOL bShift = FALSE);
  65. public:
  66. CAction(HWND hWnd);
  67. ~CAction();
  68. // 初始NPC坐标;
  69. static void InitNPCInfo();
  70. // 窗口前置;
  71. void SetGameForeground();
  72. // 是否停止走路;
  73. bool IsWalkStop();
  74. // 是否在战斗中;
  75. bool IsFighting();
  76. // 在游戏窗口中查找匹配的图标;
  77. CRect FindMatchIcon(LPCTSTR lpszTemplateImage);
  78. // 是否在指定的地图上;
  79. bool IsOnMap(LPCTSTR lpszTemplateImage);
  80. // 世界地图定位;
  81. void WorldMapPositioning(POINT ptMap);
  82. // 是否等待攻击中;nAttackNPCType 0=镜妖; 1=职业挑战
  83. bool IsWattingAttack(int nAttackNPCType);
  84. // 单击游戏对话框里的选项;
  85. bool ClickDlgSetup(LPCSTR lpszTemplateImage);
  86. // 单击游戏对话框里的多层选项;
  87. bool ClickDlgSetup(std::vector<std::string> vtOptions);
  88. // 查找NPC:通过世界地图来寻路;
  89. bool FindNPCByWorldMap(LPCTSTR lpszNPCName);
  90. // 查找NPC:先定位大概位置,再通过图标查找;
  91. bool FindNPCByIcon(POINT ptMap, LPCTSTR lpszNPCName);
  92. // 查找NPC:定位指定位置后,再相对这个坐标后的位置单击NPC坐标;
  93. bool FindNPCByIconAndPos(LPCTSTR lpszNPCName, POINT ptMap, POINT ptNpc);
  94. // 查找NPC:查找map中的NPC;
  95. bool FindNPCByMap(LPCTSTR lpszNPCName);
  96. // 是否低于SP安全值
  97. bool IsSPBelowSafeValue(BOOL IsRole, BOOL IsIdle, int nSafeValue = 30);
  98. // 是否低于HP安全值
  99. bool IsHPBelowSafeValue(BOOL IsRole, BOOL IsIdle, int nSafeValue = 30);
  100. public:
  101. // 与镜妖战斗;
  102. // bHasSummoner是否有召唤兽;
  103. // nZJType:重击类型;
  104. // bAggressiveSkill:技能是作用在敌人身上还是自己身上; true:敌人, false:自己
  105. void FightingJY(BOOL bHasSummoner, int nZJType, BOOL bAggressiveSkill);
  106. // 与职业医师战斗;
  107. void FightingYS(LPCTSTR lpszSkillName);
  108. // 与职业医师以外的战斗;
  109. void FightingOthers(LPCTSTR lpszName, LPCTSTR lpszSkillName);
  110. // 开宝箱;
  111. void OpenChest(int nTimes=10);
  112. // 周六领礼物;
  113. void GetSaturdayPresents();
  114. void ExerciseSkill(INT nVK_Skill, BOOL bCheckAttack = FALSE);
  115. private:
  116. HANDLE m_hBattleJY;
  117. HANDLE m_hBattleJYEvent;
  118. HANDLE m_hBattleZYTZ;
  119. public:
  120. bool m_bHasSummoner; // 是否有召唤曽;
  121. int m_nSummonerSkillType; // 重击技能类型;
  122. bool m_bTargetOfRoleSkill; // 人物技能作用对象:true = 敌人、 false = 自己;
  123. int m_nSkillShortcutKey; // 技能快捷键;
  124. void StartBattleJY();
  125. void StopBattleJY();
  126. static DWORD WINAPI BattleJYThread(LPVOID lpParam);
  127. void StartSkill();
  128. void StopSkill();
  129. static DWORD WINAPI SkillThread(LPVOID lpParam);
  130. };
  131. };