Removed any 'legacy' functions from the new code

This commit is contained in:
dannuic 2026-04-27 17:52:45 -06:00
parent f3634e54ae
commit d16c1b2483
14 changed files with 141 additions and 132 deletions

View File

@ -24,14 +24,9 @@ public:
IBuff() = default;
virtual ~IBuff() = default;
// TODO: I think all of the legacy stuff can just be rolled into regular buff functions and the call sites modified
virtual std::unique_ptr<EQApplicationPacket> MakeLegacyBuffsPacket(Mob* mob, bool for_target,
bool clear_buffs) const = 0;
virtual std::unique_ptr<EQApplicationPacket> LegacyBuffDefinition(Mob* mob, Buffs_Struct& buff, int slot) const = 0; // TODO: add the buffs definition packet
virtual std::unique_ptr<EQApplicationPacket> BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const = 0;
virtual std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, int32_t timer, bool remove,
virtual std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const = 0;
virtual void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const = 0;
};

View File

@ -35,6 +35,7 @@
#include <iostream>
#include <sstream>
#include "zone/client.h"
#include "zone/mob.h"
@ -4290,21 +4291,15 @@ namespace SoD
namespace Buff {
std::unique_ptr<EQApplicationPacket> SoD::MakeLegacyBuffsPacket(Mob* mob, bool for_target, bool clear_buffs) const
std::unique_ptr<EQApplicationPacket> SoD::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
// SoD only supports target refresh, not self refresh packets
if (for_target) {
if (opcode == OP_RefreshTargetBuffs) {
uint32 count = 0;
uint32 buff_count;
// for self we want all buffs, for target, we want to skip song window buffs
// since NPCs and pets don't have a song window, we still see it for them :P
if (for_target) {
buff_count = (clear_buffs) ? 0 : mob->GetMaxBuffSlots();
}
else {
buff_count = mob->GetMaxTotalSlots();
}
buff_count = mob->GetMaxTotalSlots();
Buffs_Struct* buffs = mob->GetBuffs();
@ -4314,7 +4309,7 @@ std::unique_ptr<EQApplicationPacket> SoD::MakeLegacyBuffsPacket(Mob* mob, bool f
}
}
auto outapp = std::make_unique<EQApplicationPacket>(OP_RefreshTargetBuffs,
auto outapp = std::make_unique<EQApplicationPacket>(opcode,
sizeof(BuffIcon_Struct) + sizeof(BuffIconEntry_Struct) * count);
BuffIcon_Struct *buff = (BuffIcon_Struct*)outapp->pBuffer;
@ -4322,12 +4317,8 @@ std::unique_ptr<EQApplicationPacket> SoD::MakeLegacyBuffsPacket(Mob* mob, bool f
buff->count = count;
buff->all_buffs = 1;
buff->tic_timer = mob->GetRemainingTicTime();
// there are more types, the client doesn't seem to really care though. The others are also currently hard to fill in here ...
// (see comment in common/eq_packet_structs.h)
if (for_target)
buff->type = mob->IsClient() ? 5 : 7;
else
buff->type = 0;
// (see comment in common/eq_packet_structs.h), mutated in SetRefreshType
buff->type = mob->IsClient() ? 5 : 7;
buff->name_lengths = 0; // hacky shit
uint32 index = 0;
@ -4349,4 +4340,22 @@ std::unique_ptr<EQApplicationPacket> SoD::MakeLegacyBuffsPacket(Mob* mob, bool f
return nullptr;
}
// 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC
void SoD::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const
{
if (packet) {
BuffIcon_Struct *buff = (BuffIcon_Struct*)packet->pBuffer;
if (target->GetID() == source->GetID())
buff->type = 1;
else if (target->IsPet())
buff->type = 2;
else if (target->HasGroup() && source->GetGroup() == target->GetGroup())
buff->type = 4;
else if (target->IsClient())
buff->type = 5;
else
buff->type = 7;
}
}
} // namespace Buff

View File

@ -69,8 +69,9 @@ public:
SoD() = default;
~SoD() override = default;
std::unique_ptr<EQApplicationPacket> MakeLegacyBuffsPacket(Mob* mob, bool for_target,
bool clear_buffs) const override;
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override;
};
} // namespace Buff

View File

@ -4019,12 +4019,9 @@ void Titanium::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) c
} // namespace Message
namespace Buff {
std::unique_ptr<EQApplicationPacket> Titanium::MakeLegacyBuffsPacket(Mob* mob, bool for_target, bool clear_buffs) const
{
return nullptr;
}
std::unique_ptr<EQApplicationPacket> Titanium::LegacyBuffDefinition(Mob* mob, Buffs_Struct& buff, int slot) const
std::unique_ptr<EQApplicationPacket> Titanium::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const
{
auto outapp = std::make_unique<EQApplicationPacket>(OP_BuffDefinition, sizeof(SpellBuffPacket_Struct));
SpellBuffPacket_Struct* sbf = (SpellBuffPacket_Struct*) outapp->pBuffer;
@ -4052,18 +4049,12 @@ std::unique_ptr<EQApplicationPacket> Titanium::LegacyBuffDefinition(Mob* mob, Bu
sbf->buff.z = buff.caston_z;
sbf->slotid = slot;
sbf->bufffade = 0;
sbf->bufffade = fade;
return outapp;
}
std::unique_ptr<EQApplicationPacket> Titanium::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const
{
return nullptr;
}
std::unique_ptr<EQApplicationPacket> Titanium::RefreshBuffs(EmuOpcode opcode, Mob* mob, int32_t timer, bool remove,
std::unique_ptr<EQApplicationPacket> Titanium::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
return nullptr;

View File

@ -85,13 +85,9 @@ public:
Titanium() = default;
~Titanium() override = default;
std::unique_ptr<EQApplicationPacket> MakeLegacyBuffsPacket(Mob* mob, bool for_target,
bool clear_buffs) const override;
std::unique_ptr<EQApplicationPacket> LegacyBuffDefinition(Mob* mob, Buffs_Struct& buff, int slot) const override;
std::unique_ptr<EQApplicationPacket>
BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const override;
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, int32_t timer, bool remove,
std::unique_ptr<EQApplicationPacket> BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const override;
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override;
};

View File

@ -5613,7 +5613,6 @@ std::unique_ptr<EQApplicationPacket> TOB::InterruptSpellOther(Mob* sender, uint3
} // namespace Message
namespace Buff {
// std::unique_ptr<EQApplicationPacket> TOB::MakeLegacyBuffsPacket(Mob* mob, bool for_target, bool clear_buffs) const { return nullptr; }
std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const
{
@ -5641,7 +5640,7 @@ std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_S
affect->affect.flags = 0;
affect->affect.spell_id = buff.spellid;
affect->affect.duration = buff.ticsremaining;
affect->affect.initial_duration = buff.ticsremaining; // this isn't correct, it's the total duration
affect->affect.initial_duration = buff.ticsremaining; // TODO: this isn't correct, it's the total duration
affect->affect.hit_count = buff.hit_number;
affect->affect.viral_timer = 0;
affect->affect.modifier = static_cast<float>(buff.instrument_mod) / 10.f;
@ -5667,7 +5666,7 @@ std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_S
return packet;
}
std::unique_ptr<EQApplicationPacket> TOB::RefreshBuffs(EmuOpcode opcode, Mob* mob, int32_t timer, bool remove,
std::unique_ptr<EQApplicationPacket> TOB::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
Buffs_Struct* buffs = mob->GetBuffs();
@ -5692,8 +5691,8 @@ std::unique_ptr<EQApplicationPacket> TOB::RefreshBuffs(EmuOpcode opcode, Mob* mo
SerializeBuffer buffer(buffer_size);
buffer.WriteUInt32(mob->GetID());
buffer.WriteInt32(timer);
buffer.WriteUInt8(slots.empty() ? 1 : 0); // 1 indicates all buffs on the player (0 to add or remove a single buff)
buffer.WriteInt32(mob->GetRemainingTicTime());
buffer.WriteUInt8(slots.empty() ? 1 : 0); // 1 indicates all buffs on the mob (0 to add or remove a single buff)
buffer.WriteUInt16(send_slots.size());
for (uint32_t slot : send_slots) {
@ -5713,18 +5712,20 @@ std::unique_ptr<EQApplicationPacket> TOB::RefreshBuffs(EmuOpcode opcode, Mob* mo
// 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC
void TOB::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const
{
unsigned char* type = &packet->pBuffer[packet->size - 2];
if (packet) {
unsigned char* type = &packet->pBuffer[packet->size - 2];
if (target->GetID() == source->GetID())
*type = 1;
else if (target->IsPet())
*type = 2;
else if (target->HasGroup() && source->GetGroup() == target->GetGroup())
*type = 4;
else if (target->IsClient())
*type = 5;
else
*type = 7;
if (target->GetID() == source->GetID())
*type = 1;
else if (target->IsPet())
*type = 2;
else if (target->HasGroup() && source->GetGroup() == target->GetGroup())
*type = 4;
else if (target->IsClient())
*type = 5;
else
*type = 7;
}
}
} // namespace Buff

View File

@ -65,12 +65,9 @@ public:
TOB() = default;
~TOB() override = default;
// std::unique_ptr<EQApplicationPacket> MakeLegacyBuffsPacket(Mob* mob, bool for_target,
// bool clear_buffs) const override;
std::unique_ptr<EQApplicationPacket>
BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const override;
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, int32_t timer, bool remove,
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override;
};

View File

@ -5239,21 +5239,15 @@ namespace UF
namespace Buff {
std::unique_ptr<EQApplicationPacket> UF::MakeLegacyBuffsPacket(Mob* mob, bool for_target, bool clear_buffs) const
std::unique_ptr<EQApplicationPacket> UF::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
// UF introduced the self update buff packet
uint32 count = 0;
uint32 buff_count;
// for self we want all buffs, for target, we want to skip song window buffs
// since NPCs and pets don't have a song window, we still see it for them :P
if (for_target) {
buff_count = (clear_buffs) ? 0 : mob->GetMaxBuffSlots();
}
else {
buff_count = mob->GetMaxTotalSlots();
}
buff_count = mob->GetMaxTotalSlots();
Buffs_Struct* buffs = mob->GetBuffs();
@ -5264,7 +5258,7 @@ std::unique_ptr<EQApplicationPacket> UF::MakeLegacyBuffsPacket(Mob* mob, bool fo
}
//Create it for a targeting window, else create it for a create buff packet.
auto outapp = std::make_unique<EQApplicationPacket>(for_target ? OP_RefreshTargetBuffs : OP_RefreshBuffs,
auto outapp = std::make_unique<EQApplicationPacket>(opcode,
sizeof(BuffIcon_Struct) + sizeof(BuffIconEntry_Struct) * count);
BuffIcon_Struct *buff = (BuffIcon_Struct*)outapp->pBuffer;
@ -5272,12 +5266,8 @@ std::unique_ptr<EQApplicationPacket> UF::MakeLegacyBuffsPacket(Mob* mob, bool fo
buff->count = count;
buff->all_buffs = 1;
buff->tic_timer = mob->GetRemainingTicTime();
// there are more types, the client doesn't seem to really care though. The others are also currently hard to fill in here ...
// (see comment in common/eq_packet_structs.h)
if (for_target)
buff->type = mob->IsClient() ? 5 : 7;
else
buff->type = 0;
buff->type = mob->IsClient() ? 5 : 7;
buff->name_lengths = 0; // hacky shit
uint32 index = 0;

View File

@ -69,8 +69,8 @@ public:
UF() = default;
~UF() override = default;
std::unique_ptr<EQApplicationPacket> MakeLegacyBuffsPacket(Mob* mob, bool for_target,
bool clear_buffs) const override;
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
};
} // namespace Buff

View File

@ -935,8 +935,7 @@ void Client::CompleteConnect()
delete pack;
}
if (IsClient())
Buff::SendLegacyBuffsPacket(CastToClient(), this, false);
Buff::SendFullBuffRefresh(this);
// TODO: load these states
// We at least will set them to the correct state for now
@ -15108,7 +15107,7 @@ void Client::Handle_OP_TargetMouse(const EQApplicationPacket *app)
if (nt)
{
SetTarget(nt);
Buff::SendLegacyBuffsPacket(this, nt);
Buff::SendFullBuffRefresh(nt);
}
else
{

View File

@ -2309,8 +2309,7 @@ void Client::ClearHover()
entity_list.QueueClients(this, outapp, false);
safe_delete(outapp);
if (IsClient())
Buff::SendLegacyBuffsPacket(CastToClient(), this, false);
Buff::SendFullBuffRefresh(this);
dead = false;
}

View File

@ -19,6 +19,7 @@ namespace ClientPatch {
using ClientList = std::unordered_map<uint16, Client*>;
template<typename Obj> using ComponentGetter = std::function<Obj*(const Client*)>;
using SendPredicate = std::function<bool(Client*)>;
using MutatePacket = std::function<void(std::unique_ptr<EQApplicationPacket>&, Client*)>;
template <typename Fun, typename Obj, typename... Args>
requires std::is_member_function_pointer_v<Fun>
@ -106,7 +107,7 @@ static void FastQueuePacket(Client* c, Fun fun, Obj* obj, Args&&... args)
}
}
static auto QueueClientsByTarget(Mob* sender, bool ackreq, bool HoTT, const SendPredicate& ShouldSend)
static auto QueueClientsByTarget(Mob* sender, bool ackreq, bool HoTT, const SendPredicate& should_send, const MutatePacket& mutate)
{
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, const ComponentGetter<Obj> component, Args&&... args)
requires std::is_member_function_pointer_v<Fun>
@ -115,17 +116,18 @@ static auto QueueClientsByTarget(Mob* sender, bool ackreq, bool HoTT, const Send
std::array<std::unique_ptr<EQApplicationPacket>, EQ::versions::ClientVersionCount> build_packets;
for (auto [_, c] : entity_list.GetClientList()) {
if (c != sender) {
Mob* Target = c->GetTarget();
if ((Target == sender || (HoTT && Target != nullptr && Target->GetTarget() == sender)) && ShouldSend(c)) {
auto& packet = build_packets.at(static_cast<uint32_t>(c->ClientVersion()));
if (!packet)
if (auto comp = component(c); comp != nullptr)
packet = std::invoke(fun, comp, std::forward<Args>(args)...);
Mob* Target = c->GetTarget();
if ((Target == sender || (HoTT && Target != nullptr && Target->GetTarget() == sender)) &&
(Target == c || should_send(c))) {
auto& packet = build_packets.at(static_cast<uint32_t>(c->ClientVersion()));
if (!packet)
if (auto comp = component(c); comp != nullptr)
packet = std::invoke(fun, comp, std::forward<Args>(args)...);
if (packet)
c->QueuePacket(packet.get(), ackreq, Client::CLIENT_CONNECTED);
}
mutate(packet, c);
if (packet)
c->QueuePacket(packet.get(), ackreq, Client::CLIENT_CONNECTED);
}
}
}
@ -203,7 +205,7 @@ static bool ShouldSendTargetBuffs(Client* c)
// to a client (c) for targeted mobs
if (c->GetGM() || RuleB(Spells, AlwaysSendTargetsBuffs)) { // this rule bypasses LAA abilities, always return true
if (c->GetGM()) {
if (!c->EntityVariableExists(SEE_BUFFS_FLAG)) {
if (!c->EntityVariableExists(SEE_BUFFS_FLAG)) { // This flag just ensures that the following message is only sent once
c->Message(Chat::White,
"Your GM flag allows you to always see your targets' buffs.");
c->SetEntityVariable(SEE_BUFFS_FLAG, "1");
@ -233,22 +235,66 @@ static bool ShouldSendTargetBuffs(Client* c)
return false;
}
inline void SendLegacyBuffsPacket(Client* c, Mob* sender, bool for_target = true, bool clear_buffs = false)
inline void SendFullBuffRefresh(Mob* sender, bool remove = false, bool ackreq = true)
{
ClientPatch::FastQueuePacket(c, &IBuff::MakeLegacyBuffsPacket, GetComponent(c), sender, for_target, clear_buffs);
bool suspended = zone->BuffTimersSuspended();
std::vector<uint32_t> slots;
// first, send to self if self is client
if (sender->IsClient()) {
Client* c = sender->CastToClient();
ClientPatch::FastQueuePacket(c, &IBuff::RefreshBuffs, GetComponent(c), OP_RefreshBuffs, sender, false, suspended, slots);
}
// next, send to owner if self is a pet to a client
if (sender->IsPet() && sender->GetOwner()->IsClient()) {
if (Mob* owner = sender->GetOwner(); owner != nullptr && owner->IsClient()) {
Client* c = owner->CastToClient();
ClientPatch::FastQueuePacket(c, &IBuff::RefreshBuffs, GetComponent(c), OP_RefreshPetBuffs, sender, false, suspended, slots);
}
}
// finally send to all clients targeting the mob, will need to mutate the packet to set the type
auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) {
GetComponent(c)->SetRefreshType(packet, sender, c);
};
ClientPatch::QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, false, suspended, slots);
// if we have remove set, this will clear any target windows that shouldn't see the buffs
if (remove)
ClientPatch::QueueClientsByTarget(sender, ackreq, true,
[](Client* c) { return !ShouldSendTargetBuffs(c); }, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, true, suspended, slots);
}
inline void SendLegacyBuffsPacketToClients(Mob* sender, bool ackreq = true, bool HoTT = false, bool clear_buffs = false)
inline void SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, int slot, bool remove = false, bool ackreq = true)
{
ClientPatch::QueueClientsByTarget(sender, ackreq, HoTT, ShouldSendTargetBuffs)(
&IBuff::MakeLegacyBuffsPacket, GetComponent, sender, true, clear_buffs);
}
bool suspended = zone->BuffTimersSuspended();
std::vector slots = { static_cast<uint32_t>(slot) };
inline void SendCharmDroppedBuffsPacket(Mob* sender, bool ackreq = true)
{
// dropping charm means that we want to remove the buff list from clients that shouldn't see non-pet buffs
ClientPatch::QueueClientsByTarget(sender, ackreq, false, [](Client* c) { return !ShouldSendTargetBuffs(c); })(
&IBuff::MakeLegacyBuffsPacket, GetComponent, sender, true, true);
// first, send to self if self is client, which takes the definition and the refresh
if (sender->IsClient()) {
Client* c = sender->CastToClient();
ClientPatch::FastQueuePacket(c, &IBuff::BuffDefinition, GetComponent(c), sender, buff, slot, remove);
ClientPatch::FastQueuePacket(c, &IBuff::RefreshBuffs, GetComponent(c), OP_RefreshBuffs, sender, remove, suspended, slots);
}
// the rest of the buff packets do not take the definition, only the refresh
if (sender->IsPet() && sender->GetOwner()->IsClient()) {
if (Mob* owner = sender->GetOwner(); owner != nullptr && owner->IsClient()) {
Client* c = owner->CastToClient();
ClientPatch::FastQueuePacket(c, &IBuff::RefreshBuffs, GetComponent(c), OP_RefreshPetBuffs, sender, remove, suspended, slots);
}
}
auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) {
GetComponent(c)->SetRefreshType(packet, sender, c);
};
ClientPatch::QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, remove, suspended, slots);
}
} // namespace Buff

View File

@ -152,8 +152,7 @@ bool Mob::SpellEffect(Mob* caster, int32 spell_id, float partial, int level_over
if (spells[spell_id].endurance_upkeep > 0)
SetEndurUpkeep(true);
if (IsClient())
Buff::SendLegacyBuffsPacket(CastToClient(), this, false);
Buff::SendFullBuffRefresh(this);
}
if (IsClient()) {
@ -812,7 +811,7 @@ bool Mob::SpellEffect(Mob* caster, int32 spell_id, float partial, int level_over
// This was done in AddBuff, but we were not a pet yet, so
// the target windows didn't get updated.
Buff::SendLegacyBuffsPacketToClients(this);
Buff::SendFullBuffRefresh(this);
if(caster->IsClient()){
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
@ -4432,7 +4431,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
// no longer see the buffs on the old pet.
// QueueClientsByTarget preserves GM and leadership cases.
Buff::SendCharmDroppedBuffsPacket(this);
Buff::SendFullBuffRefresh(this, true);
if (IsAIControlled())
{
@ -4656,17 +4655,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
RemoveNimbusEffect(spells[buffs[slot].spellid].nimbus_effect);
buffs[slot].spellid = SPELL_UNKNOWN;
if(IsPet() && GetOwner() && GetOwner()->IsClient()) {
SendPetBuffsToClient();
}
Buff::SendLegacyBuffsPacketToClients(this);
if (IsClient() && GetTarget() == this)
Buff::SendLegacyBuffsPacket(CastToClient(), this);
if (IsClient())
Buff::SendLegacyBuffsPacket(CastToClient(), this, false);
Buff::SendSingleBuffChange(this, buffs[slot], slot, true);
Buff::SendFullBuffRefresh(this);
// we will eventually call CalcBonuses() even if we skip it right here, so should correct itself if we still have them
degenerating_effects = false;

View File

@ -3741,13 +3741,8 @@ int Mob::AddBuff(Mob *caster, int32 spell_id, int duration, int32 level_override
}
LogSpells("Buff [{}] added to slot [{}] with caster level [{}]", spell_id, emptyslot, caster_level);
if (IsPet() && GetOwner() && GetOwner()->IsClient())
SendPetBuffsToClient();
Buff::SendLegacyBuffsPacketToClients(this);
if (IsClient() && GetTarget() == this)
Buff::SendLegacyBuffsPacket(CastToClient(), this);
Buff::SendSingleBuffChange(this, buffs[emptyslot], emptyslot);
Buff::SendFullBuffRefresh(this);
// recalculate bonuses since we stripped/added buffs
CalcBonuses();