[12048] Implement SummonPossessed

Version slightly derived from GriffonHeart's version.
This commit is contained in:
GriffonHeart 2012-07-16 17:18:44 +02:00 committed by Schmoozerd
parent 8b075e1037
commit 161b18b760
5 changed files with 69 additions and 8 deletions

View file

@ -281,7 +281,7 @@ enum SpellAttributesEx
SPELL_ATTR_EX_NO_THREAT = 0x00000400, // 10 no generates threat on cast 100%
SPELL_ATTR_EX_UNK11 = 0x00000800, // 11
SPELL_ATTR_EX_UNK12 = 0x00001000, // 12
SPELL_ATTR_EX_UNK13 = 0x00002000, // 13
SPELL_ATTR_EX_FARSIGHT = 0x00002000, // 13 related to farsight
SPELL_ATTR_EX_UNK14 = 0x00004000, // 14
SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // 15 remove auras on immunity
SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // 16 unaffected by school immunity

View file

@ -664,6 +664,7 @@ class Spell
bool DoSummonWild(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
bool DoSummonCritter(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
bool DoSummonGuardian(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
bool DoSummonPossessed(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
};
enum ReplenishType

View file

@ -4911,9 +4911,9 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
}
case SUMMON_PROP_GROUP_CONTROLLABLE:
{
// no type here
// maybe wrong - but thats the handler currently used for those
summonResult = DoSummonGuardian(summonPositions, summon_prop, eff_idx, level);
// TODO: Fix spell 46619
if (m_spellInfo->Id != 46619)
summonResult = DoSummonPossessed(summonPositions, summon_prop, eff_idx, level);
break;
}
case SUMMON_PROP_GROUP_VEHICLE:
@ -5208,6 +5208,64 @@ bool Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc)
return false;
}
bool Spell::DoSummonPossessed(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level)
{
MANGOS_ASSERT(!list.empty() && prop);
uint32 creatureEntry = m_spellInfo->EffectMiscValue[effIdx];
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creatureEntry);
if (!cInfo)
{
sLog.outErrorDb("Spell::DoSummonPossessed: creature entry %u not found for spell %u.", creatureEntry, m_spellInfo->Id);
return false;
}
Creature* spawnCreature = m_caster->SummonCreature(creatureEntry, list[0].x, list[0].y, list[0].z, m_caster->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 0);
if (!spawnCreature)
{
sLog.outError("Spell::DoSummonPossessed: creature entry %u for spell %u could not be summoned.", creatureEntry, m_spellInfo->Id);
return false;
}
list[0].creature = spawnCreature;
// Changes to be sent
spawnCreature->SetCharmerGuid(m_caster->GetObjectGuid());
spawnCreature->SetCreatorGuid(m_caster->GetObjectGuid());
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
spawnCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
spawnCreature->SetLevel(level);
spawnCreature->SetWalk(m_caster->IsWalking());
// TODO: Set Fly (ie glyph dependend)
// Internal changes
spawnCreature->addUnitState(UNIT_STAT_CONTROLLED);
// Changes to owner
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player* player = (Player*)m_caster;
player->GetCamera().SetView(spawnCreature);
player->SetCharm(spawnCreature);
player->SetClientControl(spawnCreature, 1);
player->SetMover(spawnCreature);
if (CharmInfo* charmInfo = spawnCreature->InitCharmInfo(spawnCreature))
charmInfo->InitPossessCreateSpells();
player->PossessSpellInitialize();
}
// Notify Summoner
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
((Creature*)m_originalCaster)->AI()->JustSummoned(spawnCreature);
return true;
}
bool Spell::DoSummonPet(SpellEffectIndex eff_idx)
{
if (m_caster->GetPetGuid())

View file

@ -147,6 +147,9 @@ enum UnitStandStateType
#define MAX_UNIT_STAND_STATE 10
// byte flags value (UNIT_FIELD_BYTES_1,1)
// This corresponds to free talent points (pet case)
// byte flags value (UNIT_FIELD_BYTES_1,2)
enum UnitStandFlags
{
@ -158,9 +161,6 @@ enum UnitStandFlags
UNIT_STAND_FLAGS_ALL = 0xFF
};
// byte flags value (UNIT_FIELD_BYTES_1,2)
// This corresponds to free talent points (pet case)
// byte flags value (UNIT_FIELD_BYTES_1,3)
enum UnitBytes1_Flags
{
@ -200,6 +200,8 @@ enum UnitRename
UNIT_CAN_BE_ABANDONED = 0x02,
};
// byte flags value (UNIT_FIELD_BYTES_2,3) See enum ShapeshiftForm in SharedDefines.h
#define CREATURE_MAX_SPELLS 4
enum Swing

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12047"
#define REVISION_NR "12048"
#endif // __REVISION_NR_H__