[Performance] Cull Excess Wearchange Packets

This commit is contained in:
Chris Miles 2025-05-18 13:25:02 -05:00
parent 567d46c3d6
commit 32cd0afa94
6 changed files with 7 additions and 76 deletions

View File

@ -767,8 +767,6 @@ void Client::CompleteConnect()
entity_list.SendAppearanceEffects(this);
entity_list.SendIllusionWearChange(this);
SendWearChangeAndLighting(EQ::textures::LastTexture);
Mob* pet = GetPet();
if (pet) {

View File

@ -4863,25 +4863,6 @@ void EntityList::SendAppearanceEffects(Client *c)
}
}
void EntityList::SendIllusionWearChange(Client *c)
{
if (!c) {
return;
}
for (auto &e : mob_list) {
auto &mob = e.second;
if (mob) {
if (mob == c) {
continue;
}
mob->SendIllusionWearChange(c);
}
}
}
void EntityList::ZoneWho(Client *c, Who_All_Struct *Who)
{
// This is only called for SoF clients, as regular /who is now handled server-side for that client.

View File

@ -413,7 +413,6 @@ public:
void SendNimbusEffects(Client *c);
void SendUntargetable(Client *c);
void SendAppearanceEffects(Client *c);
void SendIllusionWearChange(Client *c);
void DuelMessage(Mob* winner, Mob* loser, bool flee);
void QuestJournalledSayClose(Mob *sender, float dist, const char* mobname, const char* message, Journal::Options &opts);
void GroupMessage(uint32 gid, const char *from, const char *message);

View File

@ -424,7 +424,6 @@ public:
void ApplyHealthTransferDamage(Mob *caster, Mob *target, uint16 spell_id);
void ApplySpellEffectIllusion(int32 spell_id, Mob* caster, int buffslot, int base, int limit, int max);
void ApplyIllusionToCorpse(int32 spell_id, Corpse* new_corpse);
void SendIllusionWearChange(Client* c);
int16 GetItemSlotToConsumeCharge(int32 spell_id, uint32 inventory_slot);
bool CheckItemRaceClassDietyRestrictionsOnCast(uint32 inventory_slot);
bool IsFromTriggeredSpell(EQ::spells::CastingSlot slot, uint32 item_slot = 0xFFFFFFFF);

View File

@ -345,32 +345,16 @@ uint32 NPC::GetEquippedItemFromTextureSlot(uint8 material_slot) const
void Mob::SendArmorAppearance(Client *one_client)
{
/**
* one_client of 0 means sent to all clients
*
* Despite the fact that OP_NewSpawn and OP_ZoneSpawns include the
* armor being worn and its mats, the client doesn't update the display
* on arrival of these packets reliably.
*
* Send Wear changes if mob is a PC race and item is an armor slot.
* The other packets work for primary/secondary.
*/
LogMobAppearance("[{}]", GetCleanName());
if (IsPlayerRace(race)) {
if (!IsClient()) {
for (uint8 slot_id = 0; slot_id <= EQ::textures::materialCount; ++slot_id) {
const auto item = database.GetItem(GetEquippedItemFromTextureSlot(slot_id));
if (item) {
SendWearChange(slot_id, one_client);
}
}
}
}
for (uint8 slot_id = 0; slot_id <= EQ::textures::materialCount; ++slot_id) {
if (GetTextureProfileMaterial(slot_id)) {
bool should_send = GetTextureProfileMaterial(slot_id) != 0;
if (!should_send && IsPlayerRace(race) && !IsClient()) {
should_send = database.GetItem(GetEquippedItemFromTextureSlot(slot_id)) != nullptr;
}
if (should_send) {
SendWearChange(slot_id, one_client);
}
}

View File

@ -1520,9 +1520,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
}
);
caster->SendAppearancePacket(AppearanceType::Size, static_cast<uint32>(caster->GetTarget()->GetSize()));
for (int x = EQ::textures::textureBegin; x <= EQ::textures::LastTintableTexture; x++)
caster->SendWearChange(x);
}
break;
}
@ -4354,10 +4351,6 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
}
);
for (int x = EQ::textures::textureBegin; x <= EQ::textures::LastTintableTexture; x++) {
SendWearChange(x);
}
break;
}
@ -10397,25 +10390,6 @@ void Mob::SetProcLimitTimer(int32 base_spell_id, uint32 proc_reuse_time, int pro
}
}
void Mob::SendIllusionWearChange(Client* c) {
/*
We send this to client on Client::CompleteConnect() to properly update textures of
other mobs in zone with illusions on them.
*/
if (!c) {
return;
}
if (!spellbonuses.Illusion && !itembonuses.Illusion && !aabonuses.Illusion) {
return;
}
for (int x = EQ::textures::textureBegin; x <= EQ::textures::LastTintableTexture; x++) {
SendWearChange(x, c);
}
}
void Mob::ApplyIllusionToCorpse(int32 spell_id, Corpse* new_corpse) {
//Transfers most illusions over to the corpse upon death
@ -10560,10 +10534,6 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
SendAppearancePacket(AppearanceType::Size, race_size);
}
for (int x = EQ::textures::textureBegin; x <= EQ::textures::LastTintableTexture; x++) {
SendWearChange(x);
}
if (buffslot != -1) {
if (
caster == this &&