本文整理汇总了C#中BitPack.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# BitPack.Flush方法的具体用法?C# BitPack.Flush怎么用?C# BitPack.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitPack
的用法示例。
在下文中一共展示了BitPack.Flush方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleSendKnownSpells
public static void HandleSendKnownSpells(ref WorldClass session)
{
Character pChar = session.Character;
var specializationSpells = SpecializationMgr.GetSpecializationSpells(pChar);
var specializationSpellCount = ((specializationSpells != null) ? specializationSpells.Count : 0);
var talentSpells = SpecializationMgr.GetTalentSpells(pChar, pChar.ActiveSpecGroup);
var talentSpellCount = ((talentSpells != null) ? talentSpells.Count : 0);
int count = pChar.SpellList.Count + specializationSpellCount + talentSpellCount;
PacketWriter writer = new PacketWriter(ServerMessage.SendKnownSpells);
BitPack BitPack = new BitPack(writer);
BitPack.Write(1);
BitPack.Write(count, 22);
BitPack.Flush();
pChar.SpellList.ForEach(spell =>
writer.WriteUInt32(spell.SpellId));
if (specializationSpells != null)
specializationSpells.ForEach(spell => writer.WriteUInt32(spell.Spell));
if (talentSpells != null)
talentSpells.ForEach(spell => writer.WriteUInt32(spell));
session.Send(ref writer);
}
示例2: 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);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: HandleLearnedSpells
public static void HandleLearnedSpells(ref WorldClass session, List<uint> newSpells)
{
PacketWriter writer = new PacketWriter(ServerMessage.LearnedSpells);
BitPack BitPack = new BitPack(writer);
BitPack.Write<int>(newSpells.Count, 22);
BitPack.Write(0);
BitPack.Flush();
for (int i = 0; i < newSpells.Count; i++)
writer.WriteUInt32(newSpells[i]);
session.Send(ref writer);
}
示例6: 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;
}
示例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: 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;
}
示例9: HandleSendKnownSpells
public static void HandleSendKnownSpells(ref WorldClass session)
{
Character pChar = session.Character;
PacketWriter writer = new PacketWriter(JAMCMessage.SendKnownSpells);
BitPack BitPack = new BitPack(writer);
BitPack.Write<uint>((uint)pChar.SpellList.Count, 24);
BitPack.Write(1);
BitPack.Flush();
pChar.SpellList.ForEach(spell =>
writer.WriteUInt32(spell.SpellId));
session.Send(ref writer);
}
示例10: HandleLogoutRequest
public static void HandleLogoutRequest(ref PacketReader packet, WorldClass session)
{
PacketWriter logoutResponse = new PacketWriter(ServerMessage.LogoutResponse);
BitPack BitPack = new BitPack(logoutResponse);
logoutResponse.WriteUInt8(0);
BitPack.Write(0);
BitPack.Flush();
session.Send(ref logoutResponse);
Task.Delay(20000).ContinueWith(_ => HandleLogoutComplete(session), (cts = new CancellationTokenSource()).Token);
session.Character.setStandState(1);
MoveHandler.HandleMoveRoot(session);
}
示例11: 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);
}
示例12: SendSendKnownSpells
public static void SendSendKnownSpells()
{
Character pChar = GetSession().Character;
if (pChar.SpellList.Count == 0)
SpellMgr.LoadSpells();
PacketWriter writer = new PacketWriter(LegacyMessage.SendKnownSpells);
BitPack BitPack = new BitPack(writer);
BitPack.Write(1);
BitPack.Write<uint>((uint)pChar.SpellList.Count, 24);
BitPack.Flush();
pChar.SpellList.ForEach(spell =>
writer.WriteUInt32(spell.SpellId));
GetSession().Send(writer);
}
示例13: 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);
}
示例14: HandleRealmSplit
public static void HandleRealmSplit(ref PacketReader packet, WorldClass session)
{
uint realmSplitState = 0;
var date = "01/01/01";
PacketWriter realmSplit = new PacketWriter(ServerMessage.RealmSplit);
BitPack BitPack = new BitPack(realmSplit);
realmSplit.WriteUInt32(packet.Read<uint>());
realmSplit.WriteUInt32(realmSplitState);
BitPack.Write(date.Length, 7);
BitPack.Flush();
realmSplit.WriteString(date);
session.Send(ref realmSplit);
AddonHandler.WriteAddonData(session);
}
示例15: 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);
}
}