mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
*Fix power update after spellcast - by w12x
*Some cleanups in Player::UpdateManaRegen. --HG-- branch : trunk
This commit is contained in:
@@ -2826,6 +2826,10 @@ void Spell::SendSpellStart()
|
||||
uint32 castFlags = CAST_FLAG_UNKNOWN1;
|
||||
if(IsRangedSpell())
|
||||
castFlags |= CAST_FLAG_AMMO;
|
||||
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()))
|
||||
&& m_spellInfo->powerType != POWER_HEALTH )
|
||||
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
|
||||
|
||||
if(m_spellInfo->runeCostID)
|
||||
castFlags |= CAST_FLAG_UNKNOWN10;
|
||||
@@ -2846,23 +2850,8 @@ void Spell::SendSpellStart()
|
||||
|
||||
m_targets.write(&data);
|
||||
|
||||
if ( castFlags & CAST_FLAG_UNKNOWN6 ) // predicted power?
|
||||
data << uint32(0);
|
||||
|
||||
if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list
|
||||
{
|
||||
uint8 v1 = 0;//m_runesState;
|
||||
uint8 v2 = 0;//((Player*)m_caster)->GetRunesState();
|
||||
data << uint8(v1); // runes state before
|
||||
data << uint8(v2); // runes state after
|
||||
for(uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
uint8 m = (1 << i);
|
||||
if(m & v1) // usable before...
|
||||
if(!(m & v2)) // ...but on cooldown now...
|
||||
data << uint8(0); // some unknown byte (time?)
|
||||
}
|
||||
}
|
||||
if(castFlags & CAST_FLAG_POWER_LEFT_SELF)
|
||||
data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
|
||||
|
||||
if ( castFlags & CAST_FLAG_AMMO )
|
||||
WriteAmmoToPacket(&data);
|
||||
@@ -2883,11 +2872,14 @@ void Spell::SendSpellGo()
|
||||
uint32 castFlags = CAST_FLAG_UNKNOWN3;
|
||||
if(IsRangedSpell())
|
||||
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
|
||||
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()))
|
||||
&& m_spellInfo->powerType != POWER_HEALTH )
|
||||
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
|
||||
|
||||
if((m_caster->GetTypeId() == TYPEID_PLAYER) && (m_caster->getClass() == CLASS_DEATH_KNIGHT) && m_spellInfo->runeCostID)
|
||||
{
|
||||
castFlags |= CAST_FLAG_UNKNOWN10; // same as in SMSG_SPELL_START
|
||||
castFlags |= CAST_FLAG_UNKNOWN6; // makes cooldowns visible
|
||||
castFlags |= CAST_FLAG_UNKNOWN7; // rune cooldowns list
|
||||
}
|
||||
|
||||
@@ -2908,8 +2900,8 @@ void Spell::SendSpellGo()
|
||||
|
||||
m_targets.write(&data);
|
||||
|
||||
if ( castFlags & CAST_FLAG_UNKNOWN6 ) // unknown wotlk, predicted power?
|
||||
data << uint32(0);
|
||||
if(castFlags & CAST_FLAG_POWER_LEFT_SELF)
|
||||
data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
|
||||
|
||||
if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ enum SpellCastFlags
|
||||
CAST_FLAG_UNKNOWN3 = 0x00000100,
|
||||
CAST_FLAG_UNKNOWN13 = 0x00000200,
|
||||
CAST_FLAG_UNKNOWN14 = 0x00000400,
|
||||
CAST_FLAG_UNKNOWN6 = 0x00000800, // wotlk, trigger rune cooldown
|
||||
CAST_FLAG_POWER_LEFT_SELF = 0x00000800, // wotlk
|
||||
CAST_FLAG_UNKNOWN15 = 0x00001000,
|
||||
CAST_FLAG_UNKNOWN16 = 0x00002000,
|
||||
CAST_FLAG_UNKNOWN17 = 0x00004000,
|
||||
|
||||
@@ -697,21 +697,11 @@ void Player::UpdateManaRegen()
|
||||
power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
|
||||
}
|
||||
|
||||
// Bonus from some dummy auras
|
||||
AuraEffectList const& mDummyAuras = GetAurasByType(SPELL_AURA_PERIODIC_DUMMY);
|
||||
for(AuraEffectList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
|
||||
if((*i)->GetId() == 34074) // Aspect of the Viper
|
||||
{
|
||||
power_regen_mp5 += (*i)->GetAmount() * Intellect / 500.0f;
|
||||
// Add regen bonus from level in this dummy
|
||||
power_regen_mp5 += getLevel() * 35 / 100;
|
||||
}
|
||||
|
||||
// Set regen rate in cast state apply only on spirit based regen
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (modManaRegenInterrupt > 100)
|
||||
modManaRegenInterrupt = 100;
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, power_regen_mp5 + power_regen * modManaRegenInterrupt / 100.0f);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, (power_regen_mp5 + power_regen) * modManaRegenInterrupt / 100.0f);
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user