fix(Core/Spell): Remove ErrorCube visual

* cherry-pick https://github.com/trinitycore/trinitycore/commit/3b5014fdae

* cherry-pick small part of f4f7e6324d

Co-Authored-By: Shauren <shauren.trinity@gmail.com>
Co-Authored-By: Treeston <14020072+treeston@users.noreply.github.com>
This commit is contained in:
Kitzunu
2021-05-08 05:16:18 +02:00
parent 9f6697823d
commit 52ff8915df
9 changed files with 101 additions and 3 deletions

View File

@@ -4284,7 +4284,7 @@ void Spell::SendSpellStart()
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_spellInfo->IsChanneled())
castFlags |= CAST_FLAG_PENDING;
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT))
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
@@ -4340,7 +4340,7 @@ void Spell::SendSpellGo()
if (((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell) && !m_spellInfo->IsChanneled())
castFlags |= CAST_FLAG_PENDING;
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT))
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
@@ -4466,6 +4466,8 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
}
else
{
uint32 nonRangedAmmoDisplayID = 0;
uint32 nonRangedAmmoInventoryType = 0;
for (uint8 i = 0; i < 3; ++i)
{
if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
@@ -4489,6 +4491,10 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
ammoDisplayID = 5998; // is this need fixing?
ammoInventoryType = INVTYPE_AMMO;
break;
default:
nonRangedAmmoDisplayID = itemEntry->DisplayInfoID;
nonRangedAmmoInventoryType = itemEntry->InventoryType;
break;
}
if (ammoDisplayID)
@@ -4497,6 +4503,12 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
}
}
}
if (!ammoDisplayID && !ammoInventoryType)
{
ammoDisplayID = nonRangedAmmoDisplayID;
ammoInventoryType = nonRangedAmmoInventoryType;
}
}
*data << uint32(ammoDisplayID);