Core/Units: Encapsulate UNIT_CHANNEL_* fields

This commit is contained in:
Shauren
2017-11-06 23:32:25 +01:00
parent b49fa9658a
commit 965f4de083
5 changed files with 13 additions and 6 deletions

View File

@@ -1679,7 +1679,8 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
/// @todo Fix display here
// creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL);
// casting visual effect
creature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL);
creature->SetChannelSpellId(SPELL_SPIRIT_HEAL_CHANNEL);
creature->SetChannelSpellXSpellVisualId(VISUAL_SPIRIT_HEAL_CHANNEL);
// correct cast speed
creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f);
creature->SetFloatValue(UNIT_MOD_CAST_HASTE, 1.0f);

View File

@@ -115,6 +115,7 @@ enum BattlegroundSpells
{
SPELL_WAITING_FOR_RESURRECT = 2584, // Waiting to Resurrect
SPELL_SPIRIT_HEAL_CHANNEL = 22011, // Spirit Heal Channel
VISUAL_SPIRIT_HEAL_CHANNEL = 3060,
SPELL_SPIRIT_HEAL = 22012, // Spirit Heal
SPELL_RESURRECTION_VISUAL = 24171, // Resurrection Impact Visual
SPELL_ARENA_PREPARATION = 32727, // use this one, 32728 not correct

View File

@@ -1527,6 +1527,10 @@ class TC_GAME_API Unit : public WorldObject
float GetNegStat(Stats stat) const { return GetFloatValue(UNIT_FIELD_NEGSTAT+stat); }
float GetCreateStat(Stats stat) const { return m_createStats[stat]; }
uint32 GetChannelSpellId() const { return GetUInt32Value(UNIT_CHANNEL_SPELL); }
void SetChannelSpellId(uint32 channelSpellId) { SetUInt32Value(UNIT_CHANNEL_SPELL, channelSpellId); }
uint32 GetChannelSpellXSpellVisualId() const { return GetUInt32Value(UNIT_CHANNEL_SPELL_X_SPELL_VISUAL); }
void SetChannelSpellXSpellVisualId(uint32 channelSpellXSpellVisualId) { SetUInt32Value(UNIT_CHANNEL_SPELL_X_SPELL_VISUAL, channelSpellXSpellVisualId); }
DynamicFieldStructuredView<ObjectGuid> GetChannelObjects() const { return GetDynamicStructuredValues<ObjectGuid>(UNIT_DYNAMIC_FIELD_CHANNEL_OBJECTS); }
void AddChannelObject(ObjectGuid guid) { AddDynamicStructuredValue(UNIT_DYNAMIC_FIELD_CHANNEL_OBJECTS, &guid); }

View File

@@ -4482,7 +4482,8 @@ void Spell::SendChannelUpdate(uint32 time)
if (time == 0)
{
m_caster->ClearDynamicValue(UNIT_DYNAMIC_FIELD_CHANNEL_OBJECTS);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
m_caster->SetChannelSpellId(0);
m_caster->SetChannelSpellXSpellVisualId(0);
}
WorldPackets::Spells::SpellChannelUpdate spellChannelUpdate;
@@ -4517,8 +4518,8 @@ void Spell::SendChannelStart(uint32 duration)
for (GOTargetInfo const& target : m_UniqueGOTargetInfo)
m_caster->AddChannelObject(target.targetGUID);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL_X_SPELL_VISUAL, m_SpellVisual);
m_caster->SetChannelSpellId(m_spellInfo->Id);
m_caster->SetChannelSpellXSpellVisualId(m_SpellVisual);
}
void Spell::SendResurrectRequest(Player* target)
@@ -6953,7 +6954,7 @@ bool Spell::IsProcDisabled() const
bool Spell::IsChannelActive() const
{
return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0;
return m_caster->GetChannelSpellId() != 0;
}
bool Spell::IsAutoActionResetSpell() const

View File

@@ -245,7 +245,7 @@ public:
if (me->IsWithinDistInMap(mekgineer, MAX_REPAIR_RANGE))
{
//are we already channeling? Doesn't work very well, find better check?
if (!me->GetUInt32Value(UNIT_CHANNEL_SPELL))
if (!me->GetChannelSpellId())
{
//me->GetMotionMaster()->MovementExpired();
//me->GetMotionMaster()->MoveIdle();