[7948] Use SetFaction instead explcit field set, other cleanups.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
NoFantasy 2009-06-03 15:32:26 +04:00 committed by VladimirMangos
parent de2338c9a4
commit be6e3923d1
7 changed files with 23 additions and 23 deletions

View file

@ -3068,7 +3068,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
if( apply )
{
m_target->SetCharmerGUID(GetCasterGUID());
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction());
m_target->setFaction(caster->getFaction());
caster->SetCharm(m_target);
@ -3110,7 +3110,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
else if(m_target->GetTypeId() == TYPEID_UNIT)
{
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
m_target->setFaction(cinfo->faction_A);
}
caster->SetCharm(NULL);
@ -3200,7 +3200,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
if( apply )
{
m_target->SetCharmerGUID(GetCasterGUID());
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, caster->getFaction());
m_target->setFaction(caster->getFaction());
m_target->CastStop(m_target == caster ? GetId() : 0);
caster->SetCharm(m_target);
@ -3249,12 +3249,12 @@ void Aura::HandleModCharm(bool apply, bool Real)
if(((Creature*)m_target)->isPet())
{
if(Unit* owner = m_target->GetOwner())
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, owner->getFaction());
m_target->setFaction(owner->getFaction());
else if(cinfo)
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
m_target->setFaction(cinfo->faction_A);
}
else if(cinfo) // normal creature
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, cinfo->faction_A);
m_target->setFaction(cinfo->faction_A);
// restore UNIT_FIELD_BYTES_0
if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON)