mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[10288] Unsummon pet if pet direct control spell expire out of visibility range from owner.
This commit is contained in:
parent
ed737c55cd
commit
3099a99f9a
2 changed files with 17 additions and 7 deletions
|
|
@ -3435,20 +3435,21 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
|
|||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Unit* target = GetTarget();
|
||||
if (target->GetTypeId() != TYPEID_UNIT)
|
||||
if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->isPet())
|
||||
return;
|
||||
Creature* pet = (Creature*)target; // not need more stricted type check
|
||||
|
||||
Pet* pet = (Pet*)target;
|
||||
|
||||
Player* p_caster = (Player*)caster;
|
||||
Camera& camera = p_caster->GetCamera();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
target->addUnitState(UNIT_STAT_CONTROLLED);
|
||||
pet->addUnitState(UNIT_STAT_CONTROLLED);
|
||||
|
||||
// target should became visible at SetView call(if not visible before):
|
||||
// otherwise client\p_caster will ignore packets from the target(SetClientControl for example)
|
||||
|
|
@ -3483,8 +3484,17 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
|
|||
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
pet->AttackStop();
|
||||
pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
pet->AddSplineFlag(SPLINEFLAG_WALKMODE);
|
||||
|
||||
// out of range pet dismissed
|
||||
if (!pet->IsWithinDistInMap(p_caster, pet->GetMap()->GetVisibilityDistance()))
|
||||
{
|
||||
pet->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pet->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
pet->AddSplineFlag(SPLINEFLAG_WALKMODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10287"
|
||||
#define REVISION_NR "10288"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue