[Performance] Auto Idle / AFK (#4903)

* [Performance] AFK Client Packet Filtering

* Player feedback

* Update client_packet.cpp

* Fixes

* Streamline updates to SetAFK

* Decouple idling and AFK and manual AFK

* Reset clock timer when we take AFK or idle off

* Exclude bard songs in non combat zones from resetting timer

* GM exclusion adjustments
This commit is contained in:
Chris Miles
2025-05-22 13:08:32 -05:00
committed by GitHub
parent 53cc2de459
commit 567d46c3d6
8 changed files with 273 additions and 22 deletions
+22 -3
View File
@@ -501,9 +501,19 @@ public:
void Kick(const std::string &reason);
void WorldKick();
inline uint8 GetAnon() const { return m_pp.anon; }
inline uint8 GetAFK() const { return AFK; }
inline uint8 GetAFK() const { return m_is_afk; }
void SetAnon(uint8 anon_flag);
inline Client* ResetAFKTimer() {
if (!RuleB(Character, EnableAutoAFK)) {
return this;
}
m_afk_reset = true;
m_last_moved = std::chrono::steady_clock::now();
return this;
};
void SetAFK(uint8 afk_flag);
inline bool IsIdle() { return m_is_idle; }
inline PlayerProfile_Struct& GetPP() { return m_pp; }
inline ExtendedProfile_Struct& GetEPP() { return m_epp; }
inline EQ::InventoryProfile& GetInv() { return m_inv; }
@@ -2062,7 +2072,8 @@ private:
uint8 LFGToLevel;
bool LFGMatchFilter;
char LFGComments[64];
bool AFK;
bool m_is_afk = false;
bool m_is_manual_afk = false;
bool auto_attack;
bool auto_fire;
bool runmode;
@@ -2216,7 +2227,12 @@ private:
glm::vec4 m_last_position_before_bulk_update;
Timer m_client_bulk_npc_pos_update_timer;
Timer m_position_update_timer;
void CheckSendBulkNpcPositions();
void CheckSendBulkNpcPositions(bool force = false);
// afk
bool m_is_idle = false;
bool m_afk_reset = false; // used to trigger next-tic afk reset
std::chrono::steady_clock::time_point m_last_moved = std::chrono::steady_clock::now();
void BulkSendInventoryItems();
@@ -2410,6 +2426,9 @@ public:
const std::string &GetMailKey() const;
void ShowZoneShardMenu();
void Handle_OP_ChangePetName(const EQApplicationPacket *app);
bool IsFilteredAFKPacket(const EQApplicationPacket *p);
void CheckAutoIdleAFK(PlayerPositionUpdateClient_Struct *p);
void SyncWorldPositionsToClient(bool ignore_idle = false);
};
#endif