Ability fixes and cleanup

This commit is contained in:
dingo
2026-02-08 18:57:04 -05:00
parent ec48fce15a
commit 6e3be67f64
10 changed files with 248 additions and 16 deletions
+15 -5
View File
@@ -41,6 +41,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
// Mob definitions cache
private Dictionary<int, DungeonMobDefinition> _mobDefinitions = new();
private Dictionary<int, MobAbilityDefinition> _abilityDefinitions = new();
private Dictionary<int, MobAbilityAnimationMapping> _abilityAnimationMappings = new();
private Dictionary<int, string?> _mobSpriteConfigs = new(); // MobDefinitionId -> SpriteConfig JSON
private bool _initialized = false;
@@ -678,7 +679,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
}
}
var simulation = new DungeonSimulation(layout, tier, _mobDefinitions, bracketMin, _abilityDefinitions, _mobSpriteConfigs);
var simulation = new DungeonSimulation(layout, tier, _mobDefinitions, bracketMin, _abilityDefinitions, _mobSpriteConfigs, _abilityAnimationMappings);
instance = new DungeonInstance
{
@@ -1531,7 +1532,6 @@ public sealed partial class DungeonHandler : IClientMessageHandler
{
_ = HandleDungeonClearedAsync(session);
}
continue;
}
foreach (var session in playersInDungeon)
@@ -2891,6 +2891,16 @@ public sealed partial class DungeonHandler : IClientMessageHandler
x = e.X,
y = e.Y,
reason = e.Reason
}),
abilities = tickResult.AbilityEvents.Select(e => new
{
sourceType = e.SourceType.ToString().ToLower(),
sourceId = e.SourceId,
abilityKey = e.AbilityKey,
animationKey = e.AnimationKey,
targetX = e.TargetX,
targetY = e.TargetY,
targetId = e.TargetId
})
},
@@ -2919,10 +2929,10 @@ public sealed partial class DungeonHandler : IClientMessageHandler
{
_log.LogInformation("Dungeon cleared! Player {Name} can now exit via portal", session.Character.Name);
// Send dungeon cleared notification (but don't force exit)
await SendAsync(session.Connection, DungeonOpCodes.DUNGEON_STATE, new
// Send dungeon cleared notification on dedicated opcode.
// Full world state still flows through regular DUNGEON_STATE packets.
await SendAsync(session.Connection, DungeonOpCodes.DUNGEON_CLEARED, new
{
phase = "cleared",
message = "Dungeon cleared! Use the portal to exit."
}, CancellationToken.None);