refactor(net): own live session routing

This commit is contained in:
Erik 2026-07-21 11:17:09 +02:00
parent 707e606e35
commit 961bdd07b7
12 changed files with 1645 additions and 543 deletions

View file

@ -12,13 +12,19 @@ public static class CombatStateWiring
{
public const uint CombatModePropertyId = 40u;
public static IDisposable Wire(WorldSession session, CombatState combat)
public static IDisposable Wire(
WorldSession session,
CombatState combat,
Func<bool>? accepting = null)
{
ArgumentNullException.ThrowIfNull(session);
ArgumentNullException.ThrowIfNull(combat);
Action<WorldSession.PlayerIntPropertyUpdate> handler = update =>
{
if (accepting?.Invoke() == false) return;
ApplyPlayerIntProperty(combat, update.Property, update.Value);
};
session.PlayerIntPropertyUpdated += handler;
return new EventSubscription(session, handler);
}