refactor(net): own live session routing
This commit is contained in:
parent
707e606e35
commit
961bdd07b7
12 changed files with 1645 additions and 543 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue