PDA

View Full Version : COMMITTED: /pet who leader fix


LeftRoad
01-24-2010, 08:13 AM
"My leader is ."

Not anymore. I know it is mostly flavor but it may be useful on the larger servers.

#1 -- If you have a pet and have nothing targetted, your pet will respond with your name.

#2 -- If you target someone else's pet, whether you have a pet or not, that pet will respond with its leader's name. This works for player, npc, and even bot pets.

#3 -- As an unexpected bonus, using this on a bot will cause it to respond with the person that created them.

client_packet.cpp --- Here's the diff...

--- client_packet.orig.cpp 2010-01-21 06:49:35.000000000 -0500
+++ client_packet.cpp 2010-01-23 06:30:06.000000000 -0500
@@ -5978,7 +5978,23 @@ void Client::Handle_OP_PetCommands(const
char val1[20]={0};
PetCommand_Struct* pet = (PetCommand_Struct*) app->pBuffer;
Mob* mypet = this->GetPet();
- if(!mypet) return;
+
+ // Allow other players to ask a pet who their owner is.
+ if(!mypet || pet->command == PET_LEADER) {
+ if(pet->command == PET_LEADER) {
+ if(mypet && this->GetTarget() == NULL) {
+ // If I have a pet and don't have a target, grab my name.
+ mypet->Say_StringID(PET_LEADERIS,this->GetName());
+ } else if(this->GetTarget() != NULL) {
+ // If I have a target, check my target for an owner.
+ mypet = this->GetTarget();
+ if(mypet->GetOwner())
+ mypet->Say_StringID(PET_LEADERIS,mypet->GetOwner()->GetCleanName());
+ }
+ }
+
+ return;
+ }

if(mypet->GetPetType() == petAnimation && (pet->command != PET_HEALTHREPORT && pet->command != PET_GETLOST) && !GetAA(aaAnimationEmpathy))
return;
@@ -6050,10 +6066,6 @@ void Client::Handle_OP_PetCommands(const

break;
}
- case PET_LEADER: {
- mypet->Say_StringID(PET_LEADERIS);
- break;
- }
case PET_GUARDHERE: {
if (mypet->IsFeared()) break; //AndMetal: could be exploited like PET_BACKOFF

Derision
01-24-2010, 10:40 AM
This is in 1158, thanks :)