mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13: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;
|
return;
|
||||||
|
|
||||||
Unit* caster = GetCaster();
|
Unit* caster = GetCaster();
|
||||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Unit* target = GetTarget();
|
Unit* target = GetTarget();
|
||||||
if (target->GetTypeId() != TYPEID_UNIT)
|
if (target->GetTypeId() != TYPEID_UNIT || !((Creature*)target)->isPet())
|
||||||
return;
|
return;
|
||||||
Creature* pet = (Creature*)target; // not need more stricted type check
|
|
||||||
|
Pet* pet = (Pet*)target;
|
||||||
|
|
||||||
Player* p_caster = (Player*)caster;
|
Player* p_caster = (Player*)caster;
|
||||||
Camera& camera = p_caster->GetCamera();
|
Camera& camera = p_caster->GetCamera();
|
||||||
|
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
target->addUnitState(UNIT_STAT_CONTROLLED);
|
pet->addUnitState(UNIT_STAT_CONTROLLED);
|
||||||
|
|
||||||
// target should became visible at SetView call(if not visible before):
|
// target should became visible at SetView call(if not visible before):
|
||||||
// otherwise client\p_caster will ignore packets from the target(SetClientControl for example)
|
// otherwise client\p_caster will ignore packets from the target(SetClientControl for example)
|
||||||
|
|
@ -3483,9 +3484,18 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
|
||||||
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||||
|
|
||||||
pet->AttackStop();
|
pet->AttackStop();
|
||||||
|
|
||||||
|
// 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->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||||
pet->AddSplineFlag(SPLINEFLAG_WALKMODE);
|
pet->AddSplineFlag(SPLINEFLAG_WALKMODE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real)
|
void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10287"
|
#define REVISION_NR "10288"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue