2016-06-08 22:29:04 +01:00
|
|
|
|
using System;
|
2015-10-05 19:36:15 -04:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2016-08-22 10:43:04 -04:00
|
|
|
|
using FFXIVClassic.Common;
|
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.packets.send.actor
|
2015-10-05 19:36:15 -04:00
|
|
|
|
{
|
|
|
|
|
class SetActorNamePacket
|
|
|
|
|
{
|
|
|
|
|
public const ushort OPCODE = 0x013D;
|
|
|
|
|
public const uint PACKET_SIZE = 0x48;
|
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
public static SubPacket BuildPacket(uint sourceActorId, uint displayNameID, string customName)
|
2015-10-05 19:36:15 -04:00
|
|
|
|
{
|
|
|
|
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
|
|
|
|
|
|
|
|
|
using (MemoryStream mem = new MemoryStream(data))
|
|
|
|
|
{
|
|
|
|
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
|
|
|
|
{
|
|
|
|
|
binWriter.Write((UInt32)displayNameID);
|
|
|
|
|
|
2016-03-30 20:15:21 -04:00
|
|
|
|
if (customName != null && (displayNameID == 0 || displayNameID == 0xFFFFFFFF))
|
2015-10-05 19:36:15 -04:00
|
|
|
|
{
|
2016-01-02 18:17:03 -05:00
|
|
|
|
binWriter.Write(Encoding.ASCII.GetBytes(customName), 0, Encoding.ASCII.GetByteCount(customName) >= 0x20 ? 0x19 : Encoding.ASCII.GetByteCount(customName));
|
2015-10-05 19:36:15 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-27 13:23:05 -04:00
|
|
|
|
SubPacket packet = new SubPacket(OPCODE, sourceActorId, data);
|
2015-10-05 19:36:15 -04:00
|
|
|
|
return packet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|