Implemented packets for add/remove for friend/black lists.

This commit is contained in:
Filip Maj 2015-12-05 00:05:09 -05:00
parent bda686681d
commit 2ce801f217
4 changed files with 87 additions and 4 deletions

View File

@ -1,5 +1,7 @@
using System; using FFXIVClassic_Lobby_Server.packets;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +10,23 @@ namespace FFXIVClassic_Map_Server.packets.send.social
{ {
class BlacklistAddedPacket class BlacklistAddedPacket
{ {
public const ushort OPCODE = 0x01C9;
public const uint PACKET_SIZE = 0x048;
public static SubPacket buildPacket(uint playerActorID, bool isSuccess, string nameToAdd)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((byte)(isSuccess ? 1 : 0));
binWriter.Write(Encoding.ASCII.GetBytes(nameToAdd), 0, Encoding.ASCII.GetByteCount(nameToAdd) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(nameToAdd));
}
}
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
}
} }
} }

View File

@ -1,5 +1,7 @@
using System; using FFXIVClassic_Lobby_Server.packets;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +10,23 @@ namespace FFXIVClassic_Map_Server.packets.send.social
{ {
class BlacklistRemovedPacket class BlacklistRemovedPacket
{ {
public const ushort OPCODE = 0x01CA;
public const uint PACKET_SIZE = 0x048;
public static SubPacket buildPacket(uint playerActorID, bool isSuccess, string nameToRemove)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((byte)(isSuccess ? 1 : 0));
binWriter.Write(Encoding.ASCII.GetBytes(nameToRemove), 0, Encoding.ASCII.GetByteCount(nameToRemove) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(nameToRemove));
}
}
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
}
} }
} }

View File

@ -1,5 +1,7 @@
using System; using FFXIVClassic_Lobby_Server.packets;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +10,26 @@ namespace FFXIVClassic_Map_Server.packets.send.social
{ {
class FriendlistAddedPacket class FriendlistAddedPacket
{ {
public const ushort OPCODE = 0x01CC;
public const uint PACKET_SIZE = 0x067;
public static SubPacket buildPacket(uint playerActorID, bool isSuccess, uint index, bool isOnline, string nameToAdd)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt32)index);
binWriter.Write((UInt32)0);
binWriter.Write((byte)(isOnline ? 1 : 0));
binWriter.Write((byte)(isSuccess ? 1 : 0));
binWriter.Write(Encoding.ASCII.GetBytes(nameToAdd), 0, Encoding.ASCII.GetByteCount(nameToAdd) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(nameToAdd));
}
}
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
}
} }
} }

View File

@ -1,5 +1,7 @@
using System; using FFXIVClassic_Lobby_Server.packets;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -8,5 +10,23 @@ namespace FFXIVClassic_Map_Server.packets.send.social
{ {
class FriendlistRemovedPacket class FriendlistRemovedPacket
{ {
public const ushort OPCODE = 0x01CD;
public const uint PACKET_SIZE = 0x057;
public static SubPacket buildPacket(uint playerActorID, bool isSuccess, string nameToRemove)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((byte)(isSuccess ? 1 : 0));
binWriter.Write(Encoding.ASCII.GetBytes(nameToRemove), 0, Encoding.ASCII.GetByteCount(nameToRemove) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(nameToRemove));
}
}
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
}
} }
} }