From 797ea61f36f3903c6cf76270cab36c7d93b4bc1d Mon Sep 17 00:00:00 2001 From: Timothy Schenk Date: Thu, 16 Nov 2023 12:22:18 +0100 Subject: [PATCH] fix: incorrect offset --- .../CharacterCreationResponsePacket.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Wonderking/Packets/Outgoing/CharacterCreationResponsePacket.cs b/Wonderking/Packets/Outgoing/CharacterCreationResponsePacket.cs index c38e7a5..06b0b3f 100644 --- a/Wonderking/Packets/Outgoing/CharacterCreationResponsePacket.cs +++ b/Wonderking/Packets/Outgoing/CharacterCreationResponsePacket.cs @@ -18,38 +18,38 @@ public class CharacterCreationResponsePacket : IPacket { Span data = stackalloc byte[132]; - BinaryPrimitives.WriteInt32LittleEndian(data.Slice(0 + 132, 4), 0); - Encoding.ASCII.GetBytes(Character.Name, data.Slice(4 + 132, 20)); + BinaryPrimitives.WriteInt32LittleEndian(data.Slice(0, 4), 0); + Encoding.ASCII.GetBytes(Character.Name, data.Slice(4, 20)); // Job Data - data[24 + 132] = Character.Job.FirstJob; - data[25 + 132] = Character.Job.SecondJob; - data[26 + 132] = Character.Job.ThirdJob; - data[27 + 132] = Character.Job.FourthJob; + data[24] = Character.Job.FirstJob; + data[25] = Character.Job.SecondJob; + data[26] = Character.Job.ThirdJob; + data[27] = Character.Job.FourthJob; - data[28 + 132] = (byte)Character.Gender; - BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(49 + 132, 2), Character.Level); - data[31 + 132] = (byte)Character.Experience; + data[28] = (byte)Character.Gender; + BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(49, 2), Character.Level); + data[31] = (byte)Character.Experience; // Stats - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(32 + 132, 2), Character.Stats.Strength); - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(34 + 132, 2), Character.Stats.Dexterity); - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(36 + 132, 2), Character.Stats.Intelligence); - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(38 + 132, 2), Character.Stats.Vitality); - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(40 + 132, 2), Character.Stats.Luck); - BinaryPrimitives.WriteInt16LittleEndian(data.Slice(42 + 132, 2), Character.Stats.Wisdom); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(32, 2), Character.Stats.Strength); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(34, 2), Character.Stats.Dexterity); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(36, 2), Character.Stats.Intelligence); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(38, 2), Character.Stats.Vitality); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(40, 2), Character.Stats.Luck); + BinaryPrimitives.WriteInt16LittleEndian(data.Slice(42, 2), Character.Stats.Wisdom); - BinaryPrimitives.WriteInt32LittleEndian(data.Slice(44 + 132, 4), Character.Health); - BinaryPrimitives.WriteInt32LittleEndian(data.Slice(48 + 132, 4), Character.Mana); + BinaryPrimitives.WriteInt32LittleEndian(data.Slice(44, 4), Character.Health); + BinaryPrimitives.WriteInt32LittleEndian(data.Slice(48, 4), Character.Mana); for (var i = 0; i < 20; i++) { // Equipped Items - BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(52 + 132 + i * 2, 2), + BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(52 + i * 2, 2), Character.EquippedItems.Length > i ? Character.EquippedItems[i] : (ushort)0); // Equipped Cash Items - BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(92 + 132 + i * 2, 2), + BinaryPrimitives.WriteUInt16LittleEndian(data.Slice(92 + i * 2, 2), Character.EquippedCashItems.Length > i ? Character.EquippedCashItems[i] : (ushort)0); }