123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #pragma once
- namespace GameAssist {
- // 模块图片;
- typedef struct __META_IMG__
- {
- std::string name; // 名称;
- std::string file_path; // 路径;
- std::string desc; // 描述;
- int x = -1;
- int y = -1;
- int width = 0;
- int height = 0;
- cv::Mat img;
- void LoadImage()
- {
- if (PathFileExists(file_path.c_str()))
- {
- img = cv::imread(file_path.c_str(), cv::IMREAD_COLOR);
- }
- }
- }METAGRAPH, *LPMETAGRAPH;
- typedef struct __GACTION__ {
- byte byActionType; // 动作类型;
- std::string strActionName; // 动作名称;
- POINT ptClick;
- POINT ptStart;
- POINT ptEnd;
- }GAction, * pGAction;
- typedef struct POINT_NPC
- {
- POINT ptMap; // npc所在地图坐标;
- POINT ptNpc; // npc具体坐标;
- }PNPC, * pPNPC;
- extern std::map<std::string, POINT> g_mapZYNPC;
- extern std::map<std::string, PNPC> g_mapZYNPC2;
- extern std::map<std::string, METAGRAPH> g_mapMetaGraph;
- extern void LoadMetaGraph();
- // 单击:POINT
- // 右击:POINT
- // 双击:POINT
- // 移动:POINT、POINT
- // 拖动:POINT、POINT
- // 剪切板:字符串
- // 按键:CTRL/ALT/SHIFT + Key;粘贴CTRL+C:用于寻路NPC查找、物品查找
- // 地图
- // 战斗状态:
- // 健康状态:
- // 查找物品:
- // 查找NPC:
- // 查找宝藏:
- // 查找上古:
- // 查找资源堆:
- // 购买物品:
- class CAction
- {
- HWND m_hGameWnd;
- static ThreadSection m_ts;
- POINT m_ptCur;
- public:
- // 鼠标移动;
- void MouseMove(POINT pt, bool bSetCurPos = true);
- void MouseMove(POINT ptStart, POINT ptEnd, bool bSetCurPos = true);
- void MouseMoveEx(POINT pt, bool bSetCurPos = true);
- void MouseMoveEx(POINT ptStart, POINT ptEnd, bool bSetCurPos = true);
- // 鼠标单击;
- void MouseClick();
- void MouseClick(POINT pt);
- // 鼠标双击;
- void MouseDbClick();
- void MouseDbClick(POINT pt);
- // 鼠标右击;
- void MouseRClick();
- void MouseRClick(POINT pt);
- // 鼠标拖动;
- void MouseDrag(POINT pt);
- // 发送按键;
- void SendKey(DWORD key, BOOL bCtrl = FALSE, BOOL bAtl = FALSE, BOOL bShift = FALSE);
- public:
- CAction(HWND hWnd);
- ~CAction();
- // 初始NPC坐标;
- static void InitNPCInfo();
- // 窗口前置;
- void SetGameForeground();
- // 是否停止走路;
- bool IsWalkStop();
- // 是否在战斗中;
- bool IsFighting();
- // 在游戏窗口中查找匹配的图标;
- CRect FindMatchIcon(LPCTSTR lpszTemplateImage);
- // 是否在指定的地图上;
- bool IsOnMap(LPCTSTR lpszTemplateImage);
- // 世界地图定位;
- void WorldMapPositioning(POINT ptMap);
- // 是否等待攻击中;nAttackNPCType 0=镜妖; 1=职业挑战
- bool IsWattingAttack(int nAttackNPCType);
- // 单击游戏对话框里的选项;
- bool ClickDlgSetup(LPCSTR lpszTemplateImage);
- // 单击游戏对话框里的多层选项;
- bool ClickDlgSetup(std::vector<std::string> vtOptions);
- // 查找NPC:通过世界地图来寻路;
- bool FindNPCByWorldMap(LPCTSTR lpszNPCName);
- // 查找NPC:先定位大概位置,再通过图标查找;
- bool FindNPCByIcon(POINT ptMap, LPCTSTR lpszNPCName);
- // 查找NPC:定位指定位置后,再相对这个坐标后的位置单击NPC坐标;
- bool FindNPCByIconAndPos(LPCTSTR lpszNPCName, POINT ptMap, POINT ptNpc);
- // 查找NPC:查找map中的NPC;
- bool FindNPCByMap(LPCTSTR lpszNPCName);
- // 是否低于SP安全值
- bool IsSPBelowSafeValue(BOOL IsRole, BOOL IsIdle, int nSafeValue = 30);
- // 是否低于HP安全值
- bool IsHPBelowSafeValue(BOOL IsRole, BOOL IsIdle, int nSafeValue = 30);
- public:
- // 与镜妖战斗;
- // bHasSummoner是否有召唤兽;
- // nZJType:重击类型;
- // bAggressiveSkill:技能是作用在敌人身上还是自己身上; true:敌人, false:自己
- void FightingJY(BOOL bHasSummoner, int nZJType, BOOL bAggressiveSkill);
- // 与职业医师战斗;
- void FightingYS(LPCTSTR lpszSkillName);
- // 与职业医师以外的战斗;
- void FightingOthers(LPCTSTR lpszName, LPCTSTR lpszSkillName);
- // 开宝箱;
- void OpenChest(int nTimes=10);
- // 周六领礼物;
- void GetSaturdayPresents();
- void ExerciseSkill(INT nVK_Skill, BOOL bCheckAttack = FALSE);
- private:
- HANDLE m_hBattleJY;
- HANDLE m_hBattleJYEvent;
- HANDLE m_hBattleZYTZ;
- public:
- bool m_bHasSummoner; // 是否有召唤曽;
- int m_nSummonerSkillType; // 重击技能类型;
- bool m_bTargetOfRoleSkill; // 人物技能作用对象:true = 敌人、 false = 自己;
- int m_nSkillShortcutKey; // 技能快捷键;
- void StartBattleJY();
- void StopBattleJY();
- static DWORD WINAPI BattleJYThread(LPVOID lpParam);
- void StartSkill();
- void StopSkill();
- static DWORD WINAPI SkillThread(LPVOID lpParam);
- void StartRepeat();
- void StopRepeat();
- static DWORD WINAPI RepeatThread(LPVOID lpParam);
- };
- };
|