本文整理汇总了C#中Packet.ReadGuid方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.ReadGuid方法的具体用法?C# Packet.ReadGuid怎么用?C# Packet.ReadGuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.ReadGuid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleChannelList
public static void HandleChannelList(Packet packet)
{
packet.ReadByte("Channel Type");
packet.ReadCString("Channel Name");
packet.ReadByte("Channel Flags");
var listSize = packet.ReadInt32("List Size");
for (int i = 0; i < listSize; i++)
{
packet.ReadGuid("Player GUID");
packet.ReadByte("Player Flags");
}
}
示例2: HandleUpdateAccountData
public static void HandleUpdateAccountData(Packet packet)
{
packet.ReadGuid("GUID");
packet.ReadEnum<AccountDataType>("Type");
packet.ReadTime("Time");
int inflatedSize = packet.ReadInt32("Size");
byte[] compressedData = packet.ReadBytes((int)packet.GetLength() - (int)packet.GetPosition());
byte[] data = new byte[inflatedSize];
var inflater = new Inflater();
inflater.SetInput(compressedData, 0, compressedData.Length);
inflater.Inflate(data, 0, inflatedSize);
Console.WriteLine("Data: {0}", encoder.GetString(data));
}
示例3: HandleDestroyObject
public static void HandleDestroyObject(Packet packet)
{
packet.ReadGuid("GUID");
packet.ReadBoolean("Despawn Animation");
}
示例4: ReadMovementUpdateBlock
public static MovementInfo ReadMovementUpdateBlock(Packet packet, Guid guid)
{
var moveInfo = new MovementInfo();
var flags = packet.ReadEnum<UpdateFlag>("Update Flags");
if (flags.HasFlag(UpdateFlag.Living))
{
moveInfo = MovementHandler.ReadMovementInfo(packet, guid);
var moveFlags = moveInfo.Flags;
for (var i = 0; i < 9; i++)
{
var j = (SpeedType)i;
var speed = packet.ReadSingle();
Console.WriteLine(j + " Speed: " + speed);
switch (j)
{
case SpeedType.Walk:
{
moveInfo.WalkSpeed = speed / 2.5f;
break;
}
case SpeedType.Run:
{
moveInfo.RunSpeed = speed / 7.0f;
break;
}
}
}
if (moveFlags.HasFlag(MoveFlag.SplineEnabled))
{
var splineFlags = packet.ReadEnum<SplineFlag>("Spline Flags");
if (splineFlags.HasFlag(SplineFlag.FinalPoint))
packet.ReadVector3("Final Spline Coords");
if (splineFlags.HasFlag(SplineFlag.FinalTarget))
packet.ReadGuid("Final Spline Target GUID");
if (splineFlags.HasFlag(SplineFlag.FinalOrientation))
packet.ReadSingle("Final Spline Orientation");
packet.ReadInt32("Spline Time");
packet.ReadInt32("Spline Full Time");
packet.ReadInt32("Spline Unk Int32 1");
packet.ReadSingle("Spline Duration Multiplier");
packet.ReadSingle("Spline Unit Interval");
packet.ReadSingle("Spline Unk Float 2");
packet.ReadInt32("Spline Height Time");
var splineCount = packet.ReadInt32("Spline Count");
for (var i = 0; i < splineCount; i++)
packet.ReadVector3("Spline Waypoint " + i);
packet.ReadEnum<SplineMode>("Spline Mode");
packet.ReadVector3("Spline Endpoint");
}
}
else
{
if (flags.HasFlag(UpdateFlag.GOPosition))
{
packet.ReadPackedGuid("GO Position GUID");
var gopos = packet.ReadVector3("GO Position");
packet.ReadVector3("GO Transport Position");
var goFacing = packet.ReadSingle("GO Orientation");
moveInfo.Position = gopos;
moveInfo.Orientation = goFacing;
packet.ReadSingle("GO Transport Orientation");
}
else if (flags.HasFlag(UpdateFlag.StationaryObject))
packet.ReadVector4("Stationary Position");
}
if (flags.HasFlag(UpdateFlag.LowGuid))
packet.ReadInt32("Low GUID");
if (flags.HasFlag(UpdateFlag.AttackingTarget))
packet.ReadPackedGuid("Target GUID");
if (flags.HasFlag(UpdateFlag.Transport))
packet.ReadInt32("Transport Creation Time");
if (flags.HasFlag(UpdateFlag.Vehicle))
{
packet.ReadInt32("Vehicle ID");
packet.ReadSingle("Vehicle Orientation");
}
if (flags.HasFlag(UpdateFlag.GORotation))
packet.ReadPackedQuaternion("GO Rotation");
if (flags.HasFlag(UpdateFlag.Unknown2))
{
packet.ReadInt16("Unk Int16 1");
packet.ReadInt16("Unk Int16 2");
packet.ReadInt16("Unk Int16 3");
//.........这里部分代码省略.........
示例5: HandleMessageChat
public static void HandleMessageChat(Packet packet)
{
var type = packet.ReadEnum<ChatMessageType>("Type");
packet.ReadEnum<Language>("Language");
packet.ReadGuid("GUID");
packet.ReadInt32("Unk Int32");
switch (type)
{
case ChatMessageType.Say:
case ChatMessageType.Yell:
case ChatMessageType.Party:
case ChatMessageType.PartyLeader:
case ChatMessageType.Raid:
case ChatMessageType.RaidLeader:
case ChatMessageType.RaidWarning:
case ChatMessageType.Guild:
case ChatMessageType.Officer:
case ChatMessageType.Emote:
case ChatMessageType.TextEmote:
case ChatMessageType.Whisper:
case ChatMessageType.WhisperInform:
case ChatMessageType.System:
case ChatMessageType.Channel:
case ChatMessageType.Battleground:
case ChatMessageType.BattlegroundNeutral:
case ChatMessageType.BattlegroundAlliance:
case ChatMessageType.BattlegroundHorde:
case ChatMessageType.BattlegroundLeader:
case ChatMessageType.Achievement:
case ChatMessageType.GuildAchievement:
{
if (type == ChatMessageType.Channel)
packet.ReadCString("Channel Name");
packet.ReadGuid("Sender GUID");
break;
}
case ChatMessageType.MonsterSay:
case ChatMessageType.MonsterYell:
case ChatMessageType.MonsterParty:
case ChatMessageType.MonsterEmote:
case ChatMessageType.MonsterWhisper:
case ChatMessageType.RaidBossEmote:
case ChatMessageType.RaidBossWhisper:
case ChatMessageType.BattleNet:
{
packet.ReadInt32("Name Length");
packet.ReadCString("Name");
var target = packet.ReadGuid("Receiver GUID");
break;
}
}
packet.ReadInt32("Text Length");
packet.ReadCString("Text");
packet.ReadEnum<ChatTag>("Chat Tag");
if (type != ChatMessageType.Achievement && type != ChatMessageType.GuildAchievement)
return;
packet.ReadInt32("Achievement ID");
}
示例6: HandleEmote
public static void HandleEmote(Packet packet)
{
packet.ReadInt32("Emote");
packet.ReadGuid("GUID");
}
示例7: HandleTextEmote
public static void HandleTextEmote(Packet packet)
{
packet.ReadGuid("GUID");
packet.ReadInt32("Text Emote");
packet.ReadInt32("Emote #");
packet.ReadInt32("Name Length");
packet.ReadCString("Name");
}
示例8: ParseMonsterMovePackets
public static void ParseMonsterMovePackets(Packet packet)
{
var guid = packet.ReadPackedGuid("GUID");
if (packet.GetOpcode() == (ushort)Opcode.SMSG_MONSTER_MOVE_TRANSPORT)
{
packet.ReadPackedGuid("Transport GUID");
packet.ReadByte("Transport Seat");
}
packet.ReadBoolean("Unk Boolean");
var pos = packet.ReadVector3("Position");
packet.ReadInt32("Move Ticks");
var type = packet.ReadEnum<SplineType>("Spline Type");
switch (type)
{
case SplineType.FacingSpot:
{
packet.ReadVector3("Facing Spot");
break;
}
case SplineType.FacingTarget:
{
packet.ReadGuid("Facing GUID");
break;
}
case SplineType.FacingAngle:
{
packet.ReadSingle("Facing Angle");
break;
}
case SplineType.Stop:
{
return;
}
}
var flags = packet.ReadEnum<SplineFlag>("Spline Flags");
if (flags.HasFlag(SplineFlag.Unknown3)) {
packet.ReadEnum<MoveAnimationState>("Animation State");
packet.ReadInt32("Unk Int32 1");
}
packet.ReadInt32("Move Time");
if (flags.HasFlag(SplineFlag.Trajectory)) {
packet.ReadSingle("Unk Single");
packet.ReadInt32("Unk Int32 2");
}
var waypoints = packet.ReadInt32("Waypoints");
var newpos = packet.ReadVector3("Waypoint 0");
if (flags.HasFlag(SplineFlag.Flying) || flags.HasFlag(SplineFlag.CatmullRom)) {
for (var i = 0; i < waypoints - 1; i++) {
packet.ReadVector3("Waypoint " + (i + 1));
}
}
else {
var mid = new Vector3();
mid.X = (pos.X + newpos.X) * 0.5f;
mid.Y = (pos.Y + newpos.Y) * 0.5f;
mid.Z = (pos.Z + newpos.Z) * 0.5f;
for (var i = 0; i < waypoints - 1; i++) {
var vec = packet.ReadPackedVector3();
vec.X += mid.X;
vec.Y += mid.Y;
vec.Z += mid.Z;
Console.WriteLine("Waypoint " + (i + 1) + ": " + vec);
}
}
}
示例9: ReadMovementInfo
public static MovementInfo ReadMovementInfo(Packet packet, Guid guid)
{
bool HaveTransportData = false,
HaveTransportTime2 = false,
HaveTransportTime3 = false,
HavePitch = false,
HaveFallData = false,
HaveFallDirection = false,
HaveSplineElevation = false,
UnknownBool = false;
var info = new MovementInfo();
info.Flags = packet.ReadEnum<MoveFlag>("Movement Flags", 30);
var flags2 = packet.ReadEnum<MoveFlagExtra>("Extra Movement Flags", 12);
if (HaveTransportData = packet.ReadBit())
{
HaveTransportTime2 = packet.ReadBit();
HaveTransportTime3 = packet.ReadBit();
}
HavePitch = packet.ReadBit();
if (HaveFallData = packet.ReadBit())
HaveFallDirection = packet.ReadBit();
HaveSplineElevation = packet.ReadBit();
UnknownBool = packet.ReadBit();
packet.ReadGuid("GUID");
packet.ReadInt32("Time");
var pos = packet.ReadVector4("Position");
info.Position = new Vector3(pos.X, pos.Y, pos.Z);
info.Orientation = pos.O;
if (HaveTransportData)//info.Flags.HasFlag(MoveFlag.OnTransport))
{
packet.ReadGuid("Transport GUID");
packet.ReadVector4("Transport Position");
packet.ReadByte("Transport Seat");
packet.ReadInt32("Transport Time");
if (HaveTransportTime2)//flags2.HasFlag(MoveFlagExtra.InterpolatedPlayerMovement))
packet.ReadInt32("Transport Time 2");
if (HaveTransportTime3)
packet.ReadInt32("Transport Time 3");
}
if (HavePitch)//info.Flags.HasAnyFlag(MoveFlag.Swimming | MoveFlag.Flying) ||
//flags2.HasFlag(MoveFlagExtra.AlwaysAllowPitching))
packet.ReadSingle("Swim Pitch");
if (HaveFallData) // info.Flags.HasFlag(MoveFlag.Falling)
{
packet.ReadInt32("Fall Time");
packet.ReadSingle("Jump Velocity");
if (HaveFallDirection)
{
packet.ReadSingle("Jump Sin");
packet.ReadSingle("Jump Cos");
packet.ReadSingle("Jump XY Speed");
}
}
if (HaveSplineElevation) //info.Flags.HasFlag(MoveFlag.SplineElevation))
packet.ReadSingle("Spline Elevation");
return info;
}