This is a sample of using perl to manipulate the nameplates, I know you wanted "permanent" but just to get an idea on the appearance packet usage.
This could be used for temporary short term changes to a players nameplate, ie, maybe they got mind controlled, diseased, whatever.
This will send an appearance packet but only people currently in the zone would see it, so if a client zones in after another client has this special appearance, they would see their "normal" appearance (green if gm, red if pvp enabled, blue else). Also, when the affected client zones, they would resume their normal appearance.
Code:
diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp
index d399d76..4d96198 100644
--- a/zone/perl_client.cpp
+++ b/zone/perl_client.cpp
@@ -6110,6 +6110,47 @@ XS(XS_Client_SendSpellAnim)
XSRETURN_EMPTY;
}
+//rencro color nameplate
+XS(XS_Client_NamePlate);
+XS(XS_Client_NamePlate)
+{
+ dXSARGS;
+ if (items != 2)
+ Perl_croak(aTHX_ "Usage: Client:NamePlate(THIS, red-green-blue)");
+ {
+ Client * THIS;
+ uint8 colorX = (uint8)SvUV(ST(1)); //
+ uint32 colorY = 0; //this will be the type of appearance
+ uint32 colorZ = 0; //this will be the value
+
+ 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 == nullptr)
+ Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
+
+ if (colorX == 1) {
+ colorY = 4; //pvp
+ colorZ = 0; //blue
+ }
+ else if (colorX == 2) {
+ colorY = 4; //pvp
+ colorZ = 1; //red
+ }
+ else if (colorX == 3) {
+ colorY = 20; //gm mode
+ colorZ = 1; //green
+ }
+
+ THIS->SendAppearancePacket(colorY, colorZ, true, false);
+ }
+ XSRETURN_EMPTY;
+}
+
+
#ifdef __cplusplus
extern "C"
#endif
@@ -6351,6 +6392,7 @@ XS(boot_Client)
newXSproto(strcpy(buf, "SendMarqueeMessage"), XS_Client_SendMarqueeMessage, file, "$$$$$$$");
newXSproto(strcpy(buf, "SendColoredText"), XS_Client_SendColoredText, file, "$$$");
newXSproto(strcpy(buf, "SendSpellAnim"), XS_Client_SendSpellAnim, file, "$$$");
+ newXSproto(strcpy(buf, "NamePlate"), XS_Client_NamePlate, file, "$$");
XSRETURN_YES;
}
And the perl would be something like this
Code:
sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("Hello, to change you nameplate colors use one, two, or three.");
}
elsif ($text=~/one/i) {
quest::say("One...is Blue");
$client->NamePlate(1);
}
elsif ($text=~/two/i) {
quest::say("two...is Red");
$client->NamePlate(2);
}
elsif ($text=~/three/i) {
quest::say("Three...is Green");
$client->NamePlate(3);
}
}
Also, once you go green, it wont change back unless you zone, or you have the #gm off command done on you, even if you are not a gm, but not going to pursue it as this is just for examples, blue and red are completely interchangeable