Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-11-2009, 06:15 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default COMMITTED: quest::voicetell(charactername, macronum)

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"

Last edited by Secrets; 08-11-2009 at 02:17 PM.. Reason: Edited: fixin diffin
Reply With Quote
  #2  
Old 08-11-2009, 09:09 AM
steve
Discordant
 
Join Date: Jan 2002
Posts: 305
Default

Wow, awesome idea! Never even thought of something like this. Will definitely make things more interesting to be walking past an NPC and he yells at you trying to get your attention. Kinda like EQ2
Reply With Quote
  #3  
Old 08-11-2009, 04:39 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, that definitely opens up some options for custom content

I would suggest adding 2 more fields to that for Race and Gender instead of doing this:

Code:
svm->Voice = (GetArrayRace(From->GetRace()) * 2) + From->GetGender();
We could probably break that up by doing this:

Code:
svm->Voice = (GetArrayRace(in_race) * 2) + in_gender;
And just set in_race and in_gender on the input of the command. We can always set a default for in_race and in_gender to be human male or something if it wasn't specified.

Other than that, there is only 1 more thing I think we need to work out on this; The messages that the client shows when a voice macro is sent. I am not even sure if it is possible to create the audio sound without triggering the tell, group, or raid messages, but I definitely think it is worth playing around with filling in the structure with different things to try it. Last night, I had Secrets try sending a type of 0, since 1 is tell, 2 is group and 3 is raid, but he said that just gave no result at all. I am probably going to play around with this a bit and see if there is anyway to trick adjust that packet so it sends the sound without sending the message. Basically, I want it to work like when you click the "test" button in the voice macro window, where you just hear the sound and no message is sent. Maybe if we changed the type field to 4 it would do it, or maybe one of the other fields in the struct can cause it to not display the message.

I thought for sure that there used to be a way to trigger the voice macro without sending the message. So, when someone was doing a pull, they could have their normal pull hotkey message and then trigger any audio they wanted to go with that, without having to send a second message to the group/raid. It has been years since I actually played with it though, so maybe I am making that up, lol.

Anyway, this is definitely a cool option, and I think it has a lot of potential to add more diversity for people who actually play with sound turned on
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 08-12-2009, 12:06 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

I added two other parameters to this today, as requested by Trevius. (and it only makes sense that we have them available.)

Updated diff, apply this after the other one

edit: gotta fix the diff.
Reply With Quote
  #5  
Old 08-12-2009, 12:12 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

Diff @ r921

Code:
Index: perlparser.cpp
===================================================================
--- perlparser.cpp	(revision 921)
+++ perlparser.cpp	(working copy)
@@ -547,6 +547,24 @@
 	XSRETURN_EMPTY;
 }
 
+XS(XS__voicetell);
+XS(XS__voicetell)
+{
+	dXSARGS;
+	if (items != 4)
+		Perl_croak(aTHX_ "Usage: voicetell(clientname, type, race, gender)");
+
+	char *	str = (char *)SvPV_nolen(ST(0));
+	int	macronum = (int)SvIV(ST(1));
+	int	racenum = (int)SvIV(ST(2));
+	int	gendernum = (int)SvIV(ST(3));
+
+	quest_manager.voicetell(str, macronum, racenum, gendernum);
+
+	XSRETURN_EMPTY;
+}
+
+
 XS(XS__depop);
 XS(XS__depop)
 {
@@ -2817,6 +2835,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 921)
+++ questmgr.cpp	(working copy)
@@ -392,6 +392,10 @@
 	worldserver.SendChannelMessage(0,0,11,0, 0, "%s", str);
 }
 
+void QuestManager::voicetell(char *str, int macronum, int racenum, int gendernum) {
+	worldserver.SendVoiceMacroFromMob(owner,1,str,macronum, racenum, gendernum);
+}
+
 void QuestManager::depop(int npc_type) {
 	if(!owner->IsNPC())
 		return;
Index: questmgr.h
===================================================================
--- questmgr.h	(revision 921)
+++ 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, int racenum, int gendernum);
 	void depop(int npc_type = 0);
 	void depopall(int npc_type = 0);
 	void depopzone(bool StartSpawnTimer = true);
Index: worldserver.cpp
===================================================================
--- worldserver.cpp	(revision 921)
+++ worldserver.cpp	(working copy)
@@ -1507,6 +1507,39 @@
 	return Ret;
 }
 
+bool WorldServer::SendVoiceMacroFromMob(Mob* From, int32 Type, char* Target, int32 MacroNumber, int16 racenum, int8 gendernum) {
+
+	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 = (racenum * 2) + gendernum;
+
+	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 921)
+++ 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, int16 racenum, int8 gendernum);
 	void SetZone(int32 iZoneID, int32 iInstanceID = 0);
 	int32 SendGroupIdRequest();
 	bool RezzPlayer(EQApplicationPacket* rpack,int32 rezzexp, int16 opcode);
Reply With Quote
  #6  
Old 08-12-2009, 02:04 PM
RichardoX
Hill Giant
 
Join Date: Dec 2004
Location: in your closet....
Posts: 169
Default

Do you have a list of voice emotes?
__________________
a hill giant slashes YOU for 25 points of damage!
You have been slain!
LOADING, PLEASE WAIT...
Reply With Quote
  #7  
Old 08-12-2009, 07:46 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

Quote:
Originally Posted by RichardoX View Post
Do you have a list of voice emotes?
Yes. Open up the voice window in-game for clients, the IDs are there.
Reply With Quote
  #8  
Old 08-15-2009, 03:56 AM
RichardoX
Hill Giant
 
Join Date: Dec 2004
Location: in your closet....
Posts: 169
Default

Quote:
Originally Posted by Secrets View Post
Yes. Open up the voice window in-game for clients, the IDs are there.
Very awesome creation Secrets!
__________________
a hill giant slashes YOU for 25 points of damage!
You have been slain!
LOADING, PLEASE WAIT...
Reply With Quote
  #9  
Old 01-27-2010, 12:17 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

Should this be moved to custom code, or is it good enough to commit it?

I've been using this and the only thing it needs is a null pointer check for (!Target), incase of invis GMs. Other than that, it works fine.
Reply With Quote
  #10  
Old 01-27-2010, 01:10 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

I'll commit it shortly.
Reply With Quote
  #11  
Old 01-27-2010, 01:34 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

Just looking at it now, do we really need the ability to send the VoiceTell from a quest to a player in another zone ?

If not, then we can just do an entity_list.GetClientByName and send an OP_VoiceMacroOut directly to them in the current zone, rather than shipping a packet off to world.
Reply With Quote
  #12  
Old 01-27-2010, 02:07 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

Quote:
Originally Posted by Derision View Post
Just looking at it now, do we really need the ability to send the VoiceTell from a quest to a player in another zone ?

If not, then we can just do an entity_list.GetClientByName and send an OP_VoiceMacroOut directly to them in the current zone, rather than shipping a packet off to world.
Actually, that's probably a better idea.

I don't think for this specific command we'd need to send a packet off to world.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:41 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3