Updated class naming

This commit is contained in:
dannuic 2026-04-29 13:50:36 -06:00
parent 966ca5cf07
commit a54f93e70f
23 changed files with 309 additions and 410 deletions

View File

@ -16,7 +16,7 @@ class Mob;
class EQApplicationPacket;
class Buffs_Struct;
namespace Buff {
namespace ClientPatch {
class IBuff
{

View File

@ -25,7 +25,7 @@ class Client;
class Mob;
class EQApplicationPacket;
namespace Message {
namespace ClientPatch {
template<typename... Args>
concept AllConstChar = (std::is_convertible_v<Args, const char*> && ...);

View File

@ -36,32 +36,32 @@ struct ClientComponents
{
switch (version) {
case Version::TOB:
buffComponent = std::make_unique<Buff::TOB>();
messageComponent = std::make_unique<Message::TOB>();
buffComponent = std::make_unique<TOB::BuffComponent>();
messageComponent = std::make_unique<TOB::MessageComponent>();
break;
case Version::RoF2:
buffComponent = std::make_unique<Buff::UF>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<UF::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
case Version::RoF:
buffComponent = std::make_unique<Buff::UF>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<UF::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
case Version::UF:
buffComponent = std::make_unique<Buff::UF>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<UF::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
case Version::SoD:
buffComponent = std::make_unique<Buff::SoD>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<SoD::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
case Version::SoF:
buffComponent = std::make_unique<Buff::Titanium>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<Titanium::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
case Version::Titanium:
buffComponent = std::make_unique<Buff::Titanium>();
messageComponent = std::make_unique<Message::Titanium>();
buffComponent = std::make_unique<Titanium::BuffComponent>();
messageComponent = std::make_unique<Titanium::MessageComponent>();
break;
default:
break;
@ -69,8 +69,8 @@ struct ClientComponents
}
const Version version;
std::unique_ptr<Buff::IBuff> buffComponent;
std::unique_ptr<Message::IMessage> messageComponent;
std::unique_ptr<ClientPatch::IBuff> buffComponent;
std::unique_ptr<ClientPatch::IMessage> messageComponent;
};
// this array must be in the same order as the Version enum because it converts Version to index directly
@ -88,12 +88,14 @@ static const std::array<ClientComponents, EQ::versions::ClientVersionCount> s_pa
}
};
const std::unique_ptr<Buff::IBuff>& GetBuffComponent(Version version)
template<>
const std::unique_ptr<ClientPatch::IBuff>& GetComponent(Version version)
{
return s_patches.at(static_cast<uint32_t>(version)).buffComponent;
}
const std::unique_ptr<Message::IMessage>& GetMessageComponent(Version version)
template<>
const std::unique_ptr<ClientPatch::IMessage>& GetComponent(Version version)
{
return s_patches.at(static_cast<uint32_t>(version)).messageComponent;
}

View File

@ -7,10 +7,26 @@
#include "common/emu_versions.h"
#include <memory>
namespace Buff { class IBuff; }
namespace Message { class IMessage; }
#include "zone/client.h"
namespace ClientPatch {
class IBuff;
class IMessage;
}
// store all static functions for the different patches here
// store all static functions for the different patches here, this can return nullptr for unsupported patches
const std::unique_ptr<Buff::IBuff>& GetBuffComponent(EQ::versions::ClientVersion version);
const std::unique_ptr<Message::IMessage>& GetMessageComponent(EQ::versions::ClientVersion version);
template <typename Component>
const std::unique_ptr<Component>& GetComponent(EQ::versions::ClientVersion version);
template <>
const std::unique_ptr<ClientPatch::IBuff>& GetComponent(EQ::versions::ClientVersion version);
template <>
const std::unique_ptr<ClientPatch::IMessage>& GetComponent(EQ::versions::ClientVersion version);
template <typename Component>
static Component* GetClientComponent(const Client* client)
{
return GetComponent<Component>(client->GetClientVersion()).get();
}

View File

@ -22,30 +22,23 @@
class EQStreamIdentifier;
namespace RoF
namespace RoF {
extern void Register(EQStreamIdentifier& into);
extern void Reload();
class Strategy : public StructStrategy
{
public:
Strategy();
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "rof_ops.h"
};
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "rof_ops.h"
};
} /*RoF*/

View File

@ -22,30 +22,23 @@
class EQStreamIdentifier;
namespace RoF2
namespace RoF2 {
extern void Register(EQStreamIdentifier& into);
extern void Reload();
class Strategy : public StructStrategy
{
public:
Strategy();
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "rof2_ops.h"
};
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "rof2_ops.h"
};
}; /*RoF2*/

View File

@ -4287,12 +4287,10 @@ namespace SoD
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*SoD*/
namespace Buff {
std::unique_ptr<EQApplicationPacket> SoD::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
std::unique_ptr<EQApplicationPacket> BuffComponent::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 (opcode == OP_RefreshTargetBuffs) {
@ -4341,7 +4339,7 @@ std::unique_ptr<EQApplicationPacket> SoD::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 SoD::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const
{
if (packet) {
BuffIcon_Struct *buff = (BuffIcon_Struct*)packet->pBuffer;
@ -4358,4 +4356,4 @@ void SoD::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* sour
}
}
} // namespace Buff
} /*SoD*/

View File

@ -22,45 +22,34 @@
class EQStreamIdentifier;
namespace SoD
{
namespace SoD {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
extern void Register(EQStreamIdentifier& into);
extern void Reload();
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "sod_ops.h"
};
} /*SoD*/
namespace Buff {
class SoD : public Titanium
class Strategy : public StructStrategy
{
public:
SoD() = default;
~SoD() override = default;
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "sod_ops.h"
};
class BuffComponent : public Titanium::BuffComponent
{
public:
BuffComponent() = default;
~BuffComponent() override = default;
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
} /*SoD*/

View File

@ -22,30 +22,23 @@
class EQStreamIdentifier;
namespace SoF
namespace SoF {
extern void Register(EQStreamIdentifier& into);
extern void Reload();
class Strategy : public StructStrategy
{
public:
Strategy();
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "sof_ops.h"
};
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "sof_ops.h"
};
} /*SoF*/

View File

@ -23,27 +23,20 @@ class EQStreamIdentifier;
namespace TEMPLATE {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
extern void Register(EQStreamIdentifier& into);
extern void Reload();
class Strategy : public StructStrategy
{
public:
Strategy();
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
//magic macro to declare our opcodes
#include "ss_declare.h"
#include "TEMPLATE_ops.h"
};
protected:
virtual std::string Describe() const;
virtual const EQClientVersion ClientVersion() const;
//magic macro to declare our opcodes
#include "ss_declare.h"
#include "TEMPLATE_ops.h"
};
};

