[10200] Correct function call sequence in possess aura handlers

also removed not needed ResetView call in dummy aura handler

(based on SilverIce's repo commit c3f02ed)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
SilverIce 2010-07-16 20:11:17 +04:00 committed by VladimirMangos
parent ae51168ffc
commit ea4afebff8
2 changed files with 16 additions and 17 deletions

View file

@ -2053,17 +2053,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// AT REMOVE // AT REMOVE
else else
{ {
if (target->GetTypeId() == TYPEID_PLAYER &&
(GetSpellProto()->Effect[EFFECT_INDEX_0] == 72 || GetSpellProto()->Effect[EFFECT_INDEX_0] == 6 &&
(GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 1 || GetSpellProto()->EffectApplyAuraName[EFFECT_INDEX_0] == 128)))
{
// spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425
((Player*)target)->GetCamera().ResetView();
WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
((Player*)target)->GetSession()->SendPacket(&data);
return;
}
if (IsQuestTameSpell(GetId()) && target->isAlive()) if (IsQuestTameSpell(GetId()) && target->isAlive())
{ {
Unit* caster = GetCaster(); Unit* caster = GetCaster();
@ -3311,13 +3300,14 @@ void Aura::HandleModPossess(bool apply, bool Real)
target->addUnitState(UNIT_STAT_CONTROLLED); target->addUnitState(UNIT_STAT_CONTROLLED);
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
target->SetCharmerGUID(p_caster->GetGUID()); target->SetCharmerGUID(p_caster->GetGUID());
target->setFaction(p_caster->getFaction()); target->setFaction(p_caster->getFaction());
p_caster->SetCharm(target); // target should became visible at SetView call(if not visible before):
// otherwise client\p_caster will ignore packets from the target(SetClientControl for example)
camera.SetView(target); camera.SetView(target);
p_caster->SetCharm(target);
p_caster->SetClientControl(target, 1); p_caster->SetClientControl(target, 1);
p_caster->SetMover(target); p_caster->SetMover(target);
@ -3348,10 +3338,13 @@ void Aura::HandleModPossess(bool apply, bool Real)
{ {
p_caster->SetCharm(NULL); p_caster->SetCharm(NULL);
camera.ResetView();
p_caster->SetClientControl(target, 0); p_caster->SetClientControl(target, 0);
p_caster->SetMover(NULL); p_caster->SetMover(NULL);
// there is a possibility that target became invisible for client\p_caster at ResetView call:
// it must be called after movement control unapplying, not before! the reason is same as at aura applying
camera.ResetView();
p_caster->RemovePetActionBar(); p_caster->RemovePetActionBar();
// on delete only do caster related effects // on delete only do caster related effects
@ -3410,7 +3403,10 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
{ {
target->addUnitState(UNIT_STAT_CONTROLLED); target->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)
camera.SetView(pet); camera.SetView(pet);
p_caster->SetCharm(pet); p_caster->SetCharm(pet);
p_caster->SetClientControl(pet, 1); p_caster->SetClientControl(pet, 1);
((Player*)caster)->SetMover(pet); ((Player*)caster)->SetMover(pet);
@ -3423,11 +3419,14 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
} }
else else
{ {
camera.ResetView();
p_caster->SetCharm(NULL); p_caster->SetCharm(NULL);
p_caster->SetClientControl(pet, 0); p_caster->SetClientControl(pet, 0);
p_caster->SetMover(NULL); p_caster->SetMover(NULL);
// there is a possibility that target became invisible for client\p_caster at ResetView call:
// it must be called after movement control unapplying, not before! the reason is same as at aura applying
camera.ResetView();
// on delete only do caster related effects // on delete only do caster related effects
if(m_removeMode == AURA_REMOVE_BY_DELETE) if(m_removeMode == AURA_REMOVE_BY_DELETE)
return; return;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10199" #define REVISION_NR "10200"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__