本文整理汇总了C#中BitPack.WriteGuidBytes方法的典型用法代码示例。如果您正苦于以下问题:C# BitPack.WriteGuidBytes方法的具体用法?C# BitPack.WriteGuidBytes怎么用?C# BitPack.WriteGuidBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitPack
的用法示例。
在下文中一共展示了BitPack.WriteGuidBytes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleTalkToGossip
public static void HandleTalkToGossip(ref PacketReader packet, ref WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
byte[] guidMask = { 3, 1, 7, 4, 6, 0, 2, 5 };
byte[] guidBytes = { 0, 1, 7, 6, 5, 2, 4, 3 };
var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));
if (gossipData != null)
{
PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
BitPack BitPack = new BitPack(gossipMessage, guid);
BitPack.WriteGuidMask(0, 1);
BitPack.Write(0, 19); // gossipData.QuestsCount
BitPack.WriteGuidMask(2);
BitPack.Write(0, 20); // gossipData.OptionsCount
// QuestsCount not supported.
// for (int i = 0; i < gossipData.QuestsCount; i++)
BitPack.WriteGuidMask(3);
// OptionsCount not supported.
// for (int i = 0; i < gossipData.OptionsCount; i++)
BitPack.WriteGuidMask(5, 4, 6, 7);
BitPack.Flush();
BitPack.WriteGuidBytes(6);
// OptionsCount not supported.
// for (int i = 0; i < gossipData.OptionsCount; i++)
BitPack.WriteGuidBytes(0);
// QuestsCount not supported.
// for (int i = 0; i < gossipData.QuestsCount; i++)
gossipMessage.WriteInt32(gossipData.Id);
BitPack.WriteGuidBytes(4, 3);
gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
gossipMessage.WriteInt32(gossipData.TextID);
BitPack.WriteGuidBytes(7, 1, 5, 1);
session.Send(ref gossipMessage);
}
}
示例2: HandleMoveSetRunSpeed
public static void HandleMoveSetRunSpeed(ref WorldClass session, float speed = 7f)
{
PacketWriter setRunSpeed = new PacketWriter(JAMCMessage.MoveSetRunSpeed);
BitPack BitPack = new BitPack(setRunSpeed, session.Character.Guid);
BitPack.WriteGuidMask(0, 4, 1, 6, 3, 5, 7, 2);
BitPack.Flush();
setRunSpeed.WriteFloat(speed);
BitPack.WriteGuidBytes(7);
setRunSpeed.WriteUInt32(0);
BitPack.WriteGuidBytes(3, 6, 0, 4, 1, 5, 2);
session.Send(setRunSpeed);
}
示例3: HandleMoveSetFlightSpeed
public static void HandleMoveSetFlightSpeed(ref WorldClass session, float speed = 7f)
{
PacketWriter setFlightSpeed = new PacketWriter(ServerMessage.MoveSetFlightSpeed);
BitPack BitPack = new BitPack(setFlightSpeed, session.Character.Guid);
BitPack.WriteGuidMask(5, 4, 2, 1, 7, 6, 3, 0);
BitPack.Flush();
setFlightSpeed.WriteUInt32(0);
BitPack.WriteGuidBytes(5, 7);
setFlightSpeed.WriteFloat(speed);
BitPack.WriteGuidBytes(1, 2, 3, 6, 0, 4);
session.Send(ref setFlightSpeed);
}
示例4: HandleMoveSetRunSpeed
public static void HandleMoveSetRunSpeed(ref WorldClass session, float speed = 7f)
{
PacketWriter setRunSpeed = new PacketWriter(ServerMessage.MoveSetRunSpeed);
BitPack BitPack = new BitPack(setRunSpeed, session.Character.Guid);
BitPack.WriteGuidMask(6, 1, 2, 5, 0, 3, 7, 4);
BitPack.Flush();
BitPack.WriteGuidBytes(3, 0, 1, 5);
setRunSpeed.WriteFloat(speed);
BitPack.WriteGuidBytes(7, 4, 2);
setRunSpeed.WriteUInt32(0);
BitPack.WriteGuidBytes(6);
session.Send(ref setRunSpeed);
}
示例5: HandleTalkToGossip
public static void HandleTalkToGossip(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
byte[] guidMask = { 7, 3, 6, 5, 2, 1, 4, 0 };
byte[] guidBytes = { 3, 4, 6, 1, 0, 2, 7, 5 };
var guid = BitUnpack.GetPackedValue(guidMask, guidBytes);
var gossipData = GossipMgr.GetGossip<Creature>(SmartGuid.GetGuid(guid));
if (gossipData != null)
{
PacketWriter gossipMessage = new PacketWriter(ServerMessage.GossipMessage);
BitPack BitPack = new BitPack(gossipMessage, guid);
BitPack.WriteGuidMask(7, 6, 0);
BitPack.Write(0, 19); // gossipData.QuestsCount
BitPack.WriteGuidMask(4, 3, 2);
BitPack.Write(0, 20); // gossipData.OptionsCount
BitPack.WriteGuidMask(1, 5);
BitPack.Flush();
BitPack.WriteGuidBytes(2, 7);
gossipMessage.WriteInt32(gossipData.FriendshipFactionID);
BitPack.WriteGuidBytes(3, 1);
gossipMessage.WriteInt32(gossipData.TextID);
BitPack.WriteGuidBytes(5);
gossipMessage.WriteInt32(gossipData.Id);
BitPack.WriteGuidBytes(6, 4, 0);
session.Send(ref gossipMessage);
}
}
示例6: HandleMoveSetCanFly
public static void HandleMoveSetCanFly(ref WorldClass session)
{
PacketWriter setCanFly = new PacketWriter(JAMCMessage.MoveSetCanFly);
BitPack BitPack = new BitPack(setCanFly, session.Character.Guid);
BitPack.WriteGuidMask(7, 3, 1, 5, 0, 6, 2, 4);
BitPack.Flush();
setCanFly.WriteUInt32(0);
BitPack.WriteGuidBytes(2, 6, 7, 1, 3, 4, 6, 0);
session.Send(setCanFly);
}
示例7: HandleMoveSetCanFly
public static void HandleMoveSetCanFly(ref WorldClass session)
{
PacketWriter moveSetCanFly = new PacketWriter(ServerMessage.MoveSetCanFly);
BitPack BitPack = new BitPack(moveSetCanFly, session.Character.Guid);
BitPack.WriteGuidMask(5, 3, 0, 2, 4, 1, 6, 7);
BitPack.Flush();
BitPack.WriteGuidBytes(1, 3, 5, 0, 7, 2, 4, 6);
moveSetCanFly.WriteUInt32(0);
session.Send(ref moveSetCanFly);
}
示例8: HandleDestroyObject
public static PacketWriter HandleDestroyObject(ref WorldClass session, ulong guid)
{
PacketWriter destroyObject = new PacketWriter(ServerMessage.DestroyObject);
BitPack BitPack = new BitPack(destroyObject, guid);
BitPack.WriteGuidMask(1, 6, 5, 7, 4, 2, 0, 3);
BitPack.Write(0);
BitPack.Flush();
BitPack.WriteGuidBytes(7, 2, 6, 1, 3, 7, 5, 0);
return destroyObject;
}
示例9: HandleDestroyObject
public static PacketWriter HandleDestroyObject(ref WorldClass session, ulong guid, bool animation = false)
{
PacketWriter destroyObject = new PacketWriter(ServerMessage.DestroyObject);
BitPack BitPack = new BitPack(destroyObject, guid);
BitPack.WriteGuidMask(7, 2, 6, 3, 1, 4);
BitPack.Write(animation);
BitPack.WriteGuidMask(5, 0);
BitPack.Flush();
BitPack.WriteGuidBytes(4, 3, 2, 7, 0, 1, 6, 5);
return destroyObject;
}
示例10: SendMessage
public static void SendMessage(ref WorldClass session, ChatMessageValues chatMessage, WorldClass pSession = null)
{
byte[] GuidMask = { 4, 1, 3, 6, 2, 5, 0, 7 };
byte[] GuidMask3 = { 6, 1, 3, 5, 4, 2, 7, 0 };
byte[] GuidBytes = { 7, 4, 0, 6, 3, 2, 5, 1 };
byte[] GuidBytes3 = { 7, 4, 1, 3, 0, 6, 5, 2 };
var pChar = session.Character;
var guid = pChar.Guid;
if (pSession != null)
guid = pSession.Character.Guid;
PacketWriter chat = new PacketWriter(ServerMessage.Chat);
BitPack BitPack = new BitPack(chat, guid);
BitPack.Write(!chatMessage.HasLanguage);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Write(0);
BitPack.WriteGuidMask(GuidMask3);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(!chatMessage.HasRealmId);
BitPack.Write(0);
BitPack.WriteStringLength(chatMessage.Message, 12);
BitPack.Write(0);
BitPack.WriteGuidMask(GuidMask);
BitPack.Write(0);
BitPack.Write(8, 9);
BitPack.Flush();
BitPack.WriteGuidBytes(GuidBytes3);
if (chatMessage.HasLanguage)
chat.WriteUInt8(chatMessage.Language);
BitPack.WriteGuidBytes(GuidBytes);
chat.WriteString(chatMessage.Message, false);
chat.WriteUInt8((byte)chatMessage.ChatType);
chat.WriteInt32(0);
if (chatMessage.HasRealmId)
chat.WriteInt32(chatMessage.RealmId);
switch (chatMessage.ChatType)
{
case MessageType.ChatMessageSay:
WorldMgr.SendByDist(pChar, chat, 625);
break;
case MessageType.ChatMessageYell:
WorldMgr.SendByDist(pChar, chat, 90000);
break;
default:
session.Send(ref chat);
break;
}
}
示例11: HandleMoveUpdate
public static void HandleMoveUpdate(ulong guid, ObjectMovementValues movementValues, Vector4 vector)
{
PacketWriter moveUpdate = new PacketWriter(JAMCMessage.MoveUpdate);
BitPack BitPack = new BitPack(moveUpdate, guid);
BitPack.WriteGuidMask(0);
BitPack.Write(!movementValues.HasMovementFlags);
BitPack.Write(!movementValues.HasRotation);
BitPack.WriteGuidMask(2, 6);
BitPack.Write(!movementValues.HasMovementFlags2);
BitPack.WriteGuidMask(7);
BitPack.Write<uint>(0, 24);
BitPack.WriteGuidMask(1);
if (movementValues.HasMovementFlags)
BitPack.Write((uint)movementValues.MovementFlags, 30);
BitPack.WriteGuidMask(4);
BitPack.Write(!movementValues.IsAlive);
BitPack.Write(0);
if (movementValues.HasMovementFlags2)
BitPack.Write((uint)movementValues.MovementFlags2, 13);
BitPack.Write(0);
BitPack.WriteGuidMask(5);
BitPack.Write(true);
BitPack.Write(0);
BitPack.Write(movementValues.IsInterpolated);
BitPack.Write(0);
BitPack.Write(true);
BitPack.WriteGuidMask(3);
BitPack.Write(true);
if (movementValues.IsInterpolated)
BitPack.Write(movementValues.IsInterpolated2);
BitPack.Flush();
if (movementValues.IsInterpolated)
{
moveUpdate.WriteUInt32(0);
if (movementValues.IsInterpolated2)
{
moveUpdate.WriteFloat(0);
moveUpdate.WriteFloat(0);
moveUpdate.WriteFloat(0);
}
moveUpdate.WriteFloat(0);
}
if (movementValues.IsAlive)
moveUpdate.WriteUInt32(movementValues.Time);
BitPack.WriteGuidBytes(5, 7);
moveUpdate.WriteFloat(vector.Z);
BitPack.WriteGuidBytes(4, 3, 2, 6, 0);
moveUpdate.WriteFloat(vector.X);
if (movementValues.HasRotation)
moveUpdate.WriteFloat(vector.W);
moveUpdate.WriteFloat(vector.Y);
Character pChar = WorldMgr.GetSession(guid).Character;
ObjectMgr.SetPosition(ref pChar, vector, false);
WorldMgr.SendToAllInZone(guid, moveUpdate);
}
示例12: HandleMoveUnsetCanFly
public static void HandleMoveUnsetCanFly(ref WorldClass session)
{
PacketWriter unsetCanFly = new PacketWriter(JAMCMessage.MoveUnsetCanFly);
BitPack BitPack = new BitPack(unsetCanFly, session.Character.Guid);
unsetCanFly.WriteUInt32(0);
BitPack.WriteGuidMask(1, 4, 6, 2, 5, 7, 0, 3);
BitPack.Flush();
BitPack.WriteGuidBytes(3, 1, 5, 7, 0, 6, 2, 4);
session.Send(unsetCanFly);
}
示例13: HandleEnumCharactersResult
public static void HandleEnumCharactersResult(ref PacketReader packet, ref WorldClass session)
{
// Set existing character from last world session to null
session.Character = null;
DB.Realms.Execute("UPDATE accounts SET online = 1 WHERE id = ?", session.Account.Id);
SQLResult result = DB.Characters.Select("SELECT * FROM characters WHERE accountid = ?", session.Account.Id);
PacketWriter enumCharacters = new PacketWriter(JAMCMessage.EnumCharactersResult);
BitPack BitPack = new BitPack(enumCharacters);
BitPack.Write(0, 23);
BitPack.Write(result.Count, 17);
if (result.Count != 0)
{
for (int c = 0; c < result.Count; c++)
{
string name = result.Read<String>(c, "Name");
bool loginCinematic = result.Read<Boolean>(c, "LoginCinematic");
BitPack.Guid = result.Read<UInt64>(c, "Guid");
BitPack.GuildGuid = result.Read<UInt64>(c, "GuildGuid");
BitPack.WriteGuidMask(7, 0, 4);
BitPack.WriteGuildGuidMask(2);
BitPack.WriteGuidMask(5, 3);
BitPack.Write((uint)Encoding.ASCII.GetBytes(name).Length, 7);
BitPack.WriteGuildGuidMask(0, 5, 3);
BitPack.Write(loginCinematic);
BitPack.WriteGuildGuidMask(6, 7);
BitPack.WriteGuidMask(1);
BitPack.WriteGuildGuidMask(4, 1);
BitPack.WriteGuidMask(2, 6);
}
BitPack.Write(1);
BitPack.Flush();
for (int c = 0; c < result.Count; c++)
{
string name = result.Read<String>(c, "Name");
BitPack.Guid = result.Read<UInt64>(c, "Guid");
BitPack.GuildGuid = result.Read<UInt64>(c, "GuildGuid");
enumCharacters.WriteUInt32(result.Read<UInt32>(c, "CharacterFlags"));
enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetFamily"));
enumCharacters.WriteFloat(result.Read<Single>(c, "Z"));
BitPack.WriteGuidBytes(7);
BitPack.WriteGuildGuidBytes(6);
// Not implanted
for (int j = 0; j < 23; j++)
{
enumCharacters.WriteUInt32(0);
enumCharacters.WriteUInt8(0);
enumCharacters.WriteUInt32(0);
}
enumCharacters.WriteFloat(result.Read<Single>(c, "X"));
enumCharacters.WriteUInt8(result.Read<Byte>(c, "Class"));
BitPack.WriteGuidBytes(5);
enumCharacters.WriteFloat(result.Read<Single>(c, "Y"));
BitPack.WriteGuildGuidBytes(3);
BitPack.WriteGuidBytes(6);
enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetLevel"));
enumCharacters.WriteUInt32(result.Read<UInt32>(c, "PetDisplayId"));
BitPack.WriteGuidBytes(2);
BitPack.WriteGuidBytes(1);
enumCharacters.WriteUInt8(result.Read<Byte>(c, "HairColor"));
enumCharacters.WriteUInt8(result.Read<Byte>(c, "FacialHair"));
BitPack.WriteGuildGuidBytes(2);
enumCharacters.WriteUInt32(result.Read<UInt32>(c, "Zone"));
enumCharacters.WriteUInt8(0);
BitPack.WriteGuidBytes(0);
BitPack.WriteGuildGuidBytes(1);
enumCharacters.WriteUInt8(result.Read<Byte>(c, "Skin"));
BitPack.WriteGuidBytes(4);
BitPack.WriteGuildGuidBytes(5);
enumCharacters.WriteString(name);
BitPack.WriteGuildGuidBytes(0);
enumCharacters.WriteUInt8(result.Read<Byte>(c, "Level"));
BitPack.WriteGuidBytes(3);
//.........这里部分代码省略.........
示例14: HandleMoveTeleport
public static void HandleMoveTeleport(ref WorldClass session, Vector4 vector)
{
bool IsTransport = false;
bool Unknown = false;
PacketWriter moveTeleport = new PacketWriter(ServerMessage.MoveTeleport);
BitPack BitPack = new BitPack(moveTeleport, session.Character.Guid);
BitPack.WriteGuidMask(7);
BitPack.Write(Unknown);
BitPack.WriteGuidMask(2, 0);
if (Unknown)
{
BitPack.Write(0);
BitPack.Write(0);
}
BitPack.Write(IsTransport);
if (IsTransport)
BitPack.WriteTransportGuidMask(4, 3, 5, 7, 0, 2, 6, 1);
BitPack.WriteGuidMask(5, 1, 3, 6, 4);
BitPack.Flush();
BitPack.WriteGuidBytes(0);
if (IsTransport)
BitPack.WriteTransportGuidBytes(7, 6, 0, 2, 3, 1, 5, 4);
BitPack.WriteGuidBytes(6, 1);
moveTeleport.WriteUInt32(0);
BitPack.WriteGuidBytes(7, 5);
moveTeleport.WriteFloat(vector.X);
BitPack.WriteGuidBytes(4, 3, 2);
moveTeleport.WriteFloat(vector.Y);
moveTeleport.WriteFloat(vector.O);
moveTeleport.WriteFloat(vector.Z);
if (Unknown)
moveTeleport.WriteUInt8(0);
session.Send(ref moveTeleport);
}
示例15: HandleMoveSetSwimSpeed
public static void HandleMoveSetSwimSpeed(ref WorldClass session, float speed = 4.72222f)
{
PacketWriter setSwimSpeed = new PacketWriter(ServerMessage.MoveSetSwimSpeed);
BitPack BitPack = new BitPack(setSwimSpeed, session.Character.Guid);
BitPack.WriteGuidMask(6, 3, 1, 2, 0, 4, 7, 5);
BitPack.Flush();
BitPack.WriteGuidBytes(2);
setSwimSpeed.WriteFloat(speed);
BitPack.WriteGuidBytes(1, 6);
setSwimSpeed.WriteUInt32(0);
BitPack.WriteGuidBytes(3, 4, 0, 7, 5);
session.Send(ref setSwimSpeed);
}