View File

@ -3921,10 +3921,8 @@ namespace Titanium
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*Titanium*/
namespace Message {
std::unique_ptr<EQApplicationPacket> Titanium::Simple(uint32_t color, uint32_t id) const
std::unique_ptr<EQApplicationPacket> MessageComponent::Simple(uint32_t color, uint32_t id) const
{
uint32_t string_id = ResolveID(id);
if (string_id > 0) {
@ -3940,7 +3938,7 @@ std::unique_ptr<EQApplicationPacket> Titanium::Simple(uint32_t color, uint32_t i
return nullptr;
}
std::unique_ptr<EQApplicationPacket> Titanium::Formatted(
std::unique_ptr<EQApplicationPacket> MessageComponent::Formatted(
uint32_t color, uint32_t id, const std::array<const char*, 9>& args) const
{
uint32_t string_id = ResolveID(id);
@ -3968,7 +3966,7 @@ std::unique_ptr<EQApplicationPacket> Titanium::Formatted(
return nullptr;
}
std::unique_ptr<EQApplicationPacket> Titanium::InterruptSpell(uint32_t message, uint32_t spawn_id,
std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpell(uint32_t message, uint32_t spawn_id,
const char* spell_link) const
{
auto outapp = std::make_unique<EQApplicationPacket>(OP_InterruptCast, sizeof(InterruptCast_Struct));
@ -3980,7 +3978,7 @@ std::unique_ptr<EQApplicationPacket> Titanium::InterruptSpell(uint32_t message,
return outapp;
}
std::unique_ptr<EQApplicationPacket> Titanium::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id,
std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id,
const char* name,
const char* spell_link) const
{
@ -3993,14 +3991,14 @@ std::unique_ptr<EQApplicationPacket> Titanium::InterruptSpellOther(Mob* sender,
}
// A value of 0 means that the string isn't mapped in this client, valid string ids start at 1
uint32_t Titanium::ResolveID(uint32_t id) const
uint32_t MessageComponent::ResolveID(uint32_t id) const
{
// passthrough — string IDs are defined at the base client level;
// override in patches where IDs need remapping
return id;
}
void Titanium::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const
void MessageComponent::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const
{
switch (id) {
case SPELL_FIZZLE:
@ -4016,11 +4014,7 @@ void Titanium::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) c
}
}
} // namespace Message
namespace Buff {
std::unique_ptr<EQApplicationPacket> Titanium::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
std::unique_ptr<EQApplicationPacket> BuffComponent::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const
{
auto outapp = std::make_unique<EQApplicationPacket>(OP_BuffDefinition, sizeof(SpellBuffPacket_Struct));
@ -4054,12 +4048,12 @@ std::unique_ptr<EQApplicationPacket> Titanium::BuffDefinition(Mob* mob, const Bu
return outapp;
}
std::unique_ptr<EQApplicationPacket> Titanium::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
std::unique_ptr<EQApplicationPacket> BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
return nullptr;
}
void Titanium::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const {}
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const {}
} // namespace Buff
} /*Titanium*/

View File

@ -23,42 +23,30 @@
class EQStreamIdentifier;
namespace Titanium
{
namespace Titanium {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
extern void Register(EQStreamIdentifier& into);
extern void Reload();
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "titanium_ops.h"
};
} /*Titanium*/
// out-going message packets
namespace Message {
class Titanium : public IMessage
class Strategy : public StructStrategy
{
public:
Titanium() = default;
~Titanium() override = default;
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "titanium_ops.h"
};
class MessageComponent : public ClientPatch::IMessage
{
public:
MessageComponent() = default;
~MessageComponent() override = default;
std::unique_ptr<EQApplicationPacket> Simple(uint32_t color, uint32_t id) const override;
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
@ -75,15 +63,11 @@ protected:
virtual void ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const;
};
} // namespace Message
namespace Buff {
class Titanium : public IBuff
class BuffComponent : public ClientPatch::IBuff
{
public:
Titanium() = default;
~Titanium() override = default;
BuffComponent() = default;
~BuffComponent() override = default;
std::unique_ptr<EQApplicationPacket> BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot,
bool fade) const override;
@ -92,5 +76,5 @@ public:
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override;
};
} // namespace Buff
} /*Titanium*/

View File

@ -5478,16 +5478,13 @@ namespace TOB
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*TOB*/
namespace Message {
struct TOBStringIDs
{
static constexpr uint32_t DisarmedTrap = 1458; // You successfully disarmed the trap
};
uint32_t TOB::ResolveID(uint32_t id) const
uint32_t MessageComponent::ResolveID(uint32_t id) const
{
switch (id) {
case YOU_FLURRY:
@ -5531,11 +5528,11 @@ uint32_t TOB::ResolveID(uint32_t id) const
case DISARMED_TRAP:
return TOBStringIDs::DisarmedTrap;
default:
return Titanium::ResolveID(id);
return Titanium::MessageComponent::ResolveID(id);
}
}
void TOB::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const
void MessageComponent::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const
{
switch (id) {
case SPELL_FIZZLE:
@ -5545,12 +5542,12 @@ void TOB::ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const
// take all arguments (spell link)
break;
default:
Titanium::ResolveArguments(id, args);
Titanium::MessageComponent::ResolveArguments(id, args);
break;
}
}
std::unique_ptr<EQApplicationPacket> TOB::Formatted(uint32_t color, uint32_t id,
std::unique_ptr<EQApplicationPacket> MessageComponent::Formatted(uint32_t color, uint32_t id,
const std::array<const char*, 9>& args) const
{
uint32_t string_id = ResolveID(id);
@ -5583,7 +5580,7 @@ std::unique_ptr<EQApplicationPacket> TOB::Formatted(uint32_t color, uint32_t id,
return nullptr;
}
std::unique_ptr<EQApplicationPacket> TOB::InterruptSpell(uint32_t message, uint32_t spawn_id,
std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpell(uint32_t message, uint32_t spawn_id,
const char* spell_link) const
{
auto outapp = std::make_unique<EQApplicationPacket>(OP_InterruptCast, sizeof(InterruptCast_Struct) + strlen(spell_link) + 1);
@ -5596,7 +5593,7 @@ std::unique_ptr<EQApplicationPacket> TOB::InterruptSpell(uint32_t message, uint3
return outapp;
}
std::unique_ptr<EQApplicationPacket> TOB::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id,
std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id,
const char* name,
const char* spell_link) const
{
@ -5610,21 +5607,19 @@ std::unique_ptr<EQApplicationPacket> TOB::InterruptSpellOther(Mob* sender, uint3
return outapp;
}
} // namespace Message
namespace Buff {
std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const
std::unique_ptr<EQApplicationPacket> BuffComponent::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const
{
auto packet = std::make_unique<EQApplicationPacket>(OP_BuffDefinition, sizeof(::TOB::structs::EQAffectPacket_Struct));
auto affect = reinterpret_cast<::TOB::structs::EQAffectPacket_Struct*>(packet->pBuffer);
auto packet = std::make_unique<EQApplicationPacket>(OP_BuffDefinition, sizeof(structs::EQAffectPacket_Struct));
auto affect = reinterpret_cast<structs::EQAffectPacket_Struct*>(packet->pBuffer);
// base packet
affect->entity_id = mob->GetID();
affect->unknown004 = 0;
affect->slot_id = ::TOB::ServerToTOBBuffSlot(slot);
affect->slot_id = ServerToTOBBuffSlot(slot);
affect->buff_fade = fade ? 1 : 2; // 1 is remove, 2 is modify, 3 is add (only seen 1 and 2 sent)
memset(&affect->affect, 0, sizeof(affect->affect));
// affect slots
for (int affect_slot = 0; affect_slot < 6; ++affect_slot) {
// all of this is unknown, just what we've seen
@ -5633,22 +5628,24 @@ std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_S
affect->affect.slots[affect_slot].value = 0; // this is always 0
}
// affect info
affect->affect.caster_id.Id = buff.casterid;
affect->affect.caster_id.WorldId = RuleI(World, Id);
affect->affect.caster_id.Reserved = 0;
affect->affect.flags = 0;
affect->affect.spell_id = buff.spellid;
affect->affect.duration = buff.ticsremaining;
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;
affect->affect.y = static_cast<float>(buff.caston_y);
affect->affect.x = static_cast<float>(buff.caston_x);
affect->affect.z = static_cast<float>(buff.caston_z);
affect->affect.type = 2;
affect->affect.level = buff.casterlevel > 0 ? buff.casterlevel : mob->GetLevel();
if (!fade) {
// affect info
affect->affect.caster_id.Id = buff.casterid;
affect->affect.caster_id.WorldId = RuleI(World, Id);
affect->affect.caster_id.Reserved = 0;
affect->affect.flags = 0;
affect->affect.spell_id = buff.spellid;
affect->affect.duration = buff.ticsremaining;
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;
affect->affect.y = static_cast<float>(buff.caston_y);
affect->affect.x = static_cast<float>(buff.caston_x);
affect->affect.z = static_cast<float>(buff.caston_z);
affect->affect.type = 2;
affect->affect.level = buff.casterlevel > 0 ? buff.casterlevel : mob->GetLevel();
}
//no idea if these are right; eqlib doesn't seem to know either
if (buff.dot_rune > 0)
@ -5666,7 +5663,7 @@ std::unique_ptr<EQApplicationPacket> TOB::BuffDefinition(Mob* mob, const Buffs_S
return packet;
}
std::unique_ptr<EQApplicationPacket> TOB::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
std::unique_ptr<EQApplicationPacket> BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
{
Buffs_Struct* buffs = mob->GetBuffs();
@ -5710,7 +5707,7 @@ 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
void BuffComponent::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const
{
if (packet) {
unsigned char* type = &packet->pBuffer[packet->size - 2];
@ -5728,4 +5725,4 @@ void TOB::SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* sour
}
}
} // namespace Buff
} /*TOB*/

View File

@ -5,42 +5,30 @@
class EQStreamIdentifier;
namespace TOB
{
namespace TOB {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier& into);
extern void Reload();
extern void Register(EQStreamIdentifier& into);
extern void Reload();
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "tob_ops.h"
};
}; /*TOB*/
namespace Message {
class TOB : public Titanium
class Strategy : public StructStrategy
{
public:
TOB() = default;
~TOB() override = default;
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "tob_ops.h"
};
class MessageComponent : public Titanium::MessageComponent
{
public:
MessageComponent() = default;
~MessageComponent() override = default;
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
const std::array<const char*, 9>& args) const override;
@ -55,15 +43,11 @@ protected:
void ResolveArguments(uint32_t id, std::array<const char*, 9>& args) const override;
};
} // namespace Message
namespace Buff {
class TOB : public UF
class BuffComponent : public UF::BuffComponent
{
public:
TOB() = default;
~TOB() override = default;
BuffComponent() = default;
~BuffComponent() override = default;
std::unique_ptr<EQApplicationPacket>
BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const override;
@ -72,4 +56,4 @@ public:
void SetRefreshType(std::unique_ptr<EQApplicationPacket>& packet, Mob* source, Client* target) const override;
};
} // namespace Buff
}; /*TOB*/

View File

@ -5235,12 +5235,10 @@ namespace UF
// we're a normal buff
return index; // as long as we guard against bad slots server side, we should be fine
}
} /*UF*/
namespace Buff {
std::unique_ptr<EQApplicationPacket> UF::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove,
bool buff_timers_suspended, const std::vector<uint32_t>& slots) const
std::unique_ptr<EQApplicationPacket> BuffComponent::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
@ -5286,4 +5284,4 @@ std::unique_ptr<EQApplicationPacket> UF::RefreshBuffs(EmuOpcode opcode, Mob* mob
return outapp;
}
} // namespace Buff
} /*UF*/

