Core/Spells: Fixed ErrorCube spell missiles
Port From (https://github.com/TrinityCore/TrinityCore/commit/ce794f3978e853341b2dc0c782e7bda34303b3f8)
This commit is contained in:
@@ -3493,7 +3493,7 @@ namespace Game.Spells
|
||||
if (((IsTriggered() && !m_spellInfo.IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell != null) && !m_fromClient)
|
||||
castFlags |= SpellCastFlags.Pending;
|
||||
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.ReqAmmo) || m_spellInfo.HasAttribute(SpellCustomAttributes.NeedsAmmoData))
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.ReqAmmo) || m_spellInfo.HasAttribute(SpellAttr10.UsesRangedSlotCosmeticOnly) || m_spellInfo.HasAttribute(SpellCustomAttributes.NeedsAmmoData))
|
||||
castFlags |= SpellCastFlags.Projectile;
|
||||
|
||||
if ((m_caster.IsTypeId(TypeId.Player) || (m_caster.IsTypeId(TypeId.Unit) && m_caster.ToCreature().IsPet())) && m_powerCost.Any(cost => cost.Power != PowerType.Health))
|
||||
@@ -3594,7 +3594,7 @@ namespace Game.Spells
|
||||
if (((IsTriggered() && !m_spellInfo.IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell != null) && !m_fromClient)
|
||||
castFlags |= SpellCastFlags.Pending;
|
||||
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.ReqAmmo) || m_spellInfo.HasAttribute(SpellCustomAttributes.NeedsAmmoData))
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.ReqAmmo) || m_spellInfo.HasAttribute(SpellAttr10.UsesRangedSlotCosmeticOnly) || m_spellInfo.HasAttribute(SpellCustomAttributes.NeedsAmmoData))
|
||||
castFlags |= SpellCastFlags.Projectile; // arrows/bullets visual
|
||||
|
||||
if ((m_caster.IsTypeId(TypeId.Player) || (m_caster.IsTypeId(TypeId.Unit) && m_caster.ToCreature().IsPet())) && m_powerCost.Any(cost => cost.Power != PowerType.Health))
|
||||
@@ -3734,6 +3734,8 @@ namespace Game.Spells
|
||||
Unit unitCaster = m_caster.ToUnit();
|
||||
if (unitCaster != null)
|
||||
{
|
||||
uint nonRangedAmmoDisplayID = 0;
|
||||
InventoryType nonRangedAmmoInventoryType = 0;
|
||||
for (byte i = (int)WeaponAttackType.BaseAttack; i < (int)WeaponAttackType.Max; ++i)
|
||||
{
|
||||
uint itemId = unitCaster.GetVirtualItemId(i);
|
||||
@@ -3759,6 +3761,10 @@ namespace Game.Spells
|
||||
ammoDisplayID = 5998; // is this need fixing?
|
||||
ammoInventoryType = InventoryType.Ammo;
|
||||
break;
|
||||
default:
|
||||
nonRangedAmmoDisplayID = Global.DB2Mgr.GetItemDisplayId(itemId, unitCaster.GetVirtualItemAppearanceMod(i));
|
||||
nonRangedAmmoInventoryType = itemEntry.inventoryType;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ammoDisplayID != 0)
|
||||
@@ -3767,6 +3773,12 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ammoDisplayID == 0 && ammoInventoryType == 0)
|
||||
{
|
||||
ammoDisplayID = nonRangedAmmoDisplayID;
|
||||
ammoInventoryType = nonRangedAmmoInventoryType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3803,6 +3803,11 @@ namespace Game.Spells
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<SpellXSpellVisualRecord> GetSpellVisuals()
|
||||
{
|
||||
return _visuals;
|
||||
}
|
||||
|
||||
public bool HasAttribute(SpellAttr0 attribute) { return Convert.ToBoolean(Attributes & attribute); }
|
||||
public bool HasAttribute(SpellAttr1 attribute) { return Convert.ToBoolean(AttributesEx & attribute); }
|
||||
public bool HasAttribute(SpellAttr2 attribute) { return Convert.ToBoolean(AttributesEx2 & attribute); }
|
||||
|
||||
@@ -2897,6 +2897,42 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
spellInfo._InitializeExplicitTargetMask();
|
||||
|
||||
if (spellInfo.Speed > 0.0f)
|
||||
{
|
||||
bool visualNeedsAmmo(SpellXSpellVisualRecord spellXspellVisual)
|
||||
{
|
||||
SpellVisualRecord spellVisual = CliDB.SpellVisualStorage.LookupByKey(spellXspellVisual.SpellVisualID);
|
||||
if (spellVisual == null)
|
||||
return false;
|
||||
|
||||
var spellVisualMissiles = Global.DB2Mgr.GetSpellVisualMissiles(spellVisual.SpellVisualMissileSetID);
|
||||
if (spellVisualMissiles.Empty())
|
||||
return false;
|
||||
|
||||
foreach (SpellVisualMissileRecord spellVisualMissile in spellVisualMissiles)
|
||||
{
|
||||
var spellVisualEffectName = CliDB.SpellVisualEffectNameStorage.LookupByKey(spellVisualMissile.SpellVisualEffectNameID);
|
||||
if (spellVisualEffectName == null)
|
||||
continue;
|
||||
|
||||
SpellVisualEffectNameType type = (SpellVisualEffectNameType)spellVisualEffectName.Type;
|
||||
if (type == SpellVisualEffectNameType.UnitAmmoBasic || type == SpellVisualEffectNameType.UnitAmmoPreferred)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (SpellXSpellVisualRecord spellXspellVisual in spellInfo.GetSpellVisuals())
|
||||
{
|
||||
if (visualNeedsAmmo(spellXspellVisual))
|
||||
{
|
||||
spellInfo.AttributesCu |= SpellCustomAttributes.NeedsAmmoData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// addition for binary spells, omit spells triggering other spells
|
||||
|
||||
Reference in New Issue
Block a user