ace/Source/ACE.Server/Entity/SpellProjectileInfo.cs
gmriggs 2ba95f776f
update spell projectile to use more spell / weenie data (#2567)
* fixing mobs casting flame wave

* adding support for EmoteManager.CastSpell untargeted spell projectiles

* fixing untargeted Blast spells

* fixing blast spells

* fixing spell z-angle

* wip

* latest wip

* cleanup

* small position adjustments

* matching create.Y formula up to retail pcaps

* fixing portal gems
2019-12-31 01:45:44 -05:00

60 lines
2 KiB
C#

using System.Numerics;
using ACE.Entity;
using ACE.Server.WorldObjects;
namespace ACE.Server.Entity
{
public class SpellProjectileInfo
{
public SpellProjectile SpellProjectile;
public Position CasterPos;
public Position TargetPos;
public Vector3? CachedVelocity;
public Physics.Common.Position StartPos;
public SpellProjectileInfo(SpellProjectile spellProjectile)
{
var caster = spellProjectile.ProjectileSource;
var target = spellProjectile.ProjectileTarget;
SpellProjectile = spellProjectile;
if (caster?.Location != null)
CasterPos = new Position(caster.Location);
if (target?.Location != null)
TargetPos = new Position(target.Location);
if (spellProjectile.PhysicsObj.Position != null)
StartPos = new Physics.Common.Position(spellProjectile.PhysicsObj.Position);
CachedVelocity = target?.PhysicsObj.CachedVelocity;
}
public override string ToString()
{
var caster = SpellProjectile.ProjectileSource;
var target = SpellProjectile.ProjectileTarget;
var info = $"Caster: {caster.Name} ({caster.Guid})\n";
info += $"CasterPos: {CasterPos.ToLOCString()}\n";
info += $"Spell: {SpellProjectile.Spell.Id} - {SpellProjectile.Spell.Name}\n";
info += $"Velocity: {SpellProjectile.Velocity}\n";
info += $"CachedVelocity: {CachedVelocity}\n";
info += $"StartPos: {SpellProjectile.SpawnPos.ToLOCString()}\n";
info += $"ActualStartPos: {StartPos}\n";
info += $"EndPos: {SpellProjectile.Location.ToLOCString()}\n";
if (target != null)
{
info += $"Target: {target.WeenieClassId} - {target.Name} ({target.Guid})\n";
info += $"TargetPos: {TargetPos.ToLOCString()}";
}
return info;
}
}
}