View File

@ -22,44 +22,33 @@
class EQStreamIdentifier;
namespace UF
{
namespace UF {
//these are the only public member of this namespace.
extern void Register(EQStreamIdentifier &into);
extern void Reload();
extern void Register(EQStreamIdentifier& into);
extern void Reload();
//you should not directly access anything below..
//I just dont feel like making a seperate header for it.
class Strategy : public StructStrategy {
public:
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "uf_ops.h"
};
}; /*UF*/
namespace Buff {
class UF : public SoD
class Strategy : public StructStrategy
{
public:
UF() = default;
~UF() override = default;
Strategy();
protected:
virtual std::string Describe() const;
virtual const EQ::versions::ClientVersion ClientVersion() const;
//magic macro to declare our opcode processors
#include "ss_declare.h"
#include "uf_ops.h"
};
class BuffComponent : public SoD::BuffComponent
{
public:
BuffComponent() = default;
~BuffComponent() override = default;
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
}; /*UF*/

View File

@ -3811,10 +3811,10 @@ void Client::MessageString(uint32 type, uint32 string_id, uint32 distance)
return;
if (distance > 0)
Message::CloseMessageString(this, false, static_cast<float>(distance))(
ClientPatch::CloseMessageString(this, false, static_cast<float>(distance))(
type, string_id);
else
Message::MessageString(this, type, string_id);
ClientPatch::MessageString(this, type, string_id);
}
//
@ -3843,10 +3843,10 @@ void Client::MessageString(uint32 type, uint32 string_id, const char* message1,
type = 4;
if (distance > 0)
Message::CloseMessageString(this, false, static_cast<float>(distance))(type, string_id, message1,
ClientPatch::CloseMessageString(this, false, static_cast<float>(distance))(type, string_id, message1,
message2, message3, message4, message5, message6, message7, message8, message9);
else
Message::MessageString(this, type, string_id, message1, message2, message3, message4, message5,
ClientPatch::MessageString(this, type, string_id, message1, message2, message3, message4, message5,
message6, message7, message8, message9);
}
@ -6326,7 +6326,7 @@ void Client::SuspendMinion(int value)
if(value >= 1)
{
CurrentPet->SetPetState(m_suspendedminion.Buffs, m_suspendedminion.Items);
Buff::SendFullBuffRefresh(CurrentPet);
ClientPatch::SendFullBuffRefresh(CurrentPet);
}
CurrentPet->CalcBonuses();
@ -8930,7 +8930,7 @@ int Client::GetQuiverHaste(int delay)
return (pi->GetItem()->BagWR * 0.0025f * delay) + 1;
}
void Client::SendColoredText(uint32 color, std::string message)
void Client::SendColoredText(uint32 color, const std::string& message)
{
// arbitrary size limit
if (message.size() > 512) // live does send this with empty strings sometimes ...

View File

@ -355,7 +355,7 @@ public:
const char *message7 = nullptr, const char *message8 = nullptr,
const char *message9 = nullptr);
void Tell_StringID(uint32 string_id, const char *who, const char *message);
void SendColoredText(uint32 color, std::string message);
void SendColoredText(uint32 color, const std::string& message);
void SendTraderItem(uint32 item_id,uint16 quantity, TraderRepository::Trader &trader);
void DoBazaarSearch(BazaarSearchCriteria_Struct search_criteria);
uint16 FindTraderItem(int32 SerialNumber,uint16 Quantity);

View File

@ -760,7 +760,7 @@ void Client::CompleteConnect()
Mob* pet = GetPet();
if (pet) {
pet->SendWearChangeAndLighting(EQ::textures::LastTexture);
Buff::SendFullBuffRefresh(pet);
ClientPatch::SendFullBuffRefresh(pet);
}
if (GetGroup())
@ -935,7 +935,7 @@ void Client::CompleteConnect()
delete pack;
}
Buff::SendFullBuffRefresh(this);
ClientPatch::SendFullBuffRefresh(this);
// TODO: load these states
// We at least will set them to the correct state for now
@ -15107,7 +15107,7 @@ void Client::Handle_OP_TargetMouse(const EQApplicationPacket *app)
if (nt)
{
SetTarget(nt);
Buff::SendFullBuffRefresh(nt);
ClientPatch::SendFullBuffRefresh(nt);
}
else
{

View File

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

View File

@ -17,7 +17,7 @@
namespace ClientPatch {
using ClientList = std::unordered_map<uint16, Client*>;
template<typename Obj> using ComponentGetter = std::function<Obj*(const Client*)>;
template<typename Obj> using ComponentGetter = Obj*(*)(const Client*); //std::function<Obj*(const Client*)>;
using SendPredicate = std::function<bool(Client*)>;
using MutatePacket = std::function<void(std::unique_ptr<EQApplicationPacket>&, Client*)>;
@ -35,7 +35,7 @@ static void QueuePacket(Client* c, Fun fun, Obj* obj, Args&&... args)
// packet generator queue functions
static auto QueueClients(Mob* sender, bool ignore_sender = false, bool ackreq = true)
{
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, const ComponentGetter<Obj>& component, Args&&... args)
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, ComponentGetter<Obj> component, Args&&... args)
requires std::is_member_function_pointer_v<Fun>
{
std::array<std::unique_ptr<EQApplicationPacket>, EQ::versions::ClientVersionCount> build_packets;
@ -61,7 +61,7 @@ static auto QueueCloseClients(
{
if (distance <= 0) distance = static_cast<float>(zone->GetClientUpdateRange());
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, const ComponentGetter<Obj>& component, Args&&... args)
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, ComponentGetter<Obj> component, Args&&... args)
requires std::is_member_function_pointer_v<Fun>
{
if (sender == nullptr) {
@ -109,7 +109,7 @@ static void FastQueuePacket(Client* c, Fun fun, Obj* obj, Args&&... args)
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)
return [=]<typename Fun, typename Obj, typename... Args>(Fun fun, ComponentGetter<Obj> component, Args&&... args)
requires std::is_member_function_pointer_v<Fun>
{
if (sender != nullptr) {
@ -128,32 +128,22 @@ static auto QueueClientsByTarget(Mob* sender, bool ackreq, bool HoTT, const Send
if (packet)
c->QueuePacket(packet.get(), ackreq, Client::CLIENT_CONNECTED);
}
}
}
}
};
}
} // namespace ClientPatch
// Helpers for the Message interface to send message packets
namespace Message {
// this can return nullptr when the component doesn't exist for the version
static std::function GetComponent = [](const Client* c) -> IMessage* {
return GetMessageComponent(c->GetClientVersion()).get();
};
// Helper functions to wrap the packet construction in sends
template <AllConstChar... Args>
requires (sizeof...(Args) <= 9)
void MessageString(Client* c, uint32_t type, uint32_t id, Args&&... args)
{
if constexpr (sizeof...(Args) == 0) {
ClientPatch::QueuePacket(c, &IMessage::Simple, GetComponent(c), type, id);
QueuePacket(c, &IMessage::Simple, GetClientComponent<IMessage>(c), type, id);
} else {
std::array<const char*, 9> a = {args...};
ClientPatch::QueuePacket(c, &IMessage::Formatted, GetComponent(c), type, id, a);
QueuePacket(c, &IMessage::Formatted, GetClientComponent<IMessage>(c), type, id, a);
}
}
@ -165,40 +155,31 @@ static auto CloseMessageString(
return [=]<AllConstChar... Args>(uint32_t type, uint32_t id, Args&&... args)
requires (sizeof...(Args) <= 9)
{
auto queue_close_clients = ClientPatch::QueueCloseClients(sender, ignore_sender, distance, skipped_mob,
auto queue_close_clients = QueueCloseClients(sender, ignore_sender, distance, skipped_mob,
is_ack_required, filter);
if constexpr (sizeof...(Args) == 0) {
return queue_close_clients(&IMessage::Simple, GetComponent, type, id);
return queue_close_clients(&IMessage::Simple, GetClientComponent<IMessage>, type, id);
} else {
std::array<const char*, 9> a = {args...};
return queue_close_clients(&IMessage::Formatted, GetComponent, type, id, a);
return queue_close_clients(&IMessage::Formatted, GetClientComponent<IMessage>, type, id, a);
}
};
}
inline void InterruptSpell(Client* c, uint32_t message, uint32_t spawn_id, const char* spell_link)
{
ClientPatch::QueuePacket(c, &IMessage::InterruptSpell, GetComponent(c), message, spawn_id, spell_link);
QueuePacket(c, &IMessage::InterruptSpell, GetClientComponent<IMessage>(c), message, spawn_id, spell_link);
}
inline void InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id, const char* name,
const char* spell_link)
{
ClientPatch::QueueCloseClients(sender, true, RuleI(Range, SongMessages), nullptr, true,
QueueCloseClients(sender, true, RuleI(Range, SongMessages), nullptr, true,
sender->IsClient() ? FilterPCSpells : FilterNPCSpells)(
&IMessage::InterruptSpellOther, GetComponent, sender, message, spawn_id, name, spell_link);
&IMessage::InterruptSpellOther, GetClientComponent<IMessage>, sender, message, spawn_id, name, spell_link);
}
} // namespace Message
// helper functions to handle sending buffs
namespace Buff {
static std::function GetComponent = [](const Client* c) -> IBuff* {
return GetBuffComponent(c->GetClientVersion()).get();
};
static bool ShouldSendTargetBuffs(Client* c)
{
// this function checks for server rules against LAA and GM status to determine if a buffs packet should be sent
@ -243,30 +224,30 @@ inline void SendFullBuffRefresh(Mob* sender, bool remove = false, bool ackreq =
// 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);
FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(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);
FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(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);
GetClientComponent<IBuff>(c)->SetRefreshType(packet, sender, c);
};
ClientPatch::QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, false, suspended, slots);
QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetClientComponent<IBuff>, 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,
QueueClientsByTarget(sender, ackreq, true,
[](Client* c) { return !ShouldSendTargetBuffs(c); }, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, true, suspended, slots);
&IBuff::RefreshBuffs, GetClientComponent<IBuff>, OP_RefreshTargetBuffs, sender, true, suspended, slots);
}
inline void SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, int slot, bool remove = false, bool ackreq = true)
@ -277,36 +258,31 @@ inline void SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, int slot
// 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);
// FastQueuePacket(c, &IBuff::BuffDefinition, GetClientComponent<IBuff>(c), sender, buff, slot, false);
// FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(c), OP_RefreshBuffs, sender, remove, suspended, slots);
// FastQueuePacket(c, &IBuff::BuffDefinition, GetClientComponent<IBuff>(c), sender, buff, slot, remove);
// FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(c), OP_RefreshBuffs, sender, remove, suspended, slots);
FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(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);
FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(c), OP_RefreshPetBuffs, sender, remove, suspended, slots);
}
}
auto mutate = [sender](std::unique_ptr<EQApplicationPacket>& packet, Client* c) {
GetComponent(c)->SetRefreshType(packet, sender, c);
GetClientComponent<IBuff>(c)->SetRefreshType(packet, sender, c);
};
ClientPatch::QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetComponent, OP_RefreshTargetBuffs, sender, remove, suspended, slots);
QueueClientsByTarget(sender, ackreq, false, ShouldSendTargetBuffs, mutate)(
&IBuff::RefreshBuffs, GetClientComponent<IBuff>, OP_RefreshTargetBuffs, sender, remove, suspended, slots);
// the client doesn't automatically do this for some reason (RoF2? I think this is in TOB)
// TODO: hook this up to QueueClients, or figure out if there's another missing packet to display the fade text
if (remove && sender->IsClient())
{
const char *fadetext = spells[buff.spellid].spell_fades;
auto outapp = std::make_unique<EQApplicationPacket>(OP_ColoredText, sizeof(ColoredText_Struct) + strlen(fadetext));
ColoredText_Struct *bfm = (ColoredText_Struct *) outapp->pBuffer;
bfm->color = Chat::Spells;
memcpy(bfm->msg, fadetext, strlen(fadetext));
sender->CastToClient()->QueuePacket(outapp.get());
}
// the client doesn't automatically do this for some reason, only send it to the sender
// if (remove && sender->IsClient())
// sender->CastToClient()->SendColoredText(Chat::Spells, spells[buff.spellid].spell_fades);
}
} // namespace Buff
} // namespace ClientPatch

