mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-06 04:42:28 +00:00
Finishing up PR comments
This commit is contained in:
parent
eae065acb5
commit
8c59dda61f
@ -32,13 +32,14 @@ concept AllConstChar = (std::is_convertible_v<Args, const char*> && ...);
|
|||||||
class IMessage
|
class IMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using FormattedArgs = std::array<const char*, 9>;
|
||||||
IMessage() = default;
|
IMessage() = default;
|
||||||
virtual ~IMessage() = default;
|
virtual ~IMessage() = default;
|
||||||
|
|
||||||
// these two are the basic string message packets
|
// these two are the basic string message packets
|
||||||
virtual std::unique_ptr<EQApplicationPacket> Simple(uint32_t color, uint32_t id) const = 0;
|
virtual std::unique_ptr<EQApplicationPacket> Simple(uint32_t color, uint32_t id) const = 0;
|
||||||
virtual std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
virtual std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
||||||
const std::array<const char*, 9>& args) const = 0;
|
const FormattedArgs& args) const = 0;
|
||||||
|
|
||||||
// These aren't technically messages, but they use the same format and are similar enough to include here
|
// These aren't technically messages, but they use the same format and are similar enough to include here
|
||||||
virtual std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
virtual std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
||||||
|
|||||||
@ -31,13 +31,12 @@
|
|||||||
#include "common/raid.h"
|
#include "common/raid.h"
|
||||||
#include "common/rulesys.h"
|
#include "common/rulesys.h"
|
||||||
#include "common/strings.h"
|
#include "common/strings.h"
|
||||||
|
#include "zone/client.h"
|
||||||
|
#include "zone/mob.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "zone/client.h"
|
|
||||||
#include "zone/mob.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace SoD
|
namespace SoD
|
||||||
{
|
{
|
||||||
|
|||||||
@ -32,12 +32,11 @@
|
|||||||
#include "common/raid.h"
|
#include "common/raid.h"
|
||||||
#include "common/rulesys.h"
|
#include "common/rulesys.h"
|
||||||
#include "common/strings.h"
|
#include "common/strings.h"
|
||||||
|
#include "zone/mob.h"
|
||||||
#include "zone/string_ids.h"
|
#include "zone/string_ids.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "zone/mob.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace Titanium
|
namespace Titanium
|
||||||
{
|
{
|
||||||
@ -3902,8 +3901,8 @@ std::unique_ptr<EQApplicationPacket> MessageComponent::Simple(uint32_t color, ui
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> MessageComponent::Formatted(
|
std::unique_ptr<EQApplicationPacket> MessageComponent::Formatted(uint32_t color, uint32_t id,
|
||||||
uint32_t color, uint32_t id, const std::array<const char*, 9>& args) const
|
const FormattedArgs& args) const
|
||||||
{
|
{
|
||||||
uint32_t string_id = ResolveID(id);
|
uint32_t string_id = ResolveID(id);
|
||||||
if (string_id > 0) {
|
if (string_id > 0) {
|
||||||
@ -3943,14 +3942,13 @@ std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpell(uint32_t m
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> MessageComponent::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* name, const char* spell_link) const
|
||||||
const char* spell_link) const
|
|
||||||
{
|
{
|
||||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_InterruptCast, sizeof(InterruptCast_Struct) + strlen(name) + 1);
|
auto outapp = std::make_unique<EQApplicationPacket>(OP_InterruptCast, sizeof(InterruptCast_Struct) + strlen(name) + 1);
|
||||||
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
||||||
ic->messageid = ResolveID(message);
|
ic->messageid = ResolveID(message);
|
||||||
ic->spawnid = spawn_id;
|
ic->spawnid = spawn_id;
|
||||||
fmt::format_to_n(ic->message, strlen(name) + 1, "{}\0", name);
|
strcpy(ic->message, spell_link);
|
||||||
return outapp;
|
return outapp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3967,11 +3965,11 @@ void MessageComponent::ResolveArguments(uint32_t id, std::array<const char*, 9>&
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case SPELL_FIZZLE:
|
case SPELL_FIZZLE:
|
||||||
case MISS_NOTE:
|
case MISS_NOTE:
|
||||||
args[0] = nullptr; // drop spell link
|
args[0] = nullptr; // the 0th (and only) argument here is the spell link, not supported before TOB
|
||||||
break;
|
break;
|
||||||
case SPELL_FIZZLE_OTHER:
|
case SPELL_FIZZLE_OTHER:
|
||||||
case MISSED_NOTE_OTHER:
|
case MISSED_NOTE_OTHER:
|
||||||
args[1] = nullptr; // drop spell link
|
args[1] = nullptr; // the 1st argument here is the spell link, not supported before TOB
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> Simple(uint32_t color, uint32_t id) const override;
|
std::unique_ptr<EQApplicationPacket> Simple(uint32_t color, uint32_t id) const override;
|
||||||
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
||||||
const std::array<const char*, 9>& args) const override;
|
const FormattedArgs& args) const override;
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
||||||
const char* spell_link) const override;
|
const char* spell_link) const override;
|
||||||
|
|||||||
@ -34,8 +34,13 @@ Copyright (C) 2001-2026 EQEmu Development Team
|
|||||||
#include "common/rulesys.h"
|
#include "common/rulesys.h"
|
||||||
#include "common/path_manager.h"
|
#include "common/path_manager.h"
|
||||||
#include "common/classes.h"
|
#include "common/classes.h"
|
||||||
|
#include "common/packet_dump.h"
|
||||||
#include "common/races.h"
|
#include "common/races.h"
|
||||||
#include "common/raid.h"
|
#include "common/raid.h"
|
||||||
|
#include "world/sof_char_create_data.h"
|
||||||
|
#include "zone/client.h"
|
||||||
|
#include "zone/mob.h"
|
||||||
|
#include "zone/string_ids.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -44,12 +49,6 @@ Copyright (C) 2001-2026 EQEmu Development Team
|
|||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "common/packet_dump.h"
|
|
||||||
#include "world/sof_char_create_data.h"
|
|
||||||
#include "zone/client.h"
|
|
||||||
#include "zone/mob.h"
|
|
||||||
#include "zone/string_ids.h"
|
|
||||||
|
|
||||||
namespace TOB
|
namespace TOB
|
||||||
{
|
{
|
||||||
static const char* name = "TOB";
|
static const char* name = "TOB";
|
||||||
@ -5566,7 +5565,7 @@ void MessageComponent::ResolveArguments(uint32_t id, std::array<const char*, 9>&
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> MessageComponent::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
|
const FormattedArgs& args) const
|
||||||
{
|
{
|
||||||
uint32_t string_id = ResolveID(id);
|
uint32_t string_id = ResolveID(id);
|
||||||
if (string_id > 0) {
|
if (string_id > 0) {
|
||||||
@ -5605,7 +5604,7 @@ std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpell(uint32_t m
|
|||||||
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
||||||
ic->messageid = ResolveID(message);
|
ic->messageid = ResolveID(message);
|
||||||
ic->spawnid = spawn_id;
|
ic->spawnid = spawn_id;
|
||||||
fmt::format_to_n(ic->message, strlen(spell_link) + 1, "{}\0", spell_link);
|
strcpy(ic->message, spell_link);
|
||||||
outapp->priority = 5;
|
outapp->priority = 5;
|
||||||
|
|
||||||
return outapp;
|
return outapp;
|
||||||
@ -5620,7 +5619,8 @@ std::unique_ptr<EQApplicationPacket> MessageComponent::InterruptSpellOther(Mob*
|
|||||||
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
auto ic = reinterpret_cast<InterruptCast_Struct*>(outapp->pBuffer);
|
||||||
ic->messageid = ResolveID(message);
|
ic->messageid = ResolveID(message);
|
||||||
ic->spawnid = spawn_id;
|
ic->spawnid = spawn_id;
|
||||||
fmt::format_to_n(ic->message, strlen(name) + strlen(spell_link) + 2, "{}\0{}\0", name, spell_link);
|
strcpy(ic->message, name);
|
||||||
|
strcpy(&ic->message[strlen(name) + 1], spell_link);
|
||||||
|
|
||||||
return outapp;
|
return outapp;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ public:
|
|||||||
~MessageComponent() override = default;
|
~MessageComponent() override = default;
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
std::unique_ptr<EQApplicationPacket> Formatted(uint32_t color, uint32_t id,
|
||||||
const std::array<const char*, 9>& args) const override;
|
const FormattedArgs& args) const override;
|
||||||
|
|
||||||
std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
std::unique_ptr<EQApplicationPacket> InterruptSpell(uint32_t message, uint32_t spawn_id,
|
||||||
const char* spell_link) const override;
|
const char* spell_link) const override;
|
||||||
|
|||||||
@ -33,13 +33,12 @@
|
|||||||
#include "common/raid.h"
|
#include "common/raid.h"
|
||||||
#include "common/rulesys.h"
|
#include "common/rulesys.h"
|
||||||
#include "common/strings.h"
|
#include "common/strings.h"
|
||||||
|
#include "zone/mob.h"
|
||||||
|
|
||||||
#include "cereal/types/vector.hpp"
|
#include "cereal/types/vector.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "zone/mob.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace UF
|
namespace UF
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3811,10 +3811,10 @@ void Client::MessageString(uint32 type, uint32 string_id, uint32 distance)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (distance > 0)
|
if (distance > 0)
|
||||||
ClientPatch::CloseMessageString(this, false, static_cast<float>(distance))(
|
ClientPatch::BroadcastMessageStringInRadius(this, false, static_cast<float>(distance))(
|
||||||
type, string_id);
|
type, string_id);
|
||||||
else
|
else
|
||||||
ClientPatch::MessageString(this, type, string_id);
|
ClientPatch::SendMessageString(this, type, string_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -3843,10 +3843,10 @@ void Client::MessageString(uint32 type, uint32 string_id, const char* message1,
|
|||||||
type = 4;
|
type = 4;
|
||||||
|
|
||||||
if (distance > 0)
|
if (distance > 0)
|
||||||
ClientPatch::CloseMessageString(this, false, static_cast<float>(distance))(type, string_id, message1,
|
ClientPatch::BroadcastMessageStringInRadius(this, false, static_cast<float>(distance))(type, string_id, message1,
|
||||||
message2, message3, message4, message5, message6, message7, message8, message9);
|
message2, message3, message4, message5, message6, message7, message8, message9);
|
||||||
else
|
else
|
||||||
ClientPatch::MessageString(this, type, string_id, message1, message2, message3, message4, message5,
|
ClientPatch::SendMessageString(this, type, string_id, message1, message2, message3, message4, message5,
|
||||||
message6, message7, message8, message9);
|
message6, message7, message8, message9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@
|
|||||||
#include "common/rulesys.h"
|
#include "common/rulesys.h"
|
||||||
#include "common/shared_tasks.h"
|
#include "common/shared_tasks.h"
|
||||||
#include "zone/bot.h"
|
#include "zone/bot.h"
|
||||||
|
#include "zone/client_version.h"
|
||||||
#include "zone/dialogue_window.h"
|
#include "zone/dialogue_window.h"
|
||||||
#include "zone/dynamic_zone.h"
|
#include "zone/dynamic_zone.h"
|
||||||
#include "zone/event_codes.h"
|
#include "zone/event_codes.h"
|
||||||
@ -61,8 +62,6 @@
|
|||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "client_version.h"
|
|
||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool is_zone_loaded;
|
extern volatile bool is_zone_loaded;
|
||||||
|
|||||||
@ -123,7 +123,6 @@ void FastQueuePacket(Client* c, Fun fun, Obj* obj, Args&&... args)
|
|||||||
if (app) {
|
if (app) {
|
||||||
// FastQueuePacket specifically takes lifetime management of packet, so release here
|
// FastQueuePacket specifically takes lifetime management of packet, so release here
|
||||||
EQApplicationPacket* packet = app.release();
|
EQApplicationPacket* packet = app.release();
|
||||||
LogNetcode("S->C FastQueuePacket {}", DumpPacketToString(packet));
|
|
||||||
c->FastQueuePacket(&packet);
|
c->FastQueuePacket(&packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,17 +157,17 @@ inline auto QueueClientsByTarget(Mob* sender, bool ackreq, const SendPredicate&
|
|||||||
// Helper functions to wrap the packet construction in sends
|
// Helper functions to wrap the packet construction in sends
|
||||||
template <AllConstChar... Args>
|
template <AllConstChar... Args>
|
||||||
requires (sizeof...(Args) <= 9)
|
requires (sizeof...(Args) <= 9)
|
||||||
void MessageString(Client* c, uint32_t type, uint32_t id, Args&&... args)
|
void SendMessageString(Client* c, uint32_t type, uint32_t id, Args&&... args)
|
||||||
{
|
{
|
||||||
if constexpr (sizeof...(Args) == 0) {
|
if constexpr (sizeof...(Args) == 0) {
|
||||||
QueuePacket(c, &IMessage::Simple, GetClientComponent<IMessage>(c), type, id);
|
QueuePacket(c, &IMessage::Simple, GetClientComponent<IMessage>(c), type, id);
|
||||||
} else {
|
} else {
|
||||||
std::array<const char*, 9> a = {args...};
|
IMessage::FormattedArgs a = {args...};
|
||||||
QueuePacket(c, &IMessage::Formatted, GetClientComponent<IMessage>(c), type, id, a);
|
QueuePacket(c, &IMessage::Formatted, GetClientComponent<IMessage>(c), type, id, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto CloseMessageString(
|
inline auto BroadcastMessageStringInRadius(
|
||||||
Mob* sender, bool ignore_sender = false, float distance = 200.f,
|
Mob* sender, bool ignore_sender = false, float distance = 200.f,
|
||||||
Mob* skipped_mob = nullptr, bool is_ack_required = true,
|
Mob* skipped_mob = nullptr, bool is_ack_required = true,
|
||||||
eqFilterType filter = FilterNone)
|
eqFilterType filter = FilterNone)
|
||||||
@ -182,7 +181,7 @@ inline auto CloseMessageString(
|
|||||||
if constexpr (sizeof...(Args) == 0) {
|
if constexpr (sizeof...(Args) == 0) {
|
||||||
return queue_close_clients(&IMessage::Simple, GetClientComponent<IMessage>, type, id);
|
return queue_close_clients(&IMessage::Simple, GetClientComponent<IMessage>, type, id);
|
||||||
} else {
|
} else {
|
||||||
std::array<const char*, 9> a = {args...};
|
IMessage::FormattedArgs a = {args...};
|
||||||
return queue_close_clients(&IMessage::Formatted, GetClientComponent<IMessage>, type, id, a);
|
return queue_close_clients(&IMessage::Formatted, GetClientComponent<IMessage>, type, id, a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4420,7 +4420,7 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
|||||||
owner->SetPet(0);
|
owner->SetPet(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any client that has a previous charmed pet targetted shouldo
|
// Any client that has a previous charmed pet targeted should
|
||||||
// no longer see the buffs on the old pet.
|
// no longer see the buffs on the old pet.
|
||||||
// QueueClientsByTarget preserves GM and leadership cases.
|
// QueueClientsByTarget preserves GM and leadership cases.
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
Links::FormatSpellLink(spell_link, Links::MAX_LINK_SIZE, spell_id);
|
||||||
|
|
||||||
if (IsClient())
|
if (IsClient())
|
||||||
ClientPatch::MessageString(CastToClient(), Chat::SpellFailure, fizzle_msg, spell_link);
|
ClientPatch::SendMessageString(CastToClient(), Chat::SpellFailure, fizzle_msg, spell_link);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Song Failure message
|
* Song Failure message
|
||||||
*/
|
*/
|
||||||
ClientPatch::CloseMessageString(this, true, RuleI(Range, SpellMessages),
|
ClientPatch::BroadcastMessageStringInRadius(this, true, RuleI(Range, SpellMessages),
|
||||||
nullptr, true, IsClient() ? FilterPCSpells : FilterNPCSpells)(
|
nullptr, true, IsClient() ? FilterPCSpells : FilterNPCSpells)(
|
||||||
Chat::SpellFailure, fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER, GetName(), spell_link);
|
Chat::SpellFailure, fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER, GetName(), spell_link);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user