Skip to content

Commit

Permalink
[10200] Correct function call sequence in possess aura handlers
Browse files Browse the repository at this point in the history
also removed not needed ResetView call in dummy aura handler

(based on SilverIce's repo commit c3f02ed)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
SilverIce authored and VladimirMangos committed Jul 16, 2010
1 parent 26494a9 commit 45a4050
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions src/game/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2053,17 +2053,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// AT REMOVE
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())
{
Unit* caster = GetCaster();
Expand Down Expand Up @@ -3311,13 +3300,14 @@ void Aura::HandleModPossess(bool apply, bool Real)
target->addUnitState(UNIT_STAT_CONTROLLED);

target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);

target->SetCharmerGUID(p_caster->GetGUID());
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);

p_caster->SetCharm(target);
p_caster->SetClientControl(target, 1);
p_caster->SetMover(target);

Expand Down Expand Up @@ -3348,10 +3338,13 @@ void Aura::HandleModPossess(bool apply, bool Real)
{
p_caster->SetCharm(NULL);

camera.ResetView();
p_caster->SetClientControl(target, 0);
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();

// on delete only do caster related effects
Expand Down Expand Up @@ -3410,7 +3403,10 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
{
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);

p_caster->SetCharm(pet);
p_caster->SetClientControl(pet, 1);
((Player*)caster)->SetMover(pet);
Expand All @@ -3423,11 +3419,14 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
}
else
{
camera.ResetView();
p_caster->SetCharm(NULL);
p_caster->SetClientControl(pet, 0);
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
if(m_removeMode == AURA_REMOVE_BY_DELETE)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10199"
#define REVISION_NR "10200"
#endif // __REVISION_NR_H__

0 comments on commit 45a4050

Please sign in to comment.