[Performance] Re-use OP_Animation packet (#4621)

This commit is contained in:
Chris Miles 2025-01-27 15:32:30 -06:00 committed by GitHub
parent bbfed8300c
commit 59f645b5c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 14 deletions

View File

@ -2559,16 +2559,12 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
const uint8 killed_level = GetLevel();
if (GetClass() == Class::LDoNTreasure) { // open chest
auto outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct));
auto a = (Animation_Struct*) outapp->pBuffer;
static EQApplicationPacket p(OP_Animation, sizeof(Animation_Struct));
auto a = (Animation_Struct*) p.pBuffer;
a->spawnid = GetID();
a->action = 0x0F;
a->speed = 10;
entity_list.QueueCloseClients(this, outapp);
safe_delete(outapp);
entity_list.QueueCloseClients(this, &p);
}
auto app = new EQApplicationPacket(OP_Death, sizeof(Death_Struct));

View File

@ -125,7 +125,7 @@ Mob::Mob(
tmHidden(-1),
mitigation_ac(0),
m_specialattacks(eSpecialAttacks::None),
attack_anim_timer(500),
attack_anim_timer(100),
position_update_melee_push_timer(500),
hate_list_cleanup_timer(6000),
m_scan_close_mobs_timer(6000),
@ -3540,24 +3540,21 @@ void Mob::DoAnim(const int animation_id, int animation_speed, bool ackreq, eqFil
return;
}
auto outapp = new EQApplicationPacket(OP_Animation, sizeof(Animation_Struct));
auto *a = (Animation_Struct *) outapp->pBuffer;
static EQApplicationPacket p(OP_Animation, sizeof(Animation_Struct));
auto a = (Animation_Struct*) p.pBuffer;
a->spawnid = GetID();
a->action = animation_id;
a->speed = animation_speed ? animation_speed : 10;
entity_list.QueueCloseClients(
this, /* Sender */
outapp, /* Packet */
&p, /* Packet */
false, /* Ignore Sender */
RuleI(Range, Anims),
0, /* Skip this mob */
ackreq, /* Packet ACK */
filter /* eqFilterType filter */
);
safe_delete(outapp);
}
void Mob::ShowBuffs(Client* c) {