Allow /pet attack by mob name to work

ex. /pet attack a_snake
This commit is contained in:
Michael Cook (mackal) 2015-04-26 13:35:36 -04:00
parent 47c9690a32
commit 0d84ede3d6
14 changed files with 31 additions and 30 deletions

View File

@ -1160,7 +1160,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*000*/ uint32 command;
/*004*/ uint32 unknown;
/*004*/ uint32 target;
};
/*

View File

@ -4717,7 +4717,7 @@ namespace RoF
SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct);
IN(command);
emu->unknown = eq->unknown04;
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -4864,7 +4864,7 @@ namespace RoF2
SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct);
IN(command);
emu->unknown = eq->unknown04;
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -1293,7 +1293,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*00*/ uint32 command;
/*04*/ uint32 unknown04;
/*04*/ uint32 target;
/*08*/ uint32 unknown08;
};

View File

@ -1323,7 +1323,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*00*/ uint32 command;
/*04*/ uint32 unknown04;
/*04*/ uint32 target;
/*08*/ uint32 unknown08;
};

View File

@ -3349,7 +3349,7 @@ namespace SoD
default:
emu->command = eq->command;
}
OUT(unknown);
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -1091,7 +1091,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*000*/ uint32 command;
/*004*/ uint32 unknown;
/*004*/ uint32 target;
};
/*

View File

@ -2687,7 +2687,7 @@ namespace SoF
default:
emu->command = eq->command;
}
OUT(unknown);
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -1068,7 +1068,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*000*/ uint32 command;
/*004*/ uint32 unknown;
/*004*/ uint32 target;
};
/*

View File

@ -1942,7 +1942,7 @@ namespace Titanium
default:
emu->command = eq->command;
}
OUT(unknown);
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -950,7 +950,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*000*/ uint32 command;
/*004*/ uint32 unknown;
/*004*/ uint32 target;
};
/*

View File

@ -3599,7 +3599,7 @@ namespace UF
SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct);
IN(command);
IN(unknown);
IN(target);
FINISH_DIRECT_DECODE();
}

View File

@ -1146,7 +1146,7 @@ struct TargetReject_Struct {
struct PetCommand_Struct {
/*000*/ uint32 command;
/*004*/ uint32 unknown;
/*004*/ uint32 target;
};
/*

View File

@ -9752,6 +9752,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
char val1[20] = { 0 };
PetCommand_Struct* pet = (PetCommand_Struct*)app->pBuffer;
Mob* mypet = this->GetPet();
Mob *target = entity_list.GetMob(pet->target);
if (!mypet || pet->command == PET_LEADER)
{
@ -9799,22 +9800,22 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
switch (PetCommand)
{
case PET_ATTACK: {
if (!GetTarget())
if (!target)
break;
if (GetTarget()->IsMezzed()) {
Message_StringID(10, CANNOT_WAKE, mypet->GetCleanName(), GetTarget()->GetCleanName());
if (target->IsMezzed()) {
Message_StringID(10, CANNOT_WAKE, mypet->GetCleanName(), target->GetCleanName());
break;
}
if (mypet->IsFeared())
break; //prevent pet from attacking stuff while feared
if (!mypet->IsAttackAllowed(GetTarget())) {
if (!mypet->IsAttackAllowed(target)) {
mypet->Say_StringID(NOT_LEGAL_TARGET);
break;
}
if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) {
if (GetTarget() != this && DistanceSquaredNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
if (target != this && DistanceSquaredNoZ(mypet->GetPosition(), target->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) {
if (mypet->IsHeld()) {
if (!mypet->IsFocused()) {
mypet->SetHeld(false); //break the hold and guard if we explicitly tell the pet to attack.
@ -9822,12 +9823,12 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
mypet->SetPetOrder(SPO_Follow);
}
else {
mypet->SetTarget(GetTarget());
mypet->SetTarget(target);
}
}
zone->AddAggroMob();
mypet->AddToHateList(GetTarget(), 1);
Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName());
mypet->AddToHateList(target, 1);
Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), target->GetCleanName());
}
}
break;