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 { struct PetCommand_Struct {
/*000*/ uint32 command; /*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); SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct);
IN(command); IN(command);
emu->unknown = eq->unknown04; IN(target);
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -122,7 +122,7 @@ namespace Titanium
EAT_ENCODE(OP_GuildMemberLevelUpdate); // added ; EAT_ENCODE(OP_GuildMemberLevelUpdate); // added ;
EAT_ENCODE(OP_ZoneServerReady); // added ; EAT_ENCODE(OP_ZoneServerReady); // added ;
ENCODE(OP_Action) ENCODE(OP_Action)
{ {
ENCODE_LENGTH_EXACT(Action_Struct); ENCODE_LENGTH_EXACT(Action_Struct);
@ -326,7 +326,7 @@ namespace Titanium
{ {
SETUP_VAR_ENCODE(ExpeditionCompass_Struct); SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count); ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(count); OUT(count);
for (uint32 i = 0; i < emu->count; ++i) for (uint32 i = 0; i < emu->count; ++i)
@ -1308,7 +1308,7 @@ namespace Titanium
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]); VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, emu->unknown12[11]);
VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str()); VARSTRUCT_ENCODE_STRING(OutBuffer, new_message.c_str());
delete[] __emu_buffer; delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req); dest->FastQueuePacket(&in, ack_req);
} }
@ -1351,7 +1351,7 @@ namespace Titanium
InBuffer += strlen(InBuffer) + 1; InBuffer += strlen(InBuffer) + 1;
memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct)); memcpy(OutBuffer, InBuffer, sizeof(TaskDescriptionTrailer_Struct));
delete[] __emu_buffer; delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req); dest->FastQueuePacket(&in, ack_req);
} }
@ -1621,7 +1621,7 @@ namespace Titanium
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ApplyPoison) DECODE(OP_ApplyPoison)
{ {
DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct); DECODE_LENGTH_EXACT(structs::ApplyPoison_Struct);
@ -1942,7 +1942,7 @@ namespace Titanium
default: default:
emu->command = eq->command; emu->command = eq->command;
} }
OUT(unknown); IN(target);
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
@ -2151,7 +2151,7 @@ namespace Titanium
return serverSlot; // deprecated return serverSlot; // deprecated
} }
static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot) static inline int16 ServerToTitaniumCorpseSlot(uint32 serverCorpseSlot)
{ {
//int16 TitaniumCorpse; //int16 TitaniumCorpse;
@ -2166,7 +2166,7 @@ namespace Titanium
return titaniumSlot; // deprecated return titaniumSlot; // deprecated
} }
static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot) static inline uint32 TitaniumToServerCorpseSlot(int16 titaniumCorpseSlot)
{ {
//uint32 ServerCorpse; //uint32 ServerCorpse;

View File

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

View File

@ -2213,7 +2213,7 @@ namespace UF
FINISH_ENCODE(); FINISH_ENCODE();
return; return;
} }
unsigned char *emu_ptr = __emu_buffer; unsigned char *emu_ptr = __emu_buffer;
emu_ptr += sizeof(CharacterSelect_Struct); emu_ptr += sizeof(CharacterSelect_Struct);
CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr; CharacterSelectEntry_Struct *emu_cse = (CharacterSelectEntry_Struct *)nullptr;
@ -3599,7 +3599,7 @@ namespace UF
SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct); SETUP_DIRECT_DECODE(PetCommand_Struct, structs::PetCommand_Struct);
IN(command); IN(command);
IN(unknown); IN(target);
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
@ -3861,7 +3861,7 @@ namespace UF
UF::structs::ItemSerializationHeaderFinish hdrf; UF::structs::ItemSerializationHeaderFinish hdrf;
hdrf.ornamentIcon = ornaIcon; hdrf.ornamentIcon = ornaIcon;
hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit.. hdrf.unknown060 = 0; //This is Always 0.. or it breaks shit..
hdrf.unknown061 = 0; //possibly ornament / special ornament hdrf.unknown061 = 0; //possibly ornament / special ornament
hdrf.isCopied = 0; //Flag for item to be 'Copied' hdrf.isCopied = 0; //Flag for item to be 'Copied'
hdrf.ItemClass = item->ItemClass; hdrf.ItemClass = item->ItemClass;

View File

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