Added setAnimalTitle

feature/prepare-cross-merge
Nuno 4 years ago committed by kaetemi
parent 141e7c6459
commit 4008a69448
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -3292,6 +3292,26 @@ NLMISC_COMMAND(setPlayerPetName, "change the name of a player pet", "<uid> <inde
return true;
}
//----------------------------------------------------------------------------
NLMISC_COMMAND(setPlayerPetTitle, "change the name of a player pet", "<uid> <index> <title>")
{
if (args.size() != 3)
return false;
GET_ACTIVE_CHARACTER
uint8 index;
fromString(args[1], index);
string title;
if (args[2] != "-")
title = args[2];
else
title = "";
c->setAnimalTitle(index, title);
log.displayNL("OK");
return true;
}
//setPlayerVisual 530162 haircut fy_hof_hair_basic02.sitem
//----------------------------------------------------------------------------
NLMISC_COMMAND(setPlayerVisual, "get visual of a player", "<uid> <visual_prop1>[,<visual_prop1>,...] <arg1>[,<arg2>,...]")

@ -7796,6 +7796,32 @@ void CCharacter::setAnimalName(uint8 petIndex, ucstring customName)
sendMessageViaMirror("IOS", msgout);
}
void CCharacter::setAnimalTitle(uint8 petIndex, string title)
{
if (petIndex < 0 || petIndex >= MAX_INVENTORY_ANIMAL)
{
nlwarning("<CCharacter::setAnimalName> Incorect animal index '%d'.", petIndex);
return;
}
CPetAnimal &animal = _PlayerPets[petIndex];
string name = animal.getCustomName().toUtf8();
if (name.find('$') != string::npos)
{
name = name.substr(0, name.find('$'));
}
ucstring customName;
customName.fromUtf8(name+"$"+title)
animal.setCustomName(customName);
sendPetCustomNameToClient(petIndex);
TDataSetRow row = animal.SpawnedPets;
NLNET::CMessage msgout("CHARACTER_NAME");
msgout.serial(row);
msgout.serial(customName);
sendMessageViaMirror("IOS", msgout);
}
//-----------------------------------------------------------------------------
void CCharacter::sendPetCustomNameToClient(uint8 petIndex)
{

@ -1111,6 +1111,7 @@ public:
// Set the name of the animal
void setAnimalName(uint8 petIndex, ucstring customName);
void setAnimalTitle(uint8 petIndex, string title);
void sendPetCustomNameToClient(uint8 petIndex);

Loading…
Cancel
Save