fix: Moves many EventSinks out of core. (#1783)

This commit is contained in:
Marcelo Paez Sequeira 2024-05-21 14:02:30 -03:00 • committed by GitHub
parent 1cb798d807
commit 00908d030f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
45 changed files with 133 additions and 276 deletions

View file

@ -2,12 +2,7 @@ namespace Server.Misc
{
public static class Animations
{
public static void Initialize()
{
EventSink.AnimateRequest += EventSink_AnimateRequest;
}
private static void EventSink_AnimateRequest(Mobile from, string actionName)
public static void AnimateRequest(Mobile from, string actionName)
{
var action = actionName switch
{

View file

@ -109,16 +109,13 @@ namespace Server
Enabled = ServerConfiguration.GetOrUpdateSetting("buffIcons.enable", Core.ML);
}
public static void Initialize()
{
if (Enabled)
{
EventSink.ClientVersionReceived += ResendBuffsOnClientVersionReceived;
}
}
public static void ResendBuffsOnClientVersionReceived(NetState ns, ClientVersion cv)
{
if (!Enabled)
{
return;
}
if (ns.Mobile is PlayerMobile pm)
{
Timer.StartTimer(pm.ResendBuffs);

View file

@ -51,8 +51,6 @@ namespace Server.Misc
public static void Initialize()
{
EventSink.ClientVersionReceived += EventSink_ClientVersionReceived;
if (MinRequired == null && MaxRequired == null)
{
MinRequired = UOClient.ServerClientVersion;
@ -117,7 +115,7 @@ namespace Server.Misc
return builder.ToString();
}
private static void EventSink_ClientVersionReceived(NetState state, ClientVersion version)
public static void ClientVersionReceived(NetState state, ClientVersion version)
{
var sb = ValueStringBuilder.Create();

View file

@ -772,8 +772,6 @@ namespace Server.Guilds
public static void Configure()
{
EventSink.GuildGumpRequest += EventSink_GuildGumpRequest;
CommandSystem.Register("GuildProps", AccessLevel.Counselor, GuildProps_OnCommand);
}
@ -915,7 +913,7 @@ namespace Server.Guilds
}
}
public static void EventSink_GuildGumpRequest(Mobile m)
public static void GuildGumpRequest(Mobile m)
{
if (!NewGuildSystem || m is not PlayerMobile pm)
{

View file

@ -32,7 +32,6 @@ namespace Server
public static void Configure()
{
EventSink.Login += OnLogin;
CommandSystem.Register("GlobalLight", AccessLevel.GameMaster, Light_OnCommand);
}

View file

@ -4,13 +4,7 @@ namespace Server.Misc
{
public static class LoginStats
{
public static void Initialize()
{
// Register our event handler
EventSink.Login += EventSink_Login;
}
private static void EventSink_Login(Mobile m)
public static void OnLogin(Mobile m)
{
var userCount = NetState.Instances.Count;
var itemCount = World.Items.Count;

View file

@ -5,13 +5,7 @@ namespace Server.Misc
{
public static class Profile
{
public static void Initialize()
{
EventSink.ProfileRequest += EventSink_ProfileRequest;
EventSink.ChangeProfileRequest += EventSink_ChangeProfileRequest;
}
public static void EventSink_ChangeProfileRequest(Mobile beholder, Mobile beheld, string text)
public static void ChangeProfileRequest(Mobile beholder, Mobile beheld, string text)
{
if (beholder.ProfileLocked)
{
@ -23,7 +17,7 @@ namespace Server.Misc
}
}
public static void EventSink_ProfileRequest(Mobile beholder, Mobile beheld)
public static void ProfileRequest(Mobile beholder, Mobile beheld)
{
if (!beheld.Player)
{

View file

@ -4,12 +4,7 @@ namespace Server.Misc
{
public static class RenameRequests
{
public static void Initialize()
{
EventSink.RenameRequest += EventSink_RenameRequest;
}
private static void EventSink_RenameRequest(Mobile from, Mobile targ, string name)
public static void RenameRequest(Mobile from, Mobile targ, string name)
{
if (from.CanSee(targ) && from.InRange(targ, 12) && targ.CanBeRenamedBy(from))
{

View file

@ -125,12 +125,7 @@ public partial class ShardPoller : Item
Options[^1] = option;
}
public static void Initialize()
{
EventSink.Login += EventSink_Login;
}
private static void EventSink_Login(Mobile m)
public static void OnLogin(Mobile m)
{
if (_activePollers.Count == 0)
{

View file

@ -54,9 +54,7 @@ public static class StaminaSystem
public static void Initialize()
{
EventSink.Movement += EventSink_Movement;
EventSink.Login += Login;
EventSink.Logout += Logout;
EventSink.PlayerDeleted += OnPlayerDeleted;
// Credit idle time
using var queue = PooledRefQueue<IHasSteps>.Create();
@ -77,12 +75,12 @@ public static class StaminaSystem
}
}
private static void OnPlayerDeleted(Mobile m)
public static void OnPlayerDeleted(Mobile m)
{
RemoveEntry(m as IHasSteps);
}
private static void Login(Mobile m)
public static void OnLogin(Mobile m)
{
if (EnableMountStamina)
{