[Saylinks] Implement Auto Saylink Injection (#1525)

* Implement auto saylink injection

* Cover Lua say since it takes a different code path
This commit is contained in:
Chris Miles
2021-09-12 22:08:30 -05:00
committed by GitHub
parent 94c1a50cc8
commit 6b93130c13
8 changed files with 112 additions and 30 deletions
+18 -10
View File
@@ -989,7 +989,7 @@ XS(XS_Mob_BuffCount) {
VALIDATE_THIS_IS_MOB;
RETVAL = THIS->BuffCount();
XSprePUSH;
PUSHu((UV) RETVAL);
PUSHu((UV) RETVAL);
}
XSRETURN(1);
}
@@ -2620,7 +2620,15 @@ XS(XS_Mob_Message) {
uint32 type = (uint32) SvUV(ST(1));
char *message = (char *) SvPV_nolen(ST(2));
VALIDATE_THIS_IS_MOB;
THIS->Message(type, message);
// auto inject saylinks
if (RuleB(Chat, AutoInjectSaylinksToClientMessage)) {
std::string new_message = EQ::SayLinkEngine::InjectSaylinksIfNotExist(message);
THIS->Message(type, new_message.c_str());
}
else {
THIS->Message(type, message);
}
}
XSRETURN_EMPTY;
}
@@ -6016,7 +6024,7 @@ XS(XS_Mob_GetClassName) {
XSprePUSH;
PUSHTARG;
}
XSRETURN(1);
XSRETURN(1);
}
XS(XS_Mob_GetRaceName);
@@ -6039,7 +6047,7 @@ XS(XS_Mob_GetRaceName) {
XS(XS_Mob_DeleteBucket);
XS(XS_Mob_DeleteBucket) {
dXSARGS;
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Mob::DeleteBucket(THIS, std::string bucket_name)"); // @categories Script Utility
{
@@ -6053,7 +6061,7 @@ XS(XS_Mob_DeleteBucket) {
XS(XS_Mob_GetBucket);
XS(XS_Mob_GetBucket) {
dXSARGS;
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Mob::GetBucket(THIS, std::string bucket_name)"); // @categories Script Utility
{
@@ -6072,7 +6080,7 @@ XS(XS_Mob_GetBucket) {
XS(XS_Mob_GetBucketExpires);
XS(XS_Mob_GetBucketExpires) {
dXSARGS;
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Mob::GetBucketExpires(THIS, std::string bucket_name)"); // @categories Script Utility
{
@@ -6091,7 +6099,7 @@ XS(XS_Mob_GetBucketExpires) {
XS(XS_Mob_GetBucketKey);
XS(XS_Mob_GetBucketKey) {
dXSARGS;
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::GetBucketKey(THIS)"); // @categories Script Utility
{
@@ -6109,7 +6117,7 @@ XS(XS_Mob_GetBucketKey) {
XS(XS_Mob_GetBucketRemaining);
XS(XS_Mob_GetBucketRemaining) {
dXSARGS;
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Mob::GetBucketRemaining(THIS, std::string bucket_name)"); // @categories Script Utility
{
@@ -6128,7 +6136,7 @@ XS(XS_Mob_GetBucketRemaining) {
XS(XS_Mob_SetBucket);
XS(XS_Mob_SetBucket) {
dXSARGS;
dXSARGS;
if (items < 3 || items > 4)
Perl_croak(aTHX_ "Usage: Mob::SetBucket(THIS, std::string bucket_name, std::string bucket_value, [std::string expiration])"); // @categories Script Utility
{
@@ -6146,7 +6154,7 @@ XS(XS_Mob_SetBucket) {
}
XS(XS_Mob_IsHorse);
XS(XS_Mob_IsHorse) {
XS(XS_Mob_IsHorse) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Mob::IsHorse(THIS)"); // @categories Script Utility