本文整理汇总了C#中IPacket.CreateReader方法的典型用法代码示例。如果您正苦于以下问题:C# IPacket.CreateReader方法的具体用法?C# IPacket.CreateReader怎么用?C# IPacket.CreateReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPacket
的用法示例。
在下文中一共展示了IPacket.CreateReader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
int guildId = reader.ReadInt32();
var guild = new Guild
{
Id = guildId,
Name = "guild"
};
IPacketBuilder responce = WorldPacketFactory.Build(
WMSG.SMSG_GUILD_QUERY_RESPONSE,
writer =>
{
writer.Write(guild.Id);
writer.WriteCString(guild.Name);
foreach (GuildRank rank in guild.Ranks)
writer.WriteCString(rank.Name);
for (int i = 0; i < 10 - guild.Ranks.Count; i++)
writer.WriteCString(string.Empty);
writer.Write(guild.Tabard.EmblemStyle);
writer.Write(guild.Tabard.EmblemColor);
writer.Write(guild.Tabard.BorderStyle);
writer.Write(guild.Tabard.BorderColor);
writer.Write(guild.Tabard.BackgroundColor);
writer.Write(0); // NEW 3.0.2
});
session.Send(responce);
}
示例2: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
byte castCount = reader.ReadByte();
uint spellId = reader.ReadUInt32();
byte unklags = reader.ReadByte();
IPacket pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_START);
BinaryWriter writer = pkt.CreateWriter();
writer.WritePackGuid(session.Player.Guid);
writer.WritePackGuid(session.Player.Guid);
writer.Write(castCount);
writer.Write(spellId);
writer.Write(0); //cast flags
writer.Write(0); //ticks count
writer.Write(0); //targetflags
session.Send(pkt);
Thread.Sleep(5000);
pkt = WorldPacketFactory.Create(WMSG.SMSG_SPELL_GO);
writer = pkt.CreateWriter();
writer.WritePackGuid(session.Player.Guid);
writer.WritePackGuid(session.Player.Guid);
writer.Write(castCount);
writer.Write(spellId);
writer.Write(0); //cast flags
writer.Write(0); //ticks count
writer.Write((byte)1); //hit count
writer.Write(session.Player.Guid);
writer.Write((byte)0); //miss count
writer.Write(0); // targetflags
session.Send(pkt);
}
示例3: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader r = packet.CreateReader();
uint unk1 = r.ReadUInt32();
session.SendRealmSplitPkt(unk1);
}
示例4: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
var type = (MessageType) reader.ReadUInt32();
uint language = reader.ReadUInt32();
string channel = type == MessageType.Channel || type == MessageType.Whisper
? reader.ReadCString()
: string.Empty;
string message = reader.ReadCString();
var pkt = WorldPacketFactory.Create(WMSG.SMSG_MESSAGECHAT);
var writer = pkt.CreateWriter();
writer.Write((byte)type);
writer.Write((uint)0);
writer.Write(session.Player.Guid);
writer.Write(0);
/*
if (target != null)
writer.WritePascalString(target);
*/
writer.Write((ulong)0);
writer.WritePascalString(message);
writer.Write((byte)0);
var players = ObjectManager.GetPlayersNear(session.Player);
foreach (var player in players)
{
player.Session.Send(pkt);
}
Console.WriteLine("{0} {1} {2} {3}", type, language, channel, message);
}
示例5: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
var reader = packet.CreateReader();
var guid = reader.ReadUInt64();
var questId = reader.ReadUInt32();
var a = reader.ReadByte();
}
示例6: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
ulong guid = reader.ReadUInt64();
Player player = session.Account.GetPlayer(guid);
session.Login(player);
}
示例7: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader r = packet.CreateReader();
uint creatureId = r.ReadUInt32();
CreatureTemplate creature = IoC.Resolve<ICreatureTemplateRepository>().FindById(creatureId);
if(creature != null) {
session.SendCreatureQueryResponce(creature);
}
}
示例8: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader r = packet.CreateReader();
uint itemId = r.ReadUInt32();
ItemTemplate template = IoC.Resolve<IItemTemplateRepository>().FindById(itemId);
if(template != null) {
session.SendItemQuerySingleResponse(template);
}
}
示例9: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
uint id = reader.ReadUInt32();
GameObjectTemplate template = IoC.Resolve<IGameObjectTemplateRepository>().FindById(id);
if(template != null) {
session.SendGameObjectQueryResponce(template);
}
}
示例10: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
var type = (AccountDataType)reader.ReadUInt32();
ulong guid = session.Player != null ? session.Player.Guid : 0;
AccpuntData accpuntData = session.Account.FindAccpuntData(type, guid);
session.Send(GetUpdateAccountDataPkt(accpuntData));
}
示例11: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
byte srcSlot = reader.ReadByte();
byte dstSlot = reader.ReadByte();
Player player = session.Player;
SwapItems(player.Inventory, srcSlot, player.Inventory, dstSlot);
}
示例12: GetMoveResponce
private static IPacket GetMoveResponce(IPacket packet)
{
BinaryReader reader = packet.CreateReader();
reader.BaseStream.Seek(0, SeekOrigin.Begin);
byte[] bytes = reader.ReadBytes(packet.Size);
IPacket responce = WorldPacketFactory.Create((WMSG)packet.Code);
BinaryWriter w = responce.CreateWriter();
w.Write(bytes);
return responce;
}
示例13: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
uint textId = reader.ReadUInt32();
ulong targetGuid = reader.ReadUInt64();
NpcTexts text = IoC.Resolve<INpcTextRepository>().FindById(textId);
if(text != null) {
session.SendNpcTextUpdate(text);
}
}
示例14: Dispatch
public void Dispatch(ISession session, IPacket packet)
{
BinaryReader reader = packet.CreateReader();
ulong targetGuid = reader.ReadUInt64();
uint unk1 = reader.ReadUInt32();
uint option = reader.ReadUInt32();
if(option==1) {
session.Player.Health = 0;
}else {
session.SendShowBank(targetGuid);
}
}
示例15: Dispatch
public void Dispatch(ISession client, IPacket packet)
{
Player me = client.Player;
Session.SendNearExceptMe(me, GetMoveResponce(packet));
BinaryReader reader = packet.CreateReader();
reader.BaseStream.Seek(0, SeekOrigin.Begin);
ulong guid = reader.ReadPackGuid();
if(guid != me.Guid) {
throw new Exception();
}
me.MovementInfo.Read(reader);
}