Skip to content

Commit f8a13b4

Browse files
committed
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)
1 parent 00ddd4b commit f8a13b4

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/server/game/Spells/Spell.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,6 +3254,12 @@ void Spell::handle_immediate()
32543254
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
32553255
SendChannelStart(duration);
32563256
}
3257+
else if (duration == -1)
3258+
{
3259+
m_spellState = SPELL_STATE_CASTING;
3260+
m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags);
3261+
SendChannelStart(duration);
3262+
}
32573263
}
32583264

32593265
PrepareTargetProcessing();
@@ -3279,7 +3285,6 @@ void Spell::handle_immediate()
32793285
if (m_spellInfo->IsRangedWeaponSpell() && m_spellInfo->IsChanneled())
32803286
TakeAmmo();
32813287

3282-
32833288
if (m_spellState != SPELL_STATE_CASTING)
32843289
finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell)
32853290
}
@@ -3666,9 +3671,9 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
36663671
switch (result)
36673672
{
36683673
case SPELL_FAILED_REQUIRES_SPELL_FOCUS:
3669-
data << uint32(spellInfo->RequiresSpellFocus);
3674+
data << uint32(spellInfo->RequiresSpellFocus); // SpellFocusObject.dbc id
36703675
break;
3671-
case SPELL_FAILED_REQUIRES_AREA:
3676+
case SPELL_FAILED_REQUIRES_AREA: // AreaTable.dbc id
36723677
// hardcode areas limitation case
36733678
switch (spellInfo->Id)
36743679
{
@@ -3701,14 +3706,15 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
37013706
data << uint32(spellInfo->TotemCategory[1]);
37023707
break;
37033708
case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
3709+
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND:
3710+
case SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND:
37043711
data << uint32(spellInfo->EquippedItemClass);
37053712
data << uint32(spellInfo->EquippedItemSubClassMask);
3706-
//data << uint32(spellInfo->EquippedItemInventoryTypeMask);
37073713
break;
37083714
case SPELL_FAILED_TOO_MANY_OF_ITEM:
37093715
{
37103716
uint32 item = 0;
3711-
for (int8 x = 0;x < 3; x++)
3717+
for (int8 x = 0; x < 3; x++)
37123718
if (spellInfo->Effects[x].ItemType)
37133719
item = spellInfo->Effects[x].ItemType;
37143720
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
@@ -3757,7 +3763,7 @@ void Spell::SendSpellStart()
37573763
data << uint8(m_cast_count); // pending spell cast?
37583764
data << uint32(m_spellInfo->Id); // spellId
37593765
data << uint32(castFlags); // cast flags
3760-
data << uint32(m_timer); // delay?
3766+
data << int32(m_timer); // delay?
37613767

37623768
m_targets.Write(data);
37633769

@@ -3856,7 +3862,7 @@ void Spell::SendSpellGo()
38563862
}
38573863
}
38583864

3859-
if (castFlags & CAST_FLAG_UNKNOWN_18) // unknown wotlk
3865+
if (castFlags & CAST_FLAG_UNKNOWN_18)
38603866
{
38613867
data << float(0);
38623868
data << uint32(0);
@@ -3865,7 +3871,7 @@ void Spell::SendSpellGo()
38653871
if (castFlags & CAST_FLAG_AMMO)
38663872
WriteAmmoToPacket(&data);
38673873

3868-
if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk
3874+
if (castFlags & CAST_FLAG_UNKNOWN_20)
38693875
{
38703876
data << uint32(0);
38713877
data << uint32(0);
@@ -6260,7 +6266,7 @@ void Spell::Delayed() // only called in DealDamage()
62606266

62616267
AddPctN(delaytime, -delayReduce);
62626268

6263-
if (int32(m_timer) + delaytime > m_casttime)
6269+
if (m_timer + delaytime > m_casttime)
62646270
{
62656271
delaytime = m_casttime - m_timer;
62666272
m_timer = m_casttime;
@@ -6295,7 +6301,7 @@ void Spell::DelayedChannel()
62956301

62966302
AddPctN(delaytime, -delayReduce);
62976303

6298-
if (int32(m_timer) <= delaytime)
6304+
if (m_timer <= delaytime)
62996305
{
63006306
delaytime = m_timer;
63016307
m_timer = 0;

src/server/game/Spells/Spell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ class Spell
647647
// -------------------------------------------
648648

649649
uint32 m_spellState;
650-
uint32 m_timer;
650+
int32 m_timer;
651651

652652
TriggerCastFlags _triggeredCastFlags;
653653

0 commit comments

Comments
 (0)