diff --git a/Game/Dungeon/DungeonHandler.cs b/Game/Dungeon/DungeonHandler.cs index 6240ae4..92a2061 100644 --- a/Game/Dungeon/DungeonHandler.cs +++ b/Game/Dungeon/DungeonHandler.cs @@ -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}"); + } } } }