Fix Empowered Rune Weapon

Cleanup cast flags

--HG--
branch : trunk
This commit is contained in:
thenecromancer
2010-01-23 16:06:06 +01:00
parent 84980ea77c
commit e893ad71cf
3 changed files with 79 additions and 55 deletions

View File

@@ -2936,26 +2936,25 @@ void Spell::cast(bool skipCheck)
// CAST SPELL
SendSpellCooldown();
//SendCastResult(castResult);
SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
if(m_customAttr & SPELL_ATTR_CU_CHARGE)
for (uint32 i = 0; i < 3; ++i)
{
for (uint32 i = 0; i < 3; ++i)
switch(m_spellInfo->Effect[i])
{
switch(m_spellInfo->Effect[i])
{
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_JUMP:
case SPELL_EFFECT_JUMP2:
case SPELL_EFFECT_LEAP_BACK:
HandleEffects(NULL,NULL,NULL,i);
m_effectMask |= (1<<i);
break;
}
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_JUMP:
case SPELL_EFFECT_JUMP2:
case SPELL_EFFECT_LEAP_BACK:
case SPELL_EFFECT_ACTIVATE_RUNE:
HandleEffects(NULL,NULL,NULL,i);
m_effectMask |= (1<<i);
break;
}
}
// we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
SendSpellGo();
// Okay, everything is prepared. Now we need to distinguish between immediate and evented delayed spells
if (m_spellInfo->speed > 0.0f && !IsChanneledSpell(m_spellInfo) || m_spellInfo->Id == 14157)
{
@@ -3495,7 +3494,7 @@ void Spell::SendSpellStart()
//sLog.outDebug("Sending SMSG_SPELL_START id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN1;
uint32 castFlags = CAST_FLAG_UNKNOWN_2;
if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
@@ -3504,7 +3503,7 @@ void Spell::SendSpellStart()
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
if(m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE)
castFlags |= CAST_FLAG_UNKNOWN10;
castFlags |= CAST_FLAG_UNKNOWN_19;
WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2));
if(m_CastItem)
@@ -3526,7 +3525,7 @@ void Spell::SendSpellStart()
if ( castFlags & CAST_FLAG_AMMO )
WriteAmmoToPacket(&data);
if ( castFlags & CAST_FLAG_UNKNOWN21 )
if ( castFlags & CAST_FLAG_UNKNOWN_23 )
{
data << uint32(0);
data << uint32(0);
@@ -3543,11 +3542,11 @@ void Spell::SendSpellGo()
//sLog.outDebug("Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN3;
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
// triggered spells with spell visual != 0
if((m_IsTriggeredSpell && !IsAutoRepeatRangedSpell(m_spellInfo)) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_UNKNOWN0;
castFlags |= CAST_FLAG_PENDING;
if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
@@ -3556,10 +3555,20 @@ void Spell::SendSpellGo()
&& 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 && m_spellInfo->powerType == POWER_RUNE)
if((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
&& m_spellInfo->runeCostID
&& m_spellInfo->powerType == POWER_RUNE)
{
castFlags |= CAST_FLAG_UNKNOWN10; // same as in SMSG_SPELL_START
castFlags |= CAST_FLAG_UNKNOWN7; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_9; // ??
}
if (IsSpellHaveEffect(m_spellInfo, SPELL_EFFECT_ACTIVATE_RUNE))
{
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
castFlags |= CAST_FLAG_UNKNOWN_19; // same as in SMSG_SPELL_START
}
WorldPacket data(SMSG_SPELL_GO, 50); // guess size
@@ -3582,7 +3591,7 @@ void Spell::SendSpellGo()
if(castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType));
if ( castFlags & CAST_FLAG_UNKNOWN7 ) // rune cooldowns list
if ( castFlags & CAST_FLAG_RUNE_LIST ) // rune cooldowns list
{
uint8 v1 = m_runesState;
uint8 v2 = ((Player*)m_caster)->GetRunesState();
@@ -3597,7 +3606,7 @@ void Spell::SendSpellGo()
}
}
if ( castFlags & CAST_FLAG_UNKNOWN4 ) // unknown wotlk
if ( castFlags & CAST_FLAG_UNKNOWN_18 ) // unknown wotlk
{
data << float(0);
data << uint32(0);
@@ -3606,7 +3615,7 @@ void Spell::SendSpellGo()
if ( castFlags & CAST_FLAG_AMMO )
WriteAmmoToPacket(&data);
if ( castFlags & CAST_FLAG_UNKNOWN5 ) // unknown wotlk
if ( castFlags & CAST_FLAG_UNKNOWN_20 ) // unknown wotlk
{
data << uint32(0);
data << uint32(0);
@@ -4168,13 +4177,6 @@ void Spell::TakeRunePower()
if(!src || (src->NoRuneCost() && src->NoRunicPowerGain()))
return;
// Freezing Fog makes Howling Blast cost no runes
if (m_caster->HasAura(59052) && m_spellInfo->SpellFamilyFlags[1] & 0x2)
{
m_caster->RemoveAurasDueToSpell(59052, m_caster->GetGUID());
return;
}
m_runesState = plr->GetRunesState(); // store previous state
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death

View File

@@ -56,29 +56,29 @@ enum SpellCastTargetFlags
enum SpellCastFlags
{
CAST_FLAG_NONE = 0x00000000,
CAST_FLAG_UNKNOWN0 = 0x00000001, // may be pending spell cast
CAST_FLAG_UNKNOWN1 = 0x00000002,
CAST_FLAG_UNKNOWN11 = 0x00000004,
CAST_FLAG_UNKNOWN12 = 0x00000008,
CAST_FLAG_UNKNOWN2 = 0x00000010,
CAST_FLAG_PENDING = 0x00000001, // Pending == 1
CAST_FLAG_UNKNOWN_2 = 0x00000002,
CAST_FLAG_UNKNOWN_3 = 0x00000004,
CAST_FLAG_UNKNOWN_4 = 0x00000008,
CAST_FLAG_UNKNOWN_5 = 0x00000010,
CAST_FLAG_AMMO = 0x00000020, // Projectiles visual
CAST_FLAG_UNKNOWN8 = 0x00000040,
CAST_FLAG_UNKNOWN9 = 0x00000080,
CAST_FLAG_UNKNOWN3 = 0x00000100,
CAST_FLAG_UNKNOWN13 = 0x00000200,
CAST_FLAG_UNKNOWN14 = 0x00000400,
CAST_FLAG_POWER_LEFT_SELF = 0x00000800, // wotlk
CAST_FLAG_UNKNOWN15 = 0x00001000,
CAST_FLAG_UNKNOWN16 = 0x00002000,
CAST_FLAG_UNKNOWN17 = 0x00004000,
CAST_FLAG_UNKNOWN18 = 0x00008000,
CAST_FLAG_UNKNOWN19 = 0x00010000,
CAST_FLAG_UNKNOWN4 = 0x00020000, // wotlk
CAST_FLAG_UNKNOWN10 = 0x00040000,
CAST_FLAG_UNKNOWN5 = 0x00080000, // wotlk
CAST_FLAG_UNKNOWN20 = 0x00100000,
CAST_FLAG_UNKNOWN7 = 0x00200000, // wotlk, rune cooldown list
CAST_FLAG_UNKNOWN21 = 0x04000000
CAST_FLAG_UNKNOWN_7 = 0x00000040,
CAST_FLAG_UNKNOWN_8 = 0x00000080,
CAST_FLAG_UNKNOWN_9 = 0x00000100,
CAST_FLAG_UNKNOWN_10 = 0x00000200,
CAST_FLAG_UNKNOWN_11 = 0x00000400,
CAST_FLAG_POWER_LEFT_SELF = 0x00000800,
CAST_FLAG_UNKNOWN_13 = 0x00001000,
CAST_FLAG_UNKNOWN_14 = 0x00002000,
CAST_FLAG_UNKNOWN_15 = 0x00004000,
CAST_FLAG_UNKNOWN_16 = 0x00008000,
CAST_FLAG_UNKNOWN_17 = 0x00010000,
CAST_FLAG_UNKNOWN_18 = 0x00020000,
CAST_FLAG_UNKNOWN_19 = 0x00040000,
CAST_FLAG_UNKNOWN_20 = 0x00080000,
CAST_FLAG_UNKNOWN_21 = 0x00100000,
CAST_FLAG_RUNE_LIST = 0x00200000,
CAST_FLAG_UNKNOWN_23 = 0x04000000
};
enum SpellRangeFlag

View File

@@ -2362,6 +2362,9 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
pet->CastSpell(pet, 28305, true);
return;
}
// Empower Rune Weapon
case 53258:
return; // skip, hack-added in spell effect
}
// normal case
@@ -7249,11 +7252,30 @@ void Spell::EffectActivateRune(uint32 eff_idx)
if(plr->getClass() != CLASS_DEATH_KNIGHT)
return;
for (uint32 j = 0; j < MAX_RUNES; ++j)
// needed later
m_runesState = ((Player*)m_caster)->GetRunesState();
uint32 count = damage;
if (count == 0) count = 1;
for(uint32 j = 0; j < MAX_RUNES && count > 0; ++j)
{
if(plr->GetRuneCooldown(j) && plr->GetCurrentRune(j) == RuneType(m_spellInfo->EffectMiscValue[eff_idx]))
{
plr->SetRuneCooldown(j, 0);
--count;
}
}
// Empower rune weapon
if (m_spellInfo->Id == 47568)
{
// Need to do this just once
if (eff_idx != 0)
return;
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
if(plr->GetRuneCooldown(i) && (plr->GetCurrentRune(i) == RUNE_FROST || plr->GetCurrentRune(i) == RUNE_DEATH))
plr->SetRuneCooldown(i, 0);
}
}
}