projectile fix4

This commit is contained in:
dingo
2026-01-20 18:25:43 -05:00
parent 2765203ef1
commit ed6ad4985d
+46 -30
View File
@@ -1167,22 +1167,30 @@ public sealed partial class DungeonHandler : IClientMessageHandler
if (playerSession != null)
{
Console.WriteLine($"[HandleFireProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name} (CharId={playerSession.CharacterId})");
_ = SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
try
{
id = projectile.Id,
sourceType = "player",
sourceId = session.CharacterId,
x = projectile.X,
y = projectile.Y,
vx = projectile.VelocityX,
vy = projectile.VelocityY,
sprite = projectile.SpriteKey,
isLinear = projectile.IsLinear,
frontX = projectile.FrontX,
frontY = projectile.FrontY,
backX = projectile.BackX,
backY = projectile.BackY
}, CancellationToken.None);
await SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
{
id = projectile.Id,
sourceType = "player",
sourceId = session.CharacterId,
x = projectile.X,
y = projectile.Y,
vx = projectile.VelocityX,
vy = projectile.VelocityY,
sprite = projectile.SpriteKey,
isLinear = projectile.IsLinear,
frontX = projectile.FrontX,
frontY = projectile.FrontY,
backX = projectile.BackX,
backY = projectile.BackY
}, ct);
Console.WriteLine($"[HandleFireProjectile] Successfully sent EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}");
}
catch (Exception ex)
{
Console.WriteLine($"[HandleFireProjectile] ERROR sending EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}: {ex.Message}");
}
}
else
{
@@ -1257,22 +1265,30 @@ public sealed partial class DungeonHandler : IClientMessageHandler
if (playerSession != null)
{
Console.WriteLine($"[HandleThrowableProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name}");
_ = SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
try
{
id = projectile.Id,
sourceType = "player",
sourceId = session.CharacterId,
x = projectile.X,
y = projectile.Y,
vx = projectile.VelocityX,
vy = projectile.VelocityY,
sprite = projectile.SpriteKey,
isLinear = projectile.IsLinear,
frontX = projectile.FrontX,
frontY = projectile.FrontY,
backX = projectile.BackX,
backY = projectile.BackY
}, CancellationToken.None);
await SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
{
id = projectile.Id,
sourceType = "player",
sourceId = session.CharacterId,
x = projectile.X,
y = projectile.Y,
vx = projectile.VelocityX,
vy = projectile.VelocityY,
sprite = projectile.SpriteKey,
isLinear = projectile.IsLinear,
frontX = projectile.FrontX,
frontY = projectile.FrontY,
backX = projectile.BackX,
backY = projectile.BackY
}, ct);
Console.WriteLine($"[HandleThrowableProjectile] Successfully sent EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}");
}
catch (Exception ex)
{
Console.WriteLine($"[HandleThrowableProjectile] ERROR sending EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}: {ex.Message}");
}
}
}
}