project-meteor-server/FFXIVClassic Map Server/packets/send/events/KickEventPacket.cs
Tahir Akhlaq 335a59204c Merge branch 'master' of https://bitbucket.org/Ioncannon/ffxiv-classic-server into method_casing
# Conflicts:
#	FFXIVClassic Map Server/CommandProcessor.cs
#	FFXIVClassic Map Server/WorldManager.cs
#	FFXIVClassic Map Server/actors/area/Area.cs
#	FFXIVClassic Map Server/actors/area/PrivateArea.cs
#	FFXIVClassic Map Server/actors/area/Zone.cs
#	FFXIVClassic Map Server/actors/chara/npc/Npc.cs
#	FFXIVClassic Map Server/common/Utils.cs
#	FFXIVClassic Map Server/dataobjects/ConnectedPlayer.cs
2016-06-14 22:54:02 +01:00

42 lines
1.4 KiB
C#

using FFXIVClassic_Map_Server.lua;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace FFXIVClassic_Map_Server.packets.send.events
{
class KickEventPacket
{
public const ushort OPCODE = 0x012F;
public const uint PACKET_SIZE = 0x90;
public static SubPacket BuildPacket(uint playerActorId, uint tarGetActorId, string conditionName, List<LuaParam> luaParams)
{
byte[] data = new byte[PACKET_SIZE - 0x20];
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt32)playerActorId);
binWriter.Write((UInt32)tarGetActorId);
binWriter.Write((Byte)0x5);
binWriter.Write((Byte)0x87);
binWriter.Write((Byte)0xDC);
binWriter.Write((Byte)0x75);
binWriter.Write((UInt32)0x30400000);
binWriter.Write(Encoding.ASCII.GetBytes(conditionName), 0, Encoding.ASCII.GetByteCount(conditionName) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(conditionName));
binWriter.Seek(0x30, SeekOrigin.Begin);
LuaUtils.WriteLuaParams(binWriter, luaParams);
}
}
return new SubPacket(OPCODE, playerActorId, playerActorId, data);
}
}
}