mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-22 03:18:22 +00:00
[Performance] Clear Wearchange Deduplication Cache
This commit is contained in:
@@ -133,6 +133,7 @@ Mob::Mob(
|
|||||||
m_see_close_mobs_timer(1000),
|
m_see_close_mobs_timer(1000),
|
||||||
m_mob_check_moving_timer(1000),
|
m_mob_check_moving_timer(1000),
|
||||||
bot_attack_flag_timer(10000),
|
bot_attack_flag_timer(10000),
|
||||||
|
m_clear_wearchange_cache_timer(60 * 10 * 1000), // 10 minutes
|
||||||
m_destroying(false)
|
m_destroying(false)
|
||||||
{
|
{
|
||||||
mMovementManager = &MobMovementManager::Get();
|
mMovementManager = &MobMovementManager::Get();
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ public:
|
|||||||
uint16 m_last_wearchange_race_id = 0;
|
uint16 m_last_wearchange_race_id = 0;
|
||||||
// client_id -> slot_id -> key
|
// client_id -> slot_id -> key
|
||||||
std::unordered_map<uint32_t, std::unordered_map<uint8_t, uint64_t>> m_last_seen_wearchange;
|
std::unordered_map<uint32_t, std::unordered_map<uint8_t, uint64_t>> m_last_seen_wearchange;
|
||||||
|
Timer m_clear_wearchange_cache_timer;
|
||||||
|
|
||||||
// Bot attack flag
|
// Bot attack flag
|
||||||
Timer bot_attack_flag_timer;
|
Timer bot_attack_flag_timer;
|
||||||
|
|||||||
@@ -395,6 +395,10 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client)
|
|||||||
|
|
||||||
w->wear_slot_id = material_slot;
|
w->wear_slot_id = material_slot;
|
||||||
|
|
||||||
|
if (m_clear_wearchange_cache_timer.Check()) {
|
||||||
|
m_last_seen_wearchange.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (GetRace() != m_last_wearchange_race_id) {
|
if (GetRace() != m_last_wearchange_race_id) {
|
||||||
m_last_seen_wearchange.clear();
|
m_last_seen_wearchange.clear();
|
||||||
m_last_wearchange_race_id = GetRace();
|
m_last_wearchange_race_id = GetRace();
|
||||||
|
|||||||
Reference in New Issue
Block a user