Core/Spells:
- Fix channeling spells with infinite duration (-1) - Allowed SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND and SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND in SendCastResult (more reasons todo)
This commit is contained in:
@@ -3254,6 +3254,12 @@ void Spell::handle_immediate()
|
|||||||
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
|
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
|
||||||
SendChannelStart(duration);
|
SendChannelStart(duration);
|
||||||
}
|
}
|
||||||
|
else if (duration == -1)
|
||||||
|
{
|
||||||
|
m_spellState = SPELL_STATE_CASTING;
|
||||||
|
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
|
||||||
|
SendChannelStart(duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrepareTargetProcessing();
|
PrepareTargetProcessing();
|
||||||
@@ -3279,7 +3285,6 @@ void Spell::handle_immediate()
|
|||||||
if (m_spellInfo->IsRangedWeaponSpell() && m_spellInfo->IsChanneled())
|
if (m_spellInfo->IsRangedWeaponSpell() && m_spellInfo->IsChanneled())
|
||||||
TakeAmmo();
|
TakeAmmo();
|
||||||
|
|
||||||
|
|
||||||
if (m_spellState != SPELL_STATE_CASTING)
|
if (m_spellState != SPELL_STATE_CASTING)
|
||||||
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
|
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
|
||||||
}
|
}
|
||||||
@@ -3666,9 +3671,9 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
|
|||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
|
case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
|
||||||
data << uint32(spellInfo->RequiresSpellFocus);
|
data << uint32(spellInfo->RequiresSpellFocus); // SpellFocusObject.dbc id
|
||||||
break;
|
break;
|
||||||
case SPELL_FAILED_REQUIRES_AREA:
|
case SPELL_FAILED_REQUIRES_AREA: // AreaTable.dbc id
|
||||||
// hardcode areas limitation case
|
// hardcode areas limitation case
|
||||||
switch (spellInfo->Id)
|
switch (spellInfo->Id)
|
||||||
{
|
{
|
||||||
@@ -3701,14 +3706,15 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
|
|||||||
data << uint32(spellInfo->TotemCategory[1]);
|
data << uint32(spellInfo->TotemCategory[1]);
|
||||||
break;
|
break;
|
||||||
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
|
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
|
||||||
|
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND:
|
||||||
|
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND:
|
||||||
data << uint32(spellInfo->EquippedItemClass);
|
data << uint32(spellInfo->EquippedItemClass);
|
||||||
data << uint32(spellInfo->EquippedItemSubClassMask);
|
data << uint32(spellInfo->EquippedItemSubClassMask);
|
||||||
//data << uint32(spellInfo->EquippedItemInventoryTypeMask);
|
|
||||||
break;
|
break;
|
||||||
case SPELL_FAILED_TOO_MANY_OF_ITEM:
|
case SPELL_FAILED_TOO_MANY_OF_ITEM:
|
||||||
{
|
{
|
||||||
uint32 item = 0;
|
uint32 item = 0;
|
||||||
for (int8 x = 0;x < 3; x++)
|
for (int8 x = 0; x < 3; x++)
|
||||||
if (spellInfo->Effects[x].ItemType)
|
if (spellInfo->Effects[x].ItemType)
|
||||||
item = spellInfo->Effects[x].ItemType;
|
item = spellInfo->Effects[x].ItemType;
|
||||||
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
|
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
|
||||||
@@ -3757,7 +3763,7 @@ void Spell::SendSpellStart()
|
|||||||
data << uint8(m_cast_count); // pending spell cast?
|
data << uint8(m_cast_count); // pending spell cast?
|
||||||
data << uint32(m_spellInfo->Id); // spellId
|
data << uint32(m_spellInfo->Id); // spellId
|
||||||
data << uint32(castFlags); // cast flags
|
data << uint32(castFlags); // cast flags
|
||||||
data << uint32(m_timer); // delay?
|
data << int32(m_timer); // delay?
|
||||||
|
|
||||||
m_targets.Write(data);
|
m_targets.Write(data);
|
||||||
|
|
||||||
@@ -3856,7 +3862,7 @@ void Spell::SendSpellGo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (castFlags & CAST_FLAG_UNKNOWN_18) // unknown wotlk
|
if (castFlags & CAST_FLAG_UNKNOWN_18)
|
||||||
{
|
{
|
||||||
data << float(0);
|
data << float(0);
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
@@ -3865,7 +3871,7 @@ void Spell::SendSpellGo()
|
|||||||
if (castFlags & CAST_FLAG_AMMO)
|
if (castFlags & CAST_FLAG_AMMO)
|
||||||
WriteAmmoToPacket(&data);
|
WriteAmmoToPacket(&data);
|
||||||
|
|
||||||
if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk
|
if (castFlags & CAST_FLAG_UNKNOWN_20)
|
||||||
{
|
{
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
@@ -6260,7 +6266,7 @@ void Spell::Delayed() // only called in DealDamage()
|
|||||||
|
|
||||||
AddPctN(delaytime, -delayReduce);
|
AddPctN(delaytime, -delayReduce);
|
||||||
|
|
||||||
if (int32(m_timer) + delaytime > m_casttime)
|
if (m_timer + delaytime > m_casttime)
|
||||||
{
|
{
|
||||||
delaytime = m_casttime - m_timer;
|
delaytime = m_casttime - m_timer;
|
||||||
m_timer = m_casttime;
|
m_timer = m_casttime;
|
||||||
@@ -6295,7 +6301,7 @@ void Spell::DelayedChannel()
|
|||||||
|
|
||||||
AddPctN(delaytime, -delayReduce);
|
AddPctN(delaytime, -delayReduce);
|
||||||
|
|
||||||
if (int32(m_timer) <= delaytime)
|
if (m_timer <= delaytime)
|
||||||
{
|
{
|
||||||
delaytime = m_timer;
|
delaytime = m_timer;
|
||||||
m_timer = 0;
|
m_timer = 0;
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ class Spell
|
|||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
|
|
||||||
uint32 m_spellState;
|
uint32 m_spellState;
|
||||||
uint32 m_timer;
|
int32 m_timer;
|
||||||
|
|
||||||
TriggerCastFlags _triggeredCastFlags;
|
TriggerCastFlags _triggeredCastFlags;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user