fix(core): Removes 6017 handler (#411)

- [X] Removes 6017 handler since it is only used in one place
- [X] Exposes a ref int to modify the packet length. This is acceptable since we technically have access to the entire reader/buffer.
This commit is contained in:
Kamron Batman 2021-01-16 13:43:16 -08:00 • committed by GitHub
parent dc44142d29
commit 97f311d7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 126 additions and 129 deletions

View file

@ -23,7 +23,7 @@ namespace Server.Engines.Chat
to?.Send(new ChatMessagePacket(null, (int)type + 20, param1, param2));
}
public static void OpenChatWindowRequest(NetState state, CircularBufferReader reader)
public static void OpenChatWindowRequest(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;
@ -56,7 +56,7 @@ namespace Server.Engines.Chat
return user;
}
public static void ChatAction(NetState state, CircularBufferReader reader)
public static void ChatAction(NetState state, CircularBufferReader reader, ref int packetLength)
{
if (!Enabled)
{

View file

@ -193,7 +193,7 @@ namespace Server.Engines.MLQuests.Gumps
return false;
}
private static void RaceChangeReply(NetState state, CircularBufferReader reader)
private static void RaceChangeReply(NetState state, CircularBufferReader reader, ref int packetLength)
{
if (!m_Pending.TryGetValue(state, out var raceChangeState))
{

View file

@ -367,7 +367,7 @@ namespace Server.Items
IncomingPackets.Register(0x93, 99, true, OldHeaderChange);
}
public static void OldHeaderChange(NetState state, CircularBufferReader reader)
public static void OldHeaderChange(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;
@ -386,7 +386,7 @@ namespace Server.Items
book.Author = Utility.FixHtml(author);
}
public static void HeaderChange(NetState state, CircularBufferReader reader)
public static void HeaderChange(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;
@ -420,7 +420,7 @@ namespace Server.Items
book.Author = Utility.FixHtml(author);
}
public static void ContentChange(NetState state, CircularBufferReader reader)
public static void ContentChange(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;

View file

@ -217,7 +217,7 @@ namespace Server.Items
IncomingPackets.Register(0x71, 0, true, BBClientRequest);
}
public static void BBClientRequest(NetState state, CircularBufferReader reader)
public static void BBClientRequest(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;

View file

@ -41,7 +41,7 @@ namespace Server.Engines.Mahjong
RegisterSubCommand(0x18, MoveDealerIndicator);
}
public static void OnPacket(NetState state,CircularBufferReader reader)
public static void OnPacket(NetState state, CircularBufferReader reader, ref int packetLength)
{
var game = World.FindItem(reader.ReadUInt32()) as MahjongGame;

View file

@ -326,7 +326,7 @@ namespace Server.Items
IncomingPackets.Register(0x56, 11, true, OnMapCommand);
}
private static void OnMapCommand(NetState state, CircularBufferReader reader)
private static void OnMapCommand(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;

View file

@ -141,7 +141,7 @@ namespace Server
}
}
public static void OnReceive(NetState state, CircularBufferReader reader)
public static void OnReceive(NetState state, CircularBufferReader reader, ref int packetLength)
{
reader.ReadByte(); // 1: <4.0.1a, 2>=4.0.1a

View file

@ -1768,7 +1768,7 @@ namespace Server.Multis
context.Foundation.SendInfoTo(state);
}
public static void QueryDesignDetails(NetState state, CircularBufferReader reader)
public static void QueryDesignDetails(NetState state, CircularBufferReader reader, ref int packetLength)
{
var from = state.Mobile;

View file

@ -25,7 +25,7 @@ namespace Server.Network
public static PacketHandler GetHandler(int packetID) =>
packetID >= 0 && packetID < _handlers.Length ? _handlers[packetID] : null;
public static void DecodeBundledPacket(NetState state, CircularBufferReader reader)
public static void DecodeBundledPacket(NetState state, CircularBufferReader reader, ref int packetLength)
{
int packetID = reader.ReadByte();
@ -47,25 +47,25 @@ namespace Server.Network
}
else
{
ph.OnReceive(state, reader);
ph.OnReceive(state, reader, ref packetLength);
}
}
public static void QueryGuildMemberLocations(NetState ns, CircularBufferReader reader)
public static void QueryGuildMemberLocations(NetState state, CircularBufferReader reader, ref int packetLength)
{
Mobile from = ns.Mobile;
Mobile from = state.Mobile;
ns.SendGuildMemberLocations(from, from.Guild as Guild, reader.ReadBoolean());
state.SendGuildMemberLocations(from, from.Guild as Guild, reader.ReadBoolean());
}
public static void QueryPartyMemberLocations(NetState ns, CircularBufferReader reader)
public static void QueryPartyMemberLocations(NetState state, CircularBufferReader reader, ref int packetLength)
{
Mobile from = ns.Mobile;
Mobile from = state.Mobile;
var party = Party.Get(from);
if (party != null)
{
ns.SendPartyMemberLocations(from, party);
state.SendPartyMemberLocations(from, party);
}
}

View file

@ -19,7 +19,7 @@ namespace Server.SkillHandlers
SkillInfo.Table[(int)SkillName.Tracking].Callback = OnUse;
}
public static void QuestArrow(NetState state, CircularBufferReader reader)
public static void QuestArrow(NetState state, CircularBufferReader reader, ref int packetLength)
{
if (state.Mobile is PlayerMobile from)
{