[11443] Implement SPELL_AURA_MIRROR_IMAGE (247) and related receive/reply packets

Inspired by different patches posted in forum, thanks guys for the help it was :D

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2011-05-08 18:57:06 +02:00
parent d98b9b9670
commit 4c3b61d4f5
11 changed files with 160 additions and 6 deletions

View file

@ -297,7 +297,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleComprehendLanguage, //244 SPELL_AURA_COMPREHEND_LANGUAGE
&Aura::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS implemented in Unit::CalculateAuraDuration
&Aura::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL implemented in Unit::CalculateAuraDuration
&Aura::HandleNULL, //247 target to become a clone of the caster
&Aura::HandleAuraMirrorImage, //247 SPELL_AURA_MIRROR_IMAGE target to become a clone of the caster
&Aura::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
&Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
&Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
@ -8032,6 +8032,44 @@ void Aura::HandleAuraOpenStable(bool apply, bool Real)
// client auto close stable dialog at !apply aura
}
void Aura::HandleAuraMirrorImage(bool apply, bool Real)
{
if (!Real)
return;
// Target of aura should always be creature (ref Spell::CheckCast)
Creature* pCreature = (Creature*)GetTarget();
// Caster can be player or creature, the unit who pCreature will become an clone of.
Unit* caster = GetCaster();
if (apply)
{
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, caster->getRace());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, caster->getClass());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, caster->getGender());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 3, caster->getPowerType());
pCreature->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_CLONED);
pCreature->SetDisplayId(caster->GetNativeDisplayId());
}
else
{
const CreatureInfo* cinfo = pCreature->GetCreatureInfo();
const CreatureModelInfo* minfo = sObjectMgr.GetCreatureModelInfo(pCreature->GetNativeDisplayId());
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, 0);
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class);
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 3, 0);
pCreature->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_CLONED);
pCreature->SetDisplayId(pCreature->GetNativeDisplayId());
}
}
void Aura::HandleAuraConvertRune(bool apply, bool Real)
{
if(!Real)