本文整理汇总了C#中Framework.Network.Packets.PacketWriter.WriteUInt32Pos方法的典型用法代码示例。如果您正苦于以下问题:C# PacketWriter.WriteUInt32Pos方法的具体用法?C# PacketWriter.WriteUInt32Pos怎么用?C# PacketWriter.WriteUInt32Pos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework.Network.Packets.PacketWriter
的用法示例。
在下文中一共展示了PacketWriter.WriteUInt32Pos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleCliQueryNPCText
public static void HandleCliQueryNPCText(ref PacketReader packet, ref WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
byte[] guidMask = { 4, 7, 3, 6, 0, 1, 5, 2 };
byte[] guidBytes = { 5, 6, 7, 1, 2, 3, 0, 4 };
var gossipTextId = packet.Read<int>();
var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));
if (gossipData != null)
{
PacketWriter queryNPCTextResponse = new PacketWriter(ServerMessage.QueryNPCTextResponse);
BitPack BitPack = new BitPack(queryNPCTextResponse);
queryNPCTextResponse.WriteInt32(gossipTextId);
queryNPCTextResponse.WriteInt32(0);
queryNPCTextResponse.WriteFloat(1);
for (int i = 0; i < 7; i++)
queryNPCTextResponse.WriteUInt32(0);
queryNPCTextResponse.WriteInt32(gossipData.BroadCastText.Id);
for (int i = 0; i < 7; i++)
queryNPCTextResponse.WriteUInt32(0);
BitPack.Write(1);
BitPack.Flush();
var size = (uint)queryNPCTextResponse.BaseStream.Length - 13;
queryNPCTextResponse.WriteUInt32Pos(size, 8);
session.Send(ref queryNPCTextResponse);
}
}
示例2: HandleQueryGameObject
public static void HandleQueryGameObject(ref PacketReader packet, ref WorldClass session)
{
byte[] guidMask = { 4, 6, 7, 5, 3, 2, 1, 0 };
byte[] guidBytes = { 0, 2, 3, 5, 6, 1, 4, 7 };
BitUnpack BitUnpack = new BitUnpack(packet);
var hasData = false;
var id = packet.Read<int>();
var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
PacketWriter queryGameObjectResponse = new PacketWriter(ServerMessage.QueryGameObjectResponse);
BitPack BitPack = new BitPack(queryGameObjectResponse);
GameObject gObject = DataMgr.FindGameObject(id);
if (hasData = (gObject != null))
{
GameObjectStats stats = gObject.Stats;
BitPack.Write(hasData);
BitPack.Flush();
queryGameObjectResponse.WriteInt32(stats.Id);
queryGameObjectResponse.WriteInt32(0);
queryGameObjectResponse.WriteInt32(stats.Type);
queryGameObjectResponse.WriteInt32(stats.DisplayInfoId);
queryGameObjectResponse.WriteCString(stats.Name);
for (int i = 0; i < 3; i++)
queryGameObjectResponse.WriteCString("");
queryGameObjectResponse.WriteCString(stats.IconName);
queryGameObjectResponse.WriteCString(stats.CastBarCaption);
queryGameObjectResponse.WriteCString("");
foreach (var v in stats.Data)
queryGameObjectResponse.WriteInt32(v);
queryGameObjectResponse.WriteFloat(stats.Size);
queryGameObjectResponse.WriteUInt8((byte)stats.QuestItemId.Count);
foreach (var v in stats.QuestItemId)
queryGameObjectResponse.WriteInt32(v);
queryGameObjectResponse.WriteInt32(stats.ExpansionRequired);
var size = (uint)queryGameObjectResponse.BaseStream.Length - 13;
queryGameObjectResponse.WriteUInt32Pos(size, 9);
session.Send(ref queryGameObjectResponse);
}
else
{
BitPack.Write(hasData);
Log.Message(LogType.DEBUG, "Gameobject (Id: {0}) not found.", id);
}
}