EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Title suffix quest command (https://www.eqemulator.org/forums/showthread.php?t=27821)

realityincarnate 04-04-2009 02:07 PM

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;
 }


trevius 04-04-2009 07:01 PM

Thanks! I am sure people will appreciate that. Would be nice to get one added for prefixes too, as I don't think we have one to handle those yet either.

I have looked through the packet for sending titles to the client so they can be used in the Titles window like normal. It doesn't seem like it would be hard at all to code that to work properly. Maybe at some point, I can try to get that going after the SoF work is all done :)


All times are GMT -4. The time now is 01:47 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.