View File

@ -152,7 +152,7 @@ bool Mob::SpellEffect(Mob* caster, int32 spell_id, float partial, int level_over
if (spells[spell_id].endurance_upkeep > 0)
SetEndurUpkeep(true);
Buff::SendFullBuffRefresh(this);
ClientPatch::SendFullBuffRefresh(this);
}
if (IsClient()) {
@ -811,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::SendFullBuffRefresh(this);
ClientPatch::SendFullBuffRefresh(this);
if(caster->IsClient()){
auto app = new EQApplicationPacket(OP_Charm, sizeof(Charm_Struct));
@ -821,7 +821,7 @@ bool Mob::SpellEffect(Mob* caster, int32 spell_id, float partial, int level_over
ps->command = 1;
entity_list.QueueClients(this, app);
safe_delete(app);
Buff::SendFullBuffRefresh(this);
ClientPatch::SendFullBuffRefresh(this);
SendAppearancePacket(AppearanceType::Pet, caster->GetID(), true, true);
}
@ -3866,13 +3866,13 @@ void Mob::BuffProcess()
// this is for older clients. Newer clients will simply discard this packet
if (IsClient() && buffs[buffs_i].UpdateClient == true) {
Buff::SendSingleBuffChange(this, buffs[buffs_i], buffs_i);
ClientPatch::SendSingleBuffChange(this, buffs[buffs_i], buffs_i);
buffs[buffs_i].UpdateClient = false;
}
}
}
Buff::SendFullBuffRefresh(this);
ClientPatch::SendFullBuffRefresh(this);
}
void Mob::DoBuffTic(const Buffs_Struct &buff, int slot, Mob *caster)
@ -4244,7 +4244,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
return;
if (IsClient() && !CastToClient()->IsDead())
Buff::SendSingleBuffChange(this, buffs[slot], slot);
ClientPatch::SendSingleBuffChange(this, buffs[slot], slot);
LogSpells("Fading buff [{}] from slot [{}]", buffs[slot].spellid, slot);
@ -4427,7 +4427,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
// no longer see the buffs on the old pet.
// QueueClientsByTarget preserves GM and leadership cases.
Buff::SendFullBuffRefresh(this, true);
ClientPatch::SendFullBuffRefresh(this, true);
if (IsAIControlled())
{
@ -4651,8 +4651,8 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
RemoveNimbusEffect(spells[buffs[slot].spellid].nimbus_effect);
buffs[slot].spellid = SPELL_UNKNOWN;
Buff::SendSingleBuffChange(this, buffs[slot], slot, true);
Buff::SendFullBuffRefresh(this);
ClientPatch::SendSingleBuffChange(this, buffs[slot], slot, true);
ClientPatch::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;
@ -7010,7 +7010,7 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, int32 spell_id)
if (!TryFadeEffect(d))
BuffFadeBySlot(d, true);
} else if (IsClient()) { // still have numhits and client, update
Buff::SendSingleBuffChange(this, buffs[d], d);
ClientPatch::SendSingleBuffChange(this, buffs[d], d);
}
}
}
@ -7025,7 +7025,7 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, int32 spell_id)
if (!TryFadeEffect(buff_slot))
BuffFadeBySlot(buff_slot , true);
} else if (IsClient()) { // still have numhits and client, update
Buff::SendSingleBuffChange(this, buffs[buff_slot], buff_slot);
ClientPatch::SendSingleBuffChange(this, buffs[buff_slot], buff_slot);
}
}
}
@ -7043,7 +7043,7 @@ void Mob::CheckNumHitsRemaining(NumHit type, int32 buff_slot, int32 spell_id)
if (!TryFadeEffect(d))
BuffFadeBySlot(d, true);
} else if (IsClient()) { // still have numhits and client, update
Buff::SendSingleBuffChange(this, buffs[d], d);
ClientPatch::SendSingleBuffChange(this, buffs[d], d);
}
}
}

