diff --git a/changelog.txt b/changelog.txt index c80e6ce7c..352eab6d0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/24/2013 == +Secrets (Akkadius): Perl $client->SilentMessage("Message"); addition, this is a pre-req for a Perl plugin I've shared with EQEmu. This function essentially mimics a player speaking with an NPC - which is used in popup window responses + == 12/16/2013 == Kayen: Implemented SE_ArcheryDoubleAttack (Chance to do an extra archery attack) Kayen: Implemented SE_ShieldEquipDmgMod (Increase damage in primary hand if shield equiped) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index 6a848a140..1ce73eb93 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5817,6 +5817,37 @@ XS(XS_Client_SetConsumption) XSRETURN_EMPTY; } +XS(XS_Client_SilentMessage); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Client_SilentMessage) +{ + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: Client::SilentMessage(THIS, Message)"); + { + Client * THIS; + dXSTARG; + + if (sv_derived_from(ST(0), "Client")) { + IV tmp = SvIV((SV*)SvRV(ST(0))); + THIS = INT2PTR(Client *,tmp); + } + else + Perl_croak(aTHX_ "THIS is not of type Client"); + if(THIS == NULL) + Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); + if(THIS->GetTarget() != NULL){ + if(THIS->GetTarget()->IsNPC()){ + if (THIS->DistNoRootNoZ(*THIS->GetTarget()) <= 200) { + if(THIS->GetTarget()->CastToNPC()->IsMoving() && !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget())) + THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); + THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1))); + } + } + } + } + XSRETURN_EMPTY; +} + #ifdef __cplusplus extern "C" #endif @@ -6050,6 +6081,7 @@ XS(boot_Client) newXSproto(strcpy(buf, "SetHunger"), XS_Client_SetHunger, file, "$$"); newXSproto(strcpy(buf, "SetThirst"), XS_Client_SetThirst, file, "$$"); newXSproto(strcpy(buf, "SetConsumption"), XS_Client_SetConsumption, file, "$$$"); + newXSproto(strcpy(buf, "SilentMessage"), XS_Client_SilentMessage, file, "$$"); XSRETURN_YES; }