fix: Stops creating blocked packets entirely (#944)

Optimizes larger servers where users are logging in and packets are being created for no reason.
This commit is contained in:
Kamron Batman 2022-02-27 00:13:49 -08:00 • committed by GitHub
parent 5db8b1354c
commit 941452de4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 5510 additions and 5537 deletions

View file

@ -103,7 +103,7 @@ namespace Server.Engines.Chat
public static void SendChatMessage(this NetState ns, string lang, int number, string param1, string param2)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}

View file

@ -464,12 +464,7 @@ namespace Server.Engines.Harvest
var ns = from.NetState;
if (ns == null)
{
return;
}
if (number == 1043297 || ns.HighSeas)
if (number == 1043297 || ns?.HighSeas == true)
{
from.SendLocalizedMessage(number, name);
}

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Help
public static void SendDisplayHelpTopic(this NetState ns, int topicID, bool display = true)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}

View file

@ -48,7 +48,7 @@ namespace Server.Engines.PartySystem
public static void SendPartyMemberList(this NetState ns, Party p)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}
@ -64,7 +64,7 @@ namespace Server.Engines.PartySystem
public static void SendPartyRemoveMember(this NetState ns, Serial m, Party p = null)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}
@ -104,7 +104,7 @@ namespace Server.Engines.PartySystem
public static void SendPartyTextMessage(this NetState ns, Serial m, string text, bool toAll)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}
@ -134,7 +134,7 @@ namespace Server.Engines.PartySystem
public static void SendPartyInvitation(this NetState ns, Serial leader)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}

View file

@ -47,7 +47,7 @@ namespace Server.Engines.VeteranRewards
public static void SendStatueAnimation(this NetState ns, Serial serial, int status, int anim, int frame)
{
if (ns == null)
if (ns.CannotSendPackets())
{
return;
}