aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-04-14 17:22:35 +0200
committerQAston <none@none>2009-04-14 17:22:35 +0200
commit829b7a45364d34dcf5d6e76c6a34fb67dfbd4fb3 (patch)
tree4cec12b4c1fa644642eaf83ade0b744781d2c621 /src
parent2b52663e421a4dd51f8aa6166cf7105d7e782d9a (diff)
*Fix power update after spellcast - by w12x
*Some cleanups in Player::UpdateManaRegen. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Spell.cpp32
-rw-r--r--src/game/Spell.h2
-rw-r--r--src/game/StatSystem.cpp12
3 files changed, 14 insertions, 32 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 0e6e9c580bd..82293f91f34 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -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
{
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 5a85590fe78..f012fdff231 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -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,
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 3a95be1c3ef..f9d237b9d5e 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -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);
}