Improve auto-hunt navigation, recovery and mounted skill casting

This commit is contained in:
shen
2026-10-01 07:46:44 -07:00
parent 586bae51e4
commit e7f2202a94
14 changed files with 854 additions and 148 deletions
+29 -2
View File
@@ -686,6 +686,8 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
AUTO_HUNT_LOOT,
AUTO_HUNT_RETURN,
AUTO_HUNT_PAUSED,
AUTO_HUNT_REVIVE,
AUTO_HUNT_RECOVER,
};
enum EAutoHuntStopReason
@@ -706,7 +708,7 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
enum
{
AUTO_HUNT_SKILL_SLOT_NUM = 8, // the local quick slots on the taskbar's first page
AUTO_HUNT_SKILL_SLOT_NUM = 8, // legacy config migration only
};
struct SAutoHuntConfig
@@ -717,8 +719,11 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
int iPickup; // EAutoHuntPickup
bool bAttackStone;
bool bAttackBoss;
DWORD dwSkillSlotMask; // bit i = local quick slot i may be cast
DWORD dwSkillSlotMask; // legacy config migration only
int iGatherCount; // cloak pull: max 3/10/20 server monster groups; 0 = off
bool bAutoRevive = false;
bool bDismountSkill = true;
std::vector<DWORD> vecSkillIndices; // independent of the quick bar
};
void AutoHunt_SetEnabled(bool isEnable);
@@ -730,6 +735,10 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
int AutoHunt_GetGatheredCount();
bool AutoHunt_HandleServerCommand(const char* command); // PORT: server-authoritative cloak pull replies
bool AutoHunt_HasNoPotion(bool isHP);
std::vector<DWORD> AutoHunt_GetAvailableSkills();
void AutoHunt_SetSkills(const std::vector<DWORD>& indices);
void AutoHunt_OnDeath();
int AutoHunt_GetMountState() const { return m_iAutoHuntMountState; }
const SAutoHuntConfig& AutoHunt_GetConfig();
void AutoHunt_SetConfig(const SAutoHuntConfig& c_rkConfig);
@@ -742,6 +751,13 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
bool __AutoHunt_UpdateBuff(CInstanceBase& rkInstMain, float fNow);
void __AutoHunt_UpdateAttackSkill(CInstanceBase& rkInstMain, CInstanceBase& rkInstVictim, float fNow);
bool __AutoHunt_IsSkillReady(DWORD dwSkillSlot, CPythonSkill::TSkillData** ppSkillData);
bool __AutoHunt_CastSkill(DWORD slot, float now);
bool __AutoHunt_UpdateMount(CInstanceBase& main, float now);
bool __AutoHunt_UpdateRecovery(CInstanceBase& main, float now);
bool __AutoHunt_BuildPath(const TPixelPosition& goal, float arrival, std::vector<TPixelPosition>& path);
bool __AutoHunt_MoveTo(const TPixelPosition& goal, float arrival, float now);
void __AutoHunt_ResetMovement();
void __AutoHunt_MigrateSkills();
bool __AutoHunt_IsTargetAllowed(CInstanceBase& main, CInstanceBase& target); // PORT extension
bool __AutoHunt_RequestPull(CInstanceBase& main, float now); // PORT extension
DWORD __AutoHunt_FindTarget(CInstanceBase& rkInstMain, float fNow);
@@ -753,6 +769,17 @@ class CPythonPlayer : public CSingleton<CPythonPlayer>, public IAbstractPlayer
void __AutoHunt_LoadConfig();
void __AutoHunt_SaveConfig();
bool m_isAutoHuntLegacySkills = false;
int m_iAutoHuntMountState = 0; // 0 normal, 1 wait dismount, 2 cast, 3 wait remount
DWORD m_dwAutoHuntPendingSkill = 0;
float m_fAutoHuntMountDeadline = 0, m_fAutoHuntMountNextTime = 0;
float m_fAutoHuntMountCastEnd = 0;
float m_fAutoHuntReviveNextTime = 0;
std::vector<TPixelPosition> m_vecAutoHuntPath;
TPixelPosition m_kAutoHuntPathGoal = {}, m_kAutoHuntPathLastPosition = {};
DWORD m_dwAutoHuntScanTarget = 0;
float m_fAutoHuntTargetScanTime = 0;
float m_fAutoHuntPathTime = 0, m_fAutoHuntPathMoveTime = 0;
SAutoHuntConfig m_kAutoHuntConfig;
bool m_isAutoHuntConfigLoaded;
int m_eAutoHuntState;