Core/Spells: Fixed ErrorCube spell missiles
Port From (https://github.com/TrinityCore/TrinityCore/commit/ce794f3978e853341b2dc0c782e7bda34303b3f8)
This commit is contained in:
@@ -310,6 +310,9 @@ namespace Game.DataStorage
|
||||
SpellShapeshiftFormStorage = ReadDB2<SpellShapeshiftFormRecord>("SpellShapeshiftForm.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM, HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM_LOCALE);
|
||||
SpellTargetRestrictionsStorage = ReadDB2<SpellTargetRestrictionsRecord>("SpellTargetRestrictions.db2", HotfixStatements.SEL_SPELL_TARGET_RESTRICTIONS);
|
||||
SpellTotemsStorage = ReadDB2<SpellTotemsRecord>("SpellTotems.db2", HotfixStatements.SEL_SPELL_TOTEMS);
|
||||
SpellVisualStorage = ReadDB2<SpellVisualRecord>("SpellVisual.db2", HotfixStatements.SEL_SPELL_VISUAL);
|
||||
SpellVisualEffectNameStorage = ReadDB2<SpellVisualEffectNameRecord>("SpellVisualEffectName.db2", HotfixStatements.SEL_SPELL_VISUAL_EFFECT_NAME);
|
||||
SpellVisualMissileStorage = ReadDB2<SpellVisualMissileRecord>("SpellVisualMissile.db2", HotfixStatements.SEL_SPELL_VISUAL_MISSILE);
|
||||
SpellVisualKitStorage = ReadDB2<SpellVisualKitRecord>("SpellVisualKit.db2", HotfixStatements.SEL_SPELL_VISUAL_KIT);
|
||||
SpellXSpellVisualStorage = ReadDB2<SpellXSpellVisualRecord>("SpellXSpellVisual.db2", HotfixStatements.SEL_SPELL_X_SPELL_VISUAL);
|
||||
SummonPropertiesStorage = ReadDB2<SummonPropertiesRecord>("SummonProperties.db2", HotfixStatements.SEL_SUMMON_PROPERTIES);
|
||||
@@ -695,6 +698,9 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<SpellShapeshiftFormRecord> SpellShapeshiftFormStorage;
|
||||
public static DB6Storage<SpellTargetRestrictionsRecord> SpellTargetRestrictionsStorage;
|
||||
public static DB6Storage<SpellTotemsRecord> SpellTotemsStorage;
|
||||
public static DB6Storage<SpellVisualRecord> SpellVisualStorage;
|
||||
public static DB6Storage<SpellVisualEffectNameRecord> SpellVisualEffectNameStorage;
|
||||
public static DB6Storage<SpellVisualMissileRecord> SpellVisualMissileStorage;
|
||||
public static DB6Storage<SpellVisualKitRecord> SpellVisualKitStorage;
|
||||
public static DB6Storage<SpellXSpellVisualRecord> SpellXSpellVisualStorage;
|
||||
public static DB6Storage<SummonPropertiesRecord> SummonPropertiesStorage;
|
||||
|
||||
@@ -507,6 +507,9 @@ namespace Game.DataStorage
|
||||
foreach (SpellProcsPerMinuteModRecord ppmMod in SpellProcsPerMinuteModStorage.Values)
|
||||
_spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod);
|
||||
|
||||
foreach (SpellVisualMissileRecord spellVisualMissile in SpellVisualMissileStorage.Values)
|
||||
_spellVisualMissilesBySet.Add(spellVisualMissile.SpellVisualMissileSetID, spellVisualMissile);
|
||||
|
||||
for (var i = 0; i < (int)Class.Max; ++i)
|
||||
{
|
||||
_talentsByPosition[i] = new List<TalentRecord>[PlayerConst.MaxTalentTiers][];
|
||||
@@ -2009,6 +2012,11 @@ namespace Game.DataStorage
|
||||
return _spellProcsPerMinuteMods.LookupByKey(spellprocsPerMinuteId);
|
||||
}
|
||||
|
||||
public List<SpellVisualMissileRecord> GetSpellVisualMissiles(int spellVisualMissileSetId)
|
||||
{
|
||||
return _spellVisualMissilesBySet.LookupByKey(spellVisualMissileSetId);
|
||||
}
|
||||
|
||||
public List<TalentRecord> GetTalentsByPosition(Class class_, uint tier, uint column)
|
||||
{
|
||||
return _talentsByPosition[(int)class_][tier][column];
|
||||
@@ -2409,6 +2417,7 @@ namespace Game.DataStorage
|
||||
List<Tuple<int, uint>> _specsBySpecSet = new();
|
||||
List<byte> _spellFamilyNames = new();
|
||||
MultiMap<uint, SpellProcsPerMinuteModRecord> _spellProcsPerMinuteMods = new();
|
||||
MultiMap<uint, SpellVisualMissileRecord> _spellVisualMissilesBySet = new();
|
||||
List<TalentRecord>[][][] _talentsByPosition = new List<TalentRecord>[(int)Class.Max][][];
|
||||
List<uint> _toys = new();
|
||||
Dictionary<uint, TransmogIllusionRecord> _transmogIllusionsByEnchantmentId = new();
|
||||
|
||||
@@ -555,6 +555,69 @@ namespace Game.DataStorage
|
||||
public uint[] Totem = new uint[SpellConst.MaxTotems];
|
||||
}
|
||||
|
||||
public sealed class SpellVisualRecord
|
||||
{
|
||||
public uint Id;
|
||||
public float[] MissileCastOffset = new float[3];
|
||||
public float[] MissileImpactOffset = new float[3];
|
||||
public uint AnimEventSoundID;
|
||||
public int Flags;
|
||||
public sbyte MissileAttachment;
|
||||
public sbyte MissileDestinationAttachment;
|
||||
public uint MissileCastPositionerID;
|
||||
public uint MissileImpactPositionerID;
|
||||
public int MissileTargetingKit;
|
||||
public uint HostileSpellVisualID;
|
||||
public uint CasterSpellVisualID;
|
||||
public ushort SpellVisualMissileSetID;
|
||||
public ushort DamageNumberDelay;
|
||||
public uint LowViolenceSpellVisualID;
|
||||
public uint RaidSpellVisualMissileSetID;
|
||||
public int ReducedUnexpectedCameraMovementSpellVisualID;
|
||||
}
|
||||
|
||||
public sealed class SpellVisualEffectNameRecord
|
||||
{
|
||||
public uint Id;
|
||||
public int ModelFileDataID;
|
||||
public float BaseMissileSpeed;
|
||||
public float Scale;
|
||||
public float MinAllowedScale;
|
||||
public float MaxAllowedScale;
|
||||
public float Alpha;
|
||||
public uint Flags;
|
||||
public int TextureFileDataID;
|
||||
public float EffectRadius;
|
||||
public uint Type;
|
||||
public int GenericID;
|
||||
public uint RibbonQualityID;
|
||||
public int DissolveEffectID;
|
||||
public int ModelPosition;
|
||||
public sbyte Unknown901;
|
||||
}
|
||||
|
||||
public sealed class SpellVisualMissileRecord
|
||||
{
|
||||
public float[] CastOffset = new float[3];
|
||||
public float[] ImpactOffset = new float[3];
|
||||
public uint Id;
|
||||
public ushort SpellVisualEffectNameID;
|
||||
public uint SoundEntriesID;
|
||||
public sbyte Attachment;
|
||||
public sbyte DestinationAttachment;
|
||||
public ushort CastPositionerID;
|
||||
public ushort ImpactPositionerID;
|
||||
public int FollowGroundHeight;
|
||||
public uint FollowGroundDropSpeed;
|
||||
public ushort FollowGroundApproach;
|
||||
public uint Flags;
|
||||
public ushort SpellMissileMotionID;
|
||||
public uint AnimKitID;
|
||||
public sbyte ClutterLevel;
|
||||
public int DecayTimeAfterImpact;
|
||||
public uint SpellVisualMissileSetID;
|
||||
}
|
||||
|
||||
public sealed class SpellVisualKitRecord
|
||||
{
|
||||
public uint Id;
|
||||
|
||||
@@ -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