Moved buff target type calculation to zone

This commit is contained in:
dannuic 2026-04-30 01:01:02 -06:00
parent fd08c242ae
commit c9857202e2
8 changed files with 30 additions and 37 deletions

View File

@ -47,7 +47,7 @@ public:
bool fade) const = 0; bool fade) const = 0;
virtual std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, 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; 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; virtual void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const = 0;
virtual bool NeedsWearMessage() const = 0; virtual bool NeedsWearMessage() const = 0;
uint32_t ServerToPatchBuffSlot(uint32_t slot) const; uint32_t ServerToPatchBuffSlot(uint32_t slot) const;

View File

@ -4257,22 +4257,10 @@ namespace SoD
} }
// 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC // 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const
{ {
if (packet) { if (packet)
unsigned char* type = &packet->pBuffer[packet->size - 1]; packet->pBuffer[packet->size - 1] = refresh_type;
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;
}
} }
} /*SoD*/ } /*SoD*/

View File

@ -50,7 +50,7 @@ public:
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, 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; 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; void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const override;
}; };
} /*SoD*/ } /*SoD*/

View File

@ -4058,6 +4058,6 @@ std::unique_ptr<EQApplicationPacket> BuffComponent::RefreshBuffs(EmuOpcode opcod
bool BuffComponent::NeedsWearMessage() const { return true; } bool BuffComponent::NeedsWearMessage() const { return true; }
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const {} void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const {}
} /*Titanium*/ } /*Titanium*/

View File

@ -75,7 +75,7 @@ public:
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, 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; bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
bool NeedsWearMessage() const override; bool NeedsWearMessage() const override;
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override; void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const override;
}; };
} /*Titanium*/ } /*Titanium*/

View File

@ -5725,22 +5725,10 @@ std::unique_ptr<EQApplicationPacket> BuffComponent::RefreshBuffs(EmuOpcode opcod
bool BuffComponent::NeedsWearMessage() const { return false; } bool BuffComponent::NeedsWearMessage() const { return false; }
// 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC // 0 = self buff window, 1 = self target window, 2 = pet buff or target window, 4 = group, 5 = PC, 7 = NPC
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const
{ {
if (packet) { if (packet)
unsigned char* type = &packet->pBuffer[packet->size - 2]; packet->pBuffer[packet->size - 2] = refresh_type;
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;
}
} }
} /*TOB*/ } /*TOB*/

View File

@ -73,7 +73,7 @@ public:
std::unique_ptr<EQApplicationPacket> RefreshBuffs(EmuOpcode opcode, Mob* mob, 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; bool buff_timers_suspended, const std::vector<uint32_t>& slots) const override;
bool NeedsWearMessage() const override; bool NeedsWearMessage() const override;
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override; void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, uint8_t refresh_type) const override;
}; };
}; /*TOB*/ }; /*TOB*/

View File

@ -74,6 +74,23 @@ static bool ShouldSendTargetBuffs(Client* c) {
return false; return false;
} }
static void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target)
{
uint8_t type = 0;
if (target->GetID() == source->GetID())
type = 1;
else if (source->IsPet())
type = 2;
else if (target->HasGroup() && source->GetGroup() == target->GetGroup())
type = 4;
else if (source->IsClient())
type = 5;
else
type = 7;
ClientPatch::GetClientComponent<ClientPatch::IBuff>(target)->SetRefreshType(packet, type);
}
void ClientPatch::SendFullBuffRefresh(Mob* sender, bool remove, bool ackreq) { void ClientPatch::SendFullBuffRefresh(Mob* sender, bool remove, bool ackreq) {
bool suspended = zone->BuffTimersSuspended(); bool suspended = zone->BuffTimersSuspended();
std::vector<uint32_t> slots; std::vector<uint32_t> slots;
@ -94,7 +111,7 @@ void ClientPatch::SendFullBuffRefresh(Mob* sender, bool remove, bool ackreq) {
// finally send to all clients targeting the mob, will need to mutate the packet to set the type // 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) { auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) {
GetClientComponent<IBuff>(c)->SetRefreshType(packet, sender, c); SetRefreshType(packet, sender, c);
}; };
QueueClientsByTarget(sender, ackreq, ShouldSendTargetBuffs, mutate)( QueueClientsByTarget(sender, ackreq, ShouldSendTargetBuffs, mutate)(
@ -131,7 +148,7 @@ void ClientPatch::SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, in
} }
auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) { auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) {
GetClientComponent<IBuff>(c)->SetRefreshType(packet, sender, c); SetRefreshType(packet, sender, c);
}; };
QueueClientsByTarget(sender, ackreq, ShouldSendTargetBuffs, mutate)( QueueClientsByTarget(sender, ackreq, ShouldSendTargetBuffs, mutate)(