本文整理汇总了C#中BitPack.WriteGuidMask方法的典型用法代码示例。如果您正苦于以下问题:C# BitPack.WriteGuidMask方法的具体用法?C# BitPack.WriteGuidMask怎么用?C# BitPack.WriteGuidMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitPack
的用法示例。
在下文中一共展示了BitPack.WriteGuidMask方法的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: 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;
}
示例3: 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);
}
}
示例4: 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);
}
示例5: 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;
}
示例6: 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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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);
}
示例10: HandleEnumCharactersResult
public static void HandleEnumCharactersResult(ref PacketReader packet, 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(ServerMessage.EnumCharactersResult);
BitPack BitPack = new BitPack(enumCharacters);
BitPack.Write(0, 21);
BitPack.Write(result.Count, 16);
for (int c = 0; c < result.Count; c++)
{
var name = result.Read<string>(c, "Name");
var loginCinematic = result.Read<bool>(c, "LoginCinematic");
BitPack.Guid = result.Read<ulong>(c, "Guid");
BitPack.GuildGuid = result.Read<ulong>(c, "GuildGuid");
BitPack.WriteGuidMask(0);
BitPack.WriteGuildGuidMask(4);
BitPack.WriteGuidMask(7);
BitPack.WriteGuildGuidMask(3, 7);
BitPack.WriteGuidMask(5, 4, 6);
BitPack.WriteGuildGuidMask(1);
BitPack.WriteGuidMask(3, 2);
BitPack.WriteGuildGuidMask(0, 2);
BitPack.WriteGuidMask(1);
BitPack.WriteGuildGuidMask(5);
BitPack.Write(loginCinematic);
BitPack.WriteGuildGuidMask(6);
BitPack.Write((uint)UTF8Encoding.UTF8.GetBytes(name).Length, 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<ulong>(c, "Guid");
BitPack.GuildGuid = result.Read<ulong>(c, "GuildGuid");
enumCharacters.WriteUInt32(result.Read<uint>(c, "PetLevel"));
enumCharacters.WriteUInt8(result.Read<byte>(c, "Level"));
BitPack.WriteGuildGuidBytes(2, 3);
//TODO: implement items
for (int j = 0; j < 23; j++)
{
enumCharacters.WriteUInt32(0);
enumCharacters.WriteUInt32(0);
enumCharacters.WriteUInt8(0);
}
BitPack.WriteGuildGuidBytes(6);
enumCharacters.WriteUInt8(0);
enumCharacters.WriteUInt8(result.Read<byte>(c, "HairStyle"));
enumCharacters.WriteUInt32(result.Read<uint>(c, "CustomizeFlags"));
enumCharacters.WriteUInt8(result.Read<byte>(c, "Class"));
BitPack.WriteGuildGuidBytes(7);
BitPack.WriteGuidBytes(0);
enumCharacters.WriteUInt32(result.Read<uint>(c, "PetFamily"));
BitPack.WriteGuildGuidBytes(1);
BitPack.WriteGuidBytes(3, 7, 2);
BitPack.WriteGuildGuidBytes(5);
enumCharacters.WriteUInt8(result.Read<byte>(c, "Gender"));
enumCharacters.WriteUInt32(result.Read<uint>(c, "PetDisplayId"));
enumCharacters.WriteUInt32(result.Read<uint>(c, "Zone"));
BitPack.WriteGuidBytes(6);
enumCharacters.WriteUInt8(result.Read<byte>(c, "HairColor"));
enumCharacters.WriteUInt8(result.Read<byte>(c, "FacialHair"));
enumCharacters.WriteString(name);
enumCharacters.WriteUInt8(result.Read<byte>(c, "Race"));
BitPack.WriteGuildGuidBytes(4);
enumCharacters.WriteUInt8(result.Read<byte>(c, "Skin"));
enumCharacters.WriteUInt32(result.Read<uint>(c, "Map"));
enumCharacters.WriteUInt32(result.Read<uint>(c, "CharacterFlags"));
enumCharacters.WriteFloat(result.Read<float>(c, "Y"));
BitPack.WriteGuildGuidBytes(0);
//.........这里部分代码省略.........
示例11: HandleMoveSetFlightSpeed
public static void HandleMoveSetFlightSpeed(ref WorldClass session, float speed = 7f)
{
PacketWriter setFlightSpeed = new PacketWriter(JAMCMessage.MoveSetFlightSpeed);
BitPack BitPack = new BitPack(setFlightSpeed, session.Character.Guid);
BitPack.WriteGuidMask(6, 1, 7, 4, 5, 3, 0, 2);
BitPack.Flush();
BitPack.WriteGuidBytes(0, 4, 6);
setFlightSpeed.WriteFloat(speed);
BitPack.WriteGuidBytes(7, 2);
setFlightSpeed.WriteUInt32(0);
BitPack.WriteGuidBytes(5, 1, 3);
session.Send(ref setFlightSpeed);
}
示例12: SendMessage
public static void SendMessage(ref WorldClass session, ChatMessageValues chatMessage)
{
byte[] GuidMask = { 4, 7, 6, 3, 0, 5, 1, 2 };
byte[] GuidMask3 = { 4, 0, 7, 2, 1, 5, 3, 6 };
byte[] GuidBytes = { 3, 5, 1, 4, 2, 6, 0, 7 };
byte[] GuidBytes3 = { 7, 6, 0, 3, 4, 1, 5, 2 };
var pChar = session.Character;
PacketWriter chat = new PacketWriter(ServerMessage.Chat);
BitPack BitPack = new BitPack(chat, pChar.Guid);
BitPack.Write(1);
BitPack.Write(!chatMessage.HasLanguage);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0);
BitPack.WriteGuidMask(GuidMask);
BitPack.Write(0);
BitPack.Write(0);
BitPack.Write(chatMessage.Message.Length, 12);
BitPack.Write(!chatMessage.HasRealmId);
BitPack.WriteGuidMask(GuidMask3);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Write(8, 9);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Flush();
BitPack.WriteGuidBytes(GuidBytes);
chat.WriteString(chatMessage.Message);
if (chatMessage.HasRealmId)
chat.WriteInt32(chatMessage.RealmId);
BitPack.WriteGuidBytes(GuidBytes3);
if (chatMessage.HasLanguage)
chat.WriteUInt8(chatMessage.Language);
chat.WriteUInt8((byte)chatMessage.ChatType);
switch (chatMessage.ChatType)
{
case MessageType.ChatMessageSay:
WorldMgr.SendByDist(pChar, chat, 625);
break;
case MessageType.ChatMessageYell:
WorldMgr.SendByDist(pChar, chat, 90000);
break;
default:
break;
}
}
示例13: 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;
}
}
示例14: HandleQueryPlayerName
public static void HandleQueryPlayerName(ref PacketReader packet, WorldClass session)
{
BitUnpack BitUnpack = new BitUnpack(packet);
var guidMask = new bool[8];
var guidBytes = new byte[8];
guidMask[1] = BitUnpack.GetBit();
guidMask[3] = BitUnpack.GetBit();
guidMask[6] = BitUnpack.GetBit();
guidMask[7] = BitUnpack.GetBit();
guidMask[2] = BitUnpack.GetBit();
guidMask[5] = BitUnpack.GetBit();
var hasUnknown = BitUnpack.GetBit();
guidMask[0] = BitUnpack.GetBit();
var hasUnknown2 = BitUnpack.GetBit();
guidMask[4] = BitUnpack.GetBit();
if (guidMask[4]) guidBytes[4] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[6]) guidBytes[6] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[7]) guidBytes[7] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[1]) guidBytes[1] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[2]) guidBytes[2] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[5]) guidBytes[5] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[0]) guidBytes[0] = (byte)(packet.Read<byte>() ^ 1);
if (guidMask[3]) guidBytes[3] = (byte)(packet.Read<byte>() ^ 1);
if (hasUnknown)
packet.Read<uint>();
if (hasUnknown2)
packet.Read<uint>();
var guid = BitConverter.ToUInt64(guidBytes, 0);
var pSession = WorldMgr.GetSession(guid);
if (pSession != null)
{
var pChar = pSession.Character;
if (pChar != null)
{
PacketWriter queryPlayerNameResponse = new PacketWriter(ServerMessage.QueryPlayerNameResponse);
BitPack BitPack = new BitPack(queryPlayerNameResponse, guid);
BitPack.WriteGuidMask(3, 2, 6, 0, 4, 1, 5, 7);
BitPack.Flush();
BitPack.WriteGuidBytes(7, 1, 2, 6, 3, 5);
queryPlayerNameResponse.WriteUInt8(0);
queryPlayerNameResponse.WriteUInt8(pChar.Gender);
queryPlayerNameResponse.WriteUInt8(pChar.Class);
queryPlayerNameResponse.WriteUInt8(pChar.Level);
queryPlayerNameResponse.WriteUInt32(1);
queryPlayerNameResponse.WriteUInt8(pChar.Race);
queryPlayerNameResponse.WriteUInt32(0);
BitPack.WriteGuidBytes(4, 0);
BitPack.WriteGuidMask(5);
BitPack.Write(0);
BitPack.Write(0);
BitPack.Write(0);
BitPack.WriteGuidMask(3, 7, 0, 6);
BitPack.Write(0);
BitPack.Write(0);
BitPack.WriteGuidMask(1);
BitPack.Write(0);
for (int i = 0; i < 5; i++)
BitPack.Write(0, 7);
BitPack.WriteGuidMask(2);
BitPack.Write(0);
BitPack.WriteGuidMask(4);
BitPack.Write(0);
BitPack.Write(pChar.Name.Length, 6);
BitPack.Write(0);
BitPack.Flush();
BitPack.WriteGuidBytes(0, 7, 5, 2);
queryPlayerNameResponse.WriteString(pChar.Name);
BitPack.WriteGuidBytes(4, 1, 3, 6);
session.Send(ref queryPlayerNameResponse);
}
}
}
示例15: 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);
}