mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-15 17:04:36 +02:00
Added new search packets.
This commit is contained in:
parent
441c1a6383
commit
e819603432
8 changed files with 218 additions and 0 deletions
|
@ -0,0 +1,56 @@
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using FFXIVClassic.Common;
|
||||
using System;
|
||||
using FFXIVClassic_Map_Server.packets.send.search;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.social
|
||||
{
|
||||
class PlayerSearchInfoResultPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x01DF;
|
||||
public const uint PACKET_SIZE = 0x3C8;
|
||||
|
||||
public static SubPacket BuildPacket(uint sourceActorId, uint searchSessionId, byte resultCode, PlayerSearchResult[] results, ref int offset)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
byte count;
|
||||
|
||||
if (results.Length - offset < 8)
|
||||
count = (byte)(results.Length - offset);
|
||||
else
|
||||
count = 8;
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
for (int i = offset; i < count; i++)
|
||||
{
|
||||
long start = binWriter.BaseStream.Position;
|
||||
binWriter.Write((Byte)results[i].preferredClass);
|
||||
binWriter.Write((Byte)0);
|
||||
binWriter.Write((Byte)results[i].clientLanguage);
|
||||
binWriter.Write((UInt16)results[i].currentZone);
|
||||
binWriter.Write((Byte)results[i].initialTown);
|
||||
binWriter.Write((Byte)0);
|
||||
binWriter.Write((Byte)results[i].status);
|
||||
binWriter.Write((Byte)results[i].currentClass);
|
||||
binWriter.Write((Byte)0);
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(results[i].name), 0, Encoding.ASCII.GetByteCount(results[i].name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(results[i].name));
|
||||
binWriter.Seek((int)(start + 30), SeekOrigin.Begin);
|
||||
//classes
|
||||
binWriter.Seek((int)(start + 30 + 20), SeekOrigin.Begin);
|
||||
//jobs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
offset += count;
|
||||
|
||||
return new SubPacket(OPCODE, sourceActorId, data);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue