diff --git a/common/patches/IBuff.h b/common/patches/IBuff.h index da2d9cdbc..0f3beb4ac 100644 --- a/common/patches/IBuff.h +++ b/common/patches/IBuff.h @@ -16,7 +16,7 @@ class Mob; class EQApplicationPacket; class Buffs_Struct; -namespace Buff { +namespace ClientPatch { class IBuff { diff --git a/common/patches/IMessage.h b/common/patches/IMessage.h index 80bd15501..96723ee9d 100644 --- a/common/patches/IMessage.h +++ b/common/patches/IMessage.h @@ -25,7 +25,7 @@ class Client; class Mob; class EQApplicationPacket; -namespace Message { +namespace ClientPatch { template concept AllConstChar = (std::is_convertible_v && ...); diff --git a/common/patches/client_version.cpp b/common/patches/client_version.cpp index 764fc2bec..0416e05c2 100644 --- a/common/patches/client_version.cpp +++ b/common/patches/client_version.cpp @@ -36,32 +36,32 @@ struct ClientComponents { switch (version) { case Version::TOB: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::RoF2: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::RoF: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::UF: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::SoD: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::SoF: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; case Version::Titanium: - buffComponent = std::make_unique(); - messageComponent = std::make_unique(); + buffComponent = std::make_unique(); + messageComponent = std::make_unique(); break; default: break; @@ -69,8 +69,8 @@ struct ClientComponents } const Version version; - std::unique_ptr buffComponent; - std::unique_ptr messageComponent; + std::unique_ptr buffComponent; + std::unique_ptr 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 s_pa } }; -const std::unique_ptr& GetBuffComponent(Version version) +template<> +const std::unique_ptr& GetComponent(Version version) { return s_patches.at(static_cast(version)).buffComponent; } -const std::unique_ptr& GetMessageComponent(Version version) +template<> +const std::unique_ptr& GetComponent(Version version) { return s_patches.at(static_cast(version)).messageComponent; } diff --git a/common/patches/client_version.h b/common/patches/client_version.h index 45b4d88e4..02c809f13 100644 --- a/common/patches/client_version.h +++ b/common/patches/client_version.h @@ -7,10 +7,26 @@ #include "common/emu_versions.h" #include -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& GetBuffComponent(EQ::versions::ClientVersion version); -const std::unique_ptr& GetMessageComponent(EQ::versions::ClientVersion version); +template +const std::unique_ptr& GetComponent(EQ::versions::ClientVersion version); + +template <> +const std::unique_ptr& GetComponent(EQ::versions::ClientVersion version); + +template <> +const std::unique_ptr& GetComponent(EQ::versions::ClientVersion version); + +template +static Component* GetClientComponent(const Client* client) +{ + return GetComponent(client->GetClientVersion()).get(); +} diff --git a/common/patches/rof.h b/common/patches/rof.h index 6f7143b9f..3201750c4 100644 --- a/common/patches/rof.h +++ b/common/patches/rof.h @@ -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*/ diff --git a/common/patches/rof2.h b/common/patches/rof2.h index 8c3e77124..7386e1394 100644 --- a/common/patches/rof2.h +++ b/common/patches/rof2.h @@ -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*/ diff --git a/common/patches/sod.cpp b/common/patches/sod.cpp index d18e664c4..fd016bfe9 100644 --- a/common/patches/sod.cpp +++ b/common/patches/sod.cpp @@ -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 SoD::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, - bool buff_timers_suspended, const std::vector& slots) const + std::unique_ptr BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, + bool remove, + bool buff_timers_suspended, const std::vector& slots) const { // SoD only supports target refresh, not self refresh packets if (opcode == OP_RefreshTargetBuffs) { @@ -4341,7 +4339,7 @@ std::unique_ptr 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& packet, Mob* source, Client* target) const +void BuffComponent::SetRefreshType(std::unique_ptr& 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& packet, Mob* sour } } -} // namespace Buff +} /*SoD*/ diff --git a/common/patches/sod.h b/common/patches/sod.h index 34c730bb1..711734581 100644 --- a/common/patches/sod.h +++ b/common/patches/sod.h @@ -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 RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, bool buff_timers_suspended, const std::vector& slots) const override; void SetRefreshType(std::unique_ptr& packet, Mob* source, Client* target) const override; }; -} // namespace Buff +} /*SoD*/ diff --git a/common/patches/sof.h b/common/patches/sof.h index 8e7537828..aae84d562 100644 --- a/common/patches/sof.h +++ b/common/patches/sof.h @@ -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*/ diff --git a/common/patches/template.h b/common/patches/template.h index 8fe3775cb..93c7dbea3 100644 --- a/common/patches/template.h +++ b/common/patches/template.h @@ -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" +}; }; diff --git a/common/patches/titanium.cpp b/common/patches/titanium.cpp index 509b7e64c..d97d46a1d 100644 --- a/common/patches/titanium.cpp +++ b/common/patches/titanium.cpp @@ -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 Titanium::Simple(uint32_t color, uint32_t id) const +std::unique_ptr 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 Titanium::Simple(uint32_t color, uint32_t i return nullptr; } -std::unique_ptr Titanium::Formatted( +std::unique_ptr MessageComponent::Formatted( uint32_t color, uint32_t id, const std::array& args) const { uint32_t string_id = ResolveID(id); @@ -3968,7 +3966,7 @@ std::unique_ptr Titanium::Formatted( return nullptr; } -std::unique_ptr Titanium::InterruptSpell(uint32_t message, uint32_t spawn_id, +std::unique_ptr MessageComponent::InterruptSpell(uint32_t message, uint32_t spawn_id, const char* spell_link) const { auto outapp = std::make_unique(OP_InterruptCast, sizeof(InterruptCast_Struct)); @@ -3980,7 +3978,7 @@ std::unique_ptr Titanium::InterruptSpell(uint32_t message, return outapp; } -std::unique_ptr Titanium::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id, +std::unique_ptr 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 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& args) const +void MessageComponent::ResolveArguments(uint32_t id, std::array& args) const { switch (id) { case SPELL_FIZZLE: @@ -4016,11 +4014,7 @@ void Titanium::ResolveArguments(uint32_t id, std::array& args) c } } -} // namespace Message - -namespace Buff { - -std::unique_ptr Titanium::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, +std::unique_ptr BuffComponent::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const { auto outapp = std::make_unique(OP_BuffDefinition, sizeof(SpellBuffPacket_Struct)); @@ -4054,12 +4048,12 @@ std::unique_ptr Titanium::BuffDefinition(Mob* mob, const Bu return outapp; } -std::unique_ptr Titanium::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, +std::unique_ptr BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, bool buff_timers_suspended, const std::vector& slots) const { return nullptr; } -void Titanium::SetRefreshType(std::unique_ptr& packet, Mob* source, Client* target) const {} +void BuffComponent::SetRefreshType(std::unique_ptr& packet, Mob* source, Client* target) const {} -} // namespace Buff +} /*Titanium*/ diff --git a/common/patches/titanium.h b/common/patches/titanium.h index 8b9ec5ed4..bfe5ae269 100644 --- a/common/patches/titanium.h +++ b/common/patches/titanium.h @@ -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 Simple(uint32_t color, uint32_t id) const override; std::unique_ptr Formatted(uint32_t color, uint32_t id, @@ -75,15 +63,11 @@ protected: virtual void ResolveArguments(uint32_t id, std::array& 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 BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const override; @@ -92,5 +76,5 @@ public: void SetRefreshType(std::unique_ptr& packet, Mob* source, Client* target) const override; }; -} // namespace Buff +} /*Titanium*/ diff --git a/common/patches/tob.cpp b/common/patches/tob.cpp index 8c70437bb..c64feaa85 100644 --- a/common/patches/tob.cpp +++ b/common/patches/tob.cpp @@ -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& args) const +void MessageComponent::ResolveArguments(uint32_t id, std::array& args) const { switch (id) { case SPELL_FIZZLE: @@ -5545,12 +5542,12 @@ void TOB::ResolveArguments(uint32_t id, std::array& args) const // take all arguments (spell link) break; default: - Titanium::ResolveArguments(id, args); + Titanium::MessageComponent::ResolveArguments(id, args); break; } } -std::unique_ptr TOB::Formatted(uint32_t color, uint32_t id, +std::unique_ptr MessageComponent::Formatted(uint32_t color, uint32_t id, const std::array& args) const { uint32_t string_id = ResolveID(id); @@ -5583,7 +5580,7 @@ std::unique_ptr TOB::Formatted(uint32_t color, uint32_t id, return nullptr; } -std::unique_ptr TOB::InterruptSpell(uint32_t message, uint32_t spawn_id, +std::unique_ptr MessageComponent::InterruptSpell(uint32_t message, uint32_t spawn_id, const char* spell_link) const { auto outapp = std::make_unique(OP_InterruptCast, sizeof(InterruptCast_Struct) + strlen(spell_link) + 1); @@ -5596,7 +5593,7 @@ std::unique_ptr TOB::InterruptSpell(uint32_t message, uint3 return outapp; } -std::unique_ptr TOB::InterruptSpellOther(Mob* sender, uint32_t message, uint32_t spawn_id, +std::unique_ptr 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 TOB::InterruptSpellOther(Mob* sender, uint3 return outapp; } -} // namespace Message - -namespace Buff { - -std::unique_ptr TOB::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const +std::unique_ptr BuffComponent::BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const { - auto packet = std::make_unique(OP_BuffDefinition, sizeof(::TOB::structs::EQAffectPacket_Struct)); - auto affect = reinterpret_cast<::TOB::structs::EQAffectPacket_Struct*>(packet->pBuffer); + auto packet = std::make_unique(OP_BuffDefinition, sizeof(structs::EQAffectPacket_Struct)); + auto affect = reinterpret_cast(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 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(buff.instrument_mod) / 10.f; - affect->affect.y = static_cast(buff.caston_y); - affect->affect.x = static_cast(buff.caston_x); - affect->affect.z = static_cast(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(buff.instrument_mod) / 10.f; + affect->affect.y = static_cast(buff.caston_y); + affect->affect.x = static_cast(buff.caston_x); + affect->affect.z = static_cast(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 TOB::BuffDefinition(Mob* mob, const Buffs_S return packet; } -std::unique_ptr TOB::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, +std::unique_ptr BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, bool buff_timers_suspended, const std::vector& slots) const { Buffs_Struct* buffs = mob->GetBuffs(); @@ -5710,7 +5707,7 @@ std::unique_ptr 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& packet, Mob* source, Client* target) const +void BuffComponent::SetRefreshType(std::unique_ptr& 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& packet, Mob* sour } } -} // namespace Buff +} /*TOB*/ \ No newline at end of file diff --git a/common/patches/tob.h b/common/patches/tob.h index 2410b585b..08c32d276 100644 --- a/common/patches/tob.h +++ b/common/patches/tob.h @@ -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 Formatted(uint32_t color, uint32_t id, const std::array& args) const override; @@ -55,15 +43,11 @@ protected: void ResolveArguments(uint32_t id, std::array& 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 BuffDefinition(Mob* mob, const Buffs_Struct& buff, int slot, bool fade) const override; @@ -72,4 +56,4 @@ public: void SetRefreshType(std::unique_ptr& packet, Mob* source, Client* target) const override; }; -} // namespace Buff +}; /*TOB*/ diff --git a/common/patches/uf.cpp b/common/patches/uf.cpp index 5fe20c8a0..4c4c99462 100644 --- a/common/patches/uf.cpp +++ b/common/patches/uf.cpp @@ -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 UF::RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, - bool buff_timers_suspended, const std::vector& slots) const + std::unique_ptr BuffComponent::RefreshBuffs(EmuOpcode opcode, Mob* mob, + bool remove, + bool buff_timers_suspended, const std::vector& slots) const { // UF introduced the self update buff packet @@ -5286,4 +5284,4 @@ std::unique_ptr UF::RefreshBuffs(EmuOpcode opcode, Mob* mob return outapp; } -} // namespace Buff +} /*UF*/ diff --git a/common/patches/uf.h b/common/patches/uf.h index 8f9ede416..607d589ba 100644 --- a/common/patches/uf.h +++ b/common/patches/uf.h @@ -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 RefreshBuffs(EmuOpcode opcode, Mob* mob, bool remove, bool buff_timers_suspended, const std::vector& slots) const override; }; -} // namespace Buff +}; /*UF*/ diff --git a/zone/client.cpp b/zone/client.cpp index ad202571a..7757f6367 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -3811,10 +3811,10 @@ void Client::MessageString(uint32 type, uint32 string_id, uint32 distance) return; if (distance > 0) - Message::CloseMessageString(this, false, static_cast(distance))( + ClientPatch::CloseMessageString(this, false, static_cast(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(distance))(type, string_id, message1, + ClientPatch::CloseMessageString(this, false, static_cast(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 ... diff --git a/zone/client.h b/zone/client.h index d36e331b6..bd9bed621 100644 --- a/zone/client.h +++ b/zone/client.h @@ -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); diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index c73dc49b0..3334c8b0c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -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 { diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 953ebdcde..49605010d 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -2309,7 +2309,7 @@ void Client::ClearHover() entity_list.QueueClients(this, outapp, false); safe_delete(outapp); - Buff::SendFullBuffRefresh(this); + ClientPatch::SendFullBuffRefresh(this); dead = false; } diff --git a/zone/client_version.h b/zone/client_version.h index 130372d03..f7ae8698f 100644 --- a/zone/client_version.h +++ b/zone/client_version.h @@ -17,7 +17,7 @@ namespace ClientPatch { using ClientList = std::unordered_map; -template using ComponentGetter = std::function; +template using ComponentGetter = Obj*(*)(const Client*); //std::function; using SendPredicate = std::function; using MutatePacket = std::function&, 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 [=](Fun fun, const ComponentGetter& component, Args&&... args) + return [=](Fun fun, ComponentGetter component, Args&&... args) requires std::is_member_function_pointer_v { std::array, EQ::versions::ClientVersionCount> build_packets; @@ -61,7 +61,7 @@ static auto QueueCloseClients( { if (distance <= 0) distance = static_cast(zone->GetClientUpdateRange()); - return [=](Fun fun, const ComponentGetter& component, Args&&... args) + return [=](Fun fun, ComponentGetter component, Args&&... args) requires std::is_member_function_pointer_v { 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 [=](Fun fun, const ComponentGetter component, Args&&... args) + return [=](Fun fun, ComponentGetter component, Args&&... args) requires std::is_member_function_pointer_v { 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 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(c), type, id); } else { std::array a = {args...}; - ClientPatch::QueuePacket(c, &IMessage::Formatted, GetComponent(c), type, id, a); + QueuePacket(c, &IMessage::Formatted, GetClientComponent(c), type, id, a); } } @@ -165,40 +155,31 @@ static auto CloseMessageString( return [=](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, type, id); } else { std::array a = {args...}; - return queue_close_clients(&IMessage::Formatted, GetComponent, type, id, a); + return queue_close_clients(&IMessage::Formatted, GetClientComponent, 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(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, 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(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(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& packet, Client* c) { - GetComponent(c)->SetRefreshType(packet, sender, c); + GetClientComponent(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, 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, 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(c), sender, buff, slot, false); + // FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent(c), OP_RefreshBuffs, sender, remove, suspended, slots); + // FastQueuePacket(c, &IBuff::BuffDefinition, GetClientComponent(c), sender, buff, slot, remove); + // FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent(c), OP_RefreshBuffs, sender, remove, suspended, slots); + FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent(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(c), OP_RefreshPetBuffs, sender, remove, suspended, slots); } } auto mutate = [sender](std::unique_ptr& packet, Client* c) { - GetComponent(c)->SetRefreshType(packet, sender, c); + GetClientComponent(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, 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(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 diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 0d06e1c37..e53381d77 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -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); } } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 3717a90b8..9aa67990b 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -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();