diff options
author | QAston <none@none> | 2009-03-13 16:28:36 +0100 |
---|---|---|
committer | QAston <none@none> | 2009-03-13 16:28:36 +0100 |
commit | 7fd6d97e0f46c7e3fc7e7b266095c1ff7b39b996 (patch) | |
tree | cffa34df894a107e2b4a653f85e9525d27ab2e7c | |
parent | b8bfa091de4db3d7a49bdd90fcf194ddce4353b8 (diff) |
*Some changes in SPELL_AURA_OBS_MOD_ENERGY handler.
--HG--
branch : trunk
-rw-r--r-- | src/game/SharedDefines.h | 1 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 52 |
2 files changed, 23 insertions, 30 deletions
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 1411e78cb14..fc4628d5094 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -140,6 +140,7 @@ enum Powers POWER_HAPPINESS = 4, POWER_RUNE = 5, POWER_RUNIC_POWER = 6, + POWER_ALL = 127, // default for class? POWER_HEALTH = 0xFFFFFFFE // (-2 as signed value) }; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1549d83cbee..c016d9ca98b 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5803,42 +5803,34 @@ void Aura::PeriodicTick() { if(m_modifier.m_miscvalue < 0) break; - if (uint32 modmask = m_modifier.m_miscvalue) - { - for(uint8 i = 0; i < MAX_POWERS; ++i) - { - if(modmask & (uint32(1) << i)) - { - if(i >= MAX_POWERS) - continue; - Powers power = Powers(i); + Powers power; + if (m_modifier.m_miscvalue == POWER_ALL) + power = m_target->getPowerType(); + else + power = Powers(m_modifier.m_miscvalue); - if(m_target->GetMaxPower(power) == 0) - continue; + if(m_target->GetMaxPower(power) == 0) + break; - uint32 amount = m_modifier.m_amount * m_target->GetMaxPower(power) /100; - sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", - GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); + uint32 amount = m_modifier.m_amount * m_target->GetMaxPower(power) /100; + sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId()); - // Warning: this packet may be not blizzlike - WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size - data.append(m_target->GetPackGUID()); - data.appendPackGUID(GetCasterGUID()); - data << uint32(GetId()); - data << uint32(1); - data << uint32(m_modifier.m_auraname); - data << uint32(power); // power type - data << (uint32)amount; - m_target->SendMessageToSet(&data,true); + WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size + data.append(m_target->GetPackGUID()); + data.appendPackGUID(GetCasterGUID()); + data << uint32(GetId()); + data << uint32(1); + data << uint32(m_modifier.m_auraname); + data << uint32(power); // power type + data << (uint32)amount; + m_target->SendMessageToSet(&data,true); - int32 gain = m_target->ModifyPower(power,amount); + int32 gain = m_target->ModifyPower(power,amount); - if(Unit* pCaster = GetCaster()) - m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); - } - } - } + if(Unit* pCaster = GetCaster()) + m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_PERIODIC_ENERGIZE: |