*Cleanup of charm/farsight code. Hope this can fix some crash bugs.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-15 17:33:36 -06:00
parent 058b7c32e4
commit bb75ff7b79
10 changed files with 41 additions and 130 deletions
+10 -14
View File
@@ -7290,19 +7290,19 @@ bool ChatHandler::HandlePossessCommand(const char* args)
if(!pUnit)
return false;
// Don't allow unlimited possession of players
if (pUnit->GetTypeId() == TYPEID_PLAYER)
return false;
pUnit->SetCharmedOrPossessedBy(m_session->GetPlayer(), true);
m_session->GetPlayer()->CastSpell(pUnit, 530, true);
return true;
}
bool ChatHandler::HandleUnPossessCommand(const char* args)
{
// Use this command to also unpossess ourselves
m_session->GetPlayer()->RemoveCharmedOrPossessedBy(NULL);
Unit* pUnit = getSelectedUnit();
if(!pUnit) pUnit = m_session->GetPlayer();
pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
return true;
}
@@ -7312,11 +7312,7 @@ bool ChatHandler::HandleBindSightCommand(const char* args)
if (!pUnit)
return false;
if (m_session->GetPlayer()->isPossessing())
return false;
pUnit->AddPlayerToVision(m_session->GetPlayer());
m_session->GetPlayer()->CastSpell(pUnit, 6277, true);
return true;
}
@@ -7325,6 +7321,6 @@ bool ChatHandler::HandleUnbindSightCommand(const char* args)
if (m_session->GetPlayer()->isPossessing())
return false;
m_session->GetPlayer()->RemoveFarsightTarget();
m_session->GetPlayer()->StopCastingBindSight();
return true;
}