View File

@ -339,12 +339,12 @@ bool Mob::DoCastSpell(int32 spell_id, uint16 target_id, CastingSlot slot,
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spell_id);
if (IsClient())
Message::MessageString(CastToClient(), Chat::SpellFailure, fizzle_msg, spell_link);
ClientPatch::MessageString(CastToClient(), Chat::SpellFailure, fizzle_msg, spell_link);
/**
* Song Failure message
*/
Message::CloseMessageString(this, true, RuleI(Range, SpellMessages),
ClientPatch::CloseMessageString(this, true, RuleI(Range, SpellMessages),
nullptr, true, IsClient() ? FilterPCSpells : FilterNPCSpells)(
Chat::SpellFailure, fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER, GetName(), spell_link);
@ -1303,7 +1303,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, int32 spellid)
// the interrupt message
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spellid);
Message::InterruptSpell(CastToClient(), message, GetID(), spell_link);
ClientPatch::InterruptSpell(CastToClient(), message, GetID(), spell_link);
SendSpellBarEnable(spellid);
}
@ -1331,7 +1331,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, int32 spellid)
// this is the actual message, it works the same as a formatted message
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spellid);
Message::InterruptSpellOther(this, message_other, GetID(), GetCleanName(), spell_link);
ClientPatch::InterruptSpellOther(this, message_other, GetID(), GetCleanName(), spell_link);
}
// this is like interrupt, just it doesn't spam interrupt packets to everyone
@ -2856,7 +2856,7 @@ bool Mob::SpellFinished(int32 spell_id, Mob *spell_target, CastingSlot slot, int
if (IsClient() && IsEffectInSpell(spell_id, SpellEffect::BindSight)) {
for (int i = 0; i < GetMaxTotalSlots(); i++) {
if (buffs[i].spellid == spell_id) {
Buff::SendSingleBuffChange(this, buffs[i], i);//its hack, it works.
ClientPatch::SendSingleBuffChange(this, buffs[i], i);//its hack, it works.
}
}
}
@ -2864,7 +2864,7 @@ bool Mob::SpellFinished(int32 spell_id, Mob *spell_target, CastingSlot slot, int
if (IsClient() && spells[spell_id].hit_number) {
for (int i = 0; i < GetMaxTotalSlots(); i++) {
if (buffs[i].spellid == spell_id && buffs[i].hit_number > 0) {
Buff::SendSingleBuffChange(this, buffs[i], i);
ClientPatch::SendSingleBuffChange(this, buffs[i], i);
break;
}
}
@ -3741,8 +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);
Buff::SendSingleBuffChange(this, buffs[emptyslot], emptyslot);
Buff::SendFullBuffRefresh(this);
ClientPatch::SendSingleBuffChange(this, buffs[emptyslot], emptyslot);
ClientPatch::SendFullBuffRefresh(this);
// recalculate bonuses since we stripped/added buffs
CalcBonuses();
@ -6462,7 +6462,7 @@ void Mob::BuffModifyDurationBySpellID(int32 spell_id, int32 newDuration)
if (buffs[i].spellid == spell_id)
{
buffs[i].ticsremaining = newDuration;
Buff::SendSingleBuffChange(this, buffs[i], i);
ClientPatch::SendSingleBuffChange(this, buffs[i], i);
}
}
}
@ -7037,7 +7037,7 @@ void Mob::DoBardCastingFromItemClick(bool is_casting_bard_song, uint32 cast_time
if (cast_time != 0) {
char spell_link[Links::MAX_LINK_SIZE];
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spell_id);
Message::InterruptSpell(CastToClient(), SONG_ENDS, GetID(), spell_link);
ClientPatch::InterruptSpell(CastToClient(), SONG_ENDS, GetID(), spell_link);
ZeroCastingVars();
ZeroBardPulseVars();