View Single Post
  #1  
Old 08-06-2009, 04:09 PM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,449
Default GMSay for quests

Here it is. Requested by Trevius, it sends a message to GMSay in a quest command.


Use:

gmsay("string");

Output:

Zserver GMSAYS, 'string'

Diff:

Code:
Index: parser.cpp
===================================================================
--- parser.cpp	(revision 890)
+++ parser.cpp	(working copy)
@@ -837,6 +837,9 @@
 	else if (!strcmp(command,"shout2")) {
 		quest_manager.shout2(parms.c_str());
 	}
+	else if (!strcmp(command,"gmsay")) {
+		quest_manager.shout2(parms.c_str());
+	}
 	else if (!strcmp(command,"shout")) {
 		quest_manager.shout(parms.c_str());
 	}
Index: perlparser.cpp
===================================================================
--- perlparser.cpp	(revision 890)
+++ perlparser.cpp	(working copy)
@@ -533,6 +533,19 @@
 	XSRETURN_EMPTY;
 }
 
+XS(XS__gmsay)
+{
+	dXSARGS;
+	if (items != 1)
+		Perl_croak(aTHX_ "Usage: gmsay(str)");
+
+	char *		str = (char *)SvPV_nolen(ST(0));
+
+	quest_manager.gmsay(str);
+
+	XSRETURN_EMPTY;
+}
+
 XS(XS__depop);
 XS(XS__depop)
 {
@@ -2802,6 +2815,7 @@
 		newXS(strcpy(buf, "emote"), XS__emote, file);
 		newXS(strcpy(buf, "shout"), XS__shout, file);
 		newXS(strcpy(buf, "shout2"), XS__shout2, file);
+		newXS(strcpy(buf, "gmsay"), XS__gmsay, 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 890)
+++ questmgr.cpp	(working copy)
@@ -388,6 +388,10 @@
 	worldserver.SendEmoteMessage(0,0,0,13, "%s shouts, '%s'", owner->GetCleanName(), str);
 }
 
+void QuestManager::gmsay(const char *str) {
+	worldserver.SendChannelMessage(0,0,11,0, 0, "%s", str);
+}
+
 void QuestManager::depop(int npc_type) {
 	if(!owner->IsNPC())
 		return;
Index: questmgr.h
===================================================================
--- questmgr.h	(revision 890)
+++ questmgr.h	(working copy)
@@ -62,6 +62,7 @@
 	void emote(const char *str);
 	void shout(const char *str);
 	void shout2(const char *str);
+	void gmsay(const char *str);
 	void depop(int npc_type = 0);
 	void depopall(int npc_type = 0);
 	void depopzone(bool StartSpawnTimer = true);
Reply With Quote