This command sends a voice message to the target player from the NPC.
It uses the same index that clients use for voice tells. This makes for some interesting custom content, such as NPCs that yell at you, or making your greeter NPCs a little more friendly.
Edited the diff, please let me know if it still works. :P
Diff @ 919:
Code:
Index: perlparser.cpp
===================================================================
--- perlparser.cpp (revision 919)
+++ perlparser.cpp (working copy)
@@ -547,6 +547,22 @@
XSRETURN_EMPTY;
}
+XS(XS__voicetell);
+XS(XS__voicetell)
+{
+ dXSARGS;
+ if (items != 2)
+ Perl_croak(aTHX_ "Usage: voicetell(clientname, type)");
+
+ char * str = (char *)SvPV_nolen(ST(0));
+ int macronum = (int)SvIV(ST(1));
+
+ quest_manager.voicetell(str, macronum);
+
+ XSRETURN_EMPTY;
+}
+
+
XS(XS__depop);
XS(XS__depop)
{
@@ -2817,6 +2833,7 @@
newXS(strcpy(buf, "shout"), XS__shout, file);
newXS(strcpy(buf, "shout2"), XS__shout2, file);
newXS(strcpy(buf, "gmsay"), XS__gmsay, file);
+ newXS(strcpy(buf, "voicetell"), XS__voicetell, file);
newXS(strcpy(buf, "depop"), XS__depop, file);
newXS(strcpy(buf, "settarget"), XS__settarget, file);
newXS(strcpy(buf, "follow"), XS__follow, file);
Index: questmgr.cpp
===================================================================
--- questmgr.cpp (revision 919)
+++ questmgr.cpp (working copy)
@@ -392,6 +392,10 @@
worldserver.SendChannelMessage(0,0,11,0, 0, "%s", str);
}
+void QuestManager::voicetell(char *str, int macronum) {
+ worldserver.SendVoiceMacroFromMob(owner,1,str,macronum);
+}
+
void QuestManager::depop(int npc_type) {
if(!owner->IsNPC())
return;
Index: questmgr.h
===================================================================
--- questmgr.h (revision 919)
+++ questmgr.h (working copy)
@@ -63,6 +63,7 @@
void shout(const char *str);
void shout2(const char *str);
void gmsay(const char *str);
+ void voicetell(char *str, int macronum);
void depop(int npc_type = 0);
void depopall(int npc_type = 0);
void depopzone(bool StartSpawnTimer = true);
Index: worldserver.cpp
===================================================================
--- worldserver.cpp (revision 919)
+++ worldserver.cpp (working copy)
@@ -1507,6 +1515,39 @@
return Ret;
}
+bool WorldServer::SendVoiceMacroFromMob(Mob* From, int32 Type, char* Target, int32 MacroNumber) {
+
+ if(!worldserver.Connected())
+ return false;
+
+ ServerPacket* pack = new ServerPacket(ServerOP_VoiceMacro, sizeof(ServerVoiceMacro_Struct));
+
+ ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer;
+
+ if(!From){
+ strcpy(svm->From, "A Mysterious Voice");
+ }
+ else {
+ strcpy(svm->From, From->GetCleanName());
+ }
+
+ strcpy(svm->To, Target);
+
+ svm->Type = 1;
+
+ svm->Voice = (GetArrayRace(From->GetRace()) * 2) + From->GetGender();
+
+ svm->MacroNumber = MacroNumber;
+
+ pack->Deflate();
+
+ bool Ret = SendPacket(pack);
+
+ safe_delete(pack);
+
+ return Ret;
+}
+
bool WorldServer::RezzPlayer(EQApplicationPacket* rpack,int32 rezzexp, int16 opcode) {
_log(SPELLS__REZ, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp);
ServerPacket* pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct));
Index: worldserver.h
===================================================================
--- worldserver.h (revision 919)
+++ worldserver.h (working copy)
@@ -39,6 +39,7 @@
bool SendEmoteMessage(const char* to, int32 to_guilddbid, int32 type, const char* message, ...);
bool SendEmoteMessage(const char* to, int32 to_guilddbid, sint16 to_minstatus, int32 type, const char* message, ...);
bool SendVoiceMacro(Client* From, int32 Type, char* Target, int32 MacroNumber, int32 GroupOrRaidID = 0);
+ bool SendVoiceMacroFromMob(Mob* From, int32 Type, char* Target, int32 MacroNumber);
void SetZone(int32 iZoneID, int32 iInstanceID = 0);
int32 SendGroupIdRequest();
bool RezzPlayer(EQApplicationPacket* rpack,int32 rezzexp, int16 opcode);
Use: quest::voicetell(charactername, macronum);
Example: quest::voicetell($name, 1); -- Will send a voice tell message to the person who triggered voicetell, with the voice emote of "Agree"