CAction.h 4.3 KB

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