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

@ -17,6 +17,22 @@ using System;
using System.Buffers;
using System.Collections.Generic;
using System.IO;
using Server.Accounting;
using Server.Assistants;
using Server.Commands;
using Server.Engines.ConPVP;
using Server.Engines.Doom;
using Server.Engines.PartySystem;
using Server.Engines.Plants;
using Server.Engines.PlayerMurderSystem;
using Server.Engines.VeteranRewards;
using Server.Factions;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Regions;
using Server.Spells.Ninjitsu;
using Server.Spells.Spellweaving;
using CV = Server.ClientVersion;
namespace Server.Network;
@ -190,7 +206,7 @@ public static class IncomingAccountPackets
reader.Seek(30, SeekOrigin.Current);
var index = reader.ReadInt32();
EventSink.InvokeDeleteRequest(state, index);
AccountHandler.DeleteRequest(state, index);
}
public static void AccountID(NetState state, SpanReader reader)
@ -201,7 +217,7 @@ public static class IncomingAccountPackets
{
var version = state.Version = new CV(reader.ReadAscii());
EventSink.InvokeClientVersionReceived(state, version);
ClientVerification.ClientVersionReceived(state, version);
}
public static void ClientType(NetState state, SpanReader reader)
@ -211,7 +227,7 @@ public static class IncomingAccountPackets
int type = reader.ReadUInt16();
var version = state.Version = new CV(reader.ReadAscii());
EventSink.InvokeClientVersionReceived(state, version);
ClientVerification.ClientVersionReceived(state, version);
}
public static void PlayCharacter(NetState state, SpanReader reader)
@ -307,7 +323,30 @@ public static class IncomingAccountPackets
state.SendPlayMusic(m.Region.Music);
EventSink.InvokeLogin(m);
StaminaSystem.OnLogin(m);
DuelContext.OnLogin(m);
LightCycle.OnLogin(m);
LoginStats.OnLogin(m);
AnimalForm.OnLogin(m);
BaseBeverage.OnLogin(m);
AntiMacroSystem.OnLogin(m);
Strandedness.OnLogin(m);
ShardPoller.OnLogin(m);
ReaperFormSpell.OnLogin(m);
Party.OnLogin(m);
PlantSystem.OnLogin(m);
LampRoomRegion.OnLogin(m);
HouseRegion.OnLogin(m);
Faction.OnLogin(m);
PlayerMurderSystem.OnLogin(m);
AssistantHandler.OnLogin(m);
VisibilityList.OnLogin(m);
PlayerMobile.OnLogin(m);
Account.OnLogin(m);
GiftGiving.OnLogin(m);
PreventInaccess.OnLogin(m);
TwistedWealdDesertRegion.OnLogin(m);
RewardSystem.OnLogin(m);
}
private static int GenerateAuthID(this NetState state)

View file

@ -16,6 +16,7 @@
using System.Buffers;
using Server.ContextMenus;
using Server.Items;
using Server.Mobiles;
namespace Server.Network;
@ -251,7 +252,7 @@ public static class IncomingExtendedCommandPackets
Item spellbook = reader.ReadInt16() == 1 ? World.FindItem((Serial)reader.ReadUInt32()) : null;
var spellID = reader.ReadInt16() - 1;
EventSink.InvokeCastSpellRequest(from, spellID, spellbook);
Spellbook.CastSpellRequest(from, spellID, spellbook);
}
public static void ToggleFlying(NetState state, SpanReader reader)
@ -490,7 +491,7 @@ public static class IncomingExtendedCommandPackets
return;
}
EventSink.InvokeBandageTargetRequest(from, bandage, target);
Bandage.BandageTargetRequest(from, bandage, target);
from.NextActionTime = Core.TickCount + Mobile.ActionDelay;
}
@ -504,14 +505,14 @@ public static class IncomingExtendedCommandPackets
{
var spellId = (short)(reader.ReadInt16() - 1); // zero based;
EventSink.InvokeTargetedSpell(state.Mobile, World.FindEntity((Serial)reader.ReadUInt32()), spellId);
Spellbook.TargetedSpell(state.Mobile, World.FindEntity((Serial)reader.ReadUInt32()), spellId);
}
public static void TargetedSkillUse(NetState state, SpanReader reader)
{
var skillId = reader.ReadInt16();
EventSink.InvokeTargetedSkillUse(state.Mobile, World.FindEntity((Serial)reader.ReadUInt32()), skillId);
PlayerMobile.TargetedSkillUse(state.Mobile, World.FindEntity((Serial)reader.ReadUInt32()), skillId);
}
public static void TargetByResourceMacro(NetState state, SpanReader reader)

View file

@ -17,6 +17,7 @@ using System.Buffers;
using System.Collections.Generic;
using System.IO;
using Server.Items;
using Server.Mobiles;
namespace Server.Network;
@ -117,7 +118,7 @@ public static class IncomingItemPackets
serialList.Add((Serial)reader.ReadUInt32());
}
EventSink.InvokeEquipMacro(state.Mobile, serialList);
PlayerMobile.EquipMacro(state.Mobile, serialList);
}
public static void UnequipMacro(NetState state, SpanReader reader)
@ -129,6 +130,6 @@ public static class IncomingItemPackets
layers.Add((Layer)reader.ReadUInt16());
}
EventSink.InvokeUnequipMacro(state.Mobile, layers);
PlayerMobile.UnequipMacro(state.Mobile, layers);
}
}

View file

@ -15,6 +15,7 @@
using System.Buffers;
using Server.Items;
using Server.Misc;
namespace Server.Network;
@ -35,7 +36,7 @@ public static class IncomingMobilePackets
if (targ != null)
{
EventSink.InvokeRenameRequest(from, targ, reader.ReadAsciiSafe());
RenameRequests.RenameRequest(from, targ, reader.ReadAsciiSafe());
}
}
@ -66,7 +67,7 @@ public static class IncomingMobilePackets
{
case 0x00: // display request
{
EventSink.InvokeProfileRequest(beholder, beheld);
Profile.ProfileRequest(beholder, beheld);
break;
}
@ -82,7 +83,7 @@ public static class IncomingMobilePackets
var text = reader.ReadBigUni(length);
EventSink.InvokeChangeProfileRequest(beholder, beheld, text);
Profile.ChangeProfileRequest(beholder, beheld, text);
break;
}

View file

@ -21,9 +21,14 @@ using System.IO;
using System.Runtime.InteropServices;
using CommunityToolkit.HighPerformance;
using Server.Diagnostics;
using Server.Engines.Help;
using Server.Engines.MLQuests;
using Server.Engines.Virtues;
using Server.Exceptions;
using Server.Guilds;
using Server.Gumps;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
namespace Server.Network;
@ -136,7 +141,7 @@ public static class IncomingPlayerPackets
{
case 0xC7: // Animate
{
EventSink.InvokeAnimateRequest(from, command);
Animations.AnimateRequest(from, command);
break;
}
@ -159,7 +164,7 @@ public static class IncomingPlayerPackets
booktype = 1;
}
EventSink.InvokeOpenSpellbookRequest(from, booktype);
Spellbook.OpenSpellbookRequest(from, booktype);
break;
}
@ -169,13 +174,13 @@ public static class IncomingPlayerPackets
var spellID = (tokenizer.MoveNext() ? Utility.ToInt32(tokenizer.Current) : 0) - 1;
var serial = tokenizer.MoveNext() ? (Serial)Utility.ToUInt32(tokenizer.Current) : Serial.MinusOne;
EventSink.InvokeCastSpellRequest(from, spellID, World.FindItem(serial));
Spellbook.CastSpellRequest(from, spellID, World.FindItem(serial));
break;
}
case 0x58: // Open door
{
EventSink.InvokeOpenDoorMacroUsed(from);
BaseDoor.OpenDoorMacroUsed(from);
break;
}
@ -183,7 +188,7 @@ public static class IncomingPlayerPackets
{
var spellID = Utility.ToInt32(command) - 1;
EventSink.InvokeCastSpellRequest(from, spellID, null);
Spellbook.CastSpellRequest(from, spellID, null);
break;
}
@ -341,7 +346,7 @@ public static class IncomingPlayerPackets
public static void HelpRequest(NetState state, SpanReader reader)
{
EventSink.InvokeHelpRequest(state.Mobile);
HelpGump.HelpRequest(state.Mobile);
}
public static void DisplayGumpResponse(NetState state, SpanReader reader)
@ -617,12 +622,12 @@ public static class IncomingPlayerPackets
public static void GuildGumpRequest(NetState state, IEntity e, EncodedReader reader)
{
EventSink.InvokeGuildGumpRequest(state.Mobile);
Guild.GuildGumpRequest(state.Mobile);
}
public static void QuestGumpRequest(NetState state, IEntity e, EncodedReader reader)
{
EventSink.InvokeQuestGumpRequest(state.Mobile);
MLQuestSystem.QuestGumpRequest(state.Mobile);
}
public static unsafe void EncodedCommand(NetState state, SpanReader reader)