Implement pet regroup

Tweaks to stop as well
This commit is contained in:
Michael Cook (mackal) 2017-05-04 23:48:47 -04:00
parent 0e96e6689a
commit d6b61b9163
7 changed files with 72 additions and 9 deletions

View File

@ -2516,9 +2516,6 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
}
}
if (IsPetStop())
return;
// Pet that is /pet hold on will not add to their hate list if they're not engaged
// Pet that is /pet hold on and /pet focus on will not add others to their hate list
// Pet that is /pet ghold on will never add to their hate list unless /pet attack or /pet qattack
@ -2528,7 +2525,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b
if (IsPet()) {
if ((IsGHeld() || (IsHeld() && IsFocused())) && !on_hatelist) // we want them to be able to climb the hate list
return;
if (IsHeld() && !wasengaged)
if ((IsHeld() || IsPetStop() || IsPetRegroup()) && !wasengaged) // not 100% sure on stop/regroup kind of hard to test, but regroup is like "classic hold"
return;
}
}

View File

@ -10017,6 +10017,10 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
mypet->SetPetStop(false);
SetPetCommandState(PET_BUTTON_STOP, 0);
}
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
SetPetCommandState(PET_BUTTON_REGROUP, 0);
}
zone->AddAggroMob();
// classic acts like qattack
int hate = 1;
@ -10054,6 +10058,10 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
mypet->SetPetStop(false);
SetPetCommandState(PET_BUTTON_STOP, 0);
}
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
SetPetCommandState(PET_BUTTON_REGROUP, 0);
}
zone->AddAggroMob();
mypet->AddToHateList(GetTarget(), 1, 0, true, false, false, SPELL_UNKNOWN, true);
Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName());
@ -10422,6 +10430,10 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
mypet->SetPetStop(true);
mypet->SetCurrentSpeed(0);
mypet->SetTarget(nullptr);
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
SetPetCommandState(PET_BUTTON_REGROUP, 0);
}
}
mypet->Say_StringID(MT_PetResponse, PET_GETLOST_STRING);
}
@ -10435,6 +10447,10 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
mypet->SetCurrentSpeed(0);
mypet->SetTarget(nullptr);
mypet->Say_StringID(MT_PetResponse, PET_GETLOST_STRING);
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
SetPetCommandState(PET_BUTTON_REGROUP, 0);
}
}
break;
}
@ -10447,6 +10463,48 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app)
}
break;
}
case PET_REGROUP: {
if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF
if (aabonuses.PetCommands[PetCommand]) {
if (mypet->IsPetRegroup()) {
mypet->SetPetRegroup(false);
mypet->Say_StringID(MT_PetResponse, PET_OFF_REGROUPING);
} else {
mypet->SetPetRegroup(true);
mypet->SetTarget(nullptr);
mypet->Say_StringID(MT_PetResponse, PET_ON_REGROUPING);
if (mypet->IsPetStop()) {
mypet->SetPetStop(false);
SetPetCommandState(PET_BUTTON_STOP, 0);
}
}
}
break;
}
case PET_REGROUP_ON: {
if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF
if (aabonuses.PetCommands[PetCommand]) {
mypet->SetPetRegroup(true);
mypet->SetTarget(nullptr);
mypet->Say_StringID(MT_PetResponse, PET_ON_REGROUPING);
if (mypet->IsPetStop()) {
mypet->SetPetStop(false);
SetPetCommandState(PET_BUTTON_STOP, 0);
}
}
break;
}
case PET_REGROUP_OFF: {
if (mypet->IsFeared()) break; //could be exploited like PET_BACKOFF
if (aabonuses.PetCommands[PetCommand]) {
mypet->SetPetRegroup(false);
mypet->Say_StringID(MT_PetResponse, PET_OFF_REGROUPING);
}
break;
}
default:
printf("Client attempted to use a unknown pet command:\n");
break;

View File

@ -89,9 +89,9 @@
#define PET_GETLOST 29 // 0x1d - /pet get lost
#define PET_GUARDME 30 // 0x1e - Same as /pet follow, but different message in older clients - define not from client /pet target in modern clients but doesn't send packet
#define PET_REGROUP 31 // 0x1f - /pet regroup, acts like classic hold. Stops attack and moves back to guard/you but doesn't clear hate list
#define PET_REGROUPON 32 // 0x20 - /pet regroup on, turns on regroup
#define PET_REGROUPOFF 33 // 0x21 - /pet regroup off, turns off regroup
#define PET_MAXCOMMANDS PET_REGROUPOFF + 1
#define PET_REGROUP_ON 32 // 0x20 - /pet regroup on, turns on regroup
#define PET_REGROUP_OFF 33 // 0x21 - /pet regroup off, turns off regroup
#define PET_MAXCOMMANDS PET_REGROUP_OFF + 1
// can change the state of these buttons with a packet
#define PET_BUTTON_SIT 0

View File

@ -348,6 +348,7 @@ Mob::Mob(const char* in_name,
nocast = false;
focused = false;
pet_stop = false;
pet_regroup = false;
_IsTempPet = false;
pet_owner_client = false;
pet_targetlock_id = 0;

View File

@ -877,6 +877,8 @@ public:
inline const bool IsFocused() const { return focused; }
inline void SetPetStop(bool nState) { pet_stop = nState; }
inline const bool IsPetStop() const { return pet_stop; }
inline void SetPetRegroup(bool nState) { pet_regroup = nState; }
inline const bool IsPetRegroup() const { return pet_regroup; }
inline const bool IsRoamer() const { return roamer; }
inline const int GetWanderType() const { return wandertype; }
inline const bool IsRooted() const { return rooted || permarooted; }
@ -1187,6 +1189,7 @@ protected:
bool nocast;
bool focused;
bool pet_stop;
bool pet_regroup;
bool spawned;
void CalcSpellBonuses(StatBonuses* newbon);
virtual void CalcBonuses();

View File

@ -935,7 +935,7 @@ void Mob::AI_Process() {
bool engaged = IsEngaged();
bool doranged = false;
if (!zone->CanDoCombat() || IsPetStop()) {
if (!zone->CanDoCombat() || IsPetStop() || IsPetRegroup()) {
engaged = false;
}
@ -943,7 +943,7 @@ void Mob::AI_Process() {
//
if(RuleB(Combat, EnableFearPathing)){
if(currently_fleeing) {
if((IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosestEntOnHateList(this)))) && !IsPetStop()) {
if((IsRooted() || (IsBlind() && CombatRange(hate_list.GetClosestEntOnHateList(this)))) && !IsPetStop() && !IsPetRegroup()) {
//make sure everybody knows were not moving, for appearance sake
if(IsMoving())
{
@ -1411,6 +1411,8 @@ void Mob::AI_Process() {
break;
}
}
if (IsPetRegroup())
return;
}
/* Entity has been assigned another entity to follow */
else if (GetFollowID())

View File

@ -332,6 +332,8 @@
#define PET_ON_GHOLD 6843 //Pet greater hold has been set to on.
#define PET_OFF_GHOLD 6846 //Pet greater hold has been set to off.
#define PET_GHOLD_ON_MSG 6847 //Now greater holding master. I will only attack something new if ordered.
#define PET_ON_REGROUPING 6854 //Now regrouping, master.
#define PET_OFF_REGROUPING 6855 //No longer regrouping, master.
#define BUFF_NOT_BLOCKABLE 7608 //You cannot block this effect.
#define LDON_DONT_KNOW_TRAPPED 7552 //You do not know if this object is trapped.
#define LDON_HAVE_DISARMED 7553 //You have disarmed %1!