feature/72-channelselection-and-character-creation #82

Merged
rainote merged 35 commits from feature/72-channelselection-and-character-creation into master 2023-11-14 19:47:01 +00:00
2 changed files with 49 additions and 6 deletions
Showing only changes of commit 5381d78cfc - Show all commits

View file

@ -41,7 +41,7 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
ChannelSelectionResponsePacket responsePacket;
var testingChars = true;
if (charactersOfAccount != null && testingChars)
if (charactersOfAccount != null && !testingChars)
{
responsePacket = new ChannelSelectionResponsePacket
{
@ -99,9 +99,9 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
{
new CharacterData
{
Name = "Test243",
Name = "1",
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
Gender = Gender.None,
Gender = Gender.Female,
Level = ushort.MaxValue - 1,
Experience = 255,
Stats = new BaseStats
@ -116,8 +116,50 @@ public class ChannelSelectionHandler : IPacketHandler<ChannelSelectionPacket>
Health = int.MaxValue - 1,
Mana = int.MaxValue - 1,
EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(),
EquippedCashItems = Enumerable.Repeat((ushort)25, 20).ToArray()
EquippedCashItems = Enumerable.Repeat((ushort)70, 20).ToArray()
},
new CharacterData
{
Name = "2",
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
Gender = Gender.Female,
Level = ushort.MaxValue - 1,
Experience = 255,
Stats = new BaseStats
{
Strength = 5,
Dexterity = 5,
Intelligence = 5,
Vitality = 5,
Luck = 5,
Wisdom = 5
},
Health = int.MaxValue - 1,
Mana = int.MaxValue - 1,
EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(),
EquippedCashItems = Enumerable.Repeat((ushort)70, 20).ToArray()
},
new CharacterData
{
Name = "3",
Job = new JobData { FirstJob = 1, SecondJob = 0, ThirdJob = 0, FourthJob = 0 },
Gender = Gender.Female,
Level = ushort.MaxValue - 1,
Experience = 255,
Stats = new BaseStats
{
Strength = 5,
Dexterity = 5,
Intelligence = 5,
Vitality = 5,
Luck = 5,
Wisdom = 5
},
Health = int.MaxValue - 1,
Mana = int.MaxValue - 1,
EquippedItems = Enumerable.Repeat((ushort)25, 20).ToArray(),
EquippedCashItems = Enumerable.Repeat((ushort)65, 20).ToArray()
}
},
};
}

View file

@ -18,7 +18,7 @@ public class ChannelSelectionResponsePacket : IPacket
public byte[] Serialize()
{
Span<byte> data = stackalloc byte[1 + 16 + 2 + 2 + 132 * this.Characters.Length + 20];
Span<byte> data = stackalloc byte[1 + 16 + 2 + 1 + 132 * this.Characters.Length];
data.Clear();
data[0] = this.ChannelIsFullFlag;
Encoding.ASCII.GetBytes(this.Endpoint, data.Slice(1, 16));
@ -29,7 +29,7 @@ public class ChannelSelectionResponsePacket : IPacket
for (var i = 0; i < Characters.Length; i++)
{
var character = Characters[i];
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(20, 4), i);
BinaryPrimitives.WriteInt32LittleEndian(data.Slice(20 + (i * 132), 4), i);
Encoding.ASCII.GetBytes(character.Name, data.Slice(24 + (i * 132), 20));
// Job Data
@ -64,6 +64,7 @@ public class ChannelSelectionResponsePacket : IPacket
character.EquippedCashItems.Length > j ? character.EquippedCashItems[j] : (ushort)0);
}
}
return data.ToArray();
}
}