This comes from intercepting a command like !petname <name>. I was flowing those through a universal world script at the time so that a player could just type it in chat without needing an NPC receiver, but these days I gather there are more convenient ways to do it.
Code:
if($text =~/^!petname/i)
{
my $pid = $client->GetPetID();
my $pet = $entity_list->GetMobByID($pid);
if($pet)
{
($cm, $petname) = split(/\ /, $text, 2);
$pet->TempName($petname);
$client->Message(315, "Your pet name has been changed.");
$client->Message(315, "This is a family friendly server. Please be considerate when choosing a pet name.");
}
}
While we're at this, I also see I had a pet size function.
Code:
if($text =~/^!petsize/i)
{
my $pid = $client->GetPetID();
my $pet = $entity_list->GetMobByID($pid);
if($pet)
{
my $cursize = $pet->GetSize();
($cm, $petsize) = split(/\ /, $text, 2);
if ($petsize > 9)
{
$petsize = 9; ## Not abnormally large
}
if ($petsize < 1)
{
$petsize = 1; ## Not abnormally small
}
$newsize = $petsize - $cursize;
$pet->ChangeSize($petsize);
$client->Message(315, "Your pet's size has been changed.");
$client->Message(315, "Please do not abuse this function. Extremely large pets can lag the zone and cause issues for other people.");
}
}