mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-11 23:42:24 +00:00
[Saylinks] Multiple saylinks in brackets (#1643)
* Saylink edge case where multiple saylinks show up within a bracket * Update partial
This commit is contained in:
parent
fb66afd565
commit
6e5bf4b941
@ -24,7 +24,7 @@
|
|||||||
#include "item_instance.h"
|
#include "item_instance.h"
|
||||||
#include "item_data.h"
|
#include "item_data.h"
|
||||||
#include "../zone/zonedb.h"
|
#include "../zone/zonedb.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
bool EQ::saylink::DegenerateLinkBody(SayLinkBody_Struct &say_link_body_struct, const std::string &say_link_body)
|
bool EQ::saylink::DegenerateLinkBody(SayLinkBody_Struct &say_link_body_struct, const std::string &say_link_body)
|
||||||
{
|
{
|
||||||
@ -350,7 +350,7 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
|
|||||||
std::vector<std::string> saylinks = {};
|
std::vector<std::string> saylinks = {};
|
||||||
int saylink_length = 50;
|
int saylink_length = 50;
|
||||||
std::string saylink_separator = "\u0012";
|
std::string saylink_separator = "\u0012";
|
||||||
std::string saylink_partial = "000";
|
std::string saylink_partial = "00000";
|
||||||
|
|
||||||
LogSaylinkDetail("new_message pre pass 1 [{}]", new_message);
|
LogSaylinkDetail("new_message pre pass 1 [{}]", new_message);
|
||||||
|
|
||||||
@ -375,6 +375,8 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
|
|||||||
|
|
||||||
LogSaylinkDetail("new_message post pass 1 [{}]", new_message);
|
LogSaylinkDetail("new_message post pass 1 [{}]", new_message);
|
||||||
|
|
||||||
|
LogSaylinkDetail("saylink separator count [{}]", std::count(new_message.begin(), new_message.end(), '\u0012'));
|
||||||
|
|
||||||
// loop through brackets until none exist
|
// loop through brackets until none exist
|
||||||
if (new_message.find('[') != std::string::npos) {
|
if (new_message.find('[') != std::string::npos) {
|
||||||
for (auto &b: split_string(new_message, "[")) {
|
for (auto &b: split_string(new_message, "[")) {
|
||||||
@ -388,6 +390,12 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip where multiple saylinks are within brackets
|
||||||
|
if (bracket_message.find(saylink_separator) != std::string::npos &&
|
||||||
|
std::count(bracket_message.begin(), bracket_message.end(), '\u0012') > 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// if non empty bracket contents
|
// if non empty bracket contents
|
||||||
if (!bracket_message.empty()) {
|
if (!bracket_message.empty()) {
|
||||||
LogSaylinkDetail("Found bracket_message [{}]", bracket_message);
|
LogSaylinkDetail("Found bracket_message [{}]", bracket_message);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user