View Single Post
  #1  
Old 04-04-2009, 02:07 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default Title suffix quest command [Committed in Rev420]

There was a thread not too long ago talking about using quest commands to add titles. There didn't seem to be any way to access the suffix part through the perl scripting, so I added one.

Syntax: $client->SetTitleSuffix(title)

Code:
Index: zone/perl_client.cpp
===================================================================
--- zone/perl_client.cpp	(revision 403)
+++ zone/perl_client.cpp	(working copy)
@@ -3524,6 +3524,32 @@
 	XSRETURN_EMPTY;
 }
 
+XS(XS_Client_SetTitleSuffix);
+XS(XS_Client_SetTitleSuffix) {
+	dXSARGS;
+	if (items != 2)
+		Perl_croak(aTHX_ "Usage: Client::SetTitleSuffix(THIS, txt)");
+	{
+		Client *		THIS;
+		char *		txt = (char *)SvPV_nolen(ST(1));
+
+		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(strlen(txt) > 31) 
+			Perl_croak(aTHX_ "Title must be 31 characters or less");
+
+		THIS->SetTitleSuffix(txt);
+	}
+	XSRETURN_EMPTY;
+}
+
 #ifdef __cplusplus
 extern "C"
 #endif
@@ -3675,6 +3701,7 @@
 		newXSproto(strcpy(buf, "SendZoneFlagInfo"), XS_Client_SendZoneFlagInfo, file, "$$");
 		newXSproto(strcpy(buf, "LoadZoneFlags"), XS_Client_LoadZoneFlags, file, "$");
 		newXSproto(strcpy(buf, "SetAATitle"), XS_Client_SetAATitle, file, "$$");
+		newXSproto(strcpy(buf, "SetTitleSuffix"), XS_Client_SetTitleSuffix, file, "$$");
 	XSRETURN_YES;
 }

Last edited by Derision; 04-10-2009 at 09:13 PM.. Reason: [Committed in Rev420]
Reply